nodecommons-esm-app-socket-io 0.0.2
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/dist/apps/commons-socket-io.app.d.mts +13 -0
- package/dist/apps/commons-socket-io.app.mjs +20 -0
- package/dist/apps/commons-socket-io.app.mjs.map +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +5 -0
- package/dist/index.mjs.map +1 -0
- package/dist/interfaces/icommons-socket-io-pseudo-config.d.mts +4 -0
- package/dist/interfaces/icommons-socket-io-pseudo-config.mjs +7 -0
- package/dist/interfaces/icommons-socket-io-pseudo-config.mjs.map +1 -0
- package/dist/servers/commons-app-socket-io.server.d.mts +6 -0
- package/dist/servers/commons-app-socket-io.server.mjs +10 -0
- package/dist/servers/commons-app-socket-io.server.mjs.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { CommonsStrictExpressServer, ICommonsRequestWithStrictParams } from 'nodecommons-esm-express';
|
|
3
|
+
import { ICommonsExpressConfig } from 'nodecommons-esm-express';
|
|
4
|
+
import { CommonsRestApp } from 'nodecommons-esm-app-rest';
|
|
5
|
+
import { CommonsAppSocketIoServer } from '../servers/commons-app-socket-io.server.mjs';
|
|
6
|
+
export declare abstract class CommonsSocketIoApp<ServerT extends CommonsAppSocketIoServer> extends CommonsRestApp<ICommonsRequestWithStrictParams, express.Response, CommonsStrictExpressServer> {
|
|
7
|
+
private internalSocketIoServer;
|
|
8
|
+
constructor(name: string, configFile?: string, configPath?: string, // NB, a direct path, not the name of the args parameter
|
|
9
|
+
envVar?: string, argsKey?: string);
|
|
10
|
+
protected abstract buildSocketIoServer(_expressServer: CommonsStrictExpressServer, _expressConfig: ICommonsExpressConfig): ServerT;
|
|
11
|
+
protected get socketIoServer(): ServerT | undefined;
|
|
12
|
+
protected init(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isICommonsExpressConfig } from 'nodecommons-esm-express';
|
|
2
|
+
import { CommonsRestApp } from 'nodecommons-esm-app-rest';
|
|
3
|
+
export class CommonsSocketIoApp extends CommonsRestApp {
|
|
4
|
+
internalSocketIoServer;
|
|
5
|
+
constructor(name, configFile, configPath, // NB, a direct path, not the name of the args parameter
|
|
6
|
+
envVar, argsKey = 'config-path') {
|
|
7
|
+
super(name, 'express', configFile, configPath, envVar, argsKey);
|
|
8
|
+
}
|
|
9
|
+
get socketIoServer() {
|
|
10
|
+
return this.internalSocketIoServer;
|
|
11
|
+
}
|
|
12
|
+
async init() {
|
|
13
|
+
await super.init();
|
|
14
|
+
const expressConfig = this.getConfigArea('express');
|
|
15
|
+
if (!isICommonsExpressConfig(expressConfig))
|
|
16
|
+
throw new Error('Express config is not valid');
|
|
17
|
+
this.internalSocketIoServer = this.buildSocketIoServer(this.httpServer, expressConfig);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=commons-socket-io.app.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons-socket-io.app.mjs","sourceRoot":"","sources":["../../src/apps/commons-socket-io.app.mts"],"names":[],"mappings":"AAKA,OAAO,EAAyB,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI1D,MAAM,OAAgB,kBAA6D,SAAQ,cAI1F;IACQ,sBAAsB,CAAoB;IAElD,YACE,IAAY,EACZ,UAAmB,EACnB,UAAmB,EAAE,wDAAwD;IAC7E,MAAe,EACf,UAAkB,aAAa;QAEhC,KAAK,CACH,IAAI,EACJ,SAAS,EACT,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,CACR,CAAC;IACH,CAAC;IASD,IAAc,cAAc;QAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IAEkB,KAAK,CAAC,IAAI;QAC5B,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QAEnB,MAAM,aAAa,GAAoB,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QACrE,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAE5F,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,CACpD,IAAI,CAAC,UAAU,EACf,aAAa,CACd,CAAC;IACH,CAAC;CACD"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CommonsSocketIoApp } from './apps/commons-socket-io.app.mjs';
|
|
2
|
+
import { CommonsAppSocketIoServer } from './servers/commons-app-socket-io.server.mjs';
|
|
3
|
+
import { ICommonsSocketIoPseudoConfig, isICommonsSocketIoPseudoConfig } from './interfaces/icommons-socket-io-pseudo-config.mjs';
|
|
4
|
+
export { CommonsSocketIoApp, CommonsAppSocketIoServer, ICommonsSocketIoPseudoConfig, isICommonsSocketIoPseudoConfig };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CommonsSocketIoApp } from './apps/commons-socket-io.app.mjs';
|
|
2
|
+
import { CommonsAppSocketIoServer } from './servers/commons-app-socket-io.server.mjs';
|
|
3
|
+
import { isICommonsSocketIoPseudoConfig } from './interfaces/icommons-socket-io-pseudo-config.mjs';
|
|
4
|
+
export { CommonsSocketIoApp, CommonsAppSocketIoServer, isICommonsSocketIoPseudoConfig };
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAgC,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACjI,OAAO,EACN,kBAAkB,EAClB,wBAAwB,EAExB,8BAA8B,EAC9B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { commonsTypeHasPropertyString } from 'tscommons-esm-core';
|
|
2
|
+
export function isICommonsSocketIoPseudoConfig(test) {
|
|
3
|
+
if (!commonsTypeHasPropertyString(test, 'pseudoDomain'))
|
|
4
|
+
return false;
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=icommons-socket-io-pseudo-config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icommons-socket-io-pseudo-config.mjs","sourceRoot":"","sources":["../../src/interfaces/icommons-socket-io-pseudo-config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAMlE,MAAM,UAAU,8BAA8B,CAAC,IAAa;IAC3D,IAAI,CAAC,4BAA4B,CAAC,IAAI,EAAE,cAAc,CAAC;QAAE,OAAO,KAAK,CAAC;IAEtE,OAAO,IAAI,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ServerOptions } from 'socket.io';
|
|
2
|
+
import { CommonsStrictExpressServer, ICommonsExpressConfig } from 'nodecommons-esm-express';
|
|
3
|
+
import { CommonsSocketIoServer } from 'nodecommons-esm-socket-io';
|
|
4
|
+
export declare class CommonsAppSocketIoServer extends CommonsSocketIoServer {
|
|
5
|
+
constructor(expressServer: CommonsStrictExpressServer, expressConfig: ICommonsExpressConfig, defaultEnabled?: boolean, options?: Partial<ServerOptions>);
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CommonsSocketIoServer, commonsSocketIoBuildDefaultOptions } from 'nodecommons-esm-socket-io';
|
|
2
|
+
export class CommonsAppSocketIoServer extends CommonsSocketIoServer {
|
|
3
|
+
constructor(expressServer, expressConfig, defaultEnabled = true, options) {
|
|
4
|
+
super(expressServer.server, defaultEnabled, {
|
|
5
|
+
...commonsSocketIoBuildDefaultOptions(expressConfig),
|
|
6
|
+
...(options || {})
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=commons-app-socket-io.server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commons-app-socket-io.server.mjs","sourceRoot":"","sources":["../../src/servers/commons-app-socket-io.server.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAC;AAEtG,MAAM,OAAO,wBAAyB,SAAQ,qBAAqB;IAClE,YACE,aAAyC,EACzC,aAAoC,EACpC,iBAA0B,IAAI,EAC9B,OAAgC;QAEjC,KAAK,CACH,aAAa,CAAC,MAAM,EACpB,cAAc,EACd;YACE,GAAG,kCAAkC,CAAC,aAAa,CAAC;YACpD,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;SACnB,CACF,CAAC;IACH,CAAC;CACD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nodecommons-esm-app-socket-io",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"tsc": "./node_modules/typescript/bin/tsc",
|
|
7
|
+
"preprepare": "rm -rf ./dist; php ~/Dev/etim.php src/ && npm run tsc",
|
|
8
|
+
"publish-major": "rm -rf dist; npm run tsc && npx eslint . && npm run preprepare && npm version major && npm install && npm publish && git add . && git commit -m 'publish'",
|
|
9
|
+
"publish-minor": "rm -rf dist; npm run tsc && npx eslint . && npm run preprepare && npm version minor && npm install && npm publish && git add . && git commit -m 'publish'",
|
|
10
|
+
"publish-patch": "rm -rf dist; npm run tsc && npx eslint . && npm run preprepare && npm version patch && npm install && npm publish && git add . && git commit -m 'publish'"
|
|
11
|
+
},
|
|
12
|
+
"main": "dist/index.mjs",
|
|
13
|
+
"types": "dist/index.d.mjs",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"author": "Pete Morris",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@stylistic/eslint-plugin-ts": "^2.11.0",
|
|
19
|
+
"@types/node": "^22.10.0",
|
|
20
|
+
"eslint-plugin-import": "^2.31.0",
|
|
21
|
+
"eslint-plugin-prefer-arrow-functions": "^3.4.1",
|
|
22
|
+
"typescript": "^5.7.2",
|
|
23
|
+
"typescript-eslint": "^8.16.0"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/**/*"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@types/express": "^5.0.0",
|
|
30
|
+
"express": "^4.21.2",
|
|
31
|
+
"nodecommons-esm-app-rest": "^0.0.7",
|
|
32
|
+
"nodecommons-esm-express": "^0.0.8",
|
|
33
|
+
"nodecommons-esm-socket-io": "^0.0.2",
|
|
34
|
+
"socket.io": "^4.8.1",
|
|
35
|
+
"tscommons-esm-core": "^0.0.4"
|
|
36
|
+
}
|
|
37
|
+
}
|