typesea 0.1.0 → 0.2.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.
Files changed (285) hide show
  1. package/CHANGELOG.md +67 -6
  2. package/README.md +98 -17
  3. package/dist/adapters/index.d.ts +50 -8
  4. package/dist/adapters/index.d.ts.map +1 -1
  5. package/dist/adapters/index.js +169 -48
  6. package/dist/aot/index.d.ts +18 -2
  7. package/dist/aot/index.d.ts.map +1 -1
  8. package/dist/aot/index.js +93 -14
  9. package/dist/async/index.d.ts +28 -56
  10. package/dist/async/index.d.ts.map +1 -1
  11. package/dist/async/index.js +94 -37
  12. package/dist/builders/composite.d.ts +37 -6
  13. package/dist/builders/composite.d.ts.map +1 -1
  14. package/dist/builders/composite.js +84 -10
  15. package/dist/builders/index.d.ts +2 -0
  16. package/dist/builders/index.d.ts.map +1 -1
  17. package/dist/builders/index.js +2 -0
  18. package/dist/builders/modifier.d.ts +30 -5
  19. package/dist/builders/modifier.d.ts.map +1 -1
  20. package/dist/builders/modifier.js +38 -5
  21. package/dist/builders/object/guard.d.ts +18 -22
  22. package/dist/builders/object/guard.d.ts.map +1 -1
  23. package/dist/builders/object/guard.js +26 -26
  24. package/dist/builders/object/index.d.ts +2 -0
  25. package/dist/builders/object/index.d.ts.map +1 -1
  26. package/dist/builders/object/index.js +2 -0
  27. package/dist/builders/object/schema.d.ts +55 -9
  28. package/dist/builders/object/schema.d.ts.map +1 -1
  29. package/dist/builders/object/schema.js +92 -15
  30. package/dist/builders/object/types.d.ts +5 -31
  31. package/dist/builders/object/types.d.ts.map +1 -1
  32. package/dist/builders/object/types.js +2 -0
  33. package/dist/builders/scalar.d.ts +29 -8
  34. package/dist/builders/scalar.d.ts.map +1 -1
  35. package/dist/builders/scalar.js +33 -8
  36. package/dist/builders/table.d.ts +4 -0
  37. package/dist/builders/table.d.ts.map +1 -1
  38. package/dist/builders/table.js +4 -0
  39. package/dist/builders/types.d.ts +14 -4
  40. package/dist/builders/types.d.ts.map +1 -1
  41. package/dist/builders/types.js +2 -0
  42. package/dist/compile/check-composite.d.ts +22 -1
  43. package/dist/compile/check-composite.d.ts.map +1 -1
  44. package/dist/compile/check-composite.js +564 -24
  45. package/dist/compile/check-scalar.d.ts +78 -0
  46. package/dist/compile/check-scalar.d.ts.map +1 -1
  47. package/dist/compile/check-scalar.js +432 -1
  48. package/dist/compile/check.d.ts +12 -0
  49. package/dist/compile/check.d.ts.map +1 -1
  50. package/dist/compile/check.js +37 -0
  51. package/dist/compile/context.d.ts +47 -9
  52. package/dist/compile/context.d.ts.map +1 -1
  53. package/dist/compile/context.js +51 -8
  54. package/dist/compile/graph-predicate.d.ts +4 -2
  55. package/dist/compile/graph-predicate.d.ts.map +1 -1
  56. package/dist/compile/graph-predicate.js +1907 -171
  57. package/dist/compile/guard.d.ts +15 -24
  58. package/dist/compile/guard.d.ts.map +1 -1
  59. package/dist/compile/guard.js +158 -74
  60. package/dist/compile/index.d.ts +3 -1
  61. package/dist/compile/index.d.ts.map +1 -1
  62. package/dist/compile/index.js +2 -0
  63. package/dist/compile/issue.d.ts +110 -0
  64. package/dist/compile/issue.d.ts.map +1 -1
  65. package/dist/compile/issue.js +184 -1
  66. package/dist/compile/names.d.ts +12 -2
  67. package/dist/compile/names.d.ts.map +1 -1
  68. package/dist/compile/names.js +19 -3
  69. package/dist/compile/predicate.d.ts +24 -0
  70. package/dist/compile/predicate.d.ts.map +1 -1
  71. package/dist/compile/predicate.js +131 -5
  72. package/dist/compile/runtime.d.ts +80 -12
  73. package/dist/compile/runtime.d.ts.map +1 -1
  74. package/dist/compile/runtime.js +25 -6
  75. package/dist/compile/source.d.ts +10 -2
  76. package/dist/compile/source.d.ts.map +1 -1
  77. package/dist/compile/source.js +361 -26
  78. package/dist/compile/types.d.ts +20 -0
  79. package/dist/compile/types.d.ts.map +1 -1
  80. package/dist/compile/types.js +2 -0
  81. package/dist/decoder/index.d.ts +32 -46
  82. package/dist/decoder/index.d.ts.map +1 -1
  83. package/dist/decoder/index.js +102 -38
  84. package/dist/evaluate/check-composite.d.ts +59 -0
  85. package/dist/evaluate/check-composite.d.ts.map +1 -1
  86. package/dist/evaluate/check-composite.js +151 -3
  87. package/dist/evaluate/check-scalar.d.ts +16 -0
  88. package/dist/evaluate/check-scalar.d.ts.map +1 -1
  89. package/dist/evaluate/check-scalar.js +32 -0
  90. package/dist/evaluate/check.d.ts +7 -0
  91. package/dist/evaluate/check.d.ts.map +1 -1
  92. package/dist/evaluate/check.js +43 -0
  93. package/dist/evaluate/index.d.ts +2 -0
  94. package/dist/evaluate/index.d.ts.map +1 -1
  95. package/dist/evaluate/index.js +2 -0
  96. package/dist/evaluate/issue.d.ts +11 -1
  97. package/dist/evaluate/issue.d.ts.map +1 -1
  98. package/dist/evaluate/issue.js +15 -1
  99. package/dist/evaluate/predicate.d.ts +16 -5
  100. package/dist/evaluate/predicate.d.ts.map +1 -1
  101. package/dist/evaluate/predicate.js +20 -5
  102. package/dist/evaluate/shared.d.ts +59 -13
  103. package/dist/evaluate/shared.d.ts.map +1 -1
  104. package/dist/evaluate/shared.js +66 -8
  105. package/dist/evaluate/state.d.ts +35 -13
  106. package/dist/evaluate/state.d.ts.map +1 -1
  107. package/dist/evaluate/state.js +35 -2
  108. package/dist/guard/base.d.ts +79 -29
  109. package/dist/guard/base.d.ts.map +1 -1
  110. package/dist/guard/base.js +91 -29
  111. package/dist/guard/error.d.ts +10 -5
  112. package/dist/guard/error.d.ts.map +1 -1
  113. package/dist/guard/error.js +10 -5
  114. package/dist/guard/index.d.ts +2 -0
  115. package/dist/guard/index.d.ts.map +1 -1
  116. package/dist/guard/index.js +2 -0
  117. package/dist/guard/number.d.ts +26 -11
  118. package/dist/guard/number.d.ts.map +1 -1
  119. package/dist/guard/number.js +30 -11
  120. package/dist/guard/props.d.ts +27 -3
  121. package/dist/guard/props.d.ts.map +1 -1
  122. package/dist/guard/props.js +27 -3
  123. package/dist/guard/read.d.ts +62 -9
  124. package/dist/guard/read.d.ts.map +1 -1
  125. package/dist/guard/read.js +83 -10
  126. package/dist/guard/registry.d.ts +12 -2
  127. package/dist/guard/registry.d.ts.map +1 -1
  128. package/dist/guard/registry.js +15 -3
  129. package/dist/guard/string.d.ts +33 -13
  130. package/dist/guard/string.d.ts.map +1 -1
  131. package/dist/guard/string.js +37 -13
  132. package/dist/guard/types.d.ts +92 -40
  133. package/dist/guard/types.d.ts.map +1 -1
  134. package/dist/guard/types.js +2 -0
  135. package/dist/index.d.ts +1 -1
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/internal/index.d.ts +42 -6
  138. package/dist/internal/index.d.ts.map +1 -1
  139. package/dist/internal/index.js +51 -8
  140. package/dist/ir/builder.d.ts +16 -126
  141. package/dist/ir/builder.d.ts.map +1 -1
  142. package/dist/ir/builder.js +77 -137
  143. package/dist/ir/freeze.d.ts +4 -0
  144. package/dist/ir/freeze.d.ts.map +1 -1
  145. package/dist/ir/freeze.js +59 -0
  146. package/dist/ir/index.d.ts +3 -1
  147. package/dist/ir/index.d.ts.map +1 -1
  148. package/dist/ir/index.js +2 -0
  149. package/dist/ir/regexp.d.ts +2 -0
  150. package/dist/ir/regexp.d.ts.map +1 -1
  151. package/dist/ir/regexp.js +2 -0
  152. package/dist/ir/types.d.ts +90 -55
  153. package/dist/ir/types.d.ts.map +1 -1
  154. package/dist/ir/types.js +2 -0
  155. package/dist/ir/validate.d.ts +8 -1
  156. package/dist/ir/validate.d.ts.map +1 -1
  157. package/dist/ir/validate.js +477 -61
  158. package/dist/issue/index.d.ts +41 -9
  159. package/dist/issue/index.d.ts.map +1 -1
  160. package/dist/issue/index.js +61 -11
  161. package/dist/json-schema/emit-combinator.d.ts +44 -4
  162. package/dist/json-schema/emit-combinator.d.ts.map +1 -1
  163. package/dist/json-schema/emit-combinator.js +44 -4
  164. package/dist/json-schema/emit-composite.d.ts +10 -0
  165. package/dist/json-schema/emit-composite.d.ts.map +1 -1
  166. package/dist/json-schema/emit-composite.js +15 -1
  167. package/dist/json-schema/emit-scalar.d.ts +26 -3
  168. package/dist/json-schema/emit-scalar.d.ts.map +1 -1
  169. package/dist/json-schema/emit-scalar.js +70 -9
  170. package/dist/json-schema/emit-types.d.ts +11 -1
  171. package/dist/json-schema/emit-types.d.ts.map +1 -1
  172. package/dist/json-schema/emit-types.js +2 -0
  173. package/dist/json-schema/emit.d.ts +12 -1
  174. package/dist/json-schema/emit.d.ts.map +1 -1
  175. package/dist/json-schema/emit.js +12 -1
  176. package/dist/json-schema/freeze.d.ts +13 -2
  177. package/dist/json-schema/freeze.d.ts.map +1 -1
  178. package/dist/json-schema/freeze.js +41 -8
  179. package/dist/json-schema/index.d.ts +16 -2
  180. package/dist/json-schema/index.d.ts.map +1 -1
  181. package/dist/json-schema/index.js +23 -3
  182. package/dist/json-schema/issue.d.ts +4 -1
  183. package/dist/json-schema/issue.d.ts.map +1 -1
  184. package/dist/json-schema/issue.js +4 -1
  185. package/dist/json-schema/read.d.ts +24 -3
  186. package/dist/json-schema/read.d.ts.map +1 -1
  187. package/dist/json-schema/read.js +59 -12
  188. package/dist/json-schema/types.d.ts +38 -15
  189. package/dist/json-schema/types.d.ts.map +1 -1
  190. package/dist/json-schema/types.js +2 -0
  191. package/dist/kind/index.d.ts +15 -28
  192. package/dist/kind/index.d.ts.map +1 -1
  193. package/dist/kind/index.js +15 -10
  194. package/dist/lower/index.d.ts +6 -1
  195. package/dist/lower/index.d.ts.map +1 -1
  196. package/dist/lower/index.js +411 -44
  197. package/dist/message/index.d.ts +46 -10
  198. package/dist/message/index.d.ts.map +1 -1
  199. package/dist/message/index.js +88 -17
  200. package/dist/optimize/algebraic.d.ts +54 -0
  201. package/dist/optimize/algebraic.d.ts.map +1 -0
  202. package/dist/optimize/algebraic.js +314 -0
  203. package/dist/optimize/compact.d.ts +8 -1
  204. package/dist/optimize/compact.d.ts.map +1 -1
  205. package/dist/optimize/compact.js +13 -2
  206. package/dist/optimize/domain.d.ts +16 -0
  207. package/dist/optimize/domain.d.ts.map +1 -0
  208. package/dist/optimize/domain.js +615 -0
  209. package/dist/optimize/fold-boolean.d.ts +17 -2
  210. package/dist/optimize/fold-boolean.d.ts.map +1 -1
  211. package/dist/optimize/fold-boolean.js +59 -14
  212. package/dist/optimize/fold-common.d.ts +43 -8
  213. package/dist/optimize/fold-common.d.ts.map +1 -1
  214. package/dist/optimize/fold-common.js +37 -6
  215. package/dist/optimize/fold-constraints.d.ts +33 -0
  216. package/dist/optimize/fold-constraints.d.ts.map +1 -0
  217. package/dist/optimize/fold-constraints.js +484 -0
  218. package/dist/optimize/fold-scalar.d.ts +98 -13
  219. package/dist/optimize/fold-scalar.d.ts.map +1 -1
  220. package/dist/optimize/fold-scalar.js +98 -13
  221. package/dist/optimize/fold.d.ts +8 -1
  222. package/dist/optimize/fold.d.ts.map +1 -1
  223. package/dist/optimize/fold.js +22 -2
  224. package/dist/optimize/index.d.ts +9 -1
  225. package/dist/optimize/index.d.ts.map +1 -1
  226. package/dist/optimize/index.js +18 -3
  227. package/dist/optimize/map-node.d.ts +3 -1
  228. package/dist/optimize/map-node.d.ts.map +1 -1
  229. package/dist/optimize/map-node.js +45 -3
  230. package/dist/optimize/peephole.d.ts +16 -0
  231. package/dist/optimize/peephole.d.ts.map +1 -0
  232. package/dist/optimize/peephole.js +254 -0
  233. package/dist/optimize/remap.d.ts +2 -0
  234. package/dist/optimize/remap.d.ts.map +1 -1
  235. package/dist/optimize/remap.js +2 -0
  236. package/dist/optimize/rewrite.d.ts +13 -8
  237. package/dist/optimize/rewrite.d.ts.map +1 -1
  238. package/dist/optimize/rewrite.js +13 -8
  239. package/dist/plan/cache.d.ts +9 -3
  240. package/dist/plan/cache.d.ts.map +1 -1
  241. package/dist/plan/cache.js +21 -5
  242. package/dist/plan/index.d.ts +2 -0
  243. package/dist/plan/index.d.ts.map +1 -1
  244. package/dist/plan/index.js +2 -0
  245. package/dist/plan/predicate.d.ts +2 -0
  246. package/dist/plan/predicate.d.ts.map +1 -1
  247. package/dist/plan/predicate.js +268 -29
  248. package/dist/plan/schema-predicate.d.ts +6 -0
  249. package/dist/plan/schema-predicate.d.ts.map +1 -1
  250. package/dist/plan/schema-predicate.js +117 -13
  251. package/dist/plan/types.d.ts +2 -0
  252. package/dist/plan/types.d.ts.map +1 -1
  253. package/dist/plan/types.js +2 -0
  254. package/dist/result/index.d.ts +19 -5
  255. package/dist/result/index.d.ts.map +1 -1
  256. package/dist/result/index.js +10 -2
  257. package/dist/schema/common.d.ts +69 -6
  258. package/dist/schema/common.d.ts.map +1 -1
  259. package/dist/schema/common.js +104 -10
  260. package/dist/schema/freeze.d.ts +4 -0
  261. package/dist/schema/freeze.d.ts.map +1 -1
  262. package/dist/schema/freeze.js +18 -0
  263. package/dist/schema/index.d.ts +3 -0
  264. package/dist/schema/index.d.ts.map +1 -1
  265. package/dist/schema/index.js +3 -0
  266. package/dist/schema/lazy.d.ts +4 -0
  267. package/dist/schema/lazy.d.ts.map +1 -1
  268. package/dist/schema/lazy.js +4 -0
  269. package/dist/schema/literal.d.ts +7 -1
  270. package/dist/schema/literal.d.ts.map +1 -1
  271. package/dist/schema/literal.js +7 -1
  272. package/dist/schema/types.d.ts +20 -96
  273. package/dist/schema/types.d.ts.map +1 -1
  274. package/dist/schema/types.js +5 -1
  275. package/dist/schema/undefined.d.ts +17 -0
  276. package/dist/schema/undefined.d.ts.map +1 -0
  277. package/dist/schema/undefined.js +72 -0
  278. package/dist/schema/validate.d.ts +8 -1
  279. package/dist/schema/validate.d.ts.map +1 -1
  280. package/dist/schema/validate.js +146 -55
  281. package/docs/api.md +57 -0
  282. package/docs/assets/benchmark-headline.svg +163 -0
  283. package/docs/engine-notes.md +58 -15
  284. package/docs/index.html +130 -110
  285. package/package.json +65 -65
@@ -1,42 +1,95 @@
1
1
  /**
2
2
  * @file read.ts
3
3
  * @brief Guard receiver and constructor validation.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import type { NumberSchema, Schema, StringSchema } from "../schema/index.js";
6
8
  /**
7
- * @brief read guard schema.
9
+ * @brief Read schema from a verified guard receiver.
10
+ * @details Constructed guards take the WeakSet fast path; forged structural
11
+ * guards must expose a valid own data schema before use. The fallback exists
12
+ * because public methods can be detached from their instance in JavaScript.
13
+ * @param guard Candidate receiver or guard-like value.
14
+ * @param label Human-readable label used in TypeError messages.
15
+ * @returns Valid runtime schema carried by the guard.
16
+ * @throws TypeError when the receiver is not a valid TypeSea guard.
8
17
  */
9
18
  export declare function readGuardSchema(guard: unknown, label: string): Schema;
10
19
  /**
11
- * @brief read string method schema.
20
+ * @brief Read and require a string schema from a method receiver.
21
+ * @param guard Candidate receiver.
22
+ * @param label Human-readable label used in TypeError messages.
23
+ * @returns String schema carried by the receiver.
24
+ * @throws TypeError when the receiver is not a string guard.
25
+ * @details StringGuard methods share this gate so subtype-specific helpers do
26
+ * not duplicate receiver validation or accept forged schemas.
12
27
  */
13
28
  export declare function readStringMethodSchema(guard: unknown, label: string): StringSchema;
14
29
  /**
15
- * @brief read number method schema.
30
+ * @brief Read and require a number schema from a method receiver.
31
+ * @param guard Candidate receiver.
32
+ * @param label Human-readable label used in TypeError messages.
33
+ * @returns Number schema carried by the receiver.
34
+ * @throws TypeError when the receiver is not a number guard.
35
+ * @details NumberGuard methods must fail before reading numeric check vectors
36
+ * when a receiver is detached or structurally forged.
16
37
  */
17
38
  export declare function readNumberMethodSchema(guard: unknown, label: string): NumberSchema;
18
39
  /**
19
- * @brief read constructor schema.
40
+ * @brief Validate and freeze a generic guard constructor schema.
41
+ * @param schema Candidate runtime schema.
42
+ * @returns Frozen schema accepted by BaseGuard.
43
+ * @throws TypeError when the schema is malformed.
44
+ * @details Constructors are the only place that accepts mutable schema records.
45
+ * Freezing here lets normal method calls use the registry fast path later.
20
46
  */
21
47
  export declare function readConstructorSchema(schema: unknown): Schema;
22
48
  /**
23
- * @brief read string constructor schema.
49
+ * @brief Validate a StringGuard constructor schema.
50
+ * @param schema Candidate runtime schema.
51
+ * @returns String schema accepted by StringGuard.
52
+ * @throws TypeError when the schema is not a string schema.
53
+ * @details Specialized guards keep their schema tag invariant at construction,
54
+ * so hot method calls only need to verify receiver identity.
24
55
  */
25
56
  export declare function readStringConstructorSchema(schema: unknown): StringSchema;
26
57
  /**
27
- * @brief read number constructor schema.
58
+ * @brief Validate a NumberGuard constructor schema.
59
+ * @param schema Candidate runtime schema.
60
+ * @returns Number schema accepted by NumberGuard.
61
+ * @throws TypeError when the schema is not a number schema.
62
+ * @details Rejecting non-number schemas at construction prevents mixed scalar
63
+ * helper methods from observing incompatible check vectors.
28
64
  */
29
65
  export declare function readNumberConstructorSchema(schema: unknown): NumberSchema;
30
66
  /**
31
- * @brief check refinement input.
67
+ * @brief Validate refinement API inputs.
68
+ * @param predicate Candidate refinement predicate.
69
+ * @param name Candidate diagnostic name.
70
+ * @throws TypeError when either input has the wrong runtime type.
71
+ * @details Refinements execute user code by design. This gate narrows the call
72
+ * target and diagnostic label before the schema stores them.
32
73
  */
33
74
  export declare function checkRefinementInput(predicate: unknown, name: unknown): asserts predicate is (value: unknown) => boolean;
34
75
  /**
35
- * @brief check string length bound.
76
+ * @brief Validate a non-negative string length bound.
77
+ * @param value Candidate bound.
78
+ * @param label Bound label used in RangeError messages.
79
+ * @returns The validated bound.
80
+ * @throws RangeError when the bound is negative or non-integer.
81
+ * @details Bounds are checked once at builder time so generated validators can
82
+ * emit straight comparisons without defensive range checks.
36
83
  */
37
84
  export declare function checkStringLengthBound(value: number, label: string): number;
38
85
  /**
39
- * @brief check finite number bound.
86
+ * @brief Validate a finite numeric bound.
87
+ * @param value Candidate bound.
88
+ * @param label Bound label used in RangeError messages.
89
+ * @returns The validated bound.
90
+ * @throws RangeError when the bound is not finite.
91
+ * @details Finite bounds keep interpreter, plan, and emitted code semantics
92
+ * aligned for comparisons such as gte and lte.
40
93
  */
41
94
  export declare function checkFiniteNumberBound(value: number, label: string): number;
42
95
  //# sourceMappingURL=read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/guard/read.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK7E;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAYR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAalF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAalF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAK7D;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAKzE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAKzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAOlD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3E"}
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/guard/read.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAK7E;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC3B,KAAK,EAAE,OAAO,EACd,KAAK,EAAE,MAAM,GACd,MAAM,CAgBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAalF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAalF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAK7D;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAKzE;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,YAAY,CAKzE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,OAAO,EAClB,IAAI,EAAE,OAAO,GACd,OAAO,CAAC,SAAS,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAOlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAK3E"}
@@ -1,29 +1,48 @@
1
1
  /**
2
2
  * @file read.ts
3
3
  * @brief Guard receiver and constructor validation.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import { SchemaTag } from "../kind/index.js";
6
8
  import { freezeSchema, isSchemaValue } from "../schema/index.js";
7
9
  import { isRecord } from "./props.js";
8
10
  import { isConstructedGuard } from "./registry.js";
9
11
  /**
10
- * @brief read guard schema.
12
+ * @brief Read schema from a verified guard receiver.
13
+ * @details Constructed guards take the WeakSet fast path; forged structural
14
+ * guards must expose a valid own data schema before use. The fallback exists
15
+ * because public methods can be detached from their instance in JavaScript.
16
+ * @param guard Candidate receiver or guard-like value.
17
+ * @param label Human-readable label used in TypeError messages.
18
+ * @returns Valid runtime schema carried by the guard.
19
+ * @throws TypeError when the receiver is not a valid TypeSea guard.
11
20
  */
12
21
  export function readGuardSchema(guard, label) {
13
22
  if (isConstructedGuard(guard)) {
23
+ /*
24
+ * Constructed guards have already frozen their schema, so the registry
25
+ * path avoids repeating structural schema validation for normal calls.
26
+ */
14
27
  return guard.schema;
15
28
  }
16
29
  if (!isRecord(guard)) {
17
30
  throw new TypeError(`${label} must be a TypeSea guard`);
18
31
  }
19
- const schema = guard["schema"];
32
+ const schema = readOwnDataProperty(guard, "schema");
20
33
  if (!isSchemaValue(schema)) {
21
34
  throw new TypeError(`${label} must contain a valid TypeSea schema`);
22
35
  }
23
36
  return schema;
24
37
  }
25
38
  /**
26
- * @brief read string method schema.
39
+ * @brief Read and require a string schema from a method receiver.
40
+ * @param guard Candidate receiver.
41
+ * @param label Human-readable label used in TypeError messages.
42
+ * @returns String schema carried by the receiver.
43
+ * @throws TypeError when the receiver is not a string guard.
44
+ * @details StringGuard methods share this gate so subtype-specific helpers do
45
+ * not duplicate receiver validation or accept forged schemas.
27
46
  */
28
47
  export function readStringMethodSchema(guard, label) {
29
48
  if (isConstructedGuard(guard)) {
@@ -40,7 +59,13 @@ export function readStringMethodSchema(guard, label) {
40
59
  return schema;
41
60
  }
42
61
  /**
43
- * @brief read number method schema.
62
+ * @brief Read and require a number schema from a method receiver.
63
+ * @param guard Candidate receiver.
64
+ * @param label Human-readable label used in TypeError messages.
65
+ * @returns Number schema carried by the receiver.
66
+ * @throws TypeError when the receiver is not a number guard.
67
+ * @details NumberGuard methods must fail before reading numeric check vectors
68
+ * when a receiver is detached or structurally forged.
44
69
  */
45
70
  export function readNumberMethodSchema(guard, label) {
46
71
  if (isConstructedGuard(guard)) {
@@ -57,7 +82,12 @@ export function readNumberMethodSchema(guard, label) {
57
82
  return schema;
58
83
  }
59
84
  /**
60
- * @brief read constructor schema.
85
+ * @brief Validate and freeze a generic guard constructor schema.
86
+ * @param schema Candidate runtime schema.
87
+ * @returns Frozen schema accepted by BaseGuard.
88
+ * @throws TypeError when the schema is malformed.
89
+ * @details Constructors are the only place that accepts mutable schema records.
90
+ * Freezing here lets normal method calls use the registry fast path later.
61
91
  */
62
92
  export function readConstructorSchema(schema) {
63
93
  if (!isSchemaValue(schema)) {
@@ -66,7 +96,12 @@ export function readConstructorSchema(schema) {
66
96
  return freezeSchema(schema);
67
97
  }
68
98
  /**
69
- * @brief read string constructor schema.
99
+ * @brief Validate a StringGuard constructor schema.
100
+ * @param schema Candidate runtime schema.
101
+ * @returns String schema accepted by StringGuard.
102
+ * @throws TypeError when the schema is not a string schema.
103
+ * @details Specialized guards keep their schema tag invariant at construction,
104
+ * so hot method calls only need to verify receiver identity.
70
105
  */
71
106
  export function readStringConstructorSchema(schema) {
72
107
  if (!isSchemaValue(schema) || schema.tag !== SchemaTag.String) {
@@ -75,7 +110,12 @@ export function readStringConstructorSchema(schema) {
75
110
  return schema;
76
111
  }
77
112
  /**
78
- * @brief read number constructor schema.
113
+ * @brief Validate a NumberGuard constructor schema.
114
+ * @param schema Candidate runtime schema.
115
+ * @returns Number schema accepted by NumberGuard.
116
+ * @throws TypeError when the schema is not a number schema.
117
+ * @details Rejecting non-number schemas at construction prevents mixed scalar
118
+ * helper methods from observing incompatible check vectors.
79
119
  */
80
120
  export function readNumberConstructorSchema(schema) {
81
121
  if (!isSchemaValue(schema) || schema.tag !== SchemaTag.Number) {
@@ -84,7 +124,12 @@ export function readNumberConstructorSchema(schema) {
84
124
  return schema;
85
125
  }
86
126
  /**
87
- * @brief check refinement input.
127
+ * @brief Validate refinement API inputs.
128
+ * @param predicate Candidate refinement predicate.
129
+ * @param name Candidate diagnostic name.
130
+ * @throws TypeError when either input has the wrong runtime type.
131
+ * @details Refinements execute user code by design. This gate narrows the call
132
+ * target and diagnostic label before the schema stores them.
88
133
  */
89
134
  export function checkRefinementInput(predicate, name) {
90
135
  if (typeof predicate !== "function") {
@@ -95,7 +140,13 @@ export function checkRefinementInput(predicate, name) {
95
140
  }
96
141
  }
97
142
  /**
98
- * @brief check string length bound.
143
+ * @brief Validate a non-negative string length bound.
144
+ * @param value Candidate bound.
145
+ * @param label Bound label used in RangeError messages.
146
+ * @returns The validated bound.
147
+ * @throws RangeError when the bound is negative or non-integer.
148
+ * @details Bounds are checked once at builder time so generated validators can
149
+ * emit straight comparisons without defensive range checks.
99
150
  */
100
151
  export function checkStringLengthBound(value, label) {
101
152
  if (!Number.isInteger(value) || value < 0) {
@@ -104,7 +155,13 @@ export function checkStringLengthBound(value, label) {
104
155
  return value;
105
156
  }
106
157
  /**
107
- * @brief check finite number bound.
158
+ * @brief Validate a finite numeric bound.
159
+ * @param value Candidate bound.
160
+ * @param label Bound label used in RangeError messages.
161
+ * @returns The validated bound.
162
+ * @throws RangeError when the bound is not finite.
163
+ * @details Finite bounds keep interpreter, plan, and emitted code semantics
164
+ * aligned for comparisons such as gte and lte.
108
165
  */
109
166
  export function checkFiniteNumberBound(value, label) {
110
167
  if (typeof value !== "number" || !Number.isFinite(value)) {
@@ -112,3 +169,19 @@ export function checkFiniteNumberBound(value, label) {
112
169
  }
113
170
  return value;
114
171
  }
172
+ /**
173
+ * @brief Read one own data slot from a structural guard receiver.
174
+ * @param value Candidate receiver.
175
+ * @param key Field name or symbol.
176
+ * @returns Stored field value, or undefined when the slot is absent.
177
+ * @details Structural guard support is intentionally narrow: inherited schema
178
+ * getters must not execute while validating detached method receivers.
179
+ */
180
+ function readOwnDataProperty(value, key) {
181
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
182
+ if (descriptor === undefined ||
183
+ !Object.prototype.hasOwnProperty.call(descriptor, "value")) {
184
+ return undefined;
185
+ }
186
+ return descriptor.value;
187
+ }
@@ -1,15 +1,25 @@
1
1
  /**
2
2
  * @file registry.ts
3
3
  * @brief Constructed guard receiver registry.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import type { BaseGuard } from "./base.js";
6
8
  import type { Presence } from "./types.js";
7
9
  /**
8
- * @brief register constructed guard.
10
+ * @brief Mark a guard instance as constructor-owned.
11
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
12
+ * existing guard instance.
13
+ * @param value Guard instance created by TypeSea constructors.
14
+ * @post The value can use the fast receiver validation path.
9
15
  */
10
16
  export declare function registerConstructedGuard(value: object): void;
11
17
  /**
12
- * @brief is constructed guard.
18
+ * @brief Test whether a receiver was built by a TypeSea guard constructor.
19
+ * @param value Candidate receiver.
20
+ * @returns True when the value was registered by a TypeSea guard constructor.
21
+ * @details Public methods use this check to skip structural schema validation
22
+ * only for receivers whose schema slot was already frozen during construction.
13
23
  */
14
24
  export declare function isConstructedGuard(value: unknown): value is BaseGuard<unknown, Presence>;
15
25
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/guard/registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQ3C;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAEvC"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/guard/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAU3C;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,CAEvC"}
@@ -1,20 +1,32 @@
1
1
  /**
2
2
  * @file registry.ts
3
3
  * @brief Constructed guard receiver registry.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import { isRecord } from "./props.js";
6
8
  /**
7
- * @brief constructed guards.
9
+ * @brief Receiver identity table for guards constructed by TypeSea.
10
+ * @details Weak membership proves that a receiver passed a TypeSea constructor
11
+ * without adding public marker fields that user code could forge.
8
12
  */
9
13
  const constructedGuards = new WeakSet();
10
14
  /**
11
- * @brief register constructed guard.
15
+ * @brief Mark a guard instance as constructor-owned.
16
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
17
+ * existing guard instance.
18
+ * @param value Guard instance created by TypeSea constructors.
19
+ * @post The value can use the fast receiver validation path.
12
20
  */
13
21
  export function registerConstructedGuard(value) {
14
22
  constructedGuards.add(value);
15
23
  }
16
24
  /**
17
- * @brief is constructed guard.
25
+ * @brief Test whether a receiver was built by a TypeSea guard constructor.
26
+ * @param value Candidate receiver.
27
+ * @returns True when the value was registered by a TypeSea guard constructor.
28
+ * @details Public methods use this check to skip structural schema validation
29
+ * only for receivers whose schema slot was already frozen during construction.
18
30
  */
19
31
  export function isConstructedGuard(value) {
20
32
  return isRecord(value) && constructedGuards.has(value);
@@ -1,36 +1,56 @@
1
1
  /**
2
2
  * @file string.ts
3
3
  * @brief String guard implementation.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import type { StringSchema } from "../schema/index.js";
6
8
  import { BaseGuard } from "./base.js";
7
9
  import type { Presence } from "./types.js";
8
10
  /**
9
- * @brief string guard.
10
- * @details Owns its state directly; methods expose receiver checks and explicit result flow.
11
- * @invariant Construction leaves the instance in a fully usable state before it escapes.
11
+ * @brief Persistent builder for string predicates.
12
+ * @details Refinement methods append schema checks and return fresh frozen
13
+ * guards, so shared guard values cannot be mutated by later chains.
12
14
  */
13
15
  export declare class StringGuard<TPresence extends Presence = "required"> extends BaseGuard<string, TPresence> {
14
16
  /**
15
- * @brief constructor.
16
- * @post The receiver is initialized according to the class invariant before it can be observed.
17
+ * @brief Construct a frozen string guard.
18
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
19
+ * existing guard instance.
20
+ * @param schema String schema backing this guard.
17
21
  */
18
22
  constructor(schema: StringSchema);
19
23
  /**
20
- * @brief min.
21
- */
24
+ * @brief Add a minimum string length.
25
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
26
+ * existing guard instance.
27
+ * @param value Non-negative integer lower length bound.
28
+ * @returns Fresh StringGuard with an appended min check.
29
+ */
22
30
  min(value: number): StringGuard<TPresence>;
23
31
  /**
24
- * @brief max.
25
- */
32
+ * @brief Add a maximum string length.
33
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
34
+ * existing guard instance.
35
+ * @param value Non-negative integer upper length bound.
36
+ * @returns Fresh StringGuard with an appended max check.
37
+ */
26
38
  max(value: number): StringGuard<TPresence>;
27
39
  /**
28
- * @brief regex.
29
- */
40
+ * @brief Add a regular expression check.
41
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
42
+ * existing guard instance.
43
+ * @param pattern Plain RegExp instance to clone into the schema.
44
+ * @param name Diagnostic name for pattern failures.
45
+ * @returns Fresh StringGuard with an appended regex check.
46
+ */
30
47
  regex(pattern: RegExp, name: string): StringGuard<TPresence>;
31
48
  /**
32
- * @brief uuid.
33
- */
49
+ * @brief Add the built-in UUID string check.
50
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
51
+ * existing guard instance.
52
+ * @returns Fresh StringGuard with an appended uuid check.
53
+ */
34
54
  uuid(): StringGuard<TPresence>;
35
55
  }
36
56
  //# sourceMappingURL=string.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/guard/string.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,qBAAa,WAAW,CACtB,SAAS,SAAS,QAAQ,GAAG,UAAU,CACvC,SAAQ,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAEpC;;;OAGG;gBACgB,MAAM,EAAE,YAAY;IAKvC;;aAES;IACF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAejD;;aAES;IACF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAejD;;eAEW;IACJ,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAqBnE;;WAEO;IACA,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC;CAYtC"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/guard/string.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAOtC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C;;;;GAIG;AACH,qBAAa,WAAW,CACpB,SAAS,SAAS,QAAQ,GAAG,UAAU,CACzC,SAAQ,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAElC;;;;;OAKG;gBACgB,MAAM,EAAE,YAAY;IAKvC;;;;;;OAMG;IACI,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAejD;;;;;;OAMG;IACI,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAejD;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAyBnE;;;;;OAKG;IACI,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC;CAYxC"}
@@ -1,28 +1,36 @@
1
1
  /**
2
2
  * @file string.ts
3
3
  * @brief String guard implementation.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
4
6
  */
5
7
  import { SchemaTag, StringCheckTag } from "../kind/index.js";
6
8
  import { BaseGuard } from "./base.js";
7
9
  import { isPlainRegExp } from "./props.js";
8
10
  import { checkStringLengthBound, readStringConstructorSchema, readStringMethodSchema } from "./read.js";
9
11
  /**
10
- * @brief string guard.
11
- * @details Owns its state directly; methods expose receiver checks and explicit result flow.
12
- * @invariant Construction leaves the instance in a fully usable state before it escapes.
12
+ * @brief Persistent builder for string predicates.
13
+ * @details Refinement methods append schema checks and return fresh frozen
14
+ * guards, so shared guard values cannot be mutated by later chains.
13
15
  */
14
16
  export class StringGuard extends BaseGuard {
15
17
  /**
16
- * @brief constructor.
17
- * @post The receiver is initialized according to the class invariant before it can be observed.
18
+ * @brief Construct a frozen string guard.
19
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
20
+ * existing guard instance.
21
+ * @param schema String schema backing this guard.
18
22
  */
19
23
  constructor(schema) {
20
24
  super(readStringConstructorSchema(schema));
21
25
  Object.freeze(this);
22
26
  }
23
27
  /**
24
- * @brief min.
25
- */
28
+ * @brief Add a minimum string length.
29
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
30
+ * existing guard instance.
31
+ * @param value Non-negative integer lower length bound.
32
+ * @returns Fresh StringGuard with an appended min check.
33
+ */
26
34
  min(value) {
27
35
  const schema = readStringMethodSchema(this, "string min receiver");
28
36
  const bound = checkStringLengthBound(value, "min");
@@ -38,8 +46,12 @@ export class StringGuard extends BaseGuard {
38
46
  });
39
47
  }
40
48
  /**
41
- * @brief max.
42
- */
49
+ * @brief Add a maximum string length.
50
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
51
+ * existing guard instance.
52
+ * @param value Non-negative integer upper length bound.
53
+ * @returns Fresh StringGuard with an appended max check.
54
+ */
43
55
  max(value) {
44
56
  const schema = readStringMethodSchema(this, "string max receiver");
45
57
  const bound = checkStringLengthBound(value, "max");
@@ -55,8 +67,13 @@ export class StringGuard extends BaseGuard {
55
67
  });
56
68
  }
57
69
  /**
58
- * @brief regex.
59
- */
70
+ * @brief Add a regular expression check.
71
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
72
+ * existing guard instance.
73
+ * @param pattern Plain RegExp instance to clone into the schema.
74
+ * @param name Diagnostic name for pattern failures.
75
+ * @returns Fresh StringGuard with an appended regex check.
76
+ */
60
77
  regex(pattern, name) {
61
78
  if (!isPlainRegExp(pattern)) {
62
79
  throw new TypeError("regex pattern must be a plain RegExp");
@@ -65,6 +82,10 @@ export class StringGuard extends BaseGuard {
65
82
  throw new TypeError("regex name must be a string");
66
83
  }
67
84
  const schema = readStringMethodSchema(this, "string regex receiver");
85
+ /*
86
+ * Clone the pattern so later mutation of lastIndex or subclass state on
87
+ * the caller-owned RegExp cannot affect validation.
88
+ */
68
89
  return new StringGuard({
69
90
  tag: SchemaTag.String,
70
91
  checks: [
@@ -78,8 +99,11 @@ export class StringGuard extends BaseGuard {
78
99
  });
79
100
  }
80
101
  /**
81
- * @brief uuid.
82
- */
102
+ * @brief Add the built-in UUID string check.
103
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
104
+ * existing guard instance.
105
+ * @returns Fresh StringGuard with an appended uuid check.
106
+ */
83
107
  uuid() {
84
108
  const schema = readStringMethodSchema(this, "string uuid receiver");
85
109
  return new StringGuard({