@hey-api/openapi-ts 0.96.1 → 0.97.1

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/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-D4xuNKgu.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-DlsTSwMY.mjs";
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-Bi6_Uyy_.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-CSz9FXkH.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
- "--apply",
104
+ "--write",
96
105
  "{{path}}"
97
106
  ],
98
107
  command: "biome",
@@ -3169,8 +3178,8 @@ var ImplForTsDsl = class extends Mixed$20 {
3169
3178
  analyze(ctx) {
3170
3179
  ctx.analyze(this._condition);
3171
3180
  ctx.analyze(this._iterableOrUpdate);
3172
- ctx.analyze(this._variableOrInit);
3173
3181
  ctx.pushScope();
3182
+ ctx.analyze(this._variableOrInit);
3174
3183
  try {
3175
3184
  super.analyze(ctx);
3176
3185
  } finally {
@@ -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
- const resolveBaseUrlString = ({ plugin }) => {
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: runtimeConfigPath }) : void 0;
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
- const createClientConfigType = ({ plugin }) => {
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
- const clientPluginHandler = ({ plugin }) => {
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 = {
@@ -6432,14 +6451,15 @@ function processSchemaType({ dataExpression, plugin, schema }) {
6432
6451
  else nodes.push($.if(propertyAccessExpression).do(...propertyNodes));
6433
6452
  }
6434
6453
  if (schema.additionalProperties && dataExpression) {
6454
+ const key = plugin.symbol("key");
6435
6455
  const entryValueNodes = processSchemaType({
6436
- dataExpression: $(dataExpression).attr("key").computed(),
6456
+ dataExpression: $(dataExpression).attr(key).computed(),
6437
6457
  plugin,
6438
6458
  schema: schema.additionalProperties
6439
6459
  });
6440
6460
  if (entryValueNodes.length) {
6441
6461
  const properties = Object.keys(schema.properties ?? {});
6442
- nodes.push($.for($.const("key")).of($("Object").attr("keys").call(dataExpression)).$if(properties.length, (f) => f.do($.if($.not($.array(...properties).attr("includes").call("key"))).do(...entryValueNodes)), (f) => f.do(...entryValueNodes)));
6462
+ nodes.push($.for($.const(key)).of($("Object").attr("keys").call(dataExpression)).$if(properties.length, (f) => f.do($.if($.not($.array(...properties).attr("includes").call(key))).do(...entryValueNodes)), (f) => f.do(...entryValueNodes)));
6443
6463
  }
6444
6464
  }
6445
6465
  return nodes;
@@ -8349,7 +8369,7 @@ const handleMeta = (plugin, operation, configPath) => {
8349
8369
  };
8350
8370
  //#endregion
8351
8371
  //#region src/plugins/@tanstack/query-core/v5/infiniteQueryOptions.ts
8352
- const createInfiniteParamsFunction = ({ plugin }) => {
8372
+ function createInfiniteParamsFunction({ plugin }) {
8353
8373
  const symbolCreateInfiniteParams = plugin.symbol(applyNaming("createInfiniteParams", { case: plugin.config.case }), { meta: {
8354
8374
  category: "utility",
8355
8375
  resource: "createInfiniteParams",
@@ -8357,8 +8377,8 @@ const createInfiniteParamsFunction = ({ plugin }) => {
8357
8377
  } });
8358
8378
  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
8379
  plugin.node(fn);
8360
- };
8361
- const createInfiniteQueryOptions = ({ operation, plugin }) => {
8380
+ }
8381
+ function createInfiniteQueryOptions({ operation, plugin }) {
8362
8382
  const pagination = operationPagination({
8363
8383
  context: plugin.context,
8364
8384
  operation
@@ -8428,10 +8448,10 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
8428
8448
  plugin
8429
8449
  }), $.type(symbolInfiniteDataType).generic(typeResponse), typeQueryKey, $.type.or(type, typePageObjectParam)))));
8430
8450
  plugin.node(statement);
8431
- };
8451
+ }
8432
8452
  //#endregion
8433
8453
  //#region src/plugins/@tanstack/query-core/v5/mutationOptions.ts
8434
- const createMutationOptions = ({ operation, plugin }) => {
8454
+ function createMutationOptions({ operation, plugin }) {
8435
8455
  if (hasOperationSse({ operation })) return;
8436
8456
  const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
8437
8457
  const typeData = useTypeData({
@@ -8464,11 +8484,11 @@ const createMutationOptions = ({ operation, plugin }) => {
8464
8484
  } });
8465
8485
  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
8486
  plugin.node(statement);
8467
- };
8487
+ }
8468
8488
  //#endregion
8469
8489
  //#region src/plugins/@tanstack/query-core/v5/queryOptions.ts
8470
8490
  const optionsParamName$1 = "options";
8471
- const createQueryOptions = ({ operation, plugin }) => {
8491
+ function createQueryOptions({ operation, plugin }) {
8472
8492
  if (hasOperationSse({ operation })) return;
8473
8493
  const isRequiredOptions = isOperationOptionsRequired({
8474
8494
  context: plugin.context,
@@ -8519,11 +8539,51 @@ const createQueryOptions = ({ operation, plugin }) => {
8519
8539
  plugin
8520
8540
  }), typeResponse, $(symbolQueryKey).returnType()).return()));
8521
8541
  plugin.node(statement);
8522
- };
8542
+ }
8543
+ //#endregion
8544
+ //#region src/plugins/@tanstack/query-core/v5/setQueryData.ts
8545
+ function createSetQueryData({ operation, plugin }) {
8546
+ if (hasOperationSse({ operation })) return;
8547
+ const isRequiredOptions = isOperationOptionsRequired({
8548
+ context: plugin.context,
8549
+ operation
8550
+ });
8551
+ const symbolQueryOptionsFn = plugin.referenceSymbol({
8552
+ category: "hook",
8553
+ resource: "operation",
8554
+ resourceId: operation.id,
8555
+ role: "queryOptions",
8556
+ tool: plugin.name
8557
+ });
8558
+ const symbolQueryClient = plugin.referenceSymbol({ resource: `${plugin.name}.QueryClient` });
8559
+ const typeData = useTypeData({
8560
+ operation,
8561
+ plugin
8562
+ });
8563
+ const typeResponse = useTypeResponse({
8564
+ operation,
8565
+ plugin
8566
+ });
8567
+ const responseOrUndefined = $.type.or(typeResponse, $.type("undefined"));
8568
+ const updaterType = $.type.or(typeResponse, $.type("undefined"), $.type.func().param("old", (p) => p.type(responseOrUndefined)).returns(responseOrUndefined));
8569
+ const symbolSetQueryData = plugin.symbol(applyNaming(operation.id, plugin.config.setQueryData), { meta: {
8570
+ category: "hook",
8571
+ resource: "operation",
8572
+ resourceId: operation.id,
8573
+ role: "setQueryData",
8574
+ tool: plugin.name
8575
+ } });
8576
+ const queryClientParam = "queryClient";
8577
+ const optionsParam = "options";
8578
+ const updaterParam = "updater";
8579
+ const optionsType = isRequiredOptions ? typeData : $.type.or(typeData, $.type("undefined"));
8580
+ 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()));
8581
+ plugin.node(statement);
8582
+ }
8523
8583
  //#endregion
8524
8584
  //#region src/plugins/@tanstack/query-core/v5/useMutation.ts
8525
8585
  const mutationOptionsParamName = "mutationOptions";
8526
- const createUseMutation = ({ operation, plugin }) => {
8586
+ function createUseMutation({ operation, plugin }) {
8527
8587
  if (!("useMutation" in plugin.config)) return;
8528
8588
  const symbolUseMutationFn = plugin.symbol(applyNaming(operation.id, plugin.config.useMutation));
8529
8589
  const symbolUseMutation = plugin.external(`${plugin.name}.useMutation`);
@@ -8550,11 +8610,11 @@ const createUseMutation = ({ operation, plugin }) => {
8550
8610
  func.do($(symbolUseMutation).call($.object().spread($(symbolMutationOptionsFn).call()).spread(mutationOptionsParamName)).return());
8551
8611
  const statement = $.const(symbolUseMutationFn).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign(func);
8552
8612
  plugin.node(statement);
8553
- };
8613
+ }
8554
8614
  //#endregion
8555
8615
  //#region src/plugins/@tanstack/query-core/v5/useQuery.ts
8556
8616
  const optionsParamName = "options";
8557
- const createUseQuery = ({ operation, plugin }) => {
8617
+ function createUseQuery({ operation, plugin }) {
8558
8618
  if (hasOperationSse({ operation })) return;
8559
8619
  if (!("useQuery" in plugin.config)) return;
8560
8620
  const symbolUseQueryFn = plugin.symbol(applyNaming(operation.id, plugin.config.useQuery));
@@ -8576,7 +8636,48 @@ const createUseQuery = ({ operation, plugin }) => {
8576
8636
  });
8577
8637
  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
8638
  plugin.node(statement);
8579
- };
8639
+ }
8640
+ //#endregion
8641
+ //#region src/plugins/@tanstack/query-core/v5/useSetQueryData.ts
8642
+ function createUseSetQueryData({ operation, plugin }) {
8643
+ if (hasOperationSse({ operation })) return;
8644
+ if (!("useSetQueryData" in plugin.config)) return;
8645
+ const isRequiredOptions = isOperationOptionsRequired({
8646
+ context: plugin.context,
8647
+ operation
8648
+ });
8649
+ const symbolUseQueryClient = plugin.external(`${plugin.name}.useQueryClient`);
8650
+ const symbolQueryOptionsFn = plugin.referenceSymbol({
8651
+ category: "hook",
8652
+ resource: "operation",
8653
+ resourceId: operation.id,
8654
+ role: "queryOptions",
8655
+ tool: plugin.name
8656
+ });
8657
+ const typeData = useTypeData({
8658
+ operation,
8659
+ plugin
8660
+ });
8661
+ const typeResponse = useTypeResponse({
8662
+ operation,
8663
+ plugin
8664
+ });
8665
+ const responseOrUndefined = $.type.or(typeResponse, $.type("undefined"));
8666
+ const updaterType = $.type.or(typeResponse, $.type("undefined"), $.type.func().param("old", (p) => p.type(responseOrUndefined)).returns(responseOrUndefined));
8667
+ const symbolUseSetQueryData = plugin.symbol(applyNaming(operation.id, plugin.config.useSetQueryData), { meta: {
8668
+ category: "hook",
8669
+ resource: "operation",
8670
+ resourceId: operation.id,
8671
+ role: "useSetQueryData",
8672
+ tool: plugin.name
8673
+ } });
8674
+ const queryClientVar = "queryClient";
8675
+ const optionsParam = "options";
8676
+ const updaterParam = "updater";
8677
+ const optionsType = isRequiredOptions ? typeData : $.type.or(typeData, $.type("undefined"));
8678
+ 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()))));
8679
+ plugin.node(statement);
8680
+ }
8580
8681
  //#endregion
8581
8682
  //#region src/plugins/@tanstack/query-core/v5/plugin.ts
8582
8683
  const handlerV5 = ({ plugin }) => {
@@ -8595,9 +8696,15 @@ const handlerV5 = ({ plugin }) => {
8595
8696
  meta: { resource: `${plugin.name}.MutationOptions` }
8596
8697
  });
8597
8698
  plugin.symbol("infiniteQueryOptions", { external: plugin.name });
8699
+ plugin.symbol("QueryClient", {
8700
+ external: plugin.name,
8701
+ kind: "type",
8702
+ meta: { resource: `${plugin.name}.QueryClient` }
8703
+ });
8598
8704
  plugin.symbol("queryOptions", { external: plugin.name });
8599
8705
  plugin.symbol("useMutation", { external: plugin.name });
8600
8706
  plugin.symbol("useQuery", { external: plugin.name });
8707
+ plugin.symbol("useQueryClient", { external: plugin.name });
8601
8708
  plugin.symbol("AxiosError", {
8602
8709
  external: "axios",
8603
8710
  kind: "type"
@@ -8612,10 +8719,18 @@ const handlerV5 = ({ plugin }) => {
8612
8719
  operation,
8613
8720
  plugin
8614
8721
  });
8722
+ if (plugin.config.setQueryData.enabled) createSetQueryData({
8723
+ operation,
8724
+ plugin
8725
+ });
8615
8726
  if ("useQuery" in plugin.config && plugin.config.useQuery.enabled) createUseQuery({
8616
8727
  operation,
8617
8728
  plugin
8618
8729
  });
8730
+ if ("useSetQueryData" in plugin.config && plugin.config.useSetQueryData.enabled) createUseSetQueryData({
8731
+ operation,
8732
+ plugin
8733
+ });
8619
8734
  }
8620
8735
  if (plugin.hooks.operation.isMutation(operation)) {
8621
8736
  if (plugin.config.mutationOptions.enabled) createMutationOptions({
@@ -8693,6 +8808,29 @@ const defaultConfig$12 = {
8693
8808
  mappers,
8694
8809
  value: plugin.config.queryOptions
8695
8810
  });
8811
+ plugin.config.setQueryData = context.valueToObject({
8812
+ defaultValue: {
8813
+ case: plugin.config.case ?? "camelCase",
8814
+ enabled: false,
8815
+ name: "{{name}}SetQueryData"
8816
+ },
8817
+ mappers: {
8818
+ boolean: (enabled) => ({ enabled }),
8819
+ function: (name) => ({
8820
+ enabled: true,
8821
+ name
8822
+ }),
8823
+ object: (fields) => ({
8824
+ enabled: true,
8825
+ ...fields
8826
+ }),
8827
+ string: (name) => ({
8828
+ enabled: true,
8829
+ name
8830
+ })
8831
+ },
8832
+ value: plugin.config.setQueryData
8833
+ });
8696
8834
  }
8697
8835
  };
8698
8836
  definePluginConfig(defaultConfig$12);
@@ -8757,6 +8895,29 @@ const defaultConfig$11 = {
8757
8895
  mappers,
8758
8896
  value: plugin.config.queryOptions
8759
8897
  });
8898
+ plugin.config.setQueryData = context.valueToObject({
8899
+ defaultValue: {
8900
+ case: plugin.config.case ?? "camelCase",
8901
+ enabled: false,
8902
+ name: "{{name}}SetQueryData"
8903
+ },
8904
+ mappers: {
8905
+ boolean: (enabled) => ({ enabled }),
8906
+ function: (name) => ({
8907
+ enabled: true,
8908
+ name
8909
+ }),
8910
+ object: (fields) => ({
8911
+ enabled: true,
8912
+ ...fields
8913
+ }),
8914
+ string: (name) => ({
8915
+ enabled: true,
8916
+ name
8917
+ })
8918
+ },
8919
+ value: plugin.config.setQueryData
8920
+ });
8760
8921
  plugin.config.useMutation = context.valueToObject({
8761
8922
  defaultValue: {
8762
8923
  case: plugin.config.case ?? "camelCase",
@@ -8803,6 +8964,29 @@ const defaultConfig$11 = {
8803
8964
  },
8804
8965
  value: plugin.config.useQuery
8805
8966
  });
8967
+ plugin.config.useSetQueryData = context.valueToObject({
8968
+ defaultValue: {
8969
+ case: plugin.config.case ?? "camelCase",
8970
+ enabled: false,
8971
+ name: "use{{name}}SetQueryData"
8972
+ },
8973
+ mappers: {
8974
+ boolean: (enabled) => ({ enabled }),
8975
+ function: (name) => ({
8976
+ enabled: true,
8977
+ name
8978
+ }),
8979
+ object: (fields) => ({
8980
+ enabled: true,
8981
+ ...fields
8982
+ }),
8983
+ string: (name) => ({
8984
+ enabled: true,
8985
+ name
8986
+ })
8987
+ },
8988
+ value: plugin.config.useSetQueryData
8989
+ });
8806
8990
  if (plugin.config.useMutation.enabled) {
8807
8991
  if (!plugin.config.mutationOptions.enabled) {
8808
8992
  plugin.config.mutationOptions.enabled = true;
@@ -8879,6 +9063,29 @@ const defaultConfig$10 = {
8879
9063
  mappers,
8880
9064
  value: plugin.config.queryOptions
8881
9065
  });
9066
+ plugin.config.setQueryData = context.valueToObject({
9067
+ defaultValue: {
9068
+ case: plugin.config.case ?? "camelCase",
9069
+ enabled: false,
9070
+ name: "{{name}}SetQueryData"
9071
+ },
9072
+ mappers: {
9073
+ boolean: (enabled) => ({ enabled }),
9074
+ function: (name) => ({
9075
+ enabled: true,
9076
+ name
9077
+ }),
9078
+ object: (fields) => ({
9079
+ enabled: true,
9080
+ ...fields
9081
+ }),
9082
+ string: (name) => ({
9083
+ enabled: true,
9084
+ name
9085
+ })
9086
+ },
9087
+ value: plugin.config.setQueryData
9088
+ });
8882
9089
  plugin.config.useMutation = context.valueToObject({
8883
9090
  defaultValue: {
8884
9091
  case: plugin.config.case ?? "camelCase",
@@ -8925,6 +9132,29 @@ const defaultConfig$10 = {
8925
9132
  },
8926
9133
  value: plugin.config.useQuery
8927
9134
  });
9135
+ plugin.config.useSetQueryData = context.valueToObject({
9136
+ defaultValue: {
9137
+ case: plugin.config.case ?? "camelCase",
9138
+ enabled: false,
9139
+ name: "use{{name}}SetQueryData"
9140
+ },
9141
+ mappers: {
9142
+ boolean: (enabled) => ({ enabled }),
9143
+ function: (name) => ({
9144
+ enabled: true,
9145
+ name
9146
+ }),
9147
+ object: (fields) => ({
9148
+ enabled: true,
9149
+ ...fields
9150
+ }),
9151
+ string: (name) => ({
9152
+ enabled: true,
9153
+ name
9154
+ })
9155
+ },
9156
+ value: plugin.config.useSetQueryData
9157
+ });
8928
9158
  if (plugin.config.useMutation.enabled) {
8929
9159
  if (!plugin.config.mutationOptions.enabled) {
8930
9160
  plugin.config.mutationOptions.enabled = true;
@@ -9001,6 +9231,29 @@ const defaultConfig$9 = {
9001
9231
  mappers,
9002
9232
  value: plugin.config.queryOptions
9003
9233
  });
9234
+ plugin.config.setQueryData = context.valueToObject({
9235
+ defaultValue: {
9236
+ case: plugin.config.case ?? "camelCase",
9237
+ enabled: false,
9238
+ name: "{{name}}SetQueryData"
9239
+ },
9240
+ mappers: {
9241
+ boolean: (enabled) => ({ enabled }),
9242
+ function: (name) => ({
9243
+ enabled: true,
9244
+ name
9245
+ }),
9246
+ object: (fields) => ({
9247
+ enabled: true,
9248
+ ...fields
9249
+ }),
9250
+ string: (name) => ({
9251
+ enabled: true,
9252
+ name
9253
+ })
9254
+ },
9255
+ value: plugin.config.setQueryData
9256
+ });
9004
9257
  }
9005
9258
  };
9006
9259
  definePluginConfig(defaultConfig$9);
@@ -9065,6 +9318,29 @@ const defaultConfig$8 = {
9065
9318
  mappers,
9066
9319
  value: plugin.config.queryOptions
9067
9320
  });
9321
+ plugin.config.setQueryData = context.valueToObject({
9322
+ defaultValue: {
9323
+ case: plugin.config.case ?? "camelCase",
9324
+ enabled: false,
9325
+ name: "{{name}}SetQueryData"
9326
+ },
9327
+ mappers: {
9328
+ boolean: (enabled) => ({ enabled }),
9329
+ function: (name) => ({
9330
+ enabled: true,
9331
+ name
9332
+ }),
9333
+ object: (fields) => ({
9334
+ enabled: true,
9335
+ ...fields
9336
+ }),
9337
+ string: (name) => ({
9338
+ enabled: true,
9339
+ name
9340
+ })
9341
+ },
9342
+ value: plugin.config.setQueryData
9343
+ });
9068
9344
  }
9069
9345
  };
9070
9346
  definePluginConfig(defaultConfig$8);
@@ -9129,6 +9405,29 @@ const defaultConfig$7 = {
9129
9405
  mappers,
9130
9406
  value: plugin.config.queryOptions
9131
9407
  });
9408
+ plugin.config.setQueryData = context.valueToObject({
9409
+ defaultValue: {
9410
+ case: plugin.config.case ?? "camelCase",
9411
+ enabled: false,
9412
+ name: "{{name}}SetQueryData"
9413
+ },
9414
+ mappers: {
9415
+ boolean: (enabled) => ({ enabled }),
9416
+ function: (name) => ({
9417
+ enabled: true,
9418
+ name
9419
+ }),
9420
+ object: (fields) => ({
9421
+ enabled: true,
9422
+ ...fields
9423
+ }),
9424
+ string: (name) => ({
9425
+ enabled: true,
9426
+ name
9427
+ })
9428
+ },
9429
+ value: plugin.config.setQueryData
9430
+ });
9132
9431
  }
9133
9432
  };
9134
9433
  definePluginConfig(defaultConfig$7);
@@ -13055,6 +13354,7 @@ function defaultMeta(schema) {
13055
13354
  default: schema.default,
13056
13355
  format: schema.format,
13057
13356
  hasLazy: false,
13357
+ isIntersection: false,
13058
13358
  isLazy: false,
13059
13359
  isObject: false,
13060
13360
  nullable: false,
@@ -13072,6 +13372,7 @@ function composeMeta(children, overrides) {
13072
13372
  default: overrides?.default,
13073
13373
  format: overrides?.format,
13074
13374
  hasLazy: overrides?.hasLazy ?? children.some((c) => c.meta.hasLazy),
13375
+ isIntersection: overrides?.isIntersection ?? false,
13075
13376
  isLazy: overrides?.isLazy ?? children.some((c) => c.meta.isLazy),
13076
13377
  isObject: overrides?.isObject ?? children.some((c) => c.meta.isObject),
13077
13378
  nullable: overrides?.nullable ?? children.some((c) => c.meta.nullable),
@@ -13721,14 +14022,17 @@ function tryBuildDiscriminatedUnion({ items, parentSchema, plugin, schemas }) {
13721
14022
  const discriminatedValue = schema.items[0].properties?.[discriminatorKey]?.const;
13722
14023
  if (discriminatedValue === void 0 || items[index].meta.hasLazy) return null;
13723
14024
  let refExpression;
13724
- if (refPart.symbolRef) refExpression = $(refPart.symbolRef);
13725
- else if (refPart.$ref) {
14025
+ if (refPart.symbolRef) {
14026
+ if (refPart.symbolRef.meta?.isIntersection) return null;
14027
+ refExpression = $(refPart.symbolRef);
14028
+ } else if (refPart.$ref) {
13726
14029
  const query = {
13727
14030
  category: "schema",
13728
14031
  resource: "definition",
13729
14032
  resourceId: refPart.$ref,
13730
14033
  tool: "zod"
13731
14034
  };
14035
+ if ((plugin.querySymbol(query)?.meta)?.isIntersection) return null;
13732
14036
  refExpression = $(plugin.referenceSymbol(query));
13733
14037
  } else return null;
13734
14038
  members.push({
@@ -13919,6 +14223,7 @@ function createVisitor$2(config = {}) {
13919
14223
  default: parentSchema.default,
13920
14224
  format: parentSchema.format,
13921
14225
  hasLazy: hasAnyLazy,
14226
+ isIntersection: true,
13922
14227
  isLazy: false,
13923
14228
  nullable: items.some((i) => i.meta.nullable),
13924
14229
  readonly: items.some((i) => i.meta.readonly)
@@ -14079,6 +14384,7 @@ function createVisitor$2(config = {}) {
14079
14384
  default: parentSchema.default,
14080
14385
  format: parentSchema.format,
14081
14386
  hasLazy: hasAnyLazy,
14387
+ isIntersection: false,
14082
14388
  isLazy: false,
14083
14389
  nullable: hasNull,
14084
14390
  readonly: items.some((i) => i.meta.readonly)
@@ -14150,6 +14456,10 @@ function createProcessor$2(plugin) {
14150
14456
  exportAst({
14151
14457
  ...ctx,
14152
14458
  final,
14459
+ meta: result.meta.isIntersection ? {
14460
+ ...ctx.meta,
14461
+ isIntersection: true
14462
+ } : ctx.meta,
14153
14463
  plugin
14154
14464
  });
14155
14465
  return;
@@ -15014,6 +15324,7 @@ function createVisitor$1(config = {}) {
15014
15324
  default: parentSchema.default,
15015
15325
  format: parentSchema.format,
15016
15326
  hasLazy: hasAnyLazy,
15327
+ isIntersection: true,
15017
15328
  isLazy: false,
15018
15329
  nullable: items.some((i) => i.meta.nullable),
15019
15330
  readonly: items.some((i) => i.meta.readonly)
@@ -15165,6 +15476,7 @@ function createVisitor$1(config = {}) {
15165
15476
  default: parentSchema.default,
15166
15477
  format: parentSchema.format,
15167
15478
  hasLazy: hasAnyLazy,
15479
+ isIntersection: false,
15168
15480
  isLazy: false,
15169
15481
  nullable: hasNull,
15170
15482
  readonly: items.some((i) => i.meta.readonly)
@@ -15236,6 +15548,10 @@ function createProcessor$1(plugin) {
15236
15548
  exportAst({
15237
15549
  ...ctx,
15238
15550
  final,
15551
+ meta: result.meta.isIntersection ? {
15552
+ ...ctx.meta,
15553
+ isIntersection: true
15554
+ } : ctx.meta,
15239
15555
  plugin
15240
15556
  });
15241
15557
  return;
@@ -16106,6 +16422,7 @@ function createVisitor(config = {}) {
16106
16422
  default: parentSchema.default,
16107
16423
  format: parentSchema.format,
16108
16424
  hasLazy: hasAnyLazy,
16425
+ isIntersection: true,
16109
16426
  isLazy: false,
16110
16427
  nullable: items.some((i) => i.meta.nullable),
16111
16428
  readonly: items.some((i) => i.meta.readonly)
@@ -16266,6 +16583,7 @@ function createVisitor(config = {}) {
16266
16583
  default: parentSchema.default,
16267
16584
  format: parentSchema.format,
16268
16585
  hasLazy: hasAnyLazy,
16586
+ isIntersection: false,
16269
16587
  isLazy: false,
16270
16588
  nullable: hasNull,
16271
16589
  readonly: items.some((i) => i.meta.readonly)
@@ -16337,6 +16655,10 @@ function createProcessor(plugin) {
16337
16655
  exportAst({
16338
16656
  ...ctx,
16339
16657
  final,
16658
+ meta: result.meta.isIntersection ? {
16659
+ ...ctx.meta,
16660
+ isIntersection: true
16661
+ } : ctx.meta,
16340
16662
  plugin
16341
16663
  });
16342
16664
  return;
@@ -17208,4 +17530,4 @@ async function resolveJobs({ logger, userConfigs }) {
17208
17530
  //#endregion
17209
17531
  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
17532
 
17211
- //# sourceMappingURL=init-D4xuNKgu.mjs.map
17533
+ //# sourceMappingURL=init-Bi6_Uyy_.mjs.map