@medusajs/utils 1.9.4 → 1.9.5-next-20230805153949
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/bundles.d.ts +4 -0
- package/dist/bundles.js +5 -1
- package/dist/bundles.js.map +1 -1
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/map-object-to.d.ts +22 -0
- package/dist/common/map-object-to.js +40 -0
- package/dist/common/map-object-to.js.map +1 -0
- package/dist/dal/index.d.ts +6 -0
- package/dist/dal/index.js +23 -0
- package/dist/dal/index.js.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-create-connection.d.ts +2 -0
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js +97 -0
- package/dist/dal/mikro-orm/mikro-orm-create-connection.js.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-repository.d.ts +60 -0
- package/dist/dal/mikro-orm/mikro-orm-repository.js +271 -0
- package/dist/dal/mikro-orm/mikro-orm-repository.js.map +1 -0
- package/dist/dal/mikro-orm/mikro-orm-soft-deletable-filter.d.ts +15 -0
- package/dist/dal/mikro-orm/mikro-orm-soft-deletable-filter.js +19 -0
- package/dist/dal/mikro-orm/mikro-orm-soft-deletable-filter.js.map +1 -0
- package/dist/dal/mikro-orm/utils.d.ts +5 -0
- package/dist/dal/mikro-orm/utils.js +176 -0
- package/dist/dal/mikro-orm/utils.js.map +1 -0
- package/dist/dal/repository.d.ts +36 -0
- package/dist/dal/repository.js +142 -0
- package/dist/dal/repository.js.map +1 -0
- package/dist/dal/utils.d.ts +20 -0
- package/dist/dal/utils.js +131 -0
- package/dist/dal/utils.js.map +1 -0
- package/dist/feature-flags/analytics.d.ts +2 -0
- package/dist/feature-flags/analytics.js +10 -0
- package/dist/feature-flags/analytics.js.map +1 -0
- package/dist/feature-flags/index.d.ts +7 -0
- package/dist/feature-flags/index.js +24 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/feature-flags/order-editing.d.ts +2 -0
- package/dist/feature-flags/order-editing.js +10 -0
- package/dist/feature-flags/order-editing.js.map +1 -0
- package/dist/feature-flags/product-categories.d.ts +2 -0
- package/dist/feature-flags/product-categories.js +10 -0
- package/dist/feature-flags/product-categories.js.map +1 -0
- package/dist/feature-flags/publishable-api-keys.d.ts +2 -0
- package/dist/feature-flags/publishable-api-keys.js +10 -0
- package/dist/feature-flags/publishable-api-keys.js.map +1 -0
- package/dist/feature-flags/sales-channels.d.ts +2 -0
- package/dist/feature-flags/sales-channels.js +10 -0
- package/dist/feature-flags/sales-channels.js.map +1 -0
- package/dist/feature-flags/tax-inclusive-pricing.d.ts +2 -0
- package/dist/feature-flags/tax-inclusive-pricing.js +10 -0
- package/dist/feature-flags/tax-inclusive-pricing.js.map +1 -0
- package/dist/feature-flags/utils/flag-router.d.ts +8 -0
- package/dist/feature-flags/utils/flag-router.js +44 -0
- package/dist/feature-flags/utils/flag-router.js.map +1 -0
- package/dist/feature-flags/utils/index.d.ts +1 -0
- package/dist/feature-flags/utils/index.js +18 -0
- package/dist/feature-flags/utils/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/modules-sdk/build-query.js +2 -1
- package/dist/modules-sdk/build-query.js.map +1 -1
- package/dist/product/index.d.ts +6 -0
- package/dist/product/index.js +11 -0
- package/dist/product/index.js.map +1 -0
- package/dist/shipping/index.d.ts +5 -0
- package/dist/shipping/index.js +10 -0
- package/dist/shipping/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/common/dal.d.ts +0 -1
- package/dist/common/dal.js +0 -5
- package/dist/common/dal.js.map +0 -1
package/dist/bundles.d.ts
CHANGED
|
@@ -2,3 +2,7 @@ export * as DecoratorUtils from "./decorators";
|
|
|
2
2
|
export * as EventBusUtils from "./event-bus";
|
|
3
3
|
export * as SearchUtils from "./search";
|
|
4
4
|
export * as ModulesSdkUtils from "./modules-sdk";
|
|
5
|
+
export * as DALUtils from "./dal";
|
|
6
|
+
export * as FeatureFlagUtils from "./feature-flags";
|
|
7
|
+
export * as ShippingProfileUtils from "./shipping";
|
|
8
|
+
export * as ProductUtils from "./product";
|
package/dist/bundles.js
CHANGED
|
@@ -23,9 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ModulesSdkUtils = exports.SearchUtils = exports.EventBusUtils = exports.DecoratorUtils = void 0;
|
|
26
|
+
exports.ProductUtils = exports.ShippingProfileUtils = exports.FeatureFlagUtils = exports.DALUtils = exports.ModulesSdkUtils = exports.SearchUtils = exports.EventBusUtils = exports.DecoratorUtils = void 0;
|
|
27
27
|
exports.DecoratorUtils = __importStar(require("./decorators"));
|
|
28
28
|
exports.EventBusUtils = __importStar(require("./event-bus"));
|
|
29
29
|
exports.SearchUtils = __importStar(require("./search"));
|
|
30
30
|
exports.ModulesSdkUtils = __importStar(require("./modules-sdk"));
|
|
31
|
+
exports.DALUtils = __importStar(require("./dal"));
|
|
32
|
+
exports.FeatureFlagUtils = __importStar(require("./feature-flags"));
|
|
33
|
+
exports.ShippingProfileUtils = __importStar(require("./shipping"));
|
|
34
|
+
exports.ProductUtils = __importStar(require("./product"));
|
|
31
35
|
//# 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,+DAA8C;AAC9C,6DAA4C;AAC5C,wDAAuC;AACvC,iEAAgD"}
|
|
1
|
+
{"version":3,"file":"bundles.js","sourceRoot":"","sources":["../src/bundles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAC9C,6DAA4C;AAC5C,wDAAuC;AACvC,iEAAgD;AAChD,kDAAiC;AACjC,oEAAmD;AACnD,mEAAkD;AAClD,0DAAyC"}
|
package/dist/common/index.d.ts
CHANGED
package/dist/common/index.js
CHANGED
|
@@ -38,5 +38,5 @@ __exportStar(require("./stringify-circular"), exports);
|
|
|
38
38
|
__exportStar(require("./to-kebab-case"), exports);
|
|
39
39
|
__exportStar(require("./to-pascal-case"), exports);
|
|
40
40
|
__exportStar(require("./wrap-handler"), exports);
|
|
41
|
-
__exportStar(require("./
|
|
41
|
+
__exportStar(require("./map-object-to"), exports);
|
|
42
42
|
//# 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,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;AAC9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,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;AAC9B,kDAA+B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare type RemapInputObject = Record<string, unknown[]>;
|
|
2
|
+
declare type RemapConfig = {
|
|
3
|
+
mapTo: string;
|
|
4
|
+
valueFrom: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type MapToConfig = {
|
|
7
|
+
[key: string]: RemapConfig[];
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Create a new object with the keys remapped and the values picked from the original object based
|
|
11
|
+
* on the map config
|
|
12
|
+
*
|
|
13
|
+
* @param object input object
|
|
14
|
+
* @param mapTo configuration to map the output object
|
|
15
|
+
* @param removeIfNotRemapped if true, the keys that are not remapped will be removed from the output object
|
|
16
|
+
* @param pick if provided, only the keys in the array will be picked from the output object
|
|
17
|
+
*/
|
|
18
|
+
export declare function mapObjectTo<TResult = any, T extends RemapInputObject = RemapInputObject>(object: T, mapTo: MapToConfig, { removeIfNotRemapped, pick, }?: {
|
|
19
|
+
removeIfNotRemapped?: boolean;
|
|
20
|
+
pick?: string[];
|
|
21
|
+
}): TResult;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapObjectTo = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Create a new object with the keys remapped and the values picked from the original object based
|
|
6
|
+
* on the map config
|
|
7
|
+
*
|
|
8
|
+
* @param object input object
|
|
9
|
+
* @param mapTo configuration to map the output object
|
|
10
|
+
* @param removeIfNotRemapped if true, the keys that are not remapped will be removed from the output object
|
|
11
|
+
* @param pick if provided, only the keys in the array will be picked from the output object
|
|
12
|
+
*/
|
|
13
|
+
function mapObjectTo(object, mapTo, _a) {
|
|
14
|
+
var _b = _a === void 0 ? {} : _a, removeIfNotRemapped = _b.removeIfNotRemapped, pick = _b.pick;
|
|
15
|
+
removeIfNotRemapped !== null && removeIfNotRemapped !== void 0 ? removeIfNotRemapped : (removeIfNotRemapped = false);
|
|
16
|
+
var newObject = {};
|
|
17
|
+
var _loop_1 = function (key) {
|
|
18
|
+
var remapConfig = mapTo[key];
|
|
19
|
+
if (!remapConfig) {
|
|
20
|
+
if (!removeIfNotRemapped) {
|
|
21
|
+
newObject[key] = object[key];
|
|
22
|
+
}
|
|
23
|
+
return "continue";
|
|
24
|
+
}
|
|
25
|
+
remapConfig.forEach(function (config) {
|
|
26
|
+
if ((pick === null || pick === void 0 ? void 0 : pick.length) && !pick.includes(config.mapTo)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
newObject[config.mapTo] = object[key]
|
|
30
|
+
.map(function (obj) { return obj[config.valueFrom]; })
|
|
31
|
+
.filter(Boolean);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
for (var key in object) {
|
|
35
|
+
_loop_1(key);
|
|
36
|
+
}
|
|
37
|
+
return newObject;
|
|
38
|
+
}
|
|
39
|
+
exports.mapObjectTo = mapObjectTo;
|
|
40
|
+
//# sourceMappingURL=map-object-to.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-object-to.js","sourceRoot":"","sources":["../../src/common/map-object-to.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAIzB,MAAS,EACT,KAAkB,EAClB,EAG0D;QAH1D,qBAGwD,EAAE,KAAA,EAFxD,mBAAmB,yBAAA,EACnB,IAAI,UAAA;IAGN,mBAAmB,aAAnB,mBAAmB,cAAnB,mBAAmB,IAAnB,mBAAmB,GAAK,KAAK,EAAA;IAE7B,IAAM,SAAS,GAAwB,EAAE,CAAA;4BAE9B,GAAG;QACZ,IAAM,WAAW,GAAG,KAAK,CAAC,GAAa,CAAE,CAAA;QAEzC,IAAI,CAAC,WAAW,EAAE;YAChB,IAAI,CAAC,mBAAmB,EAAE;gBACxB,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;aAC7B;;SAEF;QAED,WAAW,CAAC,OAAO,CAAC,UAAC,MAAM;YACzB,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,KAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;gBAChD,OAAM;aACP;YAED,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;iBAClC,GAAG,CAAC,UAAC,GAAQ,IAAK,OAAA,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAArB,CAAqB,CAAC;iBACxC,MAAM,CAAC,OAAO,CAAC,CAAA;QACpB,CAAC,CAAC,CAAA;;IAlBJ,KAAK,IAAM,GAAG,IAAI,MAAM;gBAAb,GAAG;KAmBb;IAED,OAAO,SAAoB,CAAA;AAC7B,CAAC;AArCD,kCAqCC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./mikro-orm/mikro-orm-repository"), exports);
|
|
18
|
+
__exportStar(require("./repository"), exports);
|
|
19
|
+
__exportStar(require("./utils"), exports);
|
|
20
|
+
__exportStar(require("./mikro-orm/utils"), exports);
|
|
21
|
+
__exportStar(require("./mikro-orm/mikro-orm-create-connection"), exports);
|
|
22
|
+
__exportStar(require("./mikro-orm/mikro-orm-soft-deletable-filter"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dal/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAgD;AAChD,+CAA4B;AAC5B,0CAAuB;AACvB,oDAAiC;AACjC,0EAAuD;AACvD,8EAA2D"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { ModuleServiceInitializeOptions } from "@medusajs/types";
|
|
2
|
+
export declare function mikroOrmCreateConnection(database: ModuleServiceInitializeOptions["database"], entities: any[]): Promise<import("@mikro-orm/core").MikroORM<import("@mikro-orm/postgresql").PostgreSqlDriver>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.mikroOrmCreateConnection = void 0;
|
|
63
|
+
function mikroOrmCreateConnection(database, entities) {
|
|
64
|
+
var _a, _b, _c, _d;
|
|
65
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
+
var MikroORM, schema, orm;
|
|
67
|
+
return __generator(this, function (_e) {
|
|
68
|
+
switch (_e.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("@mikro-orm/postgresql")); })];
|
|
70
|
+
case 1:
|
|
71
|
+
MikroORM = (_e.sent()).MikroORM;
|
|
72
|
+
schema = database.schema || "public";
|
|
73
|
+
return [4 /*yield*/, MikroORM.init({
|
|
74
|
+
discovery: { disableDynamicFileAccess: true },
|
|
75
|
+
entities: entities,
|
|
76
|
+
debug: (_c = (_a = database.debug) !== null && _a !== void 0 ? _a : (_b = process.env.NODE_ENV) === null || _b === void 0 ? void 0 : _b.startsWith("dev")) !== null && _c !== void 0 ? _c : false,
|
|
77
|
+
baseDir: process.cwd(),
|
|
78
|
+
clientUrl: database.clientUrl,
|
|
79
|
+
schema: schema,
|
|
80
|
+
driverOptions: (_d = database.driverOptions) !== null && _d !== void 0 ? _d : {
|
|
81
|
+
connection: { ssl: true },
|
|
82
|
+
},
|
|
83
|
+
tsNode: process.env.APP_ENV === "development",
|
|
84
|
+
type: "postgresql",
|
|
85
|
+
migrations: {
|
|
86
|
+
path: __dirname + "/../migrations",
|
|
87
|
+
},
|
|
88
|
+
})];
|
|
89
|
+
case 2:
|
|
90
|
+
orm = _e.sent();
|
|
91
|
+
return [2 /*return*/, orm];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.mikroOrmCreateConnection = mikroOrmCreateConnection;
|
|
97
|
+
//# sourceMappingURL=mikro-orm-create-connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm-create-connection.js","sourceRoot":"","sources":["../../../src/dal/mikro-orm/mikro-orm-create-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAsB,wBAAwB,CAC5C,QAAoD,EACpD,QAAe;;;;;;wBAEM,sFAAa,uBAAuB,QAAC;;oBAAlD,QAAQ,GAAK,CAAA,SAAqC,CAAA,SAA1C;oBAEV,MAAM,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAA;oBAC9B,qBAAM,QAAQ,CAAC,IAAI,CAAC;4BAC9B,SAAS,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE;4BAC7C,QAAQ,UAAA;4BACR,KAAK,EAAE,MAAA,MAAA,QAAQ,CAAC,KAAK,mCAAI,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,0CAAE,UAAU,CAAC,KAAK,CAAC,mCAAI,KAAK;4BACzE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;4BACtB,SAAS,EAAE,QAAQ,CAAC,SAAS;4BAC7B,MAAM,QAAA;4BACN,aAAa,EAAE,MAAA,QAAQ,CAAC,aAAa,mCAAI;gCACvC,UAAU,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;6BAC1B;4BACD,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,aAAa;4BAC7C,IAAI,EAAE,YAAY;4BAClB,UAAU,EAAE;gCACV,IAAI,EAAE,SAAS,GAAG,gBAAgB;6BACnC;yBACF,CAAC,EAAA;;oBAfI,GAAG,GAAG,SAeV;oBAEF,sBAAO,GAAG,EAAA;;;;CACX;AAzBD,4DAyBC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Context, DAL, RepositoryTransformOptions } from "@medusajs/types";
|
|
2
|
+
declare class MikroOrmBase<T = any> {
|
|
3
|
+
protected readonly manager_: any;
|
|
4
|
+
protected constructor({ manager }: {
|
|
5
|
+
manager: any;
|
|
6
|
+
});
|
|
7
|
+
getFreshManager<TManager = unknown>(): TManager;
|
|
8
|
+
getActiveManager<TManager = unknown>({ transactionManager, manager }?: Context): TManager;
|
|
9
|
+
transaction<TManager = unknown>(task: (transactionManager: TManager) => Promise<any>, options?: {
|
|
10
|
+
isolationLevel?: string;
|
|
11
|
+
enableNestedTransactions?: boolean;
|
|
12
|
+
transaction?: TManager;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
serialize<TOutput extends object | object[]>(data: any, options?: any): Promise<TOutput>;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class MikroOrmAbstractBaseRepository<T = any> extends MikroOrmBase implements DAL.RepositoryService<T> {
|
|
17
|
+
abstract find(options?: DAL.FindOptions<T>, context?: Context): any;
|
|
18
|
+
abstract findAndCount(options?: DAL.FindOptions<T>, context?: Context): Promise<[T[], number]>;
|
|
19
|
+
abstract create(data: unknown[], context?: Context): Promise<T[]>;
|
|
20
|
+
update(data: unknown[], context?: Context): Promise<T[]>;
|
|
21
|
+
abstract delete(ids: string[], context?: Context): Promise<void>;
|
|
22
|
+
softDelete(ids: string[], { transactionManager: manager }?: Context): Promise<[T[], Record<string, unknown[]>]>;
|
|
23
|
+
restore(ids: string[], { transactionManager: manager }?: Context): Promise<T[]>;
|
|
24
|
+
}
|
|
25
|
+
export declare abstract class MikroOrmAbstractTreeRepositoryBase<T = any> extends MikroOrmBase<T> implements DAL.TreeRepositoryService<T> {
|
|
26
|
+
protected constructor({ manager }: {
|
|
27
|
+
manager: any;
|
|
28
|
+
});
|
|
29
|
+
abstract find(options?: DAL.FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): any;
|
|
30
|
+
abstract findAndCount(options?: DAL.FindOptions<T>, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<[T[], number]>;
|
|
31
|
+
abstract create(data: unknown, context?: Context): Promise<T>;
|
|
32
|
+
abstract delete(id: string, context?: Context): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Priviliged extends of the abstract classes unless most of the methods can't be implemented
|
|
36
|
+
* in your repository. This base repository is also used to provide a base repository
|
|
37
|
+
* injection if needed to be able to use the common methods without being related to an entity.
|
|
38
|
+
* In this case, none of the method will be implemented except the manager and transaction
|
|
39
|
+
* related ones.
|
|
40
|
+
*/
|
|
41
|
+
export declare class MikroOrmBaseRepository extends MikroOrmAbstractBaseRepository {
|
|
42
|
+
constructor({ manager }: {
|
|
43
|
+
manager: any;
|
|
44
|
+
});
|
|
45
|
+
create(data: unknown[], context?: Context): Promise<any[]>;
|
|
46
|
+
update(data: unknown[], context?: Context): Promise<any[]>;
|
|
47
|
+
delete(ids: string[], context?: Context): Promise<void>;
|
|
48
|
+
find(options?: DAL.FindOptions, context?: Context): Promise<any[]>;
|
|
49
|
+
findAndCount(options?: DAL.FindOptions, context?: Context): Promise<[any[], number]>;
|
|
50
|
+
}
|
|
51
|
+
export declare class MikroOrmBaseTreeRepository extends MikroOrmAbstractTreeRepositoryBase {
|
|
52
|
+
constructor({ manager }: {
|
|
53
|
+
manager: any;
|
|
54
|
+
});
|
|
55
|
+
find(options?: DAL.FindOptions, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<any[]>;
|
|
56
|
+
findAndCount(options?: DAL.FindOptions, transformOptions?: RepositoryTransformOptions, context?: Context): Promise<[any[], number]>;
|
|
57
|
+
create(data: unknown, context?: Context): Promise<any>;
|
|
58
|
+
delete(id: string, context?: Context): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
30
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
31
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
32
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
33
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
34
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
35
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
39
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
40
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
41
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
42
|
+
function step(op) {
|
|
43
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
44
|
+
while (_) try {
|
|
45
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
46
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
47
|
+
switch (op[0]) {
|
|
48
|
+
case 0: case 1: t = op; break;
|
|
49
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
50
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
51
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
52
|
+
default:
|
|
53
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
54
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
55
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
56
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
57
|
+
if (t[2]) _.ops.pop();
|
|
58
|
+
_.trys.pop(); continue;
|
|
59
|
+
}
|
|
60
|
+
op = body.call(thisArg, _);
|
|
61
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
62
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
66
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
67
|
+
if (!m) return o;
|
|
68
|
+
var i = m.call(o), r, ar = [], e;
|
|
69
|
+
try {
|
|
70
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
71
|
+
}
|
|
72
|
+
catch (error) { e = { error: error }; }
|
|
73
|
+
finally {
|
|
74
|
+
try {
|
|
75
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
76
|
+
}
|
|
77
|
+
finally { if (e) throw e.error; }
|
|
78
|
+
}
|
|
79
|
+
return ar;
|
|
80
|
+
};
|
|
81
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
82
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
83
|
+
if (ar || !(i in from)) {
|
|
84
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
85
|
+
ar[i] = from[i];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
89
|
+
};
|
|
90
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
91
|
+
exports.MikroOrmBaseTreeRepository = exports.MikroOrmBaseRepository = exports.MikroOrmAbstractTreeRepositoryBase = exports.MikroOrmAbstractBaseRepository = void 0;
|
|
92
|
+
var decorators_1 = require("../../decorators");
|
|
93
|
+
var modules_sdk_1 = require("../../modules-sdk");
|
|
94
|
+
var utils_1 = require("../utils");
|
|
95
|
+
var utils_2 = require("./utils");
|
|
96
|
+
var MikroOrmBase = /** @class */ (function () {
|
|
97
|
+
function MikroOrmBase(_a) {
|
|
98
|
+
var manager = _a.manager;
|
|
99
|
+
this.manager_ = manager;
|
|
100
|
+
}
|
|
101
|
+
MikroOrmBase.prototype.getFreshManager = function () {
|
|
102
|
+
return (this.manager_.fork
|
|
103
|
+
? this.manager_.fork()
|
|
104
|
+
: this.manager_);
|
|
105
|
+
};
|
|
106
|
+
MikroOrmBase.prototype.getActiveManager = function (_a) {
|
|
107
|
+
var _b;
|
|
108
|
+
var _c = _a === void 0 ? {} : _a, transactionManager = _c.transactionManager, manager = _c.manager;
|
|
109
|
+
return ((_b = transactionManager !== null && transactionManager !== void 0 ? transactionManager : manager) !== null && _b !== void 0 ? _b : this.manager_);
|
|
110
|
+
};
|
|
111
|
+
MikroOrmBase.prototype.transaction = function (task, options) {
|
|
112
|
+
if (options === void 0) { options = {}; }
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0: return [4 /*yield*/, utils_1.transactionWrapper.bind(this)(task, options)];
|
|
117
|
+
case 1:
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
return [2 /*return*/, _a.sent()];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
MikroOrmBase.prototype.serialize = function (data, options) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0: return [4 /*yield*/, (0, utils_2.mikroOrmSerializer)(data, options)];
|
|
129
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
var _a;
|
|
135
|
+
__decorate([
|
|
136
|
+
__param(0, (0, decorators_1.MedusaContext)()),
|
|
137
|
+
__metadata("design:type", Function),
|
|
138
|
+
__metadata("design:paramtypes", [Object]),
|
|
139
|
+
__metadata("design:returntype", typeof (_a = typeof TManager !== "undefined" && TManager) === "function" ? _a : Object)
|
|
140
|
+
], MikroOrmBase.prototype, "getActiveManager", null);
|
|
141
|
+
return MikroOrmBase;
|
|
142
|
+
}());
|
|
143
|
+
var MikroOrmAbstractBaseRepository = /** @class */ (function (_super) {
|
|
144
|
+
__extends(MikroOrmAbstractBaseRepository, _super);
|
|
145
|
+
function MikroOrmAbstractBaseRepository() {
|
|
146
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
147
|
+
}
|
|
148
|
+
MikroOrmAbstractBaseRepository.prototype.update = function (data, context) {
|
|
149
|
+
throw new Error("Method not implemented.");
|
|
150
|
+
};
|
|
151
|
+
MikroOrmAbstractBaseRepository.prototype.softDelete = function (ids, _a) {
|
|
152
|
+
var _b = _a === void 0 ? {} : _a, manager = _b.transactionManager;
|
|
153
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
+
var entities, date, softDeletedEntitiesMap;
|
|
155
|
+
return __generator(this, function (_c) {
|
|
156
|
+
switch (_c.label) {
|
|
157
|
+
case 0: return [4 /*yield*/, this.find({ where: { id: { $in: ids } } })];
|
|
158
|
+
case 1:
|
|
159
|
+
entities = _c.sent();
|
|
160
|
+
date = new Date();
|
|
161
|
+
return [4 /*yield*/, (0, utils_2.mikroOrmUpdateDeletedAtRecursively)(manager, entities, date)];
|
|
162
|
+
case 2:
|
|
163
|
+
_c.sent();
|
|
164
|
+
softDeletedEntitiesMap = (0, utils_1.getSoftDeletedCascadedEntitiesIdsMappedBy)({
|
|
165
|
+
entities: entities,
|
|
166
|
+
});
|
|
167
|
+
return [2 /*return*/, [entities, softDeletedEntitiesMap]];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
MikroOrmAbstractBaseRepository.prototype.restore = function (ids, _a) {
|
|
173
|
+
var _b = _a === void 0 ? {} : _a, manager = _b.transactionManager;
|
|
174
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
175
|
+
var query, entities;
|
|
176
|
+
return __generator(this, function (_c) {
|
|
177
|
+
switch (_c.label) {
|
|
178
|
+
case 0:
|
|
179
|
+
query = (0, modules_sdk_1.buildQuery)({ id: { $in: ids } }, {
|
|
180
|
+
withDeleted: true,
|
|
181
|
+
});
|
|
182
|
+
return [4 /*yield*/, this.find(query)];
|
|
183
|
+
case 1:
|
|
184
|
+
entities = _c.sent();
|
|
185
|
+
return [4 /*yield*/, (0, utils_2.mikroOrmUpdateDeletedAtRecursively)(manager, entities, null)];
|
|
186
|
+
case 2:
|
|
187
|
+
_c.sent();
|
|
188
|
+
return [2 /*return*/, entities];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
__decorate([
|
|
194
|
+
(0, modules_sdk_1.InjectTransactionManager)(),
|
|
195
|
+
__param(1, (0, decorators_1.MedusaContext)()),
|
|
196
|
+
__metadata("design:type", Function),
|
|
197
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
198
|
+
__metadata("design:returntype", Promise)
|
|
199
|
+
], MikroOrmAbstractBaseRepository.prototype, "softDelete", null);
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, modules_sdk_1.InjectTransactionManager)(),
|
|
202
|
+
__param(1, (0, decorators_1.MedusaContext)()),
|
|
203
|
+
__metadata("design:type", Function),
|
|
204
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
205
|
+
__metadata("design:returntype", Promise)
|
|
206
|
+
], MikroOrmAbstractBaseRepository.prototype, "restore", null);
|
|
207
|
+
return MikroOrmAbstractBaseRepository;
|
|
208
|
+
}(MikroOrmBase));
|
|
209
|
+
exports.MikroOrmAbstractBaseRepository = MikroOrmAbstractBaseRepository;
|
|
210
|
+
var MikroOrmAbstractTreeRepositoryBase = /** @class */ (function (_super) {
|
|
211
|
+
__extends(MikroOrmAbstractTreeRepositoryBase, _super);
|
|
212
|
+
function MikroOrmAbstractTreeRepositoryBase(_a) {
|
|
213
|
+
var manager = _a.manager;
|
|
214
|
+
return _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
215
|
+
}
|
|
216
|
+
return MikroOrmAbstractTreeRepositoryBase;
|
|
217
|
+
}(MikroOrmBase));
|
|
218
|
+
exports.MikroOrmAbstractTreeRepositoryBase = MikroOrmAbstractTreeRepositoryBase;
|
|
219
|
+
/**
|
|
220
|
+
* Priviliged extends of the abstract classes unless most of the methods can't be implemented
|
|
221
|
+
* in your repository. This base repository is also used to provide a base repository
|
|
222
|
+
* injection if needed to be able to use the common methods without being related to an entity.
|
|
223
|
+
* In this case, none of the method will be implemented except the manager and transaction
|
|
224
|
+
* related ones.
|
|
225
|
+
*/
|
|
226
|
+
var MikroOrmBaseRepository = /** @class */ (function (_super) {
|
|
227
|
+
__extends(MikroOrmBaseRepository, _super);
|
|
228
|
+
function MikroOrmBaseRepository(_a) {
|
|
229
|
+
var manager = _a.manager;
|
|
230
|
+
return _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
231
|
+
}
|
|
232
|
+
MikroOrmBaseRepository.prototype.create = function (data, context) {
|
|
233
|
+
throw new Error("Method not implemented.");
|
|
234
|
+
};
|
|
235
|
+
MikroOrmBaseRepository.prototype.update = function (data, context) {
|
|
236
|
+
throw new Error("Method not implemented.");
|
|
237
|
+
};
|
|
238
|
+
MikroOrmBaseRepository.prototype.delete = function (ids, context) {
|
|
239
|
+
throw new Error("Method not implemented.");
|
|
240
|
+
};
|
|
241
|
+
MikroOrmBaseRepository.prototype.find = function (options, context) {
|
|
242
|
+
throw new Error("Method not implemented.");
|
|
243
|
+
};
|
|
244
|
+
MikroOrmBaseRepository.prototype.findAndCount = function (options, context) {
|
|
245
|
+
throw new Error("Method not implemented.");
|
|
246
|
+
};
|
|
247
|
+
return MikroOrmBaseRepository;
|
|
248
|
+
}(MikroOrmAbstractBaseRepository));
|
|
249
|
+
exports.MikroOrmBaseRepository = MikroOrmBaseRepository;
|
|
250
|
+
var MikroOrmBaseTreeRepository = /** @class */ (function (_super) {
|
|
251
|
+
__extends(MikroOrmBaseTreeRepository, _super);
|
|
252
|
+
function MikroOrmBaseTreeRepository(_a) {
|
|
253
|
+
var manager = _a.manager;
|
|
254
|
+
return _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
255
|
+
}
|
|
256
|
+
MikroOrmBaseTreeRepository.prototype.find = function (options, transformOptions, context) {
|
|
257
|
+
throw new Error("Method not implemented.");
|
|
258
|
+
};
|
|
259
|
+
MikroOrmBaseTreeRepository.prototype.findAndCount = function (options, transformOptions, context) {
|
|
260
|
+
throw new Error("Method not implemented.");
|
|
261
|
+
};
|
|
262
|
+
MikroOrmBaseTreeRepository.prototype.create = function (data, context) {
|
|
263
|
+
throw new Error("Method not implemented.");
|
|
264
|
+
};
|
|
265
|
+
MikroOrmBaseTreeRepository.prototype.delete = function (id, context) {
|
|
266
|
+
throw new Error("Method not implemented.");
|
|
267
|
+
};
|
|
268
|
+
return MikroOrmBaseTreeRepository;
|
|
269
|
+
}(MikroOrmAbstractTreeRepositoryBase));
|
|
270
|
+
exports.MikroOrmBaseTreeRepository = MikroOrmBaseTreeRepository;
|
|
271
|
+
//# sourceMappingURL=mikro-orm-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm-repository.js","sourceRoot":"","sources":["../../../src/dal/mikro-orm/mikro-orm-repository.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const SoftDeletableFilterKey = "softDeletable";
|
|
2
|
+
interface FilterArguments {
|
|
3
|
+
withDeleted?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const mikroOrmSoftDeletableFilterOptions: {
|
|
6
|
+
name: string;
|
|
7
|
+
cond: ({ withDeleted }?: FilterArguments) => {
|
|
8
|
+
deleted_at?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
deleted_at: null;
|
|
11
|
+
};
|
|
12
|
+
default: boolean;
|
|
13
|
+
args: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mikroOrmSoftDeletableFilterOptions = exports.SoftDeletableFilterKey = void 0;
|
|
4
|
+
exports.SoftDeletableFilterKey = "softDeletable";
|
|
5
|
+
exports.mikroOrmSoftDeletableFilterOptions = {
|
|
6
|
+
name: exports.SoftDeletableFilterKey,
|
|
7
|
+
cond: function (_a) {
|
|
8
|
+
var _b = _a === void 0 ? {} : _a, withDeleted = _b.withDeleted;
|
|
9
|
+
if (withDeleted) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
deleted_at: null,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
default: true,
|
|
17
|
+
args: false,
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=mikro-orm-soft-deletable-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm-soft-deletable-filter.js","sourceRoot":"","sources":["../../../src/dal/mikro-orm/mikro-orm-soft-deletable-filter.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,eAAe,CAAA;AAMxC,QAAA,kCAAkC,GAAG;IAChD,IAAI,EAAE,8BAAsB;IAC5B,IAAI,EAAE,UAAC,EAAqC;YAArC,qBAAmC,EAAE,KAAA,EAAnC,WAAW,iBAAA;QAClB,IAAI,WAAW,EAAE;YACf,OAAO,EAAE,CAAA;SACV;QACD,OAAO;YACL,UAAU,EAAE,IAAI;SACjB,CAAA;IACH,CAAC;IACD,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,KAAK;CACZ,CAAA"}
|