@midwayjs/core 3.5.0 → 3.5.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.
|
@@ -115,10 +115,24 @@ class DataSourceManager {
|
|
|
115
115
|
}
|
|
116
116
|
exports.DataSourceManager = DataSourceManager;
|
|
117
117
|
function globModels(globString, appDir) {
|
|
118
|
-
|
|
118
|
+
let cwd;
|
|
119
|
+
let pattern;
|
|
120
|
+
if (globString.endsWith('**')) {
|
|
121
|
+
// 去掉尾部的 **,因为 glob 会自动添加
|
|
122
|
+
globString = globString.slice(0, -2);
|
|
123
|
+
}
|
|
124
|
+
if (/\*/.test(globString)) {
|
|
125
|
+
cwd = appDir;
|
|
126
|
+
pattern = [...interface_1.DEFAULT_PATTERN.map(p => (0, path_1.join)(globString, p))];
|
|
127
|
+
pattern.push(globString);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
pattern = [...interface_1.DEFAULT_PATTERN];
|
|
131
|
+
cwd = (0, path_1.join)(appDir, globString);
|
|
132
|
+
}
|
|
119
133
|
const models = [];
|
|
120
134
|
// string will be glob file
|
|
121
|
-
const files = (0, glob_1.run)(
|
|
135
|
+
const files = (0, glob_1.run)(pattern, {
|
|
122
136
|
cwd,
|
|
123
137
|
ignore: interface_1.IGNORE_PATTERN,
|
|
124
138
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMethodAspect } from '@midwayjs/decorator';
|
|
1
|
+
import { AspectMetadata, IMethodAspect } from '@midwayjs/decorator';
|
|
2
2
|
import { IMidwayContainer } from '../interface';
|
|
3
3
|
export declare class MidwayAspectService {
|
|
4
4
|
readonly applicationContext: IMidwayContainer;
|
|
@@ -7,7 +7,7 @@ export declare class MidwayAspectService {
|
|
|
7
7
|
* load aspect method for container
|
|
8
8
|
*/
|
|
9
9
|
loadAspect(): Promise<void>;
|
|
10
|
-
|
|
10
|
+
addAspect(aspectIns: IMethodAspect, aspectData: AspectMetadata): Promise<void>;
|
|
11
11
|
/**
|
|
12
12
|
* intercept class method in prototype
|
|
13
13
|
* @param Clz class you want to intercept
|
package/dist/util/retry.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export declare function retryWithAsync<T extends (...args: any[]) => Promise<unknown>>(retryFn: T, retryTimes?: number, options?: {
|
|
8
8
|
throwOriginError?: boolean;
|
|
9
9
|
retryInterval?: number;
|
|
10
|
+
receiver?: any;
|
|
10
11
|
}): (...args: Parameters<T>) => ReturnType<T>;
|
|
11
12
|
/**
|
|
12
13
|
* wrap sync function with retry
|
|
@@ -16,5 +17,6 @@ export declare function retryWithAsync<T extends (...args: any[]) => Promise<unk
|
|
|
16
17
|
*/
|
|
17
18
|
export declare function retryWith<T extends (...args: any[]) => unknown>(retryFn: T, retryTimes?: number, options?: {
|
|
18
19
|
throwOriginError?: boolean;
|
|
20
|
+
receiver?: any;
|
|
19
21
|
}): (...args: Parameters<T>) => ReturnType<T>;
|
|
20
22
|
//# sourceMappingURL=retry.d.ts.map
|
package/dist/util/retry.js
CHANGED
|
@@ -15,7 +15,7 @@ function retryWithAsync(retryFn, retryTimes = 1, options = {}) {
|
|
|
15
15
|
return (async (...args) => {
|
|
16
16
|
do {
|
|
17
17
|
try {
|
|
18
|
-
return await retryFn(...args);
|
|
18
|
+
return await retryFn.bind(options.receiver || this)(...args);
|
|
19
19
|
}
|
|
20
20
|
catch (err) {
|
|
21
21
|
error = err;
|
|
@@ -45,7 +45,7 @@ function retryWith(retryFn, retryTimes = 1, options = {}) {
|
|
|
45
45
|
return ((...args) => {
|
|
46
46
|
do {
|
|
47
47
|
try {
|
|
48
|
-
return retryFn(...args);
|
|
48
|
+
return retryFn.bind(options.receiver || this)(...args);
|
|
49
49
|
}
|
|
50
50
|
catch (err) {
|
|
51
51
|
error = err;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"koa": "2.13.4",
|
|
26
26
|
"midway-test-component": "*",
|
|
27
27
|
"mm": "3.2.0",
|
|
28
|
-
"pg": "
|
|
28
|
+
"pg": "8.8.0",
|
|
29
29
|
"raw-body": "2.5.1",
|
|
30
30
|
"sinon": "14.0.0"
|
|
31
31
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=12"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "32356484664846984f6d3d65a3a75dea015e8dcc"
|
|
50
50
|
}
|