@tsed/socketio 8.0.0-alpha.1 → 8.0.0-alpha.11
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/esm/SocketIOModule.js +3 -3
- package/lib/esm/SocketIOModule.js.map +1 -1
- package/lib/esm/class/SocketHandlersBuilder.js +1 -1
- package/lib/esm/class/SocketHandlersBuilder.js.map +1 -1
- package/lib/esm/class/SocketSessionData.js.map +1 -1
- package/lib/esm/decorators/args.js.map +1 -1
- package/lib/esm/decorators/io.js.map +1 -1
- package/lib/esm/decorators/nsp.js +1 -1
- package/lib/esm/decorators/nsp.js.map +1 -1
- package/lib/esm/decorators/reason.js +1 -1
- package/lib/esm/decorators/reason.js.map +1 -1
- package/lib/esm/decorators/socket.js.map +1 -1
- package/lib/esm/decorators/socketFilter.js.map +1 -1
- package/lib/esm/decorators/socketMiddleware.js +1 -1
- package/lib/esm/decorators/socketMiddleware.js.map +1 -1
- package/lib/esm/decorators/socketMiddlewareError.js +1 -1
- package/lib/esm/decorators/socketMiddlewareError.js.map +1 -1
- package/lib/esm/decorators/socketNsp.js.map +1 -1
- package/lib/esm/decorators/socketReturns.js.map +1 -1
- package/lib/esm/decorators/socketService.js +1 -1
- package/lib/esm/decorators/socketService.js.map +1 -1
- package/lib/esm/decorators/socketUseAfter.js.map +1 -1
- package/lib/esm/decorators/socketUseBefore.js.map +1 -1
- package/lib/esm/services/SocketIOService.js.map +1 -1
- package/lib/types/SocketIOModule.d.ts +3 -3
- package/package.json +25 -26
- package/vitest.config.mts +3 -3
- 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,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketUseAfter = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
* Attach a Socket Middleware to a method or a class.
|
|
7
|
-
*
|
|
8
|
-
* ### Example
|
|
9
|
-
*
|
|
10
|
-
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
11
|
-
*
|
|
12
|
-
* Here an example of a middleware:
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* import {SocketMiddlewareError, SocketErr, Socket, Args} from "@tsed/socketio";
|
|
16
|
-
*
|
|
17
|
-
* @SocketMiddlewareError()
|
|
18
|
-
* export class ErrorHandlerSocketMiddleware {
|
|
19
|
-
* async use(@SocketErr() err: any, @Socket socket: SocketIO.Socket) {
|
|
20
|
-
* console.error(err);
|
|
21
|
-
* socket.emit("error", {message: "An error has occured"})
|
|
22
|
-
* }
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* Then:
|
|
27
|
-
*
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
30
|
-
* import {ErrorHandlerSocketMiddleware} from "../middlewares.js";
|
|
31
|
-
* import {User} from "../models/User.js";
|
|
32
|
-
*
|
|
33
|
-
* @SocketService("/my-namespace")
|
|
34
|
-
* @SocketUseAfter(ErrorHandlerSocketMiddleware) // global version
|
|
35
|
-
* export class MySocketService {
|
|
36
|
-
*
|
|
37
|
-
* @Input("eventName")
|
|
38
|
-
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
39
|
-
* @SocketUseAfter(ErrorHandlerSocketMiddleware)
|
|
40
|
-
* async myMethod(@Args(0) userName: User) {
|
|
41
|
-
*
|
|
42
|
-
* console.log(user);
|
|
43
|
-
* throw new Error("Error");
|
|
44
|
-
*
|
|
45
|
-
* return user;
|
|
46
|
-
* }
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}
|
|
51
|
-
* @decorator
|
|
52
|
-
* @experimental
|
|
53
|
-
* @param middlewares
|
|
54
|
-
*/
|
|
55
|
-
function SocketUseAfter(...middlewares) {
|
|
56
|
-
return (target, propertyKey, descriptor) => {
|
|
57
|
-
if (propertyKey) {
|
|
58
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
59
|
-
handlers: {
|
|
60
|
-
[propertyKey]: {
|
|
61
|
-
useAfter: middlewares
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
68
|
-
useAfter: middlewares
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
exports.SocketUseAfter = SocketUseAfter;
|
|
74
|
-
//# sourceMappingURL=socketUseAfter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketUseAfter.js","sourceRoot":"","sources":["../../../src/decorators/socketUseAfter.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,SAAgB,cAAc,CAAC,GAAG,WAAwB;IACxD,OAAO,CAAC,MAAW,EAAE,WAAoB,EAAE,UAA+B,EAAE,EAAE;QAC5E,IAAI,WAAW,EAAE;YACf,YAAK,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,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,QAAQ,EAAE,WAAW;aACtB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAhBD,wCAgBC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketUseBefore = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
/**
|
|
6
|
-
* Attach a Socket Middleware to a method or a class.
|
|
7
|
-
*
|
|
8
|
-
* ### Example
|
|
9
|
-
*
|
|
10
|
-
* A middleware can be also used on a `SocketService` either on a class or on a method.
|
|
11
|
-
*
|
|
12
|
-
* Here an example of a middleware:
|
|
13
|
-
*
|
|
14
|
-
* ```typescript
|
|
15
|
-
* @SocketMiddleware()
|
|
16
|
-
* export class UserConverterSocketMiddleware {
|
|
17
|
-
* constructor(private converterService: ConverterService) {
|
|
18
|
-
* }
|
|
19
|
-
* async use(@Args() args: any[]) {
|
|
20
|
-
*
|
|
21
|
-
* let [user] = args;
|
|
22
|
-
* // update Arguments
|
|
23
|
-
* user = ConverterService.deserialize(user, User);
|
|
24
|
-
*
|
|
25
|
-
* return [user];
|
|
26
|
-
* }
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
* > The user instance will be forwarded to the next middleware and to your decorated method.
|
|
30
|
-
*
|
|
31
|
-
* Then:
|
|
32
|
-
*
|
|
33
|
-
* ```typescript
|
|
34
|
-
* import {SocketService, SocketUseAfter, SocketUseBefore, Emit, Input, Args} from "@tsed/socketio";
|
|
35
|
-
* import {UserConverterSocketMiddleware} from "../middlewares.js";
|
|
36
|
-
* import {User} from "../models/User.js";
|
|
37
|
-
*
|
|
38
|
-
* @SocketService("/my-namespace")
|
|
39
|
-
* @SocketUseBefore(UserConverterSocketMiddleware) // global version
|
|
40
|
-
* export class MySocketService {
|
|
41
|
-
*
|
|
42
|
-
* @Input("eventName")
|
|
43
|
-
* @Emit("responseEventName") // or Broadcast or BroadcastOthers
|
|
44
|
-
* @SocketUseBefore(UserConverterSocketMiddleware)
|
|
45
|
-
* async myMethod(@Args(0) user: User) {
|
|
46
|
-
*
|
|
47
|
-
* console.log(user);
|
|
48
|
-
*
|
|
49
|
-
* return user;
|
|
50
|
-
* }
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @returns {(target: any, propertyKey?: string, descriptor?: PropertyDescriptor) => void}
|
|
55
|
-
* @decorator
|
|
56
|
-
* @experimental
|
|
57
|
-
* @param middlewares
|
|
58
|
-
*/
|
|
59
|
-
function SocketUseBefore(...middlewares) {
|
|
60
|
-
return (target, propertyKey, descriptor) => {
|
|
61
|
-
if (propertyKey) {
|
|
62
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
63
|
-
handlers: {
|
|
64
|
-
[propertyKey]: {
|
|
65
|
-
useBefore: middlewares
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
core_1.Store.from(target).merge("socketIO", {
|
|
72
|
-
useBefore: middlewares
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
exports.SocketUseBefore = SocketUseBefore;
|
|
78
|
-
//# sourceMappingURL=socketUseBefore.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"socketUseBefore.js","sourceRoot":"","sources":["../../../src/decorators/socketUseBefore.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,SAAgB,eAAe,CAAC,GAAG,WAAwB;IACzD,OAAO,CAAC,MAAW,EAAE,WAAoB,EAAE,UAA+B,EAAE,EAAE;QAC5E,IAAI,WAAW,EAAE;YACf,YAAK,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,YAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE;gBACnC,SAAS,EAAE,WAAW;aACvB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAhBD,0CAgBC"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* @file Automatically generated by @tsed/barrels.
|
|
6
|
-
*/
|
|
7
|
-
tslib_1.__exportStar(require("./class/SocketHandlersBuilder.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./class/SocketProviderMetadata.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./class/SocketSessionData.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./constants/constants.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./decorators/args.js"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./decorators/broadcast.js"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./decorators/broadcastOthers.js"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./decorators/emit.js"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./decorators/input.js"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./decorators/inputAndBroadcast.js"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./decorators/inputAndBroadcastOthers.js"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./decorators/inputAndEmit.js"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./decorators/io.js"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./decorators/nsp.js"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./decorators/reason.js"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./decorators/socket.js"), exports);
|
|
23
|
-
tslib_1.__exportStar(require("./decorators/socketErr.js"), exports);
|
|
24
|
-
tslib_1.__exportStar(require("./decorators/socketEventName.js"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./decorators/socketFilter.js"), exports);
|
|
26
|
-
tslib_1.__exportStar(require("./decorators/socketMiddleware.js"), exports);
|
|
27
|
-
tslib_1.__exportStar(require("./decorators/socketMiddlewareError.js"), exports);
|
|
28
|
-
tslib_1.__exportStar(require("./decorators/socketNsp.js"), exports);
|
|
29
|
-
tslib_1.__exportStar(require("./decorators/socketReturns.js"), exports);
|
|
30
|
-
tslib_1.__exportStar(require("./decorators/socketService.js"), exports);
|
|
31
|
-
tslib_1.__exportStar(require("./decorators/socketSession.js"), exports);
|
|
32
|
-
tslib_1.__exportStar(require("./decorators/socketUseAfter.js"), exports);
|
|
33
|
-
tslib_1.__exportStar(require("./decorators/socketUseBefore.js"), exports);
|
|
34
|
-
tslib_1.__exportStar(require("./interfaces/interfaces.js"), exports);
|
|
35
|
-
tslib_1.__exportStar(require("./interfaces/OnNamespaceInit.js"), exports);
|
|
36
|
-
tslib_1.__exportStar(require("./interfaces/SocketFilters.js"), exports);
|
|
37
|
-
tslib_1.__exportStar(require("./interfaces/SocketHandlerMetadata.js"), exports);
|
|
38
|
-
tslib_1.__exportStar(require("./interfaces/SocketInjectableNsp.js"), exports);
|
|
39
|
-
tslib_1.__exportStar(require("./interfaces/SocketParamMetadata.js"), exports);
|
|
40
|
-
tslib_1.__exportStar(require("./interfaces/SocketProviderTypes.js"), exports);
|
|
41
|
-
tslib_1.__exportStar(require("./interfaces/SocketReturnsTypes.js"), exports);
|
|
42
|
-
tslib_1.__exportStar(require("./services/SocketIOServer.js"), exports);
|
|
43
|
-
tslib_1.__exportStar(require("./services/SocketIOService.js"), exports);
|
|
44
|
-
tslib_1.__exportStar(require("./SocketIOModule.js"), exports);
|
|
45
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,2EAAiD;AACjD,4EAAkD;AAClD,uEAA6C;AAC7C,mEAAyC;AACzC,+DAAqC;AACrC,oEAA0C;AAC1C,0EAAgD;AAChD,+DAAqC;AACrC,gEAAsC;AACtC,4EAAkD;AAClD,kFAAwD;AACxD,uEAA6C;AAC7C,6DAAmC;AACnC,8DAAoC;AACpC,iEAAuC;AACvC,iEAAuC;AACvC,oEAA0C;AAC1C,0EAAgD;AAChD,uEAA6C;AAC7C,2EAAiD;AACjD,gFAAsD;AACtD,oEAA0C;AAC1C,wEAA8C;AAC9C,wEAA8C;AAC9C,wEAA8C;AAC9C,yEAA+C;AAC/C,0EAAgD;AAChD,qEAA2C;AAC3C,0EAAgD;AAChD,wEAA8C;AAC9C,gFAAsD;AACtD,8EAAoD;AACpD,8EAAoD;AACpD,8EAAoD;AACpD,6EAAmD;AACnD,uEAA6C;AAC7C,wEAA8C;AAC9C,8DAAoC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OnNamespaceInit.js","sourceRoot":"","sources":["../../../src/interfaces/OnNamespaceInit.ts"],"names":[],"mappings":""}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketFilters = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
var SocketFilters;
|
|
8
|
-
(function (SocketFilters) {
|
|
9
|
-
SocketFilters["ARGS"] = "args";
|
|
10
|
-
SocketFilters["SOCKET"] = "socket";
|
|
11
|
-
SocketFilters["EVENT_NAME"] = "eventName";
|
|
12
|
-
SocketFilters["NSP"] = "nsp";
|
|
13
|
-
SocketFilters["SESSION"] = "session";
|
|
14
|
-
SocketFilters["RAW_SESSION"] = "raw_session";
|
|
15
|
-
SocketFilters["ERR"] = "error";
|
|
16
|
-
SocketFilters["SOCKET_NSP"] = "socket_nsp";
|
|
17
|
-
SocketFilters["REASON"] = "reason";
|
|
18
|
-
})(SocketFilters = exports.SocketFilters || (exports.SocketFilters = {}));
|
|
19
|
-
//# sourceMappingURL=SocketFilters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketFilters.js","sourceRoot":"","sources":["../../../src/interfaces/SocketFilters.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,aAUX;AAVD,WAAY,aAAa;IACvB,8BAAa,CAAA;IACb,kCAAiB,CAAA;IACjB,yCAAwB,CAAA;IACxB,4BAAW,CAAA;IACX,oCAAmB,CAAA;IACnB,4CAA2B,CAAA;IAC3B,8BAAa,CAAA;IACb,0CAAyB,CAAA;IACzB,kCAAiB,CAAA;AACnB,CAAC,EAVW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAUxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketHandlerMetadata.js","sourceRoot":"","sources":["../../../src/interfaces/SocketHandlerMetadata.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketInjectableNsp.js","sourceRoot":"","sources":["../../../src/interfaces/SocketInjectableNsp.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketParamMetadata.js","sourceRoot":"","sources":["../../../src/interfaces/SocketParamMetadata.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketProviderTypes = void 0;
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
var SocketProviderTypes;
|
|
8
|
-
(function (SocketProviderTypes) {
|
|
9
|
-
SocketProviderTypes["SERVICE"] = "service";
|
|
10
|
-
SocketProviderTypes["MIDDLEWARE"] = "middleware";
|
|
11
|
-
})(SocketProviderTypes = exports.SocketProviderTypes || (exports.SocketProviderTypes = {}));
|
|
12
|
-
//# sourceMappingURL=SocketProviderTypes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketProviderTypes.js","sourceRoot":"","sources":["../../../src/interfaces/SocketProviderTypes.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;AAC3B,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketReturnsTypes = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
var SocketReturnsTypes;
|
|
8
|
-
(function (SocketReturnsTypes) {
|
|
9
|
-
SocketReturnsTypes["BROADCAST"] = "broadcast";
|
|
10
|
-
SocketReturnsTypes["BROADCAST_OTHERS"] = "broadcastOthers";
|
|
11
|
-
SocketReturnsTypes["EMIT"] = "emit";
|
|
12
|
-
})(SocketReturnsTypes = exports.SocketReturnsTypes || (exports.SocketReturnsTypes = {}));
|
|
13
|
-
//# sourceMappingURL=SocketReturnsTypes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketReturnsTypes.js","sourceRoot":"","sources":["../../../src/interfaces/SocketReturnsTypes.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,0DAAoC,CAAA;IACpC,mCAAa,CAAA;AACf,CAAC,EAJW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":""}
|
package/lib/cjs/package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Server = exports.SocketIOServer = void 0;
|
|
4
|
-
const di_1 = require("@tsed/di");
|
|
5
|
-
const socket_io_1 = require("socket.io");
|
|
6
|
-
Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return socket_io_1.Server; } });
|
|
7
|
-
// tslint:disable-next-line: variable-name
|
|
8
|
-
exports.SocketIOServer = socket_io_1.Server;
|
|
9
|
-
(0, di_1.registerProvider)({
|
|
10
|
-
provide: socket_io_1.Server,
|
|
11
|
-
deps: [di_1.Configuration],
|
|
12
|
-
useFactory(config) {
|
|
13
|
-
return new socket_io_1.Server(config.socketIO);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=SocketIOServer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketIOServer.js","sourceRoot":"","sources":["../../../src/services/SocketIOServer.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AACzD,yCAAiC;AAOzB,uFAPA,kBAAM,OAOA;AAHd,0CAA0C;AAC7B,QAAA,cAAc,GAAG,kBAAM,CAAC;AAIrC,IAAA,qBAAgB,EAAC;IACf,OAAO,EAAE,kBAAM;IACf,IAAI,EAAE,CAAC,kBAAa,CAAC;IACrB,UAAU,CAAC,MAAqB;QAC9B,OAAO,IAAI,kBAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocketIOService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const common_1 = require("@tsed/common");
|
|
6
|
-
const SocketIO = tslib_1.__importStar(require("socket.io")); // tslint:disable-line: no-unused-variable
|
|
7
|
-
const SocketHandlersBuilder_js_1 = require("../class/SocketHandlersBuilder.js");
|
|
8
|
-
const SocketProviderMetadata_js_1 = require("../class/SocketProviderMetadata.js");
|
|
9
|
-
const io_js_1 = require("../decorators/io.js");
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
let SocketIOService = class SocketIOService {
|
|
14
|
-
constructor(injector, io) {
|
|
15
|
-
this.injector = injector;
|
|
16
|
-
this.io = io;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
* @type {Map<any, any>}
|
|
20
|
-
*/
|
|
21
|
-
this.namespaces = new Map();
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param {string} namespace
|
|
26
|
-
* @returns {SocketIO.Namespace}
|
|
27
|
-
*/
|
|
28
|
-
getNsp(namespace = "/") {
|
|
29
|
-
if (!this.namespaces.has(namespace)) {
|
|
30
|
-
const conf = { nsp: this.io.of(namespace), instances: [] };
|
|
31
|
-
this.namespaces.set(namespace, conf);
|
|
32
|
-
conf.nsp.on("connection", (socket) => {
|
|
33
|
-
conf.instances.forEach((builder) => {
|
|
34
|
-
builder.onConnection(socket, conf.nsp);
|
|
35
|
-
});
|
|
36
|
-
socket.on("disconnect", (reason) => {
|
|
37
|
-
conf.instances.forEach((builder) => {
|
|
38
|
-
builder.onDisconnect(socket, conf.nsp, reason);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return this.namespaces.get(namespace);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
*
|
|
47
|
-
* @param {Provider<any>} provider
|
|
48
|
-
*/
|
|
49
|
-
addSocketProvider(provider) {
|
|
50
|
-
const wsConfig = new SocketProviderMetadata_js_1.SocketProviderMetadata(provider.store.get("socketIO"));
|
|
51
|
-
const nspConfig = this.getNsp(wsConfig.namespace);
|
|
52
|
-
const nsps = new Map();
|
|
53
|
-
this.namespaces.forEach((value, nsp) => {
|
|
54
|
-
nsps.set(nsp, value.nsp);
|
|
55
|
-
});
|
|
56
|
-
const builder = new SocketHandlersBuilder_js_1.SocketHandlersBuilder(provider, this.injector).build(nsps);
|
|
57
|
-
nspConfig.instances.push(builder);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
SocketIOService = tslib_1.__decorate([
|
|
61
|
-
(0, common_1.Service)(),
|
|
62
|
-
tslib_1.__param(1, io_js_1.IO),
|
|
63
|
-
tslib_1.__metadata("design:paramtypes", [common_1.InjectorService, SocketIO.Server])
|
|
64
|
-
], SocketIOService);
|
|
65
|
-
exports.SocketIOService = SocketIOService;
|
|
66
|
-
//# sourceMappingURL=SocketIOService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketIOService.js","sourceRoot":"","sources":["../../../src/services/SocketIOService.ts"],"names":[],"mappings":";;;;AAAA,yCAAgE;AAChE,4DAAsC,CAAC,0CAA0C;AACjF,gFAAwE;AACxE,kFAA0E;AAC1E,+CAAuC;AAEvC;;GAEG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAO1B,YACU,QAAyB,EACrB,EAAmB;QADvB,aAAQ,GAAR,QAAQ,CAAiB;QACrB,OAAE,GAAF,EAAE,CAAiB;QARjC;;;WAGG;QACK,eAAU,GAAoE,IAAI,GAAG,EAAE,CAAC;IAK7F,CAAC;IAEJ;;;;OAIG;IACI,MAAM,CAAC,YAA6B,GAAG;QAC5C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YACnC,MAAM,IAAI,GAAG,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE,EAAC,CAAC;YAEzD,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAErC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;gBACnC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAA8B,EAAE,EAAE;oBACxD,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;gBAEH,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAc,EAAE,EAAE;oBACzC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAA8B,EAAE,EAAE;wBACxD,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;oBACjD,CAAC,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,QAAuB;QAC9C,MAAM,QAAQ,GAA2B,IAAI,kDAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;QAEpG,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,gDAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAE/E,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AAzDY,eAAe;IAD3B,IAAA,gBAAO,GAAE;IAUL,mBAAA,UAAE,CAAA;6CADe,wBAAe,EACjB,QAAQ,CAAC,MAAM;GATtB,eAAe,CAyD3B;AAzDY,0CAAe"}
|
package/lib/esm/package.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { AfterListen, InjectorService, OnDestroy, Provider } from "@tsed/common";
|
|
4
|
-
import { ServerOptions } from "socket.io";
|
|
5
|
-
import Http from "http";
|
|
6
|
-
import Https from "https";
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare class SocketIOModule implements AfterListen, OnDestroy {
|
|
11
|
-
protected disableRoutesSummary: boolean;
|
|
12
|
-
protected settings: Partial<ServerOptions>;
|
|
13
|
-
protected injector: InjectorService;
|
|
14
|
-
protected httpServer: Http.Server | null;
|
|
15
|
-
protected httpsServer: Https.Server | null;
|
|
16
|
-
private io;
|
|
17
|
-
private socketIOService;
|
|
18
|
-
$afterListen(): Promise<void>;
|
|
19
|
-
$onDestroy(): Promise<unknown>;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* @returns {Provider<any>[]}
|
|
23
|
-
*/
|
|
24
|
-
protected getWebsocketServices(): Provider<any>[];
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
protected printSocketEvents(): void;
|
|
29
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { InjectorService, Provider } from "@tsed/di";
|
|
2
|
-
import { Namespace, Socket } from "socket.io";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export declare class SocketHandlersBuilder {
|
|
7
|
-
private readonly provider;
|
|
8
|
-
private readonly injector;
|
|
9
|
-
private readonly socketProviderMetadata;
|
|
10
|
-
constructor(provider: Provider, injector: InjectorService);
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
13
|
-
* @param {SocketHandlerMetadata} handlerMetadata
|
|
14
|
-
* @param scope
|
|
15
|
-
* @returns {(data) => void}
|
|
16
|
-
*/
|
|
17
|
-
private static bindResponseMiddleware;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @returns {any}
|
|
21
|
-
*/
|
|
22
|
-
build(nsps: Map<string | RegExp, Namespace>): this;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param {Socket} socket
|
|
26
|
-
* @param {Namespace} nsp
|
|
27
|
-
*/
|
|
28
|
-
onConnection(socket: Socket, nsp: Namespace): Promise<void>;
|
|
29
|
-
onDisconnect(socket: Socket, nsp: Namespace, reason?: string): Promise<void>;
|
|
30
|
-
private buildHandlers;
|
|
31
|
-
private runQueue;
|
|
32
|
-
private deserialize;
|
|
33
|
-
private bindMiddleware;
|
|
34
|
-
private invoke;
|
|
35
|
-
private buildParameters;
|
|
36
|
-
private createContext;
|
|
37
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { SocketHandlerMetadata } from "../interfaces/SocketHandlerMetadata.js";
|
|
2
|
-
import { SocketInjectableNsp } from "../interfaces/SocketInjectableNsp.js";
|
|
3
|
-
import { SocketProviderTypes } from "../interfaces/SocketProviderTypes.js";
|
|
4
|
-
export declare class SocketProviderMetadata {
|
|
5
|
-
type: SocketProviderTypes;
|
|
6
|
-
namespace: string | RegExp;
|
|
7
|
-
error: boolean;
|
|
8
|
-
injectNamespaces: SocketInjectableNsp[];
|
|
9
|
-
useBefore: any[];
|
|
10
|
-
useAfter: any[];
|
|
11
|
-
handlers: Record<string, SocketHandlerMetadata>;
|
|
12
|
-
constructor(options?: Partial<SocketProviderMetadata>);
|
|
13
|
-
get useHandler(): SocketHandlerMetadata;
|
|
14
|
-
get $onConnection(): SocketHandlerMetadata;
|
|
15
|
-
get $onDisconnect(): SocketHandlerMetadata;
|
|
16
|
-
get(key: string): SocketHandlerMetadata;
|
|
17
|
-
set(key: string, metadata: SocketHandlerMetadata): void;
|
|
18
|
-
getHandlers(): SocketHandlerMetadata[];
|
|
19
|
-
createHook(hook: string, eventName: string): void;
|
|
20
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents session data associated with a socket connection, providing a compatibility layer with Ts.ED v7 by wrapping a `socket.data` which is used to archive recoverability and resiliency to a `Map` instance.
|
|
3
|
-
*
|
|
4
|
-
* This class implements the `Map<string, unknown>` interface and provides methods and properties to manage and manipulate session data.
|
|
5
|
-
*
|
|
6
|
-
* @internal This class is designed for internal use.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SocketSessionData extends Map<string, unknown> {
|
|
9
|
-
#private;
|
|
10
|
-
get size(): number;
|
|
11
|
-
static get [Symbol.species](): MapConstructor;
|
|
12
|
-
constructor(data: Record<string, unknown>);
|
|
13
|
-
[Symbol.iterator](): IterableIterator<[string, unknown]>;
|
|
14
|
-
clear(): void;
|
|
15
|
-
delete(key: string): boolean;
|
|
16
|
-
entries(): IterableIterator<[string, unknown]>;
|
|
17
|
-
forEach(callbackfn: (value: unknown, key: string, map: Map<string, unknown>) => void, thisArg?: any): void;
|
|
18
|
-
get(key: string): unknown | undefined;
|
|
19
|
-
has(key: string): boolean;
|
|
20
|
-
keys(): IterableIterator<string>;
|
|
21
|
-
set(key: string, value: unknown): this;
|
|
22
|
-
values(): IterableIterator<unknown>;
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const PROVIDER_TYPE_SOCKET_SERVICE = "socketService";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inject the list of arguments in the decorated parameter.
|
|
3
|
-
*
|
|
4
|
-
* `@Args` accept an index parameter to pick up directly the item in the arguments list.
|
|
5
|
-
*
|
|
6
|
-
* ### Example
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @SocketService("/nsp")
|
|
10
|
-
* export class MyWS {
|
|
11
|
-
*
|
|
12
|
-
* @Input("event")
|
|
13
|
-
* myMethod(@Args() arguments: any[]) {
|
|
14
|
-
*
|
|
15
|
-
* }
|
|
16
|
-
*
|
|
17
|
-
* @Input("event2")
|
|
18
|
-
* myMethod2(@Args(0) data: any) {
|
|
19
|
-
*
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @decorator
|
|
25
|
-
* @param mapIndex
|
|
26
|
-
* @param useType
|
|
27
|
-
*/
|
|
28
|
-
export declare function Args(mapIndex?: number, useType?: any): any;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Broadcast the response for all client registered in the same namespace.
|
|
3
|
-
*
|
|
4
|
-
* With the `@Broadcast` decorator, the method will accept a return type (Promise or not).
|
|
5
|
-
*
|
|
6
|
-
* ### Example
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @SocketService("/nsp")
|
|
10
|
-
* export class MyWS {
|
|
11
|
-
*
|
|
12
|
-
* @Input("event")
|
|
13
|
-
* @Broadcast("returnEvent")
|
|
14
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
15
|
-
* return Promise.resolve({data})
|
|
16
|
-
* }
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @decorator
|
|
21
|
-
* @param eventName
|
|
22
|
-
*/
|
|
23
|
-
export declare function Broadcast(eventName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Broadcast the response for all client registered in the same namespace except to the current client.
|
|
3
|
-
*
|
|
4
|
-
* With the `@BroadcastOthers` decorator, the method will accept a return type (Promise or not).
|
|
5
|
-
*
|
|
6
|
-
* ### Example
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @SocketService("/nsp")
|
|
10
|
-
* export class MyWS {
|
|
11
|
-
*
|
|
12
|
-
* @Input("event")
|
|
13
|
-
* @BroadcastOthers("returnEvent")
|
|
14
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
15
|
-
* return Promise.resolve({data})
|
|
16
|
-
* }
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @decorator
|
|
21
|
-
* @param eventName
|
|
22
|
-
*/
|
|
23
|
-
export declare function BroadcastOthers(eventName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Emit the response to the client.
|
|
3
|
-
*
|
|
4
|
-
* With the `@Emit` decorator, the method will accept a return type (Promise or not).
|
|
5
|
-
*
|
|
6
|
-
* ### Example
|
|
7
|
-
*
|
|
8
|
-
* ```typescript
|
|
9
|
-
* @SocketService("/nsp")
|
|
10
|
-
* export class MyWS {
|
|
11
|
-
*
|
|
12
|
-
* @Input("event")
|
|
13
|
-
* @Emit("returnEvent")
|
|
14
|
-
* async myMethod(@Args(0) data: any, @Nsp socket): Promise<any> {
|
|
15
|
-
* return Promise.resolve({data})
|
|
16
|
-
* }
|
|
17
|
-
* }
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @decorator
|
|
21
|
-
* @param eventName
|
|
22
|
-
*/
|
|
23
|
-
export declare function Emit(eventName: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
|