@beecode/msh-util 2.0.13 → 2.0.14
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/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/package.json +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/single-threshold-promise.js +12 -14
- package/lib/singleton/async.js +15 -17
- package/package.json +32 -39
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export { expressErrorHandler } from '#src/express/error-handler';
|
|
2
|
-
export { SingletonAsync } from '#src/singleton/async';
|
|
3
|
-
export { singletonPattern } from '#src/singleton/pattern';
|
|
4
|
-
export { classFactoryPattern } from '#src/class-factory-pattern';
|
|
5
|
-
export type { ClassType } from '#src/class-factory-pattern';
|
|
6
|
-
export { ErrorWithPayload, JoiUtil } from '#src/joi-util';
|
|
7
|
-
export { memoizeFactory } from '#src/memoize-factory';
|
|
8
|
-
export { ObjectUtil } from '#src/object-util';
|
|
9
|
-
export type { ObjectType } from '#src/object-util';
|
|
10
|
-
export { regexUtil } from '#src/regex-util';
|
|
11
|
-
export { SingleThresholdPromise } from '#src/single-threshold-promise';
|
|
12
|
-
export { stringUtil } from '#src/string-util';
|
|
13
|
-
export { DurationUnit, TimeUtil } from '#src/time-util';
|
|
14
|
-
export type { DurationUnitType } from '#src/time-util';
|
|
15
|
-
export { timeout } from '#src/timeout';
|
|
16
|
-
export { typeUtil } from '#src/type-util';
|
|
1
|
+
export { expressErrorHandler } from '#src/express/error-handler.js';
|
|
2
|
+
export { SingletonAsync } from '#src/singleton/async.js';
|
|
3
|
+
export { singletonPattern } from '#src/singleton/pattern.js';
|
|
4
|
+
export { classFactoryPattern } from '#src/class-factory-pattern.js';
|
|
5
|
+
export type { ClassType } from '#src/class-factory-pattern.js';
|
|
6
|
+
export { ErrorWithPayload, JoiUtil } from '#src/joi-util.js';
|
|
7
|
+
export { memoizeFactory } from '#src/memoize-factory.js';
|
|
8
|
+
export { ObjectUtil } from '#src/object-util.js';
|
|
9
|
+
export type { ObjectType } from '#src/object-util.js';
|
|
10
|
+
export { regexUtil } from '#src/regex-util.js';
|
|
11
|
+
export { SingleThresholdPromise } from '#src/single-threshold-promise.js';
|
|
12
|
+
export { stringUtil } from '#src/string-util.js';
|
|
13
|
+
export { DurationUnit, TimeUtil } from '#src/time-util.js';
|
|
14
|
+
export type { DurationUnitType } from '#src/time-util.js';
|
|
15
|
+
export { timeout } from '#src/timeout.js';
|
|
16
|
+
export { typeUtil } from '#src/type-util.js';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { expressErrorHandler } from '#src/express/error-handler';
|
|
2
|
-
export { SingletonAsync } from '#src/singleton/async';
|
|
3
|
-
export { singletonPattern } from '#src/singleton/pattern';
|
|
4
|
-
export { classFactoryPattern } from '#src/class-factory-pattern';
|
|
5
|
-
export { ErrorWithPayload, JoiUtil } from '#src/joi-util';
|
|
6
|
-
export { memoizeFactory } from '#src/memoize-factory';
|
|
7
|
-
export { ObjectUtil } from '#src/object-util';
|
|
8
|
-
export { regexUtil } from '#src/regex-util';
|
|
9
|
-
export { SingleThresholdPromise } from '#src/single-threshold-promise';
|
|
10
|
-
export { stringUtil } from '#src/string-util';
|
|
11
|
-
export { DurationUnit, TimeUtil } from '#src/time-util';
|
|
12
|
-
export { timeout } from '#src/timeout';
|
|
13
|
-
export { typeUtil } from '#src/type-util';
|
|
14
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
export { expressErrorHandler } from '#src/express/error-handler.js';
|
|
2
|
+
export { SingletonAsync } from '#src/singleton/async.js';
|
|
3
|
+
export { singletonPattern } from '#src/singleton/pattern.js';
|
|
4
|
+
export { classFactoryPattern } from '#src/class-factory-pattern.js';
|
|
5
|
+
export { ErrorWithPayload, JoiUtil } from '#src/joi-util.js';
|
|
6
|
+
export { memoizeFactory } from '#src/memoize-factory.js';
|
|
7
|
+
export { ObjectUtil } from '#src/object-util.js';
|
|
8
|
+
export { regexUtil } from '#src/regex-util.js';
|
|
9
|
+
export { SingleThresholdPromise } from '#src/single-threshold-promise.js';
|
|
10
|
+
export { stringUtil } from '#src/string-util.js';
|
|
11
|
+
export { DurationUnit, TimeUtil } from '#src/time-util.js';
|
|
12
|
+
export { timeout } from '#src/timeout.js';
|
|
13
|
+
export { typeUtil } from '#src/type-util.js';
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sK0JBQStCLENBQUE7QUFFbkUsT0FBTyxFQUFFLGNBQWMsRUFBRSxNQUFNLHlCQUF5QixDQUFBO0FBRXhELE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLDJCQUEyQixDQUFBO0FBRTVELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLCtCQUErQixDQUFBO0FBSW5FLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxPQUFPLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQTtBQUU1RCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0seUJBQXlCLENBQUE7QUFFeEQsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHFCQUFxQixDQUFBO0FBSWhELE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQTtBQUU5QyxPQUFPLEVBQUUsc0JBQXNCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQTtBQUV6RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFFaEQsT0FBTyxFQUFFLFlBQVksRUFBRSxRQUFRLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQTtBQUkxRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFFekMsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLG1CQUFtQixDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgZXhwcmVzc0Vycm9ySGFuZGxlciB9IGZyb20gJyNzcmMvZXhwcmVzcy9lcnJvci1oYW5kbGVyLmpzJ1xuXG5leHBvcnQgeyBTaW5nbGV0b25Bc3luYyB9IGZyb20gJyNzcmMvc2luZ2xldG9uL2FzeW5jLmpzJ1xuXG5leHBvcnQgeyBzaW5nbGV0b25QYXR0ZXJuIH0gZnJvbSAnI3NyYy9zaW5nbGV0b24vcGF0dGVybi5qcydcblxuZXhwb3J0IHsgY2xhc3NGYWN0b3J5UGF0dGVybiB9IGZyb20gJyNzcmMvY2xhc3MtZmFjdG9yeS1wYXR0ZXJuLmpzJ1xuXG5leHBvcnQgdHlwZSB7IENsYXNzVHlwZSB9IGZyb20gJyNzcmMvY2xhc3MtZmFjdG9yeS1wYXR0ZXJuLmpzJ1xuXG5leHBvcnQgeyBFcnJvcldpdGhQYXlsb2FkLCBKb2lVdGlsIH0gZnJvbSAnI3NyYy9qb2ktdXRpbC5qcydcblxuZXhwb3J0IHsgbWVtb2l6ZUZhY3RvcnkgfSBmcm9tICcjc3JjL21lbW9pemUtZmFjdG9yeS5qcydcblxuZXhwb3J0IHsgT2JqZWN0VXRpbCB9IGZyb20gJyNzcmMvb2JqZWN0LXV0aWwuanMnXG5cbmV4cG9ydCB0eXBlIHsgT2JqZWN0VHlwZSB9IGZyb20gJyNzcmMvb2JqZWN0LXV0aWwuanMnXG5cbmV4cG9ydCB7IHJlZ2V4VXRpbCB9IGZyb20gJyNzcmMvcmVnZXgtdXRpbC5qcydcblxuZXhwb3J0IHsgU2luZ2xlVGhyZXNob2xkUHJvbWlzZSB9IGZyb20gJyNzcmMvc2luZ2xlLXRocmVzaG9sZC1wcm9taXNlLmpzJ1xuXG5leHBvcnQgeyBzdHJpbmdVdGlsIH0gZnJvbSAnI3NyYy9zdHJpbmctdXRpbC5qcydcblxuZXhwb3J0IHsgRHVyYXRpb25Vbml0LCBUaW1lVXRpbCB9IGZyb20gJyNzcmMvdGltZS11dGlsLmpzJ1xuXG5leHBvcnQgdHlwZSB7IER1cmF0aW9uVW5pdFR5cGUgfSBmcm9tICcjc3JjL3RpbWUtdXRpbC5qcydcblxuZXhwb3J0IHsgdGltZW91dCB9IGZyb20gJyNzcmMvdGltZW91dC5qcydcblxuZXhwb3J0IHsgdHlwZVV0aWwgfSBmcm9tICcjc3JjL3R5cGUtdXRpbC5qcydcbiJdfQ==
|
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type": "module", "imports": {"#packageJson": "../package.json", "#src": "./index.js", "#src/*": "./*.js"}}
|
|
1
|
+
{"type": "module", "imports": {"#packageJson": "../package.json", "#src": "./index.js", "#src/*.js": "./*.js", "#src/*": "./*.js"}}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAEnE,YAAY,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE9D,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SingleThresholdPromise = void 0;
|
|
7
7
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
-
function
|
|
8
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
9
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
10
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
11
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
12
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -50,39 +51,36 @@ var SingleThresholdPromise = exports.SingleThresholdPromise = /*#__PURE__*/funct
|
|
|
50
51
|
}, {
|
|
51
52
|
key: "promise",
|
|
52
53
|
value: function () {
|
|
53
|
-
var _promise = _asyncToGenerator(/*#__PURE__*/
|
|
54
|
+
var _promise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
54
55
|
var _this = this;
|
|
55
56
|
var result;
|
|
56
|
-
return
|
|
57
|
-
while (1) switch (_context.
|
|
57
|
+
return _regenerator().w(function (_context) {
|
|
58
|
+
while (1) switch (_context.n) {
|
|
58
59
|
case 0:
|
|
59
60
|
if (!('promises' in this._cache)) {
|
|
60
|
-
_context.
|
|
61
|
+
_context.n = 1;
|
|
61
62
|
break;
|
|
62
63
|
}
|
|
63
|
-
return _context.
|
|
64
|
+
return _context.a(2, new Promise(function (resolve, reject) {
|
|
64
65
|
_this._cache.promises.push({
|
|
65
66
|
reject: reject,
|
|
66
67
|
resolve: resolve
|
|
67
68
|
});
|
|
68
69
|
}));
|
|
69
|
-
case
|
|
70
|
+
case 1:
|
|
70
71
|
this._cache.promises = [];
|
|
71
|
-
_context.
|
|
72
|
+
_context.n = 2;
|
|
72
73
|
return this._factoryFn()["catch"](function (err) {
|
|
73
74
|
_this._rejectPromises();
|
|
74
75
|
throw err;
|
|
75
76
|
});
|
|
76
|
-
case
|
|
77
|
-
result = _context.
|
|
77
|
+
case 2:
|
|
78
|
+
result = _context.v;
|
|
78
79
|
this._cache.promises.forEach(function (promise) {
|
|
79
80
|
promise.resolve(result);
|
|
80
81
|
});
|
|
81
82
|
delete this._cache.promises;
|
|
82
|
-
return _context.
|
|
83
|
-
case 9:
|
|
84
|
-
case "end":
|
|
85
|
-
return _context.stop();
|
|
83
|
+
return _context.a(2, result);
|
|
86
84
|
}
|
|
87
85
|
}, _callee, this);
|
|
88
86
|
}));
|
package/lib/singleton/async.js
CHANGED
|
@@ -5,7 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SingletonAsync = void 0;
|
|
7
7
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
-
function
|
|
8
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
9
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
10
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
10
11
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
11
12
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
@@ -70,31 +71,31 @@ var SingletonAsync = exports.SingletonAsync = /*#__PURE__*/function () {
|
|
|
70
71
|
}, {
|
|
71
72
|
key: "promise",
|
|
72
73
|
value: (function () {
|
|
73
|
-
var _promise = _asyncToGenerator(/*#__PURE__*/
|
|
74
|
+
var _promise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
74
75
|
var _this = this;
|
|
75
76
|
var result;
|
|
76
|
-
return
|
|
77
|
-
while (1) switch (_context.
|
|
77
|
+
return _regenerator().w(function (_context) {
|
|
78
|
+
while (1) switch (_context.n) {
|
|
78
79
|
case 0:
|
|
79
80
|
if (!('singleton' in this._cache)) {
|
|
80
|
-
_context.
|
|
81
|
+
_context.n = 1;
|
|
81
82
|
break;
|
|
82
83
|
}
|
|
83
|
-
return _context.
|
|
84
|
-
case
|
|
84
|
+
return _context.a(2, this._cache.singleton);
|
|
85
|
+
case 1:
|
|
85
86
|
if (!('promises' in this._cache)) {
|
|
86
|
-
_context.
|
|
87
|
+
_context.n = 2;
|
|
87
88
|
break;
|
|
88
89
|
}
|
|
89
|
-
return _context.
|
|
90
|
+
return _context.a(2, new Promise(function (resolve, reject) {
|
|
90
91
|
_this._cache.promises.push({
|
|
91
92
|
reject: reject,
|
|
92
93
|
resolve: resolve
|
|
93
94
|
});
|
|
94
95
|
}));
|
|
95
|
-
case
|
|
96
|
+
case 2:
|
|
96
97
|
this._cache.promises = [];
|
|
97
|
-
_context.
|
|
98
|
+
_context.n = 3;
|
|
98
99
|
return this._factory()["catch"](function (error) {
|
|
99
100
|
if (error instanceof Error) {
|
|
100
101
|
_this._rejectPromises({
|
|
@@ -103,17 +104,14 @@ var SingletonAsync = exports.SingletonAsync = /*#__PURE__*/function () {
|
|
|
103
104
|
}
|
|
104
105
|
throw error;
|
|
105
106
|
});
|
|
106
|
-
case
|
|
107
|
-
result = _context.
|
|
107
|
+
case 3:
|
|
108
|
+
result = _context.v;
|
|
108
109
|
this._cache.singleton = result;
|
|
109
110
|
this._cache.promises.forEach(function (promise) {
|
|
110
111
|
promise.resolve(result);
|
|
111
112
|
});
|
|
112
113
|
delete this._cache.promises;
|
|
113
|
-
return _context.
|
|
114
|
-
case 12:
|
|
115
|
-
case "end":
|
|
116
|
-
return _context.stop();
|
|
114
|
+
return _context.a(2, result);
|
|
117
115
|
}
|
|
118
116
|
}, _callee, this);
|
|
119
117
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beecode/msh-util",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/beecode-rs/msh-util#readme",
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
"type": "module",
|
|
17
17
|
"imports": {
|
|
18
18
|
"#packageJson": "./package.json",
|
|
19
|
-
"#src": "./
|
|
20
|
-
"#src
|
|
19
|
+
"#src": "./dist/index.js",
|
|
20
|
+
"#src/*.js": "./dist/*.js",
|
|
21
|
+
"#src/*": "./dist/*.js"
|
|
21
22
|
},
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
@@ -55,10 +56,10 @@
|
|
|
55
56
|
"docker-run-package-lock-update": "docker run --rm -v ./:/usr/app/ milosbugarinovic/msh-lib-base:node22.14.0-alpine3.21 npm i --package-lock-only",
|
|
56
57
|
"docker-run-sh": "docker run --rm -it bc-msh-util sh",
|
|
57
58
|
"fix-hybrid-lib-cjs": "mkdir -p ./lib && echo '{\"type\": \"commonjs\"}' > ./lib/package.json",
|
|
58
|
-
"fix-hybrid-lib-esm": "mkdir -p ./dist && echo '{\"type\": \"module\", \"imports\": {\"#packageJson\": \"../package.json\", \"#src\": \"./index.js\", \"#src/*\": \"./*.js\"}}' > ./dist/package.json",
|
|
59
|
+
"fix-hybrid-lib-esm": "mkdir -p ./dist && echo '{\"type\": \"module\", \"imports\": {\"#packageJson\": \"../package.json\", \"#src\": \"./index.js\", \"#src/*.js\": \"./*.js\", \"#src/*\": \"./*.js\"}}' > ./dist/package.json",
|
|
59
60
|
"init": "concurrently -c auto 'npm:init:*'",
|
|
60
61
|
"init:git-config": "git config include.path ./.git-config",
|
|
61
|
-
"init:husky": "npx husky
|
|
62
|
+
"init:husky": "npx husky init",
|
|
62
63
|
"lint": "npm run lint-prettier && npm run lint-eslint && npm run lint-json",
|
|
63
64
|
"lint-eslint": "eslint ./ --quiet",
|
|
64
65
|
"lint-eslint-fix": "npm run lint-eslint -- --fix",
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
"tsc-time": "npm run tsc -- --diagnostics",
|
|
89
90
|
"tsc-types": "tsc -p tsconfig.build.json --emitDeclarationOnly --outDir ./lib",
|
|
90
91
|
"tsc-types-alias": "tsc-alias -p tsconfig.build.json --outDir ./lib --resolve-full-paths",
|
|
92
|
+
"tsc-esm-alias": "tsc-alias -p tsconfig.build.json --outDir ./dist --resolve-full-paths",
|
|
91
93
|
"tsc-watch": "npm run tsc -- -w --preserveWatchOutput",
|
|
92
94
|
"watch": "concurrently -c auto -n build,clean 'npm run tsc-watch' 'npm run tsc-cleaner-watch'"
|
|
93
95
|
},
|
|
@@ -96,58 +98,49 @@
|
|
|
96
98
|
"@commitlint/config-conventional"
|
|
97
99
|
]
|
|
98
100
|
},
|
|
99
|
-
"lint-staged": {
|
|
100
|
-
"**/*.json": [
|
|
101
|
-
"npm run lint-json"
|
|
102
|
-
],
|
|
103
|
-
"**/*.{ts,tsx,js,jsx}": [
|
|
104
|
-
"eslint",
|
|
105
|
-
"prettier --check"
|
|
106
|
-
]
|
|
107
|
-
},
|
|
108
101
|
"config": {
|
|
109
102
|
"commitizen": {
|
|
110
103
|
"path": "node_modules/cz-conventional-changelog"
|
|
111
104
|
}
|
|
112
105
|
},
|
|
113
106
|
"dependencies": {
|
|
114
|
-
"@beecode/msh-config": "^1.1.
|
|
107
|
+
"@beecode/msh-config": "^1.1.6",
|
|
115
108
|
"date-fns": "^4.1.0",
|
|
116
109
|
"date-fns-tz": "^3.2.0",
|
|
117
|
-
"joi": "^
|
|
110
|
+
"joi": "^18.0.2",
|
|
118
111
|
"lodash.clonedeep": "^4.5.0",
|
|
119
112
|
"rxjs": "^7.8.2"
|
|
120
113
|
},
|
|
121
114
|
"devDependencies": {
|
|
122
|
-
"@babel/cli": "^7.
|
|
123
|
-
"@babel/core": "^7.
|
|
124
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
125
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
126
|
-
"@babel/preset-env": "^7.
|
|
127
|
-
"@babel/preset-typescript": "^7.
|
|
128
|
-
"@commitlint/cli": "^
|
|
129
|
-
"@commitlint/config-conventional": "^
|
|
130
|
-
"@commitlint/prompt": "^
|
|
115
|
+
"@babel/cli": "^7.28.6",
|
|
116
|
+
"@babel/core": "^7.29.0",
|
|
117
|
+
"@babel/plugin-proposal-decorators": "^7.29.0",
|
|
118
|
+
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
|
|
119
|
+
"@babel/preset-env": "^7.29.0",
|
|
120
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
121
|
+
"@commitlint/cli": "^20.4.1",
|
|
122
|
+
"@commitlint/config-conventional": "^20.4.1",
|
|
123
|
+
"@commitlint/prompt": "^20.4.1",
|
|
131
124
|
"@types/lodash.clonedeep": "^4.5.9",
|
|
132
|
-
"@types/node": "^
|
|
133
|
-
"@vitest/coverage-v8": "^
|
|
125
|
+
"@types/node": "^25.2.3",
|
|
126
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
134
127
|
"commitizen": "^4.3.1",
|
|
135
|
-
"concurrently": "^9.1
|
|
128
|
+
"concurrently": "^9.2.1",
|
|
136
129
|
"husky": "^9.1.7",
|
|
137
|
-
"json-sort-cli": "^4.
|
|
138
|
-
"lint-staged": "^
|
|
130
|
+
"json-sort-cli": "^4.1.3",
|
|
131
|
+
"lint-staged": "^16.2.7",
|
|
139
132
|
"markdown-toc": "^1.2.0",
|
|
140
|
-
"prettier": "^3.
|
|
141
|
-
"rimraf": "^6.
|
|
133
|
+
"prettier": "^3.8.1",
|
|
134
|
+
"rimraf": "^6.1.3",
|
|
142
135
|
"source-map-support": "^0.5.21",
|
|
143
136
|
"ts-cleaner": "^1.0.5",
|
|
144
137
|
"ts-node": "^10.9.2",
|
|
145
|
-
"tsc-alias": "^1.8.
|
|
146
|
-
"tsc-watch": "^
|
|
147
|
-
"typedoc": "^0.28.
|
|
148
|
-
"typedoc-plugin-markdown": "^4.
|
|
149
|
-
"typescript": "^5.
|
|
150
|
-
"vite-tsconfig-paths": "^
|
|
151
|
-
"vitest": "^
|
|
138
|
+
"tsc-alias": "^1.8.16",
|
|
139
|
+
"tsc-watch": "^7.2.0",
|
|
140
|
+
"typedoc": "^0.28.17",
|
|
141
|
+
"typedoc-plugin-markdown": "^4.10.0",
|
|
142
|
+
"typescript": "^5.9.3",
|
|
143
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
144
|
+
"vitest": "^4.0.18"
|
|
152
145
|
}
|
|
153
146
|
}
|