@kubb/agent 5.0.0-beta.3 → 5.0.0-beta.30
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1965 -1827
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/index.mjs +1 -1
- package/.output/server/node_modules/ajv/dist/2019.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2019.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/2020.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/2020.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/ajv.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/index.d.ts +2 -1
- package/.output/server/node_modules/ajv/dist/compile/index.js +10 -3
- package/.output/server/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
- package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/names.d.ts +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js +1 -0
- package/.output/server/node_modules/ajv/dist/compile/names.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js +18 -4
- package/.output/server/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/core.d.ts +4 -0
- package/.output/server/node_modules/ajv/dist/core.js +15 -1
- package/.output/server/node_modules/ajv/dist/core.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/draft4.d.ts +19 -0
- package/.output/server/node_modules/ajv/dist/draft4.js +57 -0
- package/.output/server/node_modules/ajv/dist/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/dist/types/index.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +2 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.d.ts +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js +10 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +12 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +56 -21
- package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js +29 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +10 -2
- package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js +26 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +22 -3
- package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.d.ts +12 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +4 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +8 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.d.ts +3 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
- package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js.map +1 -0
- package/.output/server/node_modules/ajv/lib/2019.ts +1 -0
- package/.output/server/node_modules/ajv/lib/2020.ts +1 -0
- package/.output/server/node_modules/ajv/lib/ajv.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/index.ts +16 -3
- package/.output/server/node_modules/ajv/lib/compile/jtd/parse.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/jtd/serialize.ts +3 -1
- package/.output/server/node_modules/ajv/lib/compile/names.ts +1 -0
- package/.output/server/node_modules/ajv/lib/compile/validate/index.ts +21 -4
- package/.output/server/node_modules/ajv/lib/core.ts +20 -1
- package/.output/server/node_modules/ajv/lib/draft4.ts +79 -0
- package/.output/server/node_modules/ajv/lib/refs/json-schema-draft-04.json +138 -0
- package/.output/server/node_modules/ajv/lib/types/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +2 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +1 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/applicator/properties.ts +4 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/code.ts +10 -3
- package/.output/server/node_modules/ajv/lib/vocabularies/core/ref.ts +21 -5
- package/.output/server/node_modules/ajv/lib/vocabularies/discriminator/index.ts +69 -19
- package/.output/server/node_modules/ajv/lib/vocabularies/draft4.ts +32 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/metadata.ts +10 -2
- package/.output/server/node_modules/ajv/lib/vocabularies/oasContext.ts +27 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +29 -7
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumber.ts +75 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumberExclusive.ts +26 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/index.ts +4 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/readOnly.ts +23 -0
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/required.ts +7 -1
- package/.output/server/node_modules/ajv/lib/vocabularies/validation/writeOnly.ts +22 -0
- package/.output/server/node_modules/ajv/package.json +9 -6
- package/.output/server/node_modules/fflate/esm/index.mjs +87 -56
- package/.output/server/node_modules/fflate/package.json +12 -11
- package/.output/server/node_modules/jiti/LICENSE +21 -0
- package/.output/server/node_modules/jiti/README.md +258 -0
- package/.output/server/node_modules/jiti/dist/babel.cjs +257 -0
- package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/.output/server/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/.output/server/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/.output/server/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/.output/server/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/.output/server/node_modules/jiti/lib/jiti.cjs +30 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
- package/.output/server/node_modules/jiti/lib/types.d.ts +420 -0
- package/.output/server/node_modules/jiti/package.json +146 -0
- package/.output/server/node_modules/remeda/dist/hasProp.js +2 -0
- package/.output/server/node_modules/remeda/dist/index.js +1 -1
- package/.output/server/node_modules/remeda/package.json +12 -12
- package/.output/server/node_modules/ws/lib/sender.js +6 -1
- package/.output/server/node_modules/ws/package.json +1 -1
- package/.output/server/package.json +5 -8
- package/README.md +62 -27
- package/package.json +15 -14
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/package.json +0 -40
- package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node +0 -0
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +0 -256
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +0 -75
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/index.js +0 -3
- package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +0 -70
- package/.output/server/node_modules/@rolldown/pluginutils/dist/index.js +0 -1
- package/.output/server/node_modules/@rolldown/pluginutils/dist/utils.js +0 -17
- package/.output/server/node_modules/@rolldown/pluginutils/package.json +0 -37
- package/.output/server/node_modules/rolldown/dist/index.mjs +0 -50
- package/.output/server/node_modules/rolldown/dist/parse-ast-index.mjs +0 -60
- package/.output/server/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +0 -582
- package/.output/server/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +0 -2211
- package/.output/server/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +0 -6
- package/.output/server/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +0 -85
- package/.output/server/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +0 -180
- package/.output/server/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +0 -21
- package/.output/server/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +0 -66
- package/.output/server/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +0 -74
- package/.output/server/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +0 -847
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +0 -40
- package/.output/server/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +0 -3325
- package/.output/server/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +0 -374
- package/.output/server/node_modules/rolldown/package.json +0 -153
- package/.output/server/node_modules/unrun/dist/index.mjs +0 -2
- package/.output/server/node_modules/unrun/dist/src-GU5PtktT.mjs +0 -887
- package/.output/server/node_modules/unrun/package.json +0 -125
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
const { Duplex } = require('stream');
|
|
6
6
|
const { randomFillSync } = require('crypto');
|
|
7
|
+
const {
|
|
8
|
+
types: { isUint8Array }
|
|
9
|
+
} = require('util');
|
|
7
10
|
|
|
8
11
|
const PerMessageDeflate = require('./permessage-deflate');
|
|
9
12
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');
|
|
@@ -200,8 +203,10 @@ class Sender {
|
|
|
200
203
|
|
|
201
204
|
if (typeof data === 'string') {
|
|
202
205
|
buf.write(data, 2);
|
|
203
|
-
} else {
|
|
206
|
+
} else if (isUint8Array(data)) {
|
|
204
207
|
buf.set(data, 2);
|
|
208
|
+
} else {
|
|
209
|
+
throw new TypeError('Second argument must be a string or a Uint8Array');
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
212
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/agent-prod",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -9,21 +9,18 @@
|
|
|
9
9
|
"@logtail/tools": "0.5.8",
|
|
10
10
|
"@logtail/types": "0.5.8",
|
|
11
11
|
"@msgpack/msgpack": "2.8.0",
|
|
12
|
-
"@rolldown/binding-linux-x64-gnu": "1.0.0-rc.17",
|
|
13
|
-
"@rolldown/pluginutils": "1.0.0-rc.17",
|
|
14
12
|
"anymatch": "3.1.3",
|
|
15
13
|
"chokidar": "5.0.0",
|
|
16
14
|
"consola": "3.4.2",
|
|
17
|
-
"fflate": "0.8.
|
|
15
|
+
"fflate": "0.8.3",
|
|
16
|
+
"jiti": "2.7.0",
|
|
18
17
|
"normalize-path": "3.0.0",
|
|
19
18
|
"picomatch": "2.3.2",
|
|
20
19
|
"readdirp": "5.0.0",
|
|
21
|
-
"remeda": "2.34.
|
|
22
|
-
"rolldown": "1.0.0-rc.17",
|
|
20
|
+
"remeda": "2.34.1",
|
|
23
21
|
"serialize-error": "8.1.0",
|
|
24
22
|
"stack-trace": "0.0.10",
|
|
25
23
|
"tinyexec": "1.1.2",
|
|
26
|
-
"
|
|
27
|
-
"ws": "8.20.0"
|
|
24
|
+
"ws": "8.20.1"
|
|
28
25
|
}
|
|
29
26
|
}
|
package/README.md
CHANGED
|
@@ -1,33 +1,41 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@kubb/agent</h1>
|
|
3
|
+
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
+
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
8
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
+
[![Coverage][coverage-src]][coverage-href]
|
|
10
|
+
[![License][license-src]][license-href]
|
|
11
|
+
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
|
+
|
|
13
|
+
<h4>
|
|
14
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
15
|
+
<span> · </span>
|
|
16
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
17
|
+
<span> · </span>
|
|
18
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
19
|
+
</h4>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
HTTP agent server for Kubb, built on [Nitro](https://nitro.build). It exposes REST endpoints for triggering code generation, a health check, and a bidirectional WebSocket connection to Kubb Studio. Machine tokens are derived from the machine's network identity so they survive restarts. Sessions are cached locally to speed up reconnects.
|
|
19
23
|
|
|
20
24
|
## Installation
|
|
21
25
|
|
|
22
26
|
The agent server is installed as part of `@kubb/cli`:
|
|
23
27
|
|
|
24
28
|
```bash
|
|
29
|
+
bun add -D @kubb/cli
|
|
30
|
+
# or
|
|
25
31
|
pnpm add -D @kubb/cli
|
|
32
|
+
# or
|
|
33
|
+
npm install -D @kubb/cli
|
|
26
34
|
```
|
|
27
35
|
|
|
28
36
|
## Usage
|
|
29
37
|
|
|
30
|
-
### Via CLI
|
|
38
|
+
### Via CLI
|
|
31
39
|
|
|
32
40
|
Start the agent server using the Kubb CLI:
|
|
33
41
|
|
|
@@ -112,7 +120,7 @@ The `agent_kv` named volume persists the KV store (session cache, machine token)
|
|
|
112
120
|
| `KUBB_AGENT_ROOT` | `/kubb/agent` (Docker) / `cwd` | Root directory for resolving relative paths. |
|
|
113
121
|
| `PORT` | `3000` | Server port. |
|
|
114
122
|
| `HOST` | `0.0.0.0` | Server host. |
|
|
115
|
-
| `KUBB_STUDIO_URL` | `https://
|
|
123
|
+
| `KUBB_STUDIO_URL` | `https://kubb.studio` | Kubb Studio WebSocket URL. |
|
|
116
124
|
| `KUBB_AGENT_TOKEN` | _(empty)_ | Authentication token for Studio. Required to connect. |
|
|
117
125
|
| `KUBB_AGENT_ALLOW_WRITE` | `false` | Set to `true` to allow writing generated files to disk. |
|
|
118
126
|
| `KUBB_AGENT_ALLOW_ALL` | `false` | Set to `true` to grant all permissions (implies `KUBB_AGENT_ALLOW_WRITE=true`). |
|
|
@@ -132,7 +140,7 @@ PORT=3000
|
|
|
132
140
|
KUBB_AGENT_ROOT=/path/to/your/project
|
|
133
141
|
KUBB_AGENT_CONFIG=/path/to/your/project/kubb.config.ts
|
|
134
142
|
KUBB_AGENT_TOKEN=your-token-here
|
|
135
|
-
KUBB_STUDIO_URL=https://
|
|
143
|
+
KUBB_STUDIO_URL=https://kubb.studio
|
|
136
144
|
```
|
|
137
145
|
|
|
138
146
|
2. **Run the agent:**
|
|
@@ -159,13 +167,15 @@ On startup the agent performs these steps before opening a WebSocket:
|
|
|
159
167
|
2. **Create session** — calls `POST /api/agent/session/create` (includes `machineToken` for verification) and receives a WebSocket URL.
|
|
160
168
|
3. **Connect** — opens a WebSocket to the returned URL using the `Authorization` header for authentication.
|
|
161
169
|
|
|
162
|
-
### Connection
|
|
170
|
+
### Connection features
|
|
163
171
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
172
|
+
| Feature | Description |
|
|
173
|
+
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| Automatic reconnection | Caches session tokens to speed up reconnects |
|
|
175
|
+
| Real-time events | Streams generation progress and events |
|
|
176
|
+
| Command handling | Receives `generate` and `connect` commands from Studio |
|
|
177
|
+
| Graceful shutdown | Notifies Studio when disconnecting |
|
|
178
|
+
| Session management | 24-hour session expiration with auto-refresh; Studio re-validates every incoming message and disconnects if the session is revoked or expired |
|
|
169
179
|
|
|
170
180
|
### Session Caching
|
|
171
181
|
|
|
@@ -324,3 +334,28 @@ npx kubb agent start
|
|
|
324
334
|
```
|
|
325
335
|
|
|
326
336
|
You'll receive a stream of events as the code generation progresses.
|
|
337
|
+
|
|
338
|
+
## Supporting Kubb
|
|
339
|
+
|
|
340
|
+
Kubb is an open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
341
|
+
|
|
342
|
+
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
343
|
+
|
|
344
|
+
<p align="center">
|
|
345
|
+
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
346
|
+
<img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
|
|
347
|
+
</a>
|
|
348
|
+
</p>
|
|
349
|
+
|
|
350
|
+
<!-- Badges -->
|
|
351
|
+
|
|
352
|
+
[npm-version-src]: https://img.shields.io/npm/v/@kubb/agent?flat&colorA=18181B&colorB=f58517
|
|
353
|
+
[npm-version-href]: https://npmjs.com/package/@kubb/agent
|
|
354
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/agent?flat&colorA=18181B&colorB=f58517
|
|
355
|
+
[npm-downloads-href]: https://npmjs.com/package/@kubb/agent
|
|
356
|
+
[license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
|
|
357
|
+
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
358
|
+
[coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
|
|
359
|
+
[coverage-href]: https://www.npmjs.com/package/@kubb/agent
|
|
360
|
+
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
361
|
+
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/agent",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.0-beta.30",
|
|
4
|
+
"description": "HTTP agent server for Kubb. Exposes code generation via REST API and WebSocket with real-time Kubb Studio integration, machine binding, and Docker support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
7
|
-
"code-generation",
|
|
8
7
|
"codegen",
|
|
8
|
+
"docker",
|
|
9
9
|
"http",
|
|
10
10
|
"kubb",
|
|
11
11
|
"openapi",
|
|
12
12
|
"server",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"typescript",
|
|
14
|
+
"websocket"
|
|
15
15
|
],
|
|
16
16
|
"license": "AGPL-3.0-or-later",
|
|
17
17
|
"author": "stijnvanhulle",
|
|
@@ -38,22 +38,23 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@logtail/node": "^0.5.8",
|
|
40
40
|
"consola": "^3.4.2",
|
|
41
|
-
"
|
|
41
|
+
"jiti": "^2.7.0",
|
|
42
|
+
"remeda": "^2.34.1",
|
|
42
43
|
"tinyexec": "^1.1.2",
|
|
43
|
-
"unrun": "^0.2.37",
|
|
44
44
|
"unstorage": "^1.17.5",
|
|
45
|
-
"ws": "^8.20.
|
|
46
|
-
"@kubb/ast": "5.0.0-beta.
|
|
47
|
-
"@kubb/core": "5.0.0-beta.
|
|
45
|
+
"ws": "^8.20.1",
|
|
46
|
+
"@kubb/ast": "5.0.0-beta.30",
|
|
47
|
+
"@kubb/core": "5.0.0-beta.30"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/ws": "^8.18.1",
|
|
51
|
-
"msw": "^2.14.
|
|
51
|
+
"msw": "^2.14.6",
|
|
52
52
|
"nitropack": "^2.13.4",
|
|
53
|
-
"vite": "^8.0.
|
|
53
|
+
"vite": "^8.0.13",
|
|
54
|
+
"@kubb/adapter-oas": "5.0.0-beta.30",
|
|
54
55
|
"@internals/utils": "0.0.0",
|
|
55
|
-
"@kubb/
|
|
56
|
-
"@kubb/
|
|
56
|
+
"@kubb/parser-ts": "5.0.0-beta.30",
|
|
57
|
+
"@kubb/renderer-jsx": "5.0.0-beta.30"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
|
59
60
|
"node": ">=22"
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@rolldown/binding-linux-x64-gnu",
|
|
3
|
-
"version": "1.0.0-rc.17",
|
|
4
|
-
"cpu": [
|
|
5
|
-
"x64"
|
|
6
|
-
],
|
|
7
|
-
"main": "rolldown-binding.linux-x64-gnu.node",
|
|
8
|
-
"files": [
|
|
9
|
-
"rolldown-binding.linux-x64-gnu.node"
|
|
10
|
-
],
|
|
11
|
-
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
|
|
12
|
-
"keywords": [
|
|
13
|
-
"bundler",
|
|
14
|
-
"esbuild",
|
|
15
|
-
"parcel",
|
|
16
|
-
"rolldown",
|
|
17
|
-
"rollup",
|
|
18
|
-
"webpack"
|
|
19
|
-
],
|
|
20
|
-
"homepage": "https://rolldown.rs/",
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"engines": {
|
|
23
|
-
"node": "^20.19.0 || >=22.12.0"
|
|
24
|
-
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/rolldown/rolldown.git",
|
|
28
|
-
"directory": "packages/rolldown"
|
|
29
|
-
},
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"registry": "https://registry.npmjs.org/",
|
|
32
|
-
"access": "public"
|
|
33
|
-
},
|
|
34
|
-
"os": [
|
|
35
|
-
"linux"
|
|
36
|
-
],
|
|
37
|
-
"libc": [
|
|
38
|
-
"glibc"
|
|
39
|
-
]
|
|
40
|
-
}
|
|
Binary file
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { cleanUrl, extractQueryWithoutFragment } from "../utils.js";
|
|
2
|
-
class And {
|
|
3
|
-
kind;
|
|
4
|
-
args;
|
|
5
|
-
constructor(...args) {
|
|
6
|
-
if (args.length === 0) {
|
|
7
|
-
throw new Error('`And` expects at least one operand');
|
|
8
|
-
}
|
|
9
|
-
this.args = args;
|
|
10
|
-
this.kind = 'and';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
class Or {
|
|
14
|
-
kind;
|
|
15
|
-
args;
|
|
16
|
-
constructor(...args) {
|
|
17
|
-
if (args.length === 0) {
|
|
18
|
-
throw new Error('`Or` expects at least one operand');
|
|
19
|
-
}
|
|
20
|
-
this.args = args;
|
|
21
|
-
this.kind = 'or';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
class Not {
|
|
25
|
-
kind;
|
|
26
|
-
expr;
|
|
27
|
-
constructor(expr) {
|
|
28
|
-
this.expr = expr;
|
|
29
|
-
this.kind = 'not';
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
class Id {
|
|
33
|
-
kind;
|
|
34
|
-
pattern;
|
|
35
|
-
params;
|
|
36
|
-
constructor(pattern, params) {
|
|
37
|
-
this.pattern = pattern;
|
|
38
|
-
this.kind = 'id';
|
|
39
|
-
this.params = params ?? {
|
|
40
|
-
cleanUrl: false,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
class ImporterId {
|
|
45
|
-
kind;
|
|
46
|
-
pattern;
|
|
47
|
-
params;
|
|
48
|
-
constructor(pattern, params) {
|
|
49
|
-
this.pattern = pattern;
|
|
50
|
-
this.kind = 'importerId';
|
|
51
|
-
this.params = params ?? {
|
|
52
|
-
cleanUrl: false,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
class ModuleType {
|
|
57
|
-
kind;
|
|
58
|
-
pattern;
|
|
59
|
-
constructor(pattern) {
|
|
60
|
-
this.pattern = pattern;
|
|
61
|
-
this.kind = 'moduleType';
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
class Code {
|
|
65
|
-
kind;
|
|
66
|
-
pattern;
|
|
67
|
-
constructor(expr) {
|
|
68
|
-
this.pattern = expr;
|
|
69
|
-
this.kind = 'code';
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
class Query {
|
|
73
|
-
kind;
|
|
74
|
-
key;
|
|
75
|
-
pattern;
|
|
76
|
-
constructor(key, pattern) {
|
|
77
|
-
this.pattern = pattern;
|
|
78
|
-
this.key = key;
|
|
79
|
-
this.kind = 'query';
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
class Include {
|
|
83
|
-
kind;
|
|
84
|
-
expr;
|
|
85
|
-
constructor(expr) {
|
|
86
|
-
this.expr = expr;
|
|
87
|
-
this.kind = 'include';
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
class Exclude {
|
|
91
|
-
kind;
|
|
92
|
-
expr;
|
|
93
|
-
constructor(expr) {
|
|
94
|
-
this.expr = expr;
|
|
95
|
-
this.kind = 'exclude';
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export function and(...args) {
|
|
99
|
-
return new And(...args);
|
|
100
|
-
}
|
|
101
|
-
export function or(...args) {
|
|
102
|
-
return new Or(...args);
|
|
103
|
-
}
|
|
104
|
-
export function not(expr) {
|
|
105
|
-
return new Not(expr);
|
|
106
|
-
}
|
|
107
|
-
export function id(pattern, params) {
|
|
108
|
-
return new Id(pattern, params);
|
|
109
|
-
}
|
|
110
|
-
export function importerId(pattern, params) {
|
|
111
|
-
return new ImporterId(pattern, params);
|
|
112
|
-
}
|
|
113
|
-
export function moduleType(pattern) {
|
|
114
|
-
return new ModuleType(pattern);
|
|
115
|
-
}
|
|
116
|
-
export function code(pattern) {
|
|
117
|
-
return new Code(pattern);
|
|
118
|
-
}
|
|
119
|
-
/*
|
|
120
|
-
* There are three kinds of conditions are supported:
|
|
121
|
-
* 1. `boolean`: if the value is `true`, the key must exist and be truthy. if the value is `false`, the key must not exist or be falsy.
|
|
122
|
-
* 2. `string`: the key must exist and be equal to the value.
|
|
123
|
-
* 3. `RegExp`: the key must exist and match the value.
|
|
124
|
-
*/
|
|
125
|
-
export function query(key, pattern) {
|
|
126
|
-
return new Query(key, pattern);
|
|
127
|
-
}
|
|
128
|
-
export function include(expr) {
|
|
129
|
-
return new Include(expr);
|
|
130
|
-
}
|
|
131
|
-
export function exclude(expr) {
|
|
132
|
-
return new Exclude(expr);
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* convert a queryObject to FilterExpression like
|
|
136
|
-
* ```js
|
|
137
|
-
* and(query(k1, v1), query(k2, v2))
|
|
138
|
-
* ```
|
|
139
|
-
* @param queryFilterObject The query filter object needs to be matched.
|
|
140
|
-
* @returns a `And` FilterExpression
|
|
141
|
-
*/
|
|
142
|
-
export function queries(queryFilter) {
|
|
143
|
-
let arr = Object.entries(queryFilter).map(([key, value]) => {
|
|
144
|
-
return new Query(key, value);
|
|
145
|
-
});
|
|
146
|
-
return and(...arr);
|
|
147
|
-
}
|
|
148
|
-
export function interpreter(exprs, code, id, moduleType, importerId) {
|
|
149
|
-
let arr = [];
|
|
150
|
-
if (Array.isArray(exprs)) {
|
|
151
|
-
arr = exprs;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
arr = [exprs];
|
|
155
|
-
}
|
|
156
|
-
return interpreterImpl(arr, code, id, moduleType, importerId);
|
|
157
|
-
}
|
|
158
|
-
export function interpreterImpl(expr, code, id, moduleType, importerId, ctx = {}) {
|
|
159
|
-
let hasInclude = false;
|
|
160
|
-
for (const e of expr) {
|
|
161
|
-
switch (e.kind) {
|
|
162
|
-
case 'include': {
|
|
163
|
-
hasInclude = true;
|
|
164
|
-
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) {
|
|
165
|
-
return true;
|
|
166
|
-
}
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
case 'exclude': {
|
|
170
|
-
if (exprInterpreter(e.expr, code, id, moduleType, importerId, ctx)) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return !hasInclude;
|
|
178
|
-
}
|
|
179
|
-
export function exprInterpreter(expr, code, id, moduleType, importerId, ctx = {}) {
|
|
180
|
-
switch (expr.kind) {
|
|
181
|
-
case 'and': {
|
|
182
|
-
return expr.args.every((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
|
183
|
-
}
|
|
184
|
-
case 'or': {
|
|
185
|
-
return expr.args.some((e) => exprInterpreter(e, code, id, moduleType, importerId, ctx));
|
|
186
|
-
}
|
|
187
|
-
case 'not': {
|
|
188
|
-
return !exprInterpreter(expr.expr, code, id, moduleType, importerId, ctx);
|
|
189
|
-
}
|
|
190
|
-
case 'id': {
|
|
191
|
-
if (id === undefined) {
|
|
192
|
-
throw new Error('`id` is required for `id` expression');
|
|
193
|
-
}
|
|
194
|
-
let idToMatch = id;
|
|
195
|
-
if (expr.params.cleanUrl) {
|
|
196
|
-
idToMatch = cleanUrl(idToMatch);
|
|
197
|
-
}
|
|
198
|
-
return typeof expr.pattern === 'string'
|
|
199
|
-
? idToMatch === expr.pattern
|
|
200
|
-
: expr.pattern.test(idToMatch);
|
|
201
|
-
}
|
|
202
|
-
case 'importerId': {
|
|
203
|
-
if (importerId === undefined) {
|
|
204
|
-
return false; // Entry files have no importer, so no match
|
|
205
|
-
}
|
|
206
|
-
let importerIdToMatch = importerId;
|
|
207
|
-
if (expr.params.cleanUrl) {
|
|
208
|
-
importerIdToMatch = cleanUrl(importerIdToMatch);
|
|
209
|
-
}
|
|
210
|
-
return typeof expr.pattern === 'string'
|
|
211
|
-
? importerIdToMatch === expr.pattern
|
|
212
|
-
: expr.pattern.test(importerIdToMatch);
|
|
213
|
-
}
|
|
214
|
-
case 'moduleType': {
|
|
215
|
-
if (moduleType === undefined) {
|
|
216
|
-
throw new Error('`moduleType` is required for `moduleType` expression');
|
|
217
|
-
}
|
|
218
|
-
return moduleType === expr.pattern;
|
|
219
|
-
}
|
|
220
|
-
case 'code': {
|
|
221
|
-
if (code === undefined) {
|
|
222
|
-
throw new Error('`code` is required for `code` expression');
|
|
223
|
-
}
|
|
224
|
-
return typeof expr.pattern === 'string'
|
|
225
|
-
? code.includes(expr.pattern)
|
|
226
|
-
: expr.pattern.test(code);
|
|
227
|
-
}
|
|
228
|
-
case 'query': {
|
|
229
|
-
if (id === undefined) {
|
|
230
|
-
throw new Error('`id` is required for `Query` expression');
|
|
231
|
-
}
|
|
232
|
-
if (!ctx.urlSearchParamsCache) {
|
|
233
|
-
let queryString = extractQueryWithoutFragment(id);
|
|
234
|
-
ctx.urlSearchParamsCache = new URLSearchParams(queryString);
|
|
235
|
-
}
|
|
236
|
-
let urlParams = ctx.urlSearchParamsCache;
|
|
237
|
-
if (typeof expr.pattern === 'boolean') {
|
|
238
|
-
if (expr.pattern) {
|
|
239
|
-
return urlParams.has(expr.key);
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
return !urlParams.has(expr.key);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
else if (typeof expr.pattern === 'string') {
|
|
246
|
-
return urlParams.get(expr.key) === expr.pattern;
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
return expr.pattern.test(urlParams.get(expr.key) ?? '');
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
default: {
|
|
253
|
-
throw new Error(`Expression ${JSON.stringify(expr)} is not expected.`);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filters out Vite plugins that have `apply: 'serve'` set.
|
|
3
|
-
*
|
|
4
|
-
* Since Rolldown operates in build mode, plugins marked with `apply: 'serve'`
|
|
5
|
-
* are intended only for Vite's dev server and should be excluded from the build process.
|
|
6
|
-
*
|
|
7
|
-
* @param plugins - Array of plugins (can include nested arrays)
|
|
8
|
-
* @returns Filtered array with serve-only plugins removed
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { defineConfig } from 'rolldown';
|
|
13
|
-
* import { filterVitePlugins } from '@rolldown/pluginutils';
|
|
14
|
-
* import viteReact from '@vitejs/plugin-react';
|
|
15
|
-
*
|
|
16
|
-
* export default defineConfig({
|
|
17
|
-
* plugins: filterVitePlugins([
|
|
18
|
-
* viteReact(),
|
|
19
|
-
* {
|
|
20
|
-
* name: 'dev-only',
|
|
21
|
-
* apply: 'serve', // This will be filtered out
|
|
22
|
-
* // ...
|
|
23
|
-
* }
|
|
24
|
-
* ])
|
|
25
|
-
* });
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export function filterVitePlugins(plugins) {
|
|
29
|
-
if (!plugins) {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
const pluginArray = Array.isArray(plugins) ? plugins : [plugins];
|
|
33
|
-
const result = [];
|
|
34
|
-
for (const plugin of pluginArray) {
|
|
35
|
-
// Skip falsy values
|
|
36
|
-
if (!plugin) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
// Handle nested arrays recursively
|
|
40
|
-
if (Array.isArray(plugin)) {
|
|
41
|
-
result.push(...filterVitePlugins(plugin));
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
// Check if plugin has apply property
|
|
45
|
-
const pluginWithApply = plugin;
|
|
46
|
-
if ('apply' in pluginWithApply) {
|
|
47
|
-
const applyValue = pluginWithApply.apply;
|
|
48
|
-
// If apply is a function, call it with build mode
|
|
49
|
-
if (typeof applyValue === 'function') {
|
|
50
|
-
try {
|
|
51
|
-
const shouldApply = applyValue({}, // config object
|
|
52
|
-
{ command: 'build', mode: 'production' });
|
|
53
|
-
if (shouldApply) {
|
|
54
|
-
result.push(plugin);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
// If function throws, include the plugin to be safe
|
|
59
|
-
result.push(plugin);
|
|
60
|
-
}
|
|
61
|
-
} // If apply is 'serve', skip this plugin
|
|
62
|
-
else if (applyValue === 'serve') {
|
|
63
|
-
continue;
|
|
64
|
-
} // If apply is 'build' or anything else, include it
|
|
65
|
-
else {
|
|
66
|
-
result.push(plugin);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
// No apply property, include the plugin
|
|
71
|
-
result.push(plugin);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return result;
|
|
75
|
-
}
|