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

Function feed

packages/effect/src/encoding/SchemaBinary.ts:790–810  ·  view source on GitHub ↗
(
        chunk: Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>
      )

Source from the content-addressed store, hash-verified

788 }
789
790 const feed = (
791 chunk: Arr.NonEmptyReadonlyArray<Uint8Array<ArrayBuffer>>
792 ): Pull.Pull<Arr.NonEmptyReadonlyArray<S["Type"]>, Schema.SchemaError | IE, Done> => {
793 const raw: Array<unknown> = []
794 try {
795 for (let i = 0; i < chunk.length; i++) {
796 const values = frames.feedSync(chunk[i])
797 for (let j = 0; j < values.length; j++) raw.push(values[j])
798 }
799 } catch (e) {
800 if (!Schema.isSchemaError(e)) return Effect.die(e)
801 if (raw.length === 0) return Effect.fail(e)
802 // Emit the values framed before the failure, then fail on the next
803 // pull.
804 stashed = e
805 }
806 if (!Arr.isReadonlyArrayNonEmpty(raw)) return pull
807 return decodeEncoded === undefined
808 ? Effect.succeed(raw as Arr.NonEmptyReadonlyArray<S["Type"]>)
809 : decodeAll(raw)
810 }
811
812 const pull: Pull.Pull<Arr.NonEmptyReadonlyArray<S["Type"]>, Schema.SchemaError | IE, Done> = Effect.suspend(() =>
813 stashed !== undefined ? Effect.fail(stashed) : Pull.matchEffect(upstream, {

Callers

nothing calls this directly

Calls 5

decodeAllFunction · 0.85
feedSyncMethod · 0.80
pushMethod · 0.65
failMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected