@openfn/language-mojatax 1.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/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +35 -0
- package/ast.json +687 -0
- package/configuration-schema.json +39 -0
- package/dist/index.cjs +191 -0
- package/dist/index.js +168 -0
- package/package.json +48 -0
- package/types/Adaptor.d.ts +91 -0
- package/types/Utils.d.ts +3 -0
- package/types/index.d.ts +3 -0
package/ast.json
ADDED
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
{
|
|
2
|
+
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "post",
|
|
5
|
+
"params": [
|
|
6
|
+
"path",
|
|
7
|
+
"data",
|
|
8
|
+
"options",
|
|
9
|
+
"callback"
|
|
10
|
+
],
|
|
11
|
+
"docs": {
|
|
12
|
+
"description": "Make a POST request to any Mojatax endpoint.",
|
|
13
|
+
"tags": [
|
|
14
|
+
{
|
|
15
|
+
"title": "example",
|
|
16
|
+
"description": "post(\"CreateInvoice\", {\ninvoice_id: 'PID092',\ncustomerId: '102',\nitems: [],\n});",
|
|
17
|
+
"caption": "Make a POST request to create an invoice"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"title": "function",
|
|
21
|
+
"description": null,
|
|
22
|
+
"name": null
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"title": "public",
|
|
26
|
+
"description": null,
|
|
27
|
+
"type": null
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"title": "param",
|
|
31
|
+
"description": "Path to resource",
|
|
32
|
+
"type": {
|
|
33
|
+
"type": "NameExpression",
|
|
34
|
+
"name": "string"
|
|
35
|
+
},
|
|
36
|
+
"name": "path"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"title": "param",
|
|
40
|
+
"description": "Object which will be attached to the request body",
|
|
41
|
+
"type": {
|
|
42
|
+
"type": "NameExpression",
|
|
43
|
+
"name": "object"
|
|
44
|
+
},
|
|
45
|
+
"name": "data"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"title": "param",
|
|
49
|
+
"description": "Optional request options",
|
|
50
|
+
"type": {
|
|
51
|
+
"type": "NameExpression",
|
|
52
|
+
"name": "MojataxRequestOptions"
|
|
53
|
+
},
|
|
54
|
+
"name": "options"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"title": "param",
|
|
58
|
+
"description": "Optional callback to handle the response",
|
|
59
|
+
"type": {
|
|
60
|
+
"type": "OptionalType",
|
|
61
|
+
"expression": {
|
|
62
|
+
"type": "NameExpression",
|
|
63
|
+
"name": "function"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"name": "callback"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"title": "returns",
|
|
70
|
+
"description": null,
|
|
71
|
+
"type": {
|
|
72
|
+
"type": "NameExpression",
|
|
73
|
+
"name": "Operation"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"title": "state",
|
|
78
|
+
"description": "{MojataxHttpState}"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
"valid": true
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "request",
|
|
86
|
+
"params": [
|
|
87
|
+
"method",
|
|
88
|
+
"path",
|
|
89
|
+
"body",
|
|
90
|
+
"options",
|
|
91
|
+
"callback"
|
|
92
|
+
],
|
|
93
|
+
"docs": {
|
|
94
|
+
"description": "Make a general HTTP request against the Mojatax server.",
|
|
95
|
+
"tags": [
|
|
96
|
+
{
|
|
97
|
+
"title": "example",
|
|
98
|
+
"description": "request(\"POST\", \"/client/CreateInvoice\", {\ninvoice_id: 'PID092',\ncustomerId: '102',\nitems: [],\n});",
|
|
99
|
+
"caption": "Make a POST request to create an invoice"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"title": "function",
|
|
103
|
+
"description": null,
|
|
104
|
+
"name": null
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"title": "public",
|
|
108
|
+
"description": null,
|
|
109
|
+
"type": null
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"title": "param",
|
|
113
|
+
"description": "HTTP method to use",
|
|
114
|
+
"type": {
|
|
115
|
+
"type": "NameExpression",
|
|
116
|
+
"name": "string"
|
|
117
|
+
},
|
|
118
|
+
"name": "method"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"title": "param",
|
|
122
|
+
"description": "Path to resource",
|
|
123
|
+
"type": {
|
|
124
|
+
"type": "NameExpression",
|
|
125
|
+
"name": "string"
|
|
126
|
+
},
|
|
127
|
+
"name": "path"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"title": "param",
|
|
131
|
+
"description": "Object which will be attached to the POST body",
|
|
132
|
+
"type": {
|
|
133
|
+
"type": "NameExpression",
|
|
134
|
+
"name": "object"
|
|
135
|
+
},
|
|
136
|
+
"name": "data"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"title": "param",
|
|
140
|
+
"description": "Optional request options",
|
|
141
|
+
"type": {
|
|
142
|
+
"type": "NameExpression",
|
|
143
|
+
"name": "MojataxRequestOptions"
|
|
144
|
+
},
|
|
145
|
+
"name": "options"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"title": "param",
|
|
149
|
+
"description": "Optional callback to handle the response",
|
|
150
|
+
"type": {
|
|
151
|
+
"type": "OptionalType",
|
|
152
|
+
"expression": {
|
|
153
|
+
"type": "NameExpression",
|
|
154
|
+
"name": "function"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"name": "callback"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"title": "returns",
|
|
161
|
+
"description": null,
|
|
162
|
+
"type": {
|
|
163
|
+
"type": "NameExpression",
|
|
164
|
+
"name": "Operation"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"title": "state",
|
|
169
|
+
"description": "{MojataxHttpState}"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"valid": false
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"exports": [],
|
|
177
|
+
"common": [
|
|
178
|
+
{
|
|
179
|
+
"name": "fn",
|
|
180
|
+
"params": [
|
|
181
|
+
"func"
|
|
182
|
+
],
|
|
183
|
+
"docs": {
|
|
184
|
+
"description": "Creates a custom step (or operation) for more flexible job writing.",
|
|
185
|
+
"tags": [
|
|
186
|
+
{
|
|
187
|
+
"title": "public",
|
|
188
|
+
"description": null,
|
|
189
|
+
"type": null
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"title": "function",
|
|
193
|
+
"description": null,
|
|
194
|
+
"name": null
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"title": "example",
|
|
198
|
+
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"title": "param",
|
|
202
|
+
"description": "is the function",
|
|
203
|
+
"type": {
|
|
204
|
+
"type": "NameExpression",
|
|
205
|
+
"name": "Function"
|
|
206
|
+
},
|
|
207
|
+
"name": "func"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"title": "returns",
|
|
211
|
+
"description": null,
|
|
212
|
+
"type": {
|
|
213
|
+
"type": "NameExpression",
|
|
214
|
+
"name": "Operation"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
"valid": true
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "sourceValue",
|
|
223
|
+
"params": [
|
|
224
|
+
"path"
|
|
225
|
+
],
|
|
226
|
+
"docs": {
|
|
227
|
+
"description": "Picks out a single value from source data.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
|
|
228
|
+
"tags": [
|
|
229
|
+
{
|
|
230
|
+
"title": "public",
|
|
231
|
+
"description": null,
|
|
232
|
+
"type": null
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"title": "function",
|
|
236
|
+
"description": null,
|
|
237
|
+
"name": null
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
"title": "example",
|
|
241
|
+
"description": "sourceValue('$.key')"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"title": "param",
|
|
245
|
+
"description": "JSONPath referencing a point in `state`.",
|
|
246
|
+
"type": {
|
|
247
|
+
"type": "NameExpression",
|
|
248
|
+
"name": "String"
|
|
249
|
+
},
|
|
250
|
+
"name": "path"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"title": "returns",
|
|
254
|
+
"description": null,
|
|
255
|
+
"type": {
|
|
256
|
+
"type": "NameExpression",
|
|
257
|
+
"name": "Operation"
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
]
|
|
261
|
+
},
|
|
262
|
+
"valid": true
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"name": "dataPath",
|
|
266
|
+
"params": [
|
|
267
|
+
"path"
|
|
268
|
+
],
|
|
269
|
+
"docs": {
|
|
270
|
+
"description": "Ensures a path points at the data.",
|
|
271
|
+
"tags": [
|
|
272
|
+
{
|
|
273
|
+
"title": "public",
|
|
274
|
+
"description": null,
|
|
275
|
+
"type": null
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"title": "function",
|
|
279
|
+
"description": null,
|
|
280
|
+
"name": null
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"title": "example",
|
|
284
|
+
"description": "dataPath('key')"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"title": "param",
|
|
288
|
+
"description": "JSONPath referencing a point in `data`.",
|
|
289
|
+
"type": {
|
|
290
|
+
"type": "NameExpression",
|
|
291
|
+
"name": "string"
|
|
292
|
+
},
|
|
293
|
+
"name": "path"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"title": "returns",
|
|
297
|
+
"description": null,
|
|
298
|
+
"type": {
|
|
299
|
+
"type": "NameExpression",
|
|
300
|
+
"name": "string"
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
"valid": true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"name": "dataValue",
|
|
309
|
+
"params": [
|
|
310
|
+
"path"
|
|
311
|
+
],
|
|
312
|
+
"docs": {
|
|
313
|
+
"description": "Picks out a single value from the source data object—usually `state.data`.\nIf a JSONPath returns more than one value for the reference, the first\nitem will be returned.",
|
|
314
|
+
"tags": [
|
|
315
|
+
{
|
|
316
|
+
"title": "public",
|
|
317
|
+
"description": null,
|
|
318
|
+
"type": null
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"title": "function",
|
|
322
|
+
"description": null,
|
|
323
|
+
"name": null
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"title": "example",
|
|
327
|
+
"description": "dataValue('key')"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"title": "param",
|
|
331
|
+
"description": "JSONPath referencing a point in `data`.",
|
|
332
|
+
"type": {
|
|
333
|
+
"type": "NameExpression",
|
|
334
|
+
"name": "String"
|
|
335
|
+
},
|
|
336
|
+
"name": "path"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"title": "returns",
|
|
340
|
+
"description": null,
|
|
341
|
+
"type": {
|
|
342
|
+
"type": "NameExpression",
|
|
343
|
+
"name": "Operation"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
},
|
|
348
|
+
"valid": true
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"name": "lastReferenceValue",
|
|
352
|
+
"params": [
|
|
353
|
+
"path"
|
|
354
|
+
],
|
|
355
|
+
"docs": {
|
|
356
|
+
"description": "Picks out the last reference value from source data.",
|
|
357
|
+
"tags": [
|
|
358
|
+
{
|
|
359
|
+
"title": "public",
|
|
360
|
+
"description": null,
|
|
361
|
+
"type": null
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"title": "function",
|
|
365
|
+
"description": null,
|
|
366
|
+
"name": null
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"title": "example",
|
|
370
|
+
"description": "lastReferenceValue('key')"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"title": "param",
|
|
374
|
+
"description": "JSONPath referencing a point in `references`.",
|
|
375
|
+
"type": {
|
|
376
|
+
"type": "NameExpression",
|
|
377
|
+
"name": "String"
|
|
378
|
+
},
|
|
379
|
+
"name": "path"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"title": "returns",
|
|
383
|
+
"description": null,
|
|
384
|
+
"type": {
|
|
385
|
+
"type": "NameExpression",
|
|
386
|
+
"name": "Operation"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"valid": true
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"name": "each",
|
|
395
|
+
"params": [
|
|
396
|
+
"dataSource",
|
|
397
|
+
"operation"
|
|
398
|
+
],
|
|
399
|
+
"docs": {
|
|
400
|
+
"description": "Scopes an array of data based on a JSONPath.\nUseful when the source data has `n` items you would like to map to\nan operation.\nThe operation will receive a slice of the data based of each item\nof the JSONPath provided.\n\nIt also ensures the results of an operation make their way back into\nthe state's references.",
|
|
401
|
+
"tags": [
|
|
402
|
+
{
|
|
403
|
+
"title": "public",
|
|
404
|
+
"description": null,
|
|
405
|
+
"type": null
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
"title": "function",
|
|
409
|
+
"description": null,
|
|
410
|
+
"name": null
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"title": "example",
|
|
414
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"title": "param",
|
|
418
|
+
"description": "JSONPath referencing a point in `state`.",
|
|
419
|
+
"type": {
|
|
420
|
+
"type": "NameExpression",
|
|
421
|
+
"name": "DataSource"
|
|
422
|
+
},
|
|
423
|
+
"name": "dataSource"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"title": "param",
|
|
427
|
+
"description": "The operation needed to be repeated.",
|
|
428
|
+
"type": {
|
|
429
|
+
"type": "NameExpression",
|
|
430
|
+
"name": "Operation"
|
|
431
|
+
},
|
|
432
|
+
"name": "operation"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"title": "returns",
|
|
436
|
+
"description": null,
|
|
437
|
+
"type": {
|
|
438
|
+
"type": "NameExpression",
|
|
439
|
+
"name": "Operation"
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
]
|
|
443
|
+
},
|
|
444
|
+
"valid": true
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"name": "field",
|
|
448
|
+
"params": [
|
|
449
|
+
"key",
|
|
450
|
+
"value"
|
|
451
|
+
],
|
|
452
|
+
"docs": {
|
|
453
|
+
"description": "Returns a key, value pair in an array.",
|
|
454
|
+
"tags": [
|
|
455
|
+
{
|
|
456
|
+
"title": "public",
|
|
457
|
+
"description": null,
|
|
458
|
+
"type": null
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"title": "function",
|
|
462
|
+
"description": null,
|
|
463
|
+
"name": null
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"title": "example",
|
|
467
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"title": "param",
|
|
471
|
+
"description": "Name of the field",
|
|
472
|
+
"type": {
|
|
473
|
+
"type": "NameExpression",
|
|
474
|
+
"name": "string"
|
|
475
|
+
},
|
|
476
|
+
"name": "key"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
"title": "param",
|
|
480
|
+
"description": "The value itself or a sourceable operation.",
|
|
481
|
+
"type": {
|
|
482
|
+
"type": "NameExpression",
|
|
483
|
+
"name": "Value"
|
|
484
|
+
},
|
|
485
|
+
"name": "value"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"title": "returns",
|
|
489
|
+
"description": null,
|
|
490
|
+
"type": {
|
|
491
|
+
"type": "NameExpression",
|
|
492
|
+
"name": "Field"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
]
|
|
496
|
+
},
|
|
497
|
+
"valid": true
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"name": "fields",
|
|
501
|
+
"params": [
|
|
502
|
+
"fields"
|
|
503
|
+
],
|
|
504
|
+
"docs": {
|
|
505
|
+
"description": "Zips key value pairs into an object.",
|
|
506
|
+
"tags": [
|
|
507
|
+
{
|
|
508
|
+
"title": "public",
|
|
509
|
+
"description": null,
|
|
510
|
+
"type": null
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"title": "function",
|
|
514
|
+
"description": null,
|
|
515
|
+
"name": null
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"title": "example",
|
|
519
|
+
"description": "fields(list_of_fields)"
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
"title": "param",
|
|
523
|
+
"description": "a list of fields",
|
|
524
|
+
"type": {
|
|
525
|
+
"type": "NameExpression",
|
|
526
|
+
"name": "Fields"
|
|
527
|
+
},
|
|
528
|
+
"name": "fields"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"title": "returns",
|
|
532
|
+
"description": null,
|
|
533
|
+
"type": {
|
|
534
|
+
"type": "NameExpression",
|
|
535
|
+
"name": "Object"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
"valid": true
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"name": "merge",
|
|
544
|
+
"params": [
|
|
545
|
+
"dataSource",
|
|
546
|
+
"fields"
|
|
547
|
+
],
|
|
548
|
+
"docs": {
|
|
549
|
+
"description": "Merges fields into each item in an array.",
|
|
550
|
+
"tags": [
|
|
551
|
+
{
|
|
552
|
+
"title": "public",
|
|
553
|
+
"description": null,
|
|
554
|
+
"type": null
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"title": "example",
|
|
558
|
+
"description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"title": "function",
|
|
562
|
+
"description": null,
|
|
563
|
+
"name": null
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"title": "public",
|
|
567
|
+
"description": null,
|
|
568
|
+
"type": null
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"title": "param",
|
|
572
|
+
"description": null,
|
|
573
|
+
"type": {
|
|
574
|
+
"type": "NameExpression",
|
|
575
|
+
"name": "DataSource"
|
|
576
|
+
},
|
|
577
|
+
"name": "dataSource"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"title": "param",
|
|
581
|
+
"description": "Group of fields to merge in.",
|
|
582
|
+
"type": {
|
|
583
|
+
"type": "NameExpression",
|
|
584
|
+
"name": "Object"
|
|
585
|
+
},
|
|
586
|
+
"name": "fields"
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
"title": "returns",
|
|
590
|
+
"description": null,
|
|
591
|
+
"type": {
|
|
592
|
+
"type": "NameExpression",
|
|
593
|
+
"name": "DataSource"
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
"valid": true
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"name": "cursor",
|
|
602
|
+
"params": [
|
|
603
|
+
"value",
|
|
604
|
+
"options"
|
|
605
|
+
],
|
|
606
|
+
"docs": {
|
|
607
|
+
"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}",
|
|
608
|
+
"tags": [
|
|
609
|
+
{
|
|
610
|
+
"title": "public",
|
|
611
|
+
"description": null,
|
|
612
|
+
"type": null
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
"title": "function",
|
|
616
|
+
"description": null,
|
|
617
|
+
"name": null
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
"title": "example",
|
|
621
|
+
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
622
|
+
"caption": "Use a cursor from state if present, or else use the default value"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"title": "example",
|
|
626
|
+
"description": "cursor(22)",
|
|
627
|
+
"caption": "Use a pagination cursor"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"title": "param",
|
|
631
|
+
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
|
632
|
+
"type": {
|
|
633
|
+
"type": "NameExpression",
|
|
634
|
+
"name": "any"
|
|
635
|
+
},
|
|
636
|
+
"name": "value"
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"title": "param",
|
|
640
|
+
"description": "options to control the cursor.",
|
|
641
|
+
"type": {
|
|
642
|
+
"type": "NameExpression",
|
|
643
|
+
"name": "object"
|
|
644
|
+
},
|
|
645
|
+
"name": "options"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"title": "param",
|
|
649
|
+
"description": "set the cursor key. Will persist through the whole run.",
|
|
650
|
+
"type": {
|
|
651
|
+
"type": "NameExpression",
|
|
652
|
+
"name": "string"
|
|
653
|
+
},
|
|
654
|
+
"name": "options.key"
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
"title": "param",
|
|
658
|
+
"description": "the value to use if value is falsy",
|
|
659
|
+
"type": {
|
|
660
|
+
"type": "NameExpression",
|
|
661
|
+
"name": "any"
|
|
662
|
+
},
|
|
663
|
+
"name": "options.defaultValue"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"title": "param",
|
|
667
|
+
"description": "custom formatter for the final cursor value",
|
|
668
|
+
"type": {
|
|
669
|
+
"type": "NameExpression",
|
|
670
|
+
"name": "Function"
|
|
671
|
+
},
|
|
672
|
+
"name": "options.format"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
"title": "returns",
|
|
676
|
+
"description": null,
|
|
677
|
+
"type": {
|
|
678
|
+
"type": "NameExpression",
|
|
679
|
+
"name": "Operation"
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
]
|
|
683
|
+
},
|
|
684
|
+
"valid": false
|
|
685
|
+
}
|
|
686
|
+
]
|
|
687
|
+
}
|