@kubb/core 4.24.1 → 4.25.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/dist/getBarrelFiles-CHL9_Obd.d.ts +76 -0
- package/dist/getBarrelFiles-CmpI3rrq.d.cts +76 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -142
- package/dist/index.d.ts +3 -142
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +167 -8
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +71 -3
- package/dist/utils.d.ts +71 -3
- package/dist/utils.js +163 -9
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
- package/src/index.ts +0 -1
- package/src/types.ts +0 -88
- package/src/utils/formatters.ts +73 -0
- package/src/utils/getConfigs.ts +39 -0
- package/src/utils/getPlugins.ts +23 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/linters.ts +42 -0
- package/dist/getBarrelFiles-CvaEQ7z_.d.ts +0 -35
- package/dist/getBarrelFiles-D9yKoizv.d.cts +0 -35
- package/schemas/openapi/server.yaml +0 -524
- package/src/server/index.ts +0 -90
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-DlpkT3g-.cjs";
|
|
2
|
-
import { f as Plugin, t as BarrelType } from "./types-ulibr7zw.cjs";
|
|
3
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
|
|
5
|
-
//#region src/utils/getBarrelFiles.d.ts
|
|
6
|
-
type FileMetaBase = {
|
|
7
|
-
pluginKey?: Plugin['key'];
|
|
8
|
-
};
|
|
9
|
-
type AddIndexesProps = {
|
|
10
|
-
type: BarrelType | false | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Root based on root and output.path specified in the config
|
|
13
|
-
*/
|
|
14
|
-
root: string;
|
|
15
|
-
/**
|
|
16
|
-
* Output for plugin
|
|
17
|
-
*/
|
|
18
|
-
output: {
|
|
19
|
-
path: string;
|
|
20
|
-
};
|
|
21
|
-
group?: {
|
|
22
|
-
output: string;
|
|
23
|
-
exportAs: string;
|
|
24
|
-
};
|
|
25
|
-
meta?: FileMetaBase;
|
|
26
|
-
};
|
|
27
|
-
declare function getBarrelFiles(files: Array<KubbFile.ResolvedFile>, {
|
|
28
|
-
type,
|
|
29
|
-
meta,
|
|
30
|
-
root,
|
|
31
|
-
output
|
|
32
|
-
}: AddIndexesProps): Promise<KubbFile.File[]>;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { getBarrelFiles as n, FileMetaBase as t };
|
|
35
|
-
//# sourceMappingURL=getBarrelFiles-D9yKoizv.d.cts.map
|
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
openapi: 3.1.0
|
|
2
|
-
info:
|
|
3
|
-
title: Kubb Server API
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
description: |
|
|
6
|
-
The Kubb Stream Server provides a real-time HTTP API for code generation using Server-Sent Events (SSE).
|
|
7
|
-
This API enables live progress tracking, event streaming, and integration with external tools.
|
|
8
|
-
|
|
9
|
-
Start the server with: `npx kubb start`
|
|
10
|
-
contact:
|
|
11
|
-
name: Kubb
|
|
12
|
-
url: https://kubb.dev
|
|
13
|
-
license:
|
|
14
|
-
name: MIT
|
|
15
|
-
url: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
16
|
-
|
|
17
|
-
servers:
|
|
18
|
-
- url: http://localhost:3000
|
|
19
|
-
description: Local development server
|
|
20
|
-
|
|
21
|
-
tags:
|
|
22
|
-
- name: Health
|
|
23
|
-
description: Server health and status endpoints
|
|
24
|
-
- name: Configuration
|
|
25
|
-
description: Configuration and metadata endpoints
|
|
26
|
-
- name: Generation
|
|
27
|
-
description: Code generation endpoints
|
|
28
|
-
|
|
29
|
-
paths:
|
|
30
|
-
/api/health:
|
|
31
|
-
get:
|
|
32
|
-
summary: Health check
|
|
33
|
-
description: Returns server status and version information
|
|
34
|
-
operationId: getHealth
|
|
35
|
-
tags:
|
|
36
|
-
- Health
|
|
37
|
-
responses:
|
|
38
|
-
'200':
|
|
39
|
-
description: Server is healthy
|
|
40
|
-
content:
|
|
41
|
-
application/json:
|
|
42
|
-
schema:
|
|
43
|
-
$ref: '#/components/schemas/HealthResponse'
|
|
44
|
-
example:
|
|
45
|
-
status: ok
|
|
46
|
-
version: 4.22.0
|
|
47
|
-
configPath: kubb.config.ts
|
|
48
|
-
|
|
49
|
-
/api/info:
|
|
50
|
-
get:
|
|
51
|
-
summary: Get configuration info
|
|
52
|
-
description: Returns configuration metadata and the OpenAPI specification content
|
|
53
|
-
operationId: getInfo
|
|
54
|
-
tags:
|
|
55
|
-
- Configuration
|
|
56
|
-
responses:
|
|
57
|
-
'200':
|
|
58
|
-
description: Configuration metadata
|
|
59
|
-
content:
|
|
60
|
-
application/json:
|
|
61
|
-
schema:
|
|
62
|
-
$ref: '#/components/schemas/ConnectResponse'
|
|
63
|
-
example:
|
|
64
|
-
version: 4.22.0
|
|
65
|
-
configPath: kubb.config.ts
|
|
66
|
-
spec: "openapi: 3.0.0\ninfo:\n title: Pet Store API\n..."
|
|
67
|
-
config:
|
|
68
|
-
name: my-api
|
|
69
|
-
root: .
|
|
70
|
-
input:
|
|
71
|
-
path: ./openapi.yaml
|
|
72
|
-
output:
|
|
73
|
-
path: ./src/gen
|
|
74
|
-
write: true
|
|
75
|
-
extension:
|
|
76
|
-
.ts: .ts
|
|
77
|
-
barrelType: all
|
|
78
|
-
plugins:
|
|
79
|
-
- name: '@kubb/plugin-oas'
|
|
80
|
-
options: {}
|
|
81
|
-
- name: '@kubb/plugin-ts'
|
|
82
|
-
options: {}
|
|
83
|
-
|
|
84
|
-
/api/generate:
|
|
85
|
-
post:
|
|
86
|
-
summary: Generate code with SSE streaming
|
|
87
|
-
description: |
|
|
88
|
-
Starts code generation and streams progress events via Server-Sent Events (SSE).
|
|
89
|
-
The response is a continuous stream of events in SSE format.
|
|
90
|
-
|
|
91
|
-
Each event contains a `type` field and a `data` array with event-specific payload.
|
|
92
|
-
operationId: generateCode
|
|
93
|
-
tags:
|
|
94
|
-
- Generation
|
|
95
|
-
responses:
|
|
96
|
-
'200':
|
|
97
|
-
description: SSE event stream
|
|
98
|
-
content:
|
|
99
|
-
text/event-stream:
|
|
100
|
-
schema:
|
|
101
|
-
type: string
|
|
102
|
-
description: Server-Sent Events stream with JSON-encoded StreamEvent objects
|
|
103
|
-
examples:
|
|
104
|
-
generation_flow:
|
|
105
|
-
summary: Typical generation flow
|
|
106
|
-
value: |
|
|
107
|
-
data: {"type":"generation:start","data":[{"name":"my-api","plugins":2}]}
|
|
108
|
-
|
|
109
|
-
data: {"type":"plugin:start","data":[{"name":"plugin-oas"}]}
|
|
110
|
-
|
|
111
|
-
data: {"type":"plugin:end","data":[{"name":"plugin-oas"},{"duration":150,"success":true}]}
|
|
112
|
-
|
|
113
|
-
data: {"type":"plugin:start","data":[{"name":"plugin-ts"}]}
|
|
114
|
-
|
|
115
|
-
data: {"type":"files:processing:start","data":[{"total":10}]}
|
|
116
|
-
|
|
117
|
-
data: {"type":"file:processing:update","data":[{"file":"models/Pet.ts","processed":1,"total":10,"percentage":10}]}
|
|
118
|
-
|
|
119
|
-
data: {"type":"file:processing:update","data":[{"file":"models/User.ts","processed":2,"total":10,"percentage":20}]}
|
|
120
|
-
|
|
121
|
-
data: {"type":"files:processing:end","data":[{"total":10}]}
|
|
122
|
-
|
|
123
|
-
data: {"type":"plugin:end","data":[{"name":"plugin-ts"},{"duration":500,"success":true}]}
|
|
124
|
-
|
|
125
|
-
data: {"type":"generation:end","data":[{},[]]}
|
|
126
|
-
|
|
127
|
-
data: {"type":"lifecycle:end","data":[]}
|
|
128
|
-
|
|
129
|
-
error_example:
|
|
130
|
-
summary: Error during generation
|
|
131
|
-
value: |
|
|
132
|
-
data: {"type":"generation:start","data":[{"name":"my-api","plugins":1}]}
|
|
133
|
-
|
|
134
|
-
data: {"type":"error","data":[{"message":"Failed to parse OpenAPI spec","stack":"Error: Failed to parse..."}]}
|
|
135
|
-
|
|
136
|
-
components:
|
|
137
|
-
schemas:
|
|
138
|
-
HealthResponse:
|
|
139
|
-
type: object
|
|
140
|
-
required:
|
|
141
|
-
- status
|
|
142
|
-
- version
|
|
143
|
-
- configPath
|
|
144
|
-
properties:
|
|
145
|
-
status:
|
|
146
|
-
type: string
|
|
147
|
-
enum: [ok]
|
|
148
|
-
description: Server status
|
|
149
|
-
version:
|
|
150
|
-
type: string
|
|
151
|
-
description: Kubb version
|
|
152
|
-
example: 4.22.0
|
|
153
|
-
configPath:
|
|
154
|
-
type: string
|
|
155
|
-
description: Relative path to the configuration file
|
|
156
|
-
example: kubb.config.ts
|
|
157
|
-
|
|
158
|
-
ConnectResponse:
|
|
159
|
-
type: object
|
|
160
|
-
required:
|
|
161
|
-
- version
|
|
162
|
-
- configPath
|
|
163
|
-
- config
|
|
164
|
-
properties:
|
|
165
|
-
version:
|
|
166
|
-
type: string
|
|
167
|
-
description: Kubb version
|
|
168
|
-
example: 4.22.0
|
|
169
|
-
configPath:
|
|
170
|
-
type: string
|
|
171
|
-
description: Relative path to the configuration file
|
|
172
|
-
example: kubb.config.ts
|
|
173
|
-
spec:
|
|
174
|
-
type: string
|
|
175
|
-
description: OpenAPI specification file content (YAML or JSON)
|
|
176
|
-
nullable: true
|
|
177
|
-
config:
|
|
178
|
-
$ref: '#/components/schemas/ConfigMetadata'
|
|
179
|
-
|
|
180
|
-
ConfigMetadata:
|
|
181
|
-
type: object
|
|
182
|
-
required:
|
|
183
|
-
- root
|
|
184
|
-
- input
|
|
185
|
-
- output
|
|
186
|
-
properties:
|
|
187
|
-
name:
|
|
188
|
-
type: string
|
|
189
|
-
description: Project name
|
|
190
|
-
example: my-api
|
|
191
|
-
root:
|
|
192
|
-
type: string
|
|
193
|
-
description: Root directory
|
|
194
|
-
example: .
|
|
195
|
-
input:
|
|
196
|
-
type: object
|
|
197
|
-
properties:
|
|
198
|
-
path:
|
|
199
|
-
type: string
|
|
200
|
-
description: Path to OpenAPI specification
|
|
201
|
-
example: ./openapi.yaml
|
|
202
|
-
output:
|
|
203
|
-
type: object
|
|
204
|
-
required:
|
|
205
|
-
- path
|
|
206
|
-
properties:
|
|
207
|
-
path:
|
|
208
|
-
type: string
|
|
209
|
-
description: Output directory path
|
|
210
|
-
example: ./src/gen
|
|
211
|
-
write:
|
|
212
|
-
type: boolean
|
|
213
|
-
description: Whether to write files to disk
|
|
214
|
-
example: true
|
|
215
|
-
extension:
|
|
216
|
-
type: object
|
|
217
|
-
additionalProperties:
|
|
218
|
-
type: string
|
|
219
|
-
description: File extension mappings
|
|
220
|
-
example:
|
|
221
|
-
.ts: .ts
|
|
222
|
-
barrelType:
|
|
223
|
-
oneOf:
|
|
224
|
-
- type: string
|
|
225
|
-
enum: [all, named]
|
|
226
|
-
- type: boolean
|
|
227
|
-
enum: [false]
|
|
228
|
-
description: Barrel file generation strategy
|
|
229
|
-
example: all
|
|
230
|
-
plugins:
|
|
231
|
-
type: array
|
|
232
|
-
items:
|
|
233
|
-
$ref: '#/components/schemas/PluginMetadata'
|
|
234
|
-
|
|
235
|
-
PluginMetadata:
|
|
236
|
-
type: object
|
|
237
|
-
required:
|
|
238
|
-
- name
|
|
239
|
-
- options
|
|
240
|
-
properties:
|
|
241
|
-
name:
|
|
242
|
-
type: string
|
|
243
|
-
description: Plugin name
|
|
244
|
-
example: '@kubb/plugin-ts'
|
|
245
|
-
options:
|
|
246
|
-
type: object
|
|
247
|
-
description: Plugin-specific configuration
|
|
248
|
-
additionalProperties: true
|
|
249
|
-
|
|
250
|
-
StreamEvent:
|
|
251
|
-
type: object
|
|
252
|
-
required:
|
|
253
|
-
- type
|
|
254
|
-
- data
|
|
255
|
-
properties:
|
|
256
|
-
type:
|
|
257
|
-
$ref: '#/components/schemas/StreamEventType'
|
|
258
|
-
data:
|
|
259
|
-
type: array
|
|
260
|
-
description: Event-specific payload (varies by event type)
|
|
261
|
-
items: {}
|
|
262
|
-
discriminator:
|
|
263
|
-
propertyName: type
|
|
264
|
-
mapping:
|
|
265
|
-
'plugin:start': '#/components/schemas/PluginStartEvent'
|
|
266
|
-
'plugin:end': '#/components/schemas/PluginEndEvent'
|
|
267
|
-
'files:processing:start': '#/components/schemas/FilesProcessingStartEvent'
|
|
268
|
-
'file:processing:update': '#/components/schemas/FileProcessingUpdateEvent'
|
|
269
|
-
'files:processing:end': '#/components/schemas/FilesProcessingEndEvent'
|
|
270
|
-
'info': '#/components/schemas/InfoEvent'
|
|
271
|
-
'success': '#/components/schemas/SuccessEvent'
|
|
272
|
-
'warn': '#/components/schemas/WarnEvent'
|
|
273
|
-
'error': '#/components/schemas/ErrorEvent'
|
|
274
|
-
'generation:start': '#/components/schemas/GenerationStartEvent'
|
|
275
|
-
'generation:end': '#/components/schemas/GenerationEndEvent'
|
|
276
|
-
'lifecycle:end': '#/components/schemas/LifecycleEndEvent'
|
|
277
|
-
|
|
278
|
-
StreamEventType:
|
|
279
|
-
type: string
|
|
280
|
-
enum:
|
|
281
|
-
- plugin:start
|
|
282
|
-
- plugin:end
|
|
283
|
-
- files:processing:start
|
|
284
|
-
- file:processing:update
|
|
285
|
-
- files:processing:end
|
|
286
|
-
- info
|
|
287
|
-
- success
|
|
288
|
-
- warn
|
|
289
|
-
- error
|
|
290
|
-
- generation:start
|
|
291
|
-
- generation:end
|
|
292
|
-
- lifecycle:end
|
|
293
|
-
description: Type of stream event
|
|
294
|
-
|
|
295
|
-
PluginStartEvent:
|
|
296
|
-
allOf:
|
|
297
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
298
|
-
- type: object
|
|
299
|
-
properties:
|
|
300
|
-
type:
|
|
301
|
-
type: string
|
|
302
|
-
enum: ['plugin:start']
|
|
303
|
-
data:
|
|
304
|
-
type: array
|
|
305
|
-
minItems: 1
|
|
306
|
-
maxItems: 1
|
|
307
|
-
items:
|
|
308
|
-
type: object
|
|
309
|
-
properties:
|
|
310
|
-
name:
|
|
311
|
-
type: string
|
|
312
|
-
description: Plugin name
|
|
313
|
-
example: plugin-ts
|
|
314
|
-
|
|
315
|
-
PluginEndEvent:
|
|
316
|
-
allOf:
|
|
317
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
318
|
-
- type: object
|
|
319
|
-
properties:
|
|
320
|
-
type:
|
|
321
|
-
type: string
|
|
322
|
-
enum: ['plugin:end']
|
|
323
|
-
data:
|
|
324
|
-
type: array
|
|
325
|
-
minItems: 2
|
|
326
|
-
maxItems: 2
|
|
327
|
-
items:
|
|
328
|
-
oneOf:
|
|
329
|
-
- type: object
|
|
330
|
-
properties:
|
|
331
|
-
name:
|
|
332
|
-
type: string
|
|
333
|
-
- type: object
|
|
334
|
-
properties:
|
|
335
|
-
duration:
|
|
336
|
-
type: number
|
|
337
|
-
description: Plugin execution duration in milliseconds
|
|
338
|
-
success:
|
|
339
|
-
type: boolean
|
|
340
|
-
description: Whether plugin executed successfully
|
|
341
|
-
|
|
342
|
-
FilesProcessingStartEvent:
|
|
343
|
-
allOf:
|
|
344
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
345
|
-
- type: object
|
|
346
|
-
properties:
|
|
347
|
-
type:
|
|
348
|
-
type: string
|
|
349
|
-
enum: ['files:processing:start']
|
|
350
|
-
data:
|
|
351
|
-
type: array
|
|
352
|
-
minItems: 1
|
|
353
|
-
maxItems: 1
|
|
354
|
-
items:
|
|
355
|
-
type: object
|
|
356
|
-
properties:
|
|
357
|
-
total:
|
|
358
|
-
type: number
|
|
359
|
-
description: Total number of files to process
|
|
360
|
-
|
|
361
|
-
FileProcessingUpdateEvent:
|
|
362
|
-
allOf:
|
|
363
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
364
|
-
- type: object
|
|
365
|
-
properties:
|
|
366
|
-
type:
|
|
367
|
-
type: string
|
|
368
|
-
enum: ['file:processing:update']
|
|
369
|
-
data:
|
|
370
|
-
type: array
|
|
371
|
-
minItems: 1
|
|
372
|
-
maxItems: 1
|
|
373
|
-
items:
|
|
374
|
-
type: object
|
|
375
|
-
properties:
|
|
376
|
-
file:
|
|
377
|
-
type: string
|
|
378
|
-
description: File path being processed
|
|
379
|
-
processed:
|
|
380
|
-
type: number
|
|
381
|
-
description: Number of files processed so far
|
|
382
|
-
total:
|
|
383
|
-
type: number
|
|
384
|
-
description: Total number of files
|
|
385
|
-
percentage:
|
|
386
|
-
type: number
|
|
387
|
-
description: Percentage of completion
|
|
388
|
-
|
|
389
|
-
FilesProcessingEndEvent:
|
|
390
|
-
allOf:
|
|
391
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
392
|
-
- type: object
|
|
393
|
-
properties:
|
|
394
|
-
type:
|
|
395
|
-
type: string
|
|
396
|
-
enum: ['files:processing:end']
|
|
397
|
-
data:
|
|
398
|
-
type: array
|
|
399
|
-
minItems: 1
|
|
400
|
-
maxItems: 1
|
|
401
|
-
items:
|
|
402
|
-
type: object
|
|
403
|
-
properties:
|
|
404
|
-
total:
|
|
405
|
-
type: number
|
|
406
|
-
description: Total number of files processed
|
|
407
|
-
|
|
408
|
-
InfoEvent:
|
|
409
|
-
allOf:
|
|
410
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
411
|
-
- type: object
|
|
412
|
-
properties:
|
|
413
|
-
type:
|
|
414
|
-
type: string
|
|
415
|
-
enum: ['info']
|
|
416
|
-
data:
|
|
417
|
-
type: array
|
|
418
|
-
minItems: 1
|
|
419
|
-
maxItems: 2
|
|
420
|
-
items:
|
|
421
|
-
type: string
|
|
422
|
-
|
|
423
|
-
SuccessEvent:
|
|
424
|
-
allOf:
|
|
425
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
426
|
-
- type: object
|
|
427
|
-
properties:
|
|
428
|
-
type:
|
|
429
|
-
type: string
|
|
430
|
-
enum: ['success']
|
|
431
|
-
data:
|
|
432
|
-
type: array
|
|
433
|
-
minItems: 1
|
|
434
|
-
maxItems: 2
|
|
435
|
-
items:
|
|
436
|
-
type: string
|
|
437
|
-
|
|
438
|
-
WarnEvent:
|
|
439
|
-
allOf:
|
|
440
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
441
|
-
- type: object
|
|
442
|
-
properties:
|
|
443
|
-
type:
|
|
444
|
-
type: string
|
|
445
|
-
enum: ['warn']
|
|
446
|
-
data:
|
|
447
|
-
type: array
|
|
448
|
-
minItems: 1
|
|
449
|
-
maxItems: 2
|
|
450
|
-
items:
|
|
451
|
-
type: string
|
|
452
|
-
|
|
453
|
-
ErrorEvent:
|
|
454
|
-
allOf:
|
|
455
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
456
|
-
- type: object
|
|
457
|
-
properties:
|
|
458
|
-
type:
|
|
459
|
-
type: string
|
|
460
|
-
enum: ['error']
|
|
461
|
-
data:
|
|
462
|
-
type: array
|
|
463
|
-
minItems: 1
|
|
464
|
-
maxItems: 1
|
|
465
|
-
items:
|
|
466
|
-
type: object
|
|
467
|
-
properties:
|
|
468
|
-
message:
|
|
469
|
-
type: string
|
|
470
|
-
description: Error message
|
|
471
|
-
stack:
|
|
472
|
-
type: string
|
|
473
|
-
description: Error stack trace
|
|
474
|
-
nullable: true
|
|
475
|
-
|
|
476
|
-
GenerationStartEvent:
|
|
477
|
-
allOf:
|
|
478
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
479
|
-
- type: object
|
|
480
|
-
properties:
|
|
481
|
-
type:
|
|
482
|
-
type: string
|
|
483
|
-
enum: ['generation:start']
|
|
484
|
-
data:
|
|
485
|
-
type: array
|
|
486
|
-
minItems: 1
|
|
487
|
-
maxItems: 1
|
|
488
|
-
items:
|
|
489
|
-
type: object
|
|
490
|
-
properties:
|
|
491
|
-
name:
|
|
492
|
-
type: string
|
|
493
|
-
description: Configuration name
|
|
494
|
-
nullable: true
|
|
495
|
-
plugins:
|
|
496
|
-
type: number
|
|
497
|
-
description: Number of plugins
|
|
498
|
-
|
|
499
|
-
GenerationEndEvent:
|
|
500
|
-
allOf:
|
|
501
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
502
|
-
- type: object
|
|
503
|
-
properties:
|
|
504
|
-
type:
|
|
505
|
-
type: string
|
|
506
|
-
enum: ['generation:end']
|
|
507
|
-
data:
|
|
508
|
-
type: array
|
|
509
|
-
description: Config, generated files, and source mappings
|
|
510
|
-
minItems: 3
|
|
511
|
-
maxItems: 3
|
|
512
|
-
|
|
513
|
-
LifecycleEndEvent:
|
|
514
|
-
allOf:
|
|
515
|
-
- $ref: '#/components/schemas/StreamEvent'
|
|
516
|
-
- type: object
|
|
517
|
-
properties:
|
|
518
|
-
type:
|
|
519
|
-
type: string
|
|
520
|
-
enum: ['lifecycle:end']
|
|
521
|
-
data:
|
|
522
|
-
type: array
|
|
523
|
-
maxItems: 0
|
|
524
|
-
description: Empty array - signals generation completion
|
package/src/server/index.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
2
|
-
import type { Config, KubbEvents } from '../types.ts'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Typed SSE events sent by the Kubb server.
|
|
6
|
-
* Follows the same tuple structure as {@link KubbEvents}.
|
|
7
|
-
* Reusable in consumers like kubb-playground to parse incoming events.
|
|
8
|
-
*/
|
|
9
|
-
export interface SseEvents {
|
|
10
|
-
'plugin:start': [plugin: { name: string }]
|
|
11
|
-
'plugin:end': [plugin: { name: string }, meta: { duration: number; success: boolean }]
|
|
12
|
-
'files:processing:start': [meta: { total: number }]
|
|
13
|
-
'file:processing:update': [
|
|
14
|
-
meta: {
|
|
15
|
-
file: string
|
|
16
|
-
processed: number
|
|
17
|
-
total: number
|
|
18
|
-
percentage: number
|
|
19
|
-
},
|
|
20
|
-
]
|
|
21
|
-
'files:processing:end': [meta: { total: number }]
|
|
22
|
-
info: [message: string, info?: string]
|
|
23
|
-
success: [message: string, info?: string]
|
|
24
|
-
warn: [message: string, info?: string]
|
|
25
|
-
error: [error: { message: string; stack?: string }]
|
|
26
|
-
'generation:start': [config: { name?: string; plugins: number }]
|
|
27
|
-
'generation:end': [Config: Config, files: Array<KubbFile.ResolvedFile>, sources: Record<KubbFile.Path, string>]
|
|
28
|
-
'lifecycle:end': []
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export type SseEventType = keyof SseEvents
|
|
32
|
-
|
|
33
|
-
export type SseEvent<T extends SseEventType = SseEventType> = {
|
|
34
|
-
type: T
|
|
35
|
-
data: SseEvents[T]
|
|
36
|
-
timestamp: number
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* API response types for the Kubb stream server endpoints.
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/** GET /api/health */
|
|
44
|
-
export type HealthResponse = {
|
|
45
|
-
status: 'ok'
|
|
46
|
-
version: string
|
|
47
|
-
configPath: string
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** GET /api/info */
|
|
51
|
-
export type InfoResponse = {
|
|
52
|
-
version: string
|
|
53
|
-
configPath: string
|
|
54
|
-
spec?: string
|
|
55
|
-
config: {
|
|
56
|
-
name?: string
|
|
57
|
-
root: string
|
|
58
|
-
input: {
|
|
59
|
-
path?: string
|
|
60
|
-
}
|
|
61
|
-
output: {
|
|
62
|
-
path: string
|
|
63
|
-
write?: boolean
|
|
64
|
-
extension?: Record<string, string>
|
|
65
|
-
barrelType?: string | false
|
|
66
|
-
}
|
|
67
|
-
plugins?: Array<{
|
|
68
|
-
name: string
|
|
69
|
-
options: unknown
|
|
70
|
-
}>
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Same events as KubbEvents but with server lifecycle events
|
|
76
|
-
*/
|
|
77
|
-
export type ServerEvents = KubbEvents & {
|
|
78
|
-
/**
|
|
79
|
-
* Emitted when the server starts successfully
|
|
80
|
-
*/
|
|
81
|
-
'server:start': [serverUrl: string, configPath: string]
|
|
82
|
-
/**
|
|
83
|
-
* Emitted when the server is shutting down
|
|
84
|
-
*/
|
|
85
|
-
'server:shutdown': []
|
|
86
|
-
/**
|
|
87
|
-
* Emitted when the server has stopped
|
|
88
|
-
*/
|
|
89
|
-
'server:stopped': []
|
|
90
|
-
}
|