@hey-api/openapi-ts 0.96.1 → 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 +4 -2
- package/dist/clients/angular/utils.ts +4 -2
- package/dist/clients/fetch/client.ts +111 -129
- package/dist/clients/fetch/types.ts +4 -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 +22 -34
- package/dist/clients/ky/utils.ts +4 -2
- package/dist/clients/next/client.ts +102 -100
- package/dist/clients/next/types.ts +2 -1
- package/dist/clients/next/utils.ts +2 -1
- package/dist/clients/ofetch/client.ts +68 -58
- package/dist/clients/ofetch/types.ts +4 -2
- package/dist/clients/ofetch/utils.ts +5 -3
- package/dist/index.d.mts +645 -1080
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-D4xuNKgu.mjs → init-EigcXVTH.mjs} +344 -23
- 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-DlsTSwMY.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-D4xuNKgu.mjs.map +0 -1
- package/dist/src-DlsTSwMY.mjs.map +0 -1
- package/dist/types-DAEl4_a4.d.mts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-
|
|
2
|
-
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-
|
|
1
|
+
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-EigcXVTH.mjs";
|
|
2
|
+
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-ErSC87Z1.mjs";
|
|
3
3
|
export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
|
|
@@ -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 = {
|
|
@@ -8349,7 +8368,7 @@ const handleMeta = (plugin, operation, configPath) => {
|
|
|
8349
8368
|
};
|
|
8350
8369
|
//#endregion
|
|
8351
8370
|
//#region src/plugins/@tanstack/query-core/v5/infiniteQueryOptions.ts
|
|
8352
|
-
|
|
8371
|
+
function createInfiniteParamsFunction({ plugin }) {
|
|
8353
8372
|
const symbolCreateInfiniteParams = plugin.symbol(applyNaming("createInfiniteParams", { case: plugin.config.case }), { meta: {
|
|
8354
8373
|
category: "utility",
|
|
8355
8374
|
resource: "createInfiniteParams",
|
|
@@ -8357,8 +8376,8 @@ const createInfiniteParamsFunction = ({ plugin }) => {
|
|
|
8357
8376
|
} });
|
|
8358
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()))));
|
|
8359
8378
|
plugin.node(fn);
|
|
8360
|
-
}
|
|
8361
|
-
|
|
8379
|
+
}
|
|
8380
|
+
function createInfiniteQueryOptions({ operation, plugin }) {
|
|
8362
8381
|
const pagination = operationPagination({
|
|
8363
8382
|
context: plugin.context,
|
|
8364
8383
|
operation
|
|
@@ -8428,10 +8447,10 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
|
|
|
8428
8447
|
plugin
|
|
8429
8448
|
}), $.type(symbolInfiniteDataType).generic(typeResponse), typeQueryKey, $.type.or(type, typePageObjectParam)))));
|
|
8430
8449
|
plugin.node(statement);
|
|
8431
|
-
}
|
|
8450
|
+
}
|
|
8432
8451
|
//#endregion
|
|
8433
8452
|
//#region src/plugins/@tanstack/query-core/v5/mutationOptions.ts
|
|
8434
|
-
|
|
8453
|
+
function createMutationOptions({ operation, plugin }) {
|
|
8435
8454
|
if (hasOperationSse({ operation })) return;
|
|
8436
8455
|
const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
|
|
8437
8456
|
const typeData = useTypeData({
|
|
@@ -8464,11 +8483,11 @@ const createMutationOptions = ({ operation, plugin }) => {
|
|
|
8464
8483
|
} });
|
|
8465
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()));
|
|
8466
8485
|
plugin.node(statement);
|
|
8467
|
-
}
|
|
8486
|
+
}
|
|
8468
8487
|
//#endregion
|
|
8469
8488
|
//#region src/plugins/@tanstack/query-core/v5/queryOptions.ts
|
|
8470
8489
|
const optionsParamName$1 = "options";
|
|
8471
|
-
|
|
8490
|
+
function createQueryOptions({ operation, plugin }) {
|
|
8472
8491
|
if (hasOperationSse({ operation })) return;
|
|
8473
8492
|
const isRequiredOptions = isOperationOptionsRequired({
|
|
8474
8493
|
context: plugin.context,
|
|
@@ -8519,11 +8538,51 @@ const createQueryOptions = ({ operation, plugin }) => {
|
|
|
8519
8538
|
plugin
|
|
8520
8539
|
}), typeResponse, $(symbolQueryKey).returnType()).return()));
|
|
8521
8540
|
plugin.node(statement);
|
|
8522
|
-
}
|
|
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
|
+
}
|
|
8523
8582
|
//#endregion
|
|
8524
8583
|
//#region src/plugins/@tanstack/query-core/v5/useMutation.ts
|
|
8525
8584
|
const mutationOptionsParamName = "mutationOptions";
|
|
8526
|
-
|
|
8585
|
+
function createUseMutation({ operation, plugin }) {
|
|
8527
8586
|
if (!("useMutation" in plugin.config)) return;
|
|
8528
8587
|
const symbolUseMutationFn = plugin.symbol(applyNaming(operation.id, plugin.config.useMutation));
|
|
8529
8588
|
const symbolUseMutation = plugin.external(`${plugin.name}.useMutation`);
|
|
@@ -8550,11 +8609,11 @@ const createUseMutation = ({ operation, plugin }) => {
|
|
|
8550
8609
|
func.do($(symbolUseMutation).call($.object().spread($(symbolMutationOptionsFn).call()).spread(mutationOptionsParamName)).return());
|
|
8551
8610
|
const statement = $.const(symbolUseMutationFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign(func);
|
|
8552
8611
|
plugin.node(statement);
|
|
8553
|
-
}
|
|
8612
|
+
}
|
|
8554
8613
|
//#endregion
|
|
8555
8614
|
//#region src/plugins/@tanstack/query-core/v5/useQuery.ts
|
|
8556
8615
|
const optionsParamName = "options";
|
|
8557
|
-
|
|
8616
|
+
function createUseQuery({ operation, plugin }) {
|
|
8558
8617
|
if (hasOperationSse({ operation })) return;
|
|
8559
8618
|
if (!("useQuery" in plugin.config)) return;
|
|
8560
8619
|
const symbolUseQueryFn = plugin.symbol(applyNaming(operation.id, plugin.config.useQuery));
|
|
@@ -8576,7 +8635,48 @@ const createUseQuery = ({ operation, plugin }) => {
|
|
|
8576
8635
|
});
|
|
8577
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()));
|
|
8578
8637
|
plugin.node(statement);
|
|
8579
|
-
}
|
|
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
|
+
}
|
|
8580
8680
|
//#endregion
|
|
8581
8681
|
//#region src/plugins/@tanstack/query-core/v5/plugin.ts
|
|
8582
8682
|
const handlerV5 = ({ plugin }) => {
|
|
@@ -8595,9 +8695,15 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8595
8695
|
meta: { resource: `${plugin.name}.MutationOptions` }
|
|
8596
8696
|
});
|
|
8597
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
|
+
});
|
|
8598
8703
|
plugin.symbol("queryOptions", { external: plugin.name });
|
|
8599
8704
|
plugin.symbol("useMutation", { external: plugin.name });
|
|
8600
8705
|
plugin.symbol("useQuery", { external: plugin.name });
|
|
8706
|
+
plugin.symbol("useQueryClient", { external: plugin.name });
|
|
8601
8707
|
plugin.symbol("AxiosError", {
|
|
8602
8708
|
external: "axios",
|
|
8603
8709
|
kind: "type"
|
|
@@ -8612,10 +8718,18 @@ const handlerV5 = ({ plugin }) => {
|
|
|
8612
8718
|
operation,
|
|
8613
8719
|
plugin
|
|
8614
8720
|
});
|
|
8721
|
+
if (plugin.config.setQueryData.enabled) createSetQueryData({
|
|
8722
|
+
operation,
|
|
8723
|
+
plugin
|
|
8724
|
+
});
|
|
8615
8725
|
if ("useQuery" in plugin.config && plugin.config.useQuery.enabled) createUseQuery({
|
|
8616
8726
|
operation,
|
|
8617
8727
|
plugin
|
|
8618
8728
|
});
|
|
8729
|
+
if ("useSetQueryData" in plugin.config && plugin.config.useSetQueryData.enabled) createUseSetQueryData({
|
|
8730
|
+
operation,
|
|
8731
|
+
plugin
|
|
8732
|
+
});
|
|
8619
8733
|
}
|
|
8620
8734
|
if (plugin.hooks.operation.isMutation(operation)) {
|
|
8621
8735
|
if (plugin.config.mutationOptions.enabled) createMutationOptions({
|
|
@@ -8693,6 +8807,29 @@ const defaultConfig$12 = {
|
|
|
8693
8807
|
mappers,
|
|
8694
8808
|
value: plugin.config.queryOptions
|
|
8695
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
|
+
});
|
|
8696
8833
|
}
|
|
8697
8834
|
};
|
|
8698
8835
|
definePluginConfig(defaultConfig$12);
|
|
@@ -8757,6 +8894,29 @@ const defaultConfig$11 = {
|
|
|
8757
8894
|
mappers,
|
|
8758
8895
|
value: plugin.config.queryOptions
|
|
8759
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
|
+
});
|
|
8760
8920
|
plugin.config.useMutation = context.valueToObject({
|
|
8761
8921
|
defaultValue: {
|
|
8762
8922
|
case: plugin.config.case ?? "camelCase",
|
|
@@ -8803,6 +8963,29 @@ const defaultConfig$11 = {
|
|
|
8803
8963
|
},
|
|
8804
8964
|
value: plugin.config.useQuery
|
|
8805
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
|
+
});
|
|
8806
8989
|
if (plugin.config.useMutation.enabled) {
|
|
8807
8990
|
if (!plugin.config.mutationOptions.enabled) {
|
|
8808
8991
|
plugin.config.mutationOptions.enabled = true;
|
|
@@ -8879,6 +9062,29 @@ const defaultConfig$10 = {
|
|
|
8879
9062
|
mappers,
|
|
8880
9063
|
value: plugin.config.queryOptions
|
|
8881
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
|
+
});
|
|
8882
9088
|
plugin.config.useMutation = context.valueToObject({
|
|
8883
9089
|
defaultValue: {
|
|
8884
9090
|
case: plugin.config.case ?? "camelCase",
|
|
@@ -8925,6 +9131,29 @@ const defaultConfig$10 = {
|
|
|
8925
9131
|
},
|
|
8926
9132
|
value: plugin.config.useQuery
|
|
8927
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
|
+
});
|
|
8928
9157
|
if (plugin.config.useMutation.enabled) {
|
|
8929
9158
|
if (!plugin.config.mutationOptions.enabled) {
|
|
8930
9159
|
plugin.config.mutationOptions.enabled = true;
|
|
@@ -9001,6 +9230,29 @@ const defaultConfig$9 = {
|
|
|
9001
9230
|
mappers,
|
|
9002
9231
|
value: plugin.config.queryOptions
|
|
9003
9232
|
});
|
|
9233
|
+
plugin.config.setQueryData = context.valueToObject({
|
|
9234
|
+
defaultValue: {
|
|
9235
|
+
case: plugin.config.case ?? "camelCase",
|
|
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
|
+
});
|
|
9004
9256
|
}
|
|
9005
9257
|
};
|
|
9006
9258
|
definePluginConfig(defaultConfig$9);
|
|
@@ -9065,6 +9317,29 @@ const defaultConfig$8 = {
|
|
|
9065
9317
|
mappers,
|
|
9066
9318
|
value: plugin.config.queryOptions
|
|
9067
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
|
+
});
|
|
9068
9343
|
}
|
|
9069
9344
|
};
|
|
9070
9345
|
definePluginConfig(defaultConfig$8);
|
|
@@ -9129,6 +9404,29 @@ const defaultConfig$7 = {
|
|
|
9129
9404
|
mappers,
|
|
9130
9405
|
value: plugin.config.queryOptions
|
|
9131
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
|
+
});
|
|
9132
9430
|
}
|
|
9133
9431
|
};
|
|
9134
9432
|
definePluginConfig(defaultConfig$7);
|
|
@@ -13055,6 +13353,7 @@ function defaultMeta(schema) {
|
|
|
13055
13353
|
default: schema.default,
|
|
13056
13354
|
format: schema.format,
|
|
13057
13355
|
hasLazy: false,
|
|
13356
|
+
isIntersection: false,
|
|
13058
13357
|
isLazy: false,
|
|
13059
13358
|
isObject: false,
|
|
13060
13359
|
nullable: false,
|
|
@@ -13072,6 +13371,7 @@ function composeMeta(children, overrides) {
|
|
|
13072
13371
|
default: overrides?.default,
|
|
13073
13372
|
format: overrides?.format,
|
|
13074
13373
|
hasLazy: overrides?.hasLazy ?? children.some((c) => c.meta.hasLazy),
|
|
13374
|
+
isIntersection: overrides?.isIntersection ?? false,
|
|
13075
13375
|
isLazy: overrides?.isLazy ?? children.some((c) => c.meta.isLazy),
|
|
13076
13376
|
isObject: overrides?.isObject ?? children.some((c) => c.meta.isObject),
|
|
13077
13377
|
nullable: overrides?.nullable ?? children.some((c) => c.meta.nullable),
|
|
@@ -13721,14 +14021,17 @@ function tryBuildDiscriminatedUnion({ items, parentSchema, plugin, schemas }) {
|
|
|
13721
14021
|
const discriminatedValue = schema.items[0].properties?.[discriminatorKey]?.const;
|
|
13722
14022
|
if (discriminatedValue === void 0 || items[index].meta.hasLazy) return null;
|
|
13723
14023
|
let refExpression;
|
|
13724
|
-
if (refPart.symbolRef)
|
|
13725
|
-
|
|
14024
|
+
if (refPart.symbolRef) {
|
|
14025
|
+
if (refPart.symbolRef.meta?.isIntersection) return null;
|
|
14026
|
+
refExpression = $(refPart.symbolRef);
|
|
14027
|
+
} else if (refPart.$ref) {
|
|
13726
14028
|
const query = {
|
|
13727
14029
|
category: "schema",
|
|
13728
14030
|
resource: "definition",
|
|
13729
14031
|
resourceId: refPart.$ref,
|
|
13730
14032
|
tool: "zod"
|
|
13731
14033
|
};
|
|
14034
|
+
if ((plugin.querySymbol(query)?.meta)?.isIntersection) return null;
|
|
13732
14035
|
refExpression = $(plugin.referenceSymbol(query));
|
|
13733
14036
|
} else return null;
|
|
13734
14037
|
members.push({
|
|
@@ -13919,6 +14222,7 @@ function createVisitor$2(config = {}) {
|
|
|
13919
14222
|
default: parentSchema.default,
|
|
13920
14223
|
format: parentSchema.format,
|
|
13921
14224
|
hasLazy: hasAnyLazy,
|
|
14225
|
+
isIntersection: true,
|
|
13922
14226
|
isLazy: false,
|
|
13923
14227
|
nullable: items.some((i) => i.meta.nullable),
|
|
13924
14228
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -14079,6 +14383,7 @@ function createVisitor$2(config = {}) {
|
|
|
14079
14383
|
default: parentSchema.default,
|
|
14080
14384
|
format: parentSchema.format,
|
|
14081
14385
|
hasLazy: hasAnyLazy,
|
|
14386
|
+
isIntersection: false,
|
|
14082
14387
|
isLazy: false,
|
|
14083
14388
|
nullable: hasNull,
|
|
14084
14389
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -14150,6 +14455,10 @@ function createProcessor$2(plugin) {
|
|
|
14150
14455
|
exportAst({
|
|
14151
14456
|
...ctx,
|
|
14152
14457
|
final,
|
|
14458
|
+
meta: result.meta.isIntersection ? {
|
|
14459
|
+
...ctx.meta,
|
|
14460
|
+
isIntersection: true
|
|
14461
|
+
} : ctx.meta,
|
|
14153
14462
|
plugin
|
|
14154
14463
|
});
|
|
14155
14464
|
return;
|
|
@@ -15014,6 +15323,7 @@ function createVisitor$1(config = {}) {
|
|
|
15014
15323
|
default: parentSchema.default,
|
|
15015
15324
|
format: parentSchema.format,
|
|
15016
15325
|
hasLazy: hasAnyLazy,
|
|
15326
|
+
isIntersection: true,
|
|
15017
15327
|
isLazy: false,
|
|
15018
15328
|
nullable: items.some((i) => i.meta.nullable),
|
|
15019
15329
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -15165,6 +15475,7 @@ function createVisitor$1(config = {}) {
|
|
|
15165
15475
|
default: parentSchema.default,
|
|
15166
15476
|
format: parentSchema.format,
|
|
15167
15477
|
hasLazy: hasAnyLazy,
|
|
15478
|
+
isIntersection: false,
|
|
15168
15479
|
isLazy: false,
|
|
15169
15480
|
nullable: hasNull,
|
|
15170
15481
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -15236,6 +15547,10 @@ function createProcessor$1(plugin) {
|
|
|
15236
15547
|
exportAst({
|
|
15237
15548
|
...ctx,
|
|
15238
15549
|
final,
|
|
15550
|
+
meta: result.meta.isIntersection ? {
|
|
15551
|
+
...ctx.meta,
|
|
15552
|
+
isIntersection: true
|
|
15553
|
+
} : ctx.meta,
|
|
15239
15554
|
plugin
|
|
15240
15555
|
});
|
|
15241
15556
|
return;
|
|
@@ -16106,6 +16421,7 @@ function createVisitor(config = {}) {
|
|
|
16106
16421
|
default: parentSchema.default,
|
|
16107
16422
|
format: parentSchema.format,
|
|
16108
16423
|
hasLazy: hasAnyLazy,
|
|
16424
|
+
isIntersection: true,
|
|
16109
16425
|
isLazy: false,
|
|
16110
16426
|
nullable: items.some((i) => i.meta.nullable),
|
|
16111
16427
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -16266,6 +16582,7 @@ function createVisitor(config = {}) {
|
|
|
16266
16582
|
default: parentSchema.default,
|
|
16267
16583
|
format: parentSchema.format,
|
|
16268
16584
|
hasLazy: hasAnyLazy,
|
|
16585
|
+
isIntersection: false,
|
|
16269
16586
|
isLazy: false,
|
|
16270
16587
|
nullable: hasNull,
|
|
16271
16588
|
readonly: items.some((i) => i.meta.readonly)
|
|
@@ -16337,6 +16654,10 @@ function createProcessor(plugin) {
|
|
|
16337
16654
|
exportAst({
|
|
16338
16655
|
...ctx,
|
|
16339
16656
|
final,
|
|
16657
|
+
meta: result.meta.isIntersection ? {
|
|
16658
|
+
...ctx.meta,
|
|
16659
|
+
isIntersection: true
|
|
16660
|
+
} : ctx.meta,
|
|
16340
16661
|
plugin
|
|
16341
16662
|
});
|
|
16342
16663
|
return;
|
|
@@ -17208,4 +17529,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
17208
17529
|
//#endregion
|
|
17209
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 };
|
|
17210
17531
|
|
|
17211
|
-
//# sourceMappingURL=init-
|
|
17532
|
+
//# sourceMappingURL=init-EigcXVTH.mjs.map
|