@openfn/language-dhis2 5.0.5 → 5.0.7

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
@@ -14,6 +14,13 @@ core execute \
14
14
  -o ./tmp/output.json
15
15
  ```
16
16
 
17
+ > **Important Note:**
18
+ > This adaptor uses the old tracker version and is only compatible with DHIS2
19
+ > API versions before 42 (2.42). For later API versions and the new tracker, use
20
+ > adaptor 6.0+. See
21
+ > [DHIS2 documentation](https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html)
22
+ > for more information.
23
+
17
24
  ## Documentation
18
25
 
19
26
  View the [docs site](https://docs.openfn.org/adaptors/packages/dhis2-docs) for
package/ast.json CHANGED
@@ -1186,7 +1186,7 @@
1186
1186
  "operation"
1187
1187
  ],
1188
1188
  "docs": {
1189
- "description": "Scopes an array of data based on a JSONPath.\nUseful when the source data has `n` items you would like to map to\nan operation.\nThe operation will receive a slice of the data based of each item\nof the JSONPath provided.\n\nIt also ensures the results of an operation make their way back into\nthe state's references.",
1189
+ "description": "Iterates over an array of items and invokes an operation upon each one, where the state\nobject is _scoped_ so that state.data is the item under iteration.\nThe rest of the state object is untouched and can be referenced as usual.\nYou can pass an array directly, or use lazy state or a JSONPath string to\nreference a slice of state.",
1190
1190
  "tags": [
1191
1191
  {
1192
1192
  "title": "public",
@@ -1200,7 +1200,18 @@
1200
1200
  },
1201
1201
  {
1202
1202
  "title": "example",
1203
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
1203
+ "description": "each(\n $.data,\n // Inside the callback operation, `$.data` is scoped to the item under iteration\n insert(\"patient\", {\n patient_name: $.data.properties.case_name,\n patient_id: $.data.case_id,\n })\n);",
1204
+ "caption": "Using lazy state ($) to iterate over items in state.data and pass each into an \"insert\" operation"
1205
+ },
1206
+ {
1207
+ "title": "example",
1208
+ "description": "each(\n $.data,\n insert(\"patient\", (state) => ({\n patient_id: state.data.case_id,\n ...state.data\n }))\n);",
1209
+ "caption": "Iterate over items in state.data and pass each one into an \"insert\" operation"
1210
+ },
1211
+ {
1212
+ "title": "example",
1213
+ "description": "each(\n \"$.data[*]\",\n insert(\"patient\", (state) => ({\n patient_name: state.data.properties.case_name,\n patient_id: state.data.case_id,\n }))\n);",
1214
+ "caption": "Using JSON path to iterate over items in state.data and pass each one into an \"insert\" operation"
1204
1215
  },
1205
1216
  {
1206
1217
  "title": "param",
package/dist/index.cjs CHANGED
@@ -261,6 +261,12 @@ function execute(...operations) {
261
261
  data: null
262
262
  };
263
263
  return (state) => {
264
+ var _a;
265
+ const version = (_a = state.configuration) == null ? void 0 : _a.apiVersion;
266
+ if (+version >= 42)
267
+ console.warn(
268
+ `WARNING: This adaptor is incompatible with DHIS2 API version 42+. See here: https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html.`
269
+ );
264
270
  return (0, import_language_common2.execute)(
265
271
  configMigrationHelper,
266
272
  ...operations
package/dist/index.js CHANGED
@@ -228,6 +228,12 @@ function execute(...operations) {
228
228
  data: null
229
229
  };
230
230
  return (state) => {
231
+ var _a;
232
+ const version = (_a = state.configuration) == null ? void 0 : _a.apiVersion;
233
+ if (+version >= 42)
234
+ console.warn(
235
+ `WARNING: This adaptor is incompatible with DHIS2 API version 42+. See here: https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/tracker.html.`
236
+ );
231
237
  return commonExecute(
232
238
  configMigrationHelper,
233
239
  ...operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-dhis2",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "DHIS2 Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "axios": "^1.7.7",
29
29
  "lodash": "^4.17.21",
30
30
  "qs": "^6.11.0",
31
- "@openfn/language-common": "2.1.0"
31
+ "@openfn/language-common": "2.1.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "assertion-error": "2.0.0",