getta 1.0.25 → 1.0.27

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/README.md CHANGED
@@ -186,7 +186,7 @@ const getResponse = await restClient.getProduct({ pathTemplateData: { 'id,+': '1
186
186
  The `getta` command generates a TypeScript client from an OpenAPI 3.x JSON or YAML document. Install Getta in your project, then run the command with the spec path and an optional output path. The default output is `api.generated.ts`.
187
187
 
188
188
  ```shell
189
- pnpm exec getta generate-openapi ./openapi.json ./src/api.generated.ts
189
+ pnpm exec getta generate-client ./openapi.json ./src/api.generated.ts
190
190
  ```
191
191
 
192
192
  The command accepts a `--name` option to change the exported client factory name. YAML specs should use a `.yaml` or `.yml` file extension.
package/bin/getta.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Is unresolved before library has been built.
4
- // eslint-disable-next-line import-x/no-unresolved
5
- import { runGettaCli } from 'getta/cli.mjs';
3
+ // Subpath does not support extension
4
+ // eslint-disable-next-line import-x/extensions
5
+ import { runGettaCli } from 'getta/cli';
6
6
 
7
7
  await runGettaCli();
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./handler.cjs");exports.handler=e.handler,exports.builder=e=>e.positional("schema",{demandOption:!0,describe:"OpenAPI 3.x JSON or YAML document.",type:"string"}).positional("output",{default:"api.generated.ts",describe:"TypeScript module to generate.",type:"string"}).option("name",{default:"createApiClient",describe:"Exported client factory name.",type:"string"}).check(({name:e})=>{if(!/^[A-Za-z_$][\w$]*$/u.test(e))throw new Error("--name must be a TypeScript identifier.");return!0}),exports.command="generate-openapi <schema> [output]",exports.describe="Generate a typed Getta client from an OpenAPI 3.x document.";
1
+ "use strict";var e=require("./handler.cjs");exports.handler=e.handler,exports.builder=e=>e.positional("schema",{demandOption:!0,describe:"OpenAPI 3.x JSON or YAML document.",type:"string"}).positional("output",{default:"api.generated.ts",describe:"TypeScript module to generate.",type:"string"}).option("name",{default:"createApiClient",describe:"Exported client factory name.",type:"string"}).check(({name:e})=>{if(!/^[A-Za-z_$][\w$]*$/u.test(e))throw new Error("--name must be a TypeScript identifier.");return!0}),exports.command="generate-client <schema> [output]",exports.describe="Generate a typed Getta client from an OpenAPI 3.x document.";
2
2
  //# sourceMappingURL=command.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.cjs","sources":["../../../src/cli/command.ts"],"sourcesContent":["import { type CommandBuilder } from 'yargs';\nimport { type GenerateOpenApiArguments } from '#cli/handler.ts';\n\nexport const builder: CommandBuilder<object, GenerateOpenApiArguments> = yargs =>\n yargs\n .positional('schema', {\n demandOption: true,\n describe: 'OpenAPI 3.x JSON or YAML document.',\n type: 'string',\n })\n .positional('output', {\n default: 'api.generated.ts',\n describe: 'TypeScript module to generate.',\n type: 'string',\n })\n .option('name', {\n default: 'createApiClient',\n describe: 'Exported client factory name.',\n type: 'string',\n })\n .check(({ name }) => {\n if (!/^[A-Za-z_$][\\w$]*$/u.test(name)) {\n throw new Error('--name must be a TypeScript identifier.');\n }\n\n return true;\n });\n\nexport const command = 'generate-openapi <schema> [output]';\nexport const describe = 'Generate a typed Getta client from an OpenAPI 3.x document.';\nexport { handler } from './handler.ts';\n"],"names":["yargs","positional","demandOption","describe","type","default","option","check","name","test","Error"],"mappings":"sFAGyEA,GACvEA,EACGC,WAAW,SAAU,CACpBC,cAAc,EACdC,SAAU,qCACVC,KAAM,WAEPH,WAAW,SAAU,CACpBI,QAAS,mBACTF,SAAU,iCACVC,KAAM,WAEPE,OAAO,OAAQ,CACdD,QAAS,kBACTF,SAAU,gCACVC,KAAM,WAEPG,MAAM,EAAGC,WACR,IAAK,sBAAsBC,KAAKD,GAC9B,MAAM,IAAIE,MAAM,2CAGlB,OAAO,oBAGU,sDACC"}
1
+ {"version":3,"file":"command.cjs","sources":["../../../src/cli/command.ts"],"sourcesContent":["import { type CommandBuilder } from 'yargs';\nimport { type GenerateOpenApiArguments } from '#cli/handler.ts';\n\nexport const builder: CommandBuilder<object, GenerateOpenApiArguments> = yargs =>\n yargs\n .positional('schema', {\n demandOption: true,\n describe: 'OpenAPI 3.x JSON or YAML document.',\n type: 'string',\n })\n .positional('output', {\n default: 'api.generated.ts',\n describe: 'TypeScript module to generate.',\n type: 'string',\n })\n .option('name', {\n default: 'createApiClient',\n describe: 'Exported client factory name.',\n type: 'string',\n })\n .check(({ name }) => {\n if (!/^[A-Za-z_$][\\w$]*$/u.test(name)) {\n throw new Error('--name must be a TypeScript identifier.');\n }\n\n return true;\n });\n\nexport const command = 'generate-client <schema> [output]';\nexport const describe = 'Generate a typed Getta client from an OpenAPI 3.x document.';\nexport { handler } from './handler.ts';\n"],"names":["yargs","positional","demandOption","describe","type","default","option","check","name","test","Error"],"mappings":"sFAGyEA,GACvEA,EACGC,WAAW,SAAU,CACpBC,cAAc,EACdC,SAAU,qCACVC,KAAM,WAEPH,WAAW,SAAU,CACpBI,QAAS,mBACTF,SAAU,iCACVC,KAAM,WAEPE,OAAO,OAAQ,CACdD,QAAS,kBACTF,SAAU,gCACVC,KAAM,WAEPG,MAAM,EAAGC,WACR,IAAK,sBAAsBC,KAAKD,GAC9B,MAAM,IAAIE,MAAM,2CAGlB,OAAO,oBAGU,qDACC"}
@@ -1,2 +1,2 @@
1
- export{handler}from"./handler.mjs";const e=e=>e.positional("schema",{demandOption:!0,describe:"OpenAPI 3.x JSON or YAML document.",type:"string"}).positional("output",{default:"api.generated.ts",describe:"TypeScript module to generate.",type:"string"}).option("name",{default:"createApiClient",describe:"Exported client factory name.",type:"string"}).check(({name:e})=>{if(!/^[A-Za-z_$][\w$]*$/u.test(e))throw new Error("--name must be a TypeScript identifier.");return!0}),t="generate-openapi <schema> [output]",n="Generate a typed Getta client from an OpenAPI 3.x document.";export{e as builder,t as command,n as describe};
1
+ export{handler}from"./handler.mjs";const e=e=>e.positional("schema",{demandOption:!0,describe:"OpenAPI 3.x JSON or YAML document.",type:"string"}).positional("output",{default:"api.generated.ts",describe:"TypeScript module to generate.",type:"string"}).option("name",{default:"createApiClient",describe:"Exported client factory name.",type:"string"}).check(({name:e})=>{if(!/^[A-Za-z_$][\w$]*$/u.test(e))throw new Error("--name must be a TypeScript identifier.");return!0}),t="generate-client <schema> [output]",n="Generate a typed Getta client from an OpenAPI 3.x document.";export{e as builder,t as command,n as describe};
2
2
  //# sourceMappingURL=command.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.mjs","sources":["../../../src/cli/command.ts"],"sourcesContent":["import { type CommandBuilder } from 'yargs';\nimport { type GenerateOpenApiArguments } from '#cli/handler.ts';\n\nexport const builder: CommandBuilder<object, GenerateOpenApiArguments> = yargs =>\n yargs\n .positional('schema', {\n demandOption: true,\n describe: 'OpenAPI 3.x JSON or YAML document.',\n type: 'string',\n })\n .positional('output', {\n default: 'api.generated.ts',\n describe: 'TypeScript module to generate.',\n type: 'string',\n })\n .option('name', {\n default: 'createApiClient',\n describe: 'Exported client factory name.',\n type: 'string',\n })\n .check(({ name }) => {\n if (!/^[A-Za-z_$][\\w$]*$/u.test(name)) {\n throw new Error('--name must be a TypeScript identifier.');\n }\n\n return true;\n });\n\nexport const command = 'generate-openapi <schema> [output]';\nexport const describe = 'Generate a typed Getta client from an OpenAPI 3.x document.';\nexport { handler } from './handler.ts';\n"],"names":["builder","yargs","positional","demandOption","describe","type","default","option","check","name","test","Error","command"],"mappings":"yCAGaA,EAA4DC,GACvEA,EACGC,WAAW,SAAU,CACpBC,cAAc,EACdC,SAAU,qCACVC,KAAM,WAEPH,WAAW,SAAU,CACpBI,QAAS,mBACTF,SAAU,iCACVC,KAAM,WAEPE,OAAO,OAAQ,CACdD,QAAS,kBACTF,SAAU,gCACVC,KAAM,WAEPG,MAAM,EAAGC,WACR,IAAK,sBAAsBC,KAAKD,GAC9B,MAAM,IAAIE,MAAM,2CAGlB,OAAO,IAGAC,EAAU,qCACVR,EAAW"}
1
+ {"version":3,"file":"command.mjs","sources":["../../../src/cli/command.ts"],"sourcesContent":["import { type CommandBuilder } from 'yargs';\nimport { type GenerateOpenApiArguments } from '#cli/handler.ts';\n\nexport const builder: CommandBuilder<object, GenerateOpenApiArguments> = yargs =>\n yargs\n .positional('schema', {\n demandOption: true,\n describe: 'OpenAPI 3.x JSON or YAML document.',\n type: 'string',\n })\n .positional('output', {\n default: 'api.generated.ts',\n describe: 'TypeScript module to generate.',\n type: 'string',\n })\n .option('name', {\n default: 'createApiClient',\n describe: 'Exported client factory name.',\n type: 'string',\n })\n .check(({ name }) => {\n if (!/^[A-Za-z_$][\\w$]*$/u.test(name)) {\n throw new Error('--name must be a TypeScript identifier.');\n }\n\n return true;\n });\n\nexport const command = 'generate-client <schema> [output]';\nexport const describe = 'Generate a typed Getta client from an OpenAPI 3.x document.';\nexport { handler } from './handler.ts';\n"],"names":["builder","yargs","positional","demandOption","describe","type","default","option","check","name","test","Error","command"],"mappings":"yCAGaA,EAA4DC,GACvEA,EACGC,WAAW,SAAU,CACpBC,cAAc,EACdC,SAAU,qCACVC,KAAM,WAEPH,WAAW,SAAU,CACpBI,QAAS,mBACTF,SAAU,iCACVC,KAAM,WAEPE,OAAO,OAAQ,CACdD,QAAS,kBACTF,SAAU,gCACVC,KAAM,WAEPG,MAAM,EAAGC,WACR,IAAK,sBAAsBC,KAAKD,GAC9B,MAAM,IAAIE,MAAM,2CAGlB,OAAO,IAGAC,EAAU,oCACVR,EAAW"}
@@ -1,14 +1,14 @@
1
1
  -----------------------------
2
2
  Rollup File Analysis
3
3
  -----------------------------
4
- bundle size: 12.076 KB
5
- original size: 13.187 KB
6
- code reduction: 8.42 %
4
+ bundle size: 12.176 KB
5
+ original size: 13.186 KB
6
+ code reduction: 7.66 %
7
7
  module count: 4
8
8
 
9
9
  █████████████████████████████████████████░░░░░░░░░
10
10
  file: /src/cli/generator.ts
11
- bundle space: 83.21 %
11
+ bundle space: 82.53 %
12
12
  rendered size: 10.049 KB
13
13
  original size: 10.398 KB
14
14
  code reduction: 3.36 %
@@ -17,27 +17,27 @@ dependents: 1
17
17
 
18
18
  ████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
19
19
  file: /src/cli/handler.ts
20
- bundle space: 8.98 %
21
- rendered size: 1.085 KB
20
+ bundle space: 9.67 %
21
+ rendered size: 1.178 KB
22
22
  original size: 1.426 KB
23
- code reduction: 23.91 %
23
+ code reduction: 17.39 %
24
24
  dependents: 1
25
25
  - /src/cli/command.ts
26
26
 
27
27
  ███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
28
28
  file: /src/cli/command.ts
29
- bundle space: 6.27 %
30
- rendered size: 757 Bytes
31
- original size: 981 Bytes
32
- code reduction: 22.83 %
29
+ bundle space: 6.21 %
30
+ rendered size: 756 Bytes
31
+ original size: 980 Bytes
32
+ code reduction: 22.86 %
33
33
  dependents: 1
34
34
  - /src/cli.ts
35
35
 
36
36
  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
37
37
  file: /src/cli.ts
38
- bundle space: 1.53 %
39
- rendered size: 185 Bytes
38
+ bundle space: 1.59 %
39
+ rendered size: 193 Bytes
40
40
  original size: 382 Bytes
41
- code reduction: 51.57 %
41
+ code reduction: 49.48 %
42
42
  dependents: 0
43
43
 
@@ -1,7 +1,7 @@
1
1
  import { type CommandBuilder } from 'yargs';
2
2
  import { type GenerateOpenApiArguments } from '#cli/handler.cts';
3
3
  export declare const builder: CommandBuilder<object, GenerateOpenApiArguments>;
4
- export declare const command = "generate-openapi <schema> [output]";
4
+ export declare const command = "generate-client <schema> [output]";
5
5
  export declare const describe = "Generate a typed Getta client from an OpenAPI 3.x document.";
6
6
  export { handler } from './handler.cts';
7
7
  //# sourceMappingURL=command.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.cts","sourceRoot":"","sources":["../../../../src/cli/command.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,wBAAwB,CAuB/D,CAAC;AAEP,eAAO,MAAM,OAAO,uCAAuC,CAAC;AAC5D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"command.d.cts","sourceRoot":"","sources":["../../../../src/cli/command.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,wBAAwB,CAuB/D,CAAC;AAEP,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type CommandBuilder } from 'yargs';
2
2
  import { type GenerateOpenApiArguments } from '#cli/handler.ts';
3
3
  export declare const builder: CommandBuilder<object, GenerateOpenApiArguments>;
4
- export declare const command = "generate-openapi <schema> [output]";
4
+ export declare const command = "generate-client <schema> [output]";
5
5
  export declare const describe = "Generate a typed Getta client from an OpenAPI 3.x document.";
6
6
  export { handler } from './handler.ts';
7
7
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,wBAAwB,CAuB/D,CAAC;AAEP,eAAO,MAAM,OAAO,uCAAuC,CAAC;AAC5D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE,wBAAwB,CAuB/D,CAAC;AAEP,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,QAAQ,gEAAgE,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}