shokupan 0.10.4 → 0.11.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/dist/{analyzer-CKLGLFtx.cjs → analyzer-BAhvpNY_.cjs} +2 -7
- package/dist/{analyzer-CKLGLFtx.cjs.map → analyzer-BAhvpNY_.cjs.map} +1 -1
- package/dist/{analyzer-BqIe1p0R.js → analyzer-CnKnQ5KV.js} +3 -8
- package/dist/{analyzer-BqIe1p0R.js.map → analyzer-CnKnQ5KV.js.map} +1 -1
- package/dist/{analyzer.impl-D9Yi1Hax.cjs → analyzer.impl-CfpMu4-g.cjs} +586 -40
- package/dist/analyzer.impl-CfpMu4-g.cjs.map +1 -0
- package/dist/{analyzer.impl-CV6W1Eq7.js → analyzer.impl-DCiqlXI5.js} +586 -40
- package/dist/analyzer.impl-DCiqlXI5.js.map +1 -0
- package/dist/cli.cjs +206 -18
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +206 -18
- package/dist/cli.js.map +1 -1
- package/dist/context.d.ts +6 -1
- package/dist/index.cjs +2405 -1008
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2402 -1006
- package/dist/index.js.map +1 -1
- package/dist/plugins/application/api-explorer/static/explorer-client.mjs +423 -30
- package/dist/plugins/application/api-explorer/static/style.css +351 -10
- package/dist/plugins/application/api-explorer/static/theme.css +7 -2
- package/dist/plugins/application/asyncapi/generator.d.ts +4 -0
- package/dist/plugins/application/asyncapi/static/asyncapi-client.mjs +154 -22
- package/dist/plugins/application/asyncapi/static/style.css +24 -8
- package/dist/plugins/application/dashboard/fetch-interceptor.d.ts +107 -0
- package/dist/plugins/application/dashboard/metrics-collector.d.ts +38 -2
- package/dist/plugins/application/dashboard/plugin.d.ts +44 -1
- package/dist/plugins/application/dashboard/static/charts.js +127 -62
- package/dist/plugins/application/dashboard/static/client.js +160 -0
- package/dist/plugins/application/dashboard/static/graph.mjs +167 -56
- package/dist/plugins/application/dashboard/static/reactflow.css +20 -10
- package/dist/plugins/application/dashboard/static/registry.js +112 -8
- package/dist/plugins/application/dashboard/static/requests.js +868 -58
- package/dist/plugins/application/dashboard/static/styles.css +186 -14
- package/dist/plugins/application/dashboard/static/tabs.js +44 -9
- package/dist/plugins/application/dashboard/static/theme.css +7 -2
- package/dist/plugins/application/openapi/analyzer.impl.d.ts +61 -1
- package/dist/plugins/application/openapi/openapi.d.ts +3 -0
- package/dist/plugins/application/shared/ast-utils.d.ts +7 -0
- package/dist/router.d.ts +55 -16
- package/dist/shokupan.d.ts +7 -2
- package/dist/util/adapter/adapters.d.ts +19 -0
- package/dist/util/adapter/filesystem.d.ts +20 -0
- package/dist/util/controller-scanner.d.ts +4 -0
- package/dist/util/cpu-monitor.d.ts +2 -0
- package/dist/util/middleware-tracker.d.ts +10 -0
- package/dist/util/types.d.ts +37 -0
- package/package.json +5 -5
- package/dist/analyzer.impl-CV6W1Eq7.js.map +0 -1
- package/dist/analyzer.impl-D9Yi1Hax.cjs.map +0 -1
- package/dist/http-server-BEMPIs33.cjs +0 -85
- package/dist/http-server-BEMPIs33.cjs.map +0 -1
- package/dist/http-server-CCeagTyU.js +0 -68
- package/dist/http-server-CCeagTyU.js.map +0 -1
- package/dist/plugins/application/dashboard/static/poll.js +0 -146
package/dist/router.d.ts
CHANGED
|
@@ -74,6 +74,27 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
74
74
|
private [$parent];
|
|
75
75
|
[$childRouters]: ShokupanRouter<T>[];
|
|
76
76
|
[$childControllers]: ShokupanController[];
|
|
77
|
+
private _hasOnResponseEndHook;
|
|
78
|
+
private _hasOnRequestStartHook;
|
|
79
|
+
private _hasOnRequestEndHook;
|
|
80
|
+
private _hasOnResponseStartHook;
|
|
81
|
+
private _hasOnErrorHook;
|
|
82
|
+
private _hasOnRequestTimeoutHook;
|
|
83
|
+
private _hasOnReadTimeoutHook;
|
|
84
|
+
private _hasOnWriteTimeoutHook;
|
|
85
|
+
private _hasBeforeValidateHook;
|
|
86
|
+
private _hasAfterValidateHook;
|
|
87
|
+
get hasOnResponseEndHook(): boolean;
|
|
88
|
+
get hasOnRequestStartHook(): boolean;
|
|
89
|
+
get hasOnRequestEndHook(): boolean;
|
|
90
|
+
get hasOnResponseStartHook(): boolean;
|
|
91
|
+
get hasOnErrorHook(): boolean;
|
|
92
|
+
get hasOnRequestTimeoutHook(): boolean;
|
|
93
|
+
get hasOnReadTimeoutHook(): boolean;
|
|
94
|
+
get hasOnWriteTimeoutHook(): boolean;
|
|
95
|
+
get hasBeforeValidateHook(): boolean;
|
|
96
|
+
get hasAfterValidateHook(): boolean;
|
|
97
|
+
requestTimeout?: number;
|
|
77
98
|
get db(): SurrealDatastore | undefined;
|
|
78
99
|
private hookCache;
|
|
79
100
|
private hooksInitialized;
|
|
@@ -85,7 +106,9 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
85
106
|
development: boolean;
|
|
86
107
|
enableAsyncLocalStorage: boolean;
|
|
87
108
|
enableOpenApiGen: boolean;
|
|
109
|
+
blockOnOpenApiGen: boolean;
|
|
88
110
|
enableAsyncApiGen: boolean;
|
|
111
|
+
blockOnAsyncApiGen: boolean;
|
|
89
112
|
reusePort: boolean;
|
|
90
113
|
controllersOnly: boolean;
|
|
91
114
|
enableTracing?: boolean;
|
|
@@ -112,6 +135,8 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
112
135
|
writeTimeout: number;
|
|
113
136
|
renderer: JSXRenderer;
|
|
114
137
|
serverFactory: import('.').ServerFactory;
|
|
138
|
+
adapter?: "bun" | "node" | "wintercg" | import('./util/adapter/adapters').ServerAdapter;
|
|
139
|
+
fileSystem?: import('./util/adapter/filesystem').FileSystemAdapter;
|
|
115
140
|
hooks: ShokupanHooks<Record<string, any>> | ShokupanHooks<Record<string, any>>[];
|
|
116
141
|
validateStatusCodes: boolean;
|
|
117
142
|
surreal?: {
|
|
@@ -195,6 +220,13 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
195
220
|
routes: any[];
|
|
196
221
|
};
|
|
197
222
|
}[];
|
|
223
|
+
events: {
|
|
224
|
+
type: 'event';
|
|
225
|
+
name: string;
|
|
226
|
+
handlerName: string;
|
|
227
|
+
metadata: RouteMetadata;
|
|
228
|
+
_fn: ShokupanHandler<T>;
|
|
229
|
+
}[];
|
|
198
230
|
};
|
|
199
231
|
constructor(config?: ShokupanRouteConfig);
|
|
200
232
|
private isRouterInstance;
|
|
@@ -202,10 +234,18 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
202
234
|
* Registers an event handler for WebSocket.
|
|
203
235
|
*/
|
|
204
236
|
event(name: string, handler: ShokupanHandler<T>): this;
|
|
237
|
+
/**
|
|
238
|
+
* Registers a lifecycle hook dynamically.
|
|
239
|
+
*/
|
|
240
|
+
hook(name: keyof ShokupanHooks, handler: Function): this;
|
|
205
241
|
/**
|
|
206
242
|
* Finds an event handler(s) by name.
|
|
207
243
|
*/
|
|
208
244
|
findEvent(name: string): ShokupanHandler<T>[] | null;
|
|
245
|
+
/**
|
|
246
|
+
* Registers a controller instance to the router.
|
|
247
|
+
*/
|
|
248
|
+
registerControllerInstance(controller: any): void;
|
|
209
249
|
/**
|
|
210
250
|
* Returns all registered event handlers.
|
|
211
251
|
*/
|
|
@@ -248,7 +288,6 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
248
288
|
testRequest(options: RequestOptions): Promise<ProcessResult>;
|
|
249
289
|
private wrapWithHooks;
|
|
250
290
|
private mountRouter;
|
|
251
|
-
private scanControllerRoutes;
|
|
252
291
|
/**
|
|
253
292
|
* Find a route matching the given method and path.
|
|
254
293
|
* @param method HTTP method
|
|
@@ -260,7 +299,6 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
260
299
|
params: Record<string, string>;
|
|
261
300
|
} | null;
|
|
262
301
|
private parsePath;
|
|
263
|
-
requestTimeout?: number;
|
|
264
302
|
/**
|
|
265
303
|
* Adds a route to the router.
|
|
266
304
|
*
|
|
@@ -297,7 +335,7 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
297
335
|
* @param path - URL path
|
|
298
336
|
* @param handlers - Route handler functions
|
|
299
337
|
*/
|
|
300
|
-
get<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
338
|
+
get<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
301
339
|
/**
|
|
302
340
|
* Adds a GET route to the router.
|
|
303
341
|
*
|
|
@@ -305,14 +343,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
305
343
|
* @param spec - OpenAPI specification for the route
|
|
306
344
|
* @param handlers - Route handler functions
|
|
307
345
|
*/
|
|
308
|
-
get<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
346
|
+
get<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
309
347
|
/**
|
|
310
348
|
* Adds a POST route to the router.
|
|
311
349
|
*
|
|
312
350
|
* @param path - URL path
|
|
313
351
|
* @param handlers - Route handler functions
|
|
314
352
|
*/
|
|
315
|
-
post<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
353
|
+
post<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
316
354
|
/**
|
|
317
355
|
* Adds a POST route to the router.
|
|
318
356
|
*
|
|
@@ -320,14 +358,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
320
358
|
* @param spec - OpenAPI specification for the route
|
|
321
359
|
* @param handlers - Route handler functions
|
|
322
360
|
*/
|
|
323
|
-
post<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
361
|
+
post<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
324
362
|
/**
|
|
325
363
|
* Adds a PUT route to the router.
|
|
326
364
|
*
|
|
327
365
|
* @param path - URL path
|
|
328
366
|
* @param handlers - Route handler functions
|
|
329
367
|
*/
|
|
330
|
-
put<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
368
|
+
put<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
331
369
|
/**
|
|
332
370
|
* Adds a PUT route to the router.
|
|
333
371
|
*
|
|
@@ -335,14 +373,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
335
373
|
* @param spec - OpenAPI specification for the route
|
|
336
374
|
* @param handlers - Route handler functions
|
|
337
375
|
*/
|
|
338
|
-
put<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
376
|
+
put<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
339
377
|
/**
|
|
340
378
|
* Adds a DELETE route to the router.
|
|
341
379
|
*
|
|
342
380
|
* @param path - URL path
|
|
343
381
|
* @param handlers - Route handler functions
|
|
344
382
|
*/
|
|
345
|
-
delete<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
383
|
+
delete<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
346
384
|
/**
|
|
347
385
|
* Adds a DELETE route to the router.
|
|
348
386
|
*
|
|
@@ -350,14 +388,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
350
388
|
* @param spec - OpenAPI specification for the route
|
|
351
389
|
* @param handlers - Route handler functions
|
|
352
390
|
*/
|
|
353
|
-
delete<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
391
|
+
delete<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
354
392
|
/**
|
|
355
393
|
* Adds a PATCH route to the router.
|
|
356
394
|
*
|
|
357
395
|
* @param path - URL path
|
|
358
396
|
* @param handlers - Route handler functions
|
|
359
397
|
*/
|
|
360
|
-
patch<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
398
|
+
patch<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
361
399
|
/**
|
|
362
400
|
* Adds a PATCH route to the router.
|
|
363
401
|
*
|
|
@@ -365,14 +403,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
365
403
|
* @param spec - OpenAPI specification for the route
|
|
366
404
|
* @param handlers - Route handler functions
|
|
367
405
|
*/
|
|
368
|
-
patch<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
406
|
+
patch<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
369
407
|
/**
|
|
370
408
|
* Adds a OPTIONS route to the router.
|
|
371
409
|
*
|
|
372
410
|
* @param path - URL path
|
|
373
411
|
* @param handlers - Route handler functions
|
|
374
412
|
*/
|
|
375
|
-
options<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
413
|
+
options<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
376
414
|
/**
|
|
377
415
|
* Adds a OPTIONS route to the router.
|
|
378
416
|
*
|
|
@@ -380,14 +418,14 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
380
418
|
* @param spec - OpenAPI specification for the route
|
|
381
419
|
* @param handlers - Route handler functions
|
|
382
420
|
*/
|
|
383
|
-
options<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
421
|
+
options<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
384
422
|
/**
|
|
385
423
|
* Adds a HEAD route to the router.
|
|
386
424
|
*
|
|
387
425
|
* @param path - URL path
|
|
388
426
|
* @param handlers - Route handler functions
|
|
389
427
|
*/
|
|
390
|
-
head<Path extends string>(path: Path, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
428
|
+
head<Path extends string>(path: Path, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
391
429
|
/**
|
|
392
430
|
* Adds a HEAD route to the router.
|
|
393
431
|
*
|
|
@@ -395,7 +433,7 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
395
433
|
* @param spec - OpenAPI specification for the route
|
|
396
434
|
* @param handlers - Route handler functions
|
|
397
435
|
*/
|
|
398
|
-
head<Path extends string>(path: Path, spec: MethodAPISpec, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
436
|
+
head<Path extends string>(path: Path, spec: MethodAPISpec, handler: ShokupanHandler<T, RouteParams<Path>>, ...handlers: ShokupanHandler<T, RouteParams<Path>>[]): any;
|
|
399
437
|
/**
|
|
400
438
|
* Adds a guard to the router that applies to all routes added **after** this point.
|
|
401
439
|
* Guards must return true or call `ctx.next()` to allow the request to continue.
|
|
@@ -427,6 +465,7 @@ export declare class ShokupanRouter<T extends Record<string, any> = Record<strin
|
|
|
427
465
|
* Now includes runtime analysis of handler functions to infer request/response types.
|
|
428
466
|
*/
|
|
429
467
|
generateApiSpec(options?: OpenAPIOptions): Promise<any>;
|
|
468
|
+
hasHooks(name: keyof ShokupanHooks): boolean;
|
|
430
469
|
private ensureHooksInitialized;
|
|
431
470
|
runHooks(name: keyof ShokupanHooks, ...args: any[]): void | Promise<void[]>;
|
|
432
471
|
}
|
package/dist/shokupan.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $dispatch } from './util/symbol';
|
|
2
|
-
import { Middleware, ProcessResult, RequestOptions, ShokupanConfig, ShokupanPlugin } from './util/types';
|
|
3
1
|
import { Server } from 'bun';
|
|
4
2
|
import { ShokupanRouter } from './router';
|
|
5
3
|
import { SurrealDatastore } from './util/datastore';
|
|
6
4
|
import { ShokupanRequest } from './util/request';
|
|
5
|
+
import { $dispatch } from './util/symbol';
|
|
6
|
+
import { Middleware, ProcessResult, RequestOptions, ShokupanConfig, ShokupanPlugin } from './util/types';
|
|
7
7
|
/**
|
|
8
8
|
* Shokupan Application
|
|
9
9
|
*
|
|
@@ -72,6 +72,8 @@ export declare class Shokupan<T = any> extends ShokupanRouter<T> {
|
|
|
72
72
|
readonly applicationConfig: ShokupanConfig;
|
|
73
73
|
openApiSpec?: any;
|
|
74
74
|
asyncApiSpec?: any;
|
|
75
|
+
private openApiSpecPromise?;
|
|
76
|
+
private asyncApiSpecPromise?;
|
|
75
77
|
private composedMiddleware?;
|
|
76
78
|
private cpuMonitor?;
|
|
77
79
|
private server?;
|
|
@@ -88,6 +90,9 @@ export declare class Shokupan<T = any> extends ShokupanRouter<T> {
|
|
|
88
90
|
};
|
|
89
91
|
constructor(applicationConfig?: ShokupanConfig);
|
|
90
92
|
private initDatastore;
|
|
93
|
+
/**
|
|
94
|
+
* Adds middleware to the application.
|
|
95
|
+
*/
|
|
91
96
|
/**
|
|
92
97
|
* Adds middleware to the application.
|
|
93
98
|
*/
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Server } from 'bun';
|
|
2
|
+
import { Shokupan } from '../../shokupan';
|
|
3
|
+
export interface ServerAdapter {
|
|
4
|
+
listen(port: number, app: Shokupan): Promise<any>;
|
|
5
|
+
stop?(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class BunAdapter implements ServerAdapter {
|
|
8
|
+
private server?;
|
|
9
|
+
listen(port: number, app: Shokupan): Promise<Server<any>>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class NodeAdapter implements ServerAdapter {
|
|
13
|
+
private server?;
|
|
14
|
+
listen(port: number, app: Shokupan): Promise<any>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export declare class WinterCGAdapter implements ServerAdapter {
|
|
18
|
+
listen(port: number, app: Shokupan): Promise<any>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface FileSystemAdapter {
|
|
2
|
+
readFile(path: string): Promise<Uint8Array | string | ReadableStream>;
|
|
3
|
+
stat?(path: string): Promise<{
|
|
4
|
+
size: number;
|
|
5
|
+
mtime: Date;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Default file system adapter that uses Bun.file for Bun and Node.js fs.promises for Node.js.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DefaultFileSystemAdapter implements FileSystemAdapter {
|
|
12
|
+
readFile(path: string): Promise<Uint8Array | string | ReadableStream>;
|
|
13
|
+
stat(path: string): Promise<{
|
|
14
|
+
size: number;
|
|
15
|
+
mtime: Date;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
export declare class NoOpFileSystemAdapter implements FileSystemAdapter {
|
|
19
|
+
readFile(path: string): Promise<Uint8Array | string | ReadableStream>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Middleware, ShokupanHandler } from '../util/types';
|
|
2
|
+
export declare class MiddlewareTracker {
|
|
3
|
+
static wrap(handler: Middleware | ShokupanHandler<any>, context: {
|
|
4
|
+
file: string;
|
|
5
|
+
line: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
isBuiltin?: boolean;
|
|
8
|
+
pluginName?: string;
|
|
9
|
+
}): any;
|
|
10
|
+
}
|
package/dist/util/types.d.ts
CHANGED
|
@@ -61,6 +61,15 @@ export interface OpenAPIOptions {
|
|
|
61
61
|
externalDocs?: OpenAPI.Document['externalDocs'];
|
|
62
62
|
defaultTagGroup?: string;
|
|
63
63
|
defaultTag?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to generate a strictly compliant OpenAPI spec (stripping x- extensions).
|
|
66
|
+
* @default false
|
|
67
|
+
*/
|
|
68
|
+
compliant?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Array to collect warnings during generation.
|
|
71
|
+
*/
|
|
72
|
+
warnings?: any[];
|
|
64
73
|
}
|
|
65
74
|
export interface AsyncAPIOptions {
|
|
66
75
|
info?: {
|
|
@@ -69,6 +78,10 @@ export interface AsyncAPIOptions {
|
|
|
69
78
|
description?: string;
|
|
70
79
|
};
|
|
71
80
|
defaultTag?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Array to collect warnings during generation.
|
|
83
|
+
*/
|
|
84
|
+
warnings?: any[];
|
|
72
85
|
}
|
|
73
86
|
export interface AsyncAPISpec {
|
|
74
87
|
type?: 'publish' | 'subscribe';
|
|
@@ -263,11 +276,25 @@ export type ShokupanConfig<T extends Record<string, any> = Record<string, any>>
|
|
|
263
276
|
* @default true
|
|
264
277
|
*/
|
|
265
278
|
enableOpenApiGen: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Whether to block server startup until OpenAPI generation completes.
|
|
281
|
+
* Only applies when enableOpenApiGen is true.
|
|
282
|
+
* When false, OpenAPI generation happens asynchronously in the background.
|
|
283
|
+
* @default true
|
|
284
|
+
*/
|
|
285
|
+
blockOnOpenApiGen: boolean;
|
|
266
286
|
/**
|
|
267
287
|
* Whether to enable AsyncAPI generation.
|
|
268
288
|
* @default false
|
|
269
289
|
*/
|
|
270
290
|
enableAsyncApiGen: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Whether to block server startup until AsyncAPI generation completes.
|
|
293
|
+
* Only applies when enableAsyncApiGen is true.
|
|
294
|
+
* When false, AsyncAPI generation happens asynchronously in the background.
|
|
295
|
+
* @default true
|
|
296
|
+
*/
|
|
297
|
+
blockOnAsyncApiGen: boolean;
|
|
271
298
|
/**
|
|
272
299
|
* Whether to reuse the port.
|
|
273
300
|
* @default false
|
|
@@ -399,8 +426,18 @@ export type ShokupanConfig<T extends Record<string, any> = Record<string, any>>
|
|
|
399
426
|
/**
|
|
400
427
|
* Factory function to create the server instance.
|
|
401
428
|
* Defaults to Bun.serve.
|
|
429
|
+
* @deprecated Use `adapter` instead.
|
|
402
430
|
*/
|
|
403
431
|
serverFactory: ServerFactory;
|
|
432
|
+
/**
|
|
433
|
+
* The server adapter to use.
|
|
434
|
+
* overrides `serverFactory`.
|
|
435
|
+
*/
|
|
436
|
+
adapter?: 'bun' | 'node' | 'wintercg' | import('./adapter/adapters').ServerAdapter;
|
|
437
|
+
/**
|
|
438
|
+
* The file system adapter to use for `ctx.file`.
|
|
439
|
+
*/
|
|
440
|
+
fileSystem?: import('./adapter/filesystem').FileSystemAdapter;
|
|
404
441
|
/**
|
|
405
442
|
* Lifecycle hooks.
|
|
406
443
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shokupan",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Shokupan is a low-lift modern web framework for Bun.",
|
|
5
5
|
"author": "Andrew G. Knackstedt",
|
|
6
6
|
"publishConfig": {
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"tslib": "^2.8.1"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
+
"@apollo/server": "^5.2.0",
|
|
74
75
|
"@scalar/api-reference": "^1.0.0",
|
|
75
76
|
"@surrealdb/node": "^2.4.0",
|
|
76
77
|
"ajv": "^8.0.0",
|
|
@@ -79,14 +80,13 @@
|
|
|
79
80
|
"class-transformer": "^0.5.0",
|
|
80
81
|
"class-validator": "^0.14.0",
|
|
81
82
|
"eta": "^4.0.0",
|
|
83
|
+
"graphql": "^16.12.0",
|
|
84
|
+
"graphql-yoga": "^5.18.0",
|
|
82
85
|
"jose": "^6.0.0",
|
|
83
86
|
"parse-json": "^8.0.0",
|
|
84
87
|
"reflect-metadata": "^0.2.0",
|
|
85
88
|
"secure-json-parse": "^4.0.0",
|
|
86
|
-
"surrealdb": "^2.0.0-alpha.16"
|
|
87
|
-
"@apollo/server": "^5.2.0",
|
|
88
|
-
"graphql-yoga": "^5.18.0",
|
|
89
|
-
"graphql": "^16.12.0"
|
|
89
|
+
"surrealdb": "^2.0.0-alpha.16"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|
|
92
92
|
"ajv": {
|