parse 5.2.0-alpha.2 → 5.2.0-alpha.3
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/parse.js +440 -240
- package/dist/parse.min.js +2 -2
- package/dist/parse.weapp.js +440 -240
- package/dist/parse.weapp.min.js +2 -2
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/LiveQueryClient.js +7 -4
- package/lib/node/Analytics.js +3 -3
- package/lib/node/AnonymousUtils.js +3 -3
- package/lib/node/Cloud.js +3 -3
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/EventuallyQueue.js +3 -3
- package/lib/node/FacebookUtils.js +3 -3
- package/lib/node/InstallationController.js +3 -3
- package/lib/node/LiveQueryClient.js +11 -7
- package/lib/node/LiveQuerySubscription.js +3 -3
- package/lib/node/LocalDatastore.js +3 -3
- package/lib/node/LocalDatastoreController.default.js +3 -3
- package/lib/node/LocalDatastoreController.js +3 -3
- package/lib/node/LocalDatastoreController.react-native.js +3 -3
- package/lib/node/ObjectStateMutations.js +3 -3
- package/lib/node/OfflineQuery.js +3 -3
- package/lib/node/Parse.js +3 -3
- package/lib/node/ParseACL.js +3 -3
- package/lib/node/ParseCLP.js +3 -3
- package/lib/node/ParseConfig.js +3 -3
- package/lib/node/ParseError.js +3 -3
- package/lib/node/ParseFile.js +3 -3
- package/lib/node/ParseHooks.js +3 -3
- package/lib/node/ParseInstallation.js +3 -3
- package/lib/node/ParseLiveQuery.js +3 -3
- package/lib/node/ParseObject.js +3 -3
- package/lib/node/ParseOp.js +3 -3
- package/lib/node/ParsePolygon.js +3 -3
- package/lib/node/ParseQuery.js +3 -3
- package/lib/node/ParseRelation.js +3 -3
- package/lib/node/ParseRole.js +3 -3
- package/lib/node/ParseSchema.js +3 -3
- package/lib/node/ParseSession.js +3 -3
- package/lib/node/ParseUser.js +3 -3
- package/lib/node/Push.js +3 -3
- package/lib/node/RESTController.js +3 -3
- package/lib/node/Storage.js +3 -3
- package/lib/node/StorageController.js +3 -3
- package/lib/node/StorageController.react-native.js +3 -3
- package/lib/node/UniqueInstanceStateController.js +3 -3
- package/lib/node/WebSocketController.js +3 -3
- package/lib/node/arrayContainsObject.js +3 -3
- package/lib/node/canBeSerialized.js +3 -3
- package/lib/node/decode.js +3 -3
- package/lib/node/encode.js +3 -3
- package/lib/node/equals.js +3 -3
- package/lib/node/unique.js +3 -3
- package/lib/node/unsavedChildren.js +3 -3
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/LiveQueryClient.js +6 -3
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/LiveQueryClient.js +7 -4
- package/package.json +12 -12
package/dist/parse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Parse JavaScript SDK v5.2.0-alpha.
|
|
2
|
+
* Parse JavaScript SDK v5.2.0-alpha.3
|
|
3
3
|
*
|
|
4
4
|
* The source tree of this library can be found at
|
|
5
5
|
* https://github.com/ParsePlatform/Parse-SDK-JS
|
|
@@ -358,7 +358,7 @@ const config = {
|
|
|
358
358
|
SERVER_AUTH_TOKEN: null,
|
|
359
359
|
LIVEQUERY_SERVER_URL: null,
|
|
360
360
|
ENCRYPTED_KEY: null,
|
|
361
|
-
VERSION: 'js' + "5.2.0-alpha.
|
|
361
|
+
VERSION: 'js' + "5.2.0-alpha.3",
|
|
362
362
|
APPLICATION_ID: null,
|
|
363
363
|
JAVASCRIPT_KEY: null,
|
|
364
364
|
MASTER_KEY: null,
|
|
@@ -1425,6 +1425,8 @@ const SUBSCRIPTION_EMMITER_TYPES = {
|
|
|
1425
1425
|
LEAVE: 'leave',
|
|
1426
1426
|
DELETE: 'delete'
|
|
1427
1427
|
};
|
|
1428
|
+
|
|
1429
|
+
// Exponentially-growing random delay
|
|
1428
1430
|
const generateInterval = k => {
|
|
1429
1431
|
return Math.random() * Math.min(30, Math.pow(2, k) - 1) * 1000;
|
|
1430
1432
|
};
|
|
@@ -1650,7 +1652,8 @@ class LiveQueryClient {
|
|
|
1650
1652
|
const query = subscription.query;
|
|
1651
1653
|
const queryJSON = query.toJSON();
|
|
1652
1654
|
const where = queryJSON.where;
|
|
1653
|
-
const
|
|
1655
|
+
const keys = (0, _keys.default)(queryJSON)?.split(',');
|
|
1656
|
+
const watch = queryJSON.watch?.split(',');
|
|
1654
1657
|
const className = query.className;
|
|
1655
1658
|
const sessionToken = subscription.sessionToken;
|
|
1656
1659
|
const subscribeRequest = {
|
|
@@ -1659,7 +1662,8 @@ class LiveQueryClient {
|
|
|
1659
1662
|
query: {
|
|
1660
1663
|
className,
|
|
1661
1664
|
where,
|
|
1662
|
-
|
|
1665
|
+
keys,
|
|
1666
|
+
watch
|
|
1663
1667
|
},
|
|
1664
1668
|
sessionToken: undefined
|
|
1665
1669
|
};
|
|
@@ -1704,7 +1708,6 @@ class LiveQueryClient {
|
|
|
1704
1708
|
this.subscriptions = new _map.default();
|
|
1705
1709
|
}
|
|
1706
1710
|
_handleWebSocketOpen() {
|
|
1707
|
-
this.attempts = 1;
|
|
1708
1711
|
const connectRequest = {
|
|
1709
1712
|
op: OP_TYPES.CONNECT,
|
|
1710
1713
|
applicationId: this.applicationId,
|
|
@@ -1743,6 +1746,7 @@ class LiveQueryClient {
|
|
|
1743
1746
|
break;
|
|
1744
1747
|
case OP_EVENTS.SUBSCRIBED:
|
|
1745
1748
|
if (subscription) {
|
|
1749
|
+
this.attempts = 1;
|
|
1746
1750
|
subscription.subscribed = true;
|
|
1747
1751
|
subscription.subscribePromise.resolve();
|
|
1748
1752
|
(0, _setTimeout2.default)(() => subscription.emit(SUBSCRIPTION_EMMITER_TYPES.OPEN, response), 200);
|
|
@@ -1846,7 +1850,6 @@ class LiveQueryClient {
|
|
|
1846
1850
|
// we're unable to distinguish different between close/error when we're unable to reconnect therefore
|
|
1847
1851
|
// we try to reconnect in both cases
|
|
1848
1852
|
// server side ws and browser WebSocket behave differently in when close/error get triggered
|
|
1849
|
-
|
|
1850
1853
|
if (this.reconnectHandle) {
|
|
1851
1854
|
clearTimeout(this.reconnectHandle);
|
|
1852
1855
|
}
|
|
@@ -15077,7 +15080,7 @@ try {
|
|
|
15077
15080
|
}
|
|
15078
15081
|
module.exports = WebSocketController;
|
|
15079
15082
|
var _default = exports.default = WebSocketController;
|
|
15080
|
-
},{"./Socket.weapp":42,"@babel/runtime-corejs3/core-js-stable/object/define-property":91,"@babel/runtime-corejs3/helpers/interopRequireDefault":105,"ws":
|
|
15083
|
+
},{"./Socket.weapp":42,"@babel/runtime-corejs3/core-js-stable/object/define-property":91,"@babel/runtime-corejs3/helpers/interopRequireDefault":105,"ws":517}],52:[function(_dereq_,module,exports){
|
|
15081
15084
|
"use strict";
|
|
15082
15085
|
|
|
15083
15086
|
var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
@@ -26363,6 +26366,12 @@ exports.values = values;
|
|
|
26363
26366
|
Object.defineProperty(exports, "__esModule", {
|
|
26364
26367
|
value: true
|
|
26365
26368
|
});
|
|
26369
|
+
Object.defineProperty(exports, "MAX", {
|
|
26370
|
+
enumerable: true,
|
|
26371
|
+
get: function () {
|
|
26372
|
+
return _max.default;
|
|
26373
|
+
}
|
|
26374
|
+
});
|
|
26366
26375
|
Object.defineProperty(exports, "NIL", {
|
|
26367
26376
|
enumerable: true,
|
|
26368
26377
|
get: function () {
|
|
@@ -26387,6 +26396,12 @@ Object.defineProperty(exports, "v1", {
|
|
|
26387
26396
|
return _v.default;
|
|
26388
26397
|
}
|
|
26389
26398
|
});
|
|
26399
|
+
Object.defineProperty(exports, "v1ToV6", {
|
|
26400
|
+
enumerable: true,
|
|
26401
|
+
get: function () {
|
|
26402
|
+
return _v1ToV.default;
|
|
26403
|
+
}
|
|
26404
|
+
});
|
|
26390
26405
|
Object.defineProperty(exports, "v3", {
|
|
26391
26406
|
enumerable: true,
|
|
26392
26407
|
get: function () {
|
|
@@ -26405,6 +26420,24 @@ Object.defineProperty(exports, "v5", {
|
|
|
26405
26420
|
return _v4.default;
|
|
26406
26421
|
}
|
|
26407
26422
|
});
|
|
26423
|
+
Object.defineProperty(exports, "v6", {
|
|
26424
|
+
enumerable: true,
|
|
26425
|
+
get: function () {
|
|
26426
|
+
return _v5.default;
|
|
26427
|
+
}
|
|
26428
|
+
});
|
|
26429
|
+
Object.defineProperty(exports, "v6ToV1", {
|
|
26430
|
+
enumerable: true,
|
|
26431
|
+
get: function () {
|
|
26432
|
+
return _v6ToV.default;
|
|
26433
|
+
}
|
|
26434
|
+
});
|
|
26435
|
+
Object.defineProperty(exports, "v7", {
|
|
26436
|
+
enumerable: true,
|
|
26437
|
+
get: function () {
|
|
26438
|
+
return _v6.default;
|
|
26439
|
+
}
|
|
26440
|
+
});
|
|
26408
26441
|
Object.defineProperty(exports, "validate", {
|
|
26409
26442
|
enumerable: true,
|
|
26410
26443
|
get: function () {
|
|
@@ -26417,34 +26450,36 @@ Object.defineProperty(exports, "version", {
|
|
|
26417
26450
|
return _version.default;
|
|
26418
26451
|
}
|
|
26419
26452
|
});
|
|
26420
|
-
|
|
26453
|
+
var _max = _interopRequireDefault(_dereq_("./max.js"));
|
|
26454
|
+
var _nil = _interopRequireDefault(_dereq_("./nil.js"));
|
|
26455
|
+
var _parse = _interopRequireDefault(_dereq_("./parse.js"));
|
|
26456
|
+
var _stringify = _interopRequireDefault(_dereq_("./stringify.js"));
|
|
26421
26457
|
var _v = _interopRequireDefault(_dereq_("./v1.js"));
|
|
26422
|
-
|
|
26458
|
+
var _v1ToV = _interopRequireDefault(_dereq_("./v1ToV6.js"));
|
|
26423
26459
|
var _v2 = _interopRequireDefault(_dereq_("./v3.js"));
|
|
26424
|
-
|
|
26425
26460
|
var _v3 = _interopRequireDefault(_dereq_("./v4.js"));
|
|
26426
|
-
|
|
26427
26461
|
var _v4 = _interopRequireDefault(_dereq_("./v5.js"));
|
|
26428
|
-
|
|
26429
|
-
var
|
|
26430
|
-
|
|
26431
|
-
var _version = _interopRequireDefault(_dereq_("./version.js"));
|
|
26432
|
-
|
|
26462
|
+
var _v5 = _interopRequireDefault(_dereq_("./v6.js"));
|
|
26463
|
+
var _v6ToV = _interopRequireDefault(_dereq_("./v6ToV1.js"));
|
|
26464
|
+
var _v6 = _interopRequireDefault(_dereq_("./v7.js"));
|
|
26433
26465
|
var _validate = _interopRequireDefault(_dereq_("./validate.js"));
|
|
26434
|
-
|
|
26435
|
-
|
|
26436
|
-
|
|
26437
|
-
var _parse = _interopRequireDefault(_dereq_("./parse.js"));
|
|
26438
|
-
|
|
26439
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26440
|
-
},{"./nil.js":499,"./parse.js":500,"./stringify.js":504,"./v1.js":505,"./v3.js":506,"./v4.js":508,"./v5.js":509,"./validate.js":510,"./version.js":511}],497:[function(_dereq_,module,exports){
|
|
26466
|
+
var _version = _interopRequireDefault(_dereq_("./version.js"));
|
|
26467
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26468
|
+
},{"./max.js":497,"./nil.js":500,"./parse.js":501,"./stringify.js":505,"./v1.js":506,"./v1ToV6.js":507,"./v3.js":508,"./v4.js":510,"./v5.js":511,"./v6.js":512,"./v6ToV1.js":513,"./v7.js":514,"./validate.js":515,"./version.js":516}],497:[function(_dereq_,module,exports){
|
|
26441
26469
|
"use strict";
|
|
26442
26470
|
|
|
26443
26471
|
Object.defineProperty(exports, "__esModule", {
|
|
26444
26472
|
value: true
|
|
26445
26473
|
});
|
|
26446
26474
|
exports.default = void 0;
|
|
26475
|
+
var _default = exports.default = 'ffffffff-ffff-ffff-ffff-ffffffffffff';
|
|
26476
|
+
},{}],498:[function(_dereq_,module,exports){
|
|
26477
|
+
"use strict";
|
|
26447
26478
|
|
|
26479
|
+
Object.defineProperty(exports, "__esModule", {
|
|
26480
|
+
value: true
|
|
26481
|
+
});
|
|
26482
|
+
exports.default = void 0;
|
|
26448
26483
|
/*
|
|
26449
26484
|
* Browser-compatible JavaScript MD5
|
|
26450
26485
|
*
|
|
@@ -26470,45 +26505,38 @@ function md5(bytes) {
|
|
|
26470
26505
|
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
26471
26506
|
|
|
26472
26507
|
bytes = new Uint8Array(msg.length);
|
|
26473
|
-
|
|
26474
26508
|
for (let i = 0; i < msg.length; ++i) {
|
|
26475
26509
|
bytes[i] = msg.charCodeAt(i);
|
|
26476
26510
|
}
|
|
26477
26511
|
}
|
|
26478
|
-
|
|
26479
26512
|
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
|
26480
26513
|
}
|
|
26514
|
+
|
|
26481
26515
|
/*
|
|
26482
26516
|
* Convert an array of little-endian words to an array of bytes
|
|
26483
26517
|
*/
|
|
26484
|
-
|
|
26485
|
-
|
|
26486
26518
|
function md5ToHexEncodedArray(input) {
|
|
26487
26519
|
const output = [];
|
|
26488
26520
|
const length32 = input.length * 32;
|
|
26489
26521
|
const hexTab = '0123456789abcdef';
|
|
26490
|
-
|
|
26491
26522
|
for (let i = 0; i < length32; i += 8) {
|
|
26492
26523
|
const x = input[i >> 5] >>> i % 32 & 0xff;
|
|
26493
26524
|
const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
26494
26525
|
output.push(hex);
|
|
26495
26526
|
}
|
|
26496
|
-
|
|
26497
26527
|
return output;
|
|
26498
26528
|
}
|
|
26529
|
+
|
|
26499
26530
|
/**
|
|
26500
26531
|
* Calculate output length with padding and bit length
|
|
26501
26532
|
*/
|
|
26502
|
-
|
|
26503
|
-
|
|
26504
26533
|
function getOutputLength(inputLength8) {
|
|
26505
26534
|
return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
|
|
26506
26535
|
}
|
|
26536
|
+
|
|
26507
26537
|
/*
|
|
26508
26538
|
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
26509
26539
|
*/
|
|
26510
|
-
|
|
26511
|
-
|
|
26512
26540
|
function wordsToMd5(x, len) {
|
|
26513
26541
|
/* append padding */
|
|
26514
26542
|
x[len >> 5] |= 0x80 << len % 32;
|
|
@@ -26517,7 +26545,6 @@ function wordsToMd5(x, len) {
|
|
|
26517
26545
|
let b = -271733879;
|
|
26518
26546
|
let c = -1732584194;
|
|
26519
26547
|
let d = 271733878;
|
|
26520
|
-
|
|
26521
26548
|
for (let i = 0; i < x.length; i += 16) {
|
|
26522
26549
|
const olda = a;
|
|
26523
26550
|
const oldb = b;
|
|
@@ -26592,76 +26619,62 @@ function wordsToMd5(x, len) {
|
|
|
26592
26619
|
c = safeAdd(c, oldc);
|
|
26593
26620
|
d = safeAdd(d, oldd);
|
|
26594
26621
|
}
|
|
26595
|
-
|
|
26596
26622
|
return [a, b, c, d];
|
|
26597
26623
|
}
|
|
26624
|
+
|
|
26598
26625
|
/*
|
|
26599
26626
|
* Convert an array bytes to an array of little-endian words
|
|
26600
26627
|
* Characters >255 have their high-byte silently ignored.
|
|
26601
26628
|
*/
|
|
26602
|
-
|
|
26603
|
-
|
|
26604
26629
|
function bytesToWords(input) {
|
|
26605
26630
|
if (input.length === 0) {
|
|
26606
26631
|
return [];
|
|
26607
26632
|
}
|
|
26608
|
-
|
|
26609
26633
|
const length8 = input.length * 8;
|
|
26610
26634
|
const output = new Uint32Array(getOutputLength(length8));
|
|
26611
|
-
|
|
26612
26635
|
for (let i = 0; i < length8; i += 8) {
|
|
26613
26636
|
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
26614
26637
|
}
|
|
26615
|
-
|
|
26616
26638
|
return output;
|
|
26617
26639
|
}
|
|
26640
|
+
|
|
26618
26641
|
/*
|
|
26619
26642
|
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
26620
26643
|
* to work around bugs in some JS interpreters.
|
|
26621
26644
|
*/
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
26645
|
function safeAdd(x, y) {
|
|
26625
26646
|
const lsw = (x & 0xffff) + (y & 0xffff);
|
|
26626
26647
|
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
26627
26648
|
return msw << 16 | lsw & 0xffff;
|
|
26628
26649
|
}
|
|
26650
|
+
|
|
26629
26651
|
/*
|
|
26630
26652
|
* Bitwise rotate a 32-bit number to the left.
|
|
26631
26653
|
*/
|
|
26632
|
-
|
|
26633
|
-
|
|
26634
26654
|
function bitRotateLeft(num, cnt) {
|
|
26635
26655
|
return num << cnt | num >>> 32 - cnt;
|
|
26636
26656
|
}
|
|
26657
|
+
|
|
26637
26658
|
/*
|
|
26638
26659
|
* These functions implement the four basic operations the algorithm uses.
|
|
26639
26660
|
*/
|
|
26640
|
-
|
|
26641
|
-
|
|
26642
26661
|
function md5cmn(q, a, b, x, s, t) {
|
|
26643
26662
|
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
26644
26663
|
}
|
|
26645
|
-
|
|
26646
26664
|
function md5ff(a, b, c, d, x, s, t) {
|
|
26647
26665
|
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
26648
26666
|
}
|
|
26649
|
-
|
|
26650
26667
|
function md5gg(a, b, c, d, x, s, t) {
|
|
26651
26668
|
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
26652
26669
|
}
|
|
26653
|
-
|
|
26654
26670
|
function md5hh(a, b, c, d, x, s, t) {
|
|
26655
26671
|
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
26656
26672
|
}
|
|
26657
|
-
|
|
26658
26673
|
function md5ii(a, b, c, d, x, s, t) {
|
|
26659
26674
|
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
26660
26675
|
}
|
|
26661
|
-
|
|
26662
|
-
|
|
26663
|
-
exports.default = _default;
|
|
26664
|
-
},{}],498:[function(_dereq_,module,exports){
|
|
26676
|
+
var _default = exports.default = md5;
|
|
26677
|
+
},{}],499:[function(_dereq_,module,exports){
|
|
26665
26678
|
"use strict";
|
|
26666
26679
|
|
|
26667
26680
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -26669,54 +26682,53 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
26669
26682
|
});
|
|
26670
26683
|
exports.default = void 0;
|
|
26671
26684
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
26672
|
-
var _default = {
|
|
26685
|
+
var _default = exports.default = {
|
|
26673
26686
|
randomUUID
|
|
26674
26687
|
};
|
|
26675
|
-
exports
|
|
26676
|
-
},{}],499:[function(_dereq_,module,exports){
|
|
26688
|
+
},{}],500:[function(_dereq_,module,exports){
|
|
26677
26689
|
"use strict";
|
|
26678
26690
|
|
|
26679
26691
|
Object.defineProperty(exports, "__esModule", {
|
|
26680
26692
|
value: true
|
|
26681
26693
|
});
|
|
26682
26694
|
exports.default = void 0;
|
|
26683
|
-
var _default = '00000000-0000-0000-0000-000000000000';
|
|
26684
|
-
exports
|
|
26685
|
-
},{}],500:[function(_dereq_,module,exports){
|
|
26695
|
+
var _default = exports.default = '00000000-0000-0000-0000-000000000000';
|
|
26696
|
+
},{}],501:[function(_dereq_,module,exports){
|
|
26686
26697
|
"use strict";
|
|
26687
26698
|
|
|
26688
26699
|
Object.defineProperty(exports, "__esModule", {
|
|
26689
26700
|
value: true
|
|
26690
26701
|
});
|
|
26691
26702
|
exports.default = void 0;
|
|
26692
|
-
|
|
26693
26703
|
var _validate = _interopRequireDefault(_dereq_("./validate.js"));
|
|
26694
|
-
|
|
26695
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26696
|
-
|
|
26704
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26697
26705
|
function parse(uuid) {
|
|
26698
26706
|
if (!(0, _validate.default)(uuid)) {
|
|
26699
26707
|
throw TypeError('Invalid UUID');
|
|
26700
26708
|
}
|
|
26701
|
-
|
|
26702
26709
|
let v;
|
|
26703
|
-
const arr = new Uint8Array(16);
|
|
26710
|
+
const arr = new Uint8Array(16);
|
|
26704
26711
|
|
|
26712
|
+
// Parse ########-....-....-....-............
|
|
26705
26713
|
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
26706
26714
|
arr[1] = v >>> 16 & 0xff;
|
|
26707
26715
|
arr[2] = v >>> 8 & 0xff;
|
|
26708
|
-
arr[3] = v & 0xff;
|
|
26716
|
+
arr[3] = v & 0xff;
|
|
26709
26717
|
|
|
26718
|
+
// Parse ........-####-....-....-............
|
|
26710
26719
|
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
26711
|
-
arr[5] = v & 0xff;
|
|
26720
|
+
arr[5] = v & 0xff;
|
|
26712
26721
|
|
|
26722
|
+
// Parse ........-....-####-....-............
|
|
26713
26723
|
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
26714
|
-
arr[7] = v & 0xff;
|
|
26724
|
+
arr[7] = v & 0xff;
|
|
26715
26725
|
|
|
26726
|
+
// Parse ........-....-....-####-............
|
|
26716
26727
|
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
26717
|
-
arr[9] = v & 0xff;
|
|
26718
|
-
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
26728
|
+
arr[9] = v & 0xff;
|
|
26719
26729
|
|
|
26730
|
+
// Parse ........-....-....-....-############
|
|
26731
|
+
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
26720
26732
|
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
26721
26733
|
arr[11] = v / 0x100000000 & 0xff;
|
|
26722
26734
|
arr[12] = v >>> 24 & 0xff;
|
|
@@ -26725,19 +26737,16 @@ function parse(uuid) {
|
|
|
26725
26737
|
arr[15] = v & 0xff;
|
|
26726
26738
|
return arr;
|
|
26727
26739
|
}
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
exports.default = _default;
|
|
26731
|
-
},{"./validate.js":510}],501:[function(_dereq_,module,exports){
|
|
26740
|
+
var _default = exports.default = parse;
|
|
26741
|
+
},{"./validate.js":515}],502:[function(_dereq_,module,exports){
|
|
26732
26742
|
"use strict";
|
|
26733
26743
|
|
|
26734
26744
|
Object.defineProperty(exports, "__esModule", {
|
|
26735
26745
|
value: true
|
|
26736
26746
|
});
|
|
26737
26747
|
exports.default = void 0;
|
|
26738
|
-
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-
|
|
26739
|
-
exports
|
|
26740
|
-
},{}],502:[function(_dereq_,module,exports){
|
|
26748
|
+
var _default = exports.default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
26749
|
+
},{}],503:[function(_dereq_,module,exports){
|
|
26741
26750
|
"use strict";
|
|
26742
26751
|
|
|
26743
26752
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -26747,61 +26756,51 @@ exports.default = rng;
|
|
|
26747
26756
|
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
26748
26757
|
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
26749
26758
|
// generators (like Math.random()).
|
|
26759
|
+
|
|
26750
26760
|
let getRandomValues;
|
|
26751
26761
|
const rnds8 = new Uint8Array(16);
|
|
26752
|
-
|
|
26753
26762
|
function rng() {
|
|
26754
26763
|
// lazy load so that environments that need to polyfill have a chance to do so
|
|
26755
26764
|
if (!getRandomValues) {
|
|
26756
26765
|
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
26757
26766
|
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
26758
|
-
|
|
26759
26767
|
if (!getRandomValues) {
|
|
26760
26768
|
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
26761
26769
|
}
|
|
26762
26770
|
}
|
|
26763
|
-
|
|
26764
26771
|
return getRandomValues(rnds8);
|
|
26765
26772
|
}
|
|
26766
|
-
},{}],
|
|
26773
|
+
},{}],504:[function(_dereq_,module,exports){
|
|
26767
26774
|
"use strict";
|
|
26768
26775
|
|
|
26769
26776
|
Object.defineProperty(exports, "__esModule", {
|
|
26770
26777
|
value: true
|
|
26771
26778
|
});
|
|
26772
26779
|
exports.default = void 0;
|
|
26773
|
-
|
|
26774
26780
|
// Adapted from Chris Veness' SHA1 code at
|
|
26775
26781
|
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
26776
26782
|
function f(s, x, y, z) {
|
|
26777
26783
|
switch (s) {
|
|
26778
26784
|
case 0:
|
|
26779
26785
|
return x & y ^ ~x & z;
|
|
26780
|
-
|
|
26781
26786
|
case 1:
|
|
26782
26787
|
return x ^ y ^ z;
|
|
26783
|
-
|
|
26784
26788
|
case 2:
|
|
26785
26789
|
return x & y ^ x & z ^ y & z;
|
|
26786
|
-
|
|
26787
26790
|
case 3:
|
|
26788
26791
|
return x ^ y ^ z;
|
|
26789
26792
|
}
|
|
26790
26793
|
}
|
|
26791
|
-
|
|
26792
26794
|
function ROTL(x, n) {
|
|
26793
26795
|
return x << n | x >>> 32 - n;
|
|
26794
26796
|
}
|
|
26795
|
-
|
|
26796
26797
|
function sha1(bytes) {
|
|
26797
26798
|
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
26798
26799
|
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
26799
|
-
|
|
26800
26800
|
if (typeof bytes === 'string') {
|
|
26801
26801
|
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
26802
26802
|
|
|
26803
26803
|
bytes = [];
|
|
26804
|
-
|
|
26805
26804
|
for (let i = 0; i < msg.length; ++i) {
|
|
26806
26805
|
bytes.push(msg.charCodeAt(i));
|
|
26807
26806
|
}
|
|
@@ -26809,43 +26808,33 @@ function sha1(bytes) {
|
|
|
26809
26808
|
// Convert Array-like to Array
|
|
26810
26809
|
bytes = Array.prototype.slice.call(bytes);
|
|
26811
26810
|
}
|
|
26812
|
-
|
|
26813
26811
|
bytes.push(0x80);
|
|
26814
26812
|
const l = bytes.length / 4 + 2;
|
|
26815
26813
|
const N = Math.ceil(l / 16);
|
|
26816
26814
|
const M = new Array(N);
|
|
26817
|
-
|
|
26818
26815
|
for (let i = 0; i < N; ++i) {
|
|
26819
26816
|
const arr = new Uint32Array(16);
|
|
26820
|
-
|
|
26821
26817
|
for (let j = 0; j < 16; ++j) {
|
|
26822
26818
|
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];
|
|
26823
26819
|
}
|
|
26824
|
-
|
|
26825
26820
|
M[i] = arr;
|
|
26826
26821
|
}
|
|
26827
|
-
|
|
26828
26822
|
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
26829
26823
|
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
26830
26824
|
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
26831
|
-
|
|
26832
26825
|
for (let i = 0; i < N; ++i) {
|
|
26833
26826
|
const W = new Uint32Array(80);
|
|
26834
|
-
|
|
26835
26827
|
for (let t = 0; t < 16; ++t) {
|
|
26836
26828
|
W[t] = M[i][t];
|
|
26837
26829
|
}
|
|
26838
|
-
|
|
26839
26830
|
for (let t = 16; t < 80; ++t) {
|
|
26840
26831
|
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
26841
26832
|
}
|
|
26842
|
-
|
|
26843
26833
|
let a = H[0];
|
|
26844
26834
|
let b = H[1];
|
|
26845
26835
|
let c = H[2];
|
|
26846
26836
|
let d = H[3];
|
|
26847
26837
|
let e = H[4];
|
|
26848
|
-
|
|
26849
26838
|
for (let t = 0; t < 80; ++t) {
|
|
26850
26839
|
const s = Math.floor(t / 20);
|
|
26851
26840
|
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
@@ -26855,20 +26844,16 @@ function sha1(bytes) {
|
|
|
26855
26844
|
b = a;
|
|
26856
26845
|
a = T;
|
|
26857
26846
|
}
|
|
26858
|
-
|
|
26859
26847
|
H[0] = H[0] + a >>> 0;
|
|
26860
26848
|
H[1] = H[1] + b >>> 0;
|
|
26861
26849
|
H[2] = H[2] + c >>> 0;
|
|
26862
26850
|
H[3] = H[3] + d >>> 0;
|
|
26863
26851
|
H[4] = H[4] + e >>> 0;
|
|
26864
26852
|
}
|
|
26865
|
-
|
|
26866
26853
|
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];
|
|
26867
26854
|
}
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
exports.default = _default;
|
|
26871
|
-
},{}],504:[function(_dereq_,module,exports){
|
|
26855
|
+
var _default = exports.default = sha1;
|
|
26856
|
+
},{}],505:[function(_dereq_,module,exports){
|
|
26872
26857
|
"use strict";
|
|
26873
26858
|
|
|
26874
26859
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -26876,169 +26861,209 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
26876
26861
|
});
|
|
26877
26862
|
exports.default = void 0;
|
|
26878
26863
|
exports.unsafeStringify = unsafeStringify;
|
|
26879
|
-
|
|
26880
26864
|
var _validate = _interopRequireDefault(_dereq_("./validate.js"));
|
|
26881
|
-
|
|
26882
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26883
|
-
|
|
26865
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26884
26866
|
/**
|
|
26885
26867
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
26886
26868
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
26887
26869
|
*/
|
|
26888
26870
|
const byteToHex = [];
|
|
26889
|
-
|
|
26890
26871
|
for (let i = 0; i < 256; ++i) {
|
|
26891
26872
|
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
26892
26873
|
}
|
|
26893
|
-
|
|
26894
26874
|
function unsafeStringify(arr, offset = 0) {
|
|
26895
26875
|
// Note: Be careful editing this code! It's been tuned for performance
|
|
26896
26876
|
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
26897
|
-
|
|
26877
|
+
//
|
|
26878
|
+
// Note to future-self: No, you can't remove the `toLowerCase()` call.
|
|
26879
|
+
// REF: https://github.com/uuidjs/uuid/pull/677#issuecomment-1757351351
|
|
26880
|
+
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]]).toLowerCase();
|
|
26898
26881
|
}
|
|
26899
|
-
|
|
26900
26882
|
function stringify(arr, offset = 0) {
|
|
26901
|
-
const uuid = unsafeStringify(arr, offset);
|
|
26883
|
+
const uuid = unsafeStringify(arr, offset);
|
|
26884
|
+
// Consistency check for valid UUID. If this throws, it's likely due to one
|
|
26902
26885
|
// of the following:
|
|
26903
26886
|
// - One or more input array values don't map to a hex octet (leading to
|
|
26904
26887
|
// "undefined" in the uuid)
|
|
26905
26888
|
// - Invalid input values for the RFC `version` or `variant` fields
|
|
26906
|
-
|
|
26907
26889
|
if (!(0, _validate.default)(uuid)) {
|
|
26908
26890
|
throw TypeError('Stringified UUID is invalid');
|
|
26909
26891
|
}
|
|
26910
|
-
|
|
26911
26892
|
return uuid;
|
|
26912
26893
|
}
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
exports.default = _default;
|
|
26916
|
-
},{"./validate.js":510}],505:[function(_dereq_,module,exports){
|
|
26894
|
+
var _default = exports.default = stringify;
|
|
26895
|
+
},{"./validate.js":515}],506:[function(_dereq_,module,exports){
|
|
26917
26896
|
"use strict";
|
|
26918
26897
|
|
|
26919
26898
|
Object.defineProperty(exports, "__esModule", {
|
|
26920
26899
|
value: true
|
|
26921
26900
|
});
|
|
26922
26901
|
exports.default = void 0;
|
|
26923
|
-
|
|
26924
26902
|
var _rng = _interopRequireDefault(_dereq_("./rng.js"));
|
|
26925
|
-
|
|
26926
26903
|
var _stringify = _dereq_("./stringify.js");
|
|
26927
|
-
|
|
26928
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26929
|
-
|
|
26904
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26930
26905
|
// **`v1()` - Generate time-based UUID**
|
|
26931
26906
|
//
|
|
26932
26907
|
// Inspired by https://github.com/LiosK/UUID.js
|
|
26933
26908
|
// and http://docs.python.org/library/uuid.html
|
|
26934
|
-
let _nodeId;
|
|
26935
|
-
|
|
26936
|
-
let _clockseq; // Previous uuid creation time
|
|
26937
26909
|
|
|
26910
|
+
let _nodeId;
|
|
26911
|
+
let _clockseq;
|
|
26938
26912
|
|
|
26913
|
+
// Previous uuid creation time
|
|
26939
26914
|
let _lastMSecs = 0;
|
|
26940
|
-
let _lastNSecs = 0;
|
|
26915
|
+
let _lastNSecs = 0;
|
|
26941
26916
|
|
|
26917
|
+
// See https://github.com/uuidjs/uuid for API details
|
|
26942
26918
|
function v1(options, buf, offset) {
|
|
26943
26919
|
let i = buf && offset || 0;
|
|
26944
26920
|
const b = buf || new Array(16);
|
|
26945
26921
|
options = options || {};
|
|
26946
|
-
let node = options.node
|
|
26947
|
-
let clockseq = options.clockseq
|
|
26948
|
-
|
|
26949
|
-
//
|
|
26922
|
+
let node = options.node;
|
|
26923
|
+
let clockseq = options.clockseq;
|
|
26924
|
+
|
|
26925
|
+
// v1 only: Use cached `node` and `clockseq` values
|
|
26926
|
+
if (!options._v6) {
|
|
26927
|
+
if (!node) {
|
|
26928
|
+
node = _nodeId;
|
|
26929
|
+
}
|
|
26930
|
+
if (clockseq == null) {
|
|
26931
|
+
clockseq = _clockseq;
|
|
26932
|
+
}
|
|
26933
|
+
}
|
|
26950
26934
|
|
|
26935
|
+
// Handle cases where we need entropy. We do this lazily to minimize issues
|
|
26936
|
+
// related to insufficient system entropy. See #189
|
|
26951
26937
|
if (node == null || clockseq == null) {
|
|
26952
26938
|
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
26953
26939
|
|
|
26940
|
+
// Randomize node
|
|
26954
26941
|
if (node == null) {
|
|
26955
|
-
|
|
26956
|
-
|
|
26942
|
+
node = [seedBytes[0], seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
26943
|
+
|
|
26944
|
+
// v1 only: cache node value for reuse
|
|
26945
|
+
if (!_nodeId && !options._v6) {
|
|
26946
|
+
// per RFC4122 4.5: Set MAC multicast bit (v1 only)
|
|
26947
|
+
node[0] |= 0x01; // Set multicast bit
|
|
26948
|
+
|
|
26949
|
+
_nodeId = node;
|
|
26950
|
+
}
|
|
26957
26951
|
}
|
|
26958
26952
|
|
|
26953
|
+
// Randomize clockseq
|
|
26959
26954
|
if (clockseq == null) {
|
|
26960
26955
|
// Per 4.2.2, randomize (14 bit) clockseq
|
|
26961
|
-
clockseq =
|
|
26956
|
+
clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
26957
|
+
if (_clockseq === undefined && !options._v6) {
|
|
26958
|
+
_clockseq = clockseq;
|
|
26959
|
+
}
|
|
26962
26960
|
}
|
|
26963
|
-
}
|
|
26964
|
-
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
26965
|
-
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
26966
|
-
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
26961
|
+
}
|
|
26967
26962
|
|
|
26963
|
+
// v1 & v6 timestamps are 100 nano-second units since the Gregorian epoch,
|
|
26964
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so time is
|
|
26965
|
+
// handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
26966
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
26967
|
+
let msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
|
26968
26968
|
|
|
26969
|
-
|
|
26969
|
+
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
26970
26970
|
// cycle to simulate higher resolution clock
|
|
26971
|
+
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
26971
26972
|
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
26973
|
+
// Time since last uuid creation (in msecs)
|
|
26974
|
+
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000;
|
|
26975
26975
|
|
|
26976
|
+
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
26976
26977
|
if (dt < 0 && options.clockseq === undefined) {
|
|
26977
26978
|
clockseq = clockseq + 1 & 0x3fff;
|
|
26978
|
-
}
|
|
26979
|
-
// time interval
|
|
26980
|
-
|
|
26979
|
+
}
|
|
26981
26980
|
|
|
26981
|
+
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
26982
|
+
// time interval
|
|
26982
26983
|
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
26983
26984
|
nsecs = 0;
|
|
26984
|
-
}
|
|
26985
|
-
|
|
26985
|
+
}
|
|
26986
26986
|
|
|
26987
|
+
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
26987
26988
|
if (nsecs >= 10000) {
|
|
26988
26989
|
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
26989
26990
|
}
|
|
26990
|
-
|
|
26991
26991
|
_lastMSecs = msecs;
|
|
26992
26992
|
_lastNSecs = nsecs;
|
|
26993
|
-
_clockseq = clockseq;
|
|
26993
|
+
_clockseq = clockseq;
|
|
26994
26994
|
|
|
26995
|
-
|
|
26995
|
+
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
26996
|
+
msecs += 12219292800000;
|
|
26996
26997
|
|
|
26998
|
+
// `time_low`
|
|
26997
26999
|
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
26998
27000
|
b[i++] = tl >>> 24 & 0xff;
|
|
26999
27001
|
b[i++] = tl >>> 16 & 0xff;
|
|
27000
27002
|
b[i++] = tl >>> 8 & 0xff;
|
|
27001
|
-
b[i++] = tl & 0xff;
|
|
27003
|
+
b[i++] = tl & 0xff;
|
|
27002
27004
|
|
|
27005
|
+
// `time_mid`
|
|
27003
27006
|
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
27004
27007
|
b[i++] = tmh >>> 8 & 0xff;
|
|
27005
|
-
b[i++] = tmh & 0xff;
|
|
27008
|
+
b[i++] = tmh & 0xff;
|
|
27006
27009
|
|
|
27010
|
+
// `time_high_and_version`
|
|
27007
27011
|
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
27012
|
+
b[i++] = tmh >>> 16 & 0xff;
|
|
27008
27013
|
|
|
27009
|
-
|
|
27014
|
+
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
27015
|
+
b[i++] = clockseq >>> 8 | 0x80;
|
|
27010
27016
|
|
|
27011
|
-
|
|
27012
|
-
|
|
27013
|
-
b[i++] = clockseq & 0xff; // `node`
|
|
27017
|
+
// `clock_seq_low`
|
|
27018
|
+
b[i++] = clockseq & 0xff;
|
|
27014
27019
|
|
|
27020
|
+
// `node`
|
|
27015
27021
|
for (let n = 0; n < 6; ++n) {
|
|
27016
27022
|
b[i + n] = node[n];
|
|
27017
27023
|
}
|
|
27018
|
-
|
|
27019
27024
|
return buf || (0, _stringify.unsafeStringify)(b);
|
|
27020
27025
|
}
|
|
27026
|
+
var _default = exports.default = v1;
|
|
27027
|
+
},{"./rng.js":503,"./stringify.js":505}],507:[function(_dereq_,module,exports){
|
|
27028
|
+
"use strict";
|
|
27021
27029
|
|
|
27022
|
-
|
|
27023
|
-
|
|
27024
|
-
}
|
|
27030
|
+
Object.defineProperty(exports, "__esModule", {
|
|
27031
|
+
value: true
|
|
27032
|
+
});
|
|
27033
|
+
exports.default = v1ToV6;
|
|
27034
|
+
var _parse = _interopRequireDefault(_dereq_("./parse.js"));
|
|
27035
|
+
var _stringify = _dereq_("./stringify.js");
|
|
27036
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27037
|
+
/**
|
|
27038
|
+
* Convert a v1 UUID to a v6 UUID
|
|
27039
|
+
*
|
|
27040
|
+
* @param {string|Uint8Array} uuid - The v1 UUID to convert to v6
|
|
27041
|
+
* @returns {string|Uint8Array} The v6 UUID as the same type as the `uuid` arg
|
|
27042
|
+
* (string or Uint8Array)
|
|
27043
|
+
*/
|
|
27044
|
+
function v1ToV6(uuid) {
|
|
27045
|
+
const v1Bytes = typeof uuid === 'string' ? (0, _parse.default)(uuid) : uuid;
|
|
27046
|
+
const v6Bytes = _v1ToV6(v1Bytes);
|
|
27047
|
+
return typeof uuid === 'string' ? (0, _stringify.unsafeStringify)(v6Bytes) : v6Bytes;
|
|
27048
|
+
}
|
|
27049
|
+
|
|
27050
|
+
// Do the field transformation needed for v1 -> v6
|
|
27051
|
+
function _v1ToV6(v1Bytes, randomize = false) {
|
|
27052
|
+
return Uint8Array.of((v1Bytes[6] & 0x0f) << 4 | v1Bytes[7] >> 4 & 0x0f, (v1Bytes[7] & 0x0f) << 4 | (v1Bytes[4] & 0xf0) >> 4, (v1Bytes[4] & 0x0f) << 4 | (v1Bytes[5] & 0xf0) >> 4, (v1Bytes[5] & 0x0f) << 4 | (v1Bytes[0] & 0xf0) >> 4, (v1Bytes[0] & 0x0f) << 4 | (v1Bytes[1] & 0xf0) >> 4, (v1Bytes[1] & 0x0f) << 4 | (v1Bytes[2] & 0xf0) >> 4, 0x60 | v1Bytes[2] & 0x0f, v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
|
|
27053
|
+
}
|
|
27054
|
+
},{"./parse.js":501,"./stringify.js":505}],508:[function(_dereq_,module,exports){
|
|
27025
27055
|
"use strict";
|
|
27026
27056
|
|
|
27027
27057
|
Object.defineProperty(exports, "__esModule", {
|
|
27028
27058
|
value: true
|
|
27029
27059
|
});
|
|
27030
27060
|
exports.default = void 0;
|
|
27031
|
-
|
|
27032
27061
|
var _v = _interopRequireDefault(_dereq_("./v35.js"));
|
|
27033
|
-
|
|
27034
27062
|
var _md = _interopRequireDefault(_dereq_("./md5.js"));
|
|
27035
|
-
|
|
27036
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27037
|
-
|
|
27063
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27038
27064
|
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
27039
|
-
var _default = v3;
|
|
27040
|
-
exports
|
|
27041
|
-
},{"./md5.js":497,"./v35.js":507}],507:[function(_dereq_,module,exports){
|
|
27065
|
+
var _default = exports.default = v3;
|
|
27066
|
+
},{"./md5.js":498,"./v35.js":509}],509:[function(_dereq_,module,exports){
|
|
27042
27067
|
"use strict";
|
|
27043
27068
|
|
|
27044
27069
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -27046,181 +27071,356 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
27046
27071
|
});
|
|
27047
27072
|
exports.URL = exports.DNS = void 0;
|
|
27048
27073
|
exports.default = v35;
|
|
27049
|
-
|
|
27050
27074
|
var _stringify = _dereq_("./stringify.js");
|
|
27051
|
-
|
|
27052
27075
|
var _parse = _interopRequireDefault(_dereq_("./parse.js"));
|
|
27053
|
-
|
|
27054
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27055
|
-
|
|
27076
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27056
27077
|
function stringToBytes(str) {
|
|
27057
27078
|
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
27058
27079
|
|
|
27059
27080
|
const bytes = [];
|
|
27060
|
-
|
|
27061
27081
|
for (let i = 0; i < str.length; ++i) {
|
|
27062
27082
|
bytes.push(str.charCodeAt(i));
|
|
27063
27083
|
}
|
|
27064
|
-
|
|
27065
27084
|
return bytes;
|
|
27066
27085
|
}
|
|
27067
|
-
|
|
27068
|
-
const
|
|
27069
|
-
exports.DNS = DNS;
|
|
27070
|
-
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
27071
|
-
exports.URL = URL;
|
|
27072
|
-
|
|
27086
|
+
const DNS = exports.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
27087
|
+
const URL = exports.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
27073
27088
|
function v35(name, version, hashfunc) {
|
|
27074
27089
|
function generateUUID(value, namespace, buf, offset) {
|
|
27075
27090
|
var _namespace;
|
|
27076
|
-
|
|
27077
27091
|
if (typeof value === 'string') {
|
|
27078
27092
|
value = stringToBytes(value);
|
|
27079
27093
|
}
|
|
27080
|
-
|
|
27081
27094
|
if (typeof namespace === 'string') {
|
|
27082
27095
|
namespace = (0, _parse.default)(namespace);
|
|
27083
27096
|
}
|
|
27084
|
-
|
|
27085
27097
|
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
27086
27098
|
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
27087
|
-
}
|
|
27099
|
+
}
|
|
27100
|
+
|
|
27101
|
+
// Compute hash of namespace and value, Per 4.3
|
|
27088
27102
|
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
27089
27103
|
// hashfunc([...namespace, ... value])`
|
|
27090
|
-
|
|
27091
|
-
|
|
27092
27104
|
let bytes = new Uint8Array(16 + value.length);
|
|
27093
27105
|
bytes.set(namespace);
|
|
27094
27106
|
bytes.set(value, namespace.length);
|
|
27095
27107
|
bytes = hashfunc(bytes);
|
|
27096
27108
|
bytes[6] = bytes[6] & 0x0f | version;
|
|
27097
27109
|
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
27098
|
-
|
|
27099
27110
|
if (buf) {
|
|
27100
27111
|
offset = offset || 0;
|
|
27101
|
-
|
|
27102
27112
|
for (let i = 0; i < 16; ++i) {
|
|
27103
27113
|
buf[offset + i] = bytes[i];
|
|
27104
27114
|
}
|
|
27105
|
-
|
|
27106
27115
|
return buf;
|
|
27107
27116
|
}
|
|
27108
|
-
|
|
27109
27117
|
return (0, _stringify.unsafeStringify)(bytes);
|
|
27110
|
-
}
|
|
27111
|
-
|
|
27118
|
+
}
|
|
27112
27119
|
|
|
27120
|
+
// Function#name is not settable on some platforms (#270)
|
|
27113
27121
|
try {
|
|
27114
|
-
generateUUID.name = name;
|
|
27115
|
-
} catch (err) {}
|
|
27116
|
-
|
|
27122
|
+
generateUUID.name = name;
|
|
27123
|
+
} catch (err) {}
|
|
27117
27124
|
|
|
27125
|
+
// For CommonJS default export support
|
|
27118
27126
|
generateUUID.DNS = DNS;
|
|
27119
27127
|
generateUUID.URL = URL;
|
|
27120
27128
|
return generateUUID;
|
|
27121
27129
|
}
|
|
27122
|
-
},{"./parse.js":
|
|
27130
|
+
},{"./parse.js":501,"./stringify.js":505}],510:[function(_dereq_,module,exports){
|
|
27123
27131
|
"use strict";
|
|
27124
27132
|
|
|
27125
27133
|
Object.defineProperty(exports, "__esModule", {
|
|
27126
27134
|
value: true
|
|
27127
27135
|
});
|
|
27128
27136
|
exports.default = void 0;
|
|
27129
|
-
|
|
27130
27137
|
var _native = _interopRequireDefault(_dereq_("./native.js"));
|
|
27131
|
-
|
|
27132
27138
|
var _rng = _interopRequireDefault(_dereq_("./rng.js"));
|
|
27133
|
-
|
|
27134
27139
|
var _stringify = _dereq_("./stringify.js");
|
|
27135
|
-
|
|
27136
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27137
|
-
|
|
27140
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27138
27141
|
function v4(options, buf, offset) {
|
|
27139
27142
|
if (_native.default.randomUUID && !buf && !options) {
|
|
27140
27143
|
return _native.default.randomUUID();
|
|
27141
27144
|
}
|
|
27142
|
-
|
|
27143
27145
|
options = options || {};
|
|
27146
|
+
const rnds = options.random || (options.rng || _rng.default)();
|
|
27144
27147
|
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
27148
27149
|
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
27149
|
-
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
27150
|
+
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
27150
27151
|
|
|
27152
|
+
// Copy bytes to buffer, if provided
|
|
27151
27153
|
if (buf) {
|
|
27152
27154
|
offset = offset || 0;
|
|
27153
|
-
|
|
27154
27155
|
for (let i = 0; i < 16; ++i) {
|
|
27155
27156
|
buf[offset + i] = rnds[i];
|
|
27156
27157
|
}
|
|
27157
|
-
|
|
27158
27158
|
return buf;
|
|
27159
27159
|
}
|
|
27160
|
-
|
|
27161
27160
|
return (0, _stringify.unsafeStringify)(rnds);
|
|
27162
27161
|
}
|
|
27163
|
-
|
|
27164
|
-
|
|
27165
|
-
exports.default = _default;
|
|
27166
|
-
},{"./native.js":498,"./rng.js":502,"./stringify.js":504}],509:[function(_dereq_,module,exports){
|
|
27162
|
+
var _default = exports.default = v4;
|
|
27163
|
+
},{"./native.js":499,"./rng.js":503,"./stringify.js":505}],511:[function(_dereq_,module,exports){
|
|
27167
27164
|
"use strict";
|
|
27168
27165
|
|
|
27169
27166
|
Object.defineProperty(exports, "__esModule", {
|
|
27170
27167
|
value: true
|
|
27171
27168
|
});
|
|
27172
27169
|
exports.default = void 0;
|
|
27173
|
-
|
|
27174
27170
|
var _v = _interopRequireDefault(_dereq_("./v35.js"));
|
|
27175
|
-
|
|
27176
27171
|
var _sha = _interopRequireDefault(_dereq_("./sha1.js"));
|
|
27172
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27173
|
+
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
27174
|
+
var _default = exports.default = v5;
|
|
27175
|
+
},{"./sha1.js":504,"./v35.js":509}],512:[function(_dereq_,module,exports){
|
|
27176
|
+
"use strict";
|
|
27177
27177
|
|
|
27178
|
-
|
|
27178
|
+
Object.defineProperty(exports, "__esModule", {
|
|
27179
|
+
value: true
|
|
27180
|
+
});
|
|
27181
|
+
exports.default = v6;
|
|
27182
|
+
var _stringify = _dereq_("./stringify.js");
|
|
27183
|
+
var _v = _interopRequireDefault(_dereq_("./v1.js"));
|
|
27184
|
+
var _v1ToV = _interopRequireDefault(_dereq_("./v1ToV6.js"));
|
|
27185
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27186
|
+
/**
|
|
27187
|
+
*
|
|
27188
|
+
* @param {object} options
|
|
27189
|
+
* @param {Uint8Array=} buf
|
|
27190
|
+
* @param {number=} offset
|
|
27191
|
+
* @returns
|
|
27192
|
+
*/
|
|
27193
|
+
function v6(options = {}, buf, offset = 0) {
|
|
27194
|
+
// v6 is v1 with different field layout, so we start with a v1 UUID, albeit
|
|
27195
|
+
// with slightly different behavior around how the clock_seq and node fields
|
|
27196
|
+
// are randomized, which is why we call v1 with _v6: true.
|
|
27197
|
+
let bytes = (0, _v.default)({
|
|
27198
|
+
...options,
|
|
27199
|
+
_v6: true
|
|
27200
|
+
}, new Uint8Array(16));
|
|
27201
|
+
|
|
27202
|
+
// Reorder the fields to v6 layout.
|
|
27203
|
+
bytes = (0, _v1ToV.default)(bytes);
|
|
27204
|
+
|
|
27205
|
+
// Return as a byte array if requested
|
|
27206
|
+
if (buf) {
|
|
27207
|
+
for (let i = 0; i < 16; i++) {
|
|
27208
|
+
buf[offset + i] = bytes[i];
|
|
27209
|
+
}
|
|
27210
|
+
return buf;
|
|
27211
|
+
}
|
|
27212
|
+
return (0, _stringify.unsafeStringify)(bytes);
|
|
27213
|
+
}
|
|
27214
|
+
},{"./stringify.js":505,"./v1.js":506,"./v1ToV6.js":507}],513:[function(_dereq_,module,exports){
|
|
27215
|
+
"use strict";
|
|
27179
27216
|
|
|
27180
|
-
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27217
|
+
Object.defineProperty(exports, "__esModule", {
|
|
27218
|
+
value: true
|
|
27219
|
+
});
|
|
27220
|
+
exports.default = v6ToV1;
|
|
27221
|
+
var _parse = _interopRequireDefault(_dereq_("./parse.js"));
|
|
27222
|
+
var _stringify = _dereq_("./stringify.js");
|
|
27223
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27224
|
+
/**
|
|
27225
|
+
* Convert a v6 UUID to a v1 UUID
|
|
27226
|
+
*
|
|
27227
|
+
* @param {string|Uint8Array} uuid - The v6 UUID to convert to v6
|
|
27228
|
+
* @returns {string|Uint8Array} The v1 UUID as the same type as the `uuid` arg
|
|
27229
|
+
* (string or Uint8Array)
|
|
27230
|
+
*/
|
|
27231
|
+
function v6ToV1(uuid) {
|
|
27232
|
+
const v6Bytes = typeof uuid === 'string' ? (0, _parse.default)(uuid) : uuid;
|
|
27233
|
+
const v1Bytes = _v6ToV1(v6Bytes);
|
|
27234
|
+
return typeof uuid === 'string' ? (0, _stringify.unsafeStringify)(v1Bytes) : v1Bytes;
|
|
27235
|
+
}
|
|
27236
|
+
|
|
27237
|
+
// Do the field transformation needed for v6 -> v1
|
|
27238
|
+
function _v6ToV1(v6Bytes) {
|
|
27239
|
+
return Uint8Array.of((v6Bytes[3] & 0x0f) << 4 | v6Bytes[4] >> 4 & 0x0f, (v6Bytes[4] & 0x0f) << 4 | (v6Bytes[5] & 0xf0) >> 4, (v6Bytes[5] & 0x0f) << 4 | v6Bytes[6] & 0x0f, v6Bytes[7], (v6Bytes[1] & 0x0f) << 4 | (v6Bytes[2] & 0xf0) >> 4, (v6Bytes[2] & 0x0f) << 4 | (v6Bytes[3] & 0xf0) >> 4, 0x10 | (v6Bytes[0] & 0xf0) >> 4, (v6Bytes[0] & 0x0f) << 4 | (v6Bytes[1] & 0xf0) >> 4, v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
|
|
27240
|
+
}
|
|
27241
|
+
},{"./parse.js":501,"./stringify.js":505}],514:[function(_dereq_,module,exports){
|
|
27184
27242
|
"use strict";
|
|
27185
27243
|
|
|
27186
27244
|
Object.defineProperty(exports, "__esModule", {
|
|
27187
27245
|
value: true
|
|
27188
27246
|
});
|
|
27189
27247
|
exports.default = void 0;
|
|
27248
|
+
var _rng = _interopRequireDefault(_dereq_("./rng.js"));
|
|
27249
|
+
var _stringify = _dereq_("./stringify.js");
|
|
27250
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27251
|
+
/**
|
|
27252
|
+
* UUID V7 - Unix Epoch time-based UUID
|
|
27253
|
+
*
|
|
27254
|
+
* The IETF has published RFC9562, introducing 3 new UUID versions (6,7,8). This
|
|
27255
|
+
* implementation of V7 is based on the accepted, though not yet approved,
|
|
27256
|
+
* revisions.
|
|
27257
|
+
*
|
|
27258
|
+
* RFC 9562:https://www.rfc-editor.org/rfc/rfc9562.html Universally Unique
|
|
27259
|
+
* IDentifiers (UUIDs)
|
|
27190
27260
|
|
|
27191
|
-
|
|
27261
|
+
*
|
|
27262
|
+
* Sample V7 value:
|
|
27263
|
+
* https://www.rfc-editor.org/rfc/rfc9562.html#name-example-of-a-uuidv7-value
|
|
27264
|
+
*
|
|
27265
|
+
* Monotonic Bit Layout: RFC rfc9562.6.2 Method 1, Dedicated Counter Bits ref:
|
|
27266
|
+
* https://www.rfc-editor.org/rfc/rfc9562.html#section-6.2-5.1
|
|
27267
|
+
*
|
|
27268
|
+
* 0 1 2 3 0 1 2 3 4 5 6
|
|
27269
|
+
* 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
27270
|
+
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27271
|
+
* | unix_ts_ms |
|
|
27272
|
+
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27273
|
+
* | unix_ts_ms | ver | seq_hi |
|
|
27274
|
+
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27275
|
+
* |var| seq_low | rand |
|
|
27276
|
+
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27277
|
+
* | rand |
|
|
27278
|
+
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
27279
|
+
*
|
|
27280
|
+
* seq is a 31 bit serialized counter; comprised of 12 bit seq_hi and 19 bit
|
|
27281
|
+
* seq_low, and randomly initialized upon timestamp change. 31 bit counter size
|
|
27282
|
+
* was selected as any bitwise operations in node are done as _signed_ 32 bit
|
|
27283
|
+
* ints. we exclude the sign bit.
|
|
27284
|
+
*/
|
|
27192
27285
|
|
|
27193
|
-
|
|
27286
|
+
let _seqLow = null;
|
|
27287
|
+
let _seqHigh = null;
|
|
27288
|
+
let _msecs = 0;
|
|
27289
|
+
function v7(options, buf, offset) {
|
|
27290
|
+
options = options || {};
|
|
27194
27291
|
|
|
27292
|
+
// initialize buffer and pointer
|
|
27293
|
+
let i = buf && offset || 0;
|
|
27294
|
+
const b = buf || new Uint8Array(16);
|
|
27295
|
+
|
|
27296
|
+
// rnds is Uint8Array(16) filled with random bytes
|
|
27297
|
+
const rnds = options.random || (options.rng || _rng.default)();
|
|
27298
|
+
|
|
27299
|
+
// milliseconds since unix epoch, 1970-01-01 00:00
|
|
27300
|
+
const msecs = options.msecs !== undefined ? options.msecs : Date.now();
|
|
27301
|
+
|
|
27302
|
+
// seq is user provided 31 bit counter
|
|
27303
|
+
let seq = options.seq !== undefined ? options.seq : null;
|
|
27304
|
+
|
|
27305
|
+
// initialize local seq high/low parts
|
|
27306
|
+
let seqHigh = _seqHigh;
|
|
27307
|
+
let seqLow = _seqLow;
|
|
27308
|
+
|
|
27309
|
+
// check if clock has advanced and user has not provided msecs
|
|
27310
|
+
if (msecs > _msecs && options.msecs === undefined) {
|
|
27311
|
+
_msecs = msecs;
|
|
27312
|
+
|
|
27313
|
+
// unless user provided seq, reset seq parts
|
|
27314
|
+
if (seq !== null) {
|
|
27315
|
+
seqHigh = null;
|
|
27316
|
+
seqLow = null;
|
|
27317
|
+
}
|
|
27318
|
+
}
|
|
27319
|
+
|
|
27320
|
+
// if we have a user provided seq
|
|
27321
|
+
if (seq !== null) {
|
|
27322
|
+
// trim provided seq to 31 bits of value, avoiding overflow
|
|
27323
|
+
if (seq > 0x7fffffff) {
|
|
27324
|
+
seq = 0x7fffffff;
|
|
27325
|
+
}
|
|
27326
|
+
|
|
27327
|
+
// split provided seq into high/low parts
|
|
27328
|
+
seqHigh = seq >>> 19 & 0xfff;
|
|
27329
|
+
seqLow = seq & 0x7ffff;
|
|
27330
|
+
}
|
|
27331
|
+
|
|
27332
|
+
// randomly initialize seq
|
|
27333
|
+
if (seqHigh === null || seqLow === null) {
|
|
27334
|
+
seqHigh = rnds[6] & 0x7f;
|
|
27335
|
+
seqHigh = seqHigh << 8 | rnds[7];
|
|
27336
|
+
seqLow = rnds[8] & 0x3f; // pad for var
|
|
27337
|
+
seqLow = seqLow << 8 | rnds[9];
|
|
27338
|
+
seqLow = seqLow << 5 | rnds[10] >>> 3;
|
|
27339
|
+
}
|
|
27340
|
+
|
|
27341
|
+
// increment seq if within msecs window
|
|
27342
|
+
if (msecs + 10000 > _msecs && seq === null) {
|
|
27343
|
+
if (++seqLow > 0x7ffff) {
|
|
27344
|
+
seqLow = 0;
|
|
27345
|
+
if (++seqHigh > 0xfff) {
|
|
27346
|
+
seqHigh = 0;
|
|
27347
|
+
|
|
27348
|
+
// increment internal _msecs. this allows us to continue incrementing
|
|
27349
|
+
// while staying monotonic. Note, once we hit 10k milliseconds beyond system
|
|
27350
|
+
// clock, we will reset breaking monotonicity (after (2^31)*10000 generations)
|
|
27351
|
+
_msecs++;
|
|
27352
|
+
}
|
|
27353
|
+
}
|
|
27354
|
+
} else {
|
|
27355
|
+
// resetting; we have advanced more than
|
|
27356
|
+
// 10k milliseconds beyond system clock
|
|
27357
|
+
_msecs = msecs;
|
|
27358
|
+
}
|
|
27359
|
+
_seqHigh = seqHigh;
|
|
27360
|
+
_seqLow = seqLow;
|
|
27361
|
+
|
|
27362
|
+
// [bytes 0-5] 48 bits of local timestamp
|
|
27363
|
+
b[i++] = _msecs / 0x10000000000 & 0xff;
|
|
27364
|
+
b[i++] = _msecs / 0x100000000 & 0xff;
|
|
27365
|
+
b[i++] = _msecs / 0x1000000 & 0xff;
|
|
27366
|
+
b[i++] = _msecs / 0x10000 & 0xff;
|
|
27367
|
+
b[i++] = _msecs / 0x100 & 0xff;
|
|
27368
|
+
b[i++] = _msecs & 0xff;
|
|
27369
|
+
|
|
27370
|
+
// [byte 6] - set 4 bits of version (7) with first 4 bits seq_hi
|
|
27371
|
+
b[i++] = seqHigh >>> 4 & 0x0f | 0x70;
|
|
27372
|
+
|
|
27373
|
+
// [byte 7] remaining 8 bits of seq_hi
|
|
27374
|
+
b[i++] = seqHigh & 0xff;
|
|
27375
|
+
|
|
27376
|
+
// [byte 8] - variant (2 bits), first 6 bits seq_low
|
|
27377
|
+
b[i++] = seqLow >>> 13 & 0x3f | 0x80;
|
|
27378
|
+
|
|
27379
|
+
// [byte 9] 8 bits seq_low
|
|
27380
|
+
b[i++] = seqLow >>> 5 & 0xff;
|
|
27381
|
+
|
|
27382
|
+
// [byte 10] remaining 5 bits seq_low, 3 bits random
|
|
27383
|
+
b[i++] = seqLow << 3 & 0xff | rnds[10] & 0x07;
|
|
27384
|
+
|
|
27385
|
+
// [bytes 11-15] always random
|
|
27386
|
+
b[i++] = rnds[11];
|
|
27387
|
+
b[i++] = rnds[12];
|
|
27388
|
+
b[i++] = rnds[13];
|
|
27389
|
+
b[i++] = rnds[14];
|
|
27390
|
+
b[i++] = rnds[15];
|
|
27391
|
+
return buf || (0, _stringify.unsafeStringify)(b);
|
|
27392
|
+
}
|
|
27393
|
+
var _default = exports.default = v7;
|
|
27394
|
+
},{"./rng.js":503,"./stringify.js":505}],515:[function(_dereq_,module,exports){
|
|
27395
|
+
"use strict";
|
|
27396
|
+
|
|
27397
|
+
Object.defineProperty(exports, "__esModule", {
|
|
27398
|
+
value: true
|
|
27399
|
+
});
|
|
27400
|
+
exports.default = void 0;
|
|
27401
|
+
var _regex = _interopRequireDefault(_dereq_("./regex.js"));
|
|
27402
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27195
27403
|
function validate(uuid) {
|
|
27196
27404
|
return typeof uuid === 'string' && _regex.default.test(uuid);
|
|
27197
27405
|
}
|
|
27198
|
-
|
|
27199
|
-
|
|
27200
|
-
exports.default = _default;
|
|
27201
|
-
},{"./regex.js":501}],511:[function(_dereq_,module,exports){
|
|
27406
|
+
var _default = exports.default = validate;
|
|
27407
|
+
},{"./regex.js":502}],516:[function(_dereq_,module,exports){
|
|
27202
27408
|
"use strict";
|
|
27203
27409
|
|
|
27204
27410
|
Object.defineProperty(exports, "__esModule", {
|
|
27205
27411
|
value: true
|
|
27206
27412
|
});
|
|
27207
27413
|
exports.default = void 0;
|
|
27208
|
-
|
|
27209
27414
|
var _validate = _interopRequireDefault(_dereq_("./validate.js"));
|
|
27210
|
-
|
|
27211
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27212
|
-
|
|
27415
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27213
27416
|
function version(uuid) {
|
|
27214
27417
|
if (!(0, _validate.default)(uuid)) {
|
|
27215
27418
|
throw TypeError('Invalid UUID');
|
|
27216
27419
|
}
|
|
27217
|
-
|
|
27218
27420
|
return parseInt(uuid.slice(14, 15), 16);
|
|
27219
27421
|
}
|
|
27220
|
-
|
|
27221
|
-
|
|
27222
|
-
exports.default = _default;
|
|
27223
|
-
},{"./validate.js":510}],512:[function(_dereq_,module,exports){
|
|
27422
|
+
var _default = exports.default = version;
|
|
27423
|
+
},{"./validate.js":515}],517:[function(_dereq_,module,exports){
|
|
27224
27424
|
'use strict';
|
|
27225
27425
|
|
|
27226
27426
|
module.exports = function () {
|