@openfn/language-common 3.0.1 → 3.0.3
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 +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.js +4 -3
- package/dist/util.cjs +2 -2
- package/dist/util.js +2 -2
- package/package.json +1 -1
- package/types/Adaptor.d.ts +1 -1
- package/types/util/http.d.ts +1 -1
package/ast.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -285,7 +285,7 @@ var assertOK = async (response, errorMap, fullUrl, method, startTime) => {
|
|
|
285
285
|
throw error;
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
|
-
var ERROR_ABSOLUTE_URL = "Absolute URLs not
|
|
288
|
+
var ERROR_ABSOLUTE_URL = "Absolute URLs not supported";
|
|
289
289
|
var assertRelativeUrl = (path2) => {
|
|
290
290
|
if (/https?:\/\//.test(path2)) {
|
|
291
291
|
const e = new Error("UNEXPECTED_ABSOLUTE_URL");
|
|
@@ -421,7 +421,7 @@ async function readResponseBody(response, parseAs) {
|
|
|
421
421
|
throw_error_default(response.statusCode, {
|
|
422
422
|
description: "Error parsing the response body",
|
|
423
423
|
parseAs,
|
|
424
|
-
contentType
|
|
424
|
+
contentType,
|
|
425
425
|
bodyLength: contentLength,
|
|
426
426
|
error: error.message
|
|
427
427
|
});
|
|
@@ -958,24 +958,25 @@ __export(http_exports, {
|
|
|
958
958
|
post: () => post2,
|
|
959
959
|
request: () => req
|
|
960
960
|
});
|
|
961
|
-
var
|
|
961
|
+
var import_lodash3 = __toESM(require("lodash"), 1);
|
|
962
|
+
var { set } = import_lodash3.default;
|
|
962
963
|
var helpers = {
|
|
963
964
|
json: function() {
|
|
964
|
-
(
|
|
965
|
+
set(this, "headers.Content-Type", "application/json");
|
|
965
966
|
return this;
|
|
966
967
|
},
|
|
967
968
|
basic: function(username, password) {
|
|
968
969
|
const buff = Buffer.from(`${username}:${password}`);
|
|
969
970
|
const credentials = buff.toString("base64");
|
|
970
|
-
(
|
|
971
|
+
set(this, "headers.Authorization", `Basic ${credentials}`);
|
|
971
972
|
return this;
|
|
972
973
|
},
|
|
973
974
|
bearer: function(token) {
|
|
974
|
-
(
|
|
975
|
+
set(this, "headers.Authorization", `Bearer ${token}`);
|
|
975
976
|
return this;
|
|
976
977
|
},
|
|
977
978
|
oauth: function(token) {
|
|
978
|
-
(
|
|
979
|
+
set(this, "headers.Authorization", `Bearer ${token}`);
|
|
979
980
|
return this;
|
|
980
981
|
}
|
|
981
982
|
};
|
package/dist/index.js
CHANGED
|
@@ -220,7 +220,7 @@ var assertOK = async (response, errorMap, fullUrl, method, startTime) => {
|
|
|
220
220
|
throw error;
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
|
-
var ERROR_ABSOLUTE_URL = "Absolute URLs not
|
|
223
|
+
var ERROR_ABSOLUTE_URL = "Absolute URLs not supported";
|
|
224
224
|
var assertRelativeUrl = (path2) => {
|
|
225
225
|
if (/https?:\/\//.test(path2)) {
|
|
226
226
|
const e = new Error("UNEXPECTED_ABSOLUTE_URL");
|
|
@@ -356,7 +356,7 @@ async function readResponseBody(response, parseAs) {
|
|
|
356
356
|
throw_error_default(response.statusCode, {
|
|
357
357
|
description: "Error parsing the response body",
|
|
358
358
|
parseAs,
|
|
359
|
-
contentType
|
|
359
|
+
contentType,
|
|
360
360
|
bodyLength: contentLength,
|
|
361
361
|
error: error.message
|
|
362
362
|
});
|
|
@@ -893,7 +893,8 @@ __export(http_exports, {
|
|
|
893
893
|
post: () => post2,
|
|
894
894
|
request: () => req
|
|
895
895
|
});
|
|
896
|
-
import
|
|
896
|
+
import _3 from "lodash";
|
|
897
|
+
var { set } = _3;
|
|
897
898
|
var helpers = {
|
|
898
899
|
json: function() {
|
|
899
900
|
set(this, "headers.Content-Type", "application/json");
|
package/dist/util.cjs
CHANGED
|
@@ -192,7 +192,7 @@ var assertOK = async (response, errorMap, fullUrl, method, startTime) => {
|
|
|
192
192
|
throw error;
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
|
-
var ERROR_ABSOLUTE_URL = "Absolute URLs not
|
|
195
|
+
var ERROR_ABSOLUTE_URL = "Absolute URLs not supported";
|
|
196
196
|
var assertRelativeUrl = (path2) => {
|
|
197
197
|
if (/https?:\/\//.test(path2)) {
|
|
198
198
|
const e = new Error("UNEXPECTED_ABSOLUTE_URL");
|
|
@@ -328,7 +328,7 @@ async function readResponseBody(response, parseAs) {
|
|
|
328
328
|
throw_error_default(response.statusCode, {
|
|
329
329
|
description: "Error parsing the response body",
|
|
330
330
|
parseAs,
|
|
331
|
-
contentType
|
|
331
|
+
contentType,
|
|
332
332
|
bodyLength: contentLength,
|
|
333
333
|
error: error.message
|
|
334
334
|
});
|
package/dist/util.js
CHANGED
|
@@ -143,7 +143,7 @@ var assertOK = async (response, errorMap, fullUrl, method, startTime) => {
|
|
|
143
143
|
throw error;
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
|
-
var ERROR_ABSOLUTE_URL = "Absolute URLs not
|
|
146
|
+
var ERROR_ABSOLUTE_URL = "Absolute URLs not supported";
|
|
147
147
|
var assertRelativeUrl = (path2) => {
|
|
148
148
|
if (/https?:\/\//.test(path2)) {
|
|
149
149
|
const e = new Error("UNEXPECTED_ABSOLUTE_URL");
|
|
@@ -279,7 +279,7 @@ async function readResponseBody(response, parseAs) {
|
|
|
279
279
|
throw_error_default(response.statusCode, {
|
|
280
280
|
description: "Error parsing the response body",
|
|
281
281
|
parseAs,
|
|
282
|
-
contentType
|
|
282
|
+
contentType,
|
|
283
283
|
bodyLength: contentLength,
|
|
284
284
|
error: error.message
|
|
285
285
|
});
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export function alterState(func: Function): Operation;
|
|
|
33
33
|
*/
|
|
34
34
|
export function fn(func: Function): Operation;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Execute a function only when the condition returns true
|
|
37
37
|
* @public
|
|
38
38
|
* @function
|
|
39
39
|
* @example
|
package/types/util/http.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export function makeBasicAuthHeader(username: any, password: any): {
|
|
|
29
29
|
};
|
|
30
30
|
export function logResponse(response: any): any;
|
|
31
31
|
export function enableMockClient(baseUrl: any, options?: {}): import("undici/types/mock-interceptor").Interceptable;
|
|
32
|
-
export const ERROR_ABSOLUTE_URL: "Absolute URLs not
|
|
32
|
+
export const ERROR_ABSOLUTE_URL: "Absolute URLs not supported";
|
|
33
33
|
export function assertRelativeUrl(path: any): void;
|
|
34
34
|
export const ERROR_URL_MISMATCH: "Target origin does not match baseUrl origin";
|
|
35
35
|
export function parseUrl(pathOrUrl: string, baseUrl: any): {
|