@zipbul/baker 5.0.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +11 -14
  3. package/dist/index.d.ts +11 -12
  4. package/dist/index.js +1 -1
  5. package/dist/src/baker.d.ts +19 -9
  6. package/dist/src/baker.js +1 -1
  7. package/dist/src/common/enums.d.ts +10 -0
  8. package/dist/src/common/enums.js +1 -0
  9. package/dist/src/common/index.d.ts +6 -0
  10. package/dist/src/common/index.js +1 -0
  11. package/dist/src/common/interfaces.d.ts +4 -0
  12. package/dist/src/common/types.d.ts +2 -0
  13. package/dist/src/config/config-normalizer.d.ts +7 -0
  14. package/dist/src/config/config-normalizer.js +1 -0
  15. package/dist/src/config/constants.d.ts +6 -0
  16. package/dist/src/config/constants.js +1 -0
  17. package/dist/src/config/index.d.ts +3 -0
  18. package/dist/src/config/index.js +1 -0
  19. package/dist/src/{configure.d.ts → config/interfaces.d.ts} +1 -8
  20. package/dist/src/config/interfaces.js +0 -0
  21. package/dist/src/decorators/constants.d.ts +2 -0
  22. package/dist/src/decorators/constants.js +1 -0
  23. package/dist/src/decorators/enums.d.ts +5 -0
  24. package/dist/src/decorators/enums.js +1 -0
  25. package/dist/src/decorators/field.d.ts +3 -54
  26. package/dist/src/decorators/field.js +1 -1
  27. package/dist/src/decorators/index.d.ts +2 -2
  28. package/dist/src/decorators/index.js +1 -1
  29. package/dist/src/decorators/interfaces.d.ts +50 -0
  30. package/dist/src/decorators/interfaces.js +0 -0
  31. package/dist/src/decorators/public.d.ts +2 -0
  32. package/dist/src/decorators/public.js +1 -0
  33. package/dist/src/decorators/types.d.ts +6 -0
  34. package/dist/src/decorators/types.js +0 -0
  35. package/dist/src/metadata/enums.d.ts +5 -0
  36. package/dist/src/metadata/enums.js +1 -0
  37. package/dist/src/metadata/index.d.ts +3 -0
  38. package/dist/src/metadata/index.js +1 -0
  39. package/dist/src/metadata/interfaces.d.ts +90 -0
  40. package/dist/src/metadata/interfaces.js +0 -0
  41. package/dist/src/metadata/meta-store.d.ts +49 -0
  42. package/dist/src/metadata/meta-store.js +1 -0
  43. package/dist/src/metadata/types.d.ts +10 -0
  44. package/dist/src/metadata/types.js +0 -0
  45. package/dist/src/rules/array.d.ts +2 -2
  46. package/dist/src/rules/array.js +1 -1
  47. package/dist/src/rules/binary.d.ts +2 -2
  48. package/dist/src/rules/binary.js +1 -1
  49. package/dist/src/rules/combinators.d.ts +1 -1
  50. package/dist/src/rules/combinators.js +1 -1
  51. package/dist/src/rules/common.d.ts +3 -3
  52. package/dist/src/rules/common.js +1 -1
  53. package/dist/src/rules/constants.d.ts +10 -0
  54. package/dist/src/rules/constants.js +1 -0
  55. package/dist/src/{create-rule.d.ts → rules/create-rule.d.ts} +1 -1
  56. package/dist/src/rules/create-rule.js +1 -0
  57. package/dist/src/rules/date.d.ts +1 -1
  58. package/dist/src/rules/date.js +1 -1
  59. package/dist/src/{enums.d.ts → rules/enums.d.ts} +0 -20
  60. package/dist/src/rules/enums.js +1 -0
  61. package/dist/src/rules/index.d.ts +5 -13
  62. package/dist/src/rules/index.js +1 -1
  63. package/dist/src/rules/interfaces.d.ts +43 -0
  64. package/dist/src/rules/interfaces.js +0 -0
  65. package/dist/src/rules/locales.d.ts +1 -1
  66. package/dist/src/rules/locales.js +1 -1
  67. package/dist/src/rules/number.d.ts +3 -3
  68. package/dist/src/rules/number.js +1 -1
  69. package/dist/src/rules/object.d.ts +1 -1
  70. package/dist/src/rules/object.js +1 -1
  71. package/dist/src/rules/public.d.ts +14 -0
  72. package/dist/src/rules/public.js +1 -0
  73. package/dist/src/{rule-metadata.d.ts → rules/rule-metadata.d.ts} +1 -1
  74. package/dist/src/{rule-metadata.js → rules/rule-metadata.js} +1 -1
  75. package/dist/src/{rule-plan.d.ts → rules/rule-plan.d.ts} +4 -7
  76. package/dist/src/rules/rule-plan.js +1 -0
  77. package/dist/src/rules/string-basic.d.ts +23 -0
  78. package/dist/src/rules/string-basic.js +1 -0
  79. package/dist/src/rules/string-crypto.d.ts +5 -0
  80. package/dist/src/rules/string-crypto.js +1 -0
  81. package/dist/src/rules/string-datetime.d.ts +3 -0
  82. package/dist/src/rules/string-datetime.js +1 -0
  83. package/dist/src/rules/string-encoding.d.ts +14 -0
  84. package/dist/src/rules/string-encoding.js +1 -0
  85. package/dist/src/rules/string-finance.d.ts +18 -0
  86. package/dist/src/rules/string-finance.js +10 -0
  87. package/dist/src/rules/string-format.d.ts +38 -0
  88. package/dist/src/rules/string-format.js +1 -0
  89. package/dist/src/rules/string-geo.d.ts +5 -0
  90. package/dist/src/rules/string-geo.js +1 -0
  91. package/dist/src/rules/string-identifier.d.ts +16 -0
  92. package/dist/src/rules/string-identifier.js +3 -0
  93. package/dist/src/rules/string-shared.d.ts +3 -0
  94. package/dist/src/rules/string-shared.js +1 -0
  95. package/dist/src/rules/string-width.d.ts +6 -0
  96. package/dist/src/rules/string-width.js +1 -0
  97. package/dist/src/rules/string.d.ts +14 -110
  98. package/dist/src/rules/string.js +1 -12
  99. package/dist/src/rules/typechecker.d.ts +10 -10
  100. package/dist/src/rules/typechecker.js +5 -5
  101. package/dist/src/rules/types.d.ts +26 -0
  102. package/dist/src/rules/types.js +0 -0
  103. package/dist/src/{functions → runtime}/check-call-options.d.ts +1 -1
  104. package/dist/src/runtime/check-call-options.js +1 -0
  105. package/dist/src/runtime/constants.d.ts +3 -0
  106. package/dist/src/runtime/constants.js +1 -0
  107. package/dist/src/runtime/deserialize.d.ts +6 -0
  108. package/dist/src/runtime/deserialize.js +1 -0
  109. package/dist/src/runtime/index.d.ts +3 -0
  110. package/dist/src/runtime/index.js +1 -0
  111. package/dist/src/runtime/serialize.d.ts +11 -0
  112. package/dist/src/runtime/serialize.js +1 -0
  113. package/dist/src/runtime/validate.d.ts +6 -0
  114. package/dist/src/runtime/validate.js +1 -0
  115. package/dist/src/seal/async-analyzer.d.ts +20 -0
  116. package/dist/src/seal/async-analyzer.js +1 -0
  117. package/dist/src/seal/circular-analyzer.d.ts +9 -6
  118. package/dist/src/seal/circular-analyzer.js +1 -1
  119. package/dist/src/seal/circular-placeholder.d.ts +20 -0
  120. package/dist/src/seal/circular-placeholder.js +1 -0
  121. package/dist/src/seal/codegen-utils.d.ts +15 -0
  122. package/dist/src/seal/codegen-utils.js +1 -1
  123. package/dist/src/seal/compile-cache.d.ts +38 -0
  124. package/dist/src/seal/compile-cache.js +1 -0
  125. package/dist/src/seal/constants.d.ts +62 -0
  126. package/dist/src/seal/constants.js +1 -0
  127. package/dist/src/seal/deserialize-builder.d.ts +6 -9
  128. package/dist/src/seal/deserialize-builder.js +199 -262
  129. package/dist/src/seal/deserialize-codegen.d.ts +58 -0
  130. package/dist/src/seal/deserialize-codegen.js +64 -0
  131. package/dist/src/seal/enums.d.ts +1 -2
  132. package/dist/src/seal/enums.js +1 -1
  133. package/dist/src/seal/expose-validator.d.ts +2 -2
  134. package/dist/src/seal/expose-validator.js +1 -1
  135. package/dist/src/seal/index.d.ts +3 -0
  136. package/dist/src/seal/index.js +1 -0
  137. package/dist/src/seal/inheritance-merger.d.ts +18 -0
  138. package/dist/src/seal/inheritance-merger.js +1 -0
  139. package/dist/src/seal/interfaces.d.ts +89 -0
  140. package/dist/src/seal/interfaces.js +0 -0
  141. package/dist/src/seal/meta-validator.d.ts +16 -0
  142. package/dist/src/seal/meta-validator.js +1 -0
  143. package/dist/src/seal/seal.d.ts +5 -30
  144. package/dist/src/seal/seal.js +1 -1
  145. package/dist/src/seal/serialize-builder.d.ts +6 -4
  146. package/dist/src/seal/serialize-builder.js +63 -63
  147. package/dist/src/seal/type-normalizer.d.ts +9 -0
  148. package/dist/src/seal/type-normalizer.js +1 -0
  149. package/dist/src/seal/type-resolver.d.ts +2 -0
  150. package/dist/src/seal/type-resolver.js +1 -0
  151. package/dist/src/seal/types.d.ts +6 -0
  152. package/dist/src/seal/types.js +0 -0
  153. package/dist/src/symbols.d.ts +2 -4
  154. package/dist/src/symbols.js +1 -1
  155. package/dist/src/transformers/{collection.transformer.d.ts → collection.d.ts} +1 -1
  156. package/dist/src/transformers/constants.d.ts +2 -0
  157. package/dist/src/transformers/constants.js +1 -0
  158. package/dist/src/transformers/{date.transformer.d.ts → date.d.ts} +1 -1
  159. package/dist/src/transformers/date.js +1 -0
  160. package/dist/src/transformers/index.d.ts +3 -8
  161. package/dist/src/transformers/index.js +1 -1
  162. package/dist/src/transformers/interfaces.d.ts +26 -0
  163. package/dist/src/transformers/interfaces.js +0 -0
  164. package/dist/src/transformers/luxon.d.ts +3 -0
  165. package/dist/src/transformers/luxon.js +1 -0
  166. package/dist/src/transformers/moment.d.ts +3 -0
  167. package/dist/src/transformers/moment.js +1 -0
  168. package/dist/src/transformers/{number.transformer.d.ts → number.d.ts} +1 -1
  169. package/dist/src/transformers/public.d.ts +7 -0
  170. package/dist/src/transformers/public.js +1 -0
  171. package/dist/src/transformers/{string.transformer.d.ts → string.d.ts} +1 -1
  172. package/dist/src/transformers/types.d.ts +3 -0
  173. package/dist/src/transformers/types.js +0 -0
  174. package/package.json +7 -7
  175. package/dist/src/collect.d.ts +0 -15
  176. package/dist/src/collect.js +0 -1
  177. package/dist/src/configure.js +0 -1
  178. package/dist/src/create-rule.js +0 -1
  179. package/dist/src/enums.js +0 -1
  180. package/dist/src/functions/check-call-options.js +0 -1
  181. package/dist/src/functions/deserialize.d.ts +0 -19
  182. package/dist/src/functions/deserialize.js +0 -1
  183. package/dist/src/functions/serialize.d.ts +0 -16
  184. package/dist/src/functions/serialize.js +0 -1
  185. package/dist/src/functions/validate.d.ts +0 -18
  186. package/dist/src/functions/validate.js +0 -1
  187. package/dist/src/interfaces.d.ts +0 -32
  188. package/dist/src/meta-access.d.ts +0 -19
  189. package/dist/src/meta-access.js +0 -1
  190. package/dist/src/rule-plan.js +0 -1
  191. package/dist/src/seal/validate-meta.d.ts +0 -13
  192. package/dist/src/seal/validate-meta.js +0 -1
  193. package/dist/src/transformers/date.transformer.js +0 -1
  194. package/dist/src/transformers/luxon.transformer.d.ts +0 -8
  195. package/dist/src/transformers/luxon.transformer.js +0 -1
  196. package/dist/src/transformers/moment.transformer.d.ts +0 -7
  197. package/dist/src/transformers/moment.transformer.js +0 -1
  198. package/dist/src/types.d.ts +0 -177
  199. /package/dist/src/{errors.d.ts → common/errors.d.ts} +0 -0
  200. /package/dist/src/{errors.js → common/errors.js} +0 -0
  201. /package/dist/src/{interfaces.js → common/interfaces.js} +0 -0
  202. /package/dist/src/{types.js → common/types.js} +0 -0
  203. /package/dist/src/{utils.d.ts → common/utils.d.ts} +0 -0
  204. /package/dist/src/{utils.js → common/utils.js} +0 -0
  205. /package/dist/src/transformers/{collection.transformer.js → collection.js} +0 -0
  206. /package/dist/src/transformers/{number.transformer.js → number.js} +0 -0
  207. /package/dist/src/transformers/{string.transformer.js → string.js} +0 -0
@@ -0,0 +1,90 @@
1
+ import type { ClassCtor } from '../common';
2
+ import type { InternalRule } from '../rules';
3
+ import type { TransformFunction } from '../transformers';
4
+ import type { CollectionType } from './enums';
5
+ /** Arguments for user-defined message callback */
6
+ export interface MessageArgs {
7
+ property: string;
8
+ value: unknown;
9
+ constraints: Record<string, unknown>;
10
+ }
11
+ export interface RuleDef {
12
+ rule: InternalRule;
13
+ each?: boolean;
14
+ groups?: string[];
15
+ /** Value to include in BakerIssue.message on validation failure */
16
+ message?: string | ((args: MessageArgs) => string);
17
+ /** Arbitrary value to include in BakerIssue.context on validation failure */
18
+ context?: unknown;
19
+ }
20
+ export interface TransformDef {
21
+ fn: TransformFunction;
22
+ isAsync?: boolean;
23
+ options?: {
24
+ groups?: string[];
25
+ deserializeOnly?: boolean;
26
+ serializeOnly?: boolean;
27
+ };
28
+ }
29
+ export interface ExposeDef {
30
+ name?: string;
31
+ groups?: string[];
32
+ deserializeOnly?: boolean;
33
+ serializeOnly?: boolean;
34
+ }
35
+ export interface ExcludeDef {
36
+ deserializeOnly?: boolean;
37
+ serializeOnly?: boolean;
38
+ }
39
+ /** A polymorphic discriminator subtype mapping — a class constructor keyed by its wire name. */
40
+ export interface DiscriminatorSubType {
41
+ value: ClassCtor;
42
+ name: string;
43
+ }
44
+ /** Polymorphic discriminator config — shared single source between @Field options and the IR TypeDef. */
45
+ export interface DiscriminatorDef {
46
+ property: string;
47
+ subTypes: DiscriminatorSubType[];
48
+ }
49
+ export interface TypeDef {
50
+ fn: () => ClassCtor | ClassCtor[] | MapConstructor | SetConstructor;
51
+ discriminator?: DiscriminatorDef;
52
+ keepDiscriminatorProperty?: boolean;
53
+ /** seal-time normalization result — true if fn() returns an array */
54
+ isArray?: boolean;
55
+ /** seal-time normalization result — cached class after resolving fn() (DTOs only, excluding primitives) */
56
+ resolvedClass?: ClassCtor;
57
+ /** seal-time normalization result — Map or Set collection type */
58
+ collection?: CollectionType;
59
+ /** Nested DTO class thunk for Map value / Set element */
60
+ collectionValue?: () => ClassCtor;
61
+ /** seal-time normalization result — cached class after resolving collectionValue */
62
+ resolvedCollectionValue?: ClassCtor;
63
+ }
64
+ export interface PropertyFlags {
65
+ /** `@Field({ optional })` — skip all validation when undefined/null */
66
+ isOptional?: boolean;
67
+ /** `@Field({ nullable })` — allow and assign null, reject undefined */
68
+ isNullable?: boolean;
69
+ /** `@Field({ when })` — skip all field validation when the predicate returns false */
70
+ validateIf?: (obj: Record<string, unknown>) => boolean;
71
+ /** Seal-derived — trigger recursive validation for nested `@Field({ type })` DTOs */
72
+ validateNested?: boolean;
73
+ /** Seal-derived — validate nested DTOs per array element */
74
+ validateNestedEach?: boolean;
75
+ }
76
+ export interface RawPropertyMeta {
77
+ validation: RuleDef[];
78
+ transform: TransformDef[];
79
+ expose: ExposeDef[];
80
+ exclude: ExcludeDef | null;
81
+ type: TypeDef | null;
82
+ flags: PropertyFlags;
83
+ /** Field-level message applied to ALL failures of this field (gate/structural/required/conversion/rule) */
84
+ message?: string | ((args: MessageArgs) => string);
85
+ /** Field-level context attached to ALL failures of this field */
86
+ context?: unknown;
87
+ }
88
+ export interface RawClassMeta {
89
+ [propertyKey: string]: RawPropertyMeta;
90
+ }
File without changes
@@ -0,0 +1,49 @@
1
+ import type { RawClassMeta, RawPropertyMeta } from './interfaces';
2
+ import type { MetaObject } from './types';
3
+ import { RAW } from '../symbols';
4
+ /**
5
+ * The single boundary that bridges symbol-keyed decorator metadata to typed RAW metadata. All RAW
6
+ * access goes through this one process-wide `metaStore` instance (and, for the seal pipeline, an
7
+ * injected reference) — no other module touches `Class[Symbol.metadata][this.#rawKey]` directly. The private
8
+ * `#metaOf`/`#ensureOwnMeta` methods are the actual encapsulation; `RAW` itself is process-global
9
+ * (`Symbol.for('baker:raw')`), so the value of consolidating access here is one access protocol, not
10
+ * a "private symbol".
11
+ *
12
+ * RAW lives on the TC39 decorator metadata object (`Class[Symbol.metadata][this.#rawKey]`) — where modern field
13
+ * decorators can write (they receive `context.metadata`, never the class). Sealed executors live in
14
+ * each Baker's own map, never on the class.
15
+ */
16
+ declare class MetaStore {
17
+ #private;
18
+ constructor(rawKey?: typeof RAW);
19
+ get(cls: Function): RawClassMeta | undefined;
20
+ /**
21
+ * Test-only: like {@link get} but throws if the class has no @Field decorators. Specs use it to
22
+ * assert metadata presence; production reads go through {@link get}/{@link hasOwn}.
23
+ */
24
+ require(cls: Function): RawClassMeta;
25
+ /**
26
+ * Test-only: inject RAW metadata directly, bypassing the @Field decorator path. The seal-pipeline
27
+ * specs use this to author DTOs programmatically; production metadata is written via {@link ensure}.
28
+ */
29
+ set(cls: Function, raw: RawClassMeta): void;
30
+ /** Test-only: drop a class's own RAW slot so specs can reset state between cases. */
31
+ delete(cls: Function): void;
32
+ /**
33
+ * True only when cls has its OWN RAW slot. A subclass without its own @Field decorators resolves
34
+ * `Class[Symbol.metadata]` to the parent's metadata via the class prototype chain; the dual own-check
35
+ * keeps inheritance merging from double-counting inherited fields.
36
+ */
37
+ hasOwn(cls: Function): boolean;
38
+ /**
39
+ * The RawPropertyMeta for `key` on a decorator metadata object — creating the RAW slot and the
40
+ * per-key default meta if absent. Called by @Field, which receives `context.metadata`.
41
+ *
42
+ * The own-RAW check is required: a subclass's metadata inherits the parent's RAW via the metadata
43
+ * prototype chain, so a bare assignment would pollute the parent. A fresh own RAW (null prototype)
44
+ * keeps child fields isolated.
45
+ */
46
+ ensure(metadata: MetaObject, key: string): RawPropertyMeta;
47
+ }
48
+ export { MetaStore };
49
+ export declare const metaStore: MetaStore;
@@ -0,0 +1 @@
1
+ class MetaStore{#z;constructor(z=I){this.#z=z}#D(z){return z[Symbol.metadata]??void 0}#G(z){if(!Object.hasOwn(z,Symbol.metadata))Object.defineProperty(z,Symbol.metadata,{value:{},writable:!0,configurable:!0,enumerable:!1});return z[Symbol.metadata]}get(z){return this.#D(z)?.[this.#z]}require(z){const D=this.get(z);if(D===void 0)throw new H(`${z.name||"<anonymous>"}: class has no @Field decorators`);return D}set(z,D){this.#G(z)[this.#z]=D}delete(z){if(Object.hasOwn(z,Symbol.metadata))delete z[Symbol.metadata][this.#z]}hasOwn(z){if(!Object.hasOwn(z,Symbol.metadata))return!1;const D=z[Symbol.metadata];return D!=null&&Object.hasOwn(D,this.#z)}ensure(z,D){if(!Object.hasOwn(z,this.#z))z[this.#z]=Object.create(null);const G=z[this.#z];return G[D]??={validation:[],transform:[],expose:[],exclude:null,type:null,flags:{}}}}import{BakerError as H}from"../common/index.js";import{RAW as I}from"../symbols.js";export{MetaStore};export const metaStore=new MetaStore;
@@ -0,0 +1,10 @@
1
+ import type { RawClassMeta } from './interfaces';
2
+ import { RAW } from '../symbols';
3
+ /** The TC39 decorator-metadata object that carries the baker RAW slot (`Class[Symbol.metadata]`). */
4
+ export type MetaObject = Record<PropertyKey, unknown> & {
5
+ [RAW]?: RawClassMeta;
6
+ };
7
+ /** A class (constructor) viewed as a carrier of decorator metadata. */
8
+ export type MetaCarrier = Function & {
9
+ [Symbol.metadata]?: MetaObject | null;
10
+ };
File without changes
@@ -1,8 +1,8 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  declare function arrayContains(values: unknown[]): EmittableRule;
3
3
  declare function arrayNotContains(values: unknown[]): EmittableRule;
4
4
  declare function arrayMinSize(min: number): EmittableRule;
5
5
  declare function arrayMaxSize(max: number): EmittableRule;
6
6
  declare function arrayUnique(identifier?: (val: unknown) => unknown): EmittableRule;
7
- declare const arrayNotEmpty: import("../types").InternalRule;
7
+ declare const arrayNotEmpty: import("./interfaces").InternalRule;
8
8
  export { arrayContains, arrayNotContains, arrayMinSize, arrayMaxSize, arrayUnique, arrayNotEmpty };
@@ -1 +1 @@
1
- import{CacheKey as D,RequiredType as A,RuleOp as F}from"../enums.js";import{makePlannedRule as G,makeRule as H,planCompare as I,planLength as J}from"../rule-plan.js";function arrayContains(b){return H({name:"arrayContains",requiresType:A.Array,constraints:{values:b},validate:(j)=>Array.isArray(j)&&b.every((w)=>j.includes(w)),emit:(j,w)=>{return`if (!refs[${w.addRef(b)}].every(function(v){return ${j}.includes(v);})) ${w.fail("arrayContains")};`}})}function arrayNotContains(b){return H({name:"arrayNotContains",requiresType:A.Array,constraints:{values:b},validate:(j)=>Array.isArray(j)&&b.every((w)=>!j.includes(w)),emit:(j,w)=>{return`if (refs[${w.addRef(b)}].some(function(v){return ${j}.includes(v);})) ${w.fail("arrayNotContains")};`}})}function arrayMinSize(b){const j={cacheKey:D.Length,failure:I(J(),F.Lt,b)};return G({name:"arrayMinSize",requiresType:A.Array,constraints:{min:b},plan:j,validate:(w)=>Array.isArray(w)&&w.length>=b})}function arrayMaxSize(b){const j={cacheKey:D.Length,failure:I(J(),F.Gt,b)};return G({name:"arrayMaxSize",requiresType:A.Array,constraints:{max:b},plan:j,validate:(w)=>Array.isArray(w)&&w.length<=b})}function arrayUnique(b){return H({name:"arrayUnique",requiresType:A.Array,constraints:{},validate:(j)=>{if(!Array.isArray(j))return!1;if(b){const w=j.map(b);return new Set(w).size===w.length}return new Set(j).size===j.length},emit:(j,w)=>{if(b){const B=w.addRef(b);return`{var keys=${j}.map(refs[${B}]);if(new Set(keys).size!==keys.length)${w.fail("arrayUnique")};}`}return`if(new Set(${j}).size!==${j}.length)${w.fail("arrayUnique")};`}})}const Q={cacheKey:D.Length,failure:I(J(),F.Eq,0)};const arrayNotEmpty=G({name:"arrayNotEmpty",requiresType:A.Array,constraints:{},plan:Q,validate:(b)=>Array.isArray(b)&&b.length>0});export{arrayContains,arrayNotContains,arrayMinSize,arrayMaxSize,arrayUnique,arrayNotEmpty};
1
+ import{CacheKey as D}from"../common/index.js";import{RequiredType as A,RuleOp as F}from"./enums.js";import{makePlannedRule as G,makeRule as H,planCompare as I,planLength as J}from"./rule-plan.js";function arrayContains(b){return H({name:"arrayContains",requiresType:A.Array,constraints:{values:b},validate:(j)=>Array.isArray(j)&&b.every((w)=>j.includes(w)),emit:(j,w)=>{return`if (!refs[${w.addRef(b)}].every(function(v){return ${j}.includes(v);})) ${w.fail("arrayContains")};`}})}function arrayNotContains(b){return H({name:"arrayNotContains",requiresType:A.Array,constraints:{values:b},validate:(j)=>Array.isArray(j)&&b.every((w)=>!j.includes(w)),emit:(j,w)=>{return`if (refs[${w.addRef(b)}].some(function(v){return ${j}.includes(v);})) ${w.fail("arrayNotContains")};`}})}function arrayMinSize(b){const j={cacheKey:D.Length,failure:I(J(),F.Lt,b)};return G({name:"arrayMinSize",requiresType:A.Array,constraints:{min:b},plan:j,validate:(w)=>Array.isArray(w)&&w.length>=b})}function arrayMaxSize(b){const j={cacheKey:D.Length,failure:I(J(),F.Gt,b)};return G({name:"arrayMaxSize",requiresType:A.Array,constraints:{max:b},plan:j,validate:(w)=>Array.isArray(w)&&w.length<=b})}function arrayUnique(b){return H({name:"arrayUnique",requiresType:A.Array,constraints:{},validate:(j)=>{if(!Array.isArray(j))return!1;if(b){const w=j.map(b);return new Set(w).size===w.length}return new Set(j).size===j.length},emit:(j,w)=>{if(b){const B=w.addRef(b);return`{var keys=${j}.map(refs[${B}]);if(new Set(keys).size!==keys.length)${w.fail("arrayUnique")};}`}return`if(new Set(${j}).size!==${j}.length)${w.fail("arrayUnique")};`}})}const Q={cacheKey:D.Length,failure:I(J(),F.Eq,0)};const arrayNotEmpty=G({name:"arrayNotEmpty",requiresType:A.Array,constraints:{},plan:Q,validate:(b)=>Array.isArray(b)&&b.length>0});export{arrayContains,arrayNotContains,arrayMinSize,arrayMaxSize,arrayUnique,arrayNotEmpty};
@@ -1,3 +1,3 @@
1
- import type { EmittableRule } from '../types';
2
- export declare const isUint8Array: import("../types").InternalRule;
1
+ import type { EmittableRule } from './interfaces';
2
+ export declare const isUint8Array: import("./interfaces").InternalRule;
3
3
  export declare function isByteSize(min: number, max?: number): EmittableRule;
@@ -1,3 +1,3 @@
1
- import{makeRule as A}from"../rule-plan.js";export const isUint8Array=A({name:"isUint8Array",constraints:{},validate:(f)=>f instanceof Uint8Array,emit:(f,j)=>`if (!(${f} instanceof Uint8Array)) ${j.fail("isUint8Array")};`});export function isByteSize(f,j){return A({name:"isByteSize",constraints:{min:f,max:j},validate:(q)=>{if(!ArrayBuffer.isView(q))return!1;const w=q.byteLength;if(w<f)return!1;if(j!==void 0&&w>j)return!1;return!0},emit:(q,w)=>{let z=`if (!ArrayBuffer.isView(${q})) ${w.fail("isByteSize")};`;z+=`
1
+ import{makeRule as A}from"./rule-plan.js";export const isUint8Array=A({name:"isUint8Array",constraints:{},validate:(f)=>f instanceof Uint8Array,emit:(f,j)=>`if (!(${f} instanceof Uint8Array)) ${j.fail("isUint8Array")};`});export function isByteSize(f,j){return A({name:"isByteSize",constraints:j!==void 0?{min:f,max:j}:{min:f},validate:(q)=>{if(!ArrayBuffer.isView(q))return!1;const w=q.byteLength;if(w<f)return!1;if(j!==void 0&&w>j)return!1;return!0},emit:(q,w)=>{let z=`if (!ArrayBuffer.isView(${q})) ${w.fail("isByteSize")};`;z+=`
2
2
  else if (${q}.byteLength < ${f}) ${w.fail("isByteSize")};`;if(j!==void 0)z+=`
3
3
  else if (${q}.byteLength > ${j}) ${w.fail("isByteSize")};`;return z}})}
@@ -1,4 +1,4 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  declare function oneOf(...branches: EmittableRule[]): EmittableRule;
3
3
  declare function arrayEvery(...rules: EmittableRule[]): EmittableRule;
4
4
  export { oneOf, arrayEvery };
@@ -1 +1 @@
1
- import{BakerError as H}from"../errors.js";import{makeRule as F}from"../rule-plan.js";function J(q,D){if(typeof q==="function"&&typeof q.emit==="function"&&typeof q.ruleName==="string")return;throw new H(`${D}: every argument must be a baker rule (function with .emit and .ruleName). Use createRule() or import a rule from @zipbul/baker/rules.`)}function oneOf(...q){if(q.length===0)throw new H("oneOf requires at least one rule.");for(const z of q)J(z,"oneOf");const D={oneOf:q.map((z)=>z.ruleName)};if(q.some((z)=>z.isAsync===!0)){const z=async(j)=>{for(const w of q)if(await w(j))return!0;return!1};return F({name:"oneOf",constraints:D,isAsync:!0,validate:z,emit:(j,w)=>{return`if (!(await refs[${w.addRef(z)}](${j}))) ${w.fail("oneOf")};`}})}return F({name:"oneOf",constraints:D,validate:(z)=>q.some((j)=>j(z)),emit:(z,j)=>{return`if (!(${q.map((C)=>`refs[${j.addRef(C)}](${z})`).join(" || ")})) ${j.fail("oneOf")};`}})}function arrayEvery(...q){if(q.length===0)throw new H("arrayEvery requires at least one rule.");for(const j of q)J(j,"arrayEvery");const D={arrayEvery:q.map((j)=>j.ruleName)};if(q.some((j)=>j.isAsync===!0)){const j=async(w)=>{if(!Array.isArray(w))return!1;for(const C of w)for(const I of q)if(!await I(C))return!1;return!0};return F({name:"arrayEvery",constraints:D,isAsync:!0,validate:j,emit:(w,C)=>{return`if (!(await refs[${C.addRef(j)}](${w}))) ${C.fail("arrayEvery")};`}})}const G=(j)=>q.every((w)=>w(j));return F({name:"arrayEvery",constraints:D,validate:(j)=>Array.isArray(j)&&j.every(G),emit:(j,w)=>{const C=w.addRef(G);return`if (!(Array.isArray(${j}) && ${j}.every(refs[${C}]))) ${w.fail("arrayEvery")};`}})}export{oneOf,arrayEvery};
1
+ import{BakerError as I}from"../common/index.js";import{makeRule as D}from"./rule-plan.js";function oneOf(...q){if(q.length===0)throw new I("oneOf requires at least one rule.");const C={oneOf:q.map((z)=>z.ruleName)};if(q.some((z)=>z.isAsync===!0)){const z=async(g)=>{for(const j of q)if(await j(g))return!0;return!1};return D({name:"oneOf",constraints:C,isAsync:!0,validate:z,emit:(g,j)=>{return`if (!(await refs[${j.addRef(z)}](${g}))) ${j.fail("oneOf")};`}})}const F=q;return D({name:"oneOf",constraints:C,validate:(z)=>F.some((g)=>g(z)),emit:(z,g)=>{return`if (!(${q.map((A)=>`refs[${g.addRef(A)}](${z})`).join(" || ")})) ${g.fail("oneOf")};`}})}function arrayEvery(...q){if(q.length===0)throw new I("arrayEvery requires at least one rule.");const C={arrayEvery:q.map((g)=>g.ruleName)};if(q.some((g)=>g.isAsync===!0)){const g=async(j)=>{if(!Array.isArray(j))return!1;for(const A of j)for(const H of q)if(!await H(A))return!1;return!0};return D({name:"arrayEvery",constraints:C,isAsync:!0,validate:g,emit:(j,A)=>{return`if (!(await refs[${A.addRef(g)}](${j}))) ${A.fail("arrayEvery")};`}})}const F=q,G=(g)=>F.every((j)=>j(g));return D({name:"arrayEvery",constraints:C,validate:(g)=>Array.isArray(g)&&g.every(G),emit:(g,j)=>{const A=j.addRef(G);return`if (!(Array.isArray(${g}) && ${g}.every(refs[${A}]))) ${j.fail("arrayEvery")};`}})}export{oneOf,arrayEvery};
@@ -1,7 +1,7 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  export declare function equals(comparison: unknown): EmittableRule;
3
3
  export declare function notEquals(comparison: unknown): EmittableRule;
4
- export declare const isEmpty: import("../types").InternalRule;
5
- export declare const isNotEmpty: import("../types").InternalRule;
4
+ export declare const isEmpty: import("./interfaces").InternalRule;
5
+ export declare const isNotEmpty: import("./interfaces").InternalRule;
6
6
  export declare function isIn(array: unknown[]): EmittableRule;
7
7
  export declare function isNotIn(array: unknown[]): EmittableRule;
@@ -1 +1 @@
1
- import{makeRule as h}from"../rule-plan.js";export function equals(b){return h({name:"equals",constraints:{value:b},validate:(d)=>d===b,emit:(d,f)=>{const g=f.addRef(b);return`if (${d} !== refs[${g}]) ${f.fail("equals")};`}})}export function notEquals(b){return h({name:"notEquals",constraints:{value:b},validate:(d)=>d!==b,emit:(d,f)=>{const g=f.addRef(b);return`if (${d} === refs[${g}]) ${f.fail("notEquals")};`}})}export const isEmpty=h({name:"isEmpty",constraints:{},validate:(b)=>b===void 0||b===null||b==="",emit:(b,d)=>`if (${b} !== undefined && ${b} !== null && ${b} !== '') ${d.fail("isEmpty")};`});export const isNotEmpty=h({name:"isNotEmpty",constraints:{},validate:(b)=>b!==void 0&&b!==null&&b!=="",emit:(b,d)=>`if (${b} === undefined || ${b} === null || ${b} === '') ${d.fail("isNotEmpty")};`});export function isIn(b){const d=new Set(b);return h({name:"isIn",constraints:{values:b},validate:(f)=>d.has(f),emit:(f,g)=>{return`if (!refs[${g.addRef(d)}].has(${f})) ${g.fail("isIn")};`}})}export function isNotIn(b){const d=new Set(b);return h({name:"isNotIn",constraints:{values:b},validate:(f)=>!d.has(f),emit:(f,g)=>{return`if (refs[${g.addRef(d)}].has(${f})) ${g.fail("isNotIn")};`}})}
1
+ import{makeRule as h}from"./rule-plan.js";export function equals(b){return h({name:"equals",constraints:{value:b},validate:(d)=>d===b,emit:(d,f)=>{const g=f.addRef(b);return`if (${d} !== refs[${g}]) ${f.fail("equals")};`}})}export function notEquals(b){return h({name:"notEquals",constraints:{value:b},validate:(d)=>d!==b,emit:(d,f)=>{const g=f.addRef(b);return`if (${d} === refs[${g}]) ${f.fail("notEquals")};`}})}export const isEmpty=h({name:"isEmpty",constraints:{},validate:(b)=>b===void 0||b===null||b==="",emit:(b,d)=>`if (${b} !== undefined && ${b} !== null && ${b} !== '') ${d.fail("isEmpty")};`});export const isNotEmpty=h({name:"isNotEmpty",constraints:{},validate:(b)=>b!==void 0&&b!==null&&b!=="",emit:(b,d)=>`if (${b} === undefined || ${b} === null || ${b} === '') ${d.fail("isNotEmpty")};`});export function isIn(b){const d=new Set(b);return h({name:"isIn",constraints:{values:b},validate:(f)=>d.has(f),emit:(f,g)=>{return`if (!refs[${g.addRef(d)}].has(${f})) ${g.fail("isIn")};`}})}export function isNotIn(b){const d=new Set(b);return h({name:"isNotIn",constraints:{values:b},validate:(f)=>!d.has(f),emit:(f,g)=>{return`if (refs[${g.addRef(d)}].has(${f})) ${g.fail("isNotIn")};`}})}
@@ -0,0 +1,10 @@
1
+ export declare const IBAN_COUNTRY_LENGTH: Record<string, number>;
2
+ export declare const ISO4217_CODES: Set<string>;
3
+ export declare const ISO31661A2_CODES: Set<string>;
4
+ export declare const ISO31661A3_CODES: Set<string>;
5
+ export declare const HASH_REGEXES: Record<string, RegExp>;
6
+ export declare const TAX_ID_REGEXES: Record<string, RegExp>;
7
+ export declare const MOBILE_PHONE_REGEXES: Record<string, RegExp>;
8
+ export declare const POSTAL_CODE_REGEXES: Record<string, RegExp>;
9
+ export declare const IDENTITY_CARD_REGEXES: Record<string, RegExp>;
10
+ export declare const PASSPORT_REGEXES: Record<string, RegExp>;
@@ -0,0 +1 @@
1
+ export const IBAN_COUNTRY_LENGTH={AD:24,AE:23,AL:28,AT:20,AZ:28,BA:20,BE:16,BG:22,BH:22,BR:29,CH:21,CR:22,CY:28,CZ:24,DE:22,DK:18,DO:28,EE:20,ES:24,FI:18,FO:18,FR:27,GB:22,GE:22,GI:23,GL:18,GR:27,GT:28,HR:21,HU:28,IE:22,IL:23,IS:26,IT:27,JO:30,KW:30,KZ:20,LB:28,LC:32,LI:21,LT:20,LU:20,LV:21,MC:27,MD:24,ME:22,MK:19,MR:27,MT:31,MU:30,NL:18,NO:15,PK:24,PL:28,PS:29,PT:25,QA:29,RO:24,RS:22,SA:24,SC:31,SE:24,SI:19,SK:24,SM:27,ST:25,SV:28,TL:23,TN:24,TR:26,UA:29,VA:22,VG:24,XK:20};export const ISO4217_CODES=new Set(["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN","BAM","BBD","BDT","BGN","BHD","BIF","BMD","BND","BOB","BOV","BRL","BSD","BTN","BWP","BYN","BZD","CAD","CDF","CHE","CHF","CHW","CLF","CLP","CNY","COP","COU","CRC","CUC","CUP","CVE","CZK","DJF","DKK","DOP","DZD","EGP","ERN","ETB","EUR","FJD","FKP","GBP","GEL","GHS","GIP","GMD","GNF","GTQ","GYD","HKD","HNL","HRK","HTG","HUF","IDR","ILS","INR","IQD","IRR","ISK","JMD","JOD","JPY","KES","KGS","KHR","KMF","KPW","KRW","KWD","KYD","KZT","LAK","LBP","LKR","LRD","LSL","LYD","MAD","MDL","MGA","MKD","MMK","MNT","MOP","MRU","MUR","MVR","MWK","MXN","MXV","MYR","MZN","NAD","NGN","NIO","NOK","NPR","NZD","OMR","PAB","PEN","PGK","PHP","PKR","PLN","PYG","QAR","RON","RSD","RUB","RWF","SAR","SBD","SCR","SDG","SEK","SGD","SHP","SLE","SLL","SOS","SRD","SSP","STN","SVC","SYP","SZL","THB","TJS","TMT","TND","TOP","TRY","TTD","TWD","TZS","UAH","UGX","USD","USN","UYI","UYU","UYW","UZS","VED","VES","VND","VUV","WST","XAF","XAG","XAU","XBA","XBB","XBC","XBD","XCD","XDR","XOF","XPD","XPF","XPT","XSU","XTS","XUA","YER","ZAR","ZMW","ZWL"]);export const ISO31661A2_CODES=new Set(["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"]);export const ISO31661A3_CODES=new Set(["ABW","AFG","AGO","AIA","ALA","ALB","AND","ARE","ARG","ARM","ASM","ATA","ATF","ATG","AUS","AUT","AZE","BDI","BEL","BEN","BES","BFA","BGD","BGR","BHR","BHS","BIH","BLM","BLR","BLZ","BMU","BOL","BRA","BRB","BRN","BTN","BVT","BWA","CAF","CAN","CCK","CHE","CHL","CHN","CIV","CMR","COD","COG","COK","COL","COM","CPV","CRI","CUB","CUW","CXR","CYM","CYP","CZE","DEU","DJI","DMA","DNK","DOM","DZA","ECU","EGY","ERI","ESH","ESP","EST","ETH","FIN","FJI","FLK","FRA","FRO","FSM","GAB","GBR","GEO","GGY","GHA","GIB","GIN","GLP","GMB","GNB","GNQ","GRC","GRD","GRL","GTM","GUF","GUM","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN","IMN","IND","IOT","IRL","IRN","IRQ","ISL","ISR","ITA","JAM","JEY","JOR","JPN","KAZ","KEN","KGZ","KHM","KIR","KNA","KOR","KWT","LAO","LBN","LBR","LBY","LCA","LIE","LKA","LSO","LTU","LUX","LVA","MAC","MAF","MAR","MCO","MDA","MDG","MDV","MEX","MHL","MKD","MLI","MLT","MMR","MNE","MNG","MNP","MOZ","MRT","MSR","MTQ","MUS","MWI","MYS","MYT","NAM","NCL","NER","NFK","NGA","NIC","NIU","NLD","NOR","NPL","NRU","NZL","OMN","PAK","PAN","PCN","PER","PHL","PLW","PNG","POL","PRI","PRK","PRT","PRY","PSE","PYF","QAT","REU","ROU","RUS","RWA","SAU","SDN","SEN","SGP","SGS","SHN","SJM","SLB","SLE","SLV","SMR","SOM","SPM","SRB","SSD","STP","SUR","SVK","SVN","SWE","SWZ","SXM","SYC","SYR","TCA","TCD","TGO","THA","TJK","TKL","TKM","TLS","TON","TTO","TUN","TUR","TUV","TWN","TZA","UGA","UKR","UMI","URY","USA","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT","WLF","WSM","YEM","ZAF","ZMB","ZWE"]);export const HASH_REGEXES={md5:/^[a-f0-9]{32}$/i,md4:/^[a-f0-9]{32}$/i,md2:/^[a-f0-9]{32}$/i,sha1:/^[a-f0-9]{40}$/i,sha256:/^[a-f0-9]{64}$/i,sha384:/^[a-f0-9]{96}$/i,sha512:/^[a-f0-9]{128}$/i,ripemd128:/^[a-f0-9]{32}$/i,ripemd160:/^[a-f0-9]{40}$/i,"tiger128,3":/^[a-f0-9]{32}$/i,"tiger128,4":/^[a-f0-9]{32}$/i,"tiger160,3":/^[a-f0-9]{40}$/i,"tiger160,4":/^[a-f0-9]{40}$/i,"tiger192,3":/^[a-f0-9]{48}$/i,"tiger192,4":/^[a-f0-9]{48}$/i,crc32:/^[a-f0-9]{8}$/i,crc32b:/^[a-f0-9]{8}$/i};export const TAX_ID_REGEXES={US:/^\d{2}-\d{7}$/,KR:/^\d{3}-\d{2}-\d{5}$/,DE:/^\d{11}$/,FR:/^[0-9]{13}$/,GB:/^\d{10}$/,IT:/^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/i,ES:/^[0-9A-Z]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d{8}$/,RS:/^\d{9}$/,RU:/^\d{9}$/,SA:/^[A-Z]\d{8}$/i,SE:/^\d{8}$/,SL:/^(P)[A-Z]\d{7}$/i,SK:/^[0-9A-Z]\d{7}$/i,TH:/^[A-Z]{1,2}\d{6,7}$/i,TN:/^\d{8}$/,TR:/^[A-Z]\d{8}$/i,TW:/^[A-Z]\d{9}$/i,UA:/^[A-Z]{2}\d{6}$/i,US:/^\d{9}$/,ZA:/^[A-Z]\d{8}$/i};
@@ -1,5 +1,5 @@
1
1
  import type { RequiredType } from './enums';
2
- import type { EmittableRule } from './types';
2
+ import type { EmittableRule } from './interfaces';
3
3
  export interface CreateRuleOptions {
4
4
  /** Rule name. Used as the error code. */
5
5
  name: string;
@@ -0,0 +1 @@
1
+ import{BakerError as K,isAsyncFunction as U,isPromiseLike as V}from"../common/index.js";import{defineRuleMetadata as W}from"./rule-metadata.js";export function createRule(b,Q){const z=typeof b==="string"?b:b.name,C=typeof b==="string"?Q:b.validate;if(typeof C!=="function")throw new K(`createRule(${z}): a validate function is required.`);const I=typeof b==="object"?b.constraints:void 0,J=typeof b==="object"?b.requiresType:void 0,D=U(C),j=function(H){const w=C(H);if(!D&&V(w))throw new K(`createRule(${z}): sync rule returned Promise. Declare the validator with async if it is asynchronous.`);return w};j.emit=function(H,w){const S=w.addRef(j);return`if(!(${D?"await ":""}refs[${S}](${H}))) ${w.fail(z)};`};const G={emit:j.emit,ruleName:z,isAsync:D};if(I!==void 0)G.constraints=I;if(J!==void 0)G.requiresType=J;W(j,G);return j}
@@ -1,3 +1,3 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  export declare function minDate(date: Date): EmittableRule;
3
3
  export declare function maxDate(date: Date): EmittableRule;
@@ -1 +1 @@
1
- import{CacheKey as A,RequiredType as B,RuleOp as w}from"../enums.js";import{makePlannedRule as D,planCompare as x,planLiteral as E,planOr as F,planTime as b}from"../rule-plan.js";export function minDate(f){const g=f.getTime(),z={cacheKey:A.Time,failure:F(x(b(),w.Neq,b()),x(b(),w.Lt,E(g)))};return D({name:"minDate",requiresType:B.Date,constraints:{min:f.toISOString()},plan:z,validate:(j)=>j instanceof Date&&j.getTime()>=g})}export function maxDate(f){const g=f.getTime(),z={cacheKey:A.Time,failure:F(x(b(),w.Neq,b()),x(b(),w.Gt,E(g)))};return D({name:"maxDate",requiresType:B.Date,constraints:{max:f.toISOString()},plan:z,validate:(j)=>j instanceof Date&&j.getTime()<=g})}
1
+ import{CacheKey as A}from"../common/index.js";import{RequiredType as B,RuleOp as w}from"./enums.js";import{makePlannedRule as D,planCompare as x,planLiteral as E,planOr as F,planTime as b}from"./rule-plan.js";export function minDate(f){const g=f.getTime(),z={cacheKey:A.Time,failure:F(x(b(),w.Neq,b()),x(b(),w.Lt,E(g)))};return D({name:"minDate",requiresType:B.Date,constraints:{min:f.toISOString()},plan:z,validate:(j)=>j instanceof Date&&j.getTime()>=g})}export function maxDate(f){const g=f.getTime(),z={cacheKey:A.Time,failure:F(x(b(),w.Neq,b()),x(b(),w.Gt,E(g)))};return D({name:"maxDate",requiresType:B.Date,constraints:{max:f.toISOString()},plan:z,validate:(j)=>j instanceof Date&&j.getTime()<=g})}
@@ -7,21 +7,6 @@ export declare enum RequiredType {
7
7
  Array = "array",
8
8
  Object = "object"
9
9
  }
10
- /** Direction of a (de)serialization pass. */
11
- export declare enum Direction {
12
- Deserialize = "deserialize",
13
- Serialize = "serialize"
14
- }
15
- /** Collection container type for a nested field. */
16
- export declare enum CollectionType {
17
- Map = "Map",
18
- Set = "Set"
19
- }
20
- /** Cached accessor a RulePlan reuses across checks. */
21
- export declare enum CacheKey {
22
- Length = "length",
23
- Time = "time"
24
- }
25
10
  /** Discriminant for a RulePlanExpr node. */
26
11
  export declare enum RulePlanExprKind {
27
12
  Value = "value",
@@ -44,8 +29,3 @@ export declare enum RuleOp {
44
29
  Eq = "===",
45
30
  Neq = "!=="
46
31
  }
47
- /** Direction in which a field is excluded. */
48
- export declare enum ExcludeMode {
49
- DeserializeOnly = "deserializeOnly",
50
- SerializeOnly = "serializeOnly"
51
- }
@@ -0,0 +1 @@
1
+ export var RequiredType;((b)=>{b.String="string";b.Number="number";b.Boolean="boolean";b.Date="date";b.Array="array";b.Object="object"})(RequiredType||={});export var RulePlanExprKind;((f)=>{f.Value="value";f.Member="member";f.Call0="call0";f.Literal="literal"})(RulePlanExprKind||={});export var RulePlanCheckKind;((j)=>{j.Compare="compare";j.And="and";j.Or="or"})(RulePlanCheckKind||={});export var RuleOp;((b)=>{b.Lt="<";b.Lte="<=";b.Gt=">";b.Gte=">=";b.Eq="===";b.Neq="!=="})(RuleOp||={});
@@ -1,13 +1,5 @@
1
- export { isString, isNumber, isBoolean, isDate, isEnum, isInt, isArray, isObject, isRegExp, isFunction, isStatelessRegExp, } from './typechecker';
2
- export type { IsNumberOptions } from './typechecker';
3
- export { oneOf, arrayEvery } from './combinators';
4
- export { min, max, isPositive, isNegative, isDivisibleBy } from './number';
5
- export { minDate, maxDate } from './date';
6
- export { equals, notEquals, isEmpty, isNotEmpty, isIn, isNotIn } from './common';
7
- export { minLength, maxLength, length, contains, notContains, matches, isLowercase, isUppercase, isAscii, isAlpha, isAlphanumeric, isHttpToken, isOrigin, isCorsOrigin, isBooleanString, isNumberString, isDecimal, isFullWidth, isHalfWidth, isVariableWidth, isMultibyte, isSurrogatePair, isHexadecimal, isOctal, isEmail, isURL, isUUID, isIP, isHexColor, isRgbColor, isHSL, isMACAddress, isISBN, isISIN, isISO8601, isISRC, isISSN, isJWT, isLatLong, isLocale, isDataURI, isFQDN, isPort, isEAN, isISO31661Alpha2, isISO31661Alpha3, isBIC, isFirebasePushId, isSemVer, isMongoId, isJSON, isBase32, isBase58, isBase64, isDateString, isMimeType, isCurrency, isMagnetURI, isCreditCard, isIBAN, isByteLength, isHash, isRFC3339, isMilitaryTime, isLatitude, isLongitude, isEthereumAddress, isBtcAddress, isISO4217CurrencyCode, isPhoneNumber, isStrongPassword, isTaxId, isULID, isCUID2, } from './string';
8
- export type { IsURLOptions, IsBase64Options, IsMACAddressOptions, IsIBANOptions, IsISSNOptions, IsFQDNOptions, IsISO8601Options, IsNumberStringOptions, IsStrongPasswordOptions, } from './string';
9
- export { arrayContains, arrayNotContains, arrayMinSize, arrayMaxSize, arrayUnique, arrayNotEmpty } from './array';
10
- export { isNotEmptyObject, isInstance } from './object';
11
- export type { IsNotEmptyObjectOptions } from './object';
12
- export { isMobilePhone, isPostalCode, isIdentityCard, isPassportNumber } from './locales';
13
- export { isUint8Array, isByteSize } from './binary';
1
+ export * from './public';
2
+ export { emitRulePlan } from './rule-plan';
3
+ export { RequiredType } from './enums';
4
+ export type { EmittableRule, InternalRule, EmitContext } from './interfaces';
5
+ export type { RulePlanCache } from './types';
@@ -1 +1 @@
1
- export{isString,isNumber,isBoolean,isDate,isEnum,isInt,isArray,isObject,isRegExp,isFunction,isStatelessRegExp}from"./typechecker.js";export{oneOf,arrayEvery}from"./combinators.js";export{min,max,isPositive,isNegative,isDivisibleBy}from"./number.js";export{minDate,maxDate}from"./date.js";export{equals,notEquals,isEmpty,isNotEmpty,isIn,isNotIn}from"./common.js";export{minLength,maxLength,length,contains,notContains,matches,isLowercase,isUppercase,isAscii,isAlpha,isAlphanumeric,isHttpToken,isOrigin,isCorsOrigin,isBooleanString,isNumberString,isDecimal,isFullWidth,isHalfWidth,isVariableWidth,isMultibyte,isSurrogatePair,isHexadecimal,isOctal,isEmail,isURL,isUUID,isIP,isHexColor,isRgbColor,isHSL,isMACAddress,isISBN,isISIN,isISO8601,isISRC,isISSN,isJWT,isLatLong,isLocale,isDataURI,isFQDN,isPort,isEAN,isISO31661Alpha2,isISO31661Alpha3,isBIC,isFirebasePushId,isSemVer,isMongoId,isJSON,isBase32,isBase58,isBase64,isDateString,isMimeType,isCurrency,isMagnetURI,isCreditCard,isIBAN,isByteLength,isHash,isRFC3339,isMilitaryTime,isLatitude,isLongitude,isEthereumAddress,isBtcAddress,isISO4217CurrencyCode,isPhoneNumber,isStrongPassword,isTaxId,isULID,isCUID2}from"./string.js";export{arrayContains,arrayNotContains,arrayMinSize,arrayMaxSize,arrayUnique,arrayNotEmpty}from"./array.js";export{isNotEmptyObject,isInstance}from"./object.js";export{isMobilePhone,isPostalCode,isIdentityCard,isPassportNumber}from"./locales.js";export{isUint8Array,isByteSize}from"./binary.js";
1
+ export*from"./public.js";export{emitRulePlan}from"./rule-plan.js";export{RequiredType}from"./enums.js";
@@ -0,0 +1,43 @@
1
+ import type { CacheKey } from '../common';
2
+ import type { SealedExecutors } from '../seal';
3
+ import type { RequiredType } from './enums';
4
+ import type { RulePlanCheck } from './types';
5
+ export interface EmitContext {
6
+ /** Register a RegExp in the reference array, return its index */
7
+ addRegex(re: RegExp): number;
8
+ /** Register in the reference array, return its index — functions, arrays, Sets, primitives, etc. */
9
+ addRef(value: unknown): number;
10
+ /** Register a SealedExecutors object in the reference array — for nested @Type DTOs */
11
+ addExecutor(executor: SealedExecutors<unknown>): number;
12
+ /** Generate a failure code string from an error code — path is bound by the builder */
13
+ fail(code: string): string;
14
+ /** Whether error collection mode is enabled (= !stopAtFirstError) */
15
+ collectErrors: boolean;
16
+ /** Whether this emit runs inside a type gate (typeof/instanceof already verified) */
17
+ insideTypeGate?: boolean;
18
+ /** @internal Path expression for inline nested — used by makeRuleEmitCtx */
19
+ pathExpr?: string;
20
+ }
21
+ export interface EmittableRule {
22
+ (value: unknown): boolean | Promise<boolean>;
23
+ emit(varName: string, ctx: EmitContext): string;
24
+ readonly ruleName: string;
25
+ /**
26
+ * Meta for the builder to determine whether to insert a typeof guard.
27
+ * Only set for rules that assume a specific type (e.g., isEmail → 'string').
28
+ * `@IsString` itself is undefined (it includes its own typeof check).
29
+ */
30
+ readonly requiresType?: RequiredType;
31
+ /** Expose rule parameters for external reading */
32
+ readonly constraints?: Record<string, unknown>;
33
+ /** true when the rule is explicitly async and must be awaited */
34
+ readonly isAsync?: boolean;
35
+ }
36
+ /** @internal internal rule shape used by builders for optimization metadata */
37
+ export interface InternalRule extends EmittableRule {
38
+ readonly plan?: RulePlan;
39
+ }
40
+ export interface RulePlan {
41
+ cacheKey?: CacheKey;
42
+ failure: RulePlanCheck;
43
+ }
File without changes
@@ -1,4 +1,4 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  declare function isMobilePhone(locale: string): EmittableRule;
3
3
  declare function isPostalCode(locale: string): EmittableRule;
4
4
  declare function isIdentityCard(locale: string): EmittableRule;
@@ -1 +1 @@
1
- import{RequiredType as Q}from"../enums.js";import{BakerError as U}from"../errors.js";import{makeRule as V}from"../rule-plan.js";const W={"ko-KR":/^(\+?82|0)1[016789]\d{7,8}$/,"en-US":/^\+?1?[2-9]\d{2}[2-9]\d{6}$/,"zh-CN":/^(\+?86)?1[3-9]\d{9}$/,"zh-TW":/^(\+?886)?9\d{8}$/,"ja-JP":/^(\+?81)?0?[789]0[0-9]{8}$/,"de-DE":/^(\+?49)?1(5\d|6[0-9]|7[0-9])\d{8}$/,"fr-FR":/^(\+?33)?[67]\d{8}$/,"en-GB":/^(\+?44)?7[1-9]\d{8}$/,"ru-RU":/^(\+?7)?9\d{9}$/,"pt-BR":/^(\+?55)?[1-9]{2}9?\d{8}$/,"in-IN":/^(\+?91)?[6-9]\d{9}$/,"ar-SA":/^(\+?966)?5\d{8}$/,"ar-EG":/^(\+?20)?1[0125]\d{8}$/,"vi-VN":/^(\+?84)?[35789]\d{8}$/,"th-TH":/^(\+?66)?[689]\d{8}$/,"id-ID":/^(\+?62)?8\d{9,11}$/,"ms-MY":/^(\+?60)?1\d{8,9}$/,"nl-NL":/^(\+?31)?6\d{8}$/,"it-IT":/^(\+?39)?3\d{9}$/,"es-ES":/^(\+?34)?[67]\d{8}$/,"pl-PL":/^(\+?48)?[45789]\d{8}$/};function isMobilePhone(f){return w("isMobilePhone",f,W)}const Z={AD:/^AD\d{3}$/,AT:/^\d{4}$/,AU:/^\d{4}$/,AZ:/^\d{4}$/,BE:/^\d{4}$/,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-Z]{2}\d{7}$/i,MK:/^[A-Z]\d{7}$/i,MT:/^\d{7}$/,MX:/^[A-Z]\d{8}$/i,MY:/^[AHK]\d{8}[A-Z]$/i,NL:/^[A-NP-Z]{2}[A-NP-Z0-9]{6}\d$/i,NO:/^\d{9}$/,NZ:/^[A-Z]{2}\d{6}$/i,PH:/^[A-Z]\d{7}[A-Z]$/i,PK:/^[A-Z]{2}\d{7}$/i,PL:/^[A-Z]{2}\d{7}$/i,PT:/^[A-Z]\d{6}$/i,RO:/^\d{8}$/,RS:/^\d{9}$/,RU:/^\d{9}$/,SA:/^[A-Z]\d{8}$/i,SE:/^\d{8}$/,SL:/^(P)[A-Z]\d{7}$/i,SK:/^[0-9A-Z]\d{7}$/i,TH:/^[A-Z]{1,2}\d{6,7}$/i,TN:/^\d{8}$/,TR:/^[A-Z]\d{8}$/i,TW:/^[A-Z]\d{9}$/i,UA:/^[A-Z]{2}\d{6}$/i,US:/^\d{9}$/,ZA:/^[A-Z]\d{8}$/i};function isPassportNumber(f){return w("isPassportNumber",f,h)}function w(f,z,K){const F=K[z];if(!F)throw new U(`Unsupported locale: "${z}" for ${f}`);return V({name:f,requiresType:Q.String,constraints:{locale:z},validate:(j)=>typeof j==="string"&&F.test(j),emit:(j,J)=>{return`if (!re[${J.addRegex(F)}].test(${j})) ${J.fail(f)};`}})}export{isMobilePhone,isPostalCode,isIdentityCard,isPassportNumber};
1
+ import{BakerError as Q}from"../common/index.js";import{MOBILE_PHONE_REGEXES as U,POSTAL_CODE_REGEXES as V,IDENTITY_CARD_REGEXES as W,PASSPORT_REGEXES as Z}from"./constants.js";import{RequiredType as $}from"./enums.js";import{makeRule as h}from"./rule-plan.js";function isMobilePhone(f){return w("isMobilePhone",f,U)}function isPostalCode(f){return w("isPostalCode",f,V)}function isIdentityCard(f){return w("isIdentityCard",f,W)}function isPassportNumber(f){return w("isPassportNumber",f,Z)}function w(f,z,K){const F=K[z];if(!F)throw new Q(`Unsupported locale: "${z}" for ${f}`);return h({name:f,requiresType:$.String,constraints:{locale:z},validate:(j)=>typeof j==="string"&&F.test(j),emit:(j,J)=>{return`if (!re[${J.addRegex(F)}].test(${j})) ${J.fail(f)};`}})}export{isMobilePhone,isPostalCode,isIdentityCard,isPassportNumber};
@@ -1,10 +1,10 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  export declare function min(n: number, opts?: {
3
3
  exclusive?: boolean;
4
4
  }): EmittableRule;
5
5
  export declare function max(n: number, opts?: {
6
6
  exclusive?: boolean;
7
7
  }): EmittableRule;
8
- export declare const isPositive: import("../types").InternalRule;
9
- export declare const isNegative: import("../types").InternalRule;
8
+ export declare const isPositive: import("./interfaces").InternalRule;
9
+ export declare const isNegative: import("./interfaces").InternalRule;
10
10
  export declare function isDivisibleBy(n: number): EmittableRule;
@@ -1 +1 @@
1
- import{RequiredType as A,RuleOp as h}from"../enums.js";import{BakerError as I}from"../errors.js";import{makePlannedRule as D,makeRule as J,planCompare as z,planLiteral as F,planOr as G,planValue as f}from"../rule-plan.js";export function min(b,w){if(!Number.isFinite(b))throw new I(`min: bound must be a finite number, got ${b}`);const j=w?.exclusive??!1,H={failure:G(z(f(),h.Neq,f()),z(f(),j?h.Lte:h.Lt,F(b)))};return D({name:"min",requiresType:A.Number,constraints:j?{min:b,exclusive:!0}:{min:b},plan:H,validate:j?(g)=>typeof g==="number"&&g>b:(g)=>typeof g==="number"&&g>=b})}export function max(b,w){if(!Number.isFinite(b))throw new I(`max: bound must be a finite number, got ${b}`);const j=w?.exclusive??!1,H={failure:G(z(f(),h.Neq,f()),z(f(),j?h.Gte:h.Gt,F(b)))};return D({name:"max",requiresType:A.Number,constraints:j?{max:b,exclusive:!0}:{max:b},plan:H,validate:j?(g)=>typeof g==="number"&&g<b:(g)=>typeof g==="number"&&g<=b})}export const isPositive=D({name:"isPositive",requiresType:A.Number,constraints:{min:0,exclusive:!0},plan:{failure:G(z(f(),h.Neq,f()),z(f(),h.Lte,F(0)))},validate:(b)=>typeof b==="number"&&b>0});export const isNegative=D({name:"isNegative",requiresType:A.Number,constraints:{max:0,exclusive:!0},plan:{failure:G(z(f(),h.Neq,f()),z(f(),h.Gte,F(0)))},validate:(b)=>typeof b==="number"&&b<0});export function isDivisibleBy(b){if(b===0)throw new I("isDivisibleBy: divisor must not be zero");return J({name:"isDivisibleBy",requiresType:A.Number,constraints:{divisor:b},validate:(w)=>typeof w==="number"&&w%b===0,emit:(w,j)=>`if (${w} % ${b} !== 0) ${j.fail("isDivisibleBy")};`})}
1
+ import{BakerError as I}from"../common/index.js";import{RequiredType as A,RuleOp as h}from"./enums.js";import{makePlannedRule as D,makeRule as J,planCompare as z,planLiteral as F,planOr as G,planValue as f}from"./rule-plan.js";export function min(b,w){if(!Number.isFinite(b))throw new I(`min: bound must be a finite number, got ${b}`);const j=w?.exclusive??!1,H={failure:G(z(f(),h.Neq,f()),z(f(),j?h.Lte:h.Lt,F(b)))};return D({name:"min",requiresType:A.Number,constraints:j?{min:b,exclusive:!0}:{min:b},plan:H,validate:j?(g)=>typeof g==="number"&&g>b:(g)=>typeof g==="number"&&g>=b})}export function max(b,w){if(!Number.isFinite(b))throw new I(`max: bound must be a finite number, got ${b}`);const j=w?.exclusive??!1,H={failure:G(z(f(),h.Neq,f()),z(f(),j?h.Gte:h.Gt,F(b)))};return D({name:"max",requiresType:A.Number,constraints:j?{max:b,exclusive:!0}:{max:b},plan:H,validate:j?(g)=>typeof g==="number"&&g<b:(g)=>typeof g==="number"&&g<=b})}export const isPositive=D({name:"isPositive",requiresType:A.Number,constraints:{min:0,exclusive:!0},plan:{failure:G(z(f(),h.Neq,f()),z(f(),h.Lte,F(0)))},validate:(b)=>typeof b==="number"&&b>0});export const isNegative=D({name:"isNegative",requiresType:A.Number,constraints:{max:0,exclusive:!0},plan:{failure:G(z(f(),h.Neq,f()),z(f(),h.Gte,F(0)))},validate:(b)=>typeof b==="number"&&b<0});export function isDivisibleBy(b){if(b===0)throw new I("isDivisibleBy: divisor must not be zero");return J({name:"isDivisibleBy",requiresType:A.Number,constraints:{divisor:b},validate:(w)=>typeof w==="number"&&w%b===0,emit:(w,j)=>`if (${w} % ${b} !== 0) ${j.fail("isDivisibleBy")};`})}
@@ -1,4 +1,4 @@
1
- import type { EmittableRule } from '../types';
1
+ import type { EmittableRule } from './interfaces';
2
2
  export interface IsNotEmptyObjectOptions {
3
3
  /** Whether to ignore keys with null/undefined values (default: false — do not ignore) */
4
4
  nullable?: boolean;
@@ -1 +1 @@
1
- import{RequiredType as C}from"../enums.js";import{makeRule as B}from"../rule-plan.js";export function isNotEmptyObject(w){const z=(f)=>{if(f===null||typeof f!=="object"||Array.isArray(f))return!1;const h=f;if(w?.nullable){for(const A in h)if(h[A]!=null)return!0;return!1}for(const A in h)return!0;return!1};return B({name:"isNotEmptyObject",requiresType:C.Object,constraints:{nullable:w?.nullable},validate:z,emit:(f,h)=>{if(w?.nullable)return`{var __ne=false;for(var __k in ${f}){if(${f}[__k]!=null){__ne=true;break;}}if(!__ne) ${h.fail("isNotEmptyObject")};}`;return`{var __ne=false;for(var __k in ${f}){__ne=true;break;}if(!__ne) ${h.fail("isNotEmptyObject")};}`}})}export function isInstance(w){return B({name:"isInstance",constraints:{type:w.name},validate:(z)=>z instanceof w,emit:(z,f)=>{const h=f.addRef(w);return`if (!(${z} instanceof refs[${h}])) ${f.fail("isInstance")};`}})}
1
+ import{RequiredType as C}from"./enums.js";import{makeRule as B}from"./rule-plan.js";export function isNotEmptyObject(h){const z=(f)=>{if(f===null||typeof f!=="object"||Array.isArray(f))return!1;const w=f;if(h?.nullable){for(const A in w)if(w[A]!=null)return!0;return!1}for(const A in w)return!0;return!1};return B({name:"isNotEmptyObject",requiresType:C.Object,constraints:h?.nullable!==void 0?{nullable:h.nullable}:{},validate:z,emit:(f,w)=>{if(h?.nullable)return`{var __ne=false;for(var __k in ${f}){if(${f}[__k]!=null){__ne=true;break;}}if(!__ne) ${w.fail("isNotEmptyObject")};}`;return`{var __ne=false;for(var __k in ${f}){__ne=true;break;}if(!__ne) ${w.fail("isNotEmptyObject")};}`}})}export function isInstance(h){return B({name:"isInstance",constraints:{type:h.name},validate:(z)=>z instanceof h,emit:(z,f)=>{const w=f.addRef(h);return`if (!(${z} instanceof refs[${w}])) ${f.fail("isInstance")};`}})}
@@ -0,0 +1,14 @@
1
+ export { createRule } from './create-rule';
2
+ export { isString, isNumber, isBoolean, isDate, isEnum, isInt, isArray, isObject, isRegExp, isFunction, isStatelessRegExp, } from './typechecker';
3
+ export type { IsNumberOptions } from './typechecker';
4
+ export { oneOf, arrayEvery } from './combinators';
5
+ export { min, max, isPositive, isNegative, isDivisibleBy } from './number';
6
+ export { minDate, maxDate } from './date';
7
+ export { equals, notEquals, isEmpty, isNotEmpty, isIn, isNotIn } from './common';
8
+ export { minLength, maxLength, length, contains, notContains, matches, isLowercase, isUppercase, isAscii, isAlpha, isAlphanumeric, isHttpToken, isOrigin, isCorsOrigin, isBooleanString, isNumberString, isDecimal, isFullWidth, isHalfWidth, isVariableWidth, isMultibyte, isSurrogatePair, isHexadecimal, isOctal, isEmail, isURL, isUUID, isIP, isHexColor, isRgbColor, isHSL, isMACAddress, isISBN, isISIN, isISO8601, isISRC, isISSN, isJWT, isLatLong, isLocale, isDataURI, isFQDN, isPort, isEAN, isISO31661Alpha2, isISO31661Alpha3, isBIC, isFirebasePushId, isSemVer, isMongoId, isJSON, isBase32, isBase58, isBase64, isDateString, isMimeType, isCurrency, isMagnetURI, isCreditCard, isIBAN, isByteLength, isHash, isRFC3339, isMilitaryTime, isLatitude, isLongitude, isEthereumAddress, isBtcAddress, isISO4217CurrencyCode, isPhoneNumber, isStrongPassword, isTaxId, isULID, isCUID2, } from './string';
9
+ export type { IsURLOptions, IsBase64Options, IsMACAddressOptions, IsIBANOptions, IsISSNOptions, IsFQDNOptions, IsISO8601Options, IsNumberStringOptions, IsStrongPasswordOptions, } from './string';
10
+ export { arrayContains, arrayNotContains, arrayMinSize, arrayMaxSize, arrayUnique, arrayNotEmpty } from './array';
11
+ export { isNotEmptyObject, isInstance } from './object';
12
+ export type { IsNotEmptyObjectOptions } from './object';
13
+ export { isMobilePhone, isPostalCode, isIdentityCard, isPassportNumber } from './locales';
14
+ export { isUint8Array, isByteSize } from './binary';
@@ -0,0 +1 @@
1
+ export{createRule}from"./create-rule.js";export{isString,isNumber,isBoolean,isDate,isEnum,isInt,isArray,isObject,isRegExp,isFunction,isStatelessRegExp}from"./typechecker.js";export{oneOf,arrayEvery}from"./combinators.js";export{min,max,isPositive,isNegative,isDivisibleBy}from"./number.js";export{minDate,maxDate}from"./date.js";export{equals,notEquals,isEmpty,isNotEmpty,isIn,isNotIn}from"./common.js";export{minLength,maxLength,length,contains,notContains,matches,isLowercase,isUppercase,isAscii,isAlpha,isAlphanumeric,isHttpToken,isOrigin,isCorsOrigin,isBooleanString,isNumberString,isDecimal,isFullWidth,isHalfWidth,isVariableWidth,isMultibyte,isSurrogatePair,isHexadecimal,isOctal,isEmail,isURL,isUUID,isIP,isHexColor,isRgbColor,isHSL,isMACAddress,isISBN,isISIN,isISO8601,isISRC,isISSN,isJWT,isLatLong,isLocale,isDataURI,isFQDN,isPort,isEAN,isISO31661Alpha2,isISO31661Alpha3,isBIC,isFirebasePushId,isSemVer,isMongoId,isJSON,isBase32,isBase58,isBase64,isDateString,isMimeType,isCurrency,isMagnetURI,isCreditCard,isIBAN,isByteLength,isHash,isRFC3339,isMilitaryTime,isLatitude,isLongitude,isEthereumAddress,isBtcAddress,isISO4217CurrencyCode,isPhoneNumber,isStrongPassword,isTaxId,isULID,isCUID2}from"./string.js";export{arrayContains,arrayNotContains,arrayMinSize,arrayMaxSize,arrayUnique,arrayNotEmpty}from"./array.js";export{isNotEmptyObject,isInstance}from"./object.js";export{isMobilePhone,isPostalCode,isIdentityCard,isPassportNumber}from"./locales.js";export{isUint8Array,isByteSize}from"./binary.js";
@@ -1,4 +1,4 @@
1
- import type { EmittableRule, InternalRule, RulePlan } from './types';
1
+ import type { EmittableRule, InternalRule, RulePlan } from './interfaces';
2
2
  interface RuleMetadata {
3
3
  emit: EmittableRule['emit'];
4
4
  ruleName: string;
@@ -1 +1 @@
1
- export function defineRuleMetadata(q,b){const j=q;j.emit=b.emit;j.ruleName=b.ruleName;if(b.requiresType!==void 0)j.requiresType=b.requiresType;if(b.constraints!==void 0)j.constraints=b.constraints;if(b.isAsync!==void 0)j.isAsync=b.isAsync;if(b.plan)j.plan=b.plan}
1
+ export function defineRuleMetadata(q,b){const j=q;j.emit=b.emit;j.ruleName=b.ruleName;if(b.requiresType!==void 0)j.requiresType=b.requiresType;if(b.constraints!==void 0)j.constraints=b.constraints;if(b.isAsync!==void 0)j.isAsync=b.isAsync;if(b.plan!==void 0)j.plan=b.plan}
@@ -1,13 +1,10 @@
1
1
  import type { RequiredType } from './enums';
2
- import type { EmitContext, InternalRule, RulePlan, RulePlanCheck, RulePlanExpr } from './types';
2
+ import type { EmitContext, InternalRule, RulePlan } from './interfaces';
3
+ import type { RulePlanCache, RulePlanCheck, RulePlanExpr } from './types';
3
4
  import { RuleOp } from './enums';
4
- type RulePlanCache = {
5
- length?: string;
6
- time?: string;
7
- };
8
5
  declare const planValue: () => RulePlanExpr;
9
- declare const planLength: (object?: RulePlanExpr) => RulePlanExpr;
10
- declare const planTime: (object?: RulePlanExpr) => RulePlanExpr;
6
+ declare const planLength: () => RulePlanExpr;
7
+ declare const planTime: () => RulePlanExpr;
11
8
  declare const planLiteral: (value: number) => RulePlanExpr;
12
9
  declare const planCompare: (left: RulePlanExpr, op: RuleOp, right: number | RulePlanExpr) => RulePlanCheck;
13
10
  declare const planOr: (...checks: RulePlanCheck[]) => RulePlanCheck;
@@ -0,0 +1 @@
1
+ import{RuleOp as X,RulePlanCheckKind as H,RulePlanExprKind as D}from"./enums.js";import{defineRuleMetadata as Y}from"./rule-metadata.js";const planValue=()=>({kind:D.Value});const planLength=()=>({kind:D.Member,property:"length"});const planTime=()=>({kind:D.Call0,method:"getTime"});const planLiteral=(z)=>({kind:D.Literal,value:z});const planCompare=(z,A,B)=>({kind:H.Compare,left:z,op:A,right:typeof B==="number"?planLiteral(B):B});const planOr=(...z)=>({kind:H.Or,checks:z});function makePlannedRule(z){const A={name:z.name,requiresType:z.requiresType,plan:z.plan,validate:z.validate,emit:(B,F)=>emitRulePlan(B,F,z.name,z.plan,void 0,F.insideTypeGate)};if(z.constraints!==void 0)A.constraints=z.constraints;return makeRule(A)}function makeRule(z){const A=(F)=>z.validate(F),B={emit:z.emit,ruleName:z.name,constraints:z.constraints??{}};if(z.requiresType!==void 0)B.requiresType=z.requiresType;if(z.isAsync!==void 0)B.isAsync=z.isAsync;if(z.plan!==void 0)B.plan=z.plan;Y(A,B);return A}function emitRulePlan(z,A,B,F,I,U){const W=U?Z(F.failure):F.failure;return`if (${Q(W,z,I)}) ${A.fail(B)};`}function Z(z){if(z.kind===H.Compare)return z;const A=z.checks.filter((B)=>!_(B));if(A.length===0)return z;if(A.length===1)return A[0];return{kind:z.kind,checks:A}}function _(z){if(z.kind!==H.Compare||z.op!==X.Neq)return!1;return $(z.left,z.right)}function $(z,A){switch(z.kind){case D.Value:return A.kind===D.Value;case D.Member:return A.kind===D.Member;case D.Call0:return A.kind===D.Call0;case D.Literal:return A.kind===D.Literal&&z.value===A.value;default:return z}}function Q(z,A,B){if(z.kind===H.Compare)return`${J(z.left,A,B)} ${z.op} ${J(z.right,A,B)}`;const F=z.kind===H.And?" && ":" || ";return`(${z.checks.map((I)=>Q(I,A,B)).join(F)})`}function J(z,A,B){switch(z.kind){case D.Value:return A;case D.Literal:return String(z.value);case D.Member:return B?.length??`${A}.length`;case D.Call0:return B?.time??`${A}.getTime()`;default:return z}}export{planValue,planLength,planTime,planLiteral,planCompare,planOr,makePlannedRule,makeRule,emitRulePlan};
@@ -0,0 +1,23 @@
1
+ import type { EmittableRule } from './interfaces';
2
+ declare function minLength(min: number): EmittableRule;
3
+ declare function maxLength(max: number): EmittableRule;
4
+ declare function length(minLen: number, maxLen: number): EmittableRule;
5
+ declare function contains(seed: string): EmittableRule;
6
+ declare function notContains(seed: string): EmittableRule;
7
+ declare function matches(pattern: string | RegExp, modifiers?: string): EmittableRule;
8
+ declare const isLowercase: import("./interfaces").InternalRule;
9
+ declare const isUppercase: import("./interfaces").InternalRule;
10
+ declare const isAscii: EmittableRule;
11
+ declare const isAlpha: EmittableRule;
12
+ declare const isAlphanumeric: EmittableRule;
13
+ declare const isHttpToken: EmittableRule;
14
+ declare const isOrigin: import("./interfaces").InternalRule;
15
+ declare const isCorsOrigin: import("./interfaces").InternalRule;
16
+ declare const isBooleanString: import("./interfaces").InternalRule;
17
+ interface IsNumberStringOptions {
18
+ noSymbols?: boolean;
19
+ }
20
+ declare function isNumberString(options?: IsNumberStringOptions): EmittableRule;
21
+ declare function isDecimal(): EmittableRule;
22
+ export { minLength, maxLength, length, contains, notContains, matches, isLowercase, isUppercase, isAscii, isAlpha, isAlphanumeric, isHttpToken, isOrigin, isCorsOrigin, isBooleanString, isNumberString, isDecimal, };
23
+ export type { IsNumberStringOptions };