@hey-api/openapi-ts 0.90.2 → 0.90.3

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- const require_openApi = require('./openApi-BwUPqtP_.cjs');
3
- const require_src = require('./src-hU76ergi.cjs');
2
+ const require_openApi = require('./openApi-BetJIgjU.cjs');
3
+ const require_src = require('./src-CJqsBn3S.cjs');
4
4
 
5
5
  exports.$ = require_openApi.$;
6
6
  exports.Logger = require_src.Logger;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as ctx, C as regexp, D as TypeTsDsl, E as TsDsl, F as Casing, I as LazyOrAsync, L as MaybeArray, M as OperationPath, N as OperationStrategy, O as ExampleOptions, P as IR, S as TypeScriptRenderer, T as MaybeTsDsl, _ as Client$2, a as Plugin, b as DollarTsDsl, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as CallArgs, k as TsDslContext, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as keywords, x as reserved, y as $ } from "./config-84ipCnU3.cjs";
2
+ import { A as ctx, C as regexp, D as TypeTsDsl, E as TsDsl, F as Casing, I as LazyOrAsync, L as MaybeArray, M as OperationPath, N as OperationStrategy, O as ExampleOptions, P as IR, S as TypeScriptRenderer, T as MaybeTsDsl, _ as Client$2, a as Plugin, b as DollarTsDsl, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as CallArgs, k as TsDslContext, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as keywords, x as reserved, y as $ } from "./config-Cmhj4J0r.cjs";
3
3
  import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
4
4
  import { Injector } from "@angular/core";
5
5
  import { AxiosError, AxiosInstance, AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults } from "axios";
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as keywords, B as IR, C as Client$1, D as reserved, E as DollarTsDsl, F as TsDslContext, H as LazyOrAsync, I as ctx, L as CallArgs, M as TsDsl, N as TypeTsDsl, O as TypeScriptRenderer, P as ExampleOptions, R as OperationPath, S as Client$3, T as $, U as MaybeArray, V as Casing, _ as Client$2, a as Plugin, b as Client$5, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as MaybeTsDsl, k as regexp, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as Client, x as Client$4, y as Client$6, z as OperationStrategy } from "./config-BzR0jtGH.mjs";
2
+ import { A as keywords, B as IR, C as Client$1, D as reserved, E as DollarTsDsl, F as TsDslContext, H as LazyOrAsync, I as ctx, L as CallArgs, M as TsDsl, N as TypeTsDsl, O as TypeScriptRenderer, P as ExampleOptions, R as OperationPath, S as Client$3, T as $, U as MaybeArray, V as Casing, _ as Client$2, a as Plugin, b as Client$5, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as MaybeTsDsl, k as regexp, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as Client, x as Client$4, y as Client$6, z as OperationStrategy } from "./config-kLkHIaUr.mjs";
3
3
  import "@hey-api/codegen-core";
4
4
 
5
5
  //#region src/generate.d.ts
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-PX3rDrOF.mjs";
3
- import { i as Logger, n as utils, r as createClient, t as defineConfig } from "./src-BCi83sdM.mjs";
2
+ import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-Ci-wjGgv.mjs";
3
+ import { i as Logger, n as utils, r as createClient, t as defineConfig } from "./src-CV7EsNIp.mjs";
4
4
 
5
5
  export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
package/dist/internal.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- const require_openApi = require('./openApi-BwUPqtP_.cjs');
2
+ const require_openApi = require('./openApi-BetJIgjU.cjs');
3
3
 
4
4
  exports.getSpec = require_openApi.getSpec;
5
5
  exports.initConfigs = require_openApi.initConfigs;
@@ -1,5 +1,5 @@
1
1
 
2
- import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-84ipCnU3.cjs";
2
+ import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-Cmhj4J0r.cjs";
3
3
  import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
4
4
 
5
5
  //#region src/config/init.d.ts
@@ -1,5 +1,5 @@
1
1
 
2
- import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-BzR0jtGH.mjs";
2
+ import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-kLkHIaUr.mjs";
3
3
  import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
4
4
 
5
5
  //#region src/config/init.d.ts
package/dist/internal.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- import { i as initConfigs, r as getSpec, t as parseOpenApiSpec } from "./openApi-PX3rDrOF.mjs";
2
+ import { i as initConfigs, r as getSpec, t as parseOpenApiSpec } from "./openApi-Ci-wjGgv.mjs";
3
3
 
4
4
  export { getSpec, initConfigs, parseOpenApiSpec };
@@ -540,66 +540,6 @@ const valueToObject = ({ defaultValue, mappers: mappers$1, value }) => {
540
540
  return result;
541
541
  };
542
542
 
543
- //#endregion
544
- //#region src/config/output/source/config.ts
545
- function resolveSource(config) {
546
- const source$2 = valueToObject({
547
- defaultValue: {
548
- enabled: Boolean(config.source),
549
- extension: "json",
550
- fileName: "source",
551
- serialize: (input) => JSON.stringify(input, null, 2)
552
- },
553
- mappers: { boolean: (enabled) => ({ enabled }) },
554
- value: config.source
555
- });
556
- if (source$2.path === void 0 || source$2.path === true) source$2.path = "";
557
- else if (source$2.path === false) source$2.path = null;
558
- return source$2;
559
- }
560
-
561
- //#endregion
562
- //#region src/config/output/config.ts
563
- function getOutput(userConfig) {
564
- if (userConfig.output instanceof Array) throw new Error("Unexpected array of outputs in user configuration. This should have been expanded already.");
565
- const output = valueToObject({
566
- defaultValue: {
567
- clean: true,
568
- fileName: {
569
- case: "preserve",
570
- name: "{{name}}",
571
- suffix: ".gen"
572
- },
573
- format: null,
574
- header: "// This file is auto-generated by @hey-api/openapi-ts",
575
- indexFile: true,
576
- lint: null,
577
- path: "",
578
- preferExportAll: false
579
- },
580
- mappers: {
581
- object: (fields, defaultValue) => ({
582
- ...fields,
583
- fileName: valueToObject({
584
- defaultValue: { ...defaultValue.fileName },
585
- mappers: {
586
- function: (name) => ({ name }),
587
- string: (name) => ({ name })
588
- },
589
- value: fields.fileName
590
- })
591
- }),
592
- string: (path$10) => ({ path: path$10 })
593
- },
594
- value: userConfig.output
595
- });
596
- output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath));
597
- if (output.importFileExtension === void 0 && (output.tsConfig?.options.moduleResolution === typescript.default.ModuleResolutionKind.NodeNext || output.tsConfig?.options.moduleResolution === typescript.default.ModuleResolutionKind.Node16)) output.importFileExtension = ".js";
598
- if (output.importFileExtension && !output.importFileExtension.startsWith(".")) output.importFileExtension = `.${output.importFileExtension}`;
599
- output.source = resolveSource(output);
600
- return output;
601
- }
602
-
603
543
  //#endregion
604
544
  //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
605
545
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1012,68 +952,169 @@ var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1012
952
  //#endregion
1013
953
  //#region src/config/output/postprocess.ts
1014
954
  var import_cross_spawn = require_cross_spawn();
1015
- /**
1016
- * Map of supported formatters
1017
- */
1018
- const formatters = {
1019
- biome: {
1020
- args: (path$10) => [
955
+ const postProcessors = {
956
+ "biome:format": {
957
+ args: [
1021
958
  "format",
1022
959
  "--write",
1023
- path$10
960
+ "{{path}}"
1024
961
  ],
1025
962
  command: "biome",
1026
963
  name: "Biome (Format)"
1027
964
  },
1028
- prettier: {
1029
- args: (path$10) => [
1030
- "--ignore-unknown",
1031
- path$10,
1032
- "--write",
1033
- "--ignore-path",
1034
- "./.prettierignore"
1035
- ],
1036
- command: "prettier",
1037
- name: "Prettier"
1038
- }
1039
- };
1040
- /**
1041
- * Map of supported linters
1042
- */
1043
- const linters = {
1044
- biome: {
1045
- args: (path$10) => [
965
+ "biome:lint": {
966
+ args: [
1046
967
  "lint",
1047
968
  "--apply",
1048
- path$10
969
+ "{{path}}"
1049
970
  ],
1050
971
  command: "biome",
1051
972
  name: "Biome (Lint)"
1052
973
  },
1053
974
  eslint: {
1054
- args: (path$10) => [path$10, "--fix"],
975
+ args: ["{{path}}", "--fix"],
1055
976
  command: "eslint",
1056
977
  name: "ESLint"
1057
978
  },
979
+ oxfmt: {
980
+ args: ["{{path}}"],
981
+ command: "oxfmt",
982
+ name: "Oxfmt"
983
+ },
1058
984
  oxlint: {
1059
- args: (path$10) => ["--fix", path$10],
985
+ args: ["--fix", "{{path}}"],
1060
986
  command: "oxlint",
1061
- name: "oxlint"
987
+ name: "Oxlint"
988
+ },
989
+ prettier: {
990
+ args: [
991
+ "--ignore-unknown",
992
+ "{{path}}",
993
+ "--write",
994
+ "--ignore-path",
995
+ "./.prettierignore"
996
+ ],
997
+ command: "prettier",
998
+ name: "Prettier"
1062
999
  }
1063
1000
  };
1064
- const postprocessOutput = (config) => {
1065
- if (config.lint) {
1066
- const module$1 = linters[config.lint];
1067
- console.log(`✨ Running ${module$1.name}`);
1068
- (0, import_cross_spawn.sync)(module$1.command, module$1.args(config.path));
1069
- }
1070
- if (config.format) {
1071
- const module$1 = formatters[config.format];
1072
- console.log(`✨ Running ${module$1.name}`);
1073
- (0, import_cross_spawn.sync)(module$1.command, module$1.args(config.path));
1001
+ const postprocessOutput = (config, jobPrefix) => {
1002
+ for (const processor of config.postProcess) {
1003
+ const resolved = typeof processor === "string" ? postProcessors[processor] : processor;
1004
+ const name = resolved.name ?? resolved.command;
1005
+ const args = resolved.args.map((arg) => arg.replace("{{path}}", config.path));
1006
+ console.log(`${jobPrefix}🧹 Running ${ansi_colors.default.cyanBright(name)}`);
1007
+ (0, import_cross_spawn.sync)(resolved.command, args);
1074
1008
  }
1075
1009
  };
1076
1010
 
1011
+ //#endregion
1012
+ //#region src/config/output/source/config.ts
1013
+ function resolveSource(config) {
1014
+ const source$2 = valueToObject({
1015
+ defaultValue: {
1016
+ enabled: Boolean(config.source),
1017
+ extension: "json",
1018
+ fileName: "source",
1019
+ serialize: (input) => JSON.stringify(input, null, 2)
1020
+ },
1021
+ mappers: { boolean: (enabled) => ({ enabled }) },
1022
+ value: config.source
1023
+ });
1024
+ if (source$2.path === void 0 || source$2.path === true) source$2.path = "";
1025
+ else if (source$2.path === false) source$2.path = null;
1026
+ return source$2;
1027
+ }
1028
+
1029
+ //#endregion
1030
+ //#region src/config/output/config.ts
1031
+ function getOutput(userConfig) {
1032
+ if (userConfig.output instanceof Array) throw new Error("Unexpected array of outputs in user configuration. This should have been expanded already.");
1033
+ const userOutput = typeof userConfig.output === "string" ? { path: userConfig.output } : userConfig.output ?? {};
1034
+ const legacyPostProcess = resolveLegacyPostProcess(userOutput);
1035
+ const output = valueToObject({
1036
+ defaultValue: {
1037
+ clean: true,
1038
+ fileName: {
1039
+ case: "preserve",
1040
+ name: "{{name}}",
1041
+ suffix: ".gen"
1042
+ },
1043
+ format: null,
1044
+ header: "// This file is auto-generated by @hey-api/openapi-ts",
1045
+ indexFile: true,
1046
+ lint: null,
1047
+ path: "",
1048
+ postProcess: [],
1049
+ preferExportAll: false
1050
+ },
1051
+ mappers: { object: (fields, defaultValue) => ({
1052
+ ...fields,
1053
+ fileName: valueToObject({
1054
+ defaultValue: { ...defaultValue.fileName },
1055
+ mappers: {
1056
+ function: (name) => ({ name }),
1057
+ string: (name) => ({ name })
1058
+ },
1059
+ value: fields.fileName
1060
+ })
1061
+ }) },
1062
+ value: userOutput
1063
+ });
1064
+ output.tsConfig = loadTsConfig(findTsConfigPath(output.tsConfigPath));
1065
+ if (output.importFileExtension === void 0 && (output.tsConfig?.options.moduleResolution === typescript.default.ModuleResolutionKind.NodeNext || output.tsConfig?.options.moduleResolution === typescript.default.ModuleResolutionKind.Node16)) output.importFileExtension = ".js";
1066
+ if (output.importFileExtension && !output.importFileExtension.startsWith(".")) output.importFileExtension = `.${output.importFileExtension}`;
1067
+ output.postProcess = normalizePostProcess(userOutput.postProcess ?? legacyPostProcess);
1068
+ output.source = resolveSource(output);
1069
+ return output;
1070
+ }
1071
+ function resolveLegacyPostProcess(config) {
1072
+ const result = [];
1073
+ if (config.lint !== void 0) {
1074
+ let processor;
1075
+ let preset;
1076
+ if (config.lint) {
1077
+ preset = config.lint === "biome" ? "biome:lint" : config.lint;
1078
+ processor = postProcessors[preset];
1079
+ if (processor) result.push(processor);
1080
+ }
1081
+ _hey_api_codegen_core.log.warnDeprecated({
1082
+ context: "output",
1083
+ field: "lint",
1084
+ replacement: `postProcess: [${processor && preset ? `'${preset}'` : ""}]`
1085
+ });
1086
+ }
1087
+ if (config.format !== void 0) {
1088
+ let processor;
1089
+ let preset;
1090
+ if (config.format) {
1091
+ preset = config.format === "biome" ? "biome:format" : config.format;
1092
+ processor = postProcessors[preset];
1093
+ if (processor) result.push(processor);
1094
+ }
1095
+ _hey_api_codegen_core.log.warnDeprecated({
1096
+ context: "output",
1097
+ field: "format",
1098
+ replacement: `postProcess: [${processor && preset ? `'${preset}'` : ""}]`
1099
+ });
1100
+ }
1101
+ return result;
1102
+ }
1103
+ function normalizePostProcess(input) {
1104
+ if (!input) return [];
1105
+ return input.map((item) => {
1106
+ if (typeof item === "string") {
1107
+ const preset = postProcessors[item];
1108
+ if (!preset) throw new Error(`Unknown post-processor preset: "${item}"`);
1109
+ return preset;
1110
+ }
1111
+ return {
1112
+ name: item.name ?? item.command,
1113
+ ...item
1114
+ };
1115
+ });
1116
+ }
1117
+
1077
1118
  //#endregion
1078
1119
  //#region src/config/packages.ts
1079
1120
  /**
@@ -21675,4 +21716,4 @@ Object.defineProperty(exports, 'toCase', {
21675
21716
  return toCase;
21676
21717
  }
21677
21718
  });
21678
- //# sourceMappingURL=openApi-BwUPqtP_.cjs.map
21719
+ //# sourceMappingURL=openApi-BetJIgjU.cjs.map