@atscript/typescript 0.1.93 → 0.1.95
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 +6 -4
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{json-schema-DXEiCfe1.cjs → json-schema-CZo482nY.cjs} +8 -5
- package/dist/{json-schema-DycaD0Rm.mjs → json-schema-Cka8ETxe.mjs} +8 -5
- package/dist/{plugin-C7I4ICoT.mjs → plugin-BDjZ2rOT.mjs} +1 -1
- package/dist/{plugin-B4kAIw0J.cjs → plugin-dcd-XTR-.cjs} +1 -1
- 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 +2 -2
- package/dist/utils.mjs +1 -1
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
|
@@ -1192,7 +1192,8 @@ function cloneTypeDef(type) {
|
|
|
1192
1192
|
const props = /* @__PURE__ */ new Map();
|
|
1193
1193
|
for (const [k, v] of obj.props) props.set(k, createAnnotatedTypeNode(v.type, new Map(v.metadata), {
|
|
1194
1194
|
id: v.id,
|
|
1195
|
-
optional: v.optional
|
|
1195
|
+
optional: v.optional,
|
|
1196
|
+
ref: v.ref
|
|
1196
1197
|
}));
|
|
1197
1198
|
return {
|
|
1198
1199
|
kind: "object",
|
|
@@ -1304,6 +1305,7 @@ function cloneTypeDef(type) {
|
|
|
1304
1305
|
},
|
|
1305
1306
|
refTo(type, chain) {
|
|
1306
1307
|
const node = this.$type;
|
|
1308
|
+
const field = chain ? chain.join(".") : "";
|
|
1307
1309
|
if (isAnnotatedType(type)) {
|
|
1308
1310
|
let newBase = type;
|
|
1309
1311
|
const typeName = type.name || "Unknown";
|
|
@@ -1317,16 +1319,16 @@ function cloneTypeDef(type) {
|
|
|
1317
1319
|
}
|
|
1318
1320
|
node.type = baseProvided ? cloneTypeDef(newBase.type) : newBase.type;
|
|
1319
1321
|
node.id = node.id ?? newBase.id;
|
|
1320
|
-
|
|
1322
|
+
node.ref = {
|
|
1321
1323
|
type: () => type,
|
|
1322
|
-
field
|
|
1324
|
+
field
|
|
1323
1325
|
};
|
|
1324
1326
|
} else if (typeof type === "function") {
|
|
1325
1327
|
const lazyType = type;
|
|
1326
1328
|
const ownId = node.id;
|
|
1327
1329
|
node.ref = {
|
|
1328
1330
|
type: lazyType,
|
|
1329
|
-
field
|
|
1331
|
+
field
|
|
1330
1332
|
};
|
|
1331
1333
|
const placeholder = node.type;
|
|
1332
1334
|
Object.defineProperty(node, "type", {
|
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-dcd-XTR-.cjs');
|
|
3
3
|
|
|
4
4
|
exports.default = require_plugin.tsPlugin;
|
|
5
5
|
exports.tsPlugin = require_plugin.tsPlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -530,7 +530,8 @@ const NON_PRIMITIVE_KINDS = new Set(["array", "object"]);
|
|
|
530
530
|
const clonedType = cloneTypeDef(existing.type);
|
|
531
531
|
objType.props.set(propName, createAnnotatedTypeNode(clonedType, new Map(existing.metadata), {
|
|
532
532
|
id: existing.id,
|
|
533
|
-
optional: existing.optional
|
|
533
|
+
optional: existing.optional,
|
|
534
|
+
ref: existing.ref
|
|
534
535
|
}));
|
|
535
536
|
}
|
|
536
537
|
function cloneTypeDef(type) {
|
|
@@ -539,7 +540,8 @@ function cloneTypeDef(type) {
|
|
|
539
540
|
const props = /* @__PURE__ */ new Map();
|
|
540
541
|
for (const [k, v] of obj.props) props.set(k, createAnnotatedTypeNode(v.type, new Map(v.metadata), {
|
|
541
542
|
id: v.id,
|
|
542
|
-
optional: v.optional
|
|
543
|
+
optional: v.optional,
|
|
544
|
+
ref: v.ref
|
|
543
545
|
}));
|
|
544
546
|
return {
|
|
545
547
|
kind: "object",
|
|
@@ -651,6 +653,7 @@ function cloneTypeDef(type) {
|
|
|
651
653
|
},
|
|
652
654
|
refTo(type, chain) {
|
|
653
655
|
const node = this.$type;
|
|
656
|
+
const field = chain ? chain.join(".") : "";
|
|
654
657
|
if (isAnnotatedType(type)) {
|
|
655
658
|
let newBase = type;
|
|
656
659
|
const typeName = type.name || "Unknown";
|
|
@@ -664,16 +667,16 @@ function cloneTypeDef(type) {
|
|
|
664
667
|
}
|
|
665
668
|
node.type = baseProvided ? cloneTypeDef(newBase.type) : newBase.type;
|
|
666
669
|
node.id = node.id ?? newBase.id;
|
|
667
|
-
|
|
670
|
+
node.ref = {
|
|
668
671
|
type: () => type,
|
|
669
|
-
field
|
|
672
|
+
field
|
|
670
673
|
};
|
|
671
674
|
} else if (typeof type === "function") {
|
|
672
675
|
const lazyType = type;
|
|
673
676
|
const ownId = node.id;
|
|
674
677
|
node.ref = {
|
|
675
678
|
type: lazyType,
|
|
676
|
-
field
|
|
679
|
+
field
|
|
677
680
|
};
|
|
678
681
|
const placeholder = node.type;
|
|
679
682
|
Object.defineProperty(node, "type", {
|
|
@@ -529,7 +529,8 @@ const NON_PRIMITIVE_KINDS = new Set(["array", "object"]);
|
|
|
529
529
|
const clonedType = cloneTypeDef(existing.type);
|
|
530
530
|
objType.props.set(propName, createAnnotatedTypeNode(clonedType, new Map(existing.metadata), {
|
|
531
531
|
id: existing.id,
|
|
532
|
-
optional: existing.optional
|
|
532
|
+
optional: existing.optional,
|
|
533
|
+
ref: existing.ref
|
|
533
534
|
}));
|
|
534
535
|
}
|
|
535
536
|
function cloneTypeDef(type) {
|
|
@@ -538,7 +539,8 @@ function cloneTypeDef(type) {
|
|
|
538
539
|
const props = /* @__PURE__ */ new Map();
|
|
539
540
|
for (const [k, v] of obj.props) props.set(k, createAnnotatedTypeNode(v.type, new Map(v.metadata), {
|
|
540
541
|
id: v.id,
|
|
541
|
-
optional: v.optional
|
|
542
|
+
optional: v.optional,
|
|
543
|
+
ref: v.ref
|
|
542
544
|
}));
|
|
543
545
|
return {
|
|
544
546
|
kind: "object",
|
|
@@ -650,6 +652,7 @@ function cloneTypeDef(type) {
|
|
|
650
652
|
},
|
|
651
653
|
refTo(type, chain) {
|
|
652
654
|
const node = this.$type;
|
|
655
|
+
const field = chain ? chain.join(".") : "";
|
|
653
656
|
if (isAnnotatedType(type)) {
|
|
654
657
|
let newBase = type;
|
|
655
658
|
const typeName = type.name || "Unknown";
|
|
@@ -663,16 +666,16 @@ function cloneTypeDef(type) {
|
|
|
663
666
|
}
|
|
664
667
|
node.type = baseProvided ? cloneTypeDef(newBase.type) : newBase.type;
|
|
665
668
|
node.id = node.id ?? newBase.id;
|
|
666
|
-
|
|
669
|
+
node.ref = {
|
|
667
670
|
type: () => type,
|
|
668
|
-
field
|
|
671
|
+
field
|
|
669
672
|
};
|
|
670
673
|
} else if (typeof type === "function") {
|
|
671
674
|
const lazyType = type;
|
|
672
675
|
const ownId = node.id;
|
|
673
676
|
node.ref = {
|
|
674
677
|
type: lazyType,
|
|
675
|
-
field
|
|
678
|
+
field
|
|
676
679
|
};
|
|
677
680
|
const placeholder = node.type;
|
|
678
681
|
Object.defineProperty(node, "type", {
|
|
@@ -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-Cka8ETxe.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
|
|
|
@@ -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-CZo482nY.cjs');
|
|
29
29
|
let path = require("path");
|
|
30
30
|
path = __toESM(path);
|
|
31
31
|
let _atscript_core = require("@atscript/core");
|
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-dcd-XTR-.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-CZo482nY.cjs');
|
|
3
3
|
|
|
4
4
|
//#region packages/typescript/src/runtime/coerce.ts
|
|
5
5
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -529,7 +529,7 @@ interface TSerializedAnnotatedTypeInner {
|
|
|
529
529
|
metadata: Record<string, unknown>;
|
|
530
530
|
optional?: boolean;
|
|
531
531
|
id?: string;
|
|
532
|
-
/** FK
|
|
532
|
+
/** Reference to another named type (chain/FK or plain); shallow `{ id, metadata }` target when `refDepth` has a `.5` fractional part. */
|
|
533
533
|
ref?: {
|
|
534
534
|
type: TSerializedAnnotatedTypeInner | TSerializedShallowRefTarget;
|
|
535
535
|
field: string;
|
|
@@ -598,7 +598,7 @@ interface TSerializeOptions {
|
|
|
598
598
|
value: unknown;
|
|
599
599
|
} | undefined | void;
|
|
600
600
|
/**
|
|
601
|
-
* How many levels of `.ref` (
|
|
601
|
+
* How many levels of `.ref` (references to other named types) to expand. `0` (default) strips refs; integer
|
|
602
602
|
* `N` expands N levels with full target bodies. A `.5` fractional part (e.g. `0.5`, `1.5`)
|
|
603
603
|
* emits a shallow `{ id, metadata }` at the tail level instead of the full body.
|
|
604
604
|
*/
|
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-Cka8ETxe.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.95",
|
|
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.95"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@atscript/db": {
|