@midwayjs/faas 3.4.0-beta.5 → 3.4.0-beta.8

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.
@@ -11,7 +11,6 @@ export declare class MidwayFaaSFramework extends BaseFramework<Application, Cont
11
11
  app: Application;
12
12
  private isReplaceLogger;
13
13
  private developmentRun;
14
- private serverlessRoutes;
15
14
  private server;
16
15
  private respond;
17
16
  private applicationAdapter;
package/dist/framework.js CHANGED
@@ -26,7 +26,6 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
26
26
  this.lock = new simple_lock_1.default();
27
27
  this.isReplaceLogger = process.env['MIDWAY_SERVERLESS_REPLACE_LOGGER'] === 'true';
28
28
  this.developmentRun = false;
29
- this.serverlessRoutes = [];
30
29
  this.httpMiddlewareManager = this.createMiddlewareManager();
31
30
  this.eventMiddlewareManager = this.createMiddlewareManager();
32
31
  this.legacyVersion = false;
@@ -128,13 +127,6 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
128
127
  for (const funcInfo of functionList) {
129
128
  // store handler
130
129
  this.funMappingStore.set(funcInfo.funcHandlerName, funcInfo);
131
- if (funcInfo.url) {
132
- // store router
133
- this.serverlessRoutes.push({
134
- matchPattern: (0, core_1.pathToRegexp)(funcInfo.url, [], { end: false }),
135
- funcInfo: funcInfo,
136
- });
137
- }
138
130
  }
139
131
  this.respond = this.app.callback();
140
132
  }, LOCK_KEY);
@@ -198,12 +190,10 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
198
190
  var _a;
199
191
  const isHttpFunction = options.isHttpFunction;
200
192
  if (!funOptions && isHttpFunction) {
201
- for (const item of this.serverlessRoutes) {
202
- if (context.method === item.funcInfo['requestMethod'].toUpperCase() &&
203
- item.matchPattern.test(context.path)) {
204
- funOptions = item.funcInfo;
205
- break;
206
- }
193
+ funOptions = await this.serverlessFunctionService.getMatchedRouterInfo(context.path, context.method);
194
+ if (funOptions) {
195
+ const matchRes = core_1.PathToRegexpUtil.match(funOptions.fullUrlFlattenString)(context.path);
196
+ context.req.pathParameters = matchRes['params'] || {};
207
197
  }
208
198
  }
209
199
  if (!funOptions) {
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@midwayjs/faas",
3
- "version": "3.4.0-beta.5",
3
+ "version": "3.4.0-beta.8",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "dependencies": {
7
- "@midwayjs/core": "^3.4.0-beta.5",
7
+ "@midwayjs/core": "^3.4.0-beta.8",
8
8
  "@midwayjs/faas-typings": "^3.3.5",
9
9
  "@midwayjs/logger": "^2.15.0",
10
- "@midwayjs/serverless-http-parser": "^3.4.0-beta.5",
10
+ "@midwayjs/serverless-http-parser": "^3.4.0-beta.8",
11
11
  "@midwayjs/simple-lock": "^1.1.4"
12
12
  },
13
13
  "devDependencies": {
14
- "@midwayjs/decorator": "^3.4.0-beta.5",
15
- "@midwayjs/mock": "^3.4.0-beta.5",
16
- "@midwayjs/serverless-fc-starter": "^3.4.0-beta.5",
17
- "@midwayjs/serverless-scf-starter": "^3.4.0-beta.5",
14
+ "@midwayjs/decorator": "^3.4.0-beta.8",
15
+ "@midwayjs/mock": "^3.4.0-beta.8",
16
+ "@midwayjs/serverless-fc-starter": "^3.4.0-beta.8",
17
+ "@midwayjs/serverless-scf-starter": "^3.4.0-beta.8",
18
18
  "mm": "3.2.0"
19
19
  },
20
20
  "engines": {
@@ -46,5 +46,5 @@
46
46
  "url": "git@github.com:midwayjs/midway.git"
47
47
  },
48
48
  "license": "MIT",
49
- "gitHead": "d84d1c77aed1fd973d002ab65cd0adeadb7924a6"
49
+ "gitHead": "9e4ed69eca31022e4dc93ed52ac503fe25ae383e"
50
50
  }