@ir-kit/openapi-ts-k6 0.1.0

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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ahmed Rowaihi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @ir-kit/openapi-ts-k6
2
+
3
+ Thin [`@hey-api/openapi-ts`](https://github.com/hey-api/openapi-ts) plugin that wraps [`@ir-kit/k6-gen`](../gen). For users who already drive code generation through `openapi-ts.config.ts` — otherwise prefer the [`k6-tools` CLI](../tools).
4
+
5
+ ```ts
6
+ // openapi-ts.config.ts
7
+ import { defineConfig } from "@hey-api/openapi-ts";
8
+ import { defineConfig as defineK6 } from "@ir-kit/openapi-ts-k6";
9
+
10
+ export default defineConfig({
11
+ input: "./openapi.yaml",
12
+ output: "./src/generated",
13
+ plugins: [
14
+ defineK6({ output: "./k6", defaultBaseUrl: "https://api.example.com" }),
15
+ ],
16
+ });
17
+ ```
18
+
19
+ Emits the same four files (`types.ts`, `client.ts`, `data.ts`, `index.ts`) under `<hey-api output.path>/<plugin output>` — see [@ir-kit/k6-gen](../gen) for output shape.
20
+
21
+ The plugin is a single function call: it reads the bundled spec from hey-api's context and delegates to `generate()`. No `$` DSL, no symbol planner, no plugin hooks — just spec → files.
@@ -0,0 +1,6 @@
1
+ import type { K6HeyApiPlugin } from "./types.js";
2
+ export declare const defaultConfig: K6HeyApiPlugin["Config"];
3
+ export declare const defineConfig: (userConfig?: Omit<import("./types.js").UserConfig, "name"> | undefined) => Omit<import("@hey-api/shared").Plugin.Config<import("@hey-api/shared").Plugin.Types<import("./types.js").UserConfig, import("./types.js").Config, never>>, "name"> & {
4
+ name: any;
5
+ };
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,QAAQ,CAQlD,CAAC;AAEF,eAAO,MAAM,YAAY;;CAAoC,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,13 @@
1
+ import { definePluginConfig } from "@hey-api/shared";
2
+ import { handler } from "./plugin.js";
3
+ export const defaultConfig = {
4
+ config: {
5
+ output: "./k6",
6
+ },
7
+ dependencies: [],
8
+ handler,
9
+ name: "@ir-kit/openapi-ts-k6",
10
+ tags: ["client"],
11
+ };
12
+ export const defineConfig = definePluginConfig(defaultConfig);
13
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,MAAM,CAAC,MAAM,aAAa,GAA6B;IACrD,MAAM,EAAE;QACN,MAAM,EAAE,MAAM;KACf;IACD,YAAY,EAAE,EAAE;IAChB,OAAO;IACP,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,CAAC,QAAQ,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import "./types.js";
2
+ export { defaultConfig, defineConfig } from "./config.js";
3
+ export type { Config, K6HeyApiPlugin, UserConfig } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC1D,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import "./types.js";
2
+ export { defaultConfig, defineConfig } from "./config.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { K6HeyApiPlugin } from "./types.js";
2
+ /**
3
+ * Plugin handler — defers all real work to `@ir-kit/k6-gen`'s
4
+ * standalone `generate()`. The hey-api context already $ref-bundled and
5
+ * normalized the spec, so we pass that through and disable our own
6
+ * normalize step.
7
+ */
8
+ export declare const handler: K6HeyApiPlugin["Handler"];
9
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,SAAS,CAW7C,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,20 @@
1
+ import { resolve } from "node:path";
2
+ import { generate } from "@ir-kit/k6-gen";
3
+ /**
4
+ * Plugin handler — defers all real work to `@ir-kit/k6-gen`'s
5
+ * standalone `generate()`. The hey-api context already $ref-bundled and
6
+ * normalized the spec, so we pass that through and disable our own
7
+ * normalize step.
8
+ */
9
+ export const handler = ({ plugin }) => {
10
+ const outputBase = plugin.context.config.output.path;
11
+ const outDir = resolve(outputBase, plugin.config.output);
12
+ const spec = plugin.context.spec;
13
+ return generate({
14
+ input: spec,
15
+ output: outDir,
16
+ defaultBaseUrl: plugin.config.defaultBaseUrl,
17
+ normalize: false,
18
+ }).then(() => undefined);
19
+ };
20
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAA8B,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IAC/D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IACrD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAA+B,CAAC;IAE5D,OAAO,QAAQ,CAAC;QACd,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,MAAM;QACd,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc;QAC5C,SAAS,EAAE,KAAK;KACjB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { DefinePlugin, Plugin } from "@hey-api/shared";
2
+ export type UserConfig = Plugin.Hooks & Plugin.UserExports & {
3
+ name: "@ir-kit/openapi-ts-k6";
4
+ /**
5
+ * Output directory for the generated client (`types.ts`, `client.ts`,
6
+ * `data.ts`, `index.ts`). Resolved relative to hey-api's `output.path`.
7
+ * @default "./k6"
8
+ */
9
+ output?: string;
10
+ /**
11
+ * Default base URL baked into the client. Falls back to spec
12
+ * `servers[0].url`. The user can still override at runtime via
13
+ * `__ENV.BASE_URL`.
14
+ */
15
+ defaultBaseUrl?: string;
16
+ };
17
+ export type Config = Plugin.Hooks & Plugin.Exports & {
18
+ name: "@ir-kit/openapi-ts-k6";
19
+ output: string;
20
+ defaultBaseUrl?: string;
21
+ };
22
+ export type K6HeyApiPlugin = DefinePlugin<UserConfig, Config>;
23
+ declare module "@hey-api/openapi-ts" {
24
+ interface PluginConfigMap {
25
+ "@ir-kit/openapi-ts-k6": K6HeyApiPlugin["Types"];
26
+ }
27
+ }
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,GACnC,MAAM,CAAC,WAAW,GAAG;IACnB,IAAI,EAAE,uBAAuB,CAAC;IAC9B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEJ,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,GAC/B,MAAM,CAAC,OAAO,GAAG;IACf,IAAI,EAAE,uBAAuB,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEJ,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAE9D,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAiB,eAAe;QAC9B,uBAAuB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;KAClD;CACF"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@ir-kit/openapi-ts-k6",
3
+ "version": "0.1.0",
4
+ "description": "Thin @hey-api/openapi-ts plugin that delegates to @ir-kit/k6-gen. Use if you already drive codegen through openapi-ts.config.ts; otherwise reach for @ir-kit/k6-toolkit.",
5
+ "keywords": [
6
+ "openapi",
7
+ "openapi-ts",
8
+ "k6",
9
+ "load-testing",
10
+ "plugin"
11
+ ],
12
+ "homepage": "https://github.com/ir-kit/ir-kit/tree/main/packages/k6/hey-api",
13
+ "bugs": {
14
+ "url": "https://github.com/ir-kit/ir-kit/issues"
15
+ },
16
+ "license": "MIT",
17
+ "author": {
18
+ "name": "Ahmed Rowaihi",
19
+ "email": "ahmedrowaihi@gmail.com"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/ir-kit/ir-kit.git",
24
+ "directory": "packages/k6/hey-api"
25
+ },
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE.md"
41
+ ],
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "provenance": true
45
+ },
46
+ "dependencies": {
47
+ "@ir-kit/k6-gen": "0.1.0"
48
+ },
49
+ "peerDependencies": {
50
+ "@hey-api/openapi-ts": ">=0.95.0",
51
+ "@hey-api/shared": ">=0.2.0"
52
+ },
53
+ "devDependencies": {
54
+ "@hey-api/openapi-ts": "^0.97.0",
55
+ "@hey-api/shared": "^0.4.2",
56
+ "@types/node": "^22",
57
+ "vitest": "^4.0.0",
58
+ "@ir-kit/tsconfig": "0.0.0"
59
+ },
60
+ "engines": {
61
+ "node": ">=20.19.0"
62
+ },
63
+ "scripts": {
64
+ "build": "tsc -p tsconfig.build.json",
65
+ "dev": "tsc -p tsconfig.build.json --watch",
66
+ "typecheck": "tsc --noEmit",
67
+ "test": "vitest run --passWithNoTests"
68
+ }
69
+ }