@hapi/nes 14.0.0 → 14.0.1
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/lib/client.d.ts +5 -2
- package/lib/socket.js +3 -3
- package/package.json +9 -13
package/lib/client.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ClientRequestArgs } from "http";
|
|
2
|
+
import type { ClientOptions } from "ws";
|
|
3
|
+
|
|
1
4
|
// Same as exported type in @hapi/hapi v20
|
|
2
5
|
type HTTP_METHODS = 'ACL' | 'BIND' | 'CHECKOUT' | 'CONNECT' | 'COPY' | 'DELETE' | 'GET' | 'HEAD' | 'LINK' | 'LOCK' |
|
|
3
6
|
'M-SEARCH' | 'MERGE' | 'MKACTIVITY' | 'MKCALENDAR' | 'MKCOL' | 'MOVE' | 'NOTIFY' | 'OPTIONS' | 'PATCH' | 'POST' |
|
|
@@ -173,7 +176,7 @@ export class Client {
|
|
|
173
176
|
constructor(
|
|
174
177
|
url: `ws://${string}` | `wss://${string}`,
|
|
175
178
|
options?: {
|
|
176
|
-
ws?:
|
|
179
|
+
ws?: ClientOptions | ClientRequestArgs;
|
|
177
180
|
timeout?: number | boolean;
|
|
178
181
|
});
|
|
179
182
|
|
|
@@ -369,4 +372,4 @@ export class Client {
|
|
|
369
372
|
* `client.connect()`
|
|
370
373
|
*/
|
|
371
374
|
reauthenticate(auth: ClientConnectOptions['auth']): Promise<unknown>;
|
|
372
|
-
}
|
|
375
|
+
}
|
package/lib/socket.js
CHANGED
|
@@ -237,7 +237,7 @@ internals.Socket.prototype._onMessage = async function (message) {
|
|
|
237
237
|
try {
|
|
238
238
|
var request = JSON.parse(message);
|
|
239
239
|
}
|
|
240
|
-
catch
|
|
240
|
+
catch {
|
|
241
241
|
return this._error(Boom.badRequest('Cannot parse message'));
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -563,7 +563,7 @@ internals.Socket.prototype._authenticate = async function (request) {
|
|
|
563
563
|
const auth = await Iron.unseal(request.auth, config.password, config.iron ?? Iron.defaults);
|
|
564
564
|
this._setCredentials(auth);
|
|
565
565
|
}
|
|
566
|
-
catch
|
|
566
|
+
catch {
|
|
567
567
|
throw Boom.unauthorized('Invalid token');
|
|
568
568
|
}
|
|
569
569
|
}
|
|
@@ -585,7 +585,7 @@ internals.Socket.prototype._authByCookie = async function () {
|
|
|
585
585
|
try {
|
|
586
586
|
var { states } = await this.server.states.parse(cookies);
|
|
587
587
|
}
|
|
588
|
-
catch
|
|
588
|
+
catch {
|
|
589
589
|
throw Boom.unauthorized('Invalid nes authentication cookie');
|
|
590
590
|
}
|
|
591
591
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hapi/nes",
|
|
3
3
|
"description": "WebSocket adapter plugin for hapi routes",
|
|
4
|
-
"version": "14.0.
|
|
4
|
+
"version": "14.0.1",
|
|
5
5
|
"repository": "git://github.com/hapijs/nes",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -16,28 +16,24 @@
|
|
|
16
16
|
"plugin",
|
|
17
17
|
"websocket"
|
|
18
18
|
],
|
|
19
|
-
"eslintConfig": {
|
|
20
|
-
"extends": [
|
|
21
|
-
"plugin:@hapi/module"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
19
|
"dependencies": {
|
|
25
20
|
"@hapi/boom": "^10.0.1",
|
|
26
|
-
"@hapi/bounce": "^3.0.
|
|
21
|
+
"@hapi/bounce": "^3.0.2",
|
|
27
22
|
"@hapi/call": "^9.0.1",
|
|
28
23
|
"@hapi/cryptiles": "^6.0.1",
|
|
29
|
-
"@hapi/hoek": "^11.0.
|
|
24
|
+
"@hapi/hoek": "^11.0.7",
|
|
30
25
|
"@hapi/iron": "^7.0.1",
|
|
31
26
|
"@hapi/teamwork": "^6.0.0",
|
|
32
27
|
"@hapi/validate": "^2.0.1",
|
|
33
|
-
"ws": "^8.
|
|
28
|
+
"@types/ws": "^8.5.13",
|
|
29
|
+
"ws": "^8.18.0"
|
|
34
30
|
},
|
|
35
31
|
"devDependencies": {
|
|
36
32
|
"@hapi/code": "^9.0.3",
|
|
37
|
-
"@hapi/eslint-plugin": "
|
|
38
|
-
"@hapi/hapi": "^21.3.
|
|
39
|
-
"@hapi/lab": "^
|
|
40
|
-
"@types/node": "^20.
|
|
33
|
+
"@hapi/eslint-plugin": "^7.0.0",
|
|
34
|
+
"@hapi/hapi": "^21.3.12",
|
|
35
|
+
"@hapi/lab": "^26.0.0",
|
|
36
|
+
"@types/node": "^20.17.12",
|
|
41
37
|
"joi": "^17.13.3",
|
|
42
38
|
"typescript": "^5.4.5"
|
|
43
39
|
},
|