@aeye/core 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -4
- package/aeye-core-schema.md +11 -7
- package/dist/common.d.ts +30 -5
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +134 -129
- package/dist/common.js.map +1 -1
- package/dist/delivery.d.ts +39 -0
- package/dist/delivery.d.ts.map +1 -0
- package/dist/delivery.js +127 -0
- package/dist/delivery.js.map +1 -0
- package/dist/errors.d.ts +60 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +84 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/prompt.d.ts +101 -9
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +163 -141
- package/dist/prompt.js.map +1 -1
- package/dist/schema/analyze.d.ts +94 -0
- package/dist/schema/analyze.d.ts.map +1 -0
- package/dist/schema/analyze.js +221 -0
- package/dist/schema/analyze.js.map +1 -0
- package/dist/schema/any-value.d.ts +32 -0
- package/dist/schema/any-value.d.ts.map +1 -0
- package/dist/schema/any-value.js +77 -0
- package/dist/schema/any-value.js.map +1 -0
- package/dist/schema/budget.d.ts +114 -0
- package/dist/schema/budget.d.ts.map +1 -0
- package/dist/schema/budget.js +223 -0
- package/dist/schema/budget.js.map +1 -0
- package/dist/schema/consistency.d.ts +27 -0
- package/dist/schema/consistency.d.ts.map +1 -0
- package/dist/schema/consistency.js +110 -0
- package/dist/schema/consistency.js.map +1 -0
- package/dist/schema/cycle-breaker.d.ts +14 -0
- package/dist/schema/cycle-breaker.d.ts.map +1 -0
- package/dist/schema/cycle-breaker.js +157 -0
- package/dist/schema/cycle-breaker.js.map +1 -0
- package/dist/schema/decode.d.ts +31 -0
- package/dist/schema/decode.d.ts.map +1 -0
- package/dist/schema/decode.js +207 -0
- package/dist/schema/decode.js.map +1 -0
- package/dist/schema/descriptor.d.ts +300 -0
- package/dist/schema/descriptor.d.ts.map +1 -0
- package/dist/schema/descriptor.js +15 -0
- package/dist/schema/descriptor.js.map +1 -0
- package/dist/schema/dialects/anthropic.d.ts +34 -0
- package/dist/schema/dialects/anthropic.d.ts.map +1 -0
- package/dist/schema/dialects/anthropic.js +77 -0
- package/dist/schema/dialects/anthropic.js.map +1 -0
- package/dist/schema/dialects/google.d.ts +47 -0
- package/dist/schema/dialects/google.d.ts.map +1 -0
- package/dist/schema/dialects/google.js +91 -0
- package/dist/schema/dialects/google.js.map +1 -0
- package/dist/schema/dialects/lenient.d.ts +4 -0
- package/dist/schema/dialects/lenient.d.ts.map +1 -0
- package/dist/schema/dialects/lenient.js +26 -0
- package/dist/schema/dialects/lenient.js.map +1 -0
- package/dist/schema/dialects/openai.d.ts +40 -0
- package/dist/schema/dialects/openai.d.ts.map +1 -0
- package/dist/schema/dialects/openai.js +81 -0
- package/dist/schema/dialects/openai.js.map +1 -0
- package/dist/schema/dialects/xai.d.ts +23 -0
- package/dist/schema/dialects/xai.d.ts.map +1 -0
- package/dist/schema/dialects/xai.js +53 -0
- package/dist/schema/dialects/xai.js.map +1 -0
- package/dist/schema/enum-values.d.ts +44 -0
- package/dist/schema/enum-values.d.ts.map +1 -0
- package/dist/schema/enum-values.js +56 -0
- package/dist/schema/enum-values.js.map +1 -0
- package/dist/schema/expressible.d.ts +59 -0
- package/dist/schema/expressible.d.ts.map +1 -0
- package/dist/schema/expressible.js +161 -0
- package/dist/schema/expressible.js.map +1 -0
- package/dist/schema/index.d.ts +20 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +20 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/json-schema.d.ts +64 -0
- package/dist/schema/json-schema.d.ts.map +1 -0
- package/dist/schema/json-schema.js +2 -0
- package/dist/schema/json-schema.js.map +1 -0
- package/dist/schema/registry.d.ts +73 -0
- package/dist/schema/registry.d.ts.map +1 -0
- package/dist/schema/registry.js +135 -0
- package/dist/schema/registry.js.map +1 -0
- package/dist/schema/strictify.d.ts +19 -0
- package/dist/schema/strictify.d.ts.map +1 -0
- package/dist/schema/strictify.js +237 -0
- package/dist/schema/strictify.js.map +1 -0
- package/dist/schema/to-json-schema.d.ts +29 -0
- package/dist/schema/to-json-schema.d.ts.map +1 -0
- package/dist/schema/to-json-schema.js +691 -0
- package/dist/schema/to-json-schema.js.map +1 -0
- package/dist/schema/walk-key.d.ts +24 -0
- package/dist/schema/walk-key.d.ts.map +1 -0
- package/dist/schema/walk-key.js +33 -0
- package/dist/schema/walk-key.js.map +1 -0
- package/dist/to.js +1 -1
- package/dist/to.js.map +1 -1
- package/dist/tool.d.ts +32 -3
- package/dist/tool.d.ts.map +1 -1
- package/dist/tool.js +41 -0
- package/dist/tool.js.map +1 -1
- package/dist/types.d.ts +265 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -1
- package/dist/types.js.map +1 -1
- package/package.json +72 -72
- package/dist/schema.d.ts +0 -837
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -2472
- package/dist/schema.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { buildAnyValueSchema } from './any-value';
|
|
3
|
+
/**
|
|
4
|
+
* Build the inline placeholder used in place of a cyclic `$ref` for
|
|
5
|
+
* descriptors with `supportsRecursion: false`. Inspects the recursive zod
|
|
6
|
+
* `schema` and emits a JSON-Schema node whose top-level shape matches it
|
|
7
|
+
* (number → `{type: 'number'}`, array → `{type: 'array', items: ...}`, union
|
|
8
|
+
* → `{anyOf: [...]}`, etc.) so the LLM still knows what JSON value to send
|
|
9
|
+
* at the cycle position. One level of structural fidelity, then bottoms out
|
|
10
|
+
* at the descriptor's flat "any" encoding.
|
|
11
|
+
*/
|
|
12
|
+
export function buildCycleBreakerSchema(schema, refId, descriptor) {
|
|
13
|
+
const placeholder = genericize(schema, descriptor, 1);
|
|
14
|
+
// The description is MODEL-FACING, so it must not point at a `$defs` entry
|
|
15
|
+
// this dialect never emits — under `allowDefsRef: false` there is no `$defs`
|
|
16
|
+
// section at all, and telling the model to look at one is a lie about the
|
|
17
|
+
// document it was handed. Name the recursion instead.
|
|
18
|
+
const description = descriptor.allowDefsRef
|
|
19
|
+
? `Would recursively reference #/$defs/${refId}`
|
|
20
|
+
: `Recursive reference to '${refId}' — repeat this shape here`;
|
|
21
|
+
return { ...placeholder, description };
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Reduce a zod schema to a JSON-Schema node carrying its top-level shape
|
|
25
|
+
* class (string / number / array / object / union / …) without nested
|
|
26
|
+
* constraints. Used by the cycle-breaker so the placeholder at a recursive
|
|
27
|
+
* position matches the JSON value the LLM is supposed to emit.
|
|
28
|
+
*
|
|
29
|
+
* `depth` controls how far structural fidelity flows into the *recursive*
|
|
30
|
+
* containers (arrays of arrays, unions of unions). Closed-form schemas
|
|
31
|
+
* (primitives, objects, tuples) ignore depth — they have no further
|
|
32
|
+
* substructure to walk and are always safe to emit verbatim.
|
|
33
|
+
* - `depth >= 1`: arrays carry their `items`, unions carry their branches,
|
|
34
|
+
* each recursing at `depth - 1`.
|
|
35
|
+
* - `depth === 0`: arrays collapse to bare `{type: 'array'}`, unions
|
|
36
|
+
* collapse to the descriptor's flat any encoding. Stops the walk before
|
|
37
|
+
* it can re-traverse the cycle that triggered the call.
|
|
38
|
+
*
|
|
39
|
+
* Depth is hardcoded to 1 by `buildCycleBreakerSchema`. That's enough for
|
|
40
|
+
* "a list of objects should be a list of records" and prevents infinite
|
|
41
|
+
* recursion on `Array<Array<Self>>` / `Union<Union<Self>>` shapes.
|
|
42
|
+
*/
|
|
43
|
+
function genericize(schema, descriptor, depth) {
|
|
44
|
+
// Unwrap transparent wrappers — recurse at the same depth because the
|
|
45
|
+
// wrapper itself doesn't add a structural level.
|
|
46
|
+
if (schema instanceof z.ZodLazy) {
|
|
47
|
+
return genericize(schema.def.getter(), descriptor, depth);
|
|
48
|
+
}
|
|
49
|
+
if (schema instanceof z.ZodOptional || schema instanceof z.ZodNullable) {
|
|
50
|
+
return genericize(schema.unwrap(), descriptor, depth);
|
|
51
|
+
}
|
|
52
|
+
if (schema instanceof z.ZodDefault) {
|
|
53
|
+
return genericize(schema.def.innerType, descriptor, depth);
|
|
54
|
+
}
|
|
55
|
+
if (schema instanceof z.ZodCodec) {
|
|
56
|
+
return genericize(schema.def.in, descriptor, depth);
|
|
57
|
+
}
|
|
58
|
+
if (schema instanceof z.ZodPipe) {
|
|
59
|
+
return genericize(schema.def.in, descriptor, depth);
|
|
60
|
+
}
|
|
61
|
+
// Primitive leaves and string-flavored types — no substructure, depth
|
|
62
|
+
// irrelevant. The LLM gets a precise type signal.
|
|
63
|
+
if (schema instanceof z.ZodString)
|
|
64
|
+
return { type: 'string' };
|
|
65
|
+
if (schema instanceof z.ZodNumber)
|
|
66
|
+
return { type: 'number' };
|
|
67
|
+
if (schema instanceof z.ZodBigInt)
|
|
68
|
+
return { type: 'number' };
|
|
69
|
+
if (schema instanceof z.ZodBoolean)
|
|
70
|
+
return { type: 'boolean' };
|
|
71
|
+
if (schema instanceof z.ZodNull)
|
|
72
|
+
return { type: 'null' };
|
|
73
|
+
if (schema instanceof z.ZodUndefined)
|
|
74
|
+
return { type: 'null' };
|
|
75
|
+
if (schema instanceof z.ZodDate ||
|
|
76
|
+
schema instanceof z.ZodISODateTime ||
|
|
77
|
+
schema instanceof z.ZodISODate ||
|
|
78
|
+
schema instanceof z.ZodISOTime ||
|
|
79
|
+
schema instanceof z.ZodISODuration ||
|
|
80
|
+
schema instanceof z.ZodEmail ||
|
|
81
|
+
schema instanceof z.ZodIPv4 ||
|
|
82
|
+
schema instanceof z.ZodIPv6 ||
|
|
83
|
+
schema instanceof z.ZodUUID ||
|
|
84
|
+
schema instanceof z.ZodTemplateLiteral) {
|
|
85
|
+
return { type: 'string' };
|
|
86
|
+
}
|
|
87
|
+
if (schema instanceof z.ZodLiteral) {
|
|
88
|
+
// ZodLiteral can carry one or more values; pick the first that maps to
|
|
89
|
+
// a JSON primitive type, else fall back to flat any.
|
|
90
|
+
const v = Array.from(schema.values).find((x) => x === null || typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean');
|
|
91
|
+
if (v === null)
|
|
92
|
+
return { type: 'null' };
|
|
93
|
+
if (typeof v === 'string')
|
|
94
|
+
return { type: 'string' };
|
|
95
|
+
if (typeof v === 'number')
|
|
96
|
+
return { type: 'number' };
|
|
97
|
+
if (typeof v === 'boolean')
|
|
98
|
+
return { type: 'boolean' };
|
|
99
|
+
return buildAnyValueSchema(descriptor);
|
|
100
|
+
}
|
|
101
|
+
if (schema instanceof z.ZodEnum) {
|
|
102
|
+
const numericValues = Object.values(schema.def.entries).filter((v) => typeof v === 'number');
|
|
103
|
+
const values = Object.entries(schema.def.entries)
|
|
104
|
+
.filter(([k]) => numericValues.indexOf(+k) === -1)
|
|
105
|
+
.map(([, v]) => v);
|
|
106
|
+
if (values.every((v) => typeof v === 'string'))
|
|
107
|
+
return { type: 'string' };
|
|
108
|
+
if (values.every((v) => typeof v === 'number'))
|
|
109
|
+
return { type: 'number' };
|
|
110
|
+
return buildAnyValueSchema(descriptor);
|
|
111
|
+
}
|
|
112
|
+
// Closed-form containers — no nested schema to walk, safe at any depth.
|
|
113
|
+
if (schema instanceof z.ZodObject ||
|
|
114
|
+
schema instanceof z.ZodRecord ||
|
|
115
|
+
schema instanceof z.ZodIntersection) {
|
|
116
|
+
return { type: 'object', additionalProperties: true };
|
|
117
|
+
}
|
|
118
|
+
if (schema instanceof z.ZodTuple) {
|
|
119
|
+
// Heterogeneous positional shape — drop items, keep array hint.
|
|
120
|
+
return { type: 'array' };
|
|
121
|
+
}
|
|
122
|
+
// Recursive containers — depth gates further structural fidelity.
|
|
123
|
+
if (schema instanceof z.ZodArray) {
|
|
124
|
+
if (depth <= 0)
|
|
125
|
+
return { type: 'array' };
|
|
126
|
+
return { type: 'array', items: genericize(schema.element, descriptor, depth - 1) };
|
|
127
|
+
}
|
|
128
|
+
if (schema instanceof z.ZodUnion || schema instanceof z.ZodDiscriminatedUnion) {
|
|
129
|
+
if (depth <= 0)
|
|
130
|
+
return buildAnyValueSchema(descriptor);
|
|
131
|
+
const options = schema.options;
|
|
132
|
+
const branches = options.map((opt) => genericize(opt, descriptor, depth - 1));
|
|
133
|
+
const unique = uniqueByJSON(branches);
|
|
134
|
+
return unique.length === 1 ? unique[0] : { anyOf: unique };
|
|
135
|
+
}
|
|
136
|
+
// ZodAny / ZodUnknown / ZodTransform / anything we don't recognize —
|
|
137
|
+
// emit the descriptor's any encoding. Safer than guessing.
|
|
138
|
+
return buildAnyValueSchema(descriptor);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Dedupe an array of JSONSchema nodes by structural (JSON-stringified)
|
|
142
|
+
* equality. Order-preserving: the first occurrence wins. Used by
|
|
143
|
+
* `genericize` to collapse `union<T, T>` placeholders into a single branch.
|
|
144
|
+
*/
|
|
145
|
+
function uniqueByJSON(nodes) {
|
|
146
|
+
const seen = new Set();
|
|
147
|
+
const out = [];
|
|
148
|
+
for (const node of nodes) {
|
|
149
|
+
const key = JSON.stringify(node);
|
|
150
|
+
if (seen.has(key))
|
|
151
|
+
continue;
|
|
152
|
+
seen.add(key);
|
|
153
|
+
out.push(node);
|
|
154
|
+
}
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=cycle-breaker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cycle-breaker.js","sourceRoot":"","sources":["../../src/schema/cycle-breaker.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAmC,EACnC,KAAa,EACb,UAA4B;IAE5B,MAAM,WAAW,GA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AC,QAAQ,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC7D,CAAC;IAED,qEAAqE;IACrE,2DAA2D;IAC3D,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,KAAmB;IACvC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import type { FormatDescriptor } from './descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Produce a NON-FAILING variant of `schema` that keeps every transform
|
|
5
|
+
* (`preprocess`, `codec`, `pipe`, `transform`) but drops validation. Parsing
|
|
6
|
+
* a wire value through the result runs the decode preprocesses installed by
|
|
7
|
+
* `strictify` (array-of-pairs → record, numeric-key object → tuple, null →
|
|
8
|
+
* undefined) and yields the conceptual value, without ever rejecting.
|
|
9
|
+
*
|
|
10
|
+
* Recursion (`z.lazy` self-reference) is handled with a per-call memo map: an
|
|
11
|
+
* in-flight node is recorded as a thunk and re-encounters resolve to
|
|
12
|
+
* `z.lazy(thunk)`, so a self-referential schema relaxes in finite time and
|
|
13
|
+
* never infinite-loops.
|
|
14
|
+
*/
|
|
15
|
+
export declare function relaxValidation(schema: z.ZodType): z.ZodType;
|
|
16
|
+
/**
|
|
17
|
+
* DECODE a model's wire `value` back to the conceptual shape a custom parser
|
|
18
|
+
* expects — symmetric with how `strictify` ENCODEs the request for the wire.
|
|
19
|
+
*
|
|
20
|
+
* Runs the descriptor's decode transforms (via `relaxValidation(strictify(...))`)
|
|
21
|
+
* without imposing validation, so array-of-pairs records, numeric-key tuples,
|
|
22
|
+
* and null-for-optional fields are normalized before a provider-agnostic
|
|
23
|
+
* custom parser sees them. Best-effort: NEVER throws — if the relaxed decoder
|
|
24
|
+
* can't parse the value it is returned unchanged.
|
|
25
|
+
*
|
|
26
|
+
* @param schema - the PRE-strictify conceptual schema (strictify runs internally)
|
|
27
|
+
* @param value - the model's raw wire value (already `JSON.parse`d)
|
|
28
|
+
* @param descriptor - the wire dialect the request was encoded with
|
|
29
|
+
*/
|
|
30
|
+
export declare function decodeWire(schema: z.ZodType, value: unknown, descriptor: FormatDescriptor): unknown;
|
|
31
|
+
//# sourceMappingURL=decode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/schema/decode.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAuKrD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAmB5D;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAanG"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import z from 'zod';
|
|
2
|
+
import { strictify } from './strictify';
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Wire → conceptual DECODE (symmetric with strictify's conceptual → wire ENCODE)
|
|
5
|
+
//
|
|
6
|
+
// `strictify` installs decode preprocesses (array-of-pairs → record,
|
|
7
|
+
// numeric-key object → tuple, null → undefined for optionals, …) that only
|
|
8
|
+
// run when Zod VALIDATES a value. A custom `parse` hook REPLACES Zod
|
|
9
|
+
// validation, so it never triggers those preprocesses — it would otherwise
|
|
10
|
+
// see the raw provider wire shape.
|
|
11
|
+
//
|
|
12
|
+
// `relaxValidation` turns a (strictified) schema into a NON-FAILING variant
|
|
13
|
+
// that KEEPS every transform but DROPS validation, so we can run it purely to
|
|
14
|
+
// execute the decode preprocesses and hand a custom parser the CONCEPTUAL
|
|
15
|
+
// value. `decodeWire` ties it together (strictify → relax → safeParse,
|
|
16
|
+
// best-effort).
|
|
17
|
+
// ============================================================================
|
|
18
|
+
/**
|
|
19
|
+
* Rebuild a `ZodObject` for the relaxed decoder.
|
|
20
|
+
*
|
|
21
|
+
* - Recurses each field through `relax` (so nested transforms still run).
|
|
22
|
+
* - `forceOptional`: when true every field becomes optional (max leniency —
|
|
23
|
+
* used everywhere EXCEPT union options). When false the field keeps its own
|
|
24
|
+
* optionality (used for union-option objects, where a required field is the
|
|
25
|
+
* discriminating signal that lets the union pick the right branch).
|
|
26
|
+
* - `loose`: when true (default) unknown keys pass straight through; when
|
|
27
|
+
* false the object STRIPS unknown keys. Intersection sides use `false` so
|
|
28
|
+
* each half only claims its own keys and the two halves merge without an
|
|
29
|
+
* "unmergable intersection" conflict (a loose side would echo the other
|
|
30
|
+
* half's raw key and collide with that half's transformed value).
|
|
31
|
+
*/
|
|
32
|
+
function relaxObjectShape(schema, relax, forceOptional, loose = true) {
|
|
33
|
+
const shape = {};
|
|
34
|
+
for (const key in schema.shape) {
|
|
35
|
+
const relaxed = relax(schema.shape[key]);
|
|
36
|
+
shape[key] = forceOptional ? relaxed.optional() : relaxed;
|
|
37
|
+
}
|
|
38
|
+
const obj = z.object(shape);
|
|
39
|
+
return loose ? obj.loose() : obj;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Relax one side of an intersection. Object sides are rebuilt STRIP (not
|
|
43
|
+
* loose) so the two halves merge cleanly (see `relaxObjectShape`'s `loose`
|
|
44
|
+
* note); everything else relaxes normally.
|
|
45
|
+
*/
|
|
46
|
+
function relaxIntersectionSide(schema, relax) {
|
|
47
|
+
if (schema instanceof z.ZodObject) {
|
|
48
|
+
return relaxObjectShape(schema, relax, /* forceOptional */ true, /* loose */ false);
|
|
49
|
+
}
|
|
50
|
+
return relax(schema);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Relax the options of a union (plain OR discriminated — the latter is a
|
|
54
|
+
* subclass of `ZodUnion` in Zod v4, so a single path covers both).
|
|
55
|
+
*
|
|
56
|
+
* Object options are rebuilt with their ORIGINAL requiredness preserved
|
|
57
|
+
* (`forceOptional: false`) so the union can discriminate by required-field
|
|
58
|
+
* presence and run the matching option's decode transforms. Non-object
|
|
59
|
+
* options are kept AS-IS: relaxing a leaf to `z.any()` would make it swallow
|
|
60
|
+
* every value (the first branch would always win), so the strictified option
|
|
61
|
+
* is left intact — it still discriminates by type and still carries any wire
|
|
62
|
+
* transform it needs. Validation on those non-object branches is therefore
|
|
63
|
+
* only best-effort, which is acceptable: `decodeWire` falls back to the
|
|
64
|
+
* original value if nothing matches.
|
|
65
|
+
*/
|
|
66
|
+
function relaxUnionOptions(options, relax) {
|
|
67
|
+
const relaxed = options.map((opt) => opt instanceof z.ZodObject ? relaxObjectShape(opt, relax, false) : opt);
|
|
68
|
+
return z.union(relaxed);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Per-node dispatch for `relaxValidation`. Mirrors the node coverage of
|
|
72
|
+
* `strictifySimple` plus the extra wrappers/containers a strictified schema
|
|
73
|
+
* can contain (`ZodMap`, `ZodSet`, `ZodCatch`, `ZodReadonly`, `ZodPrefault`,
|
|
74
|
+
* `ZodNonOptional`, …). Unknown/leaf nodes bottom out at `z.any()`.
|
|
75
|
+
*/
|
|
76
|
+
function relaxNode(schema, relax) {
|
|
77
|
+
// ---- Wrappers: unwrap, relax inner, re-wrap ----
|
|
78
|
+
if (schema instanceof z.ZodOptional)
|
|
79
|
+
return relax(schema.unwrap()).optional();
|
|
80
|
+
if (schema instanceof z.ZodNullable)
|
|
81
|
+
return relax(schema.unwrap()).nullable();
|
|
82
|
+
if (schema instanceof z.ZodDefault) {
|
|
83
|
+
return relax(schema._zod.def.innerType).default(schema._zod.def.defaultValue);
|
|
84
|
+
}
|
|
85
|
+
if (schema instanceof z.ZodPrefault) {
|
|
86
|
+
return relax(schema._zod.def.innerType).prefault(schema._zod.def.defaultValue);
|
|
87
|
+
}
|
|
88
|
+
if (schema instanceof z.ZodCatch) {
|
|
89
|
+
return relax(schema._zod.def.innerType).catch(schema._zod.def.catchValue);
|
|
90
|
+
}
|
|
91
|
+
if (schema instanceof z.ZodReadonly)
|
|
92
|
+
return relax(schema._zod.def.innerType).readonly();
|
|
93
|
+
// NonOptional adds a "must be present" validation — drop it (we're relaxing).
|
|
94
|
+
if (schema instanceof z.ZodNonOptional)
|
|
95
|
+
return relax(schema._zod.def.innerType);
|
|
96
|
+
// ---- Transforms: KEEP the transform so the decode still runs ----
|
|
97
|
+
// ZodCodec must be checked before ZodPipe (it's a ZodPipe subclass in v4).
|
|
98
|
+
if (schema instanceof z.ZodCodec) {
|
|
99
|
+
return z.codec(relax(schema._zod.def.in), relax(schema._zod.def.out), { decode: schema._zod.def.transform, encode: schema._zod.def.reverseTransform });
|
|
100
|
+
}
|
|
101
|
+
// A bare transform (the `in` of a `preprocess`, the `out` of a `.transform`)
|
|
102
|
+
// carries no validation — keep it verbatim so the transform runs.
|
|
103
|
+
if (schema instanceof z.ZodTransform)
|
|
104
|
+
return schema;
|
|
105
|
+
if (schema instanceof z.ZodPipe) {
|
|
106
|
+
return z.pipe(relax(schema._zod.def.in), relax(schema._zod.def.out));
|
|
107
|
+
}
|
|
108
|
+
// ---- Containers: recurse so nested transforms are reached ----
|
|
109
|
+
if (schema instanceof z.ZodObject)
|
|
110
|
+
return relaxObjectShape(schema, relax, /* forceOptional */ true);
|
|
111
|
+
if (schema instanceof z.ZodArray)
|
|
112
|
+
return z.array(relax(schema._zod.def.element));
|
|
113
|
+
if (schema instanceof z.ZodTuple) {
|
|
114
|
+
const items = schema._zod.def.items.map(relax);
|
|
115
|
+
const rest = schema._zod.def.rest ? relax(schema._zod.def.rest) : undefined;
|
|
116
|
+
return rest ? z.tuple(items, rest) : z.tuple(items);
|
|
117
|
+
}
|
|
118
|
+
if (schema instanceof z.ZodRecord) {
|
|
119
|
+
// Accept any string key (records arrive with string-ish keys on the wire);
|
|
120
|
+
// an exhaustive/enum key schema would reject partial records.
|
|
121
|
+
return z.record(z.string(), relax(schema._zod.def.valueType));
|
|
122
|
+
}
|
|
123
|
+
if (schema instanceof z.ZodMap) {
|
|
124
|
+
return z.map(relax(schema._zod.def.keyType), relax(schema._zod.def.valueType));
|
|
125
|
+
}
|
|
126
|
+
if (schema instanceof z.ZodSet)
|
|
127
|
+
return z.set(relax(schema._zod.def.valueType));
|
|
128
|
+
// ---- Combinators ----
|
|
129
|
+
// ZodDiscriminatedUnion is a ZodUnion subclass in v4, so this one branch
|
|
130
|
+
// covers both. Discrimination survives via required-field presence.
|
|
131
|
+
if (schema instanceof z.ZodUnion)
|
|
132
|
+
return relaxUnionOptions(schema.options, relax);
|
|
133
|
+
if (schema instanceof z.ZodIntersection) {
|
|
134
|
+
return z.intersection(relaxIntersectionSide(schema._zod.def.left, relax), relaxIntersectionSide(schema._zod.def.right, relax));
|
|
135
|
+
}
|
|
136
|
+
// ---- Recursion: defer + memoize (see `relaxValidation`) ----
|
|
137
|
+
if (schema instanceof z.ZodLazy) {
|
|
138
|
+
return z.lazy(() => relax(schema._zod.def.getter()));
|
|
139
|
+
}
|
|
140
|
+
// ---- Validating leaves + anything unrecognized → accept everything ----
|
|
141
|
+
return z.any();
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Produce a NON-FAILING variant of `schema` that keeps every transform
|
|
145
|
+
* (`preprocess`, `codec`, `pipe`, `transform`) but drops validation. Parsing
|
|
146
|
+
* a wire value through the result runs the decode preprocesses installed by
|
|
147
|
+
* `strictify` (array-of-pairs → record, numeric-key object → tuple, null →
|
|
148
|
+
* undefined) and yields the conceptual value, without ever rejecting.
|
|
149
|
+
*
|
|
150
|
+
* Recursion (`z.lazy` self-reference) is handled with a per-call memo map: an
|
|
151
|
+
* in-flight node is recorded as a thunk and re-encounters resolve to
|
|
152
|
+
* `z.lazy(thunk)`, so a self-referential schema relaxes in finite time and
|
|
153
|
+
* never infinite-loops.
|
|
154
|
+
*/
|
|
155
|
+
export function relaxValidation(schema) {
|
|
156
|
+
// Per-call cycle map — same scheme as `strictifyWithDescriptor`: cache a
|
|
157
|
+
// lazy thunk for in-flight schemas so recursive references resolve to a
|
|
158
|
+
// `z.lazy(() => result)` instead of recursing forever.
|
|
159
|
+
const map = new Map();
|
|
160
|
+
const relax = (s) => {
|
|
161
|
+
const cached = map.get(s);
|
|
162
|
+
if (cached) {
|
|
163
|
+
return typeof cached === 'function' ? z.lazy(cached) : cached;
|
|
164
|
+
}
|
|
165
|
+
let result;
|
|
166
|
+
map.set(s, () => result);
|
|
167
|
+
result = relaxNode(s, relax);
|
|
168
|
+
map.set(s, result);
|
|
169
|
+
return result;
|
|
170
|
+
};
|
|
171
|
+
return relax(schema);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Module-scope cache for relaxed decoders. Mirrors `strictifyCache`: outer
|
|
175
|
+
* WeakMap keyed by the SOURCE schema (gc'd with it), inner Map keyed by
|
|
176
|
+
* descriptor id (small bounded set).
|
|
177
|
+
*/
|
|
178
|
+
const relaxDecodeCache = new WeakMap();
|
|
179
|
+
/**
|
|
180
|
+
* DECODE a model's wire `value` back to the conceptual shape a custom parser
|
|
181
|
+
* expects — symmetric with how `strictify` ENCODEs the request for the wire.
|
|
182
|
+
*
|
|
183
|
+
* Runs the descriptor's decode transforms (via `relaxValidation(strictify(...))`)
|
|
184
|
+
* without imposing validation, so array-of-pairs records, numeric-key tuples,
|
|
185
|
+
* and null-for-optional fields are normalized before a provider-agnostic
|
|
186
|
+
* custom parser sees them. Best-effort: NEVER throws — if the relaxed decoder
|
|
187
|
+
* can't parse the value it is returned unchanged.
|
|
188
|
+
*
|
|
189
|
+
* @param schema - the PRE-strictify conceptual schema (strictify runs internally)
|
|
190
|
+
* @param value - the model's raw wire value (already `JSON.parse`d)
|
|
191
|
+
* @param descriptor - the wire dialect the request was encoded with
|
|
192
|
+
*/
|
|
193
|
+
export function decodeWire(schema, value, descriptor) {
|
|
194
|
+
let perSchema = relaxDecodeCache.get(schema);
|
|
195
|
+
if (!perSchema) {
|
|
196
|
+
perSchema = new Map();
|
|
197
|
+
relaxDecodeCache.set(schema, perSchema);
|
|
198
|
+
}
|
|
199
|
+
let decoder = perSchema.get(descriptor.id);
|
|
200
|
+
if (!decoder) {
|
|
201
|
+
decoder = relaxValidation(strictify(schema, descriptor));
|
|
202
|
+
perSchema.set(descriptor.id, decoder);
|
|
203
|
+
}
|
|
204
|
+
const result = decoder.safeParse(value);
|
|
205
|
+
return result.success ? result.data : value;
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=decode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/schema/decode.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,+EAA+E;AAC/E,iFAAiF;AACjF,EAAE;AACF,qEAAqE;AACrE,2EAA2E;AAC3E,qEAAqE;AACrE,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,0EAA0E;AAC1E,uEAAuE;AACvE,gBAAgB;AAChB,+EAA+E;AAE/E;;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