@soonspacejs/plugin-cps-soonmanager 2.13.9 → 2.13.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.
- package/dist/License/decrypt-v1.d.ts +2 -2
- package/dist/License/decrypt-v2.d.ts +3 -3
- package/dist/License/encryptInfo.d.ts +16 -16
- package/dist/License/types.d.ts +8 -8
- package/dist/WaterMark/index.d.ts +31 -31
- package/dist/batch-update-poi/index.d.ts +15 -15
- package/dist/batch-update-poi/types.d.ts +15 -16
- package/dist/batch-update-poi/utils.d.ts +18 -18
- package/dist/constants.d.ts +48 -48
- package/dist/data-source/index.d.ts +15 -15
- package/dist/data-source/request-types.d.ts +193 -193
- package/dist/data-source/types.d.ts +37 -37
- package/dist/data-source/utils/http-request.d.ts +72 -72
- package/dist/data-source/utils/http.d.ts +4 -4
- package/dist/data-source/utils/index.d.ts +4 -4
- package/dist/data-source/utils/mqtt.d.ts +4 -4
- package/dist/data-source/utils/socket.d.ts +4 -4
- package/dist/data-source/utils/utils.d.ts +18 -18
- package/dist/index.d.ts +255 -255
- package/dist/index.esm.js +4 -4
- package/dist/types.d.ts +338 -338
- package/dist/update-poi/index.d.ts +11 -11
- package/dist/update-poi/type.d.ts +7 -7
- package/dist/utils.d.ts +23 -23
- package/package.json +7 -7
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: 请求参数类型
|
|
3
|
-
*/
|
|
4
|
-
export declare enum RequestParamsTypeEnum {
|
|
5
|
-
PARAMS = "params",
|
|
6
|
-
BODY = "body",
|
|
7
|
-
HEADERS = "headers"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description: 协议
|
|
11
|
-
*/
|
|
12
|
-
export declare enum ProtocolEnum {
|
|
13
|
-
HTTP = "HTTP",
|
|
14
|
-
MQTT = "MQTT",
|
|
15
|
-
WEBSOCKET = "WebSocket"
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @description: 协议值
|
|
19
|
-
*/
|
|
20
|
-
export declare enum ProtocolValueEnum {
|
|
21
|
-
HTTPS = "https://",
|
|
22
|
-
HTTP = "http://",
|
|
23
|
-
MQTTS = "wss://",
|
|
24
|
-
MQTT = "ws://",
|
|
25
|
-
WSS = "wss://",
|
|
26
|
-
WS = "ws://"
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @description: 请求参数主体
|
|
30
|
-
*/
|
|
31
|
-
export type RequestParamsObjType = {
|
|
32
|
-
[T: string]: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* @description: 请求头部类型
|
|
36
|
-
*/
|
|
37
|
-
export declare enum RequestBodyEnum {
|
|
38
|
-
NONE = "none",
|
|
39
|
-
FORM_DATA = "form-data",
|
|
40
|
-
X_WWW_FORM_URLENCODED = "x-www-form-urlencoded",
|
|
41
|
-
JSON = "json",
|
|
42
|
-
XML = "xml"
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @description: 请求方法
|
|
46
|
-
*/
|
|
47
|
-
export declare enum RequestHttpEnum {
|
|
48
|
-
GET = "GET",
|
|
49
|
-
POST = "POST",
|
|
50
|
-
PATCH = "PATCH",
|
|
51
|
-
PUT = "PUT",
|
|
52
|
-
OPTIONS = "OPTIONS",
|
|
53
|
-
DELETE = "DELETE"
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @description: 请求间隔
|
|
57
|
-
*/
|
|
58
|
-
export declare enum RequestHttpIntervalEnum {
|
|
59
|
-
SECOND = "second",
|
|
60
|
-
MINUTE = "minute",
|
|
61
|
-
HOUR = "hour",
|
|
62
|
-
DAY = "day"
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* @description: 导出包json文件类型
|
|
66
|
-
*/
|
|
67
|
-
export type DataSourceType = {
|
|
68
|
-
dataSources: SourceEnvListInterface[];
|
|
69
|
-
dataSourceApis: SourceApiListInterface[];
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* @description: 数据源基础字段
|
|
73
|
-
*/
|
|
74
|
-
export interface SourceBaseConfigInterface {
|
|
75
|
-
id: string;
|
|
76
|
-
url: string;
|
|
77
|
-
name: string;
|
|
78
|
-
[RequestParamsTypeEnum.HEADERS]: RequestParamsObjType;
|
|
79
|
-
protocol: ProtocolEnum;
|
|
80
|
-
protocolValue: ProtocolValueEnum;
|
|
81
|
-
modules: 'SOON_MANAGER';
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @description: 环境
|
|
85
|
-
*/
|
|
86
|
-
export interface SourceEnvListInterface extends SourceBaseConfigInterface {
|
|
87
|
-
apiNumber: number;
|
|
88
|
-
port?: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @description: 接口
|
|
92
|
-
*/
|
|
93
|
-
export interface SourceApiListInterface extends SourceBaseConfigInterface {
|
|
94
|
-
sid: string;
|
|
95
|
-
componentsId?: string[];
|
|
96
|
-
configureJson: RequestConfigType;
|
|
97
|
-
method?: RequestHttpEnum;
|
|
98
|
-
nodeArray?: SourceApiRelation[];
|
|
99
|
-
fullUrl?: string;
|
|
100
|
-
}
|
|
101
|
-
export type RequestConfigType = HttpConfigInterface | WssConfigInterface | MqttConfigInterface;
|
|
102
|
-
/**
|
|
103
|
-
* @description: Http连接配置
|
|
104
|
-
*/
|
|
105
|
-
export interface HttpConfigInterface {
|
|
106
|
-
[RequestParamsTypeEnum.PARAMS]: RequestParamsObjType;
|
|
107
|
-
[RequestParamsTypeEnum.BODY]: {
|
|
108
|
-
[RequestBodyEnum.FORM_DATA]: RequestParamsObjType;
|
|
109
|
-
[RequestBodyEnum.X_WWW_FORM_URLENCODED]: RequestParamsObjType;
|
|
110
|
-
[RequestBodyEnum.JSON]: string;
|
|
111
|
-
[RequestBodyEnum.XML]: string;
|
|
112
|
-
};
|
|
113
|
-
filter: string;
|
|
114
|
-
interval: number;
|
|
115
|
-
unit: RequestHttpIntervalEnum;
|
|
116
|
-
bodyType: RequestBodyEnum;
|
|
117
|
-
method: RequestHttpEnum;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @description: 长连接事件处理
|
|
121
|
-
*/
|
|
122
|
-
export interface ConnectionEventInterface {
|
|
123
|
-
successCallback?: string;
|
|
124
|
-
errorCallback?: string;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @description: websocket连接配置
|
|
128
|
-
*/
|
|
129
|
-
export interface WssConfigInterface extends ConnectionEventInterface {
|
|
130
|
-
nameSpace?: string;
|
|
131
|
-
subProtocols?: string;
|
|
132
|
-
eventList: WssEventList[];
|
|
133
|
-
query: RequestParamsObjType;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* @description: websocket-事件
|
|
137
|
-
*/
|
|
138
|
-
export interface WssEventList {
|
|
139
|
-
event: string;
|
|
140
|
-
remark?: string;
|
|
141
|
-
filter?: string;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* @description: mqtt连接配置
|
|
145
|
-
*/
|
|
146
|
-
export interface MqttConfigInterface extends ConnectionEventInterface {
|
|
147
|
-
baseConfig: MqttBaseConfig;
|
|
148
|
-
willMessage: MqttLastWillMessage;
|
|
149
|
-
subscription: MqttSubscription[];
|
|
150
|
-
}
|
|
151
|
-
export interface MqttBaseConfig {
|
|
152
|
-
version: 3 | 4 | 5;
|
|
153
|
-
clientId?: string;
|
|
154
|
-
username?: string;
|
|
155
|
-
password?: string;
|
|
156
|
-
keepAlive?: number;
|
|
157
|
-
}
|
|
158
|
-
export type QoS = 0 | 1 | 2;
|
|
159
|
-
export interface MqttLastWillMessage {
|
|
160
|
-
topic: string;
|
|
161
|
-
qos: QoS;
|
|
162
|
-
retain: boolean;
|
|
163
|
-
message: string;
|
|
164
|
-
}
|
|
165
|
-
export interface MqttSubscription {
|
|
166
|
-
topic: string;
|
|
167
|
-
qos: QoS;
|
|
168
|
-
remark?: string;
|
|
169
|
-
filter?: string;
|
|
170
|
-
}
|
|
171
|
-
export type OptionType = {
|
|
172
|
-
label: string;
|
|
173
|
-
value: string;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* @description: 节点和接口的关联关系
|
|
177
|
-
*/
|
|
178
|
-
export type SourceApiRelation = {
|
|
179
|
-
id: string;
|
|
180
|
-
apiId: string;
|
|
181
|
-
eventList?: string[];
|
|
182
|
-
nodeId: string;
|
|
183
|
-
projectId: string;
|
|
184
|
-
matchParams?: string;
|
|
185
|
-
};
|
|
186
|
-
export declare const ProtocolOption: OptionType[];
|
|
187
|
-
export declare enum ContentTypeEnum {
|
|
188
|
-
JSON = "application/json;charset=UTF-8",
|
|
189
|
-
TEXT = "text/plain;charset=UTF-8",
|
|
190
|
-
XML = "application/xml;charset=UTF-8",
|
|
191
|
-
FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
|
|
192
|
-
FORM_DATA = "multipart/form-data"
|
|
193
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @description: 请求参数类型
|
|
3
|
+
*/
|
|
4
|
+
export declare enum RequestParamsTypeEnum {
|
|
5
|
+
PARAMS = "params",
|
|
6
|
+
BODY = "body",
|
|
7
|
+
HEADERS = "headers"
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @description: 协议
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ProtocolEnum {
|
|
13
|
+
HTTP = "HTTP",
|
|
14
|
+
MQTT = "MQTT",
|
|
15
|
+
WEBSOCKET = "WebSocket"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @description: 协议值
|
|
19
|
+
*/
|
|
20
|
+
export declare enum ProtocolValueEnum {
|
|
21
|
+
HTTPS = "https://",
|
|
22
|
+
HTTP = "http://",
|
|
23
|
+
MQTTS = "wss://",
|
|
24
|
+
MQTT = "ws://",
|
|
25
|
+
WSS = "wss://",
|
|
26
|
+
WS = "ws://"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @description: 请求参数主体
|
|
30
|
+
*/
|
|
31
|
+
export type RequestParamsObjType = {
|
|
32
|
+
[T: string]: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @description: 请求头部类型
|
|
36
|
+
*/
|
|
37
|
+
export declare enum RequestBodyEnum {
|
|
38
|
+
NONE = "none",
|
|
39
|
+
FORM_DATA = "form-data",
|
|
40
|
+
X_WWW_FORM_URLENCODED = "x-www-form-urlencoded",
|
|
41
|
+
JSON = "json",
|
|
42
|
+
XML = "xml"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* @description: 请求方法
|
|
46
|
+
*/
|
|
47
|
+
export declare enum RequestHttpEnum {
|
|
48
|
+
GET = "GET",
|
|
49
|
+
POST = "POST",
|
|
50
|
+
PATCH = "PATCH",
|
|
51
|
+
PUT = "PUT",
|
|
52
|
+
OPTIONS = "OPTIONS",
|
|
53
|
+
DELETE = "DELETE"
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @description: 请求间隔
|
|
57
|
+
*/
|
|
58
|
+
export declare enum RequestHttpIntervalEnum {
|
|
59
|
+
SECOND = "second",
|
|
60
|
+
MINUTE = "minute",
|
|
61
|
+
HOUR = "hour",
|
|
62
|
+
DAY = "day"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @description: 导出包json文件类型
|
|
66
|
+
*/
|
|
67
|
+
export type DataSourceType = {
|
|
68
|
+
dataSources: SourceEnvListInterface[];
|
|
69
|
+
dataSourceApis: SourceApiListInterface[];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @description: 数据源基础字段
|
|
73
|
+
*/
|
|
74
|
+
export interface SourceBaseConfigInterface {
|
|
75
|
+
id: string;
|
|
76
|
+
url: string;
|
|
77
|
+
name: string;
|
|
78
|
+
[RequestParamsTypeEnum.HEADERS]: RequestParamsObjType;
|
|
79
|
+
protocol: ProtocolEnum;
|
|
80
|
+
protocolValue: ProtocolValueEnum;
|
|
81
|
+
modules: 'SOON_MANAGER';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description: 环境
|
|
85
|
+
*/
|
|
86
|
+
export interface SourceEnvListInterface extends SourceBaseConfigInterface {
|
|
87
|
+
apiNumber: number;
|
|
88
|
+
port?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @description: 接口
|
|
92
|
+
*/
|
|
93
|
+
export interface SourceApiListInterface extends SourceBaseConfigInterface {
|
|
94
|
+
sid: string;
|
|
95
|
+
componentsId?: string[];
|
|
96
|
+
configureJson: RequestConfigType;
|
|
97
|
+
method?: RequestHttpEnum;
|
|
98
|
+
nodeArray?: SourceApiRelation[];
|
|
99
|
+
fullUrl?: string;
|
|
100
|
+
}
|
|
101
|
+
export type RequestConfigType = HttpConfigInterface | WssConfigInterface | MqttConfigInterface;
|
|
102
|
+
/**
|
|
103
|
+
* @description: Http连接配置
|
|
104
|
+
*/
|
|
105
|
+
export interface HttpConfigInterface {
|
|
106
|
+
[RequestParamsTypeEnum.PARAMS]: RequestParamsObjType;
|
|
107
|
+
[RequestParamsTypeEnum.BODY]: {
|
|
108
|
+
[RequestBodyEnum.FORM_DATA]: RequestParamsObjType;
|
|
109
|
+
[RequestBodyEnum.X_WWW_FORM_URLENCODED]: RequestParamsObjType;
|
|
110
|
+
[RequestBodyEnum.JSON]: string;
|
|
111
|
+
[RequestBodyEnum.XML]: string;
|
|
112
|
+
};
|
|
113
|
+
filter: string;
|
|
114
|
+
interval: number;
|
|
115
|
+
unit: RequestHttpIntervalEnum;
|
|
116
|
+
bodyType: RequestBodyEnum;
|
|
117
|
+
method: RequestHttpEnum;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @description: 长连接事件处理
|
|
121
|
+
*/
|
|
122
|
+
export interface ConnectionEventInterface {
|
|
123
|
+
successCallback?: string;
|
|
124
|
+
errorCallback?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* @description: websocket连接配置
|
|
128
|
+
*/
|
|
129
|
+
export interface WssConfigInterface extends ConnectionEventInterface {
|
|
130
|
+
nameSpace?: string;
|
|
131
|
+
subProtocols?: string;
|
|
132
|
+
eventList: WssEventList[];
|
|
133
|
+
query: RequestParamsObjType;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* @description: websocket-事件
|
|
137
|
+
*/
|
|
138
|
+
export interface WssEventList {
|
|
139
|
+
event: string;
|
|
140
|
+
remark?: string;
|
|
141
|
+
filter?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @description: mqtt连接配置
|
|
145
|
+
*/
|
|
146
|
+
export interface MqttConfigInterface extends ConnectionEventInterface {
|
|
147
|
+
baseConfig: MqttBaseConfig;
|
|
148
|
+
willMessage: MqttLastWillMessage;
|
|
149
|
+
subscription: MqttSubscription[];
|
|
150
|
+
}
|
|
151
|
+
export interface MqttBaseConfig {
|
|
152
|
+
version: 3 | 4 | 5;
|
|
153
|
+
clientId?: string;
|
|
154
|
+
username?: string;
|
|
155
|
+
password?: string;
|
|
156
|
+
keepAlive?: number;
|
|
157
|
+
}
|
|
158
|
+
export type QoS = 0 | 1 | 2;
|
|
159
|
+
export interface MqttLastWillMessage {
|
|
160
|
+
topic: string;
|
|
161
|
+
qos: QoS;
|
|
162
|
+
retain: boolean;
|
|
163
|
+
message: string;
|
|
164
|
+
}
|
|
165
|
+
export interface MqttSubscription {
|
|
166
|
+
topic: string;
|
|
167
|
+
qos: QoS;
|
|
168
|
+
remark?: string;
|
|
169
|
+
filter?: string;
|
|
170
|
+
}
|
|
171
|
+
export type OptionType = {
|
|
172
|
+
label: string;
|
|
173
|
+
value: string;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* @description: 节点和接口的关联关系
|
|
177
|
+
*/
|
|
178
|
+
export type SourceApiRelation = {
|
|
179
|
+
id: string;
|
|
180
|
+
apiId: string;
|
|
181
|
+
eventList?: string[];
|
|
182
|
+
nodeId: string;
|
|
183
|
+
projectId: string;
|
|
184
|
+
matchParams?: string;
|
|
185
|
+
};
|
|
186
|
+
export declare const ProtocolOption: OptionType[];
|
|
187
|
+
export declare enum ContentTypeEnum {
|
|
188
|
+
JSON = "application/json;charset=UTF-8",
|
|
189
|
+
TEXT = "text/plain;charset=UTF-8",
|
|
190
|
+
XML = "application/xml;charset=UTF-8",
|
|
191
|
+
FORM_URLENCODED = "application/x-www-form-urlencoded;charset=UTF-8",
|
|
192
|
+
FORM_DATA = "multipart/form-data"
|
|
193
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { MqttClient } from 'mqtt';
|
|
2
|
-
import { Socket } from 'socket.io-client';
|
|
3
|
-
import { HttpRequest } from './utils/http-request';
|
|
4
|
-
import { SourceApiListInterface } from './request-types';
|
|
5
|
-
export type ClientType = HttpRequest | MqttClient | Socket | undefined;
|
|
6
|
-
export type SourceClientListType = {
|
|
7
|
-
[T: string]: ClientType;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* @description: 连接状态
|
|
11
|
-
*/
|
|
12
|
-
export declare enum RequestStatusEnum {
|
|
13
|
-
SUCCESS = "success"
|
|
14
|
-
ERROR = "error"
|
|
15
|
-
CONNECT = "connect"
|
|
16
|
-
CLOSE = "close"
|
|
17
|
-
}
|
|
18
|
-
export type SourceOnEventType = {
|
|
19
|
-
onStatus: SourceStatusCallbackType;
|
|
20
|
-
onMessage: SourceMessageCallbackType;
|
|
21
|
-
};
|
|
22
|
-
export type SourceOnEventNameType = 'onMessage' | 'onStatus';
|
|
23
|
-
export type SourceStatusCallbackType = (info: SourceStatusType) => void;
|
|
24
|
-
export type SourceMessageCallbackType = (info: SourceMessageType) => void;
|
|
25
|
-
export type SourceCallBackBaseType = {
|
|
26
|
-
api: SourceApiListInterface;
|
|
27
|
-
client: ClientType;
|
|
28
|
-
};
|
|
29
|
-
export type SourceStatusType = SourceCallBackBaseType & InfoStatusType;
|
|
30
|
-
export type SourceMessageType = SourceCallBackBaseType & InfoMessageType;
|
|
31
|
-
export type InfoStatusType = {
|
|
32
|
-
status: RequestStatusEnum;
|
|
33
|
-
message?: Error;
|
|
34
|
-
};
|
|
35
|
-
export type InfoMessageType = {
|
|
36
|
-
data: any;
|
|
37
|
-
};
|
|
1
|
+
import { MqttClient } from 'mqtt';
|
|
2
|
+
import { Socket } from 'socket.io-client';
|
|
3
|
+
import { HttpRequest } from './utils/http-request';
|
|
4
|
+
import { SourceApiListInterface } from './request-types';
|
|
5
|
+
export type ClientType = HttpRequest | MqttClient | Socket | undefined;
|
|
6
|
+
export type SourceClientListType = {
|
|
7
|
+
[T: string]: ClientType;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @description: 连接状态
|
|
11
|
+
*/
|
|
12
|
+
export declare enum RequestStatusEnum {
|
|
13
|
+
SUCCESS = "success",// 成功
|
|
14
|
+
ERROR = "error",// 报错
|
|
15
|
+
CONNECT = "connect",// 连接中
|
|
16
|
+
CLOSE = "close"
|
|
17
|
+
}
|
|
18
|
+
export type SourceOnEventType = {
|
|
19
|
+
onStatus: SourceStatusCallbackType;
|
|
20
|
+
onMessage: SourceMessageCallbackType;
|
|
21
|
+
};
|
|
22
|
+
export type SourceOnEventNameType = 'onMessage' | 'onStatus';
|
|
23
|
+
export type SourceStatusCallbackType = (info: SourceStatusType) => void;
|
|
24
|
+
export type SourceMessageCallbackType = (info: SourceMessageType) => void;
|
|
25
|
+
export type SourceCallBackBaseType = {
|
|
26
|
+
api: SourceApiListInterface;
|
|
27
|
+
client: ClientType;
|
|
28
|
+
};
|
|
29
|
+
export type SourceStatusType = SourceCallBackBaseType & InfoStatusType;
|
|
30
|
+
export type SourceMessageType = SourceCallBackBaseType & InfoMessageType;
|
|
31
|
+
export type InfoStatusType = {
|
|
32
|
+
status: RequestStatusEnum;
|
|
33
|
+
message?: Error;
|
|
34
|
+
};
|
|
35
|
+
export type InfoMessageType = {
|
|
36
|
+
data: any;
|
|
37
|
+
};
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
export interface HttpRequesttOptionInterface {
|
|
2
|
-
method?: string;
|
|
3
|
-
protocol?: string;
|
|
4
|
-
headers?: RequestParamsObjType;
|
|
5
|
-
params?: RequestParamsObjType;
|
|
6
|
-
body?: string | FormData | RequestParamsObjType | null;
|
|
7
|
-
interval?: number;
|
|
8
|
-
timeout?: number;
|
|
9
|
-
responseType?: XMLHttpRequestResponseType;
|
|
10
|
-
filter?: ((response: any) => any) | string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @description: 请求参数主体
|
|
14
|
-
*/
|
|
15
|
-
type RequestParamsObjType = {
|
|
16
|
-
[T: string]: string;
|
|
17
|
-
};
|
|
18
|
-
export type RequestEventNameType = 'onSuccess' | 'onError' | 'onStatus';
|
|
19
|
-
export declare class HttpRequest {
|
|
20
|
-
url: string;
|
|
21
|
-
method: string;
|
|
22
|
-
protocol: string;
|
|
23
|
-
params?: RequestParamsObjType;
|
|
24
|
-
headers?: RequestParamsObjType;
|
|
25
|
-
body: any | string | FormData | RequestParamsObjType | null;
|
|
26
|
-
filter?: any;
|
|
27
|
-
interval: number;
|
|
28
|
-
timeout: number;
|
|
29
|
-
responseType: XMLHttpRequestResponseType;
|
|
30
|
-
responseData: any;
|
|
31
|
-
filteredData: any | null;
|
|
32
|
-
option?: HttpRequesttOptionInterface;
|
|
33
|
-
XHR: XMLHttpRequest | undefined;
|
|
34
|
-
private isInterval;
|
|
35
|
-
private successCallback;
|
|
36
|
-
private errorCallback;
|
|
37
|
-
private statusCallback;
|
|
38
|
-
constructor(url: string, option?: HttpRequesttOptionInterface);
|
|
39
|
-
get getUrl(): string;
|
|
40
|
-
get getOption(): {
|
|
41
|
-
url: string;
|
|
42
|
-
method?: string
|
|
43
|
-
protocol?: string
|
|
44
|
-
headers?: RequestParamsObjType
|
|
45
|
-
params?: RequestParamsObjType
|
|
46
|
-
body?: string |
|
|
47
|
-
interval?: number
|
|
48
|
-
timeout?: number
|
|
49
|
-
responseType?: XMLHttpRequestResponseType
|
|
50
|
-
filter?:
|
|
51
|
-
};
|
|
52
|
-
get getStatus(): number | undefined;
|
|
53
|
-
get getRequesting(): boolean;
|
|
54
|
-
get getResponseData(): any;
|
|
55
|
-
get getFilterData(): any;
|
|
56
|
-
send(): void;
|
|
57
|
-
abort(): void;
|
|
58
|
-
onceSend(): void;
|
|
59
|
-
listen(successCallback: (response: any, filteredData: any) => void, errorCallback?: (error: Error) => void): void;
|
|
60
|
-
on(eventName: RequestEventNameType, callback: any): void;
|
|
61
|
-
private onStatusCallback;
|
|
62
|
-
private onErrorCallback;
|
|
63
|
-
private onSuccessCallback;
|
|
64
|
-
private request;
|
|
65
|
-
private circulateRequest;
|
|
66
|
-
private onTimeout;
|
|
67
|
-
private onLoad;
|
|
68
|
-
private onError;
|
|
69
|
-
private paramsUrl;
|
|
70
|
-
private toObject;
|
|
71
|
-
}
|
|
72
|
-
export {};
|
|
1
|
+
export interface HttpRequesttOptionInterface {
|
|
2
|
+
method?: string;
|
|
3
|
+
protocol?: string;
|
|
4
|
+
headers?: RequestParamsObjType;
|
|
5
|
+
params?: RequestParamsObjType;
|
|
6
|
+
body?: string | FormData | RequestParamsObjType | null;
|
|
7
|
+
interval?: number;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
responseType?: XMLHttpRequestResponseType;
|
|
10
|
+
filter?: ((response: any) => any) | string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @description: 请求参数主体
|
|
14
|
+
*/
|
|
15
|
+
type RequestParamsObjType = {
|
|
16
|
+
[T: string]: string;
|
|
17
|
+
};
|
|
18
|
+
export type RequestEventNameType = 'onSuccess' | 'onError' | 'onStatus';
|
|
19
|
+
export declare class HttpRequest {
|
|
20
|
+
url: string;
|
|
21
|
+
method: string;
|
|
22
|
+
protocol: string;
|
|
23
|
+
params?: RequestParamsObjType;
|
|
24
|
+
headers?: RequestParamsObjType;
|
|
25
|
+
body: any | string | FormData | RequestParamsObjType | null;
|
|
26
|
+
filter?: any;
|
|
27
|
+
interval: number;
|
|
28
|
+
timeout: number;
|
|
29
|
+
responseType: XMLHttpRequestResponseType;
|
|
30
|
+
responseData: any;
|
|
31
|
+
filteredData: any | null;
|
|
32
|
+
option?: HttpRequesttOptionInterface;
|
|
33
|
+
XHR: XMLHttpRequest | undefined;
|
|
34
|
+
private isInterval;
|
|
35
|
+
private successCallback;
|
|
36
|
+
private errorCallback;
|
|
37
|
+
private statusCallback;
|
|
38
|
+
constructor(url: string, option?: HttpRequesttOptionInterface);
|
|
39
|
+
get getUrl(): string;
|
|
40
|
+
get getOption(): {
|
|
41
|
+
url: string;
|
|
42
|
+
method?: string;
|
|
43
|
+
protocol?: string;
|
|
44
|
+
headers?: RequestParamsObjType;
|
|
45
|
+
params?: RequestParamsObjType;
|
|
46
|
+
body?: string | FormData | RequestParamsObjType | null;
|
|
47
|
+
interval?: number;
|
|
48
|
+
timeout?: number;
|
|
49
|
+
responseType?: XMLHttpRequestResponseType;
|
|
50
|
+
filter?: ((response: any) => any) | string;
|
|
51
|
+
};
|
|
52
|
+
get getStatus(): number | undefined;
|
|
53
|
+
get getRequesting(): boolean;
|
|
54
|
+
get getResponseData(): any;
|
|
55
|
+
get getFilterData(): any;
|
|
56
|
+
send(): void;
|
|
57
|
+
abort(): void;
|
|
58
|
+
onceSend(): void;
|
|
59
|
+
listen(successCallback: (response: any, filteredData: any) => void, errorCallback?: (error: Error) => void): void;
|
|
60
|
+
on(eventName: RequestEventNameType, callback: any): void;
|
|
61
|
+
private onStatusCallback;
|
|
62
|
+
private onErrorCallback;
|
|
63
|
+
private onSuccessCallback;
|
|
64
|
+
private request;
|
|
65
|
+
private circulateRequest;
|
|
66
|
+
private onTimeout;
|
|
67
|
+
private onLoad;
|
|
68
|
+
private onError;
|
|
69
|
+
private paramsUrl;
|
|
70
|
+
private toObject;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpRequest } from './http-request';
|
|
2
|
-
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
-
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
-
export declare function requestHttp(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): HttpRequest;
|
|
1
|
+
import { HttpRequest } from './http-request';
|
|
2
|
+
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
+
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
+
export declare function requestHttp(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): HttpRequest;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './http';
|
|
2
|
-
export * from './mqtt';
|
|
3
|
-
export * from './socket';
|
|
4
|
-
export * from './utils';
|
|
1
|
+
export * from './http';
|
|
2
|
+
export * from './mqtt';
|
|
3
|
+
export * from './socket';
|
|
4
|
+
export * from './utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mqtt from 'mqtt';
|
|
2
|
-
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
-
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
-
export declare function requestMqtt(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): mqtt.MqttClient;
|
|
1
|
+
import mqtt from 'mqtt';
|
|
2
|
+
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
+
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
+
export declare function requestMqtt(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): mqtt.MqttClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Socket } from 'socket.io-client';
|
|
2
|
-
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
-
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
-
export declare function requestSocket(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
import { SourceApiListInterface, SourceEnvListInterface } from '../request-types';
|
|
3
|
+
import { SourceMessageCallbackType, SourceStatusCallbackType } from '../types';
|
|
4
|
+
export declare function requestSocket(api: SourceApiListInterface, env: SourceEnvListInterface, onStatus: SourceStatusCallbackType, onMessage: SourceMessageCallbackType): Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|