next-openapi-gen 1.3.0 → 1.4.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.js CHANGED
@@ -132,122 +132,6 @@ var FrameworkKind;
132
132
  FrameworkKind2["ReactRouter"] = "reactrouter";
133
133
  })(FrameworkKind || (FrameworkKind = {}));
134
134
 
135
- // ../openapi-core/dist/config/normalize.js
136
- function normalizeRouterType(routerType) {
137
- return routerType ?? DEFAULT_ROUTER_TYPE;
138
- }
139
- function normalizeSchemaTypes(schemaType) {
140
- const schemaBackends = Array.isArray(schemaType) ? schemaType : [schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE];
141
- return [...new Set(schemaBackends)];
142
- }
143
- function normalizeOpenApiVersion(template) {
144
- if (template.openapi.startsWith("3.2")) {
145
- return "3.2";
146
- }
147
- if (template.openapi.startsWith("3.1")) {
148
- return "3.1";
149
- }
150
- if (template.openapi.startsWith("4.")) {
151
- return "4.0";
152
- }
153
- return DEFAULT_OPENAPI_VERSION;
154
- }
155
- function normalizeFrameworkKind(kind) {
156
- switch (kind) {
157
- case FrameworkKind.Nextjs:
158
- case "next":
159
- return FrameworkKind.Nextjs;
160
- case FrameworkKind.Tanstack:
161
- case "tanstack":
162
- return FrameworkKind.Tanstack;
163
- case FrameworkKind.ReactRouter:
164
- case "react-router":
165
- return FrameworkKind.ReactRouter;
166
- default:
167
- return FrameworkKind.Nextjs;
168
- }
169
- }
170
- function normalizeFramework(config2, routerType) {
171
- if (config2.framework) {
172
- const frameworkKind = normalizeFrameworkKind(config2.framework.kind);
173
- switch (frameworkKind) {
174
- case FrameworkKind.Nextjs:
175
- return {
176
- ...config2.framework,
177
- kind: frameworkKind,
178
- router: config2.framework.router || routerType,
179
- modulePath: config2.framework.modulePath || config2.framework.adapterPath || config2.next?.adapterPath,
180
- adapterPath: config2.framework.adapterPath || config2.next?.adapterPath
181
- };
182
- case FrameworkKind.Tanstack:
183
- case FrameworkKind.ReactRouter:
184
- return {
185
- ...config2.framework,
186
- kind: frameworkKind,
187
- modulePath: config2.framework.modulePath || config2.framework.adapterPath
188
- };
189
- }
190
- }
191
- return {
192
- kind: FrameworkKind.Nextjs,
193
- router: routerType,
194
- modulePath: config2.next?.adapterPath,
195
- adapterPath: config2.next?.adapterPath
196
- };
197
- }
198
- function normalizeOpenApiConfig(template) {
199
- const routerType = normalizeRouterType(template.routerType);
200
- const schemaBackends = normalizeSchemaTypes(template.schemaType);
201
- const openapiVersion = normalizeOpenApiVersion({
202
- openapi: "openapi" in template ? template.openapi || "3.0.0" : "3.0.0"
203
- });
204
- return {
205
- apiDir: template.apiDir ?? DEFAULT_API_DIR,
206
- routerType,
207
- schemaDir: template.schemaDir ?? DEFAULT_SCHEMA_DIR,
208
- docsUrl: template.docsUrl ?? DEFAULT_DOCS_URL,
209
- ui: template.ui ?? DEFAULT_UI,
210
- outputFile: template.outputFile ?? DEFAULT_GENERATED_OPENAPI_FILENAME,
211
- outputDir: template.outputDir ?? DEFAULT_OUTPUT_DIR,
212
- includeOpenApiRoutes: template.includeOpenApiRoutes ?? DEFAULT_INCLUDE_OPENAPI_ROUTES,
213
- ignoreRoutes: template.ignoreRoutes ?? [],
214
- excludeSchemas: template.excludeSchemas ?? [],
215
- schemaType: template.schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE,
216
- schemaBackends,
217
- schemaFiles: template.schemaFiles ?? [],
218
- defaultResponseSet: template.defaultResponseSet,
219
- responseSets: template.responseSets,
220
- errorConfig: template.errorConfig,
221
- errorDefinitions: template.errorDefinitions,
222
- openapiVersion,
223
- framework: normalizeFramework(template, routerType),
224
- next: {
225
- adapterPath: template.next?.adapterPath
226
- },
227
- diagnostics: template.diagnostics ?? { enabled: DEFAULT_DIAGNOSTICS_ENABLED },
228
- debug: template.debug ?? DEFAULT_DEBUG
229
- };
230
- }
231
-
232
- // ../openapi-core/dist/diagnostics/collector.js
233
- var DiagnosticsCollector = class {
234
- diagnostics = [];
235
- add(diagnostic) {
236
- this.diagnostics.push(diagnostic);
237
- }
238
- getAll() {
239
- return [...this.diagnostics];
240
- }
241
- hasAny() {
242
- return this.diagnostics.length > 0;
243
- }
244
- };
245
-
246
- // ../openapi-core/dist/openapi/document.js
247
- function createDocumentFromTemplate(template) {
248
- return structuredClone(template);
249
- }
250
-
251
135
  // ../openapi-core/dist/shared/utils.js
252
136
  import { parse } from "@babel/parser";
253
137
  import * as t from "@babel/types";
@@ -583,7 +467,7 @@ function parseJSDocBlock(commentValue, filePath) {
583
467
  result.cookieType = extractTypeFromComment(normalizedComment, "@cookie");
584
468
  const authValue = extractLineValue(normalizedComment, "@auth");
585
469
  if (authValue) {
586
- result.auth = performAuthPresetReplacements(authValue);
470
+ result.auth = authValue;
587
471
  }
588
472
  const querystring = parseQuerystringTag(normalizedComment);
589
473
  if (querystring) {
@@ -1259,16 +1143,17 @@ var INTERNAL_OPENAPI_CONFIG_KEYS = [
1259
1143
  "next",
1260
1144
  "diagnostics",
1261
1145
  "debug",
1146
+ "authPresets",
1262
1147
  "excludeSchemas"
1263
1148
  ];
1264
- var AUTH_PRESET_REPLACEMENTS = {
1149
+ var DEFAULT_AUTH_PRESET_REPLACEMENTS = {
1265
1150
  bearer: "BearerAuth",
1266
1151
  basic: "BasicAuth",
1267
1152
  apikey: "ApiKeyAuth"
1268
1153
  };
1269
- function performAuthPresetReplacements(authValue) {
1154
+ function performAuthPresetReplacements(authValue, presets = DEFAULT_AUTH_PRESET_REPLACEMENTS) {
1270
1155
  const authParts = authValue.split(",").map((part) => part.trim());
1271
- const mappedParts = authParts.map((part) => AUTH_PRESET_REPLACEMENTS[part.toLowerCase()] || part);
1156
+ const mappedParts = authParts.map((part) => presets[part.toLowerCase()] || part);
1272
1157
  return mappedParts.join(",");
1273
1158
  }
1274
1159
  function getOperationId(routePath, method) {
@@ -1286,6 +1171,123 @@ function parseTypeScriptFile(content, options) {
1286
1171
  });
1287
1172
  }
1288
1173
 
1174
+ // ../openapi-core/dist/config/normalize.js
1175
+ function normalizeRouterType(routerType) {
1176
+ return routerType ?? DEFAULT_ROUTER_TYPE;
1177
+ }
1178
+ function normalizeSchemaTypes(schemaType) {
1179
+ const schemaBackends = Array.isArray(schemaType) ? schemaType : [schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE];
1180
+ return [...new Set(schemaBackends)];
1181
+ }
1182
+ function normalizeOpenApiVersion(template) {
1183
+ if (template.openapi.startsWith("3.2")) {
1184
+ return "3.2";
1185
+ }
1186
+ if (template.openapi.startsWith("3.1")) {
1187
+ return "3.1";
1188
+ }
1189
+ if (template.openapi.startsWith("4.")) {
1190
+ return "4.0";
1191
+ }
1192
+ return DEFAULT_OPENAPI_VERSION;
1193
+ }
1194
+ function normalizeFrameworkKind(kind) {
1195
+ switch (kind) {
1196
+ case FrameworkKind.Nextjs:
1197
+ case "next":
1198
+ return FrameworkKind.Nextjs;
1199
+ case FrameworkKind.Tanstack:
1200
+ case "tanstack":
1201
+ return FrameworkKind.Tanstack;
1202
+ case FrameworkKind.ReactRouter:
1203
+ case "react-router":
1204
+ return FrameworkKind.ReactRouter;
1205
+ default:
1206
+ return FrameworkKind.Nextjs;
1207
+ }
1208
+ }
1209
+ function normalizeFramework(config2, routerType) {
1210
+ if (config2.framework) {
1211
+ const frameworkKind = normalizeFrameworkKind(config2.framework.kind);
1212
+ switch (frameworkKind) {
1213
+ case FrameworkKind.Nextjs:
1214
+ return {
1215
+ ...config2.framework,
1216
+ kind: frameworkKind,
1217
+ router: config2.framework.router || routerType,
1218
+ modulePath: config2.framework.modulePath || config2.framework.adapterPath || config2.next?.adapterPath,
1219
+ adapterPath: config2.framework.adapterPath || config2.next?.adapterPath
1220
+ };
1221
+ case FrameworkKind.Tanstack:
1222
+ case FrameworkKind.ReactRouter:
1223
+ return {
1224
+ ...config2.framework,
1225
+ kind: frameworkKind,
1226
+ modulePath: config2.framework.modulePath || config2.framework.adapterPath
1227
+ };
1228
+ }
1229
+ }
1230
+ return {
1231
+ kind: FrameworkKind.Nextjs,
1232
+ router: routerType,
1233
+ modulePath: config2.next?.adapterPath,
1234
+ adapterPath: config2.next?.adapterPath
1235
+ };
1236
+ }
1237
+ function normalizeOpenApiConfig(template) {
1238
+ const routerType = normalizeRouterType(template.routerType);
1239
+ const schemaBackends = normalizeSchemaTypes(template.schemaType);
1240
+ const openapiVersion = normalizeOpenApiVersion({
1241
+ openapi: "openapi" in template ? template.openapi || "3.0.0" : "3.0.0"
1242
+ });
1243
+ return {
1244
+ apiDir: template.apiDir ?? DEFAULT_API_DIR,
1245
+ routerType,
1246
+ schemaDir: template.schemaDir ?? DEFAULT_SCHEMA_DIR,
1247
+ docsUrl: template.docsUrl ?? DEFAULT_DOCS_URL,
1248
+ ui: template.ui ?? DEFAULT_UI,
1249
+ outputFile: template.outputFile ?? DEFAULT_GENERATED_OPENAPI_FILENAME,
1250
+ outputDir: template.outputDir ?? DEFAULT_OUTPUT_DIR,
1251
+ includeOpenApiRoutes: template.includeOpenApiRoutes ?? DEFAULT_INCLUDE_OPENAPI_ROUTES,
1252
+ ignoreRoutes: template.ignoreRoutes ?? [],
1253
+ excludeSchemas: template.excludeSchemas ?? [],
1254
+ schemaType: template.schemaType ?? DEFAULT_RUNTIME_SCHEMA_TYPE,
1255
+ schemaBackends,
1256
+ schemaFiles: template.schemaFiles ?? [],
1257
+ defaultResponseSet: template.defaultResponseSet,
1258
+ responseSets: template.responseSets,
1259
+ errorConfig: template.errorConfig,
1260
+ errorDefinitions: template.errorDefinitions,
1261
+ openapiVersion,
1262
+ framework: normalizeFramework(template, routerType),
1263
+ next: {
1264
+ adapterPath: template.next?.adapterPath
1265
+ },
1266
+ diagnostics: template.diagnostics ?? { enabled: DEFAULT_DIAGNOSTICS_ENABLED },
1267
+ authPresets: { ...DEFAULT_AUTH_PRESET_REPLACEMENTS, ...template.authPresets },
1268
+ debug: template.debug ?? DEFAULT_DEBUG
1269
+ };
1270
+ }
1271
+
1272
+ // ../openapi-core/dist/diagnostics/collector.js
1273
+ var DiagnosticsCollector = class {
1274
+ diagnostics = [];
1275
+ add(diagnostic) {
1276
+ this.diagnostics.push(diagnostic);
1277
+ }
1278
+ getAll() {
1279
+ return [...this.diagnostics];
1280
+ }
1281
+ hasAny() {
1282
+ return this.diagnostics.length > 0;
1283
+ }
1284
+ };
1285
+
1286
+ // ../openapi-core/dist/openapi/document.js
1287
+ function createDocumentFromTemplate(template) {
1288
+ return structuredClone(template);
1289
+ }
1290
+
1289
1291
  // ../openapi-core/dist/openapi/version-processor.js
1290
1292
  var DefaultOpenApiVersionProcessor = class {
1291
1293
  id;
@@ -1744,8 +1746,10 @@ function downgradeSchemaForOpenApi30(schema, mediaTypeName) {
1744
1746
  const nullableBranch = nextSchema.anyOf.find((item) => item.type === "null");
1745
1747
  const baseBranch = nextSchema.anyOf.find((item) => item.type !== "null");
1746
1748
  if (nullableBranch && baseBranch) {
1749
+ const { anyOf: _anyOf, ...outerMeta } = nextSchema;
1747
1750
  nextSchema = {
1748
1751
  ...structuredClone(baseBranch),
1752
+ ...outerMeta,
1749
1753
  nullable: true
1750
1754
  };
1751
1755
  }
@@ -3665,7 +3669,7 @@ function processZodLiteral(node, context) {
3665
3669
  return { type: "string", enum: [arg.value] };
3666
3670
  }
3667
3671
  if (t8.isNumericLiteral(arg)) {
3668
- return { type: "number", enum: [arg.value] };
3672
+ return { type: Number.isInteger(arg.value) ? "integer" : "number", enum: [arg.value] };
3669
3673
  }
3670
3674
  if (t8.isBooleanLiteral(arg)) {
3671
3675
  return { type: "boolean", enum: [arg.value] };
@@ -3681,7 +3685,7 @@ function processZodLiteral(node, context) {
3681
3685
  if (typeof value === "string")
3682
3686
  return { type: "string", enum: [value] };
3683
3687
  if (typeof value === "number")
3684
- return { type: "number", enum: [value] };
3688
+ return { type: Number.isInteger(value) ? "integer" : "number", enum: [value] };
3685
3689
  if (typeof value === "boolean")
3686
3690
  return { type: "boolean", enum: [value] };
3687
3691
  if (value === null)
@@ -3776,7 +3780,7 @@ function processZodTuple(node, processNode, context) {
3776
3780
  if (t8.isIdentifier(node.arguments[0]) && context?.resolveConstArrayValues) {
3777
3781
  const values = context.resolveConstArrayValues(node.arguments[0].name);
3778
3782
  if (values && values.length > 0) {
3779
- const prefixItems = values.map((value) => typeof value === "number" ? { type: "number", enum: [value] } : { type: "string", enum: [value] });
3783
+ const prefixItems = values.map((value) => typeof value === "number" ? { type: Number.isInteger(value) ? "integer" : "number", enum: [value] } : { type: "string", enum: [value] });
3780
3784
  return {
3781
3785
  type: "array",
3782
3786
  prefixItems,
@@ -3820,7 +3824,7 @@ function processZodUnion(node, processNode, context) {
3820
3824
  if (t8.isIdentifier(node.arguments[0]) && context?.resolveConstArrayValues) {
3821
3825
  const values = context.resolveConstArrayValues(node.arguments[0].name);
3822
3826
  if (values && values.length > 0) {
3823
- const type = typeof values[0] === "number" ? "number" : "string";
3827
+ const type = typeof values[0] === "number" ? Number.isInteger(values[0]) ? "integer" : "number" : "string";
3824
3828
  return { type, enum: values };
3825
3829
  }
3826
3830
  }
@@ -11267,8 +11271,17 @@ var ZodRuntimeExporter = class {
11267
11271
  return node.arguments[0] ? literal(this.buildLiteralValue(node.arguments[0])) : null;
11268
11272
  case "enum":
11269
11273
  return this.buildEnum(node);
11270
- case "array":
11271
- return node.arguments[0] && isProcessableNode(node.arguments[0]) ? array(this.buildSchema(node.arguments[0]) ?? unknown()) : array(unknown());
11274
+ case "array": {
11275
+ const arg = node.arguments[0];
11276
+ if (!arg || !isProcessableNode(arg)) {
11277
+ return array(unknown());
11278
+ }
11279
+ const itemSchema = this.buildSchema(arg);
11280
+ if (!itemSchema) {
11281
+ return null;
11282
+ }
11283
+ return array(itemSchema);
11284
+ }
11272
11285
  case "strictObject": {
11273
11286
  const base = this.buildObject(node);
11274
11287
  return base && typeof base.strict === "function" ? base.strict() : base;
@@ -11400,13 +11413,17 @@ var ZodRuntimeExporter = class {
11400
11413
  if (node.arguments.length === 0 || !t9.isArrayExpression(node.arguments[0])) {
11401
11414
  return tuple([]);
11402
11415
  }
11403
- const items = node.arguments[0].elements.flatMap((element) => {
11416
+ const items = [];
11417
+ for (const element of node.arguments[0].elements) {
11404
11418
  if (!isProcessableNode(element)) {
11405
- return [];
11419
+ return null;
11406
11420
  }
11407
11421
  const schema = this.buildSchema(element);
11408
- return schema ? [schema] : [];
11409
- });
11422
+ if (!schema) {
11423
+ return null;
11424
+ }
11425
+ items.push(schema);
11426
+ }
11410
11427
  return tuple(items);
11411
11428
  }
11412
11429
  buildTemplateLiteral(node) {
@@ -12018,7 +12035,12 @@ var ZodSchemaConverter = class {
12018
12035
  if (this.isZodSchema(path25.node.init)) {
12019
12036
  const schema = this.processZodNode(path25.node.init);
12020
12037
  if (schema) {
12021
- this.storeResolvedSchema(schemaName, schema);
12038
+ const overrideId = this.extractMetaIdFromNode(path25.node.init);
12039
+ if (overrideId) {
12040
+ this.applyMetaIdOverride(schemaName, schema, overrideId, filePath);
12041
+ } else {
12042
+ this.storeResolvedSchema(schemaName, schema);
12043
+ }
12022
12044
  }
12023
12045
  return;
12024
12046
  }
@@ -12361,8 +12383,15 @@ var ZodSchemaConverter = class {
12361
12383
  };
12362
12384
  switch (methodName) {
12363
12385
  case "optional":
12386
+ break;
12364
12387
  case "nullable":
12365
12388
  case "nullish":
12389
+ schema = {
12390
+ anyOf: [
12391
+ { $ref: `#/components/schemas/${this.getSchemaReferenceName(schemaName)}` },
12392
+ { type: "null" }
12393
+ ]
12394
+ };
12366
12395
  break;
12367
12396
  case "describe":
12368
12397
  if (node.arguments.length > 0 && t10.isStringLiteral(node.arguments[0])) {
@@ -12857,7 +12886,7 @@ var ZodSchemaConverter = class {
12857
12886
  return helperName.startsWith("coerce.") || helperName === "templateLiteral" || helperName === "stringbool";
12858
12887
  }
12859
12888
  if (t10.isMemberExpression(node.callee) && t10.isIdentifier(node.callee.property)) {
12860
- const runtimeMethods = /* @__PURE__ */ new Set(["pipe", "meta"]);
12889
+ const runtimeMethods = /* @__PURE__ */ new Set(["pipe"]);
12861
12890
  if (runtimeMethods.has(node.callee.property.name)) {
12862
12891
  return true;
12863
12892
  }
@@ -12880,12 +12909,16 @@ var ZodSchemaConverter = class {
12880
12909
  case "optional":
12881
12910
  break;
12882
12911
  case "nullable":
12883
- if (!schema.allOf) {
12912
+ if (schema.allOf) {
12913
+ schema = { anyOf: [...schema.allOf, { type: "null" }] };
12914
+ } else {
12884
12915
  schema.nullable = true;
12885
12916
  }
12886
12917
  break;
12887
12918
  case "nullish":
12888
- if (!schema.allOf) {
12919
+ if (schema.allOf) {
12920
+ schema = { anyOf: [...schema.allOf, { type: "null" }] };
12921
+ } else {
12889
12922
  schema.nullable = true;
12890
12923
  }
12891
12924
  break;
@@ -13030,15 +13063,13 @@ var ZodSchemaConverter = class {
13030
13063
  schema.type = "integer";
13031
13064
  break;
13032
13065
  case "positive":
13033
- schema.minimum = 0;
13034
- schema.exclusiveMinimum = true;
13066
+ schema.exclusiveMinimum = 0;
13035
13067
  break;
13036
13068
  case "nonnegative":
13037
13069
  schema.minimum = 0;
13038
13070
  break;
13039
13071
  case "negative":
13040
- schema.maximum = 0;
13041
- schema.exclusiveMaximum = true;
13072
+ schema.exclusiveMaximum = 0;
13042
13073
  break;
13043
13074
  case "nonpositive":
13044
13075
  schema.maximum = 0;
@@ -13400,6 +13431,9 @@ var ZodSchemaConverter = class {
13400
13431
  if (!this.getStoredSchema(schemaName)) {
13401
13432
  logger.debug(`Pre-processing Zod schema: ${schemaName}`);
13402
13433
  this.processingSchemas.add(schemaName);
13434
+ this.currentFilePath = filePath;
13435
+ this.currentAST = ast;
13436
+ this.currentImports = importedModules;
13403
13437
  const schema = this.processZodNode(declaration.init);
13404
13438
  this.processingSchemas.delete(schemaName);
13405
13439
  if (schema) {
@@ -13432,6 +13466,9 @@ var ZodSchemaConverter = class {
13432
13466
  if (!this.getStoredSchema(schemaName) && !this.processingSchemas.has(schemaName)) {
13433
13467
  logger.debug(`Pre-processing Zod schema: ${schemaName}`);
13434
13468
  this.processingSchemas.add(schemaName);
13469
+ this.currentFilePath = filePath;
13470
+ this.currentAST = ast;
13471
+ this.currentImports = importedModules;
13435
13472
  const schema = this.processZodNode(declaration.init);
13436
13473
  this.processingSchemas.delete(schemaName);
13437
13474
  if (schema) {
@@ -16302,11 +16339,16 @@ var ResponseProcessor = class {
16302
16339
  var OperationProcessor = class {
16303
16340
  schemaProcessor;
16304
16341
  responseProcessor;
16342
+ authPresets;
16305
16343
  performanceProfile;
16306
- constructor(schemaProcessor, responseProcessor, performanceProfile) {
16344
+ constructor(schemaProcessor, responseProcessor, options = {}) {
16307
16345
  this.schemaProcessor = schemaProcessor;
16308
16346
  this.responseProcessor = responseProcessor;
16309
- this.performanceProfile = performanceProfile;
16347
+ this.authPresets = {
16348
+ ...DEFAULT_AUTH_PRESET_REPLACEMENTS,
16349
+ ...options.authPresets
16350
+ };
16351
+ this.performanceProfile = options.performanceProfile;
16310
16352
  }
16311
16353
  processOperation(varName, routePath, dataTypes, pathParamNames = []) {
16312
16354
  const method = varName.toLowerCase();
@@ -16331,9 +16373,10 @@ var OperationProcessor = class {
16331
16373
  definition.deprecated = true;
16332
16374
  }
16333
16375
  if (explicitSecurity && explicitSecurity.length > 0) {
16334
- definition.security = explicitSecurity;
16376
+ definition.security = explicitSecurity.map((req) => Object.fromEntries(Object.entries(req).map(([scheme, scopes]) => [this.applyPreset(scheme), scopes])));
16335
16377
  } else if (auth) {
16336
- const authItems = auth.split(",").map((item) => item.trim());
16378
+ const mapped = performAuthPresetReplacements(auth, this.authPresets);
16379
+ const authItems = mapped.split(",").map((item) => item.trim());
16337
16380
  definition.security = authItems.map((authItem) => ({
16338
16381
  [authItem]: []
16339
16382
  }));
@@ -16546,6 +16589,9 @@ ${suffix}`;
16546
16589
  response.links[link.name] = linkObject;
16547
16590
  }
16548
16591
  }
16592
+ applyPreset(scheme) {
16593
+ return this.authPresets[scheme.toLowerCase()] ?? scheme;
16594
+ }
16549
16595
  createQuerystringParameter(dataTypes) {
16550
16596
  if (!dataTypes.querystringType) {
16551
16597
  return void 0;
@@ -16634,7 +16680,10 @@ var RouteProcessor = class {
16634
16680
  return new RegExp(`^${regexPattern}$`);
16635
16681
  });
16636
16682
  this.responseProcessor = new ResponseProcessor(this.config, this.schemaProcessor);
16637
- this.operationProcessor = new OperationProcessor(this.schemaProcessor, this.responseProcessor, this.performanceProfile);
16683
+ this.operationProcessor = new OperationProcessor(this.schemaProcessor, this.responseProcessor, {
16684
+ authPresets: this.config.authPresets,
16685
+ performanceProfile: this.performanceProfile
16686
+ });
16638
16687
  }
16639
16688
  processResponsesFromConfig(dataTypes, method) {
16640
16689
  return this.responseProcessor.processResponses(dataTypes, method);
@@ -16876,6 +16925,7 @@ function applyExcludeSchemas(document, mergedSchemas, excludedSchemas) {
16876
16925
  if (excludedNames.size === 0)
16877
16926
  return;
16878
16927
  walkAndInline(document, excludedSchemas, excludedNames, /* @__PURE__ */ new Set());
16928
+ walkAndInline(mergedSchemas, excludedSchemas, excludedNames, /* @__PURE__ */ new Set());
16879
16929
  for (const name of excludedNames) {
16880
16930
  delete mergedSchemas[name];
16881
16931
  }
@@ -17808,96 +17858,100 @@ function typeToOpenApiSchema(type, checker, seen) {
17808
17858
  return { type: "object" };
17809
17859
  }
17810
17860
  seen.add(seenKey);
17811
- if (type.isStringLiteral()) {
17812
- return { type: "string", enum: [type.value] };
17813
- }
17814
- if (type.isNumberLiteral()) {
17815
- return { type: "number", enum: [type.value] };
17816
- }
17817
- if (type.flags & ts3.TypeFlags.BooleanLiteral) {
17818
- return {
17819
- type: "boolean",
17820
- enum: [checker.typeToString(type) === "true"]
17821
- };
17822
- }
17823
- if (type.flags & ts3.TypeFlags.TemplateLiteral) {
17824
- return { type: "string" };
17825
- }
17826
- if (type.flags & ts3.TypeFlags.StringLike) {
17827
- return { type: "string" };
17828
- }
17829
- if (type.flags & ts3.TypeFlags.NumberLike) {
17830
- return { type: "number" };
17831
- }
17832
- if (type.flags & ts3.TypeFlags.BooleanLike) {
17833
- return { type: "boolean" };
17834
- }
17835
- if (type.flags & ts3.TypeFlags.Null) {
17836
- return { type: "null" };
17837
- }
17838
- if (type.isUnion()) {
17839
- const nullable2 = type.types.some((member) => member.flags & ts3.TypeFlags.Null);
17840
- const nonNullTypes = type.types.filter((member) => !(member.flags & ts3.TypeFlags.Null));
17841
- const soleNonNullType = nonNullTypes[0];
17842
- if (nullable2 && soleNonNullType && nonNullTypes.length === 1) {
17861
+ try {
17862
+ if (type.isStringLiteral()) {
17863
+ return { type: "string", enum: [type.value] };
17864
+ }
17865
+ if (type.isNumberLiteral()) {
17866
+ return { type: "number", enum: [type.value] };
17867
+ }
17868
+ if (type.flags & ts3.TypeFlags.BooleanLiteral) {
17843
17869
  return {
17844
- ...typeToOpenApiSchema(soleNonNullType, checker, seen),
17845
- nullable: true
17870
+ type: "boolean",
17871
+ enum: [checker.typeToString(type) === "true"]
17846
17872
  };
17847
17873
  }
17848
- return {
17849
- oneOf: nonNullTypes.map((member) => typeToOpenApiSchema(member, checker, seen))
17850
- };
17851
- }
17852
- if (checker.isTupleType(type)) {
17853
- const itemTypes = checker.getTypeArguments(type);
17854
- return {
17855
- type: "array",
17856
- prefixItems: itemTypes.map((itemType) => typeToOpenApiSchema(itemType, checker, seen)),
17857
- items: false,
17858
- minItems: itemTypes.length,
17859
- maxItems: itemTypes.length
17860
- };
17861
- }
17862
- if (checker.isArrayType(type)) {
17863
- const elementType = checker.getTypeArguments(type)[0];
17864
- return {
17865
- type: "array",
17866
- items: elementType ? typeToOpenApiSchema(elementType, checker, seen) : { type: "object" }
17867
- };
17868
- }
17869
- const properties = checker.getPropertiesOfType(type);
17870
- if (properties.length > 0) {
17871
- const schemaProperties = {};
17872
- const required2 = [];
17873
- properties.forEach((property) => {
17874
- const propertyDeclaration = property.valueDeclaration || property.declarations?.[0];
17875
- if (!propertyDeclaration) {
17876
- return;
17877
- }
17878
- const propertyType = checker.getTypeOfSymbolAtLocation(property, propertyDeclaration);
17879
- schemaProperties[property.getName()] = typeToOpenApiSchema(propertyType, checker, seen);
17880
- if (!(property.flags & ts3.SymbolFlags.Optional)) {
17881
- required2.push(property.getName());
17874
+ if (type.flags & ts3.TypeFlags.TemplateLiteral) {
17875
+ return { type: "string" };
17876
+ }
17877
+ if (type.flags & ts3.TypeFlags.StringLike) {
17878
+ return { type: "string" };
17879
+ }
17880
+ if (type.flags & ts3.TypeFlags.NumberLike) {
17881
+ return { type: "number" };
17882
+ }
17883
+ if (type.flags & ts3.TypeFlags.BooleanLike) {
17884
+ return { type: "boolean" };
17885
+ }
17886
+ if (type.flags & ts3.TypeFlags.Null) {
17887
+ return { type: "null" };
17888
+ }
17889
+ if (type.isUnion()) {
17890
+ const nullable2 = type.types.some((member) => member.flags & ts3.TypeFlags.Null);
17891
+ const nonNullTypes = type.types.filter((member) => !(member.flags & ts3.TypeFlags.Null));
17892
+ const soleNonNullType = nonNullTypes[0];
17893
+ if (nullable2 && soleNonNullType && nonNullTypes.length === 1) {
17894
+ return {
17895
+ ...typeToOpenApiSchema(soleNonNullType, checker, seen),
17896
+ nullable: true
17897
+ };
17882
17898
  }
17883
- });
17884
- return required2.length > 0 ? {
17885
- type: "object",
17886
- properties: schemaProperties,
17887
- required: required2
17888
- } : {
17889
- type: "object",
17890
- properties: schemaProperties
17891
- };
17892
- }
17893
- const stringIndexType = type.getStringIndexType();
17894
- if (stringIndexType) {
17895
- return {
17896
- type: "object",
17897
- additionalProperties: typeToOpenApiSchema(stringIndexType, checker, seen)
17898
- };
17899
+ return {
17900
+ oneOf: nonNullTypes.map((member) => typeToOpenApiSchema(member, checker, seen))
17901
+ };
17902
+ }
17903
+ if (checker.isTupleType(type)) {
17904
+ const itemTypes = checker.getTypeArguments(type);
17905
+ return {
17906
+ type: "array",
17907
+ prefixItems: itemTypes.map((itemType) => typeToOpenApiSchema(itemType, checker, seen)),
17908
+ items: false,
17909
+ minItems: itemTypes.length,
17910
+ maxItems: itemTypes.length
17911
+ };
17912
+ }
17913
+ if (checker.isArrayType(type)) {
17914
+ const elementType = checker.getTypeArguments(type)[0];
17915
+ return {
17916
+ type: "array",
17917
+ items: elementType ? typeToOpenApiSchema(elementType, checker, seen) : { type: "object" }
17918
+ };
17919
+ }
17920
+ const properties = checker.getPropertiesOfType(type);
17921
+ if (properties.length > 0) {
17922
+ const schemaProperties = {};
17923
+ const required2 = [];
17924
+ properties.forEach((property) => {
17925
+ const propertyDeclaration = property.valueDeclaration || property.declarations?.[0];
17926
+ if (!propertyDeclaration) {
17927
+ return;
17928
+ }
17929
+ const propertyType = checker.getTypeOfSymbolAtLocation(property, propertyDeclaration);
17930
+ schemaProperties[property.getName()] = typeToOpenApiSchema(propertyType, checker, seen);
17931
+ if (!(property.flags & ts3.SymbolFlags.Optional)) {
17932
+ required2.push(property.getName());
17933
+ }
17934
+ });
17935
+ return required2.length > 0 ? {
17936
+ type: "object",
17937
+ properties: schemaProperties,
17938
+ required: required2
17939
+ } : {
17940
+ type: "object",
17941
+ properties: schemaProperties
17942
+ };
17943
+ }
17944
+ const stringIndexType = type.getStringIndexType();
17945
+ if (stringIndexType) {
17946
+ return {
17947
+ type: "object",
17948
+ additionalProperties: typeToOpenApiSchema(stringIndexType, checker, seen)
17949
+ };
17950
+ }
17951
+ return { type: "object" };
17952
+ } finally {
17953
+ seen.delete(seenKey);
17899
17954
  }
17900
- return { type: "object" };
17901
17955
  }
17902
17956
  function unwrapPromiseType(type, checker) {
17903
17957
  const symbolName = type.getSymbol()?.getName();