@orval/core 7.8.0 → 7.9.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/dist/index.d.ts CHANGED
@@ -73,7 +73,7 @@ type NormalizedOverrideOutput = {
73
73
  mock?: OverrideMockOptions;
74
74
  contentType?: OverrideOutputContentType;
75
75
  header: false | ((info: InfoObject) => string[] | string);
76
- formData: boolean | NormalizedMutator;
76
+ formData: NormalizedFormDataType<NormalizedMutator>;
77
77
  formUrlEncoded: boolean | NormalizedMutator;
78
78
  paramsSerializer?: NormalizedMutator;
79
79
  paramsSerializerOptions?: NormalizedParamsSerializerOptions;
@@ -106,7 +106,7 @@ type NormalizedOverrideOutput = {
106
106
  useDeprecatedOperations?: boolean;
107
107
  useBigInt?: boolean;
108
108
  useNamedParameters?: boolean;
109
- useNativeEnums?: boolean;
109
+ enumGenerationType: EnumGeneration;
110
110
  suppressReadonlyModifier?: boolean;
111
111
  };
112
112
  type NormalizedMutator = {
@@ -130,7 +130,7 @@ type NormalizedOperationOptions = {
130
130
  zod?: NormalizedZodOptions;
131
131
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
132
132
  fetch?: FetchOptions;
133
- formData?: boolean | NormalizedMutator;
133
+ formData?: NormalizedFormDataType<NormalizedMutator>;
134
134
  formUrlEncoded?: boolean | NormalizedMutator;
135
135
  paramsSerializer?: NormalizedMutator;
136
136
  requestOptions?: object | boolean;
@@ -170,6 +170,12 @@ declare const NamingConvention: {
170
170
  readonly KEBAB_CASE: "kebab-case";
171
171
  };
172
172
  type NamingConvention = (typeof NamingConvention)[keyof typeof NamingConvention];
173
+ declare const EnumGeneration: {
174
+ readonly CONST: "const";
175
+ readonly ENUM: "enum";
176
+ readonly UNION: "union";
177
+ };
178
+ type EnumGeneration = (typeof EnumGeneration)[keyof typeof EnumGeneration];
173
179
  type OutputOptions = {
174
180
  workspace?: string;
175
181
  target?: string;
@@ -224,6 +230,7 @@ declare const OutputClient: {
224
230
  readonly ZOD: "zod";
225
231
  readonly HONO: "hono";
226
232
  readonly FETCH: "fetch";
233
+ readonly MCP: "mcp";
227
234
  };
228
235
  type OutputClient = (typeof OutputClient)[keyof typeof OutputClient];
229
236
  declare const OutputHttpClient: {
@@ -296,6 +303,28 @@ type Mutator = string | MutatorObject;
296
303
  type ParamsSerializerOptions = {
297
304
  qs?: Record<string, any>;
298
305
  };
306
+ declare const FormDataArrayHandling: {
307
+ readonly SERIALIZE: "serialize";
308
+ readonly EXPLODE: "explode";
309
+ readonly SERIALIZE_WITH_BRACKETS: "serialize-with-brackets";
310
+ };
311
+ type FormDataArrayHandling = (typeof FormDataArrayHandling)[keyof typeof FormDataArrayHandling];
312
+ type NormalizedFormDataType<TMutator> = {
313
+ disabled: true;
314
+ mutator?: never;
315
+ arrayHandling: FormDataArrayHandling;
316
+ } | {
317
+ disabled: false;
318
+ mutator?: TMutator;
319
+ arrayHandling: FormDataArrayHandling;
320
+ };
321
+ type FormDataType<TMutator> = {
322
+ mutator: TMutator;
323
+ arrayHandling?: FormDataArrayHandling;
324
+ } | {
325
+ mutator?: TMutator;
326
+ arrayHandling: FormDataArrayHandling;
327
+ };
299
328
  type OverrideOutput = {
300
329
  title?: (title: string) => string;
301
330
  transformer?: OutputTransformer;
@@ -309,7 +338,7 @@ type OverrideOutput = {
309
338
  mock?: OverrideMockOptions;
310
339
  contentType?: OverrideOutputContentType;
311
340
  header?: boolean | ((info: InfoObject) => string[] | string);
312
- formData?: boolean | Mutator;
341
+ formData?: boolean | Mutator | FormDataType<Mutator>;
313
342
  formUrlEncoded?: boolean | Mutator;
314
343
  paramsSerializer?: Mutator;
315
344
  paramsSerializerOptions?: ParamsSerializerOptions;
@@ -341,7 +370,11 @@ type OverrideOutput = {
341
370
  useDeprecatedOperations?: boolean;
342
371
  useBigInt?: boolean;
343
372
  useNamedParameters?: boolean;
373
+ /**
374
+ * @deprecated use 'enumGenerationType="enum"' instead
375
+ */
344
376
  useNativeEnums?: boolean;
377
+ enumGenerationType?: EnumGeneration;
345
378
  suppressReadonlyModifier?: boolean;
346
379
  };
347
380
  type OverrideOutputContentType = {
@@ -498,7 +531,7 @@ type OperationOptions = {
498
531
  zod?: ZodOptions;
499
532
  operationName?: (operation: OperationObject, route: string, verb: Verbs) => string;
500
533
  fetch?: FetchOptions;
501
- formData?: boolean | Mutator;
534
+ formData?: boolean | Mutator | FormDataType<Mutator>;
502
535
  formUrlEncoded?: boolean | Mutator;
503
536
  paramsSerializer?: Mutator;
504
537
  requestOptions?: object | boolean;
@@ -1098,7 +1131,7 @@ declare const combineSchemas: ({ name, schema, separator, context, nullable, }:
1098
1131
  declare const resolveDiscriminators: (schemas: SchemasObject, context: ContextSpecs) => SchemasObject;
1099
1132
 
1100
1133
  declare const getEnumNames: (schemaObject: SchemaObject$1 | undefined) => any;
1101
- declare const getEnum: (value: string, enumName: string, names?: string[], useNativeEnums?: boolean) => string;
1134
+ declare const getEnum: (value: string, enumName: string, names: string[] | undefined, enumGenerationType: EnumGeneration) => string;
1102
1135
  declare const getEnumImplementation: (value: string, names?: string[]) => string;
1103
1136
 
1104
1137
  declare const getKey: (key: string) => string;
@@ -1482,4 +1515,4 @@ declare const generateTarget: (builder: WriteSpecsBuilder, options: NormalizedOu
1482
1515
 
1483
1516
  declare const generateTargetForTags: (builder: WriteSpecsBuilder, options: NormalizedOutputOptions) => Record<string, GeneratorTarget>;
1484
1517
 
1485
- export { type AngularOptions, BODY_TYPE_NAME, type BaseUrlFromConstant, type BaseUrlFromSpec, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, type FetchOptions, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, NamingConvention, type NormalizedConfig, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, type OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, PropertySortOrder, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SchemaWithConst, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodDateTimeOptions, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getEnumNames, getExtension, getFileInfo, getFullRoute, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
1518
+ export { type AngularOptions, BODY_TYPE_NAME, type BaseUrlFromConstant, type BaseUrlFromSpec, type ClientBuilder, type ClientDependenciesBuilder, type ClientExtraFilesBuilder, type ClientFileBuilder, type ClientFooterBuilder, type ClientGeneratorsBuilder, type ClientHeaderBuilder, type ClientMockBuilder, type ClientMockGeneratorBuilder, type ClientMockGeneratorImplementation, type ClientTitleBuilder, type Config, type ConfigExternal, type ConfigFn, type ContextSpecs, EnumGeneration, type FetchOptions, FormDataArrayHandling, type FormDataType, type GenerateMockImports, type GeneratorApiBuilder, type GeneratorApiOperations, type GeneratorApiResponse, type GeneratorClient, type GeneratorClientExtra, type GeneratorClientFooter, type GeneratorClientHeader, type GeneratorClientImports, type GeneratorClientTitle, type GeneratorClients, type GeneratorDependency, type GeneratorImport, type GeneratorMutator, type GeneratorMutatorParsingInfo, type GeneratorOperation, type GeneratorOperations, type GeneratorOptions, type GeneratorSchema, type GeneratorTarget, type GeneratorTargetFull, type GeneratorVerbOptions, type GeneratorVerbsOptions, type GetterBody, type GetterParam, type GetterParameters, type GetterParams, type GetterProp, GetterPropType, type GetterProps, type GetterQueryParam, type GetterResponse, type GlobalMockOptions, type GlobalOptions, type HonoOptions, type Hook, type HookCommand, type HookFunction, type HookOption, type HooksOptions, type ImportOpenApi, type InputFiltersOption, type InputOptions, type InputTransformerFn, type LogLevel, LogLevels, type LogOptions, type LogType, type Logger, type LoggerOptions, type MockData, type MockDataArray, type MockDataArrayFn, type MockDataObject, type MockDataObjectFn, type MockOptions, type MockProperties, type MockPropertiesObject, type MockPropertiesObjectFn, type Mutator, type MutatorObject, NamingConvention, type NormalizedConfig, type NormalizedFormDataType, type NormalizedHonoOptions, type NormalizedHookCommand, type NormalizedHookOptions, type NormalizedInputOptions, type NormalizedMutator, type NormalizedOperationOptions, type NormalizedOptions, type NormalizedOutputOptions, type NormalizedOverrideOutput, type NormalizedParamsSerializerOptions, type NormalizedQueryOptions, type NormalizedZodOptions, type OperationOptions, type Options, type OptionsExport, type OptionsFn, OutputClient, type OutputClientFunc, type OutputDocsOptions, OutputHttpClient, OutputMockType, OutputMode, type OutputOptions, type OverrideInput, type OverrideMockOptions, type OverrideOutput, type OverrideOutputContentType, type PackageJson, type ParamsSerializerOptions, PropertySortOrder, type QueryOptions, RefComponentSuffix, type RefInfo, type ResReqTypesValue, type ResolverValue, type ScalarValue, SchemaType, type SchemaWithConst, type SwaggerParserOptions, type SwrOptions, TEMPLATE_TAG_REGEX, type TsConfigTarget, type Tsconfig, URL_REGEX, VERBS_WITH_BODY, Verbs, type WriteModeProps, type WriteSpecsBuilder, type ZodCoerceType, type ZodDateTimeOptions, type ZodOptions, _filteredVerbs, addDependency, asyncReduce, camel, combineSchemas, compareVersions, conventionName, count, createDebugger, createLogger, createSuccessMessage, dynamicImport, escape, generalJSTypes, generalJSTypesWithArray, generateAxiosOptions, generateBodyMutatorConfig, generateBodyOptions, generateComponentDefinition, generateDependencyImports, generateFormDataAndUrlEncodedFunction, generateImports, generateModelInline, generateModelsInline, generateMutator, generateMutatorConfig, generateMutatorImports, generateMutatorRequestOptions, generateOptions, generateParameterDefinition, generateQueryParamsAxiosConfig, generateSchemasDefinition, generateTarget, generateTargetForTags, generateVerbImports, generateVerbsOptions, getArray, getBody, getEnum, getEnumImplementation, getEnumNames, getExtension, getFileInfo, getFullRoute, getIsBodyVerb, getKey, getMockFileExtensionByTypeName, getNumberWord, getObject, getOperationId, getOrvalGeneratedTypes, getParameters, getParams, getParamsInPath, getProps, getQueryParams, getRefInfo, getResReqTypes, getResponse, getRoute, getRouteAsArray, getScalar, ibmOpenapiValidator, ibmOpenapiValidatorErrors, ibmOpenapiValidatorWarnings, isBoolean, isDirectory, isFunction, isModule, isNull, isNumber, isNumeric, isObject, isReference, isRootKey, isSchema, isString, isSyntheticDefaultImportsAllow, isUndefined, isUrl, isVerb, jsDoc, jsStringEscape, kebab, loadFile, log, logError, mergeDeep, mismatchArgsMessage, openApiConverter, pascal, removeFiles, resolveDiscriminators, resolveExampleRefs, resolveObject, resolveRef, resolveValue, sanitize, snake, sortByPriority, startMessage, stringify, toObjectString, path as upath, upper, writeModelInline, writeModelsInline, writeSchema, writeSchemas, writeSingleMode, writeSplitMode, writeSplitTagsMode, writeTagsMode };
package/dist/index.js CHANGED
@@ -4682,7 +4682,7 @@ var require_lodash = __commonJS({
4682
4682
  function isArrayLikeObject(value) {
4683
4683
  return isObjectLike(value) && isArrayLike(value);
4684
4684
  }
4685
- function isBoolean2(value) {
4685
+ function isBoolean3(value) {
4686
4686
  return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
4687
4687
  }
4688
4688
  var isBuffer = nativeIsBuffer || stubFalse;
@@ -5819,7 +5819,7 @@ var require_lodash = __commonJS({
5819
5819
  lodash.isArrayBuffer = isArrayBuffer;
5820
5820
  lodash.isArrayLike = isArrayLike;
5821
5821
  lodash.isArrayLikeObject = isArrayLikeObject;
5822
- lodash.isBoolean = isBoolean2;
5822
+ lodash.isBoolean = isBoolean3;
5823
5823
  lodash.isBuffer = isBuffer;
5824
5824
  lodash.isDate = isDate;
5825
5825
  lodash.isElement = isElement;
@@ -9475,14 +9475,14 @@ var require_bool = __commonJS({
9475
9475
  function constructYamlBoolean(data) {
9476
9476
  return data === "true" || data === "True" || data === "TRUE";
9477
9477
  }
9478
- function isBoolean2(object) {
9478
+ function isBoolean3(object) {
9479
9479
  return "[object Boolean]" === Object.prototype.toString.call(object);
9480
9480
  }
9481
9481
  module2.exports = new type_1.Type("tag:yaml.org,2002:bool", {
9482
9482
  kind: "scalar",
9483
9483
  resolve: resolveYamlBoolean,
9484
9484
  construct: constructYamlBoolean,
9485
- predicate: isBoolean2,
9485
+ predicate: isBoolean3,
9486
9486
  represent: {
9487
9487
  lowercase: function(object) {
9488
9488
  return object ? "true" : "false";
@@ -31107,7 +31107,7 @@ var require_index_node_cjs = __commonJS({
31107
31107
  * @returns {string}
31108
31108
  */
31109
31109
  static get version() {
31110
- return "1.3.9";
31110
+ return "1.4.0";
31111
31111
  }
31112
31112
  /**
31113
31113
  * @returns {string}
@@ -31890,6 +31890,7 @@ var require_index_node_cjs = __commonJS({
31890
31890
  // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
31891
31891
  binary_ops: {
31892
31892
  "||": 1,
31893
+ "??": 1,
31893
31894
  "&&": 2,
31894
31895
  "|": 3,
31895
31896
  "^": 4,
@@ -31909,10 +31910,11 @@ var require_index_node_cjs = __commonJS({
31909
31910
  "-": 9,
31910
31911
  "*": 10,
31911
31912
  "/": 10,
31912
- "%": 10
31913
+ "%": 10,
31914
+ "**": 11
31913
31915
  },
31914
31916
  // sets specific binary_ops as right-associative
31915
- right_associative: /* @__PURE__ */ new Set(),
31917
+ right_associative: /* @__PURE__ */ new Set(["**"]),
31916
31918
  // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
31917
31919
  additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
31918
31920
  // Literals
@@ -32028,7 +32030,7 @@ var require_index_node_cjs = __commonJS({
32028
32030
  var MINUS_CODE = 45;
32029
32031
  var plugin = {
32030
32032
  name: "assignment",
32031
- assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|="]),
32033
+ assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
32032
32034
  updateOperators: [PLUS_CODE, MINUS_CODE],
32033
32035
  assignmentPrecedence: 0.9,
32034
32036
  init(jsep2) {
@@ -32090,6 +32092,7 @@ var require_index_node_cjs = __commonJS({
32090
32092
  jsep.addUnaryOp("typeof");
32091
32093
  jsep.addLiteral("null", null);
32092
32094
  jsep.addLiteral("undefined", void 0);
32095
+ var BLOCKED_PROTO_PROPERTIES = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]);
32093
32096
  var SafeEval = {
32094
32097
  /**
32095
32098
  * @param {jsep.Expression} ast
@@ -32168,7 +32171,7 @@ var require_index_node_cjs = __commonJS({
32168
32171
  return SafeEval.evalAst(ast.alternate, subs);
32169
32172
  },
32170
32173
  evalIdentifier(ast, subs) {
32171
- if (ast.name in subs) {
32174
+ if (Object.hasOwn(subs, ast.name)) {
32172
32175
  return subs[ast.name];
32173
32176
  }
32174
32177
  throw ReferenceError(`${ast.name} is not defined`);
@@ -32177,22 +32180,22 @@ var require_index_node_cjs = __commonJS({
32177
32180
  return ast.value;
32178
32181
  },
32179
32182
  evalMemberExpression(ast, subs) {
32180
- if (ast.property.type === "Identifier" && ast.property.name === "constructor" || ast.object.type === "Identifier" && ast.object.name === "constructor") {
32181
- throw new Error("'constructor' property is disabled");
32182
- }
32183
- const prop = ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name;
32183
+ const prop = String(
32184
+ // NOTE: `String(value)` throws error when
32185
+ // value has overwritten the toString method to return non-string
32186
+ // i.e. `value = {toString: () => []}`
32187
+ ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name
32188
+ // `object.property` property is Identifier
32189
+ );
32184
32190
  const obj = SafeEval.evalAst(ast.object, subs);
32191
+ if (obj === void 0 || obj === null) {
32192
+ throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
32193
+ }
32194
+ if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
32195
+ throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
32196
+ }
32185
32197
  const result = obj[prop];
32186
32198
  if (typeof result === "function") {
32187
- if (obj === Function && prop === "bind") {
32188
- throw new Error("Function.prototype.bind is disabled");
32189
- }
32190
- if (obj === Function && (prop === "call" || prop === "apply")) {
32191
- throw new Error("Function.prototype.call and Function.prototype.apply are disabled");
32192
- }
32193
- if (result === Function) {
32194
- return result;
32195
- }
32196
32199
  return result.bind(obj);
32197
32200
  }
32198
32201
  return result;
@@ -32214,9 +32217,6 @@ var require_index_node_cjs = __commonJS({
32214
32217
  evalCallExpression(ast, subs) {
32215
32218
  const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
32216
32219
  const func = SafeEval.evalAst(ast.callee, subs);
32217
- if (func === Function) {
32218
- throw new Error("Function constructor is disabled");
32219
- }
32220
32220
  return func(...args);
32221
32221
  },
32222
32222
  evalAssignmentExpression(ast, subs) {
@@ -32224,9 +32224,6 @@ var require_index_node_cjs = __commonJS({
32224
32224
  throw SyntaxError("Invalid left-hand side in assignment");
32225
32225
  }
32226
32226
  const id = ast.left.name;
32227
- if (id === "__proto__") {
32228
- throw new Error("Assignment to __proto__ is disabled");
32229
- }
32230
32227
  const value = SafeEval.evalAst(ast.right, subs);
32231
32228
  subs[id] = value;
32232
32229
  return subs[id];
@@ -32246,9 +32243,7 @@ var require_index_node_cjs = __commonJS({
32246
32243
  * @returns {EvaluatedResult} Result of evaluated code
32247
32244
  */
32248
32245
  runInNewContext(context) {
32249
- const keyMap = {
32250
- ...context
32251
- };
32246
+ const keyMap = Object.assign(/* @__PURE__ */ Object.create(null), context);
32252
32247
  return SafeEval.evalAst(this.ast, keyMap);
32253
32248
  }
32254
32249
  };
@@ -45732,7 +45727,7 @@ var require_object_inspect = __commonJS({
45732
45727
  if (isBigInt(obj)) {
45733
45728
  return markBoxed(inspect(bigIntValueOf.call(obj)));
45734
45729
  }
45735
- if (isBoolean2(obj)) {
45730
+ if (isBoolean3(obj)) {
45736
45731
  return markBoxed(booleanValueOf.call(obj));
45737
45732
  }
45738
45733
  if (isString3(obj)) {
@@ -45786,7 +45781,7 @@ var require_object_inspect = __commonJS({
45786
45781
  function isNumber2(obj) {
45787
45782
  return toStr(obj) === "[object Number]" && (!toStringTag2 || !(typeof obj === "object" && toStringTag2 in obj));
45788
45783
  }
45789
- function isBoolean2(obj) {
45784
+ function isBoolean3(obj) {
45790
45785
  return toStr(obj) === "[object Boolean]" && (!toStringTag2 || !(typeof obj === "object" && toStringTag2 in obj));
45791
45786
  }
45792
45787
  function isSymbol(obj) {
@@ -48117,6 +48112,8 @@ var require_dist10 = __commonJS({
48117
48112
  var src_exports = {};
48118
48113
  __export(src_exports, {
48119
48114
  BODY_TYPE_NAME: () => BODY_TYPE_NAME,
48115
+ EnumGeneration: () => EnumGeneration,
48116
+ FormDataArrayHandling: () => FormDataArrayHandling,
48120
48117
  GetterPropType: () => GetterPropType,
48121
48118
  LogLevels: () => LogLevels,
48122
48119
  NamingConvention: () => NamingConvention,
@@ -48258,6 +48255,11 @@ var NamingConvention = {
48258
48255
  SNAKE_CASE: "snake_case",
48259
48256
  KEBAB_CASE: "kebab-case"
48260
48257
  };
48258
+ var EnumGeneration = {
48259
+ CONST: "const",
48260
+ ENUM: "enum",
48261
+ UNION: "union"
48262
+ };
48261
48263
  var OutputClient = {
48262
48264
  ANGULAR: "angular",
48263
48265
  AXIOS: "axios",
@@ -48268,7 +48270,8 @@ var OutputClient = {
48268
48270
  SWR: "swr",
48269
48271
  ZOD: "zod",
48270
48272
  HONO: "hono",
48271
- FETCH: "fetch"
48273
+ FETCH: "fetch",
48274
+ MCP: "mcp"
48272
48275
  };
48273
48276
  var OutputHttpClient = {
48274
48277
  AXIOS: "axios",
@@ -48283,6 +48286,11 @@ var OutputMode = {
48283
48286
  var OutputMockType = {
48284
48287
  MSW: "msw"
48285
48288
  };
48289
+ var FormDataArrayHandling = {
48290
+ SERIALIZE: "serialize",
48291
+ EXPLODE: "explode",
48292
+ SERIALIZE_WITH_BRACKETS: "serialize-with-brackets"
48293
+ };
48286
48294
  var Verbs = {
48287
48295
  POST: "post",
48288
48296
  PUT: "put",
@@ -49423,9 +49431,14 @@ var getIsBodyVerb = (verb) => VERBS_WITH_BODY.includes(verb);
49423
49431
  var getEnumNames = (schemaObject) => {
49424
49432
  return schemaObject?.["x-enumNames"] || schemaObject?.["x-enumnames"] || schemaObject?.["x-enum-varnames"];
49425
49433
  };
49426
- var getEnum = (value, enumName, names, useNativeEnums) => {
49427
- const enumValue = useNativeEnums ? getNativeEnum(value, enumName, names) : getTypeConstEnum(value, enumName, names);
49428
- return enumValue;
49434
+ var getEnum = (value, enumName, names, enumGenerationType) => {
49435
+ if (enumGenerationType === EnumGeneration.CONST)
49436
+ return getTypeConstEnum(value, enumName, names);
49437
+ if (enumGenerationType === EnumGeneration.ENUM)
49438
+ return getNativeEnum(value, enumName, names);
49439
+ if (enumGenerationType === EnumGeneration.UNION)
49440
+ return getUnion(value, enumName);
49441
+ throw new Error(`Invalid enumGenerationType: ${enumGenerationType}`);
49429
49442
  };
49430
49443
  var getTypeConstEnum = (value, enumName, names) => {
49431
49444
  let enumValue = `export type ${enumName} = typeof ${enumName}[keyof typeof ${enumName}]`;
@@ -49510,6 +49523,9 @@ var toNumberKey = (value) => {
49510
49523
  }
49511
49524
  return `NUMBER_${value}`;
49512
49525
  };
49526
+ var getUnion = (value, enumName) => {
49527
+ return `export type ${enumName} = ${value};`;
49528
+ };
49513
49529
 
49514
49530
  // src/getters/ref.ts
49515
49531
  var RefComponentSuffix = {
@@ -49751,7 +49767,7 @@ var resolveObjectOriginal = ({
49751
49767
  resolvedValue.value,
49752
49768
  propName,
49753
49769
  getEnumNames(resolvedValue.originalSchema),
49754
- context.output.override.useNativeEnums
49770
+ context.output.override.enumGenerationType
49755
49771
  );
49756
49772
  return {
49757
49773
  value: propName,
@@ -50140,7 +50156,9 @@ var resolveSchemaPropertiesToFormData = ({
50140
50156
  variableName,
50141
50157
  propName,
50142
50158
  context,
50143
- isRequestBodyOptional
50159
+ isRequestBodyOptional,
50160
+ keyPrefix = "",
50161
+ depth = 0
50144
50162
  }) => {
50145
50163
  const formDataValues = Object.entries(schema.properties ?? {}).reduce(
50146
50164
  (acc, [key, value]) => {
@@ -50151,28 +50169,64 @@ var resolveSchemaPropertiesToFormData = ({
50151
50169
  const valueKey = `${propName}${formattedKeyPrefix}${formattedKey}`;
50152
50170
  const nonOptionalValueKey = `${propName}${formattedKey}`;
50153
50171
  if (property.type === "object") {
50154
- formDataValue = `${variableName}.append('${key}', JSON.stringify(${nonOptionalValueKey}));
50172
+ if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
50173
+ formDataValue = resolveSchemaPropertiesToFormData({
50174
+ schema: property,
50175
+ variableName,
50176
+ propName: nonOptionalValueKey,
50177
+ context,
50178
+ isRequestBodyOptional,
50179
+ keyPrefix: `${keyPrefix}${key}.`,
50180
+ depth: depth + 1
50181
+ });
50182
+ } else {
50183
+ formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, JSON.stringify(${nonOptionalValueKey}));
50155
50184
  `;
50185
+ }
50156
50186
  } else if (property.type === "array") {
50157
50187
  let valueStr = "value";
50188
+ let hasNonPrimitiveChild = false;
50158
50189
  if (property.items) {
50159
50190
  const { schema: itemSchema } = resolveRef(
50160
50191
  property.items,
50161
50192
  context
50162
50193
  );
50163
50194
  if (itemSchema.type === "object" || itemSchema.type === "array") {
50164
- valueStr = "JSON.stringify(value)";
50195
+ if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
50196
+ hasNonPrimitiveChild = true;
50197
+ const resolvedValue = resolveSchemaPropertiesToFormData({
50198
+ schema: itemSchema,
50199
+ variableName,
50200
+ propName: "value",
50201
+ context,
50202
+ isRequestBodyOptional,
50203
+ keyPrefix: `${keyPrefix}${key}[\${index${depth > 0 ? depth : ""}}].`,
50204
+ depth: depth + 1
50205
+ });
50206
+ formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ""}) => {
50207
+ ${resolvedValue}});
50208
+ `;
50209
+ } else {
50210
+ valueStr = "JSON.stringify(value)";
50211
+ }
50165
50212
  } else if (itemSchema.type === "number" || itemSchema.type?.includes("number") || itemSchema.type === "integer" || itemSchema.type?.includes("integer") || itemSchema.type === "boolean" || itemSchema.type?.includes("boolean")) {
50166
50213
  valueStr = "value.toString()";
50167
50214
  }
50168
50215
  }
50169
- formDataValue = `${valueKey}.forEach(value => ${variableName}.append('${key}', ${valueStr}));
50216
+ if (context.output.override.formData.arrayHandling === FormDataArrayHandling.EXPLODE) {
50217
+ if (!hasNonPrimitiveChild) {
50218
+ formDataValue = `${valueKey}.forEach((value, index${depth > 0 ? depth : ""}) => ${variableName}.append(\`${keyPrefix}${key}[\${index${depth > 0 ? depth : ""}}]\`, ${valueStr}));
50170
50219
  `;
50220
+ }
50221
+ } else {
50222
+ formDataValue = `${valueKey}.forEach(value => ${variableName}.append(\`${keyPrefix}${key}${context.output.override.formData.arrayHandling === FormDataArrayHandling.SERIALIZE_WITH_BRACKETS ? "[]" : ""}\`, ${valueStr}));
50223
+ `;
50224
+ }
50171
50225
  } else if (property.type === "number" || property.type?.includes("number") || property.type === "integer" || property.type?.includes("integer") || property.type === "boolean" || property.type?.includes("boolean")) {
50172
- formDataValue = `${variableName}.append('${key}', ${nonOptionalValueKey}.toString())
50226
+ formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, ${nonOptionalValueKey}.toString())
50173
50227
  `;
50174
50228
  } else {
50175
- formDataValue = `${variableName}.append('${key}', ${nonOptionalValueKey})
50229
+ formDataValue = `${variableName}.append(\`${keyPrefix}${key}\`, ${nonOptionalValueKey})
50176
50230
  `;
50177
50231
  }
50178
50232
  let existSubSchemaNullable = false;
@@ -50184,7 +50238,7 @@ var resolveSchemaPropertiesToFormData = ({
50184
50238
  if (subSchemas?.some((subSchema) => {
50185
50239
  return ["number", "integer", "boolean"].includes(subSchema.type);
50186
50240
  })) {
50187
- formDataValue = `${variableName}.append('${key}', ${nonOptionalValueKey}.toString())
50241
+ formDataValue = `${variableName}.append(\`${key}\`, ${nonOptionalValueKey}.toString())
50188
50242
  `;
50189
50243
  }
50190
50244
  if (subSchemas?.some((subSchema) => {
@@ -51086,7 +51140,7 @@ var getQueryParamsTypes = (queryParams, operationName, context) => {
51086
51140
  resolvedValue.value,
51087
51141
  enumName,
51088
51142
  getEnumNames(resolvedValue.originalSchema),
51089
- context.output.override.useNativeEnums
51143
+ context.output.override.enumGenerationType
51090
51144
  );
51091
51145
  return {
51092
51146
  definition: `${doc}${key}${!required || schema.default ? "?" : ""}: ${enumName};`,
@@ -52127,7 +52181,7 @@ var generateSchemasDefinition = (schemas = {}, context, suffix, filters) => {
52127
52181
  resolvedValue.value,
52128
52182
  schemaName,
52129
52183
  getEnumNames(resolvedValue.originalSchema),
52130
- context.output.override.useNativeEnums
52184
+ context.output.override.enumGenerationType
52131
52185
  );
52132
52186
  } else if (schemaName === resolvedValue.value && resolvedValue.isRef) {
52133
52187
  const { schema: referredSchema } = resolveRef(schema, context);
@@ -52204,8 +52258,7 @@ var generateVerbOptions = async ({
52204
52258
  overrideOperation
52205
52259
  );
52206
52260
  const overrideOperationName = overrideOperation?.operationName || output.override?.operationName;
52207
- const overriddenOperationName = overrideOperationName ? overrideOperationName(operation, route, verb) : camel(operationId);
52208
- const operationName = sanitize(overriddenOperationName, { es5keyword: true });
52261
+ const operationName = overrideOperationName ? overrideOperationName(operation, route, verb) : sanitize(camel(operationId), { es5keyword: true });
52209
52262
  const response = getResponse({
52210
52263
  responses,
52211
52264
  operationName,
@@ -52255,10 +52308,10 @@ var generateVerbOptions = async ({
52255
52308
  workspace: context.workspace,
52256
52309
  tsconfig: context.output.tsconfig
52257
52310
  });
52258
- const formData = (isString2(override?.formData) || isObject(override?.formData)) && body.formData ? await generateMutator({
52311
+ const formData = !override.formData.disabled && body.formData ? await generateMutator({
52259
52312
  output: output.target,
52260
52313
  name: operationName,
52261
- mutator: override.formData,
52314
+ mutator: override.formData.mutator,
52262
52315
  workspace: context.workspace,
52263
52316
  tsconfig: context.output.tsconfig
52264
52317
  }) : void 0;
@@ -53247,6 +53300,8 @@ var writeTagsMode = async ({
53247
53300
  // Annotate the CommonJS export names for ESM import in node:
53248
53301
  0 && (module.exports = {
53249
53302
  BODY_TYPE_NAME,
53303
+ EnumGeneration,
53304
+ FormDataArrayHandling,
53250
53305
  GetterPropType,
53251
53306
  LogLevels,
53252
53307
  NamingConvention,