@ekhein/sekiro-node-client 1.0.8 → 2.0.0
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/chunk-T4Y3R2E6.js +12 -0
- package/dist/chunk-VAHS2LQ5.js +12 -0
- package/dist/{chunk-4IXLXWNL.js → chunk-WBEASVQZ.js} +4 -1
- package/dist/decorators/action.decorator.js +3 -8
- package/dist/decorators/{bootstrap.decorator.cjs → fork.decorator.cjs} +6 -7
- package/dist/decorators/fork.decorator.js +6 -0
- package/dist/decorators/index.cjs +49 -0
- package/dist/decorators/index.d.cts +2 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.js +10 -0
- package/dist/main.cjs +6 -2
- package/dist/main.d.cts +2 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +3 -2
- package/dist/utils/logger.util.cjs +4 -1
- package/dist/utils/logger.util.d.cts +1 -0
- package/dist/utils/logger.util.d.ts +1 -0
- package/dist/utils/logger.util.js +1 -1
- package/package.json +1 -1
- package/dist/decorators/bootstrap.decorator.js +0 -12
- /package/dist/decorators/{bootstrap.decorator.d.cts → fork.decorator.d.cts} +0 -0
- /package/dist/decorators/{bootstrap.decorator.d.ts → fork.decorator.d.ts} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/decorators/action.decorator.ts
|
|
2
|
+
function Action() {
|
|
3
|
+
return function(target, method, descriptor) {
|
|
4
|
+
if (!target.handlers)
|
|
5
|
+
target.handlers = /* @__PURE__ */ new Map();
|
|
6
|
+
target.handlers.set(method, descriptor.value);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
Action
|
|
12
|
+
};
|
|
@@ -6,7 +6,10 @@ var Logger = class {
|
|
|
6
6
|
}
|
|
7
7
|
log(level, message) {
|
|
8
8
|
const time = (/* @__PURE__ */ new Date()).toLocaleString();
|
|
9
|
-
const
|
|
9
|
+
const pid = String(this.context.pid).padStart(2, "0");
|
|
10
|
+
const scope = String(this.context.scope);
|
|
11
|
+
const clientId = String(this.context.clientId);
|
|
12
|
+
const base = format("[%s] [%s] [%s] [%s] [%s]", level, time, scope, pid, clientId);
|
|
10
13
|
switch (level) {
|
|
11
14
|
case "INFO":
|
|
12
15
|
console.info(base, ...message);
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
if (!target.handlers)
|
|
5
|
-
target.handlers = /* @__PURE__ */ new Map();
|
|
6
|
-
target.handlers.set(method, descriptor.value);
|
|
7
|
-
};
|
|
8
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Action
|
|
3
|
+
} from "../chunk-T4Y3R2E6.js";
|
|
9
4
|
export {
|
|
10
5
|
Action
|
|
11
6
|
};
|
|
@@ -17,17 +17,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/decorators/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
20
|
+
// src/decorators/fork.decorator.ts
|
|
21
|
+
var fork_decorator_exports = {};
|
|
22
|
+
__export(fork_decorator_exports, {
|
|
23
23
|
Fork: () => Fork
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(fork_decorator_exports);
|
|
26
26
|
function Fork(count = 1, host, prot, clientId) {
|
|
27
27
|
return function(Client) {
|
|
28
|
-
for (let
|
|
29
|
-
|
|
30
|
-
new Client(group, host, prot, clientId);
|
|
28
|
+
for (let pid = 1; pid <= count; pid++) {
|
|
29
|
+
new Client(Client.name, pid, host, prot, clientId);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
32
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/decorators/index.ts
|
|
21
|
+
var decorators_exports = {};
|
|
22
|
+
__export(decorators_exports, {
|
|
23
|
+
Action: () => Action,
|
|
24
|
+
Fork: () => Fork
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(decorators_exports);
|
|
27
|
+
|
|
28
|
+
// src/decorators/fork.decorator.ts
|
|
29
|
+
function Fork(count = 1, host, prot, clientId) {
|
|
30
|
+
return function(Client) {
|
|
31
|
+
for (let pid = 1; pid <= count; pid++) {
|
|
32
|
+
new Client(Client.name, pid, host, prot, clientId);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/decorators/action.decorator.ts
|
|
38
|
+
function Action() {
|
|
39
|
+
return function(target, method, descriptor) {
|
|
40
|
+
if (!target.handlers)
|
|
41
|
+
target.handlers = /* @__PURE__ */ new Map();
|
|
42
|
+
target.handlers.set(method, descriptor.value);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
Action,
|
|
48
|
+
Fork
|
|
49
|
+
});
|
package/dist/main.cjs
CHANGED
|
@@ -46,7 +46,10 @@ var Logger = class {
|
|
|
46
46
|
}
|
|
47
47
|
log(level, message) {
|
|
48
48
|
const time = (/* @__PURE__ */ new Date()).toLocaleString();
|
|
49
|
-
const
|
|
49
|
+
const pid = String(this.context.pid).padStart(2, "0");
|
|
50
|
+
const scope = String(this.context.scope);
|
|
51
|
+
const clientId = String(this.context.clientId);
|
|
52
|
+
const base = (0, import_util.format)("[%s] [%s] [%s] [%s] [%s]", level, time, scope, pid, clientId);
|
|
50
53
|
switch (level) {
|
|
51
54
|
case "INFO":
|
|
52
55
|
console.info(base, ...message);
|
|
@@ -66,7 +69,7 @@ var Logger = class {
|
|
|
66
69
|
|
|
67
70
|
// src/main.ts
|
|
68
71
|
var SekiroClient = class extends import_partysocket.WebSocket {
|
|
69
|
-
constructor(scope, host = "192.168.2.102", prot = 5612, clientId = (0, import_crypto.randomUUID)().replace(/-/g, "")) {
|
|
72
|
+
constructor(scope, pid, host = "192.168.2.102", prot = 5612, clientId = (0, import_crypto.randomUUID)().replace(/-/g, "")) {
|
|
70
73
|
super("wss://", [], {
|
|
71
74
|
debug: false,
|
|
72
75
|
maxEnqueuedMessages: -1,
|
|
@@ -81,6 +84,7 @@ var SekiroClient = class extends import_partysocket.WebSocket {
|
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
86
|
this.scope = scope;
|
|
87
|
+
this.pid = pid;
|
|
84
88
|
this.host = host;
|
|
85
89
|
this.prot = prot;
|
|
86
90
|
this.clientId = clientId;
|
package/dist/main.d.cts
CHANGED
|
@@ -2,12 +2,13 @@ import { WebSocket } from 'partysocket';
|
|
|
2
2
|
|
|
3
3
|
declare class SekiroClient extends WebSocket {
|
|
4
4
|
readonly scope: string;
|
|
5
|
+
readonly pid: number;
|
|
5
6
|
readonly host: string;
|
|
6
7
|
readonly prot: number;
|
|
7
8
|
readonly clientId: string;
|
|
8
9
|
readonly handlers: Map<string, Function>;
|
|
9
10
|
private readonly logger;
|
|
10
|
-
constructor(scope: string, host?: string, prot?: number, clientId?: string);
|
|
11
|
+
constructor(scope: string, pid: number, host?: string, prot?: number, clientId?: string);
|
|
11
12
|
private onOpen;
|
|
12
13
|
private onClose;
|
|
13
14
|
private onError;
|
package/dist/main.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import { WebSocket } from 'partysocket';
|
|
|
2
2
|
|
|
3
3
|
declare class SekiroClient extends WebSocket {
|
|
4
4
|
readonly scope: string;
|
|
5
|
+
readonly pid: number;
|
|
5
6
|
readonly host: string;
|
|
6
7
|
readonly prot: number;
|
|
7
8
|
readonly clientId: string;
|
|
8
9
|
readonly handlers: Map<string, Function>;
|
|
9
10
|
private readonly logger;
|
|
10
|
-
constructor(scope: string, host?: string, prot?: number, clientId?: string);
|
|
11
|
+
constructor(scope: string, pid: number, host?: string, prot?: number, clientId?: string);
|
|
11
12
|
private onOpen;
|
|
12
13
|
private onClose;
|
|
13
14
|
private onError;
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WBEASVQZ.js";
|
|
4
4
|
import {
|
|
5
5
|
Result
|
|
6
6
|
} from "./chunk-JB43IB4T.js";
|
|
@@ -11,7 +11,7 @@ import { randomUUID } from "crypto";
|
|
|
11
11
|
import { WebSocket } from "partysocket";
|
|
12
12
|
import { WebSocket as Client } from "ws";
|
|
13
13
|
var SekiroClient = class extends WebSocket {
|
|
14
|
-
constructor(scope, host = "192.168.2.102", prot = 5612, clientId = randomUUID().replace(/-/g, "")) {
|
|
14
|
+
constructor(scope, pid, host = "192.168.2.102", prot = 5612, clientId = randomUUID().replace(/-/g, "")) {
|
|
15
15
|
super("wss://", [], {
|
|
16
16
|
debug: false,
|
|
17
17
|
maxEnqueuedMessages: -1,
|
|
@@ -26,6 +26,7 @@ var SekiroClient = class extends WebSocket {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
this.scope = scope;
|
|
29
|
+
this.pid = pid;
|
|
29
30
|
this.host = host;
|
|
30
31
|
this.prot = prot;
|
|
31
32
|
this.clientId = clientId;
|
|
@@ -30,7 +30,10 @@ var Logger = class {
|
|
|
30
30
|
}
|
|
31
31
|
log(level, message) {
|
|
32
32
|
const time = (/* @__PURE__ */ new Date()).toLocaleString();
|
|
33
|
-
const
|
|
33
|
+
const pid = String(this.context.pid).padStart(2, "0");
|
|
34
|
+
const scope = String(this.context.scope);
|
|
35
|
+
const clientId = String(this.context.clientId);
|
|
36
|
+
const base = (0, import_util.format)("[%s] [%s] [%s] [%s] [%s]", level, time, scope, pid, clientId);
|
|
34
37
|
switch (level) {
|
|
35
38
|
case "INFO":
|
|
36
39
|
console.info(base, ...message);
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// src/decorators/bootstrap.decorator.ts
|
|
2
|
-
function Fork(count = 1, host, prot, clientId) {
|
|
3
|
-
return function(Client) {
|
|
4
|
-
for (let i = 1; i <= count; i++) {
|
|
5
|
-
const group = Array(Client.name, i).join("::");
|
|
6
|
-
new Client(group, host, prot, clientId);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
Fork
|
|
12
|
-
};
|
|
File without changes
|
|
File without changes
|