@powerlines/schema 0.11.28 → 0.11.37
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/bundle.cjs +34 -20
- package/dist/bundle.d.cts +3 -3
- package/dist/bundle.d.cts.map +1 -1
- package/dist/bundle.d.mts +3 -3
- package/dist/bundle.d.mts.map +1 -1
- package/dist/bundle.mjs +35 -21
- package/dist/bundle.mjs.map +1 -1
- package/dist/codegen.cjs +55 -8
- package/dist/codegen.d.cts +12 -6
- package/dist/codegen.d.cts.map +1 -1
- package/dist/codegen.d.mts +12 -6
- package/dist/codegen.d.mts.map +1 -1
- package/dist/codegen.mjs +52 -8
- package/dist/codegen.mjs.map +1 -1
- package/dist/constants.cjs +42 -0
- package/dist/constants.d.cts +15 -0
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +15 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.mjs +39 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/extract.cjs +144 -95
- package/dist/extract.d.cts +34 -69
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +34 -69
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +144 -95
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +87 -0
- package/dist/helpers.d.cts +48 -0
- package/dist/helpers.d.cts.map +1 -0
- package/dist/helpers.d.mts +48 -0
- package/dist/helpers.d.mts.map +1 -0
- package/dist/helpers.mjs +84 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.cjs +29 -5
- package/dist/index.d.cts +8 -5
- package/dist/index.d.mts +8 -5
- package/dist/index.mjs +7 -4
- package/dist/metadata.cjs +80 -0
- package/dist/metadata.d.cts +52 -0
- package/dist/metadata.d.cts.map +1 -0
- package/dist/metadata.d.mts +52 -0
- package/dist/metadata.d.mts.map +1 -0
- package/dist/metadata.mjs +76 -0
- package/dist/metadata.mjs.map +1 -0
- package/dist/persistence.cjs +75 -0
- package/dist/persistence.d.cts +47 -0
- package/dist/persistence.d.cts.map +1 -0
- package/dist/persistence.d.mts +47 -0
- package/dist/persistence.d.mts.map +1 -0
- package/dist/persistence.mjs +71 -0
- package/dist/persistence.mjs.map +1 -0
- package/dist/reflection.cjs +292 -299
- package/dist/reflection.d.cts +3 -16
- package/dist/reflection.d.cts.map +1 -1
- package/dist/reflection.d.mts +3 -16
- package/dist/reflection.d.mts.map +1 -1
- package/dist/reflection.mjs +291 -299
- package/dist/reflection.mjs.map +1 -1
- package/dist/resolve.cjs +7 -7
- package/dist/resolve.mjs +7 -7
- package/dist/resolve.mjs.map +1 -1
- package/dist/type-checks.cjs +126 -25
- package/dist/type-checks.d.cts +45 -23
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +45 -23
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +125 -25
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +237 -95
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +237 -95
- package/dist/types.d.mts.map +1 -1
- package/package.json +24 -8
- package/dist/jtd.cjs +0 -385
- package/dist/jtd.d.cts +0 -15
- package/dist/jtd.d.cts.map +0 -1
- package/dist/jtd.d.mts +0 -15
- package/dist/jtd.d.mts.map +0 -1
- package/dist/jtd.mjs +0 -384
- package/dist/jtd.mjs.map +0 -1
package/dist/bundle.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
4
|
-
let
|
|
4
|
+
let _powerlines_unplugin_rolldown = require("@powerlines/unplugin/rolldown");
|
|
5
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
5
6
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
6
7
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
7
8
|
let defu = require("defu");
|
|
8
9
|
defu = require_runtime.__toESM(defu, 1);
|
|
9
|
-
let
|
|
10
|
+
let rolldown = require("rolldown");
|
|
10
11
|
let unplugin = require("unplugin");
|
|
11
12
|
|
|
12
13
|
//#region src/bundle.ts
|
|
@@ -21,27 +22,40 @@ let unplugin = require("unplugin");
|
|
|
21
22
|
async function bundle(context, file, options = {}) {
|
|
22
23
|
const path = await context.fs.resolve(file);
|
|
23
24
|
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const userOptions = (0, _stryke_helpers_omit.omit)(options, [
|
|
26
|
+
"name",
|
|
27
|
+
"resolve",
|
|
28
|
+
"plugins"
|
|
29
|
+
]);
|
|
30
|
+
const plugins = await Promise.resolve(options.plugins);
|
|
31
|
+
const result = await (0, rolldown.build)({
|
|
30
32
|
bundle: true,
|
|
31
|
-
packages: "bundle",
|
|
32
33
|
platform: "node",
|
|
34
|
+
...(0, _powerlines_unplugin_rolldown.resolveOptions)(context),
|
|
35
|
+
...userOptions,
|
|
33
36
|
logLevel: "silent",
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
output: {
|
|
38
|
+
dir: context.config.output.path,
|
|
39
|
+
format: "es",
|
|
40
|
+
sourcemap: false,
|
|
41
|
+
codeSplitting: false,
|
|
42
|
+
minify: false,
|
|
43
|
+
keepNames: true,
|
|
44
|
+
exports: "named",
|
|
45
|
+
...userOptions.output
|
|
46
|
+
},
|
|
47
|
+
input: [path],
|
|
48
|
+
write: false,
|
|
49
|
+
plugins: [...plugins ? (0, _stryke_convert_to_array.toArray)(plugins) : [], (0, unplugin.createRolldownPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(context, {
|
|
50
|
+
name: options.name ?? `${(0, _stryke_path_file_path_fns.findFileName)(file)} Bundler`,
|
|
51
|
+
prefix: false,
|
|
52
|
+
overrides: (0, defu.default)(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
53
|
+
silenceHookLogging: true
|
|
54
|
+
}))()].filter(Boolean)
|
|
55
|
+
});
|
|
56
|
+
if (!result.output || result.output.length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
57
|
+
if (result.output.length > 1) context.warn(`Multiple output files generated for "${file}". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`);
|
|
58
|
+
return result.output[0];
|
|
45
59
|
}
|
|
46
60
|
|
|
47
61
|
//#endregion
|
package/dist/bundle.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ResolveOptions, UnresolvedContext } from "@powerlines/core";
|
|
2
2
|
import { DeepPartial } from "@stryke/types/base";
|
|
3
|
-
import { BuildOptions,
|
|
3
|
+
import { BuildOptions, OutputChunk } from "rolldown";
|
|
4
4
|
|
|
5
5
|
//#region src/bundle.d.ts
|
|
6
|
-
type BundleOptions = DeepPartial<BuildOptions
|
|
6
|
+
type BundleOptions = DeepPartial<Omit<BuildOptions, "input" | "write">> & {
|
|
7
7
|
name?: string;
|
|
8
8
|
resolve?: DeepPartial<ResolveOptions>;
|
|
9
9
|
};
|
|
@@ -15,7 +15,7 @@ type BundleOptions = DeepPartial<BuildOptions> & {
|
|
|
15
15
|
* @param options - Optional overrides for the ESBuild configuration.
|
|
16
16
|
* @returns A promise that resolves to the bundled module.
|
|
17
17
|
*/
|
|
18
|
-
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<
|
|
18
|
+
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<OutputChunk>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { BundleOptions, bundle };
|
|
21
21
|
//# sourceMappingURL=bundle.d.cts.map
|
package/dist/bundle.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;KAkCY,aAAA,GAAgB,WAAA,CAC1B,IAAA,CAAK,YAAA;EAEL,IAAA;EACA,OAAA,GAAU,WAAA,CAAY,cAAA;AAAA;;;;;;;;;iBAWF,MAAA,kBAAwB,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,IAAA,UACA,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,WAAA"}
|
package/dist/bundle.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BuildOptions,
|
|
1
|
+
import { BuildOptions, OutputChunk } from "rolldown";
|
|
2
2
|
import { ResolveOptions, UnresolvedContext } from "@powerlines/core";
|
|
3
3
|
import { DeepPartial } from "@stryke/types/base";
|
|
4
4
|
|
|
5
5
|
//#region src/bundle.d.ts
|
|
6
|
-
type BundleOptions = DeepPartial<BuildOptions
|
|
6
|
+
type BundleOptions = DeepPartial<Omit<BuildOptions, "input" | "write">> & {
|
|
7
7
|
name?: string;
|
|
8
8
|
resolve?: DeepPartial<ResolveOptions>;
|
|
9
9
|
};
|
|
@@ -15,7 +15,7 @@ type BundleOptions = DeepPartial<BuildOptions> & {
|
|
|
15
15
|
* @param options - Optional overrides for the ESBuild configuration.
|
|
16
16
|
* @returns A promise that resolves to the bundled module.
|
|
17
17
|
*/
|
|
18
|
-
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<
|
|
18
|
+
declare function bundle<TContext extends UnresolvedContext>(context: TContext, file: string, options?: BundleOptions): Promise<OutputChunk>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { BundleOptions, bundle };
|
|
21
21
|
//# sourceMappingURL=bundle.d.mts.map
|
package/dist/bundle.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../src/bundle.ts"],"mappings":";;;;;KAkCY,aAAA,GAAgB,WAAA,CAC1B,IAAA,CAAK,YAAA;EAEL,IAAA;EACA,OAAA,GAAU,WAAA,CAAY,cAAA;AAAA;;;;;;;;;iBAWF,MAAA,kBAAwB,iBAAA,CAAA,CAC5C,OAAA,EAAS,QAAA,EACT,IAAA,UACA,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,WAAA"}
|
package/dist/bundle.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createUnpluginResolver } from "@powerlines/core/lib/unplugin";
|
|
2
|
-
import { resolveOptions } from "@powerlines/unplugin/
|
|
2
|
+
import { resolveOptions } from "@powerlines/unplugin/rolldown";
|
|
3
|
+
import { toArray } from "@stryke/convert/to-array";
|
|
3
4
|
import { omit } from "@stryke/helpers/omit";
|
|
4
5
|
import { findFileName } from "@stryke/path/file-path-fns";
|
|
5
6
|
import defu from "defu";
|
|
6
|
-
import { build } from "
|
|
7
|
-
import {
|
|
7
|
+
import { build } from "rolldown";
|
|
8
|
+
import { createRolldownPlugin } from "unplugin";
|
|
8
9
|
|
|
9
10
|
//#region src/bundle.ts
|
|
10
11
|
/**
|
|
@@ -18,27 +19,40 @@ import { createEsbuildPlugin } from "unplugin";
|
|
|
18
19
|
async function bundle(context, file, options = {}) {
|
|
19
20
|
const path = await context.fs.resolve(file);
|
|
20
21
|
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const userOptions = omit(options, [
|
|
23
|
+
"name",
|
|
24
|
+
"resolve",
|
|
25
|
+
"plugins"
|
|
26
|
+
]);
|
|
27
|
+
const plugins = await Promise.resolve(options.plugins);
|
|
28
|
+
const result = await build({
|
|
27
29
|
bundle: true,
|
|
28
|
-
packages: "bundle",
|
|
29
30
|
platform: "node",
|
|
31
|
+
...resolveOptions(context),
|
|
32
|
+
...userOptions,
|
|
30
33
|
logLevel: "silent",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
output: {
|
|
35
|
+
dir: context.config.output.path,
|
|
36
|
+
format: "es",
|
|
37
|
+
sourcemap: false,
|
|
38
|
+
codeSplitting: false,
|
|
39
|
+
minify: false,
|
|
40
|
+
keepNames: true,
|
|
41
|
+
exports: "named",
|
|
42
|
+
...userOptions.output
|
|
43
|
+
},
|
|
44
|
+
input: [path],
|
|
45
|
+
write: false,
|
|
46
|
+
plugins: [...plugins ? toArray(plugins) : [], createRolldownPlugin(createUnpluginResolver(context, {
|
|
47
|
+
name: options.name ?? `${findFileName(file)} Bundler`,
|
|
48
|
+
prefix: false,
|
|
49
|
+
overrides: defu(options.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve),
|
|
50
|
+
silenceHookLogging: true
|
|
51
|
+
}))()].filter(Boolean)
|
|
52
|
+
});
|
|
53
|
+
if (!result.output || result.output.length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
54
|
+
if (result.output.length > 1) context.warn(`Multiple output files generated for "${file}". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`);
|
|
55
|
+
return result.output[0];
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
//#endregion
|
package/dist/bundle.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.mjs","names":[],"sources":["../src/bundle.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n CreateUnpluginResolverOptions,\n ResolveOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { resolveOptions } from \"@powerlines/unplugin/
|
|
1
|
+
{"version":3,"file":"bundle.mjs","names":[],"sources":["../src/bundle.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n CreateUnpluginResolverOptions,\n ResolveOptions,\n UnresolvedContext\n} from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { resolveOptions } from \"@powerlines/unplugin/rolldown\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { DeepPartial } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport type { BuildOptions, OutputChunk } from \"rolldown\";\nimport { build } from \"rolldown\";\nimport { createRolldownPlugin } from \"unplugin\";\n\nexport type BundleOptions = DeepPartial<\n Omit<BuildOptions, \"input\" | \"write\">\n> & {\n name?: string;\n resolve?: DeepPartial<ResolveOptions>;\n};\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param options - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle<TContext extends UnresolvedContext>(\n context: TContext,\n file: string,\n options: BundleOptions = {}\n): Promise<OutputChunk> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const userOptions = omit(options, [\"name\", \"resolve\", \"plugins\"]);\n const plugins = await Promise.resolve(options.plugins);\n\n const resolvedOptions = resolveOptions(context);\n\n const result = await build({\n bundle: true,\n platform: \"node\",\n ...resolvedOptions,\n ...userOptions,\n logLevel: \"silent\",\n output: {\n dir: context.config.output.path,\n format: \"es\",\n sourcemap: false,\n codeSplitting: false,\n minify: false,\n keepNames: true,\n exports: \"named\",\n ...userOptions.output\n },\n input: [path],\n write: false,\n plugins: [\n ...(plugins ? toArray(plugins) : []),\n createRolldownPlugin(\n createUnpluginResolver(context, {\n name: options.name ?? `${findFileName(file)} Bundler`,\n prefix: false,\n overrides: defu(\n options.resolve ?? {},\n { skipNodeModulesBundle: false },\n context.config.resolve\n ) as CreateUnpluginResolverOptions[\"overrides\"],\n silenceHookLogging: true\n })\n )()\n ].filter(Boolean)\n } as BuildOptions);\n if (!result.output || result.output.length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n if (result.output.length > 1) {\n context.warn(\n `Multiple output files generated for \"${\n file\n }\". Only the first file will be used. Please check the configuration to ensure only one output file is generated.`\n );\n }\n\n return result.output[0];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,eAAsB,OACpB,SACA,MACA,UAAyB,CAAC,GACJ;CACtB,MAAM,OAAO,MAAM,QAAQ,GAAG,QAAQ,IAAI;CAC1C,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,WAAW,IAAI,GACtC,MAAM,IAAI,MACR,sBAAsB,KAAK,wCAC7B;CAGF,MAAM,cAAc,KAAK,SAAS;EAAC;EAAQ;EAAW;CAAS,CAAC;CAChE,MAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,OAAO;CAIrD,MAAM,SAAS,MAAM,MAAM;EACzB,QAAQ;EACR,UAAU;EACV,GALsB,eAAe,OAKpB;EACjB,GAAG;EACH,UAAU;EACV,QAAQ;GACN,KAAK,QAAQ,OAAO,OAAO;GAC3B,QAAQ;GACR,WAAW;GACX,eAAe;GACf,QAAQ;GACR,WAAW;GACX,SAAS;GACT,GAAG,YAAY;EACjB;EACA,OAAO,CAAC,IAAI;EACZ,OAAO;EACP,SAAS,CACP,GAAI,UAAU,QAAQ,OAAO,IAAI,CAAC,GAClC,qBACE,uBAAuB,SAAS;GAC9B,MAAM,QAAQ,QAAQ,GAAG,aAAa,IAAI,EAAE;GAC5C,QAAQ;GACR,WAAW,KACT,QAAQ,WAAW,CAAC,GACpB,EAAE,uBAAuB,MAAM,GAC/B,QAAQ,OAAO,OACjB;GACA,oBAAoB;EACtB,CAAC,CACH,EAAE,CACJ,EAAE,OAAO,OAAO;CAClB,CAAiB;CACjB,IAAI,CAAC,OAAO,UAAU,OAAO,OAAO,WAAW,GAC7C,MAAM,IAAI,MACR,iCACE,KACD,gDACH;CAEF,IAAI,OAAO,OAAO,SAAS,GACzB,QAAQ,KACN,wCACE,KACD,iHACH;CAGF,OAAO,OAAO,OAAO;AACvB"}
|
package/dist/codegen.cjs
CHANGED
|
@@ -1,27 +1,74 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_metadata = require('./metadata.cjs');
|
|
4
|
+
const require_type_checks = require('./type-checks.cjs');
|
|
5
|
+
const require_helpers = require('./helpers.cjs');
|
|
6
|
+
let _stryke_convert_to_bool = require("@stryke/convert/to-bool");
|
|
7
|
+
let _stryke_type_checks_is_boolean = require("@stryke/type-checks/is-boolean");
|
|
8
|
+
let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
9
|
+
let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
|
|
10
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
11
|
+
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
3
12
|
let ajv = require("ajv");
|
|
4
13
|
ajv = require_runtime.__toESM(ajv, 1);
|
|
14
|
+
let ajv_formats_dist_formats_js = require("ajv-formats/dist/formats.js");
|
|
15
|
+
let ajv_dist_compile_codegen_index_js = require("ajv/dist/compile/codegen/index.js");
|
|
5
16
|
let ajv_dist_standalone_index_js = require("ajv/dist/standalone/index.js");
|
|
6
17
|
ajv_dist_standalone_index_js = require_runtime.__toESM(ajv_dist_standalone_index_js, 1);
|
|
7
18
|
|
|
8
19
|
//#region src/codegen.ts
|
|
9
20
|
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
* Stringifies a value for generated TypeScript code.
|
|
22
|
+
*/
|
|
23
|
+
function stringifyValue(value, type) {
|
|
24
|
+
return (0, _stryke_type_checks_is_undefined.isUndefined)(value) ? "undefined" : (0, _stryke_type_checks_is_null.isNull)(value) ? "null" : type === "boolean" || (0, _stryke_type_checks_is_boolean.isBoolean)(value) ? String((0, _stryke_convert_to_bool.toBool)(value)) : type === "number" || (0, _stryke_type_checks_is_number.isNumber)(value) ? Number.parseFloat(String(value)).toLocaleString(void 0, { maximumFractionDigits: 20 }) : type === "integer" ? Number.parseInt(String(value)).toLocaleString() : JSON.stringify(value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Stringifies a JSON Schema fragment into a TypeScript-like type string.
|
|
28
|
+
*/
|
|
29
|
+
function stringifyType(schema) {
|
|
30
|
+
if (!schema) return "unknown";
|
|
31
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(schema.$ref)) return /^#\/(?:definitions|\$defs)\/(.+)$/.exec(schema.$ref)?.[1] ?? schema.$ref;
|
|
32
|
+
const primaryType = require_metadata.getPrimarySchemaType(schema);
|
|
33
|
+
if (primaryType) {
|
|
34
|
+
if (primaryType === "integer" || primaryType === "number") return "number";
|
|
35
|
+
return primaryType;
|
|
36
|
+
}
|
|
37
|
+
if (Array.isArray(schema.enum)) return schema.enum.map((value) => JSON.stringify(value)).join(" | ");
|
|
38
|
+
if (schema.const !== void 0) return JSON.stringify(schema.const);
|
|
39
|
+
if (schema.type === "array" || schema.items) return `${stringifyType(Array.isArray(schema.items) ? schema.items[0] : schema.items)}[]`;
|
|
40
|
+
if (schema.type === "object" || schema.properties || schema.additionalProperties) {
|
|
41
|
+
if (schema.additionalProperties && typeof schema.additionalProperties === "object") return `{ [key: string]: ${stringifyType(schema.additionalProperties)} }`;
|
|
42
|
+
if (require_type_checks.isJsonSchemaObject(schema)) return `{ ${require_helpers.getPropertiesList(schema).map((property) => {
|
|
43
|
+
const suffix = property.optional || property.nullable ? `${property.optional ? "?" : ""}${property.nullable ? " | null" : ""}` : "";
|
|
44
|
+
return `${property.key}${suffix}: ${stringifyType(property.value)}`;
|
|
45
|
+
}).join(";\n")} }`;
|
|
46
|
+
}
|
|
47
|
+
if (schema.oneOf || schema.anyOf) return (schema.oneOf ?? schema.anyOf ?? []).map((branch) => stringifyType(branch)).join(" | ");
|
|
48
|
+
if (schema.allOf) return "object";
|
|
49
|
+
return "unknown";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generates standalone JSON Schema validation code using Ajv.
|
|
15
53
|
*/
|
|
16
54
|
async function generateCode(schemas, refsOrFuncts) {
|
|
17
|
-
|
|
55
|
+
const ajv$1 = new ajv.default({
|
|
18
56
|
schemas,
|
|
19
57
|
code: {
|
|
20
58
|
source: true,
|
|
21
59
|
esm: true
|
|
22
60
|
}
|
|
23
|
-
})
|
|
61
|
+
});
|
|
62
|
+
ajv$1.opts.code.formats ??= ajv_dist_compile_codegen_index_js._`await import("ajv-formats/dist/formats").${new ajv_dist_compile_codegen_index_js.Name("fullFormats")}`;
|
|
63
|
+
for (const formatName of ajv_formats_dist_formats_js.formatNames) ajv$1.addFormat(formatName, ajv_formats_dist_formats_js.fullFormats[formatName]);
|
|
64
|
+
return (0, ajv_dist_standalone_index_js.default)(ajv$1, refsOrFuncts);
|
|
65
|
+
}
|
|
66
|
+
function isNullableSchema(schema) {
|
|
67
|
+
return require_metadata.isSchemaNullable(schema);
|
|
24
68
|
}
|
|
25
69
|
|
|
26
70
|
//#endregion
|
|
27
|
-
exports.generateCode = generateCode;
|
|
71
|
+
exports.generateCode = generateCode;
|
|
72
|
+
exports.isNullableSchema = isNullableSchema;
|
|
73
|
+
exports.stringifyType = stringifyType;
|
|
74
|
+
exports.stringifyValue = stringifyValue;
|
package/dist/codegen.d.cts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import { JsonSchema, JsonSchemaPrimitiveType } from "./types.cjs";
|
|
1
2
|
import { Options } from "ajv";
|
|
2
3
|
import standaloneCode from "ajv/dist/standalone/index.js";
|
|
3
4
|
|
|
4
5
|
//#region src/codegen.d.ts
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
7
|
+
* Stringifies a value for generated TypeScript code.
|
|
8
|
+
*/
|
|
9
|
+
declare function stringifyValue(value?: unknown, type?: JsonSchemaPrimitiveType | string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Stringifies a JSON Schema fragment into a TypeScript-like type string.
|
|
12
|
+
*/
|
|
13
|
+
declare function stringifyType<T = unknown>(schema?: JsonSchema<T>): string;
|
|
14
|
+
/**
|
|
15
|
+
* Generates standalone JSON Schema validation code using Ajv.
|
|
11
16
|
*/
|
|
12
17
|
declare function generateCode(schemas: Options["schemas"], refsOrFuncts?: Parameters<typeof standaloneCode>[1]): Promise<string>;
|
|
18
|
+
declare function isNullableSchema(schema?: JsonSchema): boolean;
|
|
13
19
|
//#endregion
|
|
14
|
-
export { generateCode };
|
|
20
|
+
export { generateCode, isNullableSchema, stringifyType, stringifyValue };
|
|
15
21
|
//# sourceMappingURL=codegen.d.cts.map
|
package/dist/codegen.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.cts","names":[],"sources":["../src/codegen.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"codegen.d.cts","names":[],"sources":["../src/codegen.ts"],"mappings":";;;;;;;AAqCA;iBAAgB,cAAA,CACd,KAAA,YACA,IAAA,GAAO,uBAAuB;;;;iBAoBhB,aAAA,aAAA,CAA2B,MAAA,GAAS,UAAU,CAAC,CAAA;;;AApBtB;iBAgGnB,YAAA,CACpB,OAAA,EAAS,OAAA,aACT,YAAA,GAAe,UAAA,QAAkB,cAAA,OAAkB,OAAA;AAAA,iBAiBrC,gBAAA,CAAiB,MAAmB,GAAV,UAAU"}
|
package/dist/codegen.d.mts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
import { JsonSchema, JsonSchemaPrimitiveType } from "./types.mjs";
|
|
1
2
|
import { Options } from "ajv";
|
|
2
3
|
import standaloneCode from "ajv/dist/standalone/index.js";
|
|
3
4
|
|
|
4
5
|
//#region src/codegen.d.ts
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
7
|
+
* Stringifies a value for generated TypeScript code.
|
|
8
|
+
*/
|
|
9
|
+
declare function stringifyValue(value?: unknown, type?: JsonSchemaPrimitiveType | string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Stringifies a JSON Schema fragment into a TypeScript-like type string.
|
|
12
|
+
*/
|
|
13
|
+
declare function stringifyType<T = unknown>(schema?: JsonSchema<T>): string;
|
|
14
|
+
/**
|
|
15
|
+
* Generates standalone JSON Schema validation code using Ajv.
|
|
11
16
|
*/
|
|
12
17
|
declare function generateCode(schemas: Options["schemas"], refsOrFuncts?: Parameters<typeof standaloneCode>[1]): Promise<string>;
|
|
18
|
+
declare function isNullableSchema(schema?: JsonSchema): boolean;
|
|
13
19
|
//#endregion
|
|
14
|
-
export { generateCode };
|
|
20
|
+
export { generateCode, isNullableSchema, stringifyType, stringifyValue };
|
|
15
21
|
//# sourceMappingURL=codegen.d.mts.map
|
package/dist/codegen.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.d.mts","names":[],"sources":["../src/codegen.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"codegen.d.mts","names":[],"sources":["../src/codegen.ts"],"mappings":";;;;;;;AAqCA;iBAAgB,cAAA,CACd,KAAA,YACA,IAAA,GAAO,uBAAuB;;;;iBAoBhB,aAAA,aAAA,CAA2B,MAAA,GAAS,UAAU,CAAC,CAAA;;;AApBtB;iBAgGnB,YAAA,CACpB,OAAA,EAAS,OAAA,aACT,YAAA,GAAe,UAAA,QAAkB,cAAA,OAAkB,OAAA;AAAA,iBAiBrC,gBAAA,CAAiB,MAAmB,GAAV,UAAU"}
|
package/dist/codegen.mjs
CHANGED
|
@@ -1,24 +1,68 @@
|
|
|
1
|
+
import { getPrimarySchemaType, isSchemaNullable } from "./metadata.mjs";
|
|
2
|
+
import { isJsonSchemaObject } from "./type-checks.mjs";
|
|
3
|
+
import { getPropertiesList } from "./helpers.mjs";
|
|
4
|
+
import { toBool } from "@stryke/convert/to-bool";
|
|
5
|
+
import { isBoolean } from "@stryke/type-checks/is-boolean";
|
|
6
|
+
import { isNull } from "@stryke/type-checks/is-null";
|
|
7
|
+
import { isNumber } from "@stryke/type-checks/is-number";
|
|
8
|
+
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
9
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
1
10
|
import Ajv from "ajv";
|
|
11
|
+
import { formatNames, fullFormats } from "ajv-formats/dist/formats.js";
|
|
12
|
+
import { Name, _ } from "ajv/dist/compile/codegen/index.js";
|
|
2
13
|
import standaloneCode from "ajv/dist/standalone/index.js";
|
|
3
14
|
|
|
4
15
|
//#region src/codegen.ts
|
|
5
16
|
/**
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
* Stringifies a value for generated TypeScript code.
|
|
18
|
+
*/
|
|
19
|
+
function stringifyValue(value, type) {
|
|
20
|
+
return isUndefined(value) ? "undefined" : isNull(value) ? "null" : type === "boolean" || isBoolean(value) ? String(toBool(value)) : type === "number" || isNumber(value) ? Number.parseFloat(String(value)).toLocaleString(void 0, { maximumFractionDigits: 20 }) : type === "integer" ? Number.parseInt(String(value)).toLocaleString() : JSON.stringify(value);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Stringifies a JSON Schema fragment into a TypeScript-like type string.
|
|
24
|
+
*/
|
|
25
|
+
function stringifyType(schema) {
|
|
26
|
+
if (!schema) return "unknown";
|
|
27
|
+
if (isSetString(schema.$ref)) return /^#\/(?:definitions|\$defs)\/(.+)$/.exec(schema.$ref)?.[1] ?? schema.$ref;
|
|
28
|
+
const primaryType = getPrimarySchemaType(schema);
|
|
29
|
+
if (primaryType) {
|
|
30
|
+
if (primaryType === "integer" || primaryType === "number") return "number";
|
|
31
|
+
return primaryType;
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(schema.enum)) return schema.enum.map((value) => JSON.stringify(value)).join(" | ");
|
|
34
|
+
if (schema.const !== void 0) return JSON.stringify(schema.const);
|
|
35
|
+
if (schema.type === "array" || schema.items) return `${stringifyType(Array.isArray(schema.items) ? schema.items[0] : schema.items)}[]`;
|
|
36
|
+
if (schema.type === "object" || schema.properties || schema.additionalProperties) {
|
|
37
|
+
if (schema.additionalProperties && typeof schema.additionalProperties === "object") return `{ [key: string]: ${stringifyType(schema.additionalProperties)} }`;
|
|
38
|
+
if (isJsonSchemaObject(schema)) return `{ ${getPropertiesList(schema).map((property) => {
|
|
39
|
+
const suffix = property.optional || property.nullable ? `${property.optional ? "?" : ""}${property.nullable ? " | null" : ""}` : "";
|
|
40
|
+
return `${property.key}${suffix}: ${stringifyType(property.value)}`;
|
|
41
|
+
}).join(";\n")} }`;
|
|
42
|
+
}
|
|
43
|
+
if (schema.oneOf || schema.anyOf) return (schema.oneOf ?? schema.anyOf ?? []).map((branch) => stringifyType(branch)).join(" | ");
|
|
44
|
+
if (schema.allOf) return "object";
|
|
45
|
+
return "unknown";
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generates standalone JSON Schema validation code using Ajv.
|
|
11
49
|
*/
|
|
12
50
|
async function generateCode(schemas, refsOrFuncts) {
|
|
13
|
-
|
|
51
|
+
const ajv = new Ajv({
|
|
14
52
|
schemas,
|
|
15
53
|
code: {
|
|
16
54
|
source: true,
|
|
17
55
|
esm: true
|
|
18
56
|
}
|
|
19
|
-
})
|
|
57
|
+
});
|
|
58
|
+
ajv.opts.code.formats ??= _`await import("ajv-formats/dist/formats").${new Name("fullFormats")}`;
|
|
59
|
+
for (const formatName of formatNames) ajv.addFormat(formatName, fullFormats[formatName]);
|
|
60
|
+
return standaloneCode(ajv, refsOrFuncts);
|
|
61
|
+
}
|
|
62
|
+
function isNullableSchema(schema) {
|
|
63
|
+
return isSchemaNullable(schema);
|
|
20
64
|
}
|
|
21
65
|
|
|
22
66
|
//#endregion
|
|
23
|
-
export { generateCode };
|
|
67
|
+
export { generateCode, isNullableSchema, stringifyType, stringifyValue };
|
|
24
68
|
//# sourceMappingURL=codegen.mjs.map
|
package/dist/codegen.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.mjs","names":[],"sources":["../src/codegen.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Options } from \"ajv\";\nimport Ajv from \"ajv\";\nimport
|
|
1
|
+
{"version":3,"file":"codegen.mjs","names":[],"sources":["../src/codegen.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toBool } from \"@stryke/convert/to-bool\";\nimport { isBoolean } from \"@stryke/type-checks/is-boolean\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport type { Options } from \"ajv\";\nimport Ajv from \"ajv\";\nimport { formatNames, fullFormats } from \"ajv-formats/dist/formats\";\nimport { _, Name } from \"ajv/dist/compile/codegen\";\nimport standaloneCode from \"ajv/dist/standalone\";\nimport { getPropertiesList } from \"./helpers\";\nimport { getPrimarySchemaType, isSchemaNullable } from \"./metadata\";\nimport { isJsonSchemaObject } from \"./type-checks\";\nimport { JsonSchema, JsonSchemaPrimitiveType } from \"./types\";\n\n/**\n * Stringifies a value for generated TypeScript code.\n */\nexport function stringifyValue(\n value?: unknown,\n type?: JsonSchemaPrimitiveType | string\n): string {\n return isUndefined(value)\n ? \"undefined\"\n : isNull(value)\n ? \"null\"\n : type === \"boolean\" || isBoolean(value)\n ? String(toBool(value))\n : type === \"number\" || isNumber(value)\n ? Number.parseFloat(String(value)).toLocaleString(undefined, {\n maximumFractionDigits: 20\n })\n : type === \"integer\"\n ? Number.parseInt(String(value)).toLocaleString()\n : JSON.stringify(value);\n}\n\n/**\n * Stringifies a JSON Schema fragment into a TypeScript-like type string.\n */\nexport function stringifyType<T = unknown>(schema?: JsonSchema<T>): string {\n if (!schema) {\n return \"unknown\";\n }\n\n if (isSetString(schema.$ref)) {\n const match = /^#\\/(?:definitions|\\$defs)\\/(.+)$/.exec(schema.$ref);\n\n return match?.[1] ?? schema.$ref;\n }\n\n const primaryType = getPrimarySchemaType(schema);\n if (primaryType) {\n if (primaryType === \"integer\" || primaryType === \"number\") {\n return \"number\";\n }\n\n return primaryType;\n }\n\n if (Array.isArray(schema.enum)) {\n return schema.enum.map(value => JSON.stringify(value)).join(\" | \");\n }\n\n if (schema.const !== undefined) {\n return JSON.stringify(schema.const);\n }\n\n if (schema.type === \"array\" || schema.items) {\n const items = Array.isArray(schema.items) ? schema.items[0] : schema.items;\n\n return `${stringifyType(items)}[]`;\n }\n\n if (\n schema.type === \"object\" ||\n schema.properties ||\n schema.additionalProperties\n ) {\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === \"object\"\n ) {\n return `{ [key: string]: ${stringifyType(schema.additionalProperties)} }`;\n }\n\n if (isJsonSchemaObject(schema)) {\n return `{ ${getPropertiesList(schema as JsonSchema<Record<string, any>>)\n .map(property => {\n const suffix =\n property.optional || property.nullable\n ? `${property.optional ? \"?\" : \"\"}${property.nullable ? \" | null\" : \"\"}`\n : \"\";\n\n return `${property.key}${suffix}: ${stringifyType(property.value)}`;\n })\n .join(\";\\n\")} }`;\n }\n }\n\n if (schema.oneOf || schema.anyOf) {\n return ((schema.oneOf ?? schema.anyOf ?? []) as JsonSchema<T>[])\n .map(branch => stringifyType(branch))\n .join(\" | \");\n }\n\n if (schema.allOf) {\n return \"object\";\n }\n\n return \"unknown\";\n}\n\n/**\n * Generates standalone JSON Schema validation code using Ajv.\n */\nexport async function generateCode(\n schemas: Options[\"schemas\"],\n refsOrFuncts?: Parameters<typeof standaloneCode>[1]\n) {\n const ajv = new Ajv({\n schemas,\n code: { source: true, esm: true }\n });\n\n ajv.opts.code.formats ??= _`await import(\"ajv-formats/dist/formats\").${new Name(\n \"fullFormats\"\n )}`;\n for (const formatName of formatNames) {\n ajv.addFormat(formatName, fullFormats[formatName]);\n }\n\n return standaloneCode(ajv, refsOrFuncts);\n}\n\nexport function isNullableSchema(schema?: JsonSchema): boolean {\n return isSchemaNullable(schema);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,SAAgB,eACd,OACA,MACQ;CACR,OAAO,YAAY,KAAK,IACpB,cACA,OAAO,KAAK,IACV,SACA,SAAS,aAAa,UAAU,KAAK,IACnC,OAAO,OAAO,KAAK,CAAC,IACpB,SAAS,YAAY,SAAS,KAAK,IACjC,OAAO,WAAW,OAAO,KAAK,CAAC,EAAE,eAAe,QAAW,EACzD,uBAAuB,GACzB,CAAC,IACD,SAAS,YACP,OAAO,SAAS,OAAO,KAAK,CAAC,EAAE,eAAe,IAC9C,KAAK,UAAU,KAAK;AAClC;;;;AAKA,SAAgB,cAA2B,QAAgC;CACzE,IAAI,CAAC,QACH,OAAO;CAGT,IAAI,YAAY,OAAO,IAAI,GAGzB,OAFc,oCAAoC,KAAK,OAAO,IAEnD,IAAI,MAAM,OAAO;CAG9B,MAAM,cAAc,qBAAqB,MAAM;CAC/C,IAAI,aAAa;EACf,IAAI,gBAAgB,aAAa,gBAAgB,UAC/C,OAAO;EAGT,OAAO;CACT;CAEA,IAAI,MAAM,QAAQ,OAAO,IAAI,GAC3B,OAAO,OAAO,KAAK,KAAI,UAAS,KAAK,UAAU,KAAK,CAAC,EAAE,KAAK,KAAK;CAGnE,IAAI,OAAO,UAAU,QACnB,OAAO,KAAK,UAAU,OAAO,KAAK;CAGpC,IAAI,OAAO,SAAS,WAAW,OAAO,OAGpC,OAAO,GAAG,cAFI,MAAM,QAAQ,OAAO,KAAK,IAAI,OAAO,MAAM,KAAK,OAAO,KAExC,EAAE;CAGjC,IACE,OAAO,SAAS,YAChB,OAAO,cACP,OAAO,sBACP;EACA,IACE,OAAO,wBACP,OAAO,OAAO,yBAAyB,UAEvC,OAAO,oBAAoB,cAAc,OAAO,oBAAoB,EAAE;EAGxE,IAAI,mBAAmB,MAAM,GAC3B,OAAO,KAAK,kBAAkB,MAAyC,EACpE,KAAI,aAAY;GACf,MAAM,SACJ,SAAS,YAAY,SAAS,WAC1B,GAAG,SAAS,WAAW,MAAM,KAAK,SAAS,WAAW,YAAY,OAClE;GAEN,OAAO,GAAG,SAAS,MAAM,OAAO,IAAI,cAAc,SAAS,KAAK;EAClE,CAAC,EACA,KAAK,KAAK,EAAE;CAEnB;CAEA,IAAI,OAAO,SAAS,OAAO,OACzB,QAAS,OAAO,SAAS,OAAO,SAAS,CAAC,GACvC,KAAI,WAAU,cAAc,MAAM,CAAC,EACnC,KAAK,KAAK;CAGf,IAAI,OAAO,OACT,OAAO;CAGT,OAAO;AACT;;;;AAKA,eAAsB,aACpB,SACA,cACA;CACA,MAAM,MAAM,IAAI,IAAI;EAClB;EACA,MAAM;GAAE,QAAQ;GAAM,KAAK;EAAK;CAClC,CAAC;CAED,IAAI,KAAK,KAAK,YAAY,CAAC,4CAA4C,IAAI,KACzE,aACF;CACA,KAAK,MAAM,cAAc,aACvB,IAAI,UAAU,YAAY,YAAY,WAAW;CAGnD,OAAO,eAAe,KAAK,YAAY;AACzC;AAEA,SAAgB,iBAAiB,QAA8B;CAC7D,OAAO,iBAAiB,MAAM;AAChC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/constants.ts
|
|
4
|
+
const JsonSchemaTypes = {
|
|
5
|
+
STRING: "string",
|
|
6
|
+
NUMBER: "number",
|
|
7
|
+
INTEGER: "integer",
|
|
8
|
+
BOOLEAN: "boolean",
|
|
9
|
+
NULL: "null",
|
|
10
|
+
OBJECT: "object",
|
|
11
|
+
ARRAY: "array"
|
|
12
|
+
};
|
|
13
|
+
const JSON_SCHEMA_DATA_TYPES = [
|
|
14
|
+
JsonSchemaTypes.STRING,
|
|
15
|
+
JsonSchemaTypes.NUMBER,
|
|
16
|
+
JsonSchemaTypes.INTEGER,
|
|
17
|
+
JsonSchemaTypes.BOOLEAN,
|
|
18
|
+
JsonSchemaTypes.ARRAY,
|
|
19
|
+
JsonSchemaTypes.OBJECT,
|
|
20
|
+
JsonSchemaTypes.NULL
|
|
21
|
+
];
|
|
22
|
+
const JSON_SCHEMA_METADATA_KEYS = [
|
|
23
|
+
"docs",
|
|
24
|
+
"deprecated",
|
|
25
|
+
"title",
|
|
26
|
+
"description",
|
|
27
|
+
"examples",
|
|
28
|
+
"visibility",
|
|
29
|
+
"hidden",
|
|
30
|
+
"ignore",
|
|
31
|
+
"internal",
|
|
32
|
+
"runtime",
|
|
33
|
+
"readOnly",
|
|
34
|
+
"writeOnly",
|
|
35
|
+
"alias",
|
|
36
|
+
"tags"
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
exports.JSON_SCHEMA_DATA_TYPES = JSON_SCHEMA_DATA_TYPES;
|
|
41
|
+
exports.JSON_SCHEMA_METADATA_KEYS = JSON_SCHEMA_METADATA_KEYS;
|
|
42
|
+
exports.JsonSchemaTypes = JsonSchemaTypes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
declare const JsonSchemaTypes: {
|
|
3
|
+
readonly STRING: "string";
|
|
4
|
+
readonly NUMBER: "number";
|
|
5
|
+
readonly INTEGER: "integer";
|
|
6
|
+
readonly BOOLEAN: "boolean";
|
|
7
|
+
readonly NULL: "null";
|
|
8
|
+
readonly OBJECT: "object";
|
|
9
|
+
readonly ARRAY: "array";
|
|
10
|
+
};
|
|
11
|
+
declare const JSON_SCHEMA_DATA_TYPES: readonly ["string", "number", "integer", "boolean", "array", "object", "null"];
|
|
12
|
+
declare const JSON_SCHEMA_METADATA_KEYS: ("title" | "description" | "docs" | "examples" | "alias" | "tags" | "visibility" | "deprecated" | "hidden" | "ignore" | "internal" | "runtime" | "readOnly" | "writeOnly")[];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { JSON_SCHEMA_DATA_TYPES, JSON_SCHEMA_METADATA_KEYS, JsonSchemaTypes };
|
|
15
|
+
//# sourceMappingURL=constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.cts","names":[],"sources":["../src/constants.ts"],"mappings":";cAoBa,eAAA;EAAA;;;;;;;;cAUA,sBAAA;AAAA,cAUA,yBAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/constants.d.ts
|
|
2
|
+
declare const JsonSchemaTypes: {
|
|
3
|
+
readonly STRING: "string";
|
|
4
|
+
readonly NUMBER: "number";
|
|
5
|
+
readonly INTEGER: "integer";
|
|
6
|
+
readonly BOOLEAN: "boolean";
|
|
7
|
+
readonly NULL: "null";
|
|
8
|
+
readonly OBJECT: "object";
|
|
9
|
+
readonly ARRAY: "array";
|
|
10
|
+
};
|
|
11
|
+
declare const JSON_SCHEMA_DATA_TYPES: readonly ["string", "number", "integer", "boolean", "array", "object", "null"];
|
|
12
|
+
declare const JSON_SCHEMA_METADATA_KEYS: ("title" | "description" | "docs" | "examples" | "alias" | "tags" | "visibility" | "deprecated" | "hidden" | "ignore" | "internal" | "runtime" | "readOnly" | "writeOnly")[];
|
|
13
|
+
//#endregion
|
|
14
|
+
export { JSON_SCHEMA_DATA_TYPES, JSON_SCHEMA_METADATA_KEYS, JsonSchemaTypes };
|
|
15
|
+
//# sourceMappingURL=constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","names":[],"sources":["../src/constants.ts"],"mappings":";cAoBa,eAAA;EAAA;;;;;;;;cAUA,sBAAA;AAAA,cAUA,yBAAA"}
|