constructa-generators 0.0.11 → 0.1.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.
package/README.md CHANGED
@@ -4,6 +4,42 @@ Built-in generator implementations for Constructa.
4
4
 
5
5
  The first implementation set will include integer, boolean, choice, decimal, string, date, UUID, object, array, and template generators. Each generator should own its configuration validation, metadata, implementation, and tests while conforming to the common core contract.
6
6
 
7
+ ## Integer
8
+
9
+ `integer({ min, max })` returns a portable definition whose output is inferred as `number`. Both safe-integer bounds are required and inclusive. `integerGenerator` uses the execution context's random source, and `registerIntegerGenerator(registry)` is available for advanced custom registries.
10
+
11
+ ## Boolean
12
+
13
+ `boolean()` returns a portable definition whose output is inferred as `boolean`. It has no configuration and selects `false` and `true` with equal probability through the execution context's random source. `registerBooleanGenerator(registry)` is available for advanced custom registries.
14
+
15
+ ## Choice
16
+
17
+ `choice(values)` accepts a non-empty array of portable JSON values and infers the union of its members, including array literals without `as const`. It selects a member through the execution context's unbiased integer source. `registerChoiceGenerator(registry)` is available for advanced custom registries.
18
+
19
+ ## Decimal
20
+
21
+ `decimal({ min, max, precision })` returns a JavaScript `number` rounded with `Number#toFixed`; it is not arbitrary-precision decimal arithmetic. Bounds must be finite and inclusive. Precision is required and ranges from 0 through 15. `registerDecimalGenerator(registry)` is available for advanced custom registries.
22
+
23
+ ## String
24
+
25
+ `string({ length, charset? })` returns a random character string. Length is required and ranges from 0 through 10,000. The explicit default charset is `alphanumeric`; `alphabetic`, `numeric`, `alphanumeric`, and `hex` are predefined, while any other non-empty string is used as a custom charset. `registerStringGenerator(registry)` is available for advanced custom registries.
26
+
27
+ ## Date
28
+
29
+ `date({ min, max })` returns an inclusive `YYYY-MM-DD` ISO calendar-date string. Dates are validated canonically and generated with UTC calendar arithmetic, so results do not depend on the local timezone. `registerDateGenerator(registry)` is available for advanced custom registries.
30
+
31
+ ## UUID
32
+
33
+ `uuid()` returns a canonical UUID v4 string. It obtains exactly 16 bytes from the execution context, sets the RFC 4122 version and variant bits, and is deterministic when the executor is seeded. `registerUuidGenerator(registry)` is available for advanced custom registries.
34
+
35
+ ## Object
36
+
37
+ `object(fields)` composes named child definitions and infers a mapped object output from them. Each child is delegated through the execution engine using its field name as the path segment, so nested errors retain their full field path. `registerObjectGenerator(registry)` is available for advanced custom registries.
38
+
39
+ ## Array
40
+
41
+ `array(item, { length })` creates one fixed-length array value and infers `Infer<typeof item>[]`. Length must be a non-negative safe integer no greater than 10,000. Array items are delegated through the execution engine using numeric index path segments; this is distinct from repeated root execution. `registerArrayGenerator(registry)` is available for advanced custom registries.
42
+
7
43
  ## Dependency boundary
8
44
 
9
45
  This package may import `constructa-core` for the generator contract and registration APIs, and `constructa-schema` for portable definitions. It must not import exporters, the SDK, applications, UI, environment, persistence, or transport code.
package/dist/index.d.ts CHANGED
@@ -1 +1,119 @@
1
- export {}
1
+ import { GeneratorDefinition, GeneratorImplementation, GeneratorRegistry } from "constructa-core";
2
+ import { JsonValue } from "constructa-schema";
3
+ //#region src/index.d.ts
4
+ declare const MAX_DECIMAL_PRECISION = 15;
5
+ declare const MAX_STRING_LENGTH = 10000;
6
+ declare const MAX_ARRAY_LENGTH = 10000;
7
+ declare const STRING_CHARSETS: {
8
+ readonly alphabetic: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
9
+ readonly numeric: "0123456789";
10
+ readonly alphanumeric: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
11
+ readonly hex: "0123456789abcdef";
12
+ };
13
+ type UuidDefinition = GeneratorDefinition<string> & {
14
+ readonly type: "uuid";
15
+ };
16
+ /** Builds a portable UUID version 4 definition. */
17
+ declare function uuid(): UuidDefinition;
18
+ declare const uuidGenerator: GeneratorImplementation<UuidDefinition, string>;
19
+ declare function registerUuidGenerator(registry: GeneratorRegistry): void;
20
+ type ObjectFields = Readonly<Record<string, GeneratorDefinition>>;
21
+ type ObjectOutput<Fields extends ObjectFields> = { [Key in keyof Fields]: InferGenerator<Fields[Key]>; };
22
+ type ObjectDefinition<Fields extends ObjectFields = ObjectFields> = GeneratorDefinition<ObjectOutput<Fields>> & {
23
+ readonly type: "object";
24
+ readonly fields: Fields;
25
+ };
26
+ type InferGenerator<Definition> = Definition extends GeneratorDefinition<infer Output> ? Output : never;
27
+ /** Builds a composite object definition from named child definitions. */
28
+ declare function object<const Fields extends ObjectFields>(fields: Fields): ObjectDefinition<Fields>;
29
+ declare const objectGenerator: GeneratorImplementation<ObjectDefinition, Record<string, unknown>>;
30
+ declare function registerObjectGenerator(registry: GeneratorRegistry): void;
31
+ type ArrayOptions = {
32
+ readonly length: number;
33
+ };
34
+ type ArrayDefinition<Item extends GeneratorDefinition = GeneratorDefinition> = GeneratorDefinition<InferGenerator<Item>[]> & {
35
+ readonly type: "array";
36
+ readonly item: Item;
37
+ readonly length: number;
38
+ };
39
+ /** Builds a fixed-length composite array definition. */
40
+ declare function array<const Item extends GeneratorDefinition>(item: Item, options: ArrayOptions): ArrayDefinition<Item>;
41
+ declare const arrayGenerator: GeneratorImplementation<ArrayDefinition, unknown[]>;
42
+ declare function registerArrayGenerator(registry: GeneratorRegistry): void;
43
+ type ChoiceDefinition<Value extends JsonValue = JsonValue> = GeneratorDefinition<Value> & {
44
+ readonly type: "choice";
45
+ readonly values: readonly Value[];
46
+ };
47
+ /** Builds a portable choice definition while preserving array-literal unions. */
48
+ declare function choice<const Values extends readonly JsonValue[]>(values: Values): ChoiceDefinition<Values[number]>;
49
+ declare const choiceGenerator: GeneratorImplementation<ChoiceDefinition, JsonValue>;
50
+ declare function registerChoiceGenerator(registry: GeneratorRegistry): void;
51
+ type DecimalOptions = {
52
+ readonly min: number;
53
+ readonly max: number;
54
+ readonly precision: number;
55
+ };
56
+ type DecimalDefinition = GeneratorDefinition<number> & {
57
+ readonly type: "decimal";
58
+ readonly min: number;
59
+ readonly max: number;
60
+ readonly precision: number;
61
+ };
62
+ /** Builds a finite JavaScript-number decimal definition. Precision is at most 15. */
63
+ declare function decimal(options: DecimalOptions): DecimalDefinition;
64
+ declare const decimalGenerator: GeneratorImplementation<DecimalDefinition, number>;
65
+ declare function registerDecimalGenerator(registry: GeneratorRegistry): void;
66
+ type StringCharset = keyof typeof STRING_CHARSETS | string;
67
+ type StringOptions = {
68
+ readonly length: number;
69
+ readonly charset?: StringCharset;
70
+ };
71
+ type StringDefinition = GeneratorDefinition<string> & {
72
+ readonly type: "string";
73
+ readonly length: number;
74
+ readonly charset: string;
75
+ };
76
+ /** Builds a random-character string definition. The default charset is alphanumeric. */
77
+ declare function string(options: StringOptions): StringDefinition;
78
+ declare const stringGenerator: GeneratorImplementation<StringDefinition, string>;
79
+ declare function registerStringGenerator(registry: GeneratorRegistry): void;
80
+ type DateOptions = {
81
+ readonly min: string;
82
+ readonly max: string;
83
+ };
84
+ type DateDefinition = GeneratorDefinition<string> & {
85
+ readonly type: "date";
86
+ readonly min: string;
87
+ readonly max: string;
88
+ };
89
+ /** Builds an inclusive timezone-independent ISO calendar-date definition. */
90
+ declare function date(options: DateOptions): DateDefinition;
91
+ declare const dateGenerator: GeneratorImplementation<DateDefinition, string>;
92
+ declare function registerDateGenerator(registry: GeneratorRegistry): void;
93
+ type IntegerOptions = {
94
+ readonly min: number;
95
+ readonly max: number;
96
+ };
97
+ type BooleanDefinition = GeneratorDefinition<boolean> & {
98
+ readonly type: "boolean";
99
+ };
100
+ /** Builds a portable, evenly distributed boolean definition. */
101
+ declare function boolean(): BooleanDefinition;
102
+ /** Trusted implementation for the portable `boolean` definition. */
103
+ declare const booleanGenerator: GeneratorImplementation<BooleanDefinition, boolean>;
104
+ /** Registers the boolean built-in with an advanced custom registry. */
105
+ declare function registerBooleanGenerator(registry: GeneratorRegistry): void;
106
+ type IntegerDefinition = GeneratorDefinition<number> & {
107
+ readonly type: "integer";
108
+ readonly min: number;
109
+ readonly max: number;
110
+ };
111
+ /** Builds a portable integer definition with inclusive minimum and maximum bounds. */
112
+ declare function integer(options: IntegerOptions): IntegerDefinition;
113
+ /** Trusted implementation for the portable `integer` definition. */
114
+ declare const integerGenerator: GeneratorImplementation<IntegerDefinition, number>;
115
+ /** Registers the integer built-in with an advanced custom registry. */
116
+ declare function registerIntegerGenerator(registry: GeneratorRegistry): void;
117
+ //#endregion
118
+ export { ArrayDefinition, ArrayOptions, BooleanDefinition, ChoiceDefinition, DateDefinition, DateOptions, DecimalDefinition, DecimalOptions, IntegerDefinition, IntegerOptions, MAX_ARRAY_LENGTH, MAX_DECIMAL_PRECISION, MAX_STRING_LENGTH, ObjectDefinition, ObjectFields, ObjectOutput, StringCharset, StringDefinition, StringOptions, UuidDefinition, array, arrayGenerator, boolean, booleanGenerator, choice, choiceGenerator, date, dateGenerator, decimal, decimalGenerator, integer, integerGenerator, object, objectGenerator, registerArrayGenerator, registerBooleanGenerator, registerChoiceGenerator, registerDateGenerator, registerDecimalGenerator, registerIntegerGenerator, registerObjectGenerator, registerStringGenerator, registerUuidGenerator, string, stringGenerator, uuid, uuidGenerator };
119
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;cAea;cACA;cACA;cAEP;;;;;;KAQM,iBAAiB;WAClB;;;iBAIK,QAAQ;cAIX,eAAe,wBAAwB;iBAapC,sBAAsB,UAAU;KAIpC,eAAe,SAAS,eAAe;KACvC,aAAa,eAAe,mBACrC,aAAa,SAAS,eAAe,OAAO;KAEnC,iBAAiB,eAAe,eAAe,gBACzD,oBAAoB,aAAa;WACtB;WACA,QAAQ;;KAGhB,eAAe,cAClB,mBAAmB,0BAA0B,UAAU;;iBAGzC,aAAa,eAAe,cAC1C,QAAQ,SACP,iBAAiB;cAUP,iBAAiB,wBAC5B,kBACA;iBAcc,wBAAwB,UAAU;KAItC;WACD;;KAEC,gBACV,aAAa,sBAAsB,uBACjC,oBAAoB,eAAe;WAC5B;WACA,MAAM;WACN;;;iBAIK,YAAY,aAAa,qBACvC,MAAM,MACN,SAAS,eACR,gBAAgB;cAeN,gBAAgB,wBAC3B;iBAec,uBAAuB,UAAU;KAIrC,iBAAiB,cAAc,YAAY,aACrD,oBAAoB;WACT;WACA,iBAAiB;;;iBAId,aAAa,wBAAwB,aACnD,QAAQ,SACP,iBAAiB;cASP,iBAAiB,wBAC5B,kBACA;iBAYc,wBAAwB,UAAU;KAItC;WACD;WACA;WACA;;KAGC,oBAAoB;WACrB;WACA;WACA;WACA;;;iBAIK,QAAQ,SAAS,iBAAiB;cAWrC,kBAAkB,wBAC7B;iBAcc,yBAAyB,UAAU;KAIvC,6BAA6B;KAC7B;WACD;WACA,UAAU;;KAGT,mBAAmB;WACpB;WACA;WACA;;;iBAIK,OAAO,SAAS,gBAAgB;cAYnC,iBAAiB,wBAC5B;iBAgBc,wBAAwB,UAAU;KAItC;WACD;WACA;;KAGC,iBAAiB;WAClB;WACA;WACA;;;iBAIK,KAAK,SAAS,cAAc;cAW/B,eAAe,wBAAwB;iBAcpC,sBAAsB,UAAU;KAIpC;WACD;WACA;;KAGC,oBAAoB;WACrB;;;iBAIK,WAAW;;cAKd,kBAAkB,wBAC7B;;iBAYc,yBAAyB,UAAU;KAIvC,oBAAoB;WACrB;WACA;WACA;;;iBAIK,QAAQ,SAAS,iBAAiB;;cAsBrC,kBAAkB,wBAC7B;;iBAac,yBAAyB,UAAU"}
package/dist/index.js CHANGED
@@ -0,0 +1,388 @@
1
+ import { createGeneratorDefinition, defineGenerator } from "constructa-core";
2
+ import { ConstructaError, validateGeneratorDefinition, validateJsonValue } from "constructa-schema";
3
+ //#region src/index.ts
4
+ const MAX_DECIMAL_PRECISION = 15;
5
+ const MAX_STRING_LENGTH = 1e4;
6
+ const MAX_ARRAY_LENGTH = 1e4;
7
+ const STRING_CHARSETS = {
8
+ alphabetic: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
9
+ numeric: "0123456789",
10
+ alphanumeric: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
11
+ hex: "0123456789abcdef"
12
+ };
13
+ /** Builds a portable UUID version 4 definition. */
14
+ function uuid() {
15
+ return createGeneratorDefinition({ type: "uuid" });
16
+ }
17
+ const uuidGenerator = defineGenerator({
18
+ type: "uuid",
19
+ version: 1,
20
+ validateDefinition: validateUuidDefinition,
21
+ generate({ context }) {
22
+ const bytes = context.random.bytes(16);
23
+ bytes[6] = (bytes[6] ?? 0) & 15 | 64;
24
+ bytes[8] = (bytes[8] ?? 0) & 63 | 128;
25
+ return formatUuid(bytes);
26
+ }
27
+ });
28
+ function registerUuidGenerator(registry) {
29
+ registry.register(uuidGenerator);
30
+ }
31
+ function object(fields) {
32
+ assertValidGeneratorOptions(validateObjectDefinition({
33
+ type: "object",
34
+ fields
35
+ }));
36
+ return createGeneratorDefinition({
37
+ type: "object",
38
+ fields
39
+ });
40
+ }
41
+ const objectGenerator = defineGenerator({
42
+ type: "object",
43
+ version: 1,
44
+ validateDefinition: validateObjectDefinition,
45
+ generate({ definition, context }) {
46
+ const result = {};
47
+ for (const [key, child] of Object.entries(definition.fields)) result[key] = context.executeChild(child, key);
48
+ return result;
49
+ }
50
+ });
51
+ function registerObjectGenerator(registry) {
52
+ registry.register(objectGenerator);
53
+ }
54
+ function array(item, options) {
55
+ assertValidGeneratorOptions(validateArrayDefinition({
56
+ type: "array",
57
+ item,
58
+ ...isDefinitionRecord(options) ? options : { length: void 0 }
59
+ }));
60
+ return createGeneratorDefinition({
61
+ type: "array",
62
+ item,
63
+ length: options.length
64
+ });
65
+ }
66
+ const arrayGenerator = defineGenerator({
67
+ type: "array",
68
+ version: 1,
69
+ validateDefinition: validateArrayDefinition,
70
+ generate({ definition, context }) {
71
+ const result = [];
72
+ for (let index = 0; index < definition.length; index += 1) result.push(context.executeChild(definition.item, index));
73
+ return result;
74
+ }
75
+ });
76
+ function registerArrayGenerator(registry) {
77
+ registry.register(arrayGenerator);
78
+ }
79
+ /** Builds a portable choice definition while preserving array-literal unions. */
80
+ function choice(values) {
81
+ assertValidGeneratorOptions(validateChoiceDefinition({
82
+ type: "choice",
83
+ values
84
+ }));
85
+ return createGeneratorDefinition({
86
+ type: "choice",
87
+ values
88
+ });
89
+ }
90
+ const choiceGenerator = defineGenerator({
91
+ type: "choice",
92
+ version: 1,
93
+ validateDefinition: validateChoiceDefinition,
94
+ generate({ definition, context }) {
95
+ return definition.values[context.random.integer(definition.values.length)];
96
+ }
97
+ });
98
+ function registerChoiceGenerator(registry) {
99
+ registry.register(choiceGenerator);
100
+ }
101
+ function decimal(options) {
102
+ assertValidGeneratorOptions(validateDecimalDefinition(options));
103
+ return createGeneratorDefinition({
104
+ type: "decimal",
105
+ ...options
106
+ });
107
+ }
108
+ const decimalGenerator = defineGenerator({
109
+ type: "decimal",
110
+ version: 1,
111
+ validateDefinition: validateDecimalDefinition,
112
+ generate({ definition, context }) {
113
+ const value = definition.min + context.random.float() * (definition.max - definition.min);
114
+ return Number(value.toFixed(definition.precision));
115
+ }
116
+ });
117
+ function registerDecimalGenerator(registry) {
118
+ registry.register(decimalGenerator);
119
+ }
120
+ function string(options) {
121
+ const normalized = normalizeStringOptions(options);
122
+ assertValidGeneratorOptions(validateStringDefinition(normalized));
123
+ return createGeneratorDefinition({
124
+ type: "string",
125
+ ...normalized
126
+ });
127
+ }
128
+ const stringGenerator = defineGenerator({
129
+ type: "string",
130
+ version: 1,
131
+ validateDefinition: validateStringDefinition,
132
+ generate({ definition, context }) {
133
+ const characters = Array.from(resolveCharset(definition.charset));
134
+ let result = "";
135
+ for (let index = 0; index < definition.length; index += 1) result += characters[context.random.integer(characters.length)];
136
+ return result;
137
+ }
138
+ });
139
+ function registerStringGenerator(registry) {
140
+ registry.register(stringGenerator);
141
+ }
142
+ function date(options) {
143
+ assertValidGeneratorOptions(validateDateDefinition(options));
144
+ return createGeneratorDefinition({
145
+ type: "date",
146
+ ...options
147
+ });
148
+ }
149
+ const dateGenerator = defineGenerator({
150
+ type: "date",
151
+ version: 1,
152
+ validateDefinition: validateDateDefinition,
153
+ generate({ definition, context }) {
154
+ const minimum = isoDateToDay(definition.min);
155
+ const maximum = isoDateToDay(definition.max);
156
+ return dayToIsoDate(minimum + context.random.integer(maximum - minimum + 1));
157
+ }
158
+ });
159
+ function registerDateGenerator(registry) {
160
+ registry.register(dateGenerator);
161
+ }
162
+ /** Builds a portable, evenly distributed boolean definition. */
163
+ function boolean() {
164
+ return createGeneratorDefinition({ type: "boolean" });
165
+ }
166
+ /** Trusted implementation for the portable `boolean` definition. */
167
+ const booleanGenerator = defineGenerator({
168
+ type: "boolean",
169
+ version: 1,
170
+ validateDefinition: validateBooleanDefinition,
171
+ generate({ context }) {
172
+ return context.random.integer(2) === 1;
173
+ }
174
+ });
175
+ /** Registers the boolean built-in with an advanced custom registry. */
176
+ function registerBooleanGenerator(registry) {
177
+ registry.register(booleanGenerator);
178
+ }
179
+ function integer(options) {
180
+ const issue = validateIntegerDefinition(options)[0];
181
+ if (issue !== void 0) throw new ConstructaError({
182
+ kind: "configuration",
183
+ code: "INVALID_RANGE",
184
+ path: issue.path,
185
+ message: issue.message,
186
+ details: { issueCode: issue.code }
187
+ });
188
+ const definition = options;
189
+ return createGeneratorDefinition({
190
+ type: "integer",
191
+ min: definition.min,
192
+ max: definition.max
193
+ });
194
+ }
195
+ /** Trusted implementation for the portable `integer` definition. */
196
+ const integerGenerator = defineGenerator({
197
+ type: "integer",
198
+ version: 1,
199
+ validateDefinition: validateIntegerDefinition,
200
+ generate({ definition, context }) {
201
+ const rangeSize = definition.max - definition.min + 1;
202
+ return definition.min + context.random.integer(rangeSize);
203
+ }
204
+ });
205
+ /** Registers the integer built-in with an advanced custom registry. */
206
+ function registerIntegerGenerator(registry) {
207
+ registry.register(integerGenerator);
208
+ }
209
+ function validateIntegerDefinition(value) {
210
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return [invalidRange([], "integer definition must be an object")];
211
+ const definition = value;
212
+ const issues = [];
213
+ if (!Number.isSafeInteger(definition.min)) issues.push(invalidRange(["min"], "min must be a safe integer"));
214
+ if (!Number.isSafeInteger(definition.max)) issues.push(invalidRange(["max"], "max must be a safe integer"));
215
+ if (issues.length > 0) return issues;
216
+ const min = definition.min;
217
+ const max = definition.max;
218
+ if (min > max) return [invalidRange(["min"], "min must be less than or equal to max")];
219
+ if (!Number.isSafeInteger(max - min + 1)) return [invalidRange(["max"], "the inclusive integer range must fit within a safe integer")];
220
+ return [];
221
+ }
222
+ function validateUuidDefinition(value) {
223
+ return validateExactDefinitionKeys(value, "uuid", []);
224
+ }
225
+ function validateObjectDefinition(value) {
226
+ const keyIssues = validateExactDefinitionKeys(value, "object", ["fields"]);
227
+ if (keyIssues.length > 0) return keyIssues;
228
+ const fields = value.fields;
229
+ if (!isDefinitionRecord(fields)) return [invalidConfiguration(["fields"], "fields must be an object")];
230
+ const issues = [];
231
+ for (const [key, child] of Object.entries(fields)) for (const issue of validateGeneratorDefinition(child)) issues.push({
232
+ ...issue,
233
+ path: [
234
+ "fields",
235
+ key,
236
+ ...issue.path
237
+ ]
238
+ });
239
+ return issues;
240
+ }
241
+ function validateArrayDefinition(value) {
242
+ const keyIssues = validateExactDefinitionKeys(value, "array", ["item", "length"]);
243
+ if (keyIssues.length > 0) return keyIssues;
244
+ const definition = value;
245
+ const issues = [];
246
+ for (const issue of validateGeneratorDefinition(definition.item)) issues.push({
247
+ ...issue,
248
+ path: ["item", ...issue.path]
249
+ });
250
+ if (!Number.isSafeInteger(definition.length) || definition.length < 0 || definition.length > 1e4) issues.push(invalidLength(["length"], `length must be an integer from 0 to ${MAX_ARRAY_LENGTH}`));
251
+ return issues;
252
+ }
253
+ function validateExactDefinitionKeys(value, type, keys) {
254
+ if (!isDefinitionRecord(value)) return [invalidConfiguration([], `${type} definition must be an object`)];
255
+ if (value.type !== type) return [invalidConfiguration(["type"], `type must be ${type}`)];
256
+ const allowed = /* @__PURE__ */ new Set(["type", ...keys]);
257
+ return Object.keys(value).filter((key) => !allowed.has(key)).map((key) => invalidConfiguration([key], `Unknown ${type} property: ${key}`));
258
+ }
259
+ function validateBooleanDefinition(value) {
260
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return [{
261
+ code: "invalid_boolean_definition",
262
+ path: [],
263
+ message: "boolean definition must be an object"
264
+ }];
265
+ return Object.keys(value).filter((key) => key !== "type").map((key) => ({
266
+ code: "unknown_property",
267
+ path: [key],
268
+ message: `Unknown boolean property: ${key}`
269
+ }));
270
+ }
271
+ function validateChoiceDefinition(value) {
272
+ if (!isDefinitionRecord(value) || !Array.isArray(value.values)) return [invalidConfiguration([], "choice definition must contain a values array")];
273
+ if (value.values.length === 0) return [{
274
+ code: "empty_choice",
275
+ path: ["values"],
276
+ message: "values must not be empty"
277
+ }];
278
+ const issues = [];
279
+ for (let index = 0; index < value.values.length; index += 1) for (const issue of validateJsonValue(value.values[index])) issues.push({
280
+ ...issue,
281
+ path: [
282
+ "values",
283
+ index,
284
+ ...issue.path
285
+ ]
286
+ });
287
+ return issues;
288
+ }
289
+ function validateDecimalDefinition(value) {
290
+ if (!isDefinitionRecord(value)) return [invalidRange([], "decimal definition must be an object")];
291
+ const issues = [];
292
+ if (!Number.isFinite(value.min)) issues.push(invalidRange(["min"], "min must be finite"));
293
+ if (!Number.isFinite(value.max)) issues.push(invalidRange(["max"], "max must be finite"));
294
+ if (!Number.isSafeInteger(value.precision) || value.precision < 0 || value.precision > 15) issues.push(invalidConfiguration(["precision"], `precision must be an integer from 0 to 15`));
295
+ if (issues.length > 0) return issues;
296
+ const min = value.min;
297
+ const max = value.max;
298
+ if (min > max || !Number.isFinite(max - min)) return [invalidRange(["max"], "max must be greater than or equal to min within a finite range")];
299
+ return [];
300
+ }
301
+ function normalizeStringOptions(value) {
302
+ if (!isDefinitionRecord(value)) return value;
303
+ return {
304
+ ...value,
305
+ charset: value.charset ?? "alphanumeric"
306
+ };
307
+ }
308
+ function validateStringDefinition(value) {
309
+ if (!isDefinitionRecord(value)) return [invalidConfiguration([], "string definition must be an object")];
310
+ const issues = [];
311
+ if (!Number.isSafeInteger(value.length) || value.length < 0 || value.length > 1e4) issues.push(invalidLength(["length"], `length must be an integer from 0 to ${MAX_STRING_LENGTH}`));
312
+ if (typeof value.charset !== "string" || Array.from(resolveCharset(value.charset)).length === 0) issues.push(invalidConfiguration(["charset"], "charset must be a non-empty string"));
313
+ return issues;
314
+ }
315
+ function validateDateDefinition(value) {
316
+ if (!isDefinitionRecord(value)) return [invalidRange([], "date definition must be an object")];
317
+ const issues = [];
318
+ if (typeof value.min !== "string" || !isCanonicalIsoDate(value.min)) issues.push(invalidRange(["min"], "min must be a canonical ISO calendar date"));
319
+ if (typeof value.max !== "string" || !isCanonicalIsoDate(value.max)) issues.push(invalidRange(["max"], "max must be a canonical ISO calendar date"));
320
+ if (issues.length > 0) return issues;
321
+ if (isoDateToDay(value.min) > isoDateToDay(value.max)) return [invalidRange(["min"], "min must be on or before max")];
322
+ return [];
323
+ }
324
+ function assertValidGeneratorOptions(issues) {
325
+ const issue = issues[0];
326
+ if (issue === void 0) return;
327
+ throw new ConstructaError({
328
+ kind: "configuration",
329
+ code: {
330
+ empty_choice: "EMPTY_CHOICE",
331
+ invalid_length: "INVALID_LENGTH",
332
+ invalid_range: "INVALID_RANGE"
333
+ }[issue.code] ?? "INVALID_CONFIGURATION",
334
+ path: issue.path,
335
+ message: issue.message,
336
+ details: { issueCode: issue.code }
337
+ });
338
+ }
339
+ function isDefinitionRecord(value) {
340
+ return typeof value === "object" && value !== null && !Array.isArray(value);
341
+ }
342
+ function resolveCharset(charset) {
343
+ return STRING_CHARSETS[charset] ?? charset;
344
+ }
345
+ function formatUuid(bytes) {
346
+ const hexadecimal = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
347
+ return `${hexadecimal.slice(0, 4).join("")}-${hexadecimal.slice(4, 6).join("")}-${hexadecimal.slice(6, 8).join("")}-${hexadecimal.slice(8, 10).join("")}-${hexadecimal.slice(10, 16).join("")}`;
348
+ }
349
+ function isCanonicalIsoDate(value) {
350
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(value)) return false;
351
+ const day = isoDateToDay(value);
352
+ return Number.isFinite(day) && dayToIsoDate(day) === value;
353
+ }
354
+ function isoDateToDay(value) {
355
+ const [year, month, day] = value.split("-").map(Number);
356
+ const date = /* @__PURE__ */ new Date(0);
357
+ date.setUTCFullYear(year, month - 1, day);
358
+ date.setUTCHours(0, 0, 0, 0);
359
+ return date.getTime() / 864e5;
360
+ }
361
+ function dayToIsoDate(day) {
362
+ return (/* @__PURE__ */ new Date(day * 864e5)).toISOString().slice(0, 10);
363
+ }
364
+ function invalidLength(path, message) {
365
+ return {
366
+ code: "invalid_length",
367
+ path,
368
+ message
369
+ };
370
+ }
371
+ function invalidConfiguration(path, message) {
372
+ return {
373
+ code: "invalid_configuration",
374
+ path,
375
+ message
376
+ };
377
+ }
378
+ function invalidRange(path, message) {
379
+ return {
380
+ code: "invalid_range",
381
+ path,
382
+ message
383
+ };
384
+ }
385
+ //#endregion
386
+ export { MAX_ARRAY_LENGTH, MAX_DECIMAL_PRECISION, MAX_STRING_LENGTH, array, arrayGenerator, boolean, booleanGenerator, choice, choiceGenerator, date, dateGenerator, decimal, decimalGenerator, integer, integerGenerator, object, objectGenerator, registerArrayGenerator, registerBooleanGenerator, registerChoiceGenerator, registerDateGenerator, registerDecimalGenerator, registerIntegerGenerator, registerObjectGenerator, registerStringGenerator, registerUuidGenerator, string, stringGenerator, uuid, uuidGenerator };
387
+
388
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["definition"],"sources":["../src/index.ts"],"sourcesContent":["import {\n createGeneratorDefinition,\n defineGenerator,\n type GeneratorDefinition,\n type GeneratorImplementation,\n type GeneratorRegistry,\n type ValidationIssue,\n} from \"constructa-core\";\nimport {\n ConstructaError,\n type JsonValue,\n validateGeneratorDefinition,\n validateJsonValue,\n} from \"constructa-schema\";\n\nexport const MAX_DECIMAL_PRECISION = 15;\nexport const MAX_STRING_LENGTH = 10_000;\nexport const MAX_ARRAY_LENGTH = 10_000;\n\nconst STRING_CHARSETS = {\n alphabetic: \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n numeric: \"0123456789\",\n alphanumeric:\n \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\",\n hex: \"0123456789abcdef\",\n} as const;\n\nexport type UuidDefinition = GeneratorDefinition<string> & {\n readonly type: \"uuid\";\n};\n\n/** Builds a portable UUID version 4 definition. */\nexport function uuid(): UuidDefinition {\n return createGeneratorDefinition({ type: \"uuid\" }) as UuidDefinition;\n}\n\nexport const uuidGenerator: GeneratorImplementation<UuidDefinition, string> =\n defineGenerator({\n type: \"uuid\",\n version: 1,\n validateDefinition: validateUuidDefinition,\n generate({ context }) {\n const bytes = context.random.bytes(16);\n bytes[6] = ((bytes[6] ?? 0) & 0x0f) | 0x40;\n bytes[8] = ((bytes[8] ?? 0) & 0x3f) | 0x80;\n return formatUuid(bytes);\n },\n });\n\nexport function registerUuidGenerator(registry: GeneratorRegistry): void {\n registry.register(uuidGenerator);\n}\n\nexport type ObjectFields = Readonly<Record<string, GeneratorDefinition>>;\nexport type ObjectOutput<Fields extends ObjectFields> = {\n [Key in keyof Fields]: InferGenerator<Fields[Key]>;\n};\nexport type ObjectDefinition<Fields extends ObjectFields = ObjectFields> =\n GeneratorDefinition<ObjectOutput<Fields>> & {\n readonly type: \"object\";\n readonly fields: Fields;\n };\n\ntype InferGenerator<Definition> =\n Definition extends GeneratorDefinition<infer Output> ? Output : never;\n\n/** Builds a composite object definition from named child definitions. */\nexport function object<const Fields extends ObjectFields>(\n fields: Fields,\n): ObjectDefinition<Fields>;\nexport function object(fields: unknown): ObjectDefinition {\n const issues = validateObjectDefinition({ type: \"object\", fields });\n assertValidGeneratorOptions(issues);\n return createGeneratorDefinition({\n type: \"object\",\n fields: fields as ObjectFields,\n }) as ObjectDefinition;\n}\n\nexport const objectGenerator: GeneratorImplementation<\n ObjectDefinition,\n Record<string, unknown>\n> = defineGenerator({\n type: \"object\",\n version: 1,\n validateDefinition: validateObjectDefinition,\n generate({ definition, context }) {\n const result: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(definition.fields)) {\n result[key] = context.executeChild(child, key);\n }\n return result;\n },\n});\n\nexport function registerObjectGenerator(registry: GeneratorRegistry): void {\n registry.register(objectGenerator);\n}\n\nexport type ArrayOptions = {\n readonly length: number;\n};\nexport type ArrayDefinition<\n Item extends GeneratorDefinition = GeneratorDefinition,\n> = GeneratorDefinition<InferGenerator<Item>[]> & {\n readonly type: \"array\";\n readonly item: Item;\n readonly length: number;\n};\n\n/** Builds a fixed-length composite array definition. */\nexport function array<const Item extends GeneratorDefinition>(\n item: Item,\n options: ArrayOptions,\n): ArrayDefinition<Item>;\nexport function array(item: unknown, options: unknown): ArrayDefinition {\n const issues = validateArrayDefinition({\n type: \"array\",\n item,\n ...(isDefinitionRecord(options) ? options : { length: undefined }),\n });\n assertValidGeneratorOptions(issues);\n return createGeneratorDefinition({\n type: \"array\",\n item: item as GeneratorDefinition,\n length: (options as ArrayOptions).length,\n }) as ArrayDefinition;\n}\n\nexport const arrayGenerator: GeneratorImplementation<\n ArrayDefinition,\n unknown[]\n> = defineGenerator({\n type: \"array\",\n version: 1,\n validateDefinition: validateArrayDefinition,\n generate({ definition, context }) {\n const result: unknown[] = [];\n for (let index = 0; index < definition.length; index += 1) {\n result.push(context.executeChild(definition.item, index));\n }\n return result;\n },\n});\n\nexport function registerArrayGenerator(registry: GeneratorRegistry): void {\n registry.register(arrayGenerator);\n}\n\nexport type ChoiceDefinition<Value extends JsonValue = JsonValue> =\n GeneratorDefinition<Value> & {\n readonly type: \"choice\";\n readonly values: readonly Value[];\n };\n\n/** Builds a portable choice definition while preserving array-literal unions. */\nexport function choice<const Values extends readonly JsonValue[]>(\n values: Values,\n): ChoiceDefinition<Values[number]> {\n const issues = validateChoiceDefinition({ type: \"choice\", values });\n assertValidGeneratorOptions(issues);\n return createGeneratorDefinition({\n type: \"choice\",\n values,\n }) as ChoiceDefinition<Values[number]>;\n}\n\nexport const choiceGenerator: GeneratorImplementation<\n ChoiceDefinition,\n JsonValue\n> = defineGenerator({\n type: \"choice\",\n version: 1,\n validateDefinition: validateChoiceDefinition,\n generate({ definition, context }) {\n return definition.values[\n context.random.integer(definition.values.length)\n ] as JsonValue;\n },\n});\n\nexport function registerChoiceGenerator(registry: GeneratorRegistry): void {\n registry.register(choiceGenerator);\n}\n\nexport type DecimalOptions = {\n readonly min: number;\n readonly max: number;\n readonly precision: number;\n};\n\nexport type DecimalDefinition = GeneratorDefinition<number> & {\n readonly type: \"decimal\";\n readonly min: number;\n readonly max: number;\n readonly precision: number;\n};\n\n/** Builds a finite JavaScript-number decimal definition. Precision is at most 15. */\nexport function decimal(options: DecimalOptions): DecimalDefinition;\nexport function decimal(options: unknown): DecimalDefinition {\n const issues = validateDecimalDefinition(options);\n assertValidGeneratorOptions(issues);\n const definition = options as DecimalOptions;\n return createGeneratorDefinition({\n type: \"decimal\",\n ...definition,\n }) as DecimalDefinition;\n}\n\nexport const decimalGenerator: GeneratorImplementation<\n DecimalDefinition,\n number\n> = defineGenerator({\n type: \"decimal\",\n version: 1,\n validateDefinition: validateDecimalDefinition,\n generate({ definition, context }) {\n const value =\n definition.min +\n context.random.float() * (definition.max - definition.min);\n return Number(value.toFixed(definition.precision));\n },\n});\n\nexport function registerDecimalGenerator(registry: GeneratorRegistry): void {\n registry.register(decimalGenerator);\n}\n\nexport type StringCharset = keyof typeof STRING_CHARSETS | string;\nexport type StringOptions = {\n readonly length: number;\n readonly charset?: StringCharset;\n};\n\nexport type StringDefinition = GeneratorDefinition<string> & {\n readonly type: \"string\";\n readonly length: number;\n readonly charset: string;\n};\n\n/** Builds a random-character string definition. The default charset is alphanumeric. */\nexport function string(options: StringOptions): StringDefinition;\nexport function string(options: unknown): StringDefinition {\n const normalized = normalizeStringOptions(options);\n const issues = validateStringDefinition(normalized);\n assertValidGeneratorOptions(issues);\n const definition = normalized as StringOptions & { readonly charset: string };\n return createGeneratorDefinition({\n type: \"string\",\n ...definition,\n }) as StringDefinition;\n}\n\nexport const stringGenerator: GeneratorImplementation<\n StringDefinition,\n string\n> = defineGenerator({\n type: \"string\",\n version: 1,\n validateDefinition: validateStringDefinition,\n generate({ definition, context }) {\n const characters = Array.from(resolveCharset(definition.charset));\n let result = \"\";\n for (let index = 0; index < definition.length; index += 1) {\n result += characters[context.random.integer(characters.length)];\n }\n return result;\n },\n});\n\nexport function registerStringGenerator(registry: GeneratorRegistry): void {\n registry.register(stringGenerator);\n}\n\nexport type DateOptions = {\n readonly min: string;\n readonly max: string;\n};\n\nexport type DateDefinition = GeneratorDefinition<string> & {\n readonly type: \"date\";\n readonly min: string;\n readonly max: string;\n};\n\n/** Builds an inclusive timezone-independent ISO calendar-date definition. */\nexport function date(options: DateOptions): DateDefinition;\nexport function date(options: unknown): DateDefinition {\n const issues = validateDateDefinition(options);\n assertValidGeneratorOptions(issues);\n const definition = options as DateOptions;\n return createGeneratorDefinition({\n type: \"date\",\n ...definition,\n }) as DateDefinition;\n}\n\nexport const dateGenerator: GeneratorImplementation<DateDefinition, string> =\n defineGenerator({\n type: \"date\",\n version: 1,\n validateDefinition: validateDateDefinition,\n generate({ definition, context }) {\n const minimum = isoDateToDay(definition.min);\n const maximum = isoDateToDay(definition.max);\n return dayToIsoDate(\n minimum + context.random.integer(maximum - minimum + 1),\n );\n },\n });\n\nexport function registerDateGenerator(registry: GeneratorRegistry): void {\n registry.register(dateGenerator);\n}\n\nexport type IntegerOptions = {\n readonly min: number;\n readonly max: number;\n};\n\nexport type BooleanDefinition = GeneratorDefinition<boolean> & {\n readonly type: \"boolean\";\n};\n\n/** Builds a portable, evenly distributed boolean definition. */\nexport function boolean(): BooleanDefinition {\n return createGeneratorDefinition({ type: \"boolean\" }) as BooleanDefinition;\n}\n\n/** Trusted implementation for the portable `boolean` definition. */\nexport const booleanGenerator: GeneratorImplementation<\n BooleanDefinition,\n boolean\n> = defineGenerator({\n type: \"boolean\",\n version: 1,\n validateDefinition: validateBooleanDefinition,\n generate({ context }) {\n return context.random.integer(2) === 1;\n },\n});\n\n/** Registers the boolean built-in with an advanced custom registry. */\nexport function registerBooleanGenerator(registry: GeneratorRegistry): void {\n registry.register(booleanGenerator);\n}\n\nexport type IntegerDefinition = GeneratorDefinition<number> & {\n readonly type: \"integer\";\n readonly min: number;\n readonly max: number;\n};\n\n/** Builds a portable integer definition with inclusive minimum and maximum bounds. */\nexport function integer(options: IntegerOptions): IntegerDefinition;\nexport function integer(options: unknown): IntegerDefinition {\n const issues = validateIntegerDefinition(options);\n const issue = issues[0];\n if (issue !== undefined) {\n throw new ConstructaError({\n kind: \"configuration\",\n code: \"INVALID_RANGE\",\n path: issue.path,\n message: issue.message,\n details: { issueCode: issue.code },\n });\n }\n const definition = options as IntegerOptions;\n return createGeneratorDefinition({\n type: \"integer\",\n min: definition.min,\n max: definition.max,\n }) as IntegerDefinition;\n}\n\n/** Trusted implementation for the portable `integer` definition. */\nexport const integerGenerator: GeneratorImplementation<\n IntegerDefinition,\n number\n> = defineGenerator({\n type: \"integer\",\n version: 1,\n validateDefinition: validateIntegerDefinition,\n generate({ definition, context }) {\n const rangeSize = definition.max - definition.min + 1;\n return definition.min + context.random.integer(rangeSize);\n },\n});\n\n/** Registers the integer built-in with an advanced custom registry. */\nexport function registerIntegerGenerator(registry: GeneratorRegistry): void {\n registry.register(integerGenerator);\n}\n\nfunction validateIntegerDefinition(value: unknown): readonly ValidationIssue[] {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return [invalidRange([], \"integer definition must be an object\")];\n }\n\n const definition = value as {\n readonly min?: unknown;\n readonly max?: unknown;\n };\n const issues: ValidationIssue[] = [];\n if (!Number.isSafeInteger(definition.min)) {\n issues.push(invalidRange([\"min\"], \"min must be a safe integer\"));\n }\n if (!Number.isSafeInteger(definition.max)) {\n issues.push(invalidRange([\"max\"], \"max must be a safe integer\"));\n }\n if (issues.length > 0) return issues;\n\n const min = definition.min as number;\n const max = definition.max as number;\n if (min > max) {\n return [invalidRange([\"min\"], \"min must be less than or equal to max\")];\n }\n if (!Number.isSafeInteger(max - min + 1)) {\n return [\n invalidRange(\n [\"max\"],\n \"the inclusive integer range must fit within a safe integer\",\n ),\n ];\n }\n return [];\n}\n\nfunction validateUuidDefinition(value: unknown): readonly ValidationIssue[] {\n return validateExactDefinitionKeys(value, \"uuid\", []);\n}\n\nfunction validateObjectDefinition(value: unknown): readonly ValidationIssue[] {\n const keyIssues = validateExactDefinitionKeys(value, \"object\", [\"fields\"]);\n if (keyIssues.length > 0) return keyIssues;\n\n const fields = (value as { readonly fields?: unknown }).fields;\n if (!isDefinitionRecord(fields)) {\n return [invalidConfiguration([\"fields\"], \"fields must be an object\")];\n }\n\n const issues: ValidationIssue[] = [];\n for (const [key, child] of Object.entries(fields)) {\n for (const issue of validateGeneratorDefinition(child)) {\n issues.push({ ...issue, path: [\"fields\", key, ...issue.path] });\n }\n }\n return issues;\n}\n\nfunction validateArrayDefinition(value: unknown): readonly ValidationIssue[] {\n const keyIssues = validateExactDefinitionKeys(value, \"array\", [\n \"item\",\n \"length\",\n ]);\n if (keyIssues.length > 0) return keyIssues;\n\n const definition = value as {\n readonly item?: unknown;\n readonly length?: unknown;\n };\n const issues: ValidationIssue[] = [];\n for (const issue of validateGeneratorDefinition(definition.item)) {\n issues.push({ ...issue, path: [\"item\", ...issue.path] });\n }\n if (\n !Number.isSafeInteger(definition.length) ||\n (definition.length as number) < 0 ||\n (definition.length as number) > MAX_ARRAY_LENGTH\n ) {\n issues.push(\n invalidLength(\n [\"length\"],\n `length must be an integer from 0 to ${MAX_ARRAY_LENGTH}`,\n ),\n );\n }\n return issues;\n}\n\nfunction validateExactDefinitionKeys(\n value: unknown,\n type: string,\n keys: readonly string[],\n): readonly ValidationIssue[] {\n if (!isDefinitionRecord(value)) {\n return [invalidConfiguration([], `${type} definition must be an object`)];\n }\n const definition = value as { readonly type?: unknown };\n if (definition.type !== type) {\n return [invalidConfiguration([\"type\"], `type must be ${type}`)];\n }\n const allowed = new Set([\"type\", ...keys]);\n return Object.keys(value)\n .filter((key) => !allowed.has(key))\n .map((key) =>\n invalidConfiguration([key], `Unknown ${type} property: ${key}`),\n );\n}\n\nfunction validateBooleanDefinition(value: unknown): readonly ValidationIssue[] {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return [\n {\n code: \"invalid_boolean_definition\",\n path: [],\n message: \"boolean definition must be an object\",\n },\n ];\n }\n return Object.keys(value)\n .filter((key) => key !== \"type\")\n .map((key) => ({\n code: \"unknown_property\",\n path: [key],\n message: `Unknown boolean property: ${key}`,\n }));\n}\n\nfunction validateChoiceDefinition(value: unknown): readonly ValidationIssue[] {\n if (!isDefinitionRecord(value) || !Array.isArray(value.values)) {\n return [\n invalidConfiguration([], \"choice definition must contain a values array\"),\n ];\n }\n if (value.values.length === 0) {\n return [\n {\n code: \"empty_choice\",\n path: [\"values\"],\n message: \"values must not be empty\",\n },\n ];\n }\n const issues: ValidationIssue[] = [];\n for (let index = 0; index < value.values.length; index += 1) {\n for (const issue of validateJsonValue(value.values[index])) {\n issues.push({ ...issue, path: [\"values\", index, ...issue.path] });\n }\n }\n return issues;\n}\n\nfunction validateDecimalDefinition(value: unknown): readonly ValidationIssue[] {\n if (!isDefinitionRecord(value)) {\n return [invalidRange([], \"decimal definition must be an object\")];\n }\n const issues: ValidationIssue[] = [];\n if (!Number.isFinite(value.min))\n issues.push(invalidRange([\"min\"], \"min must be finite\"));\n if (!Number.isFinite(value.max))\n issues.push(invalidRange([\"max\"], \"max must be finite\"));\n if (\n !Number.isSafeInteger(value.precision) ||\n (value.precision as number) < 0 ||\n (value.precision as number) > MAX_DECIMAL_PRECISION\n ) {\n issues.push(\n invalidConfiguration(\n [\"precision\"],\n `precision must be an integer from 0 to ${MAX_DECIMAL_PRECISION}`,\n ),\n );\n }\n if (issues.length > 0) return issues;\n const min = value.min as number;\n const max = value.max as number;\n if (min > max || !Number.isFinite(max - min)) {\n return [\n invalidRange(\n [\"max\"],\n \"max must be greater than or equal to min within a finite range\",\n ),\n ];\n }\n return [];\n}\n\nfunction normalizeStringOptions(value: unknown): unknown {\n if (!isDefinitionRecord(value)) return value;\n return { ...value, charset: value.charset ?? \"alphanumeric\" };\n}\n\nfunction validateStringDefinition(value: unknown): readonly ValidationIssue[] {\n if (!isDefinitionRecord(value)) {\n return [invalidConfiguration([], \"string definition must be an object\")];\n }\n const issues: ValidationIssue[] = [];\n if (\n !Number.isSafeInteger(value.length) ||\n (value.length as number) < 0 ||\n (value.length as number) > MAX_STRING_LENGTH\n ) {\n issues.push(\n invalidLength(\n [\"length\"],\n `length must be an integer from 0 to ${MAX_STRING_LENGTH}`,\n ),\n );\n }\n if (\n typeof value.charset !== \"string\" ||\n Array.from(resolveCharset(value.charset)).length === 0\n ) {\n issues.push(\n invalidConfiguration([\"charset\"], \"charset must be a non-empty string\"),\n );\n }\n return issues;\n}\n\nfunction validateDateDefinition(value: unknown): readonly ValidationIssue[] {\n if (!isDefinitionRecord(value)) {\n return [invalidRange([], \"date definition must be an object\")];\n }\n const issues: ValidationIssue[] = [];\n if (typeof value.min !== \"string\" || !isCanonicalIsoDate(value.min)) {\n issues.push(\n invalidRange([\"min\"], \"min must be a canonical ISO calendar date\"),\n );\n }\n if (typeof value.max !== \"string\" || !isCanonicalIsoDate(value.max)) {\n issues.push(\n invalidRange([\"max\"], \"max must be a canonical ISO calendar date\"),\n );\n }\n if (issues.length > 0) return issues;\n if (isoDateToDay(value.min as string) > isoDateToDay(value.max as string)) {\n return [invalidRange([\"min\"], \"min must be on or before max\")];\n }\n return [];\n}\n\nfunction assertValidGeneratorOptions(issues: readonly ValidationIssue[]): void {\n const issue = issues[0];\n if (issue === undefined) return;\n const codes: Record<string, Uppercase<string>> = {\n empty_choice: \"EMPTY_CHOICE\",\n invalid_length: \"INVALID_LENGTH\",\n invalid_range: \"INVALID_RANGE\",\n };\n throw new ConstructaError({\n kind: \"configuration\",\n code: codes[issue.code] ?? \"INVALID_CONFIGURATION\",\n path: issue.path,\n message: issue.message,\n details: { issueCode: issue.code },\n });\n}\n\nfunction isDefinitionRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction resolveCharset(charset: string): string {\n return STRING_CHARSETS[charset as keyof typeof STRING_CHARSETS] ?? charset;\n}\n\nfunction formatUuid(bytes: Uint8Array): string {\n const hexadecimal = Array.from(bytes, (byte) =>\n byte.toString(16).padStart(2, \"0\"),\n );\n return `${hexadecimal.slice(0, 4).join(\"\")}-${hexadecimal.slice(4, 6).join(\"\")}-${hexadecimal.slice(6, 8).join(\"\")}-${hexadecimal.slice(8, 10).join(\"\")}-${hexadecimal.slice(10, 16).join(\"\")}`;\n}\n\nfunction isCanonicalIsoDate(value: string): boolean {\n if (!/^\\d{4}-\\d{2}-\\d{2}$/u.test(value)) return false;\n const day = isoDateToDay(value);\n return Number.isFinite(day) && dayToIsoDate(day) === value;\n}\n\nfunction isoDateToDay(value: string): number {\n const [year, month, day] = value.split(\"-\").map(Number);\n const date = new Date(0);\n date.setUTCFullYear(year as number, (month as number) - 1, day as number);\n date.setUTCHours(0, 0, 0, 0);\n return date.getTime() / 86_400_000;\n}\n\nfunction dayToIsoDate(day: number): string {\n return new Date(day * 86_400_000).toISOString().slice(0, 10);\n}\n\nfunction invalidLength(\n path: readonly (string | number)[],\n message: string,\n): ValidationIssue {\n return { code: \"invalid_length\", path, message };\n}\n\nfunction invalidConfiguration(\n path: readonly (string | number)[],\n message: string,\n): ValidationIssue {\n return { code: \"invalid_configuration\", path, message };\n}\n\nfunction invalidRange(\n path: readonly (string | number)[],\n message: string,\n): ValidationIssue {\n return { code: \"invalid_range\", path, message };\n}\n"],"mappings":";;;AAeA,MAAa,wBAAwB;AACrC,MAAa,oBAAoB;AACjC,MAAa,mBAAmB;AAEhC,MAAM,kBAA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,aAAa,GAAG,MAAM;AACvD;AAEA,SAAS,aAAa,OAAuB;CAC3C,MAAM,CAAC,MAAM,OAAO,OAAO,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACtD,MAAM,uBAAO,IAAI,KAAK,CAAC;CACvB,KAAK,eAAe,MAAiB,QAAmB,GAAG,GAAa;CACxE,KAAK,YAAY,GAAG,GAAG,GAAG,CAAC;CAC3B,OAAO,KAAK,QAAQ,IAAI;AAC1B;AAEA,SAAS,aAAa,KAAqB;CACzC,wBAAO,IAAI,KAAK,MAAM,KAAU,EAAA,CAAE,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE;AAC7D;AAEA,SAAS,cACP,MACA,SACiB;CACjB,OAAO;EAAE,MAAM;EAAkB;EAAM;CAAQ;AACjD;AAEA,SAAS,qBACP,MACA,SACiB;CACjB,OAAO;EAAE,MAAM;EAAyB;EAAM;CAAQ;AACxD;AAEA,SAAS,aACP,MACA,SACiB;CACjB,OAAO;EAAE,MAAM;EAAiB;EAAM;CAAQ;AAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "constructa-generators",
3
- "version": "0.0.11",
3
+ "version": "0.1.0",
4
4
  "description": "Built-in primitive and composite generators for Constructa.",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "constructa-core": "0.4.0",
29
+ "constructa-core": "0.5.0",
30
30
  "constructa-schema": "2.2.0"
31
31
  },
32
32
  "devDependencies": {