medusa-test-utils 1.1.45 → 2.0.0-rc-20241001083650

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. package/dist/database.d.ts +2 -0
  2. package/dist/database.d.ts.map +1 -0
  3. package/dist/database.js +100 -146
  4. package/dist/database.js.map +1 -1
  5. package/dist/events.d.ts +3 -0
  6. package/dist/events.d.ts.map +1 -0
  7. package/dist/events.js +41 -0
  8. package/dist/events.js.map +1 -0
  9. package/dist/id-map.d.ts +3 -2
  10. package/dist/id-map.d.ts.map +1 -0
  11. package/dist/id-map.js +8 -11
  12. package/dist/id-map.js.map +1 -1
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +5 -7
  16. package/dist/index.js.map +1 -1
  17. package/dist/init-modules.d.ts +2 -1
  18. package/dist/init-modules.d.ts.map +1 -0
  19. package/dist/init-modules.js +39 -97
  20. package/dist/init-modules.js.map +1 -1
  21. package/dist/jest.d.ts +1 -0
  22. package/dist/jest.d.ts.map +1 -0
  23. package/dist/jest.js +15 -64
  24. package/dist/jest.js.map +1 -1
  25. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts +10 -5
  26. package/dist/medusa-test-runner-utils/bootstrap-app.d.ts.map +1 -0
  27. package/dist/medusa-test-runner-utils/bootstrap-app.js +53 -147
  28. package/dist/medusa-test-runner-utils/bootstrap-app.js.map +1 -1
  29. package/dist/medusa-test-runner-utils/clear-instances.d.ts +8 -0
  30. package/dist/medusa-test-runner-utils/clear-instances.d.ts.map +1 -0
  31. package/dist/medusa-test-runner-utils/clear-instances.js +14 -0
  32. package/dist/medusa-test-runner-utils/clear-instances.js.map +1 -0
  33. package/dist/medusa-test-runner-utils/config.d.ts +5 -0
  34. package/dist/medusa-test-runner-utils/config.d.ts.map +1 -0
  35. package/dist/medusa-test-runner-utils/config.js +28 -0
  36. package/dist/medusa-test-runner-utils/config.js.map +1 -0
  37. package/dist/medusa-test-runner-utils/index.d.ts +6 -0
  38. package/dist/medusa-test-runner-utils/index.d.ts.map +1 -0
  39. package/dist/medusa-test-runner-utils/index.js +22 -0
  40. package/dist/medusa-test-runner-utils/index.js.map +1 -0
  41. package/dist/medusa-test-runner-utils/use-db.d.ts +15 -12
  42. package/dist/medusa-test-runner-utils/use-db.d.ts.map +1 -0
  43. package/dist/medusa-test-runner-utils/use-db.js +51 -143
  44. package/dist/medusa-test-runner-utils/use-db.js.map +1 -1
  45. package/dist/medusa-test-runner-utils/utils.d.ts +2 -0
  46. package/dist/medusa-test-runner-utils/utils.d.ts.map +1 -0
  47. package/dist/medusa-test-runner-utils/utils.js +10 -0
  48. package/dist/medusa-test-runner-utils/utils.js.map +1 -0
  49. package/dist/medusa-test-runner.d.ts +16 -6
  50. package/dist/medusa-test-runner.d.ts.map +1 -0
  51. package/dist/medusa-test-runner.js +123 -343
  52. package/dist/medusa-test-runner.js.map +1 -1
  53. package/dist/mock-event-bus-service.d.ts +5 -4
  54. package/dist/mock-event-bus-service.d.ts.map +1 -0
  55. package/dist/mock-event-bus-service.js +13 -51
  56. package/dist/mock-event-bus-service.js.map +1 -1
  57. package/dist/module-test-runner.d.ts +4 -2
  58. package/dist/module-test-runner.d.ts.map +1 -0
  59. package/dist/module-test-runner.js +117 -132
  60. package/dist/module-test-runner.js.map +1 -1
  61. package/dist/tsconfig.tsbuildinfo +1 -0
  62. package/package.json +27 -39
  63. package/dist/mock-manager.d.ts +0 -9
  64. package/dist/mock-manager.js +0 -30
  65. package/dist/mock-manager.js.map +0 -1
  66. package/dist/mock-repository.d.ts +0 -51
  67. package/dist/mock-repository.js +0 -193
  68. package/dist/mock-repository.js.map +0 -1
@@ -1,103 +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
- exports.initModules = void 0;
40
- var utils_1 = require("@medusajs/utils");
41
- function initModules(_a) {
42
- var injectedDependencies = _a.injectedDependencies, databaseConfig = _a.databaseConfig, modulesConfig = _a.modulesConfig, joinerConfig = _a.joinerConfig, _b = _a.preventConnectionDestroyWarning, preventConnectionDestroyWarning = _b === void 0 ? false : _b;
43
- return __awaiter(this, void 0, void 0, function () {
44
- function shutdown() {
45
- var _a;
46
- return __awaiter(this, void 0, void 0, function () {
47
- return __generator(this, function (_b) {
48
- switch (_b.label) {
49
- case 0:
50
- if (!shouldDestroyConnectionAutomatically) return [3 /*break*/, 2];
51
- return [4 /*yield*/, (0, utils_1.promiseAll)([
52
- (_a = sharedPgConnection.context) === null || _a === void 0 ? void 0 : _a.destroy(),
53
- sharedPgConnection.destroy(),
54
- medusaApp.onApplicationShutdown(),
55
- ])];
56
- case 1:
57
- _b.sent();
58
- return [3 /*break*/, 3];
59
- case 2:
60
- if (!preventConnectionDestroyWarning) {
61
- console.info("You are using a custom shared connection. The connection won't be destroyed automatically.");
62
- }
63
- _b.label = 3;
64
- case 3:
65
- moduleSdkImports.MedusaModule.clearInstances();
66
- return [2 /*return*/];
67
- }
68
- });
69
- });
70
- }
71
- var moduleSdkImports, sharedPgConnection, shouldDestroyConnectionAutomatically, medusaApp;
72
- return __generator(this, function (_c) {
73
- switch (_c.label) {
74
- case 0:
75
- moduleSdkImports = require("@medusajs/modules-sdk");
76
- injectedDependencies !== null && injectedDependencies !== void 0 ? injectedDependencies : (injectedDependencies = {});
77
- sharedPgConnection = injectedDependencies === null || injectedDependencies === void 0 ? void 0 : injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION];
78
- shouldDestroyConnectionAutomatically = !sharedPgConnection;
79
- if (!sharedPgConnection) {
80
- sharedPgConnection = utils_1.ModulesSdkUtils.createPgConnection({
81
- clientUrl: databaseConfig.clientUrl,
82
- schema: databaseConfig.schema,
83
- });
84
- injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
85
- sharedPgConnection;
86
- }
87
- return [4 /*yield*/, moduleSdkImports.MedusaApp({
88
- modulesConfig: modulesConfig,
89
- servicesConfig: joinerConfig,
90
- injectedDependencies: injectedDependencies,
91
- })];
92
- case 1:
93
- medusaApp = _c.sent();
94
- return [2 /*return*/, {
95
- medusaApp: medusaApp,
96
- shutdown: shutdown,
97
- }];
98
- }
3
+ exports.initModules = initModules;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ async function initModules({ injectedDependencies, databaseConfig, modulesConfig, joinerConfig, preventConnectionDestroyWarning = false, }) {
6
+ const moduleSdkImports = require("@medusajs/framework/modules-sdk");
7
+ injectedDependencies ??= {};
8
+ let sharedPgConnection = injectedDependencies?.[utils_1.ContainerRegistrationKeys.PG_CONNECTION];
9
+ let shouldDestroyConnectionAutomatically = !sharedPgConnection;
10
+ if (!sharedPgConnection) {
11
+ sharedPgConnection = (0, utils_1.createPgConnection)({
12
+ clientUrl: databaseConfig.clientUrl,
13
+ schema: databaseConfig.schema,
99
14
  });
15
+ injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
16
+ sharedPgConnection;
17
+ }
18
+ const medusaApp = await moduleSdkImports.MedusaApp({
19
+ modulesConfig,
20
+ servicesConfig: joinerConfig,
21
+ injectedDependencies,
100
22
  });
23
+ await medusaApp.onApplicationStart();
24
+ async function shutdown() {
25
+ if (shouldDestroyConnectionAutomatically) {
26
+ await medusaApp.onApplicationPrepareShutdown();
27
+ await (0, utils_1.promiseAll)([
28
+ sharedPgConnection.context?.destroy(),
29
+ sharedPgConnection.destroy(),
30
+ medusaApp.onApplicationShutdown(),
31
+ ]);
32
+ }
33
+ else {
34
+ if (!preventConnectionDestroyWarning) {
35
+ console.info(`You are using a custom shared connection. The connection won't be destroyed automatically.`);
36
+ }
37
+ }
38
+ moduleSdkImports.MedusaModule.clearInstances();
39
+ }
40
+ return {
41
+ medusaApp,
42
+ shutdown,
43
+ };
101
44
  }
102
- exports.initModules = initModules;
103
45
  //# sourceMappingURL=init-modules.js.map
@@ -1 +1 @@
1
-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AAU,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"}
package/dist/jest.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export declare function afterAllHookDropDatabase(): void;
2
+ //# sourceMappingURL=jest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.d.ts","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,SAqBvC"}
package/dist/jest.js CHANGED
@@ -1,73 +1,24 @@
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
- exports.afterAllHookDropDatabase = void 0;
40
- var pg_god_1 = require("pg-god");
3
+ exports.afterAllHookDropDatabase = afterAllHookDropDatabase;
4
+ const pg_god_1 = require("pg-god");
41
5
  function afterAllHookDropDatabase() {
42
- var _this = this;
43
- var _a, _b, _c;
44
- var DB_HOST = (_a = process.env.DB_HOST) !== null && _a !== void 0 ? _a : "localhost";
45
- var DB_USERNAME = (_b = process.env.DB_USERNAME) !== null && _b !== void 0 ? _b : "postgres";
46
- var DB_PASSWORD = (_c = process.env.DB_PASSWORD) !== null && _c !== void 0 ? _c : "";
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(function () { return __awaiter(_this, void 0, void 0, function () {
54
- var e_1;
55
- return __generator(this, function (_a) {
56
- switch (_a.label) {
57
- case 0:
58
- _a.trys.push([0, 2, , 3]);
59
- return [4 /*yield*/, (0, pg_god_1.dropDatabase)({ databaseName: DB_NAME }, pgGodCredentials)];
60
- case 1:
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
- exports.afterAllHookDropDatabase = afterAllHookDropDatabase;
73
24
  //# sourceMappingURL=jest.js.map
package/dist/jest.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"jest.js","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAqC;AAErC,SAAgB,wBAAwB;IAAxC,iBAqBC;;IApBC,IAAM,OAAO,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,OAAO,mCAAI,WAAW,CAAA;IAClD,IAAM,WAAW,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,WAAW,mCAAI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AC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CACX,qIAAqI,CAAC,CAAC,OAAO,EAAE,CACjJ,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,5 +1,10 @@
1
- export function startBootstrapApp({ cwd, env, skipExpressListen, }?: {
2
- cwd: any;
3
- env?: {} | undefined;
4
- skipExpressListen?: boolean | undefined;
5
- }): Promise<any>;
1
+ import { MedusaContainer } from "@medusajs/framework/types";
2
+ export declare function startApp({ cwd, env, }?: {
3
+ cwd?: string;
4
+ env?: Record<any, any>;
5
+ }): Promise<{
6
+ shutdown: () => Promise<void>;
7
+ container: MedusaContainer;
8
+ port: number;
9
+ }>;
10
+ //# sourceMappingURL=bootstrap-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-app.d.ts","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/bootstrap-app.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AA4B3D,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,GAAQ,GACT,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;CAAO,GAAG,OAAO,CAAC;IACzD,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7B,SAAS,EAAE,eAAe,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb,CAAC,CAyCD"}
@@ -1,153 +1,59 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- 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;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
4
  };
37
- var __read = (this && this.__read) || function (o, n) {
38
- var m = typeof Symbol === "function" && o[Symbol.iterator];
39
- if (!m) return o;
40
- var i = m.call(o), r, ar = [], e;
41
- try {
42
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
43
- }
44
- catch (error) { e = { error: error }; }
45
- finally {
46
- try {
47
- if (r && !r.done && (m = i["return"])) m.call(i);
48
- }
49
- finally { if (e) throw e.error; }
50
- }
51
- return ar;
52
- };
53
- var _this = this;
54
- var path = require("path");
55
- var express = require("express");
56
- var getPort = require("get-port");
57
- var _a = require("@medusajs/utils"), isObject = _a.isObject, promiseAll = _a.promiseAll;
58
- var GracefulShutdownServer = require("medusa-core-utils").GracefulShutdownServer;
59
- function bootstrapApp(_a) {
60
- var _b = _a === void 0 ? {} : _a, cwd = _b.cwd, _c = _b.env, env = _c === void 0 ? {} : _c;
61
- return __awaiter(this, void 0, void 0, function () {
62
- var app, loaders, _d, container, shutdown, PORT;
63
- return __generator(this, function (_e) {
64
- switch (_e.label) {
65
- case 0:
66
- app = express();
67
- if (isObject(env)) {
68
- Object.entries(env).forEach(function (_a) {
69
- var _b = __read(_a, 2), k = _b[0], v = _b[1];
70
- return (process.env[k] = v);
71
- });
72
- }
73
- loaders = require("@medusajs/medusa/dist/loaders").default;
74
- return [4 /*yield*/, loaders({
75
- directory: path.resolve(cwd || process.cwd()),
76
- expressApp: app,
77
- isTest: false,
78
- })];
79
- case 1:
80
- _d = _e.sent(), container = _d.container, shutdown = _d.shutdown;
81
- return [4 /*yield*/, getPort()];
82
- case 2:
83
- PORT = _e.sent();
84
- return [2 /*return*/, {
85
- shutdown: shutdown,
86
- container: container,
87
- app: app,
88
- port: PORT,
89
- }];
90
- }
91
- });
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.startApp = startApp;
7
+ const express_1 = __importDefault(require("express"));
8
+ const get_port_1 = __importDefault(require("get-port"));
9
+ const path_1 = require("path");
10
+ const utils_1 = require("./utils");
11
+ const utils_2 = require("@medusajs/framework/utils");
12
+ async function bootstrapApp({ cwd, env = {}, } = {}) {
13
+ const app = (0, express_1.default)();
14
+ (0, utils_1.applyEnvVarsToProcess)(env);
15
+ const loaders = require("@medusajs/medusa/loaders/index").default;
16
+ const { container, shutdown } = await loaders({
17
+ directory: (0, path_1.resolve)(cwd || process.cwd()),
18
+ expressApp: app,
92
19
  });
20
+ const PORT = process.env.PORT ? parseInt(process.env.PORT) : await (0, get_port_1.default)();
21
+ return {
22
+ shutdown,
23
+ container,
24
+ app,
25
+ port: PORT,
26
+ };
93
27
  }
94
- module.exports = {
95
- startBootstrapApp: function (_a) {
96
- var _b = _a === void 0 ? {} : _a, cwd = _b.cwd, _c = _b.env, env = _c === void 0 ? {} : _c, _d = _b.skipExpressListen, skipExpressListen = _d === void 0 ? false : _d;
97
- return __awaiter(_this, void 0, void 0, function () {
98
- var _e, app, port, container, medusaShutdown, expressServer, shutdown;
99
- var _this = this;
100
- return __generator(this, function (_f) {
101
- switch (_f.label) {
102
- case 0: return [4 /*yield*/, bootstrapApp({
103
- cwd: cwd,
104
- env: env,
105
- })];
106
- case 1:
107
- _e = _f.sent(), app = _e.app, port = _e.port, container = _e.container, medusaShutdown = _e.shutdown;
108
- if (skipExpressListen) {
109
- return [2 /*return*/];
110
- }
111
- shutdown = function () { return __awaiter(_this, void 0, void 0, function () {
112
- return __generator(this, function (_a) {
113
- switch (_a.label) {
114
- case 0: return [4 /*yield*/, promiseAll([expressServer.shutdown(), medusaShutdown()])];
115
- case 1:
116
- _a.sent();
117
- if (typeof global !== "undefined" && (global === null || global === void 0 ? void 0 : global.gc)) {
118
- global.gc();
119
- }
120
- return [2 /*return*/];
121
- }
122
- });
123
- }); };
124
- return [4 /*yield*/, new Promise(function (resolve, reject) {
125
- var server = app.listen(port, function (err) { return __awaiter(_this, void 0, void 0, function () {
126
- return __generator(this, function (_a) {
127
- switch (_a.label) {
128
- case 0:
129
- if (!err) return [3 /*break*/, 2];
130
- return [4 /*yield*/, shutdown()];
131
- case 1:
132
- _a.sent();
133
- return [2 /*return*/, reject(err)];
134
- case 2:
135
- process.send(port);
136
- resolve({
137
- shutdown: shutdown,
138
- container: container,
139
- port: port,
140
- });
141
- return [2 /*return*/];
142
- }
143
- });
144
- }); });
145
- expressServer = GracefulShutdownServer.create(server);
146
- })];
147
- case 2: return [2 /*return*/, _f.sent()];
148
- }
28
+ async function startApp({ cwd, env = {}, } = {}) {
29
+ const { app, port, container, shutdown: medusaShutdown, } = await bootstrapApp({
30
+ cwd,
31
+ env,
32
+ });
33
+ let expressServer;
34
+ const shutdown = async () => {
35
+ await (0, utils_2.promiseAll)([expressServer?.shutdown(), medusaShutdown()]);
36
+ if (typeof global !== "undefined" && global?.gc) {
37
+ global.gc();
38
+ }
39
+ };
40
+ return await new Promise((resolve, reject) => {
41
+ const server = app
42
+ .listen(port)
43
+ .on("error", async (err) => {
44
+ await shutdown();
45
+ return reject(err);
46
+ })
47
+ .on("listening", () => {
48
+ process.send?.(port);
49
+ resolve({
50
+ shutdown,
51
+ container,
52
+ port,
149
53
  });
150
54
  });
151
- },
152
- };
55
+ // TODO: fix that once we find the appropriate place to put this util
56
+ expressServer = utils_2.GracefulShutdownServer.create(server);
57
+ });
58
+ }
153
59
  //# sourceMappingURL=bootstrap-app.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-app.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/bootstrap-app.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iBA+EA;AA/EA,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,IAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAClC,IAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAC7B,IAAA,KAA2B,OAAO,CAAC,iBAAiB,CAAC,EAAnD,QAAQ,cAAA,EAAE,UAAU,gBAA+B,CAAA;AACnD,IAAA,sBAAsB,GAAK,OAAO,CAAC,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AAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,GAAG;aACf,MAAM,CAAC,IAAI,CAAC;aACZ,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YACzB,MAAM,QAAQ,EAAE,CAAA;YAChB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC,CAAC;aACD,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAA;YAEpB,OAAO,CAAC;gBACN,QAAQ;gBACR,SAAS;gBACT,IAAI;aACL,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEJ,qEAAqE;QACrE,aAAa,GAAG,8BAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACvD,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * cleanup temporary created resources for the migrations
3
+ * @internal I didnt find a god place to put that, should we eventually add a close function
4
+ * to the planner to handle that part? so that you would do planner.close() and it will handle the cleanup
5
+ * automatically just like we usually do for the classic migrations actions
6
+ */
7
+ export declare function clearInstances(): Promise<void>;
8
+ //# sourceMappingURL=clear-instances.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-instances.d.ts","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/clear-instances.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAsB,cAAc,kBAGnC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearInstances = clearInstances;
4
+ /**
5
+ * cleanup temporary created resources for the migrations
6
+ * @internal I didnt find a god place to put that, should we eventually add a close function
7
+ * to the planner to handle that part? so that you would do planner.close() and it will handle the cleanup
8
+ * automatically just like we usually do for the classic migrations actions
9
+ */
10
+ async function clearInstances() {
11
+ const { MedusaModule } = require("@medusajs/framework/modules-sdk");
12
+ MedusaModule.clearInstances();
13
+ }
14
+ //# sourceMappingURL=clear-instances.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear-instances.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/clear-instances.ts"],"names":[],"mappings":";;AAMA,wCAGC;AATD;;;;;GAKG;AACI,KAAK,UAAU,cAAc;IAClC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAA;IACnE,YAAY,CAAC,cAAc,EAAE,CAAA;AAC/B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function configLoaderOverride(entryDirectory: string, override: {
2
+ clientUrl: string;
3
+ debug?: boolean;
4
+ }): Promise<void>;
5
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/config.ts"],"names":[],"mappings":"AAEA,wBAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,iBA4BjD"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configLoaderOverride = configLoaderOverride;
4
+ const utils_1 = require("@medusajs/framework/utils");
5
+ async function configLoaderOverride(entryDirectory, override) {
6
+ const { configManager } = await import("@medusajs/framework/config");
7
+ const { configModule, error } = (0, utils_1.getConfigFile)(entryDirectory, "medusa-config.js");
8
+ if (error) {
9
+ throw new Error(error.message || "Error during config loading");
10
+ }
11
+ configModule.projectConfig.databaseDriverOptions;
12
+ configModule.projectConfig.databaseUrl = override.clientUrl;
13
+ configModule.projectConfig.databaseLogging = !!override.debug;
14
+ configModule.projectConfig.databaseDriverOptions =
15
+ override.clientUrl.includes("localhost")
16
+ ? {}
17
+ : {
18
+ connection: {
19
+ ssl: { rejectUnauthorized: false },
20
+ },
21
+ idle_in_transaction_session_timeout: 20000,
22
+ };
23
+ configManager.loadConfig({
24
+ projectConfig: configModule,
25
+ baseDir: entryDirectory,
26
+ });
27
+ }
28
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/config.ts"],"names":[],"mappings":";;AAEA,oDA8BC;AAhCD,qDAAyD;AAElD,KAAK,UAAU,oBAAoB,CACxC,cAAsB,EACtB,QAAgD;IAEhD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAA;IACpE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,IAAA,qBAAa,EAE3C,cAAc,EAAE,kBAAkB,CAAC,CAAA;IAErC,IAAI,KAAK,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,IAAI,6BAA6B,CAAC,CAAA;IACjE,CAAC;IAED,YAAY,CAAC,aAAa,CAAC,qBAAqB,CAAA;IAChD,YAAY,CAAC,aAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,SAAS,CAAA;IAC3D,YAAY,CAAC,aAAa,CAAC,eAAe,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAA;IAC7D,YAAY,CAAC,aAAa,CAAC,qBAAqB;QAC9C,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC;YACtC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC;gBACE,UAAU,EAAE;oBACV,GAAG,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE;iBACnC;gBACD,mCAAmC,EAAE,KAAK;aAC3C,CAAA;IAEP,aAAa,CAAC,UAAU,CAAC;QACvB,aAAa,EAAE,YAAY;QAC3B,OAAO,EAAE,cAAc;KACxB,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./bootstrap-app";
2
+ export * from "./clear-instances";
3
+ export * from "./config";
4
+ export * from "./use-db";
5
+ export * from "./utils";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/medusa-test-runner-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
@@ -0,0 +1,22 @@
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("./bootstrap-app"), exports);
18
+ __exportStar(require("./clear-instances"), exports);
19
+ __exportStar(require("./config"), exports);
20
+ __exportStar(require("./use-db"), exports);
21
+ __exportStar(require("./utils"), exports);
22
+ //# sourceMappingURL=index.js.map