@openfn/language-dhis2 7.0.0 → 7.0.2

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
@@ -15,54 +15,6 @@
15
15
  "description": null,
16
16
  "type": null
17
17
  },
18
- {
19
- "title": "function",
20
- "description": null,
21
- "name": null
22
- },
23
- {
24
- "title": "param",
25
- "description": "Path to the resource to be created",
26
- "type": {
27
- "type": "NameExpression",
28
- "name": "string"
29
- },
30
- "name": "path"
31
- },
32
- {
33
- "title": "magic",
34
- "description": "path $.children.resourceTypes[*]"
35
- },
36
- {
37
- "title": "param",
38
- "description": "An object, or array of objects, to create.",
39
- "type": {
40
- "type": "NameExpression",
41
- "name": "DHIS2Data"
42
- },
43
- "name": "data"
44
- },
45
- {
46
- "title": "param",
47
- "description": "Optional object of query parameters to include in the request",
48
- "type": {
49
- "type": "NameExpression",
50
- "name": "object"
51
- },
52
- "name": "params"
53
- },
54
- {
55
- "title": "state",
56
- "description": "data - The created resource as returned by DHIS2"
57
- },
58
- {
59
- "title": "returns",
60
- "description": null,
61
- "type": {
62
- "type": "NameExpression",
63
- "name": "Operation"
64
- }
65
- },
66
18
  {
67
19
  "title": "example",
68
20
  "description": "create('programs', {\n name: 'name 20',\n shortName: 'n20',\n programType: 'WITHOUT_REGISTRATION',\n});",
@@ -70,7 +22,7 @@
70
22
  },
71
23
  {
72
24
  "title": "example",
73
- "description": "create('events', {\n program: 'eBAyeGv0exc',\n orgUnit: 'DiszpKrYNg8',\n status: 'COMPLETED',\n});",
25
+ "description": "create('events', {\n program: 'eBAyeGv0exc',\n orgUnit: 'DiszpKrYNg8',\n occurredAt: '2025-06-19',\n status: 'COMPLETED',\n});",
74
26
  "caption": "Create a single event"
75
27
  },
76
28
  {
@@ -80,7 +32,7 @@
80
32
  },
81
33
  {
82
34
  "title": "example",
83
- "description": "create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });",
35
+ "description": "create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly', shortName: 'ODS' });",
84
36
  "caption": "Create a dataSet"
85
37
  },
86
38
  {
@@ -95,7 +47,7 @@
95
47
  },
96
48
  {
97
49
  "title": "example",
98
- "description": "create('dataElementGroups', {\n name: 'Data Element Group 1',\n dataElements: [],\n});",
50
+ "description": "create('dataElementGroups', {\n name: 'Data Element Group 1',\n shortName: 'DEG1',\n dataElements: [],\n});",
99
51
  "caption": "Create a dataElementGroup"
100
52
  },
101
53
  {
@@ -115,26 +67,8 @@
115
67
  },
116
68
  {
117
69
  "title": "example",
118
- "description": "create('enrollments', {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'gZBxv9Ujxg0',\n enrollmentDate: '2013-09-17',\n incidentDate: '2013-09-17',\n});",
70
+ "description": "create('enrollments', {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'ur1Edk5Oe2n',\n enrolledAt: '2013-09-17',\n enrollmentDate: '2013-09-17',\n incidentDate: '2013-09-17',\n});",
119
71
  "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
72
  },
139
73
  {
140
74
  "title": "function",
@@ -143,16 +77,29 @@
143
77
  },
144
78
  {
145
79
  "title": "param",
146
- "description": "Path to the resource",
80
+ "description": "Path to the resource to be created",
147
81
  "type": {
148
82
  "type": "NameExpression",
149
83
  "name": "string"
150
84
  },
151
85
  "name": "path"
152
86
  },
87
+ {
88
+ "title": "magic",
89
+ "description": "path $.children.resourceTypes[*]"
90
+ },
153
91
  {
154
92
  "title": "param",
155
- "description": "Object of query parameters to include in the request",
93
+ "description": "An object, or array of objects, to create.",
94
+ "type": {
95
+ "type": "NameExpression",
96
+ "name": "DHIS2Data"
97
+ },
98
+ "name": "data"
99
+ },
100
+ {
101
+ "title": "param",
102
+ "description": "Optional object of query parameters to include in the request",
156
103
  "type": {
157
104
  "type": "NameExpression",
158
105
  "name": "object"
@@ -161,7 +108,7 @@
161
108
  },
162
109
  {
163
110
  "title": "state",
164
- "description": "data - the resource returned by DHIS2"
111
+ "description": "data - The created resource as returned by DHIS2"
165
112
  },
166
113
  {
167
114
  "title": "returns",
@@ -170,42 +117,40 @@
170
117
  "type": "NameExpression",
171
118
  "name": "Operation"
172
119
  }
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"
178
- },
179
- {
180
- "title": "example",
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)"
188
120
  }
189
121
  ]
190
122
  },
191
123
  "valid": true
192
124
  },
193
125
  {
194
- "name": "update",
126
+ "name": "get",
195
127
  "params": [
196
- "resourceType",
197
128
  "path",
198
- "data",
199
- "options"
129
+ "params"
200
130
  ],
201
131
  "docs": {
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",
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()`",
203
133
  "tags": [
204
134
  {
205
135
  "title": "public",
206
136
  "description": null,
207
137
  "type": null
208
138
  },
139
+ {
140
+ "title": "example",
141
+ "description": "get('dataValueSets', {\n dataSet: 'pBOMPrpg1QX',\n orgUnit: 'DiszpKrYNg8',\n period: '201401',\n fields: '*',\n});",
142
+ "caption": "Get all data values for the 'pBOMPrpg1QX' dataset"
143
+ },
144
+ {
145
+ "title": "example",
146
+ "description": "get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });",
147
+ "caption": "Get all programs for an organization unit"
148
+ },
149
+ {
150
+ "title": "example",
151
+ "description": "get('tracker/trackedEntities/F8yKM85NbxW');",
152
+ "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)"
153
+ },
209
154
  {
210
155
  "title": "function",
211
156
  "description": null,
@@ -213,16 +158,7 @@
213
158
  },
214
159
  {
215
160
  "title": "param",
216
- "description": "The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.",
217
- "type": {
218
- "type": "NameExpression",
219
- "name": "string"
220
- },
221
- "name": "resourceType"
222
- },
223
- {
224
- "title": "param",
225
- "description": "The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`",
161
+ "description": "Path to the resource",
226
162
  "type": {
227
163
  "type": "NameExpression",
228
164
  "name": "string"
@@ -231,24 +167,12 @@
231
167
  },
232
168
  {
233
169
  "title": "param",
234
- "description": "Data to update. It requires to send the full body. If you want partial updates, use patch operation.",
170
+ "description": "Object of query parameters to include in the request",
235
171
  "type": {
236
172
  "type": "NameExpression",
237
- "name": "Object"
238
- },
239
- "name": "data"
240
- },
241
- {
242
- "title": "param",
243
- "description": "An optional object containing query, parseAs,and headers for the request.",
244
- "type": {
245
- "type": "OptionalType",
246
- "expression": {
247
- "type": "NameExpression",
248
- "name": "RequestOptions"
249
- }
173
+ "name": "object"
250
174
  },
251
- "name": "options"
175
+ "name": "params"
252
176
  },
253
177
  {
254
178
  "title": "state",
@@ -261,6 +185,26 @@
261
185
  "type": "NameExpression",
262
186
  "name": "Operation"
263
187
  }
188
+ }
189
+ ]
190
+ },
191
+ "valid": true
192
+ },
193
+ {
194
+ "name": "update",
195
+ "params": [
196
+ "resourceType",
197
+ "path",
198
+ "data",
199
+ "options"
200
+ ],
201
+ "docs": {
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",
203
+ "tags": [
204
+ {
205
+ "title": "public",
206
+ "description": null,
207
+ "type": null
264
208
  },
265
209
  {
266
210
  "title": "example",
@@ -316,6 +260,62 @@
316
260
  "title": "example",
317
261
  "description": "update('enrollments', 'CmsHzercTBa' {\n trackedEntity: 'bmshzEacgxa',\n orgUnit: 'TSyzvBiovKh',\n program: 'gZBxv9Ujxg0',\n enrollmentDate: '2013-10-17',\n incidentDate: '2013-10-17',\n});",
318
262
  "caption": "Update an enrollment given the provided ID"
263
+ },
264
+ {
265
+ "title": "function",
266
+ "description": null,
267
+ "name": null
268
+ },
269
+ {
270
+ "title": "param",
271
+ "description": "The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.",
272
+ "type": {
273
+ "type": "NameExpression",
274
+ "name": "string"
275
+ },
276
+ "name": "resourceType"
277
+ },
278
+ {
279
+ "title": "param",
280
+ "description": "The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`",
281
+ "type": {
282
+ "type": "NameExpression",
283
+ "name": "string"
284
+ },
285
+ "name": "path"
286
+ },
287
+ {
288
+ "title": "param",
289
+ "description": "Data to update. It requires to send the full body. If you want partial updates, use patch operation.",
290
+ "type": {
291
+ "type": "NameExpression",
292
+ "name": "Object"
293
+ },
294
+ "name": "data"
295
+ },
296
+ {
297
+ "title": "param",
298
+ "description": "An optional object containing query, parseAs,and headers for the request.",
299
+ "type": {
300
+ "type": "OptionalType",
301
+ "expression": {
302
+ "type": "NameExpression",
303
+ "name": "RequestOptions"
304
+ }
305
+ },
306
+ "name": "options"
307
+ },
308
+ {
309
+ "title": "state",
310
+ "description": "data - the resource returned by DHIS2"
311
+ },
312
+ {
313
+ "title": "returns",
314
+ "description": null,
315
+ "type": {
316
+ "type": "NameExpression",
317
+ "name": "Operation"
318
+ }
319
319
  }
320
320
  ]
321
321
  },
@@ -337,6 +337,16 @@
337
337
  "description": null,
338
338
  "type": null
339
339
  },
340
+ {
341
+ "title": "example",
342
+ "description": "upsert('trackedEntities', {}, {\n orgUnit: 'TSyzvBiovKh',\n trackedEntityType: 'nEenWmSyUEp',\n attributes: [\n {\n attribute: 'w75KJ2mc4zz',\n value: 'Qassim',\n },\n ],\n});",
343
+ "caption": "Upsert a trackedEntity"
344
+ },
345
+ {
346
+ "title": "example",
347
+ "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 );",
348
+ "caption": "Upsert a dataElement"
349
+ },
340
350
  {
341
351
  "title": "function",
342
352
  "description": null,
@@ -400,16 +410,6 @@
400
410
  "type": "NameExpression",
401
411
  "name": "Operation"
402
412
  }
403
- },
404
- {
405
- "title": "example",
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"
408
- },
409
- {
410
- "title": "example",
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"
413
413
  }
414
414
  ]
415
415
  },
@@ -436,6 +436,11 @@
436
436
  "description": null,
437
437
  "name": null
438
438
  },
439
+ {
440
+ "title": "example",
441
+ "description": "destroy('trackedEntities', 'LcRd6Nyaq7T');",
442
+ "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)"
443
+ },
439
444
  {
440
445
  "title": "param",
441
446
  "description": "The type of resource to be deleted. E.g. `trackedEntities`, `organisationUnits`, etc.",
@@ -489,11 +494,6 @@
489
494
  "type": "NameExpression",
490
495
  "name": "Operation"
491
496
  }
492
- },
493
- {
494
- "title": "example",
495
- "description": "destroy('trackedEntities', 'LcRd6Nyaq7T');",
496
- "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)"
497
497
  }
498
498
  ]
499
499
  },
package/dist/index.cjs CHANGED
@@ -341,7 +341,6 @@ function configMigrationHelper(state) {
341
341
  }
342
342
  function create(path, data, params = {}) {
343
343
  return async (state) => {
344
- var _a;
345
344
  if (path === "tracker") {
346
345
  throw new Error("Invalid resourceType. Use `tracker.import()` instead.");
347
346
  }
@@ -373,15 +372,11 @@ function create(path, data, params = {}) {
373
372
  data: resolvedData
374
373
  });
375
374
  }
376
- const details = `with response ${JSON.stringify(
377
- (_a = response.body) == null ? void 0 : _a.message,
378
- null,
379
- 2
380
- )}`;
381
- console.log(`Created ${resolvedPath} ${details}`);
375
+ console.log(`Created ${resolvedPath}`);
382
376
  const { location } = response.headers;
383
- if (location)
377
+ if (location) {
384
378
  console.log(`Record available @ ${location}`);
379
+ }
385
380
  return handleResponse(response, state);
386
381
  };
387
382
  }
package/dist/index.js CHANGED
@@ -312,7 +312,6 @@ function configMigrationHelper(state) {
312
312
  }
313
313
  function create(path, data, params = {}) {
314
314
  return async (state) => {
315
- var _a;
316
315
  if (path === "tracker") {
317
316
  throw new Error("Invalid resourceType. Use `tracker.import()` instead.");
318
317
  }
@@ -344,15 +343,11 @@ function create(path, data, params = {}) {
344
343
  data: resolvedData
345
344
  });
346
345
  }
347
- const details = `with response ${JSON.stringify(
348
- (_a = response.body) == null ? void 0 : _a.message,
349
- null,
350
- 2
351
- )}`;
352
- console.log(`Created ${resolvedPath} ${details}`);
346
+ console.log(`Created ${resolvedPath}`);
353
347
  const { location } = response.headers;
354
- if (location)
348
+ if (location) {
355
349
  console.log(`Record available @ ${location}`);
350
+ }
356
351
  return handleResponse(response, state);
357
352
  };
358
353
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openfn/language-dhis2",
3
3
  "label": "DHIS2",
4
- "version": "7.0.0",
4
+ "version": "7.0.2",
5
5
  "description": "DHIS2 Language Pack for OpenFn",
6
6
  "homepage": "https://docs.openfn.org",
7
7
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "axios": "^1.8.2",
30
30
  "lodash": "^4.17.21",
31
31
  "qs": "^6.11.0",
32
- "@openfn/language-common": "2.4.0"
32
+ "@openfn/language-common": "2.5.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "assertion-error": "2.0.0",
@@ -29,13 +29,6 @@ export function execute(...operations: Operations): Operation;
29
29
  /**
30
30
  * Create a record
31
31
  * @public
32
- * @function
33
- * @param {string} path - Path to the resource to be created
34
- * @magic path $.children.resourceTypes[*]
35
- * @param {DHIS2Data} data - An object, or array of objects, to create.
36
- * @param {object} params - Optional object of query parameters to include in the request
37
- * @state data - The created resource as returned by DHIS2
38
- * @returns {Operation}
39
32
  * @example <caption>Create a program</caption>
40
33
  * create('programs', {
41
34
  * name: 'name 20',
@@ -46,6 +39,7 @@ export function execute(...operations: Operations): Operation;
46
39
  * create('events', {
47
40
  * program: 'eBAyeGv0exc',
48
41
  * orgUnit: 'DiszpKrYNg8',
42
+ * occurredAt: '2025-06-19',
49
43
  * status: 'COMPLETED',
50
44
  * });
51
45
  * @example <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)</caption>
@@ -60,7 +54,7 @@ export function execute(...operations: Operations): Operation;
60
54
  * ]
61
55
  * });
62
56
  * @example <caption>Create a dataSet</caption>
63
- * create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });
57
+ * create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly', shortName: 'ODS' });
64
58
  * @example <caption>a dataSetNotification</caption>
65
59
  * create('dataSetNotificationTemplates', {
66
60
  * dataSetNotificationTrigger: 'DATA_SET_COMPLETION',
@@ -81,6 +75,7 @@ export function execute(...operations: Operations): Operation;
81
75
  * @example <caption>Create a dataElementGroup</caption>
82
76
  * create('dataElementGroups', {
83
77
  * name: 'Data Element Group 1',
78
+ * shortName: 'DEG1',
84
79
  * dataElements: [],
85
80
  * });
86
81
  * @example <caption>Create a dataElementGroupSet</caption>
@@ -122,21 +117,24 @@ export function execute(...operations: Operations): Operation;
122
117
  * create('enrollments', {
123
118
  * trackedEntity: 'bmshzEacgxa',
124
119
  * orgUnit: 'TSyzvBiovKh',
125
- * program: 'gZBxv9Ujxg0',
120
+ * program: 'ur1Edk5Oe2n',
121
+ * enrolledAt: '2013-09-17',
126
122
  * enrollmentDate: '2013-09-17',
127
123
  * incidentDate: '2013-09-17',
128
124
  * });
125
+ * @function
126
+ * @param {string} path - Path to the resource to be created
127
+ * @magic path $.children.resourceTypes[*]
128
+ * @param {DHIS2Data} data - An object, or array of objects, to create.
129
+ * @param {object} params - Optional object of query parameters to include in the request
130
+ * @state data - The created resource as returned by DHIS2
131
+ * @returns {Operation}
129
132
  */
130
133
  export function create(path: string, data: DHIS2Data, params?: object): Operation;
131
134
  /**
132
135
  * Get any resource, as JSON, from DHIS2. Pass in any valid DHIS2 REST path, excluding /api and the version.
133
136
  * For the new tracker API, see `tracker.export()`
134
137
  * @public
135
- * @function
136
- * @param {string} path - Path to the resource
137
- * @param {object} params - Object of query parameters to include in the request
138
- * @state data - the resource returned by DHIS2
139
- * @returns {Operation}
140
138
  * @example <caption>Get all data values for the 'pBOMPrpg1QX' dataset</caption>
141
139
  * get('dataValueSets', {
142
140
  * dataSet: 'pBOMPrpg1QX',
@@ -148,18 +146,16 @@ export function create(path: string, data: DHIS2Data, params?: object): Operatio
148
146
  * get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });
149
147
  * @example <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)</caption>
150
148
  * get('tracker/trackedEntities/F8yKM85NbxW');
149
+ * @function
150
+ * @param {string} path - Path to the resource
151
+ * @param {object} params - Object of query parameters to include in the request
152
+ * @state data - the resource returned by DHIS2
153
+ * @returns {Operation}
151
154
  */
152
155
  export function get(path: string, params?: object): Operation;
153
156
  /**
154
157
  * 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
155
158
  * @public
156
- * @function
157
- * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
158
- * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
159
- * @param {Object} data - Data to update. It requires to send the full body. If you want partial updates, use patch operation.
160
- * @param {RequestOptions} [options] - An optional object containing query, parseAs,and headers for the request.
161
- * @state data - the resource returned by DHIS2
162
- * @returns {Operation}
163
159
  * @example <caption>a program</caption>
164
160
  * update('programs', 'qAZJCrNJK8H', {
165
161
  * name: '14e1aa02c3f0a31618e096f2c6d03bed',
@@ -278,20 +274,19 @@ export function get(path: string, params?: object): Operation;
278
274
  * enrollmentDate: '2013-10-17',
279
275
  * incidentDate: '2013-10-17',
280
276
  * });
277
+ * @function
278
+ * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
279
+ * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
280
+ * @param {Object} data - Data to update. It requires to send the full body. If you want partial updates, use patch operation.
281
+ * @param {RequestOptions} [options] - An optional object containing query, parseAs,and headers for the request.
282
+ * @state data - the resource returned by DHIS2
283
+ * @returns {Operation}
281
284
  */
282
285
  export function update(resourceType: string, path: string, data: any, options?: RequestOptions): Operation;
283
286
  /**
284
287
  * Upsert a record. This will atomically update a record if it already exists, or otherwise create it.
285
288
  * This function does not work with the absolute tracker path `api/tracker` but rather the new tracker paths and deprecated tracker endpoints.
286
289
  * @public
287
- * @function
288
- * @param {string} resourceType - The type of a resource to `upsert`. E.g. `trackedEntities`.
289
- * @param {Object} query - A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created.
290
- * @param {Object} data - The data to use for update or create depending on the result of the query.
291
- * @param {RequestOptions} [options] - An optional object containing query, parseAs,and headers for the request
292
- * @throws {RangeError} - Throws range error
293
- * @state {DHIS2State}
294
- * @returns {Operation}
295
290
  * @example <caption>Upsert a trackedEntity</caption>
296
291
  * upsert('trackedEntities', {}, {
297
292
  * orgUnit: 'TSyzvBiovKh',
@@ -321,20 +316,28 @@ export function update(resourceType: string, path: string, data: any, options?:
321
316
  * name: 'Acute Flaccid Paralysis (AFP) follow-up',
322
317
  * }
323
318
  * );
319
+ * @function
320
+ * @param {string} resourceType - The type of a resource to `upsert`. E.g. `trackedEntities`.
321
+ * @param {Object} query - A query object that allows to uniquely identify the resource to update. If no matches found, then the resource will be created.
322
+ * @param {Object} data - The data to use for update or create depending on the result of the query.
323
+ * @param {RequestOptions} [options] - An optional object containing query, parseAs,and headers for the request
324
+ * @throws {RangeError} - Throws range error
325
+ * @state {DHIS2State}
326
+ * @returns {Operation}
324
327
  */
325
328
  export function upsert(resourceType: string, query: any, data: any, options?: RequestOptions): Operation;
326
329
  /**
327
330
  * Delete record.
328
331
  * @public
329
332
  * @function
333
+ * @example <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)</caption>
334
+ * destroy('trackedEntities', 'LcRd6Nyaq7T');
330
335
  * @param {string} resourceType - The type of resource to be deleted. E.g. `trackedEntities`, `organisationUnits`, etc.
331
336
  * @param {string} path - Can be an `id` of an `object` or `path` to the `nested object` to `delete`.
332
337
  * @param {Object} [data] - 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}
333
338
  * @param {RequestOptions} [options] - An optional object containing query, parseAs,and headers for the request.
334
339
  * @state {DHIS2State}
335
340
  * @returns {Operation}
336
- * @example <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)</caption>
337
- * destroy('trackedEntities', 'LcRd6Nyaq7T');
338
341
  */
339
342
  export function destroy(resourceType: string, path: string, data?: any, options?: RequestOptions): Operation;
340
343
  /**
@@ -28,12 +28,6 @@ export type TrackerOptions = {
28
28
  * Import data into DHIS2 using the tracker endpoint.
29
29
  * @alias import
30
30
  * @public
31
- * @function
32
- * @param {string} strategy - The effect the import should have. Can either be CREATE, UPDATE, CREATE_AND_UPDATE and DELETE.
33
- * @param {object} payload - The data to be imported.
34
- * @param {TrackerOptions} [options] - An optional object containing parseAs, and apiVersion, and queries for the request
35
- * @state {DHIS2State}
36
- * @returns {Operation}
37
31
  * @example <caption>Import some data and pass the `atomicMode` parameter</caption>
38
32
  * tracker.import('CREATE', $.trackerData, { atomicMode: 'ALL' })
39
33
  * @example <caption>Import a trackedEntity resource</caption>
@@ -57,24 +51,30 @@ export type TrackerOptions = {
57
51
  * atomicMode: 'ALL',
58
52
  * }
59
53
  * );
54
+ * @function
55
+ * @param {string} strategy - The effect the import should have. Can either be CREATE, UPDATE, CREATE_AND_UPDATE and DELETE.
56
+ * @param {object} payload - The data to be imported.
57
+ * @param {TrackerOptions} [options] - An optional object containing parseAs, and apiVersion, and queries for the request
58
+ * @state {DHIS2State}
59
+ * @returns {Operation}
60
60
  */
61
61
  declare function _import(strategy: string, payload: object, options?: TrackerOptions): Operation;
62
62
  /**
63
63
  * Export data from DHIS2.
64
64
  * @alias export
65
65
  * @public
66
- * @function
67
- * @param {string} path - Path to the resource, relative to the /tracker endpoint
68
- * @param {object} query - An object of query parameters to be encoded into the URL
69
- * @param {TrackerOptions} [options] - An optional object containing parseAs, and apiVersion for the request
70
- * @state {DHIS2State}
71
- * @returns {Operation}
72
66
  * @example <caption>Export a trackedEntity resource using the id</caption>
73
67
  * tracker.export('trackedEntities/Gu5UKnIFnJf')
74
68
  * @example <caption>Export all enrollment resources</caption>
75
69
  * tracker.export('enrollments', {orgUnit: 'TSyzvBiovKh'});
76
70
  * @example <caption>Export all events</caption>
77
71
  * tracker.export('events')
72
+ * @function
73
+ * @param {string} path - Path to the resource, relative to the /tracker endpoint
74
+ * @param {object} query - An object of query parameters to be encoded into the URL
75
+ * @param {TrackerOptions} [options] - An optional object containing parseAs, and apiVersion for the request
76
+ * @state {DHIS2State}
77
+ * @returns {Operation}
78
78
  */
79
79
  declare function _export(path: string, query: object, options?: TrackerOptions): Operation;
80
80
  export { _import as import, _import as import, _export as export, _export as export };