vona-module-a-executor 5.0.14 → 5.0.16
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/dist/.metadata/index.d.ts +4 -0
- package/dist/index.js +12 -11
- package/dist/types/executor.d.ts +2 -2
- package/package.json +1 -1
|
@@ -28,6 +28,10 @@ declare module 'vona-module-a-bean' {
|
|
|
28
28
|
declare module 'vona-module-a-executor' {
|
|
29
29
|
interface ServiceExecutor {
|
|
30
30
|
}
|
|
31
|
+
interface ServiceExecutor {
|
|
32
|
+
get $beanFullName(): 'a-executor.service.executor';
|
|
33
|
+
get $onionName(): 'a-executor:executor';
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
/** service: end */
|
|
33
37
|
/** service: begin */
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BeanInfo, BeanBase, cast, deepExtend, BeanScopeBase } from 'vona';
|
|
2
|
+
import { isNil, combineParamsAndQuery } from '@cabloy/utils';
|
|
2
3
|
import { Bean, Service, Scope } from 'vona-module-a-bean';
|
|
3
|
-
import { combineParamsAndQuery } from '@cabloy/utils';
|
|
4
4
|
import { Aspect } from 'vona-module-a-aspect';
|
|
5
5
|
|
|
6
6
|
function __delegateProperties(ctx, ctxCaller) {
|
|
@@ -58,7 +58,7 @@ let BeanExecutor = (_dec$2 = Bean(), _dec2$2 = BeanInfo({
|
|
|
58
58
|
return await this.scope.service.executor.performActionInner(method, url, options);
|
|
59
59
|
}
|
|
60
60
|
runInBackground(fn) {
|
|
61
|
-
return this.bean.database.
|
|
61
|
+
return this.bean.database.switchDbIsolate(() => {
|
|
62
62
|
return this.newCtx(fn);
|
|
63
63
|
});
|
|
64
64
|
}
|
|
@@ -70,16 +70,17 @@ let BeanExecutor = (_dec$2 = Bean(), _dec2$2 = BeanInfo({
|
|
|
70
70
|
}
|
|
71
71
|
async mockCtx(fn, options) {
|
|
72
72
|
options = Object.assign({}, options);
|
|
73
|
-
options.dbInfo = options.dbInfo
|
|
73
|
+
options.dbInfo = isNil(options.dbInfo) ? {
|
|
74
|
+
level: 1
|
|
75
|
+
} : options.dbInfo;
|
|
74
76
|
options.instanceName = options.instanceName === undefined ? this.ctx?.instanceName ?? '' : options.instanceName;
|
|
75
77
|
return this.newCtx(fn, options);
|
|
76
78
|
}
|
|
77
79
|
async newCtx(fn, options) {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
return this.bean.database.newDb(() => {
|
|
80
|
+
if (isNil(options?.dbInfo)) return this._newCtxInner(fn, options);
|
|
81
|
+
return this.bean.database.switchDb(() => {
|
|
81
82
|
return this._newCtxInner(fn, options);
|
|
82
|
-
}, dbInfo);
|
|
83
|
+
}, options?.dbInfo);
|
|
83
84
|
}
|
|
84
85
|
async _newCtxInner(fn, options) {
|
|
85
86
|
options = Object.assign({}, options);
|
|
@@ -139,8 +140,8 @@ let BeanExecutor = (_dec$2 = Bean(), _dec2$2 = BeanInfo({
|
|
|
139
140
|
} else {
|
|
140
141
|
res = await fn();
|
|
141
142
|
}
|
|
142
|
-
//
|
|
143
|
-
await ctx.
|
|
143
|
+
// commitsDone
|
|
144
|
+
await ctx.commitsDone();
|
|
144
145
|
// ok
|
|
145
146
|
return res;
|
|
146
147
|
});
|
|
@@ -229,14 +230,14 @@ let ServiceExecutor = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
229
230
|
const clientName = options?.dbInfo?.clientName ?? current?.clientName;
|
|
230
231
|
const locale = options?.locale === undefined ? this.ctx?.locale : options.locale;
|
|
231
232
|
const instanceName = options?.instanceName === undefined ? this.ctx?.instanceName : options.instanceName;
|
|
232
|
-
options = {
|
|
233
|
+
options = Object.assign({}, options, {
|
|
233
234
|
dbInfo: {
|
|
234
235
|
level,
|
|
235
236
|
clientName
|
|
236
237
|
},
|
|
237
238
|
locale,
|
|
238
239
|
instanceName
|
|
239
|
-
};
|
|
240
|
+
});
|
|
240
241
|
if (this.ctx) {
|
|
241
242
|
options = deepExtend({
|
|
242
243
|
extraData: {
|
package/dist/types/executor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ContextState, IInstanceRecord, ILocaleInfos, PowerPartial } from 'vona';
|
|
2
|
-
import type { IDbInfo, ITransactionOptions } from 'vona-module-a-database';
|
|
3
2
|
import type { ConfigOnions } from 'vona-module-a-onion';
|
|
3
|
+
import type { IDbInfo, ITransactionOptions } from 'vona-module-a-orm';
|
|
4
4
|
export declare const SymbolRouterMiddleware: unique symbol;
|
|
5
5
|
export interface INewCtxExtraData {
|
|
6
6
|
state?: ContextState;
|
|
@@ -9,7 +9,7 @@ export interface INewCtxExtraData {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export interface INewCtxOptions extends INewCtxBaseOptions {
|
|
12
|
-
dbInfo?: IDbInfo
|
|
12
|
+
dbInfo?: Partial<IDbInfo>;
|
|
13
13
|
}
|
|
14
14
|
export interface INewCtxBaseOptions {
|
|
15
15
|
locale?: keyof ILocaleInfos;
|