@openfn/language-dhis2 3.2.3 → 3.2.4

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Language DHIS2 [<img src="https://avatars2.githubusercontent.com/u/9555108?s=200&v=4)" alt="alt text" height="20"/>](https://www.openfn.org)
1
+ # Language DHIS2
2
2
 
3
3
  An OpenFn language Pack for building expressions and operations for working with
4
4
  the
package/ast.json CHANGED
@@ -17,9 +17,8 @@
17
17
  "type": null
18
18
  },
19
19
  {
20
- "title": "constructor",
20
+ "title": "function",
21
21
  "description": null,
22
- "type": null,
23
22
  "name": null
24
23
  },
25
24
  {
@@ -149,9 +148,8 @@
149
148
  "type": null
150
149
  },
151
150
  {
152
- "title": "constructor",
151
+ "title": "function",
153
152
  "description": null,
154
- "type": null,
155
153
  "name": null
156
154
  },
157
155
  {
@@ -289,9 +287,8 @@
289
287
  "type": null
290
288
  },
291
289
  {
292
- "title": "constructor",
290
+ "title": "function",
293
291
  "description": null,
294
- "type": null,
295
292
  "name": null
296
293
  },
297
294
  {
@@ -381,9 +378,8 @@
381
378
  "type": null
382
379
  },
383
380
  {
384
- "title": "constructor",
381
+ "title": "function",
385
382
  "description": null,
386
- "type": null,
387
383
  "name": null
388
384
  },
389
385
  {
@@ -502,9 +498,8 @@
502
498
  "type": null
503
499
  },
504
500
  {
505
- "title": "constructor",
501
+ "title": "function",
506
502
  "description": null,
507
- "type": null,
508
503
  "name": null
509
504
  },
510
505
  {
@@ -560,9 +555,8 @@
560
555
  "type": null
561
556
  },
562
557
  {
563
- "title": "constructor",
558
+ "title": "function",
564
559
  "description": null,
565
- "type": null,
566
560
  "name": null
567
561
  },
568
562
  {
@@ -651,9 +645,8 @@
651
645
  "type": null
652
646
  },
653
647
  {
654
- "title": "constructor",
648
+ "title": "function",
655
649
  "description": null,
656
- "type": null,
657
650
  "name": null
658
651
  },
659
652
  {
@@ -771,9 +764,8 @@
771
764
  "description": "findAttributeValue(state.data.trackedEntityInstances[0], 'first name')"
772
765
  },
773
766
  {
774
- "title": "constructor",
767
+ "title": "function",
775
768
  "description": null,
776
- "type": null,
777
769
  "name": null
778
770
  },
779
771
  {
@@ -825,9 +817,8 @@
825
817
  "description": "attr('w75KJ2mc4zz', 'Elias')"
826
818
  },
827
819
  {
828
- "title": "constructor",
820
+ "title": "function",
829
821
  "description": null,
830
- "type": null,
831
822
  "name": null
832
823
  },
833
824
  {
@@ -879,9 +870,8 @@
879
870
  "description": "dv('f7n9E0hX8qk', 12)"
880
871
  },
881
872
  {
882
- "title": "constructor",
873
+ "title": "function",
883
874
  "description": null,
884
- "type": null,
885
875
  "name": null
886
876
  },
887
877
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-dhis2",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "DHIS2 Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -6,30 +6,15 @@
6
6
  * create('foo'),
7
7
  * delete('bar')
8
8
  * )(state)
9
- * @constructor
9
+ * @function
10
10
  * @param {Operations} operations - Operations to be performed.
11
11
  * @returns {Operation}
12
12
  */
13
13
  export function execute(...operations: Operations): Operation;
14
- export class execute {
15
- /**
16
- * Execute a sequence of operations.
17
- * Wraps `language-common/execute`, and prepends initial state for DHIS2.
18
- * @example
19
- * execute(
20
- * create('foo'),
21
- * delete('bar')
22
- * )(state)
23
- * @constructor
24
- * @param {Operations} operations - Operations to be performed.
25
- * @returns {Operation}
26
- */
27
- constructor(...operations: Operations);
28
- }
29
14
  /**
30
15
  * Create a record
31
16
  * @public
32
- * @constructor
17
+ * @function
33
18
  * @param {string} resourceType - Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ...
34
19
  * @param {Object} data - 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.
35
20
  * @param {Object} [options] - 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.
@@ -127,114 +112,11 @@ export class execute {
127
112
  * });
128
113
  */
129
114
  export function create(resourceType: string, data: any, options?: any, callback?: Function): Operation;
130
- export class create {
131
- /**
132
- * Create a record
133
- * @public
134
- * @constructor
135
- * @param {string} resourceType - Type of resource to create. E.g. `trackedEntityInstances`, `programs`, `events`, ...
136
- * @param {Object} data - 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.
137
- * @param {Object} [options] - 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.
138
- * @param {function} [callback] - Optional callback to handle the response
139
- * @returns {Operation}
140
- * @example <caption>a program</caption>
141
- * create('programs', {
142
- * name: 'name 20',
143
- * shortName: 'n20',
144
- * programType: 'WITHOUT_REGISTRATION',
145
- * });
146
- * @example <caption>an event</caption>
147
- * create('events', {
148
- * program: 'eBAyeGv0exc',
149
- * orgUnit: 'DiszpKrYNg8',
150
- * status: 'COMPLETED',
151
- * });
152
- * @example <caption>a trackedEntityInstance</caption>
153
- * create('trackedEntityInstances', {
154
- * orgUnit: 'TSyzvBiovKh',
155
- * trackedEntityType: 'nEenWmSyUEp',
156
- * attributes: [
157
- * {
158
- * attribute: 'w75KJ2mc4zz',
159
- * value: 'Gigiwe',
160
- * },
161
- * ]
162
- * });
163
- * @example <caption>a dataSet</caption>
164
- * create('dataSets', { name: 'OpenFn Data Set', periodType: 'Monthly' });
165
- * @example <caption>a dataSetNotification</caption>
166
- * create('dataSetNotificationTemplates', {
167
- * dataSetNotificationTrigger: 'DATA_SET_COMPLETION',
168
- * notificationRecipient: 'ORGANISATION_UNIT_CONTACT',
169
- * name: 'Notification',
170
- * messageTemplate: 'Hello',
171
- * deliveryChannels: ['SMS'],
172
- * dataSets: [],
173
- * });
174
- * @example <caption>a dataElement</caption>
175
- * create('dataElements', {
176
- * aggregationType: 'SUM',
177
- * domainType: 'AGGREGATE',
178
- * valueType: 'NUMBER',
179
- * name: 'Paracetamol',
180
- * shortName: 'Para',
181
- * });
182
- * @example <caption>a dataElementGroup</caption>
183
- * create('dataElementGroups', {
184
- * name: 'Data Element Group 1',
185
- * dataElements: [],
186
- * });
187
- * @example <caption>a dataElementGroupSet</caption>
188
- * create('dataElementGroupSets', {
189
- * name: 'Data Element Group Set 4',
190
- * dataDimension: true,
191
- * shortName: 'DEGS4',
192
- * dataElementGroups: [],
193
- * });
194
- * @example <caption>a dataValueSet</caption>
195
- * create('dataValueSets', {
196
- * dataElement: 'f7n9E0hX8qk',
197
- * period: '201401',
198
- * orgUnit: 'DiszpKrYNg8',
199
- * value: '12',
200
- * });
201
- * @example <caption>a dataValueSet with related dataValues</caption>
202
- * create('dataValueSets', {
203
- * dataSet: 'pBOMPrpg1QX',
204
- * completeDate: '2014-02-03',
205
- * period: '201401',
206
- * orgUnit: 'DiszpKrYNg8',
207
- * dataValues: [
208
- * {
209
- * dataElement: 'f7n9E0hX8qk',
210
- * value: '1',
211
- * },
212
- * {
213
- * dataElement: 'Ix2HsbDMLea',
214
- * value: '2',
215
- * },
216
- * {
217
- * dataElement: 'eY5ehpbEsB7',
218
- * value: '3',
219
- * },
220
- * ],
221
- * });
222
- * @example <caption>an enrollment</caption>
223
- * create('enrollments', {
224
- * trackedEntityInstance: 'bmshzEacgxa',
225
- * orgUnit: 'TSyzvBiovKh',
226
- * program: 'gZBxv9Ujxg0',
227
- * enrollmentDate: '2013-09-17',
228
- * incidentDate: '2013-09-17',
229
- * });
230
- */
231
- constructor(resourceType: string, data: any, options?: any, callback?: Function);
232
- }
233
115
  /**
234
116
  * Update data. A generic helper function to update a resource object of any type.
235
117
  * Updating an object requires to send `all required fields` or the `full body`
236
118
  * @public
237
- * @constructor
119
+ * @function
238
120
  * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
239
121
  * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
240
122
  * @param {Object} data - Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation.
@@ -364,147 +246,11 @@ export class create {
364
246
  * });
365
247
  */
366
248
  export function update(resourceType: string, path: string, data: any, options?: any, callback?: Function): Operation;
367
- export class update {
368
- /**
369
- * Update data. A generic helper function to update a resource object of any type.
370
- * Updating an object requires to send `all required fields` or the `full body`
371
- * @public
372
- * @constructor
373
- * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
374
- * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
375
- * @param {Object} data - Data to update. It requires to send `all required fields` or the `full body`. If you want `partial updates`, use `patch` operation.
376
- * @param {Object} [options] - 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.
377
- * @param {function} [callback] - Optional callback to handle the response
378
- * @returns {Operation}
379
- * @example <caption>a program</caption>
380
- * update('programs', 'qAZJCrNJK8H', {
381
- * name: '14e1aa02c3f0a31618e096f2c6d03bed',
382
- * shortName: '14e1aa02',
383
- * programType: 'WITHOUT_REGISTRATION',
384
- * });
385
- * @example <caption>an event</caption>
386
- * update('events', 'PVqUD2hvU4E', {
387
- * program: 'eBAyeGv0exc',
388
- * orgUnit: 'Ngelehun CHC',
389
- * status: 'COMPLETED',
390
- * storedBy: 'admin',
391
- * dataValues: [],
392
- * });
393
- * @example <caption>a trackedEntityInstance</caption>
394
- * update('trackedEntityInstances', 'IeQfgUtGPq2', {
395
- * created: '2015-08-06T21:12:37.256',
396
- * orgUnit: 'TSyzvBiovKh',
397
- * createdAtClient: '2015-08-06T21:12:37.256',
398
- * trackedEntityInstance: 'IeQfgUtGPq2',
399
- * lastUpdated: '2015-08-06T21:12:37.257',
400
- * trackedEntityType: 'nEenWmSyUEp',
401
- * inactive: false,
402
- * deleted: false,
403
- * featureType: 'NONE',
404
- * programOwners: [
405
- * {
406
- * ownerOrgUnit: 'TSyzvBiovKh',
407
- * program: 'IpHINAT79UW',
408
- * trackedEntityInstance: 'IeQfgUtGPq2',
409
- * },
410
- * ],
411
- * enrollments: [],
412
- * relationships: [],
413
- * attributes: [
414
- * {
415
- * lastUpdated: '2016-01-12T00:00:00.000',
416
- * displayName: 'Last name',
417
- * created: '2016-01-12T00:00:00.000',
418
- * valueType: 'TEXT',
419
- * attribute: 'zDhUuAYrxNC',
420
- * value: 'Russell',
421
- * },
422
- * {
423
- * lastUpdated: '2016-01-12T00:00:00.000',
424
- * code: 'MMD_PER_NAM',
425
- * displayName: 'First name',
426
- * created: '2016-01-12T00:00:00.000',
427
- * valueType: 'TEXT',
428
- * attribute: 'w75KJ2mc4zz',
429
- * value: 'Catherine',
430
- * },
431
- * ],
432
- * });
433
- * @example <caption>a dataSet</caption>
434
- * update('dataSets', 'lyLU2wR22tC', { name: 'OpenFN Data Set', periodType: 'Weekly' });
435
- * @example <caption>a dataSetNotification</caption>
436
- * update('dataSetNotificationTemplates', 'VbQBwdm1wVP', {
437
- * dataSetNotificationTrigger: 'DATA_SET_COMPLETION',
438
- * notificationRecipient: 'ORGANISATION_UNIT_CONTACT',
439
- * name: 'Notification',
440
- * messageTemplate: 'Hello Updated,
441
- * deliveryChannels: ['SMS'],
442
- * dataSets: [],
443
- * });
444
- * @example <caption>a dataElement</caption>
445
- * update('dataElements', 'FTRrcoaog83', {
446
- * aggregationType: 'SUM',
447
- * domainType: 'AGGREGATE',
448
- * valueType: 'NUMBER',
449
- * name: 'Paracetamol',
450
- * shortName: 'Para',
451
- * });
452
- * @example <caption>a dataElementGroup</caption>
453
- * update('dataElementGroups', 'QrprHT61XFk', {
454
- * name: 'Data Element Group 1',
455
- * dataElements: [],
456
- * });
457
- * @example <caption>a dataElementGroupSet</caption>
458
- * update('dataElementGroupSets', 'VxWloRvAze8', {
459
- * name: 'Data Element Group Set 4',
460
- * dataDimension: true,
461
- * shortName: 'DEGS4',
462
- * dataElementGroups: [],
463
- * });
464
- * @example <caption>a dataValueSet</caption>
465
- * update('dataValueSets', 'AsQj6cDsUq4', {
466
- * dataElement: 'f7n9E0hX8qk',
467
- * period: '201401',
468
- * orgUnit: 'DiszpKrYNg8',
469
- * value: '12',
470
- * });
471
- * @example <caption>a dataValueSet with related dataValues</caption>
472
- * update('dataValueSets', 'Ix2HsbDMLea', {
473
- * dataSet: 'pBOMPrpg1QX',
474
- * completeDate: '2014-02-03',
475
- * period: '201401',
476
- * orgUnit: 'DiszpKrYNg8',
477
- * dataValues: [
478
- * {
479
- * dataElement: 'f7n9E0hX8qk',
480
- * value: '1',
481
- * },
482
- * {
483
- * dataElement: 'Ix2HsbDMLea',
484
- * value: '2',
485
- * },
486
- * {
487
- * dataElement: 'eY5ehpbEsB7',
488
- * value: '3',
489
- * },
490
- * ],
491
- * });
492
- * @example <caption>a single enrollment</caption>
493
- * update('enrollments', 'CmsHzercTBa' {
494
- * trackedEntityInstance: 'bmshzEacgxa',
495
- * orgUnit: 'TSyzvBiovKh',
496
- * program: 'gZBxv9Ujxg0',
497
- * enrollmentDate: '2013-10-17',
498
- * incidentDate: '2013-10-17',
499
- * });
500
- */
501
- constructor(resourceType: string, path: string, data: any, options?: any, callback?: Function);
502
- }
503
249
  /**
504
250
  * Get data. Generic helper method for getting data of any kind from DHIS2.
505
251
  * - This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.`
506
252
  * @public
507
- * @constructor
253
+ * @function
508
254
  * @param {string} resourceType - The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc.
509
255
  * @param {Object} query - A query object that will limit what resources are retrieved when converted into request params.
510
256
  * @param {Object} [options] - Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use.
@@ -526,38 +272,10 @@ export class update {
526
272
  * });
527
273
  */
528
274
  export function get(resourceType: string, query: any, options?: any, callback?: Function): Operation;
529
- export class get {
530
- /**
531
- * Get data. Generic helper method for getting data of any kind from DHIS2.
532
- * - This can be used to get `DataValueSets`,`events`,`trackedEntityInstances`,`etc.`
533
- * @public
534
- * @constructor
535
- * @param {string} resourceType - The type of resource to get(use its `plural` name). E.g. `dataElements`, `trackedEntityInstances`,`organisationUnits`, etc.
536
- * @param {Object} query - A query object that will limit what resources are retrieved when converted into request params.
537
- * @param {Object} [options] - Optional `options` to define URL parameters via params beyond filters, request configuration (e.g. `auth`) and DHIS2 api version to use.
538
- * @param {function} [callback] - Optional callback to handle the response
539
- * @returns {Operation} state
540
- * @example <caption>all data values for the 'pBOMPrpg1QX' dataset</caption>
541
- * get('dataValueSets', {
542
- * dataSet: 'pBOMPrpg1QX',
543
- * orgUnit: 'DiszpKrYNg8',
544
- * period: '201401',
545
- * fields: '*',
546
- * });
547
- * @example <caption>all programs for an organization unit</caption>
548
- * get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' });
549
- * @example <caption>a single tracked entity instance by a unique external ID</caption>
550
- * get('trackedEntityInstances', {
551
- * ou: 'DiszpKrYNg8',
552
- * filter: ['flGbXLXCrEo:Eq:124', 'w75KJ2mc4zz:Eq:John'],
553
- * });
554
- */
555
- constructor(resourceType: string, query: any, options?: any, callback?: Function);
556
- }
557
275
  /**
558
276
  * 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.
559
277
  * @public
560
- * @constructor
278
+ * @function
561
279
  * @param {string} resourceType - The type of a resource to `upsert`. E.g. `trackedEntityInstances`
562
280
  * @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.
563
281
  * @param {Object} data - The data to use for update or create depending on the result of the query.
@@ -585,43 +303,10 @@ export function upsert(resourceType: string, query: any, data: any, options?: {
585
303
  requestConfig: object;
586
304
  params: object;
587
305
  }, callback?: Function): Operation;
588
- export class upsert {
589
- /**
590
- * 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.
591
- * @public
592
- * @constructor
593
- * @param {string} resourceType - The type of a resource to `upsert`. E.g. `trackedEntityInstances`
594
- * @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.
595
- * @param {Object} data - The data to use for update or create depending on the result of the query.
596
- * @param {{ apiVersion: object, requestConfig: object, params: object }} [options] - Optional configuration that will be applied to both the `get` and the `create` or `update` operations.
597
- * @param {function} [callback] - Optional callback to handle the response
598
- * @throws {RangeError} - Throws range error
599
- * @returns {Operation}
600
- * @example <caption>Example `expression.js` of upsert</caption>
601
- * upsert('trackedEntityInstances', {
602
- * ou: 'TSyzvBiovKh',
603
- * filter: ['w75KJ2mc4zz:Eq:Qassim'],
604
- * }, {
605
- * orgUnit: 'TSyzvBiovKh',
606
- * trackedEntityType: 'nEenWmSyUEp',
607
- * attributes: [
608
- * {
609
- * attribute: 'w75KJ2mc4zz',
610
- * value: 'Qassim',
611
- * },
612
- * ],
613
- * });
614
- */
615
- constructor(resourceType: string, query: any, data: any, options?: {
616
- apiVersion: object;
617
- requestConfig: object;
618
- params: object;
619
- }, callback?: Function);
620
- }
621
306
  /**
622
307
  * Discover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint.
623
308
  * @public
624
- * @constructor
309
+ * @function
625
310
  * @param {string} httpMethod - The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete`
626
311
  * @param {string} endpoint - The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets`
627
312
  * @returns {Operation}
@@ -629,25 +314,12 @@ export class upsert {
629
314
  * discover('post', '/trackedEntityInstances')
630
315
  */
631
316
  export function discover(httpMethod: string, endpoint: string): Operation;
632
- export class discover {
633
- /**
634
- * Discover `DHIS2` `api` `endpoint` `query parameters` and allowed `operators` for a given resource's endpoint.
635
- * @public
636
- * @constructor
637
- * @param {string} httpMethod - The HTTP to inspect parameter usage for a given endpoint, e.g., `get`, `post`,`put`,`patch`,`delete`
638
- * @param {string} endpoint - The path for a given endpoint. E.g. `/trackedEntityInstances` or `/dataValueSets`
639
- * @returns {Operation}
640
- * @example <caption>a list of parameters allowed on a given endpoint for specific http method</caption>
641
- * discover('post', '/trackedEntityInstances')
642
- */
643
- constructor(httpMethod: string, endpoint: string);
644
- }
645
317
  /**
646
318
  * Patch a record. A generic helper function to send partial updates on one or more object properties.
647
319
  * - You are not required to send the full body of object properties.
648
320
  * - This is useful for cases where you don't want or need to update all properties on a object.
649
321
  * @public
650
- * @constructor
322
+ * @function
651
323
  * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
652
324
  * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
653
325
  * @param {Object} data - Data to update. Include only the fields you want to update. E.g. `{name: "New Name"}`
@@ -658,28 +330,10 @@ export class discover {
658
330
  * patch('dataElements', 'FTRrcoaog83', { name: 'New Name' });
659
331
  */
660
332
  export function patch(resourceType: string, path: string, data: any, options?: any, callback?: Function): Operation;
661
- export class patch {
662
- /**
663
- * Patch a record. A generic helper function to send partial updates on one or more object properties.
664
- * - You are not required to send the full body of object properties.
665
- * - This is useful for cases where you don't want or need to update all properties on a object.
666
- * @public
667
- * @constructor
668
- * @param {string} resourceType - The type of resource to be updated. E.g. `dataElements`, `organisationUnits`, etc.
669
- * @param {string} path - The `id` or `path` to the `object` to be updated. E.g. `FTRrcoaog83` or `FTRrcoaog83/{collection-name}/{object-id}`
670
- * @param {Object} data - Data to update. Include only the fields you want to update. E.g. `{name: "New Name"}`
671
- * @param {Object} [options] - Optional configuration, including params for the update ({preheatCache: true, strategy: 'UPDATE', mergeMode: 'REPLACE'}). Defaults to `{operationName: 'patch', apiVersion: state.configuration.apiVersion, responseType: 'json'}`
672
- * @param {function} [callback] - Optional callback to handle the response
673
- * @returns {Operation}
674
- * @example <caption>a dataElement</caption>
675
- * patch('dataElements', 'FTRrcoaog83', { name: 'New Name' });
676
- */
677
- constructor(resourceType: string, path: string, data: any, options?: any, callback?: Function);
678
- }
679
333
  /**
680
334
  * Delete a record. A generic helper function to delete an object
681
335
  * @public
682
- * @constructor
336
+ * @function
683
337
  * @param {string} resourceType - The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc.
684
338
  * @param {string} path - Can be an `id` of an `object` or `path` to the `nested object` to `delete`.
685
339
  * @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}
@@ -694,96 +348,37 @@ export function destroy(resourceType: string, path: string, data?: any, options?
694
348
  operationName: string;
695
349
  resourceType: string;
696
350
  }, callback?: Function): Operation;
697
- export class destroy {
698
- /**
699
- * Delete a record. A generic helper function to delete an object
700
- * @public
701
- * @constructor
702
- * @param {string} resourceType - The type of resource to be deleted. E.g. `trackedEntityInstances`, `organisationUnits`, etc.
703
- * @param {string} path - Can be an `id` of an `object` or `path` to the `nested object` to `delete`.
704
- * @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}
705
- * @param {{apiVersion: number,operationName: string,resourceType: string}} [options] - 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'}`
706
- * @param {function} [callback] - Optional callback to handle the response
707
- * @returns {Operation}
708
- * @example <caption>a tracked entity instance</caption>
709
- * destroy('trackedEntityInstances', 'LcRd6Nyaq7T');
710
- */
711
- constructor(resourceType: string, path: string, data?: any, options?: {
712
- apiVersion: number;
713
- operationName: string;
714
- resourceType: string;
715
- }, callback?: Function);
716
- }
717
351
  /**
718
352
  * Gets an attribute value by its case-insensitive display name
719
353
  * @public
720
354
  * @example
721
355
  * findAttributeValue(state.data.trackedEntityInstances[0], 'first name')
722
- * @constructor
356
+ * @function
723
357
  * @param {Object} trackedEntityInstance - A tracked entity instance (TEI) object
724
358
  * @param {string} attributeDisplayName - The 'displayName' to search for in the TEI's attributes
725
359
  * @returns {string}
726
360
  */
727
361
  export function findAttributeValue(trackedEntityInstance: any, attributeDisplayName: string): string;
728
- export class findAttributeValue {
729
- /**
730
- * Gets an attribute value by its case-insensitive display name
731
- * @public
732
- * @example
733
- * findAttributeValue(state.data.trackedEntityInstances[0], 'first name')
734
- * @constructor
735
- * @param {Object} trackedEntityInstance - A tracked entity instance (TEI) object
736
- * @param {string} attributeDisplayName - The 'displayName' to search for in the TEI's attributes
737
- * @returns {string}
738
- */
739
- constructor(trackedEntityInstance: any, attributeDisplayName: string);
740
- }
741
362
  /**
742
363
  * Converts an attribute ID and value into a DSHI2 attribute object
743
364
  * @public
744
365
  * @example
745
366
  * attr('w75KJ2mc4zz', 'Elias')
746
- * @constructor
367
+ * @function
747
368
  * @param {string} attribute - A tracked entity instance (TEI) attribute ID.
748
369
  * @param {string} value - The value for that attribute.
749
370
  * @returns {object}
750
371
  */
751
372
  export function attr(attribute: string, value: string): object;
752
- export class attr {
753
- /**
754
- * Converts an attribute ID and value into a DSHI2 attribute object
755
- * @public
756
- * @example
757
- * attr('w75KJ2mc4zz', 'Elias')
758
- * @constructor
759
- * @param {string} attribute - A tracked entity instance (TEI) attribute ID.
760
- * @param {string} value - The value for that attribute.
761
- * @returns {object}
762
- */
763
- constructor(attribute: string, value: string);
764
- }
765
373
  /**
766
374
  * Converts a dataElement and value into a DSHI2 dataValue object
767
375
  * @public
768
376
  * @example
769
377
  * dv('f7n9E0hX8qk', 12)
770
- * @constructor
378
+ * @function
771
379
  * @param {string} dataElement - A data element ID.
772
380
  * @param {string} value - The value for that data element.
773
381
  * @returns {object}
774
382
  */
775
383
  export function dv(dataElement: string, value: string): object;
776
- export class dv {
777
- /**
778
- * Converts a dataElement and value into a DSHI2 dataValue object
779
- * @public
780
- * @example
781
- * dv('f7n9E0hX8qk', 12)
782
- * @constructor
783
- * @param {string} dataElement - A data element ID.
784
- * @param {string} value - The value for that data element.
785
- * @returns {object}
786
- */
787
- constructor(dataElement: string, value: string);
788
- }
789
384
  export { alterState, dataPath, dataValue, dateFns, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";