@openfn/language-dhis2 5.0.8 → 6.0.1
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 +234 -43
- package/dist/index.cjs +172 -73
- package/dist/index.js +171 -76
- package/package.json +1 -1
- package/types/Adaptor.d.ts +102 -53
- package/types/Utils.d.ts +4 -1
package/ast.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"title": "param",
|
|
26
|
-
"description": "Type of resource to create. E.g. `
|
|
26
|
+
"description": "Type of resource to create. E.g. `trackedEntities`, `programs`, `events`, ...",
|
|
27
27
|
"type": {
|
|
28
28
|
"type": "NameExpression",
|
|
29
29
|
"name": "string"
|
|
@@ -78,22 +78,22 @@
|
|
|
78
78
|
{
|
|
79
79
|
"title": "example",
|
|
80
80
|
"description": "create('programs', {\n name: 'name 20',\n shortName: 'n20',\n programType: 'WITHOUT_REGISTRATION',\n});",
|
|
81
|
-
"caption": "a program"
|
|
81
|
+
"caption": "Create a program"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"title": "example",
|
|
85
85
|
"description": "create('events', {\n program: 'eBAyeGv0exc',\n orgUnit: 'DiszpKrYNg8',\n status: 'COMPLETED',\n});",
|
|
86
|
-
"caption": "
|
|
86
|
+
"caption": "Create a single event"
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
"title": "example",
|
|
90
|
-
"description": "create('
|
|
91
|
-
"caption": "a
|
|
90
|
+
"description": "create('trackedEntities', {\n orgUnit: 'TSyzvBiovKh',\n trackedEntityType: 'nEenWmSyUEp',\n attributes: [\n {\n attribute: 'w75KJ2mc4zz',\n value: 'Gigiwe',\n },\n ]\n});",
|
|
91
|
+
"caption": "Create a single tracker entity. See [Create tracker docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#webapi_nti_import)"
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
"title": "example",
|
|
95
95
|
"description": "create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });",
|
|
96
|
-
"caption": "a dataSet"
|
|
96
|
+
"caption": "Create a dataSet"
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"title": "example",
|
|
@@ -103,32 +103,37 @@
|
|
|
103
103
|
{
|
|
104
104
|
"title": "example",
|
|
105
105
|
"description": "create('dataElements', {\n aggregationType: 'SUM',\n domainType: 'AGGREGATE',\n valueType: 'NUMBER',\n name: 'Paracetamol',\n shortName: 'Para',\n});",
|
|
106
|
-
"caption": "a dataElement"
|
|
106
|
+
"caption": "Create a dataElement"
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
"title": "example",
|
|
110
110
|
"description": "create('dataElementGroups', {\n name: 'Data Element Group 1',\n dataElements: [],\n});",
|
|
111
|
-
"caption": "a dataElementGroup"
|
|
111
|
+
"caption": "Create a dataElementGroup"
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
"title": "example",
|
|
115
115
|
"description": "create('dataElementGroupSets', {\n name: 'Data Element Group Set 4',\n dataDimension: true,\n shortName: 'DEGS4',\n dataElementGroups: [],\n});",
|
|
116
|
-
"caption": "a dataElementGroupSet"
|
|
116
|
+
"caption": "Create a dataElementGroupSet"
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"title": "example",
|
|
120
120
|
"description": "create('dataValueSets', {\n dataElement: 'f7n9E0hX8qk',\n period: '201401',\n orgUnit: 'DiszpKrYNg8',\n value: '12',\n});",
|
|
121
|
-
"caption": "a dataValueSet"
|
|
121
|
+
"caption": "Create a dataValueSet"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"title": "example",
|
|
125
125
|
"description": "create('dataValueSets', {\n dataSet: 'pBOMPrpg1QX',\n completeDate: '2014-02-03',\n period: '201401',\n orgUnit: 'DiszpKrYNg8',\n dataValues: [\n {\n dataElement: 'f7n9E0hX8qk',\n value: '1',\n },\n {\n dataElement: 'Ix2HsbDMLea',\n value: '2',\n },\n {\n dataElement: 'eY5ehpbEsB7',\n value: '3',\n },\n ],\n});",
|
|
126
|
-
"caption": "a dataValueSet with related dataValues"
|
|
126
|
+
"caption": "Create a dataValueSet with related dataValues"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"title": "example",
|
|
130
|
+
"description": "create('enrollments', {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'gZBxv9Ujxg0',\n enrollmentDate: '2013-09-17',\n incidentDate: '2013-09-17',\n});",
|
|
131
|
+
"caption": "Create an enrollment"
|
|
127
132
|
},
|
|
128
133
|
{
|
|
129
134
|
"title": "example",
|
|
130
|
-
"description": "create(
|
|
131
|
-
"caption": "an
|
|
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"
|
|
132
137
|
}
|
|
133
138
|
]
|
|
134
139
|
},
|
|
@@ -227,48 +232,48 @@
|
|
|
227
232
|
},
|
|
228
233
|
{
|
|
229
234
|
"title": "example",
|
|
230
|
-
"description": "update('
|
|
231
|
-
"caption": "a
|
|
235
|
+
"description": "update('trackedEntities', '', {\n createdAt: '2015-08-06T21:12:37.256',\n orgUnit: 'TSyzvBiovKh',\n createdAtClient: '2015-08-06T21:12:37.256',\n trackedEntity: 'IeQfgUtGPq2',\n trackedEntityType: 'nEenWmSyUEp',\n inactive: false,\n deleted: false,\n featureType: 'NONE',\n programOwners: [\n {\n ownerOrgUnit: 'TSyzvBiovKh',\n program: 'IpHINAT79UW',\n trackedEntity: 'IeQfgUtGPq2',\n },\n ],\n attributes: [\n {\n lastUpdated: '2016-01-12T00:00:00.000',\n displayName: 'Last name',\n created: '2016-01-12T00:00:00.000',\n valueType: 'TEXT',\n attribute: 'zDhUuAYrxNC',\n value: 'Russell',\n },\n {\n lastUpdated: '2016-01-12T00:00:00.000',\n code: 'MMD_PER_NAM',\n displayName: 'First name',\n created: '2016-01-12T00:00:00.000',\n valueType: 'TEXT',\n attribute: 'w75KJ2mc4zz',\n value: 'Catherine',\n },\n ],\n});",
|
|
236
|
+
"caption": "Update a tracker entity. See [Update tracker docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#webapi_nti_import)"
|
|
232
237
|
},
|
|
233
238
|
{
|
|
234
239
|
"title": "example",
|
|
235
240
|
"description": "update('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' });",
|
|
236
|
-
"caption": "a dataSet"
|
|
241
|
+
"caption": "Update a dataSet"
|
|
237
242
|
},
|
|
238
243
|
{
|
|
239
244
|
"title": "example",
|
|
240
|
-
"description": "update('dataSetNotificationTemplates', 'VbQBwdm1wVP', {\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\n name: 'Notification',\n messageTemplate: 'Hello Updated,\n deliveryChannels: ['SMS'],\n dataSets: [],\n});",
|
|
245
|
+
"description": "update('dataSetNotificationTemplates', 'VbQBwdm1wVP', {\n dataSetNotificationTrigger: 'DATA_SET_COMPLETION',\n notificationRecipient: 'ORGANISATION_UNIT_CONTACT',\n name: 'Notification',\n messageTemplate: 'Hello Updated',\n deliveryChannels: ['SMS'],\n dataSets: [],\n});",
|
|
241
246
|
"caption": "a dataSetNotification"
|
|
242
247
|
},
|
|
243
248
|
{
|
|
244
249
|
"title": "example",
|
|
245
250
|
"description": "update('dataElements', 'FTRrcoaog83', {\n aggregationType: 'SUM',\n domainType: 'AGGREGATE',\n valueType: 'NUMBER',\n name: 'Paracetamol',\n shortName: 'Para',\n});",
|
|
246
|
-
"caption": "a dataElement"
|
|
251
|
+
"caption": "Update a dataElement"
|
|
247
252
|
},
|
|
248
253
|
{
|
|
249
254
|
"title": "example",
|
|
250
255
|
"description": "update('dataElementGroups', 'QrprHT61XFk', {\n name: 'Data Element Group 1',\n dataElements: [],\n});",
|
|
251
|
-
"caption": "a dataElementGroup"
|
|
256
|
+
"caption": "Update a dataElementGroup"
|
|
252
257
|
},
|
|
253
258
|
{
|
|
254
259
|
"title": "example",
|
|
255
260
|
"description": "update('dataElementGroupSets', 'VxWloRvAze8', {\n name: 'Data Element Group Set 4',\n dataDimension: true,\n shortName: 'DEGS4',\n dataElementGroups: [],\n});",
|
|
256
|
-
"caption": "a dataElementGroupSet"
|
|
261
|
+
"caption": "Update a dataElementGroupSet"
|
|
257
262
|
},
|
|
258
263
|
{
|
|
259
264
|
"title": "example",
|
|
260
265
|
"description": "update('dataValueSets', 'AsQj6cDsUq4', {\n dataElement: 'f7n9E0hX8qk',\n period: '201401',\n orgUnit: 'DiszpKrYNg8',\n value: '12',\n});",
|
|
261
|
-
"caption": "a dataValueSet"
|
|
266
|
+
"caption": "Update a dataValueSet"
|
|
262
267
|
},
|
|
263
268
|
{
|
|
264
269
|
"title": "example",
|
|
265
270
|
"description": "update('dataValueSets', 'Ix2HsbDMLea', {\n dataSet: 'pBOMPrpg1QX',\n completeDate: '2014-02-03',\n period: '201401',\n orgUnit: 'DiszpKrYNg8',\n dataValues: [\n {\n dataElement: 'f7n9E0hX8qk',\n value: '1',\n },\n {\n dataElement: 'Ix2HsbDMLea',\n value: '2',\n },\n {\n dataElement: 'eY5ehpbEsB7',\n value: '3',\n },\n ],\n});",
|
|
266
|
-
"caption": "a dataValueSet with related dataValues"
|
|
271
|
+
"caption": "Update a dataValueSet with related dataValues"
|
|
267
272
|
},
|
|
268
273
|
{
|
|
269
274
|
"title": "example",
|
|
270
|
-
"description": "update('enrollments', 'CmsHzercTBa' {\n
|
|
271
|
-
"caption": "
|
|
275
|
+
"description": "update('enrollments', 'CmsHzercTBa' {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'gZBxv9Ujxg0',\n enrollmentDate: '2013-10-17',\n incidentDate: '2013-10-17',\n});",
|
|
276
|
+
"caption": "Update an enrollment given the provided ID"
|
|
272
277
|
}
|
|
273
278
|
]
|
|
274
279
|
},
|
|
@@ -283,7 +288,7 @@
|
|
|
283
288
|
"callback"
|
|
284
289
|
],
|
|
285
290
|
"docs": {
|
|
286
|
-
"description": "Get data. Generic helper method for getting data of any kind from DHIS2.\n- This can be used to get `DataValueSets`,`events`,`
|
|
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.`",
|
|
287
292
|
"tags": [
|
|
288
293
|
{
|
|
289
294
|
"title": "public",
|
|
@@ -297,7 +302,7 @@
|
|
|
297
302
|
},
|
|
298
303
|
{
|
|
299
304
|
"title": "param",
|
|
300
|
-
"description": "The type of resource to get(use its `plural` name). E.g. `dataElements`, `
|
|
305
|
+
"description": "The type of resource to get(use its `plural` name). E.g. `dataElements`, `tracker/trackedEntities`,`organisationUnits`, etc.",
|
|
301
306
|
"type": {
|
|
302
307
|
"type": "NameExpression",
|
|
303
308
|
"name": "string"
|
|
@@ -348,22 +353,122 @@
|
|
|
348
353
|
{
|
|
349
354
|
"title": "example",
|
|
350
355
|
"description": "get('dataValueSets', {\n dataSet: 'pBOMPrpg1QX',\n orgUnit: 'DiszpKrYNg8',\n period: '201401',\n fields: '*',\n});",
|
|
351
|
-
"caption": "all data values for the 'pBOMPrpg1QX' dataset"
|
|
356
|
+
"caption": "Get all data values for the 'pBOMPrpg1QX' dataset"
|
|
352
357
|
},
|
|
353
358
|
{
|
|
354
359
|
"title": "example",
|
|
355
360
|
"description": "get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });",
|
|
356
|
-
"caption": "all programs for an organization unit"
|
|
361
|
+
"caption": "Get all programs for an organization unit"
|
|
357
362
|
},
|
|
358
363
|
{
|
|
359
364
|
"title": "example",
|
|
360
|
-
"description": "get('
|
|
361
|
-
"caption": "a single tracked entity
|
|
365
|
+
"description": "get('tracker/trackedEntities/F8yKM85NbxW');",
|
|
366
|
+
"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)"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"title": "example",
|
|
370
|
+
"description": "get('tracker/enrollments/abcd');",
|
|
371
|
+
"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)"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"title": "example",
|
|
375
|
+
"description": "get('tracker/events');",
|
|
376
|
+
"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)"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"title": "example",
|
|
380
|
+
"description": "get('tracker/relationships', {\n trackedEntity:['F8yKM85NbxW'],\n});",
|
|
381
|
+
"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)"
|
|
362
382
|
}
|
|
363
383
|
]
|
|
364
384
|
},
|
|
365
385
|
"valid": true
|
|
366
386
|
},
|
|
387
|
+
{
|
|
388
|
+
"name": "post",
|
|
389
|
+
"params": [
|
|
390
|
+
"resourceType",
|
|
391
|
+
"data",
|
|
392
|
+
"query",
|
|
393
|
+
"options",
|
|
394
|
+
"callback"
|
|
395
|
+
],
|
|
396
|
+
"docs": {
|
|
397
|
+
"description": "Post data. Generic helper method for posting data of any kind to DHIS2.\nThis can be used to create `DataValueSets`,`events`,`trackers`,etc.",
|
|
398
|
+
"tags": [
|
|
399
|
+
{
|
|
400
|
+
"title": "public",
|
|
401
|
+
"description": null,
|
|
402
|
+
"type": null
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"title": "function",
|
|
406
|
+
"description": null,
|
|
407
|
+
"name": null
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"title": "param",
|
|
411
|
+
"description": "Type of resource to create. E.g. `trackedEntities`, `programs`, `events`, ...",
|
|
412
|
+
"type": {
|
|
413
|
+
"type": "NameExpression",
|
|
414
|
+
"name": "string"
|
|
415
|
+
},
|
|
416
|
+
"name": "resourceType"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"title": "magic",
|
|
420
|
+
"description": "resourceType $.children.resourceTypes[*]"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"title": "param",
|
|
424
|
+
"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.",
|
|
425
|
+
"type": {
|
|
426
|
+
"type": "NameExpression",
|
|
427
|
+
"name": "Dhis2Data"
|
|
428
|
+
},
|
|
429
|
+
"name": "data"
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
"title": "param",
|
|
433
|
+
"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.",
|
|
434
|
+
"type": {
|
|
435
|
+
"type": "OptionalType",
|
|
436
|
+
"expression": {
|
|
437
|
+
"type": "NameExpression",
|
|
438
|
+
"name": "Object"
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
"name": "options"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"title": "param",
|
|
445
|
+
"description": "Optional callback to handle the response",
|
|
446
|
+
"type": {
|
|
447
|
+
"type": "OptionalType",
|
|
448
|
+
"expression": {
|
|
449
|
+
"type": "NameExpression",
|
|
450
|
+
"name": "function"
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
"name": "callback"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"title": "returns",
|
|
457
|
+
"description": "state",
|
|
458
|
+
"type": {
|
|
459
|
+
"type": "NameExpression",
|
|
460
|
+
"name": "Operation"
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
"title": "example",
|
|
465
|
+
"description": "post(\"tracker\", {\n events: [\n {\n program: \"eBAyeGv0exc\",\n orgUnit: \"DiszpKrYNg8\",\n status: \"COMPLETED\",\n },\n ],\n});",
|
|
466
|
+
"caption": "Create an event"
|
|
467
|
+
}
|
|
468
|
+
]
|
|
469
|
+
},
|
|
470
|
+
"valid": false
|
|
471
|
+
},
|
|
367
472
|
{
|
|
368
473
|
"name": "upsert",
|
|
369
474
|
"params": [
|
|
@@ -388,7 +493,7 @@
|
|
|
388
493
|
},
|
|
389
494
|
{
|
|
390
495
|
"title": "param",
|
|
391
|
-
"description": "The type of a resource to `upsert`. E.g. `
|
|
496
|
+
"description": "The type of a resource to `upsert`. E.g. `trackedEntities`",
|
|
392
497
|
"type": {
|
|
393
498
|
"type": "NameExpression",
|
|
394
499
|
"name": "string"
|
|
@@ -480,8 +585,8 @@
|
|
|
480
585
|
},
|
|
481
586
|
{
|
|
482
587
|
"title": "example",
|
|
483
|
-
"description": "upsert('
|
|
484
|
-
"caption": "
|
|
588
|
+
"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});",
|
|
589
|
+
"caption": "Upsert a trackedEntity"
|
|
485
590
|
}
|
|
486
591
|
]
|
|
487
592
|
},
|
|
@@ -517,7 +622,7 @@
|
|
|
517
622
|
},
|
|
518
623
|
{
|
|
519
624
|
"title": "param",
|
|
520
|
-
"description": "The path for a given endpoint. E.g. `/
|
|
625
|
+
"description": "The path for a given endpoint. E.g. `/trackedEntities` or `/dataValueSets`",
|
|
521
626
|
"type": {
|
|
522
627
|
"type": "NameExpression",
|
|
523
628
|
"name": "string"
|
|
@@ -534,7 +639,7 @@
|
|
|
534
639
|
},
|
|
535
640
|
{
|
|
536
641
|
"title": "example",
|
|
537
|
-
"description": "discover('post', '/
|
|
642
|
+
"description": "discover('post', '/trackedEntities')",
|
|
538
643
|
"caption": "a list of parameters allowed on a given endpoint for specific http method"
|
|
539
644
|
}
|
|
540
645
|
]
|
|
@@ -655,7 +760,7 @@
|
|
|
655
760
|
},
|
|
656
761
|
{
|
|
657
762
|
"title": "param",
|
|
658
|
-
"description": "The type of resource to be deleted. E.g. `
|
|
763
|
+
"description": "The type of resource to be deleted. E.g. `trackedEntities`, `organisationUnits`, etc.",
|
|
659
764
|
"type": {
|
|
660
765
|
"type": "NameExpression",
|
|
661
766
|
"name": "string"
|
|
@@ -742,8 +847,8 @@
|
|
|
742
847
|
},
|
|
743
848
|
{
|
|
744
849
|
"title": "example",
|
|
745
|
-
"description": "destroy('
|
|
746
|
-
"caption": "a tracked entity instance"
|
|
850
|
+
"description": "destroy('trackedEntities', 'LcRd6Nyaq7T');",
|
|
851
|
+
"caption": "a tracked entity instance. See [Delete tracker docs](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-241/tracker.html#webapi_nti_import)"
|
|
747
852
|
}
|
|
748
853
|
]
|
|
749
854
|
},
|
|
@@ -752,7 +857,7 @@
|
|
|
752
857
|
{
|
|
753
858
|
"name": "findAttributeValue",
|
|
754
859
|
"params": [
|
|
755
|
-
"
|
|
860
|
+
"trackedEntity",
|
|
756
861
|
"attributeDisplayName"
|
|
757
862
|
],
|
|
758
863
|
"docs": {
|
|
@@ -765,7 +870,7 @@
|
|
|
765
870
|
},
|
|
766
871
|
{
|
|
767
872
|
"title": "example",
|
|
768
|
-
"description": "findAttributeValue(state.data.
|
|
873
|
+
"description": "findAttributeValue(state.data.trackedEntities[0], 'first name')"
|
|
769
874
|
},
|
|
770
875
|
{
|
|
771
876
|
"title": "function",
|
|
@@ -779,7 +884,7 @@
|
|
|
779
884
|
"type": "NameExpression",
|
|
780
885
|
"name": "Object"
|
|
781
886
|
},
|
|
782
|
-
"name": "
|
|
887
|
+
"name": "trackedEntity"
|
|
783
888
|
},
|
|
784
889
|
{
|
|
785
890
|
"title": "param",
|
|
@@ -809,7 +914,7 @@
|
|
|
809
914
|
"value"
|
|
810
915
|
],
|
|
811
916
|
"docs": {
|
|
812
|
-
"description": "Converts an attribute ID and value into a
|
|
917
|
+
"description": "Converts an attribute ID and value into a DHIS2 attribute object",
|
|
813
918
|
"tags": [
|
|
814
919
|
{
|
|
815
920
|
"title": "public",
|
|
@@ -862,7 +967,7 @@
|
|
|
862
967
|
"value"
|
|
863
968
|
],
|
|
864
969
|
"docs": {
|
|
865
|
-
"description": "Converts a dataElement and value into a
|
|
970
|
+
"description": "Converts a dataElement and value into a DHIS2 dataValue object",
|
|
866
971
|
"tags": [
|
|
867
972
|
{
|
|
868
973
|
"title": "public",
|
|
@@ -1473,6 +1578,92 @@
|
|
|
1473
1578
|
]
|
|
1474
1579
|
},
|
|
1475
1580
|
"valid": true
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
"name": "cursor",
|
|
1584
|
+
"params": [
|
|
1585
|
+
"value",
|
|
1586
|
+
"options"
|
|
1587
|
+
],
|
|
1588
|
+
"docs": {
|
|
1589
|
+
"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}",
|
|
1590
|
+
"tags": [
|
|
1591
|
+
{
|
|
1592
|
+
"title": "public",
|
|
1593
|
+
"description": null,
|
|
1594
|
+
"type": null
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
"title": "function",
|
|
1598
|
+
"description": null,
|
|
1599
|
+
"name": null
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
"title": "example",
|
|
1603
|
+
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
1604
|
+
"caption": "Use a cursor from state if present, or else use the default value"
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
"title": "example",
|
|
1608
|
+
"description": "cursor(22)",
|
|
1609
|
+
"caption": "Use a pagination cursor"
|
|
1610
|
+
},
|
|
1611
|
+
{
|
|
1612
|
+
"title": "param",
|
|
1613
|
+
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
|
1614
|
+
"type": {
|
|
1615
|
+
"type": "NameExpression",
|
|
1616
|
+
"name": "any"
|
|
1617
|
+
},
|
|
1618
|
+
"name": "value"
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
"title": "param",
|
|
1622
|
+
"description": "options to control the cursor.",
|
|
1623
|
+
"type": {
|
|
1624
|
+
"type": "NameExpression",
|
|
1625
|
+
"name": "object"
|
|
1626
|
+
},
|
|
1627
|
+
"name": "options"
|
|
1628
|
+
},
|
|
1629
|
+
{
|
|
1630
|
+
"title": "param",
|
|
1631
|
+
"description": "set the cursor key. Will persist through the whole run.",
|
|
1632
|
+
"type": {
|
|
1633
|
+
"type": "NameExpression",
|
|
1634
|
+
"name": "string"
|
|
1635
|
+
},
|
|
1636
|
+
"name": "options.key"
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
"title": "param",
|
|
1640
|
+
"description": "the value to use if value is falsy",
|
|
1641
|
+
"type": {
|
|
1642
|
+
"type": "NameExpression",
|
|
1643
|
+
"name": "any"
|
|
1644
|
+
},
|
|
1645
|
+
"name": "options.defaultValue"
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
"title": "param",
|
|
1649
|
+
"description": "custom formatter for the final cursor value",
|
|
1650
|
+
"type": {
|
|
1651
|
+
"type": "NameExpression",
|
|
1652
|
+
"name": "Function"
|
|
1653
|
+
},
|
|
1654
|
+
"name": "options.format"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
"title": "returns",
|
|
1658
|
+
"description": null,
|
|
1659
|
+
"type": {
|
|
1660
|
+
"type": "NameExpression",
|
|
1661
|
+
"name": "Operation"
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
]
|
|
1665
|
+
},
|
|
1666
|
+
"valid": false
|
|
1476
1667
|
}
|
|
1477
1668
|
]
|
|
1478
1669
|
}
|