@atscript/typescript 0.1.106 → 0.1.108

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.
@@ -1,11 +1,26 @@
1
1
  //#region packages/typescript/src/runtime/validator-fast-check.ts
2
+ function _define_property$1(obj, key, value) {
3
+ if (key in obj) Object.defineProperty(obj, key, {
4
+ value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ else obj[key] = value;
10
+ return obj;
11
+ }
2
12
  /**
3
13
  * Allocation-free boolean pre-check used by {@link Validator.validate} before the
4
14
  * error-collecting walk.
5
15
  *
6
- * It reads the type tree and metadata LIVE on every call (nothing derived from the
7
- * type is cached), so `annotate()` / `metadata.set()` / prop mutations made after a
8
- * validator was created are always honoured — the same as the full walk.
16
+ * Nodes are checked by the generic functions below, which read the type tree and metadata
17
+ * LIVE on every visit. Array items — the same type visited many times per call — go
18
+ * through a compiled {@link Plan} of the item type instead (cached per node, shared by every
19
+ * validator and option set). A plan snapshots what its node's check reads and re-verifies
20
+ * every snapshot against the live node lazily, once per call, right before first using it
21
+ * (rebuilding it when anything differs); constraint objects and pattern arrays are read
22
+ * live on every visit. Either way `annotate()` / `metadata.set()` / prop mutations made
23
+ * after a validator was created are always honoured — the same as the full walk.
9
24
  *
10
25
  * Result contract (relative to the full walk over the same node and value):
11
26
  * - `PASS` — the walk returns `true`, collects no errors and has no side effects.
@@ -21,10 +36,12 @@ const PASS = 1;
21
36
  const BAIL = 2;
22
37
  /** Node is at walk depth 0 (only object props / array & tuple items increase depth). */ const TOP = 1;
23
38
  /** Node is inside a union branch — failures must be exhaustive (see contract). */ const IN_UNION = 2;
39
+ /** Incremented per {@link fastCheckPasses} call; snapshots verified in older calls re-verify. */ let stamp = 0;
24
40
  /**
25
41
  * `true` only when the full walk over `value` is guaranteed to pass with no errors
26
42
  * and no side effects. Any other outcome (including a throw) means "run the walk".
27
43
  */ function fastCheckPasses(def, value, opts) {
44
+ stamp++;
28
45
  try {
29
46
  return fastCheck(def, value, TOP, opts) === PASS;
30
47
  } catch {
@@ -75,7 +92,7 @@ function fastCheck(def, value, flags, opts) {
75
92
  const branchFlags = flags | IN_UNION;
76
93
  for (const item of type.items) {
77
94
  const result = fastCheck(item, value, branchFlags, opts);
78
- if (result !== FAIL) return result === PASS && item.type.value === void 0 ? fastCheckUnionConstraints(def.metadata, value) : result;
95
+ if (result !== FAIL) return unionMatchResult(result, item, def.metadata, value);
79
96
  }
80
97
  return FAIL;
81
98
  }
@@ -115,6 +132,9 @@ function fastCheckFinal(def, value) {
115
132
  default: return BAIL;
116
133
  }
117
134
  }
135
+ /** Result of a union whose branch `item` did not fail (`PASS` or `BAIL`). */ function unionMatchResult(result, item, metadata, value) {
136
+ return result === PASS && item.type.value === void 0 ? fastCheckUnionConstraints(metadata, value) : result;
137
+ }
118
138
  /**
119
139
  * Mirrors Validator.validateUnionConstraints: union-level constraints on the matched value
120
140
  * (`null` / objects pass; the caller skips literal branches).
@@ -129,8 +149,7 @@ function fastCheckFinal(def, value) {
129
149
  }
130
150
  }
131
151
  function fastCheckBoolean(metadata, value) {
132
- if (metadata.size === 0) return PASS;
133
- return metadata.get("meta.required") && value !== true ? FAIL : PASS;
152
+ return metadata.size === 0 ? PASS : booleanConstraints(value, metadata.get("meta.required"));
134
153
  }
135
154
  function fastCheckString(metadata, value) {
136
155
  if (metadata.size === 0) return PASS;
@@ -150,13 +169,24 @@ function fastCheckString(metadata, value) {
150
169
  }
151
170
  function fastCheckNumber(metadata, value) {
152
171
  if (metadata.size === 0) return PASS;
153
- if (metadata.get("expect.int") && value % 1 !== 0) return FAIL;
154
- const min = metadata.get("expect.min");
172
+ return numberConstraints(value, metadata.get("expect.int"), metadata.get("expect.min"), metadata.get("expect.max"));
173
+ }
174
+ function booleanConstraints(value, required) {
175
+ return required && value !== true ? FAIL : PASS;
176
+ }
177
+ function numberConstraints(value, int, min, max) {
178
+ if (int && value % 1 !== 0) return FAIL;
155
179
  if (min !== void 0 && value < (typeof min === "number" ? min : min.minValue)) return FAIL;
156
- const max = metadata.get("expect.max");
157
180
  if (max !== void 0 && value > (typeof max === "number" ? max : max.maxValue)) return FAIL;
158
181
  return PASS;
159
182
  }
183
+ /** `@expect.minLength` / `@expect.maxLength` (strings and arrays). */ function lengthFails(length, minLength, maxLength) {
184
+ return minLength !== void 0 && length < (typeof minLength === "number" ? minLength : minLength.length) || maxLength !== void 0 && length > (typeof maxLength === "number" ? maxLength : maxLength.length);
185
+ }
186
+ /** Array constraints; duplicate detection (`uniqueItems`) is left to the walk. */ function arrayConstraints(length, minLength, maxLength, uniqueItems) {
187
+ if (lengthFails(length, minLength, maxLength)) return FAIL;
188
+ return uniqueItems ? BAIL : PASS;
189
+ }
160
190
  function fastCheckObject(def, value, flags, opts) {
161
191
  if (typeof value !== "object" || value === null || Array.isArray(value)) return FAIL;
162
192
  const type = def.type;
@@ -194,12 +224,14 @@ function fastCheckArray(def, value, flags, opts) {
194
224
  const result = fastCheckArrayConstraints(metadata, value);
195
225
  if (result !== PASS) return result;
196
226
  }
197
- const of = def.type.of;
227
+ return checkItems(planFor(def.type.of), value, flags, opts);
228
+ }
229
+ /** Checks every array item against the item type's plan. */ function checkItems(of, value, flags, opts) {
198
230
  const inUnion = (flags & IN_UNION) !== 0;
199
231
  const itemFlags = flags & IN_UNION;
200
232
  let result = PASS;
201
233
  for (const item of value) {
202
- const itemResult = fastCheck(of, item, itemFlags, opts);
234
+ const itemResult = checkPlan(of, item, itemFlags, opts);
203
235
  if (itemResult !== PASS) {
204
236
  if (itemResult === BAIL || !inUnion) return itemResult;
205
237
  result = FAIL;
@@ -208,11 +240,338 @@ function fastCheckArray(def, value, flags, opts) {
208
240
  return result;
209
241
  }
210
242
  function fastCheckArrayConstraints(metadata, value) {
211
- const minLength = metadata.get("expect.minLength");
212
- if (minLength !== void 0 && value.length < (typeof minLength === "number" ? minLength : minLength.length)) return FAIL;
213
- const maxLength = metadata.get("expect.maxLength");
214
- if (maxLength !== void 0 && value.length > (typeof maxLength === "number" ? maxLength : maxLength.length)) return FAIL;
215
- return metadata.get("expect.array.uniqueItems") ? BAIL : PASS;
243
+ return arrayConstraints(value.length, metadata.get("expect.minLength"), metadata.get("expect.maxLength"), metadata.get("expect.array.uniqueItems"));
244
+ }
245
+ const OP_GENERIC = 0;
246
+ const OP_PHANTOM = 1;
247
+ const OP_STRING = 2;
248
+ const OP_NUMBER = 3;
249
+ const OP_BOOLEAN = 4;
250
+ /** Any other final node: checked by {@link fastCheckFinal}. */ const OP_FINAL = 5;
251
+ const OP_OBJECT = 6;
252
+ const OP_ARRAY = 7;
253
+ const OP_UNION = 8;
254
+ function isFinalOp(op) {
255
+ return op !== OP_GENERIC && op <= OP_FINAL;
256
+ }
257
+ /** Shared placeholder for the per-kind arrays of plans that don't use them. */ const EMPTY = Object.freeze([]);
258
+ const plans = /* @__PURE__ */ new WeakMap();
259
+ /** One shape for every plan, so plan field access stays monomorphic. */ let Plan = class Plan {
260
+ constructor(def) {
261
+ _define_property$1(this, "def", void 0);
262
+ /** Call in which the node structure was last verified (`-1`: must rebuild). */ _define_property$1(this, "stamp", void 0);
263
+ /** Call in which the annotation values (`m0`–`m3`) were last verified. */ _define_property$1(this, "metaStamp", void 0);
264
+ _define_property$1(this, "op", void 0);
265
+ _define_property$1(this, "type", void 0);
266
+ _define_property$1(this, "optional", void 0);
267
+ _define_property$1(this, "metadata", void 0);
268
+ _define_property$1(this, "kind", void 0);
269
+ _define_property$1(this, "designType", void 0);
270
+ _define_property$1(this, "literal", void 0);
271
+ /** String plans: compiled `@expect.pattern` regexes by position (checked against the live entry). */ _define_property$1(this, "regexes", void 0);
272
+ /**
273
+ * Annotation keys the node's check reads, and their values (`undefined` when absent):
274
+ * string `meta.required, expect.minLength, maxLength, pattern`; number `expect.int, min,
275
+ * max`; boolean `meta.required`; array `expect.minLength, maxLength, array.uniqueItems`.
276
+ */ _define_property$1(this, "k0", void 0);
277
+ _define_property$1(this, "k1", void 0);
278
+ _define_property$1(this, "k2", void 0);
279
+ _define_property$1(this, "k3", void 0);
280
+ _define_property$1(this, "m0", void 0);
281
+ _define_property$1(this, "m1", void 0);
282
+ _define_property$1(this, "m2", void 0);
283
+ _define_property$1(this, "m3", void 0);
284
+ _define_property$1(this, "props", void 0);
285
+ _define_property$1(this, "propsPatterns", void 0);
286
+ _define_property$1(this, "keys", void 0);
287
+ /** Call in which `props.get(keys[i]) === nodes[i]` was last verified. */ _define_property$1(this, "edges", void 0);
288
+ /** Prop plans by key (the entries of `props`, verified per visit via `edges`). */ _define_property$1(this, "byKey", void 0);
289
+ _define_property$1(this, "nodes", void 0);
290
+ _define_property$1(this, "children", void 0);
291
+ _define_property$1(this, "of", void 0);
292
+ _define_property$1(this, "ofPlan", void 0);
293
+ _define_property$1(this, "items", void 0);
294
+ this.def = def;
295
+ this.stamp = -1;
296
+ this.metaStamp = -1;
297
+ this.op = OP_GENERIC;
298
+ this.type = void 0;
299
+ this.optional = void 0;
300
+ this.metadata = void 0;
301
+ this.kind = void 0;
302
+ this.designType = void 0;
303
+ this.literal = void 0;
304
+ this.regexes = EMPTY;
305
+ this.k0 = void 0;
306
+ this.k1 = void 0;
307
+ this.k2 = void 0;
308
+ this.k3 = void 0;
309
+ this.m0 = void 0;
310
+ this.m1 = void 0;
311
+ this.m2 = void 0;
312
+ this.m3 = void 0;
313
+ this.props = void 0;
314
+ this.propsPatterns = void 0;
315
+ this.keys = EMPTY;
316
+ this.edges = EMPTY;
317
+ this.byKey = void 0;
318
+ this.nodes = EMPTY;
319
+ this.children = EMPTY;
320
+ this.of = void 0;
321
+ this.ofPlan = void 0;
322
+ this.items = void 0;
323
+ }
324
+ };
325
+ function planFor(def) {
326
+ let plan = plans.get(def);
327
+ if (plan === void 0) {
328
+ plan = new Plan(def);
329
+ plans.set(def, plan);
330
+ }
331
+ return plan;
332
+ }
333
+ /** Brings the plan's structure up to date with its live node (once per call). */ function refresh(plan) {
334
+ if (!(isFinalOp(plan.op) ? verifyFinal(plan) : verify(plan))) build(plan);
335
+ plan.stamp = stamp;
336
+ }
337
+ /** Structure check for final ops; small enough to be inlined into the hot loops. */ function verifyFinal(plan) {
338
+ const def = plan.def;
339
+ const type = def.type;
340
+ return plan.stamp !== -1 && type === plan.type && def.optional === plan.optional && def.metadata === plan.metadata && type.kind === "" && type.designType === plan.designType && type.value === plan.literal;
341
+ }
342
+ /** Structure check for objects, arrays, unions and generic nodes. */ function verify(plan) {
343
+ if (plan.stamp === -1) return false;
344
+ const def = plan.def;
345
+ const type = def.type;
346
+ if (type !== plan.type || def.optional !== plan.optional || def.metadata !== plan.metadata || type.kind !== plan.kind) return false;
347
+ switch (plan.op) {
348
+ case OP_OBJECT: return type.props === plan.props && plan.props.size === plan.keys.length && type.propsPatterns === plan.propsPatterns && plan.propsPatterns.length === 0;
349
+ case OP_ARRAY: return type.of === plan.of;
350
+ case OP_UNION: {
351
+ const items = plan.items;
352
+ const nodes = plan.nodes;
353
+ if (type.items !== items || items.length !== nodes.length) return false;
354
+ for (let i = 0; i < nodes.length; i++) if (items[i] !== nodes[i]) return false;
355
+ return true;
356
+ }
357
+ default: return type.kind !== "object" || type.propsPatterns.length > 0;
358
+ }
359
+ }
360
+ /** Brings the annotation values up to date (once per call, when a constraint is read). */ function refreshMeta(plan) {
361
+ const metadata = plan.metadata;
362
+ if (!(metadata.size === 0 ? plan.m0 === void 0 && plan.m1 === void 0 && plan.m2 === void 0 && plan.m3 === void 0 : metadata.get(plan.k0) === plan.m0 && (plan.k1 === void 0 || metadata.get(plan.k1) === plan.m1) && (plan.k2 === void 0 || metadata.get(plan.k2) === plan.m2) && (plan.k3 === void 0 || metadata.get(plan.k3) === plan.m3))) snapshotMeta(plan);
363
+ plan.metaStamp = stamp;
364
+ }
365
+ function snapshotMeta(plan) {
366
+ const metadata = plan.metadata;
367
+ plan.m0 = metadata.get(plan.k0);
368
+ plan.m1 = metadata.get(plan.k1);
369
+ plan.m2 = metadata.get(plan.k2);
370
+ plan.m3 = metadata.get(plan.k3);
371
+ }
372
+ function setMetaKeys(plan, k0, k1, k2, k3) {
373
+ plan.k0 = k0;
374
+ plan.k1 = k1;
375
+ plan.k2 = k2;
376
+ plan.k3 = k3;
377
+ snapshotMeta(plan);
378
+ plan.metaStamp = stamp;
379
+ }
380
+ /** (Re)compiles `plan` from its live node. */ function build(plan) {
381
+ plan.stamp = -1;
382
+ plan.op = OP_GENERIC;
383
+ const def = plan.def;
384
+ const type = def.type;
385
+ plan.type = type;
386
+ plan.optional = def.optional;
387
+ plan.metadata = def.metadata;
388
+ plan.kind = type.kind;
389
+ plan.designType = type.designType;
390
+ plan.literal = type.value;
391
+ plan.regexes = EMPTY;
392
+ plan.props = void 0;
393
+ plan.propsPatterns = void 0;
394
+ plan.keys = EMPTY;
395
+ plan.edges = EMPTY;
396
+ plan.byKey = void 0;
397
+ plan.nodes = EMPTY;
398
+ plan.children = EMPTY;
399
+ plan.of = void 0;
400
+ plan.ofPlan = void 0;
401
+ plan.items = void 0;
402
+ setMetaKeys(plan, void 0, void 0, void 0, void 0);
403
+ switch (type.kind) {
404
+ case "":
405
+ if (type.designType === "phantom") plan.op = OP_PHANTOM;
406
+ else if (type.value !== void 0) plan.op = OP_FINAL;
407
+ else if (type.designType === "string") {
408
+ setMetaKeys(plan, "meta.required", "expect.minLength", "expect.maxLength", "expect.pattern");
409
+ plan.regexes = [];
410
+ plan.op = OP_STRING;
411
+ } else if (type.designType === "number") {
412
+ setMetaKeys(plan, "expect.int", "expect.min", "expect.max", void 0);
413
+ plan.op = OP_NUMBER;
414
+ } else if (type.designType === "boolean") {
415
+ setMetaKeys(plan, "meta.required", void 0, void 0, void 0);
416
+ plan.op = OP_BOOLEAN;
417
+ } else plan.op = OP_FINAL;
418
+ break;
419
+ case "object": {
420
+ if (type.propsPatterns.length > 0) break;
421
+ const byKey = /* @__PURE__ */ new Map();
422
+ plan.keys = [];
423
+ plan.edges = [];
424
+ plan.nodes = [];
425
+ plan.children = [];
426
+ for (const [key, node] of type.props) {
427
+ const child = planFor(node);
428
+ plan.keys.push(key);
429
+ plan.edges.push(stamp);
430
+ plan.nodes.push(node);
431
+ plan.children.push(child);
432
+ byKey.set(key, child);
433
+ }
434
+ plan.byKey = byKey;
435
+ plan.props = type.props;
436
+ plan.propsPatterns = type.propsPatterns;
437
+ plan.op = OP_OBJECT;
438
+ break;
439
+ }
440
+ case "array":
441
+ setMetaKeys(plan, "expect.minLength", "expect.maxLength", "expect.array.uniqueItems", void 0);
442
+ plan.of = type.of;
443
+ plan.ofPlan = planFor(type.of);
444
+ plan.op = OP_ARRAY;
445
+ break;
446
+ case "union":
447
+ plan.nodes = [];
448
+ plan.children = [];
449
+ for (const node of type.items) {
450
+ plan.nodes.push(node);
451
+ plan.children.push(planFor(node));
452
+ }
453
+ plan.items = type.items;
454
+ plan.op = OP_UNION;
455
+ break;
456
+ default:
457
+ }
458
+ }
459
+ /** Plan counterpart of {@link fastCheck}. */ function checkPlan(plan, value, flags, opts) {
460
+ if (plan.stamp !== stamp) refresh(plan);
461
+ if (plan.optional && (value === void 0 || value === null)) return value === null && rejectsNullAsRequired(plan.def) ? FAIL : PASS;
462
+ switch (plan.op) {
463
+ case OP_STRING: return typeof value === "string" ? checkString(plan, value) : FAIL;
464
+ case OP_NUMBER: return typeof value === "number" && Number.isFinite(value) ? checkNumber(plan, value) : FAIL;
465
+ case OP_OBJECT: return checkObject(plan, value, flags, opts);
466
+ case OP_ARRAY: return checkArray(plan, value, flags, opts);
467
+ case OP_UNION: {
468
+ const branchFlags = flags | IN_UNION;
469
+ for (const child of plan.children) {
470
+ const result = checkPlan(child, value, branchFlags, opts);
471
+ if (result !== FAIL) return unionMatchResult(result, child.def, plan.metadata, value);
472
+ }
473
+ return FAIL;
474
+ }
475
+ case OP_BOOLEAN:
476
+ if (typeof value !== "boolean") return FAIL;
477
+ if (plan.metaStamp !== stamp) refreshMeta(plan);
478
+ return booleanConstraints(value, plan.m0);
479
+ case OP_PHANTOM:
480
+ case OP_FINAL: return fastCheckFinal(plan.def, value);
481
+ default: return fastCheck(plan.def, value, flags, opts);
482
+ }
483
+ }
484
+ /** Plan counterpart of {@link fastCheckString}; constraint objects are read live. */ function checkString(plan, value) {
485
+ if (plan.metaStamp !== stamp) refreshMeta(plan);
486
+ if (plan.m0 && value.trim().length === 0) return FAIL;
487
+ if (lengthFails(value.length, plan.m1, plan.m2)) return FAIL;
488
+ const patterns = plan.m3;
489
+ if (patterns) {
490
+ if (!Array.isArray(patterns)) return fastCheckString(plan.metadata, value);
491
+ for (let i = 0; i < patterns.length; i++) {
492
+ const { pattern, flags } = patterns[i];
493
+ if (!pattern) continue;
494
+ let entry = plan.regexes[i];
495
+ if (entry === void 0 || entry.pattern !== pattern || entry.flags !== flags) {
496
+ const re = getRegex(pattern, flags);
497
+ entry = {
498
+ pattern,
499
+ flags,
500
+ re,
501
+ stateful: re.global || re.sticky
502
+ };
503
+ plan.regexes[i] = entry;
504
+ }
505
+ if (entry.stateful) return BAIL;
506
+ if (!entry.re.test(value)) return FAIL;
507
+ }
508
+ }
509
+ return PASS;
510
+ }
511
+ /** Plan counterpart of {@link fastCheckNumber}; constraint objects are read live. */ function checkNumber(plan, value) {
512
+ if (plan.metaStamp !== stamp) refreshMeta(plan);
513
+ return numberConstraints(value, plan.m0, plan.m1, plan.m2);
514
+ }
515
+ /** Plan counterpart of {@link fastCheckObject}. */ function checkObject(plan, value, flags, opts) {
516
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return FAIL;
517
+ const partial = opts.partial;
518
+ const skipUndefined = partial === "deep" || partial === true && (flags & TOP) !== 0;
519
+ const inUnion = (flags & IN_UNION) !== 0;
520
+ const propFlags = flags & IN_UNION;
521
+ const keys = plan.keys;
522
+ const children = plan.children;
523
+ const edges = plan.edges;
524
+ let result = PASS;
525
+ for (let i = 0; i < keys.length; i++) {
526
+ if (edges[i] !== stamp) {
527
+ if (plan.props.get(keys[i]) !== plan.nodes[i]) {
528
+ plan.stamp = -1;
529
+ return BAIL;
530
+ }
531
+ edges[i] = stamp;
532
+ }
533
+ const child = children[i];
534
+ if (child.stamp !== stamp) refresh(child);
535
+ const op = child.op;
536
+ if (op === OP_PHANTOM) continue;
537
+ const propValue = value[keys[i]];
538
+ if (propValue === void 0 && skipUndefined) continue;
539
+ if (typeof propValue === "string" && op === OP_STRING) {
540
+ const r = checkString(child, propValue);
541
+ if (r === PASS) continue;
542
+ if (r === BAIL || !inUnion) return r;
543
+ result = FAIL;
544
+ continue;
545
+ }
546
+ if (typeof propValue === "number" && op === OP_NUMBER) {
547
+ if (Number.isFinite(propValue) && checkNumber(child, propValue) === PASS) continue;
548
+ if (!inUnion) return FAIL;
549
+ result = FAIL;
550
+ continue;
551
+ }
552
+ const propResult = checkPlan(child, propValue, propFlags, opts);
553
+ if (propResult !== PASS) {
554
+ if (propResult === BAIL || !inUnion) return propResult;
555
+ result = FAIL;
556
+ }
557
+ }
558
+ if (result !== PASS) return result;
559
+ const unknownProps = opts.unknownProps;
560
+ if (unknownProps === "error" || unknownProps === "strip") {
561
+ const byKey = plan.byKey;
562
+ for (const key of Object.keys(value)) {
563
+ const known = byKey.get(key);
564
+ if (known === void 0 || known.op === OP_PHANTOM) return unknownProps === "error" ? FAIL : BAIL;
565
+ }
566
+ }
567
+ return PASS;
568
+ }
569
+ /** Plan counterpart of {@link fastCheckArray}. */ function checkArray(plan, value, flags, opts) {
570
+ if (!Array.isArray(value)) return FAIL;
571
+ if (plan.metaStamp !== stamp) refreshMeta(plan);
572
+ const result = arrayConstraints(value.length, plan.m0, plan.m1, plan.m2);
573
+ if (result !== PASS) return result;
574
+ return checkItems(plan.ofPlan, value, flags, opts);
216
575
  }
217
576
 
218
577
  //#endregion
@@ -563,7 +922,7 @@ function _define_property(obj, key, value) {
563
922
  validatePrimitive(def, value) {
564
923
  if (def.type.value !== void 0) {
565
924
  if (value !== def.type.value) {
566
- this.error(`Expected ${def.type.value}, got ${value}`);
925
+ this.error(`Expected ${def.type.value}, got ${printValue(value)}`);
567
926
  return false;
568
927
  }
569
928
  return true;
@@ -755,6 +1114,13 @@ function _define_property(obj, key, value) {
755
1114
  if (of) return of;
756
1115
  }
757
1116
  }
1117
+ /** `${value}` throws for symbols and null-prototype objects: `String()` handles symbols, the tag the rest. */ function printValue(value) {
1118
+ try {
1119
+ return String(value);
1120
+ } catch {
1121
+ return Object.prototype.toString.call(value);
1122
+ }
1123
+ }
758
1124
  /** Error thrown by {@link Validator.validate} when validation fails. Contains structured error details. */ var ValidatorError = class extends Error {
759
1125
  constructor(errors) {
760
1126
  super(`${errors[0].path ? errors[0].path + ": " : ""}${errors[0].message}`), _define_property(this, "errors", void 0), _define_property(this, "name", void 0), this.errors = errors, this.name = "Validation Error";
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- const require_json_schema = require('./json-schema-BN0B-fMO.cjs');
28
+ const require_json_schema = require('./json-schema-BqpH_eYJ.cjs');
29
29
  let path = require("path");
30
30
  path = __toESM(path);
31
31
  let _atscript_core = require("@atscript/core");
@@ -1,4 +1,4 @@
1
- import { l as defineAnnotatedType, t as buildJsonSchema } from "./json-schema-DKgNpLpU.mjs";
1
+ import { l as defineAnnotatedType, t as buildJsonSchema } from "./json-schema-BtZ_OIcu.mjs";
2
2
  import path from "path";
3
3
  import { DEFAULT_FORMAT, flattenInterfaceNode, getRelPath, hasNavPropAnnotation, isArray, isBareId, isBareSpecifier, isConst, isDbEntityNode, isGroup, isInterface, isPrimitive, isProp, isQueryLogical, isRef, isStructure } from "@atscript/core";
4
4
 
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_plugin = require('./plugin-91-z7KE-.cjs');
2
+ const require_plugin = require('./plugin-Cv2odCwI.cjs');
3
+ require('./json-schema-BqpH_eYJ.cjs');
3
4
  let path = require("path");
4
5
  path = require_plugin.__toESM(path);
5
6
  let _atscript_core = require("@atscript/core");
@@ -1,4 +1,5 @@
1
- import { t as tsPlugin } from "./plugin-GvSLmYJb.mjs";
1
+ import { t as tsPlugin } from "./plugin-DpfsG4O7.mjs";
2
+ import "./json-schema-BtZ_OIcu.mjs";
2
3
  import path from "path";
3
4
  import { build } from "@atscript/core";
4
5
  import { readFileSync, writeFileSync } from "fs";
package/dist/utils.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_json_schema = require('./json-schema-BN0B-fMO.cjs');
2
+ const require_json_schema = require('./json-schema-BqpH_eYJ.cjs');
3
3
 
4
4
  //#region packages/typescript/src/runtime/coerce.ts
5
5
  /**
package/dist/utils.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as forAnnotatedType, c as createAnnotatedTypeNode, d as isAnnotatedTypeOfPrimitive, f as isPhantomType, i as mergeJsonSchemas, l as defineAnnotatedType, m as ValidatorError, n as detectDiscriminator, o as annotate, p as Validator, r as fromJsonSchema, s as cloneRefProp, t as buildJsonSchema, u as isAnnotatedType } from "./json-schema-DKgNpLpU.mjs";
1
+ import { a as forAnnotatedType, c as createAnnotatedTypeNode, d as isAnnotatedTypeOfPrimitive, f as isPhantomType, i as mergeJsonSchemas, l as defineAnnotatedType, m as ValidatorError, n as detectDiscriminator, o as annotate, p as Validator, r as fromJsonSchema, s as cloneRefProp, t as buildJsonSchema, u as isAnnotatedType } from "./json-schema-BtZ_OIcu.mjs";
2
2
 
3
3
  //#region packages/typescript/src/runtime/coerce.ts
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/typescript",
3
- "version": "0.1.106",
3
+ "version": "0.1.108",
4
4
  "description": "Atscript: typescript-gen support.",
5
5
  "keywords": [
6
6
  "annotations",
@@ -63,17 +63,17 @@
63
63
  "./package.json": "./package.json"
64
64
  },
65
65
  "dependencies": {
66
- "@moostjs/event-cli": "^0.6.42",
67
- "moost": "^0.6.42"
66
+ "@moostjs/event-cli": "^0.6.52",
67
+ "moost": "^0.6.52"
68
68
  },
69
69
  "devDependencies": {
70
- "@atscript/db": "^0.1.128",
71
- "@uniqu/core": "^0.1.7",
70
+ "@atscript/db": "^0.1.159",
71
+ "@uniqu/core": "^0.1.15",
72
72
  "vitest": "3.2.7"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atscript/db": "^0.1.97",
76
- "@atscript/core": "^0.1.106"
75
+ "@atscript/db": "^0.1.159",
76
+ "@atscript/core": "^0.1.108"
77
77
  },
78
78
  "peerDependenciesMeta": {
79
79
  "@atscript/db": {