orval 6.27.0 → 6.28.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.js CHANGED
@@ -3821,7 +3821,7 @@ var import_chalk2 = __toESM(require("chalk"));
3821
3821
  var package_default = {
3822
3822
  name: "orval",
3823
3823
  description: "A swagger client generator for typescript",
3824
- version: "6.27.0",
3824
+ version: "6.28.0",
3825
3825
  license: "MIT",
3826
3826
  files: [
3827
3827
  "dist"
@@ -3875,14 +3875,14 @@ var package_default = {
3875
3875
  },
3876
3876
  dependencies: {
3877
3877
  "@apidevtools/swagger-parser": "^10.1.0",
3878
- "@orval/angular": "6.27.0",
3879
- "@orval/axios": "6.27.0",
3880
- "@orval/core": "6.27.0",
3881
- "@orval/mock": "6.27.0",
3882
- "@orval/query": "6.27.0",
3883
- "@orval/swr": "6.27.0",
3884
- "@orval/zod": "6.27.0",
3885
- "@orval/hono": "6.27.0",
3878
+ "@orval/angular": "6.28.0",
3879
+ "@orval/axios": "6.28.0",
3880
+ "@orval/core": "6.28.0",
3881
+ "@orval/mock": "6.28.0",
3882
+ "@orval/query": "6.28.0",
3883
+ "@orval/swr": "6.28.0",
3884
+ "@orval/zod": "6.28.0",
3885
+ "@orval/hono": "6.28.0",
3886
3886
  ajv: "^8.12.0",
3887
3887
  cac: "^6.7.14",
3888
3888
  chalk: "^4.1.2",
@@ -4110,7 +4110,7 @@ function defineConfig(options) {
4110
4110
  return options;
4111
4111
  }
4112
4112
  var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOptions = {}) => {
4113
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma;
4113
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb;
4114
4114
  const options = await ((0, import_core7.isFunction)(optionsExport) ? optionsExport() : optionsExport);
4115
4115
  if (!options.input) {
4116
4116
  (0, import_core7.createLogger)().error(import_chalk2.default.red(`Config require an input`));
@@ -4126,7 +4126,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
4126
4126
  outputOptions.workspace || "",
4127
4127
  workspace
4128
4128
  );
4129
- const { clean, prettier, client, mode, tslint } = globalOptions;
4129
+ const { clean, prettier, client, mode, tslint, biome } = globalOptions;
4130
4130
  const tsconfig = await loadTsconfig(
4131
4131
  outputOptions.tsconfig || globalOptions.tsconfig,
4132
4132
  workspace
@@ -4138,6 +4138,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
4138
4138
  let mock2 = (_a = outputOptions.mock) != null ? _a : globalOptions.mock;
4139
4139
  if (typeof mock2 === "boolean" && mock2) {
4140
4140
  mock2 = import_mock2.DEFAULT_MOCK_OPTIONS;
4141
+ } else if ((0, import_core7.isFunction)(mock2)) {
4141
4142
  } else if (!mock2) {
4142
4143
  mock2 = void 0;
4143
4144
  } else {
@@ -4146,6 +4147,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
4146
4147
  ...mock2
4147
4148
  };
4148
4149
  }
4150
+ const defaultFileExtension = ".ts";
4149
4151
  const normalizedOptions = {
4150
4152
  input: {
4151
4153
  target: globalOptions.input ? normalizePathOrUrl(globalOptions.input, process.cwd()) : normalizePathOrUrl(inputOptions.target, workspace),
@@ -4166,6 +4168,7 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
4166
4168
  output: {
4167
4169
  target: globalOptions.output ? normalizePath(globalOptions.output, process.cwd()) : normalizePath(outputOptions.target, outputWorkspace),
4168
4170
  schemas: normalizePath(outputOptions.schemas, outputWorkspace),
4171
+ fileExtension: outputOptions.fileExtension || defaultFileExtension,
4169
4172
  workspace: outputOptions.workspace ? outputWorkspace : void 0,
4170
4173
  client: (_f = (_e = outputOptions.client) != null ? _e : client) != null ? _f : import_core7.OutputClient.AXIOS_FUNCTIONS,
4171
4174
  mode: normalizeOutputMode((_g = outputOptions.mode) != null ? _g : mode),
@@ -4173,93 +4176,101 @@ var normalizeOptions = async (optionsExport, workspace = process.cwd(), globalOp
4173
4176
  clean: (_i = (_h = outputOptions.clean) != null ? _h : clean) != null ? _i : false,
4174
4177
  prettier: (_k = (_j = outputOptions.prettier) != null ? _j : prettier) != null ? _k : false,
4175
4178
  tslint: (_m = (_l = outputOptions.tslint) != null ? _l : tslint) != null ? _m : false,
4179
+ biome: (_o = (_n = outputOptions.biome) != null ? _n : biome) != null ? _o : false,
4176
4180
  tsconfig,
4177
4181
  packageJson,
4178
- headers: (_n = outputOptions.headers) != null ? _n : false,
4179
- indexFiles: (_o = outputOptions.indexFiles) != null ? _o : true,
4182
+ headers: (_p = outputOptions.headers) != null ? _p : false,
4183
+ indexFiles: (_q = outputOptions.indexFiles) != null ? _q : true,
4180
4184
  baseUrl: outputOptions.baseUrl,
4181
- unionAddMissingProperties: (_p = outputOptions.unionAddMissingProperties) != null ? _p : false,
4185
+ unionAddMissingProperties: (_r = outputOptions.unionAddMissingProperties) != null ? _r : false,
4182
4186
  override: {
4183
4187
  ...outputOptions.override,
4184
4188
  mock: {
4185
- arrayMin: (_s = (_r = (_q = outputOptions.override) == null ? void 0 : _q.mock) == null ? void 0 : _r.arrayMin) != null ? _s : 1,
4186
- arrayMax: (_v = (_u = (_t = outputOptions.override) == null ? void 0 : _t.mock) == null ? void 0 : _u.arrayMax) != null ? _v : 10,
4187
- ...(_x = (_w = outputOptions.override) == null ? void 0 : _w.mock) != null ? _x : {}
4189
+ arrayMin: (_u = (_t = (_s = outputOptions.override) == null ? void 0 : _s.mock) == null ? void 0 : _t.arrayMin) != null ? _u : 1,
4190
+ arrayMax: (_x = (_w = (_v = outputOptions.override) == null ? void 0 : _v.mock) == null ? void 0 : _w.arrayMax) != null ? _x : 10,
4191
+ ...(_z = (_y = outputOptions.override) == null ? void 0 : _y.mock) != null ? _z : {}
4188
4192
  },
4189
4193
  operations: normalizeOperationsAndTags(
4190
- (_z = (_y = outputOptions.override) == null ? void 0 : _y.operations) != null ? _z : {},
4194
+ (_B = (_A = outputOptions.override) == null ? void 0 : _A.operations) != null ? _B : {},
4191
4195
  outputWorkspace
4192
4196
  ),
4193
4197
  tags: normalizeOperationsAndTags(
4194
- (_B = (_A = outputOptions.override) == null ? void 0 : _A.tags) != null ? _B : {},
4198
+ (_D = (_C = outputOptions.override) == null ? void 0 : _C.tags) != null ? _D : {},
4195
4199
  outputWorkspace
4196
4200
  ),
4197
4201
  mutator: normalizeMutator(
4198
4202
  outputWorkspace,
4199
- (_C = outputOptions.override) == null ? void 0 : _C.mutator
4203
+ (_E = outputOptions.override) == null ? void 0 : _E.mutator
4200
4204
  ),
4201
- formData: (_G = !(0, import_core7.isBoolean)((_D = outputOptions.override) == null ? void 0 : _D.formData) ? normalizeMutator(
4205
+ formData: (_I = !(0, import_core7.isBoolean)((_F = outputOptions.override) == null ? void 0 : _F.formData) ? normalizeMutator(
4202
4206
  outputWorkspace,
4203
- (_E = outputOptions.override) == null ? void 0 : _E.formData
4204
- ) : (_F = outputOptions.override) == null ? void 0 : _F.formData) != null ? _G : true,
4205
- formUrlEncoded: (_K = !(0, import_core7.isBoolean)((_H = outputOptions.override) == null ? void 0 : _H.formUrlEncoded) ? normalizeMutator(
4207
+ (_G = outputOptions.override) == null ? void 0 : _G.formData
4208
+ ) : (_H = outputOptions.override) == null ? void 0 : _H.formData) != null ? _I : true,
4209
+ formUrlEncoded: (_M = !(0, import_core7.isBoolean)((_J = outputOptions.override) == null ? void 0 : _J.formUrlEncoded) ? normalizeMutator(
4206
4210
  outputWorkspace,
4207
- (_I = outputOptions.override) == null ? void 0 : _I.formUrlEncoded
4208
- ) : (_J = outputOptions.override) == null ? void 0 : _J.formUrlEncoded) != null ? _K : true,
4211
+ (_K = outputOptions.override) == null ? void 0 : _K.formUrlEncoded
4212
+ ) : (_L = outputOptions.override) == null ? void 0 : _L.formUrlEncoded) != null ? _M : true,
4209
4213
  paramsSerializer: normalizeMutator(
4210
4214
  outputWorkspace,
4211
- (_L = outputOptions.override) == null ? void 0 : _L.paramsSerializer
4215
+ (_N = outputOptions.override) == null ? void 0 : _N.paramsSerializer
4212
4216
  ),
4213
- header: ((_M = outputOptions.override) == null ? void 0 : _M.header) === false ? false : (0, import_core7.isFunction)((_N = outputOptions.override) == null ? void 0 : _N.header) ? (_O = outputOptions.override) == null ? void 0 : _O.header : getDefaultFilesHeader,
4214
- requestOptions: (_Q = (_P = outputOptions.override) == null ? void 0 : _P.requestOptions) != null ? _Q : true,
4217
+ header: ((_O = outputOptions.override) == null ? void 0 : _O.header) === false ? false : (0, import_core7.isFunction)((_P = outputOptions.override) == null ? void 0 : _P.header) ? (_Q = outputOptions.override) == null ? void 0 : _Q.header : getDefaultFilesHeader,
4218
+ requestOptions: (_S = (_R = outputOptions.override) == null ? void 0 : _R.requestOptions) != null ? _S : true,
4215
4219
  components: {
4216
4220
  schemas: {
4217
4221
  suffix: import_core7.RefComponentSuffix.schemas,
4218
- itemSuffix: (_U = (_T = (_S = (_R = outputOptions.override) == null ? void 0 : _R.components) == null ? void 0 : _S.schemas) == null ? void 0 : _T.itemSuffix) != null ? _U : "Item",
4219
- ...(_X = (_W = (_V = outputOptions.override) == null ? void 0 : _V.components) == null ? void 0 : _W.schemas) != null ? _X : {}
4222
+ itemSuffix: (_W = (_V = (_U = (_T = outputOptions.override) == null ? void 0 : _T.components) == null ? void 0 : _U.schemas) == null ? void 0 : _V.itemSuffix) != null ? _W : "Item",
4223
+ ...(_Z = (_Y = (_X = outputOptions.override) == null ? void 0 : _X.components) == null ? void 0 : _Y.schemas) != null ? _Z : {}
4220
4224
  },
4221
4225
  responses: {
4222
4226
  suffix: import_core7.RefComponentSuffix.responses,
4223
- ...(__ = (_Z = (_Y = outputOptions.override) == null ? void 0 : _Y.components) == null ? void 0 : _Z.responses) != null ? __ : {}
4227
+ ...(_aa = (_$ = (__ = outputOptions.override) == null ? void 0 : __.components) == null ? void 0 : _$.responses) != null ? _aa : {}
4224
4228
  },
4225
4229
  parameters: {
4226
4230
  suffix: import_core7.RefComponentSuffix.parameters,
4227
- ...(_ba = (_aa = (_$ = outputOptions.override) == null ? void 0 : _$.components) == null ? void 0 : _aa.parameters) != null ? _ba : {}
4231
+ ...(_da = (_ca = (_ba = outputOptions.override) == null ? void 0 : _ba.components) == null ? void 0 : _ca.parameters) != null ? _da : {}
4228
4232
  },
4229
4233
  requestBodies: {
4230
4234
  suffix: import_core7.RefComponentSuffix.requestBodies,
4231
- ...(_ea = (_da = (_ca = outputOptions.override) == null ? void 0 : _ca.components) == null ? void 0 : _da.requestBodies) != null ? _ea : {}
4235
+ ...(_ga = (_fa = (_ea = outputOptions.override) == null ? void 0 : _ea.components) == null ? void 0 : _fa.requestBodies) != null ? _ga : {}
4232
4236
  }
4233
4237
  },
4234
- hono: normalizeHonoOptions((_fa = outputOptions.override) == null ? void 0 : _fa.hono, workspace),
4238
+ hono: normalizeHonoOptions((_ha = outputOptions.override) == null ? void 0 : _ha.hono, workspace),
4235
4239
  query: {
4236
4240
  useQuery: true,
4237
4241
  useMutation: true,
4238
4242
  signal: true,
4239
4243
  shouldExportMutatorHooks: true,
4240
- ...normalizeQueryOptions((_ga = outputOptions.override) == null ? void 0 : _ga.query, workspace)
4244
+ ...normalizeQueryOptions((_ia = outputOptions.override) == null ? void 0 : _ia.query, workspace)
4241
4245
  },
4242
4246
  zod: {
4243
4247
  strict: {
4244
- param: (_ka = (_ja = (_ia = (_ha = outputOptions.override) == null ? void 0 : _ha.zod) == null ? void 0 : _ia.strict) == null ? void 0 : _ja.param) != null ? _ka : false,
4245
- query: (_oa = (_na = (_ma = (_la = outputOptions.override) == null ? void 0 : _la.zod) == null ? void 0 : _ma.strict) == null ? void 0 : _na.query) != null ? _oa : false,
4246
- header: (_sa = (_ra = (_qa = (_pa = outputOptions.override) == null ? void 0 : _pa.zod) == null ? void 0 : _qa.strict) == null ? void 0 : _ra.header) != null ? _sa : false,
4247
- body: (_wa = (_va = (_ua = (_ta = outputOptions.override) == null ? void 0 : _ta.zod) == null ? void 0 : _ua.strict) == null ? void 0 : _va.body) != null ? _wa : false,
4248
- response: (_Aa = (_za = (_ya = (_xa = outputOptions.override) == null ? void 0 : _xa.zod) == null ? void 0 : _ya.strict) == null ? void 0 : _za.response) != null ? _Aa : false
4248
+ param: (_ma = (_la = (_ka = (_ja = outputOptions.override) == null ? void 0 : _ja.zod) == null ? void 0 : _ka.strict) == null ? void 0 : _la.param) != null ? _ma : false,
4249
+ query: (_qa = (_pa = (_oa = (_na = outputOptions.override) == null ? void 0 : _na.zod) == null ? void 0 : _oa.strict) == null ? void 0 : _pa.query) != null ? _qa : false,
4250
+ header: (_ua = (_ta = (_sa = (_ra = outputOptions.override) == null ? void 0 : _ra.zod) == null ? void 0 : _sa.strict) == null ? void 0 : _ta.header) != null ? _ua : false,
4251
+ body: (_ya = (_xa = (_wa = (_va = outputOptions.override) == null ? void 0 : _va.zod) == null ? void 0 : _wa.strict) == null ? void 0 : _xa.body) != null ? _ya : false,
4252
+ response: (_Ca = (_Ba = (_Aa = (_za = outputOptions.override) == null ? void 0 : _za.zod) == null ? void 0 : _Aa.strict) == null ? void 0 : _Ba.response) != null ? _Ca : false
4253
+ },
4254
+ coerce: {
4255
+ param: (_Ga = (_Fa = (_Ea = (_Da = outputOptions.override) == null ? void 0 : _Da.zod) == null ? void 0 : _Ea.coerce) == null ? void 0 : _Fa.param) != null ? _Ga : false,
4256
+ query: (_Ka = (_Ja = (_Ia = (_Ha = outputOptions.override) == null ? void 0 : _Ha.zod) == null ? void 0 : _Ia.coerce) == null ? void 0 : _Ja.query) != null ? _Ka : false,
4257
+ header: (_Oa = (_Na = (_Ma = (_La = outputOptions.override) == null ? void 0 : _La.zod) == null ? void 0 : _Ma.coerce) == null ? void 0 : _Na.header) != null ? _Oa : false,
4258
+ body: (_Sa = (_Ra = (_Qa = (_Pa = outputOptions.override) == null ? void 0 : _Pa.zod) == null ? void 0 : _Qa.coerce) == null ? void 0 : _Ra.body) != null ? _Sa : false,
4259
+ response: (_Wa = (_Va = (_Ua = (_Ta = outputOptions.override) == null ? void 0 : _Ta.zod) == null ? void 0 : _Ua.coerce) == null ? void 0 : _Va.response) != null ? _Wa : false
4249
4260
  }
4250
4261
  },
4251
4262
  swr: {
4252
- ...(_Ca = (_Ba = outputOptions.override) == null ? void 0 : _Ba.swr) != null ? _Ca : {}
4263
+ ...(_Ya = (_Xa = outputOptions.override) == null ? void 0 : _Xa.swr) != null ? _Ya : {}
4253
4264
  },
4254
4265
  angular: {
4255
- provideIn: (_Fa = (_Ea = (_Da = outputOptions.override) == null ? void 0 : _Da.angular) == null ? void 0 : _Ea.provideIn) != null ? _Fa : "root"
4266
+ provideIn: (_$a = (__a = (_Za = outputOptions.override) == null ? void 0 : _Za.angular) == null ? void 0 : __a.provideIn) != null ? _$a : "root"
4256
4267
  },
4257
- useDates: ((_Ga = outputOptions.override) == null ? void 0 : _Ga.useDates) || false,
4258
- useDeprecatedOperations: (_Ia = (_Ha = outputOptions.override) == null ? void 0 : _Ha.useDeprecatedOperations) != null ? _Ia : true,
4259
- useNativeEnums: (_Ka = (_Ja = outputOptions.override) == null ? void 0 : _Ja.useNativeEnums) != null ? _Ka : false
4268
+ useDates: ((_ab = outputOptions.override) == null ? void 0 : _ab.useDates) || false,
4269
+ useDeprecatedOperations: (_cb = (_bb = outputOptions.override) == null ? void 0 : _bb.useDeprecatedOperations) != null ? _cb : true,
4270
+ useNativeEnums: (_eb = (_db = outputOptions.override) == null ? void 0 : _db.useNativeEnums) != null ? _eb : false
4260
4271
  },
4261
- allParamsOptional: (_La = outputOptions.allParamsOptional) != null ? _La : false,
4262
- urlEncodeParameters: (_Ma = outputOptions.urlEncodeParameters) != null ? _Ma : false
4272
+ allParamsOptional: (_fb = outputOptions.allParamsOptional) != null ? _fb : false,
4273
+ urlEncodeParameters: (_gb = outputOptions.urlEncodeParameters) != null ? _gb : false
4263
4274
  },
4264
4275
  hooks: options.hooks ? normalizeHooks(options.hooks) : {}
4265
4276
  };
@@ -4328,7 +4339,7 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace) => {
4328
4339
  ...rest
4329
4340
  }
4330
4341
  ]) => {
4331
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4342
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
4332
4343
  return [
4333
4344
  key,
4334
4345
  {
@@ -4344,6 +4355,13 @@ var normalizeOperationsAndTags = (operationsOrTags, workspace) => {
4344
4355
  header: (_f = (_e = zod2.strict) == null ? void 0 : _e.header) != null ? _f : false,
4345
4356
  body: (_h = (_g = zod2.strict) == null ? void 0 : _g.body) != null ? _h : false,
4346
4357
  response: (_j = (_i = zod2.strict) == null ? void 0 : _i.response) != null ? _j : false
4358
+ },
4359
+ coerce: {
4360
+ param: (_l = (_k = zod2.coerce) == null ? void 0 : _k.param) != null ? _l : false,
4361
+ query: (_n = (_m = zod2.coerce) == null ? void 0 : _m.query) != null ? _n : false,
4362
+ header: (_p = (_o = zod2.coerce) == null ? void 0 : _o.header) != null ? _p : false,
4363
+ body: (_r = (_q = zod2.coerce) == null ? void 0 : _q.body) != null ? _r : false,
4364
+ response: (_t = (_s = zod2.coerce) == null ? void 0 : _s.response) != null ? _t : false
4347
4365
  }
4348
4366
  }
4349
4367
  } : {},
@@ -4644,6 +4662,14 @@ var writeSpecs = async (builder, workspace, options, projectName) => {
4644
4662
  );
4645
4663
  }
4646
4664
  }
4665
+ if (output.biome) {
4666
+ try {
4667
+ await (0, import_execa2.default)("biome", ["check", "--apply", ...paths]);
4668
+ } catch (e) {
4669
+ const message = e.exitCode === 1 ? e.stdout + e.stderr : `\u26A0\uFE0F ${projectTitle ? `${projectTitle} - ` : ""}biome not found`;
4670
+ (0, import_core10.log)(import_chalk4.default.yellow(message));
4671
+ }
4672
+ }
4647
4673
  (0, import_core10.createSuccessMessage)(projectTitle);
4648
4674
  };
4649
4675
  var getWriteMode = (mode) => {