@hey-api/openapi-ts 0.90.2 → 0.90.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/clients/fetch/client.ts +7 -1
- package/dist/clients/ky/client.ts +7 -1
- package/dist/clients/next/client.ts +7 -1
- package/dist/{config-BzR0jtGH.d.mts → config-BY6SQ9vq.d.mts} +333 -147
- package/dist/{config-84ipCnU3.d.cts → config-BpoUoSpn.d.cts} +333 -147
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/{openApi-BwUPqtP_.cjs → openApi-3_A4QzK7.cjs} +451 -163
- package/dist/openApi-3_A4QzK7.cjs.map +1 -0
- package/dist/{openApi-PX3rDrOF.mjs → openApi-D6jppAcA.mjs} +451 -163
- package/dist/openApi-D6jppAcA.mjs.map +1 -0
- package/dist/run.cjs +3 -3
- package/dist/run.mjs +3 -3
- package/dist/{src-BCi83sdM.mjs → src-CGmZM4HZ.mjs} +4 -4
- package/dist/src-CGmZM4HZ.mjs.map +1 -0
- package/dist/{src-hU76ergi.cjs → src-CsHLuAJv.cjs} +4 -4
- package/dist/src-CsHLuAJv.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/openApi-BwUPqtP_.cjs.map +0 -1
- package/dist/openApi-PX3rDrOF.mjs.map +0 -1
- package/dist/src-BCi83sdM.mjs.map +0 -1
- package/dist/src-hU76ergi.cjs.map +0 -1
|
@@ -513,66 +513,6 @@ const valueToObject = ({ defaultValue, mappers: mappers$1, value }) => {
|
|
|
513
513
|
return result;
|
|
514
514
|
};
|
|
515
515
|
|
|
516
|
-
//#endregion
|
|
517
|
-
//#region src/config/output/source/config.ts
|
|
518
|
-
function resolveSource(config) {
|
|
519
|
-
const source$2 = valueToObject({
|
|
520
|
-
defaultValue: {
|
|
521
|
-
enabled: Boolean(config.source),
|
|
522
|
-
extension: "json",
|
|
523
|
-
fileName: "source",
|
|
524
|
-
serialize: (input) => JSON.stringify(input, null, 2)
|
|
525
|
-
},
|
|
526
|
-
mappers: { boolean: (enabled) => ({ enabled }) },
|
|
527
|
-
value: config.source
|
|
528
|
-
});
|
|
529
|
-
if (source$2.path === void 0 || source$2.path === true) source$2.path = "";
|
|
530
|
-
else if (source$2.path === false) source$2.path = null;
|
|
531
|
-
return source$2;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
//#endregion
|
|
535
|
-
//#region src/config/output/config.ts
|
|
536
|
-
function getOutput(userConfig) {
|
|
537
|
-
if (userConfig.output instanceof Array) throw new Error("Unexpected array of outputs in user configuration. This should have been expanded already.");
|
|
538
|
-
const output = valueToObject({
|
|
539
|
-
defaultValue: {
|
|
540
|
-
clean: true,
|
|
541
|
-
fileName: {
|
|
542
|
-
case: "preserve",
|
|
543
|
-
name: "{{name}}",
|
|
544
|
-
suffix: ".gen"
|
|
545
|
-
},
|
|
546
|
-
format: null,
|
|
547
|
-
header: "// This file is auto-generated by @hey-api/openapi-ts",
|
|
548
|
-
indexFile: true,
|
|
549
|
-
lint: null,
|
|
550
|
-
path: "",
|
|
551
|
-
preferExportAll: false
|
|
552
|
-
},
|
|
553
|
-
mappers: {
|
|
554
|
-
object: (fields, defaultValue) => ({
|
|
555
|
-
...fields,
|
|
556
|
-
fileName: valueToObject({
|
|
557
|
-
defaultValue: { ...defaultValue.fileName },
|
|
558
|
-
mappers: {
|
|
559
|
-
function: (name) => ({ name }),
|
|
560
|
-
string: (name) => ({ name })
|
|
561
|
-
},
|
|
562
|
-
value: fields.fileName
|
|
563
|
-
})
|
|
564
|
-
}),
|
|
565
|
-
string: (path$4) => ({ path: path$4 })
|
|
566
|
-
},
|
|
567
|
-
value: userConfig.output
|
|
568
|
-
});
|
|
569
|
-
output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath));
|
|
570
|
-
if (output.importFileExtension === void 0 && (output.tsConfig?.options.moduleResolution === ts.ModuleResolutionKind.NodeNext || output.tsConfig?.options.moduleResolution === ts.ModuleResolutionKind.Node16)) output.importFileExtension = ".js";
|
|
571
|
-
if (output.importFileExtension && !output.importFileExtension.startsWith(".")) output.importFileExtension = `.${output.importFileExtension}`;
|
|
572
|
-
output.source = resolveSource(output);
|
|
573
|
-
return output;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
516
|
//#endregion
|
|
577
517
|
//#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
|
|
578
518
|
var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -985,68 +925,169 @@ var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
985
925
|
//#endregion
|
|
986
926
|
//#region src/config/output/postprocess.ts
|
|
987
927
|
var import_cross_spawn = require_cross_spawn();
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
const formatters = {
|
|
992
|
-
biome: {
|
|
993
|
-
args: (path$4) => [
|
|
928
|
+
const postProcessors = {
|
|
929
|
+
"biome:format": {
|
|
930
|
+
args: [
|
|
994
931
|
"format",
|
|
995
932
|
"--write",
|
|
996
|
-
path
|
|
933
|
+
"{{path}}"
|
|
997
934
|
],
|
|
998
935
|
command: "biome",
|
|
999
936
|
name: "Biome (Format)"
|
|
1000
937
|
},
|
|
1001
|
-
|
|
1002
|
-
args:
|
|
1003
|
-
"--ignore-unknown",
|
|
1004
|
-
path$4,
|
|
1005
|
-
"--write",
|
|
1006
|
-
"--ignore-path",
|
|
1007
|
-
"./.prettierignore"
|
|
1008
|
-
],
|
|
1009
|
-
command: "prettier",
|
|
1010
|
-
name: "Prettier"
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
/**
|
|
1014
|
-
* Map of supported linters
|
|
1015
|
-
*/
|
|
1016
|
-
const linters = {
|
|
1017
|
-
biome: {
|
|
1018
|
-
args: (path$4) => [
|
|
938
|
+
"biome:lint": {
|
|
939
|
+
args: [
|
|
1019
940
|
"lint",
|
|
1020
941
|
"--apply",
|
|
1021
|
-
path
|
|
942
|
+
"{{path}}"
|
|
1022
943
|
],
|
|
1023
944
|
command: "biome",
|
|
1024
945
|
name: "Biome (Lint)"
|
|
1025
946
|
},
|
|
1026
947
|
eslint: {
|
|
1027
|
-
args:
|
|
948
|
+
args: ["{{path}}", "--fix"],
|
|
1028
949
|
command: "eslint",
|
|
1029
950
|
name: "ESLint"
|
|
1030
951
|
},
|
|
952
|
+
oxfmt: {
|
|
953
|
+
args: ["{{path}}"],
|
|
954
|
+
command: "oxfmt",
|
|
955
|
+
name: "Oxfmt"
|
|
956
|
+
},
|
|
1031
957
|
oxlint: {
|
|
1032
|
-
args:
|
|
958
|
+
args: ["--fix", "{{path}}"],
|
|
1033
959
|
command: "oxlint",
|
|
1034
|
-
name: "
|
|
960
|
+
name: "Oxlint"
|
|
961
|
+
},
|
|
962
|
+
prettier: {
|
|
963
|
+
args: [
|
|
964
|
+
"--ignore-unknown",
|
|
965
|
+
"{{path}}",
|
|
966
|
+
"--write",
|
|
967
|
+
"--ignore-path",
|
|
968
|
+
"./.prettierignore"
|
|
969
|
+
],
|
|
970
|
+
command: "prettier",
|
|
971
|
+
name: "Prettier"
|
|
1035
972
|
}
|
|
1036
973
|
};
|
|
1037
|
-
const postprocessOutput = (config) => {
|
|
1038
|
-
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
(
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
const module$1 = formatters[config.format];
|
|
1045
|
-
console.log(`✨ Running ${module$1.name}`);
|
|
1046
|
-
(0, import_cross_spawn.sync)(module$1.command, module$1.args(config.path));
|
|
974
|
+
const postprocessOutput = (config, jobPrefix) => {
|
|
975
|
+
for (const processor of config.postProcess) {
|
|
976
|
+
const resolved = typeof processor === "string" ? postProcessors[processor] : processor;
|
|
977
|
+
const name = resolved.name ?? resolved.command;
|
|
978
|
+
const args = resolved.args.map((arg) => arg.replace("{{path}}", config.path));
|
|
979
|
+
console.log(`${jobPrefix}🧹 Running ${colors.cyanBright(name)}`);
|
|
980
|
+
(0, import_cross_spawn.sync)(resolved.command, args);
|
|
1047
981
|
}
|
|
1048
982
|
};
|
|
1049
983
|
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region src/config/output/source/config.ts
|
|
986
|
+
function resolveSource(config) {
|
|
987
|
+
const source$2 = valueToObject({
|
|
988
|
+
defaultValue: {
|
|
989
|
+
enabled: Boolean(config.source),
|
|
990
|
+
extension: "json",
|
|
991
|
+
fileName: "source",
|
|
992
|
+
serialize: (input) => JSON.stringify(input, null, 2)
|
|
993
|
+
},
|
|
994
|
+
mappers: { boolean: (enabled) => ({ enabled }) },
|
|
995
|
+
value: config.source
|
|
996
|
+
});
|
|
997
|
+
if (source$2.path === void 0 || source$2.path === true) source$2.path = "";
|
|
998
|
+
else if (source$2.path === false) source$2.path = null;
|
|
999
|
+
return source$2;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region src/config/output/config.ts
|
|
1004
|
+
function getOutput(userConfig) {
|
|
1005
|
+
if (userConfig.output instanceof Array) throw new Error("Unexpected array of outputs in user configuration. This should have been expanded already.");
|
|
1006
|
+
const userOutput = typeof userConfig.output === "string" ? { path: userConfig.output } : userConfig.output ?? {};
|
|
1007
|
+
const legacyPostProcess = resolveLegacyPostProcess(userOutput);
|
|
1008
|
+
const output = valueToObject({
|
|
1009
|
+
defaultValue: {
|
|
1010
|
+
clean: true,
|
|
1011
|
+
fileName: {
|
|
1012
|
+
case: "preserve",
|
|
1013
|
+
name: "{{name}}",
|
|
1014
|
+
suffix: ".gen"
|
|
1015
|
+
},
|
|
1016
|
+
format: null,
|
|
1017
|
+
header: "// This file is auto-generated by @hey-api/openapi-ts",
|
|
1018
|
+
indexFile: true,
|
|
1019
|
+
lint: null,
|
|
1020
|
+
path: "",
|
|
1021
|
+
postProcess: [],
|
|
1022
|
+
preferExportAll: false
|
|
1023
|
+
},
|
|
1024
|
+
mappers: { object: (fields, defaultValue) => ({
|
|
1025
|
+
...fields,
|
|
1026
|
+
fileName: valueToObject({
|
|
1027
|
+
defaultValue: { ...defaultValue.fileName },
|
|
1028
|
+
mappers: {
|
|
1029
|
+
function: (name) => ({ name }),
|
|
1030
|
+
string: (name) => ({ name })
|
|
1031
|
+
},
|
|
1032
|
+
value: fields.fileName
|
|
1033
|
+
})
|
|
1034
|
+
}) },
|
|
1035
|
+
value: userOutput
|
|
1036
|
+
});
|
|
1037
|
+
output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath));
|
|
1038
|
+
if (output.importFileExtension === void 0 && (output.tsConfig?.options.moduleResolution === ts.ModuleResolutionKind.NodeNext || output.tsConfig?.options.moduleResolution === ts.ModuleResolutionKind.Node16)) output.importFileExtension = ".js";
|
|
1039
|
+
if (output.importFileExtension && !output.importFileExtension.startsWith(".")) output.importFileExtension = `.${output.importFileExtension}`;
|
|
1040
|
+
output.postProcess = normalizePostProcess(userOutput.postProcess ?? legacyPostProcess);
|
|
1041
|
+
output.source = resolveSource(output);
|
|
1042
|
+
return output;
|
|
1043
|
+
}
|
|
1044
|
+
function resolveLegacyPostProcess(config) {
|
|
1045
|
+
const result = [];
|
|
1046
|
+
if (config.lint !== void 0) {
|
|
1047
|
+
let processor;
|
|
1048
|
+
let preset;
|
|
1049
|
+
if (config.lint) {
|
|
1050
|
+
preset = config.lint === "biome" ? "biome:lint" : config.lint;
|
|
1051
|
+
processor = postProcessors[preset];
|
|
1052
|
+
if (processor) result.push(processor);
|
|
1053
|
+
}
|
|
1054
|
+
log.warnDeprecated({
|
|
1055
|
+
context: "output",
|
|
1056
|
+
field: "lint",
|
|
1057
|
+
replacement: `postProcess: [${processor && preset ? `'${preset}'` : ""}]`
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
if (config.format !== void 0) {
|
|
1061
|
+
let processor;
|
|
1062
|
+
let preset;
|
|
1063
|
+
if (config.format) {
|
|
1064
|
+
preset = config.format === "biome" ? "biome:format" : config.format;
|
|
1065
|
+
processor = postProcessors[preset];
|
|
1066
|
+
if (processor) result.push(processor);
|
|
1067
|
+
}
|
|
1068
|
+
log.warnDeprecated({
|
|
1069
|
+
context: "output",
|
|
1070
|
+
field: "format",
|
|
1071
|
+
replacement: `postProcess: [${processor && preset ? `'${preset}'` : ""}]`
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
return result;
|
|
1075
|
+
}
|
|
1076
|
+
function normalizePostProcess(input) {
|
|
1077
|
+
if (!input) return [];
|
|
1078
|
+
return input.map((item) => {
|
|
1079
|
+
if (typeof item === "string") {
|
|
1080
|
+
const preset = postProcessors[item];
|
|
1081
|
+
if (!preset) throw new Error(`Unknown post-processor preset: "${item}"`);
|
|
1082
|
+
return preset;
|
|
1083
|
+
}
|
|
1084
|
+
return {
|
|
1085
|
+
name: item.name ?? item.command,
|
|
1086
|
+
...item
|
|
1087
|
+
};
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1050
1091
|
//#endregion
|
|
1051
1092
|
//#region src/config/packages.ts
|
|
1052
1093
|
/**
|
|
@@ -11168,20 +11209,82 @@ const booleanToAst$3 = ({ plugin, schema }) => {
|
|
|
11168
11209
|
|
|
11169
11210
|
//#endregion
|
|
11170
11211
|
//#region src/plugins/valibot/v1/toAst/enum.ts
|
|
11171
|
-
|
|
11212
|
+
function itemsNode$3(ctx$1) {
|
|
11213
|
+
const { schema } = ctx$1;
|
|
11172
11214
|
const enumMembers = [];
|
|
11173
11215
|
let isNullable = false;
|
|
11174
11216
|
for (const item of schema.items ?? []) if (item.type === "string" && typeof item.const === "string") enumMembers.push($.literal(item.const));
|
|
11175
11217
|
else if (item.type === "null" || item.const === null) isNullable = true;
|
|
11218
|
+
return {
|
|
11219
|
+
enumMembers,
|
|
11220
|
+
isNullable
|
|
11221
|
+
};
|
|
11222
|
+
}
|
|
11223
|
+
function baseNode$15(ctx$1) {
|
|
11224
|
+
const { symbols } = ctx$1;
|
|
11225
|
+
const { v } = symbols;
|
|
11226
|
+
const { enumMembers } = ctx$1.nodes.items(ctx$1);
|
|
11227
|
+
return $(v).attr(identifiers$1.schemas.picklist).call($.array(...enumMembers));
|
|
11228
|
+
}
|
|
11229
|
+
function nullableNode$3(ctx$1) {
|
|
11230
|
+
const { symbols } = ctx$1;
|
|
11231
|
+
const { v } = symbols;
|
|
11232
|
+
const { isNullable } = ctx$1.nodes.items(ctx$1);
|
|
11233
|
+
if (!isNullable) return;
|
|
11234
|
+
const currentNode = ctx$1.pipes.toNode(ctx$1.pipes.current, ctx$1.plugin);
|
|
11235
|
+
return $(v).attr(identifiers$1.schemas.nullable).call(currentNode);
|
|
11236
|
+
}
|
|
11237
|
+
function enumResolver$3(ctx$1) {
|
|
11238
|
+
const { enumMembers } = ctx$1.nodes.items(ctx$1);
|
|
11239
|
+
if (!enumMembers.length) return ctx$1.pipes.current;
|
|
11240
|
+
const baseExpression = ctx$1.nodes.base(ctx$1);
|
|
11241
|
+
ctx$1.pipes.push(ctx$1.pipes.current, baseExpression);
|
|
11242
|
+
const nullableExpression = ctx$1.nodes.nullable(ctx$1);
|
|
11243
|
+
if (nullableExpression) return nullableExpression;
|
|
11244
|
+
return ctx$1.pipes.current;
|
|
11245
|
+
}
|
|
11246
|
+
const enumToAst$3 = ({ plugin, schema, state }) => {
|
|
11247
|
+
const v = plugin.external("valibot.v");
|
|
11248
|
+
const { enumMembers } = itemsNode$3({
|
|
11249
|
+
$,
|
|
11250
|
+
nodes: {
|
|
11251
|
+
base: baseNode$15,
|
|
11252
|
+
items: itemsNode$3,
|
|
11253
|
+
nullable: nullableNode$3
|
|
11254
|
+
},
|
|
11255
|
+
pipes: {
|
|
11256
|
+
...pipes,
|
|
11257
|
+
current: []
|
|
11258
|
+
},
|
|
11259
|
+
plugin,
|
|
11260
|
+
schema,
|
|
11261
|
+
symbols: { v },
|
|
11262
|
+
utils: { state }
|
|
11263
|
+
});
|
|
11176
11264
|
if (!enumMembers.length) return unknownToAst$3({
|
|
11177
11265
|
plugin,
|
|
11178
11266
|
schema: { type: "unknown" },
|
|
11179
11267
|
state
|
|
11180
11268
|
});
|
|
11181
|
-
const
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11269
|
+
const ctx$1 = {
|
|
11270
|
+
$,
|
|
11271
|
+
nodes: {
|
|
11272
|
+
base: baseNode$15,
|
|
11273
|
+
items: itemsNode$3,
|
|
11274
|
+
nullable: nullableNode$3
|
|
11275
|
+
},
|
|
11276
|
+
pipes: {
|
|
11277
|
+
...pipes,
|
|
11278
|
+
current: []
|
|
11279
|
+
},
|
|
11280
|
+
plugin,
|
|
11281
|
+
schema,
|
|
11282
|
+
symbols: { v },
|
|
11283
|
+
utils: { state }
|
|
11284
|
+
};
|
|
11285
|
+
const resolver = plugin.config["~resolvers"]?.enum;
|
|
11286
|
+
const node = resolver?.(ctx$1) ?? enumResolver$3(ctx$1);
|
|
11287
|
+
return ctx$1.pipes.toNode(node, plugin);
|
|
11185
11288
|
};
|
|
11186
11289
|
|
|
11187
11290
|
//#endregion
|
|
@@ -11226,7 +11329,7 @@ const getIntegerLimit = (format) => {
|
|
|
11226
11329
|
|
|
11227
11330
|
//#endregion
|
|
11228
11331
|
//#region src/plugins/valibot/v1/toAst/number.ts
|
|
11229
|
-
function baseNode$
|
|
11332
|
+
function baseNode$14(ctx$1) {
|
|
11230
11333
|
const { schema, symbols } = ctx$1;
|
|
11231
11334
|
const { v } = symbols;
|
|
11232
11335
|
if (ctx$1.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()))];
|
|
@@ -11260,8 +11363,8 @@ function minNode$3(ctx$1) {
|
|
|
11260
11363
|
function numberResolver$3(ctx$1) {
|
|
11261
11364
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
11262
11365
|
if (constNode$8) return ctx$1.pipes.push(ctx$1.pipes.current, constNode$8);
|
|
11263
|
-
const baseNode$
|
|
11264
|
-
if (baseNode$
|
|
11366
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
11367
|
+
if (baseNode$16) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$16);
|
|
11265
11368
|
const minNode$4 = ctx$1.nodes.min(ctx$1);
|
|
11266
11369
|
if (minNode$4) ctx$1.pipes.push(ctx$1.pipes.current, minNode$4);
|
|
11267
11370
|
const maxNode$4 = ctx$1.nodes.max(ctx$1);
|
|
@@ -11272,7 +11375,7 @@ const numberToNode$3 = ({ plugin, schema }) => {
|
|
|
11272
11375
|
const ctx$1 = {
|
|
11273
11376
|
$,
|
|
11274
11377
|
nodes: {
|
|
11275
|
-
base: baseNode$
|
|
11378
|
+
base: baseNode$14,
|
|
11276
11379
|
const: constNode$7,
|
|
11277
11380
|
max: maxNode$3,
|
|
11278
11381
|
min: minNode$3
|
|
@@ -11312,7 +11415,7 @@ function additionalPropertiesNode$3(ctx$1) {
|
|
|
11312
11415
|
if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
11313
11416
|
return pipes.toNode(additionalAst.pipes, plugin);
|
|
11314
11417
|
}
|
|
11315
|
-
function baseNode$
|
|
11418
|
+
function baseNode$13(ctx$1) {
|
|
11316
11419
|
const { nodes, symbols } = ctx$1;
|
|
11317
11420
|
const { v } = symbols;
|
|
11318
11421
|
const additional = nodes.additionalProperties(ctx$1);
|
|
@@ -11355,7 +11458,7 @@ const objectToAst$3 = ({ plugin, schema, state }) => {
|
|
|
11355
11458
|
$,
|
|
11356
11459
|
nodes: {
|
|
11357
11460
|
additionalProperties: additionalPropertiesNode$3,
|
|
11358
|
-
base: baseNode$
|
|
11461
|
+
base: baseNode$13,
|
|
11359
11462
|
shape: shapeNode$3
|
|
11360
11463
|
},
|
|
11361
11464
|
pipes: {
|
|
@@ -11378,7 +11481,7 @@ const objectToAst$3 = ({ plugin, schema, state }) => {
|
|
|
11378
11481
|
|
|
11379
11482
|
//#endregion
|
|
11380
11483
|
//#region src/plugins/valibot/v1/toAst/string.ts
|
|
11381
|
-
function baseNode$
|
|
11484
|
+
function baseNode$12(ctx$1) {
|
|
11382
11485
|
const { v } = ctx$1.symbols;
|
|
11383
11486
|
return $(v).attr(identifiers$1.schemas.string).call();
|
|
11384
11487
|
}
|
|
@@ -11429,8 +11532,8 @@ function patternNode$3(ctx$1) {
|
|
|
11429
11532
|
function stringResolver$3(ctx$1) {
|
|
11430
11533
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
11431
11534
|
if (constNode$8) return ctx$1.pipes.push(ctx$1.pipes.current, constNode$8);
|
|
11432
|
-
const baseNode$
|
|
11433
|
-
if (baseNode$
|
|
11535
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
11536
|
+
if (baseNode$16) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$16);
|
|
11434
11537
|
const formatNode$4 = ctx$1.nodes.format(ctx$1);
|
|
11435
11538
|
if (formatNode$4) ctx$1.pipes.push(ctx$1.pipes.current, formatNode$4);
|
|
11436
11539
|
const lengthNode$4 = ctx$1.nodes.length(ctx$1);
|
|
@@ -11449,7 +11552,7 @@ const stringToNode$3 = ({ plugin, schema }) => {
|
|
|
11449
11552
|
const ctx$1 = {
|
|
11450
11553
|
$,
|
|
11451
11554
|
nodes: {
|
|
11452
|
-
base: baseNode$
|
|
11555
|
+
base: baseNode$12,
|
|
11453
11556
|
const: constNode$6,
|
|
11454
11557
|
format: formatNode$3,
|
|
11455
11558
|
length: lengthNode$3,
|
|
@@ -12453,9 +12556,9 @@ const booleanToAst$2 = ({ plugin, schema }) => {
|
|
|
12453
12556
|
|
|
12454
12557
|
//#endregion
|
|
12455
12558
|
//#region src/plugins/zod/mini/toAst/enum.ts
|
|
12456
|
-
|
|
12457
|
-
const
|
|
12458
|
-
const
|
|
12559
|
+
function itemsNode$2(ctx$1) {
|
|
12560
|
+
const { schema, symbols } = ctx$1;
|
|
12561
|
+
const { z } = symbols;
|
|
12459
12562
|
const enumMembers = [];
|
|
12460
12563
|
const literalMembers = [];
|
|
12461
12564
|
let isNullable = false;
|
|
@@ -12473,16 +12576,78 @@ const enumToAst$2 = ({ plugin, schema, state }) => {
|
|
|
12473
12576
|
const literal = $.literal(item.const);
|
|
12474
12577
|
literalMembers.push($(z).attr(identifiers.literal).call(literal));
|
|
12475
12578
|
} else if (item.type === "null" || item.const === null) isNullable = true;
|
|
12579
|
+
return {
|
|
12580
|
+
allStrings,
|
|
12581
|
+
enumMembers,
|
|
12582
|
+
isNullable,
|
|
12583
|
+
literalMembers
|
|
12584
|
+
};
|
|
12585
|
+
}
|
|
12586
|
+
function baseNode$11(ctx$1) {
|
|
12587
|
+
const { symbols } = ctx$1;
|
|
12588
|
+
const { z } = symbols;
|
|
12589
|
+
const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
12590
|
+
if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
12591
|
+
else if (literalMembers.length === 1) return literalMembers[0];
|
|
12592
|
+
else return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
12593
|
+
}
|
|
12594
|
+
function nullableNode$2(ctx$1) {
|
|
12595
|
+
const { chain, symbols } = ctx$1;
|
|
12596
|
+
const { z } = symbols;
|
|
12597
|
+
const { isNullable } = ctx$1.nodes.items(ctx$1);
|
|
12598
|
+
if (!isNullable) return;
|
|
12599
|
+
return $(z).attr(identifiers.nullable).call(chain.current);
|
|
12600
|
+
}
|
|
12601
|
+
function enumResolver$2(ctx$1) {
|
|
12602
|
+
const { literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
12603
|
+
if (!literalMembers.length) return ctx$1.chain.current;
|
|
12604
|
+
const baseExpression = ctx$1.nodes.base(ctx$1);
|
|
12605
|
+
ctx$1.chain.current = baseExpression;
|
|
12606
|
+
const nullableExpression = ctx$1.nodes.nullable(ctx$1);
|
|
12607
|
+
if (nullableExpression) ctx$1.chain.current = nullableExpression;
|
|
12608
|
+
return ctx$1.chain.current;
|
|
12609
|
+
}
|
|
12610
|
+
const enumToAst$2 = ({ plugin, schema, state }) => {
|
|
12611
|
+
const z = plugin.external("zod.z");
|
|
12612
|
+
const { literalMembers } = itemsNode$2({
|
|
12613
|
+
$,
|
|
12614
|
+
chain: { current: $(z) },
|
|
12615
|
+
nodes: {
|
|
12616
|
+
base: baseNode$11,
|
|
12617
|
+
items: itemsNode$2,
|
|
12618
|
+
nullable: nullableNode$2
|
|
12619
|
+
},
|
|
12620
|
+
plugin,
|
|
12621
|
+
schema,
|
|
12622
|
+
symbols: { z },
|
|
12623
|
+
utils: {
|
|
12624
|
+
ast: {},
|
|
12625
|
+
state
|
|
12626
|
+
}
|
|
12627
|
+
});
|
|
12476
12628
|
if (!literalMembers.length) return unknownToAst$2({
|
|
12477
12629
|
plugin,
|
|
12478
12630
|
schema: { type: "unknown" },
|
|
12479
12631
|
state
|
|
12480
12632
|
});
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12633
|
+
const ctx$1 = {
|
|
12634
|
+
$,
|
|
12635
|
+
chain: { current: $(z) },
|
|
12636
|
+
nodes: {
|
|
12637
|
+
base: baseNode$11,
|
|
12638
|
+
items: itemsNode$2,
|
|
12639
|
+
nullable: nullableNode$2
|
|
12640
|
+
},
|
|
12641
|
+
plugin,
|
|
12642
|
+
schema,
|
|
12643
|
+
symbols: { z },
|
|
12644
|
+
utils: {
|
|
12645
|
+
ast: {},
|
|
12646
|
+
state
|
|
12647
|
+
}
|
|
12648
|
+
};
|
|
12649
|
+
const resolver = plugin.config["~resolvers"]?.enum;
|
|
12650
|
+
return { expression: resolver?.(ctx$1) ?? enumResolver$2(ctx$1) };
|
|
12486
12651
|
};
|
|
12487
12652
|
|
|
12488
12653
|
//#endregion
|
|
@@ -12505,7 +12670,7 @@ const nullToAst$2 = ({ plugin }) => {
|
|
|
12505
12670
|
|
|
12506
12671
|
//#endregion
|
|
12507
12672
|
//#region src/plugins/zod/mini/toAst/number.ts
|
|
12508
|
-
function baseNode$
|
|
12673
|
+
function baseNode$10(ctx$1) {
|
|
12509
12674
|
const { schema, symbols } = ctx$1;
|
|
12510
12675
|
const { z } = symbols;
|
|
12511
12676
|
if (ctx$1.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
|
|
@@ -12541,8 +12706,8 @@ function numberResolver$2(ctx$1) {
|
|
|
12541
12706
|
ctx$1.chain.current = constNode$8;
|
|
12542
12707
|
return ctx$1.chain.current;
|
|
12543
12708
|
}
|
|
12544
|
-
const baseNode$
|
|
12545
|
-
if (baseNode$
|
|
12709
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
12710
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
12546
12711
|
const checks = [];
|
|
12547
12712
|
const minNode$4 = ctx$1.nodes.min(ctx$1);
|
|
12548
12713
|
if (minNode$4) checks.push(minNode$4);
|
|
@@ -12558,7 +12723,7 @@ const numberToNode$2 = ({ plugin, schema, state }) => {
|
|
|
12558
12723
|
$,
|
|
12559
12724
|
chain: { current: $(z) },
|
|
12560
12725
|
nodes: {
|
|
12561
|
-
base: baseNode$
|
|
12726
|
+
base: baseNode$10,
|
|
12562
12727
|
const: constNode$5,
|
|
12563
12728
|
max: maxNode$2,
|
|
12564
12729
|
min: minNode$2
|
|
@@ -12595,7 +12760,7 @@ function additionalPropertiesNode$2(ctx$1) {
|
|
|
12595
12760
|
if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
12596
12761
|
return additionalAst.expression;
|
|
12597
12762
|
}
|
|
12598
|
-
function baseNode$
|
|
12763
|
+
function baseNode$9(ctx$1) {
|
|
12599
12764
|
const { nodes, symbols } = ctx$1;
|
|
12600
12765
|
const { z } = symbols;
|
|
12601
12766
|
const additional = nodes.additionalProperties(ctx$1);
|
|
@@ -12639,7 +12804,7 @@ const objectToAst$2 = ({ plugin, schema, state }) => {
|
|
|
12639
12804
|
chain: { current: $(z) },
|
|
12640
12805
|
nodes: {
|
|
12641
12806
|
additionalProperties: additionalPropertiesNode$2,
|
|
12642
|
-
base: baseNode$
|
|
12807
|
+
base: baseNode$9,
|
|
12643
12808
|
shape: shapeNode$2
|
|
12644
12809
|
},
|
|
12645
12810
|
plugin,
|
|
@@ -12657,7 +12822,7 @@ const objectToAst$2 = ({ plugin, schema, state }) => {
|
|
|
12657
12822
|
|
|
12658
12823
|
//#endregion
|
|
12659
12824
|
//#region src/plugins/zod/mini/toAst/string.ts
|
|
12660
|
-
function baseNode$
|
|
12825
|
+
function baseNode$8(ctx$1) {
|
|
12661
12826
|
const { z } = ctx$1.symbols;
|
|
12662
12827
|
return $(z).attr(identifiers.string).call();
|
|
12663
12828
|
}
|
|
@@ -12714,8 +12879,8 @@ function stringResolver$2(ctx$1) {
|
|
|
12714
12879
|
ctx$1.chain.current = constNode$8;
|
|
12715
12880
|
return ctx$1.chain.current;
|
|
12716
12881
|
}
|
|
12717
|
-
const baseNode$
|
|
12718
|
-
if (baseNode$
|
|
12882
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
12883
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
12719
12884
|
const formatNode$4 = ctx$1.nodes.format(ctx$1);
|
|
12720
12885
|
if (formatNode$4) ctx$1.chain.current = formatNode$4;
|
|
12721
12886
|
const checks = [];
|
|
@@ -12738,7 +12903,7 @@ const stringToNode$2 = ({ plugin, schema }) => {
|
|
|
12738
12903
|
$,
|
|
12739
12904
|
chain: { current: $(z) },
|
|
12740
12905
|
nodes: {
|
|
12741
|
-
base: baseNode$
|
|
12906
|
+
base: baseNode$8,
|
|
12742
12907
|
const: constNode$4,
|
|
12743
12908
|
format: formatNode$2,
|
|
12744
12909
|
length: lengthNode$2,
|
|
@@ -13123,8 +13288,9 @@ const booleanToAst$1 = ({ plugin, schema }) => {
|
|
|
13123
13288
|
|
|
13124
13289
|
//#endregion
|
|
13125
13290
|
//#region src/plugins/zod/v3/toAst/enum.ts
|
|
13126
|
-
|
|
13127
|
-
const
|
|
13291
|
+
function itemsNode$1(ctx$1) {
|
|
13292
|
+
const { schema, symbols } = ctx$1;
|
|
13293
|
+
const { z } = symbols;
|
|
13128
13294
|
const enumMembers = [];
|
|
13129
13295
|
const literalMembers = [];
|
|
13130
13296
|
let isNullable = false;
|
|
@@ -13142,17 +13308,77 @@ const enumToAst$1 = ({ plugin, schema, state }) => {
|
|
|
13142
13308
|
const literal = $.literal(item.const);
|
|
13143
13309
|
literalMembers.push($(z).attr(identifiers.literal).call(literal));
|
|
13144
13310
|
} else if (item.type === "null" || item.const === null) isNullable = true;
|
|
13311
|
+
return {
|
|
13312
|
+
allStrings,
|
|
13313
|
+
enumMembers,
|
|
13314
|
+
isNullable,
|
|
13315
|
+
literalMembers
|
|
13316
|
+
};
|
|
13317
|
+
}
|
|
13318
|
+
function baseNode$7(ctx$1) {
|
|
13319
|
+
const { symbols } = ctx$1;
|
|
13320
|
+
const { z } = symbols;
|
|
13321
|
+
const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
13322
|
+
if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
13323
|
+
else if (literalMembers.length === 1) return literalMembers[0];
|
|
13324
|
+
else return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
13325
|
+
}
|
|
13326
|
+
function nullableNode$1(ctx$1) {
|
|
13327
|
+
const { chain } = ctx$1;
|
|
13328
|
+
const { isNullable } = ctx$1.nodes.items(ctx$1);
|
|
13329
|
+
if (!isNullable) return;
|
|
13330
|
+
return chain.current.attr(identifiers.nullable).call();
|
|
13331
|
+
}
|
|
13332
|
+
function enumResolver$1(ctx$1) {
|
|
13333
|
+
const { literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
13334
|
+
if (!literalMembers.length) return ctx$1.chain.current;
|
|
13335
|
+
const baseExpression = ctx$1.nodes.base(ctx$1);
|
|
13336
|
+
ctx$1.chain.current = baseExpression;
|
|
13337
|
+
const nullableExpression = ctx$1.nodes.nullable(ctx$1);
|
|
13338
|
+
if (nullableExpression) ctx$1.chain.current = nullableExpression;
|
|
13339
|
+
return ctx$1.chain.current;
|
|
13340
|
+
}
|
|
13341
|
+
const enumToAst$1 = ({ plugin, schema, state }) => {
|
|
13342
|
+
const z = plugin.external("zod.z");
|
|
13343
|
+
const { literalMembers } = itemsNode$1({
|
|
13344
|
+
$,
|
|
13345
|
+
chain: { current: $(z) },
|
|
13346
|
+
nodes: {
|
|
13347
|
+
base: baseNode$7,
|
|
13348
|
+
items: itemsNode$1,
|
|
13349
|
+
nullable: nullableNode$1
|
|
13350
|
+
},
|
|
13351
|
+
plugin,
|
|
13352
|
+
schema,
|
|
13353
|
+
symbols: { z },
|
|
13354
|
+
utils: {
|
|
13355
|
+
ast: {},
|
|
13356
|
+
state
|
|
13357
|
+
}
|
|
13358
|
+
});
|
|
13145
13359
|
if (!literalMembers.length) return unknownToAst$1({
|
|
13146
13360
|
plugin,
|
|
13147
13361
|
schema: { type: "unknown" },
|
|
13148
13362
|
state
|
|
13149
13363
|
});
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13364
|
+
const ctx$1 = {
|
|
13365
|
+
$,
|
|
13366
|
+
chain: { current: $(z) },
|
|
13367
|
+
nodes: {
|
|
13368
|
+
base: baseNode$7,
|
|
13369
|
+
items: itemsNode$1,
|
|
13370
|
+
nullable: nullableNode$1
|
|
13371
|
+
},
|
|
13372
|
+
plugin,
|
|
13373
|
+
schema,
|
|
13374
|
+
symbols: { z },
|
|
13375
|
+
utils: {
|
|
13376
|
+
ast: {},
|
|
13377
|
+
state
|
|
13378
|
+
}
|
|
13379
|
+
};
|
|
13380
|
+
const resolver = plugin.config["~resolvers"]?.enum;
|
|
13381
|
+
return resolver?.(ctx$1) ?? enumResolver$1(ctx$1);
|
|
13156
13382
|
};
|
|
13157
13383
|
|
|
13158
13384
|
//#endregion
|
|
@@ -13169,7 +13395,7 @@ const nullToAst$1 = ({ plugin }) => {
|
|
|
13169
13395
|
|
|
13170
13396
|
//#endregion
|
|
13171
13397
|
//#region src/plugins/zod/v3/toAst/number.ts
|
|
13172
|
-
function baseNode$
|
|
13398
|
+
function baseNode$6(ctx$1) {
|
|
13173
13399
|
const { schema, symbols } = ctx$1;
|
|
13174
13400
|
const { z } = symbols;
|
|
13175
13401
|
if (ctx$1.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
|
|
@@ -13203,8 +13429,8 @@ function numberResolver$1(ctx$1) {
|
|
|
13203
13429
|
ctx$1.chain.current = constNode$8;
|
|
13204
13430
|
return ctx$1.chain.current;
|
|
13205
13431
|
}
|
|
13206
|
-
const baseNode$
|
|
13207
|
-
if (baseNode$
|
|
13432
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
13433
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
13208
13434
|
const minNode$4 = ctx$1.nodes.min(ctx$1);
|
|
13209
13435
|
if (minNode$4) ctx$1.chain.current = minNode$4;
|
|
13210
13436
|
const maxNode$4 = ctx$1.nodes.max(ctx$1);
|
|
@@ -13218,7 +13444,7 @@ const numberToNode$1 = ({ plugin, schema, state }) => {
|
|
|
13218
13444
|
$,
|
|
13219
13445
|
chain: { current: $(z) },
|
|
13220
13446
|
nodes: {
|
|
13221
|
-
base: baseNode$
|
|
13447
|
+
base: baseNode$6,
|
|
13222
13448
|
const: constNode$3,
|
|
13223
13449
|
max: maxNode$1,
|
|
13224
13450
|
min: minNode$1
|
|
@@ -13254,7 +13480,7 @@ function additionalPropertiesNode$1(ctx$1) {
|
|
|
13254
13480
|
if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
13255
13481
|
return additionalAst.expression;
|
|
13256
13482
|
}
|
|
13257
|
-
function baseNode$
|
|
13483
|
+
function baseNode$5(ctx$1) {
|
|
13258
13484
|
const { nodes, symbols } = ctx$1;
|
|
13259
13485
|
const { z } = symbols;
|
|
13260
13486
|
const additional = nodes.additionalProperties(ctx$1);
|
|
@@ -13296,7 +13522,7 @@ const objectToAst$1 = ({ plugin, schema, state }) => {
|
|
|
13296
13522
|
chain: { current: $(z) },
|
|
13297
13523
|
nodes: {
|
|
13298
13524
|
additionalProperties: additionalPropertiesNode$1,
|
|
13299
|
-
base: baseNode$
|
|
13525
|
+
base: baseNode$5,
|
|
13300
13526
|
shape: shapeNode$1
|
|
13301
13527
|
},
|
|
13302
13528
|
plugin,
|
|
@@ -13317,7 +13543,7 @@ const objectToAst$1 = ({ plugin, schema, state }) => {
|
|
|
13317
13543
|
|
|
13318
13544
|
//#endregion
|
|
13319
13545
|
//#region src/plugins/zod/v3/toAst/string.ts
|
|
13320
|
-
function baseNode$
|
|
13546
|
+
function baseNode$4(ctx$1) {
|
|
13321
13547
|
const { z } = ctx$1.symbols;
|
|
13322
13548
|
return $(z).attr(identifiers.string).call();
|
|
13323
13549
|
}
|
|
@@ -13369,8 +13595,8 @@ function stringResolver$1(ctx$1) {
|
|
|
13369
13595
|
ctx$1.chain.current = constNode$8;
|
|
13370
13596
|
return ctx$1.chain.current;
|
|
13371
13597
|
}
|
|
13372
|
-
const baseNode$
|
|
13373
|
-
if (baseNode$
|
|
13598
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
13599
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
13374
13600
|
const formatNode$4 = ctx$1.nodes.format(ctx$1);
|
|
13375
13601
|
if (formatNode$4) ctx$1.chain.current = formatNode$4;
|
|
13376
13602
|
const lengthNode$4 = ctx$1.nodes.length(ctx$1);
|
|
@@ -13391,7 +13617,7 @@ const stringToNode$1 = ({ plugin, schema }) => {
|
|
|
13391
13617
|
$,
|
|
13392
13618
|
chain: { current: $(z) },
|
|
13393
13619
|
nodes: {
|
|
13394
|
-
base: baseNode$
|
|
13620
|
+
base: baseNode$4,
|
|
13395
13621
|
const: constNode$2,
|
|
13396
13622
|
format: formatNode$1,
|
|
13397
13623
|
length: lengthNode$1,
|
|
@@ -13777,9 +14003,9 @@ const booleanToAst = ({ plugin, schema }) => {
|
|
|
13777
14003
|
|
|
13778
14004
|
//#endregion
|
|
13779
14005
|
//#region src/plugins/zod/v4/toAst/enum.ts
|
|
13780
|
-
|
|
13781
|
-
const
|
|
13782
|
-
const z =
|
|
14006
|
+
function itemsNode(ctx$1) {
|
|
14007
|
+
const { schema, symbols } = ctx$1;
|
|
14008
|
+
const { z } = symbols;
|
|
13783
14009
|
const enumMembers = [];
|
|
13784
14010
|
const literalMembers = [];
|
|
13785
14011
|
let isNullable = false;
|
|
@@ -13797,16 +14023,78 @@ const enumToAst = ({ plugin, schema, state }) => {
|
|
|
13797
14023
|
const literal = $.literal(item.const);
|
|
13798
14024
|
literalMembers.push($(z).attr(identifiers.literal).call(literal));
|
|
13799
14025
|
} else if (item.type === "null" || item.const === null) isNullable = true;
|
|
14026
|
+
return {
|
|
14027
|
+
allStrings,
|
|
14028
|
+
enumMembers,
|
|
14029
|
+
isNullable,
|
|
14030
|
+
literalMembers
|
|
14031
|
+
};
|
|
14032
|
+
}
|
|
14033
|
+
function baseNode$3(ctx$1) {
|
|
14034
|
+
const { symbols } = ctx$1;
|
|
14035
|
+
const { z } = symbols;
|
|
14036
|
+
const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
14037
|
+
if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
|
|
14038
|
+
else if (literalMembers.length === 1) return literalMembers[0];
|
|
14039
|
+
else return $(z).attr(identifiers.union).call($.array(...literalMembers));
|
|
14040
|
+
}
|
|
14041
|
+
function nullableNode(ctx$1) {
|
|
14042
|
+
const { chain, symbols } = ctx$1;
|
|
14043
|
+
const { z } = symbols;
|
|
14044
|
+
const { isNullable } = ctx$1.nodes.items(ctx$1);
|
|
14045
|
+
if (!isNullable) return;
|
|
14046
|
+
return $(z).attr(identifiers.nullable).call(chain.current);
|
|
14047
|
+
}
|
|
14048
|
+
function enumResolver(ctx$1) {
|
|
14049
|
+
const { literalMembers } = ctx$1.nodes.items(ctx$1);
|
|
14050
|
+
if (!literalMembers.length) return ctx$1.chain.current;
|
|
14051
|
+
const baseExpression = ctx$1.nodes.base(ctx$1);
|
|
14052
|
+
ctx$1.chain.current = baseExpression;
|
|
14053
|
+
const nullableExpression = ctx$1.nodes.nullable(ctx$1);
|
|
14054
|
+
if (nullableExpression) ctx$1.chain.current = nullableExpression;
|
|
14055
|
+
return ctx$1.chain.current;
|
|
14056
|
+
}
|
|
14057
|
+
const enumToAst = ({ plugin, schema, state }) => {
|
|
14058
|
+
const z = plugin.external("zod.z");
|
|
14059
|
+
const { literalMembers } = itemsNode({
|
|
14060
|
+
$,
|
|
14061
|
+
chain: { current: $(z) },
|
|
14062
|
+
nodes: {
|
|
14063
|
+
base: baseNode$3,
|
|
14064
|
+
items: itemsNode,
|
|
14065
|
+
nullable: nullableNode
|
|
14066
|
+
},
|
|
14067
|
+
plugin,
|
|
14068
|
+
schema,
|
|
14069
|
+
symbols: { z },
|
|
14070
|
+
utils: {
|
|
14071
|
+
ast: {},
|
|
14072
|
+
state
|
|
14073
|
+
}
|
|
14074
|
+
});
|
|
13800
14075
|
if (!literalMembers.length) return unknownToAst({
|
|
13801
14076
|
plugin,
|
|
13802
14077
|
schema: { type: "unknown" },
|
|
13803
14078
|
state
|
|
13804
14079
|
});
|
|
13805
|
-
|
|
13806
|
-
|
|
13807
|
-
|
|
13808
|
-
|
|
13809
|
-
|
|
14080
|
+
const ctx$1 = {
|
|
14081
|
+
$,
|
|
14082
|
+
chain: { current: $(z) },
|
|
14083
|
+
nodes: {
|
|
14084
|
+
base: baseNode$3,
|
|
14085
|
+
items: itemsNode,
|
|
14086
|
+
nullable: nullableNode
|
|
14087
|
+
},
|
|
14088
|
+
plugin,
|
|
14089
|
+
schema,
|
|
14090
|
+
symbols: { z },
|
|
14091
|
+
utils: {
|
|
14092
|
+
ast: {},
|
|
14093
|
+
state
|
|
14094
|
+
}
|
|
14095
|
+
};
|
|
14096
|
+
const resolver = plugin.config["~resolvers"]?.enum;
|
|
14097
|
+
return { expression: resolver?.(ctx$1) ?? enumResolver(ctx$1) };
|
|
13810
14098
|
};
|
|
13811
14099
|
|
|
13812
14100
|
//#endregion
|
|
@@ -13861,8 +14149,8 @@ function numberResolver(ctx$1) {
|
|
|
13861
14149
|
ctx$1.chain.current = constNode$8;
|
|
13862
14150
|
return ctx$1.chain.current;
|
|
13863
14151
|
}
|
|
13864
|
-
const baseNode$
|
|
13865
|
-
if (baseNode$
|
|
14152
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
14153
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
13866
14154
|
const minNode$4 = ctx$1.nodes.min(ctx$1);
|
|
13867
14155
|
if (minNode$4) ctx$1.chain.current = minNode$4;
|
|
13868
14156
|
const maxNode$4 = ctx$1.nodes.max(ctx$1);
|
|
@@ -14028,8 +14316,8 @@ function stringResolver(ctx$1) {
|
|
|
14028
14316
|
ctx$1.chain.current = constNode$8;
|
|
14029
14317
|
return ctx$1.chain.current;
|
|
14030
14318
|
}
|
|
14031
|
-
const baseNode$
|
|
14032
|
-
if (baseNode$
|
|
14319
|
+
const baseNode$16 = ctx$1.nodes.base(ctx$1);
|
|
14320
|
+
if (baseNode$16) ctx$1.chain.current = baseNode$16;
|
|
14033
14321
|
const formatNode$4 = ctx$1.nodes.format(ctx$1);
|
|
14034
14322
|
if (formatNode$4) ctx$1.chain.current = formatNode$4;
|
|
14035
14323
|
const lengthNode$4 = ctx$1.nodes.length(ctx$1);
|
|
@@ -21445,4 +21733,4 @@ const parseOpenApiSpec = ({ config, dependencies, logger, spec }) => {
|
|
|
21445
21733
|
|
|
21446
21734
|
//#endregion
|
|
21447
21735
|
export { openGitHubIssueWithCrashReport as A, defaultPaginationKeywords as C, ConfigValidationError as D, ConfigError as E, shouldReportCrash as M, loadPackageJson as N, JobError as O, definePluginConfig as S, getLogs as T, regexp as _, defaultPlugins as a, OperationPath as b, clientDefaultConfig as c, $ as d, TypeScriptRenderer as f, keywords as g, reserved as h, initConfigs as i, printCrashReport as j, logCrashReport as k, clientDefaultMeta as l, ctx as m, buildGraph as n, clientPluginHandler as o, TsDslContext as p, getSpec as r, generateClientBundle as s, parseOpenApiSpec as t, toCase as u, TsDsl as v, postprocessOutput as w, OperationStrategy as x, getClientPlugin as y };
|
|
21448
|
-
//# sourceMappingURL=openApi-
|
|
21736
|
+
//# sourceMappingURL=openApi-D6jppAcA.mjs.map
|