@openfn/language-inform 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 +27 -0
- package/ast.json +1107 -0
- package/configuration-schema.json +40 -0
- package/dist/index.cjs +16829 -0
- package/dist/index.js +16842 -0
- package/package.json +47 -0
- package/types/Adaptor.d.ts +109 -0
- package/types/Utils.d.ts +3 -0
- package/types/http.d.ts +57 -0
- package/types/index.d.ts +4 -0
package/ast.json
ADDED
|
@@ -0,0 +1,1107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "getForms",
|
|
5
|
+
"params": [
|
|
6
|
+
"options"
|
|
7
|
+
],
|
|
8
|
+
"docs": {
|
|
9
|
+
"description": "Fetch all forms",
|
|
10
|
+
"tags": [
|
|
11
|
+
{
|
|
12
|
+
"title": "example",
|
|
13
|
+
"description": "getForms()",
|
|
14
|
+
"caption": "Get all forms without filter options"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"title": "example",
|
|
18
|
+
"description": "getForms({\n public: true,\n page: 1,\n page_size: 5,\n});",
|
|
19
|
+
"caption": "Get all forms with filter options"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"title": "function",
|
|
23
|
+
"description": null,
|
|
24
|
+
"name": null
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"title": "public",
|
|
28
|
+
"description": null,
|
|
29
|
+
"type": null
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"title": "param",
|
|
33
|
+
"description": "Optional filter options. Some supported options are: `public`, `tags`, `page`, and `page_size`.",
|
|
34
|
+
"type": {
|
|
35
|
+
"type": "NameExpression",
|
|
36
|
+
"name": "object"
|
|
37
|
+
},
|
|
38
|
+
"name": "options"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "returns",
|
|
42
|
+
"description": null,
|
|
43
|
+
"type": {
|
|
44
|
+
"type": "NameExpression",
|
|
45
|
+
"name": "Operation"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"title": "state",
|
|
50
|
+
"description": "{HttpState}"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"valid": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "getForm",
|
|
58
|
+
"params": [
|
|
59
|
+
"formId",
|
|
60
|
+
"options"
|
|
61
|
+
],
|
|
62
|
+
"docs": {
|
|
63
|
+
"description": "Get metadata or structural data for a single form",
|
|
64
|
+
"tags": [
|
|
65
|
+
{
|
|
66
|
+
"title": "example",
|
|
67
|
+
"description": "getForm('6225')",
|
|
68
|
+
"caption": "Get a single form"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"title": "example",
|
|
72
|
+
"description": "getForm('6225', {\n structureOnly: true,\n});",
|
|
73
|
+
"caption": "Get a single form structure"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"title": "function",
|
|
77
|
+
"description": null,
|
|
78
|
+
"name": null
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"title": "public",
|
|
82
|
+
"description": null,
|
|
83
|
+
"type": null
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"title": "param",
|
|
87
|
+
"description": "Id of the form to be retrieved.",
|
|
88
|
+
"type": {
|
|
89
|
+
"type": "NameExpression",
|
|
90
|
+
"name": "string"
|
|
91
|
+
},
|
|
92
|
+
"name": "formId"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"title": "param",
|
|
96
|
+
"description": null,
|
|
97
|
+
"type": {
|
|
98
|
+
"type": "NameExpression",
|
|
99
|
+
"name": "object"
|
|
100
|
+
},
|
|
101
|
+
"name": "options"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"title": "param",
|
|
105
|
+
"description": "If true, only the form structure is returned in JSON format.",
|
|
106
|
+
"type": {
|
|
107
|
+
"type": "NameExpression",
|
|
108
|
+
"name": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"name": "options.structureOnly"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"title": "returns",
|
|
114
|
+
"description": null,
|
|
115
|
+
"type": {
|
|
116
|
+
"type": "NameExpression",
|
|
117
|
+
"name": "Operation"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"title": "state",
|
|
122
|
+
"description": "{HttpState}"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"valid": false
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "getSubmissions",
|
|
130
|
+
"params": [
|
|
131
|
+
"formId",
|
|
132
|
+
"options"
|
|
133
|
+
],
|
|
134
|
+
"docs": {
|
|
135
|
+
"description": "Get submission data of a single form",
|
|
136
|
+
"tags": [
|
|
137
|
+
{
|
|
138
|
+
"title": "example",
|
|
139
|
+
"description": "getSubmissions('6225');",
|
|
140
|
+
"caption": "Get submissions without filter options"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"title": "example",
|
|
144
|
+
"description": "getSubmissions('6225', {\n query: `{\"_submission_time\":{\"$gte\":\"2024-11-05\"}}`,\n limit: 1,\n});",
|
|
145
|
+
"caption": "Get submissions with filter options"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"title": "function",
|
|
149
|
+
"description": null,
|
|
150
|
+
"name": null
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"title": "public",
|
|
154
|
+
"description": null,
|
|
155
|
+
"type": null
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"title": "param",
|
|
159
|
+
"description": "Id of the form's submissions to be retrieved.",
|
|
160
|
+
"type": {
|
|
161
|
+
"type": "NameExpression",
|
|
162
|
+
"name": "string"
|
|
163
|
+
},
|
|
164
|
+
"name": "formId"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"title": "param",
|
|
168
|
+
"description": "Optional filter options. Some supported options are: `query`, `limit`, `start`, `page`, and `page_size`.",
|
|
169
|
+
"type": {
|
|
170
|
+
"type": "NameExpression",
|
|
171
|
+
"name": "object"
|
|
172
|
+
},
|
|
173
|
+
"name": "options"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"title": "returns",
|
|
177
|
+
"description": null,
|
|
178
|
+
"type": {
|
|
179
|
+
"type": "NameExpression",
|
|
180
|
+
"name": "Operation"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"title": "state",
|
|
185
|
+
"description": "{HttpState}"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"valid": true
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "getSubmission",
|
|
193
|
+
"params": [
|
|
194
|
+
"formId",
|
|
195
|
+
"submissionId"
|
|
196
|
+
],
|
|
197
|
+
"docs": {
|
|
198
|
+
"description": "Get a single data submission for a single form",
|
|
199
|
+
"tags": [
|
|
200
|
+
{
|
|
201
|
+
"title": "example",
|
|
202
|
+
"description": "getSubmission('6225', '7783155')"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"title": "function",
|
|
206
|
+
"description": null,
|
|
207
|
+
"name": null
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"title": "public",
|
|
211
|
+
"description": null,
|
|
212
|
+
"type": null
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"title": "param",
|
|
216
|
+
"description": "Id of the form's submissions to be retrieved.",
|
|
217
|
+
"type": {
|
|
218
|
+
"type": "NameExpression",
|
|
219
|
+
"name": "string"
|
|
220
|
+
},
|
|
221
|
+
"name": "formId"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"title": "param",
|
|
225
|
+
"description": "Id of the submission to be retrieved.",
|
|
226
|
+
"type": {
|
|
227
|
+
"type": "NameExpression",
|
|
228
|
+
"name": "string"
|
|
229
|
+
},
|
|
230
|
+
"name": "submissionId"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"title": "returns",
|
|
234
|
+
"description": null,
|
|
235
|
+
"type": {
|
|
236
|
+
"type": "NameExpression",
|
|
237
|
+
"name": "Operation"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"title": "state",
|
|
242
|
+
"description": "{HttpState}"
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
"valid": true
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"name": "getAttachmentMetadata",
|
|
250
|
+
"params": [
|
|
251
|
+
"attachmentId"
|
|
252
|
+
],
|
|
253
|
+
"docs": {
|
|
254
|
+
"description": "Fetch a single attachment's metadata",
|
|
255
|
+
"tags": [
|
|
256
|
+
{
|
|
257
|
+
"title": "example",
|
|
258
|
+
"description": "getAttachmentMetadata('621985')"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"title": "function",
|
|
262
|
+
"description": null,
|
|
263
|
+
"name": null
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"title": "public",
|
|
267
|
+
"description": null,
|
|
268
|
+
"type": null
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"title": "param",
|
|
272
|
+
"description": "Id of the attachment to be retrieved.",
|
|
273
|
+
"type": {
|
|
274
|
+
"type": "NameExpression",
|
|
275
|
+
"name": "string"
|
|
276
|
+
},
|
|
277
|
+
"name": "attachmentId"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"title": "returns",
|
|
281
|
+
"description": null,
|
|
282
|
+
"type": {
|
|
283
|
+
"type": "NameExpression",
|
|
284
|
+
"name": "Operation"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"title": "state",
|
|
289
|
+
"description": "{HttpState}"
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
"valid": true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "downloadAttachment",
|
|
297
|
+
"params": [
|
|
298
|
+
"attachmentId",
|
|
299
|
+
"options"
|
|
300
|
+
],
|
|
301
|
+
"docs": {
|
|
302
|
+
"description": "Download an attachment in binary or base64 format",
|
|
303
|
+
"tags": [
|
|
304
|
+
{
|
|
305
|
+
"title": "example",
|
|
306
|
+
"description": "downloadAttachment('622038', {\n filename:\n 'unicefbih/attachments/download_1.png',\n});",
|
|
307
|
+
"caption": "Download an attachment"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"title": "example",
|
|
311
|
+
"description": "downloadAttachment('622038', {\n filename:\n 'unicefbih/attachments/download_1.png',\n parseAs: 'base64',\n});",
|
|
312
|
+
"caption": "Download an attachment in base64 format"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"title": "function",
|
|
316
|
+
"description": null,
|
|
317
|
+
"name": null
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"title": "public",
|
|
321
|
+
"description": null,
|
|
322
|
+
"type": null
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"title": "param",
|
|
326
|
+
"description": "Id of the attachment to be retrieved.",
|
|
327
|
+
"type": {
|
|
328
|
+
"type": "NameExpression",
|
|
329
|
+
"name": "string"
|
|
330
|
+
},
|
|
331
|
+
"name": "attachmentId"
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
"title": "param",
|
|
335
|
+
"description": "Optional request options. Supported options are: `filename` for the specific attachment to be downloaded, and `parseAs` for either 'stream` or 'base64`. Defaults to `parseAs: stream`.",
|
|
336
|
+
"type": {
|
|
337
|
+
"type": "NameExpression",
|
|
338
|
+
"name": "object"
|
|
339
|
+
},
|
|
340
|
+
"name": "options"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"title": "returns",
|
|
344
|
+
"description": null,
|
|
345
|
+
"type": {
|
|
346
|
+
"type": "NameExpression",
|
|
347
|
+
"name": "Operation"
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"title": "state",
|
|
352
|
+
"description": "{HttpState}"
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
"valid": true
|
|
357
|
+
}
|
|
358
|
+
],
|
|
359
|
+
"exports": [],
|
|
360
|
+
"common": [
|
|
361
|
+
{
|
|
362
|
+
"name": "fn",
|
|
363
|
+
"params": [
|
|
364
|
+
"func"
|
|
365
|
+
],
|
|
366
|
+
"docs": {
|
|
367
|
+
"description": "Creates a custom step (or operation) for more flexible job writing.",
|
|
368
|
+
"tags": [
|
|
369
|
+
{
|
|
370
|
+
"title": "public",
|
|
371
|
+
"description": null,
|
|
372
|
+
"type": null
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"title": "function",
|
|
376
|
+
"description": null,
|
|
377
|
+
"name": null
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"title": "example",
|
|
381
|
+
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"title": "param",
|
|
385
|
+
"description": "is the function",
|
|
386
|
+
"type": {
|
|
387
|
+
"type": "NameExpression",
|
|
388
|
+
"name": "Function"
|
|
389
|
+
},
|
|
390
|
+
"name": "func"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"title": "returns",
|
|
394
|
+
"description": null,
|
|
395
|
+
"type": {
|
|
396
|
+
"type": "NameExpression",
|
|
397
|
+
"name": "Operation"
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
]
|
|
401
|
+
},
|
|
402
|
+
"valid": true
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"name": "fnIf",
|
|
406
|
+
"params": [
|
|
407
|
+
"condition",
|
|
408
|
+
"operation"
|
|
409
|
+
],
|
|
410
|
+
"docs": {
|
|
411
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
412
|
+
"tags": [
|
|
413
|
+
{
|
|
414
|
+
"title": "public",
|
|
415
|
+
"description": null,
|
|
416
|
+
"type": null
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"title": "function",
|
|
420
|
+
"description": null,
|
|
421
|
+
"name": null
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
"title": "example",
|
|
425
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"title": "param",
|
|
429
|
+
"description": "The condition that returns true",
|
|
430
|
+
"type": {
|
|
431
|
+
"type": "NameExpression",
|
|
432
|
+
"name": "Boolean"
|
|
433
|
+
},
|
|
434
|
+
"name": "condition"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"title": "param",
|
|
438
|
+
"description": "The operation needed to be executed.",
|
|
439
|
+
"type": {
|
|
440
|
+
"type": "NameExpression",
|
|
441
|
+
"name": "Operation"
|
|
442
|
+
},
|
|
443
|
+
"name": "operation"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"title": "returns",
|
|
447
|
+
"description": null,
|
|
448
|
+
"type": {
|
|
449
|
+
"type": "NameExpression",
|
|
450
|
+
"name": "Operation"
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
"valid": true
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"name": "sourceValue",
|
|
459
|
+
"params": [
|
|
460
|
+
"path"
|
|
461
|
+
],
|
|
462
|
+
"docs": {
|
|
463
|
+
"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.",
|
|
464
|
+
"tags": [
|
|
465
|
+
{
|
|
466
|
+
"title": "public",
|
|
467
|
+
"description": null,
|
|
468
|
+
"type": null
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"title": "function",
|
|
472
|
+
"description": null,
|
|
473
|
+
"name": null
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"title": "example",
|
|
477
|
+
"description": "sourceValue('$.key')"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
"title": "param",
|
|
481
|
+
"description": "JSONPath referencing a point in `state`.",
|
|
482
|
+
"type": {
|
|
483
|
+
"type": "NameExpression",
|
|
484
|
+
"name": "String"
|
|
485
|
+
},
|
|
486
|
+
"name": "path"
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"title": "returns",
|
|
490
|
+
"description": null,
|
|
491
|
+
"type": {
|
|
492
|
+
"type": "NameExpression",
|
|
493
|
+
"name": "Operation"
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
]
|
|
497
|
+
},
|
|
498
|
+
"valid": true
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
"name": "dataPath",
|
|
502
|
+
"params": [
|
|
503
|
+
"path"
|
|
504
|
+
],
|
|
505
|
+
"docs": {
|
|
506
|
+
"description": "Ensures a path points at the data.",
|
|
507
|
+
"tags": [
|
|
508
|
+
{
|
|
509
|
+
"title": "public",
|
|
510
|
+
"description": null,
|
|
511
|
+
"type": null
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"title": "function",
|
|
515
|
+
"description": null,
|
|
516
|
+
"name": null
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"title": "example",
|
|
520
|
+
"description": "dataPath('key')"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"title": "param",
|
|
524
|
+
"description": "JSONPath referencing a point in `data`.",
|
|
525
|
+
"type": {
|
|
526
|
+
"type": "NameExpression",
|
|
527
|
+
"name": "string"
|
|
528
|
+
},
|
|
529
|
+
"name": "path"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"title": "returns",
|
|
533
|
+
"description": null,
|
|
534
|
+
"type": {
|
|
535
|
+
"type": "NameExpression",
|
|
536
|
+
"name": "string"
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
]
|
|
540
|
+
},
|
|
541
|
+
"valid": true
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "dataValue",
|
|
545
|
+
"params": [
|
|
546
|
+
"path"
|
|
547
|
+
],
|
|
548
|
+
"docs": {
|
|
549
|
+
"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.",
|
|
550
|
+
"tags": [
|
|
551
|
+
{
|
|
552
|
+
"title": "public",
|
|
553
|
+
"description": null,
|
|
554
|
+
"type": null
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
"title": "function",
|
|
558
|
+
"description": null,
|
|
559
|
+
"name": null
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
"title": "example",
|
|
563
|
+
"description": "dataValue('key')"
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
"title": "param",
|
|
567
|
+
"description": "JSONPath referencing a point in `data`.",
|
|
568
|
+
"type": {
|
|
569
|
+
"type": "NameExpression",
|
|
570
|
+
"name": "String"
|
|
571
|
+
},
|
|
572
|
+
"name": "path"
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
"title": "returns",
|
|
576
|
+
"description": null,
|
|
577
|
+
"type": {
|
|
578
|
+
"type": "NameExpression",
|
|
579
|
+
"name": "Operation"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
]
|
|
583
|
+
},
|
|
584
|
+
"valid": true
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
"name": "lastReferenceValue",
|
|
588
|
+
"params": [
|
|
589
|
+
"path"
|
|
590
|
+
],
|
|
591
|
+
"docs": {
|
|
592
|
+
"description": "Picks out the last reference value from source data.",
|
|
593
|
+
"tags": [
|
|
594
|
+
{
|
|
595
|
+
"title": "public",
|
|
596
|
+
"description": null,
|
|
597
|
+
"type": null
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"title": "function",
|
|
601
|
+
"description": null,
|
|
602
|
+
"name": null
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"title": "example",
|
|
606
|
+
"description": "lastReferenceValue('key')"
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"title": "param",
|
|
610
|
+
"description": "JSONPath referencing a point in `references`.",
|
|
611
|
+
"type": {
|
|
612
|
+
"type": "NameExpression",
|
|
613
|
+
"name": "String"
|
|
614
|
+
},
|
|
615
|
+
"name": "path"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"title": "returns",
|
|
619
|
+
"description": null,
|
|
620
|
+
"type": {
|
|
621
|
+
"type": "NameExpression",
|
|
622
|
+
"name": "Operation"
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
"valid": true
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"name": "each",
|
|
631
|
+
"params": [
|
|
632
|
+
"dataSource",
|
|
633
|
+
"operation"
|
|
634
|
+
],
|
|
635
|
+
"docs": {
|
|
636
|
+
"description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
|
|
637
|
+
"tags": [
|
|
638
|
+
{
|
|
639
|
+
"title": "public",
|
|
640
|
+
"description": null,
|
|
641
|
+
"type": null
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"title": "function",
|
|
645
|
+
"description": null,
|
|
646
|
+
"name": null
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"title": "example",
|
|
650
|
+
"description": "each(\n $.data,\n // Inside the callback operation, `$.data` is scoped to the item under iteration\n insert(\"patient\", {\n patient_name: $.data.properties.case_name,\n patient_id: $.data.case_id,\n })\n);",
|
|
651
|
+
"caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
"title": "example",
|
|
655
|
+
"description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
|
|
656
|
+
"caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"title": "example",
|
|
660
|
+
"description": "each(\n \"$.data[*]\",\n insert(\"patient\", (state) => ({\n patient_name: state.data.properties.case_name,\n patient_id: state.data.case_id,\n }))\n);",
|
|
661
|
+
"caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"title": "param",
|
|
665
|
+
"description": "JSONPath referencing a point in `state`.",
|
|
666
|
+
"type": {
|
|
667
|
+
"type": "NameExpression",
|
|
668
|
+
"name": "DataSource"
|
|
669
|
+
},
|
|
670
|
+
"name": "dataSource"
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
"title": "param",
|
|
674
|
+
"description": "The operation needed to be repeated.",
|
|
675
|
+
"type": {
|
|
676
|
+
"type": "NameExpression",
|
|
677
|
+
"name": "Operation"
|
|
678
|
+
},
|
|
679
|
+
"name": "operation"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
"title": "returns",
|
|
683
|
+
"description": null,
|
|
684
|
+
"type": {
|
|
685
|
+
"type": "NameExpression",
|
|
686
|
+
"name": "Operation"
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
]
|
|
690
|
+
},
|
|
691
|
+
"valid": true
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
"name": "combine",
|
|
695
|
+
"params": [
|
|
696
|
+
"operations"
|
|
697
|
+
],
|
|
698
|
+
"docs": {
|
|
699
|
+
"description": "Combines two operations into one",
|
|
700
|
+
"tags": [
|
|
701
|
+
{
|
|
702
|
+
"title": "public",
|
|
703
|
+
"description": null,
|
|
704
|
+
"type": null
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"title": "function",
|
|
708
|
+
"description": null,
|
|
709
|
+
"name": null
|
|
710
|
+
},
|
|
711
|
+
{
|
|
712
|
+
"title": "example",
|
|
713
|
+
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"title": "param",
|
|
717
|
+
"description": "Operations to be performed.",
|
|
718
|
+
"type": {
|
|
719
|
+
"type": "NameExpression",
|
|
720
|
+
"name": "Operations"
|
|
721
|
+
},
|
|
722
|
+
"name": "operations"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"title": "returns",
|
|
726
|
+
"description": null,
|
|
727
|
+
"type": {
|
|
728
|
+
"type": "NameExpression",
|
|
729
|
+
"name": "Operation"
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
},
|
|
734
|
+
"valid": true
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
"name": "field",
|
|
738
|
+
"params": [
|
|
739
|
+
"key",
|
|
740
|
+
"value"
|
|
741
|
+
],
|
|
742
|
+
"docs": {
|
|
743
|
+
"description": "Returns a key, value pair in an array.",
|
|
744
|
+
"tags": [
|
|
745
|
+
{
|
|
746
|
+
"title": "public",
|
|
747
|
+
"description": null,
|
|
748
|
+
"type": null
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"title": "function",
|
|
752
|
+
"description": null,
|
|
753
|
+
"name": null
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
"title": "example",
|
|
757
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
"title": "param",
|
|
761
|
+
"description": "Name of the field",
|
|
762
|
+
"type": {
|
|
763
|
+
"type": "NameExpression",
|
|
764
|
+
"name": "string"
|
|
765
|
+
},
|
|
766
|
+
"name": "key"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
"title": "param",
|
|
770
|
+
"description": "The value itself or a sourceable operation.",
|
|
771
|
+
"type": {
|
|
772
|
+
"type": "NameExpression",
|
|
773
|
+
"name": "Value"
|
|
774
|
+
},
|
|
775
|
+
"name": "value"
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
"title": "returns",
|
|
779
|
+
"description": null,
|
|
780
|
+
"type": {
|
|
781
|
+
"type": "NameExpression",
|
|
782
|
+
"name": "Field"
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
]
|
|
786
|
+
},
|
|
787
|
+
"valid": true
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
"name": "fields",
|
|
791
|
+
"params": [
|
|
792
|
+
"fields"
|
|
793
|
+
],
|
|
794
|
+
"docs": {
|
|
795
|
+
"description": "Zips key value pairs into an object.",
|
|
796
|
+
"tags": [
|
|
797
|
+
{
|
|
798
|
+
"title": "public",
|
|
799
|
+
"description": null,
|
|
800
|
+
"type": null
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
"title": "function",
|
|
804
|
+
"description": null,
|
|
805
|
+
"name": null
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"title": "example",
|
|
809
|
+
"description": "fields(list_of_fields)"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"title": "param",
|
|
813
|
+
"description": "a list of fields",
|
|
814
|
+
"type": {
|
|
815
|
+
"type": "NameExpression",
|
|
816
|
+
"name": "Fields"
|
|
817
|
+
},
|
|
818
|
+
"name": "fields"
|
|
819
|
+
},
|
|
820
|
+
{
|
|
821
|
+
"title": "returns",
|
|
822
|
+
"description": null,
|
|
823
|
+
"type": {
|
|
824
|
+
"type": "NameExpression",
|
|
825
|
+
"name": "Object"
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
]
|
|
829
|
+
},
|
|
830
|
+
"valid": true
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
"name": "merge",
|
|
834
|
+
"params": [
|
|
835
|
+
"dataSource",
|
|
836
|
+
"fields"
|
|
837
|
+
],
|
|
838
|
+
"docs": {
|
|
839
|
+
"description": "Merges fields into each item in an array.",
|
|
840
|
+
"tags": [
|
|
841
|
+
{
|
|
842
|
+
"title": "public",
|
|
843
|
+
"description": null,
|
|
844
|
+
"type": null
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"title": "example",
|
|
848
|
+
"description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
"title": "function",
|
|
852
|
+
"description": null,
|
|
853
|
+
"name": null
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"title": "public",
|
|
857
|
+
"description": null,
|
|
858
|
+
"type": null
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
"title": "param",
|
|
862
|
+
"description": null,
|
|
863
|
+
"type": {
|
|
864
|
+
"type": "NameExpression",
|
|
865
|
+
"name": "DataSource"
|
|
866
|
+
},
|
|
867
|
+
"name": "dataSource"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
"title": "param",
|
|
871
|
+
"description": "Group of fields to merge in.",
|
|
872
|
+
"type": {
|
|
873
|
+
"type": "NameExpression",
|
|
874
|
+
"name": "Object"
|
|
875
|
+
},
|
|
876
|
+
"name": "fields"
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
"title": "returns",
|
|
880
|
+
"description": null,
|
|
881
|
+
"type": {
|
|
882
|
+
"type": "NameExpression",
|
|
883
|
+
"name": "DataSource"
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
},
|
|
888
|
+
"valid": true
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
"name": "group",
|
|
892
|
+
"params": [
|
|
893
|
+
"arrayOfObjects",
|
|
894
|
+
"keyPath",
|
|
895
|
+
"callback"
|
|
896
|
+
],
|
|
897
|
+
"docs": {
|
|
898
|
+
"description": "Groups an array of objects by a specified key path.",
|
|
899
|
+
"tags": [
|
|
900
|
+
{
|
|
901
|
+
"title": "public",
|
|
902
|
+
"description": null,
|
|
903
|
+
"type": null
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
"title": "example",
|
|
907
|
+
"description": "const users = [\n { name: 'Alice', age: 25, city: 'New York' },\n { name: 'Bob', age: 30, city: 'San Francisco' },\n { name: 'Charlie', age: 25, city: 'New York' },\n { name: 'David', age: 30, city: 'San Francisco' }\n];\ngroup(users, 'city');\n// state is { data: { 'New York': [/Alice, Charlie/], 'San Francisco': [ /Bob, David / ] }"
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
"title": "function",
|
|
911
|
+
"description": null,
|
|
912
|
+
"name": null
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
"title": "public",
|
|
916
|
+
"description": null,
|
|
917
|
+
"type": null
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
"title": "param",
|
|
921
|
+
"description": "The array of objects to be grouped.",
|
|
922
|
+
"type": {
|
|
923
|
+
"type": "TypeApplication",
|
|
924
|
+
"expression": {
|
|
925
|
+
"type": "NameExpression",
|
|
926
|
+
"name": "Array"
|
|
927
|
+
},
|
|
928
|
+
"applications": [
|
|
929
|
+
{
|
|
930
|
+
"type": "NameExpression",
|
|
931
|
+
"name": "Object"
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
"name": "arrayOfObjects"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"title": "param",
|
|
939
|
+
"description": "The key path to group by.",
|
|
940
|
+
"type": {
|
|
941
|
+
"type": "NameExpression",
|
|
942
|
+
"name": "string"
|
|
943
|
+
},
|
|
944
|
+
"name": "keyPath"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
"title": "param",
|
|
948
|
+
"description": "(Optional) Callback function",
|
|
949
|
+
"type": {
|
|
950
|
+
"type": "NameExpression",
|
|
951
|
+
"name": "function"
|
|
952
|
+
},
|
|
953
|
+
"name": "callback"
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
"title": "returns",
|
|
957
|
+
"description": null,
|
|
958
|
+
"type": {
|
|
959
|
+
"type": "NameExpression",
|
|
960
|
+
"name": "Operation"
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
]
|
|
964
|
+
},
|
|
965
|
+
"valid": true
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
"name": "scrubEmojis",
|
|
969
|
+
"params": [
|
|
970
|
+
"text",
|
|
971
|
+
"replacementChars"
|
|
972
|
+
],
|
|
973
|
+
"docs": {
|
|
974
|
+
"description": "Replaces emojis in a string.",
|
|
975
|
+
"tags": [
|
|
976
|
+
{
|
|
977
|
+
"title": "public",
|
|
978
|
+
"description": null,
|
|
979
|
+
"type": null
|
|
980
|
+
},
|
|
981
|
+
{
|
|
982
|
+
"title": "function",
|
|
983
|
+
"description": null,
|
|
984
|
+
"name": null
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
"title": "example",
|
|
988
|
+
"description": "scrubEmojis('Dove🕊️⭐ 29')"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
"title": "param",
|
|
992
|
+
"description": "String that needs to be cleaned",
|
|
993
|
+
"type": {
|
|
994
|
+
"type": "NameExpression",
|
|
995
|
+
"name": "string"
|
|
996
|
+
},
|
|
997
|
+
"name": "text"
|
|
998
|
+
},
|
|
999
|
+
{
|
|
1000
|
+
"title": "param",
|
|
1001
|
+
"description": "Characters that replace the emojis",
|
|
1002
|
+
"type": {
|
|
1003
|
+
"type": "NameExpression",
|
|
1004
|
+
"name": "string"
|
|
1005
|
+
},
|
|
1006
|
+
"name": "replacementChars"
|
|
1007
|
+
},
|
|
1008
|
+
{
|
|
1009
|
+
"title": "returns",
|
|
1010
|
+
"description": null,
|
|
1011
|
+
"type": {
|
|
1012
|
+
"type": "NameExpression",
|
|
1013
|
+
"name": "string"
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
]
|
|
1017
|
+
},
|
|
1018
|
+
"valid": true
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
"name": "cursor",
|
|
1022
|
+
"params": [
|
|
1023
|
+
"value",
|
|
1024
|
+
"options"
|
|
1025
|
+
],
|
|
1026
|
+
"docs": {
|
|
1027
|
+
"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}",
|
|
1028
|
+
"tags": [
|
|
1029
|
+
{
|
|
1030
|
+
"title": "public",
|
|
1031
|
+
"description": null,
|
|
1032
|
+
"type": null
|
|
1033
|
+
},
|
|
1034
|
+
{
|
|
1035
|
+
"title": "function",
|
|
1036
|
+
"description": null,
|
|
1037
|
+
"name": null
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
"title": "example",
|
|
1041
|
+
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
1042
|
+
"caption": "Use a cursor from state if present, or else use the default value"
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
"title": "example",
|
|
1046
|
+
"description": "cursor(22)",
|
|
1047
|
+
"caption": "Use a pagination cursor"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
"title": "param",
|
|
1051
|
+
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
|
1052
|
+
"type": {
|
|
1053
|
+
"type": "NameExpression",
|
|
1054
|
+
"name": "any"
|
|
1055
|
+
},
|
|
1056
|
+
"name": "value"
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
"title": "param",
|
|
1060
|
+
"description": "options to control the cursor.",
|
|
1061
|
+
"type": {
|
|
1062
|
+
"type": "NameExpression",
|
|
1063
|
+
"name": "object"
|
|
1064
|
+
},
|
|
1065
|
+
"name": "options"
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
"title": "param",
|
|
1069
|
+
"description": "set the cursor key. Will persist through the whole run.",
|
|
1070
|
+
"type": {
|
|
1071
|
+
"type": "NameExpression",
|
|
1072
|
+
"name": "string"
|
|
1073
|
+
},
|
|
1074
|
+
"name": "options.key"
|
|
1075
|
+
},
|
|
1076
|
+
{
|
|
1077
|
+
"title": "param",
|
|
1078
|
+
"description": "the value to use if value is falsy",
|
|
1079
|
+
"type": {
|
|
1080
|
+
"type": "NameExpression",
|
|
1081
|
+
"name": "any"
|
|
1082
|
+
},
|
|
1083
|
+
"name": "options.defaultValue"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
"title": "param",
|
|
1087
|
+
"description": "custom formatter for the final cursor value",
|
|
1088
|
+
"type": {
|
|
1089
|
+
"type": "NameExpression",
|
|
1090
|
+
"name": "Function"
|
|
1091
|
+
},
|
|
1092
|
+
"name": "options.format"
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
"title": "returns",
|
|
1096
|
+
"description": null,
|
|
1097
|
+
"type": {
|
|
1098
|
+
"type": "NameExpression",
|
|
1099
|
+
"name": "Operation"
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
]
|
|
1103
|
+
},
|
|
1104
|
+
"valid": false
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
}
|