@medusajs/utils 1.9.1 → 1.9.2-beta-20230705211101
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/cli/clear-project.js +17 -1
- package/dist/cli/clear-project.js.map +1 -1
- package/dist/common/build-query.js +58 -27
- package/dist/common/build-query.js.map +1 -1
- package/dist/common/errors.js +26 -1
- package/dist/common/errors.js.map +1 -1
- package/dist/common/index.d.ts +6 -2
- package/dist/common/index.js +6 -2
- package/dist/common/index.js.map +1 -1
- package/dist/common/object-to-string-path.d.ts +29 -5
- package/dist/common/object-to-string-path.js +64 -12
- package/dist/common/object-to-string-path.js.map +1 -1
- package/dist/common/set-metadata.js +53 -16
- package/dist/common/set-metadata.js.map +1 -1
- package/dist/common/to-camel-case.d.ts +1 -0
- package/dist/common/to-camel-case.js +12 -0
- package/dist/common/to-camel-case.js.map +1 -0
- package/dist/common/to-pascal-case.d.ts +1 -0
- package/dist/common/to-pascal-case.js +10 -0
- package/dist/common/to-pascal-case.js.map +1 -0
- package/dist/common/upper-case-first.d.ts +1 -0
- package/dist/common/upper-case-first.js +8 -0
- package/dist/common/upper-case-first.js.map +1 -0
- package/dist/event-bus/index.js +17 -1
- package/dist/event-bus/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
19
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
20
|
if (ar || !(i in from)) {
|
|
@@ -21,7 +37,7 @@ function clearProject(directory) {
|
|
|
21
37
|
var onboardingFiles = glob_1.default.sync(path_1.default.join(directory, "src", "**/onboarding/"));
|
|
22
38
|
var typeFiles = glob_1.default.sync(path_1.default.join(directory, "src", "types"));
|
|
23
39
|
var srcFiles = glob_1.default.sync(path_1.default.join(directory, "src", "**/*.{ts,tsx,js,jsx}"));
|
|
24
|
-
var files = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], adminFiles,
|
|
40
|
+
var files = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(adminFiles), false), __read(onboardingFiles), false), __read(typeFiles), false), __read(srcFiles), false);
|
|
25
41
|
files.forEach(function (file) {
|
|
26
42
|
return fs_1.default.rmSync(file, {
|
|
27
43
|
recursive: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-project.js","sourceRoot":"","sources":["../../src/cli/clear-project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clear-project.js","sourceRoot":"","sources":["../../src/cli/clear-project.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAmB;AACnB,8CAAuB;AACvB,8CAAuB;AAEvB,SAAgB,YAAY,CAAC,SAAiB;IAC5C,IAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAA;IACvE,IAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAC/B,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAC9C,CAAA;IACD,IAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;IACjE,IAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,CAAA;IAE/E,IAAM,KAAK,sEAAO,UAAU,kBAAK,eAAe,kBAAK,SAAS,kBAAK,QAAQ,SAAC,CAAA;IAE5E,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI;QACjB,OAAA,YAAE,CAAC,MAAM,CAAC,IAAI,EAAE;YACd,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI;SACZ,CAAC;IAHF,CAGE,CACH,CAAA;IACD,kDAAkD;IAClD,YAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,CAAA;AAC3D,CAAC;AAlBD,oCAkBC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Those utils are used in a typeorm context and we can't be sure that they can be used elsewhere
|
|
3
|
+
var __values = (this && this.__values) || function(o) {
|
|
4
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
5
|
+
if (m) return m.call(o);
|
|
6
|
+
if (o && typeof o.length === "number") return {
|
|
7
|
+
next: function () {
|
|
8
|
+
if (o && i >= o.length) o = void 0;
|
|
9
|
+
return { value: o && o[i++], done: !o };
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
13
|
+
};
|
|
3
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
15
|
exports.buildOrder = exports.buildRelations = exports.buildSelects = void 0;
|
|
5
16
|
function buildSelects(selectCollection) {
|
|
@@ -55,24 +66,34 @@ exports.buildRelations = buildRelations;
|
|
|
55
66
|
* @param collection
|
|
56
67
|
*/
|
|
57
68
|
function buildRelationsOrSelect(collection) {
|
|
58
|
-
var _a;
|
|
69
|
+
var e_1, _a;
|
|
70
|
+
var _b;
|
|
59
71
|
var output = {};
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
try {
|
|
73
|
+
for (var collection_1 = __values(collection), collection_1_1 = collection_1.next(); !collection_1_1.done; collection_1_1 = collection_1.next()) {
|
|
74
|
+
var relation = collection_1_1.value;
|
|
75
|
+
if (relation.indexOf(".") > -1) {
|
|
76
|
+
var nestedRelations = relation.split(".");
|
|
77
|
+
var parent_1 = output;
|
|
78
|
+
while (nestedRelations.length > 1) {
|
|
79
|
+
var nestedRelation = nestedRelations.shift();
|
|
80
|
+
parent_1 = parent_1[nestedRelation] = (parent_1[nestedRelation] !== true &&
|
|
81
|
+
typeof parent_1[nestedRelation] === "object"
|
|
82
|
+
? parent_1[nestedRelation]
|
|
83
|
+
: {});
|
|
84
|
+
}
|
|
85
|
+
parent_1[nestedRelations[0]] = true;
|
|
86
|
+
continue;
|
|
71
87
|
}
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
output[relation] = (_b = output[relation]) !== null && _b !== void 0 ? _b : true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (collection_1_1 && !collection_1_1.done && (_a = collection_1.return)) _a.call(collection_1);
|
|
74
95
|
}
|
|
75
|
-
|
|
96
|
+
finally { if (e_1) throw e_1.error; }
|
|
76
97
|
}
|
|
77
98
|
return output;
|
|
78
99
|
}
|
|
@@ -92,22 +113,32 @@ function buildRelationsOrSelect(collection) {
|
|
|
92
113
|
* @param orderBy
|
|
93
114
|
*/
|
|
94
115
|
function buildOrder(orderBy) {
|
|
95
|
-
var _a;
|
|
116
|
+
var e_2, _a;
|
|
117
|
+
var _b;
|
|
96
118
|
var output = {};
|
|
97
119
|
var orderKeys = Object.keys(orderBy);
|
|
98
|
-
|
|
99
|
-
var
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
120
|
+
try {
|
|
121
|
+
for (var orderKeys_1 = __values(orderKeys), orderKeys_1_1 = orderKeys_1.next(); !orderKeys_1_1.done; orderKeys_1_1 = orderKeys_1.next()) {
|
|
122
|
+
var order = orderKeys_1_1.value;
|
|
123
|
+
if (order.indexOf(".") > -1) {
|
|
124
|
+
var nestedOrder = order.split(".");
|
|
125
|
+
var parent_2 = output;
|
|
126
|
+
while (nestedOrder.length > 1) {
|
|
127
|
+
var nestedRelation = nestedOrder.shift();
|
|
128
|
+
parent_2 = (_b = parent_2[nestedRelation]) !== null && _b !== void 0 ? _b : (parent_2[nestedRelation] = {});
|
|
129
|
+
}
|
|
130
|
+
parent_2[nestedOrder[0]] = orderBy[order];
|
|
131
|
+
continue;
|
|
106
132
|
}
|
|
107
|
-
|
|
108
|
-
|
|
133
|
+
output[order] = orderBy[order];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
137
|
+
finally {
|
|
138
|
+
try {
|
|
139
|
+
if (orderKeys_1_1 && !orderKeys_1_1.done && (_a = orderKeys_1.return)) _a.call(orderKeys_1);
|
|
109
140
|
}
|
|
110
|
-
|
|
141
|
+
finally { if (e_2) throw e_2.error; }
|
|
111
142
|
}
|
|
112
143
|
return output;
|
|
113
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-query.js","sourceRoot":"","sources":["../../src/common/build-query.ts"],"names":[],"mappings":";AAAA,iGAAiG
|
|
1
|
+
{"version":3,"file":"build-query.js","sourceRoot":"","sources":["../../src/common/build-query.ts"],"names":[],"mappings":";AAAA,iGAAiG;;;;;;;;;;;;;;AAcjG,SAAgB,YAAY,CAAC,gBAA0B;IACrD,OAAO,sBAAsB,CAAC,gBAAgB,CAAC,CAAA;AACjD,CAAC;AAFD,oCAEC;AAED,SAAgB,cAAc,CAAC,kBAA4B;IACzD,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AACnD,CAAC;AAFD,wCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,SAAS,sBAAsB,CAAC,UAAoB;;;IAClD,IAAM,MAAM,GAAwB,EAAE,CAAA;;QAEtC,KAAuB,IAAA,eAAA,SAAA,UAAU,CAAA,sCAAA,8DAAE;YAA9B,IAAM,QAAQ,uBAAA;YACjB,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC9B,IAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBAE3C,IAAI,QAAM,GAAG,MAAM,CAAA;gBAEnB,OAAO,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;oBACjC,IAAM,cAAc,GAAG,eAAe,CAAC,KAAK,EAAY,CAAA;oBACxD,QAAM,GAAG,QAAM,CAAC,cAAc,CAAC,GAAG,CAChC,QAAM,CAAC,cAAc,CAAC,KAAK,IAAI;wBAC/B,OAAO,QAAM,CAAC,cAAc,CAAC,KAAK,QAAQ;wBACxC,CAAC,CAAC,QAAM,CAAC,cAAc,CAAC;wBACxB,CAAC,CAAC,EAAE,CACgB,CAAA;iBACzB;gBAED,QAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;gBAEjC,SAAQ;aACT;YAED,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAA,MAAM,CAAC,QAAQ,CAAC,mCAAI,IAAI,CAAA;SAC5C;;;;;;;;;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,UAAU,CAAI,OAAwC;;;IACpE,IAAM,MAAM,GAAU,EAAE,CAAA;IAExB,IAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;;QAEtC,KAAoB,IAAA,cAAA,SAAA,SAAS,CAAA,oCAAA,2DAAE;YAA1B,IAAM,KAAK,sBAAA;YACd,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC3B,IAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBAEpC,IAAI,QAAM,GAAG,MAAM,CAAA;gBAEnB,OAAO,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;oBAC7B,IAAM,cAAc,GAAG,WAAW,CAAC,KAAK,EAAY,CAAA;oBACpD,QAAM,SAAI,QAAM,CAAC,cAAc,CAAW,oCAAhC,QAAM,CAAC,cAAc,CAAW,GAAK,EAAE,CAAA,CAAA;iBAClD;gBAED,QAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;gBAEvC,SAAQ;aACT;YAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;SAC/B;;;;;;;;;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAzBD,gCAyBC"}
|
package/dist/common/errors.js
CHANGED
|
@@ -14,6 +14,31 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
18
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
+
if (!m) return o;
|
|
20
|
+
var i = m.call(o), r, ar = [], e;
|
|
21
|
+
try {
|
|
22
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
23
|
+
}
|
|
24
|
+
catch (error) { e = { error: error }; }
|
|
25
|
+
finally {
|
|
26
|
+
try {
|
|
27
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
28
|
+
}
|
|
29
|
+
finally { if (e) throw e.error; }
|
|
30
|
+
}
|
|
31
|
+
return ar;
|
|
32
|
+
};
|
|
33
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
34
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
35
|
+
if (ar || !(i in from)) {
|
|
36
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
37
|
+
ar[i] = from[i];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
41
|
+
};
|
|
17
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
43
|
exports.MedusaError = exports.MedusaErrorCodes = exports.MedusaErrorTypes = void 0;
|
|
19
44
|
/**
|
|
@@ -55,7 +80,7 @@ var MedusaError = /** @class */ (function (_super) {
|
|
|
55
80
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
56
81
|
params[_i - 3] = arguments[_i];
|
|
57
82
|
}
|
|
58
|
-
var _this = _super.apply(this, params) || this;
|
|
83
|
+
var _this = _super.apply(this, __spreadArray([], __read(params), false)) || this;
|
|
59
84
|
if (Error.captureStackTrace) {
|
|
60
85
|
Error.captureStackTrace(_this, MedusaError);
|
|
61
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;GAGG;AACU,QAAA,gBAAgB,GAAG;IAC9B,wCAAwC;IACxC,QAAQ,EAAE,gBAAgB;IAC1B,eAAe,EAAE,iBAAiB;IAClC,gBAAgB,EAAE,kBAAkB;IACpC,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,QAAQ,EAAE,UAAU;IACpB,2BAA2B,EAAE,6BAA6B;CAC3D,CAAA;AAEY,QAAA,gBAAgB,GAAG;IAC9B,sBAAsB,EAAE,wBAAwB;IAChD,uBAAuB,EAAE,yBAAyB;CACnD,CAAA;AAED;;;GAGG;AACH;IAAiC,+BAAK;IAQpC;;;;;;OAMG;IACH,qBAAY,IAAY,EAAE,OAAe,EAAE,IAAa;QAAE,gBAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,+BAAc;;QAAxE,wDACW,MAAM,mBAUhB;QARC,IAAI,KAAK,CAAC,iBAAiB,EAAE;YAC3B,KAAK,CAAC,iBAAiB,CAAC,KAAI,EAAE,WAAW,CAAC,CAAA;SAC3C;QAED,KAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,KAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,KAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,KAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA;;IACxB,CAAC;IArBa,iBAAK,GAAG,wBAAgB,CAAA;IACxB,iBAAK,GAAG,wBAAgB,CAAA;IAqBxC,kBAAC;CAAA,AA3BD,CAAiC,KAAK,GA2BrC;AA3BY,kCAAW"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -2,18 +2,22 @@ export * from "./build-query";
|
|
|
2
2
|
export * from "./errors";
|
|
3
3
|
export * from "./generate-entity-id";
|
|
4
4
|
export * from "./get-config-file";
|
|
5
|
+
export * from "./handle-postgres-database-error";
|
|
5
6
|
export * from "./is-date";
|
|
6
7
|
export * from "./is-defined";
|
|
7
8
|
export * from "./is-email";
|
|
8
9
|
export * from "./is-object";
|
|
9
10
|
export * from "./is-string";
|
|
10
11
|
export * from "./lower-case-first";
|
|
12
|
+
export * from "./upper-case-first";
|
|
11
13
|
export * from "./medusa-container";
|
|
12
14
|
export * from "./object-to-string-path";
|
|
13
15
|
export * from "./set-metadata";
|
|
14
16
|
export * from "./simple-hash";
|
|
15
17
|
export * from "./wrap-handler";
|
|
16
18
|
export * from "./to-kebab-case";
|
|
19
|
+
export * from "./to-camel-case";
|
|
17
20
|
export * from "./stringify-circular";
|
|
18
|
-
export * from "./
|
|
19
|
-
export * from "./
|
|
21
|
+
export * from "./to-kebab-case";
|
|
22
|
+
export * from "./to-pascal-case";
|
|
23
|
+
export * from "./wrap-handler";
|
package/dist/common/index.js
CHANGED
|
@@ -18,19 +18,23 @@ __exportStar(require("./build-query"), exports);
|
|
|
18
18
|
__exportStar(require("./errors"), exports);
|
|
19
19
|
__exportStar(require("./generate-entity-id"), exports);
|
|
20
20
|
__exportStar(require("./get-config-file"), exports);
|
|
21
|
+
__exportStar(require("./handle-postgres-database-error"), exports);
|
|
21
22
|
__exportStar(require("./is-date"), exports);
|
|
22
23
|
__exportStar(require("./is-defined"), exports);
|
|
23
24
|
__exportStar(require("./is-email"), exports);
|
|
24
25
|
__exportStar(require("./is-object"), exports);
|
|
25
26
|
__exportStar(require("./is-string"), exports);
|
|
26
27
|
__exportStar(require("./lower-case-first"), exports);
|
|
28
|
+
__exportStar(require("./upper-case-first"), exports);
|
|
27
29
|
__exportStar(require("./medusa-container"), exports);
|
|
28
30
|
__exportStar(require("./object-to-string-path"), exports);
|
|
29
31
|
__exportStar(require("./set-metadata"), exports);
|
|
30
32
|
__exportStar(require("./simple-hash"), exports);
|
|
31
33
|
__exportStar(require("./wrap-handler"), exports);
|
|
32
34
|
__exportStar(require("./to-kebab-case"), exports);
|
|
35
|
+
__exportStar(require("./to-camel-case"), exports);
|
|
33
36
|
__exportStar(require("./stringify-circular"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
35
|
-
__exportStar(require("./
|
|
37
|
+
__exportStar(require("./to-kebab-case"), exports);
|
|
38
|
+
__exportStar(require("./to-pascal-case"), exports);
|
|
39
|
+
__exportStar(require("./wrap-handler"), exports);
|
|
36
40
|
//# sourceMappingURL=index.js.map
|
package/dist/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,2CAAwB;AACxB,uDAAoC;AACpC,oDAAiC;AACjC,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,8CAA2B;AAC3B,8CAA2B;AAC3B,qDAAkC;AAClC,qDAAkC;AAClC,0DAAuC;AACvC,iDAA8B;AAC9B,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,uDAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,2CAAwB;AACxB,uDAAoC;AACpC,oDAAiC;AACjC,mEAAgD;AAChD,4CAAyB;AACzB,+CAA4B;AAC5B,6CAA0B;AAC1B,8CAA2B;AAC3B,8CAA2B;AAC3B,qDAAkC;AAClC,qDAAkC;AAClC,qDAAkC;AAClC,0DAAuC;AACvC,iDAA8B;AAC9B,gDAA6B;AAC7B,iDAA8B;AAC9B,kDAA+B;AAC/B,kDAA+B;AAC/B,uDAAoC;AACpC,kDAA+B;AAC/B,mDAAgC;AAChC,iDAA8B"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Converts a structure of find options to an
|
|
3
3
|
* array of string paths
|
|
4
4
|
* @example
|
|
5
|
-
*
|
|
5
|
+
* // With `includeTruePropertiesOnly` default value set to false
|
|
6
|
+
* const result = objectToStringPath({
|
|
6
7
|
* test: {
|
|
7
8
|
* test1: true,
|
|
8
9
|
* test2: true,
|
|
@@ -11,8 +12,31 @@
|
|
|
11
12
|
* },
|
|
12
13
|
* },
|
|
13
14
|
* test2: true
|
|
14
|
-
* }
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* })
|
|
16
|
+
* console.log(result)
|
|
17
|
+
* // output: ['test', 'test.test1', 'test.test2', 'test.test3', 'test.test3.test4', 'test2']
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // With `includeTruePropertiesOnly` set to true
|
|
21
|
+
* const result = objectToStringPath({
|
|
22
|
+
* test: {
|
|
23
|
+
* test1: true,
|
|
24
|
+
* test2: true,
|
|
25
|
+
* test3: {
|
|
26
|
+
* test4: true
|
|
27
|
+
* },
|
|
28
|
+
* },
|
|
29
|
+
* test2: true
|
|
30
|
+
* }, {
|
|
31
|
+
* includeTruePropertiesOnly: true
|
|
32
|
+
* })
|
|
33
|
+
* console.log(result)
|
|
34
|
+
* // output: ['test.test1', 'test.test2', 'test.test3.test4', 'test2']
|
|
35
|
+
*
|
|
36
|
+
* @param {InputObject} input
|
|
37
|
+
* @param {boolean} includeParentPropertyFields If set to true (example 1), all properties will be included as well as the parents,
|
|
38
|
+
* otherwise (example 2) all properties path set to true will included, excluded the parents
|
|
17
39
|
*/
|
|
18
|
-
export declare function objectToStringPath(input?: object
|
|
40
|
+
export declare function objectToStringPath(input?: object, { includeParentPropertyFields }?: {
|
|
41
|
+
includeParentPropertyFields: boolean;
|
|
42
|
+
}): string[];
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.objectToStringPath = void 0;
|
|
4
15
|
var is_object_1 = require("./is-object");
|
|
@@ -6,7 +17,8 @@ var is_object_1 = require("./is-object");
|
|
|
6
17
|
* Converts a structure of find options to an
|
|
7
18
|
* array of string paths
|
|
8
19
|
* @example
|
|
9
|
-
*
|
|
20
|
+
* // With `includeTruePropertiesOnly` default value set to false
|
|
21
|
+
* const result = objectToStringPath({
|
|
10
22
|
* test: {
|
|
11
23
|
* test1: true,
|
|
12
24
|
* test2: true,
|
|
@@ -15,19 +27,48 @@ var is_object_1 = require("./is-object");
|
|
|
15
27
|
* },
|
|
16
28
|
* },
|
|
17
29
|
* test2: true
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
*
|
|
30
|
+
* })
|
|
31
|
+
* console.log(result)
|
|
32
|
+
* // output: ['test', 'test.test1', 'test.test2', 'test.test3', 'test.test3.test4', 'test2']
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // With `includeTruePropertiesOnly` set to true
|
|
36
|
+
* const result = objectToStringPath({
|
|
37
|
+
* test: {
|
|
38
|
+
* test1: true,
|
|
39
|
+
* test2: true,
|
|
40
|
+
* test3: {
|
|
41
|
+
* test4: true
|
|
42
|
+
* },
|
|
43
|
+
* },
|
|
44
|
+
* test2: true
|
|
45
|
+
* }, {
|
|
46
|
+
* includeTruePropertiesOnly: true
|
|
47
|
+
* })
|
|
48
|
+
* console.log(result)
|
|
49
|
+
* // output: ['test.test1', 'test.test2', 'test.test3.test4', 'test2']
|
|
50
|
+
*
|
|
51
|
+
* @param {InputObject} input
|
|
52
|
+
* @param {boolean} includeParentPropertyFields If set to true (example 1), all properties will be included as well as the parents,
|
|
53
|
+
* otherwise (example 2) all properties path set to true will included, excluded the parents
|
|
21
54
|
*/
|
|
22
|
-
function objectToStringPath(input) {
|
|
55
|
+
function objectToStringPath(input, _a) {
|
|
56
|
+
var e_1, _b;
|
|
23
57
|
if (input === void 0) { input = {}; }
|
|
58
|
+
var _c = _a === void 0 ? {
|
|
59
|
+
includeParentPropertyFields: true,
|
|
60
|
+
} : _a, includeParentPropertyFields = _c.includeParentPropertyFields;
|
|
24
61
|
if (!(0, is_object_1.isObject)(input) || !Object.keys(input).length) {
|
|
25
62
|
return [];
|
|
26
63
|
}
|
|
27
|
-
var output =
|
|
64
|
+
var output = includeParentPropertyFields
|
|
65
|
+
? new Set(Object.keys(input))
|
|
66
|
+
: new Set();
|
|
28
67
|
var _loop_1 = function (key) {
|
|
29
|
-
if (
|
|
30
|
-
var deepRes = objectToStringPath(input[key]
|
|
68
|
+
if ((0, is_object_1.isObject)(input[key])) {
|
|
69
|
+
var deepRes = objectToStringPath(input[key], {
|
|
70
|
+
includeParentPropertyFields: includeParentPropertyFields,
|
|
71
|
+
});
|
|
31
72
|
var items = deepRes.reduce(function (acc, val) {
|
|
32
73
|
acc.push("".concat(key, ".").concat(val));
|
|
33
74
|
return acc;
|
|
@@ -35,11 +76,22 @@ function objectToStringPath(input) {
|
|
|
35
76
|
items.forEach(function (item) { return output.add(item); });
|
|
36
77
|
return "continue";
|
|
37
78
|
}
|
|
38
|
-
|
|
79
|
+
if ((0, is_object_1.isObject)(key) || input[key] === true) {
|
|
80
|
+
output.add(key);
|
|
81
|
+
}
|
|
39
82
|
};
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
83
|
+
try {
|
|
84
|
+
for (var _d = __values(Object.keys(input)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
85
|
+
var key = _e.value;
|
|
86
|
+
_loop_1(key);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
90
|
+
finally {
|
|
91
|
+
try {
|
|
92
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
93
|
+
}
|
|
94
|
+
finally { if (e_1) throw e_1.error; }
|
|
43
95
|
}
|
|
44
96
|
return Array.from(output);
|
|
45
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-to-string-path.js","sourceRoot":"","sources":["../../src/common/object-to-string-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"object-to-string-path.js","sourceRoot":"","sources":["../../src/common/object-to-string-path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,yCAAsC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,kBAAkB,CAChC,KAAkB,EAClB,EAEC;;IAHD,sBAAA,EAAA,UAAkB;QAClB,qBAA4E;QAC1E,2BAA2B,EAAE,IAAI;KAClC,KAAA,EAFC,2BAA2B,iCAAA;IAI7B,IAAI,CAAC,IAAA,oBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;QAClD,OAAO,EAAE,CAAA;KACV;IAED,IAAM,MAAM,GAAgB,2BAA2B;QACrD,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,IAAI,GAAG,EAAE,CAAA;4BAEF,GAAG;QACZ,IAAI,IAAA,oBAAQ,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;YACxB,IAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;gBAC7C,2BAA2B,6BAAA;aAC5B,CAAC,CAAA;YAEF,IAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG;gBACpC,GAAG,CAAC,IAAI,CAAC,UAAG,GAAG,cAAI,GAAG,CAAE,CAAC,CAAA;gBACzB,OAAO,GAAG,CAAA;YACZ,CAAC,EAAE,EAAc,CAAC,CAAA;YAElB,KAAK,CAAC,OAAO,CAAC,UAAC,IAAI,IAAK,OAAA,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAhB,CAAgB,CAAC,CAAA;;SAE1C;QAED,IAAI,IAAA,oBAAQ,EAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;YACxC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;SAChB;;;QAjBH,KAAkB,IAAA,KAAA,SAAA,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA,gBAAA;YAA/B,IAAM,GAAG,WAAA;oBAAH,GAAG;SAkBb;;;;;;;;;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC3B,CAAC;AAnCD,gDAmCC"}
|
|
@@ -10,6 +10,33 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
13
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
41
|
exports.setMetadata = void 0;
|
|
15
42
|
var errors_1 = require("./errors");
|
|
@@ -20,26 +47,36 @@ var errors_1 = require("./errors");
|
|
|
20
47
|
* @return resolves to the updated result.
|
|
21
48
|
*/
|
|
22
49
|
function setMetadata(obj, metadata) {
|
|
50
|
+
var e_1, _a;
|
|
23
51
|
var existing = obj.metadata || {};
|
|
24
52
|
var newData = {};
|
|
25
|
-
|
|
26
|
-
var _b =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
53
|
+
try {
|
|
54
|
+
for (var _b = __values(Object.entries(metadata)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
55
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
56
|
+
if (typeof key !== "string") {
|
|
57
|
+
throw new errors_1.MedusaError(errors_1.MedusaError.Types.INVALID_ARGUMENT, "Key type is invalid. Metadata keys must be strings");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* We reserve the empty string as a way to delete a key.
|
|
61
|
+
* If the value is an empty string, we don't
|
|
62
|
+
* set it, and if it exists in the existing metadata, we
|
|
63
|
+
* unset the field.
|
|
64
|
+
*/
|
|
65
|
+
if (value === "") {
|
|
66
|
+
if (key in existing) {
|
|
67
|
+
delete existing[key];
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
39
70
|
}
|
|
40
|
-
|
|
71
|
+
newData[key] = value;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
75
|
+
finally {
|
|
76
|
+
try {
|
|
77
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
41
78
|
}
|
|
42
|
-
|
|
79
|
+
finally { if (e_1) throw e_1.error; }
|
|
43
80
|
}
|
|
44
81
|
return __assign(__assign({}, existing), newData);
|
|
45
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-metadata.js","sourceRoot":"","sources":["../../src/common/set-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"set-metadata.js","sourceRoot":"","sources":["../../src/common/set-metadata.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAsC;AAEtC;;;;;GAKG;AACH,SAAgB,WAAW,CACzB,GAAiD,EACjD,QAAiC;;IAEjC,IAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAA;IACnC,IAAM,OAAO,GAAG,EAAE,CAAA;;QAElB,KAA2B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA,gBAAA,4BAAE;YAA1C,IAAA,KAAA,mBAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YACpB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;gBAC3B,MAAM,IAAI,oBAAW,CACnB,oBAAW,CAAC,KAAK,CAAC,gBAAgB,EAClC,oDAAoD,CACrD,CAAA;aACF;YAED;;;;;eAKG;YACH,IAAI,KAAK,KAAK,EAAE,EAAE;gBAChB,IAAI,GAAG,IAAI,QAAQ,EAAE;oBACnB,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;iBACrB;gBAED,SAAQ;aACT;YAED,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACrB;;;;;;;;;IAED,6BACK,QAAQ,GACR,OAAO,EACX;AACH,CAAC;AApCD,kCAoCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toCamelCase(str: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCamelCase = void 0;
|
|
4
|
+
function toCamelCase(str) {
|
|
5
|
+
return /^([a-z]+)(([A-Z]([a-z]+))+)$/.test(str)
|
|
6
|
+
? str
|
|
7
|
+
: str
|
|
8
|
+
.toLowerCase()
|
|
9
|
+
.replace(/[^a-zA-Z0-9]+(.)/g, function (m, chr) { return chr.toUpperCase(); });
|
|
10
|
+
}
|
|
11
|
+
exports.toCamelCase = toCamelCase;
|
|
12
|
+
//# sourceMappingURL=to-camel-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-camel-case.js","sourceRoot":"","sources":["../../src/common/to-camel-case.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW;IACrC,OAAO,8BAA8B,CAAC,IAAI,CAAC,GAAG,CAAC;QAC7C,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,GAAG;aACA,WAAW,EAAE;aACb,OAAO,CAAC,mBAAmB,EAAE,UAAC,CAAC,EAAE,GAAG,IAAK,OAAA,GAAG,CAAC,WAAW,EAAE,EAAjB,CAAiB,CAAC,CAAA;AACpE,CAAC;AAND,kCAMC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toPascalCase(s: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toPascalCase = void 0;
|
|
4
|
+
function toPascalCase(s) {
|
|
5
|
+
return s.replace(/(^\w|_\w)/g, function (match) {
|
|
6
|
+
return match.replace(/_/g, "").toUpperCase();
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
exports.toPascalCase = toPascalCase;
|
|
10
|
+
//# sourceMappingURL=to-pascal-case.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-pascal-case.js","sourceRoot":"","sources":["../../src/common/to-pascal-case.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,UAAC,KAAK;QACnC,OAAA,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;IAArC,CAAqC,CACtC,CAAA;AACH,CAAC;AAJD,oCAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function upperCaseFirst(str: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upperCaseFirst = void 0;
|
|
4
|
+
function upperCaseFirst(str) {
|
|
5
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
6
|
+
}
|
|
7
|
+
exports.upperCaseFirst = upperCaseFirst;
|
|
8
|
+
//# sourceMappingURL=upper-case-first.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upper-case-first.js","sourceRoot":"","sources":["../../src/common/upper-case-first.ts"],"names":[],"mappings":";;;AAAA,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AACnD,CAAC;AAFD,wCAEC"}
|
package/dist/event-bus/index.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
19
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
20
|
if (ar || !(i in from)) {
|
|
@@ -31,7 +47,7 @@ var AbstractEventBusModuleService = /** @class */ (function () {
|
|
|
31
47
|
if (subscriberAlreadyExists) {
|
|
32
48
|
throw Error("Subscriber with id ".concat(subscriberId, " already exists"));
|
|
33
49
|
}
|
|
34
|
-
this.eventToSubscribersMap_.set(event, __spreadArray(__spreadArray([], existingSubscribers,
|
|
50
|
+
this.eventToSubscribersMap_.set(event, __spreadArray(__spreadArray([], __read(existingSubscribers), false), [
|
|
35
51
|
newSubscriberDescriptor,
|
|
36
52
|
], false));
|
|
37
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event-bus/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/event-bus/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAA2B;AAE3B;IAAA;QAGY,2BAAsB,GAG5B,IAAI,GAAG,EAAE,CAAA;IA6Ff,CAAC;IA3FC,sBAAW,gEAAqB;aAAhC;YAIE,OAAO,IAAI,CAAC,sBAAsB,CAAA;QACpC,CAAC;;;OAAA;IASS,wDAAgB,GAA1B,UAA2B,EAQ1B;;YAPC,KAAK,WAAA,EACL,YAAY,kBAAA,EACZ,UAAU,gBAAA;QAMV,IAAM,uBAAuB,GAAG,EAAE,UAAU,YAAA,EAAE,EAAE,EAAE,YAAY,EAAE,CAAA;QAEhE,IAAM,mBAAmB,GAAG,MAAA,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAA;QAExE,IAAM,uBAAuB,GAAG,mBAAmB,CAAC,IAAI,CACtD,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,EAAE,KAAK,YAAY,EAAvB,CAAuB,CACjC,CAAA;QAED,IAAI,uBAAuB,EAAE;YAC3B,MAAM,KAAK,CAAC,6BAAsB,YAAY,oBAAiB,CAAC,CAAA;SACjE;QAED,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,yCAChC,mBAAmB;YACtB,uBAAuB;kBACvB,CAAA;IACJ,CAAC;IAEM,iDAAS,GAAhB,UACE,SAA0B,EAC1B,UAAoC,EACpC,OAAyC;;QAEzC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;SACjD;QACD;;;WAGG;QAEH,IAAM,MAAM,GAAG,IAAA,WAAI,GAAE,CAAA;QACrB,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAA;QAElC,IAAI,CAAC,gBAAgB,CAAC;YACpB,KAAK,OAAA;YACL,YAAY,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,mCAAI,UAAG,KAAK,cAAI,MAAM,CAAE;YAC3D,UAAU,YAAA;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,mDAAW,GAAX,UACE,SAA0B,EAC1B,UAAoC,EACpC,OAAwC;;QAExC,IAAI,OAAO,UAAU,KAAK,UAAU,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;SACjD;QAED,IAAM,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAEtE,IAAI,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,MAAM,EAAE;YAC/B,IAAM,QAAQ,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,SAAS,CAC7C,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,EAAE,MAAK,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,CAAA,EAAhC,CAAgC,CAC1C,CAAA;YAED,IAAI,QAAQ,KAAK,CAAC,CAAC,EAAE;gBACnB,MAAA,IAAI,CAAC,sBAAsB;qBACxB,GAAG,CAAC,SAAS,CAAC,0CACb,MAAM,CAAC,QAAkB,EAAE,CAAC,CAAC,CAAA;aAClC;SACF;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IACH,oCAAC;AAAD,CAAC,AAnGD,IAmGC;AAnGqB,sEAA6B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medusajs/utils",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2-beta-20230705211101",
|
|
4
4
|
"description": "Medusa utilities functions shared by Medusa core and Modules",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"author": "Medusa",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@medusajs/types": "
|
|
20
|
+
"@medusajs/types": "1.8.10-beta-20230705211101",
|
|
21
21
|
"@types/express": "^4.17.17",
|
|
22
22
|
"cross-env": "^5.2.1",
|
|
23
23
|
"express": "^4.18.2",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"prepare": "cross-env NODE_ENV=production yarn run build",
|
|
35
35
|
"build": "tsc --build",
|
|
36
36
|
"watch": "tsc --build --watch",
|
|
37
|
-
"test": "jest
|
|
37
|
+
"test": "jest"
|
|
38
38
|
}
|
|
39
39
|
}
|