@openfn/language-http 4.2.1 → 4.2.2

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 CHANGED
@@ -140,6 +140,4 @@ Clone the repo, run `pnpm install`.
140
140
 
141
141
  Run tests using `pnpm run test` or `pnpm run test:watch`.
142
142
 
143
- Build the project using `make`.
144
-
145
143
  To build the docs for this repo, run `pnpm build:docs`.
package/ast.json CHANGED
@@ -461,6 +461,14 @@
461
461
  "name": "Function"
462
462
  },
463
463
  "name": "func"
464
+ },
465
+ {
466
+ "title": "returns",
467
+ "description": null,
468
+ "type": {
469
+ "type": "NameExpression",
470
+ "name": "Operation"
471
+ }
464
472
  }
465
473
  ]
466
474
  },
@@ -496,6 +504,14 @@
496
504
  "name": "String"
497
505
  },
498
506
  "name": "path"
507
+ },
508
+ {
509
+ "title": "returns",
510
+ "description": null,
511
+ "type": {
512
+ "type": "NameExpression",
513
+ "name": "Operation"
514
+ }
499
515
  }
500
516
  ]
501
517
  },
@@ -574,6 +590,14 @@
574
590
  "name": "String"
575
591
  },
576
592
  "name": "path"
593
+ },
594
+ {
595
+ "title": "returns",
596
+ "description": null,
597
+ "type": {
598
+ "type": "NameExpression",
599
+ "name": "Operation"
600
+ }
577
601
  }
578
602
  ]
579
603
  },
@@ -609,6 +633,14 @@
609
633
  "name": "String"
610
634
  },
611
635
  "name": "path"
636
+ },
637
+ {
638
+ "title": "returns",
639
+ "description": null,
640
+ "type": {
641
+ "type": "NameExpression",
642
+ "name": "Operation"
643
+ }
612
644
  }
613
645
  ]
614
646
  },
@@ -654,6 +686,14 @@
654
686
  "name": "Operation"
655
687
  },
656
688
  "name": "operation"
689
+ },
690
+ {
691
+ "title": "returns",
692
+ "description": null,
693
+ "type": {
694
+ "type": "NameExpression",
695
+ "name": "Operation"
696
+ }
657
697
  }
658
698
  ]
659
699
  },
@@ -742,6 +782,14 @@
742
782
  "name": "Value"
743
783
  },
744
784
  "name": "value"
785
+ },
786
+ {
787
+ "title": "returns",
788
+ "description": null,
789
+ "type": {
790
+ "type": "NameExpression",
791
+ "name": "Field"
792
+ }
745
793
  }
746
794
  ]
747
795
  },
package/dist/index.cjs CHANGED
@@ -25,8 +25,35 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
25
25
  // src/index.js
26
26
  var src_exports = {};
27
27
  __export(src_exports, {
28
- Adaptor: () => Adaptor_exports,
29
- default: () => src_default
28
+ alterState: () => import_language_common2.alterState,
29
+ arrayToString: () => import_language_common2.arrayToString,
30
+ axios: () => axios,
31
+ combine: () => import_language_common2.combine,
32
+ dataPath: () => import_language_common2.dataPath,
33
+ dataValue: () => import_language_common2.dataValue,
34
+ dateFns: () => import_language_common2.dateFns,
35
+ default: () => src_default,
36
+ del: () => del,
37
+ each: () => import_language_common2.each,
38
+ execute: () => execute,
39
+ field: () => import_language_common2.field,
40
+ fields: () => import_language_common2.fields,
41
+ fn: () => import_language_common2.fn,
42
+ get: () => get,
43
+ http: () => import_language_common2.http,
44
+ humanProper: () => import_language_common2.humanProper,
45
+ lastReferenceValue: () => import_language_common2.lastReferenceValue,
46
+ merge: () => import_language_common2.merge,
47
+ parseCSV: () => parseCSV,
48
+ parseXML: () => parseXML,
49
+ patch: () => patch,
50
+ post: () => post,
51
+ put: () => put,
52
+ request: () => request,
53
+ scrubEmojis: () => import_language_common2.scrubEmojis,
54
+ sourceValue: () => import_language_common2.sourceValue,
55
+ splitKeys: () => import_language_common2.splitKeys,
56
+ toArray: () => import_language_common2.toArray
30
57
  });
31
58
  module.exports = __toCommonJS(src_exports);
32
59
 
@@ -379,5 +406,32 @@ function request(params) {
379
406
  var src_default = Adaptor_exports;
380
407
  // Annotate the CommonJS export names for ESM import in node:
381
408
  0 && (module.exports = {
382
- Adaptor
409
+ alterState,
410
+ arrayToString,
411
+ axios,
412
+ combine,
413
+ dataPath,
414
+ dataValue,
415
+ dateFns,
416
+ del,
417
+ each,
418
+ execute,
419
+ field,
420
+ fields,
421
+ fn,
422
+ get,
423
+ http,
424
+ humanProper,
425
+ lastReferenceValue,
426
+ merge,
427
+ parseCSV,
428
+ parseXML,
429
+ patch,
430
+ post,
431
+ put,
432
+ request,
433
+ scrubEmojis,
434
+ sourceValue,
435
+ splitKeys,
436
+ toArray
383
437
  });
package/dist/index.js CHANGED
@@ -376,6 +376,33 @@ function request(params) {
376
376
  // src/index.js
377
377
  var src_default = Adaptor_exports;
378
378
  export {
379
- Adaptor_exports as Adaptor,
380
- src_default as default
379
+ alterState,
380
+ arrayToString,
381
+ axios,
382
+ combine,
383
+ dataPath,
384
+ dataValue,
385
+ dateFns,
386
+ src_default as default,
387
+ del,
388
+ each,
389
+ execute,
390
+ field,
391
+ fields,
392
+ fn,
393
+ get,
394
+ http2 as http,
395
+ humanProper,
396
+ lastReferenceValue,
397
+ merge,
398
+ parseCSV,
399
+ parseXML,
400
+ patch,
401
+ post,
402
+ put,
403
+ request,
404
+ scrubEmojis,
405
+ sourceValue,
406
+ splitKeys,
407
+ toArray
381
408
  };
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "@openfn/language-http",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "An HTTP request language package for use with Open Function",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/openfn/adaptors.git"
9
9
  },
10
- "main": "dist/index.cjs",
10
+ "exports": {
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
11
14
  "type": "module",
12
15
  "types": "types/index.d.ts",
13
16
  "author": "Open Function Group",
@@ -19,30 +22,29 @@
19
22
  "configuration-schema.json"
20
23
  ],
21
24
  "dependencies": {
22
- "@openfn/language-common": "1.7.1",
25
+ "@openfn/language-common": "1.7.4",
23
26
  "cheerio": "^1.0.0-rc.10",
24
27
  "cheerio-tableparser": "^1.0.1",
25
28
  "csv-parse": "^4.10.1",
26
29
  "fast-safe-stringify": "^2.0.7",
27
30
  "form-data": "^3.0.0",
28
- "import": "0.0.6",
29
31
  "lodash": "^4.17.19",
30
32
  "request": "^2.88.2",
31
33
  "tough-cookie": "^4.0.0"
32
34
  },
33
35
  "devDependencies": {
36
+ "@openfn/buildtools": "^1.0.2",
34
37
  "@openfn/simple-ast": "0.4.1",
35
- "@openfn/buildtools": "^1.0.1",
36
- "@types/node": "18.11.3",
37
38
  "chai": "4.3.6",
38
39
  "deep-eql": "4.1.1",
39
- "esno": "0.16.3",
40
+ "esno": "^0.16.3",
40
41
  "mocha": "9.2.2",
41
42
  "nock": "13.2.9",
42
- "sinon": "9.2.4"
43
+ "rimraf": "^3.0.2"
43
44
  },
45
+ "main": "dist/index.cjs",
44
46
  "scripts": {
45
- "clean": "rm -rf dist types docs",
47
+ "clean": "rimraf dist types docs",
46
48
  "build": "pnpm clean && build-adaptor http",
47
49
  "pack": "pnpm pack --pack-destination ../../dist",
48
50
  "test": "mocha --experimental-specifier-resolution=node --no-warnings",
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Execute a sequence of operations.
3
+ * Wraps `language-common/execute`, and prepends initial state for http.
4
+ * @example
5
+ * execute(
6
+ * create('foo'),
7
+ * delete('bar')
8
+ * )(state)
9
+ * @constructor
10
+ * @param {Operations} operations - Operations to be performed.
11
+ * @returns {Operation}
12
+ */
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
+ /**
30
+ * Make a GET request
31
+ * @public
32
+ * @example
33
+ * get('/myEndpoint', {
34
+ * query: {foo: 'bar', a: 1},
35
+ * headers: {'content-type': 'application/json'},
36
+ * authentication: {username: 'user', password: 'pass'}
37
+ * })
38
+ * @constructor
39
+ * @param {string} path - Path to resource
40
+ * @param {object} params - Query, Headers and Authentication parameters
41
+ * @param {function} callback - (Optional) Callback function
42
+ * @returns {Operation}
43
+ */
44
+ 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
+ /**
64
+ * Make a POST request
65
+ * @public
66
+ * @example
67
+ * post('/myEndpoint', {
68
+ * body: {'foo': 'bar'},
69
+ * headers: {'content-type': 'application/json'},
70
+ * authentication: {username: 'user', password: 'pass'}
71
+ * })
72
+ * @constructor
73
+ * @param {string} path - Path to resource
74
+ * @param {object} params - Body, Query, Headers and Authentication parameters
75
+ * @param {function} callback - (Optional) Callback function
76
+ * @returns {operation}
77
+ */
78
+ 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
+ /**
98
+ * Make a PUT request
99
+ * @public
100
+ * @example
101
+ * put('/myEndpoint', {
102
+ * body: {'foo': 'bar'},
103
+ * headers: {'content-type': 'application/json'},
104
+ * authentication: {username: 'user', password: 'pass'}
105
+ * })
106
+ * @constructor
107
+ * @param {string} path - Path to resource
108
+ * @param {object} params - Body, Query, Headers and Auth parameters
109
+ * @param {function} callback - (Optional) Callback function
110
+ * @returns {Operation}
111
+ */
112
+ 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
+ /**
132
+ * Make a PATCH request
133
+ * @public
134
+ * @example
135
+ * patch('/myEndpoint', {
136
+ * body: {'foo': 'bar'},
137
+ * headers: {'content-type': 'application/json'},
138
+ * authentication: {username: 'user', password: 'pass'}
139
+ * })
140
+ * @constructor
141
+ * @param {string} path - Path to resource
142
+ * @param {object} params - Body, Query, Headers and Auth parameters
143
+ * @param {function} callback - (Optional) Callback function
144
+ * @returns {Operation}
145
+ */
146
+ 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
+ /**
166
+ * Make a DELETE request
167
+ * @public
168
+ * @example
169
+ * del(`/myendpoint/${state => state.data.id}`, {
170
+ * headers: {'content-type': 'application/json'}
171
+ * })
172
+ * @constructor
173
+ * @param {string} path - Path to resource
174
+ * @param {object} params - Body, Query, Headers and Auth parameters
175
+ * @param {function} callback - (Optional) Callback function
176
+ * @returns {Operation}
177
+ */
178
+ 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
+ /**
196
+ * Parse XML with the Cheerio parser
197
+ * @public
198
+ * @example
199
+ * parseXML(body, function($){
200
+ * return $("table[class=your_table]").parsetable(true, true, true);
201
+ * })
202
+ * @constructor
203
+ * @param {String} body - data string to be parsed
204
+ * @param {function} script - script for extracting data
205
+ * @returns {Operation}
206
+ */
207
+ 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
+ /**
224
+ * CSV-Parse for CSV conversion to JSON
225
+ * @public
226
+ * @example
227
+ * parseCSV("/home/user/someData.csv", {
228
+ * quoteChar: '"',
229
+ * header: false,
230
+ * });
231
+ * @constructor
232
+ * @param {String} target - string or local file with CSV data
233
+ * @param {Object} config - csv-parse config object
234
+ * @returns {Operation}
235
+ */
236
+ 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
+ /**
254
+ * Make a request using the 'request' node module. This module is deprecated.
255
+ * @example
256
+ * request(params);
257
+ * @constructor
258
+ * @param {object} params - Query, Headers and Authentication parameters
259
+ * @returns {Operation}
260
+ */
261
+ 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
+ export const axios: import("../../common/node_modules/axios").AxiosStatic;
274
+ export { alterState, arrayToString, combine, dataPath, dataValue, dateFns, each, field, fields, fn, http, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray } from "@openfn/language-common";
@@ -0,0 +1,9 @@
1
+ export function setUrl(configuration: any, path: any): any;
2
+ export function setAuth(configuration: any, manualAuth: any): any;
3
+ export function assembleError({ response, error, params }: {
4
+ response: any;
5
+ error: any;
6
+ params: any;
7
+ }): any;
8
+ export function tryJson(data: any): any;
9
+ export function mapToAxiosConfig(requestConfig: any): any;
package/types/index.d.ts CHANGED
@@ -1,309 +1,3 @@
1
- /**
2
- * Execute a sequence of operations.
3
- * Wraps `language-common/execute`, and prepends initial state for http.
4
- * @example
5
- * execute(
6
- * create('foo'),
7
- * delete('bar')
8
- * )(state)
9
- * @constructor
10
- * @param {Operations} operations - Operations to be performed.
11
- * @returns {Operation}
12
- */
13
- declare function execute(...operations: Operations): Operation;
14
- declare 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
- /**
30
- * Make a GET request
31
- * @public
32
- * @example
33
- * get('/myEndpoint', {
34
- * query: {foo: 'bar', a: 1},
35
- * headers: {'content-type': 'application/json'},
36
- * authentication: {username: 'user', password: 'pass'}
37
- * })
38
- * @constructor
39
- * @param {string} path - Path to resource
40
- * @param {object} params - Query, Headers and Authentication parameters
41
- * @param {function} callback - (Optional) Callback function
42
- * @returns {Operation}
43
- */
44
- declare function get(path: string, params: object, callback: Function): Operation;
45
- declare 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
- /**
64
- * Make a POST request
65
- * @public
66
- * @example
67
- * post('/myEndpoint', {
68
- * body: {'foo': 'bar'},
69
- * headers: {'content-type': 'application/json'},
70
- * authentication: {username: 'user', password: 'pass'}
71
- * })
72
- * @constructor
73
- * @param {string} path - Path to resource
74
- * @param {object} params - Body, Query, Headers and Authentication parameters
75
- * @param {function} callback - (Optional) Callback function
76
- * @returns {operation}
77
- */
78
- declare function post(path: string, params: object, callback: Function): operation;
79
- declare 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
- /**
98
- * Make a PUT request
99
- * @public
100
- * @example
101
- * put('/myEndpoint', {
102
- * body: {'foo': 'bar'},
103
- * headers: {'content-type': 'application/json'},
104
- * authentication: {username: 'user', password: 'pass'}
105
- * })
106
- * @constructor
107
- * @param {string} path - Path to resource
108
- * @param {object} params - Body, Query, Headers and Auth parameters
109
- * @param {function} callback - (Optional) Callback function
110
- * @returns {Operation}
111
- */
112
- declare function put(path: string, params: object, callback: Function): Operation;
113
- declare 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
- /**
132
- * Make a PATCH request
133
- * @public
134
- * @example
135
- * patch('/myEndpoint', {
136
- * body: {'foo': 'bar'},
137
- * headers: {'content-type': 'application/json'},
138
- * authentication: {username: 'user', password: 'pass'}
139
- * })
140
- * @constructor
141
- * @param {string} path - Path to resource
142
- * @param {object} params - Body, Query, Headers and Auth parameters
143
- * @param {function} callback - (Optional) Callback function
144
- * @returns {Operation}
145
- */
146
- declare function patch(path: string, params: object, callback: Function): Operation;
147
- declare 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
- /**
166
- * Make a DELETE request
167
- * @public
168
- * @example
169
- * del(`/myendpoint/${state => state.data.id}`, {
170
- * headers: {'content-type': 'application/json'}
171
- * })
172
- * @constructor
173
- * @param {string} path - Path to resource
174
- * @param {object} params - Body, Query, Headers and Auth parameters
175
- * @param {function} callback - (Optional) Callback function
176
- * @returns {Operation}
177
- */
178
- declare function del(path: string, params: object, callback: Function): Operation;
179
- declare 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
- /**
196
- * Parse XML with the Cheerio parser
197
- * @public
198
- * @example
199
- * parseXML(body, function($){
200
- * return $("table[class=your_table]").parsetable(true, true, true);
201
- * })
202
- * @constructor
203
- * @param {String} body - data string to be parsed
204
- * @param {function} script - script for extracting data
205
- * @returns {Operation}
206
- */
207
- declare function parseXML(body: string, script: Function): Operation;
208
- declare 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
- /**
224
- * CSV-Parse for CSV conversion to JSON
225
- * @public
226
- * @example
227
- * parseCSV("/home/user/someData.csv", {
228
- * quoteChar: '"',
229
- * header: false,
230
- * });
231
- * @constructor
232
- * @param {String} target - string or local file with CSV data
233
- * @param {Object} config - csv-parse config object
234
- * @returns {Operation}
235
- */
236
- declare function parseCSV(target: string, config: any): Operation;
237
- declare 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
- /**
254
- * Make a request using the 'request' node module. This module is deprecated.
255
- * @example
256
- * request(params);
257
- * @constructor
258
- * @param {object} params - Query, Headers and Authentication parameters
259
- * @returns {Operation}
260
- */
261
- declare function request(params: object): Operation;
262
- declare 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
- declare const axios: any;
274
-
275
- type Adaptor_execute = execute;
276
- declare const Adaptor_execute: typeof execute;
277
- type Adaptor_get = get;
278
- declare const Adaptor_get: typeof get;
279
- type Adaptor_post = post;
280
- declare const Adaptor_post: typeof post;
281
- type Adaptor_put = put;
282
- declare const Adaptor_put: typeof put;
283
- type Adaptor_patch = patch;
284
- declare const Adaptor_patch: typeof patch;
285
- type Adaptor_del = del;
286
- declare const Adaptor_del: typeof del;
287
- type Adaptor_parseXML = parseXML;
288
- declare const Adaptor_parseXML: typeof parseXML;
289
- type Adaptor_parseCSV = parseCSV;
290
- declare const Adaptor_parseCSV: typeof parseCSV;
291
- type Adaptor_request = request;
292
- declare const Adaptor_request: typeof request;
293
- declare const Adaptor_axios: typeof axios;
294
- declare namespace Adaptor {
295
- export {
296
- Adaptor_execute as execute,
297
- Adaptor_get as get,
298
- Adaptor_post as post,
299
- Adaptor_put as put,
300
- Adaptor_patch as patch,
301
- Adaptor_del as del,
302
- Adaptor_parseXML as parseXML,
303
- Adaptor_parseCSV as parseCSV,
304
- Adaptor_request as request,
305
- Adaptor_axios as axios,
306
- };
307
- }
308
-
309
- export { Adaptor, Adaptor as default };
1
+ export default Adaptor;
2
+ export * from "./Adaptor";
3
+ import * as Adaptor from "./Adaptor";