@openfn/language-divoc 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,574 @@
1
+ {
2
+ "operations": [
3
+ {
4
+ "name": "certifyVaccination",
5
+ "params": [
6
+ "data"
7
+ ],
8
+ "docs": {
9
+ "description": "Certify a vaccination",
10
+ "tags": [
11
+ {
12
+ "title": "public",
13
+ "description": null,
14
+ "type": null
15
+ },
16
+ {
17
+ "title": "function",
18
+ "description": null,
19
+ "name": null
20
+ },
21
+ {
22
+ "title": "example",
23
+ "description": "certifyVaccination({\n\"preEnrollmentCode\": \"string\",\n\"recipient\": {\n\"name\": \"string\",\n\"dob\": \"2025-03-20\",\n\"age\": \"string\",\n\"gender\": \"string\",\n\"nationality\": \"string\",\n\"identity\": \"string\",\n\"contact\": [\n\"string\"\n],\n\"address\": {\n\"addressLine1\": \"string\",\n\"addressLine2\": \"string\",\n\"district\": \"string\",\n\"state\": \"string\",\n\"pincode\": 0\n}\n},\n\"vaccination\": {\n\"name\": \"string\",\n\"batch\": \"string\",\n\"manufacturer\": \"string\",\n\"date\": \"2025-03-20T06:08:22.394Z\",\n\"effectiveStart\": \"2025-03-20\",\n\"effectiveUntil\": \"2025-03-20\",\n\"dose\": 1,\n\"totalDoses\": 2\n},\n\"vaccinator\": {\n\"name\": \"string\"\n},\n\"facility\": {\n\"name\": \"string\",\n\"address\": {\n\"addressLine1\": \"string\",\n\"addressLine2\": \"string\",\n\"district\": \"string\",\n\"state\": \"string\",\n\"pincode\": 0\n}\n},\n\"meta\": {}\n});",
24
+ "caption": "Certify a vaccination object"
25
+ },
26
+ {
27
+ "title": "param",
28
+ "description": "Vaccinationobject",
29
+ "type": {
30
+ "type": "NameExpression",
31
+ "name": "Object"
32
+ },
33
+ "name": "data"
34
+ },
35
+ {
36
+ "title": "state",
37
+ "description": "{DivocHttpState}"
38
+ },
39
+ {
40
+ "title": "returns",
41
+ "description": null,
42
+ "type": {
43
+ "type": "NameExpression",
44
+ "name": "Operation"
45
+ }
46
+ }
47
+ ]
48
+ },
49
+ "valid": true
50
+ }
51
+ ],
52
+ "exports": [],
53
+ "common": [
54
+ {
55
+ "name": "fn",
56
+ "params": [
57
+ "func"
58
+ ],
59
+ "docs": {
60
+ "description": "Creates a custom step (or operation) for more flexible job writing.",
61
+ "tags": [
62
+ {
63
+ "title": "public",
64
+ "description": null,
65
+ "type": null
66
+ },
67
+ {
68
+ "title": "function",
69
+ "description": null,
70
+ "name": null
71
+ },
72
+ {
73
+ "title": "example",
74
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
75
+ },
76
+ {
77
+ "title": "param",
78
+ "description": "is the function",
79
+ "type": {
80
+ "type": "NameExpression",
81
+ "name": "Function"
82
+ },
83
+ "name": "func"
84
+ },
85
+ {
86
+ "title": "returns",
87
+ "description": null,
88
+ "type": {
89
+ "type": "NameExpression",
90
+ "name": "Operation"
91
+ }
92
+ }
93
+ ]
94
+ },
95
+ "valid": true
96
+ },
97
+ {
98
+ "name": "sourceValue",
99
+ "params": [
100
+ "path"
101
+ ],
102
+ "docs": {
103
+ "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.",
104
+ "tags": [
105
+ {
106
+ "title": "public",
107
+ "description": null,
108
+ "type": null
109
+ },
110
+ {
111
+ "title": "function",
112
+ "description": null,
113
+ "name": null
114
+ },
115
+ {
116
+ "title": "example",
117
+ "description": "sourceValue('$.key')"
118
+ },
119
+ {
120
+ "title": "param",
121
+ "description": "JSONPath referencing a point in `state`.",
122
+ "type": {
123
+ "type": "NameExpression",
124
+ "name": "String"
125
+ },
126
+ "name": "path"
127
+ },
128
+ {
129
+ "title": "returns",
130
+ "description": null,
131
+ "type": {
132
+ "type": "NameExpression",
133
+ "name": "Operation"
134
+ }
135
+ }
136
+ ]
137
+ },
138
+ "valid": true
139
+ },
140
+ {
141
+ "name": "dataPath",
142
+ "params": [
143
+ "path"
144
+ ],
145
+ "docs": {
146
+ "description": "Ensures a path points at the data.",
147
+ "tags": [
148
+ {
149
+ "title": "public",
150
+ "description": null,
151
+ "type": null
152
+ },
153
+ {
154
+ "title": "function",
155
+ "description": null,
156
+ "name": null
157
+ },
158
+ {
159
+ "title": "example",
160
+ "description": "dataPath('key')"
161
+ },
162
+ {
163
+ "title": "param",
164
+ "description": "JSONPath referencing a point in `data`.",
165
+ "type": {
166
+ "type": "NameExpression",
167
+ "name": "string"
168
+ },
169
+ "name": "path"
170
+ },
171
+ {
172
+ "title": "returns",
173
+ "description": null,
174
+ "type": {
175
+ "type": "NameExpression",
176
+ "name": "string"
177
+ }
178
+ }
179
+ ]
180
+ },
181
+ "valid": true
182
+ },
183
+ {
184
+ "name": "dataValue",
185
+ "params": [
186
+ "path"
187
+ ],
188
+ "docs": {
189
+ "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.",
190
+ "tags": [
191
+ {
192
+ "title": "public",
193
+ "description": null,
194
+ "type": null
195
+ },
196
+ {
197
+ "title": "function",
198
+ "description": null,
199
+ "name": null
200
+ },
201
+ {
202
+ "title": "example",
203
+ "description": "dataValue('key')"
204
+ },
205
+ {
206
+ "title": "param",
207
+ "description": "JSONPath referencing a point in `data`.",
208
+ "type": {
209
+ "type": "NameExpression",
210
+ "name": "String"
211
+ },
212
+ "name": "path"
213
+ },
214
+ {
215
+ "title": "returns",
216
+ "description": null,
217
+ "type": {
218
+ "type": "NameExpression",
219
+ "name": "Operation"
220
+ }
221
+ }
222
+ ]
223
+ },
224
+ "valid": true
225
+ },
226
+ {
227
+ "name": "lastReferenceValue",
228
+ "params": [
229
+ "path"
230
+ ],
231
+ "docs": {
232
+ "description": "Picks out the last reference value from source data.",
233
+ "tags": [
234
+ {
235
+ "title": "public",
236
+ "description": null,
237
+ "type": null
238
+ },
239
+ {
240
+ "title": "function",
241
+ "description": null,
242
+ "name": null
243
+ },
244
+ {
245
+ "title": "example",
246
+ "description": "lastReferenceValue('key')"
247
+ },
248
+ {
249
+ "title": "param",
250
+ "description": "JSONPath referencing a point in `references`.",
251
+ "type": {
252
+ "type": "NameExpression",
253
+ "name": "String"
254
+ },
255
+ "name": "path"
256
+ },
257
+ {
258
+ "title": "returns",
259
+ "description": null,
260
+ "type": {
261
+ "type": "NameExpression",
262
+ "name": "Operation"
263
+ }
264
+ }
265
+ ]
266
+ },
267
+ "valid": true
268
+ },
269
+ {
270
+ "name": "each",
271
+ "params": [
272
+ "dataSource",
273
+ "operation"
274
+ ],
275
+ "docs": {
276
+ "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.",
277
+ "tags": [
278
+ {
279
+ "title": "public",
280
+ "description": null,
281
+ "type": null
282
+ },
283
+ {
284
+ "title": "function",
285
+ "description": null,
286
+ "name": null
287
+ },
288
+ {
289
+ "title": "example",
290
+ "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);",
291
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
292
+ },
293
+ {
294
+ "title": "example",
295
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
296
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
297
+ },
298
+ {
299
+ "title": "example",
300
+ "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);",
301
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
302
+ },
303
+ {
304
+ "title": "param",
305
+ "description": "JSONPath referencing a point in `state`.",
306
+ "type": {
307
+ "type": "NameExpression",
308
+ "name": "DataSource"
309
+ },
310
+ "name": "dataSource"
311
+ },
312
+ {
313
+ "title": "param",
314
+ "description": "The operation needed to be repeated.",
315
+ "type": {
316
+ "type": "NameExpression",
317
+ "name": "Operation"
318
+ },
319
+ "name": "operation"
320
+ },
321
+ {
322
+ "title": "returns",
323
+ "description": null,
324
+ "type": {
325
+ "type": "NameExpression",
326
+ "name": "Operation"
327
+ }
328
+ }
329
+ ]
330
+ },
331
+ "valid": true
332
+ },
333
+ {
334
+ "name": "field",
335
+ "params": [
336
+ "key",
337
+ "value"
338
+ ],
339
+ "docs": {
340
+ "description": "Returns a key, value pair in an array.",
341
+ "tags": [
342
+ {
343
+ "title": "public",
344
+ "description": null,
345
+ "type": null
346
+ },
347
+ {
348
+ "title": "function",
349
+ "description": null,
350
+ "name": null
351
+ },
352
+ {
353
+ "title": "example",
354
+ "description": "field('destination_field_name__c', 'value')"
355
+ },
356
+ {
357
+ "title": "param",
358
+ "description": "Name of the field",
359
+ "type": {
360
+ "type": "NameExpression",
361
+ "name": "string"
362
+ },
363
+ "name": "key"
364
+ },
365
+ {
366
+ "title": "param",
367
+ "description": "The value itself or a sourceable operation.",
368
+ "type": {
369
+ "type": "NameExpression",
370
+ "name": "Value"
371
+ },
372
+ "name": "value"
373
+ },
374
+ {
375
+ "title": "returns",
376
+ "description": null,
377
+ "type": {
378
+ "type": "NameExpression",
379
+ "name": "Field"
380
+ }
381
+ }
382
+ ]
383
+ },
384
+ "valid": true
385
+ },
386
+ {
387
+ "name": "fields",
388
+ "params": [
389
+ "fields"
390
+ ],
391
+ "docs": {
392
+ "description": "Zips key value pairs into an object.",
393
+ "tags": [
394
+ {
395
+ "title": "public",
396
+ "description": null,
397
+ "type": null
398
+ },
399
+ {
400
+ "title": "function",
401
+ "description": null,
402
+ "name": null
403
+ },
404
+ {
405
+ "title": "example",
406
+ "description": "fields(list_of_fields)"
407
+ },
408
+ {
409
+ "title": "param",
410
+ "description": "a list of fields",
411
+ "type": {
412
+ "type": "NameExpression",
413
+ "name": "Fields"
414
+ },
415
+ "name": "fields"
416
+ },
417
+ {
418
+ "title": "returns",
419
+ "description": null,
420
+ "type": {
421
+ "type": "NameExpression",
422
+ "name": "Object"
423
+ }
424
+ }
425
+ ]
426
+ },
427
+ "valid": true
428
+ },
429
+ {
430
+ "name": "merge",
431
+ "params": [
432
+ "dataSource",
433
+ "fields"
434
+ ],
435
+ "docs": {
436
+ "description": "Merges fields into each item in an array.",
437
+ "tags": [
438
+ {
439
+ "title": "public",
440
+ "description": null,
441
+ "type": null
442
+ },
443
+ {
444
+ "title": "example",
445
+ "description": "merge(\n \"$.books[*]\",\n fields(\n field( \"publisher\", sourceValue(\"$.publisher\") )\n )\n)"
446
+ },
447
+ {
448
+ "title": "function",
449
+ "description": null,
450
+ "name": null
451
+ },
452
+ {
453
+ "title": "public",
454
+ "description": null,
455
+ "type": null
456
+ },
457
+ {
458
+ "title": "param",
459
+ "description": null,
460
+ "type": {
461
+ "type": "NameExpression",
462
+ "name": "DataSource"
463
+ },
464
+ "name": "dataSource"
465
+ },
466
+ {
467
+ "title": "param",
468
+ "description": "Group of fields to merge in.",
469
+ "type": {
470
+ "type": "NameExpression",
471
+ "name": "Object"
472
+ },
473
+ "name": "fields"
474
+ },
475
+ {
476
+ "title": "returns",
477
+ "description": null,
478
+ "type": {
479
+ "type": "NameExpression",
480
+ "name": "DataSource"
481
+ }
482
+ }
483
+ ]
484
+ },
485
+ "valid": true
486
+ },
487
+ {
488
+ "name": "cursor",
489
+ "params": [
490
+ "value",
491
+ "options"
492
+ ],
493
+ "docs": {
494
+ "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}",
495
+ "tags": [
496
+ {
497
+ "title": "public",
498
+ "description": null,
499
+ "type": null
500
+ },
501
+ {
502
+ "title": "function",
503
+ "description": null,
504
+ "name": null
505
+ },
506
+ {
507
+ "title": "example",
508
+ "description": "cursor($.cursor, { defaultValue: 'today' })",
509
+ "caption": "Use a cursor from state if present, or else use the default value"
510
+ },
511
+ {
512
+ "title": "example",
513
+ "description": "cursor(22)",
514
+ "caption": "Use a pagination cursor"
515
+ },
516
+ {
517
+ "title": "param",
518
+ "description": "the cursor value. Usually an ISO date, natural language date, or page number",
519
+ "type": {
520
+ "type": "NameExpression",
521
+ "name": "any"
522
+ },
523
+ "name": "value"
524
+ },
525
+ {
526
+ "title": "param",
527
+ "description": "options to control the cursor.",
528
+ "type": {
529
+ "type": "NameExpression",
530
+ "name": "object"
531
+ },
532
+ "name": "options"
533
+ },
534
+ {
535
+ "title": "param",
536
+ "description": "set the cursor key. Will persist through the whole run.",
537
+ "type": {
538
+ "type": "NameExpression",
539
+ "name": "string"
540
+ },
541
+ "name": "options.key"
542
+ },
543
+ {
544
+ "title": "param",
545
+ "description": "the value to use if value is falsy",
546
+ "type": {
547
+ "type": "NameExpression",
548
+ "name": "any"
549
+ },
550
+ "name": "options.defaultValue"
551
+ },
552
+ {
553
+ "title": "param",
554
+ "description": "custom formatter for the final cursor value",
555
+ "type": {
556
+ "type": "NameExpression",
557
+ "name": "Function"
558
+ },
559
+ "name": "options.format"
560
+ },
561
+ {
562
+ "title": "returns",
563
+ "description": null,
564
+ "type": {
565
+ "type": "NameExpression",
566
+ "name": "Operation"
567
+ }
568
+ }
569
+ ]
570
+ },
571
+ "valid": false
572
+ }
573
+ ]
574
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "properties": {
4
+ "baseUrl": {
5
+ "title": "Base URL",
6
+ "type": "string",
7
+ "description": "The DIVOC server baseUrl",
8
+ "format": "uri",
9
+ "minLength": 1,
10
+ "examples": ["https://demo-divoc.egov.org.in"]
11
+ },
12
+ "access_token": {
13
+ "title": "Access token",
14
+ "type": "string",
15
+ "description": "Your DIVOC access token",
16
+ "examples": ["eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjlGWERwYmZNRlQyU3ZRdVhoODQ2WVR3RUlCdyIsI"]
17
+ }
18
+ },
19
+ "type": "object",
20
+ "additionalProperties": true,
21
+ "required": ["password", "username"]
22
+ }