@midwayjs/faas 3.10.7 → 3.10.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.
- package/dist/framework.d.ts +3 -1
- package/dist/framework.js +10 -5
- package/dist/interface.d.ts +4 -1
- package/dist/starter.d.ts +2 -1
- package/package.json +2 -2
package/dist/framework.d.ts
CHANGED
|
@@ -33,7 +33,9 @@ export declare class MidwayFaaSFramework extends BaseFramework<Application, Cont
|
|
|
33
33
|
*/
|
|
34
34
|
handleInvokeWrapper(handlerMapping: string): (...args: any[]) => Promise<any>;
|
|
35
35
|
invokeTriggerFunction(context: any, handlerMapping: string, options: HandlerOptions): Promise<any>;
|
|
36
|
-
formatHttpResponse(context: any
|
|
36
|
+
formatHttpResponse(context: any, options?: {
|
|
37
|
+
supportBufferResponse?: boolean;
|
|
38
|
+
}): HttpResponseFormat;
|
|
37
39
|
wrapHttpRequest(req: http.IncomingMessage | Record<string, any>, res?: http.ServerResponse): Promise<unknown>;
|
|
38
40
|
/**
|
|
39
41
|
* @deprecated
|
package/dist/framework.js
CHANGED
|
@@ -247,14 +247,14 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
|
|
|
247
247
|
return context.body;
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
|
-
return this.formatHttpResponse(context);
|
|
250
|
+
return this.formatHttpResponse(context, options);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
else {
|
|
254
254
|
return result;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
formatHttpResponse(context) {
|
|
257
|
+
formatHttpResponse(context, options = {}) {
|
|
258
258
|
var _a;
|
|
259
259
|
if (!((_a = context.response) === null || _a === void 0 ? void 0 : _a._explicitStatus)) {
|
|
260
260
|
if (context.body === null || context.body === 'undefined') {
|
|
@@ -272,12 +272,17 @@ let MidwayFaaSFramework = class MidwayFaaSFramework extends core_1.BaseFramework
|
|
|
272
272
|
context.body = data;
|
|
273
273
|
}
|
|
274
274
|
else if (isAnyArrayBuffer(data) || isUint8Array(data)) {
|
|
275
|
-
encoded = true;
|
|
276
275
|
if (!context.type) {
|
|
277
276
|
context.type = 'application/octet-stream';
|
|
278
277
|
}
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
if (options.supportBufferResponse) {
|
|
279
|
+
context.body = data;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
encoded = true;
|
|
283
|
+
// data is reserved as buffer
|
|
284
|
+
context.body = Buffer.from(data).toString('base64');
|
|
285
|
+
}
|
|
281
286
|
}
|
|
282
287
|
else if (typeof data === 'object') {
|
|
283
288
|
if (!context.type) {
|
package/dist/interface.d.ts
CHANGED
|
@@ -12,7 +12,10 @@ export interface FaaSContext extends IMidwayContext<FaaSHTTPContext> {
|
|
|
12
12
|
* @deprecated
|
|
13
13
|
*/
|
|
14
14
|
export type FaaSMiddleware = ((context: Context, next: () => Promise<any>) => any) | string;
|
|
15
|
-
export interface
|
|
15
|
+
export interface FormatResponseOptions {
|
|
16
|
+
supportBufferResponse?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface HandlerOptions extends FormatResponseOptions {
|
|
16
19
|
isHttpFunction?: boolean;
|
|
17
20
|
isCustomHttpResponse?: boolean;
|
|
18
21
|
}
|
package/dist/starter.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ServerlessStarterOptions } from './interface';
|
|
2
2
|
import { IMidwayBootstrapOptions } from '@midwayjs/core';
|
|
3
|
+
import { MidwayFaaSFramework } from './framework';
|
|
3
4
|
export declare abstract class AbstractBootstrapStarter {
|
|
4
5
|
protected options: ServerlessStarterOptions;
|
|
5
6
|
protected applicationContext: any;
|
|
6
|
-
protected framework:
|
|
7
|
+
protected framework: MidwayFaaSFramework;
|
|
7
8
|
constructor(options?: ServerlessStarterOptions);
|
|
8
9
|
getApplicationContext(): any;
|
|
9
10
|
close(): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/faas",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.8",
|
|
4
4
|
"main": "dist/index",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"dependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"url": "git@github.com:midwayjs/midway.git"
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "5e124cd154a919951c7cf97d2e19dd120fa68b48"
|
|
49
49
|
}
|