@eleven-am/pondsocket-express 0.0.16 → 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,13 +1,11 @@
1
- import type { ConnectionResponse, Endpoint, PondPath, IncomingConnection } from '@eleven-am/pondsocket/types';
2
- import { Express } from 'express';
3
- interface Options {
4
- redisUrl?: string;
5
- db?: number;
6
- }
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>;
7
5
  declare global {
8
6
  namespace Express {
9
7
  interface Application {
10
- 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;
11
9
  }
12
10
  }
13
11
  }
@@ -28,14 +26,13 @@ interface PondSocketExpressApp extends Express {
28
26
  * });
29
27
  * })
30
28
  */
31
- 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;
32
30
  }
33
31
  /**
34
32
  * @desc Creates a pond socket server
35
33
  * @param app - The Express app to be used by the server
36
- * @param redisUrl - The redis url to be used by the server
37
- * @param db - The db number to be used by the server
34
+ * @param redisOptions - The options to be used by the redis client
38
35
  * @constructor
39
36
  */
40
- declare const pondSocket: (app: Express, { redisUrl, db }?: Options) => PondSocketExpressApp;
37
+ declare const pondSocket: (app: Express, redisOptions?: RedisOptions) => PondSocketExpressApp;
41
38
  export default pondSocket;
package/index.js CHANGED
@@ -8,16 +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 redisUrl - The redis url to be used by the server
12
- * @param db - The db number to be used by the server
11
+ * @param redisOptions - The options to be used by the redis client
13
12
  * @constructor
14
13
  */
15
- const pondSocket = (app, { redisUrl, db } = {}) => {
14
+ const pondSocket = (app, redisOptions) => {
16
15
  const server = (0, http_1.createServer)(app);
17
16
  const pondSocket = new pondsocket_1.default({
18
17
  server,
19
- redisUrl,
20
- db,
18
+ redisOptions,
21
19
  });
22
20
  app.upgrade = (path, handler) => pondSocket.createEndpoint(path, handler);
23
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.16",
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.166"
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"}