@tsed/socketio 7.0.0-alpha.1 → 7.0.0-beta.10
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/.mocharc.js +2 -2
- package/.nycrc +1 -0
- package/lib/{SocketIOModule.js → cjs/SocketIOModule.js} +28 -24
- package/lib/cjs/SocketIOModule.js.map +1 -0
- package/lib/{class → cjs/class}/SocketHandlersBuilder.js +22 -14
- package/lib/cjs/class/SocketHandlersBuilder.js.map +1 -0
- package/lib/{class → cjs/class}/SocketProviderMetadata.js +0 -0
- package/lib/cjs/class/SocketProviderMetadata.js.map +1 -0
- package/lib/{constants/index.js → cjs/constants/constants.js} +1 -1
- package/lib/cjs/constants/constants.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/args.js +1 -1
- package/lib/cjs/decorators/args.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/broadcast.js +1 -1
- package/lib/cjs/decorators/broadcast.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/broadcastOthers.js +1 -1
- package/lib/cjs/decorators/broadcastOthers.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/emit.js +1 -1
- package/lib/cjs/decorators/emit.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/input.js +0 -0
- package/lib/cjs/decorators/input.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/inputAndBroadcast.js +2 -2
- package/lib/cjs/decorators/inputAndBroadcast.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/inputAndBroadcastOthers.js +2 -2
- package/lib/cjs/decorators/inputAndBroadcastOthers.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/inputAndEmit.js +2 -2
- package/lib/cjs/decorators/inputAndEmit.js.map +1 -0
- package/lib/cjs/decorators/io.js +13 -0
- package/lib/cjs/decorators/io.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/nsp.js +2 -2
- package/lib/cjs/decorators/nsp.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socket.js +1 -1
- package/lib/cjs/decorators/socket.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketErr.js +1 -1
- package/lib/cjs/decorators/socketErr.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketEventName.js +1 -1
- package/lib/cjs/decorators/socketEventName.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketFilter.js +0 -0
- package/lib/cjs/decorators/socketFilter.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketMiddleware.js +4 -4
- package/lib/cjs/decorators/socketMiddleware.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketMiddlewareError.js +2 -2
- package/lib/cjs/decorators/socketMiddlewareError.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketReturns.js +0 -0
- package/lib/cjs/decorators/socketReturns.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketService.js +2 -2
- package/lib/cjs/decorators/socketService.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketSession.js +1 -1
- package/lib/cjs/decorators/socketSession.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketUseAfter.js +0 -0
- package/lib/cjs/decorators/socketUseAfter.js.map +1 -0
- package/lib/{decorators → cjs/decorators}/socketUseBefore.js +0 -0
- package/lib/cjs/decorators/socketUseBefore.js.map +1 -0
- package/lib/{index.js → cjs/index.js} +21 -10
- package/lib/cjs/index.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/OnNamespaceInit.js +0 -0
- package/lib/cjs/interfaces/OnNamespaceInit.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketFilters.js +0 -0
- package/lib/cjs/interfaces/SocketFilters.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketHandlerMetadata.js +0 -0
- package/lib/cjs/interfaces/SocketHandlerMetadata.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketInjectableNsp.js +0 -0
- package/lib/cjs/interfaces/SocketInjectableNsp.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketParamMetadata.js +0 -0
- package/lib/cjs/interfaces/SocketParamMetadata.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketProviderTypes.js +0 -0
- package/lib/cjs/interfaces/SocketProviderTypes.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/SocketReturnsTypes.js +0 -0
- package/lib/cjs/interfaces/SocketReturnsTypes.js.map +1 -0
- package/lib/cjs/interfaces/interfaces.js +3 -0
- package/lib/cjs/interfaces/interfaces.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/{registries → cjs/registries}/NspSessionRegistry.js +0 -0
- package/lib/cjs/registries/NspSessionRegistry.js.map +1 -0
- package/lib/{services → cjs/services}/SocketIOServer.js +2 -2
- package/lib/cjs/services/SocketIOServer.js.map +1 -0
- package/lib/{services → cjs/services}/SocketIOService.js +4 -5
- package/lib/cjs/services/SocketIOService.js.map +1 -0
- package/lib/esm/SocketIOModule.js +109 -0
- package/lib/esm/SocketIOModule.js.map +1 -0
- package/lib/esm/class/SocketHandlersBuilder.js +207 -0
- package/lib/esm/class/SocketHandlersBuilder.js.map +1 -0
- package/lib/esm/class/SocketProviderMetadata.js +44 -0
- package/lib/esm/class/SocketProviderMetadata.js.map +1 -0
- package/lib/esm/constants/constants.js +2 -0
- package/lib/esm/constants/constants.js.map +1 -0
- package/lib/esm/decorators/args.js +57 -0
- package/lib/esm/decorators/args.js.map +1 -0
- package/lib/esm/decorators/broadcast.js +28 -0
- package/lib/esm/decorators/broadcast.js.map +1 -0
- package/lib/esm/decorators/broadcastOthers.js +28 -0
- package/lib/esm/decorators/broadcastOthers.js.map +1 -0
- package/lib/esm/decorators/emit.js +28 -0
- package/lib/esm/decorators/emit.js.map +1 -0
- package/lib/esm/decorators/input.js +33 -0
- package/lib/esm/decorators/input.js.map +1 -0
- package/lib/esm/decorators/inputAndBroadcast.js +28 -0
- package/lib/esm/decorators/inputAndBroadcast.js.map +1 -0
- package/lib/esm/decorators/inputAndBroadcastOthers.js +28 -0
- package/lib/esm/decorators/inputAndBroadcastOthers.js.map +1 -0
- package/lib/esm/decorators/inputAndEmit.js +28 -0
- package/lib/esm/decorators/inputAndEmit.js.map +1 -0
- package/lib/esm/decorators/io.js +9 -0
- package/lib/esm/decorators/io.js.map +1 -0
- package/lib/esm/decorators/nsp.js +83 -0
- package/lib/esm/decorators/nsp.js.map +1 -0
- package/lib/esm/decorators/socket.js +28 -0
- package/lib/esm/decorators/socket.js.map +1 -0
- package/lib/esm/decorators/socketErr.js +26 -0
- package/lib/esm/decorators/socketErr.js.map +1 -0
- package/lib/esm/decorators/socketEventName.js +26 -0
- package/lib/esm/decorators/socketEventName.js.map +1 -0
- package/lib/esm/decorators/socketFilter.js +25 -0
- package/lib/esm/decorators/socketFilter.js.map +1 -0
- package/lib/esm/decorators/socketMiddleware.js +70 -0
- package/lib/esm/decorators/socketMiddleware.js.map +1 -0
- package/lib/esm/decorators/socketMiddlewareError.js +67 -0
- package/lib/esm/decorators/socketMiddlewareError.js.map +1 -0
- package/lib/esm/decorators/socketReturns.js +23 -0
- package/lib/esm/decorators/socketReturns.js.map +1 -0
- package/lib/esm/decorators/socketService.js +20 -0
- package/lib/esm/decorators/socketService.js.map +1 -0
- package/lib/esm/decorators/socketSession.js +27 -0
- package/lib/esm/decorators/socketSession.js.map +1 -0
- package/lib/esm/decorators/socketUseAfter.js +70 -0
- package/lib/esm/decorators/socketUseAfter.js.map +1 -0
- package/lib/esm/decorators/socketUseBefore.js +74 -0
- package/lib/esm/decorators/socketUseBefore.js.map +1 -0
- package/lib/esm/index.js +40 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/interfaces/OnNamespaceInit.js +2 -0
- package/lib/esm/interfaces/OnNamespaceInit.js.map +1 -0
- package/lib/esm/interfaces/SocketFilters.js +13 -0
- package/lib/esm/interfaces/SocketFilters.js.map +1 -0
- package/lib/esm/interfaces/SocketHandlerMetadata.js +2 -0
- package/lib/esm/interfaces/SocketHandlerMetadata.js.map +1 -0
- package/lib/esm/interfaces/SocketInjectableNsp.js +2 -0
- package/lib/esm/interfaces/SocketInjectableNsp.js.map +1 -0
- package/lib/esm/interfaces/SocketParamMetadata.js +2 -0
- package/lib/esm/interfaces/SocketParamMetadata.js.map +1 -0
- package/lib/esm/interfaces/SocketProviderTypes.js +9 -0
- package/lib/esm/interfaces/SocketProviderTypes.js.map +1 -0
- package/lib/esm/interfaces/SocketReturnsTypes.js +10 -0
- package/lib/esm/interfaces/SocketReturnsTypes.js.map +1 -0
- package/lib/esm/interfaces/interfaces.js +2 -0
- package/lib/esm/interfaces/interfaces.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/registries/NspSessionRegistry.js +12 -0
- package/lib/esm/registries/NspSessionRegistry.js.map +1 -0
- package/lib/esm/services/SocketIOServer.js +12 -0
- package/lib/esm/services/SocketIOServer.js.map +1 -0
- package/lib/esm/services/SocketIOService.js +63 -0
- package/lib/esm/services/SocketIOService.js.map +1 -0
- package/lib/types/SocketIOModule.d.ts +28 -0
- package/lib/{class → types/class}/SocketHandlersBuilder.d.ts +2 -3
- package/lib/{class → types/class}/SocketProviderMetadata.d.ts +2 -1
- package/lib/{constants/index.d.ts → types/constants/constants.d.ts} +0 -0
- package/lib/{decorators → types/decorators}/args.d.ts +0 -0
- package/lib/{decorators → types/decorators}/broadcast.d.ts +0 -0
- package/lib/{decorators → types/decorators}/broadcastOthers.d.ts +0 -0
- package/lib/{decorators → types/decorators}/emit.d.ts +0 -0
- package/lib/{decorators → types/decorators}/input.d.ts +0 -0
- package/lib/{decorators → types/decorators}/inputAndBroadcast.d.ts +0 -0
- package/lib/{decorators → types/decorators}/inputAndBroadcastOthers.d.ts +0 -0
- package/lib/{decorators → types/decorators}/inputAndEmit.d.ts +0 -0
- package/lib/{decorators → types/decorators}/io.d.ts +1 -0
- package/lib/{decorators → types/decorators}/nsp.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socket.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketErr.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketEventName.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketFilter.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketMiddleware.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketMiddlewareError.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketReturns.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketService.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketSession.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketUseAfter.d.ts +0 -0
- package/lib/{decorators → types/decorators}/socketUseBefore.d.ts +0 -0
- package/lib/{index.d.ts → types/index.d.ts} +21 -7
- package/lib/{interfaces → types/interfaces}/OnNamespaceInit.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketFilters.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketHandlerMetadata.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketInjectableNsp.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketParamMetadata.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketProviderTypes.d.ts +0 -0
- package/lib/{interfaces → types/interfaces}/SocketReturnsTypes.d.ts +0 -0
- package/lib/types/interfaces/interfaces.d.ts +8 -0
- package/lib/{registries → types/registries}/NspSessionRegistry.d.ts +0 -0
- package/lib/{services → types/services}/SocketIOServer.d.ts +0 -0
- package/lib/{services → types/services}/SocketIOService.d.ts +2 -3
- package/package.json +45 -22
- package/readme.md +80 -96
- package/tsconfig.compile.esm.json +12 -0
- package/lib/SocketIOModule.d.ts +0 -29
- package/lib/SocketIOModule.js.map +0 -1
- package/lib/class/SocketHandlersBuilder.js.map +0 -1
- package/lib/class/SocketProviderMetadata.js.map +0 -1
- package/lib/constants/index.js.map +0 -1
- package/lib/decorators/args.js.map +0 -1
- package/lib/decorators/broadcast.js.map +0 -1
- package/lib/decorators/broadcastOthers.js.map +0 -1
- package/lib/decorators/emit.js.map +0 -1
- package/lib/decorators/input.js.map +0 -1
- package/lib/decorators/inputAndBroadcast.js.map +0 -1
- package/lib/decorators/inputAndBroadcastOthers.js.map +0 -1
- package/lib/decorators/inputAndEmit.js.map +0 -1
- package/lib/decorators/io.js +0 -27
- package/lib/decorators/io.js.map +0 -1
- package/lib/decorators/nsp.js.map +0 -1
- package/lib/decorators/socket.js.map +0 -1
- package/lib/decorators/socketErr.js.map +0 -1
- package/lib/decorators/socketEventName.js.map +0 -1
- package/lib/decorators/socketFilter.js.map +0 -1
- package/lib/decorators/socketMiddleware.js.map +0 -1
- package/lib/decorators/socketMiddlewareError.js.map +0 -1
- package/lib/decorators/socketReturns.js.map +0 -1
- package/lib/decorators/socketService.js.map +0 -1
- package/lib/decorators/socketSession.js.map +0 -1
- package/lib/decorators/socketUseAfter.js.map +0 -1
- package/lib/decorators/socketUseBefore.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/interfaces/OnNamespaceInit.js.map +0 -1
- package/lib/interfaces/SocketFilters.js.map +0 -1
- package/lib/interfaces/SocketHandlerMetadata.js.map +0 -1
- package/lib/interfaces/SocketInjectableNsp.js.map +0 -1
- package/lib/interfaces/SocketParamMetadata.js.map +0 -1
- package/lib/interfaces/SocketProviderTypes.js.map +0 -1
- package/lib/interfaces/SocketReturnsTypes.js.map +0 -1
- package/lib/interfaces/index.d.ts +0 -15
- package/lib/interfaces/index.js +0 -11
- package/lib/interfaces/index.js.map +0 -1
- package/lib/registries/NspSessionRegistry.js.map +0 -1
- package/lib/services/SocketIOServer.js.map +0 -1
- package/lib/services/SocketIOService.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Store } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {SocketFilters} filter
|
|
5
|
+
* @param {number} mapIndex
|
|
6
|
+
* @returns {(target: any, propertyKey: string, index: number) => Store}
|
|
7
|
+
* @decorator
|
|
8
|
+
*/
|
|
9
|
+
export function SocketFilter(filter, mapIndex) {
|
|
10
|
+
return (target, propertyKey, index) => {
|
|
11
|
+
Store.from(target).merge("socketIO", {
|
|
12
|
+
handlers: {
|
|
13
|
+
[propertyKey]: {
|
|
14
|
+
parameters: {
|
|
15
|
+
[index]: {
|
|
16
|
+
filter,
|
|
17
|
+
mapIndex
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=socketFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketFilter.js","sourceRoot":"","sources":["../../../src/decorators/socketFilter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAGjC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,QAAiB;IACnE,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa,EAAE,EAAE;QACzD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,QAAQ,EAAE;gBACR,CAAC,WAAW,CAAC,EAAE;oBACb,UAAU,EAAE;wBACV,CAAC,KAAK,CAAC,EAAE;4BACP,MAAM;4BACN,QAAQ;yBACT;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Store} from \"@tsed/core\";\nimport {SocketFilters} from \"../interfaces/SocketFilters\";\n\n/**\n *\n * @param {SocketFilters} filter\n * @param {number} mapIndex\n * @returns {(target: any, propertyKey: string, index: number) => Store}\n * @decorator\n */\nexport function SocketFilter(filter: SocketFilters, mapIndex?: number) {\n return (target: any, propertyKey: string, index: number) => {\n Store.from(target).merge(\"socketIO\", {\n handlers: {\n [propertyKey]: {\n parameters: {\n [index]: {\n filter,\n mapIndex\n }\n }\n }\n }\n });\n };\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Middleware } from "@tsed/platform-middlewares";
|
|
2
|
+
import { Store } from "@tsed/core";
|
|
3
|
+
import { SocketProviderTypes } from "../interfaces/SocketProviderTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Declare a new SocketMiddleware.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
10
|
+
*
|
|
11
|
+
* Here an example of a middleware:
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* @SocketMiddleware()
|
|
15
|
+
* export class UserConverterSocketMiddleware {
|
|
16
|
+
* constructor(private converterService: ConverterService) {
|
|
17
|
+
* }
|
|
18
|
+
* async use(@Args() args: any[]) {
|
|
19
|
+
*
|
|
20
|
+
* let [user] = args;
|
|
21
|
+
* // update Arguments
|
|
22
|
+
* user = this.converterService.deserialize(user, User);
|
|
23
|
+
*
|
|
24
|
+
* return [user];
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
* > The user instance will be forwarded to the next middleware and to your decorated method.
|
|
29
|
+
*
|
|
30
|
+
* Then:
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
34
|
+
* import {UserConverterSocketMiddleware} from "../middlewares";
|
|
35
|
+
* import {User} from "../models/User";
|
|
36
|
+
*
|
|
37
|
+
* @SocketService("/my-namespace")
|
|
38
|
+
* @SocketUseBefore(UserConverterSocketMiddleware) // global version
|
|
39
|
+
* export class MySocketService {
|
|
40
|
+
*
|
|
41
|
+
* @Input("eventName")
|
|
42
|
+
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
43
|
+
* @SocketUseBefore(UserConverterSocketMiddleware)
|
|
44
|
+
* async myMethod(@Args(0) user: User) {
|
|
45
|
+
*
|
|
46
|
+
* console.log(user);
|
|
47
|
+
*
|
|
48
|
+
* return user;
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* @returns {Function}
|
|
54
|
+
* @decorator
|
|
55
|
+
* @experimental
|
|
56
|
+
*/
|
|
57
|
+
export function SocketMiddleware() {
|
|
58
|
+
return (target) => {
|
|
59
|
+
Store.from(target).merge("socketIO", {
|
|
60
|
+
type: SocketProviderTypes.MIDDLEWARE,
|
|
61
|
+
handlers: {
|
|
62
|
+
use: {
|
|
63
|
+
methodClassName: "use"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return Middleware()(target);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=socketMiddleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketMiddleware.js","sourceRoot":"","sources":["../../../src/decorators/socketMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CAAC,MAAiB,EAAE,EAAE;QAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,IAAI,EAAE,mBAAmB,CAAC,UAAU;YACpC,QAAQ,EAAE;gBACR,GAAG,EAAE;oBACH,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Middleware} from \"@tsed/platform-middlewares\";\nimport {Store, Type} from \"@tsed/core\";\nimport {SocketProviderTypes} from \"../interfaces/SocketProviderTypes\";\n\n/**\n * Declare a new SocketMiddleware.\n *\n * ### Example\n *\n * A middleware can be also used on a `SocketService` either on a class or on a method.\n *\n * Here an example of a middleware:\n *\n * ```typescript\n * @SocketMiddleware()\n * export class UserConverterSocketMiddleware {\n * constructor(private converterService: ConverterService) {\n * }\n * async use(@Args() args: any[]) {\n *\n * let [user] = args;\n * // update Arguments\n * user = this.converterService.deserialize(user, User);\n *\n * return [user];\n * }\n * }\n * ```\n * > The user instance will be forwarded to the next middleware and to your decorated method.\n *\n * Then:\n *\n * ```typescript\n * import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from \"@tsed/socketio\";\n * import {UserConverterSocketMiddleware} from \"../middlewares\";\n * import {User} from \"../models/User\";\n *\n * @SocketService(\"/my-namespace\")\n * @SocketUseBefore(UserConverterSocketMiddleware) // global version\n * export class MySocketService {\n *\n * @Input(\"eventName\")\n * @Emit(\"responseEventName\") // or Broadcast or BroadcastOthers\n * @SocketUseBefore(UserConverterSocketMiddleware)\n * async myMethod(@Args(0) user: User) {\n *\n * console.log(user);\n *\n * return user;\n * }\n * }\n * ```\n *\n * @returns {Function}\n * @decorator\n * @experimental\n */\nexport function SocketMiddleware(): Function {\n return (target: Type<any>) => {\n Store.from(target).merge(\"socketIO\", {\n type: SocketProviderTypes.MIDDLEWARE,\n handlers: {\n use: {\n methodClassName: \"use\"\n }\n }\n });\n\n return Middleware()(target);\n };\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Middleware } from "@tsed/platform-middlewares";
|
|
2
|
+
import { Store } from "@tsed/core";
|
|
3
|
+
import { SocketProviderTypes } from "../interfaces/SocketProviderTypes.js";
|
|
4
|
+
/**
|
|
5
|
+
* Declare a new SocketMiddlewareError.
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
*
|
|
9
|
+
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
10
|
+
*
|
|
11
|
+
* Here an example of a middleware:
|
|
12
|
+
*
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import {SocketMiddlewareError, SocketErr, Socket, Args} from "@tsed/socketio";
|
|
15
|
+
*
|
|
16
|
+
* @SocketMiddlewareError()
|
|
17
|
+
* export class ErrorHandlerSocketMiddleware {
|
|
18
|
+
* async use(@SocketEventName, @SocketErr err: any, @Socket socket: SocketIO.Socket) {
|
|
19
|
+
* console.error(err);
|
|
20
|
+
* socket.emit("error", {message: "An error has occured"})
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Then:
|
|
26
|
+
*
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
29
|
+
* import {ErrorHandlerSocketMiddleware} from "../middlewares";
|
|
30
|
+
* import {User} from "../models/User";
|
|
31
|
+
*
|
|
32
|
+
* @SocketService("/my-namespace")
|
|
33
|
+
* @SocketUseAfter(ErrorHandlerSocketMiddleware) // global version
|
|
34
|
+
* export class MySocketService {
|
|
35
|
+
*
|
|
36
|
+
* @Input("eventName")
|
|
37
|
+
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
38
|
+
* @SocketUseAfter(ErrorHandlerSocketMiddleware)
|
|
39
|
+
* async myMethod(@Args(0) userName: User) {
|
|
40
|
+
*
|
|
41
|
+
* console.log(user);
|
|
42
|
+
* throw new Error("Error");
|
|
43
|
+
*
|
|
44
|
+
* return user;
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @returns {Function}
|
|
50
|
+
* @decorator
|
|
51
|
+
* @experimental
|
|
52
|
+
*/
|
|
53
|
+
export function SocketMiddlewareError() {
|
|
54
|
+
return (target) => {
|
|
55
|
+
Store.from(target).merge("socketIO", {
|
|
56
|
+
type: SocketProviderTypes.MIDDLEWARE,
|
|
57
|
+
error: true,
|
|
58
|
+
handlers: {
|
|
59
|
+
use: {
|
|
60
|
+
methodClassName: "use"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return Middleware()(target);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=socketMiddlewareError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketMiddlewareError.js","sourceRoot":"","sources":["../../../src/decorators/socketMiddlewareError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,CAAC,MAAiB,EAAE,EAAE;QAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,IAAI,EAAE,mBAAmB,CAAC,UAAU;YACpC,KAAK,EAAE,IAAI;YAEX,QAAQ,EAAE;gBACR,GAAG,EAAE;oBACH,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CAAC;QAEH,OAAO,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Middleware} from \"@tsed/platform-middlewares\";\nimport {Store, Type} from \"@tsed/core\";\nimport {SocketProviderTypes} from \"../interfaces/SocketProviderTypes\";\n\n/**\n * Declare a new SocketMiddlewareError.\n *\n * ### Example\n *\n * A middleware can be also used on a `SocketService` either on a class or on a method.\n *\n * Here an example of a middleware:\n *\n * ```typescript\n * import {SocketMiddlewareError, SocketErr, Socket, Args} from \"@tsed/socketio\";\n *\n * @SocketMiddlewareError()\n * export class ErrorHandlerSocketMiddleware {\n * async use(@SocketEventName, @SocketErr err: any, @Socket socket: SocketIO.Socket) {\n * console.error(err);\n * socket.emit(\"error\", {message: \"An error has occured\"})\n * }\n * }\n * ```\n *\n * Then:\n *\n * ```typescript\n * import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from \"@tsed/socketio\";\n * import {ErrorHandlerSocketMiddleware} from \"../middlewares\";\n * import {User} from \"../models/User\";\n *\n * @SocketService(\"/my-namespace\")\n * @SocketUseAfter(ErrorHandlerSocketMiddleware) // global version\n * export class MySocketService {\n *\n * @Input(\"eventName\")\n * @Emit(\"responseEventName\") // or Broadcast or BroadcastOthers\n * @SocketUseAfter(ErrorHandlerSocketMiddleware)\n * async myMethod(@Args(0) userName: User) {\n *\n * console.log(user);\n * throw new Error(\"Error\");\n *\n * return user;\n * }\n * }\n * ```\n *\n * @returns {Function}\n * @decorator\n * @experimental\n */\nexport function SocketMiddlewareError(): Function {\n return (target: Type<any>) => {\n Store.from(target).merge(\"socketIO\", {\n type: SocketProviderTypes.MIDDLEWARE,\n error: true,\n\n handlers: {\n use: {\n methodClassName: \"use\"\n }\n }\n });\n\n return Middleware()(target);\n };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Store } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {string} eventName
|
|
5
|
+
* @param {SocketReturnsTypes} type
|
|
6
|
+
* @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => void}
|
|
7
|
+
* @decorator
|
|
8
|
+
*/
|
|
9
|
+
export function SocketReturns(eventName, type) {
|
|
10
|
+
return (target, propertyKey, descriptor) => {
|
|
11
|
+
Store.from(target).merge("socketIO", {
|
|
12
|
+
handlers: {
|
|
13
|
+
[propertyKey]: {
|
|
14
|
+
returns: {
|
|
15
|
+
eventName,
|
|
16
|
+
type
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=socketReturns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketReturns.js","sourceRoot":"","sources":["../../../src/decorators/socketReturns.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAGjC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB,EAAE,IAAwB;IACvE,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,QAAQ,EAAE;gBACR,CAAC,WAAW,CAAC,EAAE;oBACb,OAAO,EAAE;wBACP,SAAS;wBACT,IAAI;qBACL;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Store} from \"@tsed/core\";\nimport {SocketReturnsTypes} from \"../interfaces/SocketReturnsTypes\";\n\n/**\n *\n * @param {string} eventName\n * @param {SocketReturnsTypes} type\n * @returns {(target: any, propertyKey: string, descriptor: PropertyDescriptor) => void}\n * @decorator\n */\nexport function SocketReturns(eventName: string, type: SocketReturnsTypes) {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n Store.from(target).merge(\"socketIO\", {\n handlers: {\n [propertyKey]: {\n returns: {\n eventName,\n type\n }\n }\n }\n });\n };\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StoreMerge, useDecorators } from "@tsed/core";
|
|
2
|
+
import { Injectable } from "@tsed/di";
|
|
3
|
+
import { SocketProviderTypes } from "../interfaces/SocketProviderTypes.js";
|
|
4
|
+
import { PROVIDER_TYPE_SOCKET_SERVICE } from "../constants/constants.js";
|
|
5
|
+
/**
|
|
6
|
+
* The decorators `@SocketService()` declare a new socket service (and service) can be injected in other service or controller on there `constructor`.
|
|
7
|
+
* All services annotated with `@SocketService()` are constructed one time.
|
|
8
|
+
*
|
|
9
|
+
* > `@SocketService()` use the `reflect-metadata` to collect and inject service on controllers or other services.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} namespace
|
|
12
|
+
* @returns {Function}
|
|
13
|
+
* @decorator
|
|
14
|
+
*/
|
|
15
|
+
export function SocketService(namespace = "/") {
|
|
16
|
+
return useDecorators(StoreMerge("socketIO", { namespace, type: SocketProviderTypes.SERVICE }), Injectable({
|
|
17
|
+
type: PROVIDER_TYPE_SOCKET_SERVICE
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=socketService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketService.js","sourceRoot":"","sources":["../../../src/decorators/socketService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAC,4BAA4B,EAAC,MAAM,wBAAwB,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,SAAS,GAAG,GAAG;IAC3C,OAAO,aAAa,CAClB,UAAU,CAAC,UAAU,EAAE,EAAC,SAAS,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,EAAC,CAAC,EACtE,UAAU,CAAC;QACT,IAAI,EAAE,4BAA4B;KACnC,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {StoreMerge, useDecorators} from \"@tsed/core\";\nimport {Injectable} from \"@tsed/di\";\nimport {SocketProviderTypes} from \"../interfaces/SocketProviderTypes\";\nimport {PROVIDER_TYPE_SOCKET_SERVICE} from \"../constants/constants\";\n\n/**\n * The decorators `@SocketService()` declare a new socket service (and service) can be injected in other service or controller on there `constructor`.\n * All services annotated with `@SocketService()` are constructed one time.\n *\n * > `@SocketService()` use the `reflect-metadata` to collect and inject service on controllers or other services.\n *\n * @param {string} namespace\n * @returns {Function}\n * @decorator\n */\nexport function SocketService(namespace = \"/\") {\n return useDecorators(\n StoreMerge(\"socketIO\", {namespace, type: SocketProviderTypes.SERVICE}),\n Injectable({\n type: PROVIDER_TYPE_SOCKET_SERVICE\n })\n );\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SocketFilters } from "../interfaces/SocketFilters.js";
|
|
2
|
+
import { SocketFilter } from "./socketFilter.js";
|
|
3
|
+
/**
|
|
4
|
+
* Inject the Socket instance in the decorated parameter.
|
|
5
|
+
*
|
|
6
|
+
* ### Example
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* @SocketService("/nsp")
|
|
10
|
+
* export class MyWS {
|
|
11
|
+
*
|
|
12
|
+
* @Input("event")
|
|
13
|
+
* myMethod(@SocketSession session: Map) {
|
|
14
|
+
* console.log(session);
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param target
|
|
20
|
+
* @param {string} propertyKey
|
|
21
|
+
* @param {number} index
|
|
22
|
+
* @decorator
|
|
23
|
+
*/
|
|
24
|
+
export function SocketSession(target, propertyKey, index) {
|
|
25
|
+
return SocketFilter(SocketFilters.SESSION)(target, propertyKey, index);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=socketSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketSession.js","sourceRoot":"","sources":["../../../src/decorators/socketSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa;IAC3E,OAAO,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AACzE,CAAC","sourcesContent":["import {SocketFilters} from \"../interfaces/SocketFilters\";\nimport {SocketFilter} from \"./socketFilter\";\n\nexport type SocketSession = Map<string, any>;\n\n/**\n * Inject the Socket instance in the decorated parameter.\n *\n * ### Example\n *\n * ```typescript\n * @SocketService(\"/nsp\")\n * export class MyWS {\n *\n * @Input(\"event\")\n * myMethod(@SocketSession session: Map) {\n * console.log(session);\n * }\n * }\n * ```\n *\n * @param target\n * @param {string} propertyKey\n * @param {number} index\n * @decorator\n */\nexport function SocketSession(target: any, propertyKey: string, index: number): any {\n return SocketFilter(SocketFilters.SESSION)(target, propertyKey, index);\n}\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Store } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
* Attach a Socket Middleware to a method or a class.
|
|
4
|
+
*
|
|
5
|
+
* ### Example
|
|
6
|
+
*
|
|
7
|
+
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
8
|
+
*
|
|
9
|
+
* Here an example of a middleware:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import {SocketMiddlewareError, SocketErr, Socket, Args} from "@tsed/socketio";
|
|
13
|
+
*
|
|
14
|
+
* @SocketMiddlewareError()
|
|
15
|
+
* export class ErrorHandlerSocketMiddleware {
|
|
16
|
+
* async use(@SocketErr() err: any, @Socket socket: SocketIO.Socket) {
|
|
17
|
+
* console.error(err);
|
|
18
|
+
* socket.emit("error", {message: "An error has occured"})
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Then:
|
|
24
|
+
*
|
|
25
|
+
* ```typescript
|
|
26
|
+
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
27
|
+
* import {ErrorHandlerSocketMiddleware} from "../middlewares";
|
|
28
|
+
* import {User} from "../models/User";
|
|
29
|
+
*
|
|
30
|
+
* @SocketService("/my-namespace")
|
|
31
|
+
* @SocketUseAfter(ErrorHandlerSocketMiddleware) // global version
|
|
32
|
+
* export class MySocketService {
|
|
33
|
+
*
|
|
34
|
+
* @Input("eventName")
|
|
35
|
+
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
36
|
+
* @SocketUseAfter(ErrorHandlerSocketMiddleware)
|
|
37
|
+
* async myMethod(@Args(0) userName: User) {
|
|
38
|
+
*
|
|
39
|
+
* console.log(user);
|
|
40
|
+
* throw new Error("Error");
|
|
41
|
+
*
|
|
42
|
+
* return user;
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}
|
|
48
|
+
* @decorator
|
|
49
|
+
* @experimental
|
|
50
|
+
* @param middlewares
|
|
51
|
+
*/
|
|
52
|
+
export function SocketUseAfter(...middlewares) {
|
|
53
|
+
return (target, propertyKey, descriptor) => {
|
|
54
|
+
if (propertyKey) {
|
|
55
|
+
Store.from(target).merge("socketIO", {
|
|
56
|
+
handlers: {
|
|
57
|
+
[propertyKey]: {
|
|
58
|
+
useAfter: middlewares
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
Store.from(target).merge("socketIO", {
|
|
65
|
+
useAfter: middlewares
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=socketUseAfter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketUseAfter.js","sourceRoot":"","sources":["../../../src/decorators/socketUseAfter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,MAAM,UAAU,cAAc,CAAC,GAAG,WAAwB;IACxD,OAAO,CAAC,MAAW,EAAE,WAAoB,EAAE,UAA+B,EAAE,EAAE;QAC5E,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,QAAQ,EAAE;oBACR,CAAC,WAAW,CAAC,EAAE;wBACb,QAAQ,EAAE,WAAW;qBACtB;iBACF;aACF,CAAC,CAAC;SACJ;aAAM;YACL,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,QAAQ,EAAE,WAAW;aACtB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Store, Type} from \"@tsed/core\";\n\n/**\n * Attach a Socket Middleware to a method or a class.\n *\n * ### Example\n *\n * A middleware can be also used on a `SocketService` either on a class or on a method.\n *\n * Here an example of a middleware:\n *\n * ```typescript\n * import {SocketMiddlewareError, SocketErr, Socket, Args} from \"@tsed/socketio\";\n *\n * @SocketMiddlewareError()\n * export class ErrorHandlerSocketMiddleware {\n * async use(@SocketErr() err: any, @Socket socket: SocketIO.Socket) {\n * console.error(err);\n * socket.emit(\"error\", {message: \"An error has occured\"})\n * }\n * }\n * ```\n *\n * Then:\n *\n * ```typescript\n * import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from \"@tsed/socketio\";\n * import {ErrorHandlerSocketMiddleware} from \"../middlewares\";\n * import {User} from \"../models/User\";\n *\n * @SocketService(\"/my-namespace\")\n * @SocketUseAfter(ErrorHandlerSocketMiddleware) // global version\n * export class MySocketService {\n *\n * @Input(\"eventName\")\n * @Emit(\"responseEventName\") // or Broadcast or BroadcastOthers\n * @SocketUseAfter(ErrorHandlerSocketMiddleware)\n * async myMethod(@Args(0) userName: User) {\n *\n * console.log(user);\n * throw new Error(\"Error\");\n *\n * return user;\n * }\n * }\n * ```\n *\n * @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}\n * @decorator\n * @experimental\n * @param middlewares\n */\nexport function SocketUseAfter(...middlewares: Type<any>[]) {\n return (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => {\n if (propertyKey) {\n Store.from(target).merge(\"socketIO\", {\n handlers: {\n [propertyKey]: {\n useAfter: middlewares\n }\n }\n });\n } else {\n Store.from(target).merge(\"socketIO\", {\n useAfter: middlewares\n });\n }\n };\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Store } from "@tsed/core";
|
|
2
|
+
/**
|
|
3
|
+
* Attach a Socket Middleware to a method or a class.
|
|
4
|
+
*
|
|
5
|
+
* ### Example
|
|
6
|
+
*
|
|
7
|
+
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
8
|
+
*
|
|
9
|
+
* Here an example of a middleware:
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* @SocketMiddleware()
|
|
13
|
+
* export class UserConverterSocketMiddleware {
|
|
14
|
+
* constructor(private converterService: ConverterService) {
|
|
15
|
+
* }
|
|
16
|
+
* async use(@Args() args: any[]) {
|
|
17
|
+
*
|
|
18
|
+
* let [user] = args;
|
|
19
|
+
* // update Arguments
|
|
20
|
+
* user = ConverterService.deserialize(user, User);
|
|
21
|
+
*
|
|
22
|
+
* return [user];
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
* > The user instance will be forwarded to the next middleware and to your decorated method.
|
|
27
|
+
*
|
|
28
|
+
* Then:
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
32
|
+
* import {UserConverterSocketMiddleware} from "../middlewares";
|
|
33
|
+
* import {User} from "../models/User";
|
|
34
|
+
*
|
|
35
|
+
* @SocketService("/my-namespace")
|
|
36
|
+
* @SocketUseBefore(UserConverterSocketMiddleware) // global version
|
|
37
|
+
* export class MySocketService {
|
|
38
|
+
*
|
|
39
|
+
* @Input("eventName")
|
|
40
|
+
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
41
|
+
* @SocketUseBefore(UserConverterSocketMiddleware)
|
|
42
|
+
* async myMethod(@Args(0) user: User) {
|
|
43
|
+
*
|
|
44
|
+
* console.log(user);
|
|
45
|
+
*
|
|
46
|
+
* return user;
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}
|
|
52
|
+
* @decorator
|
|
53
|
+
* @experimental
|
|
54
|
+
* @param middlewares
|
|
55
|
+
*/
|
|
56
|
+
export function SocketUseBefore(...middlewares) {
|
|
57
|
+
return (target, propertyKey, descriptor) => {
|
|
58
|
+
if (propertyKey) {
|
|
59
|
+
Store.from(target).merge("socketIO", {
|
|
60
|
+
handlers: {
|
|
61
|
+
[propertyKey]: {
|
|
62
|
+
useBefore: middlewares
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
Store.from(target).merge("socketIO", {
|
|
69
|
+
useBefore: middlewares
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=socketUseBefore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketUseBefore.js","sourceRoot":"","sources":["../../../src/decorators/socketUseBefore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAO,MAAM,YAAY,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,UAAU,eAAe,CAAC,GAAG,WAAwB;IACzD,OAAO,CAAC,MAAW,EAAE,WAAoB,EAAE,UAA+B,EAAE,EAAE;QAC5E,IAAI,WAAW,EAAE;YACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,QAAQ,EAAE;oBACR,CAAC,WAAW,CAAC,EAAE;wBACb,SAAS,EAAE,WAAW;qBACvB;iBACF;aACF,CAAC,CAAC;SACJ;aAAM;YACL,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,SAAS,EAAE,WAAW;aACvB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {Store, Type} from \"@tsed/core\";\n\n/**\n * Attach a Socket Middleware to a method or a class.\n *\n * ### Example\n *\n * A middleware can be also used on a `SocketService` either on a class or on a method.\n *\n * Here an example of a middleware:\n *\n * ```typescript\n * @SocketMiddleware()\n * export class UserConverterSocketMiddleware {\n * constructor(private converterService: ConverterService) {\n * }\n * async use(@Args() args: any[]) {\n *\n * let [user] = args;\n * // update Arguments\n * user = ConverterService.deserialize(user, User);\n *\n * return [user];\n * }\n * }\n * ```\n * > The user instance will be forwarded to the next middleware and to your decorated method.\n *\n * Then:\n *\n * ```typescript\n * import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from \"@tsed/socketio\";\n * import {UserConverterSocketMiddleware} from \"../middlewares\";\n * import {User} from \"../models/User\";\n *\n * @SocketService(\"/my-namespace\")\n * @SocketUseBefore(UserConverterSocketMiddleware) // global version\n * export class MySocketService {\n *\n * @Input(\"eventName\")\n * @Emit(\"responseEventName\") // or Broadcast or BroadcastOthers\n * @SocketUseBefore(UserConverterSocketMiddleware)\n * async myMethod(@Args(0) user: User) {\n *\n * console.log(user);\n *\n * return user;\n * }\n * }\n * ```\n *\n * @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}\n * @decorator\n * @experimental\n * @param middlewares\n */\nexport function SocketUseBefore(...middlewares: Type<any>[]) {\n return (target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => {\n if (propertyKey) {\n Store.from(target).merge(\"socketIO\", {\n handlers: {\n [propertyKey]: {\n useBefore: middlewares\n }\n }\n });\n } else {\n Store.from(target).merge(\"socketIO\", {\n useBefore: middlewares\n });\n }\n };\n}\n"]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./SocketIOModule.js";
|
|
5
|
+
export * from "./class/SocketHandlersBuilder.js";
|
|
6
|
+
export * from "./class/SocketProviderMetadata.js";
|
|
7
|
+
export * from "./constants/constants.js";
|
|
8
|
+
export * from "./decorators/args.js";
|
|
9
|
+
export * from "./decorators/broadcast.js";
|
|
10
|
+
export * from "./decorators/broadcastOthers.js";
|
|
11
|
+
export * from "./decorators/emit.js";
|
|
12
|
+
export * from "./decorators/input.js";
|
|
13
|
+
export * from "./decorators/inputAndBroadcast.js";
|
|
14
|
+
export * from "./decorators/inputAndBroadcastOthers.js";
|
|
15
|
+
export * from "./decorators/inputAndEmit.js";
|
|
16
|
+
export * from "./decorators/io.js";
|
|
17
|
+
export * from "./decorators/nsp.js";
|
|
18
|
+
export * from "./decorators/socket.js";
|
|
19
|
+
export * from "./decorators/socketErr.js";
|
|
20
|
+
export * from "./decorators/socketEventName.js";
|
|
21
|
+
export * from "./decorators/socketFilter.js";
|
|
22
|
+
export * from "./decorators/socketMiddleware.js";
|
|
23
|
+
export * from "./decorators/socketMiddlewareError.js";
|
|
24
|
+
export * from "./decorators/socketReturns.js";
|
|
25
|
+
export * from "./decorators/socketService.js";
|
|
26
|
+
export * from "./decorators/socketSession.js";
|
|
27
|
+
export * from "./decorators/socketUseAfter.js";
|
|
28
|
+
export * from "./decorators/socketUseBefore.js";
|
|
29
|
+
export * from "./interfaces/OnNamespaceInit.js";
|
|
30
|
+
export * from "./interfaces/SocketFilters.js";
|
|
31
|
+
export * from "./interfaces/SocketHandlerMetadata.js";
|
|
32
|
+
export * from "./interfaces/SocketInjectableNsp.js";
|
|
33
|
+
export * from "./interfaces/SocketParamMetadata.js";
|
|
34
|
+
export * from "./interfaces/SocketProviderTypes.js";
|
|
35
|
+
export * from "./interfaces/SocketReturnsTypes.js";
|
|
36
|
+
export * from "./interfaces/interfaces.js";
|
|
37
|
+
export * from "./registries/NspSessionRegistry.js";
|
|
38
|
+
export * from "./services/SocketIOServer.js";
|
|
39
|
+
export * from "./services/SocketIOService.js";
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./SocketIOModule\";\nexport * from \"./class/SocketHandlersBuilder\";\nexport * from \"./class/SocketProviderMetadata\";\nexport * from \"./constants/constants\";\nexport * from \"./decorators/args\";\nexport * from \"./decorators/broadcast\";\nexport * from \"./decorators/broadcastOthers\";\nexport * from \"./decorators/emit\";\nexport * from \"./decorators/input\";\nexport * from \"./decorators/inputAndBroadcast\";\nexport * from \"./decorators/inputAndBroadcastOthers\";\nexport * from \"./decorators/inputAndEmit\";\nexport * from \"./decorators/io\";\nexport * from \"./decorators/nsp\";\nexport * from \"./decorators/socket\";\nexport * from \"./decorators/socketErr\";\nexport * from \"./decorators/socketEventName\";\nexport * from \"./decorators/socketFilter\";\nexport * from \"./decorators/socketMiddleware\";\nexport * from \"./decorators/socketMiddlewareError\";\nexport * from \"./decorators/socketReturns\";\nexport * from \"./decorators/socketService\";\nexport * from \"./decorators/socketSession\";\nexport * from \"./decorators/socketUseAfter\";\nexport * from \"./decorators/socketUseBefore\";\nexport * from \"./interfaces/OnNamespaceInit\";\nexport * from \"./interfaces/SocketFilters\";\nexport * from \"./interfaces/SocketHandlerMetadata\";\nexport * from \"./interfaces/SocketInjectableNsp\";\nexport * from \"./interfaces/SocketParamMetadata\";\nexport * from \"./interfaces/SocketProviderTypes\";\nexport * from \"./interfaces/SocketReturnsTypes\";\nexport * from \"./interfaces/interfaces\";\nexport * from \"./registries/NspSessionRegistry\";\nexport * from \"./services/SocketIOServer\";\nexport * from \"./services/SocketIOService\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnNamespaceInit.js","sourceRoot":"","sources":["../../../src/interfaces/OnNamespaceInit.ts"],"names":[],"mappings":"","sourcesContent":["import {Namespace} from \"socket.io\";\n\n/**\n *\n */\nexport interface OnNamespaceInit {\n $onNamespaceInit(nsp: Namespace): void;\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignore
|
|
3
|
+
*/
|
|
4
|
+
export var SocketFilters;
|
|
5
|
+
(function (SocketFilters) {
|
|
6
|
+
SocketFilters["ARGS"] = "args";
|
|
7
|
+
SocketFilters["SOCKET"] = "socket";
|
|
8
|
+
SocketFilters["EVENT_NAME"] = "eventName";
|
|
9
|
+
SocketFilters["NSP"] = "nsp";
|
|
10
|
+
SocketFilters["SESSION"] = "session";
|
|
11
|
+
SocketFilters["ERR"] = "error";
|
|
12
|
+
})(SocketFilters || (SocketFilters = {}));
|
|
13
|
+
//# sourceMappingURL=SocketFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketFilters.js","sourceRoot":"","sources":["../../../src/interfaces/SocketFilters.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,kCAAiB,CAAA;IACjB,yCAAwB,CAAA;IACxB,4BAAW,CAAA;IACX,oCAAmB,CAAA;IACnB,8BAAa,CAAA;AACf,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB","sourcesContent":["/**\n * @ignore\n */\nexport enum SocketFilters {\n ARGS = \"args\",\n SOCKET = \"socket\",\n EVENT_NAME = \"eventName\",\n NSP = \"nsp\",\n SESSION = \"session\",\n ERR = \"error\"\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketHandlerMetadata.js","sourceRoot":"","sources":["../../../src/interfaces/SocketHandlerMetadata.ts"],"names":[],"mappings":"","sourcesContent":["import {SocketParamMetadata} from \"./SocketParamMetadata\";\nimport {SocketReturnsTypes} from \"./SocketReturnsTypes\";\n\n/**\n *\n */\nexport interface SocketHandlerMetadata {\n eventName?: string;\n methodClassName: string;\n useBefore?: any[];\n useAfter?: any[];\n parameters?: {[key: number]: SocketParamMetadata};\n returns?: {\n type: SocketReturnsTypes;\n eventName: string;\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketInjectableNsp.js","sourceRoot":"","sources":["../../../src/interfaces/SocketInjectableNsp.ts"],"names":[],"mappings":"","sourcesContent":["export interface SocketInjectableNsp {\n propertyKey: string;\n nsp?: string;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketParamMetadata.js","sourceRoot":"","sources":["../../../src/interfaces/SocketParamMetadata.ts"],"names":[],"mappings":"","sourcesContent":["import {MetadataTypes} from \"@tsed/core\";\nimport {SocketFilters} from \"./SocketFilters\";\n\nexport interface SocketParamMetadata extends Partial<MetadataTypes> {\n filter: SocketFilters;\n mapIndex?: number;\n useConverter?: boolean;\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
4
|
+
export var SocketProviderTypes;
|
|
5
|
+
(function (SocketProviderTypes) {
|
|
6
|
+
SocketProviderTypes["SERVICE"] = "service";
|
|
7
|
+
SocketProviderTypes["MIDDLEWARE"] = "middleware";
|
|
8
|
+
})(SocketProviderTypes || (SocketProviderTypes = {}));
|
|
9
|
+
//# sourceMappingURL=SocketProviderTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketProviderTypes.js","sourceRoot":"","sources":["../../../src/interfaces/SocketProviderTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;AAC3B,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B","sourcesContent":["/**\n *\n */\nexport enum SocketProviderTypes {\n SERVICE = \"service\",\n MIDDLEWARE = \"middleware\"\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ignore
|
|
3
|
+
*/
|
|
4
|
+
export var SocketReturnsTypes;
|
|
5
|
+
(function (SocketReturnsTypes) {
|
|
6
|
+
SocketReturnsTypes["BROADCAST"] = "broadcast";
|
|
7
|
+
SocketReturnsTypes["BROADCAST_OTHERS"] = "broadcastOthers";
|
|
8
|
+
SocketReturnsTypes["EMIT"] = "emit";
|
|
9
|
+
})(SocketReturnsTypes || (SocketReturnsTypes = {}));
|
|
10
|
+
//# sourceMappingURL=SocketReturnsTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketReturnsTypes.js","sourceRoot":"","sources":["../../../src/interfaces/SocketReturnsTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,0DAAoC,CAAA;IACpC,mCAAa,CAAA;AACf,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["/**\n * @ignore\n */\nexport enum SocketReturnsTypes {\n BROADCAST = \"broadcast\",\n BROADCAST_OTHERS = \"broadcastOthers\",\n EMIT = \"emit\"\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import SocketIO from \"socket.io\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n socketIO: Partial<SocketIO.ServerOptions>;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @type {Map<any, any>}
|
|
4
|
+
*/
|
|
5
|
+
const SESSIONS = new Map();
|
|
6
|
+
export function getNspSession(namespace = "/") {
|
|
7
|
+
if (!SESSIONS.has(namespace)) {
|
|
8
|
+
SESSIONS.set(namespace, new Map());
|
|
9
|
+
}
|
|
10
|
+
return SESSIONS.get(namespace);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=NspSessionRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NspSessionRegistry.js","sourceRoot":"","sources":["../../../src/registries/NspSessionRegistry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,QAAQ,GAAkC,IAAI,GAAG,EAAE,CAAC;AAE1D,MAAM,UAAU,aAAa,CAAC,YAAoB,GAAG;IACnD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAC5B,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;KACpC;IAED,OAAO,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["/**\n *\n * @type {Map<any, any>}\n */\nconst SESSIONS: Map<string, Map<string, any>> = new Map();\n\nexport function getNspSession(namespace: string = \"/\") {\n if (!SESSIONS.has(namespace)) {\n SESSIONS.set(namespace, new Map());\n }\n\n return SESSIONS.get(namespace);\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { registerProvider } from "@tsed/di";
|
|
2
|
+
import { Server } from "socket.io";
|
|
3
|
+
// tslint:disable-next-line: variable-name
|
|
4
|
+
export const SocketIOServer = Server;
|
|
5
|
+
export { Server };
|
|
6
|
+
registerProvider({
|
|
7
|
+
provide: Server,
|
|
8
|
+
useFactory() {
|
|
9
|
+
return new Server();
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=SocketIOServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketIOServer.js","sourceRoot":"","sources":["../../../src/services/SocketIOServer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAIjC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,OAAO,EAAC,MAAM,EAAC,CAAC;AAEhB,gBAAgB,CAAC;IACf,OAAO,EAAE,MAAM;IACf,UAAU;QACR,OAAO,IAAI,MAAM,EAAE,CAAC;IACtB,CAAC;CACF,CAAC,CAAC","sourcesContent":["import {registerProvider} from \"@tsed/di\";\nimport {Server} from \"socket.io\";\n\nexport type SocketIOServer = Server;\n\n// tslint:disable-next-line: variable-name\nexport const SocketIOServer = Server;\n\nexport {Server};\n\nregisterProvider({\n provide: Server,\n useFactory() {\n return new Server();\n }\n});\n"]}
|