@orval/core 7.13.2 → 7.15.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
@@ -483,6 +483,7 @@ type NormalizedQueryOptions = {
483
483
  useSuspenseInfiniteQuery?: boolean;
484
484
  useInfiniteQueryParam?: string;
485
485
  usePrefetch?: boolean;
486
+ useInvalidate?: boolean;
486
487
  options?: any;
487
488
  queryKey?: NormalizedMutator;
488
489
  queryOptions?: NormalizedMutator;
@@ -503,6 +504,7 @@ type QueryOptions = {
503
504
  useSuspenseInfiniteQuery?: boolean;
504
505
  useInfiniteQueryParam?: string;
505
506
  usePrefetch?: boolean;
507
+ useInvalidate?: boolean;
506
508
  options?: any;
507
509
  queryKey?: Mutator;
508
510
  queryOptions?: Mutator;
@@ -568,7 +570,7 @@ interface HookOption {
568
570
  }
569
571
  type HookCommand = string | HookFunction | HookOption | (string | HookFunction | HookOption)[];
570
572
  type NormalizedHookCommand = HookCommand[];
571
- type HooksOptions<T = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T>>;
573
+ type HooksOptions<T$1 = HookCommand | NormalizedHookCommand> = Partial<Record<Hook, T$1>>;
572
574
  type NormalizedHookOptions = HooksOptions<NormalizedHookCommand>;
573
575
  type Verbs = 'post' | 'put' | 'get' | 'patch' | 'delete' | 'head';
574
576
  declare const Verbs: {
@@ -639,6 +641,7 @@ type GeneratorImport = {
639
641
  default?: boolean;
640
642
  values?: boolean;
641
643
  syntheticDefaultImport?: boolean;
644
+ namespaceImport?: boolean;
642
645
  };
643
646
  type GeneratorDependency = {
644
647
  exports: GeneratorImport[];
@@ -1503,7 +1506,7 @@ interface DebuggerOptions {
1503
1506
  declare function createDebugger(ns: string, options?: DebuggerOptions): debug.Debugger['log'];
1504
1507
  //#endregion
1505
1508
  //#region src/utils/deep-non-nullable.d.ts
1506
- type DeepNonNullable<T> = T extends Function ? T : T extends readonly (infer U)[] ? DeepNonNullable<NonNullable<U>>[] : T extends object ? { [K in keyof T]: DeepNonNullable<NonNullable<T[K]>> } : NonNullable<T>;
1509
+ type DeepNonNullable<T$1> = T$1 extends Function ? T$1 : T$1 extends readonly (infer U)[] ? DeepNonNullable<NonNullable<U>>[] : T$1 extends object ? { [K in keyof T$1]: DeepNonNullable<NonNullable<T$1[K]>> } : NonNullable<T$1>;
1507
1510
  //#endregion
1508
1511
  //#region src/utils/doc.d.ts
1509
1512
  declare function jsDoc(schema: {
@@ -1532,6 +1535,40 @@ declare const dynamicImport: <T>(toImport: T | string, from?: string, takeDefaul
1532
1535
  //#region src/utils/extension.d.ts
1533
1536
  declare const getExtension: (path: string) => "yaml" | "json";
1534
1537
  //#endregion
1538
+ //#region src/utils/file.d.ts
1539
+ declare const getFileInfo: (target?: string, {
1540
+ backupFilename,
1541
+ extension
1542
+ }?: {
1543
+ backupFilename?: string;
1544
+ extension?: string;
1545
+ }) => {
1546
+ path: string;
1547
+ pathWithoutExtension: string;
1548
+ extension: string;
1549
+ isDirectory: boolean;
1550
+ dirname: string;
1551
+ filename: string;
1552
+ };
1553
+ declare function loadFile(filePath?: string, options?: {
1554
+ root?: string;
1555
+ defaultFileName?: string;
1556
+ alias?: Record<string, string>;
1557
+ tsconfig?: Tsconfig;
1558
+ }): Promise<{
1559
+ path: string;
1560
+ file?: string;
1561
+ error?: unknown;
1562
+ cached?: boolean;
1563
+ }>;
1564
+ declare function removeFilesAndEmptyFolders(patterns: string[], dir: string): Promise<void>;
1565
+ //#endregion
1566
+ //#region src/utils/file-extensions.d.ts
1567
+ declare const getMockFileExtensionByTypeName: (mock: GlobalMockOptions | ClientMockBuilder) => string;
1568
+ //#endregion
1569
+ //#region src/utils/is-body-verb.d.ts
1570
+ declare const getIsBodyVerb: (verb: Verbs) => boolean;
1571
+ //#endregion
1535
1572
  //#region src/utils/logger.d.ts
1536
1573
  declare const log: (message?: any, ...optionalParams: any[]) => void;
1537
1574
  declare const startMessage: ({
@@ -1575,45 +1612,8 @@ interface LoggerOptions {
1575
1612
  }
1576
1613
  declare function createLogger(level?: LogLevel, options?: LoggerOptions): Logger;
1577
1614
  //#endregion
1578
- //#region src/utils/file.d.ts
1579
- declare const getFileInfo: (target?: string, {
1580
- backupFilename,
1581
- extension
1582
- }?: {
1583
- backupFilename?: string;
1584
- extension?: string;
1585
- }) => {
1586
- path: string;
1587
- pathWithoutExtension: string;
1588
- extension: string;
1589
- isDirectory: boolean;
1590
- dirname: string;
1591
- filename: string;
1592
- };
1593
- declare function loadFile<File = any>(filePath?: string, options?: {
1594
- root?: string;
1595
- defaultFileName?: string;
1596
- logLevel?: LogLevel;
1597
- isDefault?: boolean;
1598
- alias?: Record<string, string>;
1599
- tsconfig?: Tsconfig;
1600
- load?: boolean;
1601
- }): Promise<{
1602
- path: string;
1603
- file?: File;
1604
- error?: any;
1605
- cached?: boolean;
1606
- }>;
1607
- declare function removeFilesAndEmptyFolders(patterns: string[], dir: string): Promise<void>;
1608
- //#endregion
1609
- //#region src/utils/file-extensions.d.ts
1610
- declare const getMockFileExtensionByTypeName: (mock: GlobalMockOptions | ClientMockBuilder) => string;
1611
- //#endregion
1612
- //#region src/utils/is-body-verb.d.ts
1613
- declare const getIsBodyVerb: (verb: Verbs) => boolean;
1614
- //#endregion
1615
1615
  //#region src/utils/merge-deep.d.ts
1616
- declare function mergeDeep<T extends Record<string, any>, U extends Record<string, any>>(source: T, target: U): T & U;
1616
+ declare function mergeDeep<T$1 extends Record<string, any>, U$1 extends Record<string, any>>(source: T$1, target: U$1): T$1 & U$1;
1617
1617
  //#endregion
1618
1618
  //#region src/utils/occurrence.d.ts
1619
1619
  declare const count: (str: string | undefined, key: string) => number;
package/dist/index.js CHANGED
@@ -47,12 +47,12 @@ let micromatch = require("micromatch");
47
47
  micromatch = __toESM(micromatch);
48
48
  let debug = require("debug");
49
49
  debug = __toESM(debug);
50
- let node_readline = require("node:readline");
51
- node_readline = __toESM(node_readline);
52
50
  let compare_versions = require("compare-versions");
53
51
  compare_versions = __toESM(compare_versions);
54
52
  let node_url = require("node:url");
55
53
  node_url = __toESM(node_url);
54
+ let node_readline = require("node:readline");
55
+ node_readline = __toESM(node_readline);
56
56
  let swagger2openapi = require("swagger2openapi");
57
57
  swagger2openapi = __toESM(swagger2openapi);
58
58
  let __ibm_cloud_openapi_ruleset = require("@ibm-cloud/openapi-ruleset");
@@ -192,100 +192,6 @@ function createDebugger(ns, options = {}) {
192
192
  };
193
193
  }
194
194
 
195
- //#endregion
196
- //#region src/utils/logger.ts
197
- const log = console.log;
198
- const startMessage = ({ name, version, description }) => `🍻 ${chalk.default.cyan.bold(name)} ${chalk.default.green(`v${version}`)}${description ? ` - ${description}` : ""}`;
199
- const logError = (err, tag) => {
200
- log(chalk.default.red([
201
- "🛑",
202
- tag ? `${tag} -` : void 0,
203
- err instanceof Error ? err.stack : err
204
- ].filter(Boolean).join(" ")));
205
- };
206
- const mismatchArgsMessage = (mismatchArgs) => {
207
- log(chalk.default.yellow(`${mismatchArgs.join(", ")} ${mismatchArgs.length === 1 ? "is" : "are"} not defined in your configuration!`));
208
- };
209
- const createSuccessMessage = (backend) => {
210
- log(`🎉 ${backend ? `${chalk.default.green(backend)} - ` : ""}Your OpenAPI spec has been converted into ready to use orval!`);
211
- };
212
- const ibmOpenapiValidatorWarnings = (warnings) => {
213
- log(chalk.default.yellow("(!) Warnings"));
214
- for (const i of warnings) log(chalk.default.yellow(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
215
- };
216
- const ibmOpenapiValidatorErrors = (errors) => {
217
- log(chalk.default.red("(!) Errors"));
218
- for (const i of errors) log(chalk.default.red(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
219
- };
220
- const LogLevels = {
221
- silent: 0,
222
- error: 1,
223
- warn: 2,
224
- info: 3
225
- };
226
- let lastType;
227
- let lastMsg;
228
- let sameCount = 0;
229
- function clearScreen() {
230
- const repeatCount = process.stdout.rows - 2;
231
- const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
232
- console.log(blank);
233
- node_readline.default.cursorTo(process.stdout, 0, 0);
234
- node_readline.default.clearScreenDown(process.stdout);
235
- }
236
- function createLogger(level = "info", options = {}) {
237
- const { prefix = "[vite]", allowClearScreen = true } = options;
238
- const thresh = LogLevels[level];
239
- const clear = allowClearScreen && process.stdout.isTTY && !process.env.CI ? clearScreen : () => {};
240
- function output(type, msg, options$1 = {}) {
241
- if (thresh >= LogLevels[type]) {
242
- const method = type === "info" ? "log" : type;
243
- const format = () => {
244
- if (options$1.timestamp) {
245
- const tag = type === "info" ? chalk.default.cyan.bold(prefix) : type === "warn" ? chalk.default.yellow.bold(prefix) : chalk.default.red.bold(prefix);
246
- return `${chalk.default.dim((/* @__PURE__ */ new Date()).toLocaleTimeString())} ${tag} ${msg}`;
247
- } else return msg;
248
- };
249
- if (type === lastType && msg === lastMsg) {
250
- sameCount++;
251
- clear();
252
- console[method](format(), chalk.default.yellow(`(x${sameCount + 1})`));
253
- } else {
254
- sameCount = 0;
255
- lastMsg = msg;
256
- lastType = type;
257
- if (options$1.clear) clear();
258
- console[method](format());
259
- }
260
- }
261
- }
262
- const warnedMessages = /* @__PURE__ */ new Set();
263
- const logger = {
264
- hasWarned: false,
265
- info(msg, opts) {
266
- output("info", msg, opts);
267
- },
268
- warn(msg, opts) {
269
- logger.hasWarned = true;
270
- output("warn", msg, opts);
271
- },
272
- warnOnce(msg, opts) {
273
- if (warnedMessages.has(msg)) return;
274
- logger.hasWarned = true;
275
- output("warn", msg, opts);
276
- warnedMessages.add(msg);
277
- },
278
- error(msg, opts) {
279
- logger.hasWarned = true;
280
- output("error", msg, opts);
281
- },
282
- clearScreen(type) {
283
- if (thresh >= LogLevels[type]) clear();
284
- }
285
- };
286
- return logger;
287
- }
288
-
289
195
  //#endregion
290
196
  //#region src/utils/file.ts
291
197
  const getFileInfo = (target = "", { backupFilename = "filename", extension = ".ts" } = {}) => {
@@ -306,15 +212,12 @@ const getFileInfo = (target = "", { backupFilename = "filename", extension = ".t
306
212
  const debug$1 = createDebugger("orval:file-load");
307
213
  const cache = /* @__PURE__ */ new Map();
308
214
  async function loadFile(filePath, options) {
309
- const { root = process.cwd(), isDefault = true, defaultFileName, logLevel, alias, tsconfig, load = true } = options ?? {};
215
+ const { root = process.cwd(), defaultFileName, alias, tsconfig } = options ?? {};
310
216
  const start = Date.now();
311
217
  let resolvedPath;
312
- let isTS = false;
313
218
  let isMjs = false;
314
- if (filePath) {
315
- resolvedPath = node_path.default.resolve(filePath);
316
- isTS = filePath.endsWith(".ts");
317
- } else if (defaultFileName) {
219
+ if (filePath) resolvedPath = node_path.default.resolve(filePath);
220
+ else if (defaultFileName) {
318
221
  const jsFile = node_path.default.resolve(root, `${defaultFileName}.js`);
319
222
  if (node_fs.default.existsSync(jsFile)) resolvedPath = jsFile;
320
223
  if (!resolvedPath) {
@@ -330,10 +233,7 @@ async function loadFile(filePath, options) {
330
233
  }
331
234
  if (!resolvedPath) {
332
235
  const tsFile = node_path.default.resolve(root, `${defaultFileName}.ts`);
333
- if (node_fs.default.existsSync(tsFile)) {
334
- resolvedPath = tsFile;
335
- isTS = true;
336
- }
236
+ if (node_fs.default.existsSync(tsFile)) resolvedPath = tsFile;
337
237
  }
338
238
  }
339
239
  if (!resolvedPath) if (filePath) throw new Error(chalk.default.red(`File not found => ${filePath}`));
@@ -347,24 +247,8 @@ async function loadFile(filePath, options) {
347
247
  cached: true
348
248
  };
349
249
  try {
350
- let file;
351
- if (!file && !isTS && !isMjs) try {
352
- delete require.cache[require.resolve(resolvedPath)];
353
- file = require(resolvedPath);
354
- debug$1(`cjs loaded in ${Date.now() - start}ms`);
355
- } catch (error) {
356
- if (!new RegExp([
357
- `Cannot use import statement`,
358
- `Must use import to load ES Module`,
359
- `Unexpected token`,
360
- `Unexpected identifier`
361
- ].join("|")).test(error.message)) throw error;
362
- }
363
- if (!file) {
364
- const { code } = await bundleFile(resolvedPath, isMjs, root || node_path.default.dirname(normalizeResolvedPath), alias, tsconfig?.compilerOptions);
365
- file = load ? await loadFromBundledFile(resolvedPath, code, isDefault) : code;
366
- debug$1(`bundled file loaded in ${Date.now() - start}ms`);
367
- }
250
+ const { code: file } = await bundleFile(resolvedPath, isMjs, root || node_path.default.dirname(normalizeResolvedPath), alias, tsconfig?.compilerOptions);
251
+ debug$1(`bundled file loaded in ${Date.now() - start}ms`);
368
252
  cache.set(resolvedPath, { file });
369
253
  return {
370
254
  path: normalizeResolvedPath,
@@ -459,19 +343,6 @@ async function bundleFile(fileName, mjs = false, workspace, alias, compilerOptio
459
343
  dependencies: result.metafile ? Object.keys(result.metafile.inputs) : []
460
344
  };
461
345
  }
462
- async function loadFromBundledFile(fileName, bundledCode, isDefault) {
463
- const extension = node_path.default.extname(fileName);
464
- const defaultLoader = require.extensions[extension];
465
- require.extensions[extension] = (module$1, filename) => {
466
- if (filename === fileName) module$1._compile(bundledCode, filename);
467
- else defaultLoader(module$1, filename);
468
- };
469
- delete require.cache[require.resolve(fileName)];
470
- const raw = require(fileName);
471
- const file = isDefault && raw.__esModule ? raw.default : raw;
472
- require.extensions[extension] = defaultLoader;
473
- return file;
474
- }
475
346
  async function removeFilesAndEmptyFolders(patterns, dir) {
476
347
  const files = await (0, globby.default)(patterns, {
477
348
  cwd: dir,
@@ -533,10 +404,7 @@ const relativeSafe = (from, to) => {
533
404
  return normalizeSafe(`.${separator}${normalizedRelativePath}`);
534
405
  };
535
406
  const getSpecName = (specKey, target) => {
536
- if (isUrl(specKey)) {
537
- const url = new URL(target);
538
- return specKey.replace(url.origin, "").replace(getFileInfo(url.pathname).dirname, "").replace(`.${getExtension(specKey)}`, "");
539
- }
407
+ if (isUrl(specKey)) return specKey;
540
408
  return "/" + path$1.normalize(path$1.relative(getFileInfo(target).dirname, specKey)).split("../").join("").replace(`.${getExtension(specKey)}`, "");
541
409
  };
542
410
  const getSchemaFileName = (path$3) => {
@@ -733,6 +601,7 @@ const conventionName = (name, convention) => {
733
601
  //#region src/utils/compare-version.ts
734
602
  const compareVersions = (firstVersion, secondVersions, operator = ">=") => {
735
603
  if (firstVersion === "latest" || firstVersion === "*") return true;
604
+ if (firstVersion.startsWith("catalog:")) return true;
736
605
  return (0, compare_versions.compare)(firstVersion.replace(/(\s(.*))/, ""), secondVersions, operator);
737
606
  };
738
607
 
@@ -847,6 +716,100 @@ const getMockFileExtensionByTypeName = (mock) => {
847
716
  //#region src/utils/is-body-verb.ts
848
717
  const getIsBodyVerb = (verb) => VERBS_WITH_BODY.includes(verb);
849
718
 
719
+ //#endregion
720
+ //#region src/utils/logger.ts
721
+ const log = console.log;
722
+ const startMessage = ({ name, version, description }) => `🍻 ${chalk.default.cyan.bold(name)} ${chalk.default.green(`v${version}`)}${description ? ` - ${description}` : ""}`;
723
+ const logError = (err, tag) => {
724
+ log(chalk.default.red([
725
+ "🛑",
726
+ tag ? `${tag} -` : void 0,
727
+ err instanceof Error ? err.stack : err
728
+ ].filter(Boolean).join(" ")));
729
+ };
730
+ const mismatchArgsMessage = (mismatchArgs) => {
731
+ log(chalk.default.yellow(`${mismatchArgs.join(", ")} ${mismatchArgs.length === 1 ? "is" : "are"} not defined in your configuration!`));
732
+ };
733
+ const createSuccessMessage = (backend) => {
734
+ log(`🎉 ${backend ? `${chalk.default.green(backend)} - ` : ""}Your OpenAPI spec has been converted into ready to use orval!`);
735
+ };
736
+ const ibmOpenapiValidatorWarnings = (warnings) => {
737
+ log(chalk.default.yellow("(!) Warnings"));
738
+ for (const i of warnings) log(chalk.default.yellow(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
739
+ };
740
+ const ibmOpenapiValidatorErrors = (errors) => {
741
+ log(chalk.default.red("(!) Errors"));
742
+ for (const i of errors) log(chalk.default.red(`Message : ${i.message}\nPath : ${i.path.join(", ")}`));
743
+ };
744
+ const LogLevels = {
745
+ silent: 0,
746
+ error: 1,
747
+ warn: 2,
748
+ info: 3
749
+ };
750
+ let lastType;
751
+ let lastMsg;
752
+ let sameCount = 0;
753
+ function clearScreen() {
754
+ const repeatCount = process.stdout.rows - 2;
755
+ const blank = repeatCount > 0 ? "\n".repeat(repeatCount) : "";
756
+ console.log(blank);
757
+ node_readline.default.cursorTo(process.stdout, 0, 0);
758
+ node_readline.default.clearScreenDown(process.stdout);
759
+ }
760
+ function createLogger(level = "info", options = {}) {
761
+ const { prefix = "[vite]", allowClearScreen = true } = options;
762
+ const thresh = LogLevels[level];
763
+ const clear = allowClearScreen && process.stdout.isTTY && !process.env.CI ? clearScreen : () => {};
764
+ function output(type, msg, options$1 = {}) {
765
+ if (thresh >= LogLevels[type]) {
766
+ const method = type === "info" ? "log" : type;
767
+ const format = () => {
768
+ if (options$1.timestamp) {
769
+ const tag = type === "info" ? chalk.default.cyan.bold(prefix) : type === "warn" ? chalk.default.yellow.bold(prefix) : chalk.default.red.bold(prefix);
770
+ return `${chalk.default.dim((/* @__PURE__ */ new Date()).toLocaleTimeString())} ${tag} ${msg}`;
771
+ } else return msg;
772
+ };
773
+ if (type === lastType && msg === lastMsg) {
774
+ sameCount++;
775
+ clear();
776
+ console[method](format(), chalk.default.yellow(`(x${sameCount + 1})`));
777
+ } else {
778
+ sameCount = 0;
779
+ lastMsg = msg;
780
+ lastType = type;
781
+ if (options$1.clear) clear();
782
+ console[method](format());
783
+ }
784
+ }
785
+ }
786
+ const warnedMessages = /* @__PURE__ */ new Set();
787
+ const logger = {
788
+ hasWarned: false,
789
+ info(msg, opts) {
790
+ output("info", msg, opts);
791
+ },
792
+ warn(msg, opts) {
793
+ logger.hasWarned = true;
794
+ output("warn", msg, opts);
795
+ },
796
+ warnOnce(msg, opts) {
797
+ if (warnedMessages.has(msg)) return;
798
+ logger.hasWarned = true;
799
+ output("warn", msg, opts);
800
+ warnedMessages.add(msg);
801
+ },
802
+ error(msg, opts) {
803
+ logger.hasWarned = true;
804
+ output("error", msg, opts);
805
+ },
806
+ clearScreen(type) {
807
+ if (thresh >= LogLevels[type]) clear();
808
+ }
809
+ };
810
+ return logger;
811
+ }
812
+
850
813
  //#endregion
851
814
  //#region src/utils/merge-deep.ts
852
815
  const isObject$1 = (obj) => obj && typeof obj === "object";
@@ -1127,7 +1090,10 @@ const getRefInfo = ($ref, context) => {
1127
1090
  originalName,
1128
1091
  refPaths
1129
1092
  };
1130
- const path$3 = isUrl(context.specKey) ? resolveUrl(context.specKey, pathname) : resolve(getFileInfo(context.specKey).dirname, pathname);
1093
+ let path$3;
1094
+ if (isUrl($ref)) path$3 = $ref;
1095
+ else if (isUrl(context.specKey)) path$3 = resolveUrl(context.specKey, pathname);
1096
+ else path$3 = resolve(getFileInfo(context.specKey).dirname, pathname);
1131
1097
  return {
1132
1098
  name: sanitize(pascal(originalName) + suffix, {
1133
1099
  es5keyword: true,
@@ -2595,13 +2561,13 @@ const generateMutatorImports = ({ mutators, implementation, oneMore }) => {
2595
2561
  };
2596
2562
  const generateDependency = ({ deps, isAllowSyntheticDefaultImports, dependency, specsName, key, onlyTypes }) => {
2597
2563
  const defaultDep = deps.find((e) => e.default && (isAllowSyntheticDefaultImports || !e.syntheticDefaultImport));
2598
- const syntheticDefaultImportDep = isAllowSyntheticDefaultImports ? void 0 : deps.find((e) => e.syntheticDefaultImport);
2599
- const depsString = (0, lodash_uniq.default)(deps.filter((e) => !e.default && !e.syntheticDefaultImport).map(({ name, alias }) => alias ? `${name} as ${alias}` : name)).sort().join(",\n ");
2564
+ const namespaceImportDep = defaultDep ? void 0 : deps.find((e) => !!e.namespaceImport || !isAllowSyntheticDefaultImports && e.syntheticDefaultImport);
2565
+ const depsString = (0, lodash_uniq.default)(deps.filter((e) => !e.default && !e.syntheticDefaultImport && !e.namespaceImport).map(({ name, alias }) => alias ? `${name} as ${alias}` : name)).toSorted().join(",\n ");
2600
2566
  let importString = "";
2601
- const syntheticDefaultImport = syntheticDefaultImportDep ? `import * as ${syntheticDefaultImportDep.name} from '${dependency}';` : "";
2602
- if (syntheticDefaultImport) {
2603
- if (deps.length === 1) return syntheticDefaultImport;
2604
- importString += `${syntheticDefaultImport}\n`;
2567
+ const namespaceImportString = namespaceImportDep ? `import * as ${namespaceImportDep.name} from '${dependency}';` : "";
2568
+ if (namespaceImportString) {
2569
+ if (deps.length === 1) return namespaceImportString;
2570
+ importString += `${namespaceImportString}\n`;
2605
2571
  }
2606
2572
  importString += `import ${onlyTypes ? "type " : ""}${defaultDep ? `${defaultDep.name}${depsString ? "," : ""}` : ""}${depsString ? `{\n ${depsString}\n}` : ""} from '${dependency}${key !== "default" && specsName[key] ? `/${specsName[key]}` : ""}';`;
2607
2573
  return importString;
@@ -2713,11 +2679,9 @@ const generateMutator = async ({ output, mutator, name, workspace, tsconfig }) =
2713
2679
  const errorTypeName = mutator.default ? `${pascal(name)}ErrorType` : "ErrorType";
2714
2680
  const bodyTypeName = mutator.default ? `${pascal(name)}${BODY_TYPE_NAME}` : BODY_TYPE_NAME;
2715
2681
  const { file, cached } = await loadFile(importPath, {
2716
- isDefault: false,
2717
2682
  root: workspace,
2718
2683
  alias: mutator.alias,
2719
- tsconfig,
2720
- load: false
2684
+ tsconfig
2721
2685
  });
2722
2686
  if (file) {
2723
2687
  const mutatorInfoName = isDefault ? "default" : mutator.name;
@@ -2854,7 +2818,7 @@ const generateAxiosOptions = ({ response, isExactOptionalPropertyTypes, queryPar
2854
2818
  }
2855
2819
  if (!isObject(requestOptions) || !requestOptions.hasOwnProperty("responseType")) {
2856
2820
  if (response.isBlob) value += `\n responseType: 'blob',`;
2857
- else if (response.definition.success === "string") value += `\n responseType: 'text',`;
2821
+ else if (response.contentTypes.at(0) === "text/plain") value += `\n responseType: 'text',`;
2858
2822
  }
2859
2823
  if (isObject(requestOptions)) value += `\n ${stringify(requestOptions)?.slice(1, -1)}`;
2860
2824
  if (isRequestOptions) {