wenay-common2 1.0.20 → 1.0.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/lib/client.d.ts +2 -2
- package/lib/client.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/{Common → server}/WebHook3.js +1 -1
- package/lib/server/createSignatureFunction.d.ts +17 -0
- package/lib/server/createSignatureFunction.js +22 -0
- package/lib/{Common → server}/fsKeyVolume.js +2 -2
- package/lib/server.d.ts +3 -2
- package/lib/server.js +3 -2
- package/package.json +1 -1
- package/lib/Common/WebHook2.d.ts +0 -0
- package/lib/Common/WebHook2.js +0 -1
- /package/lib/{Common → server}/WebHook3.d.ts +0 -0
- /package/lib/{Common → server}/fsKeyVolume.d.ts +0 -0
package/lib/client.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ export * from "./Common/events/SocketBuffer";
|
|
|
14
14
|
export * from "./Common/events/SocketServerHook";
|
|
15
15
|
export * from "./Common/events/joinListens";
|
|
16
16
|
export * from "./Common/rcp/rpc-index";
|
|
17
|
-
export * from "./
|
|
17
|
+
export * from "./server/fsKeyVolume";
|
|
18
18
|
export * from "./Common/Color";
|
|
19
19
|
export * from "./Common/funcTimeWait";
|
|
20
20
|
export * from "./Common/id-pool";
|
|
21
21
|
export * from "./Common/inputAutoStep";
|
|
22
22
|
export * from "./Common/node_console";
|
|
23
|
-
export * from "./
|
|
23
|
+
export * from "./server/WebHook3";
|
|
24
24
|
export * from "./Common/Time";
|
|
25
25
|
export * from "./Common/inputAutoStep";
|
|
26
26
|
export * as Math from "./Common/math/Math";
|
package/lib/client.js
CHANGED
|
@@ -53,13 +53,13 @@ __exportStar(require("./Common/events/SocketBuffer"), exports);
|
|
|
53
53
|
__exportStar(require("./Common/events/SocketServerHook"), exports);
|
|
54
54
|
__exportStar(require("./Common/events/joinListens"), exports);
|
|
55
55
|
__exportStar(require("./Common/rcp/rpc-index"), exports);
|
|
56
|
-
__exportStar(require("./
|
|
56
|
+
__exportStar(require("./server/fsKeyVolume"), exports);
|
|
57
57
|
__exportStar(require("./Common/Color"), exports);
|
|
58
58
|
__exportStar(require("./Common/funcTimeWait"), exports);
|
|
59
59
|
__exportStar(require("./Common/id-pool"), exports);
|
|
60
60
|
__exportStar(require("./Common/inputAutoStep"), exports);
|
|
61
61
|
__exportStar(require("./Common/node_console"), exports);
|
|
62
|
-
__exportStar(require("./
|
|
62
|
+
__exportStar(require("./server/WebHook3"), exports);
|
|
63
63
|
__exportStar(require("./Common/Time"), exports);
|
|
64
64
|
__exportStar(require("./Common/inputAutoStep"), exports);
|
|
65
65
|
exports.Math = __importStar(require("./Common/math/Math"));
|
package/lib/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export * from "./Common/events/SocketBuffer";
|
|
|
17
17
|
export * from "./Common/events/SocketServerHook";
|
|
18
18
|
export * from "./Common/events/joinListens";
|
|
19
19
|
export * from "./Common/rcp/rpc-index";
|
|
20
|
-
export * from "./
|
|
20
|
+
export * from "./server/fsKeyVolume";
|
|
21
21
|
export * from "./Common/Color";
|
|
22
22
|
export * from "./Common/funcTimeWait";
|
|
23
23
|
export * from "./Common/id-pool";
|
package/lib/index.js
CHANGED
|
@@ -56,7 +56,7 @@ __exportStar(require("./Common/events/SocketBuffer"), exports);
|
|
|
56
56
|
__exportStar(require("./Common/events/SocketServerHook"), exports);
|
|
57
57
|
__exportStar(require("./Common/events/joinListens"), exports);
|
|
58
58
|
__exportStar(require("./Common/rcp/rpc-index"), exports);
|
|
59
|
-
__exportStar(require("./
|
|
59
|
+
__exportStar(require("./server/fsKeyVolume"), exports);
|
|
60
60
|
__exportStar(require("./Common/Color"), exports);
|
|
61
61
|
__exportStar(require("./Common/funcTimeWait"), exports);
|
|
62
62
|
__exportStar(require("./Common/id-pool"), exports);
|
|
@@ -40,7 +40,7 @@ exports.createWebhookClient = exports.createWebhookServer = exports.apiSaveData
|
|
|
40
40
|
const express_1 = __importDefault(require("express"));
|
|
41
41
|
const axios_1 = __importDefault(require("axios"));
|
|
42
42
|
const fs = __importStar(require("fs"));
|
|
43
|
-
const waitRun_1 = require("
|
|
43
|
+
const waitRun_1 = require("../Common/async/waitRun");
|
|
44
44
|
const SUBSCRIBERS_FILE = './subscribers.json';
|
|
45
45
|
const loadSubscribers = () => {
|
|
46
46
|
try {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type MilliSec = number;
|
|
2
|
+
type tInputBaseR = {
|
|
3
|
+
[key: string]: boolean | number | string | string[];
|
|
4
|
+
};
|
|
5
|
+
export type tInputBase = {
|
|
6
|
+
timestamp?: MilliSec;
|
|
7
|
+
recvWindow?: MilliSec;
|
|
8
|
+
} & tInputBaseR;
|
|
9
|
+
type tSignatureData = tInputBase;
|
|
10
|
+
type HmacCreator = (algorithm: string, key: string) => {
|
|
11
|
+
update: (data: string) => {
|
|
12
|
+
digest: (encoding: string) => unknown;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare function createSignatureFunction<T extends HmacCreator>(hmacCreator: T): (params: tSignatureData, apiSecret: string) => unknown;
|
|
16
|
+
export type SignatureFunction = ReturnType<typeof createSignatureFunction>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSignatureFunction = createSignatureFunction;
|
|
4
|
+
function createSignatureFunction(hmacCreator) {
|
|
5
|
+
return function signRequest(params, apiSecret) {
|
|
6
|
+
const query = Object.keys(params)
|
|
7
|
+
.reduce((accumulator, key) => {
|
|
8
|
+
const value = params[key];
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
value.forEach(v => {
|
|
11
|
+
accumulator.push(key + "=" + encodeURIComponent(v));
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
else if (value !== undefined) {
|
|
15
|
+
accumulator.push(key + "=" + encodeURIComponent(value));
|
|
16
|
+
}
|
|
17
|
+
return accumulator;
|
|
18
|
+
}, [])
|
|
19
|
+
.join("&");
|
|
20
|
+
return hmacCreator('sha256', apiSecret).update(query).digest('hex');
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -35,8 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.saveKeyValue = saveKeyValue;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
|
-
const waitRun_1 = require("
|
|
39
|
-
const Decorator_1 = require("
|
|
38
|
+
const waitRun_1 = require("../Common/async/waitRun");
|
|
39
|
+
const Decorator_1 = require("../Common/core/Decorator");
|
|
40
40
|
function saveKeyValue({ dirDef = "", key: _key = "" }) {
|
|
41
41
|
async function ensureDir(dir) {
|
|
42
42
|
const fullDir = dirDef ? `${dirDef}/${dir}` : dir;
|
package/lib/server.d.ts
CHANGED
package/lib/server.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./index"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./server/fsKeyVolume"), exports);
|
|
19
|
+
__exportStar(require("./server/WebHook3"), exports);
|
|
20
|
+
__exportStar(require("./server/createSignatureFunction"), exports);
|
package/package.json
CHANGED
package/lib/Common/WebHook2.d.ts
DELETED
|
File without changes
|
package/lib/Common/WebHook2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
File without changes
|
|
File without changes
|