@hey-api/openapi-ts 0.90.3 → 0.90.5

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.
@@ -5526,7 +5526,7 @@ const operationAuth = ({ operation, plugin }) => {
5526
5526
  for (const securitySchemeObject of operation.security) {
5527
5527
  const authObject = securitySchemeObjectToAuthObject({ securitySchemeObject });
5528
5528
  if (authObject) auth.push(authObject);
5529
- else console.warn(`❗️ SDK warning: unsupported security scheme. Please open an issue if you'd like it added https://github.com/hey-api/openapi-ts/issues\n${JSON.stringify(securitySchemeObject, null, 2)}`);
5529
+ else if (securitySchemeObject.type !== "mutualTLS") console.warn(`❗️ SDK warning: unsupported security scheme. Please open an issue if you'd like it added https://github.com/hey-api/openapi-ts/issues\n${JSON.stringify(securitySchemeObject, null, 2)}`);
5530
5530
  }
5531
5531
  return auth;
5532
5532
  };
@@ -11236,20 +11236,82 @@ const booleanToAst$3 = ({ plugin, schema }) => {
11236
11236
 
11237
11237
  //#endregion
11238
11238
  //#region src/plugins/valibot/v1/toAst/enum.ts
11239
- const enumToAst$3 = ({ plugin, schema, state }) => {
11239
+ function itemsNode$3(ctx$1) {
11240
+ const { schema } = ctx$1;
11240
11241
  const enumMembers = [];
11241
11242
  let isNullable = false;
11242
11243
  for (const item of schema.items ?? []) if (item.type === "string" && typeof item.const === "string") enumMembers.push($.literal(item.const));
11243
11244
  else if (item.type === "null" || item.const === null) isNullable = true;
11245
+ return {
11246
+ enumMembers,
11247
+ isNullable
11248
+ };
11249
+ }
11250
+ function baseNode$15(ctx$1) {
11251
+ const { symbols } = ctx$1;
11252
+ const { v } = symbols;
11253
+ const { enumMembers } = ctx$1.nodes.items(ctx$1);
11254
+ return $(v).attr(identifiers$1.schemas.picklist).call($.array(...enumMembers));
11255
+ }
11256
+ function nullableNode$3(ctx$1) {
11257
+ const { symbols } = ctx$1;
11258
+ const { v } = symbols;
11259
+ const { isNullable } = ctx$1.nodes.items(ctx$1);
11260
+ if (!isNullable) return;
11261
+ const currentNode = ctx$1.pipes.toNode(ctx$1.pipes.current, ctx$1.plugin);
11262
+ return $(v).attr(identifiers$1.schemas.nullable).call(currentNode);
11263
+ }
11264
+ function enumResolver$3(ctx$1) {
11265
+ const { enumMembers } = ctx$1.nodes.items(ctx$1);
11266
+ if (!enumMembers.length) return ctx$1.pipes.current;
11267
+ const baseExpression = ctx$1.nodes.base(ctx$1);
11268
+ ctx$1.pipes.push(ctx$1.pipes.current, baseExpression);
11269
+ const nullableExpression = ctx$1.nodes.nullable(ctx$1);
11270
+ if (nullableExpression) return nullableExpression;
11271
+ return ctx$1.pipes.current;
11272
+ }
11273
+ const enumToAst$3 = ({ plugin, schema, state }) => {
11274
+ const v = plugin.external("valibot.v");
11275
+ const { enumMembers } = itemsNode$3({
11276
+ $,
11277
+ nodes: {
11278
+ base: baseNode$15,
11279
+ items: itemsNode$3,
11280
+ nullable: nullableNode$3
11281
+ },
11282
+ pipes: {
11283
+ ...pipes,
11284
+ current: []
11285
+ },
11286
+ plugin,
11287
+ schema,
11288
+ symbols: { v },
11289
+ utils: { state }
11290
+ });
11244
11291
  if (!enumMembers.length) return unknownToAst$3({
11245
11292
  plugin,
11246
11293
  schema: { type: "unknown" },
11247
11294
  state
11248
11295
  });
11249
- const v = plugin.external("valibot.v");
11250
- let resultExpression = $(v).attr(identifiers$1.schemas.picklist).call($.array(...enumMembers));
11251
- if (isNullable) resultExpression = $(v).attr(identifiers$1.schemas.nullable).call(resultExpression);
11252
- return resultExpression;
11296
+ const ctx$1 = {
11297
+ $,
11298
+ nodes: {
11299
+ base: baseNode$15,
11300
+ items: itemsNode$3,
11301
+ nullable: nullableNode$3
11302
+ },
11303
+ pipes: {
11304
+ ...pipes,
11305
+ current: []
11306
+ },
11307
+ plugin,
11308
+ schema,
11309
+ symbols: { v },
11310
+ utils: { state }
11311
+ };
11312
+ const resolver = plugin.config["~resolvers"]?.enum;
11313
+ const node = resolver?.(ctx$1) ?? enumResolver$3(ctx$1);
11314
+ return ctx$1.pipes.toNode(node, plugin);
11253
11315
  };
11254
11316
 
11255
11317
  //#endregion
@@ -11294,7 +11356,7 @@ const getIntegerLimit = (format) => {
11294
11356
 
11295
11357
  //#endregion
11296
11358
  //#region src/plugins/valibot/v1/toAst/number.ts
11297
- function baseNode$11(ctx$1) {
11359
+ function baseNode$14(ctx$1) {
11298
11360
  const { schema, symbols } = ctx$1;
11299
11361
  const { v } = symbols;
11300
11362
  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()))];
@@ -11328,8 +11390,8 @@ function minNode$3(ctx$1) {
11328
11390
  function numberResolver$3(ctx$1) {
11329
11391
  const constNode$8 = ctx$1.nodes.const(ctx$1);
11330
11392
  if (constNode$8) return ctx$1.pipes.push(ctx$1.pipes.current, constNode$8);
11331
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
11332
- if (baseNode$12) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$12);
11393
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
11394
+ if (baseNode$16) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$16);
11333
11395
  const minNode$4 = ctx$1.nodes.min(ctx$1);
11334
11396
  if (minNode$4) ctx$1.pipes.push(ctx$1.pipes.current, minNode$4);
11335
11397
  const maxNode$4 = ctx$1.nodes.max(ctx$1);
@@ -11340,7 +11402,7 @@ const numberToNode$3 = ({ plugin, schema }) => {
11340
11402
  const ctx$1 = {
11341
11403
  $,
11342
11404
  nodes: {
11343
- base: baseNode$11,
11405
+ base: baseNode$14,
11344
11406
  const: constNode$7,
11345
11407
  max: maxNode$3,
11346
11408
  min: minNode$3
@@ -11380,7 +11442,7 @@ function additionalPropertiesNode$3(ctx$1) {
11380
11442
  if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
11381
11443
  return pipes.toNode(additionalAst.pipes, plugin);
11382
11444
  }
11383
- function baseNode$10(ctx$1) {
11445
+ function baseNode$13(ctx$1) {
11384
11446
  const { nodes, symbols } = ctx$1;
11385
11447
  const { v } = symbols;
11386
11448
  const additional = nodes.additionalProperties(ctx$1);
@@ -11423,7 +11485,7 @@ const objectToAst$3 = ({ plugin, schema, state }) => {
11423
11485
  $,
11424
11486
  nodes: {
11425
11487
  additionalProperties: additionalPropertiesNode$3,
11426
- base: baseNode$10,
11488
+ base: baseNode$13,
11427
11489
  shape: shapeNode$3
11428
11490
  },
11429
11491
  pipes: {
@@ -11446,7 +11508,7 @@ const objectToAst$3 = ({ plugin, schema, state }) => {
11446
11508
 
11447
11509
  //#endregion
11448
11510
  //#region src/plugins/valibot/v1/toAst/string.ts
11449
- function baseNode$9(ctx$1) {
11511
+ function baseNode$12(ctx$1) {
11450
11512
  const { v } = ctx$1.symbols;
11451
11513
  return $(v).attr(identifiers$1.schemas.string).call();
11452
11514
  }
@@ -11497,8 +11559,8 @@ function patternNode$3(ctx$1) {
11497
11559
  function stringResolver$3(ctx$1) {
11498
11560
  const constNode$8 = ctx$1.nodes.const(ctx$1);
11499
11561
  if (constNode$8) return ctx$1.pipes.push(ctx$1.pipes.current, constNode$8);
11500
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
11501
- if (baseNode$12) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$12);
11562
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
11563
+ if (baseNode$16) ctx$1.pipes.push(ctx$1.pipes.current, baseNode$16);
11502
11564
  const formatNode$4 = ctx$1.nodes.format(ctx$1);
11503
11565
  if (formatNode$4) ctx$1.pipes.push(ctx$1.pipes.current, formatNode$4);
11504
11566
  const lengthNode$4 = ctx$1.nodes.length(ctx$1);
@@ -11517,7 +11579,7 @@ const stringToNode$3 = ({ plugin, schema }) => {
11517
11579
  const ctx$1 = {
11518
11580
  $,
11519
11581
  nodes: {
11520
- base: baseNode$9,
11582
+ base: baseNode$12,
11521
11583
  const: constNode$6,
11522
11584
  format: formatNode$3,
11523
11585
  length: lengthNode$3,
@@ -12521,9 +12583,9 @@ const booleanToAst$2 = ({ plugin, schema }) => {
12521
12583
 
12522
12584
  //#endregion
12523
12585
  //#region src/plugins/zod/mini/toAst/enum.ts
12524
- const enumToAst$2 = ({ plugin, schema, state }) => {
12525
- const z = plugin.external("zod.z");
12526
- const result = {};
12586
+ function itemsNode$2(ctx$1) {
12587
+ const { schema, symbols } = ctx$1;
12588
+ const { z } = symbols;
12527
12589
  const enumMembers = [];
12528
12590
  const literalMembers = [];
12529
12591
  let isNullable = false;
@@ -12541,16 +12603,78 @@ const enumToAst$2 = ({ plugin, schema, state }) => {
12541
12603
  const literal = $.literal(item.const);
12542
12604
  literalMembers.push($(z).attr(identifiers.literal).call(literal));
12543
12605
  } else if (item.type === "null" || item.const === null) isNullable = true;
12606
+ return {
12607
+ allStrings,
12608
+ enumMembers,
12609
+ isNullable,
12610
+ literalMembers
12611
+ };
12612
+ }
12613
+ function baseNode$11(ctx$1) {
12614
+ const { symbols } = ctx$1;
12615
+ const { z } = symbols;
12616
+ const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
12617
+ if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
12618
+ else if (literalMembers.length === 1) return literalMembers[0];
12619
+ else return $(z).attr(identifiers.union).call($.array(...literalMembers));
12620
+ }
12621
+ function nullableNode$2(ctx$1) {
12622
+ const { chain, symbols } = ctx$1;
12623
+ const { z } = symbols;
12624
+ const { isNullable } = ctx$1.nodes.items(ctx$1);
12625
+ if (!isNullable) return;
12626
+ return $(z).attr(identifiers.nullable).call(chain.current);
12627
+ }
12628
+ function enumResolver$2(ctx$1) {
12629
+ const { literalMembers } = ctx$1.nodes.items(ctx$1);
12630
+ if (!literalMembers.length) return ctx$1.chain.current;
12631
+ const baseExpression = ctx$1.nodes.base(ctx$1);
12632
+ ctx$1.chain.current = baseExpression;
12633
+ const nullableExpression = ctx$1.nodes.nullable(ctx$1);
12634
+ if (nullableExpression) ctx$1.chain.current = nullableExpression;
12635
+ return ctx$1.chain.current;
12636
+ }
12637
+ const enumToAst$2 = ({ plugin, schema, state }) => {
12638
+ const z = plugin.external("zod.z");
12639
+ const { literalMembers } = itemsNode$2({
12640
+ $,
12641
+ chain: { current: $(z) },
12642
+ nodes: {
12643
+ base: baseNode$11,
12644
+ items: itemsNode$2,
12645
+ nullable: nullableNode$2
12646
+ },
12647
+ plugin,
12648
+ schema,
12649
+ symbols: { z },
12650
+ utils: {
12651
+ ast: {},
12652
+ state
12653
+ }
12654
+ });
12544
12655
  if (!literalMembers.length) return unknownToAst$2({
12545
12656
  plugin,
12546
12657
  schema: { type: "unknown" },
12547
12658
  state
12548
12659
  });
12549
- if (allStrings && enumMembers.length > 0) result.expression = $(z).attr(identifiers.enum).call($.array(...enumMembers));
12550
- else if (literalMembers.length === 1) result.expression = literalMembers[0];
12551
- else result.expression = $(z).attr(identifiers.union).call($.array(...literalMembers));
12552
- if (isNullable) result.expression = $(z).attr(identifiers.nullable).call(result.expression);
12553
- return result;
12660
+ const ctx$1 = {
12661
+ $,
12662
+ chain: { current: $(z) },
12663
+ nodes: {
12664
+ base: baseNode$11,
12665
+ items: itemsNode$2,
12666
+ nullable: nullableNode$2
12667
+ },
12668
+ plugin,
12669
+ schema,
12670
+ symbols: { z },
12671
+ utils: {
12672
+ ast: {},
12673
+ state
12674
+ }
12675
+ };
12676
+ const resolver = plugin.config["~resolvers"]?.enum;
12677
+ return { expression: resolver?.(ctx$1) ?? enumResolver$2(ctx$1) };
12554
12678
  };
12555
12679
 
12556
12680
  //#endregion
@@ -12573,7 +12697,7 @@ const nullToAst$2 = ({ plugin }) => {
12573
12697
 
12574
12698
  //#endregion
12575
12699
  //#region src/plugins/zod/mini/toAst/number.ts
12576
- function baseNode$8(ctx$1) {
12700
+ function baseNode$10(ctx$1) {
12577
12701
  const { schema, symbols } = ctx$1;
12578
12702
  const { z } = symbols;
12579
12703
  if (ctx$1.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
@@ -12609,8 +12733,8 @@ function numberResolver$2(ctx$1) {
12609
12733
  ctx$1.chain.current = constNode$8;
12610
12734
  return ctx$1.chain.current;
12611
12735
  }
12612
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
12613
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
12736
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
12737
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
12614
12738
  const checks = [];
12615
12739
  const minNode$4 = ctx$1.nodes.min(ctx$1);
12616
12740
  if (minNode$4) checks.push(minNode$4);
@@ -12626,7 +12750,7 @@ const numberToNode$2 = ({ plugin, schema, state }) => {
12626
12750
  $,
12627
12751
  chain: { current: $(z) },
12628
12752
  nodes: {
12629
- base: baseNode$8,
12753
+ base: baseNode$10,
12630
12754
  const: constNode$5,
12631
12755
  max: maxNode$2,
12632
12756
  min: minNode$2
@@ -12663,7 +12787,7 @@ function additionalPropertiesNode$2(ctx$1) {
12663
12787
  if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
12664
12788
  return additionalAst.expression;
12665
12789
  }
12666
- function baseNode$7(ctx$1) {
12790
+ function baseNode$9(ctx$1) {
12667
12791
  const { nodes, symbols } = ctx$1;
12668
12792
  const { z } = symbols;
12669
12793
  const additional = nodes.additionalProperties(ctx$1);
@@ -12707,7 +12831,7 @@ const objectToAst$2 = ({ plugin, schema, state }) => {
12707
12831
  chain: { current: $(z) },
12708
12832
  nodes: {
12709
12833
  additionalProperties: additionalPropertiesNode$2,
12710
- base: baseNode$7,
12834
+ base: baseNode$9,
12711
12835
  shape: shapeNode$2
12712
12836
  },
12713
12837
  plugin,
@@ -12725,7 +12849,7 @@ const objectToAst$2 = ({ plugin, schema, state }) => {
12725
12849
 
12726
12850
  //#endregion
12727
12851
  //#region src/plugins/zod/mini/toAst/string.ts
12728
- function baseNode$6(ctx$1) {
12852
+ function baseNode$8(ctx$1) {
12729
12853
  const { z } = ctx$1.symbols;
12730
12854
  return $(z).attr(identifiers.string).call();
12731
12855
  }
@@ -12782,8 +12906,8 @@ function stringResolver$2(ctx$1) {
12782
12906
  ctx$1.chain.current = constNode$8;
12783
12907
  return ctx$1.chain.current;
12784
12908
  }
12785
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
12786
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
12909
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
12910
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
12787
12911
  const formatNode$4 = ctx$1.nodes.format(ctx$1);
12788
12912
  if (formatNode$4) ctx$1.chain.current = formatNode$4;
12789
12913
  const checks = [];
@@ -12806,7 +12930,7 @@ const stringToNode$2 = ({ plugin, schema }) => {
12806
12930
  $,
12807
12931
  chain: { current: $(z) },
12808
12932
  nodes: {
12809
- base: baseNode$6,
12933
+ base: baseNode$8,
12810
12934
  const: constNode$4,
12811
12935
  format: formatNode$2,
12812
12936
  length: lengthNode$2,
@@ -13191,8 +13315,9 @@ const booleanToAst$1 = ({ plugin, schema }) => {
13191
13315
 
13192
13316
  //#endregion
13193
13317
  //#region src/plugins/zod/v3/toAst/enum.ts
13194
- const enumToAst$1 = ({ plugin, schema, state }) => {
13195
- const z = plugin.external("zod.z");
13318
+ function itemsNode$1(ctx$1) {
13319
+ const { schema, symbols } = ctx$1;
13320
+ const { z } = symbols;
13196
13321
  const enumMembers = [];
13197
13322
  const literalMembers = [];
13198
13323
  let isNullable = false;
@@ -13210,17 +13335,77 @@ const enumToAst$1 = ({ plugin, schema, state }) => {
13210
13335
  const literal = $.literal(item.const);
13211
13336
  literalMembers.push($(z).attr(identifiers.literal).call(literal));
13212
13337
  } else if (item.type === "null" || item.const === null) isNullable = true;
13338
+ return {
13339
+ allStrings,
13340
+ enumMembers,
13341
+ isNullable,
13342
+ literalMembers
13343
+ };
13344
+ }
13345
+ function baseNode$7(ctx$1) {
13346
+ const { symbols } = ctx$1;
13347
+ const { z } = symbols;
13348
+ const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
13349
+ if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
13350
+ else if (literalMembers.length === 1) return literalMembers[0];
13351
+ else return $(z).attr(identifiers.union).call($.array(...literalMembers));
13352
+ }
13353
+ function nullableNode$1(ctx$1) {
13354
+ const { chain } = ctx$1;
13355
+ const { isNullable } = ctx$1.nodes.items(ctx$1);
13356
+ if (!isNullable) return;
13357
+ return chain.current.attr(identifiers.nullable).call();
13358
+ }
13359
+ function enumResolver$1(ctx$1) {
13360
+ const { literalMembers } = ctx$1.nodes.items(ctx$1);
13361
+ if (!literalMembers.length) return ctx$1.chain.current;
13362
+ const baseExpression = ctx$1.nodes.base(ctx$1);
13363
+ ctx$1.chain.current = baseExpression;
13364
+ const nullableExpression = ctx$1.nodes.nullable(ctx$1);
13365
+ if (nullableExpression) ctx$1.chain.current = nullableExpression;
13366
+ return ctx$1.chain.current;
13367
+ }
13368
+ const enumToAst$1 = ({ plugin, schema, state }) => {
13369
+ const z = plugin.external("zod.z");
13370
+ const { literalMembers } = itemsNode$1({
13371
+ $,
13372
+ chain: { current: $(z) },
13373
+ nodes: {
13374
+ base: baseNode$7,
13375
+ items: itemsNode$1,
13376
+ nullable: nullableNode$1
13377
+ },
13378
+ plugin,
13379
+ schema,
13380
+ symbols: { z },
13381
+ utils: {
13382
+ ast: {},
13383
+ state
13384
+ }
13385
+ });
13213
13386
  if (!literalMembers.length) return unknownToAst$1({
13214
13387
  plugin,
13215
13388
  schema: { type: "unknown" },
13216
13389
  state
13217
13390
  });
13218
- let enumExpression;
13219
- if (allStrings && enumMembers.length > 0) enumExpression = $(z).attr(identifiers.enum).call($.array(...enumMembers));
13220
- else if (literalMembers.length === 1) enumExpression = literalMembers[0];
13221
- else enumExpression = $(z).attr(identifiers.union).call($.array(...literalMembers));
13222
- if (isNullable) enumExpression = enumExpression.attr(identifiers.nullable).call();
13223
- return enumExpression;
13391
+ const ctx$1 = {
13392
+ $,
13393
+ chain: { current: $(z) },
13394
+ nodes: {
13395
+ base: baseNode$7,
13396
+ items: itemsNode$1,
13397
+ nullable: nullableNode$1
13398
+ },
13399
+ plugin,
13400
+ schema,
13401
+ symbols: { z },
13402
+ utils: {
13403
+ ast: {},
13404
+ state
13405
+ }
13406
+ };
13407
+ const resolver = plugin.config["~resolvers"]?.enum;
13408
+ return resolver?.(ctx$1) ?? enumResolver$1(ctx$1);
13224
13409
  };
13225
13410
 
13226
13411
  //#endregion
@@ -13237,7 +13422,7 @@ const nullToAst$1 = ({ plugin }) => {
13237
13422
 
13238
13423
  //#endregion
13239
13424
  //#region src/plugins/zod/v3/toAst/number.ts
13240
- function baseNode$5(ctx$1) {
13425
+ function baseNode$6(ctx$1) {
13241
13426
  const { schema, symbols } = ctx$1;
13242
13427
  const { z } = symbols;
13243
13428
  if (ctx$1.utils.shouldCoerceToBigInt(schema.format)) return $(z).attr(identifiers.coerce).attr(identifiers.bigint).call();
@@ -13271,8 +13456,8 @@ function numberResolver$1(ctx$1) {
13271
13456
  ctx$1.chain.current = constNode$8;
13272
13457
  return ctx$1.chain.current;
13273
13458
  }
13274
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
13275
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
13459
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
13460
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
13276
13461
  const minNode$4 = ctx$1.nodes.min(ctx$1);
13277
13462
  if (minNode$4) ctx$1.chain.current = minNode$4;
13278
13463
  const maxNode$4 = ctx$1.nodes.max(ctx$1);
@@ -13286,7 +13471,7 @@ const numberToNode$1 = ({ plugin, schema, state }) => {
13286
13471
  $,
13287
13472
  chain: { current: $(z) },
13288
13473
  nodes: {
13289
- base: baseNode$5,
13474
+ base: baseNode$6,
13290
13475
  const: constNode$3,
13291
13476
  max: maxNode$1,
13292
13477
  min: minNode$1
@@ -13322,7 +13507,7 @@ function additionalPropertiesNode$1(ctx$1) {
13322
13507
  if (additionalAst.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
13323
13508
  return additionalAst.expression;
13324
13509
  }
13325
- function baseNode$4(ctx$1) {
13510
+ function baseNode$5(ctx$1) {
13326
13511
  const { nodes, symbols } = ctx$1;
13327
13512
  const { z } = symbols;
13328
13513
  const additional = nodes.additionalProperties(ctx$1);
@@ -13364,7 +13549,7 @@ const objectToAst$1 = ({ plugin, schema, state }) => {
13364
13549
  chain: { current: $(z) },
13365
13550
  nodes: {
13366
13551
  additionalProperties: additionalPropertiesNode$1,
13367
- base: baseNode$4,
13552
+ base: baseNode$5,
13368
13553
  shape: shapeNode$1
13369
13554
  },
13370
13555
  plugin,
@@ -13385,7 +13570,7 @@ const objectToAst$1 = ({ plugin, schema, state }) => {
13385
13570
 
13386
13571
  //#endregion
13387
13572
  //#region src/plugins/zod/v3/toAst/string.ts
13388
- function baseNode$3(ctx$1) {
13573
+ function baseNode$4(ctx$1) {
13389
13574
  const { z } = ctx$1.symbols;
13390
13575
  return $(z).attr(identifiers.string).call();
13391
13576
  }
@@ -13437,8 +13622,8 @@ function stringResolver$1(ctx$1) {
13437
13622
  ctx$1.chain.current = constNode$8;
13438
13623
  return ctx$1.chain.current;
13439
13624
  }
13440
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
13441
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
13625
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
13626
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
13442
13627
  const formatNode$4 = ctx$1.nodes.format(ctx$1);
13443
13628
  if (formatNode$4) ctx$1.chain.current = formatNode$4;
13444
13629
  const lengthNode$4 = ctx$1.nodes.length(ctx$1);
@@ -13459,7 +13644,7 @@ const stringToNode$1 = ({ plugin, schema }) => {
13459
13644
  $,
13460
13645
  chain: { current: $(z) },
13461
13646
  nodes: {
13462
- base: baseNode$3,
13647
+ base: baseNode$4,
13463
13648
  const: constNode$2,
13464
13649
  format: formatNode$1,
13465
13650
  length: lengthNode$1,
@@ -13845,9 +14030,9 @@ const booleanToAst = ({ plugin, schema }) => {
13845
14030
 
13846
14031
  //#endregion
13847
14032
  //#region src/plugins/zod/v4/toAst/enum.ts
13848
- const enumToAst = ({ plugin, schema, state }) => {
13849
- const result = {};
13850
- const z = plugin.external("zod.z");
14033
+ function itemsNode(ctx$1) {
14034
+ const { schema, symbols } = ctx$1;
14035
+ const { z } = symbols;
13851
14036
  const enumMembers = [];
13852
14037
  const literalMembers = [];
13853
14038
  let isNullable = false;
@@ -13865,16 +14050,78 @@ const enumToAst = ({ plugin, schema, state }) => {
13865
14050
  const literal = $.literal(item.const);
13866
14051
  literalMembers.push($(z).attr(identifiers.literal).call(literal));
13867
14052
  } else if (item.type === "null" || item.const === null) isNullable = true;
14053
+ return {
14054
+ allStrings,
14055
+ enumMembers,
14056
+ isNullable,
14057
+ literalMembers
14058
+ };
14059
+ }
14060
+ function baseNode$3(ctx$1) {
14061
+ const { symbols } = ctx$1;
14062
+ const { z } = symbols;
14063
+ const { allStrings, enumMembers, literalMembers } = ctx$1.nodes.items(ctx$1);
14064
+ if (allStrings && enumMembers.length > 0) return $(z).attr(identifiers.enum).call($.array(...enumMembers));
14065
+ else if (literalMembers.length === 1) return literalMembers[0];
14066
+ else return $(z).attr(identifiers.union).call($.array(...literalMembers));
14067
+ }
14068
+ function nullableNode(ctx$1) {
14069
+ const { chain, symbols } = ctx$1;
14070
+ const { z } = symbols;
14071
+ const { isNullable } = ctx$1.nodes.items(ctx$1);
14072
+ if (!isNullable) return;
14073
+ return $(z).attr(identifiers.nullable).call(chain.current);
14074
+ }
14075
+ function enumResolver(ctx$1) {
14076
+ const { literalMembers } = ctx$1.nodes.items(ctx$1);
14077
+ if (!literalMembers.length) return ctx$1.chain.current;
14078
+ const baseExpression = ctx$1.nodes.base(ctx$1);
14079
+ ctx$1.chain.current = baseExpression;
14080
+ const nullableExpression = ctx$1.nodes.nullable(ctx$1);
14081
+ if (nullableExpression) ctx$1.chain.current = nullableExpression;
14082
+ return ctx$1.chain.current;
14083
+ }
14084
+ const enumToAst = ({ plugin, schema, state }) => {
14085
+ const z = plugin.external("zod.z");
14086
+ const { literalMembers } = itemsNode({
14087
+ $,
14088
+ chain: { current: $(z) },
14089
+ nodes: {
14090
+ base: baseNode$3,
14091
+ items: itemsNode,
14092
+ nullable: nullableNode
14093
+ },
14094
+ plugin,
14095
+ schema,
14096
+ symbols: { z },
14097
+ utils: {
14098
+ ast: {},
14099
+ state
14100
+ }
14101
+ });
13868
14102
  if (!literalMembers.length) return unknownToAst({
13869
14103
  plugin,
13870
14104
  schema: { type: "unknown" },
13871
14105
  state
13872
14106
  });
13873
- if (allStrings && enumMembers.length > 0) result.expression = $(z).attr(identifiers.enum).call($.array(...enumMembers));
13874
- else if (literalMembers.length === 1) result.expression = literalMembers[0];
13875
- else result.expression = $(z).attr(identifiers.union).call($.array(...literalMembers));
13876
- if (isNullable) result.expression = $(z).attr(identifiers.nullable).call(result.expression);
13877
- return result;
14107
+ const ctx$1 = {
14108
+ $,
14109
+ chain: { current: $(z) },
14110
+ nodes: {
14111
+ base: baseNode$3,
14112
+ items: itemsNode,
14113
+ nullable: nullableNode
14114
+ },
14115
+ plugin,
14116
+ schema,
14117
+ symbols: { z },
14118
+ utils: {
14119
+ ast: {},
14120
+ state
14121
+ }
14122
+ };
14123
+ const resolver = plugin.config["~resolvers"]?.enum;
14124
+ return { expression: resolver?.(ctx$1) ?? enumResolver(ctx$1) };
13878
14125
  };
13879
14126
 
13880
14127
  //#endregion
@@ -13929,8 +14176,8 @@ function numberResolver(ctx$1) {
13929
14176
  ctx$1.chain.current = constNode$8;
13930
14177
  return ctx$1.chain.current;
13931
14178
  }
13932
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
13933
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
14179
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
14180
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
13934
14181
  const minNode$4 = ctx$1.nodes.min(ctx$1);
13935
14182
  if (minNode$4) ctx$1.chain.current = minNode$4;
13936
14183
  const maxNode$4 = ctx$1.nodes.max(ctx$1);
@@ -14096,8 +14343,8 @@ function stringResolver(ctx$1) {
14096
14343
  ctx$1.chain.current = constNode$8;
14097
14344
  return ctx$1.chain.current;
14098
14345
  }
14099
- const baseNode$12 = ctx$1.nodes.base(ctx$1);
14100
- if (baseNode$12) ctx$1.chain.current = baseNode$12;
14346
+ const baseNode$16 = ctx$1.nodes.base(ctx$1);
14347
+ if (baseNode$16) ctx$1.chain.current = baseNode$16;
14101
14348
  const formatNode$4 = ctx$1.nodes.format(ctx$1);
14102
14349
  if (formatNode$4) ctx$1.chain.current = formatNode$4;
14103
14350
  const lengthNode$4 = ctx$1.nodes.length(ctx$1);
@@ -21716,4 +21963,4 @@ Object.defineProperty(exports, 'toCase', {
21716
21963
  return toCase;
21717
21964
  }
21718
21965
  });
21719
- //# sourceMappingURL=openApi-BetJIgjU.cjs.map
21966
+ //# sourceMappingURL=openApi-BZ7m5ia5.cjs.map