oak-backend-base 2.2.0 → 2.2.1
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/lib/AppLoader.js +7 -7
- package/package.json +1 -1
package/lib/AppLoader.js
CHANGED
|
@@ -11,8 +11,8 @@ const types_1 = require("oak-domain/lib/types");
|
|
|
11
11
|
const DbStore_1 = require("./DbStore");
|
|
12
12
|
const index_1 = tslib_1.__importDefault(require("oak-common-aspect/lib/index"));
|
|
13
13
|
function initTriggers(dbStore, path) {
|
|
14
|
-
const triggers = require(`${path}/lib/triggers/index`);
|
|
15
|
-
const checkers = require(`${path}/lib/checkers/index`);
|
|
14
|
+
const triggers = require(`${path}/lib/triggers/index`).default;
|
|
15
|
+
const checkers = require(`${path}/lib/checkers/index`).default;
|
|
16
16
|
const { ActionDefDict } = require(`${path}/lib/oak-app-domain/ActionDefDict`);
|
|
17
17
|
const { triggers: adTriggers, checkers: adCheckers } = (0, actionDef_1.analyzeActionDefDict)(dbStore.getSchema(), ActionDefDict);
|
|
18
18
|
triggers.forEach((trigger) => dbStore.registerTrigger(trigger));
|
|
@@ -25,7 +25,7 @@ function initTriggers(dbStore, path) {
|
|
|
25
25
|
dynamicTriggers.forEach((trigger) => dbStore.registerTrigger(trigger));
|
|
26
26
|
}
|
|
27
27
|
function startWatchers(dbStore, path, contextBuilder) {
|
|
28
|
-
const watchers = require(`${path}/lib/watchers/index`);
|
|
28
|
+
const watchers = require(`${path}/lib/watchers/index`).default;
|
|
29
29
|
const { ActionDefDict } = require(`${path}/lib/oak-app-domain/ActionDefDict`);
|
|
30
30
|
const { watchers: adWatchers } = (0, actionDef_1.analyzeActionDefDict)(dbStore.getSchema(), ActionDefDict);
|
|
31
31
|
const totalWatchers = watchers.concat(adWatchers);
|
|
@@ -85,7 +85,7 @@ class AppLoader extends types_1.AppLoader {
|
|
|
85
85
|
constructor(path, contextBuilder, dbConfig) {
|
|
86
86
|
super(path);
|
|
87
87
|
const { storageSchema } = require(`${path}/lib/oak-app-domain/Storage`);
|
|
88
|
-
this.aspectDict = Object.assign({}, index_1.default, require(`${path}/lib/aspects/index`));
|
|
88
|
+
this.aspectDict = Object.assign({}, index_1.default, require(`${path}/lib/aspects/index`).default);
|
|
89
89
|
this.dbStore = new DbStore_1.DbStore(storageSchema, contextBuilder, dbConfig);
|
|
90
90
|
this.contextBuilder = contextBuilder;
|
|
91
91
|
}
|
|
@@ -108,7 +108,7 @@ class AppLoader extends types_1.AppLoader {
|
|
|
108
108
|
}
|
|
109
109
|
async initialize(dropIfExists) {
|
|
110
110
|
await this.dbStore.initialize(dropIfExists);
|
|
111
|
-
const data = require(`${this.path}/lib/data/index`);
|
|
111
|
+
const data = require(`${this.path}/lib/data/index`).default;
|
|
112
112
|
const context = await this.contextBuilder()(this.dbStore);
|
|
113
113
|
await context.begin();
|
|
114
114
|
for (const entity in data) {
|
|
@@ -136,7 +136,7 @@ class AppLoader extends types_1.AppLoader {
|
|
|
136
136
|
startWatchers(this.dbStore, this.path, this.contextBuilder);
|
|
137
137
|
}
|
|
138
138
|
startTimers() {
|
|
139
|
-
const timers = require(`${this.path}/lib/timer/index`);
|
|
139
|
+
const timers = require(`${this.path}/lib/timer/index`).default;
|
|
140
140
|
for (const timer of timers) {
|
|
141
141
|
const { cron, fn, name } = timer;
|
|
142
142
|
(0, node_schedule_1.scheduleJob)(name, cron, async (date) => {
|
|
@@ -157,7 +157,7 @@ class AppLoader extends types_1.AppLoader {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
async execStartRoutines() {
|
|
160
|
-
const routines = require(`${this.path}/lib/routines/start`);
|
|
160
|
+
const routines = require(`${this.path}/lib/routines/start`).default;
|
|
161
161
|
for (const routine of routines) {
|
|
162
162
|
const { name, fn } = routine;
|
|
163
163
|
const context = await this.contextBuilder()(this.dbStore);
|