@case-framework/survey-core 0.8.0 → 0.9.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 +126 -244
- package/build/answer-types-DH0gv0Ea.d.mts +20 -0
- package/build/answer-types-DH0gv0Ea.d.mts.map +1 -0
- package/build/answer-types-Dtm6MqZQ.mjs +19 -0
- package/build/answer-types-Dtm6MqZQ.mjs.map +1 -0
- package/build/editor/colors.d.mts +11 -2
- package/build/editor/colors.d.mts.map +1 -0
- package/build/editor.d.mts +72913 -266
- package/build/editor.d.mts.map +1 -1
- package/build/editor.mjs +1268 -1001
- package/build/editor.mjs.map +1 -1
- package/build/index.d.mts +2 -3
- package/build/index.mjs +1620 -824
- package/build/index.mjs.map +1 -1
- package/build/keyed-object-D1yh_W5v.mjs +45 -0
- package/build/keyed-object-D1yh_W5v.mjs.map +1 -0
- package/build/localization-1lzNpyFX.mjs +1373 -0
- package/build/localization-1lzNpyFX.mjs.map +1 -0
- package/build/package.json +9 -3
- package/build/projection-DrLPFroE.mjs +2344 -0
- package/build/projection-DrLPFroE.mjs.map +1 -0
- package/build/registry-BOXcyWfX.d.mts +54292 -0
- package/build/registry-BOXcyWfX.d.mts.map +1 -0
- package/build/schema.d.mts +3 -0
- package/build/schema.mjs +4 -0
- package/package.json +9 -3
- package/build/index-SDbZ5WQM.d.mts +0 -2208
- package/build/index-SDbZ5WQM.d.mts.map +0 -1
- package/build/item-colors-DgoJeSCQ.d.mts +0 -12
- package/build/item-colors-DgoJeSCQ.d.mts.map +0 -1
- package/build/projection-Bl6qCinx.mjs +0 -3930
- package/build/projection-Bl6qCinx.mjs.map +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { U as ownValue, W as setOwnValue } from "./localization-1lzNpyFX.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/schema/keyed-object.ts
|
|
4
|
+
/** Exact generated shapes may contain opaque IDs as property names. Preserve the
|
|
5
|
+
* declared __proto__ field that ZodObject otherwise skips, including its required
|
|
6
|
+
* check. This keeps the exact properties/required/additionalProperties JSON Schema.
|
|
7
|
+
* keyed-object.test.ts is an upgrade canary for the delegated Zod parser behavior.
|
|
8
|
+
*/
|
|
9
|
+
function strictKeyedObject(shape) {
|
|
10
|
+
return new (z.core.$constructor("StrictKeyedObject", (schema, def) => {
|
|
11
|
+
z.ZodObject.init(schema, def);
|
|
12
|
+
const parse = schema._zod.parse;
|
|
13
|
+
schema._zod.parse = (payload, context) => {
|
|
14
|
+
const input = payload.value;
|
|
15
|
+
if (z.core.util.isPlainObject(input)) payload.value = Object.assign(Object.create(null), input);
|
|
16
|
+
const result = parse(payload, context);
|
|
17
|
+
const childSchema = ownValue(def.shape, "__proto__");
|
|
18
|
+
if (!childSchema || !z.core.util.isPlainObject(input)) return result;
|
|
19
|
+
const finish = (parsed) => {
|
|
20
|
+
const child = z.strictObject({ property: childSchema })._zod.run({
|
|
21
|
+
value: Object.hasOwn(input, "__proto__") ? { property: ownValue(input, "__proto__") } : {},
|
|
22
|
+
issues: []
|
|
23
|
+
}, context);
|
|
24
|
+
const assign = (value) => {
|
|
25
|
+
parsed.issues.push(...value.issues.map((issue) => ({
|
|
26
|
+
...issue,
|
|
27
|
+
path: ["__proto__", ...issue.path?.slice(1) ?? []]
|
|
28
|
+
})));
|
|
29
|
+
if (z.core.util.isPlainObject(value.value) && Object.hasOwn(value.value, "property") && z.core.util.isPlainObject(parsed.value)) setOwnValue(parsed.value, "__proto__", value.value.property);
|
|
30
|
+
return parsed;
|
|
31
|
+
};
|
|
32
|
+
return child instanceof Promise ? child.then(assign) : assign(child);
|
|
33
|
+
};
|
|
34
|
+
return result instanceof Promise ? result.then(finish) : finish(result);
|
|
35
|
+
};
|
|
36
|
+
}))({
|
|
37
|
+
type: "object",
|
|
38
|
+
shape,
|
|
39
|
+
catchall: z.never()
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { strictKeyedObject as t };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=keyed-object-D1yh_W5v.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyed-object-D1yh_W5v.mjs","names":[],"sources":["../src/schema/keyed-object.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { ownValue, setOwnValue } from \"./string-record\";\n\n/** Exact generated shapes may contain opaque IDs as property names. Preserve the\n * declared __proto__ field that ZodObject otherwise skips, including its required\n * check. This keeps the exact properties/required/additionalProperties JSON Schema.\n * keyed-object.test.ts is an upgrade canary for the delegated Zod parser behavior.\n */\nexport function strictKeyedObject<S extends z.ZodRawShape>(shape: S) {\n const ObjectSchema = z.core.$constructor<z.ZodObject<S, z.core.$strict>>(\n \"StrictKeyedObject\",\n (schema, def) => {\n z.ZodObject.init(schema, def);\n const parse = schema._zod.parse;\n schema._zod.parse = (payload, context) => {\n const input: unknown = payload.value;\n // ZodObject uses inherited reads/presence checks. Opaque keys must only\n // observe supplied properties, including optional prototype-named keys.\n if (z.core.util.isPlainObject(input))\n payload.value = Object.assign(Object.create(null), input);\n const result = parse(payload, context);\n const childSchema = ownValue(def.shape, \"__proto__\");\n if (!childSchema || !z.core.util.isPlainObject(input)) return result;\n const finish = (parsed: z.core.ParsePayload) => {\n // Delegate property presence/default/optional semantics too, rather\n // than duplicating Zod's optin/optout rules at this exceptional key.\n const child = z.strictObject({ property: childSchema })._zod.run(\n {\n value: Object.hasOwn(input, \"__proto__\")\n ? { property: ownValue(input, \"__proto__\") }\n : {},\n issues: [],\n },\n context,\n );\n const assign = (value: z.core.ParsePayload) => {\n parsed.issues.push(\n ...value.issues.map((issue) => ({\n ...issue,\n path: [\"__proto__\", ...(issue.path?.slice(1) ?? [])],\n })),\n );\n if (\n z.core.util.isPlainObject(value.value) &&\n Object.hasOwn(value.value, \"property\") &&\n z.core.util.isPlainObject(parsed.value)\n )\n setOwnValue(parsed.value, \"__proto__\", value.value.property);\n return parsed;\n };\n return child instanceof Promise ? child.then(assign) : assign(child);\n };\n return result instanceof Promise ? result.then(finish) : finish(result);\n };\n },\n );\n return new ObjectSchema({ type: \"object\", shape, catchall: z.never() });\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,kBAA2C,OAAU;CAgDnE,OAAO,KA/Cc,EAAE,KAAK,aAC1B,sBACC,QAAQ,QAAQ;EACf,EAAE,UAAU,KAAK,QAAQ,GAAG;EAC5B,MAAM,QAAQ,OAAO,KAAK;EAC1B,OAAO,KAAK,SAAS,SAAS,YAAY;GACxC,MAAM,QAAiB,QAAQ;GAG/B,IAAI,EAAE,KAAK,KAAK,cAAc,KAAK,GACjC,QAAQ,QAAQ,OAAO,OAAO,OAAO,OAAO,IAAI,GAAG,KAAK;GAC1D,MAAM,SAAS,MAAM,SAAS,OAAO;GACrC,MAAM,cAAc,SAAS,IAAI,OAAO,WAAW;GACnD,IAAI,CAAC,eAAe,CAAC,EAAE,KAAK,KAAK,cAAc,KAAK,GAAG,OAAO;GAC9D,MAAM,UAAU,WAAgC;IAG9C,MAAM,QAAQ,EAAE,aAAa,EAAE,UAAU,YAAY,CAAC,CAAC,CAAC,KAAK,IAC3D;KACE,OAAO,OAAO,OAAO,OAAO,WAAW,IACnC,EAAE,UAAU,SAAS,OAAO,WAAW,EAAE,IACzC,CAAC;KACL,QAAQ,CAAC;IACX,GACA,OACF;IACA,MAAM,UAAU,UAA+B;KAC7C,OAAO,OAAO,KACZ,GAAG,MAAM,OAAO,KAAK,WAAW;MAC9B,GAAG;MACH,MAAM,CAAC,aAAa,GAAI,MAAM,MAAM,MAAM,CAAC,KAAK,CAAC,CAAE;KACrD,EAAE,CACJ;KACA,IACE,EAAE,KAAK,KAAK,cAAc,MAAM,KAAK,KACrC,OAAO,OAAO,MAAM,OAAO,UAAU,KACrC,EAAE,KAAK,KAAK,cAAc,OAAO,KAAK,GAEtC,YAAY,OAAO,OAAO,aAAa,MAAM,MAAM,QAAQ;KAC7D,OAAO;IACT;IACA,OAAO,iBAAiB,UAAU,MAAM,KAAK,MAAM,IAAI,OAAO,KAAK;GACrE;GACA,OAAO,kBAAkB,UAAU,OAAO,KAAK,MAAM,IAAI,OAAO,MAAM;EACxE;CACF,CAEoB,GAAE;EAAE,MAAM;EAAU;EAAO,UAAU,EAAE,MAAM;CAAE,CAAC;AACxE"}
|