@versionzero/schema 1.0.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 (401) hide show
  1. package/LICENSE +177 -0
  2. package/README.md +246 -0
  3. package/package.json +84 -0
  4. package/src/compilation/handler-compilation.js +28 -0
  5. package/src/compilation/metadata-compilation.js +35 -0
  6. package/src/compilation/schema-compilation.js +142 -0
  7. package/src/compilation/selection-compilation.js +84 -0
  8. package/src/compilation/union-compilation.js +510 -0
  9. package/src/compilation/values-compilation.js +35 -0
  10. package/src/compiled-schema.js +1709 -0
  11. package/src/constants.js +1 -0
  12. package/src/core-library/index.js +32 -0
  13. package/src/core-library/processors/aggregation-operators.js +75 -0
  14. package/src/core-library/processors/alpha-constraint.js +20 -0
  15. package/src/core-library/processors/alphanum-constraint.js +20 -0
  16. package/src/core-library/processors/array-operator.js +51 -0
  17. package/src/core-library/processors/assert-constraint.js +75 -0
  18. package/src/core-library/processors/base64-constraint.js +26 -0
  19. package/src/core-library/processors/camel-case-operator.js +24 -0
  20. package/src/core-library/processors/capitalize-operator.js +16 -0
  21. package/src/core-library/processors/cardnum-constraint.js +193 -0
  22. package/src/core-library/processors/ceil-operator.js +44 -0
  23. package/src/core-library/processors/collapse-operator.js +29 -0
  24. package/src/core-library/processors/compact-operator.js +34 -0
  25. package/src/core-library/processors/compile-operator.js +65 -0
  26. package/src/core-library/processors/concat-operator.js +51 -0
  27. package/src/core-library/processors/conditional-operators.js +301 -0
  28. package/src/core-library/processors/constant-case-operator.js +16 -0
  29. package/src/core-library/processors/data-size-operator.js +86 -0
  30. package/src/core-library/processors/date-object-operator.js +54 -0
  31. package/src/core-library/processors/date-operator.js +67 -0
  32. package/src/core-library/processors/date-range-constraint.js +76 -0
  33. package/src/core-library/processors/defined-constraint.js +30 -0
  34. package/src/core-library/processors/each-operator.js +57 -0
  35. package/src/core-library/processors/email-constraint.js +112 -0
  36. package/src/core-library/processors/entries-operator.js +25 -0
  37. package/src/core-library/processors/eq-constraint.js +37 -0
  38. package/src/core-library/processors/filter-operator.js +74 -0
  39. package/src/core-library/processors/find-schema-operator.js +45 -0
  40. package/src/core-library/processors/flatten-operator.js +40 -0
  41. package/src/core-library/processors/floor-operator.js +47 -0
  42. package/src/core-library/processors/get-operator.js +44 -0
  43. package/src/core-library/processors/group-by-operator.js +84 -0
  44. package/src/core-library/processors/has-prefix-constraint.js +37 -0
  45. package/src/core-library/processors/has-suffix-constraint.js +35 -0
  46. package/src/core-library/processors/hex-constraint.js +20 -0
  47. package/src/core-library/processors/hostname-constraint.js +22 -0
  48. package/src/core-library/processors/http-url-constraint.js +27 -0
  49. package/src/core-library/processors/in-constraint.js +66 -0
  50. package/src/core-library/processors/index-by-operator.js +98 -0
  51. package/src/core-library/processors/index.js +131 -0
  52. package/src/core-library/processors/input-operator.js +23 -0
  53. package/src/core-library/processors/instanceof-constraint.js +38 -0
  54. package/src/core-library/processors/integer-constraint.js +22 -0
  55. package/src/core-library/processors/invoke-operator.js +33 -0
  56. package/src/core-library/processors/ipv4-constraint.js +188 -0
  57. package/src/core-library/processors/ipv6-constraint.js +205 -0
  58. package/src/core-library/processors/is-array-constraint.js +21 -0
  59. package/src/core-library/processors/is-date-constraint.js +22 -0
  60. package/src/core-library/processors/is-number-constraint.js +21 -0
  61. package/src/core-library/processors/is-object-constraint.js +21 -0
  62. package/src/core-library/processors/is-string-constraint.js +21 -0
  63. package/src/core-library/processors/join-operator.js +41 -0
  64. package/src/core-library/processors/json-constraint.js +22 -0
  65. package/src/core-library/processors/json-decode-operator.js +25 -0
  66. package/src/core-library/processors/json-encode-operator.js +35 -0
  67. package/src/core-library/processors/kebab-case-operator.js +23 -0
  68. package/src/core-library/processors/keys-operator.js +20 -0
  69. package/src/core-library/processors/length-constraint.js +85 -0
  70. package/src/core-library/processors/lookup-operator.js +84 -0
  71. package/src/core-library/processors/lowercase-operator.js +14 -0
  72. package/src/core-library/processors/map-operator.js +84 -0
  73. package/src/core-library/processors/match-operator.js +64 -0
  74. package/src/core-library/processors/matches-constraint.js +54 -0
  75. package/src/core-library/processors/math-operators.js +151 -0
  76. package/src/core-library/processors/merge-deep-operator.js +61 -0
  77. package/src/core-library/processors/merge-operator.js +54 -0
  78. package/src/core-library/processors/metadata-operator.js +100 -0
  79. package/src/core-library/processors/negative-constraint.js +23 -0
  80. package/src/core-library/processors/never-constraint.js +69 -0
  81. package/src/core-library/processors/non-empty-constraint.js +59 -0
  82. package/src/core-library/processors/not-constraint.js +71 -0
  83. package/src/core-library/processors/number-operator.js +24 -0
  84. package/src/core-library/processors/numeric-constraint.js +22 -0
  85. package/src/core-library/processors/object-operator.js +38 -0
  86. package/src/core-library/processors/omit-operator.js +57 -0
  87. package/src/core-library/processors/parallel-operator.js +64 -0
  88. package/src/core-library/processors/pascal-case-operator.js +16 -0
  89. package/src/core-library/processors/phone-constraint.js +235 -0
  90. package/src/core-library/processors/pick-operator.js +62 -0
  91. package/src/core-library/processors/pipeline-operator.js +63 -0
  92. package/src/core-library/processors/port-constraint.js +22 -0
  93. package/src/core-library/processors/positive-constraint.js +23 -0
  94. package/src/core-library/processors/process-operator.js +55 -0
  95. package/src/core-library/processors/property-operator.js +49 -0
  96. package/src/core-library/processors/range-constraint.js +72 -0
  97. package/src/core-library/processors/reference-operator.js +79 -0
  98. package/src/core-library/processors/require-constraint.js +74 -0
  99. package/src/core-library/processors/reverse-operator.js +20 -0
  100. package/src/core-library/processors/round-operator.js +53 -0
  101. package/src/core-library/processors/schema-handler-operators.js +54 -0
  102. package/src/core-library/processors/semver-constraint.js +282 -0
  103. package/src/core-library/processors/sequence-processors.js +406 -0
  104. package/src/core-library/processors/sort-operator.js +52 -0
  105. package/src/core-library/processors/split-operator.js +43 -0
  106. package/src/core-library/processors/string-extra-operators.js +141 -0
  107. package/src/core-library/processors/string-operator.js +34 -0
  108. package/src/core-library/processors/target-operator.js +30 -0
  109. package/src/core-library/processors/template-operator.js +60 -0
  110. package/src/core-library/processors/title-case-operator.js +17 -0
  111. package/src/core-library/processors/trim-operator.js +14 -0
  112. package/src/core-library/processors/truthy-constraint.js +35 -0
  113. package/src/core-library/processors/type-operator.js +24 -0
  114. package/src/core-library/processors/unique-operator.js +21 -0
  115. package/src/core-library/processors/uppercase-operator.js +14 -0
  116. package/src/core-library/processors/url-constraint.js +31 -0
  117. package/src/core-library/processors/url-decode-operator.js +50 -0
  118. package/src/core-library/processors/url-encode-operator.js +44 -0
  119. package/src/core-library/processors/uuid-constraint.js +31 -0
  120. package/src/core-library/processors/values-operator.js +20 -0
  121. package/src/core-library/schemas/any-schema.js +23 -0
  122. package/src/core-library/schemas/array-schema.js +8 -0
  123. package/src/core-library/schemas/boolean-schema.js +10 -0
  124. package/src/core-library/schemas/date-schema.js +12 -0
  125. package/src/core-library/schemas/function-schema.js +40 -0
  126. package/src/core-library/schemas/number-schema.js +9 -0
  127. package/src/core-library/schemas/object-schema.js +10 -0
  128. package/src/core-library/schemas/root-schema.js +21 -0
  129. package/src/core-library/schemas/string-schema.js +9 -0
  130. package/src/core-library-node/index.js +47 -0
  131. package/src/core-library-node/processors/base64-decode-operator.js +20 -0
  132. package/src/core-library-node/processors/base64-encode-operator.js +20 -0
  133. package/src/core-library-node/processors/buffer-operator.js +39 -0
  134. package/src/core-library-node/processors/directory-constraint.js +35 -0
  135. package/src/core-library-node/processors/executable-constraint.js +34 -0
  136. package/src/core-library-node/processors/file-constraint.js +34 -0
  137. package/src/core-library-node/processors/file-size-constraint.js +94 -0
  138. package/src/core-library-node/processors/is-buffer-constraint.js +21 -0
  139. package/src/core-library-node/processors/reachable-constraint.js +28 -0
  140. package/src/core-library-node/processors/readable-constraint.js +34 -0
  141. package/src/core-library-node/processors/writable-constraint.js +59 -0
  142. package/src/core-library-node/schemas/buffer-schema.js +10 -0
  143. package/src/errors.js +209 -0
  144. package/src/executor/array-executor.js +78 -0
  145. package/src/executor/conditional-executor.js +134 -0
  146. package/src/executor/each-executor.js +68 -0
  147. package/src/executor/executor.js +123 -0
  148. package/src/executor/object-executor.js +98 -0
  149. package/src/executor/parallel-executor.js +43 -0
  150. package/src/executor/pipeline-executor.js +65 -0
  151. package/src/executor/sequence-executor.js +206 -0
  152. package/src/executor/serial-executor.js +24 -0
  153. package/src/executor/step-executor.js +68 -0
  154. package/src/helpers/case.js +124 -0
  155. package/src/helpers/data-size.js +144 -0
  156. package/src/helpers/debug-sink.js +15 -0
  157. package/src/helpers/deep.js +280 -0
  158. package/src/helpers/format.js +121 -0
  159. package/src/helpers/has-string-properties.js +30 -0
  160. package/src/helpers/index.js +16 -0
  161. package/src/helpers/object.js +115 -0
  162. package/src/helpers/parse-date.js +75 -0
  163. package/src/helpers/path.js +28 -0
  164. package/src/helpers/regex.js +18 -0
  165. package/src/helpers/stringify.js +309 -0
  166. package/src/helpers/to-data.js +64 -0
  167. package/src/helpers/truthy.js +55 -0
  168. package/src/index.js +29 -0
  169. package/src/schema-compiler.js +531 -0
  170. package/src/schema-location.js +200 -0
  171. package/src/schema-resolver.js +546 -0
  172. package/src/schema.js +1182 -0
  173. package/src/traversal/executors/check-condition.js +42 -0
  174. package/src/traversal/executors/check-input.js +27 -0
  175. package/src/traversal/executors/check-required.js +19 -0
  176. package/src/traversal/executors/check-schema.js +45 -0
  177. package/src/traversal/executors/defaults.js +21 -0
  178. package/src/traversal/executors/enter-existing.js +25 -0
  179. package/src/traversal/executors/enter-input.js +25 -0
  180. package/src/traversal/executors/enter.js +37 -0
  181. package/src/traversal/executors/exit.js +74 -0
  182. package/src/traversal/executors/finalize.js +64 -0
  183. package/src/traversal/executors/index.js +42 -0
  184. package/src/traversal/executors/normalize.js +38 -0
  185. package/src/traversal/executors/prepare-existing.js +27 -0
  186. package/src/traversal/executors/prepare-pending.js +54 -0
  187. package/src/traversal/executors/resolve-union.js +50 -0
  188. package/src/traversal/executors/serialize.js +48 -0
  189. package/src/traversal/executors/transform-early.js +51 -0
  190. package/src/traversal/executors/transform.js +68 -0
  191. package/src/traversal/executors/traversal-state-executor.js +46 -0
  192. package/src/traversal/executors/validate.js +63 -0
  193. package/src/traversal/traversal-context.js +231 -0
  194. package/src/traversal/traversal-state.js +809 -0
  195. package/src/types.js +102 -0
  196. package/src/value-processor/composed-value-processor.js +43 -0
  197. package/src/value-processor/defined-value-processor.js +72 -0
  198. package/src/value-processor/function-value-processor.js +68 -0
  199. package/src/value-processor/parameterized-value-processor.js +45 -0
  200. package/src/value-processor/parameters-value-processor.js +178 -0
  201. package/src/value-processor/spec.js +89 -0
  202. package/src/value-processor/value-processor.js +105 -0
  203. package/types/compilation/handler-compilation.d.ts +13 -0
  204. package/types/compilation/metadata-compilation.d.ts +6 -0
  205. package/types/compilation/schema-compilation.d.ts +32 -0
  206. package/types/compilation/selection-compilation.d.ts +9 -0
  207. package/types/compilation/union-compilation.d.ts +42 -0
  208. package/types/compilation/values-compilation.d.ts +12 -0
  209. package/types/compiled-schema.d.ts +883 -0
  210. package/types/constants.d.ts +1 -0
  211. package/types/core-library/index.d.ts +7 -0
  212. package/types/core-library/processors/aggregation-operators.d.ts +24 -0
  213. package/types/core-library/processors/alpha-constraint.d.ts +9 -0
  214. package/types/core-library/processors/alphanum-constraint.d.ts +9 -0
  215. package/types/core-library/processors/array-operator.d.ts +12 -0
  216. package/types/core-library/processors/assert-constraint.d.ts +30 -0
  217. package/types/core-library/processors/base64-constraint.d.ts +11 -0
  218. package/types/core-library/processors/camel-case-operator.d.ts +17 -0
  219. package/types/core-library/processors/capitalize-operator.d.ts +11 -0
  220. package/types/core-library/processors/cardnum-constraint.d.ts +51 -0
  221. package/types/core-library/processors/ceil-operator.d.ts +30 -0
  222. package/types/core-library/processors/collapse-operator.d.ts +24 -0
  223. package/types/core-library/processors/compact-operator.d.ts +29 -0
  224. package/types/core-library/processors/compile-operator.d.ts +34 -0
  225. package/types/core-library/processors/concat-operator.d.ts +23 -0
  226. package/types/core-library/processors/conditional-operators.d.ts +219 -0
  227. package/types/core-library/processors/constant-case-operator.d.ts +9 -0
  228. package/types/core-library/processors/data-size-operator.d.ts +31 -0
  229. package/types/core-library/processors/date-object-operator.d.ts +16 -0
  230. package/types/core-library/processors/date-operator.d.ts +21 -0
  231. package/types/core-library/processors/date-range-constraint.d.ts +26 -0
  232. package/types/core-library/processors/defined-constraint.d.ts +20 -0
  233. package/types/core-library/processors/each-operator.d.ts +34 -0
  234. package/types/core-library/processors/email-constraint.d.ts +54 -0
  235. package/types/core-library/processors/entries-operator.d.ts +13 -0
  236. package/types/core-library/processors/eq-constraint.d.ts +20 -0
  237. package/types/core-library/processors/filter-operator.d.ts +35 -0
  238. package/types/core-library/processors/find-schema-operator.d.ts +28 -0
  239. package/types/core-library/processors/flatten-operator.d.ts +26 -0
  240. package/types/core-library/processors/floor-operator.d.ts +33 -0
  241. package/types/core-library/processors/get-operator.d.ts +31 -0
  242. package/types/core-library/processors/group-by-operator.d.ts +36 -0
  243. package/types/core-library/processors/has-prefix-constraint.d.ts +22 -0
  244. package/types/core-library/processors/has-suffix-constraint.d.ts +20 -0
  245. package/types/core-library/processors/hex-constraint.d.ts +9 -0
  246. package/types/core-library/processors/hostname-constraint.d.ts +11 -0
  247. package/types/core-library/processors/http-url-constraint.d.ts +9 -0
  248. package/types/core-library/processors/in-constraint.d.ts +27 -0
  249. package/types/core-library/processors/index-by-operator.d.ts +26 -0
  250. package/types/core-library/processors/index.d.ts +8 -0
  251. package/types/core-library/processors/input-operator.d.ts +20 -0
  252. package/types/core-library/processors/instanceof-constraint.d.ts +23 -0
  253. package/types/core-library/processors/integer-constraint.d.ts +9 -0
  254. package/types/core-library/processors/invoke-operator.d.ts +12 -0
  255. package/types/core-library/processors/ipv4-constraint.d.ts +37 -0
  256. package/types/core-library/processors/ipv6-constraint.d.ts +34 -0
  257. package/types/core-library/processors/is-array-constraint.d.ts +10 -0
  258. package/types/core-library/processors/is-date-constraint.d.ts +10 -0
  259. package/types/core-library/processors/is-number-constraint.d.ts +10 -0
  260. package/types/core-library/processors/is-object-constraint.d.ts +10 -0
  261. package/types/core-library/processors/is-string-constraint.d.ts +10 -0
  262. package/types/core-library/processors/join-operator.d.ts +29 -0
  263. package/types/core-library/processors/json-constraint.d.ts +10 -0
  264. package/types/core-library/processors/json-decode-operator.d.ts +9 -0
  265. package/types/core-library/processors/json-encode-operator.d.ts +27 -0
  266. package/types/core-library/processors/kebab-case-operator.d.ts +16 -0
  267. package/types/core-library/processors/keys-operator.d.ts +9 -0
  268. package/types/core-library/processors/length-constraint.d.ts +34 -0
  269. package/types/core-library/processors/lookup-operator.d.ts +36 -0
  270. package/types/core-library/processors/lowercase-operator.d.ts +9 -0
  271. package/types/core-library/processors/map-operator.d.ts +38 -0
  272. package/types/core-library/processors/match-operator.d.ts +34 -0
  273. package/types/core-library/processors/matches-constraint.d.ts +29 -0
  274. package/types/core-library/processors/math-operators.d.ts +91 -0
  275. package/types/core-library/processors/merge-deep-operator.d.ts +32 -0
  276. package/types/core-library/processors/merge-operator.d.ts +26 -0
  277. package/types/core-library/processors/metadata-operator.d.ts +56 -0
  278. package/types/core-library/processors/negative-constraint.d.ts +13 -0
  279. package/types/core-library/processors/never-constraint.d.ts +26 -0
  280. package/types/core-library/processors/non-empty-constraint.d.ts +28 -0
  281. package/types/core-library/processors/not-constraint.d.ts +28 -0
  282. package/types/core-library/processors/number-operator.d.ts +9 -0
  283. package/types/core-library/processors/numeric-constraint.d.ts +10 -0
  284. package/types/core-library/processors/object-operator.d.ts +10 -0
  285. package/types/core-library/processors/omit-operator.d.ts +24 -0
  286. package/types/core-library/processors/parallel-operator.d.ts +41 -0
  287. package/types/core-library/processors/pascal-case-operator.d.ts +9 -0
  288. package/types/core-library/processors/phone-constraint.d.ts +65 -0
  289. package/types/core-library/processors/pick-operator.d.ts +27 -0
  290. package/types/core-library/processors/pipeline-operator.d.ts +40 -0
  291. package/types/core-library/processors/port-constraint.d.ts +11 -0
  292. package/types/core-library/processors/positive-constraint.d.ts +13 -0
  293. package/types/core-library/processors/process-operator.d.ts +37 -0
  294. package/types/core-library/processors/property-operator.d.ts +34 -0
  295. package/types/core-library/processors/range-constraint.d.ts +30 -0
  296. package/types/core-library/processors/reference-operator.d.ts +38 -0
  297. package/types/core-library/processors/require-constraint.d.ts +29 -0
  298. package/types/core-library/processors/reverse-operator.d.ts +9 -0
  299. package/types/core-library/processors/round-operator.d.ts +34 -0
  300. package/types/core-library/processors/schema-handler-operators.d.ts +28 -0
  301. package/types/core-library/processors/semver-constraint.d.ts +43 -0
  302. package/types/core-library/processors/sequence-processors.d.ts +213 -0
  303. package/types/core-library/processors/sort-operator.d.ts +31 -0
  304. package/types/core-library/processors/split-operator.d.ts +33 -0
  305. package/types/core-library/processors/string-extra-operators.d.ts +83 -0
  306. package/types/core-library/processors/string-operator.d.ts +10 -0
  307. package/types/core-library/processors/target-operator.d.ts +27 -0
  308. package/types/core-library/processors/template-operator.d.ts +31 -0
  309. package/types/core-library/processors/title-case-operator.d.ts +12 -0
  310. package/types/core-library/processors/trim-operator.d.ts +9 -0
  311. package/types/core-library/processors/truthy-constraint.d.ts +23 -0
  312. package/types/core-library/processors/type-operator.d.ts +11 -0
  313. package/types/core-library/processors/unique-operator.d.ts +10 -0
  314. package/types/core-library/processors/uppercase-operator.d.ts +9 -0
  315. package/types/core-library/processors/url-constraint.d.ts +20 -0
  316. package/types/core-library/processors/url-decode-operator.d.ts +31 -0
  317. package/types/core-library/processors/url-encode-operator.d.ts +36 -0
  318. package/types/core-library/processors/uuid-constraint.d.ts +20 -0
  319. package/types/core-library/processors/values-operator.d.ts +9 -0
  320. package/types/core-library/schemas/any-schema.d.ts +2 -0
  321. package/types/core-library/schemas/array-schema.d.ts +2 -0
  322. package/types/core-library/schemas/boolean-schema.d.ts +2 -0
  323. package/types/core-library/schemas/date-schema.d.ts +2 -0
  324. package/types/core-library/schemas/function-schema.d.ts +2 -0
  325. package/types/core-library/schemas/number-schema.d.ts +2 -0
  326. package/types/core-library/schemas/object-schema.d.ts +2 -0
  327. package/types/core-library/schemas/root-schema.d.ts +2 -0
  328. package/types/core-library/schemas/string-schema.d.ts +2 -0
  329. package/types/core-library-node/index.d.ts +12 -0
  330. package/types/core-library-node/processors/base64-decode-operator.d.ts +9 -0
  331. package/types/core-library-node/processors/base64-encode-operator.d.ts +9 -0
  332. package/types/core-library-node/processors/buffer-operator.d.ts +15 -0
  333. package/types/core-library-node/processors/directory-constraint.d.ts +14 -0
  334. package/types/core-library-node/processors/executable-constraint.d.ts +17 -0
  335. package/types/core-library-node/processors/file-constraint.d.ts +13 -0
  336. package/types/core-library-node/processors/file-size-constraint.d.ts +43 -0
  337. package/types/core-library-node/processors/is-buffer-constraint.d.ts +10 -0
  338. package/types/core-library-node/processors/reachable-constraint.d.ts +13 -0
  339. package/types/core-library-node/processors/readable-constraint.d.ts +17 -0
  340. package/types/core-library-node/processors/writable-constraint.d.ts +18 -0
  341. package/types/core-library-node/schemas/buffer-schema.d.ts +2 -0
  342. package/types/errors.d.ts +58 -0
  343. package/types/executor/array-executor.d.ts +17 -0
  344. package/types/executor/conditional-executor.d.ts +45 -0
  345. package/types/executor/each-executor.d.ts +15 -0
  346. package/types/executor/executor.d.ts +84 -0
  347. package/types/executor/object-executor.d.ts +14 -0
  348. package/types/executor/parallel-executor.d.ts +27 -0
  349. package/types/executor/pipeline-executor.d.ts +11 -0
  350. package/types/executor/sequence-executor.d.ts +32 -0
  351. package/types/executor/serial-executor.d.ts +16 -0
  352. package/types/executor/step-executor.d.ts +14 -0
  353. package/types/helpers/case.d.ts +30 -0
  354. package/types/helpers/data-size.d.ts +25 -0
  355. package/types/helpers/debug-sink.d.ts +9 -0
  356. package/types/helpers/deep.d.ts +33 -0
  357. package/types/helpers/format.d.ts +14 -0
  358. package/types/helpers/has-string-properties.d.ts +5 -0
  359. package/types/helpers/index.d.ts +13 -0
  360. package/types/helpers/object.d.ts +46 -0
  361. package/types/helpers/parse-date.d.ts +6 -0
  362. package/types/helpers/path.d.ts +13 -0
  363. package/types/helpers/regex.d.ts +7 -0
  364. package/types/helpers/stringify.d.ts +33 -0
  365. package/types/helpers/to-data.d.ts +13 -0
  366. package/types/helpers/truthy.d.ts +26 -0
  367. package/types/index.d.ts +6 -0
  368. package/types/schema-compiler.d.ts +49 -0
  369. package/types/schema-location.d.ts +64 -0
  370. package/types/schema-resolver.d.ts +145 -0
  371. package/types/schema.d.ts +586 -0
  372. package/types/traversal/executors/check-condition.d.ts +8 -0
  373. package/types/traversal/executors/check-input.d.ts +6 -0
  374. package/types/traversal/executors/check-required.d.ts +6 -0
  375. package/types/traversal/executors/check-schema.d.ts +7 -0
  376. package/types/traversal/executors/defaults.d.ts +8 -0
  377. package/types/traversal/executors/enter-existing.d.ts +6 -0
  378. package/types/traversal/executors/enter-input.d.ts +8 -0
  379. package/types/traversal/executors/enter.d.ts +7 -0
  380. package/types/traversal/executors/exit.d.ts +6 -0
  381. package/types/traversal/executors/finalize.d.ts +6 -0
  382. package/types/traversal/executors/index.d.ts +15 -0
  383. package/types/traversal/executors/normalize.d.ts +7 -0
  384. package/types/traversal/executors/prepare-existing.d.ts +6 -0
  385. package/types/traversal/executors/prepare-pending.d.ts +6 -0
  386. package/types/traversal/executors/resolve-union.d.ts +6 -0
  387. package/types/traversal/executors/serialize.d.ts +11 -0
  388. package/types/traversal/executors/transform-early.d.ts +6 -0
  389. package/types/traversal/executors/transform.d.ts +6 -0
  390. package/types/traversal/executors/traversal-state-executor.d.ts +19 -0
  391. package/types/traversal/executors/validate.d.ts +6 -0
  392. package/types/traversal/traversal-context.d.ts +67 -0
  393. package/types/traversal/traversal-state.d.ts +97 -0
  394. package/types/types.d.ts +218 -0
  395. package/types/value-processor/composed-value-processor.d.ts +17 -0
  396. package/types/value-processor/defined-value-processor.d.ts +16 -0
  397. package/types/value-processor/function-value-processor.d.ts +15 -0
  398. package/types/value-processor/parameterized-value-processor.d.ts +14 -0
  399. package/types/value-processor/parameters-value-processor.d.ts +28 -0
  400. package/types/value-processor/spec.d.ts +22 -0
  401. package/types/value-processor/value-processor.d.ts +92 -0
@@ -0,0 +1,213 @@
1
+ /**
2
+ * ## $or
3
+ *
4
+ * A constraint that checks whether any of the provided processors return a truthy value.
5
+ *
6
+ * Returns the first truthy value from the processors, or throws if none are truthy.
7
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
8
+ * This works best in finalizers, validators, or in opaque schema transformers.
9
+ *
10
+ * See `$any` if you want to check for success (defined value) instead of truthiness
11
+ *
12
+ * ### Parameters
13
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, at least one of which must return a truthy value.
14
+ *
15
+ * ### Example
16
+ * ```js
17
+ * // Accept either a valid hostname or a valid IPv4 address
18
+ * new Schema('string').validator({$or: ['$hostname', '$ipv4']})
19
+ *
20
+ * // Accept a port number OR the string 'auto'
21
+ * new Schema('any').validator({
22
+ * $or: [
23
+ * {$range: {min: 1, max: 65535}},
24
+ * {$eq: 'auto'},
25
+ * ]
26
+ * })
27
+ * ```
28
+ *
29
+ * @type {ValueProcessorDefinition}
30
+ */
31
+ export const OR_CONSTRAINT: ValueProcessorDefinition;
32
+ /**
33
+ * ## $and
34
+ *
35
+ * A constraint that checks whether all the provided processors return a truthy value.
36
+ *
37
+ * Returns the last truthy value from the processors, or throws if any are falsey.
38
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
39
+ * This works best in finalizers, validators, or in opaque schema transformers.
40
+ *
41
+ * See `$all` if you want to check for success (defined value) instead of truthiness
42
+ *
43
+ * ### Parameters
44
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, all of which must return a truthy value.
45
+ *
46
+ * ### Example
47
+ * ```js
48
+ * // Require a string to be both non-empty and a valid email
49
+ * new Schema('string').validator({$and: ['$non-empty', '$email']})
50
+ *
51
+ * // Require a number to be positive and within range
52
+ * new Schema('number').validator({
53
+ * $and: ['$positive', {$range: {max: 1000}}]
54
+ * })
55
+ * ```
56
+ *
57
+ * @type {ValueProcessorDefinition}
58
+ */
59
+ export const AND_CONSTRAINT: ValueProcessorDefinition;
60
+ /**
61
+ * ## $any
62
+ *
63
+ * A constraint that checks whether any of the provided processors return a defined value.
64
+ * (Not to be confused with the unrelated "any" schema!)
65
+ *
66
+ * Returns the first defined value from the processors, or throws if none returned a defined value.
67
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
68
+ * This works best in finalizers, validators, or in opaque schema transformers.
69
+ *
70
+ * See `$or` if you want to check for truthiness instead of a defined value.
71
+ *
72
+ * ### Parameters
73
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, at least one of which must return a defined value.
74
+ *
75
+ * ### Example
76
+ * ```js
77
+ * // Accept a value that matches any of several pattern-based normalizations
78
+ * new Schema('string').normalizer({
79
+ * $any: [
80
+ * {$match: /^\d+$/},
81
+ * {$match: /^[a-f0-9]+$/i},
82
+ * ]
83
+ * })
84
+ *
85
+ * // Require a value that can be processed by at least one schema
86
+ * new Schema('any').validator({$any: ['$numeric', '$boolean', '$date']})
87
+ * ```
88
+ *
89
+ * @type {ValueProcessorDefinition}
90
+ */
91
+ export const ANY_CONSTRAINT: ValueProcessorDefinition;
92
+ /**
93
+ * ## $all
94
+ *
95
+ * A constraint that checks whether all the provided processors return a defined value.
96
+ *
97
+ * Returns the last defined value returned from the processors, or throws if any returned undefined or threw an error.
98
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
99
+ * This works best in finalizers, validators, or in opaque schema transformers.
100
+ *
101
+ * See `$and` if you want to check for truthiness instead of defined values.
102
+ *
103
+ * ### Parameters
104
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, all of which must return a defined value.
105
+ *
106
+ * ### Example
107
+ * ```js
108
+ * // Validate that all normalizations succeed for a value that must satisfy multiple constraints
109
+ * new Schema('string').validator({
110
+ * $all: ['$non-empty', '$email', {$matches: /\.com$/}]
111
+ * })
112
+ *
113
+ * // Ensure a value passes both a type check and a range constraint
114
+ * new Schema('any').validator({$all: ['$numeric', {$range: {min: 0, max: 100}}]})
115
+ * ```
116
+ *
117
+ * @type {ValueProcessorDefinition}
118
+ */
119
+ export const ALL_CONSTRAINT: ValueProcessorDefinition;
120
+ /**
121
+ * ## $exclusive
122
+ *
123
+ * A constraint that checks whether exactly one of the provided processors returns a truthy value.
124
+ *
125
+ * Returns the single truthy value, or throws if zero or more than one are truthy.
126
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
127
+ * This works best in finalizers, validators, or in opaque schema transformers.
128
+ *
129
+ * See `$one` if you want to check for success (defined value) instead of truthiness.
130
+ *
131
+ * ### Parameters
132
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, exactly one of which must return a truthy value.
133
+ *
134
+ * ### Example
135
+ * ```js
136
+ * // A form field must have either an email or a phone number, but not both
137
+ * new Schema('object').validator({
138
+ * $exclusive: [
139
+ * {$property: 'email'},
140
+ * {$property: 'phone'},
141
+ * ]
142
+ * })
143
+ * ```
144
+ *
145
+ * @type {ValueProcessorDefinition}
146
+ */
147
+ export const EXCLUSIVE_CONSTRAINT: ValueProcessorDefinition;
148
+ /**
149
+ * ## $one
150
+ *
151
+ * A constraint that checks whether exactly one of the provided processors returns a defined value.
152
+ *
153
+ * Returns the single defined value, or throws if zero or more than one succeed.
154
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
155
+ * This works best in finalizers, validators, or in opaque schema transformers.
156
+ *
157
+ * See `$exclusive` if you want to check for truthiness instead of a defined value.
158
+ *
159
+ * ### Parameters
160
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications, exactly one of which must return a defined value.
161
+ *
162
+ * ### Example
163
+ * ```js
164
+ * // Exactly one authentication method must be configured
165
+ * new Schema('object').validator({
166
+ * $one: [
167
+ * {$property: 'apiKey'},
168
+ * {$property: 'oauth'},
169
+ * {$property: 'basicAuth'},
170
+ * ]
171
+ * })
172
+ * ```
173
+ *
174
+ * @type {ValueProcessorDefinition}
175
+ */
176
+ export const ONE_CONSTRAINT: ValueProcessorDefinition;
177
+ /**
178
+ * ## $first
179
+ *
180
+ * An operator that returns the first defined value successfully returned from a sequence of processors.
181
+ *
182
+ * Unlike `$any`, no exception is thrown if there are no defined results, it simply returns `undefined`.
183
+ * Be careful to not use this in a situation where the provided processors may require late-resolved values!
184
+ * This works best in finalizers, validators, or in opaque schema transformers.
185
+ *
186
+ * There is no truthy variant of `$first`, as there generally isn't much value in differentiating which
187
+ * truthy value to return; use constructs like `{$if: {$or: [...]}}` to wrap truthy sequence constraints as operators.
188
+ * `$first` is basically an alias for `{$gate: {$any: [...]}}`.
189
+ *
190
+ * ### Parameters
191
+ * - `processors` (`Array<ProcessorSpec>`, required): Array of processor specifications to try in order.
192
+ *
193
+ * ### Example
194
+ * ```js
195
+ * // Try several environment variable names and return the first one that has a value
196
+ * new Schema('object').transformer({
197
+ * $first: [
198
+ * {$reference: 'DATABASE_URL'},
199
+ * {$reference: 'DB_URL'},
200
+ * {$reference: 'POSTGRES_URL'},
201
+ * ]
202
+ * })
203
+ *
204
+ * // Return the first successfully parsed format
205
+ * new Schema('string').normalizer({
206
+ * $first: ['$number', '$date', '$boolean']
207
+ * })
208
+ * ```
209
+ *
210
+ * @type {ValueProcessorDefinition}
211
+ */
212
+ export const FIRST_OPERATOR: ValueProcessorDefinition;
213
+ import type { ValueProcessorDefinition } from '../../value-processor/value-processor.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ## $sort
3
+ *
4
+ * Returns a new sorted array. Non-mutating. Numbers are compared numerically;
5
+ * all other values are compared lexicographically as strings.
6
+ * Throws if the input is not an array.
7
+ *
8
+ * ### Parameters
9
+ * - `key` (string|null, optional, default `null`): Object property key to sort by.
10
+ * - `direction` (`'asc'`|`'desc'`, optional, default `'asc'`): Sort direction.
11
+ *
12
+ * ### Example
13
+ * ```js
14
+ * // Sort an array of numbers in ascending order
15
+ * new Schema('array').transformer('$sort')
16
+ * // [3, 1, 2] → [1, 2, 3]
17
+ *
18
+ * // Sort strings in descending order
19
+ * new Schema('array').transformer({$sort: {direction: 'desc'}})
20
+ *
21
+ * // Sort an array of objects by a property
22
+ * new Schema('array').transformer({$sort: {key: 'name'}})
23
+ * // [{name: 'Charlie'}, {name: 'Alice'}] → [{name: 'Alice'}, {name: 'Charlie'}]
24
+ *
25
+ * // Sort objects by a numeric property descending
26
+ * new Schema('array').transformer({$sort: {key: 'score', direction: 'desc'}})
27
+ * ```
28
+ *
29
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
30
+ */
31
+ export const SORT_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ## $split
3
+ *
4
+ * Stringify the input and split on the provided separator, returning an array.
5
+ *
6
+ * ### Parameters
7
+ * - `separator` (string, optional, defaults to ","): The value to use for splitting
8
+ * - `limit` (integer, optional): The maximum number of elements to return.
9
+ *
10
+ * Note that RegExp separators must be wrapped in a `$literal` to prevent evaluation as constraints.
11
+ * Otherwise, follows the behavior of JavaScript's String.prototype.split.
12
+ *
13
+ * ### Example
14
+ * ```js
15
+ * // Split a comma-separated list into an array
16
+ * new Schema('string').transformer('$split')
17
+ * // 'a,b,c' → ['a', 'b', 'c']
18
+ *
19
+ * // Split on a custom separator
20
+ * new Schema('string').transformer({$split: {separator: ':'}})
21
+ * // 'host:port' → ['host', 'port']
22
+ *
23
+ * // Split then normalize each element
24
+ * new Schema('string').normalizer([{$split: {separator: ','}}, {$each: '$trim'}])
25
+ * // ' a , b , c ' → ['a', 'b', 'c']
26
+ *
27
+ * // Split a PATH-style variable, limiting to 5 segments
28
+ * new Schema('string').transformer({$split: {separator: '/', limit: 5}})
29
+ * ```
30
+ *
31
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}*
32
+ */
33
+ export const SPLIT_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * ## $replace
3
+ *
4
+ * Replaces occurrences of a pattern in a string.
5
+ *
6
+ * - Pattern may be a string (replaced globally via `replaceAll`) or a RegExp (flags control global).
7
+ * - Replacement must be a string.
8
+ *
9
+ * ### Parameters
10
+ * - First positional: pattern (string or RegExp, required)
11
+ * - Second positional: replacement (string, required)
12
+ *
13
+ * ### Example
14
+ * ```js
15
+ * // Replace all underscores with hyphens
16
+ * new Schema('string').transformer({$replace: ['_', '-']})
17
+ * // 'hello_world' → 'hello-world'
18
+ *
19
+ * // Strip all non-digit characters using a RegExp
20
+ * new Schema('string').normalizer({$replace: [/\D+/g, '']})
21
+ * // '+1 (800) 555-1234' → '18005551234'
22
+ *
23
+ * // Redact sensitive patterns
24
+ * new Schema('string').transformer({$replace: [/\b\d{4}-\d{4}-\d{4}-\d{4}\b/g, '[REDACTED]']})
25
+ * ```
26
+ *
27
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
28
+ */
29
+ export const REPLACE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
30
+ /**
31
+ * ## $substring
32
+ *
33
+ * Extracts a portion of a string by start index and optional length.
34
+ *
35
+ * ### Parameters
36
+ * - `start` (number, required): Start index (0-based).
37
+ * - `length` (number, optional): Number of characters to extract. If omitted, extracts to end of string.
38
+ *
39
+ * ### Example
40
+ * ```js
41
+ * // Extract the first 8 characters of a hash
42
+ * new Schema('string').transformer({$substring: {start: 0, length: 8}})
43
+ * // 'abcdef1234567890' → 'abcdef12'
44
+ *
45
+ * // Strip a known prefix (e.g. 'Bearer ')
46
+ * new Schema('string').transformer({$substring: {start: 7}})
47
+ *
48
+ * // Extract a fixed-position field from a formatted string
49
+ * new Schema('string').transformer({$substring: {start: 4, length: 2}})
50
+ * // '2026-03-21' → '03' (month)
51
+ * ```
52
+ *
53
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
54
+ */
55
+ export const SUBSTRING_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
56
+ /**
57
+ * ## $pad
58
+ *
59
+ * Pads a string to a minimum width.
60
+ *
61
+ * ### Parameters
62
+ * - `width` (number, required): Target minimum length.
63
+ * - `char` (string, optional): Pad character. Defaults to `' '`.
64
+ * - `side` (`'left'`|`'right'`, optional): Which side to pad. Defaults to `'left'`.
65
+ *
66
+ * ### Example
67
+ * ```js
68
+ * // Zero-pad a numeric string to 6 digits
69
+ * new Schema('string').transformer({$pad: {width: 6, char: '0'}})
70
+ * // '42' → '000042'
71
+ *
72
+ * // Right-pad a string to fill a fixed-width column
73
+ * new Schema('string').transformer({$pad: {width: 20, side: 'right'}})
74
+ * // 'Alice' → 'Alice '
75
+ *
76
+ * // Pad a month/day to 2 digits
77
+ * new Schema('number').transformer(['$string', {$pad: {width: 2, char: '0'}}])
78
+ * // 3 → '03'
79
+ * ```
80
+ *
81
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
82
+ */
83
+ export const PAD_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ## $string
3
+ *
4
+ * Ensures value is a string, stringifying as necessary. Everything other than null and undefined can be converted.
5
+ *
6
+ * See `$is-string` for strict string validation.
7
+ *
8
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
9
+ */
10
+ export const STRING_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * ## $target
3
+ *
4
+ * Returns the target value passed to the processor (value being built relative to the root).
5
+ * (Note: may return undefined or partial results, depending on the schema!)
6
+ *
7
+ * ### Example
8
+ *
9
+ * ```js
10
+ * // Uses $target to provide an object for $get to access
11
+ * new Schema('object')
12
+ * .property('level-one', new Schema('object')
13
+ * .property('enable-level-3', new Schema('boolean').default(false))
14
+ * .property('level-two', new Schema('object')
15
+ * .property('level-three', new Schema('object')
16
+ * .condition(['$target', {get: 'level-one.enable-level-3'}])
17
+ * .property('child', new Schema('string'))
18
+ * )
19
+ * )
20
+ * )
21
+ * // { "level-one": { "level-two": { "level-three": { "child": "ignored" } } } }
22
+ * // { "level-one": { "enable-level-3": true, "level-two": { "level-three": { "child": "is set" } } } }
23
+ * ```
24
+ *
25
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
26
+ */
27
+ export const TARGET_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ## $template
3
+ *
4
+ * Operator that interpolates a template string using properties from the input object.
5
+ * Placeholders use `{key}` syntax; double braces `{{` and `}}` are literal brace escapes.
6
+ *
7
+ * The input must be a plain object. Unknown keys resolve to an empty string.
8
+ *
9
+ * ### Parameters
10
+ * - `template` (string, required): The template string to interpolate.
11
+ *
12
+ * ### Example
13
+ * ```js
14
+ * // Build a connection string from object properties
15
+ * new Schema('object', {
16
+ * host: new Schema('string'),
17
+ * port: new Schema('number'),
18
+ * database: new Schema('string'),
19
+ * }).transformer({$template: 'postgresql://{host}:{port}/{database}'})
20
+ *
21
+ * // Format a greeting from a user object
22
+ * new Schema('object').transformer({$template: 'Hello, {firstName} {lastName}!'})
23
+ *
24
+ * // Use double-braces to produce literal curly braces
25
+ * new Schema('object').transformer({$template: 'Value: {{literal}}'})
26
+ * // {} → 'Value: {literal}'
27
+ * ```
28
+ *
29
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
30
+ */
31
+ export const TEMPLATE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ## $title-case
3
+ *
4
+ * Converts a string to title case, capitalizing the first letter of each significant word
5
+ * and leaving articles, coordinating conjunctions, and short prepositions lowercase when
6
+ * they appear in the middle of the phrase. The first and last words are always capitalized.
7
+ *
8
+ * Lowercase words: a, an, the, and, but, or, nor, for, so, yet, at, by, in, of, on, to, up, as, via
9
+ *
10
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
11
+ */
12
+ export const TITLE_CASE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ## $trim
3
+ *
4
+ * Removes leading and trailing whitespace from a string value.
5
+ * Safe to use in normalize phase (non-throwing operator).
6
+ *
7
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
8
+ */
9
+ export const TRIM_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * ## $truthy
3
+ *
4
+ * Validates that the value is "truthy". Note that the definition of what values are "truthy"
5
+ * mirrors the boolean schema normalization of special strings like "true" and "no".
6
+ *
7
+ * ### Example
8
+ * ```js
9
+ * // Require a feature flag to be truthy before processing a value
10
+ * new Schema('object', {
11
+ * enabled: new Schema('boolean'),
12
+ * config: new Schema('string').validator({$assert: {$property: 'enabled'}}),
13
+ * })
14
+ *
15
+ * // Use $truthy inside a conditional to branch on truthiness
16
+ * new Schema('any').transformer({
17
+ * $if: ['$truthy', '$uppercase']
18
+ * })
19
+ * ```
20
+ *
21
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
22
+ */
23
+ export const TRUTHY_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * ## $type
3
+ *
4
+ * Returns the type name of the input value as a string. Unlike the `$is-*` constraint family,
5
+ * this operator produces the type name as a value usable in pipelines and templates.
6
+ *
7
+ * **Return values**: `'string'`, `'number'`, `'boolean'`, `'array'`, `'object'`, `'date'`, `'schema'`, `'null'`, `'undefined'`
8
+ *
9
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
10
+ */
11
+ export const TYPE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ## $unique
3
+ *
4
+ * Returns a new array with duplicate values removed, preserving insertion order
5
+ * of first occurrences. Uses identity-based (`Set`) deduplication.
6
+ * Throws if the input is not an array.
7
+ *
8
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
9
+ */
10
+ export const UNIQUE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ## $uppercase
3
+ *
4
+ * Converts a string value to uppercase. Safe to use in normalize phase (non-throwing).
5
+ * Non-string values are coerced to strings before conversion.
6
+ *
7
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
8
+ */
9
+ export const UPPERCASE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ## $url
3
+ *
4
+ * Validates that a string is a valid URL and normalizes it to canonical form.
5
+ * Uses the WHATWG URL Standard for validation and normalization. The normalized
6
+ * URL includes explicit protocol, properly encoded characters, and standardized formatting.
7
+ *
8
+ * - `https://example.com` → `https://example.com/`
9
+ * - `http://localhost:8080/api` → `http://localhost:8080/api`
10
+ * - `https://example.com/path?query=value` → `https://example.com/path?query=value`
11
+ * - `ftp://files.example.com/` → `ftp://files.example.com/`
12
+ *
13
+ * - `not-a-url` (missing protocol)
14
+ * - `//example.com` (missing protocol)
15
+ * - `example.com` (missing protocol)
16
+ * - `http://` (missing host)
17
+ *
18
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
19
+ */
20
+ export const URL_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ## $url-decode
3
+ *
4
+ * Decodes a percent-encoded URL string.
5
+ *
6
+ * Use `{$url-decode: {full: true}}` to decode a complete URL (`decodeURI`)
7
+ * rather than a component (`decodeURIComponent`). Full-URL decoding preserves
8
+ * sequences that are valid structural URL characters (`%2F` etc.) undecoded.
9
+ *
10
+ * Throws if the input is not a string or contains a malformed escape sequence.
11
+ *
12
+ * ### Parameters
13
+ * - `full` (boolean, optional, default `false`): Use full-URL decoding (`decodeURI`) rather than component decoding (`decodeURIComponent`).
14
+ *
15
+ * ### Example
16
+ * ```js
17
+ * // Decode a percent-encoded query parameter
18
+ * new Schema('string').normalizer('$url-decode')
19
+ * // 'hello%20world%20%26%20more' → 'hello world & more'
20
+ *
21
+ * // Decode a full URL without decoding structural characters
22
+ * new Schema('string').normalizer({'$url-decode': {full: true}})
23
+ * // 'https://example.com/path%20with%20spaces' → 'https://example.com/path with spaces'
24
+ *
25
+ * // Decode then validate the result
26
+ * new Schema('string').normalizer('$url-decode').validator('$non-empty')
27
+ * ```
28
+ *
29
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
30
+ */
31
+ export const URL_DECODE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * ## $url-encode
3
+ *
4
+ * Percent-encodes a string for safe use as a URL component (query param value,
5
+ * path segment, etc.). Encodes all characters except unreserved URI characters
6
+ * (`A–Z a–z 0–9 - _ . ! ~ * ' ( )`).
7
+ *
8
+ * Use `{$url-encode: {full: true}}` to encode a complete URL instead of a
9
+ * component — this preserves `://`, `/`, `?`, `&`, `=`, and other structural
10
+ * characters rather than encoding them.
11
+ *
12
+ * Non-string inputs are coerced to string before encoding.
13
+ *
14
+ * ### Parameters
15
+ * - `full` (boolean, optional, default `false`): Use full-URL encoding (`encodeURI`) rather than component encoding (`encodeURIComponent`).
16
+ *
17
+ * ### Example
18
+ * ```js
19
+ * // Encode a query parameter value
20
+ * new Schema('string').transformer('$url-encode')
21
+ * // 'hello world & more' → 'hello%20world%20%26%20more'
22
+ *
23
+ * // Encode a full URL, preserving structural characters
24
+ * new Schema('string').transformer({'$url-encode': {full: true}})
25
+ * // 'https://example.com/path with spaces' → 'https://example.com/path%20with%20spaces'
26
+ *
27
+ * // Build an encoded query string from an object
28
+ * new Schema('object', {
29
+ * q: new Schema('string').transformer('$url-encode'),
30
+ * page: new Schema('number'),
31
+ * })
32
+ * ```
33
+ *
34
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
35
+ */
36
+ export const URL_ENCODE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ## $uuid
3
+ *
4
+ * Validates that a string matches valid UUID format (versions 1-5).
5
+ * UUIDs must follow RFC 4122 format: 8-4-4-4-12 hexadecimal digits
6
+ * separated by hyphens.
7
+ *
8
+ * - `550e8400-e29b-41d4-a716-446655440000` (v4)
9
+ * - `6ba7b810-9dad-11d1-80b4-00c04fd430c8` (v1)
10
+ * - `3d813cbb-47fb-32ba-91df-831e1593ac29` (v3)
11
+ * - `A6EAFB30-E49B-51D4-9B1D-8F6C0F89E8B3` (case-insensitive)
12
+ *
13
+ * - `550e8400-e29b-41d4-a716` (too short)
14
+ * - `550e8400e29b41d4a716446655440000` (missing hyphens)
15
+ * - `550e8400-e29b-61d4-a716-446655440000` (invalid version digit)
16
+ * - `not-a-valid-uuid-string`
17
+ *
18
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
19
+ */
20
+ export const UUID_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ## $values
3
+ *
4
+ * Returns the enumerable own property values of an object as an array.
5
+ * Throws if the input is not a plain object.
6
+ *
7
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
8
+ */
9
+ export const VALUES_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,2 @@
1
+ export const ANY_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const ARRAY_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const BOOLEAN_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const DATE_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const FUNCTION_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const NUMBER_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';