@openfn/language-dhis2 6.3.4 → 7.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 CHANGED
@@ -3,10 +3,9 @@
3
3
  {
4
4
  "name": "create",
5
5
  "params": [
6
- "resourceType",
6
+ "path",
7
7
  "data",
8
- "options",
9
- "callback"
8
+ "params"
10
9
  ],
11
10
  "docs": {
12
11
  "description": "Create a record",
@@ -23,49 +22,38 @@
23
22
  },
24
23
  {
25
24
  "title": "param",
26
- "description": "Type of resource to create. E.g. `trackedEntities`, `programs`, `events`, ...",
25
+ "description": "Path to the resource to be created",
27
26
  "type": {
28
27
  "type": "NameExpression",
29
28
  "name": "string"
30
29
  },
31
- "name": "resourceType"
30
+ "name": "path"
32
31
  },
33
32
  {
34
33
  "title": "magic",
35
- "description": "resourceType $.children.resourceTypes[*]"
34
+ "description": "path $.children.resourceTypes[*]"
36
35
  },
37
36
  {
38
37
  "title": "param",
39
- "description": "Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects.",
38
+ "description": "An object, or array of objects, to create.",
40
39
  "type": {
41
40
  "type": "NameExpression",
42
- "name": "Dhis2Data"
41
+ "name": "DHIS2Data"
43
42
  },
44
43
  "name": "data"
45
44
  },
46
45
  {
47
46
  "title": "param",
48
- "description": "Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion.",
47
+ "description": "Optional object of query parameters to include in the request",
49
48
  "type": {
50
- "type": "OptionalType",
51
- "expression": {
52
- "type": "NameExpression",
53
- "name": "Object"
54
- }
49
+ "type": "NameExpression",
50
+ "name": "object"
55
51
  },
56
- "name": "options"
52
+ "name": "params"
57
53
  },
58
54
  {
59
- "title": "param",
60
- "description": "Optional callback to handle the response",
61
- "type": {
62
- "type": "OptionalType",
63
- "expression": {
64
- "type": "NameExpression",
65
- "name": "function"
66
- }
67
- },
68
- "name": "callback"
55
+ "title": "state",
56
+ "description": "data - The created resource as returned by DHIS2"
69
57
  },
70
58
  {
71
59
  "title": "returns",
@@ -129,11 +117,74 @@
129
117
  "title": "example",
130
118
  "description": "create('enrollments', {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'gZBxv9Ujxg0',\n enrollmentDate: '2013-09-17',\n incidentDate: '2013-09-17',\n});",
131
119
  "caption": "Create an enrollment"
120
+ }
121
+ ]
122
+ },
123
+ "valid": true
124
+ },
125
+ {
126
+ "name": "get",
127
+ "params": [
128
+ "path",
129
+ "params"
130
+ ],
131
+ "docs": {
132
+ "description": "Get any resource, as JSON, from DHIS2. Pass in any valid DHIS2 REST path, excluding /api and the version.\nFor the new tracker API, see `tracker.export()`",
133
+ "tags": [
134
+ {
135
+ "title": "public",
136
+ "description": null,
137
+ "type": null
138
+ },
139
+ {
140
+ "title": "function",
141
+ "description": null,
142
+ "name": null
143
+ },
144
+ {
145
+ "title": "param",
146
+ "description": "Path to the resource",
147
+ "type": {
148
+ "type": "NameExpression",
149
+ "name": "string"
150
+ },
151
+ "name": "path"
152
+ },
153
+ {
154
+ "title": "param",
155
+ "description": "Object of query parameters to include in the request",
156
+ "type": {
157
+ "type": "NameExpression",
158
+ "name": "object"
159
+ },
160
+ "name": "params"
161
+ },
162
+ {
163
+ "title": "state",
164
+ "description": "data - the resource returned by DHIS2"
165
+ },
166
+ {
167
+ "title": "returns",
168
+ "description": null,
169
+ "type": {
170
+ "type": "NameExpression",
171
+ "name": "Operation"
172
+ }
173
+ },
174
+ {
175
+ "title": "example",
176
+ "description": "get('dataValueSets', {\n dataSet: 'pBOMPrpg1QX',\n orgUnit: 'DiszpKrYNg8',\n period: '201401',\n fields: '*',\n});",
177
+ "caption": "Get all data values for the 'pBOMPrpg1QX' dataset"
132
178
  },
133
179
  {
134
180
  "title": "example",
135
- "description": "create(\"tracker\", {\n enrollments: [\n {\n trackedEntity: \"bmshzEacgxa\",\n orgUnit: \"TSyzvBiovKh\",\n program: \"gZBxv9Ujxg0\",\n enrollmentDate: \"2013-09-17\",\n incidentDate: \"2013-09-17\",\n },\n ],\n trackedEntities: [\n {\n orgUnit: \"TSyzvBiovKh\",\n trackedEntityType: \"nEenWmSyUEp\",\n attributes: [\n {\n attribute: \"w75KJ2mc4zz\",\n value: \"Gigiwe\",\n },\n ],\n },\n ],\n});",
136
- "caption": "Create an multiple objects with the Tracker API"
181
+ "description": "get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });",
182
+ "caption": "Get all programs for an organization unit"
183
+ },
184
+ {
185
+ "title": "example",
186
+ "description": "get('tracker/trackedEntities/F8yKM85NbxW');",
187
+ "caption": "Get a single tracked entity given the provided ID. See [TrackedEntities docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#tracked-entities-get-apitrackertrackedentities)"
137
188
  }
138
189
  ]
139
190
  },
@@ -145,11 +196,10 @@
145
196
  "resourceType",
146
197
  "path",
147
198
  "data",
148
- "options",
149
- "callback"
199
+ "options"
150
200
  ],
151
201
  "docs": {
152
- "description": "Update data. A generic helper function to update a resource object of any type.\nUpdating an object requires to send `all required fields` or the `full body`",
202
+ "description": "Update a resource object of any type. Updating an object requires all fields of the object you are updating, even if they have not been modified",
153
203
  "tags": [
154
204
  {
155
205
  "title": "public",
@@ -181,7 +231,7 @@
181
231
  },
182
232
  {
183
233
  "title": "param",
184
- "description": "Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation.",
234
+ "description": "Data to update. It requires to send the full body. If you want partial updates, use patch operation.",
185
235
  "type": {
186
236
  "type": "NameExpression",
187
237
  "name": "Object"
@@ -190,27 +240,19 @@
190
240
  },
191
241
  {
192
242
  "title": "param",
193
- "description": "Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion.",
243
+ "description": "An optional object containing query, parseAs,and headers for the request.",
194
244
  "type": {
195
245
  "type": "OptionalType",
196
246
  "expression": {
197
247
  "type": "NameExpression",
198
- "name": "Object"
248
+ "name": "RequestOptions"
199
249
  }
200
250
  },
201
251
  "name": "options"
202
252
  },
203
253
  {
204
- "title": "param",
205
- "description": "Optional callback to handle the response",
206
- "type": {
207
- "type": "OptionalType",
208
- "expression": {
209
- "type": "NameExpression",
210
- "name": "function"
211
- }
212
- },
213
- "name": "callback"
254
+ "title": "state",
255
+ "description": "data - the resource returned by DHIS2"
214
256
  },
215
257
  {
216
258
  "title": "returns",
@@ -280,15 +322,15 @@
280
322
  "valid": true
281
323
  },
282
324
  {
283
- "name": "get",
325
+ "name": "upsert",
284
326
  "params": [
285
327
  "resourceType",
286
328
  "query",
287
- "options",
288
- "callback"
329
+ "data",
330
+ "options"
289
331
  ],
290
332
  "docs": {
291
- "description": "Get data. Generic helper method for getting data of any kind from DHIS2.\n- This can be used to get `DataValueSets`,`events`,`trackers`,`etc.`",
333
+ "description": "Upsert a record. This will atomically update a record if it already exists, or otherwise create it.\nThis function does not work with the absolute tracker path `api/tracker` but rather the new tracker paths and deprecated tracker endpoints.",
292
334
  "tags": [
293
335
  {
294
336
  "title": "public",
@@ -302,7 +344,7 @@
302
344
  },
303
345
  {
304
346
  "title": "param",
305
- "description": "The type of resource to get(use its `plural` name). E.g. `dataElements`, `tracker/trackedEntities`,`organisationUnits`, etc.",
347
+ "description": "The type of a resource to `upsert`. E.g. `trackedEntities`.",
306
348
  "type": {
307
349
  "type": "NameExpression",
308
350
  "name": "string"
@@ -311,7 +353,7 @@
311
353
  },
312
354
  {
313
355
  "title": "param",
314
- "description": "A query object that will limit what resources are retrieved when converted into request params.",
356
+ "description": "A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created.",
315
357
  "type": {
316
358
  "type": "NameExpression",
317
359
  "name": "Object"
@@ -320,68 +362,40 @@
320
362
  },
321
363
  {
322
364
  "title": "param",
323
- "description": "Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use.",
324
- "type": {
325
- "type": "OptionalType",
326
- "expression": {
327
- "type": "NameExpression",
328
- "name": "Object"
329
- }
330
- },
331
- "name": "options"
332
- },
333
- {
334
- "title": "param",
335
- "description": "The parameters for the request.",
365
+ "description": "The data to use for update or create depending on the result of the query.",
336
366
  "type": {
337
- "type": "OptionalType",
338
- "expression": {
339
- "type": "NameExpression",
340
- "name": "Object"
341
- }
367
+ "type": "NameExpression",
368
+ "name": "Object"
342
369
  },
343
- "name": "options.params"
370
+ "name": "data"
344
371
  },
345
372
  {
346
373
  "title": "param",
347
- "description": "The configuration for the request, including headers, etc.",
374
+ "description": "An optional object containing query, parseAs,and headers for the request",
348
375
  "type": {
349
376
  "type": "OptionalType",
350
377
  "expression": {
351
378
  "type": "NameExpression",
352
- "name": "Object"
379
+ "name": "RequestOptions"
353
380
  }
354
381
  },
355
- "name": "options.requestConfig"
382
+ "name": "options"
356
383
  },
357
384
  {
358
- "title": "param",
359
- "description": "Optional flag to indicate if the response should be returned as a Base64 encoded string.",
385
+ "title": "throws",
386
+ "description": "Throws range error",
360
387
  "type": {
361
- "type": "OptionalType",
362
- "expression": {
363
- "type": "NameExpression",
364
- "name": "boolean"
365
- }
366
- },
367
- "name": "options.asBase64",
368
- "default": "false"
388
+ "type": "NameExpression",
389
+ "name": "RangeError"
390
+ }
369
391
  },
370
392
  {
371
- "title": "param",
372
- "description": "Optional callback to handle the response",
373
- "type": {
374
- "type": "OptionalType",
375
- "expression": {
376
- "type": "NameExpression",
377
- "name": "function"
378
- }
379
- },
380
- "name": "callback"
393
+ "title": "state",
394
+ "description": "{DHIS2State}"
381
395
  },
382
396
  {
383
397
  "title": "returns",
384
- "description": "state",
398
+ "description": null,
385
399
  "type": {
386
400
  "type": "NameExpression",
387
401
  "name": "Operation"
@@ -389,49 +403,28 @@
389
403
  },
390
404
  {
391
405
  "title": "example",
392
- "description": "get('dataValueSets', {\n dataSet: 'pBOMPrpg1QX',\n orgUnit: 'DiszpKrYNg8',\n period: '201401',\n fields: '*',\n});",
393
- "caption": "Get all data values for the 'pBOMPrpg1QX' dataset"
394
- },
395
- {
396
- "title": "example",
397
- "description": "get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });",
398
- "caption": "Get all programs for an organization unit"
399
- },
400
- {
401
- "title": "example",
402
- "description": "get('tracker/trackedEntities/F8yKM85NbxW');",
403
- "caption": "Get a single tracked entity given the provided ID. See [TrackedEntities docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#tracked-entities-get-apitrackertrackedentities)"
404
- },
405
- {
406
- "title": "example",
407
- "description": "get('tracker/enrollments/abcd');",
408
- "caption": "Get an enrollment given the provided ID. See [Enrollment docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#enrollments-get-apitrackerenrollments)"
409
- },
410
- {
411
- "title": "example",
412
- "description": "get('tracker/events');",
413
- "caption": "Get all events matching given criteria. See [Events docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#events-get-apitrackerevents)"
406
+ "description": "upsert('trackedEntities', {}, {\n orgUnit: 'TSyzvBiovKh',\n trackedEntityType: 'nEenWmSyUEp',\n attributes: [\n {\n attribute: 'w75KJ2mc4zz',\n value: 'Qassim',\n },\n ],\n});",
407
+ "caption": "Upsert a trackedEntity"
414
408
  },
415
409
  {
416
410
  "title": "example",
417
- "description": "get('tracker/relationships', {\n trackedEntity:['F8yKM85NbxW'],\n});",
418
- "caption": "Get the relationship between two tracker entities. The only required parameters are 'trackedEntity', 'enrollment' or 'event'. See [Relationships docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#relationships-get-apitrackerrelationships)"
411
+ "description": "upsert(\n 'dataElements',\n { filter: 'id:eq:P3jJH5Tu5VC' },\n {\n op: 'add',\n path: '/domainType',\n name: 'Acute',\n shortName: 'AFP follow-up',\n dimensionItemType: 'DATA_ELEMENT',\n legendSets: [],\n aggregationType: 'SUM',\n valueType: 'NUMBER',\n domainType: 'AGGREGATE',\n code: 'DE_359049',\n name: 'Acute Flaccid Paralysis (AFP) follow-up',\n }\n );",
412
+ "caption": "Upsert a dataElement"
419
413
  }
420
414
  ]
421
415
  },
422
- "valid": false
416
+ "valid": true
423
417
  },
424
418
  {
425
- "name": "post",
419
+ "name": "destroy",
426
420
  "params": [
427
421
  "resourceType",
422
+ "path",
428
423
  "data",
429
- "query",
430
- "options",
431
- "callback"
424
+ "options"
432
425
  ],
433
426
  "docs": {
434
- "description": "Post data. Generic helper method for posting data of any kind to DHIS2.\nThis can be used to create `DataValueSets`,`events`,`trackers`,etc.",
427
+ "description": "Delete record.",
435
428
  "tags": [
436
429
  {
437
430
  "title": "public",
@@ -445,29 +438,25 @@
445
438
  },
446
439
  {
447
440
  "title": "param",
448
- "description": "Type of resource to create. E.g. `trackedEntities`, `programs`, `events`, ...",
441
+ "description": "The type of resource to be deleted. E.g. `trackedEntities`, `organisationUnits`, etc.",
449
442
  "type": {
450
443
  "type": "NameExpression",
451
444
  "name": "string"
452
445
  },
453
446
  "name": "resourceType"
454
447
  },
455
- {
456
- "title": "magic",
457
- "description": "resourceType $.children.resourceTypes[*]"
458
- },
459
448
  {
460
449
  "title": "param",
461
- "description": "Object which defines data that will be used to create a given instance of resource. To create a single instance of a resource, `data` must be a javascript object, and to create multiple instances of a resources, `data` must be an array of javascript objects.",
450
+ "description": "Can be an `id` of an `object` or `path` to the `nested object` to `delete`.",
462
451
  "type": {
463
452
  "type": "NameExpression",
464
- "name": "Dhis2Data"
453
+ "name": "string"
465
454
  },
466
- "name": "data"
455
+ "name": "path"
467
456
  },
468
457
  {
469
458
  "title": "param",
470
- "description": "Optional `options` to define URL parameters via params (E.g. `filter`, `dimension` and other import parameters), request config (E.g. `auth`) and the DHIS2 apiVersion.",
459
+ "description": "Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{\"identifiableObjects\": [{\"id\": \"IDA\"}, {\"id\": \"IDB\"}, {\"id\": \"IDC\"}]}`. See more {@link https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects on DHIS2 API docs}",
471
460
  "type": {
472
461
  "type": "OptionalType",
473
462
  "expression": {
@@ -475,408 +464,27 @@
475
464
  "name": "Object"
476
465
  }
477
466
  },
478
- "name": "options"
467
+ "name": "data"
479
468
  },
480
469
  {
481
470
  "title": "param",
482
- "description": "Optional callback to handle the response",
471
+ "description": "An optional object containing query, parseAs,and headers for the request.",
483
472
  "type": {
484
473
  "type": "OptionalType",
485
474
  "expression": {
486
475
  "type": "NameExpression",
487
- "name": "function"
476
+ "name": "RequestOptions"
488
477
  }
489
478
  },
490
- "name": "callback"
479
+ "name": "options"
480
+ },
481
+ {
482
+ "title": "state",
483
+ "description": "{DHIS2State}"
491
484
  },
492
485
  {
493
486
  "title": "returns",
494
- "description": "state",
495
- "type": {
496
- "type": "NameExpression",
497
- "name": "Operation"
498
- }
499
- },
500
- {
501
- "title": "example",
502
- "description": "post(\"tracker\", {\n events: [\n {\n program: \"eBAyeGv0exc\",\n orgUnit: \"DiszpKrYNg8\",\n status: \"COMPLETED\",\n },\n ],\n});",
503
- "caption": "Create an event"
504
- }
505
- ]
506
- },
507
- "valid": false
508
- },
509
- {
510
- "name": "upsert",
511
- "params": [
512
- "resourceType",
513
- "query",
514
- "data",
515
- "options",
516
- "callback"
517
- ],
518
- "docs": {
519
- "description": "Upsert a record. A generic helper function used to atomically either insert a row, or on the basis of the row already existing, UPDATE that existing row instead.",
520
- "tags": [
521
- {
522
- "title": "public",
523
- "description": null,
524
- "type": null
525
- },
526
- {
527
- "title": "function",
528
- "description": null,
529
- "name": null
530
- },
531
- {
532
- "title": "param",
533
- "description": "The type of a resource to `upsert`. E.g. `trackedEntities`",
534
- "type": {
535
- "type": "NameExpression",
536
- "name": "string"
537
- },
538
- "name": "resourceType"
539
- },
540
- {
541
- "title": "param",
542
- "description": "A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created.",
543
- "type": {
544
- "type": "NameExpression",
545
- "name": "Object"
546
- },
547
- "name": "query"
548
- },
549
- {
550
- "title": "param",
551
- "description": "The data to use for update or create depending on the result of the query.",
552
- "type": {
553
- "type": "NameExpression",
554
- "name": "Object"
555
- },
556
- "name": "data"
557
- },
558
- {
559
- "title": "param",
560
- "description": "Optional configuration that will be applied to both the `get` and the `create` or `update` operations.",
561
- "type": {
562
- "type": "OptionalType",
563
- "expression": {
564
- "type": "RecordType",
565
- "fields": [
566
- {
567
- "type": "FieldType",
568
- "key": "apiVersion",
569
- "value": {
570
- "type": "NameExpression",
571
- "name": "object"
572
- }
573
- },
574
- {
575
- "type": "FieldType",
576
- "key": "requestConfig",
577
- "value": {
578
- "type": "NameExpression",
579
- "name": "object"
580
- }
581
- },
582
- {
583
- "type": "FieldType",
584
- "key": "params",
585
- "value": {
586
- "type": "NameExpression",
587
- "name": "object"
588
- }
589
- }
590
- ]
591
- }
592
- },
593
- "name": "options"
594
- },
595
- {
596
- "title": "param",
597
- "description": "Optional callback to handle the response",
598
- "type": {
599
- "type": "OptionalType",
600
- "expression": {
601
- "type": "NameExpression",
602
- "name": "function"
603
- }
604
- },
605
- "name": "callback"
606
- },
607
- {
608
- "title": "throws",
609
- "description": "Throws range error",
610
- "type": {
611
- "type": "NameExpression",
612
- "name": "RangeError"
613
- }
614
- },
615
- {
616
- "title": "returns",
617
- "description": null,
618
- "type": {
619
- "type": "NameExpression",
620
- "name": "Operation"
621
- }
622
- },
623
- {
624
- "title": "example",
625
- "description": "upsert('trackedEntities', {\n orgUnit: 'TSyzvBiovKh',\n filter: ['w75KJ2mc4zz:Eq:Qassim'],\n}, {\n orgUnit: 'TSyzvBiovKh',\n trackedEntityType: 'nEenWmSyUEp',\n attributes: [\n {\n attribute: 'w75KJ2mc4zz',\n value: 'Qassim',\n },\n ],\n});",
626
- "caption": "Upsert a trackedEntity"
627
- }
628
- ]
629
- },
630
- "valid": true
631
- },
632
- {
633
- "name": "discover",
634
- "params": [
635
- "httpMethod",
636
- "endpoint"
637
- ],
638
- "docs": {
639
- "description": "Discover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint.",
640
- "tags": [
641
- {
642
- "title": "public",
643
- "description": null,
644
- "type": null
645
- },
646
- {
647
- "title": "function",
648
- "description": null,
649
- "name": null
650
- },
651
- {
652
- "title": "param",
653
- "description": "The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete`",
654
- "type": {
655
- "type": "NameExpression",
656
- "name": "string"
657
- },
658
- "name": "httpMethod"
659
- },
660
- {
661
- "title": "param",
662
- "description": "The path for a given endpoint. E.g. `/trackedEntities` or `/dataValueSets`",
663
- "type": {
664
- "type": "NameExpression",
665
- "name": "string"
666
- },
667
- "name": "endpoint"
668
- },
669
- {
670
- "title": "returns",
671
- "description": null,
672
- "type": {
673
- "type": "NameExpression",
674
- "name": "Operation"
675
- }
676
- },
677
- {
678
- "title": "example",
679
- "description": "discover('post', '/trackedEntities')",
680
- "caption": "a list of parameters allowed on a given endpoint for specific http method"
681
- }
682
- ]
683
- },
684
- "valid": true
685
- },
686
- {
687
- "name": "patch",
688
- "params": [
689
- "resourceType",
690
- "path",
691
- "data",
692
- "options",
693
- "callback"
694
- ],
695
- "docs": {
696
- "description": "Patch a record. A generic helper function to send partial updates on one or more object properties.\n- You are not required to send the full body of object properties.\n- This is useful for cases where you don't want or need to update all properties on a object.",
697
- "tags": [
698
- {
699
- "title": "public",
700
- "description": null,
701
- "type": null
702
- },
703
- {
704
- "title": "function",
705
- "description": null,
706
- "name": null
707
- },
708
- {
709
- "title": "param",
710
- "description": "The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.",
711
- "type": {
712
- "type": "NameExpression",
713
- "name": "string"
714
- },
715
- "name": "resourceType"
716
- },
717
- {
718
- "title": "param",
719
- "description": "The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`",
720
- "type": {
721
- "type": "NameExpression",
722
- "name": "string"
723
- },
724
- "name": "path"
725
- },
726
- {
727
- "title": "param",
728
- "description": "Data to update. Include only the fields you want to update. E.g. `{name: \"New Name\"}`",
729
- "type": {
730
- "type": "NameExpression",
731
- "name": "Object"
732
- },
733
- "name": "data"
734
- },
735
- {
736
- "title": "param",
737
- "description": "Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}`",
738
- "type": {
739
- "type": "OptionalType",
740
- "expression": {
741
- "type": "NameExpression",
742
- "name": "Object"
743
- }
744
- },
745
- "name": "options"
746
- },
747
- {
748
- "title": "param",
749
- "description": "Optional callback to handle the response",
750
- "type": {
751
- "type": "OptionalType",
752
- "expression": {
753
- "type": "NameExpression",
754
- "name": "function"
755
- }
756
- },
757
- "name": "callback"
758
- },
759
- {
760
- "title": "returns",
761
- "description": null,
762
- "type": {
763
- "type": "NameExpression",
764
- "name": "Operation"
765
- }
766
- },
767
- {
768
- "title": "example",
769
- "description": "patch('dataElements', 'FTRrcoaog83', { name: 'New Name' });",
770
- "caption": "a dataElement"
771
- }
772
- ]
773
- },
774
- "valid": true
775
- },
776
- {
777
- "name": "destroy",
778
- "params": [
779
- "resourceType",
780
- "path",
781
- "data",
782
- "options",
783
- "callback"
784
- ],
785
- "docs": {
786
- "description": "Delete a record. A generic helper function to delete an object",
787
- "tags": [
788
- {
789
- "title": "public",
790
- "description": null,
791
- "type": null
792
- },
793
- {
794
- "title": "function",
795
- "description": null,
796
- "name": null
797
- },
798
- {
799
- "title": "param",
800
- "description": "The type of resource to be deleted. E.g. `trackedEntities`, `organisationUnits`, etc.",
801
- "type": {
802
- "type": "NameExpression",
803
- "name": "string"
804
- },
805
- "name": "resourceType"
806
- },
807
- {
808
- "title": "param",
809
- "description": "Can be an `id` of an `object` or `path` to the `nested object` to `delete`.",
810
- "type": {
811
- "type": "NameExpression",
812
- "name": "string"
813
- },
814
- "name": "path"
815
- },
816
- {
817
- "title": "param",
818
- "description": "Optional. This is useful when you want to remove multiple objects from a collection in one request. You can send `data` as, for example, `{\"identifiableObjects\": [{\"id\": \"IDA\"}, {\"id\": \"IDB\"}, {\"id\": \"IDC\"}]}`. See more {@link https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#deleting-objects on DHIS2 API docs}",
819
- "type": {
820
- "type": "OptionalType",
821
- "expression": {
822
- "type": "NameExpression",
823
- "name": "Object"
824
- }
825
- },
826
- "name": "data"
827
- },
828
- {
829
- "title": "param",
830
- "description": "Optional `options` for `del` operation including params e.g. `{preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}`. Run `discover` or see {@link https://docs.dhis2.org/2.34/en/dhis2_developer_manual/web-api.html#create-update-parameters DHIS2 documentation}. Defaults to `{operationName: 'delete', apiVersion: state.configuration.apiVersion, responseType: 'json'}`",
831
- "type": {
832
- "type": "OptionalType",
833
- "expression": {
834
- "type": "RecordType",
835
- "fields": [
836
- {
837
- "type": "FieldType",
838
- "key": "apiVersion",
839
- "value": {
840
- "type": "NameExpression",
841
- "name": "number"
842
- }
843
- },
844
- {
845
- "type": "FieldType",
846
- "key": "operationName",
847
- "value": {
848
- "type": "NameExpression",
849
- "name": "string"
850
- }
851
- },
852
- {
853
- "type": "FieldType",
854
- "key": "resourceType",
855
- "value": {
856
- "type": "NameExpression",
857
- "name": "string"
858
- }
859
- }
860
- ]
861
- }
862
- },
863
- "name": "options"
864
- },
865
- {
866
- "title": "param",
867
- "description": "Optional callback to handle the response",
868
- "type": {
869
- "type": "OptionalType",
870
- "expression": {
871
- "type": "NameExpression",
872
- "name": "function"
873
- }
874
- },
875
- "name": "callback"
876
- },
877
- {
878
- "title": "returns",
879
- "description": null,
487
+ "description": null,
880
488
  "type": {
881
489
  "type": "NameExpression",
882
490
  "name": "Operation"
@@ -890,218 +498,6 @@
890
498
  ]
891
499
  },
892
500
  "valid": true
893
- },
894
- {
895
- "name": "findAttributeValueById",
896
- "params": [
897
- "trackedEntity",
898
- "attributeUid"
899
- ],
900
- "docs": {
901
- "description": "Gets an attribute value by its uid",
902
- "tags": [
903
- {
904
- "title": "public",
905
- "description": null,
906
- "type": null
907
- },
908
- {
909
- "title": "example",
910
- "description": "findAttributeValueById(state.tei, 'y1w2R6leVmh')"
911
- },
912
- {
913
- "title": "function",
914
- "description": null,
915
- "name": null
916
- },
917
- {
918
- "title": "param",
919
- "description": "A tracked entity instance (TEI) object",
920
- "type": {
921
- "type": "NameExpression",
922
- "name": "Object"
923
- },
924
- "name": "trackedEntity"
925
- },
926
- {
927
- "title": "param",
928
- "description": "The uid to search for in the TEI's attributes",
929
- "type": {
930
- "type": "NameExpression",
931
- "name": "string"
932
- },
933
- "name": "attributeUid"
934
- },
935
- {
936
- "title": "returns",
937
- "description": null,
938
- "type": {
939
- "type": "NameExpression",
940
- "name": "string"
941
- }
942
- }
943
- ]
944
- },
945
- "valid": true
946
- },
947
- {
948
- "name": "findAttributeValue",
949
- "params": [
950
- "trackedEntity",
951
- "attributeDisplayName"
952
- ],
953
- "docs": {
954
- "description": "Gets an attribute value by its case-insensitive display name",
955
- "tags": [
956
- {
957
- "title": "public",
958
- "description": null,
959
- "type": null
960
- },
961
- {
962
- "title": "example",
963
- "description": "findAttributeValue(state.data.trackedEntities[0], 'first name')"
964
- },
965
- {
966
- "title": "function",
967
- "description": null,
968
- "name": null
969
- },
970
- {
971
- "title": "param",
972
- "description": "A tracked entity instance (TEI) object",
973
- "type": {
974
- "type": "NameExpression",
975
- "name": "Object"
976
- },
977
- "name": "trackedEntity"
978
- },
979
- {
980
- "title": "param",
981
- "description": "The 'displayName' to search for in the TEI's attributes",
982
- "type": {
983
- "type": "NameExpression",
984
- "name": "string"
985
- },
986
- "name": "attributeDisplayName"
987
- },
988
- {
989
- "title": "returns",
990
- "description": null,
991
- "type": {
992
- "type": "NameExpression",
993
- "name": "string"
994
- }
995
- }
996
- ]
997
- },
998
- "valid": true
999
- },
1000
- {
1001
- "name": "attr",
1002
- "params": [
1003
- "attribute",
1004
- "value"
1005
- ],
1006
- "docs": {
1007
- "description": "Converts an attribute ID and value into a DHIS2 attribute object",
1008
- "tags": [
1009
- {
1010
- "title": "public",
1011
- "description": null,
1012
- "type": null
1013
- },
1014
- {
1015
- "title": "example",
1016
- "description": "attr('w75KJ2mc4zz', 'Elias')"
1017
- },
1018
- {
1019
- "title": "function",
1020
- "description": null,
1021
- "name": null
1022
- },
1023
- {
1024
- "title": "param",
1025
- "description": "A tracked entity instance (TEI) attribute ID.",
1026
- "type": {
1027
- "type": "NameExpression",
1028
- "name": "string"
1029
- },
1030
- "name": "attribute"
1031
- },
1032
- {
1033
- "title": "param",
1034
- "description": "The value for that attribute.",
1035
- "type": {
1036
- "type": "NameExpression",
1037
- "name": "string"
1038
- },
1039
- "name": "value"
1040
- },
1041
- {
1042
- "title": "returns",
1043
- "description": null,
1044
- "type": {
1045
- "type": "NameExpression",
1046
- "name": "object"
1047
- }
1048
- }
1049
- ]
1050
- },
1051
- "valid": true
1052
- },
1053
- {
1054
- "name": "dv",
1055
- "params": [
1056
- "dataElement",
1057
- "value"
1058
- ],
1059
- "docs": {
1060
- "description": "Converts a dataElement and value into a DHIS2 dataValue object",
1061
- "tags": [
1062
- {
1063
- "title": "public",
1064
- "description": null,
1065
- "type": null
1066
- },
1067
- {
1068
- "title": "example",
1069
- "description": "dv('f7n9E0hX8qk', 12)"
1070
- },
1071
- {
1072
- "title": "function",
1073
- "description": null,
1074
- "name": null
1075
- },
1076
- {
1077
- "title": "param",
1078
- "description": "A data element ID.",
1079
- "type": {
1080
- "type": "NameExpression",
1081
- "name": "string"
1082
- },
1083
- "name": "dataElement"
1084
- },
1085
- {
1086
- "title": "param",
1087
- "description": "The value for that data element.",
1088
- "type": {
1089
- "type": "NameExpression",
1090
- "name": "string"
1091
- },
1092
- "name": "value"
1093
- },
1094
- {
1095
- "title": "returns",
1096
- "description": null,
1097
- "type": {
1098
- "type": "NameExpression",
1099
- "name": "object"
1100
- }
1101
- }
1102
- ]
1103
- },
1104
- "valid": true
1105
501
  }
1106
502
  ],
1107
503
  "exports": [],