@openfn/language-browserless 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,976 @@
1
+ {
2
+ "operations": [
3
+ {
4
+ "name": "createPDF",
5
+ "params": [
6
+ "input",
7
+ "options"
8
+ ],
9
+ "docs": {
10
+ "description": "Create a PDF from HTML or URL.",
11
+ "tags": [
12
+ {
13
+ "title": "public",
14
+ "description": null,
15
+ "type": null
16
+ },
17
+ {
18
+ "title": "param",
19
+ "description": "HTML string or URL string",
20
+ "type": {
21
+ "type": "NameExpression",
22
+ "name": "string"
23
+ },
24
+ "name": "input"
25
+ },
26
+ {
27
+ "title": "param",
28
+ "description": "Optional request options",
29
+ "type": {
30
+ "type": "NameExpression",
31
+ "name": "object"
32
+ },
33
+ "name": "options"
34
+ },
35
+ {
36
+ "title": "returns",
37
+ "description": "Returns state with base64 string directly",
38
+ "type": {
39
+ "type": "NameExpression",
40
+ "name": "Operation"
41
+ }
42
+ }
43
+ ]
44
+ },
45
+ "valid": true
46
+ }
47
+ ],
48
+ "exports": [],
49
+ "common": [
50
+ {
51
+ "name": "fn",
52
+ "params": [
53
+ "func"
54
+ ],
55
+ "docs": {
56
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
57
+ "tags": [
58
+ {
59
+ "title": "public",
60
+ "description": null,
61
+ "type": null
62
+ },
63
+ {
64
+ "title": "function",
65
+ "description": null,
66
+ "name": null
67
+ },
68
+ {
69
+ "title": "example",
70
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
71
+ },
72
+ {
73
+ "title": "param",
74
+ "description": "is the function",
75
+ "type": {
76
+ "type": "NameExpression",
77
+ "name": "Function"
78
+ },
79
+ "name": "func"
80
+ },
81
+ {
82
+ "title": "returns",
83
+ "description": null,
84
+ "type": {
85
+ "type": "NameExpression",
86
+ "name": "Operation"
87
+ }
88
+ }
89
+ ]
90
+ },
91
+ "valid": true
92
+ },
93
+ {
94
+ "name": "fnIf",
95
+ "params": [
96
+ "condition",
97
+ "operation"
98
+ ],
99
+ "docs": {
100
+ "description": "Execute a function only when the condition returns true",
101
+ "tags": [
102
+ {
103
+ "title": "public",
104
+ "description": null,
105
+ "type": null
106
+ },
107
+ {
108
+ "title": "function",
109
+ "description": null,
110
+ "name": null
111
+ },
112
+ {
113
+ "title": "example",
114
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
115
+ },
116
+ {
117
+ "title": "param",
118
+ "description": "The condition that returns true",
119
+ "type": {
120
+ "type": "NameExpression",
121
+ "name": "Boolean"
122
+ },
123
+ "name": "condition"
124
+ },
125
+ {
126
+ "title": "param",
127
+ "description": "The operation needed to be executed.",
128
+ "type": {
129
+ "type": "NameExpression",
130
+ "name": "Operation"
131
+ },
132
+ "name": "operation"
133
+ },
134
+ {
135
+ "title": "returns",
136
+ "description": null,
137
+ "type": {
138
+ "type": "NameExpression",
139
+ "name": "Operation"
140
+ }
141
+ }
142
+ ]
143
+ },
144
+ "valid": true
145
+ },
146
+ {
147
+ "name": "sourceValue",
148
+ "params": [
149
+ "path"
150
+ ],
151
+ "docs": {
152
+ "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.",
153
+ "tags": [
154
+ {
155
+ "title": "public",
156
+ "description": null,
157
+ "type": null
158
+ },
159
+ {
160
+ "title": "function",
161
+ "description": null,
162
+ "name": null
163
+ },
164
+ {
165
+ "title": "example",
166
+ "description": "sourceValue('$.key')"
167
+ },
168
+ {
169
+ "title": "param",
170
+ "description": "JSONPath referencing a point in `state`.",
171
+ "type": {
172
+ "type": "NameExpression",
173
+ "name": "String"
174
+ },
175
+ "name": "path"
176
+ },
177
+ {
178
+ "title": "returns",
179
+ "description": null,
180
+ "type": {
181
+ "type": "NameExpression",
182
+ "name": "Operation"
183
+ }
184
+ }
185
+ ]
186
+ },
187
+ "valid": true
188
+ },
189
+ {
190
+ "name": "source",
191
+ "params": [
192
+ "path"
193
+ ],
194
+ "docs": {
195
+ "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.",
196
+ "tags": [
197
+ {
198
+ "title": "public",
199
+ "description": null,
200
+ "type": null
201
+ },
202
+ {
203
+ "title": "function",
204
+ "description": null,
205
+ "name": null
206
+ },
207
+ {
208
+ "title": "example",
209
+ "description": "source('$.key')"
210
+ },
211
+ {
212
+ "title": "param",
213
+ "description": "JSONPath referencing a point in `state`.",
214
+ "type": {
215
+ "type": "NameExpression",
216
+ "name": "String"
217
+ },
218
+ "name": "path"
219
+ },
220
+ {
221
+ "title": "returns",
222
+ "description": null,
223
+ "type": {
224
+ "type": "TypeApplication",
225
+ "expression": {
226
+ "type": "NameExpression",
227
+ "name": "Array"
228
+ },
229
+ "applications": [
230
+ {
231
+ "type": "UnionType",
232
+ "elements": [
233
+ {
234
+ "type": "NameExpression",
235
+ "name": "String"
236
+ },
237
+ {
238
+ "type": "NameExpression",
239
+ "name": "Object"
240
+ }
241
+ ]
242
+ }
243
+ ]
244
+ }
245
+ }
246
+ ]
247
+ },
248
+ "valid": true
249
+ },
250
+ {
251
+ "name": "dataPath",
252
+ "params": [
253
+ "path"
254
+ ],
255
+ "docs": {
256
+ "description": "Ensures a path points at the data.",
257
+ "tags": [
258
+ {
259
+ "title": "public",
260
+ "description": null,
261
+ "type": null
262
+ },
263
+ {
264
+ "title": "function",
265
+ "description": null,
266
+ "name": null
267
+ },
268
+ {
269
+ "title": "example",
270
+ "description": "dataPath('key')"
271
+ },
272
+ {
273
+ "title": "param",
274
+ "description": "JSONPath referencing a point in `data`.",
275
+ "type": {
276
+ "type": "NameExpression",
277
+ "name": "string"
278
+ },
279
+ "name": "path"
280
+ },
281
+ {
282
+ "title": "returns",
283
+ "description": null,
284
+ "type": {
285
+ "type": "NameExpression",
286
+ "name": "string"
287
+ }
288
+ }
289
+ ]
290
+ },
291
+ "valid": true
292
+ },
293
+ {
294
+ "name": "dataValue",
295
+ "params": [
296
+ "path"
297
+ ],
298
+ "docs": {
299
+ "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.",
300
+ "tags": [
301
+ {
302
+ "title": "public",
303
+ "description": null,
304
+ "type": null
305
+ },
306
+ {
307
+ "title": "function",
308
+ "description": null,
309
+ "name": null
310
+ },
311
+ {
312
+ "title": "example",
313
+ "description": "dataValue('key')"
314
+ },
315
+ {
316
+ "title": "param",
317
+ "description": "JSONPath referencing a point in `data`.",
318
+ "type": {
319
+ "type": "NameExpression",
320
+ "name": "String"
321
+ },
322
+ "name": "path"
323
+ },
324
+ {
325
+ "title": "returns",
326
+ "description": null,
327
+ "type": {
328
+ "type": "NameExpression",
329
+ "name": "Operation"
330
+ }
331
+ }
332
+ ]
333
+ },
334
+ "valid": true
335
+ },
336
+ {
337
+ "name": "lastReferenceValue",
338
+ "params": [
339
+ "path"
340
+ ],
341
+ "docs": {
342
+ "description": "Picks out the last reference value from source data.",
343
+ "tags": [
344
+ {
345
+ "title": "public",
346
+ "description": null,
347
+ "type": null
348
+ },
349
+ {
350
+ "title": "function",
351
+ "description": null,
352
+ "name": null
353
+ },
354
+ {
355
+ "title": "example",
356
+ "description": "lastReferenceValue('key')"
357
+ },
358
+ {
359
+ "title": "param",
360
+ "description": "JSONPath referencing a point in `references`.",
361
+ "type": {
362
+ "type": "NameExpression",
363
+ "name": "String"
364
+ },
365
+ "name": "path"
366
+ },
367
+ {
368
+ "title": "returns",
369
+ "description": null,
370
+ "type": {
371
+ "type": "NameExpression",
372
+ "name": "Operation"
373
+ }
374
+ }
375
+ ]
376
+ },
377
+ "valid": true
378
+ },
379
+ {
380
+ "name": "each",
381
+ "params": [
382
+ "dataSource",
383
+ "operation"
384
+ ],
385
+ "docs": {
386
+ "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.",
387
+ "tags": [
388
+ {
389
+ "title": "public",
390
+ "description": null,
391
+ "type": null
392
+ },
393
+ {
394
+ "title": "function",
395
+ "description": null,
396
+ "name": null
397
+ },
398
+ {
399
+ "title": "example",
400
+ "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);",
401
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
402
+ },
403
+ {
404
+ "title": "example",
405
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
406
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
407
+ },
408
+ {
409
+ "title": "example",
410
+ "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);",
411
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
412
+ },
413
+ {
414
+ "title": "param",
415
+ "description": "JSONPath referencing a point in `state`.",
416
+ "type": {
417
+ "type": "NameExpression",
418
+ "name": "DataSource"
419
+ },
420
+ "name": "dataSource"
421
+ },
422
+ {
423
+ "title": "param",
424
+ "description": "The operation needed to be repeated.",
425
+ "type": {
426
+ "type": "NameExpression",
427
+ "name": "Operation"
428
+ },
429
+ "name": "operation"
430
+ },
431
+ {
432
+ "title": "returns",
433
+ "description": null,
434
+ "type": {
435
+ "type": "NameExpression",
436
+ "name": "Operation"
437
+ }
438
+ }
439
+ ]
440
+ },
441
+ "valid": true
442
+ },
443
+ {
444
+ "name": "combine",
445
+ "params": [
446
+ "operations"
447
+ ],
448
+ "docs": {
449
+ "description": "Combines two operations into one",
450
+ "tags": [
451
+ {
452
+ "title": "public",
453
+ "description": null,
454
+ "type": null
455
+ },
456
+ {
457
+ "title": "function",
458
+ "description": null,
459
+ "name": null
460
+ },
461
+ {
462
+ "title": "example",
463
+ "description": "combine(\n create('foo'),\n delete('bar')\n)"
464
+ },
465
+ {
466
+ "title": "param",
467
+ "description": "Operations to be performed.",
468
+ "type": {
469
+ "type": "NameExpression",
470
+ "name": "Operations"
471
+ },
472
+ "name": "operations"
473
+ },
474
+ {
475
+ "title": "returns",
476
+ "description": null,
477
+ "type": {
478
+ "type": "NameExpression",
479
+ "name": "Operation"
480
+ }
481
+ }
482
+ ]
483
+ },
484
+ "valid": true
485
+ },
486
+ {
487
+ "name": "field",
488
+ "params": [
489
+ "key",
490
+ "value"
491
+ ],
492
+ "docs": {
493
+ "description": "Returns a key, value pair in an array.",
494
+ "tags": [
495
+ {
496
+ "title": "public",
497
+ "description": null,
498
+ "type": null
499
+ },
500
+ {
501
+ "title": "function",
502
+ "description": null,
503
+ "name": null
504
+ },
505
+ {
506
+ "title": "example",
507
+ "description": "field('destination_field_name__c', 'value')"
508
+ },
509
+ {
510
+ "title": "param",
511
+ "description": "Name of the field",
512
+ "type": {
513
+ "type": "NameExpression",
514
+ "name": "string"
515
+ },
516
+ "name": "key"
517
+ },
518
+ {
519
+ "title": "param",
520
+ "description": "The value itself or a sourceable operation.",
521
+ "type": {
522
+ "type": "NameExpression",
523
+ "name": "Value"
524
+ },
525
+ "name": "value"
526
+ },
527
+ {
528
+ "title": "returns",
529
+ "description": null,
530
+ "type": {
531
+ "type": "NameExpression",
532
+ "name": "Field"
533
+ }
534
+ }
535
+ ]
536
+ },
537
+ "valid": true
538
+ },
539
+ {
540
+ "name": "fields",
541
+ "params": [
542
+ "fields"
543
+ ],
544
+ "docs": {
545
+ "description": "Zips key value pairs into an object.",
546
+ "tags": [
547
+ {
548
+ "title": "public",
549
+ "description": null,
550
+ "type": null
551
+ },
552
+ {
553
+ "title": "function",
554
+ "description": null,
555
+ "name": null
556
+ },
557
+ {
558
+ "title": "example",
559
+ "description": "fields(list_of_fields)"
560
+ },
561
+ {
562
+ "title": "param",
563
+ "description": "a list of fields",
564
+ "type": {
565
+ "type": "NameExpression",
566
+ "name": "Fields"
567
+ },
568
+ "name": "fields"
569
+ },
570
+ {
571
+ "title": "returns",
572
+ "description": null,
573
+ "type": {
574
+ "type": "NameExpression",
575
+ "name": "Object"
576
+ }
577
+ }
578
+ ]
579
+ },
580
+ "valid": true
581
+ },
582
+ {
583
+ "name": "merge",
584
+ "params": [
585
+ "dataSource",
586
+ "fields"
587
+ ],
588
+ "docs": {
589
+ "description": "Merges fields into each item in an array.",
590
+ "tags": [
591
+ {
592
+ "title": "public",
593
+ "description": null,
594
+ "type": null
595
+ },
596
+ {
597
+ "title": "example",
598
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
599
+ },
600
+ {
601
+ "title": "function",
602
+ "description": null,
603
+ "name": null
604
+ },
605
+ {
606
+ "title": "public",
607
+ "description": null,
608
+ "type": null
609
+ },
610
+ {
611
+ "title": "param",
612
+ "description": null,
613
+ "type": {
614
+ "type": "NameExpression",
615
+ "name": "DataSource"
616
+ },
617
+ "name": "dataSource"
618
+ },
619
+ {
620
+ "title": "param",
621
+ "description": "Group of fields to merge in.",
622
+ "type": {
623
+ "type": "NameExpression",
624
+ "name": "Object"
625
+ },
626
+ "name": "fields"
627
+ },
628
+ {
629
+ "title": "returns",
630
+ "description": null,
631
+ "type": {
632
+ "type": "NameExpression",
633
+ "name": "DataSource"
634
+ }
635
+ }
636
+ ]
637
+ },
638
+ "valid": true
639
+ },
640
+ {
641
+ "name": "group",
642
+ "params": [
643
+ "arrayOfObjects",
644
+ "keyPath",
645
+ "callback"
646
+ ],
647
+ "docs": {
648
+ "description": "Groups an array of objects by a specified key path.",
649
+ "tags": [
650
+ {
651
+ "title": "public",
652
+ "description": null,
653
+ "type": null
654
+ },
655
+ {
656
+ "title": "example",
657
+ "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 / ] }"
658
+ },
659
+ {
660
+ "title": "function",
661
+ "description": null,
662
+ "name": null
663
+ },
664
+ {
665
+ "title": "public",
666
+ "description": null,
667
+ "type": null
668
+ },
669
+ {
670
+ "title": "param",
671
+ "description": "The array of objects to be grouped.",
672
+ "type": {
673
+ "type": "TypeApplication",
674
+ "expression": {
675
+ "type": "NameExpression",
676
+ "name": "Array"
677
+ },
678
+ "applications": [
679
+ {
680
+ "type": "NameExpression",
681
+ "name": "Object"
682
+ }
683
+ ]
684
+ },
685
+ "name": "arrayOfObjects"
686
+ },
687
+ {
688
+ "title": "param",
689
+ "description": "The key path to group by.",
690
+ "type": {
691
+ "type": "NameExpression",
692
+ "name": "string"
693
+ },
694
+ "name": "keyPath"
695
+ },
696
+ {
697
+ "title": "param",
698
+ "description": "(Optional) Callback function",
699
+ "type": {
700
+ "type": "NameExpression",
701
+ "name": "function"
702
+ },
703
+ "name": "callback"
704
+ },
705
+ {
706
+ "title": "returns",
707
+ "description": null,
708
+ "type": {
709
+ "type": "NameExpression",
710
+ "name": "Operation"
711
+ }
712
+ }
713
+ ]
714
+ },
715
+ "valid": true
716
+ },
717
+ {
718
+ "name": "scrubEmojis",
719
+ "params": [
720
+ "text",
721
+ "replacementChars"
722
+ ],
723
+ "docs": {
724
+ "description": "Replaces emojis in a string.",
725
+ "tags": [
726
+ {
727
+ "title": "public",
728
+ "description": null,
729
+ "type": null
730
+ },
731
+ {
732
+ "title": "function",
733
+ "description": null,
734
+ "name": null
735
+ },
736
+ {
737
+ "title": "example",
738
+ "description": "scrubEmojis('Dove🕊️⭐ 29')"
739
+ },
740
+ {
741
+ "title": "param",
742
+ "description": "String that needs to be cleaned",
743
+ "type": {
744
+ "type": "NameExpression",
745
+ "name": "string"
746
+ },
747
+ "name": "text"
748
+ },
749
+ {
750
+ "title": "param",
751
+ "description": "Characters that replace the emojis",
752
+ "type": {
753
+ "type": "NameExpression",
754
+ "name": "string"
755
+ },
756
+ "name": "replacementChars"
757
+ },
758
+ {
759
+ "title": "returns",
760
+ "description": null,
761
+ "type": {
762
+ "type": "NameExpression",
763
+ "name": "string"
764
+ }
765
+ }
766
+ ]
767
+ },
768
+ "valid": true
769
+ },
770
+ {
771
+ "name": "cursor",
772
+ "params": [
773
+ "value",
774
+ "options"
775
+ ],
776
+ "docs": {
777
+ "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}",
778
+ "tags": [
779
+ {
780
+ "title": "public",
781
+ "description": null,
782
+ "type": null
783
+ },
784
+ {
785
+ "title": "function",
786
+ "description": null,
787
+ "name": null
788
+ },
789
+ {
790
+ "title": "example",
791
+ "description": "cursor($.cursor, { defaultValue: 'today' })",
792
+ "caption": "Use a cursor from state if present, or else use the default value"
793
+ },
794
+ {
795
+ "title": "example",
796
+ "description": "cursor(22)",
797
+ "caption": "Use a pagination cursor"
798
+ },
799
+ {
800
+ "title": "param",
801
+ "description": "the cursor value. Usually an ISO date, natural language date, or page number",
802
+ "type": {
803
+ "type": "NameExpression",
804
+ "name": "any"
805
+ },
806
+ "name": "value"
807
+ },
808
+ {
809
+ "title": "param",
810
+ "description": "options to control the cursor.",
811
+ "type": {
812
+ "type": "NameExpression",
813
+ "name": "object"
814
+ },
815
+ "name": "options"
816
+ },
817
+ {
818
+ "title": "param",
819
+ "description": "set the cursor key. Will persist through the whole run.",
820
+ "type": {
821
+ "type": "NameExpression",
822
+ "name": "string"
823
+ },
824
+ "name": "options.key"
825
+ },
826
+ {
827
+ "title": "param",
828
+ "description": "the value to use if value is falsy",
829
+ "type": {
830
+ "type": "NameExpression",
831
+ "name": "any"
832
+ },
833
+ "name": "options.defaultValue"
834
+ },
835
+ {
836
+ "title": "param",
837
+ "description": "custom formatter for the final cursor value",
838
+ "type": {
839
+ "type": "NameExpression",
840
+ "name": "Function"
841
+ },
842
+ "name": "options.format"
843
+ },
844
+ {
845
+ "title": "returns",
846
+ "description": null,
847
+ "type": {
848
+ "type": "NameExpression",
849
+ "name": "Operation"
850
+ }
851
+ }
852
+ ]
853
+ },
854
+ "valid": false
855
+ },
856
+ {
857
+ "name": "as",
858
+ "params": [
859
+ "key",
860
+ "operation"
861
+ ],
862
+ "docs": {
863
+ "description": "Run an operation and save the result to a custom key in state instead of overwriting state.data.",
864
+ "tags": [
865
+ {
866
+ "title": "public",
867
+ "description": null,
868
+ "type": null
869
+ },
870
+ {
871
+ "title": "function",
872
+ "description": null,
873
+ "name": null
874
+ },
875
+ {
876
+ "title": "example",
877
+ "description": "as('cceData', collections.get('cce-data-dhis2', { key: `*:*:${$.syncedAt}*` }));",
878
+ "caption": "Fetch cce-data from collections and store them under state.cceData"
879
+ },
880
+ {
881
+ "title": "param",
882
+ "description": "The state key to assign the result of the operation to.",
883
+ "type": {
884
+ "type": "NameExpression",
885
+ "name": "string"
886
+ },
887
+ "name": "key"
888
+ },
889
+ {
890
+ "title": "param",
891
+ "description": " An operation that returns a new state object with a `data` property",
892
+ "type": {
893
+ "type": "NameExpression",
894
+ "name": "function"
895
+ },
896
+ "name": "operation"
897
+ },
898
+ {
899
+ "title": "returns",
900
+ "description": null,
901
+ "type": {
902
+ "type": "NameExpression",
903
+ "name": "Operation"
904
+ }
905
+ }
906
+ ]
907
+ },
908
+ "valid": true
909
+ },
910
+ {
911
+ "name": "map",
912
+ "params": {},
913
+ "docs": {
914
+ "description": "Iterates over a collection of items and returns a new array of mapped values,\nlike Javascript's `Array.map()` function.\n\nEach item in the source array will be passed into the callback function. The returned value\nwill be added to the new array. The callback is passed the original item, the current index\nin the source array (ie, the nth item number), and the state object.\n\nWrites a new array to `state.data` with transformed values.c array.",
915
+ "tags": [
916
+ {
917
+ "title": "public",
918
+ "description": null,
919
+ "type": null
920
+ },
921
+ {
922
+ "title": "function",
923
+ "description": null,
924
+ "name": null
925
+ },
926
+ {
927
+ "title": "example",
928
+ "description": "map($.items', (data, index, state) => {\n return {\n id: index + 1,\n name: data.name,\n createdAt: state.cursor,\n };\n});",
929
+ "caption": "Transform an array of items in state"
930
+ },
931
+ {
932
+ "title": "example",
933
+ "description": "map($.items, async (data, index, state) => {\n const userInfo = await fetchUserInfo(data.userId);\n return {\n id: index + 1,\n name: data.name,\n extra: userInfo,\n };\n});",
934
+ "caption": "Map items asynchronously (e.g. fetch extra info)"
935
+ },
936
+ {
937
+ "title": "param",
938
+ "description": "An array of items or a a JSONPath string which points to an array of items.",
939
+ "type": {
940
+ "type": "UnionType",
941
+ "elements": [
942
+ {
943
+ "type": "NameExpression",
944
+ "name": "string"
945
+ },
946
+ {
947
+ "type": "NameExpression",
948
+ "name": "Array"
949
+ }
950
+ ]
951
+ },
952
+ "name": "path"
953
+ },
954
+ {
955
+ "title": "param",
956
+ "description": "The mapping function, invoked with `(data, index, state)` for each item in the array.",
957
+ "type": {
958
+ "type": "NameExpression",
959
+ "name": "function"
960
+ },
961
+ "name": "callback"
962
+ },
963
+ {
964
+ "title": "returns",
965
+ "description": null,
966
+ "type": {
967
+ "type": "NameExpression",
968
+ "name": "State"
969
+ }
970
+ }
971
+ ]
972
+ },
973
+ "valid": false
974
+ }
975
+ ]
976
+ }