typesea 0.1.0 → 0.3.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/CHANGELOG.md +85 -6
- package/README.md +143 -28
- package/dist/adapters/index.d.ts +50 -8
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +169 -48
- package/dist/aot/index.d.ts +19 -3
- package/dist/aot/index.d.ts.map +1 -1
- package/dist/aot/index.js +115 -17
- package/dist/async/index.d.ts +28 -56
- package/dist/async/index.d.ts.map +1 -1
- package/dist/async/index.js +94 -37
- package/dist/builders/composite.d.ts +43 -9
- package/dist/builders/composite.d.ts.map +1 -1
- package/dist/builders/composite.js +100 -17
- package/dist/builders/index.d.ts +8 -5
- package/dist/builders/index.d.ts.map +1 -1
- package/dist/builders/index.js +7 -4
- package/dist/builders/modifier.d.ts +36 -5
- package/dist/builders/modifier.d.ts.map +1 -1
- package/dist/builders/modifier.js +52 -5
- package/dist/builders/object/guard.d.ts +72 -24
- package/dist/builders/object/guard.d.ts.map +1 -1
- package/dist/builders/object/guard.js +139 -29
- package/dist/builders/object/index.d.ts +4 -2
- package/dist/builders/object/index.d.ts.map +1 -1
- package/dist/builders/object/index.js +3 -1
- package/dist/builders/object/schema.d.ts +88 -11
- package/dist/builders/object/schema.d.ts.map +1 -1
- package/dist/builders/object/schema.js +290 -23
- package/dist/builders/object/types.d.ts +20 -31
- package/dist/builders/object/types.d.ts.map +1 -1
- package/dist/builders/object/types.js +2 -0
- package/dist/builders/runtime.d.ts +40 -0
- package/dist/builders/runtime.d.ts.map +1 -0
- package/dist/builders/runtime.js +150 -0
- package/dist/builders/scalar.d.ts +49 -9
- package/dist/builders/scalar.d.ts.map +1 -1
- package/dist/builders/scalar.js +87 -9
- package/dist/builders/table.d.ts +35 -5
- package/dist/builders/table.d.ts.map +1 -1
- package/dist/builders/table.js +35 -5
- package/dist/builders/types.d.ts +20 -4
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/builders/types.js +2 -0
- package/dist/compile/check-composite.d.ts +25 -2
- package/dist/compile/check-composite.d.ts.map +1 -1
- package/dist/compile/check-composite.js +699 -27
- package/dist/compile/check-scalar.d.ts +88 -0
- package/dist/compile/check-scalar.d.ts.map +1 -1
- package/dist/compile/check-scalar.js +570 -3
- package/dist/compile/check.d.ts +12 -0
- package/dist/compile/check.d.ts.map +1 -1
- package/dist/compile/check.js +62 -3
- package/dist/compile/context.d.ts +47 -9
- package/dist/compile/context.d.ts.map +1 -1
- package/dist/compile/context.js +53 -8
- package/dist/compile/first.d.ts +26 -0
- package/dist/compile/first.d.ts.map +1 -0
- package/dist/compile/first.js +850 -0
- package/dist/compile/graph-predicate.d.ts +4 -2
- package/dist/compile/graph-predicate.d.ts.map +1 -1
- package/dist/compile/graph-predicate.js +2272 -165
- package/dist/compile/guard.d.ts +16 -24
- package/dist/compile/guard.d.ts.map +1 -1
- package/dist/compile/guard.js +202 -72
- package/dist/compile/index.d.ts +3 -1
- package/dist/compile/index.d.ts.map +1 -1
- package/dist/compile/index.js +2 -0
- package/dist/compile/issue.d.ts +110 -0
- package/dist/compile/issue.d.ts.map +1 -1
- package/dist/compile/issue.js +184 -1
- package/dist/compile/names.d.ts +12 -2
- package/dist/compile/names.d.ts.map +1 -1
- package/dist/compile/names.js +19 -3
- package/dist/compile/predicate.d.ts +24 -0
- package/dist/compile/predicate.d.ts.map +1 -1
- package/dist/compile/predicate.js +287 -10
- package/dist/compile/runtime.d.ts +100 -13
- package/dist/compile/runtime.d.ts.map +1 -1
- package/dist/compile/runtime.js +56 -6
- package/dist/compile/source.d.ts +10 -2
- package/dist/compile/source.d.ts.map +1 -1
- package/dist/compile/source.js +385 -26
- package/dist/compile/types.d.ts +22 -0
- package/dist/compile/types.d.ts.map +1 -1
- package/dist/compile/types.js +2 -0
- package/dist/decoder/index.d.ts +92 -46
- package/dist/decoder/index.d.ts.map +1 -1
- package/dist/decoder/index.js +266 -39
- package/dist/evaluate/check-composite.d.ts +111 -2
- package/dist/evaluate/check-composite.d.ts.map +1 -1
- package/dist/evaluate/check-composite.js +343 -8
- package/dist/evaluate/check-scalar.d.ts +25 -0
- package/dist/evaluate/check-scalar.d.ts.map +1 -1
- package/dist/evaluate/check-scalar.js +124 -3
- package/dist/evaluate/check.d.ts +7 -0
- package/dist/evaluate/check.d.ts.map +1 -1
- package/dist/evaluate/check.js +62 -4
- package/dist/evaluate/index.d.ts +2 -0
- package/dist/evaluate/index.d.ts.map +1 -1
- package/dist/evaluate/index.js +2 -0
- package/dist/evaluate/issue.d.ts +11 -1
- package/dist/evaluate/issue.d.ts.map +1 -1
- package/dist/evaluate/issue.js +15 -1
- package/dist/evaluate/predicate.d.ts +16 -5
- package/dist/evaluate/predicate.d.ts.map +1 -1
- package/dist/evaluate/predicate.js +20 -5
- package/dist/evaluate/shared.d.ts +78 -13
- package/dist/evaluate/shared.d.ts.map +1 -1
- package/dist/evaluate/shared.js +101 -8
- package/dist/evaluate/state.d.ts +35 -13
- package/dist/evaluate/state.d.ts.map +1 -1
- package/dist/evaluate/state.js +35 -2
- package/dist/guard/array.d.ts +48 -0
- package/dist/guard/array.d.ts.map +1 -0
- package/dist/guard/array.js +84 -0
- package/dist/guard/base.d.ts +111 -31
- package/dist/guard/base.d.ts.map +1 -1
- package/dist/guard/base.js +165 -32
- package/dist/guard/date.d.ts +34 -0
- package/dist/guard/date.d.ts.map +1 -0
- package/dist/guard/date.js +60 -0
- package/dist/guard/error.d.ts +10 -5
- package/dist/guard/error.d.ts.map +1 -1
- package/dist/guard/error.js +10 -5
- package/dist/guard/index.d.ts +4 -0
- package/dist/guard/index.d.ts.map +1 -1
- package/dist/guard/index.js +4 -0
- package/dist/guard/number.d.ts +86 -11
- package/dist/guard/number.d.ts.map +1 -1
- package/dist/guard/number.js +159 -11
- package/dist/guard/props.d.ts +27 -3
- package/dist/guard/props.d.ts.map +1 -1
- package/dist/guard/props.js +27 -3
- package/dist/guard/read.d.ts +115 -10
- package/dist/guard/read.d.ts.map +1 -1
- package/dist/guard/read.js +185 -10
- package/dist/guard/registry.d.ts +12 -2
- package/dist/guard/registry.d.ts.map +1 -1
- package/dist/guard/registry.js +15 -3
- package/dist/guard/string.d.ts +115 -13
- package/dist/guard/string.d.ts.map +1 -1
- package/dist/guard/string.js +250 -13
- package/dist/guard/types.d.ts +110 -40
- package/dist/guard/types.d.ts.map +1 -1
- package/dist/guard/types.js +2 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/internal/index.d.ts +42 -6
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +51 -8
- package/dist/ir/builder.d.ts +17 -127
- package/dist/ir/builder.d.ts.map +1 -1
- package/dist/ir/builder.js +80 -137
- package/dist/ir/freeze.d.ts +4 -0
- package/dist/ir/freeze.d.ts.map +1 -1
- package/dist/ir/freeze.js +66 -0
- package/dist/ir/index.d.ts +3 -1
- package/dist/ir/index.d.ts.map +1 -1
- package/dist/ir/index.js +2 -0
- package/dist/ir/regexp.d.ts +2 -0
- package/dist/ir/regexp.d.ts.map +1 -1
- package/dist/ir/regexp.js +2 -0
- package/dist/ir/types.d.ts +94 -56
- package/dist/ir/types.d.ts.map +1 -1
- package/dist/ir/types.js +2 -0
- package/dist/ir/validate.d.ts +8 -1
- package/dist/ir/validate.d.ts.map +1 -1
- package/dist/ir/validate.js +511 -61
- package/dist/issue/index.d.ts +42 -10
- package/dist/issue/index.d.ts.map +1 -1
- package/dist/issue/index.js +65 -11
- package/dist/json-schema/emit-combinator.d.ts +44 -4
- package/dist/json-schema/emit-combinator.d.ts.map +1 -1
- package/dist/json-schema/emit-combinator.js +44 -4
- package/dist/json-schema/emit-composite.d.ts +16 -2
- package/dist/json-schema/emit-composite.d.ts.map +1 -1
- package/dist/json-schema/emit-composite.js +81 -13
- package/dist/json-schema/emit-scalar.d.ts +26 -3
- package/dist/json-schema/emit-scalar.d.ts.map +1 -1
- package/dist/json-schema/emit-scalar.js +124 -10
- package/dist/json-schema/emit-types.d.ts +11 -1
- package/dist/json-schema/emit-types.d.ts.map +1 -1
- package/dist/json-schema/emit-types.js +2 -0
- package/dist/json-schema/emit.d.ts +12 -1
- package/dist/json-schema/emit.d.ts.map +1 -1
- package/dist/json-schema/emit.js +23 -3
- package/dist/json-schema/freeze.d.ts +13 -2
- package/dist/json-schema/freeze.d.ts.map +1 -1
- package/dist/json-schema/freeze.js +41 -8
- package/dist/json-schema/index.d.ts +16 -2
- package/dist/json-schema/index.d.ts.map +1 -1
- package/dist/json-schema/index.js +23 -3
- package/dist/json-schema/issue.d.ts +4 -1
- package/dist/json-schema/issue.d.ts.map +1 -1
- package/dist/json-schema/issue.js +4 -1
- package/dist/json-schema/read.d.ts +24 -3
- package/dist/json-schema/read.d.ts.map +1 -1
- package/dist/json-schema/read.js +59 -12
- package/dist/json-schema/types.d.ts +45 -16
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/json-schema/types.js +2 -0
- package/dist/kind/index.d.ts +40 -28
- package/dist/kind/index.d.ts.map +1 -1
- package/dist/kind/index.js +41 -13
- package/dist/lower/index.d.ts +6 -1
- package/dist/lower/index.d.ts.map +1 -1
- package/dist/lower/index.js +462 -46
- package/dist/message/index.d.ts +64 -10
- package/dist/message/index.d.ts.map +1 -1
- package/dist/message/index.js +155 -17
- package/dist/optimize/algebraic.d.ts +54 -0
- package/dist/optimize/algebraic.d.ts.map +1 -0
- package/dist/optimize/algebraic.js +314 -0
- package/dist/optimize/compact.d.ts +8 -1
- package/dist/optimize/compact.d.ts.map +1 -1
- package/dist/optimize/compact.js +13 -2
- package/dist/optimize/domain.d.ts +16 -0
- package/dist/optimize/domain.d.ts.map +1 -0
- package/dist/optimize/domain.js +619 -0
- package/dist/optimize/fold-boolean.d.ts +17 -2
- package/dist/optimize/fold-boolean.d.ts.map +1 -1
- package/dist/optimize/fold-boolean.js +59 -14
- package/dist/optimize/fold-common.d.ts +43 -8
- package/dist/optimize/fold-common.d.ts.map +1 -1
- package/dist/optimize/fold-common.js +37 -6
- package/dist/optimize/fold-constraints.d.ts +33 -0
- package/dist/optimize/fold-constraints.d.ts.map +1 -0
- package/dist/optimize/fold-constraints.js +484 -0
- package/dist/optimize/fold-scalar.d.ts +98 -13
- package/dist/optimize/fold-scalar.d.ts.map +1 -1
- package/dist/optimize/fold-scalar.js +98 -13
- package/dist/optimize/fold.d.ts +8 -1
- package/dist/optimize/fold.d.ts.map +1 -1
- package/dist/optimize/fold.js +22 -2
- package/dist/optimize/index.d.ts +9 -1
- package/dist/optimize/index.d.ts.map +1 -1
- package/dist/optimize/index.js +18 -3
- package/dist/optimize/map-node.d.ts +3 -1
- package/dist/optimize/map-node.d.ts.map +1 -1
- package/dist/optimize/map-node.js +48 -3
- package/dist/optimize/peephole.d.ts +16 -0
- package/dist/optimize/peephole.d.ts.map +1 -0
- package/dist/optimize/peephole.js +254 -0
- package/dist/optimize/remap.d.ts +2 -0
- package/dist/optimize/remap.d.ts.map +1 -1
- package/dist/optimize/remap.js +2 -0
- package/dist/optimize/rewrite.d.ts +13 -8
- package/dist/optimize/rewrite.d.ts.map +1 -1
- package/dist/optimize/rewrite.js +13 -8
- package/dist/plan/cache.d.ts +9 -3
- package/dist/plan/cache.d.ts.map +1 -1
- package/dist/plan/cache.js +34 -6
- package/dist/plan/index.d.ts +2 -0
- package/dist/plan/index.d.ts.map +1 -1
- package/dist/plan/index.js +2 -0
- package/dist/plan/predicate.d.ts +2 -0
- package/dist/plan/predicate.d.ts.map +1 -1
- package/dist/plan/predicate.js +298 -29
- package/dist/plan/schema-predicate.d.ts +6 -0
- package/dist/plan/schema-predicate.d.ts.map +1 -1
- package/dist/plan/schema-predicate.js +382 -19
- package/dist/plan/types.d.ts +2 -0
- package/dist/plan/types.d.ts.map +1 -1
- package/dist/plan/types.js +2 -0
- package/dist/result/index.d.ts +19 -5
- package/dist/result/index.d.ts.map +1 -1
- package/dist/result/index.js +10 -2
- package/dist/schema/common.d.ts +69 -6
- package/dist/schema/common.d.ts.map +1 -1
- package/dist/schema/common.js +104 -10
- package/dist/schema/freeze.d.ts +4 -0
- package/dist/schema/freeze.d.ts.map +1 -1
- package/dist/schema/freeze.js +40 -0
- package/dist/schema/index.d.ts +5 -2
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -1
- package/dist/schema/lazy.d.ts +4 -0
- package/dist/schema/lazy.d.ts.map +1 -1
- package/dist/schema/lazy.js +4 -0
- package/dist/schema/literal.d.ts +7 -1
- package/dist/schema/literal.d.ts.map +1 -1
- package/dist/schema/literal.js +7 -1
- package/dist/schema/types.d.ts +109 -100
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +13 -2
- package/dist/schema/undefined.d.ts +17 -0
- package/dist/schema/undefined.d.ts.map +1 -0
- package/dist/schema/undefined.js +77 -0
- package/dist/schema/validate.d.ts +8 -1
- package/dist/schema/validate.d.ts.map +1 -1
- package/dist/schema/validate.js +255 -57
- package/docs/api.md +128 -8
- package/docs/assets/benchmark-headline.svg +163 -0
- package/docs/engine-notes.md +62 -15
- package/docs/index.html +1340 -702
- package/docs/ko/api.md +375 -0
- package/docs/ko/engine-notes.md +156 -0
- package/docs/ko/readme.md +378 -0
- package/package.json +66 -65
package/dist/schema/common.d.ts
CHANGED
|
@@ -1,30 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/common.ts
|
|
3
3
|
* @brief Private schema shape predicates.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
import type { ObjectKeyLookup } from "./types.js";
|
|
6
8
|
/**
|
|
7
|
-
* @brief
|
|
9
|
+
* @brief Sentinel for a missing own data slot.
|
|
10
|
+
* @details `undefined` is a valid schema literal, so absence needs a distinct
|
|
11
|
+
* value that cannot collide with user-authored schema data.
|
|
12
|
+
*/
|
|
13
|
+
declare const missingDataProperty: unique symbol;
|
|
14
|
+
/**
|
|
15
|
+
* @brief Test whether a schema field read observed the sentinel.
|
|
16
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
17
|
+
* validation, compilation, or export.
|
|
18
|
+
* @param value Candidate field value returned by readOwnDataProperty.
|
|
19
|
+
* @returns True when the caller must treat the schema field as absent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isMissingDataProperty(value: unknown): value is typeof missingDataProperty;
|
|
22
|
+
/**
|
|
23
|
+
* @brief Check that an object owns a concrete data descriptor.
|
|
24
|
+
* @param value Object whose descriptor table is being inspected.
|
|
25
|
+
* @param key Field name or symbol.
|
|
26
|
+
* @returns True only when the field exists directly on the object as data.
|
|
27
|
+
* @details Schema records are consumed across public boundaries. Descriptor
|
|
28
|
+
* reads avoid invoking accessors and avoid accepting prototype-backed fields.
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasOwnDataProperty(value: object, key: PropertyKey): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @brief Read one own schema data slot without consulting the prototype chain.
|
|
33
|
+
* @param value Object carrying a schema record.
|
|
34
|
+
* @param key Field name or symbol to read.
|
|
35
|
+
* @returns The stored value, or the missing-data sentinel.
|
|
36
|
+
* @details Callers must not use bracket reads on untrusted schema-like objects:
|
|
37
|
+
* a forged prototype getter could execute code or change validation meaning.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readOwnDataProperty(value: object, key: PropertyKey): unknown;
|
|
40
|
+
/**
|
|
41
|
+
* @brief Accept object records suitable for schema metadata traversal.
|
|
42
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
43
|
+
* validation, compilation, or export.
|
|
44
|
+
* @param value Candidate schema record.
|
|
45
|
+
* @returns True for non-array objects whose own fields are all data slots.
|
|
8
46
|
*/
|
|
9
47
|
export declare function isRecord(value: unknown): value is Readonly<Record<string, unknown>>;
|
|
10
48
|
/**
|
|
11
|
-
* @brief
|
|
49
|
+
* @brief Accept dense arrays whose slots can be read without side effects.
|
|
50
|
+
* @param value Candidate schema vector.
|
|
51
|
+
* @returns True for arrays with only own data descriptors and no holes.
|
|
52
|
+
* @details Schema vectors such as `checks`, `entries`, and `options` are arena
|
|
53
|
+
* metadata. Holes and inherited slots would make validation depend on array
|
|
54
|
+
* prototype state, so they are rejected at the boundary.
|
|
12
55
|
*/
|
|
13
56
|
export declare function isUnknownArray(value: unknown): value is readonly unknown[];
|
|
14
57
|
/**
|
|
15
|
-
* @brief
|
|
58
|
+
* @brief Accept only unmodified RegExp instances in schema records.
|
|
59
|
+
* @param value Candidate pattern object.
|
|
60
|
+
* @returns True for a plain RegExp with no own behavioral overrides.
|
|
61
|
+
* @details Regex checks are copied into generated and interpreted validators.
|
|
62
|
+
* Rejecting own overrides prevents later mutation of `exec`, `test`, `source`,
|
|
63
|
+
* or `flags` from changing stored schema behavior.
|
|
16
64
|
*/
|
|
17
65
|
export declare function isPlainRegExp(value: unknown): value is RegExp;
|
|
18
66
|
/**
|
|
19
|
-
* @brief
|
|
67
|
+
* @brief Validate a dense vector of object shape keys.
|
|
68
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
69
|
+
* validation, compilation, or export.
|
|
70
|
+
* @param value Candidate key vector.
|
|
71
|
+
* @returns True when every slot is a string.
|
|
20
72
|
*/
|
|
21
73
|
export declare function isStringArray(value: unknown): value is readonly string[];
|
|
22
74
|
/**
|
|
23
|
-
* @brief
|
|
75
|
+
* @brief Validate the O(1) lookup table paired with object schema keys.
|
|
76
|
+
* @param value Candidate null or plain object lookup.
|
|
77
|
+
* @param keys Ordered key vector from the same object schema.
|
|
78
|
+
* @returns True when the lookup contains exactly the listed keys mapped to true.
|
|
79
|
+
* @details The lookup and key vector must agree so strict-object validation can
|
|
80
|
+
* reject extra keys without rebuilding a membership set at runtime.
|
|
24
81
|
*/
|
|
25
82
|
export declare function isObjectKeyLookup(value: unknown, keys: readonly string[]): value is ObjectKeyLookup;
|
|
26
83
|
/**
|
|
27
|
-
* @brief
|
|
84
|
+
* @brief Linear membership check for short schema-owned string vectors.
|
|
85
|
+
* @param values Trusted frozen vector.
|
|
86
|
+
* @param value Candidate string.
|
|
87
|
+
* @returns True when the candidate appears in the vector.
|
|
88
|
+
* @details These vectors are small and validation-time only; a loop avoids
|
|
89
|
+
* allocating transient Set objects while preserving deterministic order.
|
|
28
90
|
*/
|
|
29
91
|
export declare function includesString(values: readonly string[], value: string): boolean;
|
|
92
|
+
export {};
|
|
30
93
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schema/common.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,eAAwC,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,OAAO,mBAAmB,CAErC;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,WAAW,GACjB,OAAO,CAIT;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,WAAW,GACjB,OAAO,CAOT;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAKnF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,OAAO,EAAE,CAI1E;AA2CD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO7D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,MAAM,EAAE,CAUxE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,SAAS,MAAM,EAAE,GACxB,KAAK,IAAI,eAAe,CAqB1B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAOhF"}
|
package/dist/schema/common.js
CHANGED
|
@@ -1,9 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/common.ts
|
|
3
3
|
* @brief Private schema shape predicates.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
/**
|
|
6
|
-
* @brief
|
|
8
|
+
* @brief Sentinel for a missing own data slot.
|
|
9
|
+
* @details `undefined` is a valid schema literal, so absence needs a distinct
|
|
10
|
+
* value that cannot collide with user-authored schema data.
|
|
11
|
+
*/
|
|
12
|
+
const missingDataProperty = Symbol("typesea.missingDataProperty");
|
|
13
|
+
/**
|
|
14
|
+
* @brief Test whether a schema field read observed the sentinel.
|
|
15
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
16
|
+
* validation, compilation, or export.
|
|
17
|
+
* @param value Candidate field value returned by readOwnDataProperty.
|
|
18
|
+
* @returns True when the caller must treat the schema field as absent.
|
|
19
|
+
*/
|
|
20
|
+
export function isMissingDataProperty(value) {
|
|
21
|
+
return value === missingDataProperty;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @brief Check that an object owns a concrete data descriptor.
|
|
25
|
+
* @param value Object whose descriptor table is being inspected.
|
|
26
|
+
* @param key Field name or symbol.
|
|
27
|
+
* @returns True only when the field exists directly on the object as data.
|
|
28
|
+
* @details Schema records are consumed across public boundaries. Descriptor
|
|
29
|
+
* reads avoid invoking accessors and avoid accepting prototype-backed fields.
|
|
30
|
+
*/
|
|
31
|
+
export function hasOwnDataProperty(value, key) {
|
|
32
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
33
|
+
return descriptor !== undefined &&
|
|
34
|
+
Object.prototype.hasOwnProperty.call(descriptor, "value");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @brief Read one own schema data slot without consulting the prototype chain.
|
|
38
|
+
* @param value Object carrying a schema record.
|
|
39
|
+
* @param key Field name or symbol to read.
|
|
40
|
+
* @returns The stored value, or the missing-data sentinel.
|
|
41
|
+
* @details Callers must not use bracket reads on untrusted schema-like objects:
|
|
42
|
+
* a forged prototype getter could execute code or change validation meaning.
|
|
43
|
+
*/
|
|
44
|
+
export function readOwnDataProperty(value, key) {
|
|
45
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
46
|
+
if (descriptor === undefined ||
|
|
47
|
+
!Object.prototype.hasOwnProperty.call(descriptor, "value")) {
|
|
48
|
+
return missingDataProperty;
|
|
49
|
+
}
|
|
50
|
+
return descriptor.value;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @brief Accept object records suitable for schema metadata traversal.
|
|
54
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
55
|
+
* validation, compilation, or export.
|
|
56
|
+
* @param value Candidate schema record.
|
|
57
|
+
* @returns True for non-array objects whose own fields are all data slots.
|
|
7
58
|
*/
|
|
8
59
|
export function isRecord(value) {
|
|
9
60
|
return typeof value === "object" &&
|
|
@@ -12,14 +63,23 @@ export function isRecord(value) {
|
|
|
12
63
|
hasOnlyDataProperties(value);
|
|
13
64
|
}
|
|
14
65
|
/**
|
|
15
|
-
* @brief
|
|
66
|
+
* @brief Accept dense arrays whose slots can be read without side effects.
|
|
67
|
+
* @param value Candidate schema vector.
|
|
68
|
+
* @returns True for arrays with only own data descriptors and no holes.
|
|
69
|
+
* @details Schema vectors such as `checks`, `entries`, and `options` are arena
|
|
70
|
+
* metadata. Holes and inherited slots would make validation depend on array
|
|
71
|
+
* prototype state, so they are rejected at the boundary.
|
|
16
72
|
*/
|
|
17
73
|
export function isUnknownArray(value) {
|
|
18
|
-
return Array.isArray(value) &&
|
|
74
|
+
return Array.isArray(value) &&
|
|
75
|
+
hasOnlyDataProperties(value) &&
|
|
76
|
+
hasDenseDataSlots(value);
|
|
19
77
|
}
|
|
20
78
|
/**
|
|
21
|
-
* @brief
|
|
22
|
-
* @details
|
|
79
|
+
* @brief Reject accessor descriptors before schema internals read fields.
|
|
80
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
81
|
+
* validation, compilation, or export.
|
|
82
|
+
* @param value Object whose own descriptor table is inspected.
|
|
23
83
|
* @returns True when every own property is backed by a data slot.
|
|
24
84
|
*/
|
|
25
85
|
function hasOnlyDataProperties(value) {
|
|
@@ -40,7 +100,27 @@ function hasOnlyDataProperties(value) {
|
|
|
40
100
|
return true;
|
|
41
101
|
}
|
|
42
102
|
/**
|
|
43
|
-
* @brief
|
|
103
|
+
* @brief Require array indexes from 0 to length - 1 to be own data slots.
|
|
104
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
105
|
+
* validation, compilation, or export.
|
|
106
|
+
* @param value Candidate schema vector.
|
|
107
|
+
* @returns True when no sparse or prototype-backed index is present.
|
|
108
|
+
*/
|
|
109
|
+
function hasDenseDataSlots(value) {
|
|
110
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
111
|
+
if (!hasOwnDataProperty(value, String(index))) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @brief Accept only unmodified RegExp instances in schema records.
|
|
119
|
+
* @param value Candidate pattern object.
|
|
120
|
+
* @returns True for a plain RegExp with no own behavioral overrides.
|
|
121
|
+
* @details Regex checks are copied into generated and interpreted validators.
|
|
122
|
+
* Rejecting own overrides prevents later mutation of `exec`, `test`, `source`,
|
|
123
|
+
* or `flags` from changing stored schema behavior.
|
|
44
124
|
*/
|
|
45
125
|
export function isPlainRegExp(value) {
|
|
46
126
|
return value instanceof RegExp &&
|
|
@@ -51,7 +131,11 @@ export function isPlainRegExp(value) {
|
|
|
51
131
|
!Object.prototype.hasOwnProperty.call(value, "flags");
|
|
52
132
|
}
|
|
53
133
|
/**
|
|
54
|
-
* @brief
|
|
134
|
+
* @brief Validate a dense vector of object shape keys.
|
|
135
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
136
|
+
* validation, compilation, or export.
|
|
137
|
+
* @param value Candidate key vector.
|
|
138
|
+
* @returns True when every slot is a string.
|
|
55
139
|
*/
|
|
56
140
|
export function isStringArray(value) {
|
|
57
141
|
if (!isUnknownArray(value)) {
|
|
@@ -65,7 +149,12 @@ export function isStringArray(value) {
|
|
|
65
149
|
return true;
|
|
66
150
|
}
|
|
67
151
|
/**
|
|
68
|
-
* @brief
|
|
152
|
+
* @brief Validate the O(1) lookup table paired with object schema keys.
|
|
153
|
+
* @param value Candidate null or plain object lookup.
|
|
154
|
+
* @param keys Ordered key vector from the same object schema.
|
|
155
|
+
* @returns True when the lookup contains exactly the listed keys mapped to true.
|
|
156
|
+
* @details The lookup and key vector must agree so strict-object validation can
|
|
157
|
+
* reject extra keys without rebuilding a membership set at runtime.
|
|
69
158
|
*/
|
|
70
159
|
export function isObjectKeyLookup(value, keys) {
|
|
71
160
|
if (!isRecord(value)) {
|
|
@@ -77,7 +166,7 @@ export function isObjectKeyLookup(value, keys) {
|
|
|
77
166
|
}
|
|
78
167
|
for (let index = 0; index < keys.length; index += 1) {
|
|
79
168
|
const key = keys[index];
|
|
80
|
-
if (key === undefined || value
|
|
169
|
+
if (key === undefined || readOwnDataProperty(value, key) !== true) {
|
|
81
170
|
return false;
|
|
82
171
|
}
|
|
83
172
|
}
|
|
@@ -90,7 +179,12 @@ export function isObjectKeyLookup(value, keys) {
|
|
|
90
179
|
return true;
|
|
91
180
|
}
|
|
92
181
|
/**
|
|
93
|
-
* @brief
|
|
182
|
+
* @brief Linear membership check for short schema-owned string vectors.
|
|
183
|
+
* @param values Trusted frozen vector.
|
|
184
|
+
* @param value Candidate string.
|
|
185
|
+
* @returns True when the candidate appears in the vector.
|
|
186
|
+
* @details These vectors are small and validation-time only; a loop avoids
|
|
187
|
+
* allocating transient Set objects while preserving deterministic order.
|
|
94
188
|
*/
|
|
95
189
|
export function includesString(values, value) {
|
|
96
190
|
for (let index = 0; index < values.length; index += 1) {
|
package/dist/schema/freeze.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/freeze.ts
|
|
3
3
|
* @brief Schema freezing and collection hardening.
|
|
4
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
5
|
+
* schema identity and shape stability.
|
|
4
6
|
*/
|
|
5
7
|
import type { Schema } from "./types.js";
|
|
6
8
|
/**
|
|
7
9
|
* @brief freeze schema.
|
|
10
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
11
|
+
* schema identity and shape stability.
|
|
8
12
|
*/
|
|
9
13
|
export declare function freezeSchema(schema: Schema): Schema;
|
|
10
14
|
//# sourceMappingURL=freeze.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freeze.d.ts","sourceRoot":"","sources":["../../src/schema/freeze.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"freeze.d.ts","sourceRoot":"","sources":["../../src/schema/freeze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAGR,MAAM,EAGT,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
package/dist/schema/freeze.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/freeze.ts
|
|
3
3
|
* @brief Schema freezing and collection hardening.
|
|
4
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
5
|
+
* schema identity and shape stability.
|
|
4
6
|
*/
|
|
5
7
|
import { SchemaTag, StringCheckTag } from "../kind/index.js";
|
|
6
8
|
import { isPlainRegExp } from "./common.js";
|
|
7
9
|
/**
|
|
8
10
|
* @brief freeze schema.
|
|
11
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
12
|
+
* schema identity and shape stability.
|
|
9
13
|
*/
|
|
10
14
|
export function freezeSchema(schema) {
|
|
11
15
|
return freezeSchemaInner(schema, new WeakSet());
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* @brief freeze schema inner.
|
|
19
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
20
|
+
* schema identity and shape stability.
|
|
15
21
|
*/
|
|
16
22
|
function freezeSchemaInner(schema, frozen) {
|
|
17
23
|
if (frozen.has(schema)) {
|
|
@@ -25,17 +31,38 @@ function freezeSchemaInner(schema, frozen) {
|
|
|
25
31
|
case SchemaTag.Number:
|
|
26
32
|
freezeArray(schema.checks, frozen);
|
|
27
33
|
return Object.freeze(schema);
|
|
34
|
+
case SchemaTag.Date:
|
|
35
|
+
freezeArray(schema.checks, frozen);
|
|
36
|
+
return Object.freeze(schema);
|
|
28
37
|
case SchemaTag.Array:
|
|
29
38
|
freezeSchemaInner(schema.item, frozen);
|
|
39
|
+
freezeArray(schema.checks, frozen);
|
|
30
40
|
return Object.freeze(schema);
|
|
31
41
|
case SchemaTag.Tuple:
|
|
32
42
|
freezeSchemaArray(schema.items, frozen);
|
|
43
|
+
if (schema.rest !== undefined) {
|
|
44
|
+
freezeSchemaInner(schema.rest, frozen);
|
|
45
|
+
}
|
|
33
46
|
return Object.freeze(schema);
|
|
34
47
|
case SchemaTag.Record:
|
|
35
48
|
freezeSchemaInner(schema.value, frozen);
|
|
36
49
|
return Object.freeze(schema);
|
|
50
|
+
case SchemaTag.Map:
|
|
51
|
+
freezeSchemaInner(schema.key, frozen);
|
|
52
|
+
freezeSchemaInner(schema.value, frozen);
|
|
53
|
+
return Object.freeze(schema);
|
|
54
|
+
case SchemaTag.Set:
|
|
55
|
+
freezeSchemaInner(schema.item, frozen);
|
|
56
|
+
return Object.freeze(schema);
|
|
57
|
+
case SchemaTag.Property:
|
|
58
|
+
freezeSchemaInner(schema.base, frozen);
|
|
59
|
+
freezeSchemaInner(schema.value, frozen);
|
|
60
|
+
return Object.freeze(schema);
|
|
37
61
|
case SchemaTag.Object:
|
|
38
62
|
freezeObjectEntries(schema.entries, frozen);
|
|
63
|
+
if (schema.catchall !== undefined) {
|
|
64
|
+
freezeSchemaInner(schema.catchall, frozen);
|
|
65
|
+
}
|
|
39
66
|
Object.freeze(schema.keys);
|
|
40
67
|
Object.freeze(schema.keyLookup);
|
|
41
68
|
return Object.freeze(schema);
|
|
@@ -65,6 +92,7 @@ function freezeSchemaInner(schema, frozen) {
|
|
|
65
92
|
case SchemaTag.BigInt:
|
|
66
93
|
case SchemaTag.Symbol:
|
|
67
94
|
case SchemaTag.Boolean:
|
|
95
|
+
case SchemaTag.InstanceOf:
|
|
68
96
|
case SchemaTag.Literal:
|
|
69
97
|
case SchemaTag.Lazy:
|
|
70
98
|
return Object.freeze(schema);
|
|
@@ -72,6 +100,8 @@ function freezeSchemaInner(schema, frozen) {
|
|
|
72
100
|
}
|
|
73
101
|
/**
|
|
74
102
|
* @brief freeze array.
|
|
103
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
104
|
+
* schema identity and shape stability.
|
|
75
105
|
*/
|
|
76
106
|
function freezeArray(values, frozen) {
|
|
77
107
|
for (let index = 0; index < values.length; index += 1) {
|
|
@@ -85,6 +115,8 @@ function freezeArray(values, frozen) {
|
|
|
85
115
|
}
|
|
86
116
|
/**
|
|
87
117
|
* @brief freeze string checks.
|
|
118
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
119
|
+
* schema identity and shape stability.
|
|
88
120
|
*/
|
|
89
121
|
function freezeStringChecks(values, frozen) {
|
|
90
122
|
for (let index = 0; index < values.length; index += 1) {
|
|
@@ -102,6 +134,8 @@ function freezeStringChecks(values, frozen) {
|
|
|
102
134
|
}
|
|
103
135
|
/**
|
|
104
136
|
* @brief freeze regex check.
|
|
137
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
138
|
+
* schema identity and shape stability.
|
|
105
139
|
*/
|
|
106
140
|
function freezeRegexCheck(check) {
|
|
107
141
|
const regex = check.regex;
|
|
@@ -125,6 +159,8 @@ function freezeRegexCheck(check) {
|
|
|
125
159
|
}
|
|
126
160
|
/**
|
|
127
161
|
* @brief freeze schema array.
|
|
162
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
163
|
+
* schema identity and shape stability.
|
|
128
164
|
*/
|
|
129
165
|
function freezeSchemaArray(values, frozen) {
|
|
130
166
|
for (let index = 0; index < values.length; index += 1) {
|
|
@@ -137,6 +173,8 @@ function freezeSchemaArray(values, frozen) {
|
|
|
137
173
|
}
|
|
138
174
|
/**
|
|
139
175
|
* @brief freeze object entries.
|
|
176
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
177
|
+
* schema identity and shape stability.
|
|
140
178
|
*/
|
|
141
179
|
function freezeObjectEntries(entries, frozen) {
|
|
142
180
|
for (let index = 0; index < entries.length; index += 1) {
|
|
@@ -150,6 +188,8 @@ function freezeObjectEntries(entries, frozen) {
|
|
|
150
188
|
}
|
|
151
189
|
/**
|
|
152
190
|
* @brief freeze discriminated union cases.
|
|
191
|
+
* @details Freezing hardens builder output before execution engines or exporters rely on
|
|
192
|
+
* schema identity and shape stability.
|
|
153
193
|
*/
|
|
154
194
|
function freezeDiscriminatedUnionCases(cases, frozen) {
|
|
155
195
|
for (let index = 0; index < cases.length; index += 1) {
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/index.ts
|
|
3
3
|
* @brief Schema module aggregate.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
|
-
export type { ArraySchema, BigIntSchema, BooleanSchema, BrandSchema, DiscriminatedUnionCase, DiscriminatedUnionSchema, IntersectionSchema, LazySchema, LiteralSchema, LiteralValue, NeverSchema, NullableSchema, NumberCheck, NumberGteCheck, NumberIntegerCheck, NumberLteCheck, NumberSchema, ObjectEntry, ObjectKeyLookup, ObjectSchema, OptionalSchema, RecordSchema, RefineSchema, Schema, StringCheck, StringMaxCheck, StringMinCheck, StringRegexCheck, StringSchema, StringUuidCheck, SymbolSchema, TupleSchema, UndefinedableSchema, UnionSchema, UnknownSchema } from "./types.js";
|
|
6
|
-
export { UUID_PATTERN } from "./types.js";
|
|
7
|
+
export type { ArrayCheck, ArrayMaxCheck, ArrayMinCheck, ArraySchema, BigIntSchema, BooleanSchema, BrandSchema, DateCheck, DateMaxCheck, DateMinCheck, DateSchema, DiscriminatedUnionCase, DiscriminatedUnionSchema, IntersectionSchema, LazySchema, LiteralSchema, LiteralValue, NeverSchema, NullableSchema, NumberCheck, NumberGtCheck, NumberGteCheck, NumberIntegerCheck, NumberLtCheck, NumberLteCheck, NumberMultipleOfCheck, NumberSchema, ObjectEntry, ObjectKeyLookup, ObjectSchema, OptionalSchema, InstanceOfSchema, MapSchema, PropertySchema, RecordSchema, RefineSchema, Schema, SetSchema, StringCheck, StringEmailCheck, StringIsoDateCheck, StringIsoDateTimeCheck, StringIpv4Check, StringIpv6Check, StringMaxCheck, StringMinCheck, StringRegexCheck, StringSchema, StringUlidCheck, StringUrlCheck, StringUuidCheck, SymbolSchema, TupleSchema, UndefinedableSchema, UnionSchema, UnknownSchema } from "./types.js";
|
|
8
|
+
export { EMAIL_PATTERN, IPV4_PATTERN, IPV6_PATTERN, ISO_DATETIME_PATTERN, ISO_DATE_PATTERN, ULID_PATTERN, URL_PATTERN, UUID_PATTERN } from "./types.js";
|
|
7
9
|
export { isLiteralValue } from "./literal.js";
|
|
8
10
|
export { isSchemaValue } from "./validate.js";
|
|
9
11
|
export { freezeSchema } from "./freeze.js";
|
|
10
12
|
export { resolveLazySchema } from "./lazy.js";
|
|
13
|
+
export { schemaCanAcceptUndefined } from "./undefined.js";
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,aAAa,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/schema/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/index.ts
|
|
3
3
|
* @brief Schema module aggregate.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
|
-
export { UUID_PATTERN } from "./types.js";
|
|
7
|
+
export { EMAIL_PATTERN, IPV4_PATTERN, IPV6_PATTERN, ISO_DATETIME_PATTERN, ISO_DATE_PATTERN, ULID_PATTERN, URL_PATTERN, UUID_PATTERN } from "./types.js";
|
|
6
8
|
export { isLiteralValue } from "./literal.js";
|
|
7
9
|
export { isSchemaValue } from "./validate.js";
|
|
8
10
|
export { freezeSchema } from "./freeze.js";
|
|
9
11
|
export { resolveLazySchema } from "./lazy.js";
|
|
12
|
+
export { schemaCanAcceptUndefined } from "./undefined.js";
|
package/dist/schema/lazy.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/lazy.ts
|
|
3
3
|
* @brief Lazy schema resolution.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
import type { LazySchema, Schema } from "./types.js";
|
|
6
8
|
/**
|
|
7
9
|
* @brief resolve lazy schema.
|
|
10
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
11
|
+
* validation, compilation, or export.
|
|
8
12
|
*/
|
|
9
13
|
export declare function resolveLazySchema(schema: LazySchema, resolving: WeakSet<object>): Schema;
|
|
10
14
|
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/schema/lazy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/schema/lazy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,GAC3B,MAAM,CAcR"}
|
package/dist/schema/lazy.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/lazy.ts
|
|
3
3
|
* @brief Lazy schema resolution.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
import { SchemaTag } from "../kind/index.js";
|
|
6
8
|
import { freezeSchema } from "./freeze.js";
|
|
7
9
|
import { isSchemaValue } from "./validate.js";
|
|
8
10
|
/**
|
|
9
11
|
* @brief resolve lazy schema.
|
|
12
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
13
|
+
* validation, compilation, or export.
|
|
10
14
|
*/
|
|
11
15
|
export function resolveLazySchema(schema, resolving) {
|
|
12
16
|
if (resolving.has(schema)) {
|
package/dist/schema/literal.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/literal.ts
|
|
3
3
|
* @brief Literal-value boundary checks.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
import type { LiteralValue } from "./types.js";
|
|
6
8
|
/**
|
|
7
|
-
* @brief
|
|
9
|
+
* @brief Validate values that TypeSea can store as exact literals.
|
|
10
|
+
* @param value Candidate literal payload.
|
|
11
|
+
* @returns True for JavaScript primitive literal values plus null and undefined.
|
|
12
|
+
* @details Objects are excluded because literal matching uses `Object.is`.
|
|
13
|
+
* Keeping literals primitive preserves stable interpreter and codegen behavior.
|
|
8
14
|
*/
|
|
9
15
|
export declare function isLiteralValue(value: unknown): value is LiteralValue;
|
|
10
16
|
//# sourceMappingURL=literal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["../../src/schema/literal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["../../src/schema/literal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAWpE"}
|
package/dist/schema/literal.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file schema/literal.ts
|
|
3
3
|
* @brief Literal-value boundary checks.
|
|
4
|
+
* @details Schema helpers enforce construction-time invariants before values reach
|
|
5
|
+
* validation, compilation, or export.
|
|
4
6
|
*/
|
|
5
7
|
/**
|
|
6
|
-
* @brief
|
|
8
|
+
* @brief Validate values that TypeSea can store as exact literals.
|
|
9
|
+
* @param value Candidate literal payload.
|
|
10
|
+
* @returns True for JavaScript primitive literal values plus null and undefined.
|
|
11
|
+
* @details Objects are excluded because literal matching uses `Object.is`.
|
|
12
|
+
* Keeping literals primitive preserves stable interpreter and codegen behavior.
|
|
7
13
|
*/
|
|
8
14
|
export function isLiteralValue(value) {
|
|
9
15
|
const valueType = typeof value;
|