@hey-api/openapi-ts 0.96.0 → 0.97.0
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/README.md +1 -1
- package/dist/clients/angular/client.ts +30 -20
- package/dist/clients/angular/types.ts +5 -2
- package/dist/clients/angular/utils.ts +4 -2
- package/dist/clients/fetch/client.ts +111 -129
- package/dist/clients/fetch/types.ts +5 -2
- package/dist/clients/fetch/utils.ts +4 -2
- package/dist/clients/ky/client.ts +156 -121
- package/dist/clients/ky/index.ts +0 -1
- package/dist/clients/ky/types.ts +23 -34
- package/dist/clients/ky/utils.ts +4 -2
- package/dist/clients/next/client.ts +102 -100
- package/dist/clients/next/types.ts +3 -1
- package/dist/clients/next/utils.ts +2 -1
- package/dist/clients/ofetch/client.ts +68 -58
- package/dist/clients/ofetch/types.ts +5 -2
- package/dist/clients/ofetch/utils.ts +5 -3
- package/dist/index.d.mts +1207 -1107
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-CXAVfp7x.mjs → init-EigcXVTH.mjs} +1161 -279
- package/dist/init-EigcXVTH.mjs.map +1 -0
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +2 -2
- package/dist/{src-D2PCex5z.mjs → src-ErSC87Z1.mjs} +19 -10
- package/dist/src-ErSC87Z1.mjs.map +1 -0
- package/dist/{types-DAEl4_a4.d.mts → types-KzipN7UT.d.mts} +7 -2
- package/dist/types-KzipN7UT.d.mts.map +1 -0
- package/package.json +6 -5
- package/dist/init-CXAVfp7x.mjs.map +0 -1
- package/dist/src-D2PCex5z.mjs.map +0 -1
- package/dist/types-DAEl4_a4.d.mts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { StructureModel, detectInteractiveSession, fromRef, isNode, isRef, isSymbol, loadConfigFile, log, nodeBrand, ref, refs } from "@hey-api/codegen-core";
|
|
3
|
-
import { ConfigError, OperationPath, OperationStrategy, applyNaming, buildSymbolIn, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, isEnvironment, mappers, operationPagination, operationResponsesMap, outputHeaderToPrefix, parseUrl, pathToJsonPointer, pathToName, refToName, requestValidatorLayers, resolveSource, resolveValidatorLayer, satisfies, statusCodeToGroup, toCase, valueToObject } from "@hey-api/shared";
|
|
3
|
+
import { ConfigError, OperationPath, OperationStrategy, applyNaming, buildSymbolIn, childContext, createOperationKey, createSchemaProcessor, createSchemaWalker, deduplicateSchema, definePluginConfig, dependencyFactory, ensureDirSync, escapeComment, findTsConfigPath, getInput, getLogs, getParser, hasOperationDataRequired, hasParameterGroupObjectRequired, isEnvironment, mappers, operationPagination, operationResponsesMap, outputHeaderToPrefix, parseUrl, pathToJsonPointer, pathToName, refToName, requestValidatorLayers, resolveSource, resolveValidatorLayer, satisfies, statusCodeToGroup, toCase, valueToObject, warnOnConflictingDuplicatePlugins } from "@hey-api/shared";
|
|
4
4
|
import colors from "ansi-colors";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
@@ -80,6 +80,15 @@ const getProjectDependencies = (configFilePath) => {
|
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/config/output/postprocess.ts
|
|
82
82
|
const postProcessors = {
|
|
83
|
+
"biome:check": {
|
|
84
|
+
args: [
|
|
85
|
+
"check",
|
|
86
|
+
"--write",
|
|
87
|
+
"{{path}}"
|
|
88
|
+
],
|
|
89
|
+
command: "biome",
|
|
90
|
+
name: "Biome (Check)"
|
|
91
|
+
},
|
|
83
92
|
"biome:format": {
|
|
84
93
|
args: [
|
|
85
94
|
"format",
|
|
@@ -92,7 +101,7 @@ const postProcessors = {
|
|
|
92
101
|
"biome:lint": {
|
|
93
102
|
args: [
|
|
94
103
|
"lint",
|
|
95
|
-
"--
|
|
104
|
+
"--write",
|
|
96
105
|
"{{path}}"
|
|
97
106
|
],
|
|
98
107
|
command: "biome",
|
|
@@ -5588,14 +5597,21 @@ function generateClientBundle({ header, module, outputPath, plugin, project }) {
|
|
|
5588
5597
|
}
|
|
5589
5598
|
//#endregion
|
|
5590
5599
|
//#region src/plugins/@hey-api/client-core/client.ts
|
|
5591
|
-
|
|
5600
|
+
function resolveRuntimeConfigPath({ outputPath, runtimeConfigPath }) {
|
|
5601
|
+
const isAbsolutePath = path.isAbsolute(runtimeConfigPath);
|
|
5602
|
+
if (!(isAbsolutePath || /^\.\.?\//.test(runtimeConfigPath))) return runtimeConfigPath;
|
|
5603
|
+
const absoluteInputPath = isAbsolutePath ? runtimeConfigPath : path.resolve(process.cwd(), runtimeConfigPath);
|
|
5604
|
+
const relative = path.relative(outputPath, absoluteInputPath).split(path.sep).join("/");
|
|
5605
|
+
return relative.startsWith(".") ? relative : `./${relative}`;
|
|
5606
|
+
}
|
|
5607
|
+
function resolveBaseUrlString({ plugin }) {
|
|
5592
5608
|
const { baseUrl } = plugin.config;
|
|
5593
5609
|
if (baseUrl === false) return;
|
|
5594
5610
|
if (typeof baseUrl === "string") return baseUrl;
|
|
5595
5611
|
const { servers } = plugin.context.ir;
|
|
5596
5612
|
if (!servers) return;
|
|
5597
5613
|
return servers[typeof baseUrl === "number" ? baseUrl : 0]?.url;
|
|
5598
|
-
}
|
|
5614
|
+
}
|
|
5599
5615
|
const createClient = ({ plugin }) => {
|
|
5600
5616
|
const clientModule = clientFolderAbsolutePath(getTypedConfig(plugin));
|
|
5601
5617
|
const symbolCreateClient = plugin.symbol("createClient", { external: clientModule });
|
|
@@ -5606,7 +5622,10 @@ const createClient = ({ plugin }) => {
|
|
|
5606
5622
|
role: "options"
|
|
5607
5623
|
});
|
|
5608
5624
|
const { runtimeConfigPath } = plugin.config;
|
|
5609
|
-
const symbolCreateClientConfig = runtimeConfigPath ? plugin.symbol("createClientConfig", { external:
|
|
5625
|
+
const symbolCreateClientConfig = runtimeConfigPath ? plugin.symbol("createClientConfig", { external: resolveRuntimeConfigPath({
|
|
5626
|
+
outputPath: getTypedConfig(plugin).output.path,
|
|
5627
|
+
runtimeConfigPath
|
|
5628
|
+
}) }) : void 0;
|
|
5610
5629
|
const defaultVals = $.object();
|
|
5611
5630
|
const resolvedBaseUrl = resolveBaseUrlString({ plugin });
|
|
5612
5631
|
if (resolvedBaseUrl) {
|
|
@@ -5625,7 +5644,7 @@ const createClient = ({ plugin }) => {
|
|
|
5625
5644
|
};
|
|
5626
5645
|
//#endregion
|
|
5627
5646
|
//#region src/plugins/@hey-api/client-core/createClientConfig.ts
|
|
5628
|
-
|
|
5647
|
+
function createClientConfigType({ plugin }) {
|
|
5629
5648
|
const clientModule = clientFolderAbsolutePath(getTypedConfig(plugin));
|
|
5630
5649
|
const symbolClientOptions = plugin.referenceSymbol({
|
|
5631
5650
|
category: "type",
|
|
@@ -5650,13 +5669,13 @@ const createClientConfigType = ({ plugin }) => {
|
|
|
5650
5669
|
"to ensure your client always has the correct values."
|
|
5651
5670
|
]).generic("T", (g) => g.extends(symbolDefaultClientOptions).default(symbolClientOptions)).type($.type.func().param("override", (p) => p.optional().type($.type(symbolConfig).generic($.type.and(symbolDefaultClientOptions, "T")))).returns($.type(symbolConfig).generic($.type.and($.type("Required").generic(symbolDefaultClientOptions), "T"))));
|
|
5652
5671
|
plugin.node(typeCreateClientConfig);
|
|
5653
|
-
}
|
|
5672
|
+
}
|
|
5654
5673
|
//#endregion
|
|
5655
5674
|
//#region src/plugins/@hey-api/client-core/plugin.ts
|
|
5656
|
-
|
|
5675
|
+
function clientPluginHandler({ plugin }) {
|
|
5657
5676
|
createClientConfigType({ plugin });
|
|
5658
5677
|
createClient({ plugin });
|
|
5659
|
-
}
|
|
5678
|
+
}
|
|
5660
5679
|
//#endregion
|
|
5661
5680
|
//#region src/plugins/@hey-api/client-angular/config.ts
|
|
5662
5681
|
const defaultConfig$24 = {
|
|
@@ -5740,7 +5759,7 @@ const defaultConfig$18 = {
|
|
|
5740
5759
|
definePluginConfig(defaultConfig$18);
|
|
5741
5760
|
//#endregion
|
|
5742
5761
|
//#region src/plugins/@hey-api/schemas/plugin.ts
|
|
5743
|
-
|
|
5762
|
+
function stripSchema({ plugin, schema }) {
|
|
5744
5763
|
if (plugin.config.type === "form") {
|
|
5745
5764
|
if (schema.description) delete schema.description;
|
|
5746
5765
|
if (schema["x-enum-descriptions"]) delete schema["x-enum-descriptions"];
|
|
@@ -5748,18 +5767,15 @@ const stripSchema = ({ plugin, schema }) => {
|
|
|
5748
5767
|
if (schema["x-enumNames"]) delete schema["x-enumNames"];
|
|
5749
5768
|
if (schema.title) delete schema.title;
|
|
5750
5769
|
}
|
|
5751
|
-
}
|
|
5752
|
-
|
|
5770
|
+
}
|
|
5771
|
+
function schemaToJsonSchemaDraft_04({ context, plugin, schema: _schema }) {
|
|
5753
5772
|
if (Array.isArray(_schema)) return _schema.map((item) => schemaToJsonSchemaDraft_04({
|
|
5754
5773
|
context,
|
|
5755
5774
|
plugin,
|
|
5756
5775
|
schema: item
|
|
5757
5776
|
}));
|
|
5758
5777
|
const schema = structuredClone(_schema);
|
|
5759
|
-
if (schema.$ref)
|
|
5760
|
-
schema.$ref = decodeURI(schema.$ref);
|
|
5761
|
-
return schema;
|
|
5762
|
-
}
|
|
5778
|
+
if (schema.$ref) return schema;
|
|
5763
5779
|
stripSchema({
|
|
5764
5780
|
plugin,
|
|
5765
5781
|
schema
|
|
@@ -5788,18 +5804,15 @@ const schemaToJsonSchemaDraft_04 = ({ context, plugin, schema: _schema }) => {
|
|
|
5788
5804
|
});
|
|
5789
5805
|
}
|
|
5790
5806
|
return schema;
|
|
5791
|
-
}
|
|
5792
|
-
|
|
5807
|
+
}
|
|
5808
|
+
function schemaToJsonSchemaDraft_05({ context, plugin, schema: _schema }) {
|
|
5793
5809
|
if (Array.isArray(_schema)) return _schema.map((item) => schemaToJsonSchemaDraft_05({
|
|
5794
5810
|
context,
|
|
5795
5811
|
plugin,
|
|
5796
5812
|
schema: item
|
|
5797
5813
|
}));
|
|
5798
5814
|
const schema = structuredClone(_schema);
|
|
5799
|
-
if ("$ref" in schema)
|
|
5800
|
-
schema.$ref = decodeURI(schema.$ref);
|
|
5801
|
-
return schema;
|
|
5802
|
-
}
|
|
5815
|
+
if ("$ref" in schema) return schema;
|
|
5803
5816
|
stripSchema({
|
|
5804
5817
|
plugin,
|
|
5805
5818
|
schema
|
|
@@ -5838,8 +5851,8 @@ const schemaToJsonSchemaDraft_05 = ({ context, plugin, schema: _schema }) => {
|
|
|
5838
5851
|
});
|
|
5839
5852
|
}
|
|
5840
5853
|
return schema;
|
|
5841
|
-
}
|
|
5842
|
-
|
|
5854
|
+
}
|
|
5855
|
+
function schemaToJsonSchema2020_12({ context, plugin, schema: _schema }) {
|
|
5843
5856
|
if (Array.isArray(_schema)) return _schema.map((item) => schemaToJsonSchema2020_12({
|
|
5844
5857
|
context,
|
|
5845
5858
|
plugin,
|
|
@@ -5850,7 +5863,6 @@ const schemaToJsonSchema2020_12 = ({ context, plugin, schema: _schema }) => {
|
|
|
5850
5863
|
plugin,
|
|
5851
5864
|
schema
|
|
5852
5865
|
});
|
|
5853
|
-
if (schema.$ref) schema.$ref = decodeURI(schema.$ref);
|
|
5854
5866
|
if (schema.additionalProperties && typeof schema.additionalProperties !== "boolean") schema.additionalProperties = schemaToJsonSchema2020_12({
|
|
5855
5867
|
context,
|
|
5856
5868
|
plugin,
|
|
@@ -5890,15 +5902,15 @@ const schemaToJsonSchema2020_12 = ({ context, plugin, schema: _schema }) => {
|
|
|
5890
5902
|
});
|
|
5891
5903
|
}
|
|
5892
5904
|
return schema;
|
|
5893
|
-
}
|
|
5894
|
-
|
|
5905
|
+
}
|
|
5906
|
+
function schemaName({ name, plugin, schema }) {
|
|
5895
5907
|
let customName = "";
|
|
5896
5908
|
if (plugin.config.nameBuilder) if (typeof plugin.config.nameBuilder === "function") customName = plugin.config.nameBuilder(name, schema);
|
|
5897
5909
|
else customName = plugin.config.nameBuilder.replace("{{name}}", name);
|
|
5898
5910
|
if (!customName) customName = `${name}Schema`;
|
|
5899
5911
|
return customName;
|
|
5900
|
-
}
|
|
5901
|
-
|
|
5912
|
+
}
|
|
5913
|
+
function schemasV2_0_X({ context, plugin }) {
|
|
5902
5914
|
if (!context.spec.definitions) return;
|
|
5903
5915
|
for (const name in context.spec.definitions) {
|
|
5904
5916
|
const schema = context.spec.definitions[name];
|
|
@@ -5920,8 +5932,8 @@ const schemasV2_0_X = ({ context, plugin }) => {
|
|
|
5920
5932
|
const statement = $.const(symbol).export().assign($($.fromValue(obj, { layout: "pretty" })).as("const"));
|
|
5921
5933
|
plugin.node(statement);
|
|
5922
5934
|
}
|
|
5923
|
-
}
|
|
5924
|
-
|
|
5935
|
+
}
|
|
5936
|
+
function schemasV3_0_X({ context, plugin }) {
|
|
5925
5937
|
if (!context.spec.components) return;
|
|
5926
5938
|
for (const name in context.spec.components.schemas) {
|
|
5927
5939
|
const schema = context.spec.components.schemas[name];
|
|
@@ -5943,8 +5955,8 @@ const schemasV3_0_X = ({ context, plugin }) => {
|
|
|
5943
5955
|
const statement = $.const(symbol).export().assign($($.fromValue(obj, { layout: "pretty" })).as("const"));
|
|
5944
5956
|
plugin.node(statement);
|
|
5945
5957
|
}
|
|
5946
|
-
}
|
|
5947
|
-
|
|
5958
|
+
}
|
|
5959
|
+
function schemasV3_1_X({ context, plugin }) {
|
|
5948
5960
|
if (!context.spec.components) return;
|
|
5949
5961
|
for (const name in context.spec.components.schemas) {
|
|
5950
5962
|
const schema = context.spec.components.schemas[name];
|
|
@@ -5966,7 +5978,7 @@ const schemasV3_1_X = ({ context, plugin }) => {
|
|
|
5966
5978
|
const statement = $.const(symbol).export().assign($($.fromValue(obj, { layout: "pretty" })).as("const"));
|
|
5967
5979
|
plugin.node(statement);
|
|
5968
5980
|
}
|
|
5969
|
-
}
|
|
5981
|
+
}
|
|
5970
5982
|
const handler$12 = ({ plugin }) => {
|
|
5971
5983
|
if ("swagger" in plugin.context.spec) {
|
|
5972
5984
|
schemasV2_0_X({
|
|
@@ -6739,7 +6751,7 @@ function inheritMeta$2(parent, children) {
|
|
|
6739
6751
|
}
|
|
6740
6752
|
//#endregion
|
|
6741
6753
|
//#region src/plugins/@hey-api/typescript/v1/toAst/array.ts
|
|
6742
|
-
function baseNode$
|
|
6754
|
+
function baseNode$69(ctx) {
|
|
6743
6755
|
const { plugin, schema, walk } = ctx;
|
|
6744
6756
|
if (!schema.items) return $.type("Array").generic($.type(plugin.config.topType));
|
|
6745
6757
|
const dedupedSchema = deduplicateSchema({
|
|
@@ -6760,7 +6772,7 @@ function arrayResolver$4(ctx) {
|
|
|
6760
6772
|
function arrayToAst$3({ plugin, schema, walk, walkerCtx }) {
|
|
6761
6773
|
const ctx = {
|
|
6762
6774
|
$,
|
|
6763
|
-
nodes: { base: baseNode$
|
|
6775
|
+
nodes: { base: baseNode$69 },
|
|
6764
6776
|
plugin,
|
|
6765
6777
|
schema,
|
|
6766
6778
|
walk,
|
|
@@ -6771,7 +6783,7 @@ function arrayToAst$3({ plugin, schema, walk, walkerCtx }) {
|
|
|
6771
6783
|
}
|
|
6772
6784
|
//#endregion
|
|
6773
6785
|
//#region src/plugins/@hey-api/typescript/v1/toAst/boolean.ts
|
|
6774
|
-
function baseNode$
|
|
6786
|
+
function baseNode$68() {
|
|
6775
6787
|
return $.type("boolean");
|
|
6776
6788
|
}
|
|
6777
6789
|
function constNode$19(ctx) {
|
|
@@ -6787,7 +6799,7 @@ function booleanToAst$3({ plugin, schema }) {
|
|
|
6787
6799
|
const ctx = {
|
|
6788
6800
|
$,
|
|
6789
6801
|
nodes: {
|
|
6790
|
-
base: baseNode$
|
|
6802
|
+
base: baseNode$68,
|
|
6791
6803
|
const: constNode$19
|
|
6792
6804
|
},
|
|
6793
6805
|
plugin,
|
|
@@ -6832,7 +6844,7 @@ function itemsNode$4(ctx) {
|
|
|
6832
6844
|
isNullable
|
|
6833
6845
|
};
|
|
6834
6846
|
}
|
|
6835
|
-
function baseNode$
|
|
6847
|
+
function baseNode$67(ctx) {
|
|
6836
6848
|
const { schema } = ctx;
|
|
6837
6849
|
const items = schema.items ?? [];
|
|
6838
6850
|
if (!items.length) return $.type("never");
|
|
@@ -6847,7 +6859,7 @@ function enumToAst$3({ plugin, schema }) {
|
|
|
6847
6859
|
const ctx = {
|
|
6848
6860
|
$,
|
|
6849
6861
|
nodes: {
|
|
6850
|
-
base: baseNode$
|
|
6862
|
+
base: baseNode$67,
|
|
6851
6863
|
items: itemsNode$4
|
|
6852
6864
|
},
|
|
6853
6865
|
plugin,
|
|
@@ -6861,29 +6873,29 @@ function enumToAst$3({ plugin, schema }) {
|
|
|
6861
6873
|
}
|
|
6862
6874
|
//#endregion
|
|
6863
6875
|
//#region src/plugins/@hey-api/typescript/v1/toAst/intersection.ts
|
|
6864
|
-
function baseNode$
|
|
6876
|
+
function baseNode$66(ctx) {
|
|
6865
6877
|
const { childResults } = ctx;
|
|
6866
6878
|
if (childResults.length === 1) return childResults[0].type;
|
|
6867
6879
|
return $.type.and(...childResults.map((r) => r.type));
|
|
6868
6880
|
}
|
|
6869
|
-
function intersectionResolver$
|
|
6881
|
+
function intersectionResolver$4(ctx) {
|
|
6870
6882
|
return ctx.nodes.base(ctx);
|
|
6871
6883
|
}
|
|
6872
|
-
function intersectionToAst({ childResults, parentSchema, plugin, schemas }) {
|
|
6884
|
+
function intersectionToAst$3({ childResults, parentSchema, plugin, schemas }) {
|
|
6873
6885
|
const ctx = {
|
|
6874
6886
|
$,
|
|
6875
6887
|
childResults,
|
|
6876
|
-
nodes: { base: baseNode$
|
|
6888
|
+
nodes: { base: baseNode$66 },
|
|
6877
6889
|
parentSchema,
|
|
6878
6890
|
plugin,
|
|
6879
6891
|
schemas
|
|
6880
6892
|
};
|
|
6881
6893
|
const resolver = plugin.config["~resolvers"]?.intersection;
|
|
6882
|
-
return resolver?.(ctx) ?? intersectionResolver$
|
|
6894
|
+
return resolver?.(ctx) ?? intersectionResolver$4(ctx);
|
|
6883
6895
|
}
|
|
6884
6896
|
//#endregion
|
|
6885
6897
|
//#region src/plugins/@hey-api/typescript/v1/toAst/never.ts
|
|
6886
|
-
function baseNode$
|
|
6898
|
+
function baseNode$65() {
|
|
6887
6899
|
return $.type("never");
|
|
6888
6900
|
}
|
|
6889
6901
|
function neverResolver$4(ctx) {
|
|
@@ -6892,7 +6904,7 @@ function neverResolver$4(ctx) {
|
|
|
6892
6904
|
function neverToAst$3({ plugin, schema }) {
|
|
6893
6905
|
const ctx = {
|
|
6894
6906
|
$,
|
|
6895
|
-
nodes: { base: baseNode$
|
|
6907
|
+
nodes: { base: baseNode$65 },
|
|
6896
6908
|
plugin,
|
|
6897
6909
|
schema
|
|
6898
6910
|
};
|
|
@@ -6901,7 +6913,7 @@ function neverToAst$3({ plugin, schema }) {
|
|
|
6901
6913
|
}
|
|
6902
6914
|
//#endregion
|
|
6903
6915
|
//#region src/plugins/@hey-api/typescript/v1/toAst/null.ts
|
|
6904
|
-
function baseNode$
|
|
6916
|
+
function baseNode$64() {
|
|
6905
6917
|
return $.type.literal(null);
|
|
6906
6918
|
}
|
|
6907
6919
|
function nullResolver$4(ctx) {
|
|
@@ -6910,7 +6922,7 @@ function nullResolver$4(ctx) {
|
|
|
6910
6922
|
function nullToAst$4({ plugin, schema }) {
|
|
6911
6923
|
const ctx = {
|
|
6912
6924
|
$,
|
|
6913
|
-
nodes: { base: baseNode$
|
|
6925
|
+
nodes: { base: baseNode$64 },
|
|
6914
6926
|
plugin,
|
|
6915
6927
|
schema
|
|
6916
6928
|
};
|
|
@@ -6923,7 +6935,7 @@ function constNode$18(ctx) {
|
|
|
6923
6935
|
const { schema } = ctx;
|
|
6924
6936
|
if (schema.const !== void 0) return $.type.fromValue(schema.const);
|
|
6925
6937
|
}
|
|
6926
|
-
function baseNode$
|
|
6938
|
+
function baseNode$63(ctx) {
|
|
6927
6939
|
const { plugin, schema } = ctx;
|
|
6928
6940
|
if (schema.type === "integer" && schema.format === "int64") {
|
|
6929
6941
|
if (plugin.getPlugin("@hey-api/transformers")?.config.bigInt) return $.type("bigint");
|
|
@@ -6939,7 +6951,7 @@ function numberToAst({ plugin, schema }) {
|
|
|
6939
6951
|
const ctx = {
|
|
6940
6952
|
$,
|
|
6941
6953
|
nodes: {
|
|
6942
|
-
base: baseNode$
|
|
6954
|
+
base: baseNode$63,
|
|
6943
6955
|
const: constNode$18
|
|
6944
6956
|
},
|
|
6945
6957
|
plugin,
|
|
@@ -6965,7 +6977,7 @@ function shapeNode$4(ctx) {
|
|
|
6965
6977
|
}
|
|
6966
6978
|
return shape;
|
|
6967
6979
|
}
|
|
6968
|
-
function baseNode$
|
|
6980
|
+
function baseNode$62(ctx) {
|
|
6969
6981
|
const { schema, walk, walkerCtx } = ctx;
|
|
6970
6982
|
const shape = shapeNode$4(ctx);
|
|
6971
6983
|
const required = schema.required ?? [];
|
|
@@ -7017,7 +7029,7 @@ function objectToAst$4({ plugin, schema, walk, walkerCtx }) {
|
|
|
7017
7029
|
const ctx = {
|
|
7018
7030
|
$,
|
|
7019
7031
|
nodes: {
|
|
7020
|
-
base: baseNode$
|
|
7032
|
+
base: baseNode$62,
|
|
7021
7033
|
shape: shapeNode$4
|
|
7022
7034
|
},
|
|
7023
7035
|
plugin,
|
|
@@ -7072,7 +7084,7 @@ function formatNode$4(ctx) {
|
|
|
7072
7084
|
return $.type(plugin.referenceSymbol(typeidQuery));
|
|
7073
7085
|
}
|
|
7074
7086
|
}
|
|
7075
|
-
function baseNode$
|
|
7087
|
+
function baseNode$61(ctx) {
|
|
7076
7088
|
return $.type("string");
|
|
7077
7089
|
}
|
|
7078
7090
|
function stringResolver$4(ctx) {
|
|
@@ -7088,7 +7100,7 @@ function stringToAst$1({ plugin, schema }) {
|
|
|
7088
7100
|
const ctx = {
|
|
7089
7101
|
$,
|
|
7090
7102
|
nodes: {
|
|
7091
|
-
base: baseNode$
|
|
7103
|
+
base: baseNode$61,
|
|
7092
7104
|
const: constNode$17,
|
|
7093
7105
|
format: formatNode$4
|
|
7094
7106
|
},
|
|
@@ -7100,7 +7112,7 @@ function stringToAst$1({ plugin, schema }) {
|
|
|
7100
7112
|
}
|
|
7101
7113
|
//#endregion
|
|
7102
7114
|
//#region src/plugins/@hey-api/typescript/v1/toAst/tuple.ts
|
|
7103
|
-
function baseNode$
|
|
7115
|
+
function baseNode$60(ctx) {
|
|
7104
7116
|
const { plugin, schema, walk } = ctx;
|
|
7105
7117
|
const itemTypes = [];
|
|
7106
7118
|
if (schema.items) schema.items.forEach((item) => {
|
|
@@ -7127,7 +7139,7 @@ function tupleToAst$3({ plugin, schema, walk, walkerCtx }) {
|
|
|
7127
7139
|
const ctx = {
|
|
7128
7140
|
$,
|
|
7129
7141
|
nodes: {
|
|
7130
|
-
base: baseNode$
|
|
7142
|
+
base: baseNode$60,
|
|
7131
7143
|
const: constNode$16
|
|
7132
7144
|
},
|
|
7133
7145
|
plugin,
|
|
@@ -7140,7 +7152,7 @@ function tupleToAst$3({ plugin, schema, walk, walkerCtx }) {
|
|
|
7140
7152
|
}
|
|
7141
7153
|
//#endregion
|
|
7142
7154
|
//#region src/plugins/@hey-api/typescript/v1/toAst/undefined.ts
|
|
7143
|
-
function baseNode$
|
|
7155
|
+
function baseNode$59() {
|
|
7144
7156
|
return $.type("undefined");
|
|
7145
7157
|
}
|
|
7146
7158
|
function undefinedResolver$4(ctx) {
|
|
@@ -7149,7 +7161,7 @@ function undefinedResolver$4(ctx) {
|
|
|
7149
7161
|
function undefinedToAst$3({ plugin, schema }) {
|
|
7150
7162
|
const ctx = {
|
|
7151
7163
|
$,
|
|
7152
|
-
nodes: { base: baseNode$
|
|
7164
|
+
nodes: { base: baseNode$59 },
|
|
7153
7165
|
plugin,
|
|
7154
7166
|
schema
|
|
7155
7167
|
};
|
|
@@ -7158,29 +7170,29 @@ function undefinedToAst$3({ plugin, schema }) {
|
|
|
7158
7170
|
}
|
|
7159
7171
|
//#endregion
|
|
7160
7172
|
//#region src/plugins/@hey-api/typescript/v1/toAst/union.ts
|
|
7161
|
-
function baseNode$
|
|
7173
|
+
function baseNode$58(ctx) {
|
|
7162
7174
|
const { childResults } = ctx;
|
|
7163
7175
|
if (childResults.length === 1) return childResults[0].type;
|
|
7164
7176
|
return $.type.or(...childResults.map((r) => r.type));
|
|
7165
7177
|
}
|
|
7166
|
-
function unionResolver$
|
|
7178
|
+
function unionResolver$4(ctx) {
|
|
7167
7179
|
return ctx.nodes.base(ctx);
|
|
7168
7180
|
}
|
|
7169
|
-
function unionToAst({ childResults, parentSchema, plugin, schemas }) {
|
|
7181
|
+
function unionToAst$3({ childResults, parentSchema, plugin, schemas }) {
|
|
7170
7182
|
const ctx = {
|
|
7171
7183
|
$,
|
|
7172
7184
|
childResults,
|
|
7173
|
-
nodes: { base: baseNode$
|
|
7185
|
+
nodes: { base: baseNode$58 },
|
|
7174
7186
|
parentSchema,
|
|
7175
7187
|
plugin,
|
|
7176
7188
|
schemas
|
|
7177
7189
|
};
|
|
7178
7190
|
const resolver = plugin.config["~resolvers"]?.union;
|
|
7179
|
-
return resolver?.(ctx) ?? unionResolver$
|
|
7191
|
+
return resolver?.(ctx) ?? unionResolver$4(ctx);
|
|
7180
7192
|
}
|
|
7181
7193
|
//#endregion
|
|
7182
7194
|
//#region src/plugins/@hey-api/typescript/v1/toAst/unknown.ts
|
|
7183
|
-
function baseNode$
|
|
7195
|
+
function baseNode$57(ctx) {
|
|
7184
7196
|
return $.type(ctx.plugin.config.topType);
|
|
7185
7197
|
}
|
|
7186
7198
|
function unknownResolver$4(ctx) {
|
|
@@ -7189,7 +7201,7 @@ function unknownResolver$4(ctx) {
|
|
|
7189
7201
|
function unknownToAst$3({ plugin, schema }) {
|
|
7190
7202
|
const ctx = {
|
|
7191
7203
|
$,
|
|
7192
|
-
nodes: { base: baseNode$
|
|
7204
|
+
nodes: { base: baseNode$57 },
|
|
7193
7205
|
plugin,
|
|
7194
7206
|
schema
|
|
7195
7207
|
};
|
|
@@ -7198,7 +7210,7 @@ function unknownToAst$3({ plugin, schema }) {
|
|
|
7198
7210
|
}
|
|
7199
7211
|
//#endregion
|
|
7200
7212
|
//#region src/plugins/@hey-api/typescript/v1/toAst/void.ts
|
|
7201
|
-
function baseNode$
|
|
7213
|
+
function baseNode$56() {
|
|
7202
7214
|
return $.type("void");
|
|
7203
7215
|
}
|
|
7204
7216
|
function voidResolver$4(ctx) {
|
|
@@ -7207,7 +7219,7 @@ function voidResolver$4(ctx) {
|
|
|
7207
7219
|
function voidToAst$3({ plugin, schema }) {
|
|
7208
7220
|
const ctx = {
|
|
7209
7221
|
$,
|
|
7210
|
-
nodes: { base: baseNode$
|
|
7222
|
+
nodes: { base: baseNode$56 },
|
|
7211
7223
|
plugin,
|
|
7212
7224
|
schema
|
|
7213
7225
|
};
|
|
@@ -7296,7 +7308,7 @@ function createVisitor$4(config = {}) {
|
|
|
7296
7308
|
}
|
|
7297
7309
|
},
|
|
7298
7310
|
intersection(items, schemas, parentSchema, ctx) {
|
|
7299
|
-
const type = intersectionToAst({
|
|
7311
|
+
const type = intersectionToAst$3({
|
|
7300
7312
|
childResults: items,
|
|
7301
7313
|
parentSchema,
|
|
7302
7314
|
plugin: ctx.plugin,
|
|
@@ -7403,7 +7415,7 @@ function createVisitor$4(config = {}) {
|
|
|
7403
7415
|
};
|
|
7404
7416
|
},
|
|
7405
7417
|
union(items, schemas, parentSchema, ctx) {
|
|
7406
|
-
const type = unionToAst({
|
|
7418
|
+
const type = unionToAst$3({
|
|
7407
7419
|
childResults: items,
|
|
7408
7420
|
parentSchema,
|
|
7409
7421
|
plugin: ctx.plugin,
|
|
@@ -8356,7 +8368,7 @@ const handleMeta = (plugin, operation, configPath) => {
|
|
|
8356
8368
|
};
|
|
8357
8369
|
//#endregion
|
|
8358
8370
|
//#region src/plugins/@tanstack/query-core/v5/infiniteQueryOptions.ts
|
|
8359
|
-
|
|
8371
|
+
function createInfiniteParamsFunction({ plugin }) {
|
|
8360
8372
|
const symbolCreateInfiniteParams = plugin.symbol(applyNaming("createInfiniteParams", { case: plugin.config.case }), { meta: {
|
|
8361
8373
|
category: "utility",
|
|
8362
8374
|
resource: "createInfiniteParams",
|
|
@@ -8364,8 +8376,8 @@ const createInfiniteParamsFunction = ({ plugin }) => {
|
|
|
8364
8376
|
} });
|
|
8365
8377
|
const fn = $.const(symbolCreateInfiniteParams).assign($.func().generic("K", (g) => g.extends($.type("Pick").generics($.type("QueryKey").generic("Options").idx(0), $.type.or($.type.literal("body"), $.type.literal("headers"), $.type.literal("path"), $.type.literal("query"))))).param("queryKey", (p) => p.type("QueryKey<Options>")).param("page", (p) => p.type("K")).do($.const("params").assign($.object().spread($("queryKey").attr(0))), $.if($("page").attr("body")).do($("params").attr("body").assign($.object().pretty().spread($("queryKey").attr(0).attr("body").as("any")).spread($("page").attr("body").as("any")))), $.if($("page").attr("headers")).do($("params").attr("headers").assign($.object().pretty().spread($("queryKey").attr(0).attr("headers")).spread($("page").attr("headers")))), $.if($("page").attr("path")).do($("params").attr("path").assign($.object().pretty().spread($("queryKey").attr(0).attr("path").as("any")).spread($("page").attr("path").as("any")))), $.if($("page").attr("query")).do($("params").attr("query").assign($.object().pretty().spread($("queryKey").attr(0).attr("query").as("any")).spread($("page").attr("query").as("any")))), $.return($("params").as("unknown").as($("page").typeofType()))));
|
|
8366
8378
|
plugin.node(fn);
|
|
8367
|
-
}
|
|
8368
|
-
|
|
8379
|
+
}
|
|
8380
|
+
function createInfiniteQueryOptions({ operation, plugin }) {
|
|
8369
8381
|
const pagination = operationPagination({
|
|
8370
8382
|
context: plugin.context,
|
|
8371
8383
|
operation
|
|
@@ -8435,10 +8447,10 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
|
|
|
8435
8447
|
plugin
|
|
8436
8448
|
}), $.type(symbolInfiniteDataType).generic(typeResponse), typeQueryKey, $.type.or(type, typePageObjectParam)))));
|
|
8437
8449
|
plugin.node(statement);
|
|
8438
|
-
}
|
|
8450
|
+
}
|
|
8439
8451
|
//#endregion
|
|
8440
8452
|
//#region src/plugins/@tanstack/query-core/v5/mutationOptions.ts
|
|
8441
|
-
|
|
8453
|
+
function createMutationOptions({ operation, plugin }) {
|
|
8442
8454
|
if (hasOperationSse({ operation })) return;
|
|
8443
8455
|
const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
|
|
8444
8456
|
const typeData = useTypeData({
|
|
@@ -8471,11 +8483,11 @@ const createMutationOptions = ({ operation, plugin }) => {
|
|
|
8471
8483
|
} });
|
|
8472
8484
|
const statement = $.const(symbolMutationOptions).export(plugin.config.mutationOptions.exported).$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param("options", (p) => p.optional().type($.type("Partial").generic(typeData))).returns(mutationType).do($.const(mutationOptionsFn).type(mutationType).assign($.object().pretty().prop("mutationFn", $.func().async().param(fnOptions).do(...statements)).$if(handleMeta(plugin, operation, "mutationOptions"), (c, v) => c.prop("meta", v))), $(mutationOptionsFn).return()));
|
|
8473
8485
|
plugin.node(statement);
|
|
8474
|
-
}
|
|
8486
|
+
}
|
|
8475
8487
|
//#endregion
|
|
8476
8488
|
//#region src/plugins/@tanstack/query-core/v5/queryOptions.ts
|
|
8477
8489
|
const optionsParamName$1 = "options";
|
|
8478
|
-
|
|
8490
|
+
function createQueryOptions({ operation, plugin }) {
|
|
8479
8491
|
if (hasOperationSse({ operation })) return;
|
|
8480
8492
|
const isRequiredOptions = isOperationOptionsRequired({
|
|
8481
8493
|
context: plugin.context,
|
|
@@ -8526,11 +8538,51 @@ const createQueryOptions = ({ operation, plugin }) => {
|
|
|
8526
8538
|
plugin
|
|
8527
8539
|
}), typeResponse, $(symbolQueryKey).returnType()).return()));
|
|
8528
8540
|
plugin.node(statement);
|
|
8529
|
-
}
|
|
8541
|
+
}
|
|
8542
|
+
//#endregion
|
|
8543
|
+
//#region src/plugins/@tanstack/query-core/v5/setQueryData.ts
|
|
8544
|
+
function createSetQueryData({ operation, plugin }) {
|
|
8545
|
+
if (hasOperationSse({ operation })) return;
|
|
8546
|
+
const isRequiredOptions = isOperationOptionsRequired({
|
|
8547
|
+
context: plugin.context,
|
|
8548
|
+
operation
|
|
8549
|
+
});
|
|
8550
|
+
const symbolQueryOptionsFn = plugin.referenceSymbol({
|
|
8551
|
+
category: "hook",
|
|
8552
|
+
resource: "operation",
|
|
8553
|
+
resourceId: operation.id,
|
|
8554
|
+
role: "queryOptions",
|
|
8555
|
+
tool: plugin.name
|
|
8556
|
+
});
|
|
8557
|
+
const symbolQueryClient = plugin.referenceSymbol({ resource: `${plugin.name}.QueryClient` });
|
|
8558
|
+
const typeData = useTypeData({
|
|
8559
|
+
operation,
|
|
8560
|
+
plugin
|
|
8561
|
+
});
|
|
8562
|
+
const typeResponse = useTypeResponse({
|
|
8563
|
+
operation,
|
|
8564
|
+
plugin
|
|
8565
|
+
});
|
|
8566
|
+
const responseOrUndefined = $.type.or(typeResponse, $.type("undefined"));
|
|
8567
|
+
const updaterType = $.type.or(typeResponse, $.type("undefined"), $.type.func().param("old", (p) => p.type(responseOrUndefined)).returns(responseOrUndefined));
|
|
8568
|
+
const symbolSetQueryData = plugin.symbol(applyNaming(operation.id, plugin.config.setQueryData), { meta: {
|
|
8569
|
+
category: "hook",
|
|
8570
|
+
resource: "operation",
|
|
8571
|
+
resourceId: operation.id,
|
|
8572
|
+
role: "setQueryData",
|
|
8573
|
+
tool: plugin.name
|
|
8574
|
+
} });
|
|
8575
|
+
const queryClientParam = "queryClient";
|
|
8576
|
+
const optionsParam = "options";
|
|
8577
|
+
const updaterParam = "updater";
|
|
8578
|
+
const optionsType = isRequiredOptions ? typeData : $.type.or(typeData, $.type("undefined"));
|
|
8579
|
+
const statement = $.const(symbolSetQueryData).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param(queryClientParam, (p) => p.type($.type(symbolQueryClient))).param(optionsParam, (p) => p.type(optionsType)).param(updaterParam, (p) => p.type(updaterType)).do($(queryClientParam).attr("setQueryData").call($(symbolQueryOptionsFn).call(optionsParam).attr("queryKey"), $(updaterParam)).return()));
|
|
8580
|
+
plugin.node(statement);
|
|
8581
|
+
}
|
|
8530
8582
|
//#endregion
|
|
8531
8583
|
//#region src/plugins/@tanstack/query-core/v5/useMutation.ts
|
|
8532
8584
|
const mutationOptionsParamName = "mutationOptions";
|
|
8533
|
-
|
|
8585
|
+
function createUseMutation({ operation, plugin }) {
|
|
8534
8586
|
if (!("useMutation" in plugin.config)) return;
|
|
8535
8587
|
const symbolUseMutationFn = plugin.symbol(applyNaming(operation.id, plugin.config.useMutation));
|
|
8536
8588
|
const symbolUseMutation = plugin.external(`${plugin.name}.useMutation`);
|
|
@@ -8557,11 +8609,11 @@ const createUseMutation = ({ operation, plugin }) => {
|
|
|
8557
8609
|
func.do($(symbolUseMutation).call($.object().spread($(symbolMutationOptionsFn).call()).spread(mutationOptionsParamName)).return());
|
|
8558
8610
|
const statement = $.const(symbolUseMutationFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign(func);
|
|
8559
8611
|
plugin.node(statement);
|
|
8560
|
-
}
|
|
8612
|
+
}
|
|
8561
8613
|
//#endregion
|
|
8562
8614
|
//#region src/plugins/@tanstack/query-core/v5/useQuery.ts
|
|
8563
8615
|
const optionsParamName = "options";
|
|
8564
|
-
|
|
8616
|
+
function createUseQuery({ operation, plugin }) {
|
|
8565
8617
|
if (hasOperationSse({ operation })) return;
|
|
8566
8618
|
if (!("useQuery" in plugin.config)) return;
|
|
8567
8619
|
const symbolUseQueryFn = plugin.symbol(applyNaming(operation.id, plugin.config.useQuery));
|
|
@@ -8583,7 +8635,48 @@ const createUseQuery = ({ operation, plugin }) => {
|
|
|
8583
8635
|
});
|
|
8584
8636
|
const statement = $.const(symbolUseQueryFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param(optionsParamName, (p) => p.required(isRequiredOptions).type(typeData)).do($(symbolUseQuery).call($(symbolQueryOptionsFn).call(optionsParamName)).return()));
|
|
8585
8637
|
plugin.node(statement);
|
|
8586
|
-
}
|
|
8638
|
+
}
|
|
8639
|
+
//#endregion
|
|
8640
|
+
//#region src/plugins/@tanstack/query-core/v5/useSetQueryData.ts
|
|
8641
|
+
function createUseSetQueryData({ operation, plugin }) {
|
|
8642
|
+
if (hasOperationSse({ operation })) return;
|
|
8643
|
+
if (!("useSetQueryData" in plugin.config)) return;
|
|
8644
|
+
const isRequiredOptions = isOperationOptionsRequired({
|
|
8645
|
+
context: plugin.context,
|
|
8646
|
+
operation
|
|
8647
|
+
});
|
|
8648
|
+
const symbolUseQueryClient = plugin.external(`${plugin.name}.useQueryClient`);
|
|
8649
|
+
const symbolQueryOptionsFn = plugin.referenceSymbol({
|
|
8650
|
+
category: "hook",
|
|
8651
|
+
resource: "operation",
|
|
8652
|
+
resourceId: operation.id,
|
|
8653
|
+
role: "queryOptions",
|
|
8654
|
+
tool: plugin.name
|
|
8655
|
+
});
|
|
8656
|
+
const typeData = useTypeData({
|
|
8657
|
+
operation,
|
|
8658
|
+
plugin
|
|
8659
|
+
});
|
|
8660
|
+
const typeResponse = useTypeResponse({
|
|
8661
|
+
operation,
|
|
8662
|
+
plugin
|
|
8663
|
+
});
|
|
8664
|
+
const responseOrUndefined = $.type.or(typeResponse, $.type("undefined"));
|
|
8665
|
+
const updaterType = $.type.or(typeResponse, $.type("undefined"), $.type.func().param("old", (p) => p.type(responseOrUndefined)).returns(responseOrUndefined));
|
|
8666
|
+
const symbolUseSetQueryData = plugin.symbol(applyNaming(operation.id, plugin.config.useSetQueryData), { meta: {
|
|
8667
|
+
category: "hook",
|
|
8668
|
+
resource: "operation",
|
|
8669
|
+
resourceId: operation.id,
|
|
8670
|
+
role: "useSetQueryData",
|
|
8671
|
+
tool: plugin.name
|
|
8672
|
+
} });
|
|
8673
|
+
const queryClientVar = "queryClient";
|
|
8674
|
+
const optionsParam = "options";
|
|
8675
|
+
const updaterParam = "updater";
|
|
8676
|
+
const optionsType = isRequiredOptions ? typeData : $.type.or(typeData, $.type("undefined"));
|
|
8677
|
+
const statement = $.const(symbolUseSetQueryData).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().do($.const(queryClientVar).assign($(symbolUseQueryClient).call()), $.return($.func().param(optionsParam, (p) => p.type(optionsType)).param(updaterParam, (p) => p.type(updaterType)).do($(queryClientVar).attr("setQueryData").call($(symbolQueryOptionsFn).call(optionsParam).attr("queryKey"), $(updaterParam)).return()))));
|
|
8678
|
+
plugin.node(statement);
|
|
8679
|
+
}
|
|
8587
8680
|
//#endregion
|
|
8588
8681
|
//#region src/plugins/@tanstack/query-core/v5/plugin.ts
|
|
8589
8682
|
const handlerV5 = ({ plugin }) => {
|
|
@@ -8602,9 +8695,15 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8602
8695
|
meta: { resource: `${plugin.name}.MutationOptions` }
|
|
8603
8696
|
});
|
|
8604
8697
|
plugin.symbol("infiniteQueryOptions", { external: plugin.name });
|
|
8698
|
+
plugin.symbol("QueryClient", {
|
|
8699
|
+
external: plugin.name,
|
|
8700
|
+
kind: "type",
|
|
8701
|
+
meta: { resource: `${plugin.name}.QueryClient` }
|
|
8702
|
+
});
|
|
8605
8703
|
plugin.symbol("queryOptions", { external: plugin.name });
|
|
8606
8704
|
plugin.symbol("useMutation", { external: plugin.name });
|
|
8607
8705
|
plugin.symbol("useQuery", { external: plugin.name });
|
|
8706
|
+
plugin.symbol("useQueryClient", { external: plugin.name });
|
|
8608
8707
|
plugin.symbol("AxiosError", {
|
|
8609
8708
|
external: "axios",
|
|
8610
8709
|
kind: "type"
|
|
@@ -8619,10 +8718,18 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8619
8718
|
operation,
|
|
8620
8719
|
plugin
|
|
8621
8720
|
});
|
|
8721
|
+
if (plugin.config.setQueryData.enabled) createSetQueryData({
|
|
8722
|
+
operation,
|
|
8723
|
+
plugin
|
|
8724
|
+
});
|
|
8622
8725
|
if ("useQuery" in plugin.config && plugin.config.useQuery.enabled) createUseQuery({
|
|
8623
8726
|
operation,
|
|
8624
8727
|
plugin
|
|
8625
8728
|
});
|
|
8729
|
+
if ("useSetQueryData" in plugin.config && plugin.config.useSetQueryData.enabled) createUseSetQueryData({
|
|
8730
|
+
operation,
|
|
8731
|
+
plugin
|
|
8732
|
+
});
|
|
8626
8733
|
}
|
|
8627
8734
|
if (plugin.hooks.operation.isMutation(operation)) {
|
|
8628
8735
|
if (plugin.config.mutationOptions.enabled) createMutationOptions({
|
|
@@ -8700,6 +8807,29 @@ const defaultConfig$12 = {
|
|
|
8700
8807
|
mappers,
|
|
8701
8808
|
value: plugin.config.queryOptions
|
|
8702
8809
|
});
|
|
8810
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
8811
|
+
defaultValue: {
|
|
8812
|
+
case: plugin.config.case ?? "camelCase",
|
|
8813
|
+
enabled: false,
|
|
8814
|
+
name: "{{name}}SetQueryData"
|
|
8815
|
+
},
|
|
8816
|
+
mappers: {
|
|
8817
|
+
boolean: (enabled) => ({ enabled }),
|
|
8818
|
+
function: (name) => ({
|
|
8819
|
+
enabled: true,
|
|
8820
|
+
name
|
|
8821
|
+
}),
|
|
8822
|
+
object: (fields) => ({
|
|
8823
|
+
enabled: true,
|
|
8824
|
+
...fields
|
|
8825
|
+
}),
|
|
8826
|
+
string: (name) => ({
|
|
8827
|
+
enabled: true,
|
|
8828
|
+
name
|
|
8829
|
+
})
|
|
8830
|
+
},
|
|
8831
|
+
value: plugin.config.setQueryData
|
|
8832
|
+
});
|
|
8703
8833
|
}
|
|
8704
8834
|
};
|
|
8705
8835
|
definePluginConfig(defaultConfig$12);
|
|
@@ -8764,6 +8894,29 @@ const defaultConfig$11 = {
|
|
|
8764
8894
|
mappers,
|
|
8765
8895
|
value: plugin.config.queryOptions
|
|
8766
8896
|
});
|
|
8897
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
8898
|
+
defaultValue: {
|
|
8899
|
+
case: plugin.config.case ?? "camelCase",
|
|
8900
|
+
enabled: false,
|
|
8901
|
+
name: "{{name}}SetQueryData"
|
|
8902
|
+
},
|
|
8903
|
+
mappers: {
|
|
8904
|
+
boolean: (enabled) => ({ enabled }),
|
|
8905
|
+
function: (name) => ({
|
|
8906
|
+
enabled: true,
|
|
8907
|
+
name
|
|
8908
|
+
}),
|
|
8909
|
+
object: (fields) => ({
|
|
8910
|
+
enabled: true,
|
|
8911
|
+
...fields
|
|
8912
|
+
}),
|
|
8913
|
+
string: (name) => ({
|
|
8914
|
+
enabled: true,
|
|
8915
|
+
name
|
|
8916
|
+
})
|
|
8917
|
+
},
|
|
8918
|
+
value: plugin.config.setQueryData
|
|
8919
|
+
});
|
|
8767
8920
|
plugin.config.useMutation = context.valueToObject({
|
|
8768
8921
|
defaultValue: {
|
|
8769
8922
|
case: plugin.config.case ?? "camelCase",
|
|
@@ -8810,6 +8963,29 @@ const defaultConfig$11 = {
|
|
|
8810
8963
|
},
|
|
8811
8964
|
value: plugin.config.useQuery
|
|
8812
8965
|
});
|
|
8966
|
+
plugin.config.useSetQueryData = context.valueToObject({
|
|
8967
|
+
defaultValue: {
|
|
8968
|
+
case: plugin.config.case ?? "camelCase",
|
|
8969
|
+
enabled: false,
|
|
8970
|
+
name: "use{{name}}SetQueryData"
|
|
8971
|
+
},
|
|
8972
|
+
mappers: {
|
|
8973
|
+
boolean: (enabled) => ({ enabled }),
|
|
8974
|
+
function: (name) => ({
|
|
8975
|
+
enabled: true,
|
|
8976
|
+
name
|
|
8977
|
+
}),
|
|
8978
|
+
object: (fields) => ({
|
|
8979
|
+
enabled: true,
|
|
8980
|
+
...fields
|
|
8981
|
+
}),
|
|
8982
|
+
string: (name) => ({
|
|
8983
|
+
enabled: true,
|
|
8984
|
+
name
|
|
8985
|
+
})
|
|
8986
|
+
},
|
|
8987
|
+
value: plugin.config.useSetQueryData
|
|
8988
|
+
});
|
|
8813
8989
|
if (plugin.config.useMutation.enabled) {
|
|
8814
8990
|
if (!plugin.config.mutationOptions.enabled) {
|
|
8815
8991
|
plugin.config.mutationOptions.enabled = true;
|
|
@@ -8886,6 +9062,29 @@ const defaultConfig$10 = {
|
|
|
8886
9062
|
mappers,
|
|
8887
9063
|
value: plugin.config.queryOptions
|
|
8888
9064
|
});
|
|
9065
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
9066
|
+
defaultValue: {
|
|
9067
|
+
case: plugin.config.case ?? "camelCase",
|
|
9068
|
+
enabled: false,
|
|
9069
|
+
name: "{{name}}SetQueryData"
|
|
9070
|
+
},
|
|
9071
|
+
mappers: {
|
|
9072
|
+
boolean: (enabled) => ({ enabled }),
|
|
9073
|
+
function: (name) => ({
|
|
9074
|
+
enabled: true,
|
|
9075
|
+
name
|
|
9076
|
+
}),
|
|
9077
|
+
object: (fields) => ({
|
|
9078
|
+
enabled: true,
|
|
9079
|
+
...fields
|
|
9080
|
+
}),
|
|
9081
|
+
string: (name) => ({
|
|
9082
|
+
enabled: true,
|
|
9083
|
+
name
|
|
9084
|
+
})
|
|
9085
|
+
},
|
|
9086
|
+
value: plugin.config.setQueryData
|
|
9087
|
+
});
|
|
8889
9088
|
plugin.config.useMutation = context.valueToObject({
|
|
8890
9089
|
defaultValue: {
|
|
8891
9090
|
case: plugin.config.case ?? "camelCase",
|
|
@@ -8932,6 +9131,29 @@ const defaultConfig$10 = {
|
|
|
8932
9131
|
},
|
|
8933
9132
|
value: plugin.config.useQuery
|
|
8934
9133
|
});
|
|
9134
|
+
plugin.config.useSetQueryData = context.valueToObject({
|
|
9135
|
+
defaultValue: {
|
|
9136
|
+
case: plugin.config.case ?? "camelCase",
|
|
9137
|
+
enabled: false,
|
|
9138
|
+
name: "use{{name}}SetQueryData"
|
|
9139
|
+
},
|
|
9140
|
+
mappers: {
|
|
9141
|
+
boolean: (enabled) => ({ enabled }),
|
|
9142
|
+
function: (name) => ({
|
|
9143
|
+
enabled: true,
|
|
9144
|
+
name
|
|
9145
|
+
}),
|
|
9146
|
+
object: (fields) => ({
|
|
9147
|
+
enabled: true,
|
|
9148
|
+
...fields
|
|
9149
|
+
}),
|
|
9150
|
+
string: (name) => ({
|
|
9151
|
+
enabled: true,
|
|
9152
|
+
name
|
|
9153
|
+
})
|
|
9154
|
+
},
|
|
9155
|
+
value: plugin.config.useSetQueryData
|
|
9156
|
+
});
|
|
8935
9157
|
if (plugin.config.useMutation.enabled) {
|
|
8936
9158
|
if (!plugin.config.mutationOptions.enabled) {
|
|
8937
9159
|
plugin.config.mutationOptions.enabled = true;
|
|
@@ -9008,26 +9230,49 @@ const defaultConfig$9 = {
|
|
|
9008
9230
|
mappers,
|
|
9009
9231
|
value: plugin.config.queryOptions
|
|
9010
9232
|
});
|
|
9011
|
-
|
|
9012
|
-
};
|
|
9013
|
-
definePluginConfig(defaultConfig$9);
|
|
9014
|
-
//#endregion
|
|
9015
|
-
//#region src/plugins/@tanstack/svelte-query/config.ts
|
|
9016
|
-
const defaultConfig$8 = {
|
|
9017
|
-
config: {
|
|
9018
|
-
case: "camelCase",
|
|
9019
|
-
comments: true,
|
|
9020
|
-
includeInEntry: false
|
|
9021
|
-
},
|
|
9022
|
-
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
9023
|
-
handler: handler$7,
|
|
9024
|
-
name: "@tanstack/svelte-query",
|
|
9025
|
-
resolveConfig: (plugin, context) => {
|
|
9026
|
-
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
9233
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
9027
9234
|
defaultValue: {
|
|
9028
9235
|
case: plugin.config.case ?? "camelCase",
|
|
9029
|
-
enabled:
|
|
9030
|
-
name: "{{name}}
|
|
9236
|
+
enabled: false,
|
|
9237
|
+
name: "{{name}}SetQueryData"
|
|
9238
|
+
},
|
|
9239
|
+
mappers: {
|
|
9240
|
+
boolean: (enabled) => ({ enabled }),
|
|
9241
|
+
function: (name) => ({
|
|
9242
|
+
enabled: true,
|
|
9243
|
+
name
|
|
9244
|
+
}),
|
|
9245
|
+
object: (fields) => ({
|
|
9246
|
+
enabled: true,
|
|
9247
|
+
...fields
|
|
9248
|
+
}),
|
|
9249
|
+
string: (name) => ({
|
|
9250
|
+
enabled: true,
|
|
9251
|
+
name
|
|
9252
|
+
})
|
|
9253
|
+
},
|
|
9254
|
+
value: plugin.config.setQueryData
|
|
9255
|
+
});
|
|
9256
|
+
}
|
|
9257
|
+
};
|
|
9258
|
+
definePluginConfig(defaultConfig$9);
|
|
9259
|
+
//#endregion
|
|
9260
|
+
//#region src/plugins/@tanstack/svelte-query/config.ts
|
|
9261
|
+
const defaultConfig$8 = {
|
|
9262
|
+
config: {
|
|
9263
|
+
case: "camelCase",
|
|
9264
|
+
comments: true,
|
|
9265
|
+
includeInEntry: false
|
|
9266
|
+
},
|
|
9267
|
+
dependencies: ["@hey-api/sdk", "@hey-api/typescript"],
|
|
9268
|
+
handler: handler$7,
|
|
9269
|
+
name: "@tanstack/svelte-query",
|
|
9270
|
+
resolveConfig: (plugin, context) => {
|
|
9271
|
+
plugin.config.infiniteQueryKeys = context.valueToObject({
|
|
9272
|
+
defaultValue: {
|
|
9273
|
+
case: plugin.config.case ?? "camelCase",
|
|
9274
|
+
enabled: true,
|
|
9275
|
+
name: "{{name}}InfiniteQueryKey",
|
|
9031
9276
|
tags: false
|
|
9032
9277
|
},
|
|
9033
9278
|
mappers,
|
|
@@ -9072,6 +9317,29 @@ const defaultConfig$8 = {
|
|
|
9072
9317
|
mappers,
|
|
9073
9318
|
value: plugin.config.queryOptions
|
|
9074
9319
|
});
|
|
9320
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
9321
|
+
defaultValue: {
|
|
9322
|
+
case: plugin.config.case ?? "camelCase",
|
|
9323
|
+
enabled: false,
|
|
9324
|
+
name: "{{name}}SetQueryData"
|
|
9325
|
+
},
|
|
9326
|
+
mappers: {
|
|
9327
|
+
boolean: (enabled) => ({ enabled }),
|
|
9328
|
+
function: (name) => ({
|
|
9329
|
+
enabled: true,
|
|
9330
|
+
name
|
|
9331
|
+
}),
|
|
9332
|
+
object: (fields) => ({
|
|
9333
|
+
enabled: true,
|
|
9334
|
+
...fields
|
|
9335
|
+
}),
|
|
9336
|
+
string: (name) => ({
|
|
9337
|
+
enabled: true,
|
|
9338
|
+
name
|
|
9339
|
+
})
|
|
9340
|
+
},
|
|
9341
|
+
value: plugin.config.setQueryData
|
|
9342
|
+
});
|
|
9075
9343
|
}
|
|
9076
9344
|
};
|
|
9077
9345
|
definePluginConfig(defaultConfig$8);
|
|
@@ -9136,6 +9404,29 @@ const defaultConfig$7 = {
|
|
|
9136
9404
|
mappers,
|
|
9137
9405
|
value: plugin.config.queryOptions
|
|
9138
9406
|
});
|
|
9407
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
9408
|
+
defaultValue: {
|
|
9409
|
+
case: plugin.config.case ?? "camelCase",
|
|
9410
|
+
enabled: false,
|
|
9411
|
+
name: "{{name}}SetQueryData"
|
|
9412
|
+
},
|
|
9413
|
+
mappers: {
|
|
9414
|
+
boolean: (enabled) => ({ enabled }),
|
|
9415
|
+
function: (name) => ({
|
|
9416
|
+
enabled: true,
|
|
9417
|
+
name
|
|
9418
|
+
}),
|
|
9419
|
+
object: (fields) => ({
|
|
9420
|
+
enabled: true,
|
|
9421
|
+
...fields
|
|
9422
|
+
}),
|
|
9423
|
+
string: (name) => ({
|
|
9424
|
+
enabled: true,
|
|
9425
|
+
name
|
|
9426
|
+
})
|
|
9427
|
+
},
|
|
9428
|
+
value: plugin.config.setQueryData
|
|
9429
|
+
});
|
|
9139
9430
|
}
|
|
9140
9431
|
};
|
|
9141
9432
|
definePluginConfig(defaultConfig$7);
|
|
@@ -10994,7 +11285,7 @@ function inheritMeta$1(parent, children) {
|
|
|
10994
11285
|
}
|
|
10995
11286
|
//#endregion
|
|
10996
11287
|
//#region src/plugins/valibot/v1/toAst/unknown.ts
|
|
10997
|
-
function baseNode$
|
|
11288
|
+
function baseNode$55(ctx) {
|
|
10998
11289
|
const { symbols } = ctx;
|
|
10999
11290
|
const { v } = symbols;
|
|
11000
11291
|
return $(v).attr(identifiers$1.schemas.unknown).call();
|
|
@@ -11007,7 +11298,7 @@ function unknownResolver$3(ctx) {
|
|
|
11007
11298
|
function unknownToPipes({ plugin, schema }) {
|
|
11008
11299
|
const ctx = {
|
|
11009
11300
|
$,
|
|
11010
|
-
nodes: { base: baseNode$
|
|
11301
|
+
nodes: { base: baseNode$55 },
|
|
11011
11302
|
pipes: {
|
|
11012
11303
|
...pipes,
|
|
11013
11304
|
current: []
|
|
@@ -11022,7 +11313,7 @@ function unknownToPipes({ plugin, schema }) {
|
|
|
11022
11313
|
}
|
|
11023
11314
|
//#endregion
|
|
11024
11315
|
//#region src/plugins/valibot/v1/toAst/array.ts
|
|
11025
|
-
function baseNode$
|
|
11316
|
+
function baseNode$54(ctx) {
|
|
11026
11317
|
const { plugin, symbols } = ctx;
|
|
11027
11318
|
const { v } = symbols;
|
|
11028
11319
|
const arrayFn = $(v).attr(identifiers$1.schemas.array);
|
|
@@ -11087,7 +11378,7 @@ function arrayToPipes(ctx) {
|
|
|
11087
11378
|
$,
|
|
11088
11379
|
applyModifiers: ctx.applyModifiers,
|
|
11089
11380
|
nodes: {
|
|
11090
|
-
base: baseNode$
|
|
11381
|
+
base: baseNode$54,
|
|
11091
11382
|
length: lengthNode$7,
|
|
11092
11383
|
maxLength: maxLengthNode$7,
|
|
11093
11384
|
minLength: minLengthNode$7
|
|
@@ -11111,7 +11402,7 @@ function arrayToPipes(ctx) {
|
|
|
11111
11402
|
}
|
|
11112
11403
|
//#endregion
|
|
11113
11404
|
//#region src/plugins/valibot/v1/toAst/boolean.ts
|
|
11114
|
-
function baseNode$
|
|
11405
|
+
function baseNode$53(ctx) {
|
|
11115
11406
|
const { symbols } = ctx;
|
|
11116
11407
|
const { v } = symbols;
|
|
11117
11408
|
return $(v).attr(identifiers$1.schemas.boolean).call();
|
|
@@ -11133,7 +11424,7 @@ function booleanToPipes({ plugin, schema }) {
|
|
|
11133
11424
|
const ctx = {
|
|
11134
11425
|
$,
|
|
11135
11426
|
nodes: {
|
|
11136
|
-
base: baseNode$
|
|
11427
|
+
base: baseNode$53,
|
|
11137
11428
|
const: constNode$15
|
|
11138
11429
|
},
|
|
11139
11430
|
pipes: {
|
|
@@ -11161,7 +11452,7 @@ function itemsNode$3(ctx) {
|
|
|
11161
11452
|
isNullable
|
|
11162
11453
|
};
|
|
11163
11454
|
}
|
|
11164
|
-
function baseNode$
|
|
11455
|
+
function baseNode$52(ctx) {
|
|
11165
11456
|
const { symbols } = ctx;
|
|
11166
11457
|
const { v } = symbols;
|
|
11167
11458
|
const { enumMembers } = ctx.nodes.items(ctx);
|
|
@@ -11179,7 +11470,7 @@ function enumToPipes({ plugin, schema }) {
|
|
|
11179
11470
|
const { enumMembers, isNullable } = itemsNode$3({
|
|
11180
11471
|
$,
|
|
11181
11472
|
nodes: {
|
|
11182
|
-
base: baseNode$
|
|
11473
|
+
base: baseNode$52,
|
|
11183
11474
|
items: itemsNode$3
|
|
11184
11475
|
},
|
|
11185
11476
|
pipes: {
|
|
@@ -11197,7 +11488,7 @@ function enumToPipes({ plugin, schema }) {
|
|
|
11197
11488
|
const ctx = {
|
|
11198
11489
|
$,
|
|
11199
11490
|
nodes: {
|
|
11200
|
-
base: baseNode$
|
|
11491
|
+
base: baseNode$52,
|
|
11201
11492
|
items: itemsNode$3
|
|
11202
11493
|
},
|
|
11203
11494
|
pipes: {
|
|
@@ -11217,7 +11508,7 @@ function enumToPipes({ plugin, schema }) {
|
|
|
11217
11508
|
}
|
|
11218
11509
|
//#endregion
|
|
11219
11510
|
//#region src/plugins/valibot/v1/toAst/intersection.ts
|
|
11220
|
-
function baseNode$
|
|
11511
|
+
function baseNode$51(ctx) {
|
|
11221
11512
|
const { applyModifiers, childResults, plugin, symbols } = ctx;
|
|
11222
11513
|
const { v } = symbols;
|
|
11223
11514
|
if (!childResults.length) return $(v).attr(identifiers$1.schemas.any).call();
|
|
@@ -11225,7 +11516,7 @@ function baseNode$45(ctx) {
|
|
|
11225
11516
|
const itemNodes = childResults.map((item) => pipesToNode(item.pipes, plugin));
|
|
11226
11517
|
return $(v).attr(identifiers$1.schemas.intersect).call($.array(...itemNodes));
|
|
11227
11518
|
}
|
|
11228
|
-
function intersectionResolver(ctx) {
|
|
11519
|
+
function intersectionResolver$3(ctx) {
|
|
11229
11520
|
const base = ctx.nodes.base(ctx);
|
|
11230
11521
|
if (base) ctx.pipes.push(ctx.pipes.current, base);
|
|
11231
11522
|
return ctx.pipes.current;
|
|
@@ -11236,7 +11527,7 @@ function intersectionToPipes(ctx) {
|
|
|
11236
11527
|
$,
|
|
11237
11528
|
applyModifiers,
|
|
11238
11529
|
childResults,
|
|
11239
|
-
nodes: { base: baseNode$
|
|
11530
|
+
nodes: { base: baseNode$51 },
|
|
11240
11531
|
parentSchema,
|
|
11241
11532
|
pipes: {
|
|
11242
11533
|
...pipes,
|
|
@@ -11247,7 +11538,7 @@ function intersectionToPipes(ctx) {
|
|
|
11247
11538
|
symbols: { v: plugin.external("valibot.v") }
|
|
11248
11539
|
};
|
|
11249
11540
|
const resolver = plugin.config["~resolvers"]?.intersection;
|
|
11250
|
-
const node = resolver?.(resolverCtx) ?? intersectionResolver(resolverCtx);
|
|
11541
|
+
const node = resolver?.(resolverCtx) ?? intersectionResolver$3(resolverCtx);
|
|
11251
11542
|
return {
|
|
11252
11543
|
childResults,
|
|
11253
11544
|
pipes: [resolverCtx.pipes.toNode(node, plugin)]
|
|
@@ -11255,7 +11546,7 @@ function intersectionToPipes(ctx) {
|
|
|
11255
11546
|
}
|
|
11256
11547
|
//#endregion
|
|
11257
11548
|
//#region src/plugins/valibot/v1/toAst/never.ts
|
|
11258
|
-
function baseNode$
|
|
11549
|
+
function baseNode$50(ctx) {
|
|
11259
11550
|
const { symbols } = ctx;
|
|
11260
11551
|
const { v } = symbols;
|
|
11261
11552
|
return $(v).attr(identifiers$1.schemas.never).call();
|
|
@@ -11268,7 +11559,7 @@ function neverResolver$3(ctx) {
|
|
|
11268
11559
|
function neverToPipes({ plugin, schema }) {
|
|
11269
11560
|
const ctx = {
|
|
11270
11561
|
$,
|
|
11271
|
-
nodes: { base: baseNode$
|
|
11562
|
+
nodes: { base: baseNode$50 },
|
|
11272
11563
|
pipes: {
|
|
11273
11564
|
...pipes,
|
|
11274
11565
|
current: []
|
|
@@ -11283,7 +11574,7 @@ function neverToPipes({ plugin, schema }) {
|
|
|
11283
11574
|
}
|
|
11284
11575
|
//#endregion
|
|
11285
11576
|
//#region src/plugins/valibot/v1/toAst/null.ts
|
|
11286
|
-
function baseNode$
|
|
11577
|
+
function baseNode$49(ctx) {
|
|
11287
11578
|
const { symbols } = ctx;
|
|
11288
11579
|
const { v } = symbols;
|
|
11289
11580
|
return $(v).attr(identifiers$1.schemas.null).call();
|
|
@@ -11296,7 +11587,7 @@ function nullResolver$3(ctx) {
|
|
|
11296
11587
|
function nullToPipes({ plugin, schema }) {
|
|
11297
11588
|
const ctx = {
|
|
11298
11589
|
$,
|
|
11299
|
-
nodes: { base: baseNode$
|
|
11590
|
+
nodes: { base: baseNode$49 },
|
|
11300
11591
|
pipes: {
|
|
11301
11592
|
...pipes,
|
|
11302
11593
|
current: []
|
|
@@ -11338,7 +11629,7 @@ const getIntegerLimit = (format) => {
|
|
|
11338
11629
|
};
|
|
11339
11630
|
//#endregion
|
|
11340
11631
|
//#region src/plugins/valibot/v1/toAst/number.ts
|
|
11341
|
-
function baseNode$
|
|
11632
|
+
function baseNode$48(ctx) {
|
|
11342
11633
|
const { schema, symbols } = ctx;
|
|
11343
11634
|
const { v } = symbols;
|
|
11344
11635
|
if (ctx.utils.shouldCoerceToBigInt(schema.format)) return [$(v).attr(identifiers$1.schemas.union).call($.array($(v).attr(identifiers$1.schemas.number).call(), $(v).attr(identifiers$1.schemas.string).call(), $(v).attr(identifiers$1.schemas.bigInt).call())), $(v).attr(identifiers$1.actions.transform).call($.func().param("x").do($("BigInt").call("x").return()))];
|
|
@@ -11384,7 +11675,7 @@ function numberToPipes({ plugin, schema }) {
|
|
|
11384
11675
|
const ctx = {
|
|
11385
11676
|
$,
|
|
11386
11677
|
nodes: {
|
|
11387
|
-
base: baseNode$
|
|
11678
|
+
base: baseNode$48,
|
|
11388
11679
|
const: constNode$14,
|
|
11389
11680
|
max: maxNode$3,
|
|
11390
11681
|
min: minNode$3
|
|
@@ -11416,7 +11707,7 @@ function additionalPropertiesNode$3(ctx) {
|
|
|
11416
11707
|
ctx._childResults.push(additionalResult);
|
|
11417
11708
|
return pipes.toNode(additionalResult.pipes, ctx.plugin);
|
|
11418
11709
|
}
|
|
11419
|
-
function baseNode$
|
|
11710
|
+
function baseNode$47(ctx) {
|
|
11420
11711
|
const { v } = ctx.symbols;
|
|
11421
11712
|
const additional = ctx.nodes.additionalProperties(ctx);
|
|
11422
11713
|
const shape = ctx.nodes.shape(ctx);
|
|
@@ -11452,7 +11743,7 @@ function objectToPipes(ctx) {
|
|
|
11452
11743
|
applyModifiers,
|
|
11453
11744
|
nodes: {
|
|
11454
11745
|
additionalProperties: additionalPropertiesNode$3,
|
|
11455
|
-
base: baseNode$
|
|
11746
|
+
base: baseNode$47,
|
|
11456
11747
|
shape: shapeNode$3
|
|
11457
11748
|
},
|
|
11458
11749
|
pipes: {
|
|
@@ -11474,7 +11765,7 @@ function objectToPipes(ctx) {
|
|
|
11474
11765
|
}
|
|
11475
11766
|
//#endregion
|
|
11476
11767
|
//#region src/plugins/valibot/v1/toAst/string.ts
|
|
11477
|
-
function baseNode$
|
|
11768
|
+
function baseNode$46(ctx) {
|
|
11478
11769
|
const { v } = ctx.symbols;
|
|
11479
11770
|
return $(v).attr(identifiers$1.schemas.string).call();
|
|
11480
11771
|
}
|
|
@@ -11553,7 +11844,7 @@ function stringToPipes({ plugin, schema }) {
|
|
|
11553
11844
|
const ctx = {
|
|
11554
11845
|
$,
|
|
11555
11846
|
nodes: {
|
|
11556
|
-
base: baseNode$
|
|
11847
|
+
base: baseNode$46,
|
|
11557
11848
|
const: constNode$13,
|
|
11558
11849
|
format: formatNode$3,
|
|
11559
11850
|
length: lengthNode$6,
|
|
@@ -11575,7 +11866,7 @@ function stringToPipes({ plugin, schema }) {
|
|
|
11575
11866
|
}
|
|
11576
11867
|
//#endregion
|
|
11577
11868
|
//#region src/plugins/valibot/v1/toAst/tuple.ts
|
|
11578
|
-
function baseNode$
|
|
11869
|
+
function baseNode$45(ctx) {
|
|
11579
11870
|
const { applyModifiers, pipes, plugin, schema, symbols, walk, walkerCtx } = ctx;
|
|
11580
11871
|
if (!schema.items) return unknownToPipes({ plugin });
|
|
11581
11872
|
const { v } = symbols;
|
|
@@ -11614,7 +11905,7 @@ function tupleToPipes(ctx) {
|
|
|
11614
11905
|
$,
|
|
11615
11906
|
applyModifiers: ctx.applyModifiers,
|
|
11616
11907
|
nodes: {
|
|
11617
|
-
base: baseNode$
|
|
11908
|
+
base: baseNode$45,
|
|
11618
11909
|
const: constNode$12
|
|
11619
11910
|
},
|
|
11620
11911
|
pipes: {
|
|
@@ -11636,7 +11927,7 @@ function tupleToPipes(ctx) {
|
|
|
11636
11927
|
}
|
|
11637
11928
|
//#endregion
|
|
11638
11929
|
//#region src/plugins/valibot/v1/toAst/undefined.ts
|
|
11639
|
-
function baseNode$
|
|
11930
|
+
function baseNode$44(ctx) {
|
|
11640
11931
|
const { symbols } = ctx;
|
|
11641
11932
|
const { v } = symbols;
|
|
11642
11933
|
return $(v).attr(identifiers$1.schemas.undefined).call();
|
|
@@ -11649,7 +11940,7 @@ function undefinedResolver$3(ctx) {
|
|
|
11649
11940
|
function undefinedToPipes({ plugin, schema }) {
|
|
11650
11941
|
const ctx = {
|
|
11651
11942
|
$,
|
|
11652
|
-
nodes: { base: baseNode$
|
|
11943
|
+
nodes: { base: baseNode$44 },
|
|
11653
11944
|
pipes: {
|
|
11654
11945
|
...pipes,
|
|
11655
11946
|
current: []
|
|
@@ -11663,9 +11954,24 @@ function undefinedToPipes({ plugin, schema }) {
|
|
|
11663
11954
|
return ctx.pipes.toNode(node, plugin);
|
|
11664
11955
|
}
|
|
11665
11956
|
//#endregion
|
|
11957
|
+
//#region src/plugins/valibot/shared/discriminated-union.ts
|
|
11958
|
+
function hasIntersectionDiscriminatorBranches({ items, parentSchema, schemas }) {
|
|
11959
|
+
const discriminatorKey = parentSchema.discriminator?.propertyName;
|
|
11960
|
+
if (!discriminatorKey) return false;
|
|
11961
|
+
for (let index = 0; index < schemas.length; index++) {
|
|
11962
|
+
const schema = schemas[index];
|
|
11963
|
+
if (schema.type === "null" || schema.const === null) continue;
|
|
11964
|
+
if (schema.logicalOperator !== "and" || !schema.items || schema.items.length !== 2) continue;
|
|
11965
|
+
const item = items[index];
|
|
11966
|
+
const discriminatedValue = schema.items[0].properties?.[discriminatorKey]?.const;
|
|
11967
|
+
if (item.meta.hasLazy || discriminatedValue !== void 0) return true;
|
|
11968
|
+
}
|
|
11969
|
+
return false;
|
|
11970
|
+
}
|
|
11971
|
+
//#endregion
|
|
11666
11972
|
//#region src/plugins/valibot/v1/toAst/union.ts
|
|
11667
|
-
function baseNode$
|
|
11668
|
-
const { childResults, plugin, schemas, symbols } = ctx;
|
|
11973
|
+
function baseNode$43(ctx) {
|
|
11974
|
+
const { childResults, parentSchema, plugin, schemas, symbols } = ctx;
|
|
11669
11975
|
const { v } = symbols;
|
|
11670
11976
|
const nonNullItems = [];
|
|
11671
11977
|
childResults.forEach((item, index) => {
|
|
@@ -11675,9 +11981,16 @@ function baseNode$37(ctx) {
|
|
|
11675
11981
|
if (!nonNullItems.length) return $(v).attr(identifiers$1.schemas.null).call();
|
|
11676
11982
|
if (nonNullItems.length === 1) return nonNullItems[0].pipes;
|
|
11677
11983
|
const itemNodes = nonNullItems.map((i) => pipesToNode(i.pipes, plugin));
|
|
11984
|
+
const hasIntersectionBranch = hasIntersectionDiscriminatorBranches({
|
|
11985
|
+
items: childResults,
|
|
11986
|
+
parentSchema,
|
|
11987
|
+
schemas
|
|
11988
|
+
});
|
|
11989
|
+
const discriminatorKey = parentSchema.discriminator?.propertyName;
|
|
11990
|
+
if (discriminatorKey && !hasIntersectionBranch) return $(v).attr(identifiers$1.schemas.variant).call($.literal(discriminatorKey), $.array(...itemNodes));
|
|
11678
11991
|
return $(v).attr(identifiers$1.schemas.union).call($.array(...itemNodes));
|
|
11679
11992
|
}
|
|
11680
|
-
function unionResolver(ctx) {
|
|
11993
|
+
function unionResolver$3(ctx) {
|
|
11681
11994
|
const base = ctx.nodes.base(ctx);
|
|
11682
11995
|
if (base) ctx.pipes.push(ctx.pipes.current, base);
|
|
11683
11996
|
return ctx.pipes.current;
|
|
@@ -11688,7 +12001,7 @@ function unionToPipes(ctx) {
|
|
|
11688
12001
|
$,
|
|
11689
12002
|
applyModifiers,
|
|
11690
12003
|
childResults,
|
|
11691
|
-
nodes: { base: baseNode$
|
|
12004
|
+
nodes: { base: baseNode$43 },
|
|
11692
12005
|
parentSchema,
|
|
11693
12006
|
pipes: {
|
|
11694
12007
|
...pipes,
|
|
@@ -11700,7 +12013,7 @@ function unionToPipes(ctx) {
|
|
|
11700
12013
|
symbols: { v: plugin.external("valibot.v") }
|
|
11701
12014
|
};
|
|
11702
12015
|
const resolver = plugin.config["~resolvers"]?.union;
|
|
11703
|
-
const node = resolver?.(resolverCtx) ?? unionResolver(resolverCtx);
|
|
12016
|
+
const node = resolver?.(resolverCtx) ?? unionResolver$3(resolverCtx);
|
|
11704
12017
|
return {
|
|
11705
12018
|
childResults,
|
|
11706
12019
|
pipes: [resolverCtx.pipes.toNode(node, plugin)]
|
|
@@ -11708,7 +12021,7 @@ function unionToPipes(ctx) {
|
|
|
11708
12021
|
}
|
|
11709
12022
|
//#endregion
|
|
11710
12023
|
//#region src/plugins/valibot/v1/toAst/void.ts
|
|
11711
|
-
function baseNode$
|
|
12024
|
+
function baseNode$42(ctx) {
|
|
11712
12025
|
const { symbols } = ctx;
|
|
11713
12026
|
const { v } = symbols;
|
|
11714
12027
|
return $(v).attr(identifiers$1.schemas.void).call();
|
|
@@ -11721,7 +12034,7 @@ function voidResolver$3(ctx) {
|
|
|
11721
12034
|
function voidToPipes({ plugin, schema }) {
|
|
11722
12035
|
const ctx = {
|
|
11723
12036
|
$,
|
|
11724
|
-
nodes: { base: baseNode$
|
|
12037
|
+
nodes: { base: baseNode$42 },
|
|
11725
12038
|
pipes: {
|
|
11726
12039
|
...pipes,
|
|
11727
12040
|
current: []
|
|
@@ -11736,7 +12049,7 @@ function voidToPipes({ plugin, schema }) {
|
|
|
11736
12049
|
}
|
|
11737
12050
|
//#endregion
|
|
11738
12051
|
//#region src/plugins/valibot/v1/walker.ts
|
|
11739
|
-
function getDefaultValue(meta) {
|
|
12052
|
+
function getDefaultValue$3(meta) {
|
|
11740
12053
|
return meta.format ? maybeBigInt(meta.default, meta.format) : $.fromValue(meta.default);
|
|
11741
12054
|
}
|
|
11742
12055
|
function createVisitor$3(config = {}) {
|
|
@@ -11747,14 +12060,14 @@ function createVisitor$3(config = {}) {
|
|
|
11747
12060
|
const v = ctx.plugin.external("valibot.v");
|
|
11748
12061
|
const pipes = [...result.pipes];
|
|
11749
12062
|
if (result.meta.readonly) pipes.push($(v).attr(identifiers$1.actions.readonly).call());
|
|
11750
|
-
const
|
|
11751
|
-
const needsOptional = optional ||
|
|
12063
|
+
const needsDefault = result.meta.default !== void 0;
|
|
12064
|
+
const needsOptional = optional || needsDefault;
|
|
11752
12065
|
const needsNullable = result.meta.nullable;
|
|
11753
12066
|
const innerNode = pipesToNode(pipes, ctx.plugin);
|
|
11754
12067
|
let finalPipes;
|
|
11755
|
-
if (needsOptional && needsNullable) if (
|
|
12068
|
+
if (needsOptional && needsNullable) if (needsDefault) finalPipes = [$(v).attr(identifiers$1.schemas.nullish).call(innerNode, getDefaultValue$3(result.meta))];
|
|
11756
12069
|
else finalPipes = [$(v).attr(identifiers$1.schemas.nullish).call(innerNode)];
|
|
11757
|
-
else if (needsOptional) if (
|
|
12070
|
+
else if (needsOptional) if (needsDefault) finalPipes = [$(v).attr(identifiers$1.schemas.optional).call(innerNode, getDefaultValue$3(result.meta))];
|
|
11758
12071
|
else finalPipes = [$(v).attr(identifiers$1.schemas.optional).call(innerNode)];
|
|
11759
12072
|
else if (needsNullable) finalPipes = [$(v).attr(identifiers$1.schemas.nullable).call(innerNode)];
|
|
11760
12073
|
else finalPipes = pipes;
|
|
@@ -12252,13 +12565,16 @@ const identifiers = {
|
|
|
12252
12565
|
datetime: "datetime",
|
|
12253
12566
|
default: "default",
|
|
12254
12567
|
describe: "describe",
|
|
12568
|
+
discriminatedUnion: "discriminatedUnion",
|
|
12255
12569
|
email: "email",
|
|
12256
12570
|
enum: "enum",
|
|
12571
|
+
extend: "extend",
|
|
12257
12572
|
globalRegistry: "globalRegistry",
|
|
12258
12573
|
gt: "gt",
|
|
12259
12574
|
gte: "gte",
|
|
12260
12575
|
guid: "guid",
|
|
12261
12576
|
infer: "infer",
|
|
12577
|
+
input: "input",
|
|
12262
12578
|
int: "int",
|
|
12263
12579
|
intersection: "intersection",
|
|
12264
12580
|
ip: "ip",
|
|
@@ -12283,6 +12599,7 @@ const identifiers = {
|
|
|
12283
12599
|
number: "number",
|
|
12284
12600
|
object: "object",
|
|
12285
12601
|
optional: "optional",
|
|
12602
|
+
output: "output",
|
|
12286
12603
|
parseAsync: "parseAsync",
|
|
12287
12604
|
readonly: "readonly",
|
|
12288
12605
|
record: "record",
|
|
@@ -12316,6 +12633,8 @@ function exportAst({ final, meta, naming, namingAnchor, path, plugin, schema, ta
|
|
|
12316
12633
|
plugin,
|
|
12317
12634
|
schema
|
|
12318
12635
|
}));
|
|
12636
|
+
const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(z).attr(final.typeName))).assign(final.expression);
|
|
12637
|
+
plugin.node(statement);
|
|
12319
12638
|
const typeInferSymbol = naming.types.infer.enabled ? plugin.registerSymbol(buildSymbolIn({
|
|
12320
12639
|
meta: {
|
|
12321
12640
|
category: "type",
|
|
@@ -12330,12 +12649,46 @@ function exportAst({ final, meta, naming, namingAnchor, path, plugin, schema, ta
|
|
|
12330
12649
|
plugin,
|
|
12331
12650
|
schema
|
|
12332
12651
|
})) : void 0;
|
|
12333
|
-
const statement = $.const(symbol).export().$if(plugin.config.comments && createSchemaComment(schema), (c, v) => c.doc(v)).$if(final.typeName, (c) => c.type($.type(z).attr(final.typeName))).assign(final.expression);
|
|
12334
|
-
plugin.node(statement);
|
|
12335
12652
|
if (typeInferSymbol) {
|
|
12336
12653
|
const inferType = $.type.alias(typeInferSymbol).export().type($.type(z).attr(identifiers.infer).generic($(symbol).typeofType()));
|
|
12337
12654
|
plugin.node(inferType);
|
|
12338
12655
|
}
|
|
12656
|
+
const typeInputSymbol = naming.types.input.enabled ? plugin.registerSymbol(buildSymbolIn({
|
|
12657
|
+
meta: {
|
|
12658
|
+
category: "type",
|
|
12659
|
+
path,
|
|
12660
|
+
tags,
|
|
12661
|
+
tool: "zod",
|
|
12662
|
+
variant: "input",
|
|
12663
|
+
...meta
|
|
12664
|
+
},
|
|
12665
|
+
name,
|
|
12666
|
+
naming: naming.types.input,
|
|
12667
|
+
plugin,
|
|
12668
|
+
schema
|
|
12669
|
+
})) : void 0;
|
|
12670
|
+
if (typeInputSymbol) {
|
|
12671
|
+
const inputType = $.type.alias(typeInputSymbol).export().type($.type(z).attr(identifiers.input).generic($(symbol).typeofType()));
|
|
12672
|
+
plugin.node(inputType);
|
|
12673
|
+
}
|
|
12674
|
+
const typeOutputSymbol = naming.types.output.enabled ? plugin.registerSymbol(buildSymbolIn({
|
|
12675
|
+
meta: {
|
|
12676
|
+
category: "type",
|
|
12677
|
+
path,
|
|
12678
|
+
tags,
|
|
12679
|
+
tool: "zod",
|
|
12680
|
+
variant: "output",
|
|
12681
|
+
...meta
|
|
12682
|
+
},
|
|
12683
|
+
name,
|
|
12684
|
+
naming: naming.types.output,
|
|
12685
|
+
plugin,
|
|
12686
|
+
schema
|
|
12687
|
+
})) : void 0;
|
|
12688
|
+
if (typeOutputSymbol) {
|
|
12689
|
+
const outputType = $.type.alias(typeOutputSymbol).export().type($.type(z).attr(identifiers.output).generic($(symbol).typeofType()));
|
|
12690
|
+
plugin.node(outputType);
|
|
12691
|
+
}
|
|
12339
12692
|
return symbol;
|
|
12340
12693
|
}
|
|
12341
12694
|
//#endregion
|
|
@@ -13000,6 +13353,7 @@ function defaultMeta(schema) {
|
|
|
13000
13353
|
default: schema.default,
|
|
13001
13354
|
format: schema.format,
|
|
13002
13355
|
hasLazy: false,
|
|
13356
|
+
isIntersection: false,
|
|
13003
13357
|
isLazy: false,
|
|
13004
13358
|
isObject: false,
|
|
13005
13359
|
nullable: false,
|
|
@@ -13017,6 +13371,7 @@ function composeMeta(children, overrides) {
|
|
|
13017
13371
|
default: overrides?.default,
|
|
13018
13372
|
format: overrides?.format,
|
|
13019
13373
|
hasLazy: overrides?.hasLazy ?? children.some((c) => c.meta.hasLazy),
|
|
13374
|
+
isIntersection: overrides?.isIntersection ?? false,
|
|
13020
13375
|
isLazy: overrides?.isLazy ?? children.some((c) => c.meta.isLazy),
|
|
13021
13376
|
isObject: overrides?.isObject ?? children.some((c) => c.meta.isObject),
|
|
13022
13377
|
nullable: overrides?.nullable ?? children.some((c) => c.meta.nullable),
|
|
@@ -13039,7 +13394,7 @@ function inheritMeta(parent, children) {
|
|
|
13039
13394
|
}
|
|
13040
13395
|
//#endregion
|
|
13041
13396
|
//#region src/plugins/zod/mini/toAst/unknown.ts
|
|
13042
|
-
function baseNode$
|
|
13397
|
+
function baseNode$41(ctx) {
|
|
13043
13398
|
const { symbols } = ctx;
|
|
13044
13399
|
const { z } = symbols;
|
|
13045
13400
|
return $(z).attr(identifiers.unknown).call();
|
|
@@ -13054,7 +13409,7 @@ function unknownToAst$2({ plugin, schema }) {
|
|
|
13054
13409
|
const ctx = {
|
|
13055
13410
|
$,
|
|
13056
13411
|
chain: { current: $(z) },
|
|
13057
|
-
nodes: { base: baseNode$
|
|
13412
|
+
nodes: { base: baseNode$41 },
|
|
13058
13413
|
plugin,
|
|
13059
13414
|
schema,
|
|
13060
13415
|
symbols: { z }
|
|
@@ -13064,7 +13419,7 @@ function unknownToAst$2({ plugin, schema }) {
|
|
|
13064
13419
|
}
|
|
13065
13420
|
//#endregion
|
|
13066
13421
|
//#region src/plugins/zod/mini/toAst/array.ts
|
|
13067
|
-
function baseNode$
|
|
13422
|
+
function baseNode$40(ctx) {
|
|
13068
13423
|
const { applyModifiers, childResults, plugin, schema, symbols } = ctx;
|
|
13069
13424
|
const { z } = symbols;
|
|
13070
13425
|
const arrayFn = $(z).attr(identifiers.array);
|
|
@@ -13135,7 +13490,7 @@ function arrayToAst$2({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
13135
13490
|
chain: { current: $(z) },
|
|
13136
13491
|
childResults,
|
|
13137
13492
|
nodes: {
|
|
13138
|
-
base: baseNode$
|
|
13493
|
+
base: baseNode$40,
|
|
13139
13494
|
length: lengthNode$5,
|
|
13140
13495
|
maxLength: maxLengthNode$5,
|
|
13141
13496
|
minLength: minLengthNode$5
|
|
@@ -13154,7 +13509,7 @@ function arrayToAst$2({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
13154
13509
|
}
|
|
13155
13510
|
//#endregion
|
|
13156
13511
|
//#region src/plugins/zod/mini/toAst/boolean.ts
|
|
13157
|
-
function baseNode$
|
|
13512
|
+
function baseNode$39(ctx) {
|
|
13158
13513
|
const { symbols } = ctx;
|
|
13159
13514
|
const { z } = symbols;
|
|
13160
13515
|
return $(z).attr(identifiers.boolean).call();
|
|
@@ -13181,7 +13536,7 @@ function booleanToAst$2({ plugin, schema }) {
|
|
|
13181
13536
|
$,
|
|
13182
13537
|
chain: { current: $(z) },
|
|
13183
13538
|
nodes: {
|
|
13184
|
-
base: baseNode$
|
|
13539
|
+
base: baseNode$39,
|
|
13185
13540
|
const: constNode$11
|
|
13186
13541
|
},
|
|
13187
13542
|
plugin,
|
|
@@ -13220,7 +13575,7 @@ function itemsNode$2(ctx) {
|
|
|
13220
13575
|
literalMembers
|
|
13221
13576
|
};
|
|
13222
13577
|
}
|
|
13223
|
-
function baseNode$
|
|
13578
|
+
function baseNode$38(ctx) {
|
|
13224
13579
|
const { symbols } = ctx;
|
|
13225
13580
|
const { z } = symbols;
|
|
13226
13581
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
@@ -13241,7 +13596,7 @@ function enumToAst$2({ plugin, schema }) {
|
|
|
13241
13596
|
$,
|
|
13242
13597
|
chain: { current: $(z) },
|
|
13243
13598
|
nodes: {
|
|
13244
|
-
base: baseNode$
|
|
13599
|
+
base: baseNode$38,
|
|
13245
13600
|
items: itemsNode$2
|
|
13246
13601
|
},
|
|
13247
13602
|
plugin,
|
|
@@ -13257,8 +13612,44 @@ function enumToAst$2({ plugin, schema }) {
|
|
|
13257
13612
|
return resolver?.(ctx) ?? enumResolver$2(ctx);
|
|
13258
13613
|
}
|
|
13259
13614
|
//#endregion
|
|
13615
|
+
//#region src/plugins/zod/mini/toAst/intersection.ts
|
|
13616
|
+
function baseNode$37(ctx) {
|
|
13617
|
+
const { childResults, symbols } = ctx;
|
|
13618
|
+
const { z } = symbols;
|
|
13619
|
+
if (!childResults.length) return $(z).attr(identifiers.never).call();
|
|
13620
|
+
let expression = childResults[0].expression;
|
|
13621
|
+
childResults.slice(1).forEach((item) => {
|
|
13622
|
+
expression = $(z).attr(identifiers.intersection).call(expression, item.meta.hasLazy ? $(z).attr(identifiers.lazy).call($.func().do(item.expression.return())) : item.expression);
|
|
13623
|
+
});
|
|
13624
|
+
return expression;
|
|
13625
|
+
}
|
|
13626
|
+
function intersectionResolver$2(ctx) {
|
|
13627
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
13628
|
+
ctx.chain.current = baseResult;
|
|
13629
|
+
return ctx.chain.current;
|
|
13630
|
+
}
|
|
13631
|
+
function intersectionToAst$2({ childResults, parentSchema, plugin, schemas }) {
|
|
13632
|
+
const z = plugin.external("zod.z");
|
|
13633
|
+
const ctx = {
|
|
13634
|
+
$,
|
|
13635
|
+
chain: { current: $(z) },
|
|
13636
|
+
childResults,
|
|
13637
|
+
nodes: { base: baseNode$37 },
|
|
13638
|
+
parentSchema,
|
|
13639
|
+
plugin,
|
|
13640
|
+
schema: parentSchema,
|
|
13641
|
+
schemas,
|
|
13642
|
+
symbols: { z }
|
|
13643
|
+
};
|
|
13644
|
+
const resolver = plugin.config["~resolvers"]?.intersection;
|
|
13645
|
+
return {
|
|
13646
|
+
childResults,
|
|
13647
|
+
expression: resolver?.(ctx) ?? intersectionResolver$2(ctx)
|
|
13648
|
+
};
|
|
13649
|
+
}
|
|
13650
|
+
//#endregion
|
|
13260
13651
|
//#region src/plugins/zod/mini/toAst/never.ts
|
|
13261
|
-
function baseNode$
|
|
13652
|
+
function baseNode$36(ctx) {
|
|
13262
13653
|
const { symbols } = ctx;
|
|
13263
13654
|
const { z } = symbols;
|
|
13264
13655
|
return $(z).attr(identifiers.never).call();
|
|
@@ -13273,7 +13664,7 @@ function neverToAst$2({ plugin, schema }) {
|
|
|
13273
13664
|
const ctx = {
|
|
13274
13665
|
$,
|
|
13275
13666
|
chain: { current: $(z) },
|
|
13276
|
-
nodes: { base: baseNode$
|
|
13667
|
+
nodes: { base: baseNode$36 },
|
|
13277
13668
|
plugin,
|
|
13278
13669
|
schema,
|
|
13279
13670
|
symbols: { z }
|
|
@@ -13283,7 +13674,7 @@ function neverToAst$2({ plugin, schema }) {
|
|
|
13283
13674
|
}
|
|
13284
13675
|
//#endregion
|
|
13285
13676
|
//#region src/plugins/zod/mini/toAst/null.ts
|
|
13286
|
-
function baseNode$
|
|
13677
|
+
function baseNode$35(ctx) {
|
|
13287
13678
|
const { symbols } = ctx;
|
|
13288
13679
|
const { z } = symbols;
|
|
13289
13680
|
return $(z).attr(identifiers.null).call();
|
|
@@ -13298,7 +13689,7 @@ function nullToAst$2({ plugin, schema }) {
|
|
|
13298
13689
|
const ctx = {
|
|
13299
13690
|
$,
|
|
13300
13691
|
chain: { current: $(z) },
|
|
13301
|
-
nodes: { base: baseNode$
|
|
13692
|
+
nodes: { base: baseNode$35 },
|
|
13302
13693
|
plugin,
|
|
13303
13694
|
schema,
|
|
13304
13695
|
symbols: { z }
|
|
@@ -13308,7 +13699,7 @@ function nullToAst$2({ plugin, schema }) {
|
|
|
13308
13699
|
}
|
|
13309
13700
|
//#endregion
|
|
13310
13701
|
//#region src/plugins/zod/mini/toAst/number.ts
|
|
13311
|
-
function baseNode$
|
|
13702
|
+
function baseNode$34(ctx) {
|
|
13312
13703
|
const { schema, symbols } = ctx;
|
|
13313
13704
|
const { z } = symbols;
|
|
13314
13705
|
if (ctx.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
|
|
@@ -13360,7 +13751,7 @@ function numberToNode$2({ plugin, schema }) {
|
|
|
13360
13751
|
$,
|
|
13361
13752
|
chain: { current: $(z) },
|
|
13362
13753
|
nodes: {
|
|
13363
|
-
base: baseNode$
|
|
13754
|
+
base: baseNode$34,
|
|
13364
13755
|
const: constNode$10,
|
|
13365
13756
|
max: maxNode$2,
|
|
13366
13757
|
min: minNode$2
|
|
@@ -13386,7 +13777,7 @@ function additionalPropertiesNode$2(ctx) {
|
|
|
13386
13777
|
_childResults.push(additionalResult);
|
|
13387
13778
|
return applyModifiers(additionalResult, {}).expression;
|
|
13388
13779
|
}
|
|
13389
|
-
function baseNode$
|
|
13780
|
+
function baseNode$33(ctx) {
|
|
13390
13781
|
const { nodes, symbols } = ctx;
|
|
13391
13782
|
const { z } = symbols;
|
|
13392
13783
|
const additional = nodes.additionalProperties(ctx);
|
|
@@ -13421,7 +13812,7 @@ function objectToAst$2(options) {
|
|
|
13421
13812
|
chain: { current: $(z) },
|
|
13422
13813
|
nodes: {
|
|
13423
13814
|
additionalProperties: additionalPropertiesNode$2,
|
|
13424
|
-
base: baseNode$
|
|
13815
|
+
base: baseNode$33,
|
|
13425
13816
|
shape: shapeNode$2
|
|
13426
13817
|
},
|
|
13427
13818
|
plugin,
|
|
@@ -13438,7 +13829,7 @@ function objectToAst$2(options) {
|
|
|
13438
13829
|
}
|
|
13439
13830
|
//#endregion
|
|
13440
13831
|
//#region src/plugins/zod/mini/toAst/string.ts
|
|
13441
|
-
function baseNode$
|
|
13832
|
+
function baseNode$32(ctx) {
|
|
13442
13833
|
const { z } = ctx.symbols;
|
|
13443
13834
|
return $(z).attr(identifiers.string).call();
|
|
13444
13835
|
}
|
|
@@ -13521,7 +13912,7 @@ function stringToNode$2({ plugin, schema }) {
|
|
|
13521
13912
|
$,
|
|
13522
13913
|
chain: { current: $(z) },
|
|
13523
13914
|
nodes: {
|
|
13524
|
-
base: baseNode$
|
|
13915
|
+
base: baseNode$32,
|
|
13525
13916
|
const: constNode$9,
|
|
13526
13917
|
format: formatNode$2,
|
|
13527
13918
|
length: lengthNode$4,
|
|
@@ -13538,7 +13929,7 @@ function stringToNode$2({ plugin, schema }) {
|
|
|
13538
13929
|
}
|
|
13539
13930
|
//#endregion
|
|
13540
13931
|
//#region src/plugins/zod/mini/toAst/tuple.ts
|
|
13541
|
-
function baseNode$
|
|
13932
|
+
function baseNode$31(ctx) {
|
|
13542
13933
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
13543
13934
|
const { z } = symbols;
|
|
13544
13935
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
@@ -13576,7 +13967,7 @@ function tupleToAst$2({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
13576
13967
|
chain: { current: $(z) },
|
|
13577
13968
|
childResults,
|
|
13578
13969
|
nodes: {
|
|
13579
|
-
base: baseNode$
|
|
13970
|
+
base: baseNode$31,
|
|
13580
13971
|
const: constNode$8
|
|
13581
13972
|
},
|
|
13582
13973
|
plugin,
|
|
@@ -13593,7 +13984,7 @@ function tupleToAst$2({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
13593
13984
|
}
|
|
13594
13985
|
//#endregion
|
|
13595
13986
|
//#region src/plugins/zod/mini/toAst/undefined.ts
|
|
13596
|
-
function baseNode$
|
|
13987
|
+
function baseNode$30(ctx) {
|
|
13597
13988
|
const { symbols } = ctx;
|
|
13598
13989
|
const { z } = symbols;
|
|
13599
13990
|
return $(z).attr(identifiers.undefined).call();
|
|
@@ -13608,7 +13999,7 @@ function undefinedToAst$2({ plugin, schema }) {
|
|
|
13608
13999
|
const ctx = {
|
|
13609
14000
|
$,
|
|
13610
14001
|
chain: { current: $(z) },
|
|
13611
|
-
nodes: { base: baseNode$
|
|
14002
|
+
nodes: { base: baseNode$30 },
|
|
13612
14003
|
plugin,
|
|
13613
14004
|
schema,
|
|
13614
14005
|
symbols: { z }
|
|
@@ -13617,25 +14008,112 @@ function undefinedToAst$2({ plugin, schema }) {
|
|
|
13617
14008
|
return resolver?.(ctx) ?? undefinedResolver$2(ctx);
|
|
13618
14009
|
}
|
|
13619
14010
|
//#endregion
|
|
13620
|
-
//#region src/plugins/zod/
|
|
13621
|
-
function
|
|
13622
|
-
const
|
|
14011
|
+
//#region src/plugins/zod/shared/discriminated-union.ts
|
|
14012
|
+
function tryBuildDiscriminatedUnion({ items, parentSchema, plugin, schemas }) {
|
|
14013
|
+
const discriminatorKey = parentSchema.discriminator?.propertyName;
|
|
14014
|
+
if (!discriminatorKey) return null;
|
|
14015
|
+
const members = [];
|
|
14016
|
+
for (let index = 0; index < schemas.length; index++) {
|
|
14017
|
+
const schema = schemas[index];
|
|
14018
|
+
if (schema.type === "null" || schema.const === null) continue;
|
|
14019
|
+
if (schema.logicalOperator !== "and" || !schema.items || schema.items.length !== 2) return null;
|
|
14020
|
+
const refPart = schema.items[1];
|
|
14021
|
+
const discriminatedValue = schema.items[0].properties?.[discriminatorKey]?.const;
|
|
14022
|
+
if (discriminatedValue === void 0 || items[index].meta.hasLazy) return null;
|
|
14023
|
+
let refExpression;
|
|
14024
|
+
if (refPart.symbolRef) {
|
|
14025
|
+
if (refPart.symbolRef.meta?.isIntersection) return null;
|
|
14026
|
+
refExpression = $(refPart.symbolRef);
|
|
14027
|
+
} else if (refPart.$ref) {
|
|
14028
|
+
const query = {
|
|
14029
|
+
category: "schema",
|
|
14030
|
+
resource: "definition",
|
|
14031
|
+
resourceId: refPart.$ref,
|
|
14032
|
+
tool: "zod"
|
|
14033
|
+
};
|
|
14034
|
+
if ((plugin.querySymbol(query)?.meta)?.isIntersection) return null;
|
|
14035
|
+
refExpression = $(plugin.referenceSymbol(query));
|
|
14036
|
+
} else return null;
|
|
14037
|
+
members.push({
|
|
14038
|
+
discriminatedValue,
|
|
14039
|
+
refExpression
|
|
14040
|
+
});
|
|
14041
|
+
}
|
|
14042
|
+
if (!members.length) return null;
|
|
14043
|
+
return {
|
|
14044
|
+
discriminatorKey,
|
|
14045
|
+
members
|
|
14046
|
+
};
|
|
14047
|
+
}
|
|
14048
|
+
//#endregion
|
|
14049
|
+
//#region src/plugins/zod/mini/toAst/union.ts
|
|
14050
|
+
function baseNode$29(ctx) {
|
|
14051
|
+
const { childResults, parentSchema, plugin, schemas, symbols } = ctx;
|
|
13623
14052
|
const { z } = symbols;
|
|
13624
|
-
return $(z).attr(identifiers.
|
|
14053
|
+
if (!childResults.length) return $(z).attr(identifiers.null).call();
|
|
14054
|
+
const nonNullItems = [];
|
|
14055
|
+
childResults.forEach((result, index) => {
|
|
14056
|
+
const schema = schemas[index];
|
|
14057
|
+
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(result);
|
|
14058
|
+
});
|
|
14059
|
+
if (!nonNullItems.length) return $(z).attr(identifiers.null).call();
|
|
14060
|
+
if (nonNullItems.length === 1) return nonNullItems[0].expression;
|
|
14061
|
+
const discriminatedExpression = tryBuildDiscriminatedUnion({
|
|
14062
|
+
items: childResults,
|
|
14063
|
+
parentSchema,
|
|
14064
|
+
plugin,
|
|
14065
|
+
schemas
|
|
14066
|
+
});
|
|
14067
|
+
if (discriminatedExpression) {
|
|
14068
|
+
const unionMembers = discriminatedExpression.members.map((member) => $(z).attr(identifiers.extend).call(member.refExpression, $.object().prop(discriminatedExpression.discriminatorKey, $(z).attr(identifiers.literal).call($.fromValue(member.discriminatedValue)))));
|
|
14069
|
+
return $(z).attr(identifiers.discriminatedUnion).call($.literal(discriminatedExpression.discriminatorKey), $.array().pretty().elements(...unionMembers));
|
|
14070
|
+
}
|
|
14071
|
+
return $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
13625
14072
|
}
|
|
13626
|
-
function
|
|
14073
|
+
function unionResolver$2(ctx) {
|
|
13627
14074
|
const baseResult = ctx.nodes.base(ctx);
|
|
13628
14075
|
ctx.chain.current = baseResult;
|
|
13629
14076
|
return ctx.chain.current;
|
|
13630
14077
|
}
|
|
13631
|
-
function
|
|
14078
|
+
function unionToAst$2({ childResults, parentSchema, plugin, schemas }) {
|
|
13632
14079
|
const z = plugin.external("zod.z");
|
|
13633
14080
|
const ctx = {
|
|
13634
14081
|
$,
|
|
13635
14082
|
chain: { current: $(z) },
|
|
13636
|
-
|
|
14083
|
+
childResults,
|
|
14084
|
+
nodes: { base: baseNode$29 },
|
|
14085
|
+
parentSchema,
|
|
13637
14086
|
plugin,
|
|
13638
|
-
schema,
|
|
14087
|
+
schema: parentSchema,
|
|
14088
|
+
schemas,
|
|
14089
|
+
symbols: { z }
|
|
14090
|
+
};
|
|
14091
|
+
const resolver = plugin.config["~resolvers"]?.union;
|
|
14092
|
+
return {
|
|
14093
|
+
childResults,
|
|
14094
|
+
expression: resolver?.(ctx) ?? unionResolver$2(ctx)
|
|
14095
|
+
};
|
|
14096
|
+
}
|
|
14097
|
+
//#endregion
|
|
14098
|
+
//#region src/plugins/zod/mini/toAst/void.ts
|
|
14099
|
+
function baseNode$28(ctx) {
|
|
14100
|
+
const { symbols } = ctx;
|
|
14101
|
+
const { z } = symbols;
|
|
14102
|
+
return $(z).attr(identifiers.void).call();
|
|
14103
|
+
}
|
|
14104
|
+
function voidResolver$2(ctx) {
|
|
14105
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
14106
|
+
ctx.chain.current = baseResult;
|
|
14107
|
+
return ctx.chain.current;
|
|
14108
|
+
}
|
|
14109
|
+
function voidToAst$2({ plugin, schema }) {
|
|
14110
|
+
const z = plugin.external("zod.z");
|
|
14111
|
+
const ctx = {
|
|
14112
|
+
$,
|
|
14113
|
+
chain: { current: $(z) },
|
|
14114
|
+
nodes: { base: baseNode$28 },
|
|
14115
|
+
plugin,
|
|
14116
|
+
schema,
|
|
13639
14117
|
symbols: { z }
|
|
13640
14118
|
};
|
|
13641
14119
|
const resolver = plugin.config["~resolvers"]?.void;
|
|
@@ -13643,6 +14121,9 @@ function voidToAst$2({ plugin, schema }) {
|
|
|
13643
14121
|
}
|
|
13644
14122
|
//#endregion
|
|
13645
14123
|
//#region src/plugins/zod/mini/walker.ts
|
|
14124
|
+
function getDefaultValue$2(meta) {
|
|
14125
|
+
return meta.format ? maybeBigInt(meta.default, meta.format) : $.fromValue(meta.default);
|
|
14126
|
+
}
|
|
13646
14127
|
function createVisitor$2(config = {}) {
|
|
13647
14128
|
const { schemaExtractor } = config;
|
|
13648
14129
|
return {
|
|
@@ -13651,12 +14132,12 @@ function createVisitor$2(config = {}) {
|
|
|
13651
14132
|
const z = ctx.plugin.external("zod.z");
|
|
13652
14133
|
let expression = result.expression;
|
|
13653
14134
|
if (result.meta.readonly) expression = $(z).attr(identifiers.readonly).call(expression);
|
|
13654
|
-
const
|
|
14135
|
+
const needsDefault = result.meta.default !== void 0;
|
|
13655
14136
|
const needsNullable = result.meta.nullable;
|
|
13656
14137
|
if (optional && needsNullable) expression = $(z).attr(identifiers.nullish).call(expression);
|
|
13657
14138
|
else if (optional) expression = $(z).attr(identifiers.optional).call(expression);
|
|
13658
14139
|
else if (needsNullable) expression = $(z).attr(identifiers.nullable).call(expression);
|
|
13659
|
-
if (
|
|
14140
|
+
if (needsDefault) expression = $(z).attr(identifiers._default).call(expression, getDefaultValue$2(result.meta));
|
|
13660
14141
|
return { expression };
|
|
13661
14142
|
},
|
|
13662
14143
|
array(schema, ctx, walk) {
|
|
@@ -13728,11 +14209,12 @@ function createVisitor$2(config = {}) {
|
|
|
13728
14209
|
};
|
|
13729
14210
|
},
|
|
13730
14211
|
intersection(items, schemas, parentSchema, ctx) {
|
|
13731
|
-
const z = ctx.plugin.external("zod.z");
|
|
13732
14212
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
13733
|
-
|
|
13734
|
-
|
|
13735
|
-
|
|
14213
|
+
const { expression } = intersectionToAst$2({
|
|
14214
|
+
childResults: items,
|
|
14215
|
+
parentSchema,
|
|
14216
|
+
plugin: ctx.plugin,
|
|
14217
|
+
schemas
|
|
13736
14218
|
});
|
|
13737
14219
|
return {
|
|
13738
14220
|
expression,
|
|
@@ -13740,6 +14222,7 @@ function createVisitor$2(config = {}) {
|
|
|
13740
14222
|
default: parentSchema.default,
|
|
13741
14223
|
format: parentSchema.format,
|
|
13742
14224
|
hasLazy: hasAnyLazy,
|
|
14225
|
+
isIntersection: true,
|
|
13743
14226
|
isLazy: false,
|
|
13744
14227
|
nullable: items.some((i) => i.meta.nullable),
|
|
13745
14228
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -13886,24 +14369,21 @@ function createVisitor$2(config = {}) {
|
|
|
13886
14369
|
};
|
|
13887
14370
|
},
|
|
13888
14371
|
union(items, schemas, parentSchema, ctx) {
|
|
13889
|
-
const z = ctx.plugin.external("zod.z");
|
|
13890
14372
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
13891
14373
|
const hasNull = schemas.some((s) => s.type === "null") || items.some((i) => i.meta.nullable);
|
|
13892
|
-
const
|
|
13893
|
-
|
|
13894
|
-
|
|
13895
|
-
|
|
14374
|
+
const { expression } = unionToAst$2({
|
|
14375
|
+
childResults: items,
|
|
14376
|
+
parentSchema,
|
|
14377
|
+
plugin: ctx.plugin,
|
|
14378
|
+
schemas
|
|
13896
14379
|
});
|
|
13897
|
-
let expression;
|
|
13898
|
-
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
13899
|
-
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
13900
|
-
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
13901
14380
|
return {
|
|
13902
14381
|
expression,
|
|
13903
14382
|
meta: {
|
|
13904
14383
|
default: parentSchema.default,
|
|
13905
14384
|
format: parentSchema.format,
|
|
13906
14385
|
hasLazy: hasAnyLazy,
|
|
14386
|
+
isIntersection: false,
|
|
13907
14387
|
isLazy: false,
|
|
13908
14388
|
nullable: hasNull,
|
|
13909
14389
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -13975,6 +14455,10 @@ function createProcessor$2(plugin) {
|
|
|
13975
14455
|
exportAst({
|
|
13976
14456
|
...ctx,
|
|
13977
14457
|
final,
|
|
14458
|
+
meta: result.meta.isIntersection ? {
|
|
14459
|
+
...ctx.meta,
|
|
14460
|
+
isIntersection: true
|
|
14461
|
+
} : ctx.meta,
|
|
13978
14462
|
plugin
|
|
13979
14463
|
});
|
|
13980
14464
|
return;
|
|
@@ -14057,7 +14541,7 @@ const handlerMini = ({ plugin }) => {
|
|
|
14057
14541
|
};
|
|
14058
14542
|
//#endregion
|
|
14059
14543
|
//#region src/plugins/zod/v3/toAst/unknown.ts
|
|
14060
|
-
function baseNode$
|
|
14544
|
+
function baseNode$27(ctx) {
|
|
14061
14545
|
const { symbols } = ctx;
|
|
14062
14546
|
const { z } = symbols;
|
|
14063
14547
|
return $(z).attr(identifiers.unknown).call();
|
|
@@ -14072,7 +14556,7 @@ function unknownToAst$1({ plugin, schema }) {
|
|
|
14072
14556
|
const ctx = {
|
|
14073
14557
|
$,
|
|
14074
14558
|
chain: { current: $(z) },
|
|
14075
|
-
nodes: { base: baseNode$
|
|
14559
|
+
nodes: { base: baseNode$27 },
|
|
14076
14560
|
plugin,
|
|
14077
14561
|
schema,
|
|
14078
14562
|
symbols: { z }
|
|
@@ -14082,7 +14566,7 @@ function unknownToAst$1({ plugin, schema }) {
|
|
|
14082
14566
|
}
|
|
14083
14567
|
//#endregion
|
|
14084
14568
|
//#region src/plugins/zod/v3/toAst/array.ts
|
|
14085
|
-
function baseNode$
|
|
14569
|
+
function baseNode$26(ctx) {
|
|
14086
14570
|
const { applyModifiers, childResults, plugin, schema, symbols } = ctx;
|
|
14087
14571
|
const { z } = symbols;
|
|
14088
14572
|
const arrayFn = $(z).attr(identifiers.array);
|
|
@@ -14158,7 +14642,7 @@ function arrayToAst$1({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
14158
14642
|
chain: { current: $(z) },
|
|
14159
14643
|
childResults,
|
|
14160
14644
|
nodes: {
|
|
14161
|
-
base: baseNode$
|
|
14645
|
+
base: baseNode$26,
|
|
14162
14646
|
length: lengthNode$3,
|
|
14163
14647
|
maxLength: maxLengthNode$3,
|
|
14164
14648
|
minLength: minLengthNode$3
|
|
@@ -14177,7 +14661,7 @@ function arrayToAst$1({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
14177
14661
|
}
|
|
14178
14662
|
//#endregion
|
|
14179
14663
|
//#region src/plugins/zod/v3/toAst/boolean.ts
|
|
14180
|
-
function baseNode$
|
|
14664
|
+
function baseNode$25(ctx) {
|
|
14181
14665
|
const { symbols } = ctx;
|
|
14182
14666
|
const { z } = symbols;
|
|
14183
14667
|
return $(z).attr(identifiers.boolean).call();
|
|
@@ -14204,7 +14688,7 @@ function booleanToAst$1({ plugin, schema }) {
|
|
|
14204
14688
|
$,
|
|
14205
14689
|
chain: { current: $(z) },
|
|
14206
14690
|
nodes: {
|
|
14207
|
-
base: baseNode$
|
|
14691
|
+
base: baseNode$25,
|
|
14208
14692
|
const: constNode$7
|
|
14209
14693
|
},
|
|
14210
14694
|
plugin,
|
|
@@ -14243,7 +14727,7 @@ function itemsNode$1(ctx) {
|
|
|
14243
14727
|
literalMembers
|
|
14244
14728
|
};
|
|
14245
14729
|
}
|
|
14246
|
-
function baseNode$
|
|
14730
|
+
function baseNode$24(ctx) {
|
|
14247
14731
|
const { symbols } = ctx;
|
|
14248
14732
|
const { z } = symbols;
|
|
14249
14733
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
@@ -14264,7 +14748,7 @@ function enumToAst$1({ plugin, schema }) {
|
|
|
14264
14748
|
$,
|
|
14265
14749
|
chain: { current: $(z) },
|
|
14266
14750
|
nodes: {
|
|
14267
|
-
base: baseNode$
|
|
14751
|
+
base: baseNode$24,
|
|
14268
14752
|
items: itemsNode$1
|
|
14269
14753
|
},
|
|
14270
14754
|
plugin,
|
|
@@ -14275,8 +14759,46 @@ function enumToAst$1({ plugin, schema }) {
|
|
|
14275
14759
|
return resolver?.(ctx) ?? enumResolver$1(ctx);
|
|
14276
14760
|
}
|
|
14277
14761
|
//#endregion
|
|
14762
|
+
//#region src/plugins/zod/v3/toAst/intersection.ts
|
|
14763
|
+
function baseNode$23(ctx) {
|
|
14764
|
+
const { childResults, schemas, symbols } = ctx;
|
|
14765
|
+
const { z } = symbols;
|
|
14766
|
+
if (!childResults.length) return $(z).attr(identifiers.never).call();
|
|
14767
|
+
const firstSchema = schemas[0];
|
|
14768
|
+
if (firstSchema?.logicalOperator === "or" || firstSchema?.type && firstSchema.type !== "object") return $(z).attr(identifiers.intersection).call(...childResults.map((result) => result.expression));
|
|
14769
|
+
let expression = childResults[0].expression;
|
|
14770
|
+
childResults.slice(1).forEach((item) => {
|
|
14771
|
+
expression = expression.attr(identifiers.and).call(item.meta.hasLazy && !item.meta.isLazy ? $(z).attr(identifiers.lazy).call($.func().do(item.expression.return())) : item.expression);
|
|
14772
|
+
});
|
|
14773
|
+
return expression;
|
|
14774
|
+
}
|
|
14775
|
+
function intersectionResolver$1(ctx) {
|
|
14776
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
14777
|
+
ctx.chain.current = baseResult;
|
|
14778
|
+
return ctx.chain.current;
|
|
14779
|
+
}
|
|
14780
|
+
function intersectionToAst$1({ childResults, parentSchema, plugin, schemas }) {
|
|
14781
|
+
const z = plugin.external("zod.z");
|
|
14782
|
+
const ctx = {
|
|
14783
|
+
$,
|
|
14784
|
+
chain: { current: $(z) },
|
|
14785
|
+
childResults,
|
|
14786
|
+
nodes: { base: baseNode$23 },
|
|
14787
|
+
parentSchema,
|
|
14788
|
+
plugin,
|
|
14789
|
+
schema: parentSchema,
|
|
14790
|
+
schemas,
|
|
14791
|
+
symbols: { z }
|
|
14792
|
+
};
|
|
14793
|
+
const resolver = plugin.config["~resolvers"]?.intersection;
|
|
14794
|
+
return {
|
|
14795
|
+
childResults,
|
|
14796
|
+
expression: resolver?.(ctx) ?? intersectionResolver$1(ctx)
|
|
14797
|
+
};
|
|
14798
|
+
}
|
|
14799
|
+
//#endregion
|
|
14278
14800
|
//#region src/plugins/zod/v3/toAst/never.ts
|
|
14279
|
-
function baseNode$
|
|
14801
|
+
function baseNode$22(ctx) {
|
|
14280
14802
|
const { symbols } = ctx;
|
|
14281
14803
|
const { z } = symbols;
|
|
14282
14804
|
return $(z).attr(identifiers.never).call();
|
|
@@ -14291,7 +14813,7 @@ function neverToAst$1({ plugin, schema }) {
|
|
|
14291
14813
|
const ctx = {
|
|
14292
14814
|
$,
|
|
14293
14815
|
chain: { current: $(z) },
|
|
14294
|
-
nodes: { base: baseNode$
|
|
14816
|
+
nodes: { base: baseNode$22 },
|
|
14295
14817
|
plugin,
|
|
14296
14818
|
schema,
|
|
14297
14819
|
symbols: { z }
|
|
@@ -14301,7 +14823,7 @@ function neverToAst$1({ plugin, schema }) {
|
|
|
14301
14823
|
}
|
|
14302
14824
|
//#endregion
|
|
14303
14825
|
//#region src/plugins/zod/v3/toAst/null.ts
|
|
14304
|
-
function baseNode$
|
|
14826
|
+
function baseNode$21(ctx) {
|
|
14305
14827
|
const { symbols } = ctx;
|
|
14306
14828
|
const { z } = symbols;
|
|
14307
14829
|
return $(z).attr(identifiers.null).call();
|
|
@@ -14316,7 +14838,7 @@ function nullToAst$1({ plugin, schema }) {
|
|
|
14316
14838
|
const ctx = {
|
|
14317
14839
|
$,
|
|
14318
14840
|
chain: { current: $(z) },
|
|
14319
|
-
nodes: { base: baseNode$
|
|
14841
|
+
nodes: { base: baseNode$21 },
|
|
14320
14842
|
plugin,
|
|
14321
14843
|
schema,
|
|
14322
14844
|
symbols: { z }
|
|
@@ -14326,7 +14848,7 @@ function nullToAst$1({ plugin, schema }) {
|
|
|
14326
14848
|
}
|
|
14327
14849
|
//#endregion
|
|
14328
14850
|
//#region src/plugins/zod/v3/toAst/number.ts
|
|
14329
|
-
function baseNode$
|
|
14851
|
+
function baseNode$20(ctx) {
|
|
14330
14852
|
const { schema, symbols } = ctx;
|
|
14331
14853
|
const { z } = symbols;
|
|
14332
14854
|
if (ctx.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
|
|
@@ -14374,7 +14896,7 @@ function numberToNode$1({ plugin, schema }) {
|
|
|
14374
14896
|
$,
|
|
14375
14897
|
chain: { current: $(z) },
|
|
14376
14898
|
nodes: {
|
|
14377
|
-
base: baseNode$
|
|
14899
|
+
base: baseNode$20,
|
|
14378
14900
|
const: constNode$6,
|
|
14379
14901
|
max: maxNode$1,
|
|
14380
14902
|
min: minNode$1
|
|
@@ -14400,7 +14922,7 @@ function additionalPropertiesNode$1(ctx) {
|
|
|
14400
14922
|
ctx._childResults.push(additionalResult);
|
|
14401
14923
|
return applyModifiers(additionalResult, {}).expression;
|
|
14402
14924
|
}
|
|
14403
|
-
function baseNode$
|
|
14925
|
+
function baseNode$19(ctx) {
|
|
14404
14926
|
const { nodes, symbols } = ctx;
|
|
14405
14927
|
const { z } = symbols;
|
|
14406
14928
|
const additional = nodes.additionalProperties(ctx);
|
|
@@ -14435,7 +14957,7 @@ function objectToAst$1(options) {
|
|
|
14435
14957
|
chain: { current: $(z) },
|
|
14436
14958
|
nodes: {
|
|
14437
14959
|
additionalProperties: additionalPropertiesNode$1,
|
|
14438
|
-
base: baseNode$
|
|
14960
|
+
base: baseNode$19,
|
|
14439
14961
|
shape: shapeNode$1
|
|
14440
14962
|
},
|
|
14441
14963
|
plugin,
|
|
@@ -14452,7 +14974,7 @@ function objectToAst$1(options) {
|
|
|
14452
14974
|
}
|
|
14453
14975
|
//#endregion
|
|
14454
14976
|
//#region src/plugins/zod/v3/toAst/string.ts
|
|
14455
|
-
function baseNode$
|
|
14977
|
+
function baseNode$18(ctx) {
|
|
14456
14978
|
const { z } = ctx.symbols;
|
|
14457
14979
|
return $(z).attr(identifiers.string).call();
|
|
14458
14980
|
}
|
|
@@ -14527,7 +15049,7 @@ function stringToNode$1({ plugin, schema }) {
|
|
|
14527
15049
|
$,
|
|
14528
15050
|
chain: { current: $(z) },
|
|
14529
15051
|
nodes: {
|
|
14530
|
-
base: baseNode$
|
|
15052
|
+
base: baseNode$18,
|
|
14531
15053
|
const: constNode$5,
|
|
14532
15054
|
format: formatNode$1,
|
|
14533
15055
|
length: lengthNode$2,
|
|
@@ -14544,7 +15066,7 @@ function stringToNode$1({ plugin, schema }) {
|
|
|
14544
15066
|
}
|
|
14545
15067
|
//#endregion
|
|
14546
15068
|
//#region src/plugins/zod/v3/toAst/tuple.ts
|
|
14547
|
-
function baseNode$
|
|
15069
|
+
function baseNode$17(ctx) {
|
|
14548
15070
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
14549
15071
|
const { z } = symbols;
|
|
14550
15072
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
@@ -14582,7 +15104,7 @@ function tupleToAst$1({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
14582
15104
|
chain: { current: $(z) },
|
|
14583
15105
|
childResults,
|
|
14584
15106
|
nodes: {
|
|
14585
|
-
base: baseNode$
|
|
15107
|
+
base: baseNode$17,
|
|
14586
15108
|
const: constNode$4
|
|
14587
15109
|
},
|
|
14588
15110
|
plugin,
|
|
@@ -14599,7 +15121,7 @@ function tupleToAst$1({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
14599
15121
|
}
|
|
14600
15122
|
//#endregion
|
|
14601
15123
|
//#region src/plugins/zod/v3/toAst/undefined.ts
|
|
14602
|
-
function baseNode$
|
|
15124
|
+
function baseNode$16(ctx) {
|
|
14603
15125
|
const { symbols } = ctx;
|
|
14604
15126
|
const { z } = symbols;
|
|
14605
15127
|
return $(z).attr(identifiers.undefined).call();
|
|
@@ -14614,7 +15136,7 @@ function undefinedToAst$1({ plugin, schema }) {
|
|
|
14614
15136
|
const ctx = {
|
|
14615
15137
|
$,
|
|
14616
15138
|
chain: { current: $(z) },
|
|
14617
|
-
nodes: { base: baseNode$
|
|
15139
|
+
nodes: { base: baseNode$16 },
|
|
14618
15140
|
plugin,
|
|
14619
15141
|
schema,
|
|
14620
15142
|
symbols: { z }
|
|
@@ -14623,8 +15145,57 @@ function undefinedToAst$1({ plugin, schema }) {
|
|
|
14623
15145
|
return resolver?.(ctx) ?? undefinedResolver$1(ctx);
|
|
14624
15146
|
}
|
|
14625
15147
|
//#endregion
|
|
15148
|
+
//#region src/plugins/zod/v3/toAst/union.ts
|
|
15149
|
+
function baseNode$15(ctx) {
|
|
15150
|
+
const { childResults, parentSchema, plugin, schemas, symbols } = ctx;
|
|
15151
|
+
const { z } = symbols;
|
|
15152
|
+
if (!childResults.length) return $(z).attr(identifiers.null).call();
|
|
15153
|
+
const nonNullItems = [];
|
|
15154
|
+
childResults.forEach((result, index) => {
|
|
15155
|
+
const schema = schemas[index];
|
|
15156
|
+
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(result);
|
|
15157
|
+
});
|
|
15158
|
+
if (!nonNullItems.length) return $(z).attr(identifiers.null).call();
|
|
15159
|
+
if (nonNullItems.length === 1) return nonNullItems[0].expression;
|
|
15160
|
+
const discriminatedExpression = tryBuildDiscriminatedUnion({
|
|
15161
|
+
items: childResults,
|
|
15162
|
+
parentSchema,
|
|
15163
|
+
plugin,
|
|
15164
|
+
schemas
|
|
15165
|
+
});
|
|
15166
|
+
if (discriminatedExpression) {
|
|
15167
|
+
const unionMembers = discriminatedExpression.members.map((member) => member.refExpression.attr(identifiers.extend).call($.object().prop(discriminatedExpression.discriminatorKey, $(z).attr(identifiers.literal).call($.fromValue(member.discriminatedValue)))));
|
|
15168
|
+
return $(z).attr(identifiers.discriminatedUnion).call($.literal(discriminatedExpression.discriminatorKey), $.array().pretty().elements(...unionMembers));
|
|
15169
|
+
}
|
|
15170
|
+
return $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
15171
|
+
}
|
|
15172
|
+
function unionResolver$1(ctx) {
|
|
15173
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
15174
|
+
ctx.chain.current = baseResult;
|
|
15175
|
+
return ctx.chain.current;
|
|
15176
|
+
}
|
|
15177
|
+
function unionToAst$1({ childResults, parentSchema, plugin, schemas }) {
|
|
15178
|
+
const z = plugin.external("zod.z");
|
|
15179
|
+
const ctx = {
|
|
15180
|
+
$,
|
|
15181
|
+
chain: { current: $(z) },
|
|
15182
|
+
childResults,
|
|
15183
|
+
nodes: { base: baseNode$15 },
|
|
15184
|
+
parentSchema,
|
|
15185
|
+
plugin,
|
|
15186
|
+
schema: parentSchema,
|
|
15187
|
+
schemas,
|
|
15188
|
+
symbols: { z }
|
|
15189
|
+
};
|
|
15190
|
+
const resolver = plugin.config["~resolvers"]?.union;
|
|
15191
|
+
return {
|
|
15192
|
+
childResults,
|
|
15193
|
+
expression: resolver?.(ctx) ?? unionResolver$1(ctx)
|
|
15194
|
+
};
|
|
15195
|
+
}
|
|
15196
|
+
//#endregion
|
|
14626
15197
|
//#region src/plugins/zod/v3/toAst/void.ts
|
|
14627
|
-
function baseNode$
|
|
15198
|
+
function baseNode$14(ctx) {
|
|
14628
15199
|
const { symbols } = ctx;
|
|
14629
15200
|
const { z } = symbols;
|
|
14630
15201
|
return $(z).attr(identifiers.void).call();
|
|
@@ -14639,7 +15210,7 @@ function voidToAst$1({ plugin, schema }) {
|
|
|
14639
15210
|
const ctx = {
|
|
14640
15211
|
$,
|
|
14641
15212
|
chain: { current: $(z) },
|
|
14642
|
-
nodes: { base: baseNode$
|
|
15213
|
+
nodes: { base: baseNode$14 },
|
|
14643
15214
|
plugin,
|
|
14644
15215
|
schema,
|
|
14645
15216
|
symbols: { z }
|
|
@@ -14649,6 +15220,9 @@ function voidToAst$1({ plugin, schema }) {
|
|
|
14649
15220
|
}
|
|
14650
15221
|
//#endregion
|
|
14651
15222
|
//#region src/plugins/zod/v3/walker.ts
|
|
15223
|
+
function getDefaultValue$1(meta) {
|
|
15224
|
+
return meta.format ? maybeBigInt(meta.default, meta.format) : $.fromValue(meta.default);
|
|
15225
|
+
}
|
|
14652
15226
|
function createVisitor$1(config = {}) {
|
|
14653
15227
|
const { schemaExtractor } = config;
|
|
14654
15228
|
return {
|
|
@@ -14656,12 +15230,12 @@ function createVisitor$1(config = {}) {
|
|
|
14656
15230
|
const { optional } = options;
|
|
14657
15231
|
let expression = result.expression;
|
|
14658
15232
|
if (result.meta.readonly) expression = expression.attr(identifiers.readonly).call();
|
|
14659
|
-
const
|
|
15233
|
+
const needsDefault = result.meta.default !== void 0;
|
|
14660
15234
|
const needsNullable = result.meta.nullable;
|
|
14661
15235
|
if (optional && needsNullable) expression = expression.attr(identifiers.nullish).call();
|
|
14662
15236
|
else if (optional) expression = expression.attr(identifiers.optional).call();
|
|
14663
15237
|
else if (needsNullable) expression = expression.attr(identifiers.nullable).call();
|
|
14664
|
-
if (
|
|
15238
|
+
if (needsDefault) expression = expression.attr(identifiers.default).call(getDefaultValue$1(result.meta));
|
|
14665
15239
|
return {
|
|
14666
15240
|
expression,
|
|
14667
15241
|
typeName: result.meta.hasLazy ? result.meta.isObject ? identifiers.AnyZodObject : identifiers.ZodTypeAny : void 0
|
|
@@ -14736,23 +15310,20 @@ function createVisitor$1(config = {}) {
|
|
|
14736
15310
|
};
|
|
14737
15311
|
},
|
|
14738
15312
|
intersection(items, schemas, parentSchema, ctx) {
|
|
14739
|
-
const z = ctx.plugin.external("zod.z");
|
|
14740
15313
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
14741
|
-
const
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
expression = expression.attr(identifiers.and).call(item.meta.hasLazy && !item.meta.isLazy ? $(z).attr(identifiers.lazy).call($.func().do(item.expression.return())) : item.expression);
|
|
14748
|
-
});
|
|
14749
|
-
}
|
|
15314
|
+
const { expression } = intersectionToAst$1({
|
|
15315
|
+
childResults: items,
|
|
15316
|
+
parentSchema,
|
|
15317
|
+
plugin: ctx.plugin,
|
|
15318
|
+
schemas
|
|
15319
|
+
});
|
|
14750
15320
|
return {
|
|
14751
15321
|
expression,
|
|
14752
15322
|
meta: {
|
|
14753
15323
|
default: parentSchema.default,
|
|
14754
15324
|
format: parentSchema.format,
|
|
14755
15325
|
hasLazy: hasAnyLazy,
|
|
15326
|
+
isIntersection: true,
|
|
14756
15327
|
isLazy: false,
|
|
14757
15328
|
nullable: items.some((i) => i.meta.nullable),
|
|
14758
15329
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -14890,24 +15461,21 @@ function createVisitor$1(config = {}) {
|
|
|
14890
15461
|
};
|
|
14891
15462
|
},
|
|
14892
15463
|
union(items, schemas, parentSchema, ctx) {
|
|
14893
|
-
const z = ctx.plugin.external("zod.z");
|
|
14894
15464
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
14895
15465
|
const hasNull = schemas.some((s) => s.type === "null") || items.some((i) => i.meta.nullable);
|
|
14896
|
-
const
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
15466
|
+
const { expression } = unionToAst$1({
|
|
15467
|
+
childResults: items,
|
|
15468
|
+
parentSchema,
|
|
15469
|
+
plugin: ctx.plugin,
|
|
15470
|
+
schemas
|
|
14900
15471
|
});
|
|
14901
|
-
let expression;
|
|
14902
|
-
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
14903
|
-
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
14904
|
-
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
14905
15472
|
return {
|
|
14906
15473
|
expression,
|
|
14907
15474
|
meta: {
|
|
14908
15475
|
default: parentSchema.default,
|
|
14909
15476
|
format: parentSchema.format,
|
|
14910
15477
|
hasLazy: hasAnyLazy,
|
|
15478
|
+
isIntersection: false,
|
|
14911
15479
|
isLazy: false,
|
|
14912
15480
|
nullable: hasNull,
|
|
14913
15481
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -14979,6 +15547,10 @@ function createProcessor$1(plugin) {
|
|
|
14979
15547
|
exportAst({
|
|
14980
15548
|
...ctx,
|
|
14981
15549
|
final,
|
|
15550
|
+
meta: result.meta.isIntersection ? {
|
|
15551
|
+
...ctx.meta,
|
|
15552
|
+
isIntersection: true
|
|
15553
|
+
} : ctx.meta,
|
|
14982
15554
|
plugin
|
|
14983
15555
|
});
|
|
14984
15556
|
return;
|
|
@@ -15060,7 +15632,7 @@ const handlerV3 = ({ plugin }) => {
|
|
|
15060
15632
|
};
|
|
15061
15633
|
//#endregion
|
|
15062
15634
|
//#region src/plugins/zod/v4/toAst/unknown.ts
|
|
15063
|
-
function baseNode$
|
|
15635
|
+
function baseNode$13(ctx) {
|
|
15064
15636
|
const { symbols } = ctx;
|
|
15065
15637
|
const { z } = symbols;
|
|
15066
15638
|
return $(z).attr(identifiers.unknown).call();
|
|
@@ -15075,7 +15647,7 @@ function unknownToAst({ plugin, schema }) {
|
|
|
15075
15647
|
const ctx = {
|
|
15076
15648
|
$,
|
|
15077
15649
|
chain: { current: $(z) },
|
|
15078
|
-
nodes: { base: baseNode$
|
|
15650
|
+
nodes: { base: baseNode$13 },
|
|
15079
15651
|
plugin,
|
|
15080
15652
|
schema,
|
|
15081
15653
|
symbols: { z }
|
|
@@ -15085,7 +15657,7 @@ function unknownToAst({ plugin, schema }) {
|
|
|
15085
15657
|
}
|
|
15086
15658
|
//#endregion
|
|
15087
15659
|
//#region src/plugins/zod/v4/toAst/array.ts
|
|
15088
|
-
function baseNode$
|
|
15660
|
+
function baseNode$12(ctx) {
|
|
15089
15661
|
const { applyModifiers, childResults, plugin, schema, symbols } = ctx;
|
|
15090
15662
|
const { z } = symbols;
|
|
15091
15663
|
const arrayFn = $(z).attr(identifiers.array);
|
|
@@ -15161,7 +15733,7 @@ function arrayToAst({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
15161
15733
|
chain: { current: $(z) },
|
|
15162
15734
|
childResults,
|
|
15163
15735
|
nodes: {
|
|
15164
|
-
base: baseNode$
|
|
15736
|
+
base: baseNode$12,
|
|
15165
15737
|
length: lengthNode$1,
|
|
15166
15738
|
maxLength: maxLengthNode$1,
|
|
15167
15739
|
minLength: minLengthNode$1
|
|
@@ -15180,7 +15752,7 @@ function arrayToAst({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
15180
15752
|
}
|
|
15181
15753
|
//#endregion
|
|
15182
15754
|
//#region src/plugins/zod/v4/toAst/boolean.ts
|
|
15183
|
-
function baseNode$
|
|
15755
|
+
function baseNode$11(ctx) {
|
|
15184
15756
|
const { symbols } = ctx;
|
|
15185
15757
|
const { z } = symbols;
|
|
15186
15758
|
return $(z).attr(identifiers.boolean).call();
|
|
@@ -15207,7 +15779,7 @@ function booleanToAst({ plugin, schema }) {
|
|
|
15207
15779
|
$,
|
|
15208
15780
|
chain: { current: $(z) },
|
|
15209
15781
|
nodes: {
|
|
15210
|
-
base: baseNode$
|
|
15782
|
+
base: baseNode$11,
|
|
15211
15783
|
const: constNode$3
|
|
15212
15784
|
},
|
|
15213
15785
|
plugin,
|
|
@@ -15246,7 +15818,7 @@ function itemsNode(ctx) {
|
|
|
15246
15818
|
literalMembers
|
|
15247
15819
|
};
|
|
15248
15820
|
}
|
|
15249
|
-
function baseNode$
|
|
15821
|
+
function baseNode$10(ctx) {
|
|
15250
15822
|
const { symbols } = ctx;
|
|
15251
15823
|
const { z } = symbols;
|
|
15252
15824
|
const { allStrings, enumMembers, literalMembers } = ctx.nodes.items(ctx);
|
|
@@ -15267,7 +15839,7 @@ function enumToAst({ plugin, schema }) {
|
|
|
15267
15839
|
$,
|
|
15268
15840
|
chain: { current: $(z) },
|
|
15269
15841
|
nodes: {
|
|
15270
|
-
base: baseNode$
|
|
15842
|
+
base: baseNode$10,
|
|
15271
15843
|
items: itemsNode
|
|
15272
15844
|
},
|
|
15273
15845
|
plugin,
|
|
@@ -15283,8 +15855,46 @@ function enumToAst({ plugin, schema }) {
|
|
|
15283
15855
|
return resolver?.(ctx) ?? enumResolver(ctx);
|
|
15284
15856
|
}
|
|
15285
15857
|
//#endregion
|
|
15858
|
+
//#region src/plugins/zod/v4/toAst/intersection.ts
|
|
15859
|
+
function baseNode$9(ctx) {
|
|
15860
|
+
const { childResults, schemas, symbols } = ctx;
|
|
15861
|
+
const { z } = symbols;
|
|
15862
|
+
if (!childResults.length) return $(z).attr(identifiers.never).call();
|
|
15863
|
+
const firstSchema = schemas[0];
|
|
15864
|
+
if (firstSchema?.logicalOperator === "or" || firstSchema?.type && firstSchema.type !== "object") return $(z).attr(identifiers.intersection).call(...childResults.map((result) => result.expression));
|
|
15865
|
+
let expression = childResults[0].expression;
|
|
15866
|
+
childResults.slice(1).forEach((item) => {
|
|
15867
|
+
expression = expression.attr(identifiers.and).call(item.meta.hasLazy ? $(z).attr(identifiers.lazy).call($.func().do(item.expression.return())) : item.expression);
|
|
15868
|
+
});
|
|
15869
|
+
return expression;
|
|
15870
|
+
}
|
|
15871
|
+
function intersectionResolver(ctx) {
|
|
15872
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
15873
|
+
ctx.chain.current = baseResult;
|
|
15874
|
+
return ctx.chain.current;
|
|
15875
|
+
}
|
|
15876
|
+
function intersectionToAst({ childResults, parentSchema, plugin, schemas }) {
|
|
15877
|
+
const z = plugin.external("zod.z");
|
|
15878
|
+
const ctx = {
|
|
15879
|
+
$,
|
|
15880
|
+
chain: { current: $(z) },
|
|
15881
|
+
childResults,
|
|
15882
|
+
nodes: { base: baseNode$9 },
|
|
15883
|
+
parentSchema,
|
|
15884
|
+
plugin,
|
|
15885
|
+
schema: parentSchema,
|
|
15886
|
+
schemas,
|
|
15887
|
+
symbols: { z }
|
|
15888
|
+
};
|
|
15889
|
+
const resolver = plugin.config["~resolvers"]?.intersection;
|
|
15890
|
+
return {
|
|
15891
|
+
childResults,
|
|
15892
|
+
expression: resolver?.(ctx) ?? intersectionResolver(ctx)
|
|
15893
|
+
};
|
|
15894
|
+
}
|
|
15895
|
+
//#endregion
|
|
15286
15896
|
//#region src/plugins/zod/v4/toAst/never.ts
|
|
15287
|
-
function baseNode$
|
|
15897
|
+
function baseNode$8(ctx) {
|
|
15288
15898
|
const { symbols } = ctx;
|
|
15289
15899
|
const { z } = symbols;
|
|
15290
15900
|
return $(z).attr(identifiers.never).call();
|
|
@@ -15299,7 +15909,7 @@ function neverToAst({ plugin, schema }) {
|
|
|
15299
15909
|
const ctx = {
|
|
15300
15910
|
$,
|
|
15301
15911
|
chain: { current: $(z) },
|
|
15302
|
-
nodes: { base: baseNode$
|
|
15912
|
+
nodes: { base: baseNode$8 },
|
|
15303
15913
|
plugin,
|
|
15304
15914
|
schema,
|
|
15305
15915
|
symbols: { z }
|
|
@@ -15309,7 +15919,7 @@ function neverToAst({ plugin, schema }) {
|
|
|
15309
15919
|
}
|
|
15310
15920
|
//#endregion
|
|
15311
15921
|
//#region src/plugins/zod/v4/toAst/null.ts
|
|
15312
|
-
function baseNode$
|
|
15922
|
+
function baseNode$7(ctx) {
|
|
15313
15923
|
const { symbols } = ctx;
|
|
15314
15924
|
const { z } = symbols;
|
|
15315
15925
|
return $(z).attr(identifiers.null).call();
|
|
@@ -15324,7 +15934,7 @@ function nullToAst({ plugin, schema }) {
|
|
|
15324
15934
|
const ctx = {
|
|
15325
15935
|
$,
|
|
15326
15936
|
chain: { current: $(z) },
|
|
15327
|
-
nodes: { base: baseNode$
|
|
15937
|
+
nodes: { base: baseNode$7 },
|
|
15328
15938
|
plugin,
|
|
15329
15939
|
schema,
|
|
15330
15940
|
symbols: { z }
|
|
@@ -15334,7 +15944,7 @@ function nullToAst({ plugin, schema }) {
|
|
|
15334
15944
|
}
|
|
15335
15945
|
//#endregion
|
|
15336
15946
|
//#region src/plugins/zod/v4/toAst/number.ts
|
|
15337
|
-
function baseNode$
|
|
15947
|
+
function baseNode$6(ctx) {
|
|
15338
15948
|
const { schema, symbols } = ctx;
|
|
15339
15949
|
const { z } = symbols;
|
|
15340
15950
|
if (ctx.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
|
|
@@ -15382,7 +15992,7 @@ function numberToNode({ plugin, schema }) {
|
|
|
15382
15992
|
$,
|
|
15383
15993
|
chain: { current: $(z) },
|
|
15384
15994
|
nodes: {
|
|
15385
|
-
base: baseNode$
|
|
15995
|
+
base: baseNode$6,
|
|
15386
15996
|
const: constNode$2,
|
|
15387
15997
|
max: maxNode,
|
|
15388
15998
|
min: minNode
|
|
@@ -15408,7 +16018,7 @@ function additionalPropertiesNode(ctx) {
|
|
|
15408
16018
|
_childResults.push(additionalResult);
|
|
15409
16019
|
return applyModifiers(additionalResult, {}).expression;
|
|
15410
16020
|
}
|
|
15411
|
-
function baseNode$
|
|
16021
|
+
function baseNode$5(ctx) {
|
|
15412
16022
|
const { nodes, symbols } = ctx;
|
|
15413
16023
|
const { z } = symbols;
|
|
15414
16024
|
const additional = nodes.additionalProperties(ctx);
|
|
@@ -15443,7 +16053,7 @@ function objectToAst(options) {
|
|
|
15443
16053
|
chain: { current: $(z) },
|
|
15444
16054
|
nodes: {
|
|
15445
16055
|
additionalProperties: additionalPropertiesNode,
|
|
15446
|
-
base: baseNode$
|
|
16056
|
+
base: baseNode$5,
|
|
15447
16057
|
shape: shapeNode
|
|
15448
16058
|
},
|
|
15449
16059
|
plugin,
|
|
@@ -15460,7 +16070,7 @@ function objectToAst(options) {
|
|
|
15460
16070
|
}
|
|
15461
16071
|
//#endregion
|
|
15462
16072
|
//#region src/plugins/zod/v4/toAst/string.ts
|
|
15463
|
-
function baseNode$
|
|
16073
|
+
function baseNode$4(ctx) {
|
|
15464
16074
|
const { z } = ctx.symbols;
|
|
15465
16075
|
return $(z).attr(identifiers.string).call();
|
|
15466
16076
|
}
|
|
@@ -15537,7 +16147,7 @@ function stringToNode({ plugin, schema }) {
|
|
|
15537
16147
|
$,
|
|
15538
16148
|
chain: { current: $(z) },
|
|
15539
16149
|
nodes: {
|
|
15540
|
-
base: baseNode$
|
|
16150
|
+
base: baseNode$4,
|
|
15541
16151
|
const: constNode$1,
|
|
15542
16152
|
format: formatNode,
|
|
15543
16153
|
length: lengthNode,
|
|
@@ -15554,7 +16164,7 @@ function stringToNode({ plugin, schema }) {
|
|
|
15554
16164
|
}
|
|
15555
16165
|
//#endregion
|
|
15556
16166
|
//#region src/plugins/zod/v4/toAst/tuple.ts
|
|
15557
|
-
function baseNode$
|
|
16167
|
+
function baseNode$3(ctx) {
|
|
15558
16168
|
const { applyModifiers, childResults, symbols } = ctx;
|
|
15559
16169
|
const { z } = symbols;
|
|
15560
16170
|
const tupleFn = $(z).attr(identifiers.tuple);
|
|
@@ -15592,7 +16202,7 @@ function tupleToAst({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
15592
16202
|
chain: { current: $(z) },
|
|
15593
16203
|
childResults,
|
|
15594
16204
|
nodes: {
|
|
15595
|
-
base: baseNode$
|
|
16205
|
+
base: baseNode$3,
|
|
15596
16206
|
const: constNode
|
|
15597
16207
|
},
|
|
15598
16208
|
plugin,
|
|
@@ -15609,7 +16219,7 @@ function tupleToAst({ applyModifiers, plugin, schema, walk, walkerCtx }) {
|
|
|
15609
16219
|
}
|
|
15610
16220
|
//#endregion
|
|
15611
16221
|
//#region src/plugins/zod/v4/toAst/undefined.ts
|
|
15612
|
-
function baseNode$
|
|
16222
|
+
function baseNode$2(ctx) {
|
|
15613
16223
|
const { symbols } = ctx;
|
|
15614
16224
|
const { z } = symbols;
|
|
15615
16225
|
return $(z).attr(identifiers.undefined).call();
|
|
@@ -15624,7 +16234,7 @@ function undefinedToAst({ plugin, schema }) {
|
|
|
15624
16234
|
const ctx = {
|
|
15625
16235
|
$,
|
|
15626
16236
|
chain: { current: $(z) },
|
|
15627
|
-
nodes: { base: baseNode$
|
|
16237
|
+
nodes: { base: baseNode$2 },
|
|
15628
16238
|
plugin,
|
|
15629
16239
|
schema,
|
|
15630
16240
|
symbols: { z }
|
|
@@ -15633,6 +16243,58 @@ function undefinedToAst({ plugin, schema }) {
|
|
|
15633
16243
|
return resolver?.(ctx) ?? undefinedResolver(ctx);
|
|
15634
16244
|
}
|
|
15635
16245
|
//#endregion
|
|
16246
|
+
//#region src/plugins/zod/v4/toAst/union.ts
|
|
16247
|
+
function baseNode$1(ctx) {
|
|
16248
|
+
const { childResults, parentSchema, plugin, schemas, symbols } = ctx;
|
|
16249
|
+
const { z } = symbols;
|
|
16250
|
+
if (!childResults.length) return $(z).attr(identifiers.null).call();
|
|
16251
|
+
const nonNullItems = [];
|
|
16252
|
+
childResults.forEach((result, index) => {
|
|
16253
|
+
const schema = schemas[index];
|
|
16254
|
+
if (schema.type !== "null" && schema.const !== null) nonNullItems.push(result);
|
|
16255
|
+
});
|
|
16256
|
+
let expression;
|
|
16257
|
+
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
16258
|
+
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
16259
|
+
else {
|
|
16260
|
+
const discriminatedExpression = tryBuildDiscriminatedUnion({
|
|
16261
|
+
items: childResults,
|
|
16262
|
+
parentSchema,
|
|
16263
|
+
plugin,
|
|
16264
|
+
schemas
|
|
16265
|
+
});
|
|
16266
|
+
if (discriminatedExpression) {
|
|
16267
|
+
const unionMembers = discriminatedExpression.members.map((member) => member.refExpression.attr(identifiers.extend).call($.object().prop(discriminatedExpression.discriminatorKey, $(z).attr(identifiers.literal).call($.fromValue(member.discriminatedValue)))));
|
|
16268
|
+
expression = $(z).attr(identifiers.discriminatedUnion).call($.literal(discriminatedExpression.discriminatorKey), $.array().pretty().elements(...unionMembers));
|
|
16269
|
+
} else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
16270
|
+
}
|
|
16271
|
+
return expression;
|
|
16272
|
+
}
|
|
16273
|
+
function unionResolver(ctx) {
|
|
16274
|
+
const baseResult = ctx.nodes.base(ctx);
|
|
16275
|
+
ctx.chain.current = baseResult;
|
|
16276
|
+
return ctx.chain.current;
|
|
16277
|
+
}
|
|
16278
|
+
function unionToAst({ childResults, parentSchema, plugin, schemas }) {
|
|
16279
|
+
const z = plugin.external("zod.z");
|
|
16280
|
+
const ctx = {
|
|
16281
|
+
$,
|
|
16282
|
+
chain: { current: $(z) },
|
|
16283
|
+
childResults,
|
|
16284
|
+
nodes: { base: baseNode$1 },
|
|
16285
|
+
parentSchema,
|
|
16286
|
+
plugin,
|
|
16287
|
+
schema: parentSchema,
|
|
16288
|
+
schemas,
|
|
16289
|
+
symbols: { z }
|
|
16290
|
+
};
|
|
16291
|
+
const resolver = plugin.config["~resolvers"]?.union;
|
|
16292
|
+
return {
|
|
16293
|
+
childResults,
|
|
16294
|
+
expression: resolver?.(ctx) ?? unionResolver(ctx)
|
|
16295
|
+
};
|
|
16296
|
+
}
|
|
16297
|
+
//#endregion
|
|
15636
16298
|
//#region src/plugins/zod/v4/toAst/void.ts
|
|
15637
16299
|
function baseNode(ctx) {
|
|
15638
16300
|
const { symbols } = ctx;
|
|
@@ -15659,6 +16321,9 @@ function voidToAst({ plugin, schema }) {
|
|
|
15659
16321
|
}
|
|
15660
16322
|
//#endregion
|
|
15661
16323
|
//#region src/plugins/zod/v4/walker.ts
|
|
16324
|
+
function getDefaultValue(meta) {
|
|
16325
|
+
return meta.format ? maybeBigInt(meta.default, meta.format) : $.fromValue(meta.default);
|
|
16326
|
+
}
|
|
15662
16327
|
function createVisitor(config = {}) {
|
|
15663
16328
|
const { schemaExtractor } = config;
|
|
15664
16329
|
return {
|
|
@@ -15666,12 +16331,12 @@ function createVisitor(config = {}) {
|
|
|
15666
16331
|
const { optional } = options;
|
|
15667
16332
|
let expression = result.expression;
|
|
15668
16333
|
if (result.meta.readonly) expression = expression.attr(identifiers.readonly).call();
|
|
15669
|
-
const
|
|
16334
|
+
const needsDefault = result.meta.default !== void 0;
|
|
15670
16335
|
const needsNullable = result.meta.nullable;
|
|
15671
16336
|
if (optional && needsNullable) expression = expression.attr(identifiers.nullish).call();
|
|
15672
16337
|
else if (optional) expression = expression.attr(identifiers.optional).call();
|
|
15673
16338
|
else if (needsNullable) expression = expression.attr(identifiers.nullable).call();
|
|
15674
|
-
if (
|
|
16339
|
+
if (needsDefault) expression = expression.attr(identifiers.default).call(getDefaultValue(result.meta));
|
|
15675
16340
|
return { expression };
|
|
15676
16341
|
},
|
|
15677
16342
|
array(schema, ctx, walk) {
|
|
@@ -15743,23 +16408,20 @@ function createVisitor(config = {}) {
|
|
|
15743
16408
|
};
|
|
15744
16409
|
},
|
|
15745
16410
|
intersection(items, schemas, parentSchema, ctx) {
|
|
15746
|
-
const z = ctx.plugin.external("zod.z");
|
|
15747
16411
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
15748
|
-
const
|
|
15749
|
-
|
|
15750
|
-
|
|
15751
|
-
|
|
15752
|
-
|
|
15753
|
-
|
|
15754
|
-
expression = expression.attr(identifiers.and).call(item.meta.hasLazy ? $(z).attr(identifiers.lazy).call($.func().do(item.expression.return())) : item.expression);
|
|
15755
|
-
});
|
|
15756
|
-
}
|
|
16412
|
+
const { expression } = intersectionToAst({
|
|
16413
|
+
childResults: items,
|
|
16414
|
+
parentSchema,
|
|
16415
|
+
plugin: ctx.plugin,
|
|
16416
|
+
schemas
|
|
16417
|
+
});
|
|
15757
16418
|
return {
|
|
15758
16419
|
expression,
|
|
15759
16420
|
meta: {
|
|
15760
16421
|
default: parentSchema.default,
|
|
15761
16422
|
format: parentSchema.format,
|
|
15762
16423
|
hasLazy: hasAnyLazy,
|
|
16424
|
+
isIntersection: true,
|
|
15763
16425
|
isLazy: false,
|
|
15764
16426
|
nullable: items.some((i) => i.meta.nullable),
|
|
15765
16427
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -15906,24 +16568,21 @@ function createVisitor(config = {}) {
|
|
|
15906
16568
|
};
|
|
15907
16569
|
},
|
|
15908
16570
|
union(items, schemas, parentSchema, ctx) {
|
|
15909
|
-
const z = ctx.plugin.external("zod.z");
|
|
15910
16571
|
const hasAnyLazy = items.some((item) => item.meta.hasLazy);
|
|
15911
16572
|
const hasNull = schemas.some((s) => s.type === "null") || items.some((i) => i.meta.nullable);
|
|
15912
|
-
const
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
|
|
16573
|
+
const { expression } = unionToAst({
|
|
16574
|
+
childResults: items,
|
|
16575
|
+
parentSchema,
|
|
16576
|
+
plugin: ctx.plugin,
|
|
16577
|
+
schemas
|
|
15916
16578
|
});
|
|
15917
|
-
let expression;
|
|
15918
|
-
if (!nonNullItems.length) expression = $(z).attr(identifiers.null).call();
|
|
15919
|
-
else if (nonNullItems.length === 1) expression = nonNullItems[0].expression;
|
|
15920
|
-
else expression = $(z).attr(identifiers.union).call($.array().pretty().elements(...nonNullItems.map((item) => item.expression)));
|
|
15921
16579
|
return {
|
|
15922
16580
|
expression,
|
|
15923
16581
|
meta: {
|
|
15924
16582
|
default: parentSchema.default,
|
|
15925
16583
|
format: parentSchema.format,
|
|
15926
16584
|
hasLazy: hasAnyLazy,
|
|
16585
|
+
isIntersection: false,
|
|
15927
16586
|
isLazy: false,
|
|
15928
16587
|
nullable: hasNull,
|
|
15929
16588
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -15995,6 +16654,10 @@ function createProcessor(plugin) {
|
|
|
15995
16654
|
exportAst({
|
|
15996
16655
|
...ctx,
|
|
15997
16656
|
final,
|
|
16657
|
+
meta: result.meta.isIntersection ? {
|
|
16658
|
+
...ctx.meta,
|
|
16659
|
+
isIntersection: true
|
|
16660
|
+
} : ctx.meta,
|
|
15998
16661
|
plugin
|
|
15999
16662
|
});
|
|
16000
16663
|
return;
|
|
@@ -16125,10 +16788,20 @@ const defaultConfig = {
|
|
|
16125
16788
|
value: plugin.config.dates
|
|
16126
16789
|
});
|
|
16127
16790
|
plugin.config.types = context.valueToObject({
|
|
16128
|
-
defaultValue: {
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16791
|
+
defaultValue: {
|
|
16792
|
+
infer: {
|
|
16793
|
+
case: "PascalCase",
|
|
16794
|
+
enabled: false
|
|
16795
|
+
},
|
|
16796
|
+
input: {
|
|
16797
|
+
case: "PascalCase",
|
|
16798
|
+
enabled: false
|
|
16799
|
+
},
|
|
16800
|
+
output: {
|
|
16801
|
+
case: "PascalCase",
|
|
16802
|
+
enabled: false
|
|
16803
|
+
}
|
|
16804
|
+
},
|
|
16132
16805
|
mappers: { object: (fields, defaultValue) => ({
|
|
16133
16806
|
...fields,
|
|
16134
16807
|
infer: context.valueToObject({
|
|
@@ -16138,6 +16811,22 @@ const defaultConfig = {
|
|
|
16138
16811
|
},
|
|
16139
16812
|
mappers,
|
|
16140
16813
|
value: fields.infer
|
|
16814
|
+
}),
|
|
16815
|
+
input: context.valueToObject({
|
|
16816
|
+
defaultValue: {
|
|
16817
|
+
...defaultValue.input,
|
|
16818
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
16819
|
+
},
|
|
16820
|
+
mappers,
|
|
16821
|
+
value: fields.input
|
|
16822
|
+
}),
|
|
16823
|
+
output: context.valueToObject({
|
|
16824
|
+
defaultValue: {
|
|
16825
|
+
...defaultValue.output,
|
|
16826
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
16827
|
+
},
|
|
16828
|
+
mappers,
|
|
16829
|
+
value: fields.output
|
|
16141
16830
|
})
|
|
16142
16831
|
}) },
|
|
16143
16832
|
value: plugin.config.types
|
|
@@ -16152,6 +16841,14 @@ const defaultConfig = {
|
|
|
16152
16841
|
infer: {
|
|
16153
16842
|
...plugin.config.types.infer,
|
|
16154
16843
|
name: "{{name}}ZodType"
|
|
16844
|
+
},
|
|
16845
|
+
input: {
|
|
16846
|
+
...plugin.config.types.input,
|
|
16847
|
+
name: "{{name}}ZodInput"
|
|
16848
|
+
},
|
|
16849
|
+
output: {
|
|
16850
|
+
...plugin.config.types.output,
|
|
16851
|
+
name: "{{name}}ZodOutput"
|
|
16155
16852
|
}
|
|
16156
16853
|
}
|
|
16157
16854
|
},
|
|
@@ -16170,6 +16867,22 @@ const defaultConfig = {
|
|
|
16170
16867
|
},
|
|
16171
16868
|
mappers,
|
|
16172
16869
|
value: fields.infer
|
|
16870
|
+
}),
|
|
16871
|
+
input: context.valueToObject({
|
|
16872
|
+
defaultValue: {
|
|
16873
|
+
...defaultValue.input,
|
|
16874
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
16875
|
+
},
|
|
16876
|
+
mappers,
|
|
16877
|
+
value: fields.input
|
|
16878
|
+
}),
|
|
16879
|
+
output: context.valueToObject({
|
|
16880
|
+
defaultValue: {
|
|
16881
|
+
...defaultValue.output,
|
|
16882
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
16883
|
+
},
|
|
16884
|
+
mappers,
|
|
16885
|
+
value: fields.output
|
|
16173
16886
|
})
|
|
16174
16887
|
}) },
|
|
16175
16888
|
value: fields.types
|
|
@@ -16189,6 +16902,14 @@ const defaultConfig = {
|
|
|
16189
16902
|
infer: {
|
|
16190
16903
|
...plugin.config.types.infer,
|
|
16191
16904
|
name: "{{name}}BodyZodType"
|
|
16905
|
+
},
|
|
16906
|
+
input: {
|
|
16907
|
+
...plugin.config.types.input,
|
|
16908
|
+
name: "{{name}}BodyZodInput"
|
|
16909
|
+
},
|
|
16910
|
+
output: {
|
|
16911
|
+
...plugin.config.types.output,
|
|
16912
|
+
name: "{{name}}BodyZodOutput"
|
|
16192
16913
|
}
|
|
16193
16914
|
}
|
|
16194
16915
|
},
|
|
@@ -16203,6 +16924,14 @@ const defaultConfig = {
|
|
|
16203
16924
|
infer: {
|
|
16204
16925
|
...plugin.config.types.infer,
|
|
16205
16926
|
name: "{{name}}HeadersZodType"
|
|
16927
|
+
},
|
|
16928
|
+
input: {
|
|
16929
|
+
...plugin.config.types.input,
|
|
16930
|
+
name: "{{name}}HeadersZodInput"
|
|
16931
|
+
},
|
|
16932
|
+
output: {
|
|
16933
|
+
...plugin.config.types.output,
|
|
16934
|
+
name: "{{name}}HeadersZodOutput"
|
|
16206
16935
|
}
|
|
16207
16936
|
}
|
|
16208
16937
|
},
|
|
@@ -16216,6 +16945,14 @@ const defaultConfig = {
|
|
|
16216
16945
|
infer: {
|
|
16217
16946
|
...plugin.config.types.infer,
|
|
16218
16947
|
name: "{{name}}PathZodType"
|
|
16948
|
+
},
|
|
16949
|
+
input: {
|
|
16950
|
+
...plugin.config.types.input,
|
|
16951
|
+
name: "{{name}}PathZodInput"
|
|
16952
|
+
},
|
|
16953
|
+
output: {
|
|
16954
|
+
...plugin.config.types.output,
|
|
16955
|
+
name: "{{name}}PathZodOutput"
|
|
16219
16956
|
}
|
|
16220
16957
|
}
|
|
16221
16958
|
},
|
|
@@ -16228,6 +16965,14 @@ const defaultConfig = {
|
|
|
16228
16965
|
infer: {
|
|
16229
16966
|
...plugin.config.types.infer,
|
|
16230
16967
|
name: "{{name}}QueryZodType"
|
|
16968
|
+
},
|
|
16969
|
+
input: {
|
|
16970
|
+
...plugin.config.types.input,
|
|
16971
|
+
name: "{{name}}QueryZodInput"
|
|
16972
|
+
},
|
|
16973
|
+
output: {
|
|
16974
|
+
...plugin.config.types.output,
|
|
16975
|
+
name: "{{name}}QueryZodOutput"
|
|
16231
16976
|
}
|
|
16232
16977
|
}
|
|
16233
16978
|
},
|
|
@@ -16237,6 +16982,14 @@ const defaultConfig = {
|
|
|
16237
16982
|
infer: {
|
|
16238
16983
|
...plugin.config.types.infer,
|
|
16239
16984
|
name: "{{name}}DataZodType"
|
|
16985
|
+
},
|
|
16986
|
+
input: {
|
|
16987
|
+
...plugin.config.types.input,
|
|
16988
|
+
name: "{{name}}DataZodInput"
|
|
16989
|
+
},
|
|
16990
|
+
output: {
|
|
16991
|
+
...plugin.config.types.output,
|
|
16992
|
+
name: "{{name}}DataZodOutput"
|
|
16240
16993
|
}
|
|
16241
16994
|
}
|
|
16242
16995
|
},
|
|
@@ -16261,6 +17014,22 @@ const defaultConfig = {
|
|
|
16261
17014
|
},
|
|
16262
17015
|
mappers,
|
|
16263
17016
|
value: fields.infer
|
|
17017
|
+
}),
|
|
17018
|
+
input: context.valueToObject({
|
|
17019
|
+
defaultValue: {
|
|
17020
|
+
...defaultValue.input,
|
|
17021
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17022
|
+
},
|
|
17023
|
+
mappers,
|
|
17024
|
+
value: fields.input
|
|
17025
|
+
}),
|
|
17026
|
+
output: context.valueToObject({
|
|
17027
|
+
defaultValue: {
|
|
17028
|
+
...defaultValue.output,
|
|
17029
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17030
|
+
},
|
|
17031
|
+
mappers,
|
|
17032
|
+
value: fields.output
|
|
16264
17033
|
})
|
|
16265
17034
|
}) },
|
|
16266
17035
|
value: fields.types
|
|
@@ -16286,6 +17055,22 @@ const defaultConfig = {
|
|
|
16286
17055
|
},
|
|
16287
17056
|
mappers,
|
|
16288
17057
|
value: fields.infer
|
|
17058
|
+
}),
|
|
17059
|
+
input: context.valueToObject({
|
|
17060
|
+
defaultValue: {
|
|
17061
|
+
...defaultValue.input,
|
|
17062
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17063
|
+
},
|
|
17064
|
+
mappers,
|
|
17065
|
+
value: fields.input
|
|
17066
|
+
}),
|
|
17067
|
+
output: context.valueToObject({
|
|
17068
|
+
defaultValue: {
|
|
17069
|
+
...defaultValue.output,
|
|
17070
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17071
|
+
},
|
|
17072
|
+
mappers,
|
|
17073
|
+
value: fields.output
|
|
16289
17074
|
})
|
|
16290
17075
|
}) },
|
|
16291
17076
|
value: fields.types
|
|
@@ -16311,6 +17096,22 @@ const defaultConfig = {
|
|
|
16311
17096
|
},
|
|
16312
17097
|
mappers,
|
|
16313
17098
|
value: fields.infer
|
|
17099
|
+
}),
|
|
17100
|
+
input: context.valueToObject({
|
|
17101
|
+
defaultValue: {
|
|
17102
|
+
...defaultValue.input,
|
|
17103
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17104
|
+
},
|
|
17105
|
+
mappers,
|
|
17106
|
+
value: fields.input
|
|
17107
|
+
}),
|
|
17108
|
+
output: context.valueToObject({
|
|
17109
|
+
defaultValue: {
|
|
17110
|
+
...defaultValue.output,
|
|
17111
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17112
|
+
},
|
|
17113
|
+
mappers,
|
|
17114
|
+
value: fields.output
|
|
16314
17115
|
})
|
|
16315
17116
|
}) },
|
|
16316
17117
|
value: fields.types
|
|
@@ -16336,6 +17137,22 @@ const defaultConfig = {
|
|
|
16336
17137
|
},
|
|
16337
17138
|
mappers,
|
|
16338
17139
|
value: fields.infer
|
|
17140
|
+
}),
|
|
17141
|
+
input: context.valueToObject({
|
|
17142
|
+
defaultValue: {
|
|
17143
|
+
...defaultValue.input,
|
|
17144
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17145
|
+
},
|
|
17146
|
+
mappers,
|
|
17147
|
+
value: fields.input
|
|
17148
|
+
}),
|
|
17149
|
+
output: context.valueToObject({
|
|
17150
|
+
defaultValue: {
|
|
17151
|
+
...defaultValue.output,
|
|
17152
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17153
|
+
},
|
|
17154
|
+
mappers,
|
|
17155
|
+
value: fields.output
|
|
16339
17156
|
})
|
|
16340
17157
|
}) },
|
|
16341
17158
|
value: fields.types
|
|
@@ -16356,6 +17173,22 @@ const defaultConfig = {
|
|
|
16356
17173
|
},
|
|
16357
17174
|
mappers,
|
|
16358
17175
|
value: fields.infer
|
|
17176
|
+
}),
|
|
17177
|
+
input: context.valueToObject({
|
|
17178
|
+
defaultValue: {
|
|
17179
|
+
...defaultValue.input,
|
|
17180
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17181
|
+
},
|
|
17182
|
+
mappers,
|
|
17183
|
+
value: fields.input
|
|
17184
|
+
}),
|
|
17185
|
+
output: context.valueToObject({
|
|
17186
|
+
defaultValue: {
|
|
17187
|
+
...defaultValue.output,
|
|
17188
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17189
|
+
},
|
|
17190
|
+
mappers,
|
|
17191
|
+
value: fields.output
|
|
16359
17192
|
})
|
|
16360
17193
|
}) },
|
|
16361
17194
|
value: fields.types
|
|
@@ -16374,6 +17207,14 @@ const defaultConfig = {
|
|
|
16374
17207
|
infer: {
|
|
16375
17208
|
...plugin.config.types.infer,
|
|
16376
17209
|
name: "{{name}}ResponseZodType"
|
|
17210
|
+
},
|
|
17211
|
+
input: {
|
|
17212
|
+
...plugin.config.types.input,
|
|
17213
|
+
name: "{{name}}ResponseZodInput"
|
|
17214
|
+
},
|
|
17215
|
+
output: {
|
|
17216
|
+
...plugin.config.types.output,
|
|
17217
|
+
name: "{{name}}ResponseZodOutput"
|
|
16377
17218
|
}
|
|
16378
17219
|
}
|
|
16379
17220
|
},
|
|
@@ -16392,6 +17233,22 @@ const defaultConfig = {
|
|
|
16392
17233
|
},
|
|
16393
17234
|
mappers,
|
|
16394
17235
|
value: fields.infer
|
|
17236
|
+
}),
|
|
17237
|
+
input: context.valueToObject({
|
|
17238
|
+
defaultValue: {
|
|
17239
|
+
...defaultValue.input,
|
|
17240
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17241
|
+
},
|
|
17242
|
+
mappers,
|
|
17243
|
+
value: fields.input
|
|
17244
|
+
}),
|
|
17245
|
+
output: context.valueToObject({
|
|
17246
|
+
defaultValue: {
|
|
17247
|
+
...defaultValue.output,
|
|
17248
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17249
|
+
},
|
|
17250
|
+
mappers,
|
|
17251
|
+
value: fields.output
|
|
16395
17252
|
})
|
|
16396
17253
|
}) },
|
|
16397
17254
|
value: fields.types
|
|
@@ -16410,6 +17267,14 @@ const defaultConfig = {
|
|
|
16410
17267
|
infer: {
|
|
16411
17268
|
...plugin.config.types.infer,
|
|
16412
17269
|
name: "{{name}}WebhookRequestZodType"
|
|
17270
|
+
},
|
|
17271
|
+
input: {
|
|
17272
|
+
...plugin.config.types.input,
|
|
17273
|
+
name: "{{name}}WebhookRequestZodInput"
|
|
17274
|
+
},
|
|
17275
|
+
output: {
|
|
17276
|
+
...plugin.config.types.output,
|
|
17277
|
+
name: "{{name}}WebhookRequestZodOutput"
|
|
16413
17278
|
}
|
|
16414
17279
|
}
|
|
16415
17280
|
},
|
|
@@ -16428,6 +17293,22 @@ const defaultConfig = {
|
|
|
16428
17293
|
},
|
|
16429
17294
|
mappers,
|
|
16430
17295
|
value: fields.infer
|
|
17296
|
+
}),
|
|
17297
|
+
input: context.valueToObject({
|
|
17298
|
+
defaultValue: {
|
|
17299
|
+
...defaultValue.input,
|
|
17300
|
+
enabled: fields.input !== void 0 ? Boolean(fields.input) : defaultValue.input.enabled
|
|
17301
|
+
},
|
|
17302
|
+
mappers,
|
|
17303
|
+
value: fields.input
|
|
17304
|
+
}),
|
|
17305
|
+
output: context.valueToObject({
|
|
17306
|
+
defaultValue: {
|
|
17307
|
+
...defaultValue.output,
|
|
17308
|
+
enabled: fields.output !== void 0 ? Boolean(fields.output) : defaultValue.output.enabled
|
|
17309
|
+
},
|
|
17310
|
+
mappers,
|
|
17311
|
+
value: fields.output
|
|
16431
17312
|
})
|
|
16432
17313
|
}) },
|
|
16433
17314
|
value: fields.types
|
|
@@ -16539,6 +17420,7 @@ function getPlugins({ dependencies, userConfig }) {
|
|
|
16539
17420
|
if (userConfig.plugins.length === 1 && isPluginClient(userConfig.plugins[0])) definedPlugins = [...defaultPlugins, ...userConfig.plugins];
|
|
16540
17421
|
else definedPlugins = userConfig.plugins;
|
|
16541
17422
|
}
|
|
17423
|
+
warnOnConflictingDuplicatePlugins(definedPlugins);
|
|
16542
17424
|
return getPluginsConfig({
|
|
16543
17425
|
dependencies,
|
|
16544
17426
|
userPlugins: definedPlugins.map((plugin) => {
|
|
@@ -16647,4 +17529,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
16647
17529
|
//#endregion
|
|
16648
17530
|
export { postProcessors as _, clientDefaultConfig as a, TypeScriptRenderer as c, reserved as d, keywords as f, getTypedConfig as g, getClientPlugin as h, generateClientBundle as i, TsDslContext as l, TsDsl as m, defaultPlugins as n, clientDefaultMeta as o, regexp as p, clientPluginHandler as r, $ as s, resolveJobs as t, ctx as u };
|
|
16649
17531
|
|
|
16650
|
-
//# sourceMappingURL=init-
|
|
17532
|
+
//# sourceMappingURL=init-EigcXVTH.mjs.map
|