MCPcopy Create free account
hub / github.com/Effect-TS/effect / write

Function write

packages/effect/src/encoding/SchemaBinary.ts:697–706  ·  view source on GitHub ↗
(
    values: ReadonlyArray<unknown>
  )

Source from the content-addressed store, hash-verified

695 const parseOptions: SchemaAST.ParseOptions = options ?? SchemaAST.defaultParseOptions
696 const mode = compileMode(layout, options?.fingerprint)
697 const write = (
698 values: ReadonlyArray<unknown>
699 ): Effect.Effect<Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>, Schema.SchemaError> => {
700 try {
701 return Effect.succeed(Arr.of(encodeFrames(layout, values, parseOptions, mode)))
702 } catch (e) {
703 if (e instanceof IssueError) return Effect.fail(new Schema.SchemaError(e.issue))
704 return Effect.die(e)
705 }
706 }
707 if (exact && parseOptions.onExcessProperty !== "error") {
708 return Channel.fromTransform((upstream, _scope) => Effect.sync(() => Effect.flatMap(upstream, write)))
709 }

Callers

nothing calls this directly

Calls 4

encodeFramesFunction · 0.85
ofMethod · 0.65
failMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected