@midwayjs/core 3.8.0 → 3.10.0
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/baseFramework.d.ts +5 -2
- package/dist/baseFramework.js +17 -0
- package/dist/common/applicationManager.d.ts +1 -2
- package/dist/common/applicationManager.js +2 -1
- package/dist/common/dataSourceManager.d.ts +1 -0
- package/dist/common/dataSourceManager.js +14 -12
- package/dist/common/loggerFactory.d.ts +8 -0
- package/dist/common/loggerFactory.js +7 -0
- package/dist/common/serviceFactory.d.ts +3 -2
- package/dist/common/webGenerator.js +2 -1
- package/dist/config/config.default.js +2 -1
- package/dist/constants.d.ts +1 -11
- package/dist/constants.js +2 -12
- package/dist/context/container.d.ts +1 -2
- package/dist/context/container.js +3 -3
- package/dist/context/definitionRegistry.d.ts +1 -5
- package/dist/context/managedResolverFactory.d.ts +1 -2
- package/dist/context/managedResolverFactory.js +2 -3
- package/dist/context/providerWrapper.d.ts +1 -2
- package/dist/decorator/common/aspect.d.ts +0 -18
- package/dist/decorator/common/aspect.js +2 -1
- package/dist/decorator/common/filter.d.ts +1 -1
- package/dist/decorator/common/filter.js +1 -1
- package/dist/decorator/common/framework.d.ts +1 -1
- package/dist/decorator/common/framework.js +2 -1
- package/dist/decorator/common/guard.js +1 -1
- package/dist/decorator/common/inject.d.ts +2 -1
- package/dist/decorator/common/inject.js +9 -1
- package/dist/decorator/common/middleware.js +2 -1
- package/dist/decorator/common/mock.d.ts +2 -0
- package/dist/decorator/common/mock.js +14 -0
- package/dist/decorator/common/objectDef.d.ts +2 -1
- package/dist/decorator/common/objectDef.js +10 -1
- package/dist/decorator/common/pipe.d.ts +2 -0
- package/dist/decorator/common/pipe.js +13 -0
- package/dist/decorator/common/pipeline.d.ts +1 -1
- package/dist/decorator/common/provide.d.ts +1 -1
- package/dist/decorator/constant.d.ts +2 -0
- package/dist/decorator/constant.js +4 -2
- package/dist/decorator/decoratorManager.d.ts +6 -10
- package/dist/decorator/decoratorManager.js +20 -8
- package/dist/decorator/faas/serverlessTrigger.d.ts +3 -1
- package/dist/decorator/faas/serverlessTrigger.js +3 -2
- package/dist/decorator/index.d.ts +2 -1
- package/dist/decorator/index.js +2 -1
- package/dist/decorator/microservice/consumer.d.ts +1 -1
- package/dist/decorator/microservice/consumer.js +2 -1
- package/dist/decorator/microservice/kafkaListener.d.ts +3 -3
- package/dist/decorator/microservice/provider.d.ts +1 -1
- package/dist/decorator/microservice/provider.js +2 -1
- package/dist/decorator/rpc/hsf.d.ts +1 -0
- package/dist/decorator/rpc/hsf.js +3 -1
- package/dist/decorator/task/schedule.js +2 -1
- package/dist/decorator/web/controller.d.ts +1 -1
- package/dist/decorator/web/controller.js +2 -1
- package/dist/decorator/web/requestMapping.d.ts +1 -4
- package/dist/decorator/ws/webSocketController.d.ts +1 -1
- package/dist/decorator/ws/webSocketController.js +2 -1
- package/dist/decorator/ws/webSocketEvent.d.ts +1 -1
- package/dist/definitions/functionDefinition.d.ts +1 -2
- package/dist/definitions/functionDefinition.js +4 -4
- package/dist/definitions/objectDefinition.d.ts +1 -2
- package/dist/definitions/objectDefinition.js +4 -4
- package/dist/definitions/properties.d.ts +1 -2
- package/dist/error/base.d.ts +2 -2
- package/dist/error/framework.d.ts +1 -1
- package/dist/error/framework.js +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interface.d.ts +344 -25
- package/dist/interface.js +64 -1
- package/dist/service/aspectService.d.ts +1 -2
- package/dist/service/aspectService.js +2 -1
- package/dist/service/configService.js +2 -1
- package/dist/service/decoratorService.d.ts +3 -1
- package/dist/service/decoratorService.js +64 -12
- package/dist/service/environmentService.js +2 -1
- package/dist/service/frameworkService.d.ts +1 -2
- package/dist/service/frameworkService.js +21 -1
- package/dist/service/informationService.js +2 -1
- package/dist/service/lifeCycleService.d.ts +2 -0
- package/dist/service/lifeCycleService.js +14 -4
- package/dist/service/loggerService.d.ts +11 -7
- package/dist/service/loggerService.js +31 -9
- package/dist/service/middlewareService.js +2 -1
- package/dist/service/mockService.d.ts +9 -1
- package/dist/service/mockService.js +43 -1
- package/dist/service/pipelineService.d.ts +2 -3
- package/dist/service/slsFunctionService.d.ts +1 -1
- package/dist/service/slsFunctionService.js +3 -2
- package/dist/service/webRouterService.d.ts +1 -1
- package/dist/service/webRouterService.js +3 -2
- package/dist/setup.js +6 -2
- package/dist/util/camelCase.js +8 -5
- package/dist/util/httpclient.d.ts +2 -2
- package/dist/util/pathToRegexp.d.ts +5 -5
- package/dist/util/webRouterParam.d.ts +2 -4
- package/dist/util/webRouterParam.js +5 -27
- package/package.json +5 -6
- package/dist/decorator/interface.d.ts +0 -242
- package/dist/decorator/interface.js +0 -66
package/dist/setup.js
CHANGED
|
@@ -6,7 +6,6 @@ const config_default_1 = require("./config/config.default");
|
|
|
6
6
|
const decorator_1 = require("./decorator");
|
|
7
7
|
const util = require("util");
|
|
8
8
|
const path_1 = require("path");
|
|
9
|
-
const logger_1 = require("@midwayjs/logger");
|
|
10
9
|
const slsFunctionService_1 = require("./service/slsFunctionService");
|
|
11
10
|
const debug = util.debuglog('midway:debug');
|
|
12
11
|
/**
|
|
@@ -18,6 +17,7 @@ async function initializeGlobalApplicationContext(globalOptions) {
|
|
|
18
17
|
// init logger
|
|
19
18
|
const loggerService = await applicationContext.getAsync(_1.MidwayLoggerService, [
|
|
20
19
|
applicationContext,
|
|
20
|
+
globalOptions,
|
|
21
21
|
]);
|
|
22
22
|
if (loggerService.getLogger('appLogger')) {
|
|
23
23
|
// register global logger
|
|
@@ -32,6 +32,8 @@ async function initializeGlobalApplicationContext(globalOptions) {
|
|
|
32
32
|
await applicationContext.getAsync(_1.MidwayLifeCycleService, [
|
|
33
33
|
applicationContext,
|
|
34
34
|
]);
|
|
35
|
+
// mock support
|
|
36
|
+
await applicationContext.get(_1.MidwayMockService, [applicationContext]);
|
|
35
37
|
// some preload module init
|
|
36
38
|
const modules = (0, decorator_1.listPreloadModule)();
|
|
37
39
|
for (const module of modules) {
|
|
@@ -42,13 +44,15 @@ async function initializeGlobalApplicationContext(globalOptions) {
|
|
|
42
44
|
}
|
|
43
45
|
exports.initializeGlobalApplicationContext = initializeGlobalApplicationContext;
|
|
44
46
|
async function destroyGlobalApplicationContext(applicationContext) {
|
|
47
|
+
const loggerService = await applicationContext.getAsync(_1.MidwayLoggerService);
|
|
48
|
+
const loggerFactory = loggerService.getCurrentLoggerFactory();
|
|
45
49
|
// stop lifecycle
|
|
46
50
|
const lifecycleService = await applicationContext.getAsync(_1.MidwayLifeCycleService);
|
|
47
51
|
await lifecycleService.stop();
|
|
48
52
|
// stop container
|
|
49
53
|
await applicationContext.stop();
|
|
50
54
|
(0, decorator_1.clearBindContainer)();
|
|
51
|
-
|
|
55
|
+
loggerFactory.close();
|
|
52
56
|
global['MIDWAY_APPLICATION_CONTEXT'] = undefined;
|
|
53
57
|
global['MIDWAY_MAIN_FRAMEWORK'] = undefined;
|
|
54
58
|
}
|
package/dist/util/camelCase.js
CHANGED
|
@@ -12,19 +12,19 @@ const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
|
|
12
12
|
let isLastCharLower = false;
|
|
13
13
|
let isLastCharUpper = false;
|
|
14
14
|
let isLastLastCharUpper = false;
|
|
15
|
-
for (let
|
|
16
|
-
const character = string[
|
|
15
|
+
for (let index = 0; index < string.length; index++) {
|
|
16
|
+
const character = string[index];
|
|
17
17
|
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
18
|
-
string = string.slice(0,
|
|
18
|
+
string = string.slice(0, index) + '-' + string.slice(index);
|
|
19
19
|
isLastCharLower = false;
|
|
20
20
|
isLastLastCharUpper = isLastCharUpper;
|
|
21
21
|
isLastCharUpper = true;
|
|
22
|
-
|
|
22
|
+
index++;
|
|
23
23
|
}
|
|
24
24
|
else if (isLastCharUpper &&
|
|
25
25
|
isLastLastCharUpper &&
|
|
26
26
|
LOWERCASE.test(character)) {
|
|
27
|
-
string = string.slice(0,
|
|
27
|
+
string = string.slice(0, index - 1) + '-' + string.slice(index - 1);
|
|
28
28
|
isLastLastCharUpper = isLastCharUpper;
|
|
29
29
|
isLastCharUpper = false;
|
|
30
30
|
isLastCharLower = true;
|
|
@@ -60,6 +60,9 @@ function camelCaseOrigin(input, options) {
|
|
|
60
60
|
const toLowerCase = string => string.toLowerCase();
|
|
61
61
|
const toUpperCase = string => string.toUpperCase();
|
|
62
62
|
if (input.length === 1) {
|
|
63
|
+
if (SEPARATORS.test(input)) {
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
63
66
|
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
64
67
|
}
|
|
65
68
|
const hasUpperCase = input !== toLowerCase(input);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import http = require('http');
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
type MethodType = 'GET' | 'POST';
|
|
5
|
+
type MimeType = 'text' | 'json' | undefined;
|
|
6
6
|
interface IOptions {
|
|
7
7
|
method?: MethodType;
|
|
8
8
|
headers?: any;
|
|
@@ -30,7 +30,7 @@ interface TokensToFunctionOptions {
|
|
|
30
30
|
* Compile a string to a template function for the path.
|
|
31
31
|
*/
|
|
32
32
|
declare function compile<P extends object = object>(str: string, options?: ParseOptions & TokensToFunctionOptions): PathFunction<P>;
|
|
33
|
-
|
|
33
|
+
type PathFunction<P extends object = object> = (data?: P) => string;
|
|
34
34
|
interface RegexpToFunctionOptions {
|
|
35
35
|
/**
|
|
36
36
|
* Function for decoding strings for params.
|
|
@@ -48,11 +48,11 @@ interface MatchResult<P extends object = object> {
|
|
|
48
48
|
/**
|
|
49
49
|
* A match is either `false` (no match) or a match result.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
type Match<P extends object = object> = false | MatchResult<P>;
|
|
52
52
|
/**
|
|
53
53
|
* The match function takes a string and returns whether it matched the path.
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
type MatchFunction<P extends object = object> = (path: string) => Match<P>;
|
|
56
56
|
/**
|
|
57
57
|
* Create path match function from `path-to-regexp` spec.
|
|
58
58
|
*/
|
|
@@ -70,7 +70,7 @@ interface Key {
|
|
|
70
70
|
/**
|
|
71
71
|
* A token is a string (nothing special) or key metadata (capture group).
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
type Token = string | Key;
|
|
74
74
|
interface TokensToRegexpOptions {
|
|
75
75
|
/**
|
|
76
76
|
* When `true` the regexp will be case sensitive. (default: `false`)
|
|
@@ -104,7 +104,7 @@ interface TokensToRegexpOptions {
|
|
|
104
104
|
/**
|
|
105
105
|
* Supported `path-to-regexp` input types.
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
type Path = string | RegExp | Array<string | RegExp>;
|
|
108
108
|
/**
|
|
109
109
|
* Normalize the given path string, returning a regular expression.
|
|
110
110
|
*
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
export declare const extractKoaLikeValue: (key: any, data: any, paramType?: any, pipes?: PipeTransform[]) => (ctx: any, next: any) => Promise<any>;
|
|
4
|
-
export declare const extractExpressLikeValue: (key: any, data: any, paramType?: any, pipes?: PipeTransform[]) => (req: any, res: any, next: any) => Promise<any>;
|
|
1
|
+
export declare const extractKoaLikeValue: (key: any, data: any, paramType?: any) => (ctx: any, next: any) => any;
|
|
2
|
+
export declare const extractExpressLikeValue: (key: any, data: any, paramType?: any) => (req: any, res: any, next: any) => any;
|
|
5
3
|
//# sourceMappingURL=webRouterParam.d.ts.map
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractExpressLikeValue = exports.extractKoaLikeValue =
|
|
3
|
+
exports.extractExpressLikeValue = exports.extractKoaLikeValue = void 0;
|
|
4
4
|
const decorator_1 = require("../decorator");
|
|
5
5
|
const index_1 = require("./index");
|
|
6
|
-
|
|
7
|
-
if (pipes && pipes.length) {
|
|
8
|
-
for (const pipe of pipes) {
|
|
9
|
-
if ('transform' in pipe) {
|
|
10
|
-
value = await pipe.transform(value);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
value = await pipe(value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
exports.callPipes = callPipes;
|
|
20
|
-
const extractKoaLikeValue = (key, data, paramType, pipes) => {
|
|
6
|
+
const extractKoaLikeValue = (key, data, paramType) => {
|
|
21
7
|
if (decorator_1.ALL === data) {
|
|
22
8
|
data = undefined;
|
|
23
9
|
}
|
|
24
|
-
|
|
10
|
+
return function (ctx, next) {
|
|
25
11
|
switch (key) {
|
|
26
12
|
case decorator_1.RouteParamTypes.NEXT:
|
|
27
13
|
return next;
|
|
@@ -74,17 +60,13 @@ const extractKoaLikeValue = (key, data, paramType, pipes) => {
|
|
|
74
60
|
return null;
|
|
75
61
|
}
|
|
76
62
|
};
|
|
77
|
-
return async function (ctx, next) {
|
|
78
|
-
const result = await value(ctx, next);
|
|
79
|
-
return await callPipes(pipes || [], result);
|
|
80
|
-
};
|
|
81
63
|
};
|
|
82
64
|
exports.extractKoaLikeValue = extractKoaLikeValue;
|
|
83
|
-
const extractExpressLikeValue = (key, data, paramType
|
|
65
|
+
const extractExpressLikeValue = (key, data, paramType) => {
|
|
84
66
|
if (decorator_1.ALL === data) {
|
|
85
67
|
data = undefined;
|
|
86
68
|
}
|
|
87
|
-
|
|
69
|
+
return function (req, res, next) {
|
|
88
70
|
switch (key) {
|
|
89
71
|
case decorator_1.RouteParamTypes.NEXT:
|
|
90
72
|
return next;
|
|
@@ -121,10 +103,6 @@ const extractExpressLikeValue = (key, data, paramType, pipes) => {
|
|
|
121
103
|
return null;
|
|
122
104
|
}
|
|
123
105
|
};
|
|
124
|
-
return async function (req, res, next) {
|
|
125
|
-
const result = await value(req, res, next);
|
|
126
|
-
return await callPipes(pipes || [], result);
|
|
127
|
-
};
|
|
128
106
|
};
|
|
129
107
|
exports.extractExpressLikeValue = extractExpressLikeValue;
|
|
130
108
|
//# sourceMappingURL=webRouterParam.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.0",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -22,11 +22,10 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"koa": "2.
|
|
26
|
-
"mm": "3.2.
|
|
27
|
-
"pg": "8.8.0",
|
|
25
|
+
"koa": "2.14.1",
|
|
26
|
+
"mm": "3.2.1",
|
|
28
27
|
"raw-body": "2.5.1",
|
|
29
|
-
"sinon": "
|
|
28
|
+
"sinon": "15.0.1"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
31
|
"@midwayjs/glob": "^1.0.2",
|
|
@@ -43,5 +42,5 @@
|
|
|
43
42
|
"engines": {
|
|
44
43
|
"node": ">=12"
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "33d28f1a020963404488e866432916fd15c0952c"
|
|
47
46
|
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
export declare type MiddlewareParamArray = Array<string | any>;
|
|
2
|
-
export declare type ObjectIdentifier = string | Symbol;
|
|
3
|
-
export declare type GroupModeType = 'one' | 'multi';
|
|
4
|
-
export declare enum ScopeEnum {
|
|
5
|
-
Singleton = "Singleton",
|
|
6
|
-
Request = "Request",
|
|
7
|
-
Prototype = "Prototype"
|
|
8
|
-
}
|
|
9
|
-
export declare enum InjectModeEnum {
|
|
10
|
-
Identifier = "Identifier",
|
|
11
|
-
Class = "Class",
|
|
12
|
-
PropertyName = "PropertyName"
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 内部管理的属性、json、ref等解析实例存储
|
|
16
|
-
*/
|
|
17
|
-
export interface IManagedInstance {
|
|
18
|
-
type: string;
|
|
19
|
-
value?: any;
|
|
20
|
-
args?: any;
|
|
21
|
-
}
|
|
22
|
-
export interface ObjectDefinitionOptions {
|
|
23
|
-
isAsync?: boolean;
|
|
24
|
-
initMethod?: string;
|
|
25
|
-
destroyMethod?: string;
|
|
26
|
-
scope?: ScopeEnum;
|
|
27
|
-
constructorArgs?: any[];
|
|
28
|
-
namespace?: string;
|
|
29
|
-
srcPath?: string;
|
|
30
|
-
allowDowngrade?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface TagPropsMetadata {
|
|
33
|
-
key: string | number | symbol;
|
|
34
|
-
value: any;
|
|
35
|
-
args?: any;
|
|
36
|
-
}
|
|
37
|
-
export interface TagClsMetadata {
|
|
38
|
-
id: string;
|
|
39
|
-
originName: string;
|
|
40
|
-
uuid: string;
|
|
41
|
-
name: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ReflectResult {
|
|
44
|
-
[key: string]: any[];
|
|
45
|
-
}
|
|
46
|
-
export declare enum MSProviderType {
|
|
47
|
-
DUBBO = "dubbo",
|
|
48
|
-
GRPC = "gRPC"
|
|
49
|
-
}
|
|
50
|
-
export declare enum MSListenerType {
|
|
51
|
-
RABBITMQ = "rabbitmq",
|
|
52
|
-
MQTT = "mqtt",
|
|
53
|
-
KAFKA = "kafka",
|
|
54
|
-
REDIS = "redis"
|
|
55
|
-
}
|
|
56
|
-
export declare namespace ConsumerMetadata {
|
|
57
|
-
interface ConsumerMetadata {
|
|
58
|
-
type: MSListenerType;
|
|
59
|
-
metadata: any;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* grpc decorator metadata format
|
|
64
|
-
*/
|
|
65
|
-
export declare namespace GRPCMetadata {
|
|
66
|
-
interface ProviderOptions {
|
|
67
|
-
serviceName?: string;
|
|
68
|
-
package?: string;
|
|
69
|
-
}
|
|
70
|
-
interface ProviderMetadata {
|
|
71
|
-
type: MSProviderType;
|
|
72
|
-
metadata: ProviderOptions;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export declare namespace FaaSMetadata {
|
|
76
|
-
export interface ServerlessFunctionOptions {
|
|
77
|
-
/**
|
|
78
|
-
* function name
|
|
79
|
-
*/
|
|
80
|
-
functionName?: string;
|
|
81
|
-
/**
|
|
82
|
-
* function description
|
|
83
|
-
*/
|
|
84
|
-
description?: string;
|
|
85
|
-
/**
|
|
86
|
-
* function memory size, unit: M
|
|
87
|
-
*/
|
|
88
|
-
memorySize?: number;
|
|
89
|
-
/**
|
|
90
|
-
* function timeout value, unit: seconds
|
|
91
|
-
*/
|
|
92
|
-
timeout?: number;
|
|
93
|
-
/**
|
|
94
|
-
* function init timeout, just for aliyun
|
|
95
|
-
*/
|
|
96
|
-
initTimeout?: number;
|
|
97
|
-
/**
|
|
98
|
-
* function runtime, nodejs10, nodejs12, nodejs14
|
|
99
|
-
*/
|
|
100
|
-
runtime?: string;
|
|
101
|
-
/**
|
|
102
|
-
* invoke concurrency, just for aliyun
|
|
103
|
-
*/
|
|
104
|
-
concurrency?: number;
|
|
105
|
-
/**
|
|
106
|
-
* function invoke stage, like env, just for tencent
|
|
107
|
-
*/
|
|
108
|
-
stage?: string;
|
|
109
|
-
/**
|
|
110
|
-
* environment variable, key-value
|
|
111
|
-
*/
|
|
112
|
-
environment?: any;
|
|
113
|
-
/**
|
|
114
|
-
* deploy or not
|
|
115
|
-
*/
|
|
116
|
-
isDeploy?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* function handler name, like 'index.handler'
|
|
119
|
-
*/
|
|
120
|
-
handlerName?: string;
|
|
121
|
-
}
|
|
122
|
-
interface TriggerCommonOptions {
|
|
123
|
-
/**
|
|
124
|
-
* function name
|
|
125
|
-
*/
|
|
126
|
-
functionName?: string;
|
|
127
|
-
/**
|
|
128
|
-
* serverless event name
|
|
129
|
-
*/
|
|
130
|
-
name?: string;
|
|
131
|
-
/**
|
|
132
|
-
* function invoke role, just for aliyun
|
|
133
|
-
*/
|
|
134
|
-
role?: string;
|
|
135
|
-
/**
|
|
136
|
-
* function publish version, just for aliyun
|
|
137
|
-
*/
|
|
138
|
-
version?: string;
|
|
139
|
-
/**
|
|
140
|
-
* deploy or not
|
|
141
|
-
*/
|
|
142
|
-
isDeploy?: boolean;
|
|
143
|
-
/**
|
|
144
|
-
* function middleware
|
|
145
|
-
*/
|
|
146
|
-
middleware?: any[];
|
|
147
|
-
}
|
|
148
|
-
export interface EventTriggerOptions extends TriggerCommonOptions {
|
|
149
|
-
}
|
|
150
|
-
export interface HTTPTriggerOptions extends TriggerCommonOptions {
|
|
151
|
-
path: string;
|
|
152
|
-
method?: 'get' | 'post' | 'delete' | 'put' | 'head' | 'patch' | 'all';
|
|
153
|
-
}
|
|
154
|
-
export interface APIGatewayTriggerOptions extends HTTPTriggerOptions {
|
|
155
|
-
}
|
|
156
|
-
export interface OSTriggerOptions extends TriggerCommonOptions {
|
|
157
|
-
bucket: string;
|
|
158
|
-
events: string | string[];
|
|
159
|
-
filter?: {
|
|
160
|
-
prefix: string;
|
|
161
|
-
suffix: string;
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
export interface LogTriggerOptions extends TriggerCommonOptions {
|
|
165
|
-
source: string;
|
|
166
|
-
project: string;
|
|
167
|
-
log: string;
|
|
168
|
-
retryTime?: number;
|
|
169
|
-
interval?: number;
|
|
170
|
-
}
|
|
171
|
-
export interface TimerTriggerOptions extends TriggerCommonOptions {
|
|
172
|
-
type: 'cron' | 'every' | 'interval';
|
|
173
|
-
value: string;
|
|
174
|
-
payload?: string;
|
|
175
|
-
enable?: boolean;
|
|
176
|
-
}
|
|
177
|
-
export interface MQTriggerOptions extends TriggerCommonOptions {
|
|
178
|
-
topic: string;
|
|
179
|
-
tags?: string;
|
|
180
|
-
region?: string;
|
|
181
|
-
strategy?: 'BACKOFF_RETRY' | 'EXPONENTIAL_DECAY_RETRY';
|
|
182
|
-
}
|
|
183
|
-
export interface HSFTriggerOptions extends TriggerCommonOptions {
|
|
184
|
-
}
|
|
185
|
-
export interface MTopTriggerOptions extends TriggerCommonOptions {
|
|
186
|
-
}
|
|
187
|
-
export interface CDNTriggerOptions extends TriggerCommonOptions {
|
|
188
|
-
}
|
|
189
|
-
export type EventTriggerUnionOptions = EventTriggerOptions | HTTPTriggerOptions | APIGatewayTriggerOptions | OSTriggerOptions | CDNTriggerOptions | LogTriggerOptions | TimerTriggerOptions | MQTriggerOptions | HSFTriggerOptions | MTopTriggerOptions;
|
|
190
|
-
export interface TriggerMetadata {
|
|
191
|
-
type: ServerlessTriggerType;
|
|
192
|
-
functionName?: string;
|
|
193
|
-
handlerName?: string;
|
|
194
|
-
methodName?: string;
|
|
195
|
-
metadata: EventTriggerUnionOptions;
|
|
196
|
-
}
|
|
197
|
-
export {};
|
|
198
|
-
}
|
|
199
|
-
export declare abstract class FrameworkType {
|
|
200
|
-
abstract name: string;
|
|
201
|
-
}
|
|
202
|
-
export declare class MidwayFrameworkType extends FrameworkType {
|
|
203
|
-
name: string;
|
|
204
|
-
static WEB: MidwayFrameworkType;
|
|
205
|
-
static WEB_KOA: MidwayFrameworkType;
|
|
206
|
-
static WEB_EXPRESS: MidwayFrameworkType;
|
|
207
|
-
static FAAS: MidwayFrameworkType;
|
|
208
|
-
static MS_GRPC: MidwayFrameworkType;
|
|
209
|
-
static MS_RABBITMQ: MidwayFrameworkType;
|
|
210
|
-
static MS_KAFKA: MidwayFrameworkType;
|
|
211
|
-
static WS_IO: MidwayFrameworkType;
|
|
212
|
-
static WS: MidwayFrameworkType;
|
|
213
|
-
static SERVERLESS_APP: MidwayFrameworkType;
|
|
214
|
-
static CUSTOM: MidwayFrameworkType;
|
|
215
|
-
static EMPTY: MidwayFrameworkType;
|
|
216
|
-
static LIGHT: MidwayFrameworkType;
|
|
217
|
-
static TASK: MidwayFrameworkType;
|
|
218
|
-
constructor(name: string);
|
|
219
|
-
}
|
|
220
|
-
export declare enum ServerlessTriggerType {
|
|
221
|
-
EVENT = "event",
|
|
222
|
-
HTTP = "http",
|
|
223
|
-
API_GATEWAY = "apigw",
|
|
224
|
-
OS = "os",
|
|
225
|
-
CDN = "cdn",
|
|
226
|
-
LOG = "log",
|
|
227
|
-
TIMER = "timer",
|
|
228
|
-
MQ = "mq",
|
|
229
|
-
KAFKA = "kafka",
|
|
230
|
-
HSF = "hsf",
|
|
231
|
-
MTOP = "mtop"
|
|
232
|
-
}
|
|
233
|
-
export interface IModuleStore {
|
|
234
|
-
listModule(key: string): any;
|
|
235
|
-
saveModule(key: string, module: any): any;
|
|
236
|
-
transformModule?(moduleMap: Map<string, Set<any>>): any;
|
|
237
|
-
}
|
|
238
|
-
export interface PipeTransform<T = any, R = any> {
|
|
239
|
-
transform(value: T): R;
|
|
240
|
-
}
|
|
241
|
-
export declare type PipeTransformFunction<T = any, R = any> = (value: T) => R;
|
|
242
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerlessTriggerType = exports.MidwayFrameworkType = exports.FrameworkType = exports.MSListenerType = exports.MSProviderType = exports.InjectModeEnum = exports.ScopeEnum = void 0;
|
|
4
|
-
var ScopeEnum;
|
|
5
|
-
(function (ScopeEnum) {
|
|
6
|
-
ScopeEnum["Singleton"] = "Singleton";
|
|
7
|
-
ScopeEnum["Request"] = "Request";
|
|
8
|
-
ScopeEnum["Prototype"] = "Prototype";
|
|
9
|
-
})(ScopeEnum = exports.ScopeEnum || (exports.ScopeEnum = {}));
|
|
10
|
-
var InjectModeEnum;
|
|
11
|
-
(function (InjectModeEnum) {
|
|
12
|
-
InjectModeEnum["Identifier"] = "Identifier";
|
|
13
|
-
InjectModeEnum["Class"] = "Class";
|
|
14
|
-
InjectModeEnum["PropertyName"] = "PropertyName";
|
|
15
|
-
})(InjectModeEnum = exports.InjectModeEnum || (exports.InjectModeEnum = {}));
|
|
16
|
-
var MSProviderType;
|
|
17
|
-
(function (MSProviderType) {
|
|
18
|
-
MSProviderType["DUBBO"] = "dubbo";
|
|
19
|
-
MSProviderType["GRPC"] = "gRPC";
|
|
20
|
-
})(MSProviderType = exports.MSProviderType || (exports.MSProviderType = {}));
|
|
21
|
-
var MSListenerType;
|
|
22
|
-
(function (MSListenerType) {
|
|
23
|
-
MSListenerType["RABBITMQ"] = "rabbitmq";
|
|
24
|
-
MSListenerType["MQTT"] = "mqtt";
|
|
25
|
-
MSListenerType["KAFKA"] = "kafka";
|
|
26
|
-
MSListenerType["REDIS"] = "redis";
|
|
27
|
-
})(MSListenerType = exports.MSListenerType || (exports.MSListenerType = {}));
|
|
28
|
-
class FrameworkType {
|
|
29
|
-
}
|
|
30
|
-
exports.FrameworkType = FrameworkType;
|
|
31
|
-
class MidwayFrameworkType extends FrameworkType {
|
|
32
|
-
constructor(name) {
|
|
33
|
-
super();
|
|
34
|
-
this.name = name;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.MidwayFrameworkType = MidwayFrameworkType;
|
|
38
|
-
MidwayFrameworkType.WEB = new MidwayFrameworkType('@midwayjs/web');
|
|
39
|
-
MidwayFrameworkType.WEB_KOA = new MidwayFrameworkType('@midwayjs/web-koa');
|
|
40
|
-
MidwayFrameworkType.WEB_EXPRESS = new MidwayFrameworkType('@midwayjs/express');
|
|
41
|
-
MidwayFrameworkType.FAAS = new MidwayFrameworkType('@midwayjs/faas');
|
|
42
|
-
MidwayFrameworkType.MS_GRPC = new MidwayFrameworkType('@midwayjs/grpc');
|
|
43
|
-
MidwayFrameworkType.MS_RABBITMQ = new MidwayFrameworkType('@midwayjs/rabbitmq');
|
|
44
|
-
MidwayFrameworkType.MS_KAFKA = new MidwayFrameworkType('@midwayjs/kafka');
|
|
45
|
-
MidwayFrameworkType.WS_IO = new MidwayFrameworkType('@midwayjs/socketio');
|
|
46
|
-
MidwayFrameworkType.WS = new MidwayFrameworkType('@midwayjs/ws');
|
|
47
|
-
MidwayFrameworkType.SERVERLESS_APP = new MidwayFrameworkType('@midwayjs/serverless-app');
|
|
48
|
-
MidwayFrameworkType.CUSTOM = new MidwayFrameworkType('');
|
|
49
|
-
MidwayFrameworkType.EMPTY = new MidwayFrameworkType('empty');
|
|
50
|
-
MidwayFrameworkType.LIGHT = new MidwayFrameworkType('light');
|
|
51
|
-
MidwayFrameworkType.TASK = new MidwayFrameworkType('@midwayjs/task');
|
|
52
|
-
var ServerlessTriggerType;
|
|
53
|
-
(function (ServerlessTriggerType) {
|
|
54
|
-
ServerlessTriggerType["EVENT"] = "event";
|
|
55
|
-
ServerlessTriggerType["HTTP"] = "http";
|
|
56
|
-
ServerlessTriggerType["API_GATEWAY"] = "apigw";
|
|
57
|
-
ServerlessTriggerType["OS"] = "os";
|
|
58
|
-
ServerlessTriggerType["CDN"] = "cdn";
|
|
59
|
-
ServerlessTriggerType["LOG"] = "log";
|
|
60
|
-
ServerlessTriggerType["TIMER"] = "timer";
|
|
61
|
-
ServerlessTriggerType["MQ"] = "mq";
|
|
62
|
-
ServerlessTriggerType["KAFKA"] = "kafka";
|
|
63
|
-
ServerlessTriggerType["HSF"] = "hsf";
|
|
64
|
-
ServerlessTriggerType["MTOP"] = "mtop";
|
|
65
|
-
})(ServerlessTriggerType = exports.ServerlessTriggerType || (exports.ServerlessTriggerType = {}));
|
|
66
|
-
//# sourceMappingURL=interface.js.map
|