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

Function rebaseIssue

packages/effect/src/encoding/Csv.ts:585–599  ·  view source on GitHub ↗
(error: Schema.SchemaError, record: (index: number) => number)

Source from the content-addressed store, hash-verified

583// Rewrites the chunk index at the head of each top-level issue path to the
584// record number, keeping the rest of the issue unchanged.
585const rebaseIssue = (error: Schema.SchemaError, record: (index: number) => number): Schema.SchemaError => {
586 const issue = error.issue
587 if (issue._tag !== "Composite") return error
588 return new Schema.SchemaError(
589 new SchemaIssue.Composite(
590 issue.ast,
591 Arr.map(issue.issues, (issue) =>
592 issue._tag === "Pointer" && typeof issue.path[0] === "number"
593 ? new SchemaIssue.Pointer([record(issue.path[0]), ...issue.path.slice(1)], issue.issue)
594 : issue),
595 issue.input,
596 { reportInput: "input" in issue }
597 )
598 )
599}
600
601// Derived codecs are new ASTs, and schema parsers are cached per AST, so they
602// are memoized to avoid recompiling parsers for every channel.

Callers 2

decodeSchemaStringFunction · 0.85
encodeSchemaRecordsFunction · 0.85

Calls 3

sliceMethod · 0.80
recordFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected