@eleven-am/pondsocket-express 0.0.29 → 0.0.31
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/index.d.ts +5 -6
- package/index.js +4 -7
- package/package.json +11 -11
package/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ConnectionContext, Endpoint, PondPath, PondSocketOptions, RequestHandler } from '@eleven-am/pondsocket/types';
|
|
2
2
|
import type { Express } from 'express';
|
|
3
|
-
type ExpressUpgradeHandler<Path extends string> = (request: IncomingConnection<Path>, response: ConnectionResponse) => void | Promise<void>;
|
|
4
3
|
declare global {
|
|
5
4
|
namespace Express {
|
|
6
5
|
interface Application {
|
|
7
|
-
|
|
6
|
+
createEndpoint<Path extends string>(path: PondPath<Path>, handler: RequestHandler<ConnectionContext<Path>>): Endpoint;
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
9
|
}
|
|
@@ -25,13 +24,13 @@ interface PondSocketExpressApp extends Express {
|
|
|
25
24
|
* });
|
|
26
25
|
* })
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
createEndpoint<Path extends string>(path: PondPath<Path>, handler: RequestHandler<ConnectionContext<Path>>): Endpoint;
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* @desc Creates a pond socket server
|
|
32
31
|
* @param app - The Express app to be used by the server
|
|
33
|
-
* @param
|
|
32
|
+
* @param options - The options to be used by the pond socket server
|
|
34
33
|
* @constructor
|
|
35
34
|
*/
|
|
36
|
-
declare const pondSocket: (app: Express,
|
|
35
|
+
declare const pondSocket: (app: Express, options: Omit<PondSocketOptions, "server">) => PondSocketExpressApp;
|
|
37
36
|
export default pondSocket;
|
package/index.js
CHANGED
|
@@ -8,16 +8,13 @@ const pondsocket_1 = __importDefault(require("@eleven-am/pondsocket"));
|
|
|
8
8
|
/**
|
|
9
9
|
* @desc Creates a pond socket server
|
|
10
10
|
* @param app - The Express app to be used by the server
|
|
11
|
-
* @param
|
|
11
|
+
* @param options - The options to be used by the pond socket server
|
|
12
12
|
* @constructor
|
|
13
13
|
*/
|
|
14
|
-
const pondSocket = (app,
|
|
14
|
+
const pondSocket = (app, options) => {
|
|
15
15
|
const server = (0, http_1.createServer)(app);
|
|
16
|
-
const pondSocket = new pondsocket_1.default({
|
|
17
|
-
|
|
18
|
-
redisOptions,
|
|
19
|
-
});
|
|
20
|
-
app.upgrade = (path, handler) => pondSocket.createEndpoint(path, handler);
|
|
16
|
+
const pondSocket = new pondsocket_1.default(Object.assign(Object.assign({}, options), { server }));
|
|
17
|
+
app.createEndpoint = (path, handler) => pondSocket.createEndpoint(path, handler);
|
|
21
18
|
app.listen = (...args) => pondSocket.listen(...args);
|
|
22
19
|
return app;
|
|
23
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eleven-am/pondsocket-express",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "PondSocket is a fast simple socket server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"socket",
|
|
@@ -26,26 +26,26 @@
|
|
|
26
26
|
"lint:fix": "eslint --fix --ext .ts src",
|
|
27
27
|
"copy": "cp package.json dist && cp README.md dist && cp LICENSE dist",
|
|
28
28
|
"push": "npm version patch && npm run copy && cd dist && npm publish && cd ..",
|
|
29
|
-
"pipeline": "npm run lint && npm run build && npm run push"
|
|
29
|
+
"pipeline": "npm run lint:fix && npm run lint && npm run build && npm run push"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@eleven-am/pondsocket": "^0.1.
|
|
32
|
+
"@eleven-am/pondsocket": "^0.1.202"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@eslint/compat": "^1.2.
|
|
35
|
+
"@eslint/compat": "^1.2.9",
|
|
36
36
|
"@eslint/eslintrc": "^3.3.1",
|
|
37
|
-
"@eslint/js": "^9.
|
|
38
|
-
"@stylistic/eslint-plugin-ts": "^4.
|
|
39
|
-
"@types/express": "^5.0.
|
|
37
|
+
"@eslint/js": "^9.28.0",
|
|
38
|
+
"@stylistic/eslint-plugin-ts": "^4.4.1",
|
|
39
|
+
"@types/express": "^5.0.3",
|
|
40
40
|
"@types/jest": "^29.5.14",
|
|
41
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
42
|
-
"eslint": "^9.
|
|
41
|
+
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
|
42
|
+
"eslint": "^9.28.0",
|
|
43
43
|
"eslint-plugin-file-progress": "^3.0.2",
|
|
44
44
|
"eslint-plugin-import": "^2.31.0",
|
|
45
|
-
"globals": "^16.
|
|
45
|
+
"globals": "^16.2.0",
|
|
46
46
|
"jest": "^29.7.0",
|
|
47
47
|
"prettier": "^3.5.3",
|
|
48
|
-
"ts-jest": "^29.3.
|
|
48
|
+
"ts-jest": "^29.3.4",
|
|
49
49
|
"ts-loader": "^9.5.2",
|
|
50
50
|
"ts-node": "^10.9.2",
|
|
51
51
|
"typescript": "^5.8.3"
|