swagger-typescript-api 13.2.10 → 13.2.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # swagger-typescript-api
2
2
 
3
+ ## 13.2.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1420](https://github.com/acacode/swagger-typescript-api/pull/1420) [`426433b`](https://github.com/acacode/swagger-typescript-api/commit/426433b3f6144b6f28f0b79614df28dd3dea2012) Thanks [@smorimoto](https://github.com/smorimoto)! - Move `@types/lodash` and `openapi-types` to dependencies
8
+
9
+ These type packages are referenced by the published declarations, so consumers
10
+ require them at install time for correct type resolution. Moving them from
11
+ `devDependencies` prevents downstream TypeScript errors whilst having no
12
+ runtime impact.
13
+
14
+ ## 13.2.11
15
+
16
+ ### Patch Changes
17
+
18
+ - [#1390](https://github.com/acacode/swagger-typescript-api/pull/1390) [`5897e4b`](https://github.com/acacode/swagger-typescript-api/commit/5897e4ba1e3d21adf9ccb161bfc6eb0f1dde966c) Thanks [@MatanAvneri](https://github.com/MatanAvneri)! - Fix being able to call getComponentByRef from templates
19
+
20
+ - [#1393](https://github.com/acacode/swagger-typescript-api/pull/1393) [`9a7c788`](https://github.com/acacode/swagger-typescript-api/commit/9a7c788edc8efefbb8412bcc331e909b80ece317) Thanks [@RoCat](https://github.com/RoCat)! - Ensure discriminators are just after enums in components list to avoid cyclic errors
21
+
22
+ - [#1416](https://github.com/acacode/swagger-typescript-api/pull/1416) [`cd127a9`](https://github.com/acacode/swagger-typescript-api/commit/cd127a94e3386ef5eece740ba9335715fb7d13e0) Thanks [@smorimoto](https://github.com/smorimoto)! - Fix fetch client response parsing without re-reading body.
23
+
3
24
  ## 13.2.10
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  - Support for OpenAPI 3.0, 2.0, JSON and YAML
4
4
  - Generate the API Client for Fetch or Axios from an OpenAPI Specification
5
5
 
6
- Any questions you can ask [**here**](https://github.com/acacode/swagger-typescript-api/discussions)
6
+ Any questions you can ask here: <https://github.com/acacode/swagger-typescript-api/discussions>
7
7
 
8
8
  ## Examples
9
9
 
10
- All examples you can find [**here**](https://github.com/acacode/swagger-typescript-api/tree/main/tests)
10
+ All examples you can find here: <https://github.com/acacode/swagger-typescript-api/tree/main/tests>
11
11
 
12
12
  ## Usage
13
13
 
@@ -1,10 +1,12 @@
1
1
  //#region rolldown:runtime
2
2
  var __defProp = Object.defineProperty;
3
- var __export = (target, all) => {
3
+ var __export = (all) => {
4
+ let target = {};
4
5
  for (var name in all) __defProp(target, name, {
5
6
  get: all[name],
6
7
  enumerable: true
7
8
  });
9
+ return target;
8
10
  };
9
11
 
10
12
  //#endregion
package/dist/cli.cjs CHANGED
@@ -1,8 +1,11 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-C5bMYV9w.cjs');
3
- const node_path = require_src.__toESM(require("node:path"));
4
- const c12 = require_src.__toESM(require("c12"));
5
- const citty = require_src.__toESM(require("citty"));
2
+ const require_src = require('./src-Fy1zzbnV.cjs');
3
+ let node_path = require("node:path");
4
+ node_path = require_src.__toESM(node_path);
5
+ let c12 = require("c12");
6
+ c12 = require_src.__toESM(c12);
7
+ let citty = require("citty");
8
+ citty = require_src.__toESM(citty);
6
9
 
7
10
  //#region index.ts
8
11
  const templateGenBaseConfig = new require_src.TemplatesGenConfig({});
package/dist/cli.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["TemplatesGenConfig","HTTP_CLIENT","generateTemplates","CodeGenConfig","packageJson","generateApi","path"],"sources":["../index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\";\nimport { loadConfig } from \"c12\";\nimport { defineCommand, runMain } from \"citty\";\nimport packageJson from \"./package.json\" with { type: \"json\" };\nimport { TemplatesGenConfig } from \"./src/commands/generate-templates/configuration.js\";\nimport { CodeGenConfig } from \"./src/configuration.js\";\nimport { HTTP_CLIENT } from \"./src/constants.js\";\nimport { generateApi, generateTemplates } from \"./src/index.js\";\nimport type { GenerateApiParams, HttpClientType } from \"./types/index.js\";\n\nconst templateGenBaseConfig = new TemplatesGenConfig({});\n\nconst generateTemplatesCommand = defineCommand({\n meta: {\n name: \"generate-templates\",\n description: 'Generate \".ejs\" templates needed for generate api',\n },\n args: {\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate template. WARNING: May cause data loss\",\n default: templateGenBaseConfig.cleanOutput,\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: templateGenBaseConfig.debug,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n default: templateGenBaseConfig.httpClientType,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate templates needed to separate files for http client, data contracts, and routes\",\n default: templateGenBaseConfig.modular,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of generated templates\",\n default: templateGenBaseConfig.output,\n },\n rewrite: {\n type: \"boolean\",\n alias: \"r\",\n description: \"rewrite content in existing templates\",\n default: templateGenBaseConfig.rewrite,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: templateGenBaseConfig.silent,\n },\n },\n run: async ({ args }) => {\n await generateTemplates({\n cleanOutput: args[\"clean-output\"],\n httpClientType: args[\"http-client\"] as HttpClientType,\n modular: args.modular,\n output: args.output,\n rewrite: args.rewrite,\n silent: args.silent,\n debug: args.debug,\n });\n },\n});\n\nconst codeGenBaseConfig = new CodeGenConfig({});\n\nconst generateCommand = defineCommand({\n meta: {\n name: \"generate\",\n description: packageJson.description,\n },\n args: {\n \"add-readonly\": {\n type: \"boolean\",\n description: \"generate readonly properties\",\n default: codeGenBaseConfig.addReadonly,\n },\n \"another-array-type\": {\n type: \"boolean\",\n description: \"generate array types as Array<Type> (by default Type[])\",\n default: codeGenBaseConfig.anotherArrayType,\n },\n \"api-class-name\": {\n type: \"string\",\n description: \"name of the api class\",\n default: codeGenBaseConfig.apiClassName,\n },\n axios: {\n type: \"boolean\",\n description: \"generate axios http client\",\n default: false,\n },\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate api. WARNING: May cause data loss\",\n default: codeGenBaseConfig.cleanOutput,\n },\n client: {\n type: \"boolean\",\n description: \"do not generate an API class\",\n default: codeGenBaseConfig.generateClient,\n },\n \"custom-config\": {\n type: \"string\",\n description: \"custom config: primitiveTypeConstructs, hooks, ... \",\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: codeGenBaseConfig.debug,\n },\n \"default-as-success\": {\n type: \"boolean\",\n alias: \"d\",\n description:\n 'use \"default\" response status code as success response too. some swagger schemas use \"default\" response status code as success response type by default.',\n default: codeGenBaseConfig.defaultResponseAsSuccess,\n },\n \"default-response\": {\n type: \"string\",\n description: \"default type for empty response schema\",\n default: codeGenBaseConfig.defaultResponseType,\n },\n \"disable-throw-on-error\": {\n type: \"boolean\",\n description: \"Do not throw an error when response.ok is not true\",\n default: codeGenBaseConfig.disableThrowOnError,\n },\n \"enum-names-as-values\": {\n type: \"boolean\",\n description:\n \"use values in 'x-enumNames' as enum values (not only as keys)\",\n default: codeGenBaseConfig.enumNamesAsValues,\n },\n \"extract-enums\": {\n type: \"boolean\",\n description:\n \"extract all enums from inline interface/type content to typescript enum construction\",\n default: codeGenBaseConfig.extractEnums,\n },\n \"extract-request-body\": {\n type: \"boolean\",\n description: \"extract request body type to data contract\",\n default: codeGenBaseConfig.extractRequestBody,\n },\n \"extract-request-params\": {\n type: \"boolean\",\n description:\n \"extract request params to data contract (Also combine path params and query params into one object)\",\n default: codeGenBaseConfig.extractRequestParams,\n },\n \"extract-response-body\": {\n type: \"boolean\",\n description: \"extract response body type to data contract\",\n default: codeGenBaseConfig.extractResponseBody,\n },\n \"extract-response-error\": {\n type: \"boolean\",\n description: \"extract response error type to data contract\",\n default: codeGenBaseConfig.extractResponseError,\n },\n \"extract-responses\": {\n type: \"boolean\",\n description: \"extract all responses described in /components/responses\",\n default: codeGenBaseConfig.extractResponses,\n },\n \"generate-union-enums\": {\n type: \"boolean\",\n description: 'generate all \"enum\" types as union types (T1 | T2 | TN)',\n default: codeGenBaseConfig.generateUnionEnums,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n },\n js: {\n type: \"boolean\",\n description: \"generate js api module with declaration file\",\n default: codeGenBaseConfig.toJS,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate separated files for http client, data contracts, and routes\",\n default: codeGenBaseConfig.modular,\n },\n \"module-name-first-tag\": {\n type: \"boolean\",\n description: \"splits routes based on the first tag\",\n default: codeGenBaseConfig.moduleNameFirstTag,\n },\n \"module-name-index\": {\n type: \"string\",\n description:\n \"determines which path index should be used for routes separation (example: GET:/fruits/getFruit -> index:0 -> moduleName -> fruits)\",\n default: codeGenBaseConfig.moduleNameIndex.toString(),\n },\n name: {\n type: \"string\",\n alias: \"n\",\n description: \"name of output typescript api file\",\n default: codeGenBaseConfig.fileName,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of typescript api file\",\n default: \"./\",\n },\n patch: {\n type: \"boolean\",\n description: \"fix up small errors in the swagger source definition\",\n default: codeGenBaseConfig.patch,\n },\n path: {\n type: \"string\",\n alias: \"p\",\n description: \"path/url to swagger schema\",\n },\n responses: {\n type: \"boolean\",\n alias: \"r\",\n description:\n \"generate additional information about request responses also add typings for bad responses\",\n default: codeGenBaseConfig.generateResponses,\n },\n \"route-types\": {\n type: \"boolean\",\n description: \"generate type definitions for API routes\",\n default: codeGenBaseConfig.generateRouteTypes,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: codeGenBaseConfig.silent,\n },\n \"single-http-client\": {\n type: \"boolean\",\n description: \"Ability to send HttpClient instance to Api constructor\",\n default: codeGenBaseConfig.singleHttpClient,\n },\n \"sort-routes\": {\n type: \"boolean\",\n description: \"sort routes in alphabetical order\",\n default: codeGenBaseConfig.sortRoutes,\n },\n \"sort-types\": {\n type: \"boolean\",\n description: \"sort fields and types\",\n default: codeGenBaseConfig.sortTypes,\n },\n templates: {\n type: \"string\",\n alias: \"t\",\n description: \"path to folder containing templates\",\n },\n \"type-prefix\": {\n type: \"string\",\n description: \"data contract name prefix\",\n default: codeGenBaseConfig.typePrefix,\n },\n \"type-suffix\": {\n type: \"string\",\n description: \"data contract name suffix\",\n default: codeGenBaseConfig.typeSuffix,\n },\n \"unwrap-response-data\": {\n type: \"boolean\",\n description: \"unwrap the data item from the response\",\n default: codeGenBaseConfig.unwrapResponseData,\n },\n },\n run: async ({ args }) => {\n const customConfig = await loadConfig<GenerateApiParams>({\n name: \"swagger-typescript-api\",\n configFile: args[\"custom-config\"],\n });\n\n await generateApi({\n addReadonly: args[\"add-readonly\"],\n anotherArrayType: args[\"another-array-type\"],\n apiClassName: args[\"api-class-name\"],\n cleanOutput: args[\"clean-output\"],\n debug: args.debug,\n defaultResponseAsSuccess: args[\"default-as-success\"],\n defaultResponseType: args[\"default-response\"],\n disableThrowOnError: args[\"disable-throw-on-error\"],\n enumNamesAsValues: args[\"enum-names-as-values\"],\n extractEnums: args[\"extract-enums\"],\n extractRequestBody: args[\"extract-request-body\"],\n extractRequestParams: args[\"extract-request-params\"],\n extractResponseBody: args[\"extract-response-body\"],\n extractResponseError: args[\"extract-response-error\"],\n extractResponses: args[\"extract-responses\"],\n fileName: args.name,\n generateClient: args.client,\n generateResponses: args.responses,\n generateRouteTypes: args[\"route-types\"],\n generateUnionEnums: args[\"generate-union-enums\"],\n httpClientType:\n args[\"http-client\"] || args.axios\n ? HTTP_CLIENT.AXIOS\n : HTTP_CLIENT.FETCH,\n input: path.resolve(process.cwd(), args.path as string),\n modular: args.modular,\n moduleNameFirstTag: args[\"module-name-first-tag\"],\n moduleNameIndex: +args[\"module-name-index\"] || 0,\n output: path.resolve(process.cwd(), (args.output as string) || \".\"),\n patch: args.patch,\n silent: args.silent,\n singleHttpClient: args[\"single-http-client\"],\n sortRoutes: args[\"sort-routes\"],\n sortTypes: args[\"sort-types\"],\n templates: args.templates,\n toJS: args.js,\n typePrefix: args[\"type-prefix\"],\n typeSuffix: args[\"type-suffix\"],\n unwrapResponseData: args[\"unwrap-response-data\"],\n url: args.path,\n ...customConfig.config,\n });\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: packageJson.name,\n description: packageJson.description,\n version: packageJson.version,\n },\n subCommands: {\n generate: generateCommand,\n \"generate-templates\": generateTemplatesCommand,\n },\n});\n\nrunMain(main);\n"],"mappings":";;;;;;;AAYA,MAAM,wBAAwB,IAAIA,+BAAmB;AAErD,MAAM,oDAAyC;CAC7C,MAAM;EACJ,MAAM;EACN,aAAa;;CAEf,MAAM;EACJ,gBAAgB;GACd,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;;EAEjC,OAAO;GACL,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;;EAEjC,eAAe;GACb,MAAM;GACN,aAAa,sCAAsC,OAAO,OACxDC,yBACA;GACF,SAAS,sBAAsB;;EAEjC,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;;EAEjC,QAAQ;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;;EAEjC,SAAS;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;;EAEjC,QAAQ;GACN,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;;;CAGnC,KAAK,OAAO,EAAE,WAAW;AACvB,QAAMC,8BAAkB;GACtB,aAAa,KAAK;GAClB,gBAAgB,KAAK;GACrB,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,OAAO,KAAK;;;;AAKlB,MAAM,oBAAoB,IAAIC,0BAAc;AAE5C,MAAM,2CAAgC;CACpC,MAAM;EACJ,MAAM;EACN,aAAaC,4BAAY;;CAE3B,MAA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,cAAc,KAAK;GACnB,oBAAoB,KAAK;GACzB,sBAAsB,KAAK;GAC3B,qBAAqB,KAAK;GAC1B,sBAAsB,KAAK;GAC3B,kBAAkB,KAAK;GACvB,UAAU,KAAK;GACf,gBAAgB,KAAK;GACrB,mBAAmB,KAAK;GACxB,oBAAoB,KAAK;GACzB,oBAAoB,KAAK;GACzB,gBACE,KAAK,kBAAkB,KAAK,QACxBJ,wBAAY,QACZA,wBAAY;GAClB,OAAOK,UAAK,QAAQ,QAAQ,OAAO,KAAK;GACxC,SAAS,KAAK;GACd,oBAAoB,KAAK;GACzB,iBAAiB,CAAC,KAAK,wBAAwB;GAC/C,QAAQA,UAAK,QAAQ,QAAQ,OAAQ,KAAK,UAAqB;GAC/D,OAAO,KAAK;GACZ,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,WAAW,KAAK;GAChB,MAAM,KAAK;GACX,YAAY,KAAK;GACjB,YAAY,KAAK;GACjB,oBAAoB,KAAK;GACzB,KAAK,KAAK;GACV,GAAG,aAAa;;;;AAKtB,MAAM,gCAAqB;CACzB,MAAM;EACJ,MAAMF,4BAAY;EAClB,aAAaA,4BAAY;EACzB,SAASA,4BAAY;;CAEvB,aAAa;EACX,UAAU;EACV,sBAAsB;;;mBAIlB"}
1
+ {"version":3,"file":"cli.cjs","names":["TemplatesGenConfig","HTTP_CLIENT","generateTemplates","CodeGenConfig","packageJson","generateApi","path"],"sources":["../index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\";\nimport { loadConfig } from \"c12\";\nimport { defineCommand, runMain } from \"citty\";\nimport packageJson from \"./package.json\" with { type: \"json\" };\nimport { TemplatesGenConfig } from \"./src/commands/generate-templates/configuration.js\";\nimport { CodeGenConfig } from \"./src/configuration.js\";\nimport { HTTP_CLIENT } from \"./src/constants.js\";\nimport { generateApi, generateTemplates } from \"./src/index.js\";\nimport type { GenerateApiParams, HttpClientType } from \"./types/index.js\";\n\nconst templateGenBaseConfig = new TemplatesGenConfig({});\n\nconst generateTemplatesCommand = defineCommand({\n meta: {\n name: \"generate-templates\",\n description: 'Generate \".ejs\" templates needed for generate api',\n },\n args: {\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate template. WARNING: May cause data loss\",\n default: templateGenBaseConfig.cleanOutput,\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: templateGenBaseConfig.debug,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n default: templateGenBaseConfig.httpClientType,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate templates needed to separate files for http client, data contracts, and routes\",\n default: templateGenBaseConfig.modular,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of generated templates\",\n default: templateGenBaseConfig.output,\n },\n rewrite: {\n type: \"boolean\",\n alias: \"r\",\n description: \"rewrite content in existing templates\",\n default: templateGenBaseConfig.rewrite,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: templateGenBaseConfig.silent,\n },\n },\n run: async ({ args }) => {\n await generateTemplates({\n cleanOutput: args[\"clean-output\"],\n httpClientType: args[\"http-client\"] as HttpClientType,\n modular: args.modular,\n output: args.output,\n rewrite: args.rewrite,\n silent: args.silent,\n debug: args.debug,\n });\n },\n});\n\nconst codeGenBaseConfig = new CodeGenConfig({});\n\nconst generateCommand = defineCommand({\n meta: {\n name: \"generate\",\n description: packageJson.description,\n },\n args: {\n \"add-readonly\": {\n type: \"boolean\",\n description: \"generate readonly properties\",\n default: codeGenBaseConfig.addReadonly,\n },\n \"another-array-type\": {\n type: \"boolean\",\n description: \"generate array types as Array<Type> (by default Type[])\",\n default: codeGenBaseConfig.anotherArrayType,\n },\n \"api-class-name\": {\n type: \"string\",\n description: \"name of the api class\",\n default: codeGenBaseConfig.apiClassName,\n },\n axios: {\n type: \"boolean\",\n description: \"generate axios http client\",\n default: false,\n },\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate api. WARNING: May cause data loss\",\n default: codeGenBaseConfig.cleanOutput,\n },\n client: {\n type: \"boolean\",\n description: \"do not generate an API class\",\n default: codeGenBaseConfig.generateClient,\n },\n \"custom-config\": {\n type: \"string\",\n description: \"custom config: primitiveTypeConstructs, hooks, ... \",\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: codeGenBaseConfig.debug,\n },\n \"default-as-success\": {\n type: \"boolean\",\n alias: \"d\",\n description:\n 'use \"default\" response status code as success response too. some swagger schemas use \"default\" response status code as success response type by default.',\n default: codeGenBaseConfig.defaultResponseAsSuccess,\n },\n \"default-response\": {\n type: \"string\",\n description: \"default type for empty response schema\",\n default: codeGenBaseConfig.defaultResponseType,\n },\n \"disable-throw-on-error\": {\n type: \"boolean\",\n description: \"Do not throw an error when response.ok is not true\",\n default: codeGenBaseConfig.disableThrowOnError,\n },\n \"enum-names-as-values\": {\n type: \"boolean\",\n description:\n \"use values in 'x-enumNames' as enum values (not only as keys)\",\n default: codeGenBaseConfig.enumNamesAsValues,\n },\n \"extract-enums\": {\n type: \"boolean\",\n description:\n \"extract all enums from inline interface/type content to typescript enum construction\",\n default: codeGenBaseConfig.extractEnums,\n },\n \"extract-request-body\": {\n type: \"boolean\",\n description: \"extract request body type to data contract\",\n default: codeGenBaseConfig.extractRequestBody,\n },\n \"extract-request-params\": {\n type: \"boolean\",\n description:\n \"extract request params to data contract (Also combine path params and query params into one object)\",\n default: codeGenBaseConfig.extractRequestParams,\n },\n \"extract-response-body\": {\n type: \"boolean\",\n description: \"extract response body type to data contract\",\n default: codeGenBaseConfig.extractResponseBody,\n },\n \"extract-response-error\": {\n type: \"boolean\",\n description: \"extract response error type to data contract\",\n default: codeGenBaseConfig.extractResponseError,\n },\n \"extract-responses\": {\n type: \"boolean\",\n description: \"extract all responses described in /components/responses\",\n default: codeGenBaseConfig.extractResponses,\n },\n \"generate-union-enums\": {\n type: \"boolean\",\n description: 'generate all \"enum\" types as union types (T1 | T2 | TN)',\n default: codeGenBaseConfig.generateUnionEnums,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n },\n js: {\n type: \"boolean\",\n description: \"generate js api module with declaration file\",\n default: codeGenBaseConfig.toJS,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate separated files for http client, data contracts, and routes\",\n default: codeGenBaseConfig.modular,\n },\n \"module-name-first-tag\": {\n type: \"boolean\",\n description: \"splits routes based on the first tag\",\n default: codeGenBaseConfig.moduleNameFirstTag,\n },\n \"module-name-index\": {\n type: \"string\",\n description:\n \"determines which path index should be used for routes separation (example: GET:/fruits/getFruit -> index:0 -> moduleName -> fruits)\",\n default: codeGenBaseConfig.moduleNameIndex.toString(),\n },\n name: {\n type: \"string\",\n alias: \"n\",\n description: \"name of output typescript api file\",\n default: codeGenBaseConfig.fileName,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of typescript api file\",\n default: \"./\",\n },\n patch: {\n type: \"boolean\",\n description: \"fix up small errors in the swagger source definition\",\n default: codeGenBaseConfig.patch,\n },\n path: {\n type: \"string\",\n alias: \"p\",\n description: \"path/url to swagger schema\",\n },\n responses: {\n type: \"boolean\",\n alias: \"r\",\n description:\n \"generate additional information about request responses also add typings for bad responses\",\n default: codeGenBaseConfig.generateResponses,\n },\n \"route-types\": {\n type: \"boolean\",\n description: \"generate type definitions for API routes\",\n default: codeGenBaseConfig.generateRouteTypes,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: codeGenBaseConfig.silent,\n },\n \"single-http-client\": {\n type: \"boolean\",\n description: \"Ability to send HttpClient instance to Api constructor\",\n default: codeGenBaseConfig.singleHttpClient,\n },\n \"sort-routes\": {\n type: \"boolean\",\n description: \"sort routes in alphabetical order\",\n default: codeGenBaseConfig.sortRoutes,\n },\n \"sort-types\": {\n type: \"boolean\",\n description: \"sort fields and types\",\n default: codeGenBaseConfig.sortTypes,\n },\n templates: {\n type: \"string\",\n alias: \"t\",\n description: \"path to folder containing templates\",\n },\n \"type-prefix\": {\n type: \"string\",\n description: \"data contract name prefix\",\n default: codeGenBaseConfig.typePrefix,\n },\n \"type-suffix\": {\n type: \"string\",\n description: \"data contract name suffix\",\n default: codeGenBaseConfig.typeSuffix,\n },\n \"unwrap-response-data\": {\n type: \"boolean\",\n description: \"unwrap the data item from the response\",\n default: codeGenBaseConfig.unwrapResponseData,\n },\n },\n run: async ({ args }) => {\n const customConfig = await loadConfig<GenerateApiParams>({\n name: \"swagger-typescript-api\",\n configFile: args[\"custom-config\"],\n });\n\n await generateApi({\n addReadonly: args[\"add-readonly\"],\n anotherArrayType: args[\"another-array-type\"],\n apiClassName: args[\"api-class-name\"],\n cleanOutput: args[\"clean-output\"],\n debug: args.debug,\n defaultResponseAsSuccess: args[\"default-as-success\"],\n defaultResponseType: args[\"default-response\"],\n disableThrowOnError: args[\"disable-throw-on-error\"],\n enumNamesAsValues: args[\"enum-names-as-values\"],\n extractEnums: args[\"extract-enums\"],\n extractRequestBody: args[\"extract-request-body\"],\n extractRequestParams: args[\"extract-request-params\"],\n extractResponseBody: args[\"extract-response-body\"],\n extractResponseError: args[\"extract-response-error\"],\n extractResponses: args[\"extract-responses\"],\n fileName: args.name,\n generateClient: args.client,\n generateResponses: args.responses,\n generateRouteTypes: args[\"route-types\"],\n generateUnionEnums: args[\"generate-union-enums\"],\n httpClientType:\n args[\"http-client\"] || args.axios\n ? HTTP_CLIENT.AXIOS\n : HTTP_CLIENT.FETCH,\n input: path.resolve(process.cwd(), args.path as string),\n modular: args.modular,\n moduleNameFirstTag: args[\"module-name-first-tag\"],\n moduleNameIndex: +args[\"module-name-index\"] || 0,\n output: path.resolve(process.cwd(), (args.output as string) || \".\"),\n patch: args.patch,\n silent: args.silent,\n singleHttpClient: args[\"single-http-client\"],\n sortRoutes: args[\"sort-routes\"],\n sortTypes: args[\"sort-types\"],\n templates: args.templates,\n toJS: args.js,\n typePrefix: args[\"type-prefix\"],\n typeSuffix: args[\"type-suffix\"],\n unwrapResponseData: args[\"unwrap-response-data\"],\n url: args.path,\n ...customConfig.config,\n });\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: packageJson.name,\n description: packageJson.description,\n version: packageJson.version,\n },\n subCommands: {\n generate: generateCommand,\n \"generate-templates\": generateTemplatesCommand,\n },\n});\n\nrunMain(main);\n"],"mappings":";;;;;;;;;;AAYA,MAAM,wBAAwB,IAAIA,+BAAmB,EAAE,CAAC;AAExD,MAAM,oDAAyC;CAC7C,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,gBAAgB;GACd,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;GAChC;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,eAAe;GACb,MAAM;GACN,aAAa,sCAAsC,OAAO,OACxDC,wBACD,CAAC;GACF,SAAS,sBAAsB;GAChC;EACD,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;GAChC;EACD,QAAQ;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,SAAS;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;GAChC;EACF;CACD,KAAK,OAAO,EAAE,WAAW;AACvB,QAAMC,8BAAkB;GACtB,aAAa,KAAK;GAClB,gBAAgB,KAAK;GACrB,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,OAAO,KAAK;GACb,CAAC;;CAEL,CAAC;AAEF,MAAM,oBAAoB,IAAIC,0BAAc,EAAE,CAAC;AAE/C,MAAM,2CAAgC;CACpC,MAAM;EACJ,MAAM;EACN,aAAaC,4BAAY;EAC1B;CACD,MAAM;EACJ,gBAAgB;GACd,MAA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;GACnB,aAAa,KAAK;GAClB,OAAO,KAAK;GACZ,0BAA0B,KAAK;GAC/B,qBAAqB,KAAK;GAC1B,qBAAqB,KAAK;GAC1B,mBAAmB,KAAK;GACxB,cAAc,KAAK;GACnB,oBAAoB,KAAK;GACzB,sBAAsB,KAAK;GAC3B,qBAAqB,KAAK;GAC1B,sBAAsB,KAAK;GAC3B,kBAAkB,KAAK;GACvB,UAAU,KAAK;GACf,gBAAgB,KAAK;GACrB,mBAAmB,KAAK;GACxB,oBAAoB,KAAK;GACzB,oBAAoB,KAAK;GACzB,gBACE,KAAK,kBAAkB,KAAK,QACxBJ,wBAAY,QACZA,wBAAY;GAClB,OAAOK,UAAK,QAAQ,QAAQ,KAAK,EAAE,KAAK,KAAe;GACvD,SAAS,KAAK;GACd,oBAAoB,KAAK;GACzB,iBAAiB,CAAC,KAAK,wBAAwB;GAC/C,QAAQA,UAAK,QAAQ,QAAQ,KAAK,EAAG,KAAK,UAAqB,IAAI;GACnE,OAAO,KAAK;GACZ,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,WAAW,KAAK;GAChB,MAAM,KAAK;GACX,YAAY,KAAK;GACjB,YAAY,KAAK;GACjB,oBAAoB,KAAK;GACzB,KAAK,KAAK;GACV,GAAG,aAAa;GACjB,CAAC;;CAEL,CAAC;AAEF,MAAM,gCAAqB;CACzB,MAAM;EACJ,MAAMF,4BAAY;EAClB,aAAaA,4BAAY;EACzB,SAASA,4BAAY;EACtB;CACD,aAAa;EACX,UAAU;EACV,sBAAsB;EACvB;CACF,CAAC;mBAEM,KAAK"}
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-s8addnrG.js";
2
+ import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-LjX9fiRq.js";
3
3
  import * as path$1 from "node:path";
4
4
  import { loadConfig } from "c12";
5
5
  import { defineCommand, runMain } from "citty";
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":["packageJson","path"],"sources":["../index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\";\nimport { loadConfig } from \"c12\";\nimport { defineCommand, runMain } from \"citty\";\nimport packageJson from \"./package.json\" with { type: \"json\" };\nimport { TemplatesGenConfig } from \"./src/commands/generate-templates/configuration.js\";\nimport { CodeGenConfig } from \"./src/configuration.js\";\nimport { HTTP_CLIENT } from \"./src/constants.js\";\nimport { generateApi, generateTemplates } from \"./src/index.js\";\nimport type { GenerateApiParams, HttpClientType } from \"./types/index.js\";\n\nconst templateGenBaseConfig = new TemplatesGenConfig({});\n\nconst generateTemplatesCommand = defineCommand({\n meta: {\n name: \"generate-templates\",\n description: 'Generate \".ejs\" templates needed for generate api',\n },\n args: {\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate template. WARNING: May cause data loss\",\n default: templateGenBaseConfig.cleanOutput,\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: templateGenBaseConfig.debug,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n default: templateGenBaseConfig.httpClientType,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate templates needed to separate files for http client, data contracts, and routes\",\n default: templateGenBaseConfig.modular,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of generated templates\",\n default: templateGenBaseConfig.output,\n },\n rewrite: {\n type: \"boolean\",\n alias: \"r\",\n description: \"rewrite content in existing templates\",\n default: templateGenBaseConfig.rewrite,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: templateGenBaseConfig.silent,\n },\n },\n run: async ({ args }) => {\n await generateTemplates({\n cleanOutput: args[\"clean-output\"],\n httpClientType: args[\"http-client\"] as HttpClientType,\n modular: args.modular,\n output: args.output,\n rewrite: args.rewrite,\n silent: args.silent,\n debug: args.debug,\n });\n },\n});\n\nconst codeGenBaseConfig = new CodeGenConfig({});\n\nconst generateCommand = defineCommand({\n meta: {\n name: \"generate\",\n description: packageJson.description,\n },\n args: {\n \"add-readonly\": {\n type: \"boolean\",\n description: \"generate readonly properties\",\n default: codeGenBaseConfig.addReadonly,\n },\n \"another-array-type\": {\n type: \"boolean\",\n description: \"generate array types as Array<Type> (by default Type[])\",\n default: codeGenBaseConfig.anotherArrayType,\n },\n \"api-class-name\": {\n type: \"string\",\n description: \"name of the api class\",\n default: codeGenBaseConfig.apiClassName,\n },\n axios: {\n type: \"boolean\",\n description: \"generate axios http client\",\n default: false,\n },\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate api. WARNING: May cause data loss\",\n default: codeGenBaseConfig.cleanOutput,\n },\n client: {\n type: \"boolean\",\n description: \"do not generate an API class\",\n default: codeGenBaseConfig.generateClient,\n },\n \"custom-config\": {\n type: \"string\",\n description: \"custom config: primitiveTypeConstructs, hooks, ... \",\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: codeGenBaseConfig.debug,\n },\n \"default-as-success\": {\n type: \"boolean\",\n alias: \"d\",\n description:\n 'use \"default\" response status code as success response too. some swagger schemas use \"default\" response status code as success response type by default.',\n default: codeGenBaseConfig.defaultResponseAsSuccess,\n },\n \"default-response\": {\n type: \"string\",\n description: \"default type for empty response schema\",\n default: codeGenBaseConfig.defaultResponseType,\n },\n \"disable-throw-on-error\": {\n type: \"boolean\",\n description: \"Do not throw an error when response.ok is not true\",\n default: codeGenBaseConfig.disableThrowOnError,\n },\n \"enum-names-as-values\": {\n type: \"boolean\",\n description:\n \"use values in 'x-enumNames' as enum values (not only as keys)\",\n default: codeGenBaseConfig.enumNamesAsValues,\n },\n \"extract-enums\": {\n type: \"boolean\",\n description:\n \"extract all enums from inline interface/type content to typescript enum construction\",\n default: codeGenBaseConfig.extractEnums,\n },\n \"extract-request-body\": {\n type: \"boolean\",\n description: \"extract request body type to data contract\",\n default: codeGenBaseConfig.extractRequestBody,\n },\n \"extract-request-params\": {\n type: \"boolean\",\n description:\n \"extract request params to data contract (Also combine path params and query params into one object)\",\n default: codeGenBaseConfig.extractRequestParams,\n },\n \"extract-response-body\": {\n type: \"boolean\",\n description: \"extract response body type to data contract\",\n default: codeGenBaseConfig.extractResponseBody,\n },\n \"extract-response-error\": {\n type: \"boolean\",\n description: \"extract response error type to data contract\",\n default: codeGenBaseConfig.extractResponseError,\n },\n \"extract-responses\": {\n type: \"boolean\",\n description: \"extract all responses described in /components/responses\",\n default: codeGenBaseConfig.extractResponses,\n },\n \"generate-union-enums\": {\n type: \"boolean\",\n description: 'generate all \"enum\" types as union types (T1 | T2 | TN)',\n default: codeGenBaseConfig.generateUnionEnums,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n },\n js: {\n type: \"boolean\",\n description: \"generate js api module with declaration file\",\n default: codeGenBaseConfig.toJS,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate separated files for http client, data contracts, and routes\",\n default: codeGenBaseConfig.modular,\n },\n \"module-name-first-tag\": {\n type: \"boolean\",\n description: \"splits routes based on the first tag\",\n default: codeGenBaseConfig.moduleNameFirstTag,\n },\n \"module-name-index\": {\n type: \"string\",\n description:\n \"determines which path index should be used for routes separation (example: GET:/fruits/getFruit -> index:0 -> moduleName -> fruits)\",\n default: codeGenBaseConfig.moduleNameIndex.toString(),\n },\n name: {\n type: \"string\",\n alias: \"n\",\n description: \"name of output typescript api file\",\n default: codeGenBaseConfig.fileName,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of typescript api file\",\n default: \"./\",\n },\n patch: {\n type: \"boolean\",\n description: \"fix up small errors in the swagger source definition\",\n default: codeGenBaseConfig.patch,\n },\n path: {\n type: \"string\",\n alias: \"p\",\n description: \"path/url to swagger schema\",\n },\n responses: {\n type: \"boolean\",\n alias: \"r\",\n description:\n \"generate additional information about request responses also add typings for bad responses\",\n default: codeGenBaseConfig.generateResponses,\n },\n \"route-types\": {\n type: \"boolean\",\n description: \"generate type definitions for API routes\",\n default: codeGenBaseConfig.generateRouteTypes,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: codeGenBaseConfig.silent,\n },\n \"single-http-client\": {\n type: \"boolean\",\n description: \"Ability to send HttpClient instance to Api constructor\",\n default: codeGenBaseConfig.singleHttpClient,\n },\n \"sort-routes\": {\n type: \"boolean\",\n description: \"sort routes in alphabetical order\",\n default: codeGenBaseConfig.sortRoutes,\n },\n \"sort-types\": {\n type: \"boolean\",\n description: \"sort fields and types\",\n default: codeGenBaseConfig.sortTypes,\n },\n templates: {\n type: \"string\",\n alias: \"t\",\n description: \"path to folder containing templates\",\n },\n \"type-prefix\": {\n type: \"string\",\n description: \"data contract name prefix\",\n default: codeGenBaseConfig.typePrefix,\n },\n \"type-suffix\": {\n type: \"string\",\n description: \"data contract name suffix\",\n default: codeGenBaseConfig.typeSuffix,\n },\n \"unwrap-response-data\": {\n type: \"boolean\",\n description: \"unwrap the data item from the response\",\n default: codeGenBaseConfig.unwrapResponseData,\n },\n },\n run: async ({ args }) => {\n const customConfig = await loadConfig<GenerateApiParams>({\n name: \"swagger-typescript-api\",\n configFile: args[\"custom-config\"],\n });\n\n await generateApi({\n addReadonly: args[\"add-readonly\"],\n anotherArrayType: args[\"another-array-type\"],\n apiClassName: args[\"api-class-name\"],\n cleanOutput: args[\"clean-output\"],\n debug: args.debug,\n defaultResponseAsSuccess: args[\"default-as-success\"],\n defaultResponseType: args[\"default-response\"],\n disableThrowOnError: args[\"disable-throw-on-error\"],\n enumNamesAsValues: args[\"enum-names-as-values\"],\n extractEnums: args[\"extract-enums\"],\n extractRequestBody: args[\"extract-request-body\"],\n extractRequestParams: args[\"extract-request-params\"],\n extractResponseBody: args[\"extract-response-body\"],\n extractResponseError: args[\"extract-response-error\"],\n extractResponses: args[\"extract-responses\"],\n fileName: args.name,\n generateClient: args.client,\n generateResponses: args.responses,\n generateRouteTypes: args[\"route-types\"],\n generateUnionEnums: args[\"generate-union-enums\"],\n httpClientType:\n args[\"http-client\"] || args.axios\n ? HTTP_CLIENT.AXIOS\n : HTTP_CLIENT.FETCH,\n input: path.resolve(process.cwd(), args.path as string),\n modular: args.modular,\n moduleNameFirstTag: args[\"module-name-first-tag\"],\n moduleNameIndex: +args[\"module-name-index\"] || 0,\n output: path.resolve(process.cwd(), (args.output as string) || \".\"),\n patch: args.patch,\n silent: args.silent,\n singleHttpClient: args[\"single-http-client\"],\n sortRoutes: args[\"sort-routes\"],\n sortTypes: args[\"sort-types\"],\n templates: args.templates,\n toJS: args.js,\n typePrefix: args[\"type-prefix\"],\n typeSuffix: args[\"type-suffix\"],\n unwrapResponseData: args[\"unwrap-response-data\"],\n url: args.path,\n ...customConfig.config,\n });\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: packageJson.name,\n description: packageJson.description,\n version: packageJson.version,\n },\n subCommands: {\n generate: generateCommand,\n \"generate-templates\": generateTemplatesCommand,\n },\n});\n\nrunMain(main);\n"],"mappings":";;;;;;;AAYA,MAAM,wBAAwB,IAAI,mBAAmB;AAErD,MAAM,2BAA2B,cAAc;CAC7C,MAAM;EACJ,MAAM;EACN,aAAa;;CAEf,MAAM;EACJ,gBAAgB;GACd,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;;EAEjC,OAAO;GACL,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;;EAEjC,eAAe;GACb,MAAM;GACN,aAAa,sCAAsC,OAAO,OACxD,aACA;GACF,SAAS,sBAAsB;;EAEjC,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;;EAEjC,QAAQ;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;;EAEjC,SAAS;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS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ources":["../index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\";\nimport { loadConfig } from \"c12\";\nimport { defineCommand, runMain } from \"citty\";\nimport packageJson from \"./package.json\" with { type: \"json\" };\nimport { TemplatesGenConfig } from \"./src/commands/generate-templates/configuration.js\";\nimport { CodeGenConfig } from \"./src/configuration.js\";\nimport { HTTP_CLIENT } from \"./src/constants.js\";\nimport { generateApi, generateTemplates } from \"./src/index.js\";\nimport type { GenerateApiParams, HttpClientType } from \"./types/index.js\";\n\nconst templateGenBaseConfig = new TemplatesGenConfig({});\n\nconst generateTemplatesCommand = defineCommand({\n meta: {\n name: \"generate-templates\",\n description: 'Generate \".ejs\" templates needed for generate api',\n },\n args: {\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate template. WARNING: May cause data loss\",\n default: templateGenBaseConfig.cleanOutput,\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: templateGenBaseConfig.debug,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n default: templateGenBaseConfig.httpClientType,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate templates needed to separate files for http client, data contracts, and routes\",\n default: templateGenBaseConfig.modular,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of generated templates\",\n default: templateGenBaseConfig.output,\n },\n rewrite: {\n type: \"boolean\",\n alias: \"r\",\n description: \"rewrite content in existing templates\",\n default: templateGenBaseConfig.rewrite,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: templateGenBaseConfig.silent,\n },\n },\n run: async ({ args }) => {\n await generateTemplates({\n cleanOutput: args[\"clean-output\"],\n httpClientType: args[\"http-client\"] as HttpClientType,\n modular: args.modular,\n output: args.output,\n rewrite: args.rewrite,\n silent: args.silent,\n debug: args.debug,\n });\n },\n});\n\nconst codeGenBaseConfig = new CodeGenConfig({});\n\nconst generateCommand = defineCommand({\n meta: {\n name: \"generate\",\n description: packageJson.description,\n },\n args: {\n \"add-readonly\": {\n type: \"boolean\",\n description: \"generate readonly properties\",\n default: codeGenBaseConfig.addReadonly,\n },\n \"another-array-type\": {\n type: \"boolean\",\n description: \"generate array types as Array<Type> (by default Type[])\",\n default: codeGenBaseConfig.anotherArrayType,\n },\n \"api-class-name\": {\n type: \"string\",\n description: \"name of the api class\",\n default: codeGenBaseConfig.apiClassName,\n },\n axios: {\n type: \"boolean\",\n description: \"generate axios http client\",\n default: false,\n },\n \"clean-output\": {\n type: \"boolean\",\n description:\n \"clean output folder before generate api. WARNING: May cause data loss\",\n default: codeGenBaseConfig.cleanOutput,\n },\n client: {\n type: \"boolean\",\n description: \"do not generate an API class\",\n default: codeGenBaseConfig.generateClient,\n },\n \"custom-config\": {\n type: \"string\",\n description: \"custom config: primitiveTypeConstructs, hooks, ... \",\n },\n debug: {\n type: \"boolean\",\n description: \"additional information about processes inside this tool\",\n default: codeGenBaseConfig.debug,\n },\n \"default-as-success\": {\n type: \"boolean\",\n alias: \"d\",\n description:\n 'use \"default\" response status code as success response too. some swagger schemas use \"default\" response status code as success response type by default.',\n default: codeGenBaseConfig.defaultResponseAsSuccess,\n },\n \"default-response\": {\n type: \"string\",\n description: \"default type for empty response schema\",\n default: codeGenBaseConfig.defaultResponseType,\n },\n \"disable-throw-on-error\": {\n type: \"boolean\",\n description: \"Do not throw an error when response.ok is not true\",\n default: codeGenBaseConfig.disableThrowOnError,\n },\n \"enum-names-as-values\": {\n type: \"boolean\",\n description:\n \"use values in 'x-enumNames' as enum values (not only as keys)\",\n default: codeGenBaseConfig.enumNamesAsValues,\n },\n \"extract-enums\": {\n type: \"boolean\",\n description:\n \"extract all enums from inline interface/type content to typescript enum construction\",\n default: codeGenBaseConfig.extractEnums,\n },\n \"extract-request-body\": {\n type: \"boolean\",\n description: \"extract request body type to data contract\",\n default: codeGenBaseConfig.extractRequestBody,\n },\n \"extract-request-params\": {\n type: \"boolean\",\n description:\n \"extract request params to data contract (Also combine path params and query params into one object)\",\n default: codeGenBaseConfig.extractRequestParams,\n },\n \"extract-response-body\": {\n type: \"boolean\",\n description: \"extract response body type to data contract\",\n default: codeGenBaseConfig.extractResponseBody,\n },\n \"extract-response-error\": {\n type: \"boolean\",\n description: \"extract response error type to data contract\",\n default: codeGenBaseConfig.extractResponseError,\n },\n \"extract-responses\": {\n type: \"boolean\",\n description: \"extract all responses described in /components/responses\",\n default: codeGenBaseConfig.extractResponses,\n },\n \"generate-union-enums\": {\n type: \"boolean\",\n description: 'generate all \"enum\" types as union types (T1 | T2 | TN)',\n default: codeGenBaseConfig.generateUnionEnums,\n },\n \"http-client\": {\n type: \"string\",\n description: `http client type (possible values: ${Object.values(\n HTTP_CLIENT,\n )})`,\n },\n js: {\n type: \"boolean\",\n description: \"generate js api module with declaration file\",\n default: codeGenBaseConfig.toJS,\n },\n modular: {\n type: \"boolean\",\n description:\n \"generate separated files for http client, data contracts, and routes\",\n default: codeGenBaseConfig.modular,\n },\n \"module-name-first-tag\": {\n type: \"boolean\",\n description: \"splits routes based on the first tag\",\n default: codeGenBaseConfig.moduleNameFirstTag,\n },\n \"module-name-index\": {\n type: \"string\",\n description:\n \"determines which path index should be used for routes separation (example: GET:/fruits/getFruit -> index:0 -> moduleName -> fruits)\",\n default: codeGenBaseConfig.moduleNameIndex.toString(),\n },\n name: {\n type: \"string\",\n alias: \"n\",\n description: \"name of output typescript api file\",\n default: codeGenBaseConfig.fileName,\n },\n output: {\n type: \"string\",\n alias: \"o\",\n description: \"output path of typescript api file\",\n default: \"./\",\n },\n patch: {\n type: \"boolean\",\n description: \"fix up small errors in the swagger source definition\",\n default: codeGenBaseConfig.patch,\n },\n path: {\n type: \"string\",\n alias: \"p\",\n description: \"path/url to swagger schema\",\n },\n responses: {\n type: \"boolean\",\n alias: \"r\",\n description:\n \"generate additional information about request responses also add typings for bad responses\",\n default: codeGenBaseConfig.generateResponses,\n },\n \"route-types\": {\n type: \"boolean\",\n description: \"generate type definitions for API routes\",\n default: codeGenBaseConfig.generateRouteTypes,\n },\n silent: {\n type: \"boolean\",\n description: \"Output only errors to console\",\n default: codeGenBaseConfig.silent,\n },\n \"single-http-client\": {\n type: \"boolean\",\n description: \"Ability to send HttpClient instance to Api constructor\",\n default: codeGenBaseConfig.singleHttpClient,\n },\n \"sort-routes\": {\n type: \"boolean\",\n description: \"sort routes in alphabetical order\",\n default: codeGenBaseConfig.sortRoutes,\n },\n \"sort-types\": {\n type: \"boolean\",\n description: \"sort fields and types\",\n default: codeGenBaseConfig.sortTypes,\n },\n templates: {\n type: \"string\",\n alias: \"t\",\n description: \"path to folder containing templates\",\n },\n \"type-prefix\": {\n type: \"string\",\n description: \"data contract name prefix\",\n default: codeGenBaseConfig.typePrefix,\n },\n \"type-suffix\": {\n type: \"string\",\n description: \"data contract name suffix\",\n default: codeGenBaseConfig.typeSuffix,\n },\n \"unwrap-response-data\": {\n type: \"boolean\",\n description: \"unwrap the data item from the response\",\n default: codeGenBaseConfig.unwrapResponseData,\n },\n },\n run: async ({ args }) => {\n const customConfig = await loadConfig<GenerateApiParams>({\n name: \"swagger-typescript-api\",\n configFile: args[\"custom-config\"],\n });\n\n await generateApi({\n addReadonly: args[\"add-readonly\"],\n anotherArrayType: args[\"another-array-type\"],\n apiClassName: args[\"api-class-name\"],\n cleanOutput: args[\"clean-output\"],\n debug: args.debug,\n defaultResponseAsSuccess: args[\"default-as-success\"],\n defaultResponseType: args[\"default-response\"],\n disableThrowOnError: args[\"disable-throw-on-error\"],\n enumNamesAsValues: args[\"enum-names-as-values\"],\n extractEnums: args[\"extract-enums\"],\n extractRequestBody: args[\"extract-request-body\"],\n extractRequestParams: args[\"extract-request-params\"],\n extractResponseBody: args[\"extract-response-body\"],\n extractResponseError: args[\"extract-response-error\"],\n extractResponses: args[\"extract-responses\"],\n fileName: args.name,\n generateClient: args.client,\n generateResponses: args.responses,\n generateRouteTypes: args[\"route-types\"],\n generateUnionEnums: args[\"generate-union-enums\"],\n httpClientType:\n args[\"http-client\"] || args.axios\n ? HTTP_CLIENT.AXIOS\n : HTTP_CLIENT.FETCH,\n input: path.resolve(process.cwd(), args.path as string),\n modular: args.modular,\n moduleNameFirstTag: args[\"module-name-first-tag\"],\n moduleNameIndex: +args[\"module-name-index\"] || 0,\n output: path.resolve(process.cwd(), (args.output as string) || \".\"),\n patch: args.patch,\n silent: args.silent,\n singleHttpClient: args[\"single-http-client\"],\n sortRoutes: args[\"sort-routes\"],\n sortTypes: args[\"sort-types\"],\n templates: args.templates,\n toJS: args.js,\n typePrefix: args[\"type-prefix\"],\n typeSuffix: args[\"type-suffix\"],\n unwrapResponseData: args[\"unwrap-response-data\"],\n url: args.path,\n ...customConfig.config,\n });\n },\n});\n\nconst main = defineCommand({\n meta: {\n name: packageJson.name,\n description: packageJson.description,\n version: packageJson.version,\n },\n subCommands: {\n generate: generateCommand,\n \"generate-templates\": generateTemplatesCommand,\n },\n});\n\nrunMain(main);\n"],"mappings":";;;;;;;AAYA,MAAM,wBAAwB,IAAI,mBAAmB,EAAE,CAAC;AAExD,MAAM,2BAA2B,cAAc;CAC7C,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,gBAAgB;GACd,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;GAChC;EACD,OAAO;GACL,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,eAAe;GACb,MAAM;GACN,aAAa,sCAAsC,OAAO,OACxD,YACD,CAAC;GACF,SAAS,sBAAsB;GAChC;EACD,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS,sBAAsB;GAChC;EACD,QAAQ;GACN,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,SAAS;GACP,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS,sBAAsB;GAChC;EACD,QAAQ;GACN,MAAM;GACN,aAAa;GACb,SAAS,sBAAsB;GAChC;EACF;CACD,KAAK,OAAO,EAAE,WAAW;AACvB,QA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BAAY;EACzB,SAASA,gBAAY;EACtB;CACD,aAAa;EACX,UAAU;EACV,sBAAsB;EACvB;CACF,CAAC;AAEF,QAAQ,KAAK"}
package/dist/lib.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-C5bMYV9w.cjs');
1
+ const require_src = require('./src-Fy1zzbnV.cjs');
2
2
 
3
3
  exports.RequestContentKind = require_src.RequestContentKind;
4
4
  exports.SCHEMA_TYPES = require_src.SCHEMA_TYPES;
package/dist/lib.d.cts CHANGED
@@ -18,8 +18,9 @@ declare class SchemaComponentsMap {
18
18
  createComponent($ref: string, rawTypeData: SchemaComponent["rawTypeData"]): SchemaComponent;
19
19
  getComponents(): SchemaComponent[];
20
20
  filter(...componentNames: (string[] | string)[]): SchemaComponent[];
21
- get($ref: string): SchemaComponent | null;
21
+ get: ($ref: string) => SchemaComponent | null;
22
22
  enumsFirst(): void;
23
+ discriminatorsFirst(): void;
23
24
  }
24
25
  //#endregion
25
26
  //#region src/util/file-system.d.ts
@@ -532,7 +533,7 @@ declare class CodeGenProcess {
532
533
  };
533
534
  };
534
535
  getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
535
- renderTemplate: (template: string, configuration: object, options?: object) => string;
536
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
536
537
  createFile: ({
537
538
  path: path_,
538
539
  fileName,
@@ -677,7 +678,7 @@ declare class TemplatesWorker {
677
678
  }: CodeGenConfig) => {};
678
679
  findTemplateWithExt: (path: string) => string | undefined;
679
680
  getTemplateContent: (path_: string) => string;
680
- renderTemplate: (template: string, configuration: object, options?: object) => string;
681
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
681
682
  }
682
683
  //#endregion
683
684
  //#region src/schema-parser/schema-parser.d.ts
@@ -1807,7 +1808,7 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1807
1808
  };
1808
1809
  };
1809
1810
  getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
1810
- renderTemplate: (template: string, configuration: object, options?: object) => string;
1811
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
1811
1812
  createFile: ({
1812
1813
  path: path_,
1813
1814
  fileName,
package/dist/lib.d.ts CHANGED
@@ -16,8 +16,9 @@ declare class SchemaComponentsMap {
16
16
  createComponent($ref: string, rawTypeData: SchemaComponent["rawTypeData"]): SchemaComponent;
17
17
  getComponents(): SchemaComponent[];
18
18
  filter(...componentNames: (string[] | string)[]): SchemaComponent[];
19
- get($ref: string): SchemaComponent | null;
19
+ get: ($ref: string) => SchemaComponent | null;
20
20
  enumsFirst(): void;
21
+ discriminatorsFirst(): void;
21
22
  }
22
23
  //#endregion
23
24
  //#region src/util/file-system.d.ts
@@ -530,7 +531,7 @@ declare class CodeGenProcess {
530
531
  };
531
532
  };
532
533
  getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
533
- renderTemplate: (template: string, configuration: object, options?: object) => string;
534
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
534
535
  createFile: ({
535
536
  path: path_,
536
537
  fileName,
@@ -675,7 +676,7 @@ declare class TemplatesWorker {
675
676
  }: CodeGenConfig) => {};
676
677
  findTemplateWithExt: (path: string) => string | undefined;
677
678
  getTemplateContent: (path_: string) => string;
678
- renderTemplate: (template: string, configuration: object, options?: object) => string;
679
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
679
680
  }
680
681
  //#endregion
681
682
  //#region src/schema-parser/schema-parser.d.ts
@@ -1805,7 +1806,7 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1805
1806
  };
1806
1807
  };
1807
1808
  getTemplate: (name: string, fileName: string, path?: string) => string | undefined;
1808
- renderTemplate: (template: string, configuration: object, options?: object) => string;
1809
+ renderTemplate: (template: string, configuration: Record<string, unknown>) => string;
1809
1810
  createFile: ({
1810
1811
  path: path_,
1811
1812
  fileName,
package/dist/lib.js CHANGED
@@ -1,3 +1,3 @@
1
- import { RequestContentKind, SCHEMA_TYPES, constants_exports, generateApi, generateTemplates } from "./src-s8addnrG.js";
1
+ import { RequestContentKind, SCHEMA_TYPES, constants_exports, generateApi, generateTemplates } from "./src-LjX9fiRq.js";
2
2
 
3
3
  export { RequestContentKind, SCHEMA_TYPES, constants_exports as constants, generateApi, generateTemplates };