@medusajs/utils 1.11.6 → 1.11.7-next-20240305095805
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/api-key/api-key-type.d.ts +15 -0
- package/dist/api-key/api-key-type.js +20 -0
- package/dist/api-key/api-key-type.js.map +1 -0
- package/dist/api-key/index.d.ts +1 -0
- package/dist/api-key/index.js +18 -0
- package/dist/api-key/index.js.map +1 -0
- package/dist/auth/abstract-auth-provider.js +1 -1
- package/dist/auth/abstract-auth-provider.js.map +1 -1
- package/dist/bundles.d.ts +3 -0
- package/dist/bundles.js +4 -1
- package/dist/bundles.js.map +1 -1
- package/dist/common/alter-columns-helper.d.ts +1 -0
- package/dist/common/alter-columns-helper.js +13 -0
- package/dist/common/alter-columns-helper.js.map +1 -0
- package/dist/common/container.d.ts +1 -0
- package/dist/common/container.js +1 -0
- package/dist/common/container.js.map +1 -1
- package/dist/common/convert-item-response-to-update-request.d.ts +5 -0
- package/dist/common/convert-item-response-to-update-request.js +139 -0
- package/dist/common/convert-item-response-to-update-request.js.map +1 -0
- package/dist/common/create-psql-index-helper.d.ts +15 -6
- package/dist/common/create-psql-index-helper.js +34 -5
- package/dist/common/create-psql-index-helper.js.map +1 -1
- package/dist/common/get-duplicates.d.ts +1 -0
- package/dist/common/get-duplicates.js +20 -0
- package/dist/common/get-duplicates.js.map +1 -0
- package/dist/common/get-set-difference.d.ts +6 -0
- package/dist/common/get-set-difference.js +19 -0
- package/dist/common/get-set-difference.js.map +1 -0
- package/dist/common/index.d.ts +7 -0
- package/dist/common/index.js +7 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/is-big-number.d.ts +2 -0
- package/dist/common/is-big-number.js +9 -0
- package/dist/common/is-big-number.js.map +1 -0
- package/dist/common/remove-undefined.d.ts +1 -0
- package/dist/common/remove-undefined.js +9 -0
- package/dist/common/remove-undefined.js.map +1 -0
- package/dist/common/trim-zeros.d.ts +1 -0
- package/dist/common/trim-zeros.js +32 -0
- package/dist/common/trim-zeros.js.map +1 -0
- package/dist/dal/index.d.ts +1 -0
- package/dist/dal/index.js +1 -0
- package/dist/dal/index.js.map +1 -1
- package/dist/dal/mikro-orm/big-number-field.d.ts +4 -0
- package/dist/dal/mikro-orm/big-number-field.js +58 -0
- package/dist/dal/mikro-orm/big-number-field.js.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-repository.js +12 -3
- package/dist/dal/mikro-orm/mikro-orm-repository.js.map +1 -1
- package/dist/dal/mikro-orm/utils.d.ts +2 -1
- package/dist/dal/mikro-orm/utils.js +187 -129
- package/dist/dal/mikro-orm/utils.js.map +1 -1
- package/dist/defaults/currencies.js +1 -1
- package/dist/defaults/currencies.js.map +1 -1
- package/dist/event-bus/message-aggregator.d.ts +2 -1
- package/dist/event-bus/message-aggregator.js +4 -0
- package/dist/event-bus/message-aggregator.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/modules-sdk/abstract-module-service-factory.d.ts +0 -7
- package/dist/modules-sdk/abstract-module-service-factory.js +37 -2
- package/dist/modules-sdk/abstract-module-service-factory.js.map +1 -1
- package/dist/modules-sdk/build-query.js +25 -8
- package/dist/modules-sdk/build-query.js.map +1 -1
- package/dist/modules-sdk/create-pg-connection.d.ts +1 -1
- package/dist/modules-sdk/create-pg-connection.js +2 -5
- package/dist/modules-sdk/create-pg-connection.js.map +1 -1
- package/dist/modules-sdk/decorators/emit-events.d.ts +1 -0
- package/dist/modules-sdk/decorators/emit-events.js +73 -0
- package/dist/modules-sdk/decorators/emit-events.js.map +1 -0
- package/dist/modules-sdk/decorators/index.d.ts +2 -0
- package/dist/modules-sdk/decorators/index.js +2 -0
- package/dist/modules-sdk/decorators/index.js.map +1 -1
- package/dist/modules-sdk/decorators/inject-into-context.js.map +1 -1
- package/dist/modules-sdk/internal-module-service-factory.js +25 -4
- package/dist/modules-sdk/internal-module-service-factory.js.map +1 -1
- package/dist/modules-sdk/loaders/container-loader-factory.js +2 -2
- package/dist/modules-sdk/loaders/container-loader-factory.js.map +1 -1
- package/dist/orchestration/symbol.d.ts +8 -8
- package/dist/orchestration/symbol.js +8 -8
- package/dist/orchestration/symbol.js.map +1 -1
- package/dist/order/index.d.ts +1 -0
- package/dist/order/index.js +18 -0
- package/dist/order/index.js.map +1 -0
- package/dist/order/status.d.ts +58 -0
- package/dist/order/status.js +64 -0
- package/dist/order/status.js.map +1 -0
- package/dist/payment/abstract-payment-provider.d.ts +76 -0
- package/dist/payment/abstract-payment-provider.js +73 -0
- package/dist/payment/abstract-payment-provider.js.map +1 -0
- package/dist/payment/index.d.ts +2 -0
- package/dist/payment/index.js +2 -0
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/webhook.d.ts +24 -0
- package/dist/payment/webhook.js +30 -0
- package/dist/payment/webhook.js.map +1 -0
- package/dist/promotion/index.d.ts +5 -0
- package/dist/promotion/index.js +7 -1
- package/dist/promotion/index.js.map +1 -1
- package/dist/totals/big-number.d.ts +18 -0
- package/dist/totals/big-number.js +114 -0
- package/dist/totals/big-number.js.map +1 -0
- package/dist/totals/index.d.ts +50 -0
- package/dist/totals/index.js +195 -0
- package/dist/totals/index.js.map +1 -0
- package/dist/totals/promotion/index.d.ts +1 -0
- package/dist/totals/promotion/index.js +18 -0
- package/dist/totals/promotion/index.js.map +1 -0
- package/dist/totals/promotion/totals.d.ts +3 -0
- package/dist/totals/promotion/totals.js +43 -0
- package/dist/totals/promotion/totals.js.map +1 -0
- package/dist/totals/to-big-number-js.d.ts +12 -0
- package/dist/totals/to-big-number-js.js +20 -0
- package/dist/totals/to-big-number-js.js.map +1 -0
- package/dist/user/events.d.ts +7 -0
- package/dist/user/events.js +12 -0
- package/dist/user/events.js.map +1 -0
- package/dist/user/index.d.ts +1 -0
- package/dist/user/index.js +18 -0
- package/dist/user/index.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @enum
|
|
3
|
+
*
|
|
4
|
+
* The API key's type.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum ApiKeyType {
|
|
7
|
+
/**
|
|
8
|
+
* Publishable key that is tied to eg. a sales channel
|
|
9
|
+
*/
|
|
10
|
+
PUBLISHABLE = "publishable",
|
|
11
|
+
/**
|
|
12
|
+
* Secret key that allows access to the admin API
|
|
13
|
+
*/
|
|
14
|
+
SECRET = "secret"
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiKeyType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @enum
|
|
6
|
+
*
|
|
7
|
+
* The API key's type.
|
|
8
|
+
*/
|
|
9
|
+
var ApiKeyType;
|
|
10
|
+
(function (ApiKeyType) {
|
|
11
|
+
/**
|
|
12
|
+
* Publishable key that is tied to eg. a sales channel
|
|
13
|
+
*/
|
|
14
|
+
ApiKeyType["PUBLISHABLE"] = "publishable";
|
|
15
|
+
/**
|
|
16
|
+
* Secret key that allows access to the admin API
|
|
17
|
+
*/
|
|
18
|
+
ApiKeyType["SECRET"] = "secret";
|
|
19
|
+
})(ApiKeyType || (exports.ApiKeyType = ApiKeyType = {}));
|
|
20
|
+
//# sourceMappingURL=api-key-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-key-type.js","sourceRoot":"","sources":["../../src/api-key/api-key-type.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,UASX;AATD,WAAY,UAAU;IACpB;;OAEG;IACH,yCAA2B,CAAA;IAC3B;;OAEG;IACH,+BAAiB,CAAA;AACnB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./api-key-type";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api-key-type"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api-key/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B"}
|
|
@@ -35,7 +35,7 @@ var AbstractAuthModuleProvider = /** @class */ (function () {
|
|
|
35
35
|
this.validateScope(scope);
|
|
36
36
|
var cloned = new this.constructor(this.container_);
|
|
37
37
|
cloned.scope_ = scope;
|
|
38
|
-
cloned.
|
|
38
|
+
cloned.scopeConfig_ = this.scopes_[scope];
|
|
39
39
|
return cloned;
|
|
40
40
|
};
|
|
41
41
|
AbstractAuthModuleProvider.prototype.validateCallback = function (data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-auth-provider.js","sourceRoot":"","sources":["../../src/auth/abstract-auth-provider.ts"],"names":[],"mappings":";;;AAEA,oCAAuC;AAEvC;IAkBE,oCACE,EAAU,EACV,MAAiD;YAD/C,MAAM,YAAA;;;QAGR,IAAI,C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fillment";
|
|
7
7
|
export * as ModulesSdkUtils from "./modules-sdk";
|
|
8
8
|
export * as OrchestrationUtils from "./orchestration";
|
|
9
|
+
export * as OrderUtils from "./order";
|
|
9
10
|
export * as ProductUtils from "./product";
|
|
10
11
|
export * as PromotionUtils from "./promotion";
|
|
11
12
|
export * as SearchUtils from "./search";
|
|
12
13
|
export * as ShippingProfileUtils from "./shipping";
|
|
14
|
+
export * as UserUtils from "./user";
|
|
15
|
+
export * as ApiKeyUtils from "./api-key";
|
package/dist/bundles.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ShippingProfileUtils = exports.SearchUtils = exports.PromotionUtils = exports.ProductUtils = exports.OrchestrationUtils = exports.ModulesSdkUtils = exports.FulfillmentUtils = exports.FeatureFlagUtils = exports.EventBusUtils = exports.DefaultsUtils = exports.DecoratorUtils = exports.DALUtils = void 0;
|
|
26
|
+
exports.ApiKeyUtils = exports.UserUtils = exports.ShippingProfileUtils = exports.SearchUtils = exports.PromotionUtils = exports.ProductUtils = exports.OrderUtils = exports.OrchestrationUtils = exports.ModulesSdkUtils = exports.FulfillmentUtils = exports.FeatureFlagUtils = exports.EventBusUtils = exports.DefaultsUtils = exports.DecoratorUtils = exports.DALUtils = void 0;
|
|
27
27
|
exports.DALUtils = __importStar(require("./dal"));
|
|
28
28
|
exports.DecoratorUtils = __importStar(require("./decorators"));
|
|
29
29
|
exports.DefaultsUtils = __importStar(require("./defaults"));
|
|
@@ -32,8 +32,11 @@ exports.FeatureFlagUtils = __importStar(require("./feature-flags"));
|
|
|
32
32
|
exports.FulfillmentUtils = __importStar(require("./fulfillment"));
|
|
33
33
|
exports.ModulesSdkUtils = __importStar(require("./modules-sdk"));
|
|
34
34
|
exports.OrchestrationUtils = __importStar(require("./orchestration"));
|
|
35
|
+
exports.OrderUtils = __importStar(require("./order"));
|
|
35
36
|
exports.ProductUtils = __importStar(require("./product"));
|
|
36
37
|
exports.PromotionUtils = __importStar(require("./promotion"));
|
|
37
38
|
exports.SearchUtils = __importStar(require("./search"));
|
|
38
39
|
exports.ShippingProfileUtils = __importStar(require("./shipping"));
|
|
40
|
+
exports.UserUtils = __importStar(require("./user"));
|
|
41
|
+
exports.ApiKeyUtils = __importStar(require("./api-key"));
|
|
39
42
|
//# sourceMappingURL=bundles.js.map
|
package/dist/bundles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAiC;AACjC,+DAA8C;AAC9C,4DAA2C;AAC3C,6DAA4C;AAC5C,oEAAmD;AACnD,kEAAiD;AACjD,iEAAgD;AAChD,sEAAqD;AACrD,0DAAyC;AACzC,8DAA6C;AAC7C,wDAAuC;AACvC,mEAAkD"}
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAiC;AACjC,+DAA8C;AAC9C,4DAA2C;AAC3C,6DAA4C;AAC5C,oEAAmD;AACnD,kEAAiD;AACjD,iEAAgD;AAChD,sEAAqD;AACrD,sDAAqC;AACrC,0DAAyC;AACzC,8DAA6C;AAC7C,wDAAuC;AACvC,mEAAkD;AAClD,oDAAmC;AACnC,yDAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generatePostgresAlterColummnIfExistStatement(tableName: string, columns: string[], alterExpression: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generatePostgresAlterColummnIfExistStatement = void 0;
|
|
4
|
+
function generatePostgresAlterColummnIfExistStatement(tableName, columns, alterExpression) {
|
|
5
|
+
var script = "\n DO $$\n DECLARE\n current_column text;\n BEGIN";
|
|
6
|
+
columns.forEach(function (column) {
|
|
7
|
+
script += "\n current_column := '".concat(column, "';\n IF EXISTS (\n SELECT 1 \n FROM information_schema.columns \n WHERE table_name = '").concat(tableName, "' \n AND column_name = current_column\n ) THEN\n EXECUTE format('ALTER TABLE %I ALTER COLUMN %I ").concat(alterExpression, "', '").concat(tableName, "', current_column);\n ELSE\n RAISE NOTICE 'Column % does not exist or alteration condition not met.', current_column;\n END IF;");
|
|
8
|
+
});
|
|
9
|
+
script += "\n END$$;\n ";
|
|
10
|
+
return script;
|
|
11
|
+
}
|
|
12
|
+
exports.generatePostgresAlterColummnIfExistStatement = generatePostgresAlterColummnIfExistStatement;
|
|
13
|
+
//# sourceMappingURL=alter-columns-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alter-columns-helper.js","sourceRoot":"","sources":["../../src/common/alter-columns-helper.ts"],"names":[],"mappings":";;;AAAA,SAAgB,4CAA4C,CAC1D,SAAiB,EACjB,OAAiB,EACjB,eAAuB;IAEvB,IAAI,MAAM,GAAG,mEAIL,CAAA;IAER,OAAO,CAAC,OAAO,CAAC,UAAC,MAAM;QACrB,MAAM,IAAI,uCACe,MAAM,2IAID,SAAS,0IAGkB,eAAe,iBAAO,SAAS,6JAG5E,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,MAAM,IAAI,oBAEP,CAAA;IAEH,OAAO,MAAM,CAAA;AACf,CAAC;AA/BD,oGA+BC"}
|
package/dist/common/container.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/common/container.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;IACvC,aAAa,EAAE,mBAAmB;IAClC,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,cAAc;IAC7B,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,YAAY;
|
|
1
|
+
{"version":3,"file":"container.js","sourceRoot":"","sources":["../../src/common/container.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG;IACvC,aAAa,EAAE,mBAAmB;IAClC,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,cAAc;IAC7B,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,YAAY;IACzB,mBAAmB,EAAE,mBAAmB;CACzC,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
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
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.convertItemResponseToUpdateRequest = void 0;
|
|
31
|
+
var is_object_1 = require("../common/is-object");
|
|
32
|
+
function convertItemResponseToUpdateRequest(item, selects, relations, fromManyRelationships) {
|
|
33
|
+
var e_1, _a;
|
|
34
|
+
if (fromManyRelationships === void 0) { fromManyRelationships = false; }
|
|
35
|
+
var newItem = {
|
|
36
|
+
id: item.id,
|
|
37
|
+
};
|
|
38
|
+
// If item is a child of a many relationship, we just need to pass in the id of the item
|
|
39
|
+
if (fromManyRelationships) {
|
|
40
|
+
return newItem;
|
|
41
|
+
}
|
|
42
|
+
var _loop_1 = function (key, value) {
|
|
43
|
+
var e_2, _e, e_3, _f;
|
|
44
|
+
if (relations.includes(key)) {
|
|
45
|
+
var relation = item[key];
|
|
46
|
+
// If the relationship is an object, its either a one to one or many to one relationship
|
|
47
|
+
// We typically don't update the parent from the child relationship, we can skip this for now.
|
|
48
|
+
// This can be focused on solely for one to one relationships
|
|
49
|
+
if ((0, is_object_1.isObject)(relation)) {
|
|
50
|
+
// If "id" is the only one in the object, underscorize the relation. This is assuming that
|
|
51
|
+
// the relationship itself was changed to another item and now we need to revert it to the old item.
|
|
52
|
+
if (Object.keys(relation).length === 1 && "id" in relation) {
|
|
53
|
+
newItem["".concat(key, "_id")] = relation.id;
|
|
54
|
+
}
|
|
55
|
+
// If attributes of the relation have been updated, we can assume that this
|
|
56
|
+
// was an update operation on the relation. We revert what was updated.
|
|
57
|
+
if (Object.keys(relation).length > 1) {
|
|
58
|
+
// The ID can be figured out from the relationship, we can delete the ID here
|
|
59
|
+
if ("id" in relation) {
|
|
60
|
+
delete relation.id;
|
|
61
|
+
}
|
|
62
|
+
// we just need the selects for the relation, filter it out and remove the parent scope
|
|
63
|
+
var filteredSelects = selects
|
|
64
|
+
.filter(function (s) { return s.startsWith(key) && !s.includes("id"); })
|
|
65
|
+
.map(shiftFirstPath);
|
|
66
|
+
try {
|
|
67
|
+
// Add the filtered selects to the sanitized object
|
|
68
|
+
for (var filteredSelects_1 = (e_2 = void 0, __values(filteredSelects)), filteredSelects_1_1 = filteredSelects_1.next(); !filteredSelects_1_1.done; filteredSelects_1_1 = filteredSelects_1.next()) {
|
|
69
|
+
var filteredSelect = filteredSelects_1_1.value;
|
|
70
|
+
newItem[key] = newItem[key] || {};
|
|
71
|
+
newItem[key][filteredSelect] = relation[filteredSelect];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
75
|
+
finally {
|
|
76
|
+
try {
|
|
77
|
+
if (filteredSelects_1_1 && !filteredSelects_1_1.done && (_e = filteredSelects_1.return)) _e.call(filteredSelects_1);
|
|
78
|
+
}
|
|
79
|
+
finally { if (e_2) throw e_2.error; }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return "continue";
|
|
83
|
+
}
|
|
84
|
+
// If the relation is an array, we can expect this to be a one to many or many to many
|
|
85
|
+
// relationships. Recursively call the function until all relations are converted
|
|
86
|
+
if (Array.isArray(relation)) {
|
|
87
|
+
var newRelationsArray = [];
|
|
88
|
+
try {
|
|
89
|
+
for (var relation_1 = (e_3 = void 0, __values(relation)), relation_1_1 = relation_1.next(); !relation_1_1.done; relation_1_1 = relation_1.next()) {
|
|
90
|
+
var rel = relation_1_1.value;
|
|
91
|
+
// Scope selects and relations to ones that are relevant to the current relation
|
|
92
|
+
var filteredRelations = relations
|
|
93
|
+
.filter(function (r) { return r.startsWith(key); })
|
|
94
|
+
.map(shiftFirstPath);
|
|
95
|
+
var filteredSelects = selects
|
|
96
|
+
.filter(function (s) { return s.startsWith(key); })
|
|
97
|
+
.map(shiftFirstPath);
|
|
98
|
+
newRelationsArray.push(convertItemResponseToUpdateRequest(rel, filteredSelects, filteredRelations, true));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
102
|
+
finally {
|
|
103
|
+
try {
|
|
104
|
+
if (relation_1_1 && !relation_1_1.done && (_f = relation_1.return)) _f.call(relation_1);
|
|
105
|
+
}
|
|
106
|
+
finally { if (e_3) throw e_3.error; }
|
|
107
|
+
}
|
|
108
|
+
newItem[key] = newRelationsArray;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// if the key exists in the selects, we add them to the new sanitized array.
|
|
112
|
+
// sanitisation is done because MikroORM adds relationship attributes and other default attributes
|
|
113
|
+
// which we do not want to add to the update request
|
|
114
|
+
if (selects.includes(key) && !fromManyRelationships) {
|
|
115
|
+
newItem[key] = value;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
try {
|
|
119
|
+
for (var _b = __values(Object.entries(item)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
120
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
121
|
+
_loop_1(key, value);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
125
|
+
finally {
|
|
126
|
+
try {
|
|
127
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
128
|
+
}
|
|
129
|
+
finally { if (e_1) throw e_1.error; }
|
|
130
|
+
}
|
|
131
|
+
return newItem;
|
|
132
|
+
}
|
|
133
|
+
exports.convertItemResponseToUpdateRequest = convertItemResponseToUpdateRequest;
|
|
134
|
+
function shiftFirstPath(select) {
|
|
135
|
+
var selectArray = select.split(".");
|
|
136
|
+
selectArray.shift();
|
|
137
|
+
return selectArray.join(".");
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=convert-item-response-to-update-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-item-response-to-update-request.js","sourceRoot":"","sources":["../../src/common/convert-item-response-to-update-request.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAM9C,SAAgB,kCAAkC,CAChD,IAAgB,EAChB,OAAiB,EACjB,SAAmB,EACnB,qBAAsC;;IAAtC,sCAAA,EAAA,6BAAsC;IAEtC,IAAM,OAAO,GAAe;QAC1B,E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CAAA;AAChB,CAAC;AA1FD,gFA0FC;AAED,SAAS,cAAc,CAAC,MAAM;IAC5B,IAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACrC,WAAW,CAAC,KAAK,EAAE,CAAA;IAEnB,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Index } from "@mikro-orm/core";
|
|
1
2
|
/**
|
|
2
3
|
* Create a PSQL index statement
|
|
3
|
-
* @param name The name of the index
|
|
4
|
+
* @param name The name of the index, if not provided it will be generated in the format IDX_tableName_columnName
|
|
4
5
|
* @param tableName The name of the table
|
|
5
6
|
* @param columns The columns to index
|
|
6
7
|
* @param type The type of index (e.g GIN, GIST, BTREE, etc)
|
|
7
8
|
* @param where The where clause
|
|
9
|
+
* @param unique If the index should be a unique index
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* createPsqlIndexStatementHelper({
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
* where: "email IS NOT NULL"
|
|
16
18
|
* });
|
|
17
19
|
*
|
|
18
|
-
* // CREATE INDEX IF NOT EXISTS idx_user_email ON user USING btree (email) WHERE email IS NOT NULL;
|
|
20
|
+
* // expression: CREATE INDEX IF NOT EXISTS idx_user_email ON user USING btree (email) WHERE email IS NOT NULL;
|
|
19
21
|
*
|
|
20
22
|
* createPsqlIndexStatementHelper({
|
|
21
23
|
* name: "idx_user_email",
|
|
@@ -23,13 +25,20 @@
|
|
|
23
25
|
* columns: "email"
|
|
24
26
|
* });
|
|
25
27
|
*
|
|
26
|
-
* // CREATE INDEX IF NOT EXISTS idx_user_email ON user (email);
|
|
28
|
+
* // expression: CREATE INDEX IF NOT EXISTS idx_user_email ON user (email);
|
|
27
29
|
*
|
|
28
30
|
*/
|
|
29
|
-
export declare function createPsqlIndexStatementHelper({ name, tableName, columns, type, where, }: {
|
|
30
|
-
name
|
|
31
|
+
export declare function createPsqlIndexStatementHelper({ name, tableName, columns, type, where, unique, }: {
|
|
32
|
+
name?: string;
|
|
31
33
|
tableName: string;
|
|
32
34
|
columns: string | string[];
|
|
33
35
|
type?: string;
|
|
34
36
|
where?: string;
|
|
35
|
-
|
|
37
|
+
unique?: boolean;
|
|
38
|
+
}): {
|
|
39
|
+
toString: () => string;
|
|
40
|
+
valueOf: () => string;
|
|
41
|
+
name: string;
|
|
42
|
+
expression: string;
|
|
43
|
+
MikroORMIndex: (options?: Parameters<typeof Index>[0]) => (target: Partial<any>, propertyName?: string | undefined) => any;
|
|
44
|
+
};
|
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.createPsqlIndexStatementHelper = void 0;
|
|
15
|
+
var core_1 = require("@mikro-orm/core");
|
|
4
16
|
/**
|
|
5
17
|
* Create a PSQL index statement
|
|
6
|
-
* @param name The name of the index
|
|
18
|
+
* @param name The name of the index, if not provided it will be generated in the format IDX_tableName_columnName
|
|
7
19
|
* @param tableName The name of the table
|
|
8
20
|
* @param columns The columns to index
|
|
9
21
|
* @param type The type of index (e.g GIN, GIST, BTREE, etc)
|
|
10
22
|
* @param where The where clause
|
|
23
|
+
* @param unique If the index should be a unique index
|
|
11
24
|
*
|
|
12
25
|
* @example
|
|
13
26
|
* createPsqlIndexStatementHelper({
|
|
@@ -18,7 +31,7 @@ exports.createPsqlIndexStatementHelper = void 0;
|
|
|
18
31
|
* where: "email IS NOT NULL"
|
|
19
32
|
* });
|
|
20
33
|
*
|
|
21
|
-
* // CREATE INDEX IF NOT EXISTS idx_user_email ON user USING btree (email) WHERE email IS NOT NULL;
|
|
34
|
+
* // expression: CREATE INDEX IF NOT EXISTS idx_user_email ON user USING btree (email) WHERE email IS NOT NULL;
|
|
22
35
|
*
|
|
23
36
|
* createPsqlIndexStatementHelper({
|
|
24
37
|
* name: "idx_user_email",
|
|
@@ -26,15 +39,31 @@ exports.createPsqlIndexStatementHelper = void 0;
|
|
|
26
39
|
* columns: "email"
|
|
27
40
|
* });
|
|
28
41
|
*
|
|
29
|
-
* // CREATE INDEX IF NOT EXISTS idx_user_email ON user (email);
|
|
42
|
+
* // expression: CREATE INDEX IF NOT EXISTS idx_user_email ON user (email);
|
|
30
43
|
*
|
|
31
44
|
*/
|
|
32
45
|
function createPsqlIndexStatementHelper(_a) {
|
|
33
|
-
var name = _a.name, tableName = _a.tableName, columns = _a.columns, type = _a.type, where = _a.where;
|
|
46
|
+
var name = _a.name, tableName = _a.tableName, columns = _a.columns, type = _a.type, where = _a.where, unique = _a.unique;
|
|
47
|
+
var columnsName = Array.isArray(columns) ? columns.join("_") : columns;
|
|
34
48
|
columns = Array.isArray(columns) ? columns.join(", ") : columns;
|
|
49
|
+
name = name || "IDX_".concat(tableName, "_").concat(columnsName).concat(unique ? "_unique" : "");
|
|
35
50
|
var typeStr = type ? " USING ".concat(type) : "";
|
|
36
51
|
var optionsStr = where ? " WHERE ".concat(where) : "";
|
|
37
|
-
|
|
52
|
+
var uniqueStr = unique ? "UNIQUE " : "";
|
|
53
|
+
var expression = "CREATE ".concat(uniqueStr, "INDEX IF NOT EXISTS \"").concat(name, "\" ON \"").concat(tableName, "\"").concat(typeStr, " (").concat(columns, ")").concat(optionsStr);
|
|
54
|
+
return {
|
|
55
|
+
toString: function () {
|
|
56
|
+
return expression;
|
|
57
|
+
},
|
|
58
|
+
valueOf: function () {
|
|
59
|
+
return expression;
|
|
60
|
+
},
|
|
61
|
+
name: name,
|
|
62
|
+
expression: expression,
|
|
63
|
+
MikroORMIndex: function (options) {
|
|
64
|
+
return (0, core_1.Index)(__assign({ name: name, expression: expression }, options));
|
|
65
|
+
},
|
|
66
|
+
};
|
|
38
67
|
}
|
|
39
68
|
exports.createPsqlIndexStatementHelper = createPsqlIndexStatementHelper;
|
|
40
69
|
//# sourceMappingURL=create-psql-index-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-psql-index-helper.js","sourceRoot":"","sources":["../../src/common/create-psql-index-helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-psql-index-helper.js","sourceRoot":"","sources":["../../src/common/create-psql-index-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wCAAuC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,SAAgB,8BAA8B,CAAC,EAc9C;QAbC,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,OAAO,aAAA,EACP,IAAI,UAAA,EACJ,KAAK,WAAA,EACL,MAAM,YAAA;IASN,IAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAExE,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;IAC/D,IAAI,GAAG,IAAI,IAAI,cAAO,SAAS,cAAI,WAAW,SAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAE,CAAA;IAE1E,IAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,iBAAU,IAAI,CAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAC5C,IAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,iBAAU,KAAK,CAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IACjD,IAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAA;IAEzC,IAAM,UAAU,GAAG,iBAAU,SAAS,mCAAwB,IAAI,qBAAS,SAAS,eAAI,OAAO,eAAK,OAAO,cAAI,UAAU,CAAE,CAAA;IAC3H,OAAO;QACL,QAAQ,EAAE;YACR,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,OAAO,EAAE;YACP,OAAO,UAAU,CAAA;QACnB,CAAC;QACD,IAAI,MAAA;QACJ,UAAU,YAAA;QACV,aAAa,EAAE,UAAC,OAAqC;YACnD,OAAO,IAAA,YAAK,aACV,IAAI,MAAA,EACJ,UAAU,YAAA,IACP,OAAO,EACV,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC;AA1CD,wEA0CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getDuplicates: (collection: string[]) => string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDuplicates = void 0;
|
|
4
|
+
// This function is intentionally not generic, as we will likely need a comparator function in that case, which will make it more complex than necessary
|
|
5
|
+
// Revisit if there is such use-case in the future
|
|
6
|
+
var getDuplicates = function (collection) {
|
|
7
|
+
var uniqueElements = new Set();
|
|
8
|
+
var duplicates = new Set();
|
|
9
|
+
collection.forEach(function (item) {
|
|
10
|
+
if (uniqueElements.has(item)) {
|
|
11
|
+
duplicates.add(item);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
uniqueElements.add(item);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return Array.from(duplicates);
|
|
18
|
+
};
|
|
19
|
+
exports.getDuplicates = getDuplicates;
|
|
20
|
+
//# sourceMappingURL=get-duplicates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-duplicates.js","sourceRoot":"","sources":["../../src/common/get-duplicates.ts"],"names":[],"mappings":";;;AAAA,wJAAwJ;AACxJ,kDAAkD;AAC3C,IAAM,aAAa,GAAG,UAAC,UAAoB;IAChD,IAAM,cAAc,GAAG,IAAI,GAAG,EAAU,CAAA;IACxC,IAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAA;IAEpC,UAAU,CAAC,OAAO,CAAC,UAAC,IAAI;QACtB,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC5B,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;SACrB;aAAM;YACL,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;SACzB;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAC/B,CAAC,CAAA;AAbY,QAAA,aAAa,iBAazB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the difference between two sets. The difference is the elements that are in the original set but not in the compare set.
|
|
3
|
+
* @param orignalSet
|
|
4
|
+
* @param compareSet
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSetDifference<T>(orignalSet: Set<T>, compareSet: Set<T>): Set<T>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSetDifference = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Get the difference between two sets. The difference is the elements that are in the original set but not in the compare set.
|
|
6
|
+
* @param orignalSet
|
|
7
|
+
* @param compareSet
|
|
8
|
+
*/
|
|
9
|
+
function getSetDifference(orignalSet, compareSet) {
|
|
10
|
+
var difference = new Set();
|
|
11
|
+
orignalSet.forEach(function (element) {
|
|
12
|
+
if (!compareSet.has(element)) {
|
|
13
|
+
difference.add(element);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return difference;
|
|
17
|
+
}
|
|
18
|
+
exports.getSetDifference = getSetDifference;
|
|
19
|
+
//# sourceMappingURL=get-set-difference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-set-difference.js","sourceRoot":"","sources":["../../src/common/get-set-difference.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,SAAgB,gBAAgB,CAC9B,UAAkB,EAClB,UAAkB;IAElB,IAAM,UAAU,GAAG,IAAI,GAAG,EAAK,CAAA;IAE/B,UAAU,CAAC,OAAO,CAAC,UAAC,OAAO;QACzB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YAC5B,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;SACxB;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,UAAU,CAAA;AACnB,CAAC;AAbD,4CAaC"}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
export * from "./alter-columns-helper";
|
|
1
2
|
export * from "./array-difference";
|
|
2
3
|
export * from "./build-query";
|
|
3
4
|
export * from "./camel-to-snake-case";
|
|
4
5
|
export * from "./container";
|
|
6
|
+
export * from "./convert-item-response-to-update-request";
|
|
5
7
|
export * from "./create-container-like";
|
|
6
8
|
export * from "./create-psql-index-helper";
|
|
7
9
|
export * from "./deduplicate";
|
|
@@ -10,10 +12,13 @@ export * from "./errors";
|
|
|
10
12
|
export * from "./generate-entity-id";
|
|
11
13
|
export * from "./generate-linkable-keys-map";
|
|
12
14
|
export * from "./get-config-file";
|
|
15
|
+
export * from "./get-duplicates";
|
|
13
16
|
export * from "./get-iso-string-from-date";
|
|
14
17
|
export * from "./get-selects-and-relations-from-object-array";
|
|
18
|
+
export * from "./get-set-difference";
|
|
15
19
|
export * from "./group-by";
|
|
16
20
|
export * from "./handle-postgres-database-error";
|
|
21
|
+
export * from "./is-big-number";
|
|
17
22
|
export * from "./is-date";
|
|
18
23
|
export * from "./is-defined";
|
|
19
24
|
export * from "./is-email";
|
|
@@ -32,6 +37,7 @@ export * from "./promise-all";
|
|
|
32
37
|
export * from "./remote-query-object-from-string";
|
|
33
38
|
export * from "./remote-query-object-to-string";
|
|
34
39
|
export * from "./remove-nullisih";
|
|
40
|
+
export * from "./remove-undefined";
|
|
35
41
|
export * from "./selector-constraints-to-string";
|
|
36
42
|
export * from "./set-metadata";
|
|
37
43
|
export * from "./simple-hash";
|
|
@@ -42,5 +48,6 @@ export * from "./to-camel-case";
|
|
|
42
48
|
export * from "./to-kebab-case";
|
|
43
49
|
export * from "./to-pascal-case";
|
|
44
50
|
export * from "./transaction";
|
|
51
|
+
export * from "./trim-zeros";
|
|
45
52
|
export * from "./upper-case-first";
|
|
46
53
|
export * from "./wrap-handler";
|
package/dist/common/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./alter-columns-helper"), exports);
|
|
17
18
|
__exportStar(require("./array-difference"), exports);
|
|
18
19
|
__exportStar(require("./build-query"), exports);
|
|
19
20
|
__exportStar(require("./camel-to-snake-case"), exports);
|
|
20
21
|
__exportStar(require("./container"), exports);
|
|
22
|
+
__exportStar(require("./convert-item-response-to-update-request"), exports);
|
|
21
23
|
__exportStar(require("./create-container-like"), exports);
|
|
22
24
|
__exportStar(require("./create-psql-index-helper"), exports);
|
|
23
25
|
__exportStar(require("./deduplicate"), exports);
|
|
@@ -26,10 +28,13 @@ __exportStar(require("./errors"), exports);
|
|
|
26
28
|
__exportStar(require("./generate-entity-id"), exports);
|
|
27
29
|
__exportStar(require("./generate-linkable-keys-map"), exports);
|
|
28
30
|
__exportStar(require("./get-config-file"), exports);
|
|
31
|
+
__exportStar(require("./get-duplicates"), exports);
|
|
29
32
|
__exportStar(require("./get-iso-string-from-date"), exports);
|
|
30
33
|
__exportStar(require("./get-selects-and-relations-from-object-array"), exports);
|
|
34
|
+
__exportStar(require("./get-set-difference"), exports);
|
|
31
35
|
__exportStar(require("./group-by"), exports);
|
|
32
36
|
__exportStar(require("./handle-postgres-database-error"), exports);
|
|
37
|
+
__exportStar(require("./is-big-number"), exports);
|
|
33
38
|
__exportStar(require("./is-date"), exports);
|
|
34
39
|
__exportStar(require("./is-defined"), exports);
|
|
35
40
|
__exportStar(require("./is-email"), exports);
|
|
@@ -48,6 +53,7 @@ __exportStar(require("./promise-all"), exports);
|
|
|
48
53
|
__exportStar(require("./remote-query-object-from-string"), exports);
|
|
49
54
|
__exportStar(require("./remote-query-object-to-string"), exports);
|
|
50
55
|
__exportStar(require("./remove-nullisih"), exports);
|
|
56
|
+
__exportStar(require("./remove-undefined"), exports);
|
|
51
57
|
__exportStar(require("./selector-constraints-to-string"), exports);
|
|
52
58
|
__exportStar(require("./set-metadata"), exports);
|
|
53
59
|
__exportStar(require("./simple-hash"), exports);
|
|
@@ -58,6 +64,7 @@ __exportStar(require("./to-camel-case"), exports);
|
|
|
58
64
|
__exportStar(require("./to-kebab-case"), exports);
|
|
59
65
|
__exportStar(require("./to-pascal-case"), exports);
|
|
60
66
|
__exportStar(require("./transaction"), exports);
|
|
67
|
+
__exportStar(require("./trim-zeros"), exports);
|
|
61
68
|
__exportStar(require("./upper-case-first"), exports);
|
|
62
69
|
__exportStar(require("./wrap-handler"), exports);
|
|
63
70
|
//# 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,qDAAkC;AAClC,gDAA6B;AAC7B,wDAAqC;AACrC,8CAA2B;AAC3B,0DAAuC;AACvC,6DAA0C;AAC1C,gDAA6B;AAC7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ACjD,kEAA+C;AAC/C,oDAAiC;AACjC,qDAAkC;AAClC,mEAAgD;AAChD,iDAA8B;AAC9B,gDAA6B;AAC7B,2DAAwC;AACxC,qEAAkD;AAClD,uDAAoC;AACpC,kDAA+B;AAC/B,kDAA+B;AAC/B,mDAAgC;AAChC,gDAA6B;AAC7B,+CAA4B;AAC5B,qDAAkC;AAClC,iDAA8B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBigNumber = void 0;
|
|
4
|
+
var is_object_1 = require("./is-object");
|
|
5
|
+
function isBigNumber(obj) {
|
|
6
|
+
return (0, is_object_1.isObject)(obj) && "value" in obj;
|
|
7
|
+
}
|
|
8
|
+
exports.isBigNumber = isBigNumber;
|
|
9
|
+
//# sourceMappingURL=is-big-number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-big-number.js","sourceRoot":"","sources":["../../src/common/is-big-number.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAEtC,SAAgB,WAAW,CAAC,GAAQ;IAClC,OAAO,IAAA,oBAAQ,EAAC,GAAG,CAAC,IAAI,OAAO,IAAI,GAAG,CAAA;AACxC,CAAC;AAFD,kCAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const removeUndefined: <T extends Record<string, any>>(obj: T) => T;
|