@openfn/language-asana 3.1.0 → 3.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
@@ -351,6 +351,59 @@
351
351
  },
352
352
  "valid": true
353
353
  },
354
+ {
355
+ "name": "fnIf",
356
+ "params": [
357
+ "condition",
358
+ "operation"
359
+ ],
360
+ "docs": {
361
+ "description": "A custom operation that will only execute the function if the condition returns true",
362
+ "tags": [
363
+ {
364
+ "title": "public",
365
+ "description": null,
366
+ "type": null
367
+ },
368
+ {
369
+ "title": "example",
370
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
371
+ },
372
+ {
373
+ "title": "function",
374
+ "description": null,
375
+ "name": null
376
+ },
377
+ {
378
+ "title": "param",
379
+ "description": "The condition that returns true",
380
+ "type": {
381
+ "type": "NameExpression",
382
+ "name": "Boolean"
383
+ },
384
+ "name": "condition"
385
+ },
386
+ {
387
+ "title": "param",
388
+ "description": "The operation needed to be executed.",
389
+ "type": {
390
+ "type": "NameExpression",
391
+ "name": "Operation"
392
+ },
393
+ "name": "operation"
394
+ },
395
+ {
396
+ "title": "returns",
397
+ "description": null,
398
+ "type": {
399
+ "type": "NameExpression",
400
+ "name": "Operation"
401
+ }
402
+ }
403
+ ]
404
+ },
405
+ "valid": true
406
+ },
354
407
  {
355
408
  "name": "sourceValue",
356
409
  "params": [
@@ -724,6 +777,92 @@
724
777
  ]
725
778
  },
726
779
  "valid": true
780
+ },
781
+ {
782
+ "name": "cursor",
783
+ "params": [
784
+ "value",
785
+ "options"
786
+ ],
787
+ "docs": {
788
+ "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}",
789
+ "tags": [
790
+ {
791
+ "title": "public",
792
+ "description": null,
793
+ "type": null
794
+ },
795
+ {
796
+ "title": "example",
797
+ "description": "cursor($.cursor, { defaultValue: 'today' })",
798
+ "caption": "Use a cursor from state if present, or else use the default value"
799
+ },
800
+ {
801
+ "title": "example",
802
+ "description": "cursor(22)",
803
+ "caption": "Use a pagination cursor"
804
+ },
805
+ {
806
+ "title": "function",
807
+ "description": null,
808
+ "name": null
809
+ },
810
+ {
811
+ "title": "param",
812
+ "description": "the cursor value. Usually an ISO date, natural language date, or page number",
813
+ "type": {
814
+ "type": "NameExpression",
815
+ "name": "any"
816
+ },
817
+ "name": "value"
818
+ },
819
+ {
820
+ "title": "param",
821
+ "description": "options to control the cursor.",
822
+ "type": {
823
+ "type": "NameExpression",
824
+ "name": "object"
825
+ },
826
+ "name": "options"
827
+ },
828
+ {
829
+ "title": "param",
830
+ "description": "set the cursor key. Will persist through the whole run.",
831
+ "type": {
832
+ "type": "NameExpression",
833
+ "name": "string"
834
+ },
835
+ "name": "options.key"
836
+ },
837
+ {
838
+ "title": "param",
839
+ "description": "the value to use if value is falsy",
840
+ "type": {
841
+ "type": "NameExpression",
842
+ "name": "any"
843
+ },
844
+ "name": "options.defaultValue"
845
+ },
846
+ {
847
+ "title": "param",
848
+ "description": "custom formatter for the final cursor value",
849
+ "type": {
850
+ "type": "NameExpression",
851
+ "name": "Function"
852
+ },
853
+ "name": "options.format"
854
+ },
855
+ {
856
+ "title": "returns",
857
+ "description": null,
858
+ "type": {
859
+ "type": "NameExpression",
860
+ "name": "Operation"
861
+ }
862
+ }
863
+ ]
864
+ },
865
+ "valid": false
727
866
  }
728
867
  ]
729
868
  }
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ __export(src_exports, {
22
22
  alterState: () => import_language_common3.alterState,
23
23
  createTask: () => createTask,
24
24
  createTaskStory: () => createTaskStory,
25
+ cursor: () => import_language_common3.cursor,
25
26
  dataPath: () => import_language_common3.dataPath,
26
27
  dataValue: () => import_language_common3.dataValue,
27
28
  dateFns: () => import_language_common3.dateFns,
@@ -31,6 +32,7 @@ __export(src_exports, {
31
32
  field: () => import_language_common3.field,
32
33
  fields: () => import_language_common3.fields,
33
34
  fn: () => import_language_common3.fn,
35
+ fnIf: () => import_language_common3.fnIf,
34
36
  getTask: () => getTask,
35
37
  getTasks: () => getTasks,
36
38
  http: () => import_language_common3.http,
@@ -49,6 +51,7 @@ __export(Adaptor_exports, {
49
51
  alterState: () => import_language_common3.alterState,
50
52
  createTask: () => createTask,
51
53
  createTaskStory: () => createTaskStory,
54
+ cursor: () => import_language_common3.cursor,
52
55
  dataPath: () => import_language_common3.dataPath,
53
56
  dataValue: () => import_language_common3.dataValue,
54
57
  dateFns: () => import_language_common3.dateFns,
@@ -57,6 +60,7 @@ __export(Adaptor_exports, {
57
60
  field: () => import_language_common3.field,
58
61
  fields: () => import_language_common3.fields,
59
62
  fn: () => import_language_common3.fn,
63
+ fnIf: () => import_language_common3.fnIf,
60
64
  getTask: () => getTask,
61
65
  getTasks: () => getTasks,
62
66
  http: () => import_language_common3.http,
@@ -247,6 +251,7 @@ var src_default = Adaptor_exports;
247
251
  alterState,
248
252
  createTask,
249
253
  createTaskStory,
254
+ cursor,
250
255
  dataPath,
251
256
  dataValue,
252
257
  dateFns,
@@ -255,6 +260,7 @@ var src_default = Adaptor_exports;
255
260
  field,
256
261
  fields,
257
262
  fn,
263
+ fnIf,
258
264
  getTask,
259
265
  getTasks,
260
266
  http,
package/dist/index.js CHANGED
@@ -10,6 +10,7 @@ __export(Adaptor_exports, {
10
10
  alterState: () => alterState,
11
11
  createTask: () => createTask,
12
12
  createTaskStory: () => createTaskStory,
13
+ cursor: () => cursor,
13
14
  dataPath: () => dataPath,
14
15
  dataValue: () => dataValue,
15
16
  dateFns: () => dateFns,
@@ -18,6 +19,7 @@ __export(Adaptor_exports, {
18
19
  field: () => field,
19
20
  fields: () => fields,
20
21
  fn: () => fn,
22
+ fnIf: () => fnIf,
21
23
  getTask: () => getTask,
22
24
  getTasks: () => getTasks,
23
25
  http: () => http,
@@ -71,6 +73,7 @@ function request(state, path, params, callback = (s) => s) {
71
73
  // src/Adaptor.js
72
74
  import {
73
75
  alterState,
76
+ cursor,
74
77
  dataPath,
75
78
  dataValue,
76
79
  dateFns,
@@ -78,6 +81,7 @@ import {
78
81
  field,
79
82
  fields,
80
83
  fn,
84
+ fnIf,
81
85
  http,
82
86
  lastReferenceValue,
83
87
  merge,
@@ -223,6 +227,7 @@ export {
223
227
  alterState,
224
228
  createTask,
225
229
  createTaskStory,
230
+ cursor,
226
231
  dataPath,
227
232
  dataValue,
228
233
  dateFns,
@@ -232,6 +237,7 @@ export {
232
237
  field,
233
238
  fields,
234
239
  fn,
240
+ fnIf,
235
241
  getTask,
236
242
  getTasks,
237
243
  http,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-asana",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "An adaptor to access objects in Asana",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "configuration-schema.json"
24
24
  ],
25
25
  "dependencies": {
26
- "@openfn/language-common": "^1.12.0"
26
+ "@openfn/language-common": "^1.14.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@openfn/simple-ast": "0.4.1",
@@ -187,4 +187,4 @@ export type RequestOptions = {
187
187
  */
188
188
  method: string;
189
189
  };
190
- export { alterState, dataPath, dataValue, dateFns, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
190
+ export { alterState, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";