@openfn/language-http 5.1.1 → 6.0.0
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/ast.json +135 -9
- package/dist/index.cjs +111 -284
- package/dist/index.js +82 -250
- package/package.json +9 -15
- package/types/Adaptor.d.ts +82 -27
- package/types/Utils.d.ts +2 -9
package/dist/index.cjs
CHANGED
|
@@ -25,355 +25,183 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
25
25
|
// src/index.js
|
|
26
26
|
var src_exports = {};
|
|
27
27
|
__export(src_exports, {
|
|
28
|
-
alterState: () =>
|
|
29
|
-
arrayToString: () =>
|
|
30
|
-
|
|
31
|
-
combine: () =>
|
|
32
|
-
dataPath: () =>
|
|
33
|
-
dataValue: () =>
|
|
34
|
-
dateFns: () =>
|
|
28
|
+
alterState: () => import_language_common3.alterState,
|
|
29
|
+
arrayToString: () => import_language_common3.arrayToString,
|
|
30
|
+
chunk: () => import_language_common3.chunk,
|
|
31
|
+
combine: () => import_language_common3.combine,
|
|
32
|
+
dataPath: () => import_language_common3.dataPath,
|
|
33
|
+
dataValue: () => import_language_common3.dataValue,
|
|
34
|
+
dateFns: () => import_language_common3.dateFns,
|
|
35
35
|
default: () => src_default,
|
|
36
36
|
del: () => del,
|
|
37
|
-
each: () =>
|
|
37
|
+
each: () => import_language_common3.each,
|
|
38
38
|
execute: () => execute,
|
|
39
|
-
field: () =>
|
|
40
|
-
fields: () =>
|
|
41
|
-
fn: () =>
|
|
39
|
+
field: () => import_language_common3.field,
|
|
40
|
+
fields: () => import_language_common3.fields,
|
|
41
|
+
fn: () => import_language_common3.fn,
|
|
42
42
|
get: () => get,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
parseCsv: () => import_language_common2.parseCsv,
|
|
43
|
+
humanProper: () => import_language_common3.humanProper,
|
|
44
|
+
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
45
|
+
merge: () => import_language_common3.merge,
|
|
46
|
+
parseCsv: () => import_language_common3.parseCsv,
|
|
48
47
|
parseXML: () => parseXML,
|
|
49
48
|
patch: () => patch,
|
|
50
49
|
post: () => post,
|
|
51
50
|
put: () => put,
|
|
52
|
-
request: () =>
|
|
53
|
-
scrubEmojis: () =>
|
|
54
|
-
sourceValue: () =>
|
|
55
|
-
splitKeys: () =>
|
|
56
|
-
toArray: () =>
|
|
51
|
+
request: () => request2,
|
|
52
|
+
scrubEmojis: () => import_language_common3.scrubEmojis,
|
|
53
|
+
sourceValue: () => import_language_common3.sourceValue,
|
|
54
|
+
splitKeys: () => import_language_common3.splitKeys,
|
|
55
|
+
toArray: () => import_language_common3.toArray
|
|
57
56
|
});
|
|
58
57
|
module.exports = __toCommonJS(src_exports);
|
|
59
58
|
|
|
60
59
|
// src/Adaptor.js
|
|
61
60
|
var Adaptor_exports = {};
|
|
62
61
|
__export(Adaptor_exports, {
|
|
63
|
-
alterState: () =>
|
|
64
|
-
arrayToString: () =>
|
|
65
|
-
|
|
66
|
-
combine: () =>
|
|
67
|
-
dataPath: () =>
|
|
68
|
-
dataValue: () =>
|
|
69
|
-
dateFns: () =>
|
|
62
|
+
alterState: () => import_language_common3.alterState,
|
|
63
|
+
arrayToString: () => import_language_common3.arrayToString,
|
|
64
|
+
chunk: () => import_language_common3.chunk,
|
|
65
|
+
combine: () => import_language_common3.combine,
|
|
66
|
+
dataPath: () => import_language_common3.dataPath,
|
|
67
|
+
dataValue: () => import_language_common3.dataValue,
|
|
68
|
+
dateFns: () => import_language_common3.dateFns,
|
|
70
69
|
del: () => del,
|
|
71
|
-
each: () =>
|
|
70
|
+
each: () => import_language_common3.each,
|
|
72
71
|
execute: () => execute,
|
|
73
|
-
field: () =>
|
|
74
|
-
fields: () =>
|
|
75
|
-
fn: () =>
|
|
72
|
+
field: () => import_language_common3.field,
|
|
73
|
+
fields: () => import_language_common3.fields,
|
|
74
|
+
fn: () => import_language_common3.fn,
|
|
76
75
|
get: () => get,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
parseCsv: () => import_language_common2.parseCsv,
|
|
76
|
+
humanProper: () => import_language_common3.humanProper,
|
|
77
|
+
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
78
|
+
merge: () => import_language_common3.merge,
|
|
79
|
+
parseCsv: () => import_language_common3.parseCsv,
|
|
82
80
|
parseXML: () => parseXML,
|
|
83
81
|
patch: () => patch,
|
|
84
82
|
post: () => post,
|
|
85
83
|
put: () => put,
|
|
86
|
-
request: () =>
|
|
87
|
-
scrubEmojis: () =>
|
|
88
|
-
sourceValue: () =>
|
|
89
|
-
splitKeys: () =>
|
|
90
|
-
toArray: () =>
|
|
84
|
+
request: () => request2,
|
|
85
|
+
scrubEmojis: () => import_language_common3.scrubEmojis,
|
|
86
|
+
sourceValue: () => import_language_common3.sourceValue,
|
|
87
|
+
splitKeys: () => import_language_common3.splitKeys,
|
|
88
|
+
toArray: () => import_language_common3.toArray
|
|
91
89
|
});
|
|
90
|
+
var import_language_common2 = require("@openfn/language-common");
|
|
91
|
+
var import_cheerio = __toESM(require("cheerio"), 1);
|
|
92
|
+
var import_cheerio_tableparser = __toESM(require("cheerio-tableparser"), 1);
|
|
92
93
|
|
|
93
94
|
// src/Utils.js
|
|
94
|
-
var
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
if (isValidHttpUrl(path))
|
|
101
|
-
return path;
|
|
102
|
-
if (baseUrl)
|
|
103
|
-
return `${baseUrl.replace(/\/$/, "")}/${path.replace(/^\/+/g, "")}`;
|
|
104
|
-
return path;
|
|
105
|
-
}
|
|
106
|
-
function isValidHttpUrl(string) {
|
|
107
|
-
let url;
|
|
108
|
-
try {
|
|
109
|
-
url = new URL(string);
|
|
110
|
-
} catch (_2) {
|
|
111
|
-
return false;
|
|
95
|
+
var import_language_common = require("@openfn/language-common");
|
|
96
|
+
var import_util = require("@openfn/language-common/util");
|
|
97
|
+
function addBasicAuth(configuration = {}, headers) {
|
|
98
|
+
const { username, password } = configuration;
|
|
99
|
+
if (username && password) {
|
|
100
|
+
Object.assign(headers, (0, import_util.makeBasicAuthHeader)(username, password));
|
|
112
101
|
}
|
|
113
|
-
return url.protocol === "http:" || url.protocol === "https:";
|
|
114
|
-
}
|
|
115
|
-
function setAuth(configuration, manualAuth) {
|
|
116
|
-
if (manualAuth)
|
|
117
|
-
return manualAuth;
|
|
118
|
-
else if (configuration && configuration.username)
|
|
119
|
-
return {
|
|
120
|
-
username: configuration.username,
|
|
121
|
-
password: configuration.password
|
|
122
|
-
};
|
|
123
|
-
else
|
|
124
|
-
return null;
|
|
125
102
|
}
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const status = (response == null ? void 0 : response.status) || (response == null ? void 0 : response.statusCode);
|
|
131
|
-
if ((customCodes || [200, 201, 202]).indexOf(status) > -1) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
103
|
+
function encodeFormBody(data) {
|
|
104
|
+
const form = new FormData();
|
|
105
|
+
for (const [key, value] of Object.entries(data)) {
|
|
106
|
+
form.append(key, value);
|
|
134
107
|
}
|
|
135
|
-
|
|
136
|
-
return error;
|
|
137
|
-
delete response.request;
|
|
138
|
-
delete response.connection;
|
|
139
|
-
return new Error((0, import_fast_safe_stringify.default)(response, null, 2));
|
|
108
|
+
return form;
|
|
140
109
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
110
|
+
function request(method, path, params, callback = (s) => s) {
|
|
111
|
+
return (state) => {
|
|
112
|
+
var _a;
|
|
113
|
+
const [resolvedPath, resolvedParams = {}] = (0, import_util.expandReferences)(
|
|
114
|
+
state,
|
|
115
|
+
path,
|
|
116
|
+
params
|
|
117
|
+
);
|
|
118
|
+
let { body, headers = {} } = resolvedParams;
|
|
119
|
+
if (resolvedParams.json) {
|
|
120
|
+
console.warn(
|
|
121
|
+
"WARNING: The `json` option has been deprecated. Use `body` instead"
|
|
122
|
+
);
|
|
123
|
+
body = resolvedParams.json;
|
|
147
124
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
function mapToAxiosConfig(requestConfig) {
|
|
152
|
-
let form = null;
|
|
153
|
-
const formData = (requestConfig == null ? void 0 : requestConfig.formData) || (requestConfig == null ? void 0 : requestConfig.form);
|
|
154
|
-
let headers = requestConfig == null ? void 0 : requestConfig.headers;
|
|
155
|
-
if ((requestConfig == null ? void 0 : requestConfig.gzip) === true) {
|
|
156
|
-
headers = { ...headers, "Accept-Encoding": "gzip, deflate" };
|
|
157
|
-
}
|
|
158
|
-
if (!isEmpty(formData)) {
|
|
159
|
-
form = new import_form_data.default();
|
|
160
|
-
Object.entries(formData).forEach((element) => {
|
|
161
|
-
form.append(element[0], element[1]);
|
|
162
|
-
});
|
|
163
|
-
const formHeaders = form.getHeaders();
|
|
164
|
-
headers = { ...headers, ...formHeaders };
|
|
165
|
-
}
|
|
166
|
-
if (requestConfig == null ? void 0 : requestConfig.json) {
|
|
167
|
-
headers = { ...headers, "Content-type": "application/json" };
|
|
168
|
-
if (typeof (requestConfig == null ? void 0 : requestConfig.json) === "object") {
|
|
169
|
-
requestConfig = { ...requestConfig, body: requestConfig == null ? void 0 : requestConfig.json };
|
|
125
|
+
if (resolvedParams.form) {
|
|
126
|
+
body = encodeFormBody(resolvedParams.form);
|
|
170
127
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
128
|
+
const baseUrl = (_a = state.configuration) == null ? void 0 : _a.baseUrl;
|
|
129
|
+
addBasicAuth(state.configuration, headers);
|
|
130
|
+
const maxRedirections = resolvedParams.maxRedirections ?? (resolvedParams.followAllRedirects === false ? 0 : 5);
|
|
131
|
+
const tls = resolvedParams.tls ?? resolvedParams.agentOptions;
|
|
132
|
+
if (resolvedParams.agentOptions) {
|
|
133
|
+
console.warn(
|
|
134
|
+
"WARNING: The `agentOptions` option has been deprecated. Use `tls` instead"
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const options = {
|
|
138
|
+
...resolvedParams,
|
|
139
|
+
headers,
|
|
140
|
+
baseUrl,
|
|
141
|
+
body,
|
|
142
|
+
tls,
|
|
143
|
+
maxRedirections
|
|
144
|
+
};
|
|
145
|
+
return (0, import_util.request)(method, resolvedPath, options).then((response) => {
|
|
146
|
+
(0, import_util.logResponse)(response);
|
|
147
|
+
return {
|
|
148
|
+
...(0, import_language_common.composeNextState)(state, response.body),
|
|
149
|
+
response
|
|
150
|
+
};
|
|
151
|
+
}).then(callback).catch((err) => {
|
|
152
|
+
(0, import_util.logResponse)(err);
|
|
153
|
+
throw err;
|
|
154
|
+
});
|
|
193
155
|
};
|
|
194
|
-
return finalConfig;
|
|
195
156
|
}
|
|
196
157
|
|
|
197
158
|
// src/Adaptor.js
|
|
198
|
-
var
|
|
199
|
-
var import_request = __toESM(require("request"), 1);
|
|
200
|
-
var import_cheerio = __toESM(require("cheerio"), 1);
|
|
201
|
-
var import_cheerio_tableparser = __toESM(require("cheerio-tableparser"), 1);
|
|
202
|
-
var import_tough_cookie = __toESM(require("tough-cookie"), 1);
|
|
203
|
-
var import_language_common2 = require("@openfn/language-common");
|
|
204
|
-
var { axios } = import_language_common.http;
|
|
159
|
+
var import_language_common3 = require("@openfn/language-common");
|
|
205
160
|
function execute(...operations) {
|
|
206
161
|
const initialState = {
|
|
207
162
|
references: [],
|
|
208
163
|
data: null
|
|
209
164
|
};
|
|
210
165
|
return (state) => {
|
|
211
|
-
return (0,
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
var cookiejar = new import_tough_cookie.default.CookieJar();
|
|
215
|
-
var Cookie = import_tough_cookie.default.Cookie;
|
|
216
|
-
axios.interceptors.request.use((config) => {
|
|
217
|
-
cookiejar == null ? void 0 : cookiejar.getCookies(config.url, (err, cookies) => {
|
|
218
|
-
config.headers.cookie = cookies == null ? void 0 : cookies.join("; ");
|
|
219
|
-
});
|
|
220
|
-
return config;
|
|
221
|
-
});
|
|
222
|
-
function handleCookies(response) {
|
|
223
|
-
var _a, _b;
|
|
224
|
-
const { config, data, headers } = response;
|
|
225
|
-
if (config.keepCookie) {
|
|
226
|
-
let cookies;
|
|
227
|
-
let keepCookies = [];
|
|
228
|
-
if (headers["set-cookie"]) {
|
|
229
|
-
if (headers["set-cookie"] instanceof Array) {
|
|
230
|
-
cookies = (_a = headers["set-cookie"]) == null ? void 0 : _a.map(Cookie.parse);
|
|
231
|
-
} else {
|
|
232
|
-
cookies = [Cookie.parse(headers["set-cookie"])];
|
|
233
|
-
}
|
|
234
|
-
(_b = headers["set-cookie"]) == null ? void 0 : _b.forEach((c) => {
|
|
235
|
-
cookiejar.setCookie(Cookie.parse(c), config.url, (err, cookie) => {
|
|
236
|
-
keepCookies == null ? void 0 : keepCookies.push(cookie == null ? void 0 : cookie.cookieString());
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
const extendableData = Array.isArray(data) ? { body: data } : data;
|
|
241
|
-
return {
|
|
242
|
-
...response,
|
|
243
|
-
data: {
|
|
244
|
-
...extendableData,
|
|
245
|
-
__cookie: (keepCookies == null ? void 0 : keepCookies.length) === 1 ? keepCookies[0] : keepCookies,
|
|
246
|
-
__headers: response.headers
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
return response;
|
|
251
|
-
}
|
|
252
|
-
function handleResponse(state, response) {
|
|
253
|
-
console.log(
|
|
254
|
-
response.config.method.toUpperCase(),
|
|
255
|
-
"request succeeded with",
|
|
256
|
-
response.status,
|
|
257
|
-
"\u2713"
|
|
258
|
-
);
|
|
259
|
-
const { method, path, host, protocol, _headers } = response.request;
|
|
260
|
-
response.request = { method, path, host, protocol, _headers };
|
|
261
|
-
const compatibleResp = {
|
|
262
|
-
...response,
|
|
263
|
-
httpStatus: response.status,
|
|
264
|
-
message: response.statusText,
|
|
265
|
-
data: tryJson(response.data)
|
|
266
|
-
};
|
|
267
|
-
const respWithCookies = handleCookies(compatibleResp);
|
|
268
|
-
return {
|
|
269
|
-
...(0, import_language_common.composeNextState)(state, respWithCookies.data),
|
|
270
|
-
response: respWithCookies
|
|
166
|
+
return (0, import_language_common2.execute)(...operations)({ ...initialState, ...state });
|
|
271
167
|
};
|
|
272
168
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
return callback(state);
|
|
276
|
-
return state;
|
|
169
|
+
function request2(method, path, params, callback) {
|
|
170
|
+
return request(method, path, params, callback);
|
|
277
171
|
}
|
|
278
172
|
function get(path, params, callback) {
|
|
279
|
-
return (
|
|
280
|
-
const resolvedPath = (0, import_language_common.expandReferences)(path)(state);
|
|
281
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
282
|
-
const url = setUrl(state.configuration, resolvedPath);
|
|
283
|
-
const auth = setAuth(
|
|
284
|
-
state.configuration,
|
|
285
|
-
(resolvedParams == null ? void 0 : resolvedParams.authentication) ?? (resolvedParams == null ? void 0 : resolvedParams.auth)
|
|
286
|
-
);
|
|
287
|
-
const config = mapToAxiosConfig({ ...resolvedParams, url, auth });
|
|
288
|
-
return import_language_common.http.get(config)(state).then((response) => handleResponse(state, response)).then((nextState) => handleCallback(nextState, callback));
|
|
289
|
-
};
|
|
173
|
+
return request("GET", path, params, callback);
|
|
290
174
|
}
|
|
291
175
|
function post(path, params, callback) {
|
|
292
|
-
return (
|
|
293
|
-
const resolvedPath = (0, import_language_common.expandReferences)(path)(state);
|
|
294
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
295
|
-
const url = setUrl(state.configuration, resolvedPath);
|
|
296
|
-
const auth = setAuth(
|
|
297
|
-
state.configuration,
|
|
298
|
-
(resolvedParams == null ? void 0 : resolvedParams.authentication) ?? (resolvedParams == null ? void 0 : resolvedParams.auth)
|
|
299
|
-
);
|
|
300
|
-
const config = mapToAxiosConfig({ ...resolvedParams, url, auth });
|
|
301
|
-
return import_language_common.http.post(config)(state).then((response) => handleResponse(state, response)).then((nextState) => handleCallback(nextState, callback));
|
|
302
|
-
};
|
|
176
|
+
return request("POST", path, params, callback);
|
|
303
177
|
}
|
|
304
178
|
function put(path, params, callback) {
|
|
305
|
-
return (
|
|
306
|
-
const resolvedPath = (0, import_language_common.expandReferences)(path)(state);
|
|
307
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
308
|
-
const url = setUrl(state.configuration, resolvedPath);
|
|
309
|
-
const auth = setAuth(
|
|
310
|
-
state.configuration,
|
|
311
|
-
(resolvedParams == null ? void 0 : resolvedParams.authentication) ?? (resolvedParams == null ? void 0 : resolvedParams.auth)
|
|
312
|
-
);
|
|
313
|
-
const config = mapToAxiosConfig({ ...resolvedParams, url, auth });
|
|
314
|
-
return import_language_common.http.put(config)(state).then((response) => handleResponse(state, response)).then((nextState) => handleCallback(nextState, callback));
|
|
315
|
-
};
|
|
179
|
+
return request("PUT", path, params, callback);
|
|
316
180
|
}
|
|
317
181
|
function patch(path, params, callback) {
|
|
318
|
-
return (
|
|
319
|
-
const resolvedPath = (0, import_language_common.expandReferences)(path)(state);
|
|
320
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
321
|
-
const url = setUrl(state.configuration, resolvedPath);
|
|
322
|
-
const auth = setAuth(
|
|
323
|
-
state.configuration,
|
|
324
|
-
(resolvedParams == null ? void 0 : resolvedParams.authentication) ?? (resolvedParams == null ? void 0 : resolvedParams.auth)
|
|
325
|
-
);
|
|
326
|
-
const config = mapToAxiosConfig({ ...resolvedParams, url, auth });
|
|
327
|
-
return import_language_common.http.patch(config)(state).then((response) => handleResponse(state, response)).then((nextState) => handleCallback(nextState, callback));
|
|
328
|
-
};
|
|
182
|
+
return request("PATCH", path, params, callback);
|
|
329
183
|
}
|
|
330
184
|
function del(path, params, callback) {
|
|
331
|
-
return (
|
|
332
|
-
const resolvedPath = (0, import_language_common.expandReferences)(path)(state);
|
|
333
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
334
|
-
const url = setUrl(state.configuration, resolvedPath);
|
|
335
|
-
const auth = setAuth(
|
|
336
|
-
state.configuration,
|
|
337
|
-
(resolvedParams == null ? void 0 : resolvedParams.authentication) ?? resolvedParams.auth
|
|
338
|
-
);
|
|
339
|
-
const config = mapToAxiosConfig({ ...resolvedParams, url, auth });
|
|
340
|
-
return import_language_common.http.delete(config)(state).then((response) => handleResponse(state, response)).then((nextState) => handleCallback(nextState, callback));
|
|
341
|
-
};
|
|
185
|
+
return request("DELETE", path, params, callback);
|
|
342
186
|
}
|
|
343
187
|
function parseXML(body, script) {
|
|
344
188
|
return (state) => {
|
|
345
|
-
const resolvedBody = (0,
|
|
189
|
+
const resolvedBody = (0, import_language_common2.expandReferences)(body)(state);
|
|
346
190
|
const $ = import_cheerio.default.load(resolvedBody);
|
|
347
191
|
(0, import_cheerio_tableparser.default)($);
|
|
348
192
|
if (script) {
|
|
349
193
|
const result = script($);
|
|
350
194
|
try {
|
|
351
195
|
const r = JSON.parse(result);
|
|
352
|
-
return (0,
|
|
196
|
+
return (0, import_language_common2.composeNextState)(state, r);
|
|
353
197
|
} catch (e) {
|
|
354
|
-
return (0,
|
|
198
|
+
return (0, import_language_common2.composeNextState)(state, { body: result });
|
|
355
199
|
}
|
|
356
200
|
} else {
|
|
357
|
-
return (0,
|
|
201
|
+
return (0, import_language_common2.composeNextState)(state, { body: resolvedBody });
|
|
358
202
|
}
|
|
359
203
|
};
|
|
360
204
|
}
|
|
361
|
-
function request(params) {
|
|
362
|
-
return (state) => {
|
|
363
|
-
const resolvedParams = import_language_common.http.expandRequestReferences(params)(state);
|
|
364
|
-
return new Promise((resolve, reject) => {
|
|
365
|
-
(0, import_request.default)(resolvedParams, (err, response, body) => {
|
|
366
|
-
const error = assembleError({ error: err, response, resolvedParams });
|
|
367
|
-
error && reject(error);
|
|
368
|
-
console.log(
|
|
369
|
-
"\u2713 Request succeeded. (The response body available in state.)"
|
|
370
|
-
);
|
|
371
|
-
const resp = tryJson(body);
|
|
372
|
-
resolve(resp);
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
205
|
|
|
378
206
|
// src/index.js
|
|
379
207
|
var src_default = Adaptor_exports;
|
|
@@ -381,7 +209,7 @@ var src_default = Adaptor_exports;
|
|
|
381
209
|
0 && (module.exports = {
|
|
382
210
|
alterState,
|
|
383
211
|
arrayToString,
|
|
384
|
-
|
|
212
|
+
chunk,
|
|
385
213
|
combine,
|
|
386
214
|
dataPath,
|
|
387
215
|
dataValue,
|
|
@@ -393,7 +221,6 @@ var src_default = Adaptor_exports;
|
|
|
393
221
|
fields,
|
|
394
222
|
fn,
|
|
395
223
|
get,
|
|
396
|
-
http,
|
|
397
224
|
humanProper,
|
|
398
225
|
lastReferenceValue,
|
|
399
226
|
merge,
|