UNPKG

955 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.realm_set_begin = exports.realm_check = void 0;
4const main_1 = require("./main");
5//#region ---------- Hook Functions ----------
6async function realm_check(realm) {
7 const project = await main_1.getCurrentProject();
8 if (realm.project !== project) {
9 throw new Error(`Realm ${realm.name} with Context ${realm.context} should have project ${realm.project} but has ${project}
10 Do a 'npm run vdev realm ${realm.name}' to make sure all is set correctly`);
11 }
12}
13exports.realm_check = realm_check;
14async function realm_set_begin(realm, currentRealm) {
15 const project = await main_1.getCurrentProject();
16 if (realm.project && realm.project !== project) {
17 await main_1.setCurrentProject(realm.project);
18 return true;
19 }
20 return false;
21}
22exports.realm_set_begin = realm_set_begin;
23//#endregion ---------- /Hook Functions ----------