@hey-api/openapi-ts 0.88.1 → 0.88.2

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.
@@ -167,6 +167,8 @@ export const createSseClient = <TData = unknown>({
167
167
  const { done, value } = await reader.read();
168
168
  if (done) break;
169
169
  buffer += value;
170
+ // Normalize line endings: CRLF -> LF, then CR -> LF
171
+ buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
170
172
 
171
173
  const chunks = buffer.split('\n\n');
172
174
  buffer = chunks.pop() ?? '';
package/dist/run.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- const e=require(`./openApi-DszQAwQH.cjs`),t=require(`./src-9qIIwEzI.cjs`);let n=require(`commander`);var r=`0.88.1`,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`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).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(`-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?`).parse(process.argv).opts(),s;try{s=o(e,[`dryRun`,`logFile`]),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();
2
+ const e=require(`./openApi-DszQAwQH.cjs`),t=require(`./src-9qIIwEzI.cjs`);let n=require(`commander`);var r=`0.88.2`,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`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).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(`-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?`).parse(process.argv).opts(),s;try{s=o(e,[`dryRun`,`logFile`]),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.88.1\",\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.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\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.mts\",\n \"default\": \"./dist/internal.mjs\"\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 \"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.3\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.2\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.2\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.2\",\n \"open\": \"11.0.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.2\",\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 \"ky\": \"1.14.0\",\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.23\",\n \"yaml\": \"2.8.1\",\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('-c, --client <value>', 'HTTP client to generate')\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\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('-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 .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, ['dryRun', 'logFile']);\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":";2GAEa,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,OAAO,uBAAwB,0BAA0B,CACzD,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CAAC,SAAU,UAAU,CAAC,CAErD,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,GCjHnB,GAAQ"}
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.88.2\",\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.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\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.mts\",\n \"default\": \"./dist/internal.mjs\"\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 \"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.3\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.2\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.2\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.2\",\n \"open\": \"11.0.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.2\",\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 \"ky\": \"1.14.0\",\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.23\",\n \"yaml\": \"2.8.1\",\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('-c, --client <value>', 'HTTP client to generate')\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\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('-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 .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, ['dryRun', 'logFile']);\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":";2GAEa,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,OAAO,uBAAwB,0BAA0B,CACzD,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CAAC,SAAU,UAAU,CAAC,CAErD,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,GCjHnB,GAAQ"}
package/dist/run.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import"./openApi-DlyxIg9f.mjs";import{r as e}from"./src-BNSjnWaN.mjs";import{Command as t}from"commander";var n=`0.88.1`,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`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).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(`-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?`).parse(process.argv).opts(),s;try{s=a(o,[`dryRun`,`logFile`]),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{};
2
+ import"./openApi-DlyxIg9f.mjs";import{r as e}from"./src-BNSjnWaN.mjs";import{Command as t}from"commander";var n=`0.88.2`,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`).option(`-d, --debug`,`Set log level to debug`).option(`--dry-run [value]`,`Skip writing files to disk?`).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(`-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?`).parse(process.argv).opts(),s;try{s=a(o,[`dryRun`,`logFile`]),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.mjs.map
package/dist/run.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.mjs","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.88.1\",\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.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\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.mts\",\n \"default\": \"./dist/internal.mjs\"\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 \"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.3\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.2\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.2\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.2\",\n \"open\": \"11.0.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.2\",\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 \"ky\": \"1.14.0\",\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.23\",\n \"yaml\": \"2.8.1\",\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('-c, --client <value>', 'HTTP client to generate')\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\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('-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 .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, ['dryRun', 'logFile']);\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":";gHAEa,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,OAAO,uBAAwB,0BAA0B,CACzD,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CAAC,SAAU,UAAU,CAAC,CAErD,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,KCjHX"}
1
+ {"version":3,"file":"run.mjs","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.88.2\",\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.mjs\",\n \"types\": \"./dist/index.d.mts\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/index.d.mts\",\n \"default\": \"./dist/index.mjs\"\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.mts\",\n \"default\": \"./dist/internal.mjs\"\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 \"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.3\",\n \"@hey-api/json-schema-ref-parser\": \"1.2.2\",\n \"ansi-colors\": \"4.1.3\",\n \"c12\": \"3.3.2\",\n \"color-support\": \"1.1.3\",\n \"commander\": \"14.0.2\",\n \"open\": \"11.0.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.2\",\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 \"ky\": \"1.14.0\",\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.23\",\n \"yaml\": \"2.8.1\",\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('-c, --client <value>', 'HTTP client to generate')\n .option('-d, --debug', 'Set log level to debug')\n .option('--dry-run [value]', 'Skip writing files to disk?')\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('-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 .parse(process.argv)\n .opts();\n\n let userConfig: Record<string, unknown>;\n\n try {\n userConfig = processParams(params, ['dryRun', 'logFile']);\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":";gHAEa,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,OAAO,uBAAwB,0BAA0B,CACzD,OAAO,cAAe,yBAAyB,CAC/C,OAAO,oBAAqB,8BAA8B,CAC1D,OAAO,qBAAsB,0BAA0B,CACvD,OACC,sBACA,uDACD,CACA,OAAO,qBAAsB,cAAc,CAC3C,OAAO,uBAAwB,gBAAgB,CAC/C,OAAO,2BAA4B,oCAAoC,CACvE,OAAO,eAAgB,0BAA0B,CACjD,OACC,gBACA,yFACD,CACA,OACC,sBACA,qDACD,CACA,MAAM,QAAQ,KAAK,CACnB,MAAM,CAELC,EAEJ,GAAI,CACF,EAAa,EAAc,EAAQ,CAAC,SAAU,UAAU,CAAC,CAErD,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,KCjHX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hey-api/openapi-ts",
3
- "version": "0.88.1",
3
+ "version": "0.88.2",
4
4
  "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.",
5
5
  "homepage": "https://heyapi.dev/",
6
6
  "repository": {