@ocap/util 1.16.14 → 1.16.17
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/constant.d.ts +1 -0
- package/lib/constant.js +4 -3
- package/lib/create-sorted-list.d.ts +1 -0
- package/lib/create-sorted-list.js +10 -6
- package/lib/error.d.ts +8 -0
- package/lib/error.js +11 -11
- package/lib/get-list-field.d.ts +1 -0
- package/lib/get-list-field.js +9 -5
- package/lib/get-related-addr.d.ts +1 -0
- package/lib/get-related-addr.js +4 -2
- package/lib/index.d.ts +217 -69
- package/lib/index.js +351 -419
- package/lib/md5.d.ts +1 -0
- package/lib/md5.js +9 -5
- package/lib/ready.d.ts +11 -0
- package/lib/ready.js +39 -39
- package/package.json +22 -15
package/lib/md5.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const md5: (x: $TSFixMe) => string;
|
package/lib/md5.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.md5 = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const md5 = (x) => crypto_1.default.createHash('md5').update(x).digest('hex');
|
|
9
|
+
exports.md5 = md5;
|
package/lib/ready.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
export declare class Ready extends EventEmitter {
|
|
4
|
+
emit: $TSFixMe;
|
|
5
|
+
ready: $TSFixMe;
|
|
6
|
+
readyCallbacks: $TSFixMe;
|
|
7
|
+
readyMarks: $TSFixMe;
|
|
8
|
+
constructor();
|
|
9
|
+
markReady(mark?: $TSFixMe): void;
|
|
10
|
+
onReady(cb: $TSFixMe): void;
|
|
11
|
+
}
|
package/lib/ready.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
markReady(mark) {
|
|
15
|
-
if (this.ready) {
|
|
16
|
-
return;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Ready = void 0;
|
|
7
|
+
const events_1 = __importDefault(require("events"));
|
|
8
|
+
class Ready extends events_1.default {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.ready = false;
|
|
12
|
+
this.readyCallbacks = [];
|
|
13
|
+
this.readyMarks = {};
|
|
17
14
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
markReady(mark) {
|
|
16
|
+
if (this.ready) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (mark === undefined) {
|
|
20
|
+
this.ready = true;
|
|
21
|
+
this.readyCallbacks.forEach((x) => x());
|
|
22
|
+
this.emit('ready');
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// console.log('Ready.markReady', this.name, mark);
|
|
26
|
+
this.readyMarks[mark] = true;
|
|
27
|
+
this.ready = Object.values(this.readyMarks).every((x) => !!x);
|
|
28
|
+
if (this.ready) {
|
|
29
|
+
this.readyCallbacks.forEach((cb) => cb());
|
|
30
|
+
this.emit('ready');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
onReady(cb) {
|
|
35
|
+
if (this.ready) {
|
|
36
|
+
cb();
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.readyCallbacks.push(cb);
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
|
-
}
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
module.exports = Ready;
|
|
43
|
+
exports.Ready = Ready;
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/util",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.17",
|
|
4
4
|
"description": "utils shared across multiple forge js libs, works in both node.js and browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arcblock",
|
|
7
|
-
"node.js",
|
|
8
7
|
"browser",
|
|
9
8
|
"sdk"
|
|
10
9
|
],
|
|
@@ -13,18 +12,26 @@
|
|
|
13
12
|
},
|
|
14
13
|
"dependencies": {
|
|
15
14
|
"base64-url": "^2.3.3",
|
|
16
|
-
"bn.js": "5.2.
|
|
15
|
+
"bn.js": "5.2.1",
|
|
17
16
|
"bs58": "^5.0.0",
|
|
18
17
|
"lodash": "^4.17.21",
|
|
19
18
|
"utf8": "^3.0.0"
|
|
20
19
|
},
|
|
21
20
|
"resolutions": {
|
|
22
|
-
"bn.js": "5.2.
|
|
21
|
+
"bn.js": "5.2.1",
|
|
23
22
|
"elliptic": "6.5.3"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"@arcblock/eslint-config-ts": "0.2.2",
|
|
26
|
+
"@types/base64-url": "^2.2.0",
|
|
27
|
+
"@types/jest": "^28.1.0",
|
|
28
|
+
"@types/lodash": "^4.14.182",
|
|
29
|
+
"@types/node": "^17.0.38",
|
|
30
|
+
"@types/utf8": "^3.0.1",
|
|
31
|
+
"eslint": "^8.17.0",
|
|
32
|
+
"jest": "^28.1.0",
|
|
33
|
+
"ts-jest": "^28.0.3",
|
|
34
|
+
"typescript": "^4.7.3"
|
|
28
35
|
},
|
|
29
36
|
"author": {
|
|
30
37
|
"name": "wangshijun",
|
|
@@ -37,6 +44,7 @@
|
|
|
37
44
|
"homepage": "https://github.com/ArcBlock/asset-chain/tree/master/core/forge-util",
|
|
38
45
|
"license": "Apache-2.0",
|
|
39
46
|
"main": "lib/index.js",
|
|
47
|
+
"typings": "lib/index.d.ts",
|
|
40
48
|
"files": [
|
|
41
49
|
"lib"
|
|
42
50
|
],
|
|
@@ -45,18 +53,17 @@
|
|
|
45
53
|
"url": "git+https://github.com/ArcBlock/asset-chain.git"
|
|
46
54
|
},
|
|
47
55
|
"scripts": {
|
|
48
|
-
"lint": "eslint
|
|
49
|
-
"lint:fix": "
|
|
50
|
-
"docs": "yarn gen-dts && yarn gen-docs && yarn cleanup-docs && yarn format-docs",
|
|
51
|
-
"cleanup-docs": "node ../../scripts/cleanup-docs.js docs/README.md $npm_package_name",
|
|
52
|
-
"gen-docs": "jsdoc2md lib/index.js > docs/README.md",
|
|
53
|
-
"gen-dts": "j2d lib/index.js",
|
|
54
|
-
"format-docs": "remark . -o",
|
|
56
|
+
"lint": "eslint src tests",
|
|
57
|
+
"lint:fix": "npm run lint -- --fix",
|
|
55
58
|
"test": "jest --forceExit --detectOpenHandles",
|
|
56
|
-
"coverage": "yarn test -- --coverage"
|
|
59
|
+
"coverage": "yarn test -- --coverage",
|
|
60
|
+
"clean": "rm -fr lib",
|
|
61
|
+
"prebuild": "npm run clean",
|
|
62
|
+
"build": "tsc",
|
|
63
|
+
"build:watch": "npm run build -- -w"
|
|
57
64
|
},
|
|
58
65
|
"bugs": {
|
|
59
66
|
"url": "https://github.com/ArcBlock/asset-chain/issues"
|
|
60
67
|
},
|
|
61
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "489ce5e03bce27ddcd535390228b11ab56e7a2e3"
|
|
62
69
|
}
|