@atscript/typescript 0.1.41 → 0.1.42
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/dist/cli.cjs +10 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{json-schema-CpCjWo9b.mjs → json-schema-Bl8jkrCj.mjs} +10 -1
- package/dist/{json-schema-CE9SaXaN.cjs → json-schema-Bu4xgpQn.cjs} +10 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.mjs +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -752,7 +752,14 @@ var Validator = class {
|
|
|
752
752
|
}
|
|
753
753
|
validateSafe(def, value) {
|
|
754
754
|
if (this.limitExceeded) return false;
|
|
755
|
-
if (this.hasReplace)
|
|
755
|
+
if (this.hasReplace) {
|
|
756
|
+
let replaced = this.replaceCache.get(def);
|
|
757
|
+
if (replaced === undefined) {
|
|
758
|
+
replaced = this.opts.replace(def, this.buildPath());
|
|
759
|
+
this.replaceCache.set(def, replaced);
|
|
760
|
+
}
|
|
761
|
+
def = replaced;
|
|
762
|
+
}
|
|
756
763
|
if (def.optional && (value === undefined || value === null)) return true;
|
|
757
764
|
if (this.hasPlugins) for (const plugin of this.opts.plugins) {
|
|
758
765
|
const result = plugin(this, def, value);
|
|
@@ -1099,6 +1106,7 @@ else {
|
|
|
1099
1106
|
_define_property$4(this, "opts", void 0);
|
|
1100
1107
|
_define_property$4(this, "hasPlugins", void 0);
|
|
1101
1108
|
_define_property$4(this, "hasReplace", void 0);
|
|
1109
|
+
_define_property$4(this, "replaceCache", void 0);
|
|
1102
1110
|
/** Validation errors collected during the last {@link validate} call. */ _define_property$4(this, "errors", void 0);
|
|
1103
1111
|
_define_property$4(this, "stackErrors", void 0);
|
|
1104
1112
|
_define_property$4(this, "pathSegments", void 0);
|
|
@@ -1120,6 +1128,7 @@ else {
|
|
|
1120
1128
|
};
|
|
1121
1129
|
this.hasPlugins = this.opts.plugins.length > 0;
|
|
1122
1130
|
this.hasReplace = typeof this.opts.replace === "function";
|
|
1131
|
+
if (this.hasReplace) this.replaceCache = new WeakMap();
|
|
1123
1132
|
}
|
|
1124
1133
|
};
|
|
1125
1134
|
var ValidatorError = class extends Error {
|
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
|
-
const require_json_schema = require('./json-schema-
|
|
26
|
+
const require_json_schema = require('./json-schema-Bu4xgpQn.cjs');
|
|
27
27
|
const path = __toESM(require("path"));
|
|
28
28
|
const __atscript_core = __toESM(require("@atscript/core"));
|
|
29
29
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildJsonSchema, defineAnnotatedType } from "./json-schema-
|
|
1
|
+
import { buildJsonSchema, defineAnnotatedType } from "./json-schema-Bl8jkrCj.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { DEFAULT_FORMAT, flattenInterfaceNode, hasNavPropAnnotation, isArray, isConst, isGroup, isInterface, isPrimitive, isQueryLogical, isRef, isStructure } from "@atscript/core";
|
|
4
4
|
|
|
@@ -76,7 +76,14 @@ var Validator = class {
|
|
|
76
76
|
}
|
|
77
77
|
validateSafe(def, value) {
|
|
78
78
|
if (this.limitExceeded) return false;
|
|
79
|
-
if (this.hasReplace)
|
|
79
|
+
if (this.hasReplace) {
|
|
80
|
+
let replaced = this.replaceCache.get(def);
|
|
81
|
+
if (replaced === undefined) {
|
|
82
|
+
replaced = this.opts.replace(def, this.buildPath());
|
|
83
|
+
this.replaceCache.set(def, replaced);
|
|
84
|
+
}
|
|
85
|
+
def = replaced;
|
|
86
|
+
}
|
|
80
87
|
if (def.optional && (value === undefined || value === null)) return true;
|
|
81
88
|
if (this.hasPlugins) for (const plugin of this.opts.plugins) {
|
|
82
89
|
const result = plugin(this, def, value);
|
|
@@ -423,6 +430,7 @@ else {
|
|
|
423
430
|
_define_property(this, "opts", void 0);
|
|
424
431
|
_define_property(this, "hasPlugins", void 0);
|
|
425
432
|
_define_property(this, "hasReplace", void 0);
|
|
433
|
+
_define_property(this, "replaceCache", void 0);
|
|
426
434
|
/** Validation errors collected during the last {@link validate} call. */ _define_property(this, "errors", void 0);
|
|
427
435
|
_define_property(this, "stackErrors", void 0);
|
|
428
436
|
_define_property(this, "pathSegments", void 0);
|
|
@@ -444,6 +452,7 @@ else {
|
|
|
444
452
|
};
|
|
445
453
|
this.hasPlugins = this.opts.plugins.length > 0;
|
|
446
454
|
this.hasReplace = typeof this.opts.replace === "function";
|
|
455
|
+
if (this.hasReplace) this.replaceCache = new WeakMap();
|
|
447
456
|
}
|
|
448
457
|
};
|
|
449
458
|
var ValidatorError = class extends Error {
|
|
@@ -77,7 +77,14 @@ var Validator = class {
|
|
|
77
77
|
}
|
|
78
78
|
validateSafe(def, value) {
|
|
79
79
|
if (this.limitExceeded) return false;
|
|
80
|
-
if (this.hasReplace)
|
|
80
|
+
if (this.hasReplace) {
|
|
81
|
+
let replaced = this.replaceCache.get(def);
|
|
82
|
+
if (replaced === undefined) {
|
|
83
|
+
replaced = this.opts.replace(def, this.buildPath());
|
|
84
|
+
this.replaceCache.set(def, replaced);
|
|
85
|
+
}
|
|
86
|
+
def = replaced;
|
|
87
|
+
}
|
|
81
88
|
if (def.optional && (value === undefined || value === null)) return true;
|
|
82
89
|
if (this.hasPlugins) for (const plugin of this.opts.plugins) {
|
|
83
90
|
const result = plugin(this, def, value);
|
|
@@ -424,6 +431,7 @@ else {
|
|
|
424
431
|
_define_property(this, "opts", void 0);
|
|
425
432
|
_define_property(this, "hasPlugins", void 0);
|
|
426
433
|
_define_property(this, "hasReplace", void 0);
|
|
434
|
+
_define_property(this, "replaceCache", void 0);
|
|
427
435
|
/** Validation errors collected during the last {@link validate} call. */ _define_property(this, "errors", void 0);
|
|
428
436
|
_define_property(this, "stackErrors", void 0);
|
|
429
437
|
_define_property(this, "pathSegments", void 0);
|
|
@@ -445,6 +453,7 @@ else {
|
|
|
445
453
|
};
|
|
446
454
|
this.hasPlugins = this.opts.plugins.length > 0;
|
|
447
455
|
this.hasReplace = typeof this.opts.replace === "function";
|
|
456
|
+
if (this.hasReplace) this.replaceCache = new WeakMap();
|
|
448
457
|
}
|
|
449
458
|
};
|
|
450
459
|
var ValidatorError = class extends Error {
|
package/dist/utils.cjs
CHANGED
package/dist/utils.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ declare class Validator<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedTyp
|
|
|
53
53
|
protected opts: TValidatorOptions;
|
|
54
54
|
protected hasPlugins: boolean;
|
|
55
55
|
protected hasReplace: boolean;
|
|
56
|
+
private replaceCache?;
|
|
56
57
|
constructor(def: T, opts?: Partial<TValidatorOptions>);
|
|
57
58
|
/** Validation errors collected during the last {@link validate} call. */
|
|
58
59
|
errors: TError[];
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Validator, ValidatorError, annotate, buildJsonSchema, cloneRefProp, createAnnotatedTypeNode, defineAnnotatedType, forAnnotatedType, fromJsonSchema, isAnnotatedType, isAnnotatedTypeOfPrimitive, isPhantomType, mergeJsonSchemas } from "./json-schema-
|
|
1
|
+
import { Validator, ValidatorError, annotate, buildJsonSchema, cloneRefProp, createAnnotatedTypeNode, defineAnnotatedType, forAnnotatedType, fromJsonSchema, isAnnotatedType, isAnnotatedTypeOfPrimitive, isPhantomType, mergeJsonSchemas } from "./json-schema-Bl8jkrCj.mjs";
|
|
2
2
|
|
|
3
3
|
//#region packages/typescript/src/runtime/default-value.ts
|
|
4
4
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/typescript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"description": "Atscript: typescript-gen support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@atscript/db": "^0.1.41",
|
|
69
|
-
"@atscript/core": "^0.1.
|
|
69
|
+
"@atscript/core": "^0.1.42"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"@atscript/db": {
|