@ir-kit/openapi-typescript 0.1.2 → 0.2.1
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 +3 -3
- package/dist/generate.d.ts +4 -4
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +2 -2
- package/dist/generate.js.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @ir-kit/openapi-typescript
|
|
2
2
|
|
|
3
|
-
Thin programmatic wrapper around [`@hey-api/openapi-ts`](https://www.npmjs.com/package/@hey-api/openapi-ts) that exposes the same `generate()` shape as [`@ir-kit/openapi-{go,kotlin,swift}`](https://github.com/
|
|
3
|
+
Thin programmatic wrapper around [`@hey-api/openapi-ts`](https://www.npmjs.com/package/@hey-api/openapi-ts) that exposes the same `generate()` shape as [`@ir-kit/openapi-{go,kotlin,swift}`](https://github.com/ahmedrowaihi/ir-kit). Lets the [`sdk-regen`](https://github.com/ahmedrowaihi/ir-kit/tree/main/actions/sdk-regen) GitHub Action drive a TypeScript SDK alongside the native ones — same workflow, same inputs, four targets.
|
|
4
4
|
|
|
5
|
-
Part of [ir-kit](https://github.com/
|
|
5
|
+
Part of [ir-kit](https://github.com/ahmedrowaihi/ir-kit). **No new codegen** — the entire TypeScript pipeline (types, sdk, schemas, transformers, validators, query hooks, ...) is hey-api's; this package only normalises the calling convention and the result shape.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -63,7 +63,7 @@ interface GenerateResult {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
Matches the result shape of `@ir-kit/openapi-go` / `-kotlin` / `-swift`, so downstream tooling (the [`sdk-regen`](https://github.com/
|
|
66
|
+
Matches the result shape of `@ir-kit/openapi-go` / `-kotlin` / `-swift`, so downstream tooling (the [`sdk-regen`](https://github.com/ahmedrowaihi/ir-kit/tree/main/actions/sdk-regen) action, your own CI scripts) can iterate the four packages uniformly.
|
|
67
67
|
|
|
68
68
|
## Why a wrapper
|
|
69
69
|
|
package/dist/generate.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { type UserConfig } from "@hey-api/openapi-ts";
|
|
|
2
2
|
import type { NormalizeOptions } from "@ir-kit/openapi";
|
|
3
3
|
export interface GenerateOptions {
|
|
4
4
|
/**
|
|
5
|
-
* Path
|
|
6
|
-
* delegates to `@hey-api/json-schema-ref-parser`
|
|
7
|
-
*
|
|
5
|
+
* Path, URL, or pre-parsed OpenAPI 3.x spec. Forwarded to hey-api
|
|
6
|
+
* which delegates to `@hey-api/json-schema-ref-parser` for strings
|
|
7
|
+
* and accepts objects directly.
|
|
8
8
|
*/
|
|
9
|
-
input: string
|
|
9
|
+
input: string | Record<string, unknown>;
|
|
10
10
|
/** Directory the SDK is written to (created if missing). */
|
|
11
11
|
output: string;
|
|
12
12
|
/**
|
package/dist/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAiBxD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAiBxD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAChC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;CACxC;AAED,MAAM,WAAW,SAAS;IACxB,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAc7E"}
|
package/dist/generate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readdir, stat } from "node:fs/promises";
|
|
2
2
|
import { join, relative, resolve } from "node:path";
|
|
3
3
|
import { createClient } from "@hey-api/openapi-ts";
|
|
4
|
-
import {
|
|
4
|
+
import { loadOpenAPI } from "@ir-kit/openapi-loader";
|
|
5
5
|
/**
|
|
6
6
|
* Default plugin set — emits a runnable client SDK ready to drop into a
|
|
7
7
|
* TypeScript project: types from schemas, the SDK functions, and the
|
|
@@ -24,7 +24,7 @@ const DEFAULT_PLUGINS = [
|
|
|
24
24
|
export async function generate(opts) {
|
|
25
25
|
const out = resolve(process.cwd(), opts.output);
|
|
26
26
|
const input = opts.normalize
|
|
27
|
-
? await
|
|
27
|
+
? await loadOpenAPI({ input: opts.input, normalize: opts.normalize })
|
|
28
28
|
: opts.input;
|
|
29
29
|
const config = {
|
|
30
30
|
input,
|
package/dist/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM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G,EAAE,KAAK,EAAE,CAAC;AAChC,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,YAAY,CAAC,GAAW;IACrC,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,MAAM,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,IAAI,CACjB,IAAY,EACZ,OAAe,EACf,GAAgB;IAEhB,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAClC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,CAAC,WAAW,EAAE;YAAE,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;;YAC5C,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ir-kit/openapi-typescript",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Thin programmatic wrapper around @hey-api/openapi-ts that ships a `generate()` matching the shape of @ir-kit/openapi-{go,kotlin,swift}, so the same sdk-regen workflow can target TypeScript clients (types + sdk + schemas + transformers + validators + ...) via hey-api's plugin pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"client",
|
|
11
11
|
"hey-api"
|
|
12
12
|
],
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/ahmedrowaihi/ir-kit/tree/main/packages/openapi/typescript",
|
|
14
14
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
15
|
+
"url": "https://github.com/ahmedrowaihi/ir-kit/issues"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/
|
|
24
|
+
"url": "git+https://github.com/ahmedrowaihi/ir-kit.git",
|
|
25
25
|
"directory": "packages/openapi/typescript"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"@hey-api/openapi-ts": ">=0.97.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@ir-kit/openapi": "0.
|
|
52
|
-
"@ir-kit/openapi-
|
|
51
|
+
"@ir-kit/openapi": "0.4.0",
|
|
52
|
+
"@ir-kit/openapi-loader": "0.3.0",
|
|
53
|
+
"@ir-kit/openapi-tools": "0.3.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@hey-api/openapi-ts": "^0.97.0",
|