ddan-js 2.8.0 → 2.8.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/bin/ddan-js.esm.js +1 -1
- package/bin/ddan-js.js +1 -1
- package/bin/lib/class/kvalue.js +4 -1
- package/bin/lib/index.js +2 -1
- package/bin/lib/modules/crypto/tea.js +2 -1
- package/bin/lib/modules/hook/log.js +27 -3
- package/bin/types/class/kvalue.d.ts +1 -0
- package/bin/types/index.d.ts +12 -5
- package/bin/types/modules/crypto/index.d.ts +1 -0
- package/bin/types/modules/crypto/tea.d.ts +1 -0
- package/bin/types/modules/hook/index.d.ts +4 -2
- package/bin/types/modules/hook/log.d.ts +4 -2
- package/package.json +1 -1
|
@@ -3,8 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const is_1 = require("../../util/is");
|
|
4
4
|
const rsa_web_1 = require("../node/rsa-web");
|
|
5
5
|
const rsa_1 = require("../rsa");
|
|
6
|
+
const tea_1 = require("../crypto/tea");
|
|
7
|
+
const convert_1 = require("../convert");
|
|
6
8
|
const string_1 = require("../string");
|
|
7
|
-
const logString =
|
|
9
|
+
const logString = (data) => {
|
|
10
|
+
try {
|
|
11
|
+
const jsonString = JSON.stringify(data);
|
|
12
|
+
if (jsonString === undefined)
|
|
13
|
+
return '';
|
|
14
|
+
return tea_1.default.encode(jsonString, convert_1.default.hex2str(tea_1.default.TEAKey));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const logParse = (logStr) => {
|
|
21
|
+
try {
|
|
22
|
+
if (!logStr)
|
|
23
|
+
return '';
|
|
24
|
+
const ret = tea_1.default.decode(logStr, convert_1.default.hex2str(tea_1.default.TEAKey));
|
|
25
|
+
return string_1.default.jsonFormat(ret);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const logRString = async (data) => {
|
|
8
32
|
try {
|
|
9
33
|
const jsonString = JSON.stringify(data);
|
|
10
34
|
if (jsonString === undefined)
|
|
@@ -16,7 +40,7 @@ const logString = async (data) => {
|
|
|
16
40
|
return '';
|
|
17
41
|
}
|
|
18
42
|
};
|
|
19
|
-
const
|
|
43
|
+
const logRParse = async (logStr) => {
|
|
20
44
|
try {
|
|
21
45
|
if (!logStr)
|
|
22
46
|
return '';
|
|
@@ -27,4 +51,4 @@ const logParse = async (logStr) => {
|
|
|
27
51
|
return '';
|
|
28
52
|
}
|
|
29
53
|
};
|
|
30
|
-
exports.default = { logString, logParse };
|
|
54
|
+
exports.default = { logString, logParse, logRString, logRParse };
|
package/bin/types/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ declare const dUtil: {
|
|
|
64
64
|
encodeByOss: (input: string) => string;
|
|
65
65
|
};
|
|
66
66
|
tea: {
|
|
67
|
+
TEAKey: string;
|
|
67
68
|
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
68
69
|
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
69
70
|
toTeaKey: (str: string) => Uint32Array;
|
|
@@ -312,8 +313,10 @@ declare const dHook: {
|
|
|
312
313
|
pipe: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/pipeline").default;
|
|
313
314
|
pipeline: (max?: number) => import("./modules/hook/modules/pipeline").default;
|
|
314
315
|
safeTask: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/safeTask").default;
|
|
315
|
-
logString: (data: any) =>
|
|
316
|
-
logParse: (logStr: string) =>
|
|
316
|
+
logString: (data: any) => string;
|
|
317
|
+
logParse: (logStr: string) => string;
|
|
318
|
+
logRString: (data: any) => Promise<string>;
|
|
319
|
+
logRParse: (logStr: string) => Promise<string>;
|
|
317
320
|
to: <T_2 = any, U extends object = any>(promise: Promise<T_2>, errorExt?: object | undefined) => Promise<[null, T_2] | [U, undefined]>;
|
|
318
321
|
go: <T_3 = any>(task?: import("./typings").Ddan.PFunction<T_3> | undefined) => Promise<[any, undefined] | [null, T_3]>;
|
|
319
322
|
delay: (ms?: number) => Promise<unknown>;
|
|
@@ -324,6 +327,7 @@ declare const dHook: {
|
|
|
324
327
|
encodeByOss: (input: string) => string;
|
|
325
328
|
};
|
|
326
329
|
tea: {
|
|
330
|
+
TEAKey: string;
|
|
327
331
|
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
328
332
|
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
329
333
|
toTeaKey: (str: string) => Uint32Array;
|
|
@@ -650,7 +654,7 @@ declare const dNode: {
|
|
|
650
654
|
brotliCompress: typeof import("./modules/node/brotli").brotliCompress;
|
|
651
655
|
brotliDecompress: typeof import("./modules/node/brotli").brotliDecompress;
|
|
652
656
|
};
|
|
653
|
-
export { dUtil, dHook, dWeb, dMini, dCdn, dStore, dJoker, dTracker, dLogger, dNode, KValue, Mapping };
|
|
657
|
+
export { dUtil, dHook, dWeb, dMini, dCdn, dStore, dJoker, dTracker, dLogger, dNode, Event, KValue, Mapping };
|
|
654
658
|
declare const _default: {
|
|
655
659
|
gbk: {
|
|
656
660
|
gbkLength: (str: string) => number;
|
|
@@ -691,8 +695,10 @@ declare const _default: {
|
|
|
691
695
|
pipe: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/pipeline").default;
|
|
692
696
|
pipeline: (max?: number) => import("./modules/hook/modules/pipeline").default;
|
|
693
697
|
safeTask: (func: import("./typings").Ddan.Function, callback?: ((result: import("./typings").Ddan.SafeResult<any>) => void) | undefined) => import("./modules/hook/modules/safeTask").default;
|
|
694
|
-
logString: (data: any) =>
|
|
695
|
-
logParse: (logStr: string) =>
|
|
698
|
+
logString: (data: any) => string;
|
|
699
|
+
logParse: (logStr: string) => string;
|
|
700
|
+
logRString: (data: any) => Promise<string>;
|
|
701
|
+
logRParse: (logStr: string) => Promise<string>;
|
|
696
702
|
to: <T_1 = any, U extends object = any>(promise: Promise<T_1>, errorExt?: object | undefined) => Promise<[null, T_1] | [U, undefined]>;
|
|
697
703
|
go: <T_2 = any>(task?: import("./typings").Ddan.PFunction<T_2> | undefined) => Promise<[any, undefined] | [null, T_2]>;
|
|
698
704
|
delay: (ms?: number) => Promise<unknown>;
|
|
@@ -827,6 +833,7 @@ declare const _default: {
|
|
|
827
833
|
encodeByOss: (input: string) => string;
|
|
828
834
|
};
|
|
829
835
|
tea: {
|
|
836
|
+
TEAKey: string;
|
|
830
837
|
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
831
838
|
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
832
839
|
toTeaKey: (str: string) => Uint32Array;
|
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
encodeByOss: (input: string) => string;
|
|
6
6
|
};
|
|
7
7
|
tea: {
|
|
8
|
+
TEAKey: string;
|
|
8
9
|
encrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
9
10
|
decrypt: (v: Uint32Array, teaKey: Uint32Array) => Uint32Array;
|
|
10
11
|
toTeaKey: (str: string) => Uint32Array;
|
|
@@ -25,8 +25,10 @@ declare const _default: {
|
|
|
25
25
|
pipe: (func: Ddan.Function, callback?: ((result: Ddan.SafeResult<any>) => void) | undefined) => DPipeline;
|
|
26
26
|
pipeline: (max?: number) => DPipeline;
|
|
27
27
|
safeTask: (func: Ddan.Function, callback?: ((result: Ddan.SafeResult<any>) => void) | undefined) => DSafeTask;
|
|
28
|
-
logString: (data: any) =>
|
|
29
|
-
logParse: (logStr: string) =>
|
|
28
|
+
logString: (data: any) => string;
|
|
29
|
+
logParse: (logStr: string) => string;
|
|
30
|
+
logRString: (data: any) => Promise<string>;
|
|
31
|
+
logRParse: (logStr: string) => Promise<string>;
|
|
30
32
|
to: <T = any, U extends object = any>(promise: Promise<T>, errorExt?: object | undefined) => Promise<[null, T] | [U, undefined]>;
|
|
31
33
|
go: <T_1 = any>(task?: Ddan.PFunction<T_1> | undefined) => Promise<[any, undefined] | [null, T_1]>;
|
|
32
34
|
delay: (ms?: number) => Promise<unknown>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
logString: (data: any) =>
|
|
3
|
-
logParse: (logStr: string) =>
|
|
2
|
+
logString: (data: any) => string;
|
|
3
|
+
logParse: (logStr: string) => string;
|
|
4
|
+
logRString: (data: any) => Promise<string>;
|
|
5
|
+
logRParse: (logStr: string) => Promise<string>;
|
|
4
6
|
};
|
|
5
7
|
export default _default;
|