@openfn/language-http 6.1.0 → 6.2.1

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 CHANGED
@@ -1304,6 +1304,83 @@
1304
1304
  ]
1305
1305
  },
1306
1306
  "valid": true
1307
+ },
1308
+ {
1309
+ "name": "cursor",
1310
+ "params": [
1311
+ "value",
1312
+ "options"
1313
+ ],
1314
+ "docs": {
1315
+ "description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones \nare not yet supported.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
1316
+ "tags": [
1317
+ {
1318
+ "title": "public",
1319
+ "description": null,
1320
+ "type": null
1321
+ },
1322
+ {
1323
+ "title": "example",
1324
+ "description": "cursor($.cursor, { defaultValue: 'today' })",
1325
+ "caption": "Use a cursor from state if present, or else use the default value"
1326
+ },
1327
+ {
1328
+ "title": "example",
1329
+ "description": "cursor(22)",
1330
+ "caption": "Use a pagination cursor"
1331
+ },
1332
+ {
1333
+ "title": "function",
1334
+ "description": null,
1335
+ "name": null
1336
+ },
1337
+ {
1338
+ "title": "param",
1339
+ "description": "the cursor value. Usually an ISO date, natural language date, or page number",
1340
+ "type": {
1341
+ "type": "NameExpression",
1342
+ "name": "any"
1343
+ },
1344
+ "name": "value"
1345
+ },
1346
+ {
1347
+ "title": "param",
1348
+ "description": "options to control the cursor.",
1349
+ "type": {
1350
+ "type": "NameExpression",
1351
+ "name": "object"
1352
+ },
1353
+ "name": "options"
1354
+ },
1355
+ {
1356
+ "title": "param",
1357
+ "description": "set the cursor key. Will persist through the whole run.",
1358
+ "type": {
1359
+ "type": "NameExpression",
1360
+ "name": "string"
1361
+ },
1362
+ "name": "options.key"
1363
+ },
1364
+ {
1365
+ "title": "param",
1366
+ "description": "the value to use if value is falsy",
1367
+ "type": {
1368
+ "type": "NameExpression",
1369
+ "name": "any"
1370
+ },
1371
+ "name": "options.defaultValue"
1372
+ },
1373
+ {
1374
+ "title": "returns",
1375
+ "description": null,
1376
+ "type": {
1377
+ "type": "NameExpression",
1378
+ "name": "Operation"
1379
+ }
1380
+ }
1381
+ ]
1382
+ },
1383
+ "valid": false
1307
1384
  }
1308
1385
  ]
1309
1386
  }
@@ -18,6 +18,15 @@
18
18
  "@some(!)Password"
19
19
  ]
20
20
  },
21
+ "token": {
22
+ "title": "Token",
23
+ "type": "string",
24
+ "description": "Bearer token or API key. This should be added manually to the Authorization header.",
25
+ "writeOnly": true,
26
+ "examples": [
27
+ "00QCjAl4MlV-WPX"
28
+ ]
29
+ },
21
30
  "baseUrl": {
22
31
  "title": "Base URL",
23
32
  "anyOf": [
@@ -37,6 +46,5 @@
37
46
  }
38
47
  },
39
48
  "type": "object",
40
- "additionalProperties": true,
41
- "required": ["password", "username"]
49
+ "additionalProperties": true
42
50
  }
package/dist/index.cjs CHANGED
@@ -29,6 +29,7 @@ __export(src_exports, {
29
29
  arrayToString: () => import_language_common3.arrayToString,
30
30
  chunk: () => import_language_common3.chunk,
31
31
  combine: () => import_language_common3.combine,
32
+ cursor: () => import_language_common3.cursor,
32
33
  dataPath: () => import_language_common3.dataPath,
33
34
  dataValue: () => import_language_common3.dataValue,
34
35
  dateFns: () => import_language_common3.dateFns,
@@ -63,6 +64,7 @@ __export(Adaptor_exports, {
63
64
  arrayToString: () => import_language_common3.arrayToString,
64
65
  chunk: () => import_language_common3.chunk,
65
66
  combine: () => import_language_common3.combine,
67
+ cursor: () => import_language_common3.cursor,
66
68
  dataPath: () => import_language_common3.dataPath,
67
69
  dataValue: () => import_language_common3.dataValue,
68
70
  dateFns: () => import_language_common3.dateFns,
@@ -96,7 +98,7 @@ var cheerio = __toESM(require("cheerio"), 1);
96
98
  var import_cheerio_tableparser = __toESM(require("cheerio-tableparser"), 1);
97
99
  function addBasicAuth(configuration = {}, headers) {
98
100
  const { username, password } = configuration;
99
- if (username && password) {
101
+ if (username && password && !headers.Authorization) {
100
102
  Object.assign(headers, (0, import_util.makeBasicAuthHeader)(username, password));
101
103
  }
102
104
  }
@@ -214,6 +216,7 @@ var src_default = Adaptor_exports;
214
216
  arrayToString,
215
217
  chunk,
216
218
  combine,
219
+ cursor,
217
220
  dataPath,
218
221
  dataValue,
219
222
  dateFns,
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ __export(Adaptor_exports, {
11
11
  arrayToString: () => arrayToString,
12
12
  chunk: () => chunk,
13
13
  combine: () => combine,
14
+ cursor: () => cursor,
14
15
  dataPath: () => dataPath,
15
16
  dataValue: () => dataValue,
16
17
  dateFns: () => dateFns,
@@ -49,7 +50,7 @@ import * as cheerio from "cheerio";
49
50
  import cheerioTableparser from "cheerio-tableparser";
50
51
  function addBasicAuth(configuration = {}, headers) {
51
52
  const { username, password } = configuration;
52
- if (username && password) {
53
+ if (username && password && !headers.Authorization) {
53
54
  Object.assign(headers, makeBasicAuthHeader(username, password));
54
55
  }
55
56
  }
@@ -131,6 +132,7 @@ import {
131
132
  alterState,
132
133
  arrayToString,
133
134
  combine,
135
+ cursor,
134
136
  dataPath,
135
137
  dataValue,
136
138
  dateFns,
@@ -186,6 +188,7 @@ export {
186
188
  arrayToString,
187
189
  chunk,
188
190
  combine,
191
+ cursor,
189
192
  dataPath,
190
193
  dataValue,
191
194
  dateFns,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-http",
3
- "version": "6.1.0",
3
+ "version": "6.2.1",
4
4
  "description": "An HTTP request language package for use with Open Function",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -36,8 +36,7 @@
36
36
  "esno": "^0.16.3",
37
37
  "mocha": "9.2.2",
38
38
  "mocha-suppress-logs": "^0.4.1",
39
- "rimraf": "^3.0.2",
40
- "@openfn/buildtools": "^1.0.2"
39
+ "rimraf": "^3.0.2"
41
40
  },
42
41
  "main": "dist/index.cjs",
43
42
  "scripts": {
@@ -179,4 +179,4 @@ export type RequestOptions = {
179
179
  */
180
180
  tls: object;
181
181
  };
182
- export { alterState, arrayToString, combine, dataPath, dataValue, dateFns, each, field, fields, fn, chunk, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";
182
+ export { alterState, arrayToString, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, chunk, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";