@swagger-api/apidom-core 0.76.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -530,7 +530,6 @@ __webpack_require__.r(__webpack_exports__);
530
530
  /* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68322);
531
531
  /* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(short_unique_id__WEBPACK_IMPORTED_MODULE_0__);
532
532
  /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67952);
533
- // @ts-ignore
534
533
 
535
534
 
536
535
 
@@ -551,7 +550,7 @@ const plugin = ({
551
550
  visitor: {
552
551
  enter(element) {
553
552
  // eslint-disable-next-line no-param-reassign
554
- element.id = new minim__WEBPACK_IMPORTED_MODULE_1__.StringElement(uuid());
553
+ element.id = new minim__WEBPACK_IMPORTED_MODULE_1__.StringElement(uuid.randomUUID());
555
554
  }
556
555
  },
557
556
  post() {
@@ -574,7 +573,6 @@ __webpack_require__.r(__webpack_exports__);
574
573
  /* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68322);
575
574
  /* harmony import */ var short_unique_id__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(short_unique_id__WEBPACK_IMPORTED_MODULE_0__);
576
575
  /* harmony import */ var minim__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(67952);
577
- // @ts-ignore
578
576
 
579
577
 
580
578
 
@@ -598,7 +596,7 @@ const plugin = ({
598
596
  enter(element) {
599
597
  if (!predicates.isPrimitiveElement(element)) {
600
598
  // eslint-disable-next-line no-param-reassign
601
- element.id = new minim__WEBPACK_IMPORTED_MODULE_1__.StringElement(uuid());
599
+ element.id = new minim__WEBPACK_IMPORTED_MODULE_1__.StringElement(uuid.randomUUID());
602
600
  }
603
601
  }
604
602
  },
@@ -1650,6 +1648,16 @@ const dereference = (object, root) => {
1650
1648
  }, object);
1651
1649
  };
1652
1650
 
1651
+ /***/ }),
1652
+
1653
+ /***/ 60042:
1654
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1655
+
1656
+ var parent = __webpack_require__(35846);
1657
+
1658
+ module.exports = parent;
1659
+
1660
+
1653
1661
  /***/ }),
1654
1662
 
1655
1663
  /***/ 28385:
@@ -1724,6 +1732,21 @@ var parent = __webpack_require__(16042);
1724
1732
  module.exports = parent;
1725
1733
 
1726
1734
 
1735
+ /***/ }),
1736
+
1737
+ /***/ 56791:
1738
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1739
+
1740
+ __webpack_require__(4339);
1741
+ __webpack_require__(4242);
1742
+ __webpack_require__(84016);
1743
+ __webpack_require__(98939);
1744
+ __webpack_require__(5454);
1745
+ var path = __webpack_require__(57545);
1746
+
1747
+ module.exports = path.AggregateError;
1748
+
1749
+
1727
1750
  /***/ }),
1728
1751
 
1729
1752
  /***/ 92089:
@@ -1846,6 +1869,27 @@ var WrappedWellKnownSymbolModule = __webpack_require__(89207);
1846
1869
  module.exports = WrappedWellKnownSymbolModule.f('toPrimitive');
1847
1870
 
1848
1871
 
1872
+ /***/ }),
1873
+
1874
+ /***/ 36762:
1875
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1876
+
1877
+ module.exports = __webpack_require__(73028);
1878
+
1879
+
1880
+ /***/ }),
1881
+
1882
+ /***/ 73028:
1883
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1884
+
1885
+ // TODO: remove from `core-js@4`
1886
+ __webpack_require__(12752);
1887
+
1888
+ var parent = __webpack_require__(60042);
1889
+
1890
+ module.exports = parent;
1891
+
1892
+
1849
1893
  /***/ }),
1850
1894
 
1851
1895
  /***/ 32747:
@@ -2275,6 +2319,29 @@ module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
2275
2319
  };
2276
2320
 
2277
2321
 
2322
+ /***/ }),
2323
+
2324
+ /***/ 97987:
2325
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2326
+
2327
+ var hasOwn = __webpack_require__(64500);
2328
+ var ownKeys = __webpack_require__(93011);
2329
+ var getOwnPropertyDescriptorModule = __webpack_require__(5141);
2330
+ var definePropertyModule = __webpack_require__(42760);
2331
+
2332
+ module.exports = function (target, source, exceptions) {
2333
+ var keys = ownKeys(source);
2334
+ var defineProperty = definePropertyModule.f;
2335
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
2336
+ for (var i = 0; i < keys.length; i++) {
2337
+ var key = keys[i];
2338
+ if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
2339
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
2340
+ }
2341
+ }
2342
+ };
2343
+
2344
+
2278
2345
  /***/ }),
2279
2346
 
2280
2347
  /***/ 4635:
@@ -2572,6 +2639,65 @@ module.exports = [
2572
2639
  ];
2573
2640
 
2574
2641
 
2642
+ /***/ }),
2643
+
2644
+ /***/ 14503:
2645
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2646
+
2647
+ var uncurryThis = __webpack_require__(84120);
2648
+
2649
+ var $Error = Error;
2650
+ var replace = uncurryThis(''.replace);
2651
+
2652
+ var TEST = (function (arg) { return String($Error(arg).stack); })('zxcasd');
2653
+ // eslint-disable-next-line redos/no-vulnerable -- safe
2654
+ var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
2655
+ var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
2656
+
2657
+ module.exports = function (stack, dropEntries) {
2658
+ if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
2659
+ while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
2660
+ } return stack;
2661
+ };
2662
+
2663
+
2664
+ /***/ }),
2665
+
2666
+ /***/ 58266:
2667
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2668
+
2669
+ var createNonEnumerableProperty = __webpack_require__(98711);
2670
+ var clearErrorStack = __webpack_require__(14503);
2671
+ var ERROR_STACK_INSTALLABLE = __webpack_require__(50274);
2672
+
2673
+ // non-standard V8
2674
+ var captureStackTrace = Error.captureStackTrace;
2675
+
2676
+ module.exports = function (error, C, stack, dropEntries) {
2677
+ if (ERROR_STACK_INSTALLABLE) {
2678
+ if (captureStackTrace) captureStackTrace(error, C);
2679
+ else createNonEnumerableProperty(error, 'stack', clearErrorStack(stack, dropEntries));
2680
+ }
2681
+ };
2682
+
2683
+
2684
+ /***/ }),
2685
+
2686
+ /***/ 50274:
2687
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2688
+
2689
+ var fails = __webpack_require__(76192);
2690
+ var createPropertyDescriptor = __webpack_require__(90774);
2691
+
2692
+ module.exports = !fails(function () {
2693
+ var error = Error('a');
2694
+ if (!('stack' in error)) return true;
2695
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
2696
+ Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
2697
+ return error.stack !== 7;
2698
+ });
2699
+
2700
+
2575
2701
  /***/ }),
2576
2702
 
2577
2703
  /***/ 93085:
@@ -2855,6 +2981,46 @@ module.exports = function (namespace, method) {
2855
2981
  };
2856
2982
 
2857
2983
 
2984
+ /***/ }),
2985
+
2986
+ /***/ 78703:
2987
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2988
+
2989
+ var classof = __webpack_require__(4696);
2990
+ var getMethod = __webpack_require__(75037);
2991
+ var isNullOrUndefined = __webpack_require__(75646);
2992
+ var Iterators = __webpack_require__(82621);
2993
+ var wellKnownSymbol = __webpack_require__(18182);
2994
+
2995
+ var ITERATOR = wellKnownSymbol('iterator');
2996
+
2997
+ module.exports = function (it) {
2998
+ if (!isNullOrUndefined(it)) return getMethod(it, ITERATOR)
2999
+ || getMethod(it, '@@iterator')
3000
+ || Iterators[classof(it)];
3001
+ };
3002
+
3003
+
3004
+ /***/ }),
3005
+
3006
+ /***/ 61669:
3007
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3008
+
3009
+ var call = __webpack_require__(18922);
3010
+ var aCallable = __webpack_require__(66235);
3011
+ var anObject = __webpack_require__(31138);
3012
+ var tryToString = __webpack_require__(79288);
3013
+ var getIteratorMethod = __webpack_require__(78703);
3014
+
3015
+ var $TypeError = TypeError;
3016
+
3017
+ module.exports = function (argument, usingIterator) {
3018
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
3019
+ if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));
3020
+ throw $TypeError(tryToString(argument) + ' is not iterable');
3021
+ };
3022
+
3023
+
2858
3024
  /***/ }),
2859
3025
 
2860
3026
  /***/ 19202:
@@ -3004,6 +3170,31 @@ module.exports = fails(function () {
3004
3170
  } : $Object;
3005
3171
 
3006
3172
 
3173
+ /***/ }),
3174
+
3175
+ /***/ 62643:
3176
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3177
+
3178
+ var isCallable = __webpack_require__(16447);
3179
+ var isObject = __webpack_require__(35744);
3180
+ var setPrototypeOf = __webpack_require__(24469);
3181
+
3182
+ // makes subclassing work correct for wrapped built-ins
3183
+ module.exports = function ($this, dummy, Wrapper) {
3184
+ var NewTarget, NewTargetPrototype;
3185
+ if (
3186
+ // it can work only with native `setPrototypeOf`
3187
+ setPrototypeOf &&
3188
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
3189
+ isCallable(NewTarget = dummy.constructor) &&
3190
+ NewTarget !== Wrapper &&
3191
+ isObject(NewTargetPrototype = NewTarget.prototype) &&
3192
+ NewTargetPrototype !== Wrapper.prototype
3193
+ ) setPrototypeOf($this, NewTargetPrototype);
3194
+ return $this;
3195
+ };
3196
+
3197
+
3007
3198
  /***/ }),
3008
3199
 
3009
3200
  /***/ 19516:
@@ -3025,6 +3216,23 @@ if (!isCallable(store.inspectSource)) {
3025
3216
  module.exports = store.inspectSource;
3026
3217
 
3027
3218
 
3219
+ /***/ }),
3220
+
3221
+ /***/ 10273:
3222
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3223
+
3224
+ var isObject = __webpack_require__(35744);
3225
+ var createNonEnumerableProperty = __webpack_require__(98711);
3226
+
3227
+ // `InstallErrorCause` abstract operation
3228
+ // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
3229
+ module.exports = function (O, options) {
3230
+ if (isObject(options) && 'cause' in options) {
3231
+ createNonEnumerableProperty(O, 'cause', options.cause);
3232
+ }
3233
+ };
3234
+
3235
+
3028
3236
  /***/ }),
3029
3237
 
3030
3238
  /***/ 73326:
@@ -3102,6 +3310,23 @@ module.exports = {
3102
3310
  };
3103
3311
 
3104
3312
 
3313
+ /***/ }),
3314
+
3315
+ /***/ 96109:
3316
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3317
+
3318
+ var wellKnownSymbol = __webpack_require__(18182);
3319
+ var Iterators = __webpack_require__(82621);
3320
+
3321
+ var ITERATOR = wellKnownSymbol('iterator');
3322
+ var ArrayPrototype = Array.prototype;
3323
+
3324
+ // check on default Array iterator
3325
+ module.exports = function (it) {
3326
+ return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
3327
+ };
3328
+
3329
+
3105
3330
  /***/ }),
3106
3331
 
3107
3332
  /***/ 34770:
@@ -3280,6 +3505,111 @@ module.exports = USE_SYMBOL_AS_UID ? function (it) {
3280
3505
  };
3281
3506
 
3282
3507
 
3508
+ /***/ }),
3509
+
3510
+ /***/ 33442:
3511
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3512
+
3513
+ var bind = __webpack_require__(8043);
3514
+ var call = __webpack_require__(18922);
3515
+ var anObject = __webpack_require__(31138);
3516
+ var tryToString = __webpack_require__(79288);
3517
+ var isArrayIteratorMethod = __webpack_require__(96109);
3518
+ var lengthOfArrayLike = __webpack_require__(84104);
3519
+ var isPrototypeOf = __webpack_require__(8902);
3520
+ var getIterator = __webpack_require__(61669);
3521
+ var getIteratorMethod = __webpack_require__(78703);
3522
+ var iteratorClose = __webpack_require__(66639);
3523
+
3524
+ var $TypeError = TypeError;
3525
+
3526
+ var Result = function (stopped, result) {
3527
+ this.stopped = stopped;
3528
+ this.result = result;
3529
+ };
3530
+
3531
+ var ResultPrototype = Result.prototype;
3532
+
3533
+ module.exports = function (iterable, unboundFunction, options) {
3534
+ var that = options && options.that;
3535
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
3536
+ var IS_RECORD = !!(options && options.IS_RECORD);
3537
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
3538
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
3539
+ var fn = bind(unboundFunction, that);
3540
+ var iterator, iterFn, index, length, result, next, step;
3541
+
3542
+ var stop = function (condition) {
3543
+ if (iterator) iteratorClose(iterator, 'normal', condition);
3544
+ return new Result(true, condition);
3545
+ };
3546
+
3547
+ var callFn = function (value) {
3548
+ if (AS_ENTRIES) {
3549
+ anObject(value);
3550
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
3551
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
3552
+ };
3553
+
3554
+ if (IS_RECORD) {
3555
+ iterator = iterable.iterator;
3556
+ } else if (IS_ITERATOR) {
3557
+ iterator = iterable;
3558
+ } else {
3559
+ iterFn = getIteratorMethod(iterable);
3560
+ if (!iterFn) throw $TypeError(tryToString(iterable) + ' is not iterable');
3561
+ // optimisation for array iterators
3562
+ if (isArrayIteratorMethod(iterFn)) {
3563
+ for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
3564
+ result = callFn(iterable[index]);
3565
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
3566
+ } return new Result(false);
3567
+ }
3568
+ iterator = getIterator(iterable, iterFn);
3569
+ }
3570
+
3571
+ next = IS_RECORD ? iterable.next : iterator.next;
3572
+ while (!(step = call(next, iterator)).done) {
3573
+ try {
3574
+ result = callFn(step.value);
3575
+ } catch (error) {
3576
+ iteratorClose(iterator, 'throw', error);
3577
+ }
3578
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
3579
+ } return new Result(false);
3580
+ };
3581
+
3582
+
3583
+ /***/ }),
3584
+
3585
+ /***/ 66639:
3586
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3587
+
3588
+ var call = __webpack_require__(18922);
3589
+ var anObject = __webpack_require__(31138);
3590
+ var getMethod = __webpack_require__(75037);
3591
+
3592
+ module.exports = function (iterator, kind, value) {
3593
+ var innerResult, innerError;
3594
+ anObject(iterator);
3595
+ try {
3596
+ innerResult = getMethod(iterator, 'return');
3597
+ if (!innerResult) {
3598
+ if (kind === 'throw') throw value;
3599
+ return value;
3600
+ }
3601
+ innerResult = call(innerResult, iterator);
3602
+ } catch (error) {
3603
+ innerError = true;
3604
+ innerResult = error;
3605
+ }
3606
+ if (kind === 'throw') throw value;
3607
+ if (innerError) throw innerResult;
3608
+ anObject(innerResult);
3609
+ return value;
3610
+ };
3611
+
3612
+
3283
3613
  /***/ }),
3284
3614
 
3285
3615
  /***/ 25695:
@@ -3507,6 +3837,18 @@ module.exports = Math.trunc || function trunc(x) {
3507
3837
  };
3508
3838
 
3509
3839
 
3840
+ /***/ }),
3841
+
3842
+ /***/ 36016:
3843
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3844
+
3845
+ var toString = __webpack_require__(44845);
3846
+
3847
+ module.exports = function (argument, $default) {
3848
+ return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
3849
+ };
3850
+
3851
+
3510
3852
  /***/ }),
3511
3853
 
3512
3854
  /***/ 52853:
@@ -3935,6 +4277,27 @@ module.exports = function (input, pref) {
3935
4277
  };
3936
4278
 
3937
4279
 
4280
+ /***/ }),
4281
+
4282
+ /***/ 93011:
4283
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4284
+
4285
+ var getBuiltIn = __webpack_require__(10150);
4286
+ var uncurryThis = __webpack_require__(84120);
4287
+ var getOwnPropertyNamesModule = __webpack_require__(92092);
4288
+ var getOwnPropertySymbolsModule = __webpack_require__(84750);
4289
+ var anObject = __webpack_require__(31138);
4290
+
4291
+ var concat = uncurryThis([].concat);
4292
+
4293
+ // all object keys, includes non-enumerable and symbols
4294
+ module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
4295
+ var keys = getOwnPropertyNamesModule.f(anObject(it));
4296
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
4297
+ return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
4298
+ };
4299
+
4300
+
3938
4301
  /***/ }),
3939
4302
 
3940
4303
  /***/ 57545:
@@ -3943,6 +4306,22 @@ module.exports = function (input, pref) {
3943
4306
  module.exports = {};
3944
4307
 
3945
4308
 
4309
+ /***/ }),
4310
+
4311
+ /***/ 67656:
4312
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4313
+
4314
+ var defineProperty = (__webpack_require__(42760).f);
4315
+
4316
+ module.exports = function (Target, Source, key) {
4317
+ key in Target || defineProperty(Target, key, {
4318
+ configurable: true,
4319
+ get: function () { return Source[key]; },
4320
+ set: function (it) { Source[key] = it; }
4321
+ });
4322
+ };
4323
+
4324
+
3946
4325
  /***/ }),
3947
4326
 
3948
4327
  /***/ 13209:
@@ -4493,6 +4872,176 @@ module.exports = function (name) {
4493
4872
  };
4494
4873
 
4495
4874
 
4875
+ /***/ }),
4876
+
4877
+ /***/ 20426:
4878
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4879
+
4880
+ "use strict";
4881
+
4882
+ var getBuiltIn = __webpack_require__(10150);
4883
+ var hasOwn = __webpack_require__(64500);
4884
+ var createNonEnumerableProperty = __webpack_require__(98711);
4885
+ var isPrototypeOf = __webpack_require__(8902);
4886
+ var setPrototypeOf = __webpack_require__(24469);
4887
+ var copyConstructorProperties = __webpack_require__(97987);
4888
+ var proxyAccessor = __webpack_require__(67656);
4889
+ var inheritIfRequired = __webpack_require__(62643);
4890
+ var normalizeStringArgument = __webpack_require__(36016);
4891
+ var installErrorCause = __webpack_require__(10273);
4892
+ var installErrorStack = __webpack_require__(58266);
4893
+ var DESCRIPTORS = __webpack_require__(50069);
4894
+ var IS_PURE = __webpack_require__(85546);
4895
+
4896
+ module.exports = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
4897
+ var STACK_TRACE_LIMIT = 'stackTraceLimit';
4898
+ var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
4899
+ var path = FULL_NAME.split('.');
4900
+ var ERROR_NAME = path[path.length - 1];
4901
+ var OriginalError = getBuiltIn.apply(null, path);
4902
+
4903
+ if (!OriginalError) return;
4904
+
4905
+ var OriginalErrorPrototype = OriginalError.prototype;
4906
+
4907
+ // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
4908
+ if (!IS_PURE && hasOwn(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;
4909
+
4910
+ if (!FORCED) return OriginalError;
4911
+
4912
+ var BaseError = getBuiltIn('Error');
4913
+
4914
+ var WrappedError = wrapper(function (a, b) {
4915
+ var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
4916
+ var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
4917
+ if (message !== undefined) createNonEnumerableProperty(result, 'message', message);
4918
+ installErrorStack(result, WrappedError, result.stack, 2);
4919
+ if (this && isPrototypeOf(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError);
4920
+ if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
4921
+ return result;
4922
+ });
4923
+
4924
+ WrappedError.prototype = OriginalErrorPrototype;
4925
+
4926
+ if (ERROR_NAME !== 'Error') {
4927
+ if (setPrototypeOf) setPrototypeOf(WrappedError, BaseError);
4928
+ else copyConstructorProperties(WrappedError, BaseError, { name: true });
4929
+ } else if (DESCRIPTORS && STACK_TRACE_LIMIT in OriginalError) {
4930
+ proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT);
4931
+ proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace');
4932
+ }
4933
+
4934
+ copyConstructorProperties(WrappedError, OriginalError);
4935
+
4936
+ if (!IS_PURE) try {
4937
+ // Safari 13- bug: WebAssembly errors does not have a proper `.name`
4938
+ if (OriginalErrorPrototype.name !== ERROR_NAME) {
4939
+ createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME);
4940
+ }
4941
+ OriginalErrorPrototype.constructor = WrappedError;
4942
+ } catch (error) { /* empty */ }
4943
+
4944
+ return WrappedError;
4945
+ };
4946
+
4947
+
4948
+ /***/ }),
4949
+
4950
+ /***/ 84016:
4951
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
4952
+
4953
+ var $ = __webpack_require__(93085);
4954
+ var getBuiltIn = __webpack_require__(10150);
4955
+ var apply = __webpack_require__(86298);
4956
+ var fails = __webpack_require__(76192);
4957
+ var wrapErrorConstructorWithCause = __webpack_require__(20426);
4958
+
4959
+ var AGGREGATE_ERROR = 'AggregateError';
4960
+ var $AggregateError = getBuiltIn(AGGREGATE_ERROR);
4961
+
4962
+ var FORCED = !fails(function () {
4963
+ return $AggregateError([1]).errors[0] !== 1;
4964
+ }) && fails(function () {
4965
+ return $AggregateError([1], AGGREGATE_ERROR, { cause: 7 }).cause !== 7;
4966
+ });
4967
+
4968
+ // https://tc39.es/ecma262/#sec-aggregate-error
4969
+ $({ global: true, constructor: true, arity: 2, forced: FORCED }, {
4970
+ AggregateError: wrapErrorConstructorWithCause(AGGREGATE_ERROR, function (init) {
4971
+ // eslint-disable-next-line no-unused-vars -- required for functions `.length`
4972
+ return function AggregateError(errors, message) { return apply(init, this, arguments); };
4973
+ }, FORCED, true)
4974
+ });
4975
+
4976
+
4977
+ /***/ }),
4978
+
4979
+ /***/ 93820:
4980
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
4981
+
4982
+ "use strict";
4983
+
4984
+ var $ = __webpack_require__(93085);
4985
+ var isPrototypeOf = __webpack_require__(8902);
4986
+ var getPrototypeOf = __webpack_require__(89341);
4987
+ var setPrototypeOf = __webpack_require__(24469);
4988
+ var copyConstructorProperties = __webpack_require__(97987);
4989
+ var create = __webpack_require__(52853);
4990
+ var createNonEnumerableProperty = __webpack_require__(98711);
4991
+ var createPropertyDescriptor = __webpack_require__(90774);
4992
+ var installErrorCause = __webpack_require__(10273);
4993
+ var installErrorStack = __webpack_require__(58266);
4994
+ var iterate = __webpack_require__(33442);
4995
+ var normalizeStringArgument = __webpack_require__(36016);
4996
+ var wellKnownSymbol = __webpack_require__(18182);
4997
+
4998
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
4999
+ var $Error = Error;
5000
+ var push = [].push;
5001
+
5002
+ var $AggregateError = function AggregateError(errors, message /* , options */) {
5003
+ var isInstance = isPrototypeOf(AggregateErrorPrototype, this);
5004
+ var that;
5005
+ if (setPrototypeOf) {
5006
+ that = setPrototypeOf($Error(), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype);
5007
+ } else {
5008
+ that = isInstance ? this : create(AggregateErrorPrototype);
5009
+ createNonEnumerableProperty(that, TO_STRING_TAG, 'Error');
5010
+ }
5011
+ if (message !== undefined) createNonEnumerableProperty(that, 'message', normalizeStringArgument(message));
5012
+ installErrorStack(that, $AggregateError, that.stack, 1);
5013
+ if (arguments.length > 2) installErrorCause(that, arguments[2]);
5014
+ var errorsArray = [];
5015
+ iterate(errors, push, { that: errorsArray });
5016
+ createNonEnumerableProperty(that, 'errors', errorsArray);
5017
+ return that;
5018
+ };
5019
+
5020
+ if (setPrototypeOf) setPrototypeOf($AggregateError, $Error);
5021
+ else copyConstructorProperties($AggregateError, $Error, { name: true });
5022
+
5023
+ var AggregateErrorPrototype = $AggregateError.prototype = create($Error.prototype, {
5024
+ constructor: createPropertyDescriptor(1, $AggregateError),
5025
+ message: createPropertyDescriptor(1, ''),
5026
+ name: createPropertyDescriptor(1, 'AggregateError')
5027
+ });
5028
+
5029
+ // `AggregateError` constructor
5030
+ // https://tc39.es/ecma262/#sec-aggregate-error-constructor
5031
+ $({ global: true, constructor: true, arity: 2 }, {
5032
+ AggregateError: $AggregateError
5033
+ });
5034
+
5035
+
5036
+ /***/ }),
5037
+
5038
+ /***/ 4242:
5039
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
5040
+
5041
+ // TODO: Remove this module from `core-js@4` since it's replaced to module below
5042
+ __webpack_require__(93820);
5043
+
5044
+
4496
5045
  /***/ }),
4497
5046
 
4498
5047
  /***/ 59106:
@@ -4668,6 +5217,69 @@ if (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {
4668
5217
  // empty
4669
5218
 
4670
5219
 
5220
+ /***/ }),
5221
+
5222
+ /***/ 4339:
5223
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
5224
+
5225
+ /* eslint-disable no-unused-vars -- required for functions `.length` */
5226
+ var $ = __webpack_require__(93085);
5227
+ var global = __webpack_require__(98576);
5228
+ var apply = __webpack_require__(86298);
5229
+ var wrapErrorConstructorWithCause = __webpack_require__(20426);
5230
+
5231
+ var WEB_ASSEMBLY = 'WebAssembly';
5232
+ var WebAssembly = global[WEB_ASSEMBLY];
5233
+
5234
+ var FORCED = Error('e', { cause: 7 }).cause !== 7;
5235
+
5236
+ var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
5237
+ var O = {};
5238
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED);
5239
+ $({ global: true, constructor: true, arity: 1, forced: FORCED }, O);
5240
+ };
5241
+
5242
+ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
5243
+ if (WebAssembly && WebAssembly[ERROR_NAME]) {
5244
+ var O = {};
5245
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED);
5246
+ $({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED }, O);
5247
+ }
5248
+ };
5249
+
5250
+ // https://tc39.es/ecma262/#sec-nativeerror
5251
+ exportGlobalErrorCauseWrapper('Error', function (init) {
5252
+ return function Error(message) { return apply(init, this, arguments); };
5253
+ });
5254
+ exportGlobalErrorCauseWrapper('EvalError', function (init) {
5255
+ return function EvalError(message) { return apply(init, this, arguments); };
5256
+ });
5257
+ exportGlobalErrorCauseWrapper('RangeError', function (init) {
5258
+ return function RangeError(message) { return apply(init, this, arguments); };
5259
+ });
5260
+ exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
5261
+ return function ReferenceError(message) { return apply(init, this, arguments); };
5262
+ });
5263
+ exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
5264
+ return function SyntaxError(message) { return apply(init, this, arguments); };
5265
+ });
5266
+ exportGlobalErrorCauseWrapper('TypeError', function (init) {
5267
+ return function TypeError(message) { return apply(init, this, arguments); };
5268
+ });
5269
+ exportGlobalErrorCauseWrapper('URIError', function (init) {
5270
+ return function URIError(message) { return apply(init, this, arguments); };
5271
+ });
5272
+ exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
5273
+ return function CompileError(message) { return apply(init, this, arguments); };
5274
+ });
5275
+ exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
5276
+ return function LinkError(message) { return apply(init, this, arguments); };
5277
+ });
5278
+ exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
5279
+ return function RuntimeError(message) { return apply(init, this, arguments); };
5280
+ });
5281
+
5282
+
4671
5283
  /***/ }),
4672
5284
 
4673
5285
  /***/ 59704:
@@ -5388,6 +6000,15 @@ var defineWellKnownSymbol = __webpack_require__(48332);
5388
6000
  defineWellKnownSymbol('unscopables');
5389
6001
 
5390
6002
 
6003
+ /***/ }),
6004
+
6005
+ /***/ 12752:
6006
+ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
6007
+
6008
+ // TODO: Remove from `core-js@4`
6009
+ __webpack_require__(4242);
6010
+
6011
+
5391
6012
  /***/ }),
5392
6013
 
5393
6014
  /***/ 17148:
@@ -5592,6 +6213,20 @@ for (var COLLECTION_NAME in DOMIterables) {
5592
6213
  }
5593
6214
 
5594
6215
 
6216
+ /***/ }),
6217
+
6218
+ /***/ 35846:
6219
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6220
+
6221
+ // TODO: remove from `core-js@4`
6222
+ __webpack_require__(12752);
6223
+
6224
+ var parent = __webpack_require__(56791);
6225
+ __webpack_require__(80162);
6226
+
6227
+ module.exports = parent;
6228
+
6229
+
5595
6230
  /***/ }),
5596
6231
 
5597
6232
  /***/ 26174:
@@ -12105,8 +12740,12 @@ var trimCharsStart = (0,ramda__WEBPACK_IMPORTED_MODULE_0__.curry)(function (char
12105
12740
  /***/ 68322:
12106
12741
  /***/ ((module) => {
12107
12742
 
12743
+ "use strict";
12744
+
12108
12745
  var ShortUniqueId = (() => {
12109
12746
  var __defProp = Object.defineProperty;
12747
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12748
+ var __getOwnPropNames = Object.getOwnPropertyNames;
12110
12749
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12111
12750
  var __hasOwnProp = Object.prototype.hasOwnProperty;
12112
12751
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -12122,22 +12761,34 @@ var ShortUniqueId = (() => {
12122
12761
  }
12123
12762
  return a;
12124
12763
  };
12125
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
12126
12764
  var __export = (target, all) => {
12127
- __markAsModule(target);
12128
12765
  for (var name in all)
12129
12766
  __defProp(target, name, { get: all[name], enumerable: true });
12130
12767
  };
12768
+ var __copyProps = (to, from, except, desc) => {
12769
+ if (from && typeof from === "object" || typeof from === "function") {
12770
+ for (let key of __getOwnPropNames(from))
12771
+ if (!__hasOwnProp.call(to, key) && key !== except)
12772
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12773
+ }
12774
+ return to;
12775
+ };
12776
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
12777
+ var __publicField = (obj, key, value) => {
12778
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12779
+ return value;
12780
+ };
12131
12781
 
12132
12782
  // src/index.ts
12133
12783
  var src_exports = {};
12134
12784
  __export(src_exports, {
12785
+ DEFAULT_OPTIONS: () => DEFAULT_OPTIONS,
12135
12786
  DEFAULT_UUID_LENGTH: () => DEFAULT_UUID_LENGTH,
12136
12787
  default: () => ShortUniqueId
12137
12788
  });
12138
12789
 
12139
12790
  // package.json
12140
- var version = "4.4.4";
12791
+ var version = "5.0.2";
12141
12792
 
12142
12793
  // src/index.ts
12143
12794
  var DEFAULT_UUID_LENGTH = 6;
@@ -12145,54 +12796,70 @@ var ShortUniqueId = (() => {
12145
12796
  dictionary: "alphanum",
12146
12797
  shuffle: true,
12147
12798
  debug: false,
12148
- length: DEFAULT_UUID_LENGTH
12799
+ length: DEFAULT_UUID_LENGTH,
12800
+ counter: 0
12149
12801
  };
12150
- var _ShortUniqueId = class extends Function {
12802
+ var _ShortUniqueId = class _ShortUniqueId {
12151
12803
  constructor(argOptions = {}) {
12152
- super();
12153
- this.dictIndex = 0;
12154
- this.dictRange = [];
12155
- this.lowerBound = 0;
12156
- this.upperBound = 0;
12157
- this.dictLength = 0;
12158
- this._digit_first_ascii = 48;
12159
- this._digit_last_ascii = 58;
12160
- this._alpha_lower_first_ascii = 97;
12161
- this._alpha_lower_last_ascii = 123;
12162
- this._hex_last_ascii = 103;
12163
- this._alpha_upper_first_ascii = 65;
12164
- this._alpha_upper_last_ascii = 91;
12165
- this._number_dict_ranges = {
12804
+ __publicField(this, "counter");
12805
+ __publicField(this, "debug");
12806
+ __publicField(this, "dict");
12807
+ __publicField(this, "version");
12808
+ __publicField(this, "dictIndex", 0);
12809
+ __publicField(this, "dictRange", []);
12810
+ __publicField(this, "lowerBound", 0);
12811
+ __publicField(this, "upperBound", 0);
12812
+ __publicField(this, "dictLength", 0);
12813
+ __publicField(this, "uuidLength");
12814
+ __publicField(this, "_digit_first_ascii", 48);
12815
+ __publicField(this, "_digit_last_ascii", 58);
12816
+ __publicField(this, "_alpha_lower_first_ascii", 97);
12817
+ __publicField(this, "_alpha_lower_last_ascii", 123);
12818
+ __publicField(this, "_hex_last_ascii", 103);
12819
+ __publicField(this, "_alpha_upper_first_ascii", 65);
12820
+ __publicField(this, "_alpha_upper_last_ascii", 91);
12821
+ __publicField(this, "_number_dict_ranges", {
12166
12822
  digits: [this._digit_first_ascii, this._digit_last_ascii]
12167
- };
12168
- this._alpha_dict_ranges = {
12823
+ });
12824
+ __publicField(this, "_alpha_dict_ranges", {
12169
12825
  lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
12170
12826
  upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
12171
- };
12172
- this._alpha_lower_dict_ranges = {
12827
+ });
12828
+ __publicField(this, "_alpha_lower_dict_ranges", {
12173
12829
  lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
12174
- };
12175
- this._alpha_upper_dict_ranges = {
12830
+ });
12831
+ __publicField(this, "_alpha_upper_dict_ranges", {
12176
12832
  upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
12177
- };
12178
- this._alphanum_dict_ranges = {
12833
+ });
12834
+ __publicField(this, "_alphanum_dict_ranges", {
12179
12835
  digits: [this._digit_first_ascii, this._digit_last_ascii],
12180
12836
  lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii],
12181
12837
  upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
12182
- };
12183
- this._alphanum_lower_dict_ranges = {
12838
+ });
12839
+ __publicField(this, "_alphanum_lower_dict_ranges", {
12184
12840
  digits: [this._digit_first_ascii, this._digit_last_ascii],
12185
12841
  lowerCase: [this._alpha_lower_first_ascii, this._alpha_lower_last_ascii]
12186
- };
12187
- this._alphanum_upper_dict_ranges = {
12842
+ });
12843
+ __publicField(this, "_alphanum_upper_dict_ranges", {
12188
12844
  digits: [this._digit_first_ascii, this._digit_last_ascii],
12189
12845
  upperCase: [this._alpha_upper_first_ascii, this._alpha_upper_last_ascii]
12190
- };
12191
- this._hex_dict_ranges = {
12846
+ });
12847
+ __publicField(this, "_hex_dict_ranges", {
12192
12848
  decDigits: [this._digit_first_ascii, this._digit_last_ascii],
12193
12849
  alphaDigits: [this._alpha_lower_first_ascii, this._hex_last_ascii]
12194
- };
12195
- this.log = (...args) => {
12850
+ });
12851
+ __publicField(this, "_dict_ranges", {
12852
+ _number_dict_ranges: this._number_dict_ranges,
12853
+ _alpha_dict_ranges: this._alpha_dict_ranges,
12854
+ _alpha_lower_dict_ranges: this._alpha_lower_dict_ranges,
12855
+ _alpha_upper_dict_ranges: this._alpha_upper_dict_ranges,
12856
+ _alphanum_dict_ranges: this._alphanum_dict_ranges,
12857
+ _alphanum_lower_dict_ranges: this._alphanum_lower_dict_ranges,
12858
+ _alphanum_upper_dict_ranges: this._alphanum_upper_dict_ranges,
12859
+ _hex_dict_ranges: this._hex_dict_ranges
12860
+ });
12861
+ /* tslint:disable consistent-return */
12862
+ __publicField(this, "log", (...args) => {
12196
12863
  const finalArgs = [...args];
12197
12864
  finalArgs[0] = `[short-unique-id] ${args[0]}`;
12198
12865
  if (this.debug === true) {
@@ -12200,8 +12867,10 @@ var ShortUniqueId = (() => {
12200
12867
  return console.log(...finalArgs);
12201
12868
  }
12202
12869
  }
12203
- };
12204
- this.setDictionary = (dictionary, shuffle) => {
12870
+ });
12871
+ /* tslint:enable consistent-return */
12872
+ /** Change the dictionary after initialization. */
12873
+ __publicField(this, "setDictionary", (dictionary, shuffle) => {
12205
12874
  let finalDict;
12206
12875
  if (dictionary && Array.isArray(dictionary) && dictionary.length > 1) {
12207
12876
  finalDict = dictionary;
@@ -12210,7 +12879,7 @@ var ShortUniqueId = (() => {
12210
12879
  let i;
12211
12880
  this.dictIndex = i = 0;
12212
12881
  const rangesName = `_${dictionary}_dict_ranges`;
12213
- const ranges = this[rangesName];
12882
+ const ranges = this._dict_ranges[rangesName];
12214
12883
  Object.keys(ranges).forEach((rangeType) => {
12215
12884
  const rangeTypeKey = rangeType;
12216
12885
  this.dictRange = ranges[rangeTypeKey];
@@ -12227,12 +12896,16 @@ var ShortUniqueId = (() => {
12227
12896
  }
12228
12897
  this.dict = finalDict;
12229
12898
  this.dictLength = this.dict.length;
12230
- this.counter = 0;
12231
- };
12232
- this.seq = () => {
12899
+ this.setCounter(0);
12900
+ });
12901
+ __publicField(this, "seq", () => {
12233
12902
  return this.sequentialUUID();
12234
- };
12235
- this.sequentialUUID = () => {
12903
+ });
12904
+ /**
12905
+ * Generates UUID based on internal counter that's incremented after each ID generation.
12906
+ * @alias `const uid = new ShortUniqueId(); uid.seq();`
12907
+ */
12908
+ __publicField(this, "sequentialUUID", () => {
12236
12909
  let counterDiv;
12237
12910
  let counterRem;
12238
12911
  let id = "";
@@ -12244,8 +12917,15 @@ var ShortUniqueId = (() => {
12244
12917
  } while (counterDiv !== 0);
12245
12918
  this.counter += 1;
12246
12919
  return id;
12247
- };
12248
- this.randomUUID = (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
12920
+ });
12921
+ __publicField(this, "rnd", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
12922
+ return this.randomUUID(uuidLength);
12923
+ });
12924
+ /**
12925
+ * Generates UUID by creating each part randomly.
12926
+ * @alias `const uid = new ShortUniqueId(); uid.rnd(uuidLength: number);`
12927
+ */
12928
+ __publicField(this, "randomUUID", (uuidLength = this.uuidLength || DEFAULT_UUID_LENGTH) => {
12249
12929
  let id;
12250
12930
  let randomPartIdx;
12251
12931
  let j;
@@ -12255,44 +12935,234 @@ var ShortUniqueId = (() => {
12255
12935
  const isPositive = uuidLength >= 0;
12256
12936
  id = "";
12257
12937
  for (j = 0; j < uuidLength; j += 1) {
12258
- randomPartIdx = parseInt((Math.random() * this.dictLength).toFixed(0), 10) % this.dictLength;
12938
+ randomPartIdx = parseInt(
12939
+ (Math.random() * this.dictLength).toFixed(0),
12940
+ 10
12941
+ ) % this.dictLength;
12259
12942
  id += this.dict[randomPartIdx];
12260
12943
  }
12261
12944
  return id;
12262
- };
12263
- this.availableUUIDs = (uuidLength = this.uuidLength) => {
12264
- return parseFloat(Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0));
12265
- };
12266
- this.approxMaxBeforeCollision = (rounds = this.availableUUIDs(this.uuidLength)) => {
12267
- return parseFloat(Math.sqrt(Math.PI / 2 * rounds).toFixed(20));
12268
- };
12269
- this.collisionProbability = (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
12270
- return parseFloat((this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20));
12271
- };
12272
- this.uniqueness = (rounds = this.availableUUIDs(this.uuidLength)) => {
12273
- const score = parseFloat((1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20));
12945
+ });
12946
+ __publicField(this, "fmt", (format, date) => {
12947
+ return this.formattedUUID(format, date);
12948
+ });
12949
+ /**
12950
+ * Generates custom UUID with the provided format string.
12951
+ * @alias `const uid = new ShortUniqueId(); uid.fmt(format: string);`
12952
+ */
12953
+ __publicField(this, "formattedUUID", (format, date) => {
12954
+ const fnMap = {
12955
+ "$r": this.randomUUID,
12956
+ "$s": this.sequentialUUID,
12957
+ "$t": this.stamp
12958
+ };
12959
+ const result = format.replace(
12960
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
12961
+ (m) => {
12962
+ const fn = m.slice(0, 2);
12963
+ const len = parseInt(m.slice(2), 10);
12964
+ if (fn === "$s") {
12965
+ return fnMap[fn]().padStart(len, "0");
12966
+ }
12967
+ if (fn === "$t" && date) {
12968
+ return fnMap[fn](len, date);
12969
+ }
12970
+ return fnMap[fn](len);
12971
+ }
12972
+ );
12973
+ return result;
12974
+ });
12975
+ /**
12976
+ * Calculates total number of possible UUIDs.
12977
+ *
12978
+ * Given that:
12979
+ *
12980
+ * - `H` is the total number of possible UUIDs
12981
+ * - `n` is the number of unique characters in the dictionary
12982
+ * - `l` is the UUID length
12983
+ *
12984
+ * Then `H` is defined as `n` to the power of `l`:
12985
+ *
12986
+ * <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
12987
+ * <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20H=n%5El"/>
12988
+ * </div>
12989
+ *
12990
+ * This function returns `H`.
12991
+ */
12992
+ __publicField(this, "availableUUIDs", (uuidLength = this.uuidLength) => {
12993
+ return parseFloat(
12994
+ Math.pow([...new Set(this.dict)].length, uuidLength).toFixed(0)
12995
+ );
12996
+ });
12997
+ /**
12998
+ * Calculates approximate number of hashes before first collision.
12999
+ *
13000
+ * Given that:
13001
+ *
13002
+ * - `H` is the total number of possible UUIDs, or in terms of this library,
13003
+ * the result of running `availableUUIDs()`
13004
+ * - the expected number of values we have to choose before finding the
13005
+ * first collision can be expressed as the quantity `Q(H)`
13006
+ *
13007
+ * Then `Q(H)` can be approximated as the square root of the product of half
13008
+ * of pi times `H`:
13009
+ *
13010
+ * <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
13011
+ * <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20Q(H)%5Capprox%5Csqrt%7B%5Cfrac%7B%5Cpi%7D%7B2%7DH%7D"/>
13012
+ * </div>
13013
+ *
13014
+ * This function returns `Q(H)`.
13015
+ *
13016
+ * (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
13017
+ */
13018
+ __publicField(this, "approxMaxBeforeCollision", (rounds = this.availableUUIDs(this.uuidLength)) => {
13019
+ return parseFloat(
13020
+ Math.sqrt(Math.PI / 2 * rounds).toFixed(20)
13021
+ );
13022
+ });
13023
+ /**
13024
+ * Calculates probability of generating duplicate UUIDs (a collision) in a
13025
+ * given number of UUID generation rounds.
13026
+ *
13027
+ * Given that:
13028
+ *
13029
+ * - `r` is the maximum number of times that `randomUUID()` will be called,
13030
+ * or better said the number of _rounds_
13031
+ * - `H` is the total number of possible UUIDs, or in terms of this library,
13032
+ * the result of running `availableUUIDs()`
13033
+ *
13034
+ * Then the probability of collision `p(r; H)` can be approximated as the result
13035
+ * of dividing the square root of the product of half of pi times `r` by `H`:
13036
+ *
13037
+ * <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
13038
+ * <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%20p(r%3B%20H)%5Capprox%5Cfrac%7B%5Csqrt%7B%5Cfrac%7B%5Cpi%7D%7B2%7Dr%7D%7D%7BH%7D"/>
13039
+ * </div>
13040
+ *
13041
+ * This function returns `p(r; H)`.
13042
+ *
13043
+ * (see [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution))
13044
+ *
13045
+ * (Useful if you are wondering _"If I use this lib and expect to perform at most
13046
+ * `r` rounds of UUID generations, what is the probability that I will hit a duplicate UUID?"_.)
13047
+ */
13048
+ __publicField(this, "collisionProbability", (rounds = this.availableUUIDs(this.uuidLength), uuidLength = this.uuidLength) => {
13049
+ return parseFloat(
13050
+ (this.approxMaxBeforeCollision(rounds) / this.availableUUIDs(uuidLength)).toFixed(20)
13051
+ );
13052
+ });
13053
+ /**
13054
+ * Calculate a "uniqueness" score (from 0 to 1) of UUIDs based on size of
13055
+ * dictionary and chosen UUID length.
13056
+ *
13057
+ * Given that:
13058
+ *
13059
+ * - `H` is the total number of possible UUIDs, or in terms of this library,
13060
+ * the result of running `availableUUIDs()`
13061
+ * - `Q(H)` is the approximate number of hashes before first collision,
13062
+ * or in terms of this library, the result of running `approxMaxBeforeCollision()`
13063
+ *
13064
+ * Then `uniqueness` can be expressed as the additive inverse of the probability of
13065
+ * generating a "word" I had previously generated (a duplicate) at any given iteration
13066
+ * up to the the total number of possible UUIDs expressed as the quotiend of `Q(H)` and `H`:
13067
+ *
13068
+ * <div style="background: white; padding: 5px; border-radius: 5px; overflow: hidden;">
13069
+ * <img src="https://render.githubusercontent.com/render/math?math=%5CHuge%201-%5Cfrac%7BQ(H)%7D%7BH%7D"/>
13070
+ * </div>
13071
+ *
13072
+ * (Useful if you need a value to rate the "quality" of the combination of given dictionary
13073
+ * and UUID length. The closer to 1, higher the uniqueness and thus better the quality.)
13074
+ */
13075
+ __publicField(this, "uniqueness", (rounds = this.availableUUIDs(this.uuidLength)) => {
13076
+ const score = parseFloat(
13077
+ (1 - this.approxMaxBeforeCollision(rounds) / rounds).toFixed(20)
13078
+ );
12274
13079
  return score > 1 ? 1 : score < 0 ? 0 : score;
12275
- };
12276
- this.getVersion = () => {
13080
+ });
13081
+ /**
13082
+ * Return the version of this module.
13083
+ */
13084
+ __publicField(this, "getVersion", () => {
12277
13085
  return this.version;
12278
- };
12279
- this.stamp = (finalLength) => {
13086
+ });
13087
+ /**
13088
+ * Generates a UUID with a timestamp that can be extracted using `uid.parseStamp(stampString);`.
13089
+ *
13090
+ * ```js
13091
+ * const uidWithTimestamp = uid.stamp(32);
13092
+ * console.log(uidWithTimestamp);
13093
+ * // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
13094
+ *
13095
+ * console.log(uid.parseStamp(uidWithTimestamp));
13096
+ * // 2021-05-03T06:24:58.000Z
13097
+ * ```
13098
+ */
13099
+ __publicField(this, "stamp", (finalLength, date) => {
13100
+ const hexStamp = Math.floor(+(date || /* @__PURE__ */ new Date()) / 1e3).toString(16);
13101
+ if (typeof finalLength === "number" && finalLength === 0) {
13102
+ return hexStamp;
13103
+ }
12280
13104
  if (typeof finalLength !== "number" || finalLength < 10) {
12281
- throw new Error("Param finalLength must be number greater than 10");
13105
+ throw new Error(
13106
+ [
13107
+ "Param finalLength must be a number greater than or equal to 10,",
13108
+ "or 0 if you want the raw hexadecimal timestamp"
13109
+ ].join("\n")
13110
+ );
12282
13111
  }
12283
- const hexStamp = Math.floor(+new Date() / 1e3).toString(16);
12284
13112
  const idLength = finalLength - 9;
12285
13113
  const rndIdx = Math.round(Math.random() * (idLength > 15 ? 15 : idLength));
12286
13114
  const id = this.randomUUID(idLength);
12287
- return `${id.substr(0, rndIdx)}${hexStamp}${id.substr(rndIdx)}${rndIdx.toString(16)}`;
12288
- };
12289
- this.parseStamp = (stamp) => {
13115
+ return `${id.substring(0, rndIdx)}${hexStamp}${id.substring(rndIdx)}${rndIdx.toString(16)}`;
13116
+ });
13117
+ /**
13118
+ * Extracts the date embeded in a UUID generated using the `uid.stamp(finalLength);` method.
13119
+ *
13120
+ * ```js
13121
+ * const uidWithTimestamp = uid.stamp(32);
13122
+ * console.log(uidWithTimestamp);
13123
+ * // GDa608f973aRCHLXQYPTbKDbjDeVsSb3
13124
+ *
13125
+ * console.log(uid.parseStamp(uidWithTimestamp));
13126
+ * // 2021-05-03T06:24:58.000Z
13127
+ * ```
13128
+ */
13129
+ __publicField(this, "parseStamp", (suid, format) => {
13130
+ if (format && !/t0|t[1-9]\d{1,}/.test(format)) {
13131
+ throw new Error("Cannot extract date from a formated UUID with no timestamp in the format");
13132
+ }
13133
+ const stamp = format ? format.replace(
13134
+ /\$[rs]\d{0,}|\$t0|\$t[1-9]\d{1,}/g,
13135
+ (m) => {
13136
+ const fnMap = {
13137
+ "$r": (len2) => [...Array(len2)].map(() => "r").join(""),
13138
+ "$s": (len2) => [...Array(len2)].map(() => "s").join(""),
13139
+ "$t": (len2) => [...Array(len2)].map(() => "t").join("")
13140
+ };
13141
+ const fn = m.slice(0, 2);
13142
+ const len = parseInt(m.slice(2), 10);
13143
+ return fnMap[fn](len);
13144
+ }
13145
+ ).replace(
13146
+ /^(.*?)(t{8,})(.*)$/g,
13147
+ (_m, p1, p2) => {
13148
+ return suid.substring(p1.length, p1.length + p2.length);
13149
+ }
13150
+ ) : suid;
13151
+ if (stamp.length === 8) {
13152
+ return new Date(parseInt(stamp, 16) * 1e3);
13153
+ }
12290
13154
  if (stamp.length < 10) {
12291
13155
  throw new Error("Stamp length invalid");
12292
13156
  }
12293
- const rndIdx = parseInt(stamp.substr(stamp.length - 1, 1), 16);
12294
- return new Date(parseInt(stamp.substr(rndIdx, 8), 16) * 1e3);
12295
- };
13157
+ const rndIdx = parseInt(stamp.substring(stamp.length - 1), 16);
13158
+ return new Date(parseInt(stamp.substring(rndIdx, rndIdx + 8), 16) * 1e3);
13159
+ });
13160
+ /**
13161
+ * Set the counter to a specific value.
13162
+ */
13163
+ __publicField(this, "setCounter", (counter) => {
13164
+ this.counter = counter;
13165
+ });
12296
13166
  const options = __spreadValues(__spreadValues({}, DEFAULT_OPTIONS), argOptions);
12297
13167
  this.counter = 0;
12298
13168
  this.debug = false;
@@ -12301,21 +13171,40 @@ var ShortUniqueId = (() => {
12301
13171
  const {
12302
13172
  dictionary,
12303
13173
  shuffle,
12304
- length
13174
+ length,
13175
+ counter
12305
13176
  } = options;
12306
13177
  this.uuidLength = length;
12307
13178
  this.setDictionary(dictionary, shuffle);
13179
+ this.setCounter(counter);
12308
13180
  this.debug = options.debug;
12309
13181
  this.log(this.dict);
12310
- this.log(`Generator instantiated with Dictionary Size ${this.dictLength}`);
12311
- return new Proxy(this, {
12312
- apply: (target, that, args) => this.randomUUID(...args)
12313
- });
13182
+ this.log(
13183
+ `Generator instantiated with Dictionary Size ${this.dictLength} and counter set to ${this.counter}`
13184
+ );
13185
+ this.log = this.log.bind(this);
13186
+ this.setDictionary = this.setDictionary.bind(this);
13187
+ this.setCounter = this.setCounter.bind(this);
13188
+ this.seq = this.seq.bind(this);
13189
+ this.sequentialUUID = this.sequentialUUID.bind(this);
13190
+ this.rnd = this.rnd.bind(this);
13191
+ this.randomUUID = this.randomUUID.bind(this);
13192
+ this.fmt = this.fmt.bind(this);
13193
+ this.formattedUUID = this.formattedUUID.bind(this);
13194
+ this.availableUUIDs = this.availableUUIDs.bind(this);
13195
+ this.approxMaxBeforeCollision = this.approxMaxBeforeCollision.bind(this);
13196
+ this.collisionProbability = this.collisionProbability.bind(this);
13197
+ this.uniqueness = this.uniqueness.bind(this);
13198
+ this.getVersion = this.getVersion.bind(this);
13199
+ this.stamp = this.stamp.bind(this);
13200
+ this.parseStamp = this.parseStamp.bind(this);
13201
+ return this;
12314
13202
  }
12315
13203
  };
13204
+ /** @hidden */
13205
+ __publicField(_ShortUniqueId, "default", _ShortUniqueId);
12316
13206
  var ShortUniqueId = _ShortUniqueId;
12317
- ShortUniqueId.default = _ShortUniqueId;
12318
- return src_exports;
13207
+ return __toCommonJS(src_exports);
12319
13208
  })();
12320
13209
  //# sourceMappingURL=short-unique-id.js.map
12321
13210
  true&&(module.exports=ShortUniqueId.default),'undefined'!=typeof window&&(ShortUniqueId=ShortUniqueId.default);
@@ -12329,6 +13218,13 @@ var ShortUniqueId = (() => {
12329
13218
 
12330
13219
  /***/ }),
12331
13220
 
13221
+ /***/ 21427:
13222
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
13223
+
13224
+ module.exports = __webpack_require__(36762);
13225
+
13226
+ /***/ }),
13227
+
12332
13228
  /***/ 28936:
12333
13229
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
12334
13230
 
@@ -12995,12 +13891,20 @@ __webpack_require__.r(__webpack_exports__);
12995
13891
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
12996
13892
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
12997
13893
  /* harmony export */ });
12998
- /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(39723);
13894
+ /* harmony import */ var ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(39723);
12999
13895
  /* harmony import */ var ramda__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13776);
13896
+ /* harmony import */ var _babel_runtime_corejs3_core_js_aggregate_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21427);
13897
+ var _globalThis$Aggregate;
13898
+
13000
13899
 
13900
+ // @ts-ignore
13001
13901
 
13902
+ const AggregateError = (_globalThis$Aggregate = globalThis.AggregateError) !== null && _globalThis$Aggregate !== void 0 ? _globalThis$Aggregate : _babel_runtime_corejs3_core_js_aggregate_error__WEBPACK_IMPORTED_MODULE_1__;
13903
+ /**
13904
+ * ApiDOMAggregateError is using polyfill of AggregateError from core-js-pure
13905
+ * in environments which don't support global AggregateError symbol.
13906
+ */
13002
13907
  class ApiDOMAggregateError extends AggregateError {
13003
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13004
13908
  constructor(errors, message, options) {
13005
13909
  super(errors, message, options);
13006
13910
  this.name = this.constructor.name;
@@ -13017,7 +13921,7 @@ class ApiDOMAggregateError extends AggregateError {
13017
13921
  * This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
13018
13922
  * Node.js is >= 16.9.0 supports error causes natively.
13019
13923
  */
13020
- if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_1__["default"])(options) && (0,ramda__WEBPACK_IMPORTED_MODULE_0__.hasIn)('cause', options) && !(0,ramda__WEBPACK_IMPORTED_MODULE_0__.hasIn)('cause', this)) {
13924
+ if ((0,ramda_adjunct__WEBPACK_IMPORTED_MODULE_2__["default"])(options) && (0,ramda__WEBPACK_IMPORTED_MODULE_0__.hasIn)('cause', options) && !(0,ramda__WEBPACK_IMPORTED_MODULE_0__.hasIn)('cause', this)) {
13021
13925
  const {
13022
13926
  cause
13023
13927
  } = options;