@hey-api/openapi-ts 0.86.6 → 0.86.8
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/{getSpec-x2GCg2gS.js → getSpec-CXDbow97.js} +2 -2
- package/dist/{getSpec-x2GCg2gS.js.map → getSpec-CXDbow97.js.map} +1 -1
- package/dist/{getSpec-dCAz_woE.cjs → getSpec-dCba3-3n.cjs} +2 -2
- package/dist/{getSpec-dCAz_woE.cjs.map → getSpec-dCba3-3n.cjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/run.cjs +1 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.js +1 -1
- package/dist/run.js.map +1 -1
- package/dist/{src-uVOc7K-o.js → src-Be7tT6MZ.js} +2 -2
- package/dist/{src-uVOc7K-o.js.map → src-Be7tT6MZ.js.map} +1 -1
- package/dist/{src-ZtEOUDGN.cjs → src-CrH8890n.cjs} +2 -2
- package/dist/{src-ZtEOUDGN.cjs.map → src-CrH8890n.cjs.map} +1 -1
- package/dist/{types-ComCm5zo.d.cts → types-CHvu8B2X.d.cts} +2 -2
- package/dist/{types-7_tn_FD9.d.ts → types-CxjjO0D6.d.ts} +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./getSpec-
|
|
1
|
+
const e=require(`./getSpec-dCba3-3n.cjs`),t=require(`./src-CrH8890n.cjs`);exports.Logger=t.i,exports.clientDefaultConfig=e.s,exports.clientDefaultMeta=e.c,exports.clientPluginHandler=e.a,exports.compiler=e._,exports.createClient=t.r,exports.defaultPaginationKeywords=e.x,exports.defaultPlugins=e.r,exports.defineConfig=t.t,exports.definePluginConfig=e.b,exports.tsc=e.v,exports.utils=t.n;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as AccessLevel, C as PluginHandler, D as Comments, E as MaybeArray, F as types_d_exports, I as __export, M as FunctionTypeParameter, N as ObjectValue, O as ImportExportItemObject, P as SyntaxKindKeyword, S as Client$2, T as LazyOrAsync, _ as OpenApiRequestBodyObject, c as ExpressionTransformer, d as Client$7, f as Operation, g as OpenApiParameterObject, h as OpenApiOperationObject, i as UserConfig, j as FunctionParameter, k as tsNodeToString, l as DefinePlugin, m as OpenApiMetaObject, o as IR, p as OpenApi, s as TypeTransformer, t as LegacyIR, u as Plugin, v as OpenApiResponseObject, w as StringCase, x as Logger, y as OpenApiSchemaObject } from "./types-CHvu8B2X.cjs";
|
|
2
2
|
import * as typescript0 from "typescript";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
|
|
@@ -2132,5 +2132,5 @@ declare module '@hey-api/codegen-core' {
|
|
|
2132
2132
|
*/
|
|
2133
2133
|
declare const defineConfig: <T extends MaybeArray<UserConfig>>(config: LazyOrAsync<T>) => Promise<T>;
|
|
2134
2134
|
//#endregion
|
|
2135
|
-
export { type Client as AngularClient, type Client$1 as AxiosClient, type Client$2 as Client, type DefinePlugin, type ExpressionTransformer, type Client$3 as FetchClient, type IR, type LegacyIR, Logger, type Client$4 as NextClient, type Client$5 as NuxtClient, type Client$6 as OfetchClient, type OpenApi, type OpenApiMetaObject, type OpenApiOperationObject, type OpenApiParameterObject, type OpenApiRequestBodyObject, type OpenApiResponseObject, type OpenApiSchemaObject, type Plugin, type TypeTransformer, type UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, compiler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, tsc, utils };
|
|
2135
|
+
export { type Client as AngularClient, type Client$1 as AxiosClient, type Client$2 as Client, type DefinePlugin, type ExpressionTransformer, type Client$3 as FetchClient, type IR, type LegacyIR, Logger, type Client$4 as NextClient, type Client$5 as NuxtClient, type Client$6 as OfetchClient, type OpenApi, type OpenApiMetaObject, type OpenApiOperationObject, type OpenApiParameterObject, type OpenApiRequestBodyObject, type OpenApiResponseObject, type OpenApiSchemaObject, type Operation, type Plugin, type TypeTransformer, type UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, compiler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, tsc, utils };
|
|
2136
2136
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __export } from "./chunk-C-EqMg7d.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as AccessLevel, C as PluginHandler, D as Comments, E as MaybeArray, F as types_d_exports, M as FunctionTypeParameter, N as ObjectValue, O as ImportExportItemObject, P as SyntaxKindKeyword, S as Client$2, T as LazyOrAsync, _ as OpenApiRequestBodyObject, c as ExpressionTransformer, d as Client$7, f as Operation, g as OpenApiParameterObject, h as OpenApiOperationObject, i as UserConfig, j as FunctionParameter, k as tsNodeToString, l as DefinePlugin, m as OpenApiMetaObject, o as IR, p as OpenApi, s as TypeTransformer, t as LegacyIR, u as Plugin, v as OpenApiResponseObject, w as StringCase, x as Logger, y as OpenApiSchemaObject } from "./types-CxjjO0D6.js";
|
|
3
3
|
import "@hey-api/codegen-core";
|
|
4
4
|
import * as typescript0 from "typescript";
|
|
5
5
|
import ts from "typescript";
|
|
@@ -2134,5 +2134,5 @@ declare module '@hey-api/codegen-core' {
|
|
|
2134
2134
|
*/
|
|
2135
2135
|
declare const defineConfig: <T extends MaybeArray<UserConfig>>(config: LazyOrAsync<T>) => Promise<T>;
|
|
2136
2136
|
//#endregion
|
|
2137
|
-
export { type Client as AngularClient, type Client$1 as AxiosClient, type Client$2 as Client, type DefinePlugin, type ExpressionTransformer, type Client$3 as FetchClient, type IR, type LegacyIR, Logger, type Client$4 as NextClient, type Client$5 as NuxtClient, type Client$6 as OfetchClient, type OpenApi, type OpenApiMetaObject, type OpenApiOperationObject, type OpenApiParameterObject, type OpenApiRequestBodyObject, type OpenApiResponseObject, type OpenApiSchemaObject, type Plugin, type TypeTransformer, type UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, compiler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, tsc, utils };
|
|
2137
|
+
export { type Client as AngularClient, type Client$1 as AxiosClient, type Client$2 as Client, type DefinePlugin, type ExpressionTransformer, type Client$3 as FetchClient, type IR, type LegacyIR, Logger, type Client$4 as NextClient, type Client$5 as NuxtClient, type Client$6 as OfetchClient, type OpenApi, type OpenApiMetaObject, type OpenApiOperationObject, type OpenApiParameterObject, type OpenApiRequestBodyObject, type OpenApiResponseObject, type OpenApiSchemaObject, type Operation, type Plugin, type TypeTransformer, type UserConfig, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, compiler, createClient, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, tsc, utils };
|
|
2138
2138
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,c as r,r as i,s as a,v as o,x as s}from"./getSpec-
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,r as i,s as a,v as o,x as s}from"./getSpec-CXDbow97.js";import{i as c,n as l,r as u,t as d}from"./src-Be7tT6MZ.js";export{c as Logger,a as clientDefaultConfig,r as clientDefaultMeta,t as clientPluginHandler,e as compiler,u as createClient,s as defaultPaginationKeywords,i as defaultPlugins,d as defineConfig,n as definePluginConfig,o as tsc,l as utils};
|
package/dist/internal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./getSpec-
|
|
1
|
+
const e=require(`./getSpec-dCba3-3n.cjs`);exports.getSpec=e.t,exports.initConfigs=e.n,exports.parseOpenApiSpec=e.u;
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Input, b as
|
|
1
|
+
import { a as Input, b as parseOpenApiSpec, i as UserConfig, n as WatchValues, r as Config, x as Logger } from "./types-CHvu8B2X.cjs";
|
|
2
2
|
import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
|
|
3
3
|
|
|
4
4
|
//#region src/config/init.d.ts
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Input, b as
|
|
1
|
+
import { a as Input, b as parseOpenApiSpec, i as UserConfig, n as WatchValues, r as Config, x as Logger } from "./types-CxjjO0D6.js";
|
|
2
2
|
import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
|
|
3
3
|
|
|
4
4
|
//#region src/config/init.d.ts
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t,u as n}from"./getSpec-
|
|
1
|
+
import{n as e,t,u as n}from"./getSpec-CXDbow97.js";export{t as getSpec,e as initConfigs,n as parseOpenApiSpec};
|
package/dist/run.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const e=require(`./getSpec-
|
|
2
|
+
const e=require(`./getSpec-dCba3-3n.cjs`),t=require(`./src-CrH8890n.cjs`);let n=require(`commander`);n=e.R(n);var r=`0.86.8`,i={"openapi-ts":`./bin/run.js`};const a=e=>e===`true`?!0:e===`false`?!1:e,o=(e,t)=>{for(let n of t){let t=e[n];if(typeof t==`string`){let r=a(t);delete e[n],e[n]=r}}return e},s=async()=>{let e=new n.Command().name(Object.keys(i)[0]).usage(`[options]`).version(r).option(`-c, --client <value>`,`HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).option(`-e, --experimental-parser [value]`,`Opt-in to the experimental parser?`).option(`-f, --file [value]`,`Path to the config file`).option(`-i, --input <value>`,`OpenAPI specification (path, url, or string content)`).option(`-l, --logs [value]`,`Logs folder`).option(`-o, --output <value>`,`Output folder`).option(`-p, --plugins [value...]`,`List of plugins you'd like to use`).option(`--base [value]`,`DEPRECATED. Manually set base in OpenAPI config instead of inferring from server value`).option(`-s, --silent`,`Set log level to silent`).option(`--no-log-file`,`Disable writing a log file. Works like --silent but without suppressing console output`).option(`-w, --watch [value]`,`Regenerate the client when the input file changes?`).option(`--exportCore [value]`,`DEPRECATED. Write core files to disk`).option(`--name <value>`,`DEPRECATED. Custom client class name`).option(`--request <value>`,`DEPRECATED. Path to custom request file`).option(`--useOptions [value]`,`DEPRECATED. Use options instead of arguments?`).parse(process.argv).opts(),s;try{s=o(e,[`dryRun`,`experimentalParser`,`exportCore`,`logFile`,`useOptions`]),s.file&&(s.configFile=s.file,delete s.file),e.plugins===!0?s.plugins=[]:e.plugins?s.plugins=e.plugins:s.client&&(s.plugins=[`@hey-api/typescript`,`@hey-api/sdk`]),s.client&&(s.plugins.push(s.client),delete s.client),s.logs=s.logs?{path:s.logs}:{},s.debug||a(process.env.DEBUG)?(s.logs.level=`debug`,delete s.debug):s.silent&&(s.logs.level=`silent`,delete s.silent),s.logs.file=s.logFile,delete s.logFile,typeof e.watch==`string`&&(s.watch=Number.parseInt(e.watch,10)),Object.keys(s.logs).length||delete s.logs,(await t.r(s))[0]?.config.input.some(e=>e.watch&&e.watch.enabled)||process.exit(0)}catch{process.exit(1)}};s();
|
|
3
3
|
//# sourceMappingURL=run.cjs.map
|
package/dist/run.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.cjs","names":["Command","pkg.bin","pkg.version","userConfig: Record<string, unknown>","createClient"],"sources":["../package.json","../src/cli.ts","../src/run.ts"],"sourcesContent":["{\n \"name\": \"@hey-api/openapi-ts\",\n \"version\": \"0.86.
|
|
1
|
+
{"version":3,"file":"run.cjs","names":["Command","pkg.bin","pkg.version","userConfig: Record<string, unknown>","createClient"],"sources":["../package.json","../src/cli.ts","../src/run.ts"],"sourcesContent":["{\n \"name\": \"@hey-api/openapi-ts\",\n \"version\": \"0.86.8\",\n \"description\": \"🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.\",\n \"homepage\": \"https://heyapi.dev/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/hey-api/openapi-ts.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/hey-api/openapi-ts/issues\"\n },\n \"license\": \"MIT\",\n \"author\": {\n \"email\": \"lubos@heyapi.dev\",\n \"name\": \"Hey API\",\n \"url\": \"https://heyapi.dev\"\n },\n \"funding\": \"https://github.com/sponsors/hey-api\",\n \"keywords\": [\n \"angular\",\n \"axios\",\n \"codegen\",\n \"fetch\",\n \"generator\",\n \"http\",\n \"javascript\",\n \"json\",\n \"next\",\n \"next.js\",\n \"node\",\n \"nuxt\",\n \"ofetch\",\n \"openapi\",\n \"rest\",\n \"swagger\",\n \"typescript\",\n \"xhr\",\n \"yaml\"\n ],\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./internal\": {\n \"import\": {\n \"types\": \"./dist/internal.d.ts\",\n \"default\": \"./dist/internal.js\"\n },\n \"require\": {\n \"types\": \"./dist/internal.d.cts\",\n \"default\": \"./dist/internal.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"bin\": {\n \"openapi-ts\": \"./bin/run.js\"\n },\n \"files\": [\n \"bin\",\n \"dist\",\n \"LICENSE.md\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"tsdown && pnpm check-exports\",\n \"check-exports\": \"attw --pack . --profile node16\",\n \"dev\": \"tsdown --watch\",\n \"handlebars\": \"node src/legacy/handlebars/handlebars.cjs\",\n \"prepublishOnly\": \"pnpm build\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:update\": \"vitest watch --update\",\n \"test:watch\": \"vitest watch\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"engines\": {\n \"node\": \">=20.19.0\"\n },\n \"dependencies\": {\n \"@hey-api/codegen-core\": \"workspace:^0.3.1\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.1\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.1\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.1\",\n \"handlebars\": \"4.7.8\",\n \"open\": \"10.2.0\",\n \"semver\": \"7.7.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.5.3\"\n },\n \"devDependencies\": {\n \"@angular/common\": \"19.2.15\",\n \"@angular/compiler\": \"19.2.15\",\n \"@angular/compiler-cli\": \"19.2.15\",\n \"@angular/core\": \"19.2.15\",\n \"@angular/platform-browser\": \"19.2.15\",\n \"@angular/platform-browser-dynamic\": \"19.2.15\",\n \"@angular/router\": \"19.2.15\",\n \"@config/vite-base\": \"workspace:*\",\n \"@types/bun\": \"1.3.1\",\n \"@types/cross-spawn\": \"6.0.6\",\n \"@types/semver\": \"7.7.1\",\n \"axios\": \"1.8.2\",\n \"cross-spawn\": \"7.0.6\",\n \"eslint\": \"9.17.0\",\n \"glob\": \"11.0.3\",\n \"nuxt\": \"3.14.1592\",\n \"ofetch\": \"1.4.1\",\n \"prettier\": \"3.4.2\",\n \"rxjs\": \"7.8.2\",\n \"typescript\": \"5.9.3\",\n \"vue\": \"3.5.13\",\n \"yaml\": \"2.8.0\",\n \"zone.js\": \"0.15.1\"\n }\n}\n","import type { OptionValues } from 'commander';\nimport { Command } from 'commander';\n\nimport { createClient } from '~/index';\n\nimport pkg from '../package.json' assert { type: 'json' };\n\nconst stringToBoolean = (\n value: string | undefined,\n): boolean | string | undefined => {\n if (value === 'true') return true;\n if (value === 'false') return false;\n return value;\n};\n\nconst processParams = (\n obj: OptionValues,\n booleanKeys: ReadonlyArray<string>,\n): OptionValues => {\n for (const key of booleanKeys) {\n const value = obj[key];\n if (typeof value === 'string') {\n const parsedValue = stringToBoolean(value);\n delete obj[key];\n obj[key] = parsedValue;\n }\n }\n return obj;\n};\n\nexport const runCli = async (): Promise<void> => {\n const params = new Command()\n .name(Object.keys(pkg.bin)[0]!)\n .usage('[options]')\n .version(pkg.version)\n .option(\n '-c, --client <value>',\n 'HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]',\n )\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\n .option(\n '-e, --experimental-parser [value]',\n 'Opt-in to the experimental parser?',\n )\n .option('-f, --file [value]', 'Path to the config file')\n .option(\n '-i, --input <value>',\n 'OpenAPI specification (path, url, or string content)',\n )\n .option('-l, --logs [value]', 'Logs folder')\n .option('-o, --output <value>', 'Output folder')\n .option('-p, --plugins [value...]', \"List of plugins you'd like to use\")\n .option(\n '--base [value]',\n 'DEPRECATED. Manually set base in OpenAPI config instead of inferring from server value',\n )\n .option('-s, --silent', 'Set log level to silent')\n .option(\n '--no-log-file',\n 'Disable writing a log file. Works like --silent but without suppressing console output',\n )\n .option(\n '-w, --watch [value]',\n 'Regenerate the client when the input file changes?',\n )\n .option('--exportCore [value]', 'DEPRECATED. Write core files to disk')\n .option('--name <value>', 'DEPRECATED. Custom client class name')\n .option('--request <value>', 'DEPRECATED. Path to custom request file')\n .option(\n '--useOptions [value]',\n 'DEPRECATED. Use options instead of arguments?',\n )\n .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, [\n 'dryRun',\n 'experimentalParser',\n 'exportCore',\n 'logFile',\n 'useOptions',\n ]);\n\n if (userConfig.file) {\n userConfig.configFile = userConfig.file;\n delete userConfig.file;\n }\n\n if (params.plugins === true) {\n userConfig.plugins = [];\n } else if (params.plugins) {\n userConfig.plugins = params.plugins;\n } else if (userConfig.client) {\n userConfig.plugins = ['@hey-api/typescript', '@hey-api/sdk'];\n }\n\n if (userConfig.client) {\n (userConfig.plugins as Array<string>).push(userConfig.client as string);\n delete userConfig.client;\n }\n\n userConfig.logs = userConfig.logs\n ? {\n path: userConfig.logs,\n }\n : {};\n\n if (userConfig.debug || stringToBoolean(process.env.DEBUG)) {\n (userConfig.logs as Record<string, unknown>).level = 'debug';\n delete userConfig.debug;\n } else if (userConfig.silent) {\n (userConfig.logs as Record<string, unknown>).level = 'silent';\n delete userConfig.silent;\n }\n\n (userConfig.logs as Record<string, unknown>).file = userConfig.logFile;\n delete userConfig.logFile;\n\n if (typeof params.watch === 'string') {\n userConfig.watch = Number.parseInt(params.watch, 10);\n }\n\n if (!Object.keys(userConfig.logs as Record<string, unknown>).length) {\n delete userConfig.logs;\n }\n\n const context = await createClient(\n userConfig as unknown as Required<Parameters<typeof createClient>>[0],\n );\n if (\n !context[0]?.config.input.some(\n (input) => input.watch && input.watch.enabled,\n )\n ) {\n process.exit(0);\n }\n } catch {\n process.exit(1);\n }\n};\n","#!/usr/bin/env node\n\nimport { runCli } from '~/cli';\n\nrunCli();\n"],"mappings":";oHAEa,WAiEJ,CACL,aAAc,eACf,CC9DH,MAAM,EACJ,GAEI,IAAU,OAAe,GACzB,IAAU,QAAgB,GACvB,EAGH,GACJ,EACA,IACiB,CACjB,IAAK,IAAM,KAAO,EAAa,CAC7B,IAAM,EAAQ,EAAI,GAClB,GAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAc,EAAgB,EAAM,CAC1C,OAAO,EAAI,GACX,EAAI,GAAO,GAGf,OAAO,GAGI,EAAS,SAA2B,CAC/C,IAAM,EAAS,IAAIA,EAAAA,SAAS,CACzB,KAAK,OAAO,KAAKC,EAAQ,CAAC,GAAI,CAC9B,MAAM,YAAY,CAClB,QAAQC,EAAY,CACpB,OACC,uBACA,0LACD,CACA,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OACC,oCACA,qCACD,CACA,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OACC,iBACA,yFACD,CACA,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,OAAO,uBAAwB,uCAAuC,CACtE,OAAO,iBAAkB,uCAAuC,CAChE,OAAO,oBAAqB,0CAA0C,CACtE,OACC,uBACA,gDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CACjC,SACA,qBACA,aACA,UACA,aACD,CAAC,CAEE,EAAW,OACb,EAAW,WAAa,EAAW,KACnC,OAAO,EAAW,MAGhB,EAAO,UAAY,GACrB,EAAW,QAAU,EAAE,CACd,EAAO,QAChB,EAAW,QAAU,EAAO,QACnB,EAAW,SACpB,EAAW,QAAU,CAAC,sBAAuB,eAAe,EAG1D,EAAW,SACZ,EAAW,QAA0B,KAAK,EAAW,OAAiB,CACvE,OAAO,EAAW,QAGpB,EAAW,KAAO,EAAW,KACzB,CACE,KAAM,EAAW,KAClB,CACD,EAAE,CAEF,EAAW,OAAS,EAAgB,QAAQ,IAAI,MAAM,EACvD,EAAW,KAAiC,MAAQ,QACrD,OAAO,EAAW,OACT,EAAW,SACnB,EAAW,KAAiC,MAAQ,SACrD,OAAO,EAAW,QAGnB,EAAW,KAAiC,KAAO,EAAW,QAC/D,OAAO,EAAW,QAEd,OAAO,EAAO,OAAU,WAC1B,EAAW,MAAQ,OAAO,SAAS,EAAO,MAAO,GAAG,EAGjD,OAAO,KAAK,EAAW,KAAgC,CAAC,QAC3D,OAAO,EAAW,MAGJ,MAAMC,EAAAA,EACpB,EACD,EAEU,IAAI,OAAO,MAAM,KACvB,GAAU,EAAM,OAAS,EAAM,MAAM,QACvC,EAED,QAAQ,KAAK,EAAE,MAEX,CACN,QAAQ,KAAK,EAAE,GCzInB,GAAQ"}
|
package/dist/run.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./getSpec-
|
|
2
|
+
import"./getSpec-CXDbow97.js";import{r as e}from"./src-Be7tT6MZ.js";import{Command as t}from"commander";var n=`0.86.8`,r={"openapi-ts":`./bin/run.js`};const i=e=>e===`true`?!0:e===`false`?!1:e,a=(e,t)=>{for(let n of t){let t=e[n];if(typeof t==`string`){let r=i(t);delete e[n],e[n]=r}}return e};(async()=>{let o=new t().name(Object.keys(r)[0]).usage(`[options]`).version(n).option(`-c, --client <value>`,`HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).option(`-e, --experimental-parser [value]`,`Opt-in to the experimental parser?`).option(`-f, --file [value]`,`Path to the config file`).option(`-i, --input <value>`,`OpenAPI specification (path, url, or string content)`).option(`-l, --logs [value]`,`Logs folder`).option(`-o, --output <value>`,`Output folder`).option(`-p, --plugins [value...]`,`List of plugins you'd like to use`).option(`--base [value]`,`DEPRECATED. Manually set base in OpenAPI config instead of inferring from server value`).option(`-s, --silent`,`Set log level to silent`).option(`--no-log-file`,`Disable writing a log file. Works like --silent but without suppressing console output`).option(`-w, --watch [value]`,`Regenerate the client when the input file changes?`).option(`--exportCore [value]`,`DEPRECATED. Write core files to disk`).option(`--name <value>`,`DEPRECATED. Custom client class name`).option(`--request <value>`,`DEPRECATED. Path to custom request file`).option(`--useOptions [value]`,`DEPRECATED. Use options instead of arguments?`).parse(process.argv).opts(),s;try{s=a(o,[`dryRun`,`experimentalParser`,`exportCore`,`logFile`,`useOptions`]),s.file&&(s.configFile=s.file,delete s.file),o.plugins===!0?s.plugins=[]:o.plugins?s.plugins=o.plugins:s.client&&(s.plugins=[`@hey-api/typescript`,`@hey-api/sdk`]),s.client&&(s.plugins.push(s.client),delete s.client),s.logs=s.logs?{path:s.logs}:{},s.debug||i(process.env.DEBUG)?(s.logs.level=`debug`,delete s.debug):s.silent&&(s.logs.level=`silent`,delete s.silent),s.logs.file=s.logFile,delete s.logFile,typeof o.watch==`string`&&(s.watch=Number.parseInt(o.watch,10)),Object.keys(s.logs).length||delete s.logs,(await e(s))[0]?.config.input.some(e=>e.watch&&e.watch.enabled)||process.exit(0)}catch{process.exit(1)}})();export{};
|
|
3
3
|
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":["pkg.bin","pkg.version","userConfig: Record<string, unknown>"],"sources":["../package.json","../src/cli.ts","../src/run.ts"],"sourcesContent":["{\n \"name\": \"@hey-api/openapi-ts\",\n \"version\": \"0.86.
|
|
1
|
+
{"version":3,"file":"run.js","names":["pkg.bin","pkg.version","userConfig: Record<string, unknown>"],"sources":["../package.json","../src/cli.ts","../src/run.ts"],"sourcesContent":["{\n \"name\": \"@hey-api/openapi-ts\",\n \"version\": \"0.86.8\",\n \"description\": \"🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.\",\n \"homepage\": \"https://heyapi.dev/\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/hey-api/openapi-ts.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/hey-api/openapi-ts/issues\"\n },\n \"license\": \"MIT\",\n \"author\": {\n \"email\": \"lubos@heyapi.dev\",\n \"name\": \"Hey API\",\n \"url\": \"https://heyapi.dev\"\n },\n \"funding\": \"https://github.com/sponsors/hey-api\",\n \"keywords\": [\n \"angular\",\n \"axios\",\n \"codegen\",\n \"fetch\",\n \"generator\",\n \"http\",\n \"javascript\",\n \"json\",\n \"next\",\n \"next.js\",\n \"node\",\n \"nuxt\",\n \"ofetch\",\n \"openapi\",\n \"rest\",\n \"swagger\",\n \"typescript\",\n \"xhr\",\n \"yaml\"\n ],\n \"type\": \"module\",\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.ts\",\n \"default\": \"./dist/index.js\"\n },\n \"require\": {\n \"types\": \"./dist/index.d.cts\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"./internal\": {\n \"import\": {\n \"types\": \"./dist/internal.d.ts\",\n \"default\": \"./dist/internal.js\"\n },\n \"require\": {\n \"types\": \"./dist/internal.d.cts\",\n \"default\": \"./dist/internal.cjs\"\n }\n },\n \"./package.json\": \"./package.json\"\n },\n \"bin\": {\n \"openapi-ts\": \"./bin/run.js\"\n },\n \"files\": [\n \"bin\",\n \"dist\",\n \"LICENSE.md\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"tsdown && pnpm check-exports\",\n \"check-exports\": \"attw --pack . --profile node16\",\n \"dev\": \"tsdown --watch\",\n \"handlebars\": \"node src/legacy/handlebars/handlebars.cjs\",\n \"prepublishOnly\": \"pnpm build\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:update\": \"vitest watch --update\",\n \"test:watch\": \"vitest watch\",\n \"test\": \"vitest run\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"engines\": {\n \"node\": \">=20.19.0\"\n },\n \"dependencies\": {\n \"@hey-api/codegen-core\": \"workspace:^0.3.1\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.1\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.1\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.1\",\n \"handlebars\": \"4.7.8\",\n \"open\": \"10.2.0\",\n \"semver\": \"7.7.2\"\n },\n \"peerDependencies\": {\n \"typescript\": \">=5.5.3\"\n },\n \"devDependencies\": {\n \"@angular/common\": \"19.2.15\",\n \"@angular/compiler\": \"19.2.15\",\n \"@angular/compiler-cli\": \"19.2.15\",\n \"@angular/core\": \"19.2.15\",\n \"@angular/platform-browser\": \"19.2.15\",\n \"@angular/platform-browser-dynamic\": \"19.2.15\",\n \"@angular/router\": \"19.2.15\",\n \"@config/vite-base\": \"workspace:*\",\n \"@types/bun\": \"1.3.1\",\n \"@types/cross-spawn\": \"6.0.6\",\n \"@types/semver\": \"7.7.1\",\n \"axios\": \"1.8.2\",\n \"cross-spawn\": \"7.0.6\",\n \"eslint\": \"9.17.0\",\n \"glob\": \"11.0.3\",\n \"nuxt\": \"3.14.1592\",\n \"ofetch\": \"1.4.1\",\n \"prettier\": \"3.4.2\",\n \"rxjs\": \"7.8.2\",\n \"typescript\": \"5.9.3\",\n \"vue\": \"3.5.13\",\n \"yaml\": \"2.8.0\",\n \"zone.js\": \"0.15.1\"\n }\n}\n","import type { OptionValues } from 'commander';\nimport { Command } from 'commander';\n\nimport { createClient } from '~/index';\n\nimport pkg from '../package.json' assert { type: 'json' };\n\nconst stringToBoolean = (\n value: string | undefined,\n): boolean | string | undefined => {\n if (value === 'true') return true;\n if (value === 'false') return false;\n return value;\n};\n\nconst processParams = (\n obj: OptionValues,\n booleanKeys: ReadonlyArray<string>,\n): OptionValues => {\n for (const key of booleanKeys) {\n const value = obj[key];\n if (typeof value === 'string') {\n const parsedValue = stringToBoolean(value);\n delete obj[key];\n obj[key] = parsedValue;\n }\n }\n return obj;\n};\n\nexport const runCli = async (): Promise<void> => {\n const params = new Command()\n .name(Object.keys(pkg.bin)[0]!)\n .usage('[options]')\n .version(pkg.version)\n .option(\n '-c, --client <value>',\n 'HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]',\n )\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\n .option(\n '-e, --experimental-parser [value]',\n 'Opt-in to the experimental parser?',\n )\n .option('-f, --file [value]', 'Path to the config file')\n .option(\n '-i, --input <value>',\n 'OpenAPI specification (path, url, or string content)',\n )\n .option('-l, --logs [value]', 'Logs folder')\n .option('-o, --output <value>', 'Output folder')\n .option('-p, --plugins [value...]', \"List of plugins you'd like to use\")\n .option(\n '--base [value]',\n 'DEPRECATED. Manually set base in OpenAPI config instead of inferring from server value',\n )\n .option('-s, --silent', 'Set log level to silent')\n .option(\n '--no-log-file',\n 'Disable writing a log file. Works like --silent but without suppressing console output',\n )\n .option(\n '-w, --watch [value]',\n 'Regenerate the client when the input file changes?',\n )\n .option('--exportCore [value]', 'DEPRECATED. Write core files to disk')\n .option('--name <value>', 'DEPRECATED. Custom client class name')\n .option('--request <value>', 'DEPRECATED. Path to custom request file')\n .option(\n '--useOptions [value]',\n 'DEPRECATED. Use options instead of arguments?',\n )\n .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, [\n 'dryRun',\n 'experimentalParser',\n 'exportCore',\n 'logFile',\n 'useOptions',\n ]);\n\n if (userConfig.file) {\n userConfig.configFile = userConfig.file;\n delete userConfig.file;\n }\n\n if (params.plugins === true) {\n userConfig.plugins = [];\n } else if (params.plugins) {\n userConfig.plugins = params.plugins;\n } else if (userConfig.client) {\n userConfig.plugins = ['@hey-api/typescript', '@hey-api/sdk'];\n }\n\n if (userConfig.client) {\n (userConfig.plugins as Array<string>).push(userConfig.client as string);\n delete userConfig.client;\n }\n\n userConfig.logs = userConfig.logs\n ? {\n path: userConfig.logs,\n }\n : {};\n\n if (userConfig.debug || stringToBoolean(process.env.DEBUG)) {\n (userConfig.logs as Record<string, unknown>).level = 'debug';\n delete userConfig.debug;\n } else if (userConfig.silent) {\n (userConfig.logs as Record<string, unknown>).level = 'silent';\n delete userConfig.silent;\n }\n\n (userConfig.logs as Record<string, unknown>).file = userConfig.logFile;\n delete userConfig.logFile;\n\n if (typeof params.watch === 'string') {\n userConfig.watch = Number.parseInt(params.watch, 10);\n }\n\n if (!Object.keys(userConfig.logs as Record<string, unknown>).length) {\n delete userConfig.logs;\n }\n\n const context = await createClient(\n userConfig as unknown as Required<Parameters<typeof createClient>>[0],\n );\n if (\n !context[0]?.config.input.some(\n (input) => input.watch && input.watch.enabled,\n )\n ) {\n process.exit(0);\n }\n } catch {\n process.exit(1);\n }\n};\n","#!/usr/bin/env node\n\nimport { runCli } from '~/cli';\n\nrunCli();\n"],"mappings":";8GAEa,WAiEJ,CACL,aAAc,eACf,CC9DH,MAAM,EACJ,GAEI,IAAU,OAAe,GACzB,IAAU,QAAgB,GACvB,EAGH,GACJ,EACA,IACiB,CACjB,IAAK,IAAM,KAAO,EAAa,CAC7B,IAAM,EAAQ,EAAI,GAClB,GAAI,OAAO,GAAU,SAAU,CAC7B,IAAM,EAAc,EAAgB,EAAM,CAC1C,OAAO,EAAI,GACX,EAAI,GAAO,GAGf,OAAO,IAGa,SAA2B,CAC/C,IAAM,EAAS,IAAI,GAAS,CACzB,KAAK,OAAO,KAAKA,EAAQ,CAAC,GAAI,CAC9B,MAAM,YAAY,CAClB,QAAQC,EAAY,CACpB,OACC,uBACA,0LACD,CACA,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OACC,oCACA,qCACD,CACA,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OACC,iBACA,yFACD,CACA,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,OAAO,uBAAwB,uCAAuC,CACtE,OAAO,iBAAkB,uCAAuC,CAChE,OAAO,oBAAqB,0CAA0C,CACtE,OACC,uBACA,gDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CACjC,SACA,qBACA,aACA,UACA,aACD,CAAC,CAEE,EAAW,OACb,EAAW,WAAa,EAAW,KACnC,OAAO,EAAW,MAGhB,EAAO,UAAY,GACrB,EAAW,QAAU,EAAE,CACd,EAAO,QAChB,EAAW,QAAU,EAAO,QACnB,EAAW,SACpB,EAAW,QAAU,CAAC,sBAAuB,eAAe,EAG1D,EAAW,SACZ,EAAW,QAA0B,KAAK,EAAW,OAAiB,CACvE,OAAO,EAAW,QAGpB,EAAW,KAAO,EAAW,KACzB,CACE,KAAM,EAAW,KAClB,CACD,EAAE,CAEF,EAAW,OAAS,EAAgB,QAAQ,IAAI,MAAM,EACvD,EAAW,KAAiC,MAAQ,QACrD,OAAO,EAAW,OACT,EAAW,SACnB,EAAW,KAAiC,MAAQ,SACrD,OAAO,EAAW,QAGnB,EAAW,KAAiC,KAAO,EAAW,QAC/D,OAAO,EAAW,QAEd,OAAO,EAAO,OAAU,WAC1B,EAAW,MAAQ,OAAO,SAAS,EAAO,MAAO,GAAG,EAGjD,OAAO,KAAK,EAAW,KAAgC,CAAC,QAC3D,OAAO,EAAW,MAGJ,MAAM,EACpB,EACD,EAEU,IAAI,OAAO,MAAM,KACvB,GAAU,EAAM,OAAS,EAAM,MAAM,QACvC,EAED,QAAQ,KAAK,EAAE,MAEX,CACN,QAAQ,KAAK,EAAE,KCzIX"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,r as t,t as n}from"./chunk-C-EqMg7d.js";import{A as r,C as i,D as a,E as o,F as s,I as c,M as l,N as u,O as d,P as f,S as p,T as m,d as h,f as g,g as _,h as v,i as y,j as b,k as ee,l as te,m as ne,n as re,o as x,p as S,t as ie,u as ae,v as C,w,y as T}from"./getSpec-
|
|
1
|
+
import{i as e,r as t,t as n}from"./chunk-C-EqMg7d.js";import{A as r,C as i,D as a,E as o,F as s,I as c,M as l,N as u,O as d,P as f,S as p,T as m,d as h,f as g,g as _,h as v,i as y,j as b,k as ee,l as te,m as ne,n as re,o as x,p as S,t as ie,u as ae,v as C,w,y as T}from"./getSpec-CXDbow97.js";import"@hey-api/codegen-core";import E from"ansi-colors";import oe from"color-support";import D from"node:fs";import O from"node:path";import{$RefParser as se}from"@hey-api/json-schema-ref-parser";import k from"handlebars";const ce=()=>{if(typeof Bun<`u`){let[e]=Bun.version.split(`.`).map(Number);if(e<1)throw new a(`Unsupported Bun version ${Bun.version}. Please use Bun 1.0.0 or newer.`)}else if(typeof process<`u`&&process.versions?.node){let[e]=process.versions.node.split(`.`).map(Number);if(e<20)throw new a(`Unsupported Node version ${process.versions.node}. Please use Node 20 or newer.`)}},A=e=>{switch(e){case`legacy/angular`:return`AngularHttpRequest`;case`legacy/axios`:return`AxiosHttpRequest`;case`legacy/fetch`:return`FetchHttpRequest`;case`legacy/node`:return`NodeHttpRequest`;case`legacy/xhr`:return`XHRHttpRequest`;default:return``}},le=async(e,t,n,r)=>{let a=i(),s=o(a),c=r.client({$config:a,...n,httpRequest:A(s.name),models:g(n.models),services:g(n.services)});m(a)&&(f(t),D.writeFileSync(O.resolve(t,`${m(a)}.ts`),c))},j=async(e,t,n)=>{let r=i();if(r.exportCore){let i=o(r),a={httpRequest:A(i.name),server:r.base===void 0?t.server:r.base,version:t.version};if(D.rmSync(O.resolve(e),{force:!0,recursive:!0}),D.mkdirSync(O.resolve(e),{recursive:!0}),await D.writeFileSync(O.resolve(e,`OpenAPI.ts`),n.core.settings({$config:r,...a})),await D.writeFileSync(O.resolve(e,`ApiError.ts`),n.core.apiError({$config:r,...a})),await D.writeFileSync(O.resolve(e,`ApiRequestOptions.ts`),n.core.apiRequestOptions({$config:r,...a})),await D.writeFileSync(O.resolve(e,`ApiResult.ts`),n.core.apiResult({$config:r,...a})),i.name!==`legacy/angular`&&await D.writeFileSync(O.resolve(e,`CancelablePromise.ts`),n.core.cancelablePromise({$config:r,...a})),await D.writeFileSync(O.resolve(e,`request.ts`),n.core.request({$config:r,...a})),m(r)&&(await D.writeFileSync(O.resolve(e,`BaseHttpRequest.ts`),n.core.baseHttpRequest({$config:r,...a})),await D.writeFileSync(O.resolve(e,`${a.httpRequest}.ts`),n.core.httpRequest({$config:r,...a}))),r.request){let t=O.resolve(process.cwd(),r.request);if(!await D.existsSync(t))throw Error(`Custom request file "${t}" does not exists`);await D.copyFileSync(t,O.resolve(e,`request.ts`))}}},M=({files:e})=>{let t=i();e.index=new y({dir:t.output.path,id:`index`,name:`index.ts`}),m(t)&&e.index.add(C.exportNamedDeclaration({exports:m(t),module:`./${m(t)}`})),t.exportCore&&(e.index.add(C.exportNamedDeclaration({exports:`ApiError`,module:`./core/ApiError`})),t.plugins[`@hey-api/sdk`]?.config.response===`response`&&e.index.add(C.exportNamedDeclaration({exports:{asType:!0,name:`ApiResult`},module:`./core/ApiResult`})),m(t)&&e.index.add(C.exportNamedDeclaration({exports:`BaseHttpRequest`,module:`./core/BaseHttpRequest`})),o(t).name!==`legacy/angular`&&e.index.add(C.exportNamedDeclaration({exports:[`CancelablePromise`,`CancelError`],module:`./core/CancelablePromise`})),e.index.add(C.exportNamedDeclaration({exports:[`OpenAPI`,{asType:!0,name:`OpenAPIConfig`}],module:`./core/OpenAPI`}))),Object.keys(e).sort().forEach(t=>{let n=e[t];t===`index`||n.isEmpty()||n.exportFromIndex&&e.index.add(C.exportAllDeclaration({module:`./${n.nameWithoutExtension()}`}))})},N=async({client:e,openApi:t,templates:n})=>{let r=i(),a=t;if(e){if(r.plugins[`@hey-api/sdk`]?.config.include&&r.plugins[`@hey-api/sdk`].config.asClass){let t=new RegExp(r.plugins[`@hey-api/sdk`].config.include);e.services=e.services.filter(e=>t.test(e.name))}if(r.plugins[`@hey-api/typescript`]?.config.include){let t=new RegExp(r.plugins[`@hey-api/typescript`].config.include);e.models=e.models.filter(e=>t.test(e.name))}}let c=O.resolve(r.output.path);r.output.clean&&s(c);let l=o(r);!w(r)&&`bundle`in l.config&&l.config.bundle&&!r.dryRun&&x({meta:{importFileExtension:r.output.importFileExtension},outputPath:c,plugin:l}),await le(a,c,e,n),await j(O.resolve(r.output.path,`core`),e,n);let u={};for(let t of r.pluginOrder){let n=r.plugins[t],i=(n.output??``).split(`/`),o=O.resolve(r.output.path,...i.slice(0,i.length-1));u[n.name]=new y({dir:o,id:`legacy-unused-${n.name}`,name:`${i[i.length-1]}.ts`}),n.handlerLegacy?.({client:e,files:u,openApi:a,plugin:n})}M({files:u}),Object.entries(u).forEach(([e,t])=>{r.dryRun||(e===`index`?t.write(`
|
|
2
2
|
`,r.output.tsConfig):t.write(`
|
|
3
3
|
|
|
4
4
|
`,r.output.tsConfig))})},P=async({context:e})=>{let t=O.resolve(e.config.output.path);e.config.output.clean&&s(t);let n={importFileExtension:e.config.output.importFileExtension},r=o(e.config);`bundle`in r.config&&r.config.bundle&&!e.config.dryRun&&(e.config._FRAGILE_CLIENT_BUNDLE_RENAMED=x({meta:n,outputPath:t,plugin:r,project:e.gen}));for(let t of e.registerPlugins())await t.run();for(let r of e.gen.render(n)){let n=O.resolve(t,r.path),i=O.dirname(n);e.config.dryRun||(D.mkdirSync(i,{recursive:!0}),D.writeFileSync(n,r.content,{encoding:`utf8`}))}},F=({patchOptions:e,spec:t})=>{if(!e)return;let n=t;if(`swagger`in n){if(e.version&&n.swagger&&(n.swagger=typeof e.version==`string`?e.version:e.version(n.swagger)),e.meta&&n.info&&e.meta(n.info),e.schemas&&n.definitions)for(let t in e.schemas){let r=n.definitions[t];if(!r||typeof r!=`object`)continue;let i=e.schemas[t];i(r)}if(e.operations&&n.paths)for(let t in e.operations){let[r,i]=t.split(` `);if(!r||!i)continue;let a=n.paths[i];if(!a)continue;let o=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!o||typeof o!=`object`)continue;let s=e.operations[t];s(o)}return}if(e.version&&n.openapi&&(n.openapi=typeof e.version==`string`?e.version:e.version(n.openapi)),e.meta&&n.info&&e.meta(n.info),n.components){if(e.schemas&&n.components.schemas)for(let t in e.schemas){let r=n.components.schemas[t];if(!r||typeof r!=`object`)continue;let i=e.schemas[t];i(r)}if(e.parameters&&n.components.parameters)for(let t in e.parameters){let r=n.components.parameters[t];if(!r||typeof r!=`object`)continue;let i=e.parameters[t];i(r)}if(e.requestBodies&&n.components.requestBodies)for(let t in e.requestBodies){let r=n.components.requestBodies[t];if(!r||typeof r!=`object`)continue;let i=e.requestBodies[t];i(r)}if(e.responses&&n.components.responses)for(let t in e.responses){let r=n.components.responses[t];if(!r||typeof r!=`object`)continue;let i=e.responses[t];i(r)}}if(e.operations&&n.paths)for(let t in e.operations){let[r,i]=t.split(` `);if(!r||!i)continue;let a=n.paths[i];if(!a)continue;let o=a[r.toLocaleLowerCase()]||a[r.toLocaleUpperCase()];if(!o||typeof o!=`object`)continue;let s=e.operations[t];s(o)}};var I=n(((e,n)=>{n.exports=o,o.sync=s;var r=t(`fs`);function i(e,t){var n=t.pathExt===void 0?process.env.PATHEXT:t.pathExt;if(!n||(n=n.split(`;`),n.indexOf(``)!==-1))return!0;for(var r=0;r<n.length;r++){var i=n[r].toLowerCase();if(i&&e.substr(-i.length).toLowerCase()===i)return!0}return!1}function a(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:i(t,n)}function o(e,t,n){r.stat(e,function(r,i){n(r,r?!1:a(i,e,t))})}function s(e,t){return a(r.statSync(e),e,t)}})),L=n(((e,n)=>{n.exports=i,i.sync=a;var r=t(`fs`);function i(e,t,n){r.stat(e,function(e,r){n(e,e?!1:o(r,t))})}function a(e,t){return o(r.statSync(e),t)}function o(e,t){return e.isFile()&&s(e,t)}function s(e,t){var n=e.mode,r=e.uid,i=e.gid,a=t.uid===void 0?process.getuid&&process.getuid():t.uid,o=t.gid===void 0?process.getgid&&process.getgid():t.gid,s=64,c=8,l=1,u=s|c;return n&l||n&c&&i===o||n&s&&r===a||n&u&&a===0}})),R=n(((e,n)=>{t(`fs`);var r=process.platform===`win32`||global.TESTING_WINDOWS?I():L();n.exports=i,i.sync=a;function i(e,t,n){if(typeof t==`function`&&(n=t,t={}),!n){if(typeof Promise!=`function`)throw TypeError(`callback not provided`);return new Promise(function(n,r){i(e,t||{},function(e,t){e?r(e):n(t)})})}r(e,t||{},function(e,r){e&&(e.code===`EACCES`||t&&t.ignoreErrors)&&(e=null,r=!1),n(e,r)})}function a(e,t){try{return r.sync(e,t||{})}catch(e){if(t&&t.ignoreErrors||e.code===`EACCES`)return!1;throw e}}})),z=n(((e,n)=>{let r=process.platform===`win32`||process.env.OSTYPE===`cygwin`||process.env.OSTYPE===`msys`,i=t(`path`),a=r?`;`:`:`,o=R(),s=e=>Object.assign(Error(`not found: ${e}`),{code:`ENOENT`}),c=(e,t)=>{let n=t.colon||a,i=e.match(/\//)||r&&e.match(/\\/)?[``]:[...r?[process.cwd()]:[],...(t.path||process.env.PATH||``).split(n)],o=r?t.pathExt||process.env.PATHEXT||`.EXE;.CMD;.BAT;.COM`:``,s=r?o.split(n):[``];return r&&e.indexOf(`.`)!==-1&&s[0]!==``&&s.unshift(``),{pathEnv:i,pathExt:s,pathExtExe:o}},l=(e,t,n)=>{typeof t==`function`&&(n=t,t={}),t||={};let{pathEnv:r,pathExt:a,pathExtExe:l}=c(e,t),u=[],d=n=>new Promise((a,o)=>{if(n===r.length)return t.all&&u.length?a(u):o(s(e));let c=r[n],l=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(l,e);a(f(!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d,n,0))}),f=(e,n,r)=>new Promise((i,s)=>{if(r===a.length)return i(d(n+1));let c=a[r];o(e+c,{pathExt:l},(a,o)=>{if(!a&&o)if(t.all)u.push(e+c);else return i(e+c);return i(f(e,n,r+1))})});return n?d(0).then(e=>n(null,e),n):d(0)};n.exports=l,l.sync=(e,t)=>{t||={};let{pathEnv:n,pathExt:r,pathExtExe:a}=c(e,t),l=[];for(let s=0;s<n.length;s++){let c=n[s],u=/^".*"$/.test(c)?c.slice(1,-1):c,d=i.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+d:d;for(let e=0;e<r.length;e++){let n=f+r[e];try{if(o.sync(n,{pathExt:a}))if(t.all)l.push(n);else return n}catch{}}}if(t.all&&l.length)return l;if(t.nothrow)return null;throw s(e)}})),B=n(((e,t)=>{let n=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)===`win32`?Object.keys(t).reverse().find(e=>e.toUpperCase()===`PATH`)||`Path`:`PATH`};t.exports=n,t.exports.default=n})),V=n(((e,n)=>{let r=t(`path`),i=z(),a=B();function o(e,t){let n=e.options.env||process.env,o=process.cwd(),s=e.options.cwd!=null,c=s&&process.chdir!==void 0&&!process.chdir.disabled;if(c)try{process.chdir(e.options.cwd)}catch{}let l;try{l=i.sync(e.command,{path:n[a({env:n})],pathExt:t?r.delimiter:void 0})}catch{}finally{c&&process.chdir(o)}return l&&=r.resolve(s?e.options.cwd:``,l),l}function s(e){return o(e)||o(e,!0)}n.exports=s})),H=n(((e,t)=>{let n=/([()\][%!^"`<>&|;, *?])/g;function r(e){return e=e.replace(n,`^$1`),e}function i(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,`$1$1\\"`),e=e.replace(/(?=(\\+?)?)\1$/,`$1$1`),e=`"${e}"`,e=e.replace(n,`^$1`),t&&(e=e.replace(n,`^$1`)),e}t.exports.command=r,t.exports.argument=i})),U=n(((e,t)=>{t.exports=/^#!(.*)/})),W=n(((e,t)=>{let n=U();t.exports=(e=``)=>{let t=e.match(n);if(!t)return null;let[r,i]=t[0].replace(/#! ?/,``).split(` `),a=r.split(`/`).pop();return a===`env`?i:i?`${a} ${i}`:a}})),ue=n(((e,n)=>{let r=t(`fs`),i=W();function a(e){let t=Buffer.alloc(150),n;try{n=r.openSync(e,`r`),r.readSync(n,t,0,150,0),r.closeSync(n)}catch{}return i(t.toString())}n.exports=a})),de=n(((e,n)=>{let r=t(`path`),i=V(),a=H(),o=ue(),s=process.platform===`win32`,c=/\.(?:com|exe)$/i,l=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(e){e.file=i(e);let t=e.file&&o(e.file);return t?(e.args.unshift(e.file),e.command=t,i(e)):e.file}function d(e){if(!s)return e;let t=u(e),n=!c.test(t);if(e.options.forceShell||n){let n=l.test(t);e.command=r.normalize(e.command),e.command=a.command(e.command),e.args=e.args.map(e=>a.argument(e,n)),e.args=[`/d`,`/s`,`/c`,`"${[e.command].concat(e.args).join(` `)}"`],e.command=process.env.comspec||`cmd.exe`,e.options.windowsVerbatimArguments=!0}return e}function f(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:d(r)}n.exports=f})),fe=n(((e,t)=>{let n=process.platform===`win32`;function r(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:`ENOENT`,errno:`ENOENT`,syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){if(!n)return;let r=e.emit;e.emit=function(n,i){if(n===`exit`){let n=a(i,t);if(n)return r.call(e,`error`,n)}return r.apply(e,arguments)}}function a(e,t){return n&&e===1&&!t.file?r(t.original,`spawn`):null}function o(e,t){return n&&e===1&&!t.file?r(t.original,`spawnSync`):null}t.exports={hookChildProcess:i,verifyENOENT:a,verifyENOENTSync:o,notFoundError:r}})),G=e(n(((e,n)=>{let r=t(`child_process`),i=de(),a=fe();function o(e,t,n){let o=i(e,t,n),s=r.spawn(o.command,o.args,o.options);return a.hookChildProcess(s,o),s}function s(e,t,n){let o=i(e,t,n),s=r.spawnSync(o.command,o.args,o.options);return s.error=s.error||a.verifyENOENTSync(s.status,o),s}n.exports=o,n.exports.spawn=o,n.exports.sync=s,n.exports._parse=i,n.exports._enoent=a}))(),1);const pe={biome:{args:e=>[`format`,`--write`,e],command:`biome`,name:`Biome (Format)`},prettier:{args:e=>[`--ignore-unknown`,e,`--write`,`--ignore-path`,`./.prettierignore`],command:`prettier`,name:`Prettier`}},me={biome:{args:e=>[`lint`,`--apply`,e],command:`biome`,name:`Biome (Lint)`},eslint:{args:e=>[e,`--fix`],command:`eslint`,name:`ESLint`},oxlint:{args:e=>[`--fix`,e],command:`oxlint`,name:`oxlint`}},he=({config:e})=>{if(e.output.format){let t=pe[e.output.format];console.log(`✨ Running ${t.name}`),(0,G.sync)(t.command,t.args(e.output.path))}if(e.output.lint){let t=me[e.output.lint];console.log(`✨ Running ${t.name}`),(0,G.sync)(t.command,t.args(e.output.path))}};function ge(e,t){return{...e,config:t,models:e.models.map(e=>_e(e)),services:ve(e.operations).map(ye),types:{}}}const _e=e=>({...e,$refs:e.$refs.filter((e,t,n)=>S(e,t,n)),enum:e.enum.filter((e,t,n)=>n.findIndex(t=>t.value===e.value)===t),enums:e.enums.filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t),imports:e.imports.filter((t,n,r)=>S(t,n,r)&&t!==e.name).sort(h)}),ve=e=>{let t=i(),n=new Map;return e.forEach(e=>{(e.tags?.length&&(t.plugins[`@hey-api/sdk`]?.config.asClass||m(t))?e.tags.filter(S):[`Default`]).forEach(t=>{let r={...e,service:Se(t)},i=n.get(r.service)||xe(r);i.$refs=[...i.$refs,...r.$refs],i.imports=[...i.imports,...r.imports],i.operations=[...i.operations,r],n.set(r.service,i)})}),Array.from(n.values())},ye=e=>{let t={...e};return t.operations=be(t),t.operations.forEach(e=>{t.imports.push(...e.imports)}),t.imports=t.imports.filter(S).sort(h),t},be=e=>{let t=new Map;return e.operations.map(e=>{let n={...e};n.imports.push(...n.parameters.flatMap(e=>e.imports));let r=n.responses.filter(e=>e.responseTypes.includes(`success`));n.imports.push(...r.flatMap(e=>e.imports));let i=n.name,a=t.get(i)||0;return a>0&&(n.name=`${i}${a}`),t.set(i,a+1),n})},xe=e=>({$refs:[],imports:[],name:e.service,operations:[]}),Se=e=>T({case:`PascalCase`,value:_(e)}),Ce=e=>{let t={...e,path:``};if(e.path&&(typeof e.path!=`string`||e.registry!==`hey-api`))return t.path=e.path,t;let[n,r]=e.path.split(`?`),i=(r||``).split(`&`).map(e=>e.split(`=`)),a=n||``;a.endsWith(`/`)&&(a=a.slice(0,a.length-1));let[,o]=a.split(`://`),[s,c,l]=(o||``).split(`/`);t.organization=c||e.organization,t.project=l||e.project;let u=[],d=`api_key`;t.api_key=i.find(([e])=>e===d)?.[1]||e.api_key||process.env.HEY_API_TOKEN,t.api_key&&u.push(`${d}=${t.api_key}`);let f=`branch`;t.branch=i.find(([e])=>e===f)?.[1]||e.branch,t.branch&&u.push(`${f}=${t.branch}`);let p=`commit_sha`;t.commit_sha=i.find(([e])=>e===p)?.[1]||e.commit_sha,t.commit_sha&&u.push(`${p}=${t.commit_sha}`);let m=`tags`;t.tags=i.find(([e])=>e===m)?.[1]?.split(`,`)||e.tags,t.tags?.length&&u.push(`${m}=${t.tags.join(`,`)}`);let h=`version`;if(t.version=i.find(([e])=>e===h)?.[1]||e.version,t.version&&u.push(`${h}=${t.version}`),!t.organization)throw Error(`missing organization - from which Hey API Platform organization do you want to generate your output?`);if(!t.project)throw Error(`missing project - from which Hey API Platform project do you want to generate your output?`);let g=u.join(`&`),_=s||`get.heyapi.dev`,v=_.startsWith(`localhost`),y=[v?`http`:`https`,_].join(`://`),b=v?[y,`v1`,`get`,t.organization,t.project].join(`/`):[y,t.organization,t.project].join(`/`);return t.path=g?`${b}?${g}`:b,t},K=(e,t)=>{let n=[],r=E.gray(`[Job ${t+1}] `),i=e.length,a=E.cyan(`Generating from ${i} ${i===1?`input`:`inputs`}:`);n.push(`${r}⏳ ${a}`),e.forEach((e,t)=>{let i=` [${t+1}] `,a=E.cyan(i),o=` `.repeat(i.length);if(typeof e.path!=`string`){n.push(`${r}${a}raw OpenAPI specification`);return}switch(e.registry){case`hey-api`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);n.push(`${r}${a}${t}`),e.branch&&n.push(`${r}${o}${E.gray(`branch:`)} ${E.green(e.branch)}`),e.commit_sha&&n.push(`${r}${o}${E.gray(`commit:`)} ${E.green(e.commit_sha)}`),e.tags?.length&&n.push(`${r}${o}${E.gray(`tags:`)} ${E.green(e.tags.join(`, `))}`),e.version&&n.push(`${r}${o}${E.gray(`version:`)} ${E.green(e.version)}`),n.push(`${r}${o}${E.gray(`registry:`)} ${E.green(`Hey API`)}`);break}case`readme`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);t?n.push(`${r}${a}${t}`):n.push(`${r}${a}${e.path}`),e.uuid&&n.push(`${r}${o}${E.gray(`uuid:`)} ${E.green(e.uuid)}`),n.push(`${r}${o}${E.gray(`registry:`)} ${E.green(`ReadMe`)}`);break}case`scalar`:{let t=[e.organization,e.project].filter(Boolean).join(`/`);n.push(`${r}${a}${t}`),n.push(`${r}${o}${E.gray(`registry:`)} ${E.green(`Scalar`)}`);break}default:n.push(`${r}${a}${e.path}`);break}});for(let e of n)console.log(e)},q=async({config:e,dependencies:t,jobIndex:n,logger:r,templates:i,watches:a})=>{let o=a||Array.from({length:e.input.length},()=>({headers:new Headers})),s=e.input.map(e=>Ce(e));e.logs.level!==`silent`&&!a&&K(s,n);let c=async(e,t)=>{let n=r.timeEvent(`spec`),{arrayBuffer:i,error:c,resolvedInput:l,response:u}=await ie({fetchOptions:e.fetch,inputPath:s[t].path,timeout:e.watch.timeout,watch:o[t]});if(n.timeEnd(),c&&!a)throw Error(`Request failed with status ${u.status}: ${u.statusText}`);return{arrayBuffer:i,resolvedInput:l}},l=(await Promise.all(e.input.map((e,t)=>c(e,t)))).filter(e=>e.arrayBuffer||e.resolvedInput),u,d;if(l.length){let o=new se,c=l.length>1?await o.bundleMany({arrayBuffer:l.map(e=>e.arrayBuffer),pathOrUrlOrSchemas:[],resolvedInputs:l.map(e=>e.resolvedInput)}):await o.bundle({arrayBuffer:l[0].arrayBuffer,pathOrUrlOrSchema:void 0,resolvedInput:l[0].resolvedInput});e.logs.level!==`silent`&&a&&(console.clear(),K(s,n));let f=r.timeEvent(`input.patch`);F({patchOptions:e.parser.patch,spec:c}),f.timeEnd();let p=r.timeEvent(`parser`);e.experimentalParser&&!w(e)&&!m(e)&&(d=ae({config:e,dependencies:t,logger:r,spec:c})),d?d.graph=v(d.ir,r).graph:u=ge(te({openApi:c}),e),p.timeEnd();let h=r.timeEvent(`generator`);d?await P({context:d}):u&&await N({client:u,openApi:c,templates:i}),h.timeEnd();let g=r.timeEvent(`postprocess`);if(!e.dryRun&&(he({config:e}),e.logs.level!==`silent`)){let t=process.env.INIT_CWD?`./${O.relative(process.env.INIT_CWD,e.output.path)}`:e.output.path,r=E.gray(`[Job ${n+1}] `);console.log(`${r}${E.green(`✅ Done!`)} Your output is in ${E.cyanBright(t)}`)}g.timeEnd()}let f=e.input.find((e,t)=>e.watch.enabled&&typeof s[t].path==`string`);return f&&setTimeout(()=>{q({config:e,dependencies:t,jobIndex:n,logger:r,templates:i,watches:o})},f.watch.interval),d||u},we=(e,t)=>{let n=[],r=Array.from({length:t?.padding??0}).fill(``);n.push(...r);let i=0,a=``;for(let t of e)t===`
|
|
@@ -1307,4 +1307,4 @@ export const request = <T>(config: OpenAPIConfig, options: ApiRequestOptions<T>)
|
|
|
1307
1307
|
onCancel(() => xhr.abort());
|
|
1308
1308
|
});
|
|
1309
1309
|
};`},useData:!0};const gt=()=>{k.registerHelper(`camelCase`,function(e){return T({case:`camelCase`,value:e})}),k.registerHelper(`equals`,function(e,t,n){return e===t?n.fn(this):n.inverse(this)}),k.registerHelper(`ifServicesResponse`,function(e,t){return i().plugins[`@hey-api/sdk`]?.config.response===e?t.fn(this):t.inverse(this)}),k.registerHelper(`ifdef`,function(...e){let t=e.pop();return e.every(e=>!e)?t.inverse(this):t.fn(this)}),k.registerHelper(`notEquals`,function(e,t,n){return e===t?n.inverse(this):n.fn(this)}),k.registerHelper(`transformServiceName`,function(e){return ne({config:i(),name:e})})},_t=()=>{gt();let e={client:k.template(Ee),core:{apiError:k.template(Ne),apiRequestOptions:k.template(Pe),apiResult:k.template(Fe),baseHttpRequest:k.template(He),cancelablePromise:k.template(Ue),httpRequest:k.template(st),request:k.template(lt),settings:k.template(ct)}};return k.registerPartial(`functions/base64`,k.template(Xe)),k.registerPartial(`functions/catchErrorCodes`,k.template(Ze)),k.registerPartial(`functions/getFormData`,k.template(Qe)),k.registerPartial(`functions/getQueryString`,k.template($e)),k.registerPartial(`functions/getUrl`,k.template(et)),k.registerPartial(`functions/isBlob`,k.template(tt)),k.registerPartial(`functions/isFormData`,k.template(nt)),k.registerPartial(`functions/isString`,k.template(rt)),k.registerPartial(`functions/isStringWithValue`,k.template(it)),k.registerPartial(`functions/isSuccess`,k.template(at)),k.registerPartial(`functions/resolve`,k.template(ot)),k.registerPartial(`fetch/getHeaders`,k.template(We)),k.registerPartial(`fetch/getRequestBody`,k.template(Ge)),k.registerPartial(`fetch/getResponseBody`,k.template(Ke)),k.registerPartial(`fetch/getResponseHeader`,k.template(qe)),k.registerPartial(`fetch/request`,k.template(Je)),k.registerPartial(`fetch/sendRequest`,k.template(Ye)),k.registerPartial(`xhr/getHeaders`,k.template(ut)),k.registerPartial(`xhr/getRequestBody`,k.template(dt)),k.registerPartial(`xhr/getResponseBody`,k.template(ft)),k.registerPartial(`xhr/getResponseHeader`,k.template(pt)),k.registerPartial(`xhr/request`,k.template(mt)),k.registerPartial(`xhr/sendRequest`,k.template(ht)),k.registerPartial(`axios/getHeaders`,k.template(Ie)),k.registerPartial(`axios/getRequestBody`,k.template(Le)),k.registerPartial(`axios/getResponseBody`,k.template(Re)),k.registerPartial(`axios/getResponseHeader`,k.template(ze)),k.registerPartial(`axios/request`,k.template(Be)),k.registerPartial(`axios/sendRequest`,k.template(Ve)),k.registerPartial(`angular/getHeaders`,k.template(De)),k.registerPartial(`angular/getRequestBody`,k.template(Oe)),k.registerPartial(`angular/getResponseBody`,k.template(ke)),k.registerPartial(`angular/getResponseHeader`,k.template(Ae)),k.registerPartial(`angular/request`,k.template(je)),k.registerPartial(`angular/sendRequest`,k.template(Me)),e};let J=0;const Y=e=>`${e}-${J++}`,X=e=>`${e}-end`,Z=e=>`${e}-length`,Q=e=>`${e}-start`,vt=(e,t)=>{if(e>200)return{color:E.red,type:`duration`};if(t>30)return{color:E.red,type:`percentage`};if(e>50)return{color:E.yellow,type:`duration`};if(t>10)return{color:E.yellow,type:`percentage`}};var $=class{events=[];end(e){let t,n=this.events;for(let r of e.position)t=n[r],t?.events&&(n=t.events);t&&!t.end&&(t.end=performance.mark(X(t.id)))}report(e=!0){let t=this.events[0];if(!t)return;let n=this.events[this.events.length-1],r=`root`,i=Y(r),a=performance.measure(Z(i),Q(t.id),X(n.id));return e&&this.reportEvent({end:n.end,events:this.events,id:i,indent:0,measure:a,name:r,start:t.start}),a}reportEvent({indent:e,...t}){let n=e?E.gray:E.cyan,r=t.events.length-1;t.events.forEach((i,a)=>{let o=performance.measure(Z(i.id),Q(i.id),X(i.id)),s=Math.ceil(o.duration*100)/100,c=Math.ceil(o.duration/t.measure.duration*100*100)/100,l=e?vt(s,c):void 0,u=`${s.toFixed(2).padStart(8)}ms`;l?.type===`duration`&&(u=l.color(u));let d=a===r?`└─ `:`├─ `,f=e?`│ `.repeat(e-1)+d:``,p=38-f.length,m=e?`↳ `:``,h=`${e?` `.repeat(e-1)+m:``}${c.toFixed(2)}%`;l?.type===`percentage`&&(h=l.color(h));let g=E.gray(`[root] `);console.log(`${g}${E.gray(f)}${n(`${i.name.padEnd(p)} ${u} (${h})`)}`),this.reportEvent({...i,indent:e+1,measure:o})})}start(e){return performance.mark(Q(e))}storeEvent({result:e,...t}){let n=t.events.length-1,r=t.events[n];if(r&&!r.end){e.position=[...e.position,n],this.storeEvent({...t,events:r.events,result:e});return}let i=t.events.push({...t,events:[]});e.position=[...e.position,i-1]}timeEvent(e){let t=Y(e),n=this.start(t),r={events:this.events,id:t,name:e,start:n},i={position:[]};return this.storeEvent({...r,result:i}),{mark:n,timeEnd:()=>this.end(i)}}};const yt=async(e,t=new $)=>{let n=typeof e==`function`?await e():e,i=n?n instanceof Array?n:[n]:[],a=i.find(e=>p(e).level!==`silent`)?.logs;typeof a==`string`&&(a=p({logs:a}));let o;try{ce();let e=t.timeEvent(`createClient`),n=t.timeEvent(`config`);o=await re({logger:t,userConfigs:i}),o.results.some(e=>e.config.logs.level!==`silent`)&&Te(),n.timeEnd();let r=o.results.flatMap(e=>e.errors.map(t=>({error:t,jobIndex:e.jobIndex})));if(r.length)throw new d(r);let a=t.timeEvent(`handlebars`),s=_t();a.timeEnd();let c=(await Promise.all(o.results.map(async e=>{try{return await q({config:e.config,dependencies:o.dependencies,jobIndex:e.jobIndex,logger:t,templates:s})}catch(t){throw new ee(``,{error:t,jobIndex:e.jobIndex})}}))).filter(e=>!!e);e.timeEnd();let l=o.results.some(e=>e.config.logs.level===`debug`);return t.report(l),c}catch(e){let t=o?.results??[],n=t.find(e=>e.config.logs.level!==`silent`)?.config.logs??t[0]?.config.logs??a,s=t.some(e=>e.config.dryRun)??i.some(e=>e.dryRun)??!1,c=n?.file&&!s?r(e,n.path??``):void 0;throw(!n||n.level!==`silent`)&&(l({error:e,logPath:c}),await u({error:e,isInteractive:t.some(e=>e.config.interactive)??i.some(e=>e.interactive)??!1})&&await b(e)),e}},bt={stringCase:T};E.enabled=oe().hasBasic;const xt=async e=>typeof e==`function`?await e():e;export{$ as i,bt as n,yt as r,xt as t};
|
|
1310
|
-
//# sourceMappingURL=src-
|
|
1310
|
+
//# sourceMappingURL=src-Be7tT6MZ.js.map
|