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.
Files changed (301) hide show
  1. package/CHANGELOG.md +85 -6
  2. package/README.md +143 -28
  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 +19 -3
  7. package/dist/aot/index.d.ts.map +1 -1
  8. package/dist/aot/index.js +115 -17
  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 +43 -9
  13. package/dist/builders/composite.d.ts.map +1 -1
  14. package/dist/builders/composite.js +100 -17
  15. package/dist/builders/index.d.ts +8 -5
  16. package/dist/builders/index.d.ts.map +1 -1
  17. package/dist/builders/index.js +7 -4
  18. package/dist/builders/modifier.d.ts +36 -5
  19. package/dist/builders/modifier.d.ts.map +1 -1
  20. package/dist/builders/modifier.js +52 -5
  21. package/dist/builders/object/guard.d.ts +72 -24
  22. package/dist/builders/object/guard.d.ts.map +1 -1
  23. package/dist/builders/object/guard.js +139 -29
  24. package/dist/builders/object/index.d.ts +4 -2
  25. package/dist/builders/object/index.d.ts.map +1 -1
  26. package/dist/builders/object/index.js +3 -1
  27. package/dist/builders/object/schema.d.ts +88 -11
  28. package/dist/builders/object/schema.d.ts.map +1 -1
  29. package/dist/builders/object/schema.js +290 -23
  30. package/dist/builders/object/types.d.ts +20 -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/runtime.d.ts +40 -0
  34. package/dist/builders/runtime.d.ts.map +1 -0
  35. package/dist/builders/runtime.js +150 -0
  36. package/dist/builders/scalar.d.ts +49 -9
  37. package/dist/builders/scalar.d.ts.map +1 -1
  38. package/dist/builders/scalar.js +87 -9
  39. package/dist/builders/table.d.ts +35 -5
  40. package/dist/builders/table.d.ts.map +1 -1
  41. package/dist/builders/table.js +35 -5
  42. package/dist/builders/types.d.ts +20 -4
  43. package/dist/builders/types.d.ts.map +1 -1
  44. package/dist/builders/types.js +2 -0
  45. package/dist/compile/check-composite.d.ts +25 -2
  46. package/dist/compile/check-composite.d.ts.map +1 -1
  47. package/dist/compile/check-composite.js +699 -27
  48. package/dist/compile/check-scalar.d.ts +88 -0
  49. package/dist/compile/check-scalar.d.ts.map +1 -1
  50. package/dist/compile/check-scalar.js +570 -3
  51. package/dist/compile/check.d.ts +12 -0
  52. package/dist/compile/check.d.ts.map +1 -1
  53. package/dist/compile/check.js +62 -3
  54. package/dist/compile/context.d.ts +47 -9
  55. package/dist/compile/context.d.ts.map +1 -1
  56. package/dist/compile/context.js +53 -8
  57. package/dist/compile/first.d.ts +26 -0
  58. package/dist/compile/first.d.ts.map +1 -0
  59. package/dist/compile/first.js +850 -0
  60. package/dist/compile/graph-predicate.d.ts +4 -2
  61. package/dist/compile/graph-predicate.d.ts.map +1 -1
  62. package/dist/compile/graph-predicate.js +2272 -165
  63. package/dist/compile/guard.d.ts +16 -24
  64. package/dist/compile/guard.d.ts.map +1 -1
  65. package/dist/compile/guard.js +202 -72
  66. package/dist/compile/index.d.ts +3 -1
  67. package/dist/compile/index.d.ts.map +1 -1
  68. package/dist/compile/index.js +2 -0
  69. package/dist/compile/issue.d.ts +110 -0
  70. package/dist/compile/issue.d.ts.map +1 -1
  71. package/dist/compile/issue.js +184 -1
  72. package/dist/compile/names.d.ts +12 -2
  73. package/dist/compile/names.d.ts.map +1 -1
  74. package/dist/compile/names.js +19 -3
  75. package/dist/compile/predicate.d.ts +24 -0
  76. package/dist/compile/predicate.d.ts.map +1 -1
  77. package/dist/compile/predicate.js +287 -10
  78. package/dist/compile/runtime.d.ts +100 -13
  79. package/dist/compile/runtime.d.ts.map +1 -1
  80. package/dist/compile/runtime.js +56 -6
  81. package/dist/compile/source.d.ts +10 -2
  82. package/dist/compile/source.d.ts.map +1 -1
  83. package/dist/compile/source.js +385 -26
  84. package/dist/compile/types.d.ts +22 -0
  85. package/dist/compile/types.d.ts.map +1 -1
  86. package/dist/compile/types.js +2 -0
  87. package/dist/decoder/index.d.ts +92 -46
  88. package/dist/decoder/index.d.ts.map +1 -1
  89. package/dist/decoder/index.js +266 -39
  90. package/dist/evaluate/check-composite.d.ts +111 -2
  91. package/dist/evaluate/check-composite.d.ts.map +1 -1
  92. package/dist/evaluate/check-composite.js +343 -8
  93. package/dist/evaluate/check-scalar.d.ts +25 -0
  94. package/dist/evaluate/check-scalar.d.ts.map +1 -1
  95. package/dist/evaluate/check-scalar.js +124 -3
  96. package/dist/evaluate/check.d.ts +7 -0
  97. package/dist/evaluate/check.d.ts.map +1 -1
  98. package/dist/evaluate/check.js +62 -4
  99. package/dist/evaluate/index.d.ts +2 -0
  100. package/dist/evaluate/index.d.ts.map +1 -1
  101. package/dist/evaluate/index.js +2 -0
  102. package/dist/evaluate/issue.d.ts +11 -1
  103. package/dist/evaluate/issue.d.ts.map +1 -1
  104. package/dist/evaluate/issue.js +15 -1
  105. package/dist/evaluate/predicate.d.ts +16 -5
  106. package/dist/evaluate/predicate.d.ts.map +1 -1
  107. package/dist/evaluate/predicate.js +20 -5
  108. package/dist/evaluate/shared.d.ts +78 -13
  109. package/dist/evaluate/shared.d.ts.map +1 -1
  110. package/dist/evaluate/shared.js +101 -8
  111. package/dist/evaluate/state.d.ts +35 -13
  112. package/dist/evaluate/state.d.ts.map +1 -1
  113. package/dist/evaluate/state.js +35 -2
  114. package/dist/guard/array.d.ts +48 -0
  115. package/dist/guard/array.d.ts.map +1 -0
  116. package/dist/guard/array.js +84 -0
  117. package/dist/guard/base.d.ts +111 -31
  118. package/dist/guard/base.d.ts.map +1 -1
  119. package/dist/guard/base.js +165 -32
  120. package/dist/guard/date.d.ts +34 -0
  121. package/dist/guard/date.d.ts.map +1 -0
  122. package/dist/guard/date.js +60 -0
  123. package/dist/guard/error.d.ts +10 -5
  124. package/dist/guard/error.d.ts.map +1 -1
  125. package/dist/guard/error.js +10 -5
  126. package/dist/guard/index.d.ts +4 -0
  127. package/dist/guard/index.d.ts.map +1 -1
  128. package/dist/guard/index.js +4 -0
  129. package/dist/guard/number.d.ts +86 -11
  130. package/dist/guard/number.d.ts.map +1 -1
  131. package/dist/guard/number.js +159 -11
  132. package/dist/guard/props.d.ts +27 -3
  133. package/dist/guard/props.d.ts.map +1 -1
  134. package/dist/guard/props.js +27 -3
  135. package/dist/guard/read.d.ts +115 -10
  136. package/dist/guard/read.d.ts.map +1 -1
  137. package/dist/guard/read.js +185 -10
  138. package/dist/guard/registry.d.ts +12 -2
  139. package/dist/guard/registry.d.ts.map +1 -1
  140. package/dist/guard/registry.js +15 -3
  141. package/dist/guard/string.d.ts +115 -13
  142. package/dist/guard/string.d.ts.map +1 -1
  143. package/dist/guard/string.js +250 -13
  144. package/dist/guard/types.d.ts +110 -40
  145. package/dist/guard/types.d.ts.map +1 -1
  146. package/dist/guard/types.js +2 -0
  147. package/dist/index.d.ts +5 -5
  148. package/dist/index.d.ts.map +1 -1
  149. package/dist/index.js +4 -4
  150. package/dist/internal/index.d.ts +42 -6
  151. package/dist/internal/index.d.ts.map +1 -1
  152. package/dist/internal/index.js +51 -8
  153. package/dist/ir/builder.d.ts +17 -127
  154. package/dist/ir/builder.d.ts.map +1 -1
  155. package/dist/ir/builder.js +80 -137
  156. package/dist/ir/freeze.d.ts +4 -0
  157. package/dist/ir/freeze.d.ts.map +1 -1
  158. package/dist/ir/freeze.js +66 -0
  159. package/dist/ir/index.d.ts +3 -1
  160. package/dist/ir/index.d.ts.map +1 -1
  161. package/dist/ir/index.js +2 -0
  162. package/dist/ir/regexp.d.ts +2 -0
  163. package/dist/ir/regexp.d.ts.map +1 -1
  164. package/dist/ir/regexp.js +2 -0
  165. package/dist/ir/types.d.ts +94 -56
  166. package/dist/ir/types.d.ts.map +1 -1
  167. package/dist/ir/types.js +2 -0
  168. package/dist/ir/validate.d.ts +8 -1
  169. package/dist/ir/validate.d.ts.map +1 -1
  170. package/dist/ir/validate.js +511 -61
  171. package/dist/issue/index.d.ts +42 -10
  172. package/dist/issue/index.d.ts.map +1 -1
  173. package/dist/issue/index.js +65 -11
  174. package/dist/json-schema/emit-combinator.d.ts +44 -4
  175. package/dist/json-schema/emit-combinator.d.ts.map +1 -1
  176. package/dist/json-schema/emit-combinator.js +44 -4
  177. package/dist/json-schema/emit-composite.d.ts +16 -2
  178. package/dist/json-schema/emit-composite.d.ts.map +1 -1
  179. package/dist/json-schema/emit-composite.js +81 -13
  180. package/dist/json-schema/emit-scalar.d.ts +26 -3
  181. package/dist/json-schema/emit-scalar.d.ts.map +1 -1
  182. package/dist/json-schema/emit-scalar.js +124 -10
  183. package/dist/json-schema/emit-types.d.ts +11 -1
  184. package/dist/json-schema/emit-types.d.ts.map +1 -1
  185. package/dist/json-schema/emit-types.js +2 -0
  186. package/dist/json-schema/emit.d.ts +12 -1
  187. package/dist/json-schema/emit.d.ts.map +1 -1
  188. package/dist/json-schema/emit.js +23 -3
  189. package/dist/json-schema/freeze.d.ts +13 -2
  190. package/dist/json-schema/freeze.d.ts.map +1 -1
  191. package/dist/json-schema/freeze.js +41 -8
  192. package/dist/json-schema/index.d.ts +16 -2
  193. package/dist/json-schema/index.d.ts.map +1 -1
  194. package/dist/json-schema/index.js +23 -3
  195. package/dist/json-schema/issue.d.ts +4 -1
  196. package/dist/json-schema/issue.d.ts.map +1 -1
  197. package/dist/json-schema/issue.js +4 -1
  198. package/dist/json-schema/read.d.ts +24 -3
  199. package/dist/json-schema/read.d.ts.map +1 -1
  200. package/dist/json-schema/read.js +59 -12
  201. package/dist/json-schema/types.d.ts +45 -16
  202. package/dist/json-schema/types.d.ts.map +1 -1
  203. package/dist/json-schema/types.js +2 -0
  204. package/dist/kind/index.d.ts +40 -28
  205. package/dist/kind/index.d.ts.map +1 -1
  206. package/dist/kind/index.js +41 -13
  207. package/dist/lower/index.d.ts +6 -1
  208. package/dist/lower/index.d.ts.map +1 -1
  209. package/dist/lower/index.js +462 -46
  210. package/dist/message/index.d.ts +64 -10
  211. package/dist/message/index.d.ts.map +1 -1
  212. package/dist/message/index.js +155 -17
  213. package/dist/optimize/algebraic.d.ts +54 -0
  214. package/dist/optimize/algebraic.d.ts.map +1 -0
  215. package/dist/optimize/algebraic.js +314 -0
  216. package/dist/optimize/compact.d.ts +8 -1
  217. package/dist/optimize/compact.d.ts.map +1 -1
  218. package/dist/optimize/compact.js +13 -2
  219. package/dist/optimize/domain.d.ts +16 -0
  220. package/dist/optimize/domain.d.ts.map +1 -0
  221. package/dist/optimize/domain.js +619 -0
  222. package/dist/optimize/fold-boolean.d.ts +17 -2
  223. package/dist/optimize/fold-boolean.d.ts.map +1 -1
  224. package/dist/optimize/fold-boolean.js +59 -14
  225. package/dist/optimize/fold-common.d.ts +43 -8
  226. package/dist/optimize/fold-common.d.ts.map +1 -1
  227. package/dist/optimize/fold-common.js +37 -6
  228. package/dist/optimize/fold-constraints.d.ts +33 -0
  229. package/dist/optimize/fold-constraints.d.ts.map +1 -0
  230. package/dist/optimize/fold-constraints.js +484 -0
  231. package/dist/optimize/fold-scalar.d.ts +98 -13
  232. package/dist/optimize/fold-scalar.d.ts.map +1 -1
  233. package/dist/optimize/fold-scalar.js +98 -13
  234. package/dist/optimize/fold.d.ts +8 -1
  235. package/dist/optimize/fold.d.ts.map +1 -1
  236. package/dist/optimize/fold.js +22 -2
  237. package/dist/optimize/index.d.ts +9 -1
  238. package/dist/optimize/index.d.ts.map +1 -1
  239. package/dist/optimize/index.js +18 -3
  240. package/dist/optimize/map-node.d.ts +3 -1
  241. package/dist/optimize/map-node.d.ts.map +1 -1
  242. package/dist/optimize/map-node.js +48 -3
  243. package/dist/optimize/peephole.d.ts +16 -0
  244. package/dist/optimize/peephole.d.ts.map +1 -0
  245. package/dist/optimize/peephole.js +254 -0
  246. package/dist/optimize/remap.d.ts +2 -0
  247. package/dist/optimize/remap.d.ts.map +1 -1
  248. package/dist/optimize/remap.js +2 -0
  249. package/dist/optimize/rewrite.d.ts +13 -8
  250. package/dist/optimize/rewrite.d.ts.map +1 -1
  251. package/dist/optimize/rewrite.js +13 -8
  252. package/dist/plan/cache.d.ts +9 -3
  253. package/dist/plan/cache.d.ts.map +1 -1
  254. package/dist/plan/cache.js +34 -6
  255. package/dist/plan/index.d.ts +2 -0
  256. package/dist/plan/index.d.ts.map +1 -1
  257. package/dist/plan/index.js +2 -0
  258. package/dist/plan/predicate.d.ts +2 -0
  259. package/dist/plan/predicate.d.ts.map +1 -1
  260. package/dist/plan/predicate.js +298 -29
  261. package/dist/plan/schema-predicate.d.ts +6 -0
  262. package/dist/plan/schema-predicate.d.ts.map +1 -1
  263. package/dist/plan/schema-predicate.js +382 -19
  264. package/dist/plan/types.d.ts +2 -0
  265. package/dist/plan/types.d.ts.map +1 -1
  266. package/dist/plan/types.js +2 -0
  267. package/dist/result/index.d.ts +19 -5
  268. package/dist/result/index.d.ts.map +1 -1
  269. package/dist/result/index.js +10 -2
  270. package/dist/schema/common.d.ts +69 -6
  271. package/dist/schema/common.d.ts.map +1 -1
  272. package/dist/schema/common.js +104 -10
  273. package/dist/schema/freeze.d.ts +4 -0
  274. package/dist/schema/freeze.d.ts.map +1 -1
  275. package/dist/schema/freeze.js +40 -0
  276. package/dist/schema/index.d.ts +5 -2
  277. package/dist/schema/index.d.ts.map +1 -1
  278. package/dist/schema/index.js +4 -1
  279. package/dist/schema/lazy.d.ts +4 -0
  280. package/dist/schema/lazy.d.ts.map +1 -1
  281. package/dist/schema/lazy.js +4 -0
  282. package/dist/schema/literal.d.ts +7 -1
  283. package/dist/schema/literal.d.ts.map +1 -1
  284. package/dist/schema/literal.js +7 -1
  285. package/dist/schema/types.d.ts +109 -100
  286. package/dist/schema/types.d.ts.map +1 -1
  287. package/dist/schema/types.js +13 -2
  288. package/dist/schema/undefined.d.ts +17 -0
  289. package/dist/schema/undefined.d.ts.map +1 -0
  290. package/dist/schema/undefined.js +77 -0
  291. package/dist/schema/validate.d.ts +8 -1
  292. package/dist/schema/validate.d.ts.map +1 -1
  293. package/dist/schema/validate.js +255 -57
  294. package/docs/api.md +128 -8
  295. package/docs/assets/benchmark-headline.svg +163 -0
  296. package/docs/engine-notes.md +62 -15
  297. package/docs/index.html +1340 -702
  298. package/docs/ko/api.md +375 -0
  299. package/docs/ko/engine-notes.md +156 -0
  300. package/docs/ko/readme.md +378 -0
  301. package/package.json +66 -65
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * @file index.ts
3
3
  * @brief Public guard module aggregation.
4
+ * @details This barrel keeps public import paths stable while implementation files remain
5
+ * split by responsibility.
4
6
  */
5
7
  export { BaseGuard } from "./base.js";
8
+ export { ArrayGuard } from "./array.js";
9
+ export { DateGuard } from "./date.js";
6
10
  export { TypeSeaAssertionError } from "./error.js";
7
11
  export { NumberGuard } from "./number.js";
8
12
  export { StringGuard } from "./string.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EACV,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAY,EACb,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guard/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,KAAK,EACL,QAAQ,EACR,YAAY,EACf,MAAM,YAAY,CAAC"}
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * @file index.ts
3
3
  * @brief Public guard module aggregation.
4
+ * @details This barrel keeps public import paths stable while implementation files remain
5
+ * split by responsibility.
4
6
  */
5
7
  export { BaseGuard } from "./base.js";
8
+ export { ArrayGuard } from "./array.js";
9
+ export { DateGuard } from "./date.js";
6
10
  export { TypeSeaAssertionError } from "./error.js";
7
11
  export { NumberGuard } from "./number.js";
8
12
  export { StringGuard } from "./string.js";
@@ -1,32 +1,107 @@
1
1
  /**
2
2
  * @file number.ts
3
3
  * @brief Number 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 { NumberSchema } from "../schema/index.js";
6
8
  import { BaseGuard } from "./base.js";
7
9
  import type { Presence } from "./types.js";
8
10
  /**
9
- * @brief number 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 finite number predicates.
12
+ * @details Bounds are normalized before entering the schema so the evaluator
13
+ * and compiler never have to defend against NaN or infinities later.
12
14
  */
13
15
  export declare class NumberGuard<TPresence extends Presence = "required"> extends BaseGuard<number, 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 number guard.
18
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
19
+ * existing guard instance.
20
+ * @param schema Number schema backing this guard.
17
21
  */
18
22
  constructor(schema: NumberSchema);
19
23
  /**
20
- * @brief int.
21
- */
24
+ * @brief Require finite numbers to be integers.
25
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
26
+ * existing guard instance.
27
+ * @returns Fresh NumberGuard with an appended integer check.
28
+ */
22
29
  int(): NumberGuard<TPresence>;
23
30
  /**
24
- * @brief gte.
25
- */
31
+ * @brief Add an inclusive lower bound.
32
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
33
+ * existing guard instance.
34
+ * @param value Finite lower bound.
35
+ * @returns Fresh NumberGuard with an appended gte check.
36
+ */
26
37
  gte(value: number): NumberGuard<TPresence>;
27
38
  /**
28
- * @brief lte.
29
- */
39
+ * @brief Alias for an inclusive lower bound.
40
+ * @param value Finite lower bound.
41
+ * @returns Fresh NumberGuard with an appended gte check.
42
+ */
43
+ min(value: number): NumberGuard<TPresence>;
44
+ /**
45
+ * @brief Add an inclusive upper bound.
46
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
47
+ * existing guard instance.
48
+ * @param value Finite upper bound.
49
+ * @returns Fresh NumberGuard with an appended lte check.
50
+ */
30
51
  lte(value: number): NumberGuard<TPresence>;
52
+ /**
53
+ * @brief Alias for an inclusive upper bound.
54
+ * @param value Finite upper bound.
55
+ * @returns Fresh NumberGuard with an appended lte check.
56
+ */
57
+ max(value: number): NumberGuard<TPresence>;
58
+ /**
59
+ * @brief Add an exclusive lower bound.
60
+ * @param value Finite lower bound.
61
+ * @returns Fresh NumberGuard with an appended gt check.
62
+ */
63
+ gt(value: number): NumberGuard<TPresence>;
64
+ /**
65
+ * @brief Add an exclusive upper bound.
66
+ * @param value Finite upper bound.
67
+ * @returns Fresh NumberGuard with an appended lt check.
68
+ */
69
+ lt(value: number): NumberGuard<TPresence>;
70
+ /**
71
+ * @brief Require a number to be divisible by a positive finite divisor.
72
+ * @param value Positive finite divisor.
73
+ * @returns Fresh NumberGuard with an appended multipleOf check.
74
+ */
75
+ multipleOf(value: number): NumberGuard<TPresence>;
76
+ /**
77
+ * @brief Require a number greater than zero.
78
+ * @returns Fresh NumberGuard with `gt(0)`.
79
+ */
80
+ positive(): NumberGuard<TPresence>;
81
+ /**
82
+ * @brief Require a number greater than or equal to zero.
83
+ * @returns Fresh NumberGuard with `gte(0)`.
84
+ */
85
+ nonnegative(): NumberGuard<TPresence>;
86
+ /**
87
+ * @brief Require a number less than zero.
88
+ * @returns Fresh NumberGuard with `lt(0)`.
89
+ */
90
+ negative(): NumberGuard<TPresence>;
91
+ /**
92
+ * @brief Require a number less than or equal to zero.
93
+ * @returns Fresh NumberGuard with `lte(0)`.
94
+ */
95
+ nonpositive(): NumberGuard<TPresence>;
96
+ /**
97
+ * @brief Keep the explicit Zod-compatible finite marker.
98
+ * @returns This guard because TypeSea numbers are finite by construction.
99
+ */
100
+ finite(): this;
101
+ /**
102
+ * @brief Require a safe JavaScript integer.
103
+ * @returns Fresh NumberGuard constrained to Number.isSafeInteger domain.
104
+ */
105
+ safe(): NumberGuard<TPresence>;
31
106
  }
32
107
  //# sourceMappingURL=number.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/guard/number.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtC,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;;WAEO;IACA,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC;IAapC;;aAES;IACF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC;IAejD;;aAES;IACF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC,SA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;IAIzC;;;OAGG;IACI,WAAW,IAAI,WAAW,CAAC,SAAS,CAAC;IAI5C;;;OAGG;IACI,MAAM,IAAI,IAAI;IAIrB;;;OAGG;IACI,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC;CAKxC"}
@@ -1,27 +1,34 @@
1
1
  /**
2
2
  * @file number.ts
3
3
  * @brief Number 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 { NumberCheckTag, SchemaTag } from "../kind/index.js";
6
8
  import { BaseGuard } from "./base.js";
7
9
  import { checkFiniteNumberBound, readNumberConstructorSchema, readNumberMethodSchema } from "./read.js";
8
10
  /**
9
- * @brief number 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 finite number predicates.
12
+ * @details Bounds are normalized before entering the schema so the evaluator
13
+ * and compiler never have to defend against NaN or infinities later.
12
14
  */
13
15
  export class NumberGuard extends BaseGuard {
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 number guard.
18
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
19
+ * existing guard instance.
20
+ * @param schema Number schema backing this guard.
17
21
  */
18
22
  constructor(schema) {
19
23
  super(readNumberConstructorSchema(schema));
20
24
  Object.freeze(this);
21
25
  }
22
26
  /**
23
- * @brief int.
24
- */
27
+ * @brief Require finite numbers to be integers.
28
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
29
+ * existing guard instance.
30
+ * @returns Fresh NumberGuard with an appended integer check.
31
+ */
25
32
  int() {
26
33
  const schema = readNumberMethodSchema(this, "number int receiver");
27
34
  return new NumberGuard({
@@ -35,11 +42,19 @@ export class NumberGuard extends BaseGuard {
35
42
  });
36
43
  }
37
44
  /**
38
- * @brief gte.
39
- */
45
+ * @brief Add an inclusive lower bound.
46
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
47
+ * existing guard instance.
48
+ * @param value Finite lower bound.
49
+ * @returns Fresh NumberGuard with an appended gte check.
50
+ */
40
51
  gte(value) {
41
52
  const schema = readNumberMethodSchema(this, "number gte receiver");
42
53
  const bound = checkFiniteNumberBound(value, "gte");
54
+ /*
55
+ * Bounds are normalized before schema construction so interpreters and
56
+ * compilers never need to handle NaN or infinity inside hot validation.
57
+ */
43
58
  return new NumberGuard({
44
59
  tag: SchemaTag.Number,
45
60
  checks: [
@@ -52,8 +67,20 @@ export class NumberGuard extends BaseGuard {
52
67
  });
53
68
  }
54
69
  /**
55
- * @brief lte.
56
- */
70
+ * @brief Alias for an inclusive lower bound.
71
+ * @param value Finite lower bound.
72
+ * @returns Fresh NumberGuard with an appended gte check.
73
+ */
74
+ min(value) {
75
+ return this.gte(value);
76
+ }
77
+ /**
78
+ * @brief Add an inclusive upper bound.
79
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
80
+ * existing guard instance.
81
+ * @param value Finite upper bound.
82
+ * @returns Fresh NumberGuard with an appended lte check.
83
+ */
57
84
  lte(value) {
58
85
  const schema = readNumberMethodSchema(this, "number lte receiver");
59
86
  const bound = checkFiniteNumberBound(value, "lte");
@@ -68,4 +95,125 @@ export class NumberGuard extends BaseGuard {
68
95
  ]
69
96
  });
70
97
  }
98
+ /**
99
+ * @brief Alias for an inclusive upper bound.
100
+ * @param value Finite upper bound.
101
+ * @returns Fresh NumberGuard with an appended lte check.
102
+ */
103
+ max(value) {
104
+ return this.lte(value);
105
+ }
106
+ /**
107
+ * @brief Add an exclusive lower bound.
108
+ * @param value Finite lower bound.
109
+ * @returns Fresh NumberGuard with an appended gt check.
110
+ */
111
+ gt(value) {
112
+ const schema = readNumberMethodSchema(this, "number gt receiver");
113
+ const bound = checkFiniteNumberBound(value, "gt");
114
+ return new NumberGuard({
115
+ tag: SchemaTag.Number,
116
+ checks: [
117
+ ...schema.checks,
118
+ {
119
+ tag: NumberCheckTag.Gt,
120
+ value: bound
121
+ }
122
+ ]
123
+ });
124
+ }
125
+ /**
126
+ * @brief Add an exclusive upper bound.
127
+ * @param value Finite upper bound.
128
+ * @returns Fresh NumberGuard with an appended lt check.
129
+ */
130
+ lt(value) {
131
+ const schema = readNumberMethodSchema(this, "number lt receiver");
132
+ const bound = checkFiniteNumberBound(value, "lt");
133
+ return new NumberGuard({
134
+ tag: SchemaTag.Number,
135
+ checks: [
136
+ ...schema.checks,
137
+ {
138
+ tag: NumberCheckTag.Lt,
139
+ value: bound
140
+ }
141
+ ]
142
+ });
143
+ }
144
+ /**
145
+ * @brief Require a number to be divisible by a positive finite divisor.
146
+ * @param value Positive finite divisor.
147
+ * @returns Fresh NumberGuard with an appended multipleOf check.
148
+ */
149
+ multipleOf(value) {
150
+ const schema = readNumberMethodSchema(this, "number multipleOf receiver");
151
+ const divisor = checkPositiveFiniteNumber(value, "multipleOf");
152
+ return new NumberGuard({
153
+ tag: SchemaTag.Number,
154
+ checks: [
155
+ ...schema.checks,
156
+ {
157
+ tag: NumberCheckTag.MultipleOf,
158
+ value: divisor
159
+ }
160
+ ]
161
+ });
162
+ }
163
+ /**
164
+ * @brief Require a number greater than zero.
165
+ * @returns Fresh NumberGuard with `gt(0)`.
166
+ */
167
+ positive() {
168
+ return this.gt(0);
169
+ }
170
+ /**
171
+ * @brief Require a number greater than or equal to zero.
172
+ * @returns Fresh NumberGuard with `gte(0)`.
173
+ */
174
+ nonnegative() {
175
+ return this.gte(0);
176
+ }
177
+ /**
178
+ * @brief Require a number less than zero.
179
+ * @returns Fresh NumberGuard with `lt(0)`.
180
+ */
181
+ negative() {
182
+ return this.lt(0);
183
+ }
184
+ /**
185
+ * @brief Require a number less than or equal to zero.
186
+ * @returns Fresh NumberGuard with `lte(0)`.
187
+ */
188
+ nonpositive() {
189
+ return this.lte(0);
190
+ }
191
+ /**
192
+ * @brief Keep the explicit Zod-compatible finite marker.
193
+ * @returns This guard because TypeSea numbers are finite by construction.
194
+ */
195
+ finite() {
196
+ return this;
197
+ }
198
+ /**
199
+ * @brief Require a safe JavaScript integer.
200
+ * @returns Fresh NumberGuard constrained to Number.isSafeInteger domain.
201
+ */
202
+ safe() {
203
+ return this.int()
204
+ .gte(Number.MIN_SAFE_INTEGER)
205
+ .lte(Number.MAX_SAFE_INTEGER);
206
+ }
207
+ }
208
+ /**
209
+ * @brief Validate a positive finite numeric divisor.
210
+ * @param value Candidate divisor.
211
+ * @param label Bound label used in RangeError messages.
212
+ * @returns Accepted divisor.
213
+ */
214
+ function checkPositiveFiniteNumber(value, label) {
215
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
216
+ throw new RangeError(`${label} numeric divisor must be positive and finite`);
217
+ }
218
+ return value;
71
219
  }
@@ -1,18 +1,42 @@
1
1
  /**
2
2
  * @file props.ts
3
3
  * @brief Guard object shape helpers.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
6
+ */
7
+ /**
8
+ * @brief Define one immutable public property.
9
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
10
+ * existing guard instance.
11
+ * @param target Object receiving the property.
12
+ * @param key Property key.
13
+ * @param value Stored property value.
14
+ * @param enumerable Whether the property should appear in enumeration.
15
+ * @post The property is non-configurable and non-writable.
4
16
  */
5
17
  export declare function defineReadonlyProperty(target: object, key: string, value: unknown, enumerable: boolean): void;
6
18
  /**
7
- * @brief is strict true.
19
+ * @brief Test for the only accepted refinement success value.
20
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
21
+ * existing guard instance.
22
+ * @param value Predicate return value.
23
+ * @returns True only for the boolean literal true.
8
24
  */
9
25
  export declare function isStrictTrue(value: unknown): boolean;
10
26
  /**
11
- * @brief is record.
27
+ * @brief Test whether a value is a non-array object record.
28
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
29
+ * existing guard instance.
30
+ * @param value Candidate runtime value.
31
+ * @returns True for object values that can carry string properties.
12
32
  */
13
33
  export declare function isRecord(value: unknown): value is Readonly<Record<string, unknown>>;
14
34
  /**
15
- * @brief is plain reg exp.
35
+ * @brief Accept only unmodified RegExp instances for schema storage.
36
+ * @details User-owned exec/test/source/flags overrides can change validation
37
+ * behavior after construction, so they are rejected at the API boundary.
38
+ * @param value Candidate pattern.
39
+ * @returns True for plain RegExp instances without own behavioral overrides.
16
40
  */
17
41
  export declare function isPlainRegExp(value: unknown): value is RegExp;
18
42
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/guard/props.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,OAAO,GAClB,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEnF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO7D"}
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/guard/props.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,OAAO,GACpB,IAAI,CAON;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEnF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAO7D"}
@@ -1,6 +1,18 @@
1
1
  /**
2
2
  * @file props.ts
3
3
  * @brief Guard object shape helpers.
4
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
5
+ * existing guard instance.
6
+ */
7
+ /**
8
+ * @brief Define one immutable public property.
9
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
10
+ * existing guard instance.
11
+ * @param target Object receiving the property.
12
+ * @param key Property key.
13
+ * @param value Stored property value.
14
+ * @param enumerable Whether the property should appear in enumeration.
15
+ * @post The property is non-configurable and non-writable.
4
16
  */
5
17
  export function defineReadonlyProperty(target, key, value, enumerable) {
6
18
  Object.defineProperty(target, key, {
@@ -11,19 +23,31 @@ export function defineReadonlyProperty(target, key, value, enumerable) {
11
23
  });
12
24
  }
13
25
  /**
14
- * @brief is strict true.
26
+ * @brief Test for the only accepted refinement success value.
27
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
28
+ * existing guard instance.
29
+ * @param value Predicate return value.
30
+ * @returns True only for the boolean literal true.
15
31
  */
16
32
  export function isStrictTrue(value) {
17
33
  return value === true;
18
34
  }
19
35
  /**
20
- * @brief is record.
36
+ * @brief Test whether a value is a non-array object record.
37
+ * @details Guard helpers build new immutable schema wrappers so fluent APIs never mutate an
38
+ * existing guard instance.
39
+ * @param value Candidate runtime value.
40
+ * @returns True for object values that can carry string properties.
21
41
  */
22
42
  export function isRecord(value) {
23
43
  return typeof value === "object" && value !== null && !Array.isArray(value);
24
44
  }
25
45
  /**
26
- * @brief is plain reg exp.
46
+ * @brief Accept only unmodified RegExp instances for schema storage.
47
+ * @details User-owned exec/test/source/flags overrides can change validation
48
+ * behavior after construction, so they are rejected at the API boundary.
49
+ * @param value Candidate pattern.
50
+ * @returns True for plain RegExp instances without own behavioral overrides.
27
51
  */
28
52
  export function isPlainRegExp(value) {
29
53
  return value instanceof RegExp &&
@@ -1,42 +1,147 @@
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
- import type { NumberSchema, Schema, StringSchema } from "../schema/index.js";
7
+ import type { ArraySchema, DateSchema, 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 Read and require a Date schema from a method receiver.
41
+ * @param guard Candidate receiver.
42
+ * @param label Human-readable label used in TypeError messages.
43
+ * @returns Date schema carried by the receiver.
44
+ * @throws TypeError when the receiver is not a Date guard.
45
+ */
46
+ export declare function readDateMethodSchema(guard: unknown, label: string): DateSchema;
47
+ /**
48
+ * @brief Read and require an array schema from a method receiver.
49
+ * @param guard Candidate receiver.
50
+ * @param label Human-readable label used in TypeError messages.
51
+ * @returns Array schema carried by the receiver.
52
+ * @throws TypeError when the receiver is not an array guard.
53
+ * @details ArrayGuard methods share this gate so fluent length helpers cannot
54
+ * be detached and applied to unrelated guard instances.
55
+ */
56
+ export declare function readArrayMethodSchema(guard: unknown, label: string): ArraySchema;
57
+ /**
58
+ * @brief Validate and freeze a generic guard constructor schema.
59
+ * @param schema Candidate runtime schema.
60
+ * @returns Frozen schema accepted by BaseGuard.
61
+ * @throws TypeError when the schema is malformed.
62
+ * @details Constructors are the only place that accepts mutable schema records.
63
+ * Freezing here lets normal method calls use the registry fast path later.
20
64
  */
21
65
  export declare function readConstructorSchema(schema: unknown): Schema;
22
66
  /**
23
- * @brief read string constructor schema.
67
+ * @brief Validate a StringGuard constructor schema.
68
+ * @param schema Candidate runtime schema.
69
+ * @returns String schema accepted by StringGuard.
70
+ * @throws TypeError when the schema is not a string schema.
71
+ * @details Specialized guards keep their schema tag invariant at construction,
72
+ * so hot method calls only need to verify receiver identity.
24
73
  */
25
74
  export declare function readStringConstructorSchema(schema: unknown): StringSchema;
26
75
  /**
27
- * @brief read number constructor schema.
76
+ * @brief Validate a NumberGuard constructor schema.
77
+ * @param schema Candidate runtime schema.
78
+ * @returns Number schema accepted by NumberGuard.
79
+ * @throws TypeError when the schema is not a number schema.
80
+ * @details Rejecting non-number schemas at construction prevents mixed scalar
81
+ * helper methods from observing incompatible check vectors.
28
82
  */
29
83
  export declare function readNumberConstructorSchema(schema: unknown): NumberSchema;
30
84
  /**
31
- * @brief check refinement input.
85
+ * @brief Validate a DateGuard constructor schema.
86
+ * @param schema Candidate runtime schema.
87
+ * @returns Date schema accepted by DateGuard.
88
+ * @throws TypeError when the schema is not a Date schema.
89
+ */
90
+ export declare function readDateConstructorSchema(schema: unknown): DateSchema;
91
+ /**
92
+ * @brief Validate an ArrayGuard constructor schema.
93
+ * @param schema Candidate runtime schema.
94
+ * @returns Array schema accepted by ArrayGuard.
95
+ * @throws TypeError when the schema is not an array schema.
96
+ * @details The schema validator already checks the item tree and length-check
97
+ * vector, so the specialized constructor only enforces the root tag.
98
+ */
99
+ export declare function readArrayConstructorSchema(schema: unknown): ArraySchema;
100
+ /**
101
+ * @brief Validate refinement API inputs.
102
+ * @param predicate Candidate refinement predicate.
103
+ * @param name Candidate diagnostic name.
104
+ * @throws TypeError when either input has the wrong runtime type.
105
+ * @details Refinements execute user code by design. This gate narrows the call
106
+ * target and diagnostic label before the schema stores them.
32
107
  */
33
108
  export declare function checkRefinementInput(predicate: unknown, name: unknown): asserts predicate is (value: unknown) => boolean;
34
109
  /**
35
- * @brief check string length bound.
110
+ * @brief Validate a non-negative string length bound.
111
+ * @param value Candidate bound.
112
+ * @param label Bound label used in RangeError messages.
113
+ * @returns The validated bound.
114
+ * @throws RangeError when the bound is negative or non-integer.
115
+ * @details Bounds are checked once at builder time so generated validators can
116
+ * emit straight comparisons without defensive range checks.
36
117
  */
37
118
  export declare function checkStringLengthBound(value: number, label: string): number;
38
119
  /**
39
- * @brief check finite number bound.
120
+ * @brief Validate a non-negative array length bound.
121
+ * @param value Candidate bound.
122
+ * @param label Bound label used in RangeError messages.
123
+ * @returns The validated bound.
124
+ * @throws RangeError when the bound is negative or non-integer.
125
+ * @details Array bounds share the same integer contract as string length
126
+ * bounds, but the separate helper keeps public error text precise.
127
+ */
128
+ export declare function checkArrayLengthBound(value: number, label: string): number;
129
+ /**
130
+ * @brief Validate a finite numeric bound.
131
+ * @param value Candidate bound.
132
+ * @param label Bound label used in RangeError messages.
133
+ * @returns The validated bound.
134
+ * @throws RangeError when the bound is not finite.
135
+ * @details Finite bounds keep interpreter, plan, and emitted code semantics
136
+ * aligned for comparisons such as gte and lte.
40
137
  */
41
138
  export declare function checkFiniteNumberBound(value: number, label: string): number;
139
+ /**
140
+ * @brief Normalize a Date bound into a finite epoch millisecond value.
141
+ * @param value Candidate Date bound.
142
+ * @param label Bound label used in RangeError messages.
143
+ * @returns Finite epoch millisecond value.
144
+ * @throws RangeError when the bound is not a valid Date instance.
145
+ */
146
+ export declare function checkDateBound(value: Date, label: string): number;
42
147
  //# 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,wBA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