@nocobase/plugin-async-task-manager 1.9.0-beta.5 → 1.9.0-beta.7
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/ISSUES.md +31 -0
- package/dist/client/index.d.ts +17 -4
- package/dist/client/index.js +1 -1
- package/dist/client/locale.d.ts +9 -1
- package/dist/common/collections/asyncTasks.d.ts +25 -0
- package/dist/common/collections/asyncTasks.js +97 -0
- package/dist/common/constants.d.ts +73 -0
- package/dist/common/constants.js +86 -0
- package/dist/common/types.d.ts +11 -0
- package/dist/common/types.js +24 -0
- package/dist/externalVersion.js +7 -5
- package/dist/server/base-task-manager.d.ts +21 -15
- package/dist/server/base-task-manager.js +230 -101
- package/dist/server/collections/asyncTasks.d.ts +11 -0
- package/dist/server/collections/asyncTasks.js +43 -0
- package/dist/server/command-task-type.d.ts +9 -0
- package/dist/server/command-task-type.js +19 -8
- package/dist/server/interfaces/async-task-manager.d.ts +11 -48
- package/dist/server/interfaces/task.d.ts +25 -23
- package/dist/server/interfaces/task.js +28 -0
- package/dist/server/plugin.d.ts +2 -5
- package/dist/server/plugin.js +15 -129
- package/dist/server/resourcers/async-tasks.d.ts +3 -2
- package/dist/server/resourcers/async-tasks.js +44 -27
- package/dist/server/task-type.d.ts +10 -62
- package/dist/server/task-type.js +66 -121
- package/package.json +2 -2
- package/dist/client/TaskResultRendererManager.d.ts +0 -6
- package/dist/node_modules/p-queue/dist/index.d.ts +0 -101
- package/dist/node_modules/p-queue/dist/index.js +0 -1
- package/dist/node_modules/p-queue/dist/lower-bound.d.ts +0 -1
- package/dist/node_modules/p-queue/dist/lower-bound.js +0 -21
- package/dist/node_modules/p-queue/dist/options.d.ts +0 -64
- package/dist/node_modules/p-queue/dist/options.js +0 -2
- package/dist/node_modules/p-queue/dist/priority-queue.d.ts +0 -12
- package/dist/node_modules/p-queue/dist/priority-queue.js +0 -32
- package/dist/node_modules/p-queue/dist/queue.d.ts +0 -7
- package/dist/node_modules/p-queue/dist/queue.js +0 -2
- package/dist/node_modules/p-queue/license +0 -9
- package/dist/node_modules/p-queue/node_modules/eventemitter3/index.d.ts +0 -134
- package/dist/node_modules/p-queue/node_modules/eventemitter3/index.js +0 -336
- package/dist/node_modules/p-queue/node_modules/eventemitter3/package.json +0 -56
- package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.js +0 -340
- package/dist/node_modules/p-queue/node_modules/eventemitter3/umd/eventemitter3.min.js +0 -1
- package/dist/node_modules/p-queue/package.json +0 -1
- package/dist/node_modules/uuid/dist/bin/uuid +0 -2
- package/dist/node_modules/uuid/dist/commonjs-browser/index.js +0 -79
- package/dist/node_modules/uuid/dist/commonjs-browser/md5.js +0 -223
- package/dist/node_modules/uuid/dist/commonjs-browser/native.js +0 -11
- package/dist/node_modules/uuid/dist/commonjs-browser/nil.js +0 -8
- package/dist/node_modules/uuid/dist/commonjs-browser/parse.js +0 -45
- package/dist/node_modules/uuid/dist/commonjs-browser/regex.js +0 -8
- package/dist/node_modules/uuid/dist/commonjs-browser/rng.js +0 -25
- package/dist/node_modules/uuid/dist/commonjs-browser/sha1.js +0 -104
- package/dist/node_modules/uuid/dist/commonjs-browser/stringify.js +0 -44
- package/dist/node_modules/uuid/dist/commonjs-browser/v1.js +0 -107
- package/dist/node_modules/uuid/dist/commonjs-browser/v3.js +0 -16
- package/dist/node_modules/uuid/dist/commonjs-browser/v35.js +0 -80
- package/dist/node_modules/uuid/dist/commonjs-browser/v4.js +0 -43
- package/dist/node_modules/uuid/dist/commonjs-browser/v5.js +0 -16
- package/dist/node_modules/uuid/dist/commonjs-browser/validate.js +0 -17
- package/dist/node_modules/uuid/dist/commonjs-browser/version.js +0 -21
- package/dist/node_modules/uuid/dist/esm-browser/index.js +0 -9
- package/dist/node_modules/uuid/dist/esm-browser/md5.js +0 -215
- package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -4
- package/dist/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/parse.js +0 -35
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +0 -18
- package/dist/node_modules/uuid/dist/esm-browser/sha1.js +0 -96
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +0 -33
- package/dist/node_modules/uuid/dist/esm-browser/v1.js +0 -95
- package/dist/node_modules/uuid/dist/esm-browser/v3.js +0 -4
- package/dist/node_modules/uuid/dist/esm-browser/v35.js +0 -66
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +0 -29
- package/dist/node_modules/uuid/dist/esm-browser/v5.js +0 -4
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +0 -7
- package/dist/node_modules/uuid/dist/esm-browser/version.js +0 -11
- package/dist/node_modules/uuid/dist/esm-node/index.js +0 -9
- package/dist/node_modules/uuid/dist/esm-node/md5.js +0 -13
- package/dist/node_modules/uuid/dist/esm-node/native.js +0 -4
- package/dist/node_modules/uuid/dist/esm-node/nil.js +0 -1
- package/dist/node_modules/uuid/dist/esm-node/parse.js +0 -35
- package/dist/node_modules/uuid/dist/esm-node/regex.js +0 -1
- package/dist/node_modules/uuid/dist/esm-node/rng.js +0 -12
- package/dist/node_modules/uuid/dist/esm-node/sha1.js +0 -13
- package/dist/node_modules/uuid/dist/esm-node/stringify.js +0 -33
- package/dist/node_modules/uuid/dist/esm-node/v1.js +0 -95
- package/dist/node_modules/uuid/dist/esm-node/v3.js +0 -4
- package/dist/node_modules/uuid/dist/esm-node/v35.js +0 -66
- package/dist/node_modules/uuid/dist/esm-node/v4.js +0 -29
- package/dist/node_modules/uuid/dist/esm-node/v5.js +0 -4
- package/dist/node_modules/uuid/dist/esm-node/validate.js +0 -7
- package/dist/node_modules/uuid/dist/esm-node/version.js +0 -11
- package/dist/node_modules/uuid/dist/index.js +0 -1
- package/dist/node_modules/uuid/dist/md5-browser.js +0 -223
- package/dist/node_modules/uuid/dist/md5.js +0 -23
- package/dist/node_modules/uuid/dist/native-browser.js +0 -11
- package/dist/node_modules/uuid/dist/native.js +0 -15
- package/dist/node_modules/uuid/dist/nil.js +0 -8
- package/dist/node_modules/uuid/dist/parse.js +0 -45
- package/dist/node_modules/uuid/dist/regex.js +0 -8
- package/dist/node_modules/uuid/dist/rng-browser.js +0 -25
- package/dist/node_modules/uuid/dist/rng.js +0 -24
- package/dist/node_modules/uuid/dist/sha1-browser.js +0 -104
- package/dist/node_modules/uuid/dist/sha1.js +0 -23
- package/dist/node_modules/uuid/dist/stringify.js +0 -44
- package/dist/node_modules/uuid/dist/uuid-bin.js +0 -85
- package/dist/node_modules/uuid/dist/v1.js +0 -107
- package/dist/node_modules/uuid/dist/v3.js +0 -16
- package/dist/node_modules/uuid/dist/v35.js +0 -80
- package/dist/node_modules/uuid/dist/v4.js +0 -43
- package/dist/node_modules/uuid/dist/v5.js +0 -16
- package/dist/node_modules/uuid/dist/validate.js +0 -17
- package/dist/node_modules/uuid/dist/version.js +0 -21
- package/dist/node_modules/uuid/package.json +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
8
|
-
exports.default = _default;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = rng;
|
|
7
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
8
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
9
|
-
// generators (like Math.random()).
|
|
10
|
-
let getRandomValues;
|
|
11
|
-
const rnds8 = new Uint8Array(16);
|
|
12
|
-
|
|
13
|
-
function rng() {
|
|
14
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
15
|
-
if (!getRandomValues) {
|
|
16
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
17
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
18
|
-
|
|
19
|
-
if (!getRandomValues) {
|
|
20
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return getRandomValues(rnds8);
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = rng;
|
|
7
|
-
|
|
8
|
-
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
|
|
13
|
-
|
|
14
|
-
let poolPtr = rnds8Pool.length;
|
|
15
|
-
|
|
16
|
-
function rng() {
|
|
17
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
18
|
-
_crypto.default.randomFillSync(rnds8Pool);
|
|
19
|
-
|
|
20
|
-
poolPtr = 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
24
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
// Adapted from Chris Veness' SHA1 code at
|
|
9
|
-
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
10
|
-
function f(s, x, y, z) {
|
|
11
|
-
switch (s) {
|
|
12
|
-
case 0:
|
|
13
|
-
return x & y ^ ~x & z;
|
|
14
|
-
|
|
15
|
-
case 1:
|
|
16
|
-
return x ^ y ^ z;
|
|
17
|
-
|
|
18
|
-
case 2:
|
|
19
|
-
return x & y ^ x & z ^ y & z;
|
|
20
|
-
|
|
21
|
-
case 3:
|
|
22
|
-
return x ^ y ^ z;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function ROTL(x, n) {
|
|
27
|
-
return x << n | x >>> 32 - n;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function sha1(bytes) {
|
|
31
|
-
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
32
|
-
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
33
|
-
|
|
34
|
-
if (typeof bytes === 'string') {
|
|
35
|
-
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
36
|
-
|
|
37
|
-
bytes = [];
|
|
38
|
-
|
|
39
|
-
for (let i = 0; i < msg.length; ++i) {
|
|
40
|
-
bytes.push(msg.charCodeAt(i));
|
|
41
|
-
}
|
|
42
|
-
} else if (!Array.isArray(bytes)) {
|
|
43
|
-
// Convert Array-like to Array
|
|
44
|
-
bytes = Array.prototype.slice.call(bytes);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
bytes.push(0x80);
|
|
48
|
-
const l = bytes.length / 4 + 2;
|
|
49
|
-
const N = Math.ceil(l / 16);
|
|
50
|
-
const M = new Array(N);
|
|
51
|
-
|
|
52
|
-
for (let i = 0; i < N; ++i) {
|
|
53
|
-
const arr = new Uint32Array(16);
|
|
54
|
-
|
|
55
|
-
for (let j = 0; j < 16; ++j) {
|
|
56
|
-
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
M[i] = arr;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
63
|
-
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
64
|
-
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
65
|
-
|
|
66
|
-
for (let i = 0; i < N; ++i) {
|
|
67
|
-
const W = new Uint32Array(80);
|
|
68
|
-
|
|
69
|
-
for (let t = 0; t < 16; ++t) {
|
|
70
|
-
W[t] = M[i][t];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
for (let t = 16; t < 80; ++t) {
|
|
74
|
-
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let a = H[0];
|
|
78
|
-
let b = H[1];
|
|
79
|
-
let c = H[2];
|
|
80
|
-
let d = H[3];
|
|
81
|
-
let e = H[4];
|
|
82
|
-
|
|
83
|
-
for (let t = 0; t < 80; ++t) {
|
|
84
|
-
const s = Math.floor(t / 20);
|
|
85
|
-
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
86
|
-
e = d;
|
|
87
|
-
d = c;
|
|
88
|
-
c = ROTL(b, 30) >>> 0;
|
|
89
|
-
b = a;
|
|
90
|
-
a = T;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
H[0] = H[0] + a >>> 0;
|
|
94
|
-
H[1] = H[1] + b >>> 0;
|
|
95
|
-
H[2] = H[2] + c >>> 0;
|
|
96
|
-
H[3] = H[3] + d >>> 0;
|
|
97
|
-
H[4] = H[4] + e >>> 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
var _default = sha1;
|
|
104
|
-
exports.default = _default;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _crypto = _interopRequireDefault(require("crypto"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function sha1(bytes) {
|
|
13
|
-
if (Array.isArray(bytes)) {
|
|
14
|
-
bytes = Buffer.from(bytes);
|
|
15
|
-
} else if (typeof bytes === 'string') {
|
|
16
|
-
bytes = Buffer.from(bytes, 'utf8');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return _crypto.default.createHash('sha1').update(bytes).digest();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
var _default = sha1;
|
|
23
|
-
exports.default = _default;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
exports.unsafeStringify = unsafeStringify;
|
|
8
|
-
|
|
9
|
-
var _validate = _interopRequireDefault(require("./validate.js"));
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
15
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
16
|
-
*/
|
|
17
|
-
const byteToHex = [];
|
|
18
|
-
|
|
19
|
-
for (let i = 0; i < 256; ++i) {
|
|
20
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function unsafeStringify(arr, offset = 0) {
|
|
24
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
25
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
26
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function stringify(arr, offset = 0) {
|
|
30
|
-
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
31
|
-
// of the following:
|
|
32
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
33
|
-
// "undefined" in the uuid)
|
|
34
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
35
|
-
|
|
36
|
-
if (!(0, _validate.default)(uuid)) {
|
|
37
|
-
throw TypeError('Stringified UUID is invalid');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return uuid;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
var _default = stringify;
|
|
44
|
-
exports.default = _default;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _assert = _interopRequireDefault(require("assert"));
|
|
4
|
-
|
|
5
|
-
var _v = _interopRequireDefault(require("./v1.js"));
|
|
6
|
-
|
|
7
|
-
var _v2 = _interopRequireDefault(require("./v3.js"));
|
|
8
|
-
|
|
9
|
-
var _v3 = _interopRequireDefault(require("./v4.js"));
|
|
10
|
-
|
|
11
|
-
var _v4 = _interopRequireDefault(require("./v5.js"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function usage() {
|
|
16
|
-
console.log('Usage:');
|
|
17
|
-
console.log(' uuid');
|
|
18
|
-
console.log(' uuid v1');
|
|
19
|
-
console.log(' uuid v3 <name> <namespace uuid>');
|
|
20
|
-
console.log(' uuid v4');
|
|
21
|
-
console.log(' uuid v5 <name> <namespace uuid>');
|
|
22
|
-
console.log(' uuid --help');
|
|
23
|
-
console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const args = process.argv.slice(2);
|
|
27
|
-
|
|
28
|
-
if (args.indexOf('--help') >= 0) {
|
|
29
|
-
usage();
|
|
30
|
-
process.exit(0);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const version = args.shift() || 'v4';
|
|
34
|
-
|
|
35
|
-
switch (version) {
|
|
36
|
-
case 'v1':
|
|
37
|
-
console.log((0, _v.default)());
|
|
38
|
-
break;
|
|
39
|
-
|
|
40
|
-
case 'v3':
|
|
41
|
-
{
|
|
42
|
-
const name = args.shift();
|
|
43
|
-
let namespace = args.shift();
|
|
44
|
-
(0, _assert.default)(name != null, 'v3 name not specified');
|
|
45
|
-
(0, _assert.default)(namespace != null, 'v3 namespace not specified');
|
|
46
|
-
|
|
47
|
-
if (namespace === 'URL') {
|
|
48
|
-
namespace = _v2.default.URL;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (namespace === 'DNS') {
|
|
52
|
-
namespace = _v2.default.DNS;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
console.log((0, _v2.default)(name, namespace));
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
case 'v4':
|
|
60
|
-
console.log((0, _v3.default)());
|
|
61
|
-
break;
|
|
62
|
-
|
|
63
|
-
case 'v5':
|
|
64
|
-
{
|
|
65
|
-
const name = args.shift();
|
|
66
|
-
let namespace = args.shift();
|
|
67
|
-
(0, _assert.default)(name != null, 'v5 name not specified');
|
|
68
|
-
(0, _assert.default)(namespace != null, 'v5 namespace not specified');
|
|
69
|
-
|
|
70
|
-
if (namespace === 'URL') {
|
|
71
|
-
namespace = _v4.default.URL;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (namespace === 'DNS') {
|
|
75
|
-
namespace = _v4.default.DNS;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
console.log((0, _v4.default)(name, namespace));
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
default:
|
|
83
|
-
usage();
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _rng = _interopRequireDefault(require("./rng.js"));
|
|
9
|
-
|
|
10
|
-
var _stringify = require("./stringify.js");
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
// **`v1()` - Generate time-based UUID**
|
|
15
|
-
//
|
|
16
|
-
// Inspired by https://github.com/LiosK/UUID.js
|
|
17
|
-
// and http://docs.python.org/library/uuid.html
|
|
18
|
-
let _nodeId;
|
|
19
|
-
|
|
20
|
-
let _clockseq; // Previous uuid creation time
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let _lastMSecs = 0;
|
|
24
|
-
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
|
25
|
-
|
|
26
|
-
function v1(options, buf, offset) {
|
|
27
|
-
let i = buf && offset || 0;
|
|
28
|
-
const b = buf || new Array(16);
|
|
29
|
-
options = options || {};
|
|
30
|
-
let node = options.node || _nodeId;
|
|
31
|
-
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
32
|
-
// specified. We do this lazily to minimize issues related to insufficient
|
|
33
|
-
// system entropy. See #189
|
|
34
|
-
|
|
35
|
-
if (node == null || clockseq == null) {
|
|
36
|
-
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
37
|
-
|
|
38
|
-
if (node == null) {
|
|
39
|
-
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
40
|
-
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (clockseq == null) {
|
|
44
|
-
// Per 4.2.2, randomize (14 bit) clockseq
|
|
45
|
-
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
46
|
-
}
|
|
47
|
-
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
48
|
-
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
49
|
-
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
50
|
-
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
54
|
-
// cycle to simulate higher resolution clock
|
|
55
|
-
|
|
56
|
-
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
|
57
|
-
|
|
58
|
-
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
59
|
-
|
|
60
|
-
if (dt < 0 && options.clockseq === undefined) {
|
|
61
|
-
clockseq = clockseq + 1 & 0x3fff;
|
|
62
|
-
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
63
|
-
// time interval
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
67
|
-
nsecs = 0;
|
|
68
|
-
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (nsecs >= 10000) {
|
|
72
|
-
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
_lastMSecs = msecs;
|
|
76
|
-
_lastNSecs = nsecs;
|
|
77
|
-
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
78
|
-
|
|
79
|
-
msecs += 12219292800000; // `time_low`
|
|
80
|
-
|
|
81
|
-
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
82
|
-
b[i++] = tl >>> 24 & 0xff;
|
|
83
|
-
b[i++] = tl >>> 16 & 0xff;
|
|
84
|
-
b[i++] = tl >>> 8 & 0xff;
|
|
85
|
-
b[i++] = tl & 0xff; // `time_mid`
|
|
86
|
-
|
|
87
|
-
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
88
|
-
b[i++] = tmh >>> 8 & 0xff;
|
|
89
|
-
b[i++] = tmh & 0xff; // `time_high_and_version`
|
|
90
|
-
|
|
91
|
-
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
92
|
-
|
|
93
|
-
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
94
|
-
|
|
95
|
-
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
|
96
|
-
|
|
97
|
-
b[i++] = clockseq & 0xff; // `node`
|
|
98
|
-
|
|
99
|
-
for (let n = 0; n < 6; ++n) {
|
|
100
|
-
b[i + n] = node[n];
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return buf || (0, _stringify.unsafeStringify)(b);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var _default = v1;
|
|
107
|
-
exports.default = _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _v = _interopRequireDefault(require("./v35.js"));
|
|
9
|
-
|
|
10
|
-
var _md = _interopRequireDefault(require("./md5.js"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
15
|
-
var _default = v3;
|
|
16
|
-
exports.default = _default;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.URL = exports.DNS = void 0;
|
|
7
|
-
exports.default = v35;
|
|
8
|
-
|
|
9
|
-
var _stringify = require("./stringify.js");
|
|
10
|
-
|
|
11
|
-
var _parse = _interopRequireDefault(require("./parse.js"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function stringToBytes(str) {
|
|
16
|
-
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
17
|
-
|
|
18
|
-
const bytes = [];
|
|
19
|
-
|
|
20
|
-
for (let i = 0; i < str.length; ++i) {
|
|
21
|
-
bytes.push(str.charCodeAt(i));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return bytes;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
28
|
-
exports.DNS = DNS;
|
|
29
|
-
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
30
|
-
exports.URL = URL;
|
|
31
|
-
|
|
32
|
-
function v35(name, version, hashfunc) {
|
|
33
|
-
function generateUUID(value, namespace, buf, offset) {
|
|
34
|
-
var _namespace;
|
|
35
|
-
|
|
36
|
-
if (typeof value === 'string') {
|
|
37
|
-
value = stringToBytes(value);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (typeof namespace === 'string') {
|
|
41
|
-
namespace = (0, _parse.default)(namespace);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
45
|
-
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
46
|
-
} // Compute hash of namespace and value, Per 4.3
|
|
47
|
-
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
48
|
-
// hashfunc([...namespace, ... value])`
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let bytes = new Uint8Array(16 + value.length);
|
|
52
|
-
bytes.set(namespace);
|
|
53
|
-
bytes.set(value, namespace.length);
|
|
54
|
-
bytes = hashfunc(bytes);
|
|
55
|
-
bytes[6] = bytes[6] & 0x0f | version;
|
|
56
|
-
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
57
|
-
|
|
58
|
-
if (buf) {
|
|
59
|
-
offset = offset || 0;
|
|
60
|
-
|
|
61
|
-
for (let i = 0; i < 16; ++i) {
|
|
62
|
-
buf[offset + i] = bytes[i];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return buf;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return (0, _stringify.unsafeStringify)(bytes);
|
|
69
|
-
} // Function#name is not settable on some platforms (#270)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
74
|
-
} catch (err) {} // For CommonJS default export support
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
generateUUID.DNS = DNS;
|
|
78
|
-
generateUUID.URL = URL;
|
|
79
|
-
return generateUUID;
|
|
80
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _native = _interopRequireDefault(require("./native.js"));
|
|
9
|
-
|
|
10
|
-
var _rng = _interopRequireDefault(require("./rng.js"));
|
|
11
|
-
|
|
12
|
-
var _stringify = require("./stringify.js");
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
|
-
function v4(options, buf, offset) {
|
|
17
|
-
if (_native.default.randomUUID && !buf && !options) {
|
|
18
|
-
return _native.default.randomUUID();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
options = options || {};
|
|
22
|
-
|
|
23
|
-
const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
27
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
28
|
-
|
|
29
|
-
if (buf) {
|
|
30
|
-
offset = offset || 0;
|
|
31
|
-
|
|
32
|
-
for (let i = 0; i < 16; ++i) {
|
|
33
|
-
buf[offset + i] = rnds[i];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return buf;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (0, _stringify.unsafeStringify)(rnds);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var _default = v4;
|
|
43
|
-
exports.default = _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _v = _interopRequireDefault(require("./v35.js"));
|
|
9
|
-
|
|
10
|
-
var _sha = _interopRequireDefault(require("./sha1.js"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
|
-
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
15
|
-
var _default = v5;
|
|
16
|
-
exports.default = _default;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _regex = _interopRequireDefault(require("./regex.js"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function validate(uuid) {
|
|
13
|
-
return typeof uuid === 'string' && _regex.default.test(uuid);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var _default = validate;
|
|
17
|
-
exports.default = _default;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _validate = _interopRequireDefault(require("./validate.js"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function version(uuid) {
|
|
13
|
-
if (!(0, _validate.default)(uuid)) {
|
|
14
|
-
throw TypeError('Invalid UUID');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return parseInt(uuid.slice(14, 15), 16);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var _default = version;
|
|
21
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"uuid","version":"9.0.1","description":"RFC4122 (v1, v4, and v5) UUIDs","funding":["https://github.com/sponsors/broofa","https://github.com/sponsors/ctavan"],"commitlint":{"extends":["@commitlint/config-conventional"]},"keywords":["uuid","guid","rfc4122"],"license":"MIT","bin":{"uuid":"./dist/bin/uuid"},"sideEffects":false,"main":"./dist/index.js","exports":{".":{"node":{"module":"./dist/esm-node/index.js","require":"./dist/index.js","import":"./wrapper.mjs"},"browser":{"import":"./dist/esm-browser/index.js","require":"./dist/commonjs-browser/index.js"},"default":"./dist/esm-browser/index.js"},"./package.json":"./package.json"},"module":"./dist/esm-node/index.js","browser":{"./dist/md5.js":"./dist/md5-browser.js","./dist/native.js":"./dist/native-browser.js","./dist/rng.js":"./dist/rng-browser.js","./dist/sha1.js":"./dist/sha1-browser.js","./dist/esm-node/index.js":"./dist/esm-browser/index.js"},"files":["CHANGELOG.md","CONTRIBUTING.md","LICENSE.md","README.md","dist","wrapper.mjs"],"devDependencies":{"@babel/cli":"7.18.10","@babel/core":"7.18.10","@babel/eslint-parser":"7.18.9","@babel/preset-env":"7.18.10","@commitlint/cli":"17.0.3","@commitlint/config-conventional":"17.0.3","bundlewatch":"0.3.3","eslint":"8.21.0","eslint-config-prettier":"8.5.0","eslint-config-standard":"17.0.0","eslint-plugin-import":"2.26.0","eslint-plugin-node":"11.1.0","eslint-plugin-prettier":"4.2.1","eslint-plugin-promise":"6.0.0","husky":"8.0.1","jest":"28.1.3","lint-staged":"13.0.3","npm-run-all":"4.1.5","optional-dev-dependency":"2.0.1","prettier":"2.7.1","random-seed":"0.3.0","runmd":"1.3.9","standard-version":"9.5.0"},"optionalDevDependencies":{"@wdio/browserstack-service":"7.16.10","@wdio/cli":"7.16.10","@wdio/jasmine-framework":"7.16.6","@wdio/local-runner":"7.16.10","@wdio/spec-reporter":"7.16.9","@wdio/static-server-service":"7.16.6"},"scripts":{"examples:browser:webpack:build":"cd examples/browser-webpack && npm install && npm run build","examples:browser:rollup:build":"cd examples/browser-rollup && npm install && npm run build","examples:node:commonjs:test":"cd examples/node-commonjs && npm install && npm test","examples:node:esmodules:test":"cd examples/node-esmodules && npm install && npm test","examples:node:jest:test":"cd examples/node-jest && npm install && npm test","prepare":"cd $( git rev-parse --show-toplevel ) && husky install","lint":"npm run eslint:check && npm run prettier:check","eslint:check":"eslint src/ test/ examples/ *.js","eslint:fix":"eslint --fix src/ test/ examples/ *.js","pretest":"[ -n $CI ] || npm run build","test":"BABEL_ENV=commonjsNode node --throw-deprecation node_modules/.bin/jest test/unit/","pretest:browser":"optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**","test:browser":"wdio run ./wdio.conf.js","pretest:node":"npm run build","test:node":"npm-run-all --parallel examples:node:**","test:pack":"./scripts/testpack.sh","pretest:benchmark":"npm run build","test:benchmark":"cd examples/benchmark && npm install && npm test","prettier:check":"prettier --check '**/*.{js,jsx,json,md}'","prettier:fix":"prettier --write '**/*.{js,jsx,json,md}'","bundlewatch":"npm run pretest:browser && bundlewatch --config bundlewatch.config.json","md":"runmd --watch --output=README.md README_js.md","docs":"( node --version | grep -q 'v18' ) && ( npm run build && npx runmd --output=README.md README_js.md )","docs:diff":"npm run docs && git diff --quiet README.md","build":"./scripts/build.sh","prepack":"npm run build","release":"standard-version --no-verify"},"repository":{"type":"git","url":"https://github.com/uuidjs/uuid.git"},"lint-staged":{"*.{js,jsx,json,md}":["prettier --write"],"*.{js,jsx}":["eslint --fix"]},"standard-version":{"scripts":{"postchangelog":"prettier --write CHANGELOG.md"}},"_lastModified":"2025-07-24T15:16:28.697Z"}
|