getta 1.0.26 → 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 +1 -1
- package/dist/cjs/cli/command.cjs +1 -1
- package/dist/cjs/cli/command.cjs.map +1 -1
- package/dist/esm/cli/command.mjs +1 -1
- package/dist/esm/cli/command.mjs.map +1 -1
- package/dist/production.analysis.txt +8 -8
- package/dist/types/cjs/cli/command.d.cts +1 -1
- package/dist/types/cjs/cli/command.d.cts.map +1 -1
- package/dist/types/esm/cli/command.d.ts +1 -1
- package/dist/types/esm/cli/command.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/cli/command.test.ts +2 -2
- package/src/cli/command.ts +1 -1
- package/src/cli/handler.test.ts +1 -1
- package/src/cli.test.ts +2 -2
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-
|
|
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/dist/cjs/cli/command.cjs
CHANGED
|
@@ -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-
|
|
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-
|
|
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"}
|
package/dist/esm/cli/command.mjs
CHANGED
|
@@ -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-
|
|
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-
|
|
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.
|
|
5
|
-
original size: 13.
|
|
4
|
+
bundle size: 12.176 KB
|
|
5
|
+
original size: 13.186 KB
|
|
6
6
|
code reduction: 7.66 %
|
|
7
7
|
module count: 4
|
|
8
8
|
|
|
9
9
|
█████████████████████████████████████████░░░░░░░░░
|
|
10
10
|
file: /src/cli/generator.ts
|
|
11
|
-
bundle space: 82.
|
|
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 %
|
|
@@ -26,16 +26,16 @@ dependents: 1
|
|
|
26
26
|
|
|
27
27
|
███░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
|
|
28
28
|
file: /src/cli/command.ts
|
|
29
|
-
bundle space: 6.
|
|
30
|
-
rendered size:
|
|
31
|
-
original size:
|
|
32
|
-
code reduction: 22.
|
|
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.
|
|
38
|
+
bundle space: 1.59 %
|
|
39
39
|
rendered size: 193 Bytes
|
|
40
40
|
original size: 382 Bytes
|
|
41
41
|
code reduction: 49.48 %
|
|
@@ -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-
|
|
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,
|
|
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-
|
|
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,
|
|
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"}
|