@openfn/language-http 6.2.3 → 6.3.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 CHANGED
@@ -502,6 +502,59 @@
502
502
  },
503
503
  "valid": true
504
504
  },
505
+ {
506
+ "name": "fnIf",
507
+ "params": [
508
+ "condition",
509
+ "operation"
510
+ ],
511
+ "docs": {
512
+ "description": "A custom operation that will only execute the function if the condition returns true",
513
+ "tags": [
514
+ {
515
+ "title": "public",
516
+ "description": null,
517
+ "type": null
518
+ },
519
+ {
520
+ "title": "example",
521
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
522
+ },
523
+ {
524
+ "title": "function",
525
+ "description": null,
526
+ "name": null
527
+ },
528
+ {
529
+ "title": "param",
530
+ "description": "The condition that returns true",
531
+ "type": {
532
+ "type": "NameExpression",
533
+ "name": "Boolean"
534
+ },
535
+ "name": "condition"
536
+ },
537
+ {
538
+ "title": "param",
539
+ "description": "The operation needed to be executed.",
540
+ "type": {
541
+ "type": "NameExpression",
542
+ "name": "Operation"
543
+ },
544
+ "name": "operation"
545
+ },
546
+ {
547
+ "title": "returns",
548
+ "description": null,
549
+ "type": {
550
+ "type": "NameExpression",
551
+ "name": "Operation"
552
+ }
553
+ }
554
+ ]
555
+ },
556
+ "valid": true
557
+ },
505
558
  {
506
559
  "name": "sourceValue",
507
560
  "params": [
@@ -1312,7 +1365,7 @@
1312
1365
  "options"
1313
1366
  ],
1314
1367
  "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.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
1368
+ "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.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
1316
1369
  "tags": [
1317
1370
  {
1318
1371
  "title": "public",
package/dist/index.cjs CHANGED
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  field: () => import_language_common3.field,
41
41
  fields: () => import_language_common3.fields,
42
42
  fn: () => import_language_common3.fn,
43
+ fnIf: () => import_language_common3.fnIf,
43
44
  get: () => get,
44
45
  humanProper: () => import_language_common3.humanProper,
45
46
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
@@ -74,6 +75,7 @@ __export(Adaptor_exports, {
74
75
  field: () => import_language_common3.field,
75
76
  fields: () => import_language_common3.fields,
76
77
  fn: () => import_language_common3.fn,
78
+ fnIf: () => import_language_common3.fnIf,
77
79
  get: () => get,
78
80
  humanProper: () => import_language_common3.humanProper,
79
81
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
@@ -231,6 +233,7 @@ var src_default = Adaptor_exports;
231
233
  field,
232
234
  fields,
233
235
  fn,
236
+ fnIf,
234
237
  get,
235
238
  humanProper,
236
239
  lastReferenceValue,
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ __export(Adaptor_exports, {
21
21
  field: () => field,
22
22
  fields: () => fields,
23
23
  fn: () => fn,
24
+ fnIf: () => fnIf,
24
25
  get: () => get,
25
26
  humanProper: () => humanProper,
26
27
  lastReferenceValue: () => lastReferenceValue,
@@ -145,6 +146,7 @@ import {
145
146
  field,
146
147
  fields,
147
148
  fn,
149
+ fnIf,
148
150
  chunk,
149
151
  humanProper,
150
152
  lastReferenceValue,
@@ -204,6 +206,7 @@ export {
204
206
  field,
205
207
  fields,
206
208
  fn,
209
+ fnIf,
207
210
  get,
208
211
  humanProper,
209
212
  lastReferenceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-http",
3
- "version": "6.2.3",
3
+ "version": "6.3.0",
4
4
  "description": "An HTTP request language package for use with Open Function",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "cheerio": "1.0.0-rc.12",
29
29
  "cheerio-tableparser": "^1.0.1",
30
- "@openfn/language-common": "1.13.5"
30
+ "@openfn/language-common": "1.14.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@openfn/simple-ast": "0.4.1",
@@ -179,4 +179,4 @@ export type RequestOptions = {
179
179
  */
180
180
  tls: object;
181
181
  };
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";
182
+ export { alterState, arrayToString, combine, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, chunk, humanProper, lastReferenceValue, merge, scrubEmojis, sourceValue, splitKeys, toArray, parseCsv } from "@openfn/language-common";