@ekhein/sekiro-node-client 2.0.1 → 2.0.3

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/dist/main.js CHANGED
@@ -1,4 +1,3 @@
1
- import { format } from 'util';
2
1
  import { randomUUID } from 'crypto';
3
2
  import { WebSocket } from 'partysocket';
4
3
  import { WebSocket as Client } from 'ws';
@@ -17,9 +16,9 @@ export class SekiroClient extends WebSocket {
17
16
  maxEnqueuedMessages: -1,
18
17
  WebSocket: class extends Client {
19
18
  constructor() {
20
- const site = format("ws://%s:%s", host, prot);
21
- const wsURL = new URL("/business-demo/register", site);
22
- wsURL.searchParams.append("group", scope);
19
+ const group = String(scope).toLowerCase();
20
+ const wsURL = new URL("/business-demo/register", "ws://" + host + ":" + prot);
21
+ wsURL.searchParams.append("group", group);
23
22
  wsURL.searchParams.append("clientId", clientId);
24
23
  super(wsURL);
25
24
  }
@@ -48,7 +47,10 @@ export class SekiroClient extends WebSocket {
48
47
  this.logger.info("Received request", event.data);
49
48
  const request = JSON.parse(event.data);
50
49
  try {
51
- const data = await this.handlers.get(request.action)?.apply(this, [request]);
50
+ const handler = this.handlers.get(request.action);
51
+ if (!handler)
52
+ throw new Error("No handler for this action");
53
+ const data = await handler.call(this, request.params);
52
54
  const pack = Result.success(request, data);
53
55
  this.send(pack);
54
56
  }
package/package.json CHANGED
@@ -1,24 +1,13 @@
1
1
  {
2
2
  "name": "@ekhein/sekiro-node-client",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "ekhein",
7
7
  "main": "./dist/main.js",
8
8
  "files": [
9
- "dist",
10
- "types"
9
+ "dist"
11
10
  ],
12
- "exports": {
13
- ".": {
14
- "import": "./dist/index.js",
15
- "types": "./dist/index.d.ts"
16
- },
17
- "./decorators": {
18
- "import": "./dist/decorators/index.js",
19
- "types": "./dist/decorators/index.d.ts"
20
- }
21
- },
22
11
  "scripts": {
23
12
  "build": "tsc"
24
13
  },
package/types/sekiro.d.ts DELETED
@@ -1,8 +0,0 @@
1
-
2
- interface ISekiroRequest {
3
- __sekiro_seq__: number
4
- }
5
-
6
- interface ISekiroHandler {
7
- (request: ISekiroRequest): Promise<any>
8
- }