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