@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,2 @@
1
+ export const OBJECT_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const ROOT_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,2 @@
1
+ export const STRING_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Node.js-specific schemas and processors.
3
+ *
4
+ * Loaded automatically when running under Node.js. Registers the `buffer`
5
+ * schema type and processors that depend on `node:fs`, `node:dns`, or the
6
+ * Node.js `Buffer` global.
7
+ *
8
+ * @param {SchemaResolver} resolver
9
+ * @param {object} options
10
+ */
11
+ export default function coreLibraryNode(resolver: SchemaResolver, options: object): void;
12
+ import type { SchemaResolver } from '../schema-resolver.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ## $base64-decode
3
+ *
4
+ * Decodes a Base64-encoded string to a Buffer.
5
+ * Throws if the input is not a string.
6
+ *
7
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
8
+ */
9
+ export const BASE64_DECODE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ## $base64-encode
3
+ *
4
+ * Encodes a Buffer to a Base64 string.
5
+ * Throws if the input is not a Buffer.
6
+ *
7
+ * @type {import('../../value-processor/value-processor.js').ValueProcessorDefinition}
8
+ */
9
+ export const BASE64_ENCODE_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * ## $buffer
3
+ *
4
+ * Converts a value to a Node.js Buffer. Accepts:
5
+ * - `Buffer` — passed through unchanged
6
+ * - `string` — decoded from Base64 via `Buffer.from(value, 'base64')`
7
+ * - `{size, fill?, encoding?}` — allocated via `Buffer.alloc(size, fill, encoding)`
8
+ * - `{encoding, buffer}` — constructed from an underlying ArrayBuffer via `Buffer.from(value.buffer)`
9
+ * - anything else (TypedArray, byte array, etc.) — via `Buffer.from(value)`
10
+ *
11
+ * See `$is-buffer` for strict Buffer validation without conversion.
12
+ *
13
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
14
+ */
15
+ export const BUFFER_OPERATOR: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * ## $directory
3
+ *
4
+ * Validates that a path exists on the filesystem and is a directory (not a file).
5
+ * This is an **async processor** that performs filesystem operations.
6
+ *
7
+ * The processor checks both existence and type, throwing distinct errors for:
8
+ * - Path does not exist (`ENOENT`)
9
+ * - Path exists but is a file, symlink, or other non-directory type
10
+ * - Path is inaccessible due to permissions or other filesystem errors
11
+ *
12
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
13
+ */
14
+ export const DIRECTORY_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ## $executable
3
+ *
4
+ * Validates that a file path points to an executable file by checking execute
5
+ * permissions. This is an asynchronous processor that performs a file system
6
+ * access check.
7
+ *
8
+ * This processor is particularly useful for validating script paths, binary
9
+ * paths, and command executables in configuration files.
10
+ *
11
+ * **Note**: This processor performs async file system checks and should usually
12
+ * be used as a validator. Execution permissions are platform-dependent (Unix/Linux/macOS
13
+ * use chmod +x; Windows uses file extensions and ACLs).
14
+ *
15
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
16
+ */
17
+ export const EXECUTABLE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ## $file
3
+ *
4
+ * Validates that a path exists in the filesystem and is a file (not a directory or other type).
5
+ * Performs an asynchronous filesystem check using `fs.stat()`.
6
+ *
7
+ * - Non-existent paths: `"/does/not/exist.txt"` → throws "File does not exist"
8
+ * - Directory paths: `"/var/log"` → throws "Path exists but is not a file"
9
+ * - Inaccessible paths: `"/root/secret.txt"` (permission denied) → throws "Cannot access file: ..."
10
+ *
11
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
12
+ */
13
+ export const FILE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * ## $file-size
3
+ *
4
+ * Validates that a file's size falls within the specified range. Accepts size constraints
5
+ * in bytes and checks the file's metadata without loading the entire file into memory.
6
+ * Can specify minimum, maximum, or both bounds.
7
+ *
8
+ * **This is an async processor** that performs filesystem I/O, and probably best suited
9
+ * for use during transformation or validation phases.
10
+ *
11
+ * ### Parameters
12
+ * - `min` (number, optional): Minimum file size in bytes (inclusive). If omitted, no lower bound.
13
+ * - `max` (number, optional): Maximum file size in bytes (inclusive). If omitted, no upper bound.
14
+ *
15
+ * **Unit Conversions**: Size must be specified in bytes. Use standard conversions:
16
+ * - 1 KB = 1024 bytes
17
+ * - 1 MB = 1024 * 1024 bytes (1,048,576)
18
+ * - 1 GB = 1024 * 1024 * 1024 bytes (1,073,741,824)
19
+ *
20
+ * **Note**: Typically used with `$file` validator to ensure the file exists before checking size.
21
+ * The processor reads file metadata via `fs.stat()` and does not load file contents.
22
+ *
23
+ * ### Example
24
+ * ```js
25
+ * // Validate a config file exists and is under 1 MB
26
+ * new Schema('string')
27
+ * .validator('$file')
28
+ * .validator({'$file-size': {max: 1024 * 1024}})
29
+ *
30
+ * // Require an upload file to be between 1 KB and 10 MB
31
+ * new Schema('string')
32
+ * .validator('$file')
33
+ * .validator({'$file-size': {min: 1024, max: 10 * 1024 * 1024}})
34
+ *
35
+ * // Ensure a log file is not empty
36
+ * new Schema('string')
37
+ * .validator('$file')
38
+ * .validator({'$file-size': {min: 1}})
39
+ * ```
40
+ *
41
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
42
+ */
43
+ export const FILE_SIZE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ## $is-buffer
3
+ *
4
+ * Validates that the input is a Node.js Buffer.
5
+ *
6
+ * See `$buffer` for looser normalization that accepts values that can be converted to a Buffer.
7
+ *
8
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
9
+ */
10
+ export const IS_BUFFER_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * ## $reachable
3
+ *
4
+ * Validates that a hostname is reachable by performing a DNS lookup.
5
+ * This is an asynchronous processor that checks if the hostname resolves to an IP address.
6
+ *
7
+ * Note: This processor performs a network operation and may fail if DNS is unavailable
8
+ * or the hostname does not exist. It does not verify that the host is responding on any port,
9
+ * only that it has a DNS record.
10
+ *
11
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
12
+ */
13
+ export const REACHABLE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ## $readable
3
+ *
4
+ * Validates that a file or directory path exists and has read permissions for the
5
+ * current process. Performs an asynchronous file system access check.
6
+ *
7
+ * This processor uses Node.js `fs.access()` with `R_OK` flag to verify read permissions
8
+ * without actually opening the file. Note that permission checks can be subject to race
9
+ * conditions where permissions change between validation and actual file access.
10
+ *
11
+ * (e.g., `"/etc/hosts"`, `"./config.json"`, `"~/Documents"`)
12
+ *
13
+ * or non-string values
14
+ *
15
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
16
+ */
17
+ export const READABLE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ## $writable
3
+ *
4
+ * Validates that a file system path is writable by checking write permissions.
5
+ * If the path does not exist, validates that the parent directory exists and is writable.
6
+ *
7
+ * This is an asynchronous processor that performs file system permission checks.
8
+ *
9
+ * - Existing files with write permissions: `/tmp/output.log`, `./config.json`
10
+ * - Non-existent paths in writable directories: `/tmp/new-file.txt`, `./data/output.csv`
11
+ *
12
+ * - Read-only files: `/etc/hosts`, system-protected paths
13
+ * - Paths in non-existent parent directories: `/nonexistent/dir/file.txt`
14
+ * - Paths in read-only directories: `/read-only-mount/file.txt`
15
+ *
16
+ * @type {import("../../value-processor/value-processor.js").ValueProcessorDefinition}
17
+ */
18
+ export const WRITABLE_CONSTRAINT: import("../../value-processor/value-processor.js").ValueProcessorDefinition;
@@ -0,0 +1,2 @@
1
+ export const BUFFER_SCHEMA: Schema;
2
+ import { Schema } from '../../schema.js';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @param {Error} error
3
+ * @param {RegExp|string} match
4
+ * @param {string} [fullErrorMessage]
5
+ * @param {Error} [err]
6
+ * @returns {boolean}
7
+ * @internal
8
+ */
9
+ export function assertErrorMessageInCauseChain(error: Error, match: RegExp | string, fullErrorMessage?: string, err?: Error): boolean;
10
+ export class SchemaError extends Error {
11
+ /**
12
+ * @param {string} message
13
+ * @param {object} [data]
14
+ * @param {Error|any} [data.cause]
15
+ * @param {string} [data.path]
16
+ * @param {SchemaLocation} [data.location]
17
+ * @param {string|number} [data.property]
18
+ * @param {any} [data.value]
19
+ * @param {number} [data.code]
20
+ * @param {Array<Error>} [data.errors]
21
+ * @param {boolean} [preserveStack]
22
+ */
23
+ constructor(message: string, data?: {
24
+ cause?: Error | any;
25
+ path?: string | undefined;
26
+ location?: SchemaLocation | undefined;
27
+ property?: string | number | undefined;
28
+ value?: any;
29
+ code?: number | undefined;
30
+ errors?: Error[] | undefined;
31
+ }, preserveStack?: boolean);
32
+ /** @type {any} */
33
+ data: any;
34
+ __proto__: any;
35
+ cause: any;
36
+ get name(): string;
37
+ set stack(str: string);
38
+ get stack(): string;
39
+ }
40
+ export class ConstraintError extends SchemaError {
41
+ }
42
+ export class ValidationError extends SchemaError {
43
+ }
44
+ export class NormalizeError extends SchemaError {
45
+ }
46
+ export class TransformError extends SchemaError {
47
+ }
48
+ export class FinalizeError extends SchemaError {
49
+ }
50
+ export class SerializeError extends SchemaError {
51
+ }
52
+ export class UnionResolutionError extends SchemaError {
53
+ }
54
+ export class ResolverError extends SchemaError {
55
+ }
56
+ export class SchemaCompilationError extends SchemaError {
57
+ }
58
+ import { SchemaLocation } from "./schema-location.js";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @augments {Executor<any>}
3
+ */
4
+ export class ArrayExecutor extends Executor<any> {
5
+ /**
6
+ * @param {any[]|any} [array]
7
+ */
8
+ constructor(array?: any[] | any);
9
+ /**
10
+ * @param {any} input
11
+ * @param {...any} extra
12
+ * @returns {any[]|Promise<any[]>}
13
+ */
14
+ execute(input: any, ...extra: any[]): any[] | Promise<any[]>;
15
+ #private;
16
+ }
17
+ import { Executor } from './executor.js';
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @template T
3
+ * @typedef {object} ConditionalExecutorActions
4
+ * @property {any} [success]
5
+ * @property {any} [failure]
6
+ */
7
+ /**
8
+ * Checks if the provided predicate succeeds. Usable as-is, or as a base class with behavior configured by flags.
9
+ *
10
+ * Default behavior simply tries running the predicate; if it throws or rejects, it is considered a failure.
11
+ *
12
+ * On success, the success action is called with the original input (default: returns the value)
13
+ * On failure, the failure action is called with the original input (default: return undefined)
14
+ *
15
+ * @template T
16
+ * @augments {Executor<T>}
17
+ */
18
+ export class ConditionalExecutor<T> extends Executor<T> {
19
+ static CHECK_TRUTHY: symbol;
20
+ static CHECK_DEFINED: symbol;
21
+ static PASS_RESULT: symbol;
22
+ static PASS_ERROR: symbol;
23
+ /**
24
+ * Construct a `ConditionalExecutor` from a predicate and optional success/failure executors.
25
+ * - If no success executor is provided, the resolved value from the predicate is returned.
26
+ * - If no failure executor is provided, `undefined` is returned.
27
+ *
28
+ * @param {any} predicate
29
+ * @param {ConditionalExecutorActions<T>} [actions]
30
+ * @param {symbol[]} [flags]
31
+ */
32
+ constructor(predicate: any, actions?: ConditionalExecutorActions<T>, flags?: symbol[]);
33
+ /**
34
+ * @param {T} input
35
+ * @param {...any} variadic
36
+ * @returns {T|null|undefined|Promise<T|null|undefined>}
37
+ */
38
+ execute(input: T, ...variadic: any[]): T | null | undefined | Promise<T | null | undefined>;
39
+ #private;
40
+ }
41
+ export type ConditionalExecutorActions<T> = {
42
+ success?: any;
43
+ failure?: any;
44
+ };
45
+ import { Executor } from './executor.js';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @template T
3
+ * @template E
4
+ * @augments {Executor<T>}
5
+ */
6
+ export class EachExecutor<T, E> extends Executor<T> {
7
+ /**
8
+ * @param {Executor<E>|any} each - executor to apply to each value during execute
9
+ * @param {(value:T|null|undefined)=>(E|null|undefined)[]} [toValues] - optional value factory
10
+ * @param {((values:(E|null|undefined)[],input:T|null|undefined)=>T|null|undefined)} [fromValues]
11
+ */
12
+ constructor(each: Executor<E> | any, toValues?: (value: T | null | undefined) => (E | null | undefined)[], fromValues?: ((values: (E | null | undefined)[], input: T | null | undefined) => T | null | undefined));
13
+ #private;
14
+ }
15
+ import { Executor } from './executor.js';
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @template T
3
+ * @param {T|Executor<T>|ExecutorFunction<T>} e
4
+ * @returns {Executor<T>}
5
+ */
6
+ export function toExecutor<T>(e: T | Executor<T> | ExecutorFunction<T>): Executor<T>;
7
+ /** @import {Thenable} from './thenable.js' */
8
+ /**
9
+ * @template T
10
+ * @typedef {(input:T|null|undefined, ...variadic:any) => T|null|undefined|Promise<T|null|undefined>} ExecutorFunction
11
+ */
12
+ /**
13
+ * @template T
14
+ * @template R
15
+ * @typedef {(input:T|null|undefined, ...variadic:any) => R|null|undefined|Promise<R|null|undefined>} MappingExecutorFunction
16
+ */
17
+ /**
18
+ * An `Executor` is a composable unit of computation that processes an input into an output.
19
+ *
20
+ * Executors are designed for fine-grained runtime composition (executors calling other executors) and
21
+ * are frequently used in hot code paths. Executors may be synchronous or asynchronous, but fully synchronous
22
+ * executor call chains are optimized to incur no async overhead. Only the outermost call thus needs to be awaited.
23
+ *
24
+ * Errors are surfaced as exceptions or rejections.
25
+ *
26
+ * Combinator executors may catch and transform errors, or intercept and reinterpret intermediate outputs.
27
+ *
28
+ * @template T
29
+ */
30
+ export class Executor<T> {
31
+ /**
32
+ * Process on a given input.
33
+ *
34
+ * The execute() method may return an output synchronously, or return a `Promise`
35
+ * for deferred output. Callers must handle both cases.
36
+ *
37
+ * Output value conventions:
38
+ * - An output value of `null` signals that processing this input will *never* produce an output. Most executors
39
+ * receiving `null` as input should propagate it immediately without processing, although coordinator executors
40
+ * that check for success or failure may choose to branch to an appropriate handler executor based on the result.
41
+ * - An output value of `undefined` signals that this input could not be processed *at this time*.
42
+ * It is a soft signal (often used to halt a chain); individual executors define whether
43
+ * `undefined` is a legal input for their context.
44
+ *
45
+ * @param {T|null|undefined} input - required primary input
46
+ * @param {...any} variadic - optional extra arguments (defined as needed by subclasses)
47
+ * @returns {T|null|undefined|Promise<T|null|undefined>}
48
+ */
49
+ execute(input: T | null | undefined, ...variadic: any[]): T | null | undefined | Promise<T | null | undefined>;
50
+ get isConstant(): boolean;
51
+ }
52
+ /**
53
+ * Wrap a provided executor function as an Executor
54
+ *
55
+ * @template T
56
+ * @augments Executor<T>
57
+ */
58
+ export class FunctionExecutor<T> extends Executor<T> {
59
+ /**
60
+ * @param {ExecutorFunction<T>} execute
61
+ */
62
+ constructor(execute: ExecutorFunction<T>);
63
+ /**
64
+ * @param {T} input - required primary input
65
+ * @param {...any} variadic - optional extra arguments (defined as needed by subclasses)
66
+ * @returns {T|null|undefined|Promise<T|null|undefined>}
67
+ */
68
+ execute(input: T, ...variadic: any[]): T | null | undefined | Promise<T | null | undefined>;
69
+ #private;
70
+ }
71
+ export class ConstantExecutor extends Executor<any> {
72
+ /**
73
+ * @param {any} value
74
+ */
75
+ constructor(value: any);
76
+ execute(): any;
77
+ #private;
78
+ }
79
+ export const NULL_EXECUTOR: ConstantExecutor;
80
+ export const UNDEFINED_EXECUTOR: ConstantExecutor;
81
+ export const TRUE_EXECUTOR: ConstantExecutor;
82
+ export const FALSE_EXECUTOR: ConstantExecutor;
83
+ export type ExecutorFunction<T> = (input: T | null | undefined, ...variadic: any) => T | null | undefined | Promise<T | null | undefined>;
84
+ export type MappingExecutorFunction<T, R> = (input: T | null | undefined, ...variadic: any) => R | null | undefined | Promise<R | null | undefined>;
@@ -0,0 +1,14 @@
1
+ /** @typedef {[key:string, executor:Executor]} ObjectExecutorEntry */
2
+ /**
3
+ * @augments {Executor<any>}
4
+ */
5
+ export class ObjectExecutor extends Executor<any> {
6
+ /**
7
+ * @param {object} [object]
8
+ * @param {(input:any) => any} [preprocess]
9
+ */
10
+ constructor(object?: object, preprocess?: (input: any) => any);
11
+ #private;
12
+ }
13
+ export type ObjectExecutorEntry = [key: string, executor: Executor<any>];
14
+ import { Executor } from './executor.js';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Executes a fixed set of executors concurrently, passing the same input value and variadic arguments to each,
3
+ * and returning an array of all results in the same order as the executors.
4
+ *
5
+ * When all executors are synchronous, execution is sequential and the result is a plain array.
6
+ * When any executor returns a Promise, all results are collected via `Promise.all`, giving true
7
+ * concurrent execution for I/O-bound processors.
8
+ *
9
+ * Errors propagate immediately — a synchronous throw or async rejection halts collection
10
+ * and surfaces the error to the caller without waiting for remaining executors.
11
+ *
12
+ * @augments {Executor<any>}
13
+ */
14
+ export class ParallelExecutor extends Executor<any> {
15
+ /**
16
+ * @param {Array<any>} [parallel] - executors/functions/values to execute concurrently
17
+ */
18
+ constructor(parallel?: Array<any>);
19
+ /**
20
+ * @param {any} input
21
+ * @param {...any} variadic
22
+ * @returns {any[]|Promise<any[]>}
23
+ */
24
+ execute(input: any, ...variadic: any[]): any[] | Promise<any[]>;
25
+ #private;
26
+ }
27
+ import { Executor } from './executor.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @augments Executor<any>
3
+ */
4
+ export class PipelineExecutor extends Executor<any> {
5
+ /**
6
+ * @param {Array<any>|any} pipeline - executors/functions/values to execute as a pipeline
7
+ */
8
+ constructor(pipeline?: Array<any> | any);
9
+ #private;
10
+ }
11
+ import { Executor } from './executor.js';
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Call a sequence of executors on the input until one returns a truthy value. Exceptions/rejections are caught and
3
+ * interpreted as a falsey value. Return the first successful truthy result, or undefined on failure.
4
+ *
5
+ * @template T
6
+ * @augments {Executor<T>}
7
+ */
8
+ export class SequenceExecutor<T> extends Executor<T> {
9
+ static ANY_CRITERIA: symbol;
10
+ static ALL_CRITERIA: symbol;
11
+ static EXCLUSIVE_CRITERIA: symbol;
12
+ static TRUTHY_CHECK: symbol;
13
+ static DEFINED_CHECK: symbol;
14
+ static SUCCESS_CHECK: symbol;
15
+ static RESULT_RETURN: symbol;
16
+ static INPUT_RETURN: symbol;
17
+ static RETHROW_ERRORS: symbol;
18
+ static CAPTURE_ERRORS: symbol;
19
+ /**
20
+ * @param {Array<any>|any} [executors]
21
+ * @param {symbol[]} [flags]
22
+ */
23
+ constructor(executors?: Array<any> | any, flags?: symbol[]);
24
+ /**
25
+ * @param {any} input
26
+ * @param {...any} extra
27
+ * @returns {T|null|undefined|Promise<T|null|undefined>}
28
+ */
29
+ execute(input: any, ...extra: any[]): T | null | undefined | Promise<T | null | undefined>;
30
+ #private;
31
+ }
32
+ import { Executor } from './executor.js';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Executes a fixed sequence of executors serially, passing each same input value and variadic arguments.
3
+ * and returning the original input value on success. This executor is intended for side-effect-style composition;
4
+ * for chained processing, see `PipelineExecutor` or `StepExecutor`. See `SequenceExecutor` to allow fine
5
+ * tuning of sequence execution behavior.
6
+ *
7
+ * @template T
8
+ * @augments {SequenceExecutor<T>}
9
+ */
10
+ export class SerialExecutor<T> extends SequenceExecutor<T> {
11
+ /**
12
+ * @param {any[]|any} [serial]
13
+ */
14
+ constructor(serial?: any[] | any);
15
+ }
16
+ import { SequenceExecutor } from './sequence-executor.js';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * StepExecutor is basically like PipelineExecutor, except that null or undefined step results are returned immediately.
3
+ *
4
+ * @template T
5
+ * @augments {Executor<T>}
6
+ */
7
+ export class StepExecutor<T> extends Executor<T> {
8
+ /**
9
+ * @param {Array<any>|any} steps - executors/functions/values to execute as a pipeline
10
+ */
11
+ constructor(steps?: Array<any> | any);
12
+ #private;
13
+ }
14
+ import { Executor } from './executor.js';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @param {string} str
3
+ * @returns {string}
4
+ */
5
+ export function toCamelCase(str: string): string;
6
+ /**
7
+ * @param {string} str
8
+ * @returns {string}
9
+ */
10
+ export function toPascalCase(str: string): string;
11
+ /**
12
+ * @param {string} str
13
+ * @returns {string}
14
+ */
15
+ export function toConstantCase(str: string): string;
16
+ /**
17
+ * @param {string} str
18
+ * @returns {string}
19
+ */
20
+ export function toKebabCase(str: string): string;
21
+ /**
22
+ * @param {string} str
23
+ * @returns {string}
24
+ */
25
+ export function toCapitalize(str: string): string;
26
+ /**
27
+ * @param {string} str
28
+ * @returns {string}
29
+ */
30
+ export function toTitleCase(str: string): string;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Parse a data-size string into a byte count.
3
+ *
4
+ * Accepts numeric values (treated as bytes), or strings like `'20KiB'`, `'1.5 MB'`, `'512'`.
5
+ * When `standard` is omitted, both IEC and SI suffixes are accepted.
6
+ * When `standard` is `'iec'` or `'si'`, only that standard's suffixes are accepted.
7
+ *
8
+ * @package
9
+ * @param {string|number} value
10
+ * @param {string} [standard] - `'iec'` or `'si'`; omit to accept either
11
+ * @returns {number} byte count
12
+ */
13
+ export function parseDataSize(value: string | number, standard?: string): number;
14
+ /**
15
+ * Format a byte count into a human-readable data-size string.
16
+ *
17
+ * Selects the largest unit where the value is >= 1 and formats with up to
18
+ * two decimal places (trailing zeros stripped).
19
+ *
20
+ * @package
21
+ * @param {number} bytes
22
+ * @param {string} [standard='iec'] - `'iec'` or `'si'`
23
+ * @returns {string|undefined}
24
+ */
25
+ export function formatDataSize(bytes: number, standard?: string): string | undefined;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * A hook for compatible loggers (e.g., `@versionzero/logger`) to automatically capture debug messages.
3
+ * (Left in for new code hacking; debug calls were removed for performance reasons after the library was stabilized.)
4
+ *
5
+ * @param {...any} args
6
+ * @package
7
+ * @deprecated
8
+ */
9
+ export function debug(...args: any[]): void;