@openfn/language-mogli 0.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 ADDED
@@ -0,0 +1,781 @@
1
+ {
2
+ "operations": [],
3
+ "exports": [],
4
+ "common": [
5
+ {
6
+ "name": "sourceValue",
7
+ "params": [
8
+ "path"
9
+ ],
10
+ "docs": {
11
+ "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.",
12
+ "tags": [
13
+ {
14
+ "title": "public",
15
+ "description": null,
16
+ "type": null
17
+ },
18
+ {
19
+ "title": "example",
20
+ "description": "sourceValue('$.key')"
21
+ },
22
+ {
23
+ "title": "function",
24
+ "description": null,
25
+ "name": null
26
+ },
27
+ {
28
+ "title": "param",
29
+ "description": "JSONPath referencing a point in `state`.",
30
+ "type": {
31
+ "type": "NameExpression",
32
+ "name": "String"
33
+ },
34
+ "name": "path"
35
+ },
36
+ {
37
+ "title": "returns",
38
+ "description": null,
39
+ "type": {
40
+ "type": "NameExpression",
41
+ "name": "Operation"
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ "valid": true
47
+ },
48
+ {
49
+ "name": "source",
50
+ "params": [
51
+ "path"
52
+ ],
53
+ "docs": {
54
+ "description": "Picks out a value from source data.\nWill return whatever JSONPath returns, which will always be an array.\nIf you need a single value use `sourceValue` instead.",
55
+ "tags": [
56
+ {
57
+ "title": "public",
58
+ "description": null,
59
+ "type": null
60
+ },
61
+ {
62
+ "title": "example",
63
+ "description": "source('$.key')"
64
+ },
65
+ {
66
+ "title": "function",
67
+ "description": null,
68
+ "name": null
69
+ },
70
+ {
71
+ "title": "param",
72
+ "description": "JSONPath referencing a point in `state`.",
73
+ "type": {
74
+ "type": "NameExpression",
75
+ "name": "String"
76
+ },
77
+ "name": "path"
78
+ },
79
+ {
80
+ "title": "returns",
81
+ "description": null,
82
+ "type": {
83
+ "type": "TypeApplication",
84
+ "expression": {
85
+ "type": "NameExpression",
86
+ "name": "Array"
87
+ },
88
+ "applications": [
89
+ {
90
+ "type": "UnionType",
91
+ "elements": [
92
+ {
93
+ "type": "NameExpression",
94
+ "name": "String"
95
+ },
96
+ {
97
+ "type": "NameExpression",
98
+ "name": "Object"
99
+ }
100
+ ]
101
+ }
102
+ ]
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ "valid": true
108
+ },
109
+ {
110
+ "name": "dataPath",
111
+ "params": [
112
+ "path"
113
+ ],
114
+ "docs": {
115
+ "description": "Ensures a path points at the data.",
116
+ "tags": [
117
+ {
118
+ "title": "public",
119
+ "description": null,
120
+ "type": null
121
+ },
122
+ {
123
+ "title": "example",
124
+ "description": "dataPath('key')"
125
+ },
126
+ {
127
+ "title": "function",
128
+ "description": null,
129
+ "name": null
130
+ },
131
+ {
132
+ "title": "param",
133
+ "description": "JSONPath referencing a point in `data`.",
134
+ "type": {
135
+ "type": "NameExpression",
136
+ "name": "string"
137
+ },
138
+ "name": "path"
139
+ },
140
+ {
141
+ "title": "returns",
142
+ "description": null,
143
+ "type": {
144
+ "type": "NameExpression",
145
+ "name": "string"
146
+ }
147
+ }
148
+ ]
149
+ },
150
+ "valid": true
151
+ },
152
+ {
153
+ "name": "dataValue",
154
+ "params": [
155
+ "path"
156
+ ],
157
+ "docs": {
158
+ "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.",
159
+ "tags": [
160
+ {
161
+ "title": "public",
162
+ "description": null,
163
+ "type": null
164
+ },
165
+ {
166
+ "title": "example",
167
+ "description": "dataValue('key')"
168
+ },
169
+ {
170
+ "title": "function",
171
+ "description": null,
172
+ "name": null
173
+ },
174
+ {
175
+ "title": "param",
176
+ "description": "JSONPath referencing a point in `data`.",
177
+ "type": {
178
+ "type": "NameExpression",
179
+ "name": "String"
180
+ },
181
+ "name": "path"
182
+ },
183
+ {
184
+ "title": "returns",
185
+ "description": null,
186
+ "type": {
187
+ "type": "NameExpression",
188
+ "name": "Operation"
189
+ }
190
+ }
191
+ ]
192
+ },
193
+ "valid": true
194
+ },
195
+ {
196
+ "name": "referencePath",
197
+ "params": [
198
+ "path"
199
+ ],
200
+ "docs": {
201
+ "description": "Ensures a path points at references.",
202
+ "tags": [
203
+ {
204
+ "title": "public",
205
+ "description": null,
206
+ "type": null
207
+ },
208
+ {
209
+ "title": "example",
210
+ "description": "referencePath('key')"
211
+ },
212
+ {
213
+ "title": "function",
214
+ "description": null,
215
+ "name": null
216
+ },
217
+ {
218
+ "title": "param",
219
+ "description": "JSONPath referencing a point in `references`.",
220
+ "type": {
221
+ "type": "NameExpression",
222
+ "name": "string"
223
+ },
224
+ "name": "path"
225
+ },
226
+ {
227
+ "title": "returns",
228
+ "description": null,
229
+ "type": {
230
+ "type": "NameExpression",
231
+ "name": "string"
232
+ }
233
+ }
234
+ ]
235
+ },
236
+ "valid": true
237
+ },
238
+ {
239
+ "name": "lastReferenceValue",
240
+ "params": [
241
+ "path"
242
+ ],
243
+ "docs": {
244
+ "description": "Picks out the last reference value from source data.",
245
+ "tags": [
246
+ {
247
+ "title": "public",
248
+ "description": null,
249
+ "type": null
250
+ },
251
+ {
252
+ "title": "example",
253
+ "description": "lastReferenceValue('key')"
254
+ },
255
+ {
256
+ "title": "function",
257
+ "description": null,
258
+ "name": null
259
+ },
260
+ {
261
+ "title": "param",
262
+ "description": "JSONPath referencing a point in `references`.",
263
+ "type": {
264
+ "type": "NameExpression",
265
+ "name": "String"
266
+ },
267
+ "name": "path"
268
+ },
269
+ {
270
+ "title": "returns",
271
+ "description": null,
272
+ "type": {
273
+ "type": "NameExpression",
274
+ "name": "Operation"
275
+ }
276
+ }
277
+ ]
278
+ },
279
+ "valid": true
280
+ },
281
+ {
282
+ "name": "each",
283
+ "params": [
284
+ "dataSource",
285
+ "operation"
286
+ ],
287
+ "docs": {
288
+ "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.",
289
+ "tags": [
290
+ {
291
+ "title": "public",
292
+ "description": null,
293
+ "type": null
294
+ },
295
+ {
296
+ "title": "example",
297
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
298
+ },
299
+ {
300
+ "title": "function",
301
+ "description": null,
302
+ "name": null
303
+ },
304
+ {
305
+ "title": "param",
306
+ "description": "JSONPath referencing a point in `state`.",
307
+ "type": {
308
+ "type": "NameExpression",
309
+ "name": "DataSource"
310
+ },
311
+ "name": "dataSource"
312
+ },
313
+ {
314
+ "title": "param",
315
+ "description": "The operation needed to be repeated.",
316
+ "type": {
317
+ "type": "NameExpression",
318
+ "name": "Operation"
319
+ },
320
+ "name": "operation"
321
+ },
322
+ {
323
+ "title": "returns",
324
+ "description": null,
325
+ "type": {
326
+ "type": "NameExpression",
327
+ "name": "Operation"
328
+ }
329
+ }
330
+ ]
331
+ },
332
+ "valid": true
333
+ },
334
+ {
335
+ "name": "combine",
336
+ "params": [
337
+ "operations"
338
+ ],
339
+ "docs": {
340
+ "description": "Combines two operations into one",
341
+ "tags": [
342
+ {
343
+ "title": "public",
344
+ "description": null,
345
+ "type": null
346
+ },
347
+ {
348
+ "title": "example",
349
+ "description": "combine(\n create('foo'),\n delete('bar')\n)"
350
+ },
351
+ {
352
+ "title": "function",
353
+ "description": null,
354
+ "name": null
355
+ },
356
+ {
357
+ "title": "param",
358
+ "description": "Operations to be performed.",
359
+ "type": {
360
+ "type": "NameExpression",
361
+ "name": "Operations"
362
+ },
363
+ "name": "operations"
364
+ },
365
+ {
366
+ "title": "returns",
367
+ "description": null,
368
+ "type": {
369
+ "type": "NameExpression",
370
+ "name": "Operation"
371
+ }
372
+ }
373
+ ]
374
+ },
375
+ "valid": true
376
+ },
377
+ {
378
+ "name": "join",
379
+ "params": [
380
+ "targetPath",
381
+ "sourcePath",
382
+ "targetKey"
383
+ ],
384
+ "docs": {
385
+ "description": "Adds data from a target object",
386
+ "tags": [
387
+ {
388
+ "title": "public",
389
+ "description": null,
390
+ "type": null
391
+ },
392
+ {
393
+ "title": "example",
394
+ "description": "join('$.key','$.data','newKey')"
395
+ },
396
+ {
397
+ "title": "function",
398
+ "description": null,
399
+ "name": null
400
+ },
401
+ {
402
+ "title": "param",
403
+ "description": "Target path",
404
+ "type": {
405
+ "type": "NameExpression",
406
+ "name": "String"
407
+ },
408
+ "name": "targetPath"
409
+ },
410
+ {
411
+ "title": "param",
412
+ "description": "Source path",
413
+ "type": {
414
+ "type": "NameExpression",
415
+ "name": "String"
416
+ },
417
+ "name": "sourcePath"
418
+ },
419
+ {
420
+ "title": "param",
421
+ "description": "Target Key",
422
+ "type": {
423
+ "type": "NameExpression",
424
+ "name": "String"
425
+ },
426
+ "name": "targetKey"
427
+ },
428
+ {
429
+ "title": "returns",
430
+ "description": null,
431
+ "type": {
432
+ "type": "NameExpression",
433
+ "name": "Operation"
434
+ }
435
+ }
436
+ ]
437
+ },
438
+ "valid": true
439
+ },
440
+ {
441
+ "name": "field",
442
+ "params": [
443
+ "key",
444
+ "value"
445
+ ],
446
+ "docs": {
447
+ "description": "Returns a key, value pair in an array.",
448
+ "tags": [
449
+ {
450
+ "title": "public",
451
+ "description": null,
452
+ "type": null
453
+ },
454
+ {
455
+ "title": "example",
456
+ "description": "field('destination_field_name__c', 'value')"
457
+ },
458
+ {
459
+ "title": "function",
460
+ "description": null,
461
+ "name": null
462
+ },
463
+ {
464
+ "title": "param",
465
+ "description": "Name of the field",
466
+ "type": {
467
+ "type": "NameExpression",
468
+ "name": "string"
469
+ },
470
+ "name": "key"
471
+ },
472
+ {
473
+ "title": "param",
474
+ "description": "The value itself or a sourceable operation.",
475
+ "type": {
476
+ "type": "NameExpression",
477
+ "name": "Value"
478
+ },
479
+ "name": "value"
480
+ },
481
+ {
482
+ "title": "returns",
483
+ "description": null,
484
+ "type": {
485
+ "type": "NameExpression",
486
+ "name": "Field"
487
+ }
488
+ }
489
+ ]
490
+ },
491
+ "valid": true
492
+ },
493
+ {
494
+ "name": "fields",
495
+ "params": [
496
+ "fields"
497
+ ],
498
+ "docs": {
499
+ "description": "Zips key value pairs into an object.",
500
+ "tags": [
501
+ {
502
+ "title": "public",
503
+ "description": null,
504
+ "type": null
505
+ },
506
+ {
507
+ "title": "example",
508
+ "description": "fields(list_of_fields)"
509
+ },
510
+ {
511
+ "title": "function",
512
+ "description": null,
513
+ "name": null
514
+ },
515
+ {
516
+ "title": "param",
517
+ "description": "a list of fields",
518
+ "type": {
519
+ "type": "NameExpression",
520
+ "name": "Fields"
521
+ },
522
+ "name": "fields"
523
+ },
524
+ {
525
+ "title": "returns",
526
+ "description": null,
527
+ "type": {
528
+ "type": "NameExpression",
529
+ "name": "Object"
530
+ }
531
+ }
532
+ ]
533
+ },
534
+ "valid": true
535
+ },
536
+ {
537
+ "name": "merge",
538
+ "params": [
539
+ "dataSource",
540
+ "fields"
541
+ ],
542
+ "docs": {
543
+ "description": "Merges fields into each item in an array.",
544
+ "tags": [
545
+ {
546
+ "title": "public",
547
+ "description": null,
548
+ "type": null
549
+ },
550
+ {
551
+ "title": "example",
552
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
553
+ },
554
+ {
555
+ "title": "function",
556
+ "description": null,
557
+ "name": null
558
+ },
559
+ {
560
+ "title": "param",
561
+ "description": null,
562
+ "type": {
563
+ "type": "NameExpression",
564
+ "name": "DataSource"
565
+ },
566
+ "name": "dataSource"
567
+ },
568
+ {
569
+ "title": "param",
570
+ "description": "Group of fields to merge in.",
571
+ "type": {
572
+ "type": "NameExpression",
573
+ "name": "Object"
574
+ },
575
+ "name": "fields"
576
+ },
577
+ {
578
+ "title": "returns",
579
+ "description": null,
580
+ "type": {
581
+ "type": "NameExpression",
582
+ "name": "DataSource"
583
+ }
584
+ }
585
+ ]
586
+ },
587
+ "valid": true
588
+ },
589
+ {
590
+ "name": "index",
591
+ "params": [],
592
+ "docs": {
593
+ "description": "Returns the index of the current array being iterated.\nTo be used with `each` as a data source.",
594
+ "tags": [
595
+ {
596
+ "title": "public",
597
+ "description": null,
598
+ "type": null
599
+ },
600
+ {
601
+ "title": "example",
602
+ "description": "index()"
603
+ },
604
+ {
605
+ "title": "function",
606
+ "description": null,
607
+ "name": null
608
+ },
609
+ {
610
+ "title": "returns",
611
+ "description": null,
612
+ "type": {
613
+ "type": "NameExpression",
614
+ "name": "DataSource"
615
+ }
616
+ }
617
+ ]
618
+ },
619
+ "valid": true
620
+ },
621
+ {
622
+ "name": "arrayToString",
623
+ "params": [
624
+ "arr",
625
+ "separator"
626
+ ],
627
+ "docs": {
628
+ "description": "Turns an array into a string, separated by X.",
629
+ "tags": [
630
+ {
631
+ "title": "public",
632
+ "description": null,
633
+ "type": null
634
+ },
635
+ {
636
+ "title": "example",
637
+ "description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
638
+ },
639
+ {
640
+ "title": "function",
641
+ "description": null,
642
+ "name": null
643
+ },
644
+ {
645
+ "title": "param",
646
+ "description": "Array of toString'able primatives.",
647
+ "type": {
648
+ "type": "NameExpression",
649
+ "name": "array"
650
+ },
651
+ "name": "arr"
652
+ },
653
+ {
654
+ "title": "param",
655
+ "description": "Separator string.",
656
+ "type": {
657
+ "type": "NameExpression",
658
+ "name": "string"
659
+ },
660
+ "name": "separator"
661
+ },
662
+ {
663
+ "title": "returns",
664
+ "description": null,
665
+ "type": {
666
+ "type": "NameExpression",
667
+ "name": "string"
668
+ }
669
+ }
670
+ ]
671
+ },
672
+ "valid": true
673
+ },
674
+ {
675
+ "name": "toArray",
676
+ "params": [
677
+ "arg"
678
+ ],
679
+ "docs": {
680
+ "description": "Ensures primitive data types are wrapped in an array.\nDoes not affect array objects.",
681
+ "tags": [
682
+ {
683
+ "title": "public",
684
+ "description": null,
685
+ "type": null
686
+ },
687
+ {
688
+ "title": "example",
689
+ "description": "each(function(state) {\n return toArray( dataValue(\"path_of_array\")(state) )\n}, ...)"
690
+ },
691
+ {
692
+ "title": "function",
693
+ "description": null,
694
+ "name": null
695
+ },
696
+ {
697
+ "title": "param",
698
+ "description": "Data required to be in an array",
699
+ "type": {
700
+ "type": "NameExpression",
701
+ "name": "any"
702
+ },
703
+ "name": "arg"
704
+ },
705
+ {
706
+ "title": "returns",
707
+ "description": null,
708
+ "type": {
709
+ "type": "NameExpression",
710
+ "name": "array"
711
+ }
712
+ }
713
+ ]
714
+ },
715
+ "valid": true
716
+ },
717
+ {
718
+ "name": "map",
719
+ "params": [
720
+ "path",
721
+ "operation",
722
+ "state"
723
+ ],
724
+ "docs": {
725
+ "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.",
726
+ "tags": [
727
+ {
728
+ "title": "public",
729
+ "description": null,
730
+ "type": null
731
+ },
732
+ {
733
+ "title": "example",
734
+ "description": "map(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
735
+ },
736
+ {
737
+ "title": "function",
738
+ "description": null,
739
+ "name": null
740
+ },
741
+ {
742
+ "title": "param",
743
+ "description": "JSONPath referencing a point in `state.data`.",
744
+ "type": {
745
+ "type": "NameExpression",
746
+ "name": "string"
747
+ },
748
+ "name": "path"
749
+ },
750
+ {
751
+ "title": "param",
752
+ "description": "The operation needed to be repeated.",
753
+ "type": {
754
+ "type": "NameExpression",
755
+ "name": "function"
756
+ },
757
+ "name": "operation"
758
+ },
759
+ {
760
+ "title": "param",
761
+ "description": "Runtime state.",
762
+ "type": {
763
+ "type": "NameExpression",
764
+ "name": "State"
765
+ },
766
+ "name": "state"
767
+ },
768
+ {
769
+ "title": "returns",
770
+ "description": null,
771
+ "type": {
772
+ "type": "NameExpression",
773
+ "name": "State"
774
+ }
775
+ }
776
+ ]
777
+ },
778
+ "valid": true
779
+ }
780
+ ]
781
+ }