oak-backend-base 1.0.4 → 1.0.6
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.d.ts +1 -1
- package/lib/AppLoader.js +1 -1
- package/lib/DbStore.d.ts +1 -1
- package/lib/DbStore.js +1 -1
- package/lib/data/area.json +1 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/package.json +9 -13
- package/lib/BackendContext.d.ts +0 -7
- package/lib/BackendContext.js +0 -20
package/lib/AppLoader.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class AppLoader<ED extends EntityDict & BaseEntityDict, Cxt exten
|
|
|
5
5
|
private dbStore;
|
|
6
6
|
private aspectDict;
|
|
7
7
|
private contextBuilder;
|
|
8
|
-
constructor(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt
|
|
8
|
+
constructor(path: string, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Promise<Cxt>, dbConfig: MySQLConfiguration);
|
|
9
9
|
mount(initialize?: true): Promise<void>;
|
|
10
10
|
unmount(): Promise<void>;
|
|
11
11
|
execAspect(name: string, context: Cxt, params?: any): Promise<any>;
|
package/lib/AppLoader.js
CHANGED
|
@@ -53,7 +53,7 @@ class AppLoader extends types_1.AppLoader {
|
|
|
53
53
|
async initialize(dropIfExists) {
|
|
54
54
|
await this.dbStore.initialize(dropIfExists);
|
|
55
55
|
const { data } = require(`${this.path}/lib/data/index`);
|
|
56
|
-
const context = this.contextBuilder()(this.dbStore);
|
|
56
|
+
const context = await this.contextBuilder()(this.dbStore);
|
|
57
57
|
await context.begin();
|
|
58
58
|
for (const entity in data) {
|
|
59
59
|
let rows = data[entity];
|
package/lib/DbStore.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain';
|
|
|
4
4
|
import { MySQLConfiguration } from 'oak-db/lib/MySQL/types/Configuration';
|
|
5
5
|
export declare class DbStore<ED extends EntityDict & BaseEntityDict, Cxt extends Context<ED>> extends MysqlStore<ED, Cxt> {
|
|
6
6
|
private executor;
|
|
7
|
-
constructor(storageSchema: StorageSchema<ED>, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Cxt
|
|
7
|
+
constructor(storageSchema: StorageSchema<ED>, contextBuilder: (scene?: string) => (store: RowStore<ED, Cxt>) => Promise<Cxt>, mysqlConfiguration: MySQLConfiguration);
|
|
8
8
|
protected cascadeUpdate<T extends keyof ED>(entity: T, operation: ED[T]['Create'] | ED[T]['Update'] | ED[T]['Remove'], context: Cxt, option: MysqlOperateOption): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
|
|
9
9
|
protected cascadeSelect<T extends keyof ED, S extends ED[T]["Selection"]>(entity: T, selection: S, context: Cxt, option: MySqlSelectOption): Promise<SelectRowShape<ED[T]['Schema'], S['data']>[]>;
|
|
10
10
|
operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: MysqlOperateOption): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
|
package/lib/DbStore.js
CHANGED
|
@@ -7,7 +7,7 @@ class DbStore extends oak_db_1.MysqlStore {
|
|
|
7
7
|
executor;
|
|
8
8
|
constructor(storageSchema, contextBuilder, mysqlConfiguration) {
|
|
9
9
|
super(storageSchema, mysqlConfiguration);
|
|
10
|
-
this.executor = new TriggerExecutor_1.TriggerExecutor(
|
|
10
|
+
this.executor = new TriggerExecutor_1.TriggerExecutor((scene) => contextBuilder(scene)(this));
|
|
11
11
|
}
|
|
12
12
|
async cascadeUpdate(entity, operation, context, option) {
|
|
13
13
|
if (!option.blockTrigger) {
|