medusa-test-utils 1.1.45-snapshot-20240607093839 → 1.1.45-snapshot-20240703074611
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/database.js +56 -142
- package/dist/database.js.map +1 -1
- package/dist/events.js +7 -54
- package/dist/events.js.map +1 -1
- package/dist/id-map.js +8 -13
- package/dist/id-map.js.map +1 -1
- package/dist/init-modules.js +37 -98
- package/dist/init-modules.js.map +1 -1
- package/dist/jest.js +14 -62
- package/dist/jest.js.map +1 -1
- package/dist/medusa-test-runner-utils/bootstrap-app.js +48 -141
- package/dist/medusa-test-runner-utils/bootstrap-app.js.map +1 -1
- package/dist/medusa-test-runner-utils/use-db.js +26 -99
- package/dist/medusa-test-runner-utils/use-db.js.map +1 -1
- package/dist/medusa-test-runner.d.ts +7 -0
- package/dist/medusa-test-runner.js +130 -290
- package/dist/medusa-test-runner.js.map +1 -1
- package/dist/mock-event-bus-service.d.ts +4 -4
- package/dist/mock-event-bus-service.js +13 -53
- package/dist/mock-event-bus-service.js.map +1 -1
- package/dist/module-test-runner.js +57 -128
- package/dist/module-test-runner.js.map +1 -1
- package/package.json +6 -6
package/dist/database.js
CHANGED
@@ -1,60 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
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;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
3
|
exports.getMikroOrmWrapper = exports.getMikroOrmConfig = exports.getDatabaseURL = void 0;
|
40
|
-
|
4
|
+
const postgresql_1 = require("@mikro-orm/postgresql");
|
41
5
|
function getDatabaseURL(dbName) {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
return "postgres://".concat(DB_USERNAME).concat(DB_PASSWORD ? ":".concat(DB_PASSWORD) : "", "@").concat(DB_HOST, "/").concat(DB_NAME);
|
6
|
+
const DB_HOST = process.env.DB_HOST ?? "localhost";
|
7
|
+
const DB_USERNAME = process.env.DB_USERNAME ?? "";
|
8
|
+
const DB_PASSWORD = process.env.DB_PASSWORD;
|
9
|
+
const DB_NAME = dbName ?? process.env.DB_TEMP_NAME;
|
10
|
+
return `postgres://${DB_USERNAME}${DB_PASSWORD ? `:${DB_PASSWORD}` : ""}@${DB_HOST}/${DB_NAME}`;
|
48
11
|
}
|
49
12
|
exports.getDatabaseURL = getDatabaseURL;
|
50
|
-
function getMikroOrmConfig(
|
51
|
-
|
52
|
-
var DB_URL = clientUrl !== null && clientUrl !== void 0 ? clientUrl : getDatabaseURL();
|
13
|
+
function getMikroOrmConfig({ mikroOrmEntities, pathToMigrations, clientUrl, schema, }) {
|
14
|
+
const DB_URL = clientUrl ?? getDatabaseURL();
|
53
15
|
return {
|
54
16
|
type: "postgresql",
|
55
17
|
clientUrl: DB_URL,
|
56
18
|
entities: Object.values(mikroOrmEntities),
|
57
|
-
schema: schema
|
19
|
+
schema: schema ?? process.env.MEDUSA_DB_SCHEMA,
|
58
20
|
debug: false,
|
59
21
|
migrations: {
|
60
22
|
pathTs: pathToMigrations,
|
@@ -63,121 +25,73 @@ function getMikroOrmConfig(_a) {
|
|
63
25
|
};
|
64
26
|
}
|
65
27
|
exports.getMikroOrmConfig = getMikroOrmConfig;
|
66
|
-
function getMikroOrmWrapper(
|
67
|
-
var mikroOrmEntities = _a.mikroOrmEntities, pathToMigrations = _a.pathToMigrations, clientUrl = _a.clientUrl, schema = _a.schema;
|
28
|
+
function getMikroOrmWrapper({ mikroOrmEntities, pathToMigrations, clientUrl, schema, }) {
|
68
29
|
return {
|
69
|
-
mikroOrmEntities
|
70
|
-
pathToMigrations
|
71
|
-
clientUrl: clientUrl
|
72
|
-
schema: schema
|
30
|
+
mikroOrmEntities,
|
31
|
+
pathToMigrations,
|
32
|
+
clientUrl: clientUrl ?? getDatabaseURL(),
|
33
|
+
schema: schema ?? process.env.MEDUSA_DB_SCHEMA,
|
73
34
|
orm: null,
|
74
35
|
manager: null,
|
75
|
-
getManager
|
36
|
+
getManager() {
|
76
37
|
if (this.manager === null) {
|
77
38
|
throw new Error("manager entity not available");
|
78
39
|
}
|
79
40
|
return this.manager;
|
80
41
|
},
|
81
|
-
forkManager
|
42
|
+
forkManager() {
|
82
43
|
if (this.manager === null) {
|
83
44
|
throw new Error("manager entity not available");
|
84
45
|
}
|
85
46
|
return this.manager.fork();
|
86
47
|
},
|
87
|
-
getOrm
|
48
|
+
getOrm() {
|
88
49
|
if (this.orm === null) {
|
89
50
|
throw new Error("orm entity not available");
|
90
51
|
}
|
91
52
|
return this.orm;
|
92
53
|
},
|
93
|
-
setupDatabase
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
case 0:
|
100
|
-
OrmConfig = getMikroOrmConfig({
|
101
|
-
mikroOrmEntities: this.mikroOrmEntities,
|
102
|
-
pathToMigrations: this.pathToMigrations,
|
103
|
-
clientUrl: this.clientUrl,
|
104
|
-
schema: this.schema,
|
105
|
-
});
|
106
|
-
// Initializing the ORM
|
107
|
-
_a = this;
|
108
|
-
return [4 /*yield*/, postgresql_1.MikroORM.init(OrmConfig)];
|
109
|
-
case 1:
|
110
|
-
// Initializing the ORM
|
111
|
-
_a.orm = _d.sent();
|
112
|
-
this.manager = this.orm.em;
|
113
|
-
_d.label = 2;
|
114
|
-
case 2:
|
115
|
-
_d.trys.push([2, 4, , 5]);
|
116
|
-
return [4 /*yield*/, this.orm.getSchemaGenerator().ensureDatabase()];
|
117
|
-
case 3:
|
118
|
-
_d.sent();
|
119
|
-
return [3 /*break*/, 5];
|
120
|
-
case 4:
|
121
|
-
err_1 = _d.sent();
|
122
|
-
console.log(err_1);
|
123
|
-
return [3 /*break*/, 5];
|
124
|
-
case 5: return [4 /*yield*/, ((_b = this.manager) === null || _b === void 0 ? void 0 : _b.execute("CREATE SCHEMA IF NOT EXISTS \"".concat((_c = this.schema) !== null && _c !== void 0 ? _c : "public", "\";")))];
|
125
|
-
case 6:
|
126
|
-
_d.sent();
|
127
|
-
return [4 /*yield*/, this.orm
|
128
|
-
.getMigrator()
|
129
|
-
.getPendingMigrations()];
|
130
|
-
case 7:
|
131
|
-
pendingMigrations = _d.sent();
|
132
|
-
if (!(pendingMigrations && pendingMigrations.length > 0)) return [3 /*break*/, 9];
|
133
|
-
return [4 /*yield*/, this.orm
|
134
|
-
.getMigrator()
|
135
|
-
.up({ migrations: pendingMigrations.map(function (m) { return m.name; }) })];
|
136
|
-
case 8:
|
137
|
-
_d.sent();
|
138
|
-
return [3 /*break*/, 11];
|
139
|
-
case 9: return [4 /*yield*/, this.orm.schema.refreshDatabase()]; // ensure db exists and is fresh
|
140
|
-
case 10:
|
141
|
-
_d.sent(); // ensure db exists and is fresh
|
142
|
-
_d.label = 11;
|
143
|
-
case 11: return [2 /*return*/];
|
144
|
-
}
|
145
|
-
});
|
54
|
+
async setupDatabase() {
|
55
|
+
const OrmConfig = getMikroOrmConfig({
|
56
|
+
mikroOrmEntities: this.mikroOrmEntities,
|
57
|
+
pathToMigrations: this.pathToMigrations,
|
58
|
+
clientUrl: this.clientUrl,
|
59
|
+
schema: this.schema,
|
146
60
|
});
|
61
|
+
// Initializing the ORM
|
62
|
+
this.orm = await postgresql_1.MikroORM.init(OrmConfig);
|
63
|
+
this.manager = this.orm.em;
|
64
|
+
try {
|
65
|
+
await this.orm.getSchemaGenerator().ensureDatabase();
|
66
|
+
}
|
67
|
+
catch (err) {
|
68
|
+
console.log(err);
|
69
|
+
}
|
70
|
+
await this.manager?.execute(`CREATE SCHEMA IF NOT EXISTS "${this.schema ?? "public"}";`);
|
71
|
+
const pendingMigrations = await this.orm
|
72
|
+
.getMigrator()
|
73
|
+
.getPendingMigrations();
|
74
|
+
if (pendingMigrations && pendingMigrations.length > 0) {
|
75
|
+
await this.orm
|
76
|
+
.getMigrator()
|
77
|
+
.up({ migrations: pendingMigrations.map((m) => m.name) });
|
78
|
+
}
|
79
|
+
else {
|
80
|
+
await this.orm.schema.refreshDatabase(); // ensure db exists and is fresh
|
81
|
+
}
|
147
82
|
},
|
148
|
-
clearDatabase
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
_f.sent();
|
161
|
-
return [4 /*yield*/, ((_d = this.manager) === null || _d === void 0 ? void 0 : _d.execute("CREATE SCHEMA IF NOT EXISTS \"".concat((_e = this.schema) !== null && _e !== void 0 ? _e : "public", "\";")))];
|
162
|
-
case 2:
|
163
|
-
_f.sent();
|
164
|
-
_f.label = 3;
|
165
|
-
case 3:
|
166
|
-
_f.trys.push([3, 5, , 6]);
|
167
|
-
return [4 /*yield*/, this.orm.close()];
|
168
|
-
case 4:
|
169
|
-
_f.sent();
|
170
|
-
return [3 /*break*/, 6];
|
171
|
-
case 5:
|
172
|
-
_a = _f.sent();
|
173
|
-
return [3 /*break*/, 6];
|
174
|
-
case 6:
|
175
|
-
this.orm = null;
|
176
|
-
this.manager = null;
|
177
|
-
return [2 /*return*/];
|
178
|
-
}
|
179
|
-
});
|
180
|
-
});
|
83
|
+
async clearDatabase() {
|
84
|
+
if (this.orm === null) {
|
85
|
+
throw new Error("ORM not configured");
|
86
|
+
}
|
87
|
+
await this.manager?.execute(`DROP SCHEMA IF EXISTS "${this.schema ?? "public"}" CASCADE;`);
|
88
|
+
await this.manager?.execute(`CREATE SCHEMA IF NOT EXISTS "${this.schema ?? "public"}";`);
|
89
|
+
try {
|
90
|
+
await this.orm.close();
|
91
|
+
}
|
92
|
+
catch { }
|
93
|
+
this.orm = null;
|
94
|
+
this.manager = null;
|
181
95
|
},
|
182
96
|
};
|
183
97
|
}
|
package/dist/database.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"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"}
|
package/dist/events.js
CHANGED
@@ -1,67 +1,20 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
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;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
3
|
exports.waitSubscribersExecution = void 0;
|
40
4
|
// Allows you to wait for all subscribers to execute for a given event. Only works with the local event bus.
|
41
|
-
|
42
|
-
|
43
|
-
eventBus.eventEmitter_.listeners(eventName).forEach(
|
5
|
+
const waitSubscribersExecution = (eventName, eventBus) => {
|
6
|
+
const subscriberPromises = [];
|
7
|
+
eventBus.eventEmitter_.listeners(eventName).forEach((listener) => {
|
44
8
|
;
|
45
9
|
eventBus.eventEmitter_.removeListener("order.created", listener);
|
46
|
-
|
47
|
-
|
10
|
+
let ok, nok;
|
11
|
+
const promise = new Promise((resolve, reject) => {
|
48
12
|
ok = resolve;
|
49
13
|
nok = reject;
|
50
14
|
});
|
51
15
|
subscriberPromises.push(promise);
|
52
|
-
|
53
|
-
|
54
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
55
|
-
args2[_i] = arguments[_i];
|
56
|
-
}
|
57
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
58
|
-
return __generator(this, function (_a) {
|
59
|
-
switch (_a.label) {
|
60
|
-
case 0: return [4 /*yield*/, listener.apply(eventBus, args2).then(ok).catch(nok)];
|
61
|
-
case 1: return [2 /*return*/, _a.sent()];
|
62
|
-
}
|
63
|
-
});
|
64
|
-
});
|
16
|
+
const newListener = async (...args2) => {
|
17
|
+
return await listener.apply(eventBus, args2).then(ok).catch(nok);
|
65
18
|
};
|
66
19
|
eventBus.eventEmitter_.on("order.created", newListener);
|
67
20
|
});
|
package/dist/events.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAEA,4GAA4G;AACrG,MAAM,wBAAwB,GAAG,CACtC,SAAiB,EACjB,QAAgC,EAChC,EAAE;IACF,MAAM,kBAAkB,GAAmB,EAAE,CAE5C;IAAC,QAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACzE,CAAC;QAAC,QAAgB,CAAC,aAAa,CAAC,cAAc,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;QAE1E,IAAI,EAAE,EAAE,GAAG,CAAA;QACX,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,EAAE,GAAG,OAAO,CAAA;YACZ,GAAG,GAAG,MAAM,CAAA;QACd,CAAC,CAAC,CAAA;QACF,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAEhC,MAAM,WAAW,GAAG,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE;YACrC,OAAO,MAAM,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClE,CAAC,CAEA;QAAC,QAAgB,CAAC,aAAa,CAAC,EAAE,CAAC,eAAe,EAAE,WAAW,CAAC,CAAA;IACnE,CAAC,CAAC,CAAA;IAEF,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;AACxC,CAAC,CAAA;AAxBY,QAAA,wBAAwB,4BAwBpC"}
|
package/dist/id-map.js
CHANGED
@@ -3,23 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
}
|
11
|
-
IdMap.prototype.getId = function (key, prefix, length) {
|
12
|
-
if (prefix === void 0) { prefix = ""; }
|
13
|
-
if (length === void 0) { length = 10; }
|
6
|
+
const randomatic_1 = __importDefault(require("randomatic"));
|
7
|
+
class IdMap {
|
8
|
+
ids = {};
|
9
|
+
getId(key, prefix = "", length = 10) {
|
14
10
|
if (this.ids[key]) {
|
15
11
|
return this.ids[key];
|
16
12
|
}
|
17
|
-
|
13
|
+
const id = `${prefix && prefix + "_"}${(0, randomatic_1.default)("Aa0", length)}`;
|
18
14
|
this.ids[key] = id;
|
19
15
|
return id;
|
20
|
-
}
|
21
|
-
|
22
|
-
|
23
|
-
var instance = new IdMap();
|
16
|
+
}
|
17
|
+
}
|
18
|
+
const instance = new IdMap();
|
24
19
|
exports.default = instance;
|
25
20
|
//# sourceMappingURL=id-map.js.map
|
package/dist/id-map.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"id-map.js","sourceRoot":"","sources":["../src/id-map.ts"],"names":[],"mappings":";;;;;AAAA,
|
1
|
+
{"version":3,"file":"id-map.js","sourceRoot":"","sources":["../src/id-map.ts"],"names":[],"mappings":";;;;;AAAA,4DAAkC;AAElC,MAAM,KAAK;IACT,GAAG,GAAG,EAAE,CAAA;IAER,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;QAED,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,MAAM,GAAG,GAAG,GAAG,IAAA,oBAAS,EAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAA;QACjE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QAElB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,IAAI,KAAK,EAAE,CAAA;AAC5B,kBAAe,QAAQ,CAAA"}
|
package/dist/init-modules.js
CHANGED
@@ -1,106 +1,45 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
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;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
3
|
exports.initModules = void 0;
|
40
|
-
|
41
|
-
function initModules(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
return [4 /*yield*/, medusaApp.onApplicationPrepareShutdown()];
|
51
|
-
case 1:
|
52
|
-
_b.sent();
|
53
|
-
return [4 /*yield*/, (0, utils_1.promiseAll)([
|
54
|
-
(_a = sharedPgConnection.context) === null || _a === void 0 ? void 0 : _a.destroy(),
|
55
|
-
sharedPgConnection.destroy(),
|
56
|
-
medusaApp.onApplicationShutdown(),
|
57
|
-
])];
|
58
|
-
case 2:
|
59
|
-
_b.sent();
|
60
|
-
return [3 /*break*/, 4];
|
61
|
-
case 3:
|
62
|
-
if (!preventConnectionDestroyWarning) {
|
63
|
-
console.info("You are using a custom shared connection. The connection won't be destroyed automatically.");
|
64
|
-
}
|
65
|
-
_b.label = 4;
|
66
|
-
case 4:
|
67
|
-
moduleSdkImports.MedusaModule.clearInstances();
|
68
|
-
return [2 /*return*/];
|
69
|
-
}
|
70
|
-
});
|
71
|
-
});
|
72
|
-
}
|
73
|
-
var moduleSdkImports, sharedPgConnection, shouldDestroyConnectionAutomatically, medusaApp;
|
74
|
-
var injectedDependencies = _b.injectedDependencies, databaseConfig = _b.databaseConfig, modulesConfig = _b.modulesConfig, joinerConfig = _b.joinerConfig, _c = _b.preventConnectionDestroyWarning, preventConnectionDestroyWarning = _c === void 0 ? false : _c;
|
75
|
-
return __generator(this, function (_d) {
|
76
|
-
switch (_d.label) {
|
77
|
-
case 0:
|
78
|
-
moduleSdkImports = require("@medusajs/modules-sdk");
|
79
|
-
injectedDependencies !== null && injectedDependencies !== void 0 ? injectedDependencies : (injectedDependencies = {});
|
80
|
-
sharedPgConnection = injectedDependencies === null || injectedDependencies === void 0 ? void 0 : injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION];
|
81
|
-
shouldDestroyConnectionAutomatically = !sharedPgConnection;
|
82
|
-
if (!sharedPgConnection) {
|
83
|
-
sharedPgConnection = utils_1.ModulesSdkUtils.createPgConnection({
|
84
|
-
clientUrl: databaseConfig.clientUrl,
|
85
|
-
schema: databaseConfig.schema,
|
86
|
-
});
|
87
|
-
injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
|
88
|
-
sharedPgConnection;
|
89
|
-
}
|
90
|
-
return [4 /*yield*/, moduleSdkImports.MedusaApp({
|
91
|
-
modulesConfig: modulesConfig,
|
92
|
-
servicesConfig: joinerConfig,
|
93
|
-
injectedDependencies: injectedDependencies,
|
94
|
-
})];
|
95
|
-
case 1:
|
96
|
-
medusaApp = _d.sent();
|
97
|
-
return [2 /*return*/, {
|
98
|
-
medusaApp: medusaApp,
|
99
|
-
shutdown: shutdown,
|
100
|
-
}];
|
101
|
-
}
|
4
|
+
const utils_1 = require("@medusajs/utils");
|
5
|
+
async function initModules({ injectedDependencies, databaseConfig, modulesConfig, joinerConfig, preventConnectionDestroyWarning = false, }) {
|
6
|
+
const moduleSdkImports = require("@medusajs/modules-sdk");
|
7
|
+
injectedDependencies ??= {};
|
8
|
+
let sharedPgConnection = injectedDependencies?.[utils_1.ContainerRegistrationKeys.PG_CONNECTION];
|
9
|
+
let shouldDestroyConnectionAutomatically = !sharedPgConnection;
|
10
|
+
if (!sharedPgConnection) {
|
11
|
+
sharedPgConnection = utils_1.ModulesSdkUtils.createPgConnection({
|
12
|
+
clientUrl: databaseConfig.clientUrl,
|
13
|
+
schema: databaseConfig.schema,
|
102
14
|
});
|
15
|
+
injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
|
16
|
+
sharedPgConnection;
|
17
|
+
}
|
18
|
+
const medusaApp = await moduleSdkImports.MedusaApp({
|
19
|
+
modulesConfig,
|
20
|
+
servicesConfig: joinerConfig,
|
21
|
+
injectedDependencies,
|
103
22
|
});
|
23
|
+
async function shutdown() {
|
24
|
+
if (shouldDestroyConnectionAutomatically) {
|
25
|
+
await medusaApp.onApplicationPrepareShutdown();
|
26
|
+
await (0, utils_1.promiseAll)([
|
27
|
+
sharedPgConnection.context?.destroy(),
|
28
|
+
sharedPgConnection.destroy(),
|
29
|
+
medusaApp.onApplicationShutdown(),
|
30
|
+
]);
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
if (!preventConnectionDestroyWarning) {
|
34
|
+
console.info(`You are using a custom shared connection. The connection won't be destroyed automatically.`);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
moduleSdkImports.MedusaModule.clearInstances();
|
38
|
+
}
|
39
|
+
return {
|
40
|
+
medusaApp,
|
41
|
+
shutdown,
|
42
|
+
};
|
104
43
|
}
|
105
44
|
exports.initModules = initModules;
|
106
45
|
//# sourceMappingURL=init-modules.js.map
|
package/dist/init-modules.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"init-modules.js","sourceRoot":"","sources":["../src/init-modules.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"init-modules.js","sourceRoot":"","sources":["../src/init-modules.ts"],"names":[],"mappings":";;;AAKA,2CAIwB;AAkBjB,KAAK,UAAU,WAAW,CAAC,EAChC,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,+BAA+B,GAAG,KAAK,GACpB;IACnB,MAAM,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IAEzD,oBAAoB,KAAK,EAAE,CAAA;IAE3B,IAAI,kBAAkB,GACpB,oBAAoB,EAAE,CAAC,iCAAyB,CAAC,aAAa,CAAC,CAAA;IAEjE,IAAI,oCAAoC,GAAG,CAAC,kBAAkB,CAAA;IAC9D,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,uBAAe,CAAC,kBAAkB,CAAC;YACtD,SAAS,EAAE,cAAc,CAAC,SAAS;YACnC,MAAM,EAAE,cAAc,CAAC,MAAM;SAC9B,CAAC,CAAA;QAEF,oBAAoB,CAAC,iCAAyB,CAAC,aAAa,CAAC;YAC3D,kBAAkB,CAAA;IACtB,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC;QACjD,aAAa;QACb,cAAc,EAAE,YAAY;QAC5B,oBAAoB;KACrB,CAAC,CAAA;IAEF,KAAK,UAAU,QAAQ;QACrB,IAAI,oCAAoC,EAAE,CAAC;YACzC,MAAM,SAAS,CAAC,4BAA4B,EAAE,CAAA;YAE9C,MAAM,IAAA,kBAAU,EAAC;gBACd,kBAA0B,CAAC,OAAO,EAAE,OAAO,EAAE;gBAC7C,kBAA0B,CAAC,OAAO,EAAE;gBACrC,SAAS,CAAC,qBAAqB,EAAE;aAClC,CAAC,CAAA;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,+BAA+B,EAAE,CAAC;gBACrC,OAAO,CAAC,IAAI,CACV,4FAA4F,CAC7F,CAAA;YACH,CAAC;QACH,CAAC;QACD,gBAAgB,CAAC,YAAY,CAAC,cAAc,EAAE,CAAA;IAChD,CAAC;IAED,OAAO;QACL,SAAS;QACT,QAAQ;KACT,CAAA;AACH,CAAC;AAtDD,kCAsDC"}
|
package/dist/jest.js
CHANGED
@@ -1,73 +1,25 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
-
function step(op) {
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
-
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;
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
-
switch (op[0]) {
|
21
|
-
case 0: case 1: t = op; break;
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
-
default:
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
-
if (t[2]) _.ops.pop();
|
31
|
-
_.trys.pop(); continue;
|
32
|
-
}
|
33
|
-
op = body.call(thisArg, _);
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
-
}
|
37
|
-
};
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
39
3
|
exports.afterAllHookDropDatabase = void 0;
|
40
|
-
|
4
|
+
const pg_god_1 = require("pg-god");
|
41
5
|
function afterAllHookDropDatabase() {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
var DB_NAME = process.env.DB_TEMP_NAME || "";
|
48
|
-
var pgGodCredentials = {
|
6
|
+
const DB_HOST = process.env.DB_HOST ?? "localhost";
|
7
|
+
const DB_USERNAME = process.env.DB_USERNAME ?? "postgres";
|
8
|
+
const DB_PASSWORD = process.env.DB_PASSWORD ?? "";
|
9
|
+
const DB_NAME = process.env.DB_TEMP_NAME || "";
|
10
|
+
const pgGodCredentials = {
|
49
11
|
user: DB_USERNAME,
|
50
12
|
password: DB_PASSWORD,
|
51
13
|
host: DB_HOST,
|
52
14
|
};
|
53
|
-
afterAll(
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
_a.sent();
|
62
|
-
return [3 /*break*/, 3];
|
63
|
-
case 2:
|
64
|
-
e_1 = _a.sent();
|
65
|
-
console.error("This might fail if it is run during the unit tests since there is no database to drop. Otherwise, please check what is the issue. ".concat(e_1.message));
|
66
|
-
return [3 /*break*/, 3];
|
67
|
-
case 3: return [2 /*return*/];
|
68
|
-
}
|
69
|
-
});
|
70
|
-
}); });
|
15
|
+
afterAll(async () => {
|
16
|
+
try {
|
17
|
+
await (0, pg_god_1.dropDatabase)({ databaseName: DB_NAME }, pgGodCredentials);
|
18
|
+
}
|
19
|
+
catch (e) {
|
20
|
+
console.error(`This might fail if it is run during the unit tests since there is no database to drop. Otherwise, please check what is the issue. ${e.message}`);
|
21
|
+
}
|
22
|
+
});
|
71
23
|
}
|
72
24
|
exports.afterAllHookDropDatabase = afterAllHookDropDatabase;
|
73
25
|
//# sourceMappingURL=jest.js.map
|