@midwayjs/faas 3.7.3 → 3.8.1

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.
@@ -32,7 +32,7 @@ export declare class MidwayFaaSFramework extends BaseFramework<Application, Cont
32
32
  * @param handlerMapping
33
33
  */
34
34
  handleInvokeWrapper(handlerMapping: string): (...args: any[]) => Promise<any>;
35
- getTriggerFunction(context: any, handlerMapping: string, options: HandlerOptions): Promise<any>;
35
+ invokeTriggerFunction(context: any, handlerMapping: string, options: HandlerOptions): Promise<any>;
36
36
  wrapHttpRequest(req: http.IncomingMessage | Record<string, any>, res?: http.ServerResponse): Promise<unknown>;
37
37
  /**
38
38
  * @deprecated
package/dist/framework.js CHANGED
@@ -107,20 +107,21 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
107
107
  }
108
108
  if (funcInfo) {
109
109
  return async (...args) => {
110
- const context = this.app.createAnonymousContext();
111
- return this.getTriggerFunction(context, funcInfo.funcHandlerName, {
112
- isHttpFunction: false,
110
+ const context = this.app.createAnonymousContext({
113
111
  originContext: customContext,
114
112
  originEvent: args[0],
115
113
  });
114
+ return this.invokeTriggerFunction(context, funcInfo.funcHandlerName, {
115
+ isHttpFunction: false,
116
+ });
116
117
  };
117
118
  }
118
119
  },
119
120
  });
120
121
  return instance;
121
122
  },
122
- getTriggerFunction: (context, handlerMapping, options) => {
123
- return this.getTriggerFunction(context, handlerMapping, options);
123
+ invokeTriggerFunction: (context, handlerMapping, options) => {
124
+ return this.invokeTriggerFunction(context, handlerMapping, options);
124
125
  },
125
126
  });
126
127
  // hack use method
@@ -214,7 +215,7 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
214
215
  return await composeMiddleware(context);
215
216
  };
216
217
  }
217
- async getTriggerFunction(context, handlerMapping, options) {
218
+ async invokeTriggerFunction(context, handlerMapping, options) {
218
219
  var _a, _b;
219
220
  let funOptions = this.funMappingStore.get(handlerMapping);
220
221
  const isHttpFunction = options.isHttpFunction;
@@ -245,7 +246,7 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
245
246
  args = [ctx];
246
247
  }
247
248
  else {
248
- args = [options.originEvent, options.originContext];
249
+ args = [ctx.originEvent, ctx.originContext];
249
250
  }
250
251
  // invoke handler
251
252
  const result = await this.invokeHandler(funOptions, ctx, args, isHttpFunction);
@@ -14,8 +14,6 @@ export interface FaaSContext extends IMidwayContext<FaaSHTTPContext> {
14
14
  export declare type FaaSMiddleware = ((context: Context, next: () => Promise<any>) => any) | string;
15
15
  export interface HandlerOptions {
16
16
  isHttpFunction: boolean;
17
- originEvent: any;
18
- originContext: any;
19
17
  }
20
18
  export declare type IMidwayFaaSApplication = IMidwayApplication<Context, {
21
19
  getInitializeContext(): any;
@@ -35,7 +33,7 @@ export declare type IMidwayFaaSApplication = IMidwayApplication<Context, {
35
33
  getFunctionServiceName(): string;
36
34
  useEventMiddleware(middleware: CommonMiddlewareUnion<Context, NextFunction, undefined>): void;
37
35
  getEventMiddleware(): ContextMiddlewareManager<Context, NextFunction, undefined>;
38
- getTriggerFunction(context: any, handler: string, options: HandlerOptions): Promise<any>;
36
+ invokeTriggerFunction(context: any, handler: string, options: HandlerOptions): Promise<any>;
39
37
  getServerlessInstance<T>(serviceClass: ObjectIdentifier | {
40
38
  new (...args: any[]): T;
41
39
  }, customContext?: any): Promise<T>;
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@midwayjs/faas",
3
- "version": "3.7.3",
3
+ "version": "3.8.1",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "dependencies": {
7
- "@midwayjs/core": "^3.7.0",
7
+ "@midwayjs/core": "^3.8.0",
8
8
  "@midwayjs/faas-typings": "^3.6.0",
9
9
  "@midwayjs/logger": "^2.15.0",
10
10
  "@midwayjs/serverless-http-parser": "^3.6.0",
11
11
  "@midwayjs/simple-lock": "^1.1.4"
12
12
  },
13
13
  "devDependencies": {
14
- "@midwayjs/mock": "^3.7.3",
15
- "@midwayjs/serverless-fc-starter": "^3.7.0",
14
+ "@midwayjs/mock": "^3.8.0",
15
+ "@midwayjs/serverless-fc-starter": "^3.8.0",
16
16
  "@midwayjs/serverless-scf-starter": "^3.7.0",
17
- "mm": "3.2.0"
17
+ "mm": "3.2.1"
18
18
  },
19
19
  "engines": {
20
20
  "node": ">=12"
@@ -45,5 +45,5 @@
45
45
  "url": "git@github.com:midwayjs/midway.git"
46
46
  },
47
47
  "license": "MIT",
48
- "gitHead": "8e6c830bca52818e0086873b542423d16e609aef"
48
+ "gitHead": "a603d2348d6141f8f723901498f03a162a037708"
49
49
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2013 - Now midwayjs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.