@lowdefy/connection-axios-http 4.0.0-alpha.26 → 4.0.0-alpha.29
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/connection-axios-http",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.29",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -35,18 +35,17 @@
|
|
|
35
35
|
"dist/*"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
38
|
+
"build": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
|
|
39
39
|
"clean": "rm -rf dist",
|
|
40
|
-
"
|
|
41
|
-
"swc": "swc src --out-dir dist --config-file ../../../../.swcrc --delete-dir-on-start --copy-files",
|
|
40
|
+
"prepublishOnly": "pnpm build",
|
|
42
41
|
"test": "jest --coverage"
|
|
43
42
|
},
|
|
44
43
|
"dependencies": {
|
|
45
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
44
|
+
"@lowdefy/helpers": "4.0.0-alpha.29",
|
|
46
45
|
"axios": "0.27.2"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"@lowdefy/ajv": "4.0.0-alpha.
|
|
48
|
+
"@lowdefy/ajv": "4.0.0-alpha.29",
|
|
50
49
|
"@swc/cli": "0.1.57",
|
|
51
50
|
"@swc/core": "1.2.194",
|
|
52
51
|
"@swc/jest": "0.2.21",
|
|
@@ -55,5 +54,5 @@
|
|
|
55
54
|
"publishConfig": {
|
|
56
55
|
"access": "public"
|
|
57
56
|
},
|
|
58
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "621a191ebc0a1569ee6669dc74c12f8be5a8c7f3"
|
|
59
58
|
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import http from 'http';
|
|
16
|
-
import https from 'https';
|
|
17
|
-
import axios from 'axios';
|
|
18
|
-
import { mergeObjects } from '@lowdefy/helpers';
|
|
19
|
-
import schema from '../schema.js';
|
|
20
|
-
async function AxiosHttp({ request , connection }) {
|
|
21
|
-
try {
|
|
22
|
-
const config = mergeObjects([
|
|
23
|
-
connection,
|
|
24
|
-
request
|
|
25
|
-
]);
|
|
26
|
-
if (config.httpAgentOptions) {
|
|
27
|
-
config.httpAgent = new http.Agent(config.httpAgentOptions);
|
|
28
|
-
}
|
|
29
|
-
if (config.httpsAgentOptions) {
|
|
30
|
-
config.httpsAgent = new https.Agent(config.httpsAgentOptions);
|
|
31
|
-
}
|
|
32
|
-
const res = await axios(config);
|
|
33
|
-
const { status , statusText , headers , method , path , data } = res;
|
|
34
|
-
return {
|
|
35
|
-
status,
|
|
36
|
-
statusText,
|
|
37
|
-
headers,
|
|
38
|
-
method,
|
|
39
|
-
path,
|
|
40
|
-
data
|
|
41
|
-
};
|
|
42
|
-
} catch (error) {
|
|
43
|
-
if (error.response) {
|
|
44
|
-
throw new Error(`${error.message}; Http response "${error.response.status}: ${error.response.statusText}"; Data: ${JSON.stringify(error.response.data)}.`);
|
|
45
|
-
}
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
AxiosHttp.schema = schema;
|
|
50
|
-
AxiosHttp.meta = {
|
|
51
|
-
checkRead: false,
|
|
52
|
-
checkWrite: false
|
|
53
|
-
};
|
|
54
|
-
export default AxiosHttp;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import AxiosHttp from './AxiosHttp/AxiosHttp.js';
|
|
16
|
-
import schema from './schema.js';
|
|
17
|
-
export default {
|
|
18
|
-
schema,
|
|
19
|
-
requests: {
|
|
20
|
-
AxiosHttp
|
|
21
|
-
}
|
|
22
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ export default {
|
|
16
|
-
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
17
|
-
title: 'Lowdefy Connection Schema - AxiosHttp',
|
|
18
|
-
type: 'object',
|
|
19
|
-
properties: {
|
|
20
|
-
url: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
description: 'The server URL that will be used for the request.',
|
|
23
|
-
errorMessage: {
|
|
24
|
-
type: 'AxiosHttp property "url" should be a string.'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
method: {
|
|
28
|
-
type: 'string',
|
|
29
|
-
enum: [
|
|
30
|
-
'get',
|
|
31
|
-
'delete',
|
|
32
|
-
'head',
|
|
33
|
-
'options',
|
|
34
|
-
'post',
|
|
35
|
-
'put',
|
|
36
|
-
'patch'
|
|
37
|
-
],
|
|
38
|
-
description: 'The request method to be used when making the request',
|
|
39
|
-
errorMessage: {
|
|
40
|
-
type: 'AxiosHttp property "method" should be a string.',
|
|
41
|
-
enum: 'AxiosHttp property "method" is not a valid value.'
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
baseURL: {
|
|
45
|
-
type: 'string',
|
|
46
|
-
description: 'baseURL will be prepended to url unless url is absolute. It can be convenient to set baseURL for an axios connection so that requests can use relative urls.',
|
|
47
|
-
errorMessage: {
|
|
48
|
-
type: 'AxiosHttp property "baseURL" should be a string.'
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
headers: {
|
|
52
|
-
type: 'object',
|
|
53
|
-
description: 'An object with custom headers to be sent with the request. The object keys should be header names, and the values should be the string header values.',
|
|
54
|
-
errorMessage: {
|
|
55
|
-
type: 'AxiosHttp property "headers" should be an object.'
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
params: {
|
|
59
|
-
type: 'object',
|
|
60
|
-
description: 'An object with URL parameters to be sent with the request.',
|
|
61
|
-
errorMessage: {
|
|
62
|
-
type: 'AxiosHttp property "params" should be an object.'
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
data: {
|
|
66
|
-
type: [
|
|
67
|
-
'string',
|
|
68
|
-
'object'
|
|
69
|
-
],
|
|
70
|
-
description: "The data to be sent as the request body. Only applicable for request methods 'put', 'post', and 'patch'. Can be an object or a string in the format 'Country=USA&City=New York'.",
|
|
71
|
-
errorMessage: {
|
|
72
|
-
type: 'AxiosHttp property "data" should be an object or string.'
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
timeout: {
|
|
76
|
-
type: 'number',
|
|
77
|
-
description: 'The number of milliseconds before the request times out. If the request takes longer than timeout, the request will be aborted. Set to 0 for no timeout.',
|
|
78
|
-
default: 0,
|
|
79
|
-
errorMessage: {
|
|
80
|
-
type: 'AxiosHttp property "timeout" should be a number.'
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
auth: {
|
|
84
|
-
type: 'object',
|
|
85
|
-
description: 'Indicates that HTTP Basic authorization should be used, and supplies credentials. This will set an Authorization header, overwriting any existing Authorization custom headers you have set using headers. Only HTTP Basic auth is configurable through this parameter, for Bearer tokens and such, use Authorization custom headers instead.',
|
|
86
|
-
properties: {
|
|
87
|
-
username: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
description: 'HTTP Basic authorization username.',
|
|
90
|
-
errorMessage: {
|
|
91
|
-
type: 'AxiosHttp property "auth.username" should be a string.'
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
password: {
|
|
95
|
-
type: 'string',
|
|
96
|
-
description: 'HTTP Basic authorization password.',
|
|
97
|
-
errorMessage: {
|
|
98
|
-
type: 'AxiosHttp property "auth.password" should be a string.'
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
errorMessage: {
|
|
103
|
-
type: 'AxiosHttp property "auth" should be an object.'
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
responseType: {
|
|
107
|
-
type: 'string',
|
|
108
|
-
enum: [
|
|
109
|
-
'json',
|
|
110
|
-
'document',
|
|
111
|
-
'text'
|
|
112
|
-
],
|
|
113
|
-
description: 'The type of data that the server should respond with.',
|
|
114
|
-
default: 'json',
|
|
115
|
-
errorMessage: {
|
|
116
|
-
type: 'AxiosHttp property "responseType" should be a string.',
|
|
117
|
-
enum: 'AxiosHttp property "responseType" is not a valid value.'
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
responseEncoding: {
|
|
121
|
-
type: 'string',
|
|
122
|
-
description: 'Indicates encoding to use for decoding responses.',
|
|
123
|
-
default: 'utf8',
|
|
124
|
-
errorMessage: {
|
|
125
|
-
type: 'AxiosHttp property "responseEncoding" should be a string.'
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
maxContentLength: {
|
|
129
|
-
type: 'number',
|
|
130
|
-
description: 'Defines the max size of the http response content allowed in bytes.',
|
|
131
|
-
errorMessage: {
|
|
132
|
-
type: 'AxiosHttp property "maxContentLength" should be a number.'
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
maxRedirects: {
|
|
136
|
-
type: 'number',
|
|
137
|
-
description: 'Defines the maximum number of redirects to follow. If set to 0, no redirects will be followed.',
|
|
138
|
-
default: 5,
|
|
139
|
-
errorMessage: {
|
|
140
|
-
type: 'AxiosHttp property "maxRedirects" should be a number.'
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
proxy: {
|
|
144
|
-
type: 'object',
|
|
145
|
-
description: 'Defines the hostname and port of the proxy server.',
|
|
146
|
-
errorMessage: {
|
|
147
|
-
type: 'AxiosHttp property "proxy" should be an object.'
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
};
|
package/dist/connections.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ export { default as AxiosHttp } from './connections/AxiosHttp/AxiosHttp.js';
|
package/dist/types.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/namespace */ /*
|
|
2
|
-
Copyright 2020-2022 Lowdefy, Inc
|
|
3
|
-
|
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
you may not use this file except in compliance with the License.
|
|
6
|
-
You may obtain a copy of the License at
|
|
7
|
-
|
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
See the License for the specific language governing permissions and
|
|
14
|
-
limitations under the License.
|
|
15
|
-
*/ import * as connections from './connections.js';
|
|
16
|
-
export default {
|
|
17
|
-
connections: Object.keys(connections),
|
|
18
|
-
requests: Object.keys(connections).map((connection)=>Object.keys(connections[connection].requests)).flat()
|
|
19
|
-
};
|