@midwayjs/core 3.4.0-beta.2 → 3.4.0-beta.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.
|
@@ -17,6 +17,7 @@ export declare const FrameworkErrorEnum: {
|
|
|
17
17
|
readonly INCONSISTENT_VERSION: "MIDWAY_10013";
|
|
18
18
|
readonly INVALID_CONFIG: "MIDWAY_10014";
|
|
19
19
|
readonly DUPLICATE_CLASS_NAME: "MIDWAY_10015";
|
|
20
|
+
readonly DUPLICATE_CONTROLLER_PREFIX_OPTIONS: "MIDWAY_10016";
|
|
20
21
|
};
|
|
21
22
|
export declare class MidwayCommonError extends MidwayError {
|
|
22
23
|
constructor(message: string);
|
|
@@ -66,4 +67,7 @@ export declare class MidwayInconsistentVersionError extends MidwayError {
|
|
|
66
67
|
export declare class MidwayDuplicateClassNameError extends MidwayError {
|
|
67
68
|
constructor(className: string, existPath: string, existPathOther: string);
|
|
68
69
|
}
|
|
70
|
+
export declare class MidwayDuplicateControllerOptionsError extends MidwayError {
|
|
71
|
+
constructor(prefix: string, existController: string, existControllerOther: string);
|
|
72
|
+
}
|
|
69
73
|
//# sourceMappingURL=framework.d.ts.map
|
package/dist/error/framework.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MidwayDuplicateClassNameError = exports.MidwayInconsistentVersionError = exports.MidwayUtilHttpClientTimeoutError = exports.MidwayMissingImportComponentError = exports.MidwaySingletonInjectRequestError = exports.MidwayUseWrongMethodError = exports.MidwayDuplicateRouteError = exports.MidwayResolverMissingError = exports.MidwayInvalidConfigError = exports.MidwayConfigMissingError = exports.MidwayFeatureNotImplementedError = exports.MidwayFeatureNoLongerSupportedError = exports.MidwayDefinitionNotFoundError = exports.MidwayParameterError = exports.MidwayCommonError = exports.FrameworkErrorEnum = void 0;
|
|
3
|
+
exports.MidwayDuplicateControllerOptionsError = exports.MidwayDuplicateClassNameError = exports.MidwayInconsistentVersionError = exports.MidwayUtilHttpClientTimeoutError = exports.MidwayMissingImportComponentError = exports.MidwaySingletonInjectRequestError = exports.MidwayUseWrongMethodError = exports.MidwayDuplicateRouteError = exports.MidwayResolverMissingError = exports.MidwayInvalidConfigError = exports.MidwayConfigMissingError = exports.MidwayFeatureNotImplementedError = exports.MidwayFeatureNoLongerSupportedError = exports.MidwayDefinitionNotFoundError = exports.MidwayParameterError = exports.MidwayCommonError = exports.FrameworkErrorEnum = void 0;
|
|
4
4
|
const base_1 = require("./base");
|
|
5
5
|
exports.FrameworkErrorEnum = (0, base_1.registerErrorCode)('midway', {
|
|
6
6
|
UNKNOWN: 10000,
|
|
@@ -19,6 +19,7 @@ exports.FrameworkErrorEnum = (0, base_1.registerErrorCode)('midway', {
|
|
|
19
19
|
INCONSISTENT_VERSION: 10013,
|
|
20
20
|
INVALID_CONFIG: 10014,
|
|
21
21
|
DUPLICATE_CLASS_NAME: 10015,
|
|
22
|
+
DUPLICATE_CONTROLLER_PREFIX_OPTIONS: 10016,
|
|
22
23
|
});
|
|
23
24
|
class MidwayCommonError extends base_1.MidwayError {
|
|
24
25
|
constructor(message) {
|
|
@@ -129,4 +130,10 @@ class MidwayDuplicateClassNameError extends base_1.MidwayError {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
exports.MidwayDuplicateClassNameError = MidwayDuplicateClassNameError;
|
|
133
|
+
class MidwayDuplicateControllerOptionsError extends base_1.MidwayError {
|
|
134
|
+
constructor(prefix, existController, existControllerOther) {
|
|
135
|
+
super(`"Prefix ${prefix}" with duplicated controller options between "${existController}" and "${existControllerOther}"`, exports.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
exports.MidwayDuplicateControllerOptionsError = MidwayDuplicateControllerOptionsError;
|
|
132
139
|
//# sourceMappingURL=framework.js.map
|
package/dist/interface.d.ts
CHANGED
|
@@ -314,10 +314,7 @@ export declare type FunctionMiddleware<CTX, R, N = unknown> = N extends true ? (
|
|
|
314
314
|
export declare type ClassMiddleware<CTX, R, N> = new (...args: any[]) => IMiddleware<CTX, R, N>;
|
|
315
315
|
export declare type CommonMiddleware<CTX, R, N> = ClassMiddleware<CTX, R, N> | FunctionMiddleware<CTX, R, N>;
|
|
316
316
|
export declare type CommonMiddlewareUnion<CTX, R, N> = CommonMiddleware<CTX, R, N> | Array<CommonMiddleware<CTX, R, N>>;
|
|
317
|
-
export declare type MiddlewareRespond<CTX, R, N> = (context: CTX, nextOrRes?: N extends true ? R : NextFunction, next?: N) => Promise<
|
|
318
|
-
result: any;
|
|
319
|
-
error: Error | undefined;
|
|
320
|
-
}>;
|
|
317
|
+
export declare type MiddlewareRespond<CTX, R, N> = (context: CTX, nextOrRes?: N extends true ? R : NextFunction, next?: N) => Promise<any>;
|
|
321
318
|
/**
|
|
322
319
|
* Common Exception Filter definition
|
|
323
320
|
*/
|
|
@@ -113,6 +113,15 @@ let MidwayWebRouterService = class MidwayWebRouterService {
|
|
|
113
113
|
routerModule: controllerClz,
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
+
else {
|
|
117
|
+
// 不同的 controller,可能会有相同的 prefix,一旦 options 不同,就要报错
|
|
118
|
+
if (middleware) {
|
|
119
|
+
const originRoute = this.routesPriority.filter(el => {
|
|
120
|
+
return el.prefix === prefix;
|
|
121
|
+
})[0];
|
|
122
|
+
throw new error_1.MidwayDuplicateControllerOptionsError(prefix, controllerId, originRoute.controllerId);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
116
125
|
// set ignorePrefix
|
|
117
126
|
if (!this.routes.has(ignorePrefix)) {
|
|
118
127
|
this.routes.set(ignorePrefix, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.3",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@midwayjs/decorator": "^3.4.0-beta.
|
|
24
|
+
"@midwayjs/decorator": "^3.4.0-beta.3",
|
|
25
25
|
"koa": "2.13.4",
|
|
26
26
|
"midway-test-component": "*",
|
|
27
27
|
"mm": "3.2.0",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=12"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "ddbff5c3da5d908953cc691a8e5de4f0197de365"
|
|
49
49
|
}
|