@atscript/typescript 0.1.103 → 0.1.105
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 +5 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{json-schema-L8xJQiLc.cjs → json-schema-BN0B-fMO.cjs} +3 -0
- package/dist/{json-schema-BGYiqs-J.mjs → json-schema-DKgNpLpU.mjs} +3 -0
- package/dist/{plugin-2TNKdtc6.cjs → plugin-91-z7KE-.cjs} +3 -3
- package/dist/{plugin-BN6tnRsJ.mjs → plugin-GvSLmYJb.mjs} +3 -3
- package/dist/test-utils.cjs +1 -1
- package/dist/test-utils.mjs +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +7 -0
- package/dist/utils.mjs +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -1014,6 +1014,9 @@ function _define_property$4(obj, key, value) {
|
|
|
1014
1014
|
get path() {
|
|
1015
1015
|
return this.buildPath();
|
|
1016
1016
|
}
|
|
1017
|
+
/** The type this validator was created for (see {@link TValidatorPluginContext.root}). */ get root() {
|
|
1018
|
+
return this.def;
|
|
1019
|
+
}
|
|
1017
1020
|
validateAnnotatedType(def, value) {
|
|
1018
1021
|
switch (def.type.kind) {
|
|
1019
1022
|
case "":
|
|
@@ -2417,7 +2420,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
2417
2420
|
const refExpr = !!synth || (ownerDecl ? ownerDecl.doc !== this.doc : false) ? `() => ${refName}` : refName;
|
|
2418
2421
|
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${refExpr}${chain})`);
|
|
2419
2422
|
if (!ref.hasChain) {
|
|
2420
|
-
if (ownerDecl?.node) ownerDecl.doc.
|
|
2423
|
+
if (ownerDecl?.node) ownerDecl.doc.evalReferredAnnotations(ownerDecl.node)?.forEach((an) => {
|
|
2421
2424
|
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
2422
2425
|
});
|
|
2423
2426
|
}
|
|
@@ -2584,7 +2587,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
2584
2587
|
if (primitive) return primitive.annotations;
|
|
2585
2588
|
if (ref.hasChain) return;
|
|
2586
2589
|
const ownerDecl = this.resolveOwner(this.doc, ref.id);
|
|
2587
|
-
return ownerDecl?.node ? ownerDecl.doc.
|
|
2590
|
+
return ownerDecl?.node ? ownerDecl.doc.evalReferredAnnotations(ownerDecl.node) : void 0;
|
|
2588
2591
|
}
|
|
2589
2592
|
defineMetadata(node) {
|
|
2590
2593
|
let annotations;
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const require_plugin = require('./plugin-
|
|
2
|
+
const require_plugin = require('./plugin-91-z7KE-.cjs');
|
|
3
3
|
|
|
4
4
|
exports.default = require_plugin.tsPlugin;
|
|
5
5
|
exports.tsPlugin = require_plugin.tsPlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -346,6 +346,9 @@ function _define_property(obj, key, value) {
|
|
|
346
346
|
get path() {
|
|
347
347
|
return this.buildPath();
|
|
348
348
|
}
|
|
349
|
+
/** The type this validator was created for (see {@link TValidatorPluginContext.root}). */ get root() {
|
|
350
|
+
return this.def;
|
|
351
|
+
}
|
|
349
352
|
validateAnnotatedType(def, value) {
|
|
350
353
|
switch (def.type.kind) {
|
|
351
354
|
case "":
|
|
@@ -345,6 +345,9 @@ function _define_property(obj, key, value) {
|
|
|
345
345
|
get path() {
|
|
346
346
|
return this.buildPath();
|
|
347
347
|
}
|
|
348
|
+
/** The type this validator was created for (see {@link TValidatorPluginContext.root}). */ get root() {
|
|
349
|
+
return this.def;
|
|
350
|
+
}
|
|
348
351
|
validateAnnotatedType(def, value) {
|
|
349
352
|
switch (def.type.kind) {
|
|
350
353
|
case "":
|
|
@@ -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-
|
|
28
|
+
const require_json_schema = require('./json-schema-BN0B-fMO.cjs');
|
|
29
29
|
let path = require("path");
|
|
30
30
|
path = __toESM(path);
|
|
31
31
|
let _atscript_core = require("@atscript/core");
|
|
@@ -1171,7 +1171,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
1171
1171
|
const refExpr = !!synth || (ownerDecl ? ownerDecl.doc !== this.doc : false) ? `() => ${refName}` : refName;
|
|
1172
1172
|
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${refExpr}${chain})`);
|
|
1173
1173
|
if (!ref.hasChain) {
|
|
1174
|
-
if (ownerDecl?.node) ownerDecl.doc.
|
|
1174
|
+
if (ownerDecl?.node) ownerDecl.doc.evalReferredAnnotations(ownerDecl.node)?.forEach((an) => {
|
|
1175
1175
|
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
1176
1176
|
});
|
|
1177
1177
|
}
|
|
@@ -1338,7 +1338,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
1338
1338
|
if (primitive) return primitive.annotations;
|
|
1339
1339
|
if (ref.hasChain) return;
|
|
1340
1340
|
const ownerDecl = this.resolveOwner(this.doc, ref.id);
|
|
1341
|
-
return ownerDecl?.node ? ownerDecl.doc.
|
|
1341
|
+
return ownerDecl?.node ? ownerDecl.doc.evalReferredAnnotations(ownerDecl.node) : void 0;
|
|
1342
1342
|
}
|
|
1343
1343
|
defineMetadata(node) {
|
|
1344
1344
|
let annotations;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as defineAnnotatedType, t as buildJsonSchema } from "./json-schema-
|
|
1
|
+
import { l as defineAnnotatedType, t as buildJsonSchema } from "./json-schema-DKgNpLpU.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
|
|
|
@@ -1143,7 +1143,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
1143
1143
|
const refExpr = !!synth || (ownerDecl ? ownerDecl.doc !== this.doc : false) ? `() => ${refName}` : refName;
|
|
1144
1144
|
this.writeln(`$(${name ? `"", ${name}` : ""})`).indent().writeln(`.refTo(${refExpr}${chain})`);
|
|
1145
1145
|
if (!ref.hasChain) {
|
|
1146
|
-
if (ownerDecl?.node) ownerDecl.doc.
|
|
1146
|
+
if (ownerDecl?.node) ownerDecl.doc.evalReferredAnnotations(ownerDecl.node)?.forEach((an) => {
|
|
1147
1147
|
this.resolveAnnotationValue(ownerDecl.node, an);
|
|
1148
1148
|
});
|
|
1149
1149
|
}
|
|
@@ -1310,7 +1310,7 @@ var JsRenderer = class extends BaseRenderer {
|
|
|
1310
1310
|
if (primitive) return primitive.annotations;
|
|
1311
1311
|
if (ref.hasChain) return;
|
|
1312
1312
|
const ownerDecl = this.resolveOwner(this.doc, ref.id);
|
|
1313
|
-
return ownerDecl?.node ? ownerDecl.doc.
|
|
1313
|
+
return ownerDecl?.node ? ownerDecl.doc.evalReferredAnnotations(ownerDecl.node) : void 0;
|
|
1314
1314
|
}
|
|
1315
1315
|
defineMetadata(node) {
|
|
1316
1316
|
let annotations;
|
package/dist/test-utils.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_plugin = require('./plugin-
|
|
2
|
+
const require_plugin = require('./plugin-91-z7KE-.cjs');
|
|
3
3
|
let path = require("path");
|
|
4
4
|
path = require_plugin.__toESM(path);
|
|
5
5
|
let _atscript_core = require("@atscript/core");
|
package/dist/test-utils.mjs
CHANGED
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-
|
|
2
|
+
const require_json_schema = require('./json-schema-BN0B-fMO.cjs');
|
|
3
3
|
|
|
4
4
|
//#region packages/typescript/src/runtime/coerce.ts
|
|
5
5
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ interface TValidatorPluginContext {
|
|
|
25
25
|
validateAnnotatedType: Validator<any>['validateAnnotatedType'];
|
|
26
26
|
error: Validator<any>['error'];
|
|
27
27
|
path: Validator<any>['path'];
|
|
28
|
+
/**
|
|
29
|
+
* The type the validator was created for — the root of the walk, as passed to the
|
|
30
|
+
* constructor (before `replace`). The plugin's `def` argument is the node visited now.
|
|
31
|
+
*/
|
|
32
|
+
readonly root: TAtscriptAnnotatedType;
|
|
28
33
|
context: unknown;
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
@@ -89,6 +94,8 @@ declare class Validator<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedTyp
|
|
|
89
94
|
private get shortcuts();
|
|
90
95
|
protected validateSafe(def: TAtscriptAnnotatedType, value: any): boolean;
|
|
91
96
|
protected get path(): string;
|
|
97
|
+
/** The type this validator was created for (see {@link TValidatorPluginContext.root}). */
|
|
98
|
+
protected get root(): T;
|
|
92
99
|
protected validateAnnotatedType(def: TAtscriptAnnotatedType, value: any): boolean;
|
|
93
100
|
protected validateUnion(def: TAtscriptAnnotatedType<TAtscriptTypeComplex>, value: any): boolean;
|
|
94
101
|
/**
|
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-
|
|
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";
|
|
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.
|
|
3
|
+
"version": "0.1.105",
|
|
4
4
|
"description": "Atscript: typescript-gen support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@atscript/db": "^0.1.97",
|
|
76
|
-
"@atscript/core": "^0.1.
|
|
76
|
+
"@atscript/core": "^0.1.105"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@atscript/db": {
|