@freshbox-medusa/modules-sdk 1.0.0
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/definitions.d.ts +7 -0
- package/dist/definitions.d.ts.map +1 -0
- package/dist/definitions.js +313 -0
- package/dist/definitions.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/link.d.ts +54 -0
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +444 -0
- package/dist/link.js.map +1 -0
- package/dist/loaders/index.d.ts +4 -0
- package/dist/loaders/index.d.ts.map +1 -0
- package/dist/loaders/index.js +20 -0
- package/dist/loaders/index.js.map +1 -0
- package/dist/loaders/module-loader.d.ts +10 -0
- package/dist/loaders/module-loader.d.ts.map +1 -0
- package/dist/loaders/module-loader.js +56 -0
- package/dist/loaders/module-loader.js.map +1 -0
- package/dist/loaders/module-provider-loader.d.ts +8 -0
- package/dist/loaders/module-provider-loader.d.ts.map +1 -0
- package/dist/loaders/module-provider-loader.js +56 -0
- package/dist/loaders/module-provider-loader.js.map +1 -0
- package/dist/loaders/register-modules.d.ts +10 -0
- package/dist/loaders/register-modules.d.ts.map +1 -0
- package/dist/loaders/register-modules.js +102 -0
- package/dist/loaders/register-modules.js.map +1 -0
- package/dist/loaders/utils/index.d.ts +2 -0
- package/dist/loaders/utils/index.d.ts.map +1 -0
- package/dist/loaders/utils/index.js +18 -0
- package/dist/loaders/utils/index.js.map +1 -0
- package/dist/loaders/utils/load-internal.d.ts +53 -0
- package/dist/loaders/utils/load-internal.d.ts.map +1 -0
- package/dist/loaders/utils/load-internal.js +519 -0
- package/dist/loaders/utils/load-internal.js.map +1 -0
- package/dist/medusa-app.d.ts +96 -0
- package/dist/medusa-app.d.ts.map +1 -0
- package/dist/medusa-app.js +437 -0
- package/dist/medusa-app.js.map +1 -0
- package/dist/medusa-module.d.ts +149 -0
- package/dist/medusa-module.d.ts.map +1 -0
- package/dist/medusa-module.js +541 -0
- package/dist/medusa-module.js.map +1 -0
- package/dist/remote-query/index.d.ts +3 -0
- package/dist/remote-query/index.d.ts.map +1 -0
- package/dist/remote-query/index.js +19 -0
- package/dist/remote-query/index.js.map +1 -0
- package/dist/remote-query/parse-filters.d.ts +15 -0
- package/dist/remote-query/parse-filters.d.ts.map +1 -0
- package/dist/remote-query/parse-filters.js +178 -0
- package/dist/remote-query/parse-filters.js.map +1 -0
- package/dist/remote-query/query.d.ts +58 -0
- package/dist/remote-query/query.d.ts.map +1 -0
- package/dist/remote-query/query.js +254 -0
- package/dist/remote-query/query.js.map +1 -0
- package/dist/remote-query/remote-query.d.ts +43 -0
- package/dist/remote-query/remote-query.d.ts.map +1 -0
- package/dist/remote-query/remote-query.js +297 -0
- package/dist/remote-query/remote-query.js.map +1 -0
- package/dist/remote-query/to-remote-query.d.ts +29 -0
- package/dist/remote-query/to-remote-query.d.ts.map +1 -0
- package/dist/remote-query/to-remote-query.js +110 -0
- package/dist/remote-query/to-remote-query.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/convert-data-to-link-definition.d.ts +3 -0
- package/dist/utils/convert-data-to-link-definition.d.ts.map +1 -0
- package/dist/utils/convert-data-to-link-definition.js +28 -0
- package/dist/utils/convert-data-to-link-definition.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/linking-error.d.ts +14 -0
- package/dist/utils/linking-error.d.ts.map +1 -0
- package/dist/utils/linking-error.js +18 -0
- package/dist/utils/linking-error.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadModules = loadModules;
|
|
4
|
+
exports.MedusaApp = MedusaApp;
|
|
5
|
+
exports.MedusaAppMigrateUp = MedusaAppMigrateUp;
|
|
6
|
+
exports.MedusaAppMigrateDown = MedusaAppMigrateDown;
|
|
7
|
+
exports.MedusaAppMigrateGenerate = MedusaAppMigrateGenerate;
|
|
8
|
+
exports.MedusaAppGetLinksExecutionPlanner = MedusaAppGetLinksExecutionPlanner;
|
|
9
|
+
const awilix_1 = require("@freshbox-medusa/deps/awilix");
|
|
10
|
+
const utils_1 = require("@freshbox-medusa/utils");
|
|
11
|
+
const link_1 = require("./link");
|
|
12
|
+
const medusa_module_1 = require("./medusa-module");
|
|
13
|
+
const remote_query_1 = require("./remote-query");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
const LinkModulePackage = utils_1.MODULE_PACKAGE_NAMES[utils_1.Modules.LINK];
|
|
16
|
+
async function loadModules(args) {
|
|
17
|
+
const { modulesConfig, sharedContainer, sharedResourcesConfig, migrationOnly = false, schemaOnly = false, loaderOnly = false, workerMode = "shared", cwd, } = args;
|
|
18
|
+
const allModules = {};
|
|
19
|
+
const modulesToLoad = [];
|
|
20
|
+
for (const moduleName of Object.keys(modulesConfig)) {
|
|
21
|
+
const mod = modulesConfig[moduleName];
|
|
22
|
+
let path;
|
|
23
|
+
let moduleExports = undefined;
|
|
24
|
+
let declaration = {};
|
|
25
|
+
let definition = undefined;
|
|
26
|
+
// TODO: We are keeping mod === false for backward compatibility for now
|
|
27
|
+
if (mod === false || ((0, utils_1.isObject)(mod) && "disable" in mod && mod.disable)) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if ((0, utils_1.isObject)(mod)) {
|
|
31
|
+
const mod_ = mod;
|
|
32
|
+
path = mod_.resolve ?? utils_1.MODULE_PACKAGE_NAMES[moduleName];
|
|
33
|
+
definition = mod_.definition;
|
|
34
|
+
moduleExports = !(0, utils_1.isString)(mod_.resolve)
|
|
35
|
+
? mod_.resolve
|
|
36
|
+
: undefined;
|
|
37
|
+
declaration = { ...mod };
|
|
38
|
+
delete declaration.definition;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
path = utils_1.MODULE_PACKAGE_NAMES[moduleName];
|
|
42
|
+
}
|
|
43
|
+
declaration.scope ??= types_1.MODULE_SCOPE.INTERNAL;
|
|
44
|
+
if (declaration.scope === types_1.MODULE_SCOPE.INTERNAL) {
|
|
45
|
+
declaration.options ??= {};
|
|
46
|
+
if (!declaration.options.database) {
|
|
47
|
+
declaration.options[utils_1.isSharedConnectionSymbol] = true;
|
|
48
|
+
}
|
|
49
|
+
declaration.options.database ??= {
|
|
50
|
+
...sharedResourcesConfig?.database,
|
|
51
|
+
};
|
|
52
|
+
declaration.options.database.debug ??=
|
|
53
|
+
sharedResourcesConfig?.database?.debug;
|
|
54
|
+
}
|
|
55
|
+
modulesToLoad.push({
|
|
56
|
+
moduleKey: moduleName,
|
|
57
|
+
defaultPath: path,
|
|
58
|
+
declaration,
|
|
59
|
+
sharedContainer,
|
|
60
|
+
moduleDefinition: definition,
|
|
61
|
+
moduleExports,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const loaded = (await medusa_module_1.MedusaModule.bootstrapAll(modulesToLoad, {
|
|
65
|
+
migrationOnly,
|
|
66
|
+
schemaOnly,
|
|
67
|
+
loaderOnly,
|
|
68
|
+
workerMode,
|
|
69
|
+
cwd,
|
|
70
|
+
}));
|
|
71
|
+
if (loaderOnly) {
|
|
72
|
+
return allModules;
|
|
73
|
+
}
|
|
74
|
+
for (const { moduleKey } of modulesToLoad) {
|
|
75
|
+
const service = loaded.find((loadedModule) => loadedModule[moduleKey])?.[moduleKey];
|
|
76
|
+
if (!service) {
|
|
77
|
+
throw new Error(`Module ${moduleKey} could not be loaded.`);
|
|
78
|
+
}
|
|
79
|
+
sharedContainer.register({
|
|
80
|
+
[service.__definition.key]: (0, awilix_1.asValue)(service),
|
|
81
|
+
});
|
|
82
|
+
if (allModules[moduleKey] && !Array.isArray(allModules[moduleKey])) {
|
|
83
|
+
allModules[moduleKey] = [];
|
|
84
|
+
}
|
|
85
|
+
if (allModules[moduleKey]) {
|
|
86
|
+
;
|
|
87
|
+
allModules[moduleKey].push(service);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
allModules[moduleKey] = service;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return allModules;
|
|
94
|
+
}
|
|
95
|
+
async function initializeLinks({ config, linkModules, injectedDependencies, moduleExports, migrationOnly = false, schemaOnly = false, }) {
|
|
96
|
+
try {
|
|
97
|
+
let resources = moduleExports;
|
|
98
|
+
if (!resources) {
|
|
99
|
+
const module = await (0, utils_1.dynamicImport)(LinkModulePackage);
|
|
100
|
+
if ("discoveryPath" in module) {
|
|
101
|
+
const reExportedLoadedModule = await (0, utils_1.dynamicImport)(module.discoveryPath);
|
|
102
|
+
resources = reExportedLoadedModule.default ?? reExportedLoadedModule;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const { initialize, getMigrationPlanner } = resources;
|
|
106
|
+
const linkResolution = await initialize(config, linkModules, injectedDependencies, undefined, migrationOnly, schemaOnly);
|
|
107
|
+
return {
|
|
108
|
+
remoteLink: new link_1.Link(),
|
|
109
|
+
linkResolution,
|
|
110
|
+
getMigrationPlanner,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.warn("Error initializing link modules.", err);
|
|
115
|
+
return {
|
|
116
|
+
remoteLink: undefined,
|
|
117
|
+
linkResolution: undefined,
|
|
118
|
+
getMigrationPlanner: () => void 0,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function isMedusaModule(mod) {
|
|
123
|
+
return typeof mod?.initialize === "function";
|
|
124
|
+
}
|
|
125
|
+
function cleanAndMergeSchema(loadedSchema) {
|
|
126
|
+
const defaultMedusaSchema = `
|
|
127
|
+
scalar DateTime
|
|
128
|
+
scalar JSON
|
|
129
|
+
directive @enumValue(value: String) on ENUM_VALUE
|
|
130
|
+
`;
|
|
131
|
+
const { schema: cleanedSchema, notFound } = utils_1.GraphQLUtils.cleanGraphQLSchema(defaultMedusaSchema + loadedSchema);
|
|
132
|
+
const mergedSchema = utils_1.GraphQLUtils.mergeTypeDefs(cleanedSchema);
|
|
133
|
+
return {
|
|
134
|
+
schema: utils_1.GraphQLUtils.makeExecutableSchema({ typeDefs: mergedSchema }),
|
|
135
|
+
notFound,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function getLoadedSchema() {
|
|
139
|
+
return medusa_module_1.MedusaModule.getAllJoinerConfigs()
|
|
140
|
+
.map((joinerConfig) => joinerConfig?.schema ?? "")
|
|
141
|
+
.join("\n");
|
|
142
|
+
}
|
|
143
|
+
function registerCustomJoinerConfigs(servicesConfig) {
|
|
144
|
+
for (const config of servicesConfig) {
|
|
145
|
+
if (!config.serviceName || config.isReadOnlyLink) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
medusa_module_1.MedusaModule.setJoinerConfig(config.serviceName, config);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async function MedusaApp_({ sharedContainer, sharedResourcesConfig, servicesConfig, medusaConfigPath, modulesConfigFileName, modulesConfig, linkModules, remoteFetchData, injectedDependencies = {}, migrationOnly = false, schemaOnly = false, loaderOnly = false, workerMode = "shared", cwd = process.cwd(), } = {}) {
|
|
152
|
+
const sharedContainer_ = (0, utils_1.createMedusaContainer)({}, sharedContainer);
|
|
153
|
+
const config = sharedContainer_.resolve(utils_1.ContainerRegistrationKeys.CONFIG_MODULE, {
|
|
154
|
+
allowUnregistered: true,
|
|
155
|
+
});
|
|
156
|
+
const logger = sharedContainer_.resolve(utils_1.ContainerRegistrationKeys.LOGGER, {
|
|
157
|
+
allowUnregistered: true,
|
|
158
|
+
});
|
|
159
|
+
const discovered = await (0, utils_1.discoverFeatureFlagsFromDir)(cwd);
|
|
160
|
+
for (const def of discovered) {
|
|
161
|
+
(0, utils_1.registerFeatureFlag)({
|
|
162
|
+
flag: def,
|
|
163
|
+
projectConfigFlags: config?.featureFlags ?? {},
|
|
164
|
+
router: utils_1.FeatureFlag,
|
|
165
|
+
logger,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
const onApplicationShutdown = async () => {
|
|
169
|
+
await (0, utils_1.promiseAll)([
|
|
170
|
+
medusa_module_1.MedusaModule.onApplicationShutdown(),
|
|
171
|
+
sharedContainer_.dispose(),
|
|
172
|
+
]);
|
|
173
|
+
};
|
|
174
|
+
const onApplicationPrepareShutdown = async () => {
|
|
175
|
+
await (0, utils_1.promiseAll)([medusa_module_1.MedusaModule.onApplicationPrepareShutdown()]);
|
|
176
|
+
};
|
|
177
|
+
const onApplicationStart = async () => {
|
|
178
|
+
await medusa_module_1.MedusaModule.onApplicationStart();
|
|
179
|
+
};
|
|
180
|
+
const modules = modulesConfig ??
|
|
181
|
+
(await (0, utils_1.dynamicImport)(medusaConfigPath ?? cwd + (modulesConfigFileName ?? "/modules-config"))).default;
|
|
182
|
+
const dbData = utils_1.ModulesSdkUtils.loadDatabaseConfig("medusa", sharedResourcesConfig, true);
|
|
183
|
+
registerCustomJoinerConfigs(servicesConfig ?? []);
|
|
184
|
+
if (sharedResourcesConfig?.database?.connection &&
|
|
185
|
+
!injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION]) {
|
|
186
|
+
injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
|
|
187
|
+
sharedResourcesConfig.database.connection;
|
|
188
|
+
}
|
|
189
|
+
else if (dbData.clientUrl &&
|
|
190
|
+
!injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION]) {
|
|
191
|
+
injectedDependencies[utils_1.ContainerRegistrationKeys.PG_CONNECTION] =
|
|
192
|
+
utils_1.ModulesSdkUtils.createPgConnection({
|
|
193
|
+
...(sharedResourcesConfig?.database ?? {}),
|
|
194
|
+
...dbData,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
// remove the link module from the modules
|
|
198
|
+
const linkModule = modules[LinkModulePackage] ?? modules[utils_1.Modules.LINK];
|
|
199
|
+
delete modules[LinkModulePackage];
|
|
200
|
+
delete modules[utils_1.Modules.LINK];
|
|
201
|
+
let linkModuleOrOptions = {};
|
|
202
|
+
if ((0, utils_1.isObject)(linkModule)) {
|
|
203
|
+
linkModuleOrOptions = linkModule;
|
|
204
|
+
}
|
|
205
|
+
for (const injectedDependency of Object.keys(injectedDependencies)) {
|
|
206
|
+
sharedContainer_.register({
|
|
207
|
+
[injectedDependency]: (0, awilix_1.asValue)(injectedDependencies[injectedDependency]),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const allModules = await loadModules({
|
|
211
|
+
modulesConfig: modules,
|
|
212
|
+
sharedContainer: sharedContainer_,
|
|
213
|
+
sharedResourcesConfig: { database: dbData },
|
|
214
|
+
migrationOnly,
|
|
215
|
+
schemaOnly,
|
|
216
|
+
loaderOnly,
|
|
217
|
+
workerMode,
|
|
218
|
+
cwd,
|
|
219
|
+
});
|
|
220
|
+
if (loaderOnly) {
|
|
221
|
+
async function query(...args) {
|
|
222
|
+
throw new Error("Querying not allowed in loaderOnly mode");
|
|
223
|
+
}
|
|
224
|
+
query.graph = query;
|
|
225
|
+
query.gql = query;
|
|
226
|
+
return {
|
|
227
|
+
onApplicationShutdown,
|
|
228
|
+
onApplicationPrepareShutdown,
|
|
229
|
+
onApplicationStart,
|
|
230
|
+
modules: allModules,
|
|
231
|
+
link: undefined,
|
|
232
|
+
query: query,
|
|
233
|
+
runMigrations: async () => {
|
|
234
|
+
throw new Error("Migrations not allowed in loaderOnly mode");
|
|
235
|
+
},
|
|
236
|
+
revertMigrations: async () => {
|
|
237
|
+
throw new Error("Revert migrations not allowed in loaderOnly mode");
|
|
238
|
+
},
|
|
239
|
+
generateMigrations: async () => {
|
|
240
|
+
throw new Error("Generate migrations not allowed in loaderOnly mode");
|
|
241
|
+
},
|
|
242
|
+
linkMigrationExecutionPlanner: () => {
|
|
243
|
+
throw new Error("Migrations planner is not avaibable in loaderOnly mode");
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// Share Event bus with link modules
|
|
248
|
+
injectedDependencies[utils_1.Modules.EVENT_BUS] = sharedContainer_.resolve(utils_1.Modules.EVENT_BUS, {
|
|
249
|
+
allowUnregistered: true,
|
|
250
|
+
});
|
|
251
|
+
linkModules ??= [];
|
|
252
|
+
if (!Array.isArray(linkModules)) {
|
|
253
|
+
linkModules = [linkModules];
|
|
254
|
+
}
|
|
255
|
+
linkModules.push(...medusa_module_1.MedusaModule.getCustomLinks());
|
|
256
|
+
const allLoadedJoinerConfigs = medusa_module_1.MedusaModule.getAllJoinerConfigs();
|
|
257
|
+
for (let linkIdx = 0; linkIdx < linkModules.length; linkIdx++) {
|
|
258
|
+
const customLink = linkModules[linkIdx];
|
|
259
|
+
if (typeof customLink === "function") {
|
|
260
|
+
linkModules[linkIdx] = customLink(allLoadedJoinerConfigs);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const { remoteLink, getMigrationPlanner } = await initializeLinks({
|
|
264
|
+
config: linkModuleOrOptions,
|
|
265
|
+
linkModules,
|
|
266
|
+
injectedDependencies,
|
|
267
|
+
moduleExports: isMedusaModule(linkModule) ? linkModule : undefined,
|
|
268
|
+
migrationOnly,
|
|
269
|
+
schemaOnly,
|
|
270
|
+
});
|
|
271
|
+
const loadedSchema = getLoadedSchema();
|
|
272
|
+
const { schema, notFound } = cleanAndMergeSchema(loadedSchema);
|
|
273
|
+
const entitiesMap = schema.getTypeMap();
|
|
274
|
+
const remoteQuery = new remote_query_1.RemoteQuery({
|
|
275
|
+
servicesConfig,
|
|
276
|
+
customRemoteFetchData: remoteFetchData,
|
|
277
|
+
entitiesMap,
|
|
278
|
+
});
|
|
279
|
+
const applyMigration = async ({ modulesNames, action = "run", allOrNothing = false, }) => {
|
|
280
|
+
const moduleResolutions = Array.from(new Set(modulesNames)).map((moduleName) => {
|
|
281
|
+
return {
|
|
282
|
+
moduleName,
|
|
283
|
+
resolution: medusa_module_1.MedusaModule.getModuleResolutions(moduleName),
|
|
284
|
+
};
|
|
285
|
+
});
|
|
286
|
+
const missingModules = moduleResolutions
|
|
287
|
+
.filter(({ resolution }) => !resolution)
|
|
288
|
+
.map(({ moduleName }) => moduleName);
|
|
289
|
+
if (missingModules.length) {
|
|
290
|
+
const error = new utils_1.MedusaError(utils_1.MedusaError.Types.UNKNOWN_MODULES, `Cannot ${action} migrations for unknown module(s) ${missingModules.join(",")}`, utils_1.MedusaError.Codes.UNKNOWN_MODULES);
|
|
291
|
+
error["allModules"] = Object.keys(allModules);
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
let executedResolutions = []; // [moduleResolution, migration names[]]
|
|
295
|
+
const run = async ({ resolution: moduleResolution }, migrationNames) => {
|
|
296
|
+
if (!moduleResolution.options?.database &&
|
|
297
|
+
moduleResolution.moduleDeclaration?.scope === types_1.MODULE_SCOPE.INTERNAL) {
|
|
298
|
+
moduleResolution.options ??= {};
|
|
299
|
+
moduleResolution.options.database = {
|
|
300
|
+
...(sharedResourcesConfig?.database ?? {}),
|
|
301
|
+
};
|
|
302
|
+
moduleResolution.options.database.debug ??=
|
|
303
|
+
sharedResourcesConfig?.database?.debug;
|
|
304
|
+
}
|
|
305
|
+
const migrationOptions = {
|
|
306
|
+
moduleKey: moduleResolution.definition.key,
|
|
307
|
+
modulePath: moduleResolution.resolutionPath,
|
|
308
|
+
container: sharedContainer,
|
|
309
|
+
options: moduleResolution.options,
|
|
310
|
+
moduleExports: moduleResolution.moduleExports,
|
|
311
|
+
cwd,
|
|
312
|
+
};
|
|
313
|
+
if (action === "revert") {
|
|
314
|
+
await medusa_module_1.MedusaModule.migrateDown(migrationOptions, migrationNames);
|
|
315
|
+
}
|
|
316
|
+
else if (action === "run") {
|
|
317
|
+
const ranMigrationsResult = await medusa_module_1.MedusaModule.migrateUp(migrationOptions);
|
|
318
|
+
// Store for revert if anything goes wrong later
|
|
319
|
+
executedResolutions.push([
|
|
320
|
+
moduleResolution,
|
|
321
|
+
ranMigrationsResult?.map((r) => r.name) ?? [],
|
|
322
|
+
]);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
await medusa_module_1.MedusaModule.migrateGenerate(migrationOptions);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const concurrency = parseInt(process.env.DB_MIGRATION_CONCURRENCY ?? "1");
|
|
329
|
+
try {
|
|
330
|
+
const results = await (0, utils_1.executeWithConcurrency)(moduleResolutions.map((a) => () => run(a)), concurrency);
|
|
331
|
+
const rejections = results.filter((result) => result.status === "rejected");
|
|
332
|
+
if (rejections.length) {
|
|
333
|
+
throw new Error(`Some migrations failed to ${action}: ${rejections
|
|
334
|
+
.map((r) => r.reason)
|
|
335
|
+
.join(", ")}`);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
if (allOrNothing) {
|
|
340
|
+
action = "revert";
|
|
341
|
+
await (0, utils_1.executeWithConcurrency)(executedResolutions.map(([resolution, migrationNames]) => () => run({ resolution }, migrationNames)), concurrency);
|
|
342
|
+
}
|
|
343
|
+
throw error;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
const runMigrations = async ({ allOrNothing = false } = {
|
|
347
|
+
allOrNothing: false,
|
|
348
|
+
}) => {
|
|
349
|
+
await applyMigration({
|
|
350
|
+
modulesNames: Object.keys(allModules),
|
|
351
|
+
allOrNothing,
|
|
352
|
+
});
|
|
353
|
+
};
|
|
354
|
+
const revertMigrations = async (modulesNames) => {
|
|
355
|
+
await applyMigration({
|
|
356
|
+
modulesNames,
|
|
357
|
+
action: "revert",
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
const generateMigrations = async (modulesNames) => {
|
|
361
|
+
await applyMigration({
|
|
362
|
+
modulesNames,
|
|
363
|
+
action: "generate",
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
const getMigrationPlannerFn = () => {
|
|
367
|
+
const options = "scope" in linkModuleOrOptions
|
|
368
|
+
? { ...linkModuleOrOptions.options }
|
|
369
|
+
: {
|
|
370
|
+
...linkModuleOrOptions,
|
|
371
|
+
};
|
|
372
|
+
options.database ??= {
|
|
373
|
+
...sharedResourcesConfig?.database,
|
|
374
|
+
};
|
|
375
|
+
options.database.debug ??= sharedResourcesConfig?.database?.debug;
|
|
376
|
+
return getMigrationPlanner(options, linkModules);
|
|
377
|
+
};
|
|
378
|
+
const indexModule = sharedContainer_.resolve(utils_1.Modules.INDEX, {
|
|
379
|
+
allowUnregistered: true,
|
|
380
|
+
});
|
|
381
|
+
return {
|
|
382
|
+
onApplicationShutdown,
|
|
383
|
+
onApplicationPrepareShutdown,
|
|
384
|
+
onApplicationStart,
|
|
385
|
+
modules: allModules,
|
|
386
|
+
link: remoteLink,
|
|
387
|
+
query: (0, remote_query_1.createQuery)({
|
|
388
|
+
remoteQuery,
|
|
389
|
+
indexModule,
|
|
390
|
+
container: sharedContainer_,
|
|
391
|
+
}), // TODO: rm any once we remove the old RemoteQueryFunction and rely on the Query object instead,
|
|
392
|
+
entitiesMap,
|
|
393
|
+
gqlSchema: schema,
|
|
394
|
+
notFound,
|
|
395
|
+
runMigrations,
|
|
396
|
+
revertMigrations,
|
|
397
|
+
generateMigrations,
|
|
398
|
+
linkMigrationExecutionPlanner: getMigrationPlannerFn,
|
|
399
|
+
sharedContainer: sharedContainer_,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
async function MedusaApp(options = {}) {
|
|
403
|
+
return await MedusaApp_(options);
|
|
404
|
+
}
|
|
405
|
+
async function MedusaAppMigrateUp(options = {}) {
|
|
406
|
+
const migrationOnly = true;
|
|
407
|
+
const { runMigrations } = await MedusaApp_({
|
|
408
|
+
...options,
|
|
409
|
+
migrationOnly,
|
|
410
|
+
});
|
|
411
|
+
await runMigrations({ allOrNothing: options.allOrNothing }).finally(medusa_module_1.MedusaModule.clearInstances);
|
|
412
|
+
}
|
|
413
|
+
async function MedusaAppMigrateDown(moduleNames, options = {}) {
|
|
414
|
+
const migrationOnly = true;
|
|
415
|
+
const { revertMigrations } = await MedusaApp_({
|
|
416
|
+
...options,
|
|
417
|
+
migrationOnly,
|
|
418
|
+
});
|
|
419
|
+
await revertMigrations(moduleNames).finally(medusa_module_1.MedusaModule.clearInstances);
|
|
420
|
+
}
|
|
421
|
+
async function MedusaAppMigrateGenerate(moduleNames, options = {}) {
|
|
422
|
+
const migrationOnly = true;
|
|
423
|
+
const { generateMigrations } = await MedusaApp_({
|
|
424
|
+
...options,
|
|
425
|
+
migrationOnly,
|
|
426
|
+
});
|
|
427
|
+
await generateMigrations(moduleNames).finally(medusa_module_1.MedusaModule.clearInstances);
|
|
428
|
+
}
|
|
429
|
+
async function MedusaAppGetLinksExecutionPlanner(options = {}) {
|
|
430
|
+
const migrationOnly = true;
|
|
431
|
+
const { linkMigrationExecutionPlanner } = await MedusaApp_({
|
|
432
|
+
...options,
|
|
433
|
+
migrationOnly,
|
|
434
|
+
});
|
|
435
|
+
return linkMigrationExecutionPlanner();
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=medusa-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"medusa-app.js","sourceRoot":"","sources":["../src/medusa-app.ts"],"names":[],"mappings":";;AAmFA,kCAuHC;AAifD,8BAIC;AAED,gDAaC;AAED,oDAYC;AAED,4DAYC;AAED,8EAWC;AAvvBD,yDAAsD;AAmBtD,kDAiB+B;AAC/B,iCAA6B;AAC7B,mDAKwB;AACxB,iDAAyD;AACzD,mCAAsC;AAEtC,MAAM,iBAAiB,GAAG,4BAAoB,CAAC,eAAO,CAAC,IAAI,CAAC,CAAA;AAoCrD,KAAK,UAAU,WAAW,CAAC,IASjC;IACC,MAAM,EACJ,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,aA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erConfig, ModuleResolution } from "@freshbox-medusa/types";
|
|
2
|
+
declare global {
|
|
3
|
+
interface MedusaModule {
|
|
4
|
+
getLoadedModules(aliases?: Map<string, string>): {
|
|
5
|
+
[key: string]: LoadedModule;
|
|
6
|
+
}[];
|
|
7
|
+
getModuleInstance(moduleKey: string, alias?: string): LoadedModule;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type MigrationOptions = {
|
|
11
|
+
moduleKey: string;
|
|
12
|
+
modulePath: string;
|
|
13
|
+
container?: MedusaContainer;
|
|
14
|
+
options?: Record<string, any>;
|
|
15
|
+
moduleExports?: ModuleExports;
|
|
16
|
+
cwd?: string;
|
|
17
|
+
};
|
|
18
|
+
export type ModuleBootstrapOptions = {
|
|
19
|
+
moduleKey: string;
|
|
20
|
+
defaultPath: string;
|
|
21
|
+
declaration?: ModuleBootstrapDeclaration;
|
|
22
|
+
moduleExports?: ModuleExports;
|
|
23
|
+
sharedContainer?: MedusaContainer;
|
|
24
|
+
moduleDefinition?: ModuleDefinition;
|
|
25
|
+
injectedDependencies?: Record<string, any>;
|
|
26
|
+
/**
|
|
27
|
+
* In this mode, all instances are partially loaded, meaning that the module will not be fully loaded and the services will not be available.
|
|
28
|
+
* Don't forget to clear the instances (MedusaModule.clearInstances()) after the migration are done.
|
|
29
|
+
*/
|
|
30
|
+
migrationOnly?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Forces the modules bootstrapper to only run the modules loaders and return prematurely. This
|
|
33
|
+
* is meant for modules that have data loader. In a test env, in order to clear all data
|
|
34
|
+
* and load them back, we need to run those loader again
|
|
35
|
+
*/
|
|
36
|
+
loaderOnly?: boolean;
|
|
37
|
+
workerMode?: "shared" | "worker" | "server";
|
|
38
|
+
cwd?: string;
|
|
39
|
+
};
|
|
40
|
+
export type LinkModuleBootstrapOptions = {
|
|
41
|
+
definition: LinkModuleDefinition;
|
|
42
|
+
declaration?: InternalModuleDeclaration;
|
|
43
|
+
moduleExports?: ModuleExports;
|
|
44
|
+
injectedDependencies?: Record<string, any>;
|
|
45
|
+
cwd?: string;
|
|
46
|
+
migrationOnly?: boolean;
|
|
47
|
+
schemaOnly?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export type RegisterModuleJoinerConfig = ModuleJoinerConfig | ((modules: ModuleJoinerConfig[]) => ModuleJoinerConfig);
|
|
50
|
+
declare class MedusaModule {
|
|
51
|
+
private static instances_;
|
|
52
|
+
private static modules_;
|
|
53
|
+
private static customLinks_;
|
|
54
|
+
private static loading_;
|
|
55
|
+
private static joinerConfig_;
|
|
56
|
+
private static moduleResolutions_;
|
|
57
|
+
static getLoadedModules(aliases?: Map<string, string>): {
|
|
58
|
+
[key: string]: LoadedModule;
|
|
59
|
+
}[];
|
|
60
|
+
static onApplicationStart(onApplicationStartCb?: () => void): void;
|
|
61
|
+
static onApplicationShutdown(): Promise<void>;
|
|
62
|
+
static onApplicationPrepareShutdown(): Promise<void>;
|
|
63
|
+
static clearInstances(): void;
|
|
64
|
+
static isInstalled(moduleKey: string, alias?: string): boolean;
|
|
65
|
+
static getJoinerConfig(moduleKey: string): ModuleJoinerConfig;
|
|
66
|
+
static getAllJoinerConfigs(): ModuleJoinerConfig[];
|
|
67
|
+
static getModuleResolutions(moduleKey: string): ModuleResolution;
|
|
68
|
+
static getAllModuleResolutions(): ModuleResolution[];
|
|
69
|
+
static unregisterModuleResolution(moduleKey: string): void;
|
|
70
|
+
static setModuleResolution(moduleKey: string, resolution: ModuleResolution): ModuleResolution;
|
|
71
|
+
static setJoinerConfig(moduleKey: string, config: ModuleJoinerConfig): ModuleJoinerConfig;
|
|
72
|
+
static setCustomLink(config: RegisterModuleJoinerConfig): void;
|
|
73
|
+
static getCustomLinks(): RegisterModuleJoinerConfig[];
|
|
74
|
+
static getModuleInstance(moduleKey: string, alias?: string): any | undefined;
|
|
75
|
+
private static registerModule;
|
|
76
|
+
/**
|
|
77
|
+
* Load all modules and resolve them once they are loaded
|
|
78
|
+
* @param modulesOptions
|
|
79
|
+
* @param migrationOnly
|
|
80
|
+
* @param loaderOnly
|
|
81
|
+
* @param workerMode
|
|
82
|
+
*/
|
|
83
|
+
static bootstrapAll(modulesOptions: Omit<ModuleBootstrapOptions, "migrationOnly" | "loaderOnly" | "workerMode" | "schemaOnly">[], { migrationOnly, loaderOnly, workerMode, schemaOnly, cwd, }: {
|
|
84
|
+
migrationOnly?: boolean;
|
|
85
|
+
loaderOnly?: boolean;
|
|
86
|
+
workerMode?: ModuleBootstrapOptions["workerMode"];
|
|
87
|
+
cwd?: string;
|
|
88
|
+
schemaOnly?: boolean;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
}[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Load a single module and resolve it once it is loaded
|
|
94
|
+
* @param moduleKey
|
|
95
|
+
* @param defaultPath
|
|
96
|
+
* @param declaration
|
|
97
|
+
* @param moduleExports
|
|
98
|
+
* @param sharedContainer
|
|
99
|
+
* @param moduleDefinition
|
|
100
|
+
* @param injectedDependencies
|
|
101
|
+
* @param migrationOnly
|
|
102
|
+
* @param loaderOnly
|
|
103
|
+
* @param workerMode
|
|
104
|
+
*/
|
|
105
|
+
static bootstrap<T>({ moduleKey, defaultPath, declaration, moduleExports, sharedContainer, moduleDefinition, injectedDependencies, migrationOnly, loaderOnly, workerMode, cwd, }: ModuleBootstrapOptions): Promise<{
|
|
106
|
+
[key: string]: T;
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Load all modules and then resolve them once they are loaded
|
|
110
|
+
*
|
|
111
|
+
* @param modulesOptions
|
|
112
|
+
* @param migrationOnly
|
|
113
|
+
* @param loaderOnly
|
|
114
|
+
* @param workerMode
|
|
115
|
+
* @protected
|
|
116
|
+
*/
|
|
117
|
+
protected static bootstrap_<T>(modulesOptions: Omit<ModuleBootstrapOptions, "migrationOnly" | "loaderOnly" | "workerMode" | "cwd" | "schemaOnly">[], { migrationOnly, loaderOnly, workerMode, cwd, schemaOnly, }: {
|
|
118
|
+
migrationOnly?: boolean;
|
|
119
|
+
loaderOnly?: boolean;
|
|
120
|
+
workerMode?: "shared" | "worker" | "server";
|
|
121
|
+
cwd?: string;
|
|
122
|
+
schemaOnly?: boolean;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
[key: string]: T;
|
|
125
|
+
}[]>;
|
|
126
|
+
/**
|
|
127
|
+
* Resolve all the modules once they all have been loaded through the bootstrap
|
|
128
|
+
* and store their references in the instances_ map and return them
|
|
129
|
+
*
|
|
130
|
+
* @param hashKey
|
|
131
|
+
* @param modDeclaration
|
|
132
|
+
* @param moduleResolutions
|
|
133
|
+
* @param container
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
private static resolveLoadedModule;
|
|
137
|
+
static bootstrapLink({ definition, declaration, moduleExports, injectedDependencies, cwd, migrationOnly, schemaOnly, }: LinkModuleBootstrapOptions): Promise<{
|
|
138
|
+
[key: string]: unknown;
|
|
139
|
+
}>;
|
|
140
|
+
static migrateGenerate({ options, container, moduleExports, moduleKey, modulePath, cwd, }: MigrationOptions): Promise<void>;
|
|
141
|
+
static migrateUp({ options, container, moduleExports, moduleKey, modulePath, cwd, }: MigrationOptions): Promise<{
|
|
142
|
+
name: string;
|
|
143
|
+
path: string;
|
|
144
|
+
}[]>;
|
|
145
|
+
static migrateDown({ options, container, moduleExports, moduleKey, modulePath, cwd, }: MigrationOptions, migrationNames?: string[]): Promise<void>;
|
|
146
|
+
}
|
|
147
|
+
declare const GlobalMedusaModule: typeof MedusaModule;
|
|
148
|
+
export { GlobalMedusaModule as MedusaModule };
|
|
149
|
+
//# sourceMappingURL=medusa-module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"medusa-module.d.ts","sourceRoot":"","sources":["../src/medusa-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,yBAAyB,EACzB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,0BAA0B,EAC1B,gBAAgB,EAChB,a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