@eleven-am/pondsocket-express 0.0.17 → 0.0.18

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 CHANGED
@@ -1,9 +1,11 @@
1
- import type { ConnectionResponse, Endpoint, PondPath, IncomingConnection } from '@eleven-am/pondsocket/types';
2
- import { Express } from 'express';
1
+ import type { ConnectionResponse, Endpoint, RedisOptions } from '@eleven-am/pondsocket/types';
2
+ import { PondPath, IncomingConnection } from '@eleven-am/pondsocket-common';
3
+ import type { Express } from 'express';
4
+ type ExpressUpgradeHandler<Path extends string> = (request: IncomingConnection<Path>, response: ConnectionResponse) => void | Promise<void>;
3
5
  declare global {
4
6
  namespace Express {
5
7
  interface Application {
6
- upgrade<Path extends string>(path: PondPath<Path>, handler: (request: IncomingConnection<Path>, response: ConnectionResponse) => void | Promise<void>): Endpoint;
8
+ upgrade<Path extends string>(path: PondPath<Path>, handler: ExpressUpgradeHandler<Path>): Endpoint;
7
9
  }
8
10
  }
9
11
  }
@@ -24,12 +26,13 @@ interface PondSocketExpressApp extends Express {
24
26
  * });
25
27
  * })
26
28
  */
27
- upgrade<Path extends string>(path: PondPath<Path>, handler: (request: IncomingConnection<Path>, response: ConnectionResponse) => void | Promise<void>): Endpoint;
29
+ upgrade<Path extends string>(path: PondPath<Path>, handler: ExpressUpgradeHandler<Path>): Endpoint;
28
30
  }
29
31
  /**
30
32
  * @desc Creates a pond socket server
31
33
  * @param app - The Express app to be used by the server
34
+ * @param redisOptions - The options to be used by the redis client
32
35
  * @constructor
33
36
  */
34
- declare const pondSocket: (app: Express) => PondSocketExpressApp;
37
+ declare const pondSocket: (app: Express, redisOptions?: RedisOptions) => PondSocketExpressApp;
35
38
  export default pondSocket;
package/index.js CHANGED
@@ -8,12 +8,14 @@ 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 redisOptions - The options to be used by the redis client
11
12
  * @constructor
12
13
  */
13
- const pondSocket = (app) => {
14
+ const pondSocket = (app, redisOptions) => {
14
15
  const server = (0, http_1.createServer)(app);
15
16
  const pondSocket = new pondsocket_1.default({
16
17
  server,
18
+ redisOptions,
17
19
  });
18
20
  app.upgrade = (path, handler) => pondSocket.createEndpoint(path, handler);
19
21
  app.listen = (...args) => pondSocket.listen(...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eleven-am/pondsocket-express",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "PondSocket is a fast simple socket server",
5
5
  "keywords": [
6
6
  "socket",
@@ -29,20 +29,21 @@
29
29
  "pipeline": "npm run lint && npm run build && npm run push"
30
30
  },
31
31
  "dependencies": {
32
- "@eleven-am/pondsocket": "^0.1.169"
32
+ "@eleven-am/pondsocket-common": "^0.0.24",
33
+ "@eleven-am/pondsocket": "^0.1.170"
33
34
  },
34
35
  "devDependencies": {
35
- "@types/jest": "^29.5.12",
36
- "@types/express": "^4.17.21",
37
- "@typescript-eslint/eslint-plugin": "^7.16.1",
38
- "eslint-plugin-file-progress": "^1.4.0",
39
- "eslint-plugin-import": "^2.29.1",
36
+ "@types/jest": "^29.5.13",
37
+ "@types/express": "^5.0.0",
38
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
39
+ "eslint-plugin-file-progress": "^1.5.0",
40
+ "eslint-plugin-import": "^2.30.0",
40
41
  "jest": "^29.7.0",
41
42
  "prettier": "^3.3.3",
42
- "ts-jest": "^29.2.3",
43
+ "ts-jest": "^29.2.5",
43
44
  "ts-loader": "^9.5.1",
44
45
  "ts-node": "^10.9.2",
45
- "typescript": "^5.5.3"
46
+ "typescript": "^5.6.2"
46
47
  },
47
48
  "jest": {
48
49
  "moduleFileExtensions": [
@@ -0,0 +1 @@
1
+ {"root":["../src/index.ts"],"version":"5.6.2"}