@tsed/socketio 8.0.0-alpha.4 → 8.0.0-alpha.6
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/lib/types/SocketIOModule.d.ts +2 -2
- package/package.json +17 -18
- package/.nycrc +0 -27
- package/lib/cjs/SocketIOModule.js +0 -111
- package/lib/cjs/SocketIOModule.js.map +0 -1
- package/lib/cjs/class/SocketHandlersBuilder.js +0 -218
- package/lib/cjs/class/SocketHandlersBuilder.js.map +0 -1
- package/lib/cjs/class/SocketProviderMetadata.js +0 -48
- package/lib/cjs/class/SocketProviderMetadata.js.map +0 -1
- package/lib/cjs/class/SocketSessionData.js +0 -73
- package/lib/cjs/class/SocketSessionData.js.map +0 -1
- package/lib/cjs/constants/constants.js +0 -5
- package/lib/cjs/constants/constants.js.map +0 -1
- package/lib/cjs/decorators/args.js +0 -61
- package/lib/cjs/decorators/args.js.map +0 -1
- package/lib/cjs/decorators/broadcast.js +0 -32
- package/lib/cjs/decorators/broadcast.js.map +0 -1
- package/lib/cjs/decorators/broadcastOthers.js +0 -32
- package/lib/cjs/decorators/broadcastOthers.js.map +0 -1
- package/lib/cjs/decorators/emit.js +0 -32
- package/lib/cjs/decorators/emit.js.map +0 -1
- package/lib/cjs/decorators/input.js +0 -37
- package/lib/cjs/decorators/input.js.map +0 -1
- package/lib/cjs/decorators/inputAndBroadcast.js +0 -32
- package/lib/cjs/decorators/inputAndBroadcast.js.map +0 -1
- package/lib/cjs/decorators/inputAndBroadcastOthers.js +0 -32
- package/lib/cjs/decorators/inputAndBroadcastOthers.js.map +0 -1
- package/lib/cjs/decorators/inputAndEmit.js +0 -32
- package/lib/cjs/decorators/inputAndEmit.js.map +0 -1
- package/lib/cjs/decorators/io.js +0 -13
- package/lib/cjs/decorators/io.js.map +0 -1
- package/lib/cjs/decorators/nsp.js +0 -96
- package/lib/cjs/decorators/nsp.js.map +0 -1
- package/lib/cjs/decorators/reason.js +0 -34
- package/lib/cjs/decorators/reason.js.map +0 -1
- package/lib/cjs/decorators/socket.js +0 -32
- package/lib/cjs/decorators/socket.js.map +0 -1
- package/lib/cjs/decorators/socketErr.js +0 -30
- package/lib/cjs/decorators/socketErr.js.map +0 -1
- package/lib/cjs/decorators/socketEventName.js +0 -30
- package/lib/cjs/decorators/socketEventName.js.map +0 -1
- package/lib/cjs/decorators/socketFilter.js +0 -29
- package/lib/cjs/decorators/socketFilter.js.map +0 -1
- package/lib/cjs/decorators/socketMiddleware.js +0 -74
- package/lib/cjs/decorators/socketMiddleware.js.map +0 -1
- package/lib/cjs/decorators/socketMiddlewareError.js +0 -71
- package/lib/cjs/decorators/socketMiddlewareError.js.map +0 -1
- package/lib/cjs/decorators/socketNsp.js +0 -33
- package/lib/cjs/decorators/socketNsp.js.map +0 -1
- package/lib/cjs/decorators/socketReturns.js +0 -27
- package/lib/cjs/decorators/socketReturns.js.map +0 -1
- package/lib/cjs/decorators/socketService.js +0 -24
- package/lib/cjs/decorators/socketService.js.map +0 -1
- package/lib/cjs/decorators/socketSession.js +0 -55
- package/lib/cjs/decorators/socketSession.js.map +0 -1
- package/lib/cjs/decorators/socketUseAfter.js +0 -74
- package/lib/cjs/decorators/socketUseAfter.js.map +0 -1
- package/lib/cjs/decorators/socketUseBefore.js +0 -78
- package/lib/cjs/decorators/socketUseBefore.js.map +0 -1
- package/lib/cjs/index.js +0 -45
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/OnNamespaceInit.js +0 -3
- package/lib/cjs/interfaces/OnNamespaceInit.js.map +0 -1
- package/lib/cjs/interfaces/SocketFilters.js +0 -19
- package/lib/cjs/interfaces/SocketFilters.js.map +0 -1
- package/lib/cjs/interfaces/SocketHandlerMetadata.js +0 -3
- package/lib/cjs/interfaces/SocketHandlerMetadata.js.map +0 -1
- package/lib/cjs/interfaces/SocketInjectableNsp.js +0 -3
- package/lib/cjs/interfaces/SocketInjectableNsp.js.map +0 -1
- package/lib/cjs/interfaces/SocketParamMetadata.js +0 -3
- package/lib/cjs/interfaces/SocketParamMetadata.js.map +0 -1
- package/lib/cjs/interfaces/SocketProviderTypes.js +0 -12
- package/lib/cjs/interfaces/SocketProviderTypes.js.map +0 -1
- package/lib/cjs/interfaces/SocketReturnsTypes.js +0 -13
- package/lib/cjs/interfaces/SocketReturnsTypes.js.map +0 -1
- package/lib/cjs/interfaces/interfaces.js +0 -3
- package/lib/cjs/interfaces/interfaces.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/services/SocketIOServer.js +0 -16
- package/lib/cjs/services/SocketIOServer.js.map +0 -1
- package/lib/cjs/services/SocketIOService.js +0 -66
- package/lib/cjs/services/SocketIOService.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/SocketIOModule.d.ts +0 -29
- package/lib/types-esm/class/SocketHandlersBuilder.d.ts +0 -37
- package/lib/types-esm/class/SocketProviderMetadata.d.ts +0 -20
- package/lib/types-esm/class/SocketSessionData.d.ts +0 -23
- package/lib/types-esm/constants/constants.d.ts +0 -1
- package/lib/types-esm/decorators/args.d.ts +0 -28
- package/lib/types-esm/decorators/broadcast.d.ts +0 -23
- package/lib/types-esm/decorators/broadcastOthers.d.ts +0 -23
- package/lib/types-esm/decorators/emit.d.ts +0 -23
- package/lib/types-esm/decorators/input.d.ts +0 -20
- package/lib/types-esm/decorators/inputAndBroadcast.d.ts +0 -20
- package/lib/types-esm/decorators/inputAndBroadcastOthers.d.ts +0 -20
- package/lib/types-esm/decorators/inputAndEmit.d.ts +0 -20
- package/lib/types-esm/decorators/io.d.ts +0 -20
- package/lib/types-esm/decorators/nsp.d.ts +0 -72
- package/lib/types-esm/decorators/reason.d.ts +0 -25
- package/lib/types-esm/decorators/socket.d.ts +0 -25
- package/lib/types-esm/decorators/socketErr.d.ts +0 -21
- package/lib/types-esm/decorators/socketEventName.d.ts +0 -21
- package/lib/types-esm/decorators/socketFilter.d.ts +0 -9
- package/lib/types-esm/decorators/socketMiddleware.d.ts +0 -54
- package/lib/types-esm/decorators/socketMiddlewareError.d.ts +0 -50
- package/lib/types-esm/decorators/socketNsp.d.ts +0 -26
- package/lib/types-esm/decorators/socketReturns.d.ts +0 -9
- package/lib/types-esm/decorators/socketService.d.ts +0 -11
- package/lib/types-esm/decorators/socketSession.d.ts +0 -44
- package/lib/types-esm/decorators/socketUseAfter.d.ts +0 -52
- package/lib/types-esm/decorators/socketUseBefore.d.ts +0 -56
- package/lib/types-esm/index.d.ts +0 -41
- package/lib/types-esm/interfaces/OnNamespaceInit.d.ts +0 -7
- package/lib/types-esm/interfaces/SocketFilters.d.ts +0 -14
- package/lib/types-esm/interfaces/SocketHandlerMetadata.d.ts +0 -18
- package/lib/types-esm/interfaces/SocketInjectableNsp.d.ts +0 -4
- package/lib/types-esm/interfaces/SocketParamMetadata.d.ts +0 -7
- package/lib/types-esm/interfaces/SocketProviderTypes.d.ts +0 -7
- package/lib/types-esm/interfaces/SocketReturnsTypes.d.ts +0 -8
- package/lib/types-esm/interfaces/interfaces.d.ts +0 -8
- package/lib/types-esm/services/SocketIOServer.d.ts +0 -4
- package/lib/types-esm/services/SocketIOService.d.ts +0 -29
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/decorators/args.ts"],"names":[],"mappings":";;;AAAA,qCAAyD;AACzD,qEAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,IAAI,CAAC,QAAiB,EAAE,OAAa;IACnD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa,EAAE,EAAE;QACzD,MAAM,KAAK,GAAG,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjC,MAAM,IAAI,GAAG,eAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,KAAK,GAAG;YACZ,MAAM,EAAE,gCAAa,CAAC,IAAI;YAC1B,SAAS,EAAE,KAAK;SACjB,CAAC;QAEF,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;gBACnB,QAAQ;gBACR,SAAS,EAAE,IAAI;gBACf,IAAI,EAAE,OAAO,IAAI,IAAI;gBACrB,cAAc,EAAE,IAAA,mBAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;aACtD,CAAC,CAAC;SACJ;QAED,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE;YACtB,QAAQ,EAAE;gBACR,CAAC,WAAW,CAAC,EAAE;oBACb,UAAU,EAAE;wBACV,CAAC,KAAK,CAAC,EAAE,KAAK;qBACf;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AA5BD,oBA4BC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Broadcast = void 0;
|
|
4
|
-
const SocketReturnsTypes_js_1 = require("../interfaces/SocketReturnsTypes.js");
|
|
5
|
-
const socketReturns_js_1 = require("./socketReturns.js");
|
|
6
|
-
/**
|
|
7
|
-
* Broadcast the response for all client registered in the same namespace.
|
|
8
|
-
*
|
|
9
|
-
* With the `@Broadcast` decorator, the method will accept a return type (Promise or not).
|
|
10
|
-
*
|
|
11
|
-
* ### Example
|
|
12
|
-
*
|
|
13
|
-
* ```typescript
|
|
14
|
-
* @SocketService("/nsp")
|
|
15
|
-
* export class MyWS {
|
|
16
|
-
*
|
|
17
|
-
* @Input("event")
|
|
18
|
-
* @Broadcast("returnEvent")
|
|
19
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
20
|
-
* return Promise.resolve({data})
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @decorator
|
|
26
|
-
* @param eventName
|
|
27
|
-
*/
|
|
28
|
-
function Broadcast(eventName) {
|
|
29
|
-
return (0, socketReturns_js_1.SocketReturns)(eventName, SocketReturnsTypes_js_1.SocketReturnsTypes.BROADCAST);
|
|
30
|
-
}
|
|
31
|
-
exports.Broadcast = Broadcast;
|
|
32
|
-
//# sourceMappingURL=broadcast.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/decorators/broadcast.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AACvE,yDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,SAAS,CAAC,SAAiB;IACzC,OAAO,IAAA,gCAAa,EAAC,SAAS,EAAE,0CAAkB,CAAC,SAAS,CAAC,CAAC;AAChE,CAAC;AAFD,8BAEC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BroadcastOthers = void 0;
|
|
4
|
-
const SocketReturnsTypes_js_1 = require("../interfaces/SocketReturnsTypes.js");
|
|
5
|
-
const socketReturns_js_1 = require("./socketReturns.js");
|
|
6
|
-
/**
|
|
7
|
-
* Broadcast the response for all client registered in the same namespace except to the current client.
|
|
8
|
-
*
|
|
9
|
-
* With the `@BroadcastOthers` decorator, the method will accept a return type (Promise or not).
|
|
10
|
-
*
|
|
11
|
-
* ### Example
|
|
12
|
-
*
|
|
13
|
-
* ```typescript
|
|
14
|
-
* @SocketService("/nsp")
|
|
15
|
-
* export class MyWS {
|
|
16
|
-
*
|
|
17
|
-
* @Input("event")
|
|
18
|
-
* @BroadcastOthers("returnEvent")
|
|
19
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
20
|
-
* return Promise.resolve({data})
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @decorator
|
|
26
|
-
* @param eventName
|
|
27
|
-
*/
|
|
28
|
-
function BroadcastOthers(eventName) {
|
|
29
|
-
return (0, socketReturns_js_1.SocketReturns)(eventName, SocketReturnsTypes_js_1.SocketReturnsTypes.BROADCAST_OTHERS);
|
|
30
|
-
}
|
|
31
|
-
exports.BroadcastOthers = BroadcastOthers;
|
|
32
|
-
//# sourceMappingURL=broadcastOthers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broadcastOthers.js","sourceRoot":"","sources":["../../../src/decorators/broadcastOthers.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AACvE,yDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,eAAe,CAAC,SAAiB;IAC/C,OAAO,IAAA,gCAAa,EAAC,SAAS,EAAE,0CAAkB,CAAC,gBAAgB,CAAC,CAAC;AACvE,CAAC;AAFD,0CAEC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Emit = void 0;
|
|
4
|
-
const SocketReturnsTypes_js_1 = require("../interfaces/SocketReturnsTypes.js");
|
|
5
|
-
const socketReturns_js_1 = require("./socketReturns.js");
|
|
6
|
-
/**
|
|
7
|
-
* Emit the response to the client.
|
|
8
|
-
*
|
|
9
|
-
* With the `@Emit` decorator, the method will accept a return type (Promise or not).
|
|
10
|
-
*
|
|
11
|
-
* ### Example
|
|
12
|
-
*
|
|
13
|
-
* ```typescript
|
|
14
|
-
* @SocketService("/nsp")
|
|
15
|
-
* export class MyWS {
|
|
16
|
-
*
|
|
17
|
-
* @Input("event")
|
|
18
|
-
* @Emit("returnEvent")
|
|
19
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
20
|
-
* return Promise.resolve({data})
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @decorator
|
|
26
|
-
* @param eventName
|
|
27
|
-
*/
|
|
28
|
-
function Emit(eventName) {
|
|
29
|
-
return (0, socketReturns_js_1.SocketReturns)(eventName, SocketReturnsTypes_js_1.SocketReturnsTypes.EMIT);
|
|
30
|
-
}
|
|
31
|
-
exports.Emit = Emit;
|
|
32
|
-
//# sourceMappingURL=emit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emit.js","sourceRoot":"","sources":["../../../src/decorators/emit.ts"],"names":[],"mappings":";;;AAAA,+EAAuE;AACvE,yDAAiD;AAEjD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,IAAI,CAAC,SAAiB;IACpC,OAAO,IAAA,gCAAa,EAAC,SAAS,EAAE,0CAAkB,CAAC,IAAI,CAAC,CAAC;AAC3D,CAAC;AAFD,oBAEC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Input = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
* Attach the decorated method to the socket event.
|
|
7
|
-
*
|
|
8
|
-
* ### Example
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @SocketService("/nsp")
|
|
12
|
-
* export class MyWS {
|
|
13
|
-
*
|
|
14
|
-
* @Input("event")
|
|
15
|
-
* myMethod(@Args(0) data: any, @Nsp socket) {
|
|
16
|
-
*
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @decorator
|
|
22
|
-
* @param eventName
|
|
23
|
-
*/
|
|
24
|
-
function Input(eventName) {
|
|
25
|
-
return (target, propertyKey, descriptor) => {
|
|
26
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
27
|
-
handlers: {
|
|
28
|
-
[propertyKey]: {
|
|
29
|
-
eventName,
|
|
30
|
-
methodClassName: propertyKey
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
exports.Input = Input;
|
|
37
|
-
//# sourceMappingURL=input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/decorators/input.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,KAAK,CAAC,SAAiB;IACrC,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,QAAQ,EAAE;gBACR,CAAC,WAAW,CAAC,EAAE;oBACb,SAAS;oBACT,eAAe,EAAE,WAAW;iBAC7B;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAXD,sBAWC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InputAndBroadcast = void 0;
|
|
4
|
-
const broadcast_js_1 = require("./broadcast.js");
|
|
5
|
-
const input_js_1 = require("./input.js");
|
|
6
|
-
/**
|
|
7
|
-
* Attach the decorated method to the socket event and broadcast the response to all clients.
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketService("/nsp")
|
|
13
|
-
* export class MyWS {
|
|
14
|
-
*
|
|
15
|
-
* @InputAndBroadcast("event")
|
|
16
|
-
* async myMethod(@Args(0) data: any, @Nsp socket) {
|
|
17
|
-
* return {data: "data"};
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @decorator
|
|
23
|
-
* @param eventName
|
|
24
|
-
*/
|
|
25
|
-
function InputAndBroadcast(eventName) {
|
|
26
|
-
return (target, propertyKey, descriptor) => {
|
|
27
|
-
(0, input_js_1.Input)(eventName)(target, propertyKey, descriptor);
|
|
28
|
-
(0, broadcast_js_1.Broadcast)(eventName)(target, propertyKey, descriptor);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.InputAndBroadcast = InputAndBroadcast;
|
|
32
|
-
//# sourceMappingURL=inputAndBroadcast.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputAndBroadcast.js","sourceRoot":"","sources":["../../../src/decorators/inputAndBroadcast.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,yCAAiC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,iBAAiB,CAAC,SAAiB;IACjD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAClD,IAAA,wBAAS,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AALD,8CAKC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InputAndBroadcastOthers = void 0;
|
|
4
|
-
const broadcastOthers_js_1 = require("./broadcastOthers.js");
|
|
5
|
-
const input_js_1 = require("./input.js");
|
|
6
|
-
/**
|
|
7
|
-
* Attach the decorated method to the socket event and broadcast the response to all clients with the exception of the connected customer.
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketService("/nsp")
|
|
13
|
-
* export class MyWS {
|
|
14
|
-
*
|
|
15
|
-
* @InputAndBroadcastOthers("event")
|
|
16
|
-
* async myMethod(@Args(0) data: any, @Nsp socket) {
|
|
17
|
-
* return {data: "data"};
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @decorator
|
|
23
|
-
* @param eventName
|
|
24
|
-
*/
|
|
25
|
-
function InputAndBroadcastOthers(eventName) {
|
|
26
|
-
return (target, propertyKey, descriptor) => {
|
|
27
|
-
(0, input_js_1.Input)(eventName)(target, propertyKey, descriptor);
|
|
28
|
-
(0, broadcastOthers_js_1.BroadcastOthers)(eventName)(target, propertyKey, descriptor);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.InputAndBroadcastOthers = InputAndBroadcastOthers;
|
|
32
|
-
//# sourceMappingURL=inputAndBroadcastOthers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputAndBroadcastOthers.js","sourceRoot":"","sources":["../../../src/decorators/inputAndBroadcastOthers.ts"],"names":[],"mappings":";;;AAAA,6DAAqD;AACrD,yCAAiC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,uBAAuB,CAAC,SAAiB;IACvD,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAClD,IAAA,oCAAe,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC;AALD,0DAKC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InputAndEmit = void 0;
|
|
4
|
-
const emit_js_1 = require("./emit.js");
|
|
5
|
-
const input_js_1 = require("./input.js");
|
|
6
|
-
/**
|
|
7
|
-
* Attach the decorated method to the socket event and emit the response to the client.
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketService("/nsp")
|
|
13
|
-
* export class MyWS {
|
|
14
|
-
*
|
|
15
|
-
* @InputAndEmit("event")
|
|
16
|
-
* async myMethod(@Args(0) data: any, @Nsp socket) {
|
|
17
|
-
* return {data: "data"};
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @decorator
|
|
23
|
-
* @param eventName
|
|
24
|
-
*/
|
|
25
|
-
function InputAndEmit(eventName) {
|
|
26
|
-
return (target, propertyKey, descriptor) => {
|
|
27
|
-
(0, input_js_1.Input)(eventName)(target, propertyKey, descriptor);
|
|
28
|
-
(0, emit_js_1.Emit)(eventName)(target, propertyKey, descriptor);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
exports.InputAndEmit = InputAndEmit;
|
|
32
|
-
//# sourceMappingURL=inputAndEmit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputAndEmit.js","sourceRoot":"","sources":["../../../src/decorators/inputAndEmit.ts"],"names":[],"mappings":";;;AAAA,uCAA+B;AAC/B,yCAAiC;AAEjC;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,YAAY,CAAC,SAAiB;IAC5C,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,UAA8B,EAAE,EAAE;QAC1E,IAAA,gBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QAClD,IAAA,cAAI,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AALD,oCAKC"}
|
package/lib/cjs/decorators/io.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IO = void 0;
|
|
4
|
-
const di_1 = require("@tsed/di");
|
|
5
|
-
const SocketIOServer_js_1 = require("../services/SocketIOServer.js");
|
|
6
|
-
function IO(target, targetKey, descriptor) {
|
|
7
|
-
if (target) {
|
|
8
|
-
return (0, di_1.Inject)(SocketIOServer_js_1.Server)(target, targetKey, descriptor);
|
|
9
|
-
}
|
|
10
|
-
return (0, di_1.Inject)(SocketIOServer_js_1.Server);
|
|
11
|
-
}
|
|
12
|
-
exports.IO = IO;
|
|
13
|
-
//# sourceMappingURL=io.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../../src/decorators/io.ts"],"names":[],"mappings":";;;AAAA,iCAAgC;AAEhC,qEAAqD;AAqBrD,SAAgB,EAAE,CAChB,MAAkB,EAClB,SAAuC,EACvC,UAAuD;IAEvD,IAAI,MAAM,EAAE;QACV,OAAO,IAAA,WAAM,EAAC,0BAAM,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;KACtD;IACD,OAAO,IAAA,WAAM,EAAC,0BAAM,CAAC,CAAC;AACxB,CAAC;AATD,gBASC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Namespace = exports.Nsp = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const SocketFilters_js_1 = require("../interfaces/SocketFilters.js");
|
|
6
|
-
const socketFilter_js_1 = require("./socketFilter.js");
|
|
7
|
-
/**
|
|
8
|
-
* Inject the [SocketIO.Namespace](https://socket.io/docs/rooms-and-namespaces/#namespaces) instance in the decorated parameter.
|
|
9
|
-
* Note that when using dynamic namespaces, when injecting a parameter, you may want to consider using @SocketNsp instead.
|
|
10
|
-
*
|
|
11
|
-
* ### Example
|
|
12
|
-
*
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import {Nsp, SocketService, Input} from "@tsed/socketio";
|
|
15
|
-
*
|
|
16
|
-
* @SocketService("/nsp")
|
|
17
|
-
* export class MyWS {
|
|
18
|
-
*
|
|
19
|
-
* @Nsp
|
|
20
|
-
* nsp: SocketIO.Namespace; // will inject SocketIO.Namespace (not available on constructor)
|
|
21
|
-
*
|
|
22
|
-
* @Nsp("/my-other-namespace")
|
|
23
|
-
* nspOther: SocketIO.Namespace; // communication between two namespace
|
|
24
|
-
*
|
|
25
|
-
* @Nsp(/regexp/)
|
|
26
|
-
* nspDynamic: SocketIO.Namespace; // will inject a dynamic namespace (not available on constructor)
|
|
27
|
-
*
|
|
28
|
-
* @Input("event")
|
|
29
|
-
* myMethod(@Nsp namespace: SocketIO.Namespace) {
|
|
30
|
-
*
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @param target
|
|
36
|
-
* @param {string} propertyKey
|
|
37
|
-
* @param {number} index
|
|
38
|
-
* @decorator
|
|
39
|
-
*/
|
|
40
|
-
function Nsp(target, propertyKey, index) {
|
|
41
|
-
return Namespace(target, propertyKey, index);
|
|
42
|
-
}
|
|
43
|
-
exports.Nsp = Nsp;
|
|
44
|
-
/**
|
|
45
|
-
* Inject the [SocketIO.Namespace](https://socket.io/docs/rooms-and-namespaces/#namespaces) instance in the decorated parameter.
|
|
46
|
-
* Note that when using dynamic namespaces, when injecting a parameter, you may want to consider using @SocketNsp instead.
|
|
47
|
-
*
|
|
48
|
-
* ### Example
|
|
49
|
-
*
|
|
50
|
-
* ```typescript
|
|
51
|
-
* import {Namespace, SocketService, Input} from "@tsed/socketio";
|
|
52
|
-
*
|
|
53
|
-
* @SocketService("/nsp")
|
|
54
|
-
* export class MyWS {
|
|
55
|
-
*
|
|
56
|
-
* @Namespace
|
|
57
|
-
* nsp: SocketIO.Namespace; // will inject SocketIO.Namespace (not available on constructor)
|
|
58
|
-
*
|
|
59
|
-
* @Namespace("/my-other-namespace")
|
|
60
|
-
* nspOther: SocketIO.Namespace; // communication between two namespace
|
|
61
|
-
*
|
|
62
|
-
* @Namespace(/regexp/)
|
|
63
|
-
* nspDynamic: SocketIO.Namespace; // will inject a dynamic namespace (not available on constructor)
|
|
64
|
-
*
|
|
65
|
-
* @Input("event")
|
|
66
|
-
* myMethod(@Namespace namespace: Namespace) {
|
|
67
|
-
*
|
|
68
|
-
* }
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @param target
|
|
73
|
-
* @param {string} propertyKey
|
|
74
|
-
* @param {number} index
|
|
75
|
-
* @alias {Nsp}
|
|
76
|
-
* @decorator
|
|
77
|
-
*/
|
|
78
|
-
function Namespace(target, propertyKey, index) {
|
|
79
|
-
if (typeof target === "string" || (0, core_1.isRegExp)(target)) {
|
|
80
|
-
const nsp = target;
|
|
81
|
-
return (target, propertyKey) => {
|
|
82
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
83
|
-
injectNamespaces: [{ propertyKey, nsp }]
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if ((0, core_1.decoratorTypeOf)([target, propertyKey, index]) === core_1.DecoratorTypes.PROP) {
|
|
88
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
89
|
-
injectNamespaces: [{ propertyKey }]
|
|
90
|
-
});
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
return (0, socketFilter_js_1.SocketFilter)(SocketFilters_js_1.SocketFilters.NSP)(target, propertyKey, index);
|
|
94
|
-
}
|
|
95
|
-
exports.Namespace = Namespace;
|
|
96
|
-
//# sourceMappingURL=nsp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nsp.js","sourceRoot":"","sources":["../../../src/decorators/nsp.ts"],"names":[],"mappings":";;;AAAA,qCAA4E;AAE5E,qEAA6D;AAC7D,uDAA+C;AAK/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,GAAG,CAAC,MAAW,EAAE,WAAoB,EAAE,KAAc;IACnE,OAAO,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAFD,kBAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,SAAS,CAAC,MAAW,EAAE,WAAoB,EAAE,KAAc;IACzE,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,IAAA,eAAQ,EAAC,MAAM,CAAC,EAAE;QAClD,MAAM,GAAG,GAAG,MAAyB,CAAC;QAEtC,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,EAAE;YAC1C,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,gBAAgB,EAAE,CAAC,EAAC,WAAW,EAAE,GAAG,EAAC,CAAC;aACvC,CAAC,CAAC;QACL,CAAC,CAAC;KACH;IAED,IAAI,IAAA,sBAAe,EAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,KAAK,qBAAc,CAAC,IAAI,EAAE;QACzE,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,gBAAgB,EAAE,CAAC,EAAC,WAAW,EAAC,CAAC;SAClC,CAAC,CAAC;QAEH,OAAO;KACR;IAED,OAAO,IAAA,8BAAY,EAAC,gCAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAY,EAAE,KAAM,CAAC,CAAC;AACvE,CAAC;AApBD,8BAoBC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Reason = void 0;
|
|
4
|
-
const socketFilter_js_1 = require("./socketFilter.js");
|
|
5
|
-
const SocketFilters_js_1 = require("../interfaces/SocketFilters.js");
|
|
6
|
-
/**
|
|
7
|
-
* Inject the disconnection reason into the decorated parameter.
|
|
8
|
-
*
|
|
9
|
-
* This decorator is used in conjunction with the `$onDisconnect` event handler to handle disconnection reasons in SocketIO services.
|
|
10
|
-
* It allows you to access the reason for the disconnection in your method implementation. For details please refer to the [Socket.io documentation](https://socket.io/docs/v4/server-api/#event-disconnect).
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* @SocketService("/nsp")
|
|
15
|
-
* export class MyWS {
|
|
16
|
-
* public async $onDisconnect(
|
|
17
|
-
* @Reason reason: string = ''
|
|
18
|
-
* ) {
|
|
19
|
-
* // your implementation
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @experimental This decorator is experimental and may change or be removed in future versions.
|
|
25
|
-
* @param target
|
|
26
|
-
* @param {string} propertyKey
|
|
27
|
-
* @param {number} index
|
|
28
|
-
* @decorator
|
|
29
|
-
*/
|
|
30
|
-
function Reason(target, propertyKey, index) {
|
|
31
|
-
return (0, socketFilter_js_1.SocketFilter)(SocketFilters_js_1.SocketFilters.REASON)(target, propertyKey, index);
|
|
32
|
-
}
|
|
33
|
-
exports.Reason = Reason;
|
|
34
|
-
//# sourceMappingURL=reason.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reason.js","sourceRoot":"","sources":["../../../src/decorators/reason.ts"],"names":[],"mappings":";;;AAAA,uDAA+C;AAC/C,qEAA6D;AAE7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,MAAM,CAAC,MAAe,EAAE,WAAmB,EAAE,KAAa;IACxE,OAAO,IAAA,8BAAY,EAAC,gCAAa,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AACxE,CAAC;AAFD,wBAEC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Socket = void 0;
|
|
4
|
-
const SocketFilters_js_1 = require("../interfaces/SocketFilters.js");
|
|
5
|
-
const socketFilter_js_1 = require("./socketFilter.js");
|
|
6
|
-
/**
|
|
7
|
-
* Inject the Socket instance in the decorated parameter.
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketService("/nsp")
|
|
13
|
-
* export class MyWS {
|
|
14
|
-
*
|
|
15
|
-
* @Input("event")
|
|
16
|
-
* myMethod(@Socket socket) {
|
|
17
|
-
*
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @experimental
|
|
23
|
-
* @param target
|
|
24
|
-
* @param {string} propertyKey
|
|
25
|
-
* @param {number} index
|
|
26
|
-
* @decorator
|
|
27
|
-
*/
|
|
28
|
-
function Socket(target, propertyKey, index) {
|
|
29
|
-
return (0, socketFilter_js_1.SocketFilter)(SocketFilters_js_1.SocketFilters.SOCKET)(target, propertyKey, index);
|
|
30
|
-
}
|
|
31
|
-
exports.Socket = Socket;
|
|
32
|
-
//# sourceMappingURL=socket.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socket.js","sourceRoot":"","sources":["../../../src/decorators/socket.ts"],"names":[],"mappings":";;;AACA,qEAA6D;AAC7D,uDAA+C;AAI/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,MAAM,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa;IACpE,OAAO,IAAA,8BAAY,EAAC,gCAAa,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AACxE,CAAC;AAFD,wBAEC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketErr = void 0;
|
|
4
|
-
const SocketFilters_js_1 = require("../interfaces/SocketFilters.js");
|
|
5
|
-
const socketFilter_js_1 = require("./socketFilter.js");
|
|
6
|
-
/**
|
|
7
|
-
* Inject the error in the parameters
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketMiddlewareError()
|
|
13
|
-
* export class MyMiddleware {
|
|
14
|
-
*
|
|
15
|
-
* myMethod(@SocketErr err: any, @Args() arguments: any[]) {
|
|
16
|
-
*
|
|
17
|
-
* }
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @decorator
|
|
22
|
-
* @param target
|
|
23
|
-
* @param propertyKey
|
|
24
|
-
* @param index
|
|
25
|
-
*/
|
|
26
|
-
function SocketErr(target, propertyKey, index) {
|
|
27
|
-
return (0, socketFilter_js_1.SocketFilter)(SocketFilters_js_1.SocketFilters.ERR)(target, propertyKey, index);
|
|
28
|
-
}
|
|
29
|
-
exports.SocketErr = SocketErr;
|
|
30
|
-
//# sourceMappingURL=socketErr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketErr.js","sourceRoot":"","sources":["../../../src/decorators/socketErr.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,uDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,SAAS,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa;IACvE,OAAO,IAAA,8BAAY,EAAC,gCAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AACrE,CAAC;AAFD,8BAEC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketEventName = void 0;
|
|
4
|
-
const SocketFilters_js_1 = require("../interfaces/SocketFilters.js");
|
|
5
|
-
const socketFilter_js_1 = require("./socketFilter.js");
|
|
6
|
-
/**
|
|
7
|
-
* Inject the Socket instance in the decorated parameter.
|
|
8
|
-
*
|
|
9
|
-
* ### Example
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* @SocketMiddleware("/nsp")
|
|
13
|
-
* export class MyMiddleware {
|
|
14
|
-
* use(@SocketEventName eventName: string) {
|
|
15
|
-
*
|
|
16
|
-
* }
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @experimental
|
|
21
|
-
* @param target
|
|
22
|
-
* @param {string} propertyKey
|
|
23
|
-
* @param {number} index
|
|
24
|
-
* @decorator
|
|
25
|
-
*/
|
|
26
|
-
function SocketEventName(target, propertyKey, index) {
|
|
27
|
-
return (0, socketFilter_js_1.SocketFilter)(SocketFilters_js_1.SocketFilters.EVENT_NAME)(target, propertyKey, index);
|
|
28
|
-
}
|
|
29
|
-
exports.SocketEventName = SocketEventName;
|
|
30
|
-
//# sourceMappingURL=socketEventName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketEventName.js","sourceRoot":"","sources":["../../../src/decorators/socketEventName.ts"],"names":[],"mappings":";;;AAAA,qEAA6D;AAC7D,uDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,eAAe,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa;IAC7E,OAAO,IAAA,8BAAY,EAAC,gCAAa,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC5E,CAAC;AAFD,0CAEC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketFilter = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @param {SocketFilters} filter
|
|
8
|
-
* @param {number} mapIndex
|
|
9
|
-
* @returns {(target: any, propertyKey: string, index: number) => Store}
|
|
10
|
-
* @decorator
|
|
11
|
-
*/
|
|
12
|
-
function SocketFilter(filter, mapIndex) {
|
|
13
|
-
return (target, propertyKey, index) => {
|
|
14
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
15
|
-
handlers: {
|
|
16
|
-
[propertyKey]: {
|
|
17
|
-
parameters: {
|
|
18
|
-
[index]: {
|
|
19
|
-
filter,
|
|
20
|
-
mapIndex
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.SocketFilter = SocketFilter;
|
|
29
|
-
//# sourceMappingURL=socketFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketFilter.js","sourceRoot":"","sources":["../../../src/decorators/socketFilter.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AAGjC;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,MAAqB,EAAE,QAAiB;IACnE,OAAO,CAAC,MAAW,EAAE,WAAmB,EAAE,KAAa,EAAE,EAAE;QACzD,YAAK,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;AAfD,oCAeC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketMiddleware = void 0;
|
|
4
|
-
const platform_middlewares_1 = require("@tsed/platform-middlewares");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
const SocketProviderTypes_js_1 = require("../interfaces/SocketProviderTypes.js");
|
|
7
|
-
/**
|
|
8
|
-
* Declare a new SocketMiddleware.
|
|
9
|
-
*
|
|
10
|
-
* ### Example
|
|
11
|
-
*
|
|
12
|
-
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
13
|
-
*
|
|
14
|
-
* Here an example of a middleware:
|
|
15
|
-
*
|
|
16
|
-
* ```typescript
|
|
17
|
-
* @SocketMiddleware()
|
|
18
|
-
* export class UserConverterSocketMiddleware {
|
|
19
|
-
* constructor(private converterService: ConverterService) {
|
|
20
|
-
* }
|
|
21
|
-
* async use(@Args() args: any[]) {
|
|
22
|
-
*
|
|
23
|
-
* let [user] = args;
|
|
24
|
-
* // update Arguments
|
|
25
|
-
* user = this.converterService.deserialize(user, User);
|
|
26
|
-
*
|
|
27
|
-
* return [user];
|
|
28
|
-
* }
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
* > The user instance will be forwarded to the next middleware and to your decorated method.
|
|
32
|
-
*
|
|
33
|
-
* Then:
|
|
34
|
-
*
|
|
35
|
-
* ```typescript
|
|
36
|
-
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
37
|
-
* import {UserConverterSocketMiddleware} from "../middlewares.js";
|
|
38
|
-
* import {User} from "../models/User.js";
|
|
39
|
-
*
|
|
40
|
-
* @SocketService("/my-namespace")
|
|
41
|
-
* @SocketUseBefore(UserConverterSocketMiddleware) // global version
|
|
42
|
-
* export class MySocketService {
|
|
43
|
-
*
|
|
44
|
-
* @Input("eventName")
|
|
45
|
-
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
46
|
-
* @SocketUseBefore(UserConverterSocketMiddleware)
|
|
47
|
-
* async myMethod(@Args(0) user: User) {
|
|
48
|
-
*
|
|
49
|
-
* console.log(user);
|
|
50
|
-
*
|
|
51
|
-
* return user;
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @returns {Function}
|
|
57
|
-
* @decorator
|
|
58
|
-
* @experimental
|
|
59
|
-
*/
|
|
60
|
-
function SocketMiddleware() {
|
|
61
|
-
return (target) => {
|
|
62
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
63
|
-
type: SocketProviderTypes_js_1.SocketProviderTypes.MIDDLEWARE,
|
|
64
|
-
handlers: {
|
|
65
|
-
use: {
|
|
66
|
-
methodClassName: "use"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return (0, platform_middlewares_1.Middleware)()(target);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
exports.SocketMiddleware = SocketMiddleware;
|
|
74
|
-
//# sourceMappingURL=socketMiddleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketMiddleware.js","sourceRoot":"","sources":["../../../src/decorators/socketMiddleware.ts"],"names":[],"mappings":";;;AAAA,qEAAsD;AACtD,qCAAuC;AACvC,iFAAyE;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,CAAC,MAAiB,EAAE,EAAE;QAC3B,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;YACnC,IAAI,EAAE,4CAAmB,CAAC,UAAU;YACpC,QAAQ,EAAE;gBACR,GAAG,EAAE;oBACH,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CAAC;QAEH,OAAO,IAAA,iCAAU,GAAE,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC;AAbD,4CAaC"}
|