@openfn/language-http 4.2.2 → 4.2.4
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/README.md +0 -2
- package/ast.json +7 -14
- package/package.json +7 -4
- package/types/Adaptor.d.ts +9 -154
package/README.md
CHANGED
package/ast.json
CHANGED
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
"description": "get('/myEndpoint', {\n query: {foo: 'bar', a: 1},\n headers: {'content-type': 'application/json'},\n authentication: {username: 'user', password: 'pass'}\n })"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
"title": "
|
|
23
|
+
"title": "function",
|
|
24
24
|
"description": null,
|
|
25
|
-
"type": null,
|
|
26
25
|
"name": null
|
|
27
26
|
},
|
|
28
27
|
{
|
|
@@ -84,9 +83,8 @@
|
|
|
84
83
|
"description": "post('/myEndpoint', {\n body: {'foo': 'bar'},\n headers: {'content-type': 'application/json'},\n authentication: {username: 'user', password: 'pass'}\n })"
|
|
85
84
|
},
|
|
86
85
|
{
|
|
87
|
-
"title": "
|
|
86
|
+
"title": "function",
|
|
88
87
|
"description": null,
|
|
89
|
-
"type": null,
|
|
90
88
|
"name": null
|
|
91
89
|
},
|
|
92
90
|
{
|
|
@@ -148,9 +146,8 @@
|
|
|
148
146
|
"description": "put('/myEndpoint', {\n body: {'foo': 'bar'},\n headers: {'content-type': 'application/json'},\n authentication: {username: 'user', password: 'pass'}\n })"
|
|
149
147
|
},
|
|
150
148
|
{
|
|
151
|
-
"title": "
|
|
149
|
+
"title": "function",
|
|
152
150
|
"description": null,
|
|
153
|
-
"type": null,
|
|
154
151
|
"name": null
|
|
155
152
|
},
|
|
156
153
|
{
|
|
@@ -212,9 +209,8 @@
|
|
|
212
209
|
"description": "patch('/myEndpoint', {\n body: {'foo': 'bar'},\n headers: {'content-type': 'application/json'},\n authentication: {username: 'user', password: 'pass'}\n })"
|
|
213
210
|
},
|
|
214
211
|
{
|
|
215
|
-
"title": "
|
|
212
|
+
"title": "function",
|
|
216
213
|
"description": null,
|
|
217
|
-
"type": null,
|
|
218
214
|
"name": null
|
|
219
215
|
},
|
|
220
216
|
{
|
|
@@ -276,9 +272,8 @@
|
|
|
276
272
|
"description": "del(`/myendpoint/${state => state.data.id}`, {\n headers: {'content-type': 'application/json'}\n })"
|
|
277
273
|
},
|
|
278
274
|
{
|
|
279
|
-
"title": "
|
|
275
|
+
"title": "function",
|
|
280
276
|
"description": null,
|
|
281
|
-
"type": null,
|
|
282
277
|
"name": null
|
|
283
278
|
},
|
|
284
279
|
{
|
|
@@ -339,9 +334,8 @@
|
|
|
339
334
|
"description": "parseXML(body, function($){\n return $(\"table[class=your_table]\").parsetable(true, true, true);\n })"
|
|
340
335
|
},
|
|
341
336
|
{
|
|
342
|
-
"title": "
|
|
337
|
+
"title": "function",
|
|
343
338
|
"description": null,
|
|
344
|
-
"type": null,
|
|
345
339
|
"name": null
|
|
346
340
|
},
|
|
347
341
|
{
|
|
@@ -393,9 +387,8 @@
|
|
|
393
387
|
"description": "parseCSV(\"/home/user/someData.csv\", {\n\t quoteChar: '\"',\n\t header: false,\n\t});"
|
|
394
388
|
},
|
|
395
389
|
{
|
|
396
|
-
"title": "
|
|
390
|
+
"title": "function",
|
|
397
391
|
"description": null,
|
|
398
|
-
"type": null,
|
|
399
392
|
"name": null
|
|
400
393
|
},
|
|
401
394
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-http",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.4",
|
|
4
4
|
"description": "An HTTP request language package for use with Open Function",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
"url": "https://github.com/openfn/adaptors.git"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
|
-
"
|
|
12
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
13
16
|
},
|
|
14
17
|
"type": "module",
|
|
15
18
|
"types": "types/index.d.ts",
|
|
@@ -22,7 +25,7 @@
|
|
|
22
25
|
"configuration-schema.json"
|
|
23
26
|
],
|
|
24
27
|
"dependencies": {
|
|
25
|
-
"@openfn/language-common": "1.7.
|
|
28
|
+
"@openfn/language-common": "1.7.5",
|
|
26
29
|
"cheerio": "^1.0.0-rc.10",
|
|
27
30
|
"cheerio-tableparser": "^1.0.1",
|
|
28
31
|
"csv-parse": "^4.10.1",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -6,26 +6,11 @@
|
|
|
6
6
|
* create('foo'),
|
|
7
7
|
* delete('bar')
|
|
8
8
|
* )(state)
|
|
9
|
-
* @
|
|
9
|
+
* @function
|
|
10
10
|
* @param {Operations} operations - Operations to be performed.
|
|
11
11
|
* @returns {Operation}
|
|
12
12
|
*/
|
|
13
13
|
export function execute(...operations: Operations): Operation;
|
|
14
|
-
export class execute {
|
|
15
|
-
/**
|
|
16
|
-
* Execute a sequence of operations.
|
|
17
|
-
* Wraps `language-common/execute`, and prepends initial state for http.
|
|
18
|
-
* @example
|
|
19
|
-
* execute(
|
|
20
|
-
* create('foo'),
|
|
21
|
-
* delete('bar')
|
|
22
|
-
* )(state)
|
|
23
|
-
* @constructor
|
|
24
|
-
* @param {Operations} operations - Operations to be performed.
|
|
25
|
-
* @returns {Operation}
|
|
26
|
-
*/
|
|
27
|
-
constructor(...operations: Operations);
|
|
28
|
-
}
|
|
29
14
|
/**
|
|
30
15
|
* Make a GET request
|
|
31
16
|
* @public
|
|
@@ -35,31 +20,13 @@ export class execute {
|
|
|
35
20
|
* headers: {'content-type': 'application/json'},
|
|
36
21
|
* authentication: {username: 'user', password: 'pass'}
|
|
37
22
|
* })
|
|
38
|
-
* @
|
|
23
|
+
* @function
|
|
39
24
|
* @param {string} path - Path to resource
|
|
40
25
|
* @param {object} params - Query, Headers and Authentication parameters
|
|
41
26
|
* @param {function} callback - (Optional) Callback function
|
|
42
27
|
* @returns {Operation}
|
|
43
28
|
*/
|
|
44
29
|
export function get(path: string, params: object, callback: Function): Operation;
|
|
45
|
-
export class get {
|
|
46
|
-
/**
|
|
47
|
-
* Make a GET request
|
|
48
|
-
* @public
|
|
49
|
-
* @example
|
|
50
|
-
* get('/myEndpoint', {
|
|
51
|
-
* query: {foo: 'bar', a: 1},
|
|
52
|
-
* headers: {'content-type': 'application/json'},
|
|
53
|
-
* authentication: {username: 'user', password: 'pass'}
|
|
54
|
-
* })
|
|
55
|
-
* @constructor
|
|
56
|
-
* @param {string} path - Path to resource
|
|
57
|
-
* @param {object} params - Query, Headers and Authentication parameters
|
|
58
|
-
* @param {function} callback - (Optional) Callback function
|
|
59
|
-
* @returns {Operation}
|
|
60
|
-
*/
|
|
61
|
-
constructor(path: string, params: object, callback: Function);
|
|
62
|
-
}
|
|
63
30
|
/**
|
|
64
31
|
* Make a POST request
|
|
65
32
|
* @public
|
|
@@ -69,31 +36,13 @@ export class get {
|
|
|
69
36
|
* headers: {'content-type': 'application/json'},
|
|
70
37
|
* authentication: {username: 'user', password: 'pass'}
|
|
71
38
|
* })
|
|
72
|
-
* @
|
|
39
|
+
* @function
|
|
73
40
|
* @param {string} path - Path to resource
|
|
74
41
|
* @param {object} params - Body, Query, Headers and Authentication parameters
|
|
75
42
|
* @param {function} callback - (Optional) Callback function
|
|
76
43
|
* @returns {operation}
|
|
77
44
|
*/
|
|
78
45
|
export function post(path: string, params: object, callback: Function): operation;
|
|
79
|
-
export class post {
|
|
80
|
-
/**
|
|
81
|
-
* Make a POST request
|
|
82
|
-
* @public
|
|
83
|
-
* @example
|
|
84
|
-
* post('/myEndpoint', {
|
|
85
|
-
* body: {'foo': 'bar'},
|
|
86
|
-
* headers: {'content-type': 'application/json'},
|
|
87
|
-
* authentication: {username: 'user', password: 'pass'}
|
|
88
|
-
* })
|
|
89
|
-
* @constructor
|
|
90
|
-
* @param {string} path - Path to resource
|
|
91
|
-
* @param {object} params - Body, Query, Headers and Authentication parameters
|
|
92
|
-
* @param {function} callback - (Optional) Callback function
|
|
93
|
-
* @returns {operation}
|
|
94
|
-
*/
|
|
95
|
-
constructor(path: string, params: object, callback: Function);
|
|
96
|
-
}
|
|
97
46
|
/**
|
|
98
47
|
* Make a PUT request
|
|
99
48
|
* @public
|
|
@@ -103,31 +52,13 @@ export class post {
|
|
|
103
52
|
* headers: {'content-type': 'application/json'},
|
|
104
53
|
* authentication: {username: 'user', password: 'pass'}
|
|
105
54
|
* })
|
|
106
|
-
* @
|
|
55
|
+
* @function
|
|
107
56
|
* @param {string} path - Path to resource
|
|
108
57
|
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
109
58
|
* @param {function} callback - (Optional) Callback function
|
|
110
59
|
* @returns {Operation}
|
|
111
60
|
*/
|
|
112
61
|
export function put(path: string, params: object, callback: Function): Operation;
|
|
113
|
-
export class put {
|
|
114
|
-
/**
|
|
115
|
-
* Make a PUT request
|
|
116
|
-
* @public
|
|
117
|
-
* @example
|
|
118
|
-
* put('/myEndpoint', {
|
|
119
|
-
* body: {'foo': 'bar'},
|
|
120
|
-
* headers: {'content-type': 'application/json'},
|
|
121
|
-
* authentication: {username: 'user', password: 'pass'}
|
|
122
|
-
* })
|
|
123
|
-
* @constructor
|
|
124
|
-
* @param {string} path - Path to resource
|
|
125
|
-
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
126
|
-
* @param {function} callback - (Optional) Callback function
|
|
127
|
-
* @returns {Operation}
|
|
128
|
-
*/
|
|
129
|
-
constructor(path: string, params: object, callback: Function);
|
|
130
|
-
}
|
|
131
62
|
/**
|
|
132
63
|
* Make a PATCH request
|
|
133
64
|
* @public
|
|
@@ -137,31 +68,13 @@ export class put {
|
|
|
137
68
|
* headers: {'content-type': 'application/json'},
|
|
138
69
|
* authentication: {username: 'user', password: 'pass'}
|
|
139
70
|
* })
|
|
140
|
-
* @
|
|
71
|
+
* @function
|
|
141
72
|
* @param {string} path - Path to resource
|
|
142
73
|
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
143
74
|
* @param {function} callback - (Optional) Callback function
|
|
144
75
|
* @returns {Operation}
|
|
145
76
|
*/
|
|
146
77
|
export function patch(path: string, params: object, callback: Function): Operation;
|
|
147
|
-
export class patch {
|
|
148
|
-
/**
|
|
149
|
-
* Make a PATCH request
|
|
150
|
-
* @public
|
|
151
|
-
* @example
|
|
152
|
-
* patch('/myEndpoint', {
|
|
153
|
-
* body: {'foo': 'bar'},
|
|
154
|
-
* headers: {'content-type': 'application/json'},
|
|
155
|
-
* authentication: {username: 'user', password: 'pass'}
|
|
156
|
-
* })
|
|
157
|
-
* @constructor
|
|
158
|
-
* @param {string} path - Path to resource
|
|
159
|
-
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
160
|
-
* @param {function} callback - (Optional) Callback function
|
|
161
|
-
* @returns {Operation}
|
|
162
|
-
*/
|
|
163
|
-
constructor(path: string, params: object, callback: Function);
|
|
164
|
-
}
|
|
165
78
|
/**
|
|
166
79
|
* Make a DELETE request
|
|
167
80
|
* @public
|
|
@@ -169,29 +82,13 @@ export class patch {
|
|
|
169
82
|
* del(`/myendpoint/${state => state.data.id}`, {
|
|
170
83
|
* headers: {'content-type': 'application/json'}
|
|
171
84
|
* })
|
|
172
|
-
* @
|
|
85
|
+
* @function
|
|
173
86
|
* @param {string} path - Path to resource
|
|
174
87
|
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
175
88
|
* @param {function} callback - (Optional) Callback function
|
|
176
89
|
* @returns {Operation}
|
|
177
90
|
*/
|
|
178
91
|
export function del(path: string, params: object, callback: Function): Operation;
|
|
179
|
-
export class del {
|
|
180
|
-
/**
|
|
181
|
-
* Make a DELETE request
|
|
182
|
-
* @public
|
|
183
|
-
* @example
|
|
184
|
-
* del(`/myendpoint/${state => state.data.id}`, {
|
|
185
|
-
* headers: {'content-type': 'application/json'}
|
|
186
|
-
* })
|
|
187
|
-
* @constructor
|
|
188
|
-
* @param {string} path - Path to resource
|
|
189
|
-
* @param {object} params - Body, Query, Headers and Auth parameters
|
|
190
|
-
* @param {function} callback - (Optional) Callback function
|
|
191
|
-
* @returns {Operation}
|
|
192
|
-
*/
|
|
193
|
-
constructor(path: string, params: object, callback: Function);
|
|
194
|
-
}
|
|
195
92
|
/**
|
|
196
93
|
* Parse XML with the Cheerio parser
|
|
197
94
|
* @public
|
|
@@ -199,27 +96,12 @@ export class del {
|
|
|
199
96
|
* parseXML(body, function($){
|
|
200
97
|
* return $("table[class=your_table]").parsetable(true, true, true);
|
|
201
98
|
* })
|
|
202
|
-
* @
|
|
99
|
+
* @function
|
|
203
100
|
* @param {String} body - data string to be parsed
|
|
204
101
|
* @param {function} script - script for extracting data
|
|
205
102
|
* @returns {Operation}
|
|
206
103
|
*/
|
|
207
104
|
export function parseXML(body: string, script: Function): Operation;
|
|
208
|
-
export class parseXML {
|
|
209
|
-
/**
|
|
210
|
-
* Parse XML with the Cheerio parser
|
|
211
|
-
* @public
|
|
212
|
-
* @example
|
|
213
|
-
* parseXML(body, function($){
|
|
214
|
-
* return $("table[class=your_table]").parsetable(true, true, true);
|
|
215
|
-
* })
|
|
216
|
-
* @constructor
|
|
217
|
-
* @param {String} body - data string to be parsed
|
|
218
|
-
* @param {function} script - script for extracting data
|
|
219
|
-
* @returns {Operation}
|
|
220
|
-
*/
|
|
221
|
-
constructor(body: string, script: Function);
|
|
222
|
-
}
|
|
223
105
|
/**
|
|
224
106
|
* CSV-Parse for CSV conversion to JSON
|
|
225
107
|
* @public
|
|
@@ -228,47 +110,20 @@ export class parseXML {
|
|
|
228
110
|
* quoteChar: '"',
|
|
229
111
|
* header: false,
|
|
230
112
|
* });
|
|
231
|
-
* @
|
|
113
|
+
* @function
|
|
232
114
|
* @param {String} target - string or local file with CSV data
|
|
233
115
|
* @param {Object} config - csv-parse config object
|
|
234
116
|
* @returns {Operation}
|
|
235
117
|
*/
|
|
236
118
|
export function parseCSV(target: string, config: any): Operation;
|
|
237
|
-
export class parseCSV {
|
|
238
|
-
/**
|
|
239
|
-
* CSV-Parse for CSV conversion to JSON
|
|
240
|
-
* @public
|
|
241
|
-
* @example
|
|
242
|
-
* parseCSV("/home/user/someData.csv", {
|
|
243
|
-
* quoteChar: '"',
|
|
244
|
-
* header: false,
|
|
245
|
-
* });
|
|
246
|
-
* @constructor
|
|
247
|
-
* @param {String} target - string or local file with CSV data
|
|
248
|
-
* @param {Object} config - csv-parse config object
|
|
249
|
-
* @returns {Operation}
|
|
250
|
-
*/
|
|
251
|
-
constructor(target: string, config: any);
|
|
252
|
-
}
|
|
253
119
|
/**
|
|
254
120
|
* Make a request using the 'request' node module. This module is deprecated.
|
|
255
121
|
* @example
|
|
256
122
|
* request(params);
|
|
257
|
-
* @
|
|
123
|
+
* @function
|
|
258
124
|
* @param {object} params - Query, Headers and Authentication parameters
|
|
259
125
|
* @returns {Operation}
|
|
260
126
|
*/
|
|
261
127
|
export function request(params: object): Operation;
|
|
262
|
-
export class request {
|
|
263
|
-
/**
|
|
264
|
-
* Make a request using the 'request' node module. This module is deprecated.
|
|
265
|
-
* @example
|
|
266
|
-
* request(params);
|
|
267
|
-
* @constructor
|
|
268
|
-
* @param {object} params - Query, Headers and Authentication parameters
|
|
269
|
-
* @returns {Operation}
|
|
270
|
-
*/
|
|
271
|
-
constructor(params: object);
|
|
272
|
-
}
|
|
273
128
|
export const axios: import("../../common/node_modules/axios").AxiosStatic;
|
|
274
129
|
export { alterState, arrayToString, combine, dataPath, dataValue, dateFns, each, field, fields, fn, http, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray } from "@openfn/language-common";
|