@powerlines/deepkit 0.5.1 → 0.5.3
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/capnp.cjs +49 -48
- package/dist/capnp.js +4 -3
- package/dist/{chunk-U5O6DHJ2.js → chunk-35PNVYKI.js} +4 -4
- package/dist/chunk-3GQAWCBQ.js +10 -0
- package/dist/{chunk-PKLLVKY2.cjs → chunk-3GRTJOID.cjs} +9 -9
- package/dist/{chunk-ESVH44QW.cjs → chunk-3PKIT7K2.cjs} +4 -4
- package/dist/{chunk-MEMIQ5AA.js → chunk-47WBQTA6.js} +1 -1
- package/dist/chunk-4UQ4UDET.cjs +19685 -0
- package/dist/{chunk-VMRRVNO2.cjs → chunk-B47NLUDW.cjs} +2 -2
- package/dist/chunk-BGYQAVKQ.cjs +13 -0
- package/dist/chunk-F5QUFY7D.cjs +135 -0
- package/dist/{chunk-4V4LIAN2.js → chunk-GVS5O43Z.js} +2 -2
- package/dist/{chunk-YQQIT5YX.js → chunk-JSH5MVQG.js} +2 -2
- package/dist/{chunk-VWKKT7CM.cjs → chunk-KDKCOXXC.cjs} +5 -5
- package/dist/chunk-KWUXT6EF.js +127 -0
- package/dist/{chunk-J2FVIV7W.cjs → chunk-MSO7PT57.cjs} +126 -126
- package/dist/chunk-O2LKJ62Q.cjs +2863 -0
- package/dist/chunk-U7WEV6HK.js +19678 -0
- package/dist/chunk-W423FBJ2.js +2854 -0
- package/dist/{chunk-I5CVIT7W.js → chunk-XI47ZADG.js} +42 -42
- package/dist/chunk-XU55W26B.js +109 -0
- package/dist/esbuild-plugin.cjs +6 -5
- package/dist/esbuild-plugin.js +5 -4
- package/dist/index.cjs +68 -67
- package/dist/index.js +10 -9
- package/dist/reflect-type.cjs +8 -7
- package/dist/reflect-type.js +7 -6
- package/dist/resolve-reflections.cjs +3 -3
- package/dist/resolve-reflections.js +2 -2
- package/dist/transformer.cjs +5 -4
- package/dist/transformer.js +3 -2
- package/dist/transpile.cjs +5 -4
- package/dist/transpile.js +4 -3
- package/dist/utilities.cjs +11 -10
- package/dist/utilities.js +4 -3
- package/dist/vendor/chunk-5BKT4CS5.js +28 -0
- package/dist/vendor/{chunk-ZDFKNN7Y.cjs → chunk-BDXVTHBY.cjs} +322 -153
- package/dist/vendor/{chunk-7LAB3COT.js → chunk-BLN7QVCP.js} +154 -7
- package/dist/vendor/chunk-EQXMWOHO.cjs +115 -0
- package/dist/vendor/chunk-MO4O4UYI.cjs +42 -0
- package/dist/vendor/core.cjs +131 -130
- package/dist/vendor/core.js +2 -2
- package/dist/vendor/index.cjs +28 -0
- package/dist/vendor/index.d.cts +2 -0
- package/dist/vendor/index.d.ts +2 -0
- package/dist/vendor/index.js +1 -0
- package/dist/vendor/type-spec.cjs +6 -5
- package/dist/vendor/type-spec.js +1 -1
- package/dist/vendor/type.cjs +2346 -641
- package/dist/vendor/type.js +1661 -23
- package/package.json +5 -5
- package/dist/chunk-7J3ZDT6O.cjs +0 -30
- package/dist/chunk-B6GTAZEL.js +0 -37
- package/dist/chunk-FFBZWTR7.cjs +0 -63
- package/dist/chunk-GRNJVY7I.cjs +0 -19
- package/dist/chunk-IRPJW6HH.js +0 -16
- package/dist/chunk-J4SVRFV4.js +0 -127
- package/dist/chunk-QLKLDV3V.cjs +0 -135
- package/dist/chunk-XGQQM64U.js +0 -8
- package/dist/vendor/chunk-SHUYVCID.js +0 -4
- package/dist/vendor/chunk-USNT2KNT.cjs +0 -6
- /package/dist/{vendor/chunk-5NPGWGPO.cjs → chunk-5NPGWGPO.cjs} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/deepkit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -119,13 +119,13 @@
|
|
|
119
119
|
"@storm-software/config-tools": "^1.188.73",
|
|
120
120
|
"@stryke/capnp": "^0.12.51",
|
|
121
121
|
"@stryke/fs": "^0.33.26",
|
|
122
|
-
"@stryke/path": "^0.
|
|
122
|
+
"@stryke/path": "^0.24.0",
|
|
123
123
|
"@stryke/type-checks": "^0.5.14",
|
|
124
124
|
"@stryke/types": "^0.10.28",
|
|
125
125
|
"chalk": "5.6.2",
|
|
126
126
|
"defu": "^6.1.4",
|
|
127
127
|
"jiti": "^2.6.1",
|
|
128
|
-
"powerlines": "^0.34.
|
|
128
|
+
"powerlines": "^0.34.9",
|
|
129
129
|
"typescript": "^5.9.3",
|
|
130
130
|
"unplugin": "3.0.0-beta.3"
|
|
131
131
|
},
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
"@deepkit/type": "1.0.5",
|
|
135
135
|
"@deepkit/type-compiler": "1.0.5",
|
|
136
136
|
"@deepkit/type-spec": "1.0.1",
|
|
137
|
-
"@powerlines/nx": "^0.11.
|
|
137
|
+
"@powerlines/nx": "^0.11.22",
|
|
138
138
|
"@types/node": "^24.10.4",
|
|
139
139
|
"dts-bundle-generator": "^9.5.1",
|
|
140
140
|
"tsup": "8.4.0",
|
|
141
141
|
"esbuild": "^0.25.12"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": { "access": "public" },
|
|
144
|
-
"gitHead": "
|
|
144
|
+
"gitHead": "f7af737805bba3f9c2d5dd4008f0574b0a15cdf8"
|
|
145
145
|
}
|
package/dist/chunk-7J3ZDT6O.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkGRNJVY7I_cjs = require('./chunk-GRNJVY7I.cjs');
|
|
4
|
-
var type_star = require('@deepkit/type');
|
|
5
|
-
|
|
6
|
-
function _interopNamespace(e) {
|
|
7
|
-
if (e && e.__esModule) return e;
|
|
8
|
-
var n = Object.create(null);
|
|
9
|
-
if (e) {
|
|
10
|
-
Object.keys(e).forEach(function (k) {
|
|
11
|
-
if (k !== 'default') {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () { return e[k]; }
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
var type_star__namespace = /*#__PURE__*/_interopNamespace(type_star);
|
|
25
|
-
|
|
26
|
-
// src/vendor/type.ts
|
|
27
|
-
var type_exports = {};
|
|
28
|
-
chunkGRNJVY7I_cjs.__reExport(type_exports, type_star__namespace);
|
|
29
|
-
|
|
30
|
-
exports.type_exports = type_exports;
|
package/dist/chunk-B6GTAZEL.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { __reExport, __name } from './chunk-IRPJW6HH.js';
|
|
2
|
-
import * as type_compiler_star from '@deepkit/type-compiler';
|
|
3
|
-
import defu from 'defu';
|
|
4
|
-
|
|
5
|
-
// src/vendor/type-compiler/index.ts
|
|
6
|
-
var type_compiler_exports = {};
|
|
7
|
-
__reExport(type_compiler_exports, type_compiler_star);
|
|
8
|
-
var cache = new type_compiler_exports.Cache();
|
|
9
|
-
function createTransformer(context, options = {}) {
|
|
10
|
-
return /* @__PURE__ */ __name(function transformer(ctx) {
|
|
11
|
-
cache.tick();
|
|
12
|
-
return new type_compiler_exports.ReflectionTransformer(ctx, cache).withReflection(defu(options, {
|
|
13
|
-
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
14
|
-
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
15
|
-
}, {
|
|
16
|
-
exclude: [],
|
|
17
|
-
reflection: "default",
|
|
18
|
-
reflectionLevel: "minimal"
|
|
19
|
-
}));
|
|
20
|
-
}, "transformer");
|
|
21
|
-
}
|
|
22
|
-
__name(createTransformer, "createTransformer");
|
|
23
|
-
function createDeclarationTransformer(context, options = {}) {
|
|
24
|
-
return /* @__PURE__ */ __name(function declarationTransformer(ctx) {
|
|
25
|
-
return new type_compiler_exports.DeclarationTransformer(ctx, cache).withReflection(defu(options, {
|
|
26
|
-
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
27
|
-
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
28
|
-
}, {
|
|
29
|
-
exclude: [],
|
|
30
|
-
reflection: "default",
|
|
31
|
-
reflectionLevel: "minimal"
|
|
32
|
-
}));
|
|
33
|
-
}, "declarationTransformer");
|
|
34
|
-
}
|
|
35
|
-
__name(createDeclarationTransformer, "createDeclarationTransformer");
|
|
36
|
-
|
|
37
|
-
export { createDeclarationTransformer, createTransformer };
|
package/dist/chunk-FFBZWTR7.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkGRNJVY7I_cjs = require('./chunk-GRNJVY7I.cjs');
|
|
4
|
-
var type_compiler_star = require('@deepkit/type-compiler');
|
|
5
|
-
var defu = require('defu');
|
|
6
|
-
|
|
7
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return e[k]; }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
n.default = e;
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var type_compiler_star__namespace = /*#__PURE__*/_interopNamespace(type_compiler_star);
|
|
28
|
-
var defu__default = /*#__PURE__*/_interopDefault(defu);
|
|
29
|
-
|
|
30
|
-
// src/vendor/type-compiler/index.ts
|
|
31
|
-
var type_compiler_exports = {};
|
|
32
|
-
chunkGRNJVY7I_cjs.__reExport(type_compiler_exports, type_compiler_star__namespace);
|
|
33
|
-
var cache = new type_compiler_exports.Cache();
|
|
34
|
-
function createTransformer(context, options = {}) {
|
|
35
|
-
return /* @__PURE__ */ chunkGRNJVY7I_cjs.__name(function transformer(ctx) {
|
|
36
|
-
cache.tick();
|
|
37
|
-
return new type_compiler_exports.ReflectionTransformer(ctx, cache).withReflection(defu__default.default(options, {
|
|
38
|
-
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
39
|
-
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
40
|
-
}, {
|
|
41
|
-
exclude: [],
|
|
42
|
-
reflection: "default",
|
|
43
|
-
reflectionLevel: "minimal"
|
|
44
|
-
}));
|
|
45
|
-
}, "transformer");
|
|
46
|
-
}
|
|
47
|
-
chunkGRNJVY7I_cjs.__name(createTransformer, "createTransformer");
|
|
48
|
-
function createDeclarationTransformer(context, options = {}) {
|
|
49
|
-
return /* @__PURE__ */ chunkGRNJVY7I_cjs.__name(function declarationTransformer(ctx) {
|
|
50
|
-
return new type_compiler_exports.DeclarationTransformer(ctx, cache).withReflection(defu__default.default(options, {
|
|
51
|
-
reflection: context.tsconfig.tsconfigJson.compilerOptions?.reflection || context.tsconfig.tsconfigJson.reflection,
|
|
52
|
-
reflectionLevel: context.tsconfig.tsconfigJson.compilerOptions?.reflectionLevel || context.tsconfig.tsconfigJson.reflectionLevel
|
|
53
|
-
}, {
|
|
54
|
-
exclude: [],
|
|
55
|
-
reflection: "default",
|
|
56
|
-
reflectionLevel: "minimal"
|
|
57
|
-
}));
|
|
58
|
-
}, "declarationTransformer");
|
|
59
|
-
}
|
|
60
|
-
chunkGRNJVY7I_cjs.__name(createDeclarationTransformer, "createDeclarationTransformer");
|
|
61
|
-
|
|
62
|
-
exports.createDeclarationTransformer = createDeclarationTransformer;
|
|
63
|
-
exports.createTransformer = createTransformer;
|
package/dist/chunk-GRNJVY7I.cjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
-
|
|
18
|
-
exports.__name = __name;
|
|
19
|
-
exports.__reExport = __reExport;
|
package/dist/chunk-IRPJW6HH.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
|
|
16
|
-
export { __name, __reExport };
|
package/dist/chunk-J4SVRFV4.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { type_exports } from './chunk-XGQQM64U.js';
|
|
2
|
-
import { __name } from './chunk-IRPJW6HH.js';
|
|
3
|
-
import { getUniqueBy } from '@stryke/helpers/get-unique';
|
|
4
|
-
import { StormJSON } from '@stryke/json/storm-json';
|
|
5
|
-
import { isNull } from '@stryke/type-checks/is-null';
|
|
6
|
-
import { isString } from '@stryke/type-checks/is-string';
|
|
7
|
-
import { isUndefined } from '@stryke/type-checks/is-undefined';
|
|
8
|
-
|
|
9
|
-
function stringifyDefaultValue(property, value) {
|
|
10
|
-
return stringifyValue(property.type, value ?? property.getDefaultValue());
|
|
11
|
-
}
|
|
12
|
-
__name(stringifyDefaultValue, "stringifyDefaultValue");
|
|
13
|
-
function stringifyStringValue(value) {
|
|
14
|
-
return `"${String(value).replaceAll('"', '\\"')}"`;
|
|
15
|
-
}
|
|
16
|
-
__name(stringifyStringValue, "stringifyStringValue");
|
|
17
|
-
function stringifyValue(type, value) {
|
|
18
|
-
return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type.kind === type_exports.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === type_exports.ReflectionKind.string || type.kind === type_exports.ReflectionKind.literal && isString(type.literal) ? stringifyStringValue(value) : type.kind === type_exports.ReflectionKind.enum ? getEnumReflectionType(type).kind === type_exports.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === type_exports.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === type_exports.ReflectionKind.array ? stringifyStringValue(StormJSON.stringify(value)) : type.kind === type_exports.ReflectionKind.object || type.kind === type_exports.ReflectionKind.objectLiteral ? StormJSON.stringify(value) : type.kind === type_exports.ReflectionKind.property || type.kind === type_exports.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
19
|
-
}
|
|
20
|
-
__name(stringifyValue, "stringifyValue");
|
|
21
|
-
function getEnumReflectionType(type) {
|
|
22
|
-
if (type.kind !== type_exports.ReflectionKind.enum) {
|
|
23
|
-
throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
24
|
-
}
|
|
25
|
-
const unique = getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString(enumMember) ? {
|
|
26
|
-
kind: type_exports.ReflectionKind.string
|
|
27
|
-
} : {
|
|
28
|
-
kind: type_exports.ReflectionKind.number
|
|
29
|
-
});
|
|
30
|
-
if (unique.length === 0) {
|
|
31
|
-
throw new Error(`No valid enum members could be found.`);
|
|
32
|
-
}
|
|
33
|
-
return unique[0] && isString(unique[0]) ? {
|
|
34
|
-
kind: type_exports.ReflectionKind.string
|
|
35
|
-
} : {
|
|
36
|
-
kind: type_exports.ReflectionKind.number
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
__name(getEnumReflectionType, "getEnumReflectionType");
|
|
40
|
-
function getUnionTypes(type) {
|
|
41
|
-
if (type.kind === type_exports.ReflectionKind.union && type.types.length > 0) {
|
|
42
|
-
return getUniqueBy(type.types, (member) => member.kind);
|
|
43
|
-
}
|
|
44
|
-
throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
|
|
45
|
-
}
|
|
46
|
-
__name(getUnionTypes, "getUnionTypes");
|
|
47
|
-
function isStringUnion(type) {
|
|
48
|
-
return getUnionTypes(type).some((member) => member.kind === type_exports.ReflectionKind.string || member.kind === type_exports.ReflectionKind.literal && isString(member.literal));
|
|
49
|
-
}
|
|
50
|
-
__name(isStringUnion, "isStringUnion");
|
|
51
|
-
function kindToName(kind) {
|
|
52
|
-
if (kind === type_exports.ReflectionKind.void) {
|
|
53
|
-
return "void";
|
|
54
|
-
} else if (kind === type_exports.ReflectionKind.never) {
|
|
55
|
-
return "never";
|
|
56
|
-
} else if (kind === type_exports.ReflectionKind.null) {
|
|
57
|
-
return "null";
|
|
58
|
-
} else if (kind === type_exports.ReflectionKind.undefined) {
|
|
59
|
-
return "undefined";
|
|
60
|
-
} else if (kind === type_exports.ReflectionKind.symbol) {
|
|
61
|
-
return "symbol";
|
|
62
|
-
} else if (kind === type_exports.ReflectionKind.bigint) {
|
|
63
|
-
return "bigint";
|
|
64
|
-
} else if (kind === type_exports.ReflectionKind.number) {
|
|
65
|
-
return "number";
|
|
66
|
-
} else if (kind === type_exports.ReflectionKind.string) {
|
|
67
|
-
return "string";
|
|
68
|
-
} else if (kind === type_exports.ReflectionKind.boolean) {
|
|
69
|
-
return "boolean";
|
|
70
|
-
} else if (kind === type_exports.ReflectionKind.literal) {
|
|
71
|
-
return "literal";
|
|
72
|
-
} else if (kind === type_exports.ReflectionKind.class) {
|
|
73
|
-
return "class";
|
|
74
|
-
} else if (kind === type_exports.ReflectionKind.array) {
|
|
75
|
-
return "array";
|
|
76
|
-
} else if (kind === type_exports.ReflectionKind.object) {
|
|
77
|
-
return "object";
|
|
78
|
-
} else if (kind === type_exports.ReflectionKind.objectLiteral) {
|
|
79
|
-
return "objectLiteral";
|
|
80
|
-
} else if (kind === type_exports.ReflectionKind.union) {
|
|
81
|
-
return "union";
|
|
82
|
-
} else if (kind === type_exports.ReflectionKind.enum) {
|
|
83
|
-
return "enum";
|
|
84
|
-
} else if (kind === type_exports.ReflectionKind.regexp) {
|
|
85
|
-
return "regexp";
|
|
86
|
-
} else if (kind === type_exports.ReflectionKind.templateLiteral) {
|
|
87
|
-
return "templateLiteral";
|
|
88
|
-
} else if (kind === type_exports.ReflectionKind.property) {
|
|
89
|
-
return "property";
|
|
90
|
-
} else if (kind === type_exports.ReflectionKind.method) {
|
|
91
|
-
return "method";
|
|
92
|
-
} else if (kind === type_exports.ReflectionKind.function) {
|
|
93
|
-
return "function";
|
|
94
|
-
} else if (kind === type_exports.ReflectionKind.parameter) {
|
|
95
|
-
return "parameter";
|
|
96
|
-
} else if (kind === type_exports.ReflectionKind.promise) {
|
|
97
|
-
return "promise";
|
|
98
|
-
} else if (kind === type_exports.ReflectionKind.typeParameter) {
|
|
99
|
-
return "typeParameter";
|
|
100
|
-
} else if (kind === type_exports.ReflectionKind.tuple) {
|
|
101
|
-
return "tuple";
|
|
102
|
-
} else if (kind === type_exports.ReflectionKind.tupleMember) {
|
|
103
|
-
return "tupleMember";
|
|
104
|
-
} else if (kind === type_exports.ReflectionKind.enumMember) {
|
|
105
|
-
return "enumMember";
|
|
106
|
-
} else if (kind === type_exports.ReflectionKind.rest) {
|
|
107
|
-
return "rest";
|
|
108
|
-
} else if (kind === type_exports.ReflectionKind.indexSignature) {
|
|
109
|
-
return "indexSignature";
|
|
110
|
-
} else if (kind === type_exports.ReflectionKind.propertySignature) {
|
|
111
|
-
return "propertySignature";
|
|
112
|
-
} else if (kind === type_exports.ReflectionKind.methodSignature) {
|
|
113
|
-
return "methodSignature";
|
|
114
|
-
} else if (kind === type_exports.ReflectionKind.infer) {
|
|
115
|
-
return "infer";
|
|
116
|
-
} else if (kind === type_exports.ReflectionKind.callSignature) {
|
|
117
|
-
return "callSignature";
|
|
118
|
-
} else if (kind === type_exports.ReflectionKind.any) {
|
|
119
|
-
return "any";
|
|
120
|
-
} else if (kind === type_exports.ReflectionKind.intersection) {
|
|
121
|
-
return "intersection";
|
|
122
|
-
}
|
|
123
|
-
return "unknown";
|
|
124
|
-
}
|
|
125
|
-
__name(kindToName, "kindToName");
|
|
126
|
-
|
|
127
|
-
export { getEnumReflectionType, getUnionTypes, isStringUnion, kindToName, stringifyDefaultValue, stringifyStringValue, stringifyValue };
|
package/dist/chunk-QLKLDV3V.cjs
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk7J3ZDT6O_cjs = require('./chunk-7J3ZDT6O.cjs');
|
|
4
|
-
var chunkGRNJVY7I_cjs = require('./chunk-GRNJVY7I.cjs');
|
|
5
|
-
var getUnique = require('@stryke/helpers/get-unique');
|
|
6
|
-
var stormJson = require('@stryke/json/storm-json');
|
|
7
|
-
var isNull = require('@stryke/type-checks/is-null');
|
|
8
|
-
var isString = require('@stryke/type-checks/is-string');
|
|
9
|
-
var isUndefined = require('@stryke/type-checks/is-undefined');
|
|
10
|
-
|
|
11
|
-
function stringifyDefaultValue(property, value) {
|
|
12
|
-
return stringifyValue(property.type, value ?? property.getDefaultValue());
|
|
13
|
-
}
|
|
14
|
-
chunkGRNJVY7I_cjs.__name(stringifyDefaultValue, "stringifyDefaultValue");
|
|
15
|
-
function stringifyStringValue(value) {
|
|
16
|
-
return `"${String(value).replaceAll('"', '\\"')}"`;
|
|
17
|
-
}
|
|
18
|
-
chunkGRNJVY7I_cjs.__name(stringifyStringValue, "stringifyStringValue");
|
|
19
|
-
function stringifyValue(type, value) {
|
|
20
|
-
return isUndefined.isUndefined(value) ? "undefined" : isNull.isNull(value) ? "null" : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.boolean ? String(value).trim().toLowerCase() === "true" ? "true" : "false" : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string || type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.literal && isString.isString(type.literal) ? stringifyStringValue(value) : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.enum ? getEnumReflectionType(type).kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string ? stringifyStringValue(value) : `${String(value)}` : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.union ? isStringUnion(type) ? stringifyStringValue(value) : `${String(value)}` : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.array ? stringifyStringValue(stormJson.StormJSON.stringify(value)) : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.object || type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.objectLiteral ? stormJson.StormJSON.stringify(value) : type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.property || type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.parameter ? stringifyValue(type.type, value) : String(value);
|
|
21
|
-
}
|
|
22
|
-
chunkGRNJVY7I_cjs.__name(stringifyValue, "stringifyValue");
|
|
23
|
-
function getEnumReflectionType(type) {
|
|
24
|
-
if (type.kind !== chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.enum) {
|
|
25
|
-
throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);
|
|
26
|
-
}
|
|
27
|
-
const unique = getUnique.getUniqueBy(type.values.filter((value) => value !== void 0 && value !== null), (enumMember) => isString.isString(enumMember) ? {
|
|
28
|
-
kind: chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string
|
|
29
|
-
} : {
|
|
30
|
-
kind: chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.number
|
|
31
|
-
});
|
|
32
|
-
if (unique.length === 0) {
|
|
33
|
-
throw new Error(`No valid enum members could be found.`);
|
|
34
|
-
}
|
|
35
|
-
return unique[0] && isString.isString(unique[0]) ? {
|
|
36
|
-
kind: chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string
|
|
37
|
-
} : {
|
|
38
|
-
kind: chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.number
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
chunkGRNJVY7I_cjs.__name(getEnumReflectionType, "getEnumReflectionType");
|
|
42
|
-
function getUnionTypes(type) {
|
|
43
|
-
if (type.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.union && type.types.length > 0) {
|
|
44
|
-
return getUnique.getUniqueBy(type.types, (member) => member.kind);
|
|
45
|
-
}
|
|
46
|
-
throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);
|
|
47
|
-
}
|
|
48
|
-
chunkGRNJVY7I_cjs.__name(getUnionTypes, "getUnionTypes");
|
|
49
|
-
function isStringUnion(type) {
|
|
50
|
-
return getUnionTypes(type).some((member) => member.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string || member.kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.literal && isString.isString(member.literal));
|
|
51
|
-
}
|
|
52
|
-
chunkGRNJVY7I_cjs.__name(isStringUnion, "isStringUnion");
|
|
53
|
-
function kindToName(kind) {
|
|
54
|
-
if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.void) {
|
|
55
|
-
return "void";
|
|
56
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.never) {
|
|
57
|
-
return "never";
|
|
58
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.null) {
|
|
59
|
-
return "null";
|
|
60
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.undefined) {
|
|
61
|
-
return "undefined";
|
|
62
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.symbol) {
|
|
63
|
-
return "symbol";
|
|
64
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.bigint) {
|
|
65
|
-
return "bigint";
|
|
66
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.number) {
|
|
67
|
-
return "number";
|
|
68
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.string) {
|
|
69
|
-
return "string";
|
|
70
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.boolean) {
|
|
71
|
-
return "boolean";
|
|
72
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.literal) {
|
|
73
|
-
return "literal";
|
|
74
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.class) {
|
|
75
|
-
return "class";
|
|
76
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.array) {
|
|
77
|
-
return "array";
|
|
78
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.object) {
|
|
79
|
-
return "object";
|
|
80
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.objectLiteral) {
|
|
81
|
-
return "objectLiteral";
|
|
82
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.union) {
|
|
83
|
-
return "union";
|
|
84
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.enum) {
|
|
85
|
-
return "enum";
|
|
86
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.regexp) {
|
|
87
|
-
return "regexp";
|
|
88
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.templateLiteral) {
|
|
89
|
-
return "templateLiteral";
|
|
90
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.property) {
|
|
91
|
-
return "property";
|
|
92
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.method) {
|
|
93
|
-
return "method";
|
|
94
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.function) {
|
|
95
|
-
return "function";
|
|
96
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.parameter) {
|
|
97
|
-
return "parameter";
|
|
98
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.promise) {
|
|
99
|
-
return "promise";
|
|
100
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.typeParameter) {
|
|
101
|
-
return "typeParameter";
|
|
102
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.tuple) {
|
|
103
|
-
return "tuple";
|
|
104
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.tupleMember) {
|
|
105
|
-
return "tupleMember";
|
|
106
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.enumMember) {
|
|
107
|
-
return "enumMember";
|
|
108
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.rest) {
|
|
109
|
-
return "rest";
|
|
110
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.indexSignature) {
|
|
111
|
-
return "indexSignature";
|
|
112
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.propertySignature) {
|
|
113
|
-
return "propertySignature";
|
|
114
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.methodSignature) {
|
|
115
|
-
return "methodSignature";
|
|
116
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.infer) {
|
|
117
|
-
return "infer";
|
|
118
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.callSignature) {
|
|
119
|
-
return "callSignature";
|
|
120
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.any) {
|
|
121
|
-
return "any";
|
|
122
|
-
} else if (kind === chunk7J3ZDT6O_cjs.type_exports.ReflectionKind.intersection) {
|
|
123
|
-
return "intersection";
|
|
124
|
-
}
|
|
125
|
-
return "unknown";
|
|
126
|
-
}
|
|
127
|
-
chunkGRNJVY7I_cjs.__name(kindToName, "kindToName");
|
|
128
|
-
|
|
129
|
-
exports.getEnumReflectionType = getEnumReflectionType;
|
|
130
|
-
exports.getUnionTypes = getUnionTypes;
|
|
131
|
-
exports.isStringUnion = isStringUnion;
|
|
132
|
-
exports.kindToName = kindToName;
|
|
133
|
-
exports.stringifyDefaultValue = stringifyDefaultValue;
|
|
134
|
-
exports.stringifyStringValue = stringifyStringValue;
|
|
135
|
-
exports.stringifyValue = stringifyValue;
|
package/dist/chunk-XGQQM64U.js
DELETED
|
File without changes
|