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