@atscript/typescript 0.1.107 → 0.1.109

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.
@@ -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-9OBvrg9D.cjs');
29
29
  let path = require("path");
30
30
  path = __toESM(path);
31
31
  let _atscript_core = require("@atscript/core");
@@ -686,6 +686,12 @@ const QUERY_OP_MAP = {
686
686
  "exists": "$exists",
687
687
  "not exists": "$exists"
688
688
  };
689
+ /** Value field of each number-bound annotation's object form. */ const NUMBER_BOUND_FIELDS = {
690
+ "expect.min": "minValue",
691
+ "expect.max": "maxValue",
692
+ "expect.exclusiveMin": "exclusiveMinValue",
693
+ "expect.exclusiveMax": "exclusiveMaxValue"
694
+ };
689
695
  const SYNTH_IMPORTS_MARKER = "/*@@atscript-synth-imports@@*/";
690
696
  var JsRenderer = class extends BaseRenderer {
691
697
  /**
@@ -1109,14 +1115,11 @@ var JsRenderer = class extends BaseRenderer {
1109
1115
  });
1110
1116
  break;
1111
1117
  case "expect.min":
1112
- if (a.args[0]) handle.annotate(a.name, {
1113
- minValue: Number(a.args[0].text),
1114
- message: a.args[1]?.text
1115
- });
1116
- break;
1117
1118
  case "expect.max":
1119
+ case "expect.exclusiveMin":
1120
+ case "expect.exclusiveMax":
1118
1121
  if (a.args[0]) handle.annotate(a.name, {
1119
- maxValue: Number(a.args[0].text),
1122
+ [NUMBER_BOUND_FIELDS[a.name]]: Number(a.args[0].text),
1120
1123
  message: a.args[1]?.text
1121
1124
  });
1122
1125
  break;
@@ -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-CioBVi6F.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
 
@@ -658,6 +658,12 @@ const QUERY_OP_MAP = {
658
658
  "exists": "$exists",
659
659
  "not exists": "$exists"
660
660
  };
661
+ /** Value field of each number-bound annotation's object form. */ const NUMBER_BOUND_FIELDS = {
662
+ "expect.min": "minValue",
663
+ "expect.max": "maxValue",
664
+ "expect.exclusiveMin": "exclusiveMinValue",
665
+ "expect.exclusiveMax": "exclusiveMaxValue"
666
+ };
661
667
  const SYNTH_IMPORTS_MARKER = "/*@@atscript-synth-imports@@*/";
662
668
  var JsRenderer = class extends BaseRenderer {
663
669
  /**
@@ -1081,14 +1087,11 @@ var JsRenderer = class extends BaseRenderer {
1081
1087
  });
1082
1088
  break;
1083
1089
  case "expect.min":
1084
- if (a.args[0]) handle.annotate(a.name, {
1085
- minValue: Number(a.args[0].text),
1086
- message: a.args[1]?.text
1087
- });
1088
- break;
1089
1090
  case "expect.max":
1091
+ case "expect.exclusiveMin":
1092
+ case "expect.exclusiveMax":
1090
1093
  if (a.args[0]) handle.annotate(a.name, {
1091
- maxValue: Number(a.args[0].text),
1094
+ [NUMBER_BOUND_FIELDS[a.name]]: Number(a.args[0].text),
1092
1095
  message: a.args[1]?.text
1093
1096
  });
1094
1097
  break;
@@ -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-6r27w6rG.cjs');
3
+ require('./json-schema-9OBvrg9D.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-D3_BnRrI.mjs";
2
+ import "./json-schema-CioBVi6F.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-9OBvrg9D.cjs');
3
3
 
4
4
  //#region packages/typescript/src/runtime/coerce.ts
5
5
  /**
package/dist/utils.d.ts CHANGED
@@ -115,8 +115,10 @@ declare class Validator<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedTyp
115
115
  /** `@meta.required` / `@expect.minLength` / `maxLength` / `pattern` checks for a string value. */
116
116
  protected validateStringConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: string): boolean;
117
117
  protected validateNumber(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: number): boolean;
118
- /** `@expect.int` / `min` / `max` checks for a number value. */
118
+ /** `@expect.int` / `min` / `max` / `exclusiveMin` / `exclusiveMax` checks for a number value. */
119
119
  protected validateNumberConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: number): boolean;
120
+ /** Reports a failed number bound: its custom message, else `Expected <label> <bound>, got <value>`. */
121
+ private numberBoundFailed;
120
122
  protected validateBoolean(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: boolean): boolean;
121
123
  /** `@meta.required` check for a boolean value (must be `true`). */
122
124
  protected validateBooleanConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: boolean): boolean;
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-CioBVi6F.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.107",
3
+ "version": "0.1.109",
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.52",
67
- "moost": "^0.6.52"
66
+ "@moostjs/event-cli": "^0.6.53",
67
+ "moost": "^0.6.53"
68
68
  },
69
69
  "devDependencies": {
70
- "@atscript/db": "^0.1.157",
70
+ "@atscript/db": "^0.1.161",
71
71
  "@uniqu/core": "^0.1.15",
72
72
  "vitest": "3.2.7"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atscript/db": "^0.1.157",
76
- "@atscript/core": "^0.1.107"
75
+ "@atscript/db": "^0.1.159",
76
+ "@atscript/core": "^0.1.109"
77
77
  },
78
78
  "peerDependenciesMeta": {
79
79
  "@atscript/db": {