@feathersjs/socketio 5.0.0-pre.2 → 5.0.0-pre.22

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/CHANGELOG.md CHANGED
@@ -3,6 +3,186 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-pre.22](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.21...v5.0.0-pre.22) (2022-05-24)
7
+
8
+ **Note:** Version bump only for package @feathersjs/socketio
9
+
10
+
11
+
12
+
13
+
14
+ # [5.0.0-pre.21](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.20...v5.0.0-pre.21) (2022-05-23)
15
+
16
+ **Note:** Version bump only for package @feathersjs/socketio
17
+
18
+
19
+
20
+
21
+
22
+ # [5.0.0-pre.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
28
+
29
+
30
+
31
+
32
+
33
+ # [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
34
+
35
+
36
+ ### Features
37
+
38
+ * **typescript:** Improve params and query typeability ([#2600](https://github.com/feathersjs/feathers/issues/2600)) ([df28b76](https://github.com/feathersjs/feathers/commit/df28b7619161f1df5e700326f52cca1a92dc5d28))
39
+
40
+
41
+
42
+
43
+
44
+ # [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
45
+
46
+ **Note:** Version bump only for package @feathersjs/socketio
47
+
48
+
49
+
50
+
51
+
52
+ # [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
53
+
54
+ **Note:** Version bump only for package @feathersjs/socketio
55
+
56
+
57
+
58
+
59
+
60
+ # [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
61
+
62
+ **Note:** Version bump only for package @feathersjs/socketio
63
+
64
+
65
+
66
+
67
+
68
+ # [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
74
+
75
+
76
+
77
+
78
+
79
+ # [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
80
+
81
+ **Note:** Version bump only for package @feathersjs/socketio
82
+
83
+
84
+
85
+
86
+
87
+ # [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
88
+
89
+ **Note:** Version bump only for package @feathersjs/socketio
90
+
91
+
92
+
93
+
94
+
95
+ # [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
96
+
97
+ **Note:** Version bump only for package @feathersjs/socketio
98
+
99
+
100
+
101
+
102
+
103
+ # [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
104
+
105
+ **Note:** Version bump only for package @feathersjs/socketio
106
+
107
+
108
+
109
+
110
+
111
+ # [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
112
+
113
+ **Note:** Version bump only for package @feathersjs/socketio
114
+
115
+
116
+
117
+
118
+
119
+ # [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
120
+
121
+ **Note:** Version bump only for package @feathersjs/socketio
122
+
123
+
124
+
125
+
126
+
127
+ # [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
128
+
129
+ **Note:** Version bump only for package @feathersjs/socketio
130
+
131
+
132
+
133
+
134
+
135
+ # [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
136
+
137
+ **Note:** Version bump only for package @feathersjs/socketio
138
+
139
+
140
+
141
+
142
+
143
+ # [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
144
+
145
+ **Note:** Version bump only for package @feathersjs/socketio
146
+
147
+
148
+
149
+
150
+
151
+ # [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
152
+
153
+
154
+ ### Features
155
+
156
+ * **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f))
157
+
158
+
159
+
160
+
161
+
162
+ # [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
163
+
164
+ **Note:** Version bump only for package @feathersjs/socketio
165
+
166
+
167
+
168
+
169
+
170
+ # [5.0.0-pre.3](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.2...v5.0.0-pre.3) (2021-04-21)
171
+
172
+
173
+ ### Bug Fixes
174
+
175
+ * **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
176
+
177
+
178
+ ### Features
179
+
180
+ * **dependencies:** Remove direct debug dependency ([#2296](https://github.com/feathersjs/feathers/issues/2296)) ([501d416](https://github.com/feathersjs/feathers/commit/501d4164d30c6a126906dc640cdfdc82207ba34a))
181
+
182
+
183
+
184
+
185
+
6
186
  # [5.0.0-pre.2](https://github.com/feathersjs/feathers/compare/v5.0.0-beta.1...v5.0.0-pre.2) (2021-04-06)
7
187
 
8
188
  **Note:** Version bump only for package @feathersjs/socketio
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Feathers
3
+ Copyright (c) 2022 Feathers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @feathersjs/socketio
2
2
 
3
3
  [![CI](https://github.com/feathersjs/feathers/workflows/CI/badge.svg)](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
4
- [![Dependency Status](https://img.shields.io/david/feathersjs/feathers.svg?style=flat-square&path=packages/socketio)](https://david-dm.org/feathersjs/feathers?path=packages/socketio)
5
4
  [![Download Status](https://img.shields.io/npm/dm/@feathersjs/socketio.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/socketio)
5
+ [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/qa8kez8QBx)
6
6
 
7
7
  > The Feathers Socket.io real-time API provider
8
8
 
@@ -18,6 +18,6 @@ Refer to the [Feathers SocketIO API documentation](https://docs.feathersjs.com/a
18
18
 
19
19
  ## License
20
20
 
21
- Copyright (c) 2021 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
21
+ Copyright (c) 2022 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
22
22
 
23
23
  Licensed under the [MIT license](LICENSE).
package/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" />
2
- import { Server, ServerOptions } from 'socket.io';
3
2
  import http from 'http';
3
+ import { Server, ServerOptions } from 'socket.io';
4
4
  import { Application } from '@feathersjs/feathers';
5
5
  declare module '@feathersjs/feathers/lib/declarations' {
6
- interface Application<ServiceTypes, AppSettings> {
6
+ interface Application<Services, Settings> {
7
7
  io: Server;
8
8
  listen(options: any): Promise<http.Server>;
9
9
  }
package/lib/index.js CHANGED
@@ -1,22 +1,13 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
14
- const debug_1 = __importDefault(require("debug"));
15
- const socket_io_1 = require("socket.io");
16
5
  const http_1 = __importDefault(require("http"));
6
+ const socket_io_1 = require("socket.io");
7
+ const commons_1 = require("@feathersjs/commons");
17
8
  const transport_commons_1 = require("@feathersjs/transport-commons");
18
9
  const middleware_1 = require("./middleware");
19
- const debug = debug_1.default('@feathersjs/socketio');
10
+ const debug = (0, commons_1.createDebug)('@feathersjs/socketio');
20
11
  function configureSocketio(port, options, config) {
21
12
  if (typeof port !== 'number') {
22
13
  config = options;
@@ -37,41 +28,37 @@ function configureSocketio(port, options, config) {
37
28
  const done = new Promise(resolve => {
38
29
  const { listen, setup } = app;
39
30
  Object.assign(app, {
40
- listen(...args) {
41
- return __awaiter(this, void 0, void 0, function* () {
42
- if (typeof listen === 'function') {
43
- // If `listen` already exists
44
- // usually the case when the app has been expressified
45
- return listen.call(this, ...args);
46
- }
47
- const server = http_1.default.createServer();
48
- yield this.setup(server);
49
- return server.listen(...args);
50
- });
31
+ async listen(...args) {
32
+ if (typeof listen === 'function') {
33
+ // If `listen` already exists
34
+ // usually the case when the app has been expressified
35
+ return listen.call(this, ...args);
36
+ }
37
+ const server = http_1.default.createServer();
38
+ await this.setup(server);
39
+ return server.listen(...args);
51
40
  },
52
- setup(server, ...rest) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- if (!this.io) {
55
- const io = this.io = new socket_io_1.Server(port || server, options);
56
- io.use(middleware_1.disconnect(app, getParams));
57
- io.use(middleware_1.params(app, socketMap));
58
- io.use(middleware_1.authentication(app, getParams));
59
- // In Feathers it is easy to hit the standard Node warning limit
60
- // of event listeners (e.g. by registering 10 services).
61
- // So we set it to a higher number. 64 should be enough for everyone.
62
- io.sockets.setMaxListeners(64);
63
- }
64
- if (typeof config === 'function') {
65
- debug('Calling SocketIO configuration function');
66
- config.call(this, this.io);
67
- }
68
- resolve(this.io);
69
- return setup.call(this, server, ...rest);
70
- });
41
+ async setup(server, ...rest) {
42
+ if (!this.io) {
43
+ const io = this.io = new socket_io_1.Server(port || server, options);
44
+ io.use((0, middleware_1.disconnect)(app, getParams));
45
+ io.use((0, middleware_1.params)(app, socketMap));
46
+ io.use((0, middleware_1.authentication)(app, getParams));
47
+ // In Feathers it is easy to hit the standard Node warning limit
48
+ // of event listeners (e.g. by registering 10 services).
49
+ // So we set it to a higher number. 64 should be enough for everyone.
50
+ io.sockets.setMaxListeners(64);
51
+ }
52
+ if (typeof config === 'function') {
53
+ debug('Calling SocketIO configuration function');
54
+ config.call(this, this.io);
55
+ }
56
+ resolve(this.io);
57
+ return setup.call(this, server, ...rest);
71
58
  }
72
59
  });
73
60
  });
74
- app.configure(transport_commons_1.socket({
61
+ app.configure((0, transport_commons_1.socket)({
75
62
  done,
76
63
  socketMap,
77
64
  getParams,
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"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,EAAE,GAAG,IAAW;oBACzD,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE;wBACZ,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,kBAAM,CAAC,IAAI,IAAI,MAAM,EAAE,OAAO,CAAC,CAAC;wBAEzD,EAAE,CAAC,GAAG,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;wBACnC,EAAE,CAAC,GAAG,CAAC,IAAA,mBAAM,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;wBAC/B,EAAE,CAAC,GAAG,CAAC,IAAA,2BAAc,EAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;wBAEvC,gEAAgE;wBAChE,wDAAwD;wBACxD,qEAAqE;wBACrE,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;qBAChC;oBAED,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;wBAChC,KAAK,CAAC,yCAAyC,CAAC,CAAC;wBACjD,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;qBAC5B;oBAED,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAEjB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;gBAC3C,CAAC;aACF,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,SAAS,CAAC,IAAA,0BAAM,EAAC;YACnB,IAAI;YACJ,SAAS;YACT,SAAS;YACT,IAAI,EAAE,MAAM;SACb,CAAC,CAAC,CAAC;IACN,CAAC,CAAC;AACJ,CAAC;AAED,iBAAS,iBAAiB,CAAC"}
@@ -3,7 +3,9 @@ import { Socket } from 'socket.io';
3
3
  export declare type ParamsGetter = (socket: Socket) => any;
4
4
  export declare type NextFunction = (err?: any) => void;
5
5
  export interface FeathersSocket extends Socket {
6
- feathers?: Params;
6
+ feathers?: Params & {
7
+ [key: string]: any;
8
+ };
7
9
  }
8
10
  export declare const disconnect: (app: Application, getParams: ParamsGetter) => (socket: FeathersSocket, next: NextFunction) => void;
9
11
  export declare const params: (_app: Application, socketMap: WeakMap<any, any>) => (socket: FeathersSocket, next: NextFunction) => void;
package/lib/middleware.js CHANGED
@@ -1,20 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
2
  Object.defineProperty(exports, "__esModule", { value: true });
15
3
  exports.authentication = exports.params = exports.disconnect = void 0;
16
- const debug_1 = __importDefault(require("debug"));
17
- const debug = debug_1.default('@feathersjs/socketio/middleware');
4
+ const commons_1 = require("@feathersjs/commons");
5
+ const debug = (0, commons_1.createDebug)('@feathersjs/socketio/middleware');
18
6
  const disconnect = (app, getParams) => (socket, next) => {
19
7
  socket.once('disconnect', () => app.emit('disconnect', getParams(socket)));
20
8
  next();
@@ -40,17 +28,17 @@ const authentication = (app, getParams, settings = {}) => (socket, next) => {
40
28
  return next();
41
29
  }
42
30
  service.parse(socket.handshake, null, ...authStrategies)
43
- .then((authentication) => __awaiter(void 0, void 0, void 0, function* () {
31
+ .then(async (authentication) => {
44
32
  if (authentication) {
45
33
  debug('Parsed authentication from HTTP header', authentication);
46
34
  socket.feathers.authentication = authentication;
47
- yield service.create(authentication, {
35
+ await service.create(authentication, {
48
36
  provider: 'socketio',
49
37
  connection: getParams(socket)
50
38
  });
51
39
  }
52
40
  next();
53
- })).catch(next);
41
+ }).catch(next);
54
42
  };
55
43
  exports.authentication = authentication;
56
44
  //# sourceMappingURL=middleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAA0B;AAG1B,MAAM,KAAK,GAAG,eAAK,CAAC,iCAAiC,CAAC,CAAC;AAQhD,MAAM,UAAU,GAAG,CAAC,GAAgB,EAAE,SAAuB,EAAE,EAAE,CACtE,CAAC,MAAsB,EAAE,IAAkB,EAAE,EAAE;IAC7C,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,CAAC;AACT,CAAC,CAAA;AAJU,QAAA,UAAU,cAIpB;AAEI,MAAM,MAAM,GAAG,CAAC,IAAiB,EAAE,SAA4B,EAAE,EAAE,CACxE,CAAC,MAAsB,EAAE,IAAkB,EAAE,EAAE;IAC7C,MAAM,CAAC,QAAQ,GAAG;QAChB,QAAQ,EAAE,UAAU;QACpB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,OAAO;KAClC,CAAC;IAEF,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAEvC,IAAI,EAAE,CAAC;AACT,CAAC,CAAA;AAVU,QAAA,MAAM,UAUhB;AAEI,MAAM,cAAc,GAAG,CAAC,GAAgB,EAAE,SAAuB,EAAE,WAAgB,EAAE,EAAE,EAAE,CAC9F,CAAC,MAAsB,EAAE,IAAkB,EAAE,EAAE;IAC7C,MAAM,OAAO,GAAI,GAAW,CAAC,qBAAqB,CAAC,CAAC,CAAE,GAAW,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAC,CA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AQ,CAAC,cAAc,GAAG,cAAc,CAAC;YAChD,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE;gBACnC,QAAQ,EAAE,UAAU;gBACpB,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC;aAC9B,CAAC,CAAC;SACJ;QAED,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC,CAAA;AA5BU,QAAA,cAAc,kBA4BxB"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@feathersjs/socketio",
3
3
  "description": "The Feathers Socket.io real-time API provider",
4
- "version": "5.0.0-pre.2",
4
+ "version": "5.0.0-pre.22",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
+ "types": "lib/",
7
8
  "keywords": [
8
9
  "feathers",
9
10
  "feathers-plugin"
@@ -15,7 +16,8 @@
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",
18
- "url": "git://github.com/feathersjs/feathers.git"
19
+ "url": "git://github.com/feathersjs/feathers.git",
20
+ "directory": "packages/socketio"
19
21
  },
20
22
  "author": {
21
23
  "name": "Feathers contributors",
@@ -50,23 +52,22 @@
50
52
  "access": "public"
51
53
  },
52
54
  "dependencies": {
53
- "@feathersjs/transport-commons": "^5.0.0-pre.2",
54
- "debug": "^4.3.1",
55
- "socket.io": "^4.0.1"
55
+ "@feathersjs/commons": "^5.0.0-pre.22",
56
+ "@feathersjs/feathers": "^5.0.0-pre.22",
57
+ "@feathersjs/transport-commons": "^5.0.0-pre.22",
58
+ "socket.io": "^4.5.0"
56
59
  },
57
60
  "devDependencies": {
58
- "@feathersjs/adapter-memory": "^5.0.0-pre.2",
59
- "@feathersjs/commons": "^5.0.0-pre.2",
60
- "@feathersjs/express": "^5.0.0-pre.2",
61
- "@feathersjs/feathers": "^5.0.0-pre.2",
62
- "@feathersjs/tests": "^5.0.0-pre.2",
63
- "@types/mocha": "^8.2.2",
64
- "@types/node": "^14.14.37",
61
+ "@feathersjs/express": "^5.0.0-pre.22",
62
+ "@feathersjs/memory": "^5.0.0-pre.22",
63
+ "@feathersjs/tests": "^5.0.0-pre.22",
64
+ "@types/mocha": "^9.1.1",
65
+ "@types/node": "^17.0.31",
65
66
  "lodash": "^4.17.21",
66
- "mocha": "^8.3.2",
67
- "shx": "^0.3.3",
68
- "socket.io-client": "^4.0.1",
69
- "typescript": "^4.2.3"
67
+ "mocha": "^10.0.0",
68
+ "shx": "^0.3.4",
69
+ "socket.io-client": "^4.5.0",
70
+ "typescript": "^4.6.4"
70
71
  },
71
- "gitHead": "6e1f888dc5b612d2d77653177622e3f66245a0fb"
72
+ "gitHead": "e452e02063e6d8943a9cae2315ab585bc4f82fb6"
72
73
  }
package/src/index.ts CHANGED
@@ -1,15 +1,15 @@
1
- import Debug from 'debug';
2
- import { Server, ServerOptions } from 'socket.io';
3
1
  import http from 'http';
2
+ import { Server, ServerOptions } from 'socket.io';
3
+ import { createDebug } from '@feathersjs/commons';
4
4
  import { Application } from '@feathersjs/feathers';
5
5
  import { socket } from '@feathersjs/transport-commons';
6
6
 
7
7
  import { disconnect, params, authentication, FeathersSocket } from './middleware';
8
8
 
9
- const debug = Debug('@feathersjs/socketio');
9
+ const debug = createDebug('@feathersjs/socketio');
10
10
 
11
11
  declare module '@feathersjs/feathers/lib/declarations' {
12
- interface Application<ServiceTypes, AppSettings> { // eslint-disable-line
12
+ interface Application<Services, Settings> { // eslint-disable-line
13
13
  io: Server;
14
14
  listen (options: any): Promise<http.Server>;
15
15
  }
package/src/middleware.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { Application, Params } from '@feathersjs/feathers';
2
- import Debug from 'debug';
2
+ import { createDebug } from '@feathersjs/commons';
3
3
  import { Socket } from 'socket.io';
4
4
 
5
- const debug = Debug('@feathersjs/socketio/middleware');
5
+ const debug = createDebug('@feathersjs/socketio/middleware');
6
6
 
7
7
  export type ParamsGetter = (socket: Socket) => any;
8
8
  export type NextFunction = (err?: any) => void;
9
9
  export interface FeathersSocket extends Socket {
10
- feathers?: Params
10
+ feathers?: Params & { [key: string]: any }
11
11
  }
12
12
 
13
13
  export const disconnect = (app: Application, getParams: ParamsGetter) =>