oak-backend-base 2.0.2 → 2.0.3
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/DbStore.d.ts +0 -1
- package/lib/DbStore.js +10 -13
- package/package.json +4 -4
package/lib/DbStore.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export declare class DbStore<ED extends EntityDict & BaseEntityDict, Cxt extends
|
|
|
7
7
|
private executor;
|
|
8
8
|
constructor(storageSchema: StorageSchema<ED>, contextBuilder: (scene?: string) => (store: DbStore<ED, Cxt>) => Promise<AsyncContext<ED>>, mysqlConfiguration: MySQLConfiguration);
|
|
9
9
|
protected cascadeUpdateAsync<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: AsyncContext<ED>, option: MysqlOperateOption): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
|
|
10
|
-
protected cascadeSelectAsync<T extends keyof ED>(entity: T, selection: ED[T]["Selection"], context: AsyncContext<ED>, option: MySqlSelectOption): Promise<Partial<ED[T]['Schema']>[]>;
|
|
11
10
|
operate<T extends keyof ED>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: MysqlOperateOption): Promise<import("oak-domain/lib/types").OperationResult<ED>>;
|
|
12
11
|
select<T extends keyof ED>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: MySqlSelectOption): Promise<Partial<ED[T]["Schema"]>[]>;
|
|
13
12
|
count<T extends keyof ED>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, context: Cxt, option: SelectOption): Promise<number>;
|
package/lib/DbStore.js
CHANGED
|
@@ -19,19 +19,6 @@ class DbStore extends oak_db_1.MysqlStore {
|
|
|
19
19
|
}
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
|
-
async cascadeSelectAsync(entity, selection, context, option) {
|
|
23
|
-
const selection2 = Object.assign({
|
|
24
|
-
action: 'select',
|
|
25
|
-
}, selection);
|
|
26
|
-
if (!option.blockTrigger) {
|
|
27
|
-
await this.executor.preOperation(entity, selection2, context, option);
|
|
28
|
-
}
|
|
29
|
-
const result = await super.cascadeSelectAsync(entity, selection2, context, option);
|
|
30
|
-
if (!option.blockTrigger) {
|
|
31
|
-
await this.executor.postOperation(entity, selection2, context, option, result);
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
22
|
async operate(entity, operation, context, option) {
|
|
36
23
|
const autoCommit = !context.getCurrentTxnId();
|
|
37
24
|
let result;
|
|
@@ -56,8 +43,18 @@ class DbStore extends oak_db_1.MysqlStore {
|
|
|
56
43
|
await context.begin();
|
|
57
44
|
}
|
|
58
45
|
let result;
|
|
46
|
+
// select的trigger应加在根select之前,cascade的select不加处理
|
|
47
|
+
const selection2 = Object.assign({
|
|
48
|
+
action: 'select',
|
|
49
|
+
}, selection);
|
|
50
|
+
if (!option.blockTrigger) {
|
|
51
|
+
await this.executor.preOperation(entity, selection2, context, option);
|
|
52
|
+
}
|
|
59
53
|
try {
|
|
60
54
|
result = await super.select(entity, selection, context, option);
|
|
55
|
+
if (!option.blockTrigger) {
|
|
56
|
+
await this.executor.postOperation(entity, selection2, context, option, result);
|
|
57
|
+
}
|
|
61
58
|
}
|
|
62
59
|
catch (err) {
|
|
63
60
|
await context.rollback();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-backend-base",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "oak-backend-base",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"author": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"lodash": "^4.17.21",
|
|
19
19
|
"mysql": "^2.18.1",
|
|
20
20
|
"mysql2": "^2.3.3",
|
|
21
|
-
"oak-common-aspect": "2.0.
|
|
22
|
-
"oak-db": "^2.0.
|
|
23
|
-
"oak-domain": "^2.0.
|
|
21
|
+
"oak-common-aspect": "^2.0.2",
|
|
22
|
+
"oak-db": "^2.0.3",
|
|
23
|
+
"oak-domain": "^2.0.2",
|
|
24
24
|
"uuid": "^8.3.2"
|
|
25
25
|
},
|
|
26
26
|
"license": "ISC",
|