@onebun/core 0.1.23 → 0.2.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/package.json +8 -8
- package/src/application/application.test.ts +519 -32
- package/src/application/application.ts +342 -377
- package/src/decorators/decorators.test.ts +47 -33
- package/src/decorators/decorators.ts +12 -0
- package/src/docs-examples.test.ts +300 -1
- package/src/index.ts +2 -0
- package/src/module/controller.ts +7 -3
- package/src/queue/docs-examples.test.ts +86 -0
- package/src/service-client/service-client.test.ts +1 -1
- package/src/types.ts +18 -2
- package/src/validation/schemas.test.ts +0 -2
- package/src/websocket/ws-base-gateway.ts +2 -2
- package/src/websocket/ws-handler.ts +4 -3
- package/src/websocket/ws.types.ts +1 -1
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
WebSocketApplicationOptions,
|
|
15
15
|
} from './ws.types';
|
|
16
16
|
import type { WsHandlerResponse } from './ws.types';
|
|
17
|
+
import type { OneBunRequest } from '../types';
|
|
17
18
|
import type { Server, ServerWebSocket } from 'bun';
|
|
18
19
|
|
|
19
20
|
import type { SyncLogger } from '@onebun/logger';
|
|
@@ -121,7 +122,7 @@ export class WsHandler {
|
|
|
121
122
|
/**
|
|
122
123
|
* Initialize gateways with server
|
|
123
124
|
*/
|
|
124
|
-
initializeGateways(server: Server): void {
|
|
125
|
+
initializeGateways(server: Server<WsClientData>): void {
|
|
125
126
|
for (const [_, gateway] of this.gateways) {
|
|
126
127
|
gateway.instance._initialize(this.storage, server);
|
|
127
128
|
}
|
|
@@ -182,8 +183,8 @@ export class WsHandler {
|
|
|
182
183
|
* Handle WebSocket upgrade request
|
|
183
184
|
*/
|
|
184
185
|
async handleUpgrade(
|
|
185
|
-
req: Request,
|
|
186
|
-
server: Server
|
|
186
|
+
req: OneBunRequest | Request,
|
|
187
|
+
server: Server<WsClientData>,
|
|
187
188
|
): Promise<Response | undefined> {
|
|
188
189
|
const url = new URL(req.url);
|
|
189
190
|
const path = url.pathname;
|
|
@@ -294,7 +294,7 @@ export interface WsGuard {
|
|
|
294
294
|
*/
|
|
295
295
|
export interface WsServer {
|
|
296
296
|
/** Bun server instance */
|
|
297
|
-
server: Server
|
|
297
|
+
server: Server<WsClientData>;
|
|
298
298
|
/** Publish message to a topic */
|
|
299
299
|
publish(topic: string, message: string | Buffer): void;
|
|
300
300
|
/** Get subscriber count for a topic */
|