@tsed/socketio-testing 6.87.1 → 6.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
- package/lib/cjs/index.js +5 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{services → cjs/services}/SocketClientService.d.ts +0 -0
- package/lib/{services → cjs/services}/SocketClientService.js +11 -11
- package/lib/cjs/services/SocketClientService.js.map +1 -0
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/services/SocketClientService.js +41 -0
- package/lib/esm/services/SocketClientService.js.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/SocketClientService.d.ts +9 -0
- package/package.json +19 -10
- package/tsconfig.compile.esm.json +23 -0
- package/lib/index.js +0 -5
- package/lib/index.js.map +0 -1
- package/lib/services/SocketClientService.js.map +0 -1
|
File without changes
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,8EAA+C","sourcesContent":["export * from \"./services/SocketClientService\";\n"]}
|
|
File without changes
|
|
@@ -16,29 +16,29 @@ let SocketClientService = class SocketClientService {
|
|
|
16
16
|
const { address, port } = this.settings.getHttpPort();
|
|
17
17
|
const uri = `http://${address}:${port}${namespace}`;
|
|
18
18
|
this.logger.info("Bind Socket.io client on:", uri);
|
|
19
|
-
const client = socket_io_client_1.io(uri);
|
|
19
|
+
const client = (0, socket_io_client_1.io)(uri);
|
|
20
20
|
this.clients.set(namespace, client);
|
|
21
21
|
await new Promise((resolve) => {
|
|
22
22
|
client.on("connect", resolve);
|
|
23
23
|
});
|
|
24
|
-
this.logger.
|
|
24
|
+
this.logger.debug("Socket.io client connected...");
|
|
25
25
|
return client;
|
|
26
26
|
}
|
|
27
27
|
$onDestroy() {
|
|
28
28
|
this.clients.forEach((client) => client.close());
|
|
29
|
-
this.logger.
|
|
29
|
+
this.logger.debug("Socket.io clients closed...");
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
tslib_1.__decorate([
|
|
33
|
-
di_1.Configuration(),
|
|
34
|
-
tslib_1.__metadata("design:type", Object)
|
|
32
|
+
(0, tslib_1.__decorate)([
|
|
33
|
+
(0, di_1.Configuration)(),
|
|
34
|
+
(0, tslib_1.__metadata)("design:type", Object)
|
|
35
35
|
], SocketClientService.prototype, "settings", void 0);
|
|
36
|
-
tslib_1.__decorate([
|
|
37
|
-
common_1.Inject(),
|
|
38
|
-
tslib_1.__metadata("design:type", common_1.Logger)
|
|
36
|
+
(0, tslib_1.__decorate)([
|
|
37
|
+
(0, common_1.Inject)(),
|
|
38
|
+
(0, tslib_1.__metadata)("design:type", common_1.Logger)
|
|
39
39
|
], SocketClientService.prototype, "logger", void 0);
|
|
40
|
-
SocketClientService = tslib_1.__decorate([
|
|
41
|
-
di_1.Injectable()
|
|
40
|
+
SocketClientService = (0, tslib_1.__decorate)([
|
|
41
|
+
(0, di_1.Injectable)()
|
|
42
42
|
], SocketClientService);
|
|
43
43
|
exports.SocketClientService = SocketClientService;
|
|
44
44
|
//# sourceMappingURL=SocketClientService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketClientService.js","sourceRoot":"","sources":["../../../src/services/SocketClientService.ts"],"names":[],"mappings":";;;;AAAA,yCAAuD;AACvD,iCAAmD;AACnD,uDAA4C;AAG5C,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAAhC;QAOU,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IA4BnD,CAAC;IA1BC,KAAK,CAAC,GAAG,CAAC,YAAoB,GAAG;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;SACrC;QAED,MAAM,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,UAAU,OAAO,IAAI,IAAI,GAAG,SAAS,EAAE,CAAC;QAEpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,IAAA,qBAAE,EAAC,GAAG,CAAC,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEpC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,OAAc,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AAjCC;IADC,IAAA,kBAAa,GAAE;;qDACgB;AAGhC;IADC,IAAA,eAAM,GAAE;2CACO,eAAM;mDAAC;AALZ,mBAAmB;IAD/B,IAAA,eAAU,GAAE;GACA,mBAAmB,CAmC/B;AAnCY,kDAAmB","sourcesContent":["import {Inject, Logger, OnDestroy} from \"@tsed/common\";\nimport {Configuration, Injectable} from \"@tsed/di\";\nimport {io, Socket} from \"socket.io-client\";\n\n@Injectable()\nexport class SocketClientService implements OnDestroy {\n @Configuration()\n private settings: Configuration;\n\n @Inject()\n private logger: Logger;\n\n private clients: Map<string, Socket> = new Map();\n\n async get(namespace: string = \"/\"): Promise<Socket> {\n if (this.clients.has(namespace)) {\n return this.clients.get(namespace)!;\n }\n\n const {address, port} = this.settings.getHttpPort();\n const uri = `http://${address}:${port}${namespace}`;\n\n this.logger.info(\"Bind Socket.io client on:\", uri);\n const client = io(uri);\n\n this.clients.set(namespace, client);\n\n await new Promise((resolve) => {\n client.on(\"connect\", resolve as any);\n });\n\n this.logger.debug(\"Socket.io client connected...\");\n\n return client;\n }\n\n $onDestroy() {\n this.clients.forEach((client) => client.close());\n this.logger.debug(\"Socket.io clients closed...\");\n }\n}\n"]}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./services/SocketClientService\";\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { Inject, Logger } from "@tsed/common";
|
|
3
|
+
import { Configuration, Injectable } from "@tsed/di";
|
|
4
|
+
import { io } from "socket.io-client";
|
|
5
|
+
let SocketClientService = class SocketClientService {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.clients = new Map();
|
|
8
|
+
}
|
|
9
|
+
async get(namespace = "/") {
|
|
10
|
+
if (this.clients.has(namespace)) {
|
|
11
|
+
return this.clients.get(namespace);
|
|
12
|
+
}
|
|
13
|
+
const { address, port } = this.settings.getHttpPort();
|
|
14
|
+
const uri = `http://${address}:${port}${namespace}`;
|
|
15
|
+
this.logger.info("Bind Socket.io client on:", uri);
|
|
16
|
+
const client = io(uri);
|
|
17
|
+
this.clients.set(namespace, client);
|
|
18
|
+
await new Promise((resolve) => {
|
|
19
|
+
client.on("connect", resolve);
|
|
20
|
+
});
|
|
21
|
+
this.logger.debug("Socket.io client connected...");
|
|
22
|
+
return client;
|
|
23
|
+
}
|
|
24
|
+
$onDestroy() {
|
|
25
|
+
this.clients.forEach((client) => client.close());
|
|
26
|
+
this.logger.debug("Socket.io clients closed...");
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
__decorate([
|
|
30
|
+
Configuration(),
|
|
31
|
+
__metadata("design:type", Object)
|
|
32
|
+
], SocketClientService.prototype, "settings", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
Inject(),
|
|
35
|
+
__metadata("design:type", Logger)
|
|
36
|
+
], SocketClientService.prototype, "logger", void 0);
|
|
37
|
+
SocketClientService = __decorate([
|
|
38
|
+
Injectable()
|
|
39
|
+
], SocketClientService);
|
|
40
|
+
export { SocketClientService };
|
|
41
|
+
//# sourceMappingURL=SocketClientService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocketClientService.js","sourceRoot":"","sources":["../../../src/services/SocketClientService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAE,MAAM,EAAY,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;AACnD,OAAO,EAAC,EAAE,EAAS,MAAM,kBAAkB,CAAC;AAG5C,IAAa,mBAAmB,GAAhC,MAAa,mBAAmB;IAAhC;QAOU,YAAO,GAAwB,IAAI,GAAG,EAAE,CAAC;IA4BnD,CAAC;IA1BC,KAAK,CAAC,GAAG,CAAC,YAAoB,GAAG;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAE,CAAC;SACrC;QAED,MAAM,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QACpD,MAAM,GAAG,GAAG,UAAU,OAAO,IAAI,IAAI,GAAG,SAAS,EAAE,CAAC;QAEpD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QACnD,MAAM,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAEvB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEpC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,OAAc,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAEnD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AAjCC;IADC,aAAa,EAAE;;qDACgB;AAGhC;IADC,MAAM,EAAE;8BACO,MAAM;mDAAC;AALZ,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CAmC/B;SAnCY,mBAAmB","sourcesContent":["import {Inject, Logger, OnDestroy} from \"@tsed/common\";\nimport {Configuration, Injectable} from \"@tsed/di\";\nimport {io, Socket} from \"socket.io-client\";\n\n@Injectable()\nexport class SocketClientService implements OnDestroy {\n @Configuration()\n private settings: Configuration;\n\n @Inject()\n private logger: Logger;\n\n private clients: Map<string, Socket> = new Map();\n\n async get(namespace: string = \"/\"): Promise<Socket> {\n if (this.clients.has(namespace)) {\n return this.clients.get(namespace)!;\n }\n\n const {address, port} = this.settings.getHttpPort();\n const uri = `http://${address}:${port}${namespace}`;\n\n this.logger.info(\"Bind Socket.io client on:\", uri);\n const client = io(uri);\n\n this.clients.set(namespace, client);\n\n await new Promise((resolve) => {\n client.on(\"connect\", resolve as any);\n });\n\n this.logger.debug(\"Socket.io client connected...\");\n\n return client;\n }\n\n $onDestroy() {\n this.clients.forEach((client) => client.close());\n this.logger.debug(\"Socket.io clients closed...\");\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./services/SocketClientService";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OnDestroy } from "@tsed/common";
|
|
2
|
+
import { Socket } from "socket.io-client";
|
|
3
|
+
export declare class SocketClientService implements OnDestroy {
|
|
4
|
+
private settings;
|
|
5
|
+
private logger;
|
|
6
|
+
private clients;
|
|
7
|
+
get(namespace?: string): Promise<Socket>;
|
|
8
|
+
$onDestroy(): void;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/socketio-testing",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.89.0",
|
|
4
4
|
"description": "Socket.io testing package for Ts.ED framework",
|
|
5
|
-
"main": "./lib/index.js",
|
|
6
|
-
"typings": "./lib/index.d.ts",
|
|
7
5
|
"private": false,
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./lib/cjs/index.js",
|
|
8
|
+
"typings": "./lib/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"import": "./lib/esm/index.js",
|
|
12
|
+
"require": "./lib/cjs/index.js",
|
|
13
|
+
"default": "./lib/esm/index.js"
|
|
14
|
+
},
|
|
8
15
|
"scripts": {
|
|
9
|
-
"build": "
|
|
16
|
+
"build": "yarn run build:esm && yarn run build:cjs",
|
|
17
|
+
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
18
|
+
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
10
19
|
"start": "ts-node -r tsconfig-paths/register test/app/index.ts"
|
|
11
20
|
},
|
|
12
21
|
"dependencies": {
|
|
13
22
|
"tslib": "2.2.0"
|
|
14
23
|
},
|
|
15
24
|
"devDependencies": {
|
|
16
|
-
"@tsed/common": "6.
|
|
17
|
-
"@tsed/di": "6.
|
|
25
|
+
"@tsed/common": "6.89.0",
|
|
26
|
+
"@tsed/di": "6.89.0",
|
|
18
27
|
"socket.io-client": "^4.1.2"
|
|
19
28
|
},
|
|
20
29
|
"peerDependencies": {
|
|
21
|
-
"@tsed/common": "^6.
|
|
22
|
-
"@tsed/core": "^6.
|
|
23
|
-
"@tsed/di": "^6.
|
|
24
|
-
"@tsed/socketio": "^6.
|
|
30
|
+
"@tsed/common": "^6.89.0",
|
|
31
|
+
"@tsed/core": "^6.89.0",
|
|
32
|
+
"@tsed/di": "^6.89.0",
|
|
33
|
+
"@tsed/socketio": "^6.89.0",
|
|
25
34
|
"socket.io-client": "^4.0.1"
|
|
26
35
|
},
|
|
27
36
|
"repository": "https://github.com/tsedio/tsed",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.compile.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"module": "ES2020",
|
|
6
|
+
"rootDir": "src",
|
|
7
|
+
"outDir": "./lib/esm",
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationDir": "./lib/types"
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"node_modules",
|
|
13
|
+
"test",
|
|
14
|
+
"lib",
|
|
15
|
+
"benchmark",
|
|
16
|
+
"coverage",
|
|
17
|
+
"spec",
|
|
18
|
+
"**/*.benchmark.ts",
|
|
19
|
+
"**/*.spec.ts",
|
|
20
|
+
"keys",
|
|
21
|
+
"jest.config.js"
|
|
22
|
+
]
|
|
23
|
+
}
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+C","sourcesContent":["export * from \"./services/SocketClientService\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SocketClientService.js","sourceRoot":"","sources":["../../src/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AAE;sCACO,eAAM;mDAAC;AALZ,mBAAmB;IAD/B,eAAU,EAAE;GACA,mBAAmB,CAmC/B;AAnCY,kDAAmB","sourcesContent":["import {Inject, Logger, OnDestroy} from \"@tsed/common\";\nimport {Configuration, Injectable} from \"@tsed/di\";\nimport {io, Socket} from \"socket.io-client\";\n\n@Injectable()\nexport class SocketClientService implements OnDestroy {\n @Configuration()\n private settings: Configuration;\n\n @Inject()\n private logger: Logger;\n\n private clients: Map<string, Socket> = new Map();\n\n async get(namespace: string = \"/\"): Promise<Socket> {\n if (this.clients.has(namespace)) {\n return this.clients.get(namespace)!;\n }\n\n const {address, port} = this.settings.getHttpPort();\n const uri = `http://${address}:${port}${namespace}`;\n\n this.logger.info(\"Bind Socket.io client on:\", uri);\n const client = io(uri);\n\n this.clients.set(namespace, client);\n\n await new Promise((resolve) => {\n client.on(\"connect\", resolve as any);\n });\n\n this.logger.info(\"Socket.io client connected...\");\n\n return client;\n }\n\n $onDestroy() {\n this.clients.forEach((client) => client.close());\n this.logger.info(\"Socket.io clients closed...\");\n }\n}\n"]}
|