@c8y/bootstrap
Version:
Bootstrap layer
27 lines • 1.09 kB
JavaScript
import { bootstrapGetRemotes, loadRemotes } from '../plugins/plugins';
import { ensureLoggedInIfRequired } from '../login-check/login-check';
import { loadOptions, applyOptions } from '../resolvers/options-resolver';
export async function loadMetaDataAndPerformBootstrap(loadBootstrapModule) {
const options = await loadOptions();
await applyOptions({
...options
});
const loggedIn = await ensureLoggedInIfRequired(options);
if (!loggedIn) {
console.error('User is not logged in');
return;
}
const { currentUser, currentApp, currentTenant } = loggedIn;
const remotes = bootstrapGetRemotes(currentApp.config, options);
// sadly we need to load these after each other as otherwise DM app runs into issues..
const bootstrapModule = await loadBootstrapModule();
const remoteModuleFactories = await loadRemotes(remotes, options);
return bootstrapModule.bootstrap({
options,
currentUser,
currentApp,
remoteModuleFactories,
currentTenant
});
}
//# sourceMappingURL=metadata.js.map