@midwayjs/core 3.11.4 → 3.11.11
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare abstract class DataListener<T> {
|
|
2
2
|
private innerData;
|
|
3
3
|
protected init(): Promise<void>;
|
|
4
|
-
abstract initData(): T
|
|
4
|
+
abstract initData(): T | Promise<T>;
|
|
5
5
|
abstract onData(callback: (data: T) => void): any;
|
|
6
6
|
protected setData(data: T): void;
|
|
7
7
|
getData(): T;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FaaSMetadata, ServerlessTriggerType } from '../../interface';
|
|
2
|
-
export declare function ServerlessFunction(options: FaaSMetadata.ServerlessFunctionOptions): MethodDecorator;
|
|
2
|
+
export declare function ServerlessFunction(options: FaaSMetadata.ServerlessFunctionOptions & Record<string, any>): MethodDecorator;
|
|
3
3
|
export declare function ServerlessTrigger(type: ServerlessTriggerType.HTTP, metadata: FaaSMetadata.HTTPTriggerOptions): MethodDecorator;
|
|
4
4
|
export declare function ServerlessTrigger(type: ServerlessTriggerType.OS, metadata: FaaSMetadata.OSTriggerOptions): MethodDecorator;
|
|
5
5
|
export declare function ServerlessTrigger(type: ServerlessTriggerType.LOG, metadata: FaaSMetadata.LogTriggerOptions): MethodDecorator;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
3
4
|
import http = require('http');
|
|
5
|
+
import https = require('https');
|
|
4
6
|
type MethodType = 'GET' | 'POST';
|
|
5
7
|
type MimeType = 'text' | 'json' | undefined;
|
|
6
|
-
interface IOptions {
|
|
8
|
+
interface IOptions extends https.RequestOptions {
|
|
7
9
|
method?: MethodType;
|
|
8
10
|
headers?: any;
|
|
9
11
|
contentType?: MimeType;
|
package/dist/util/httpclient.js
CHANGED
|
@@ -22,10 +22,8 @@ async function makeHttpRequest(url, options = {}) {
|
|
|
22
22
|
debug(`request '${url}'`);
|
|
23
23
|
const whatwgUrl = new URL(url);
|
|
24
24
|
const client = whatwgUrl.protocol === 'https:' ? https : http;
|
|
25
|
-
|
|
26
|
-
const dataType = options
|
|
27
|
-
const method = (options.method || 'GET').toUpperCase();
|
|
28
|
-
const timeout = options.timeout || 5000;
|
|
25
|
+
options.method = (options.method || 'GET').toUpperCase();
|
|
26
|
+
const { contentType, dataType, method, timeout = 5000, ...otherOptions } = options;
|
|
29
27
|
const headers = {
|
|
30
28
|
Accept: mimeMap[dataType] || mimeMap.octet,
|
|
31
29
|
...options.headers,
|
|
@@ -50,6 +48,7 @@ async function makeHttpRequest(url, options = {}) {
|
|
|
50
48
|
const req = client.request(whatwgUrl.toString(), {
|
|
51
49
|
method,
|
|
52
50
|
headers,
|
|
51
|
+
...otherOptions,
|
|
53
52
|
}, res => {
|
|
54
53
|
res.setTimeout(timeout, () => {
|
|
55
54
|
res.destroy(new Error('Response Timeout'));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/core",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.11",
|
|
4
4
|
"description": "midway core",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"koa": "2.14.1",
|
|
26
|
-
"mm": "3.
|
|
26
|
+
"mm": "3.3.0",
|
|
27
27
|
"raw-body": "2.5.2",
|
|
28
|
-
"sinon": "15.
|
|
28
|
+
"sinon": "15.1.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@midwayjs/glob": "^1.0.2",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=12"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "3d2e85a212cfecb5cecb8ab45134fa361fe6cba2"
|
|
46
46
|
}
|