@openfn/language-dhis2 4.1.0 → 5.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
@@ -924,15 +924,15 @@
924
924
  "description": null,
925
925
  "type": null
926
926
  },
927
- {
928
- "title": "example",
929
- "description": "fn(state => {\n // do some things to state\n return state;\n});"
930
- },
931
927
  {
932
928
  "title": "function",
933
929
  "description": null,
934
930
  "name": null
935
931
  },
932
+ {
933
+ "title": "example",
934
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
935
+ },
936
936
  {
937
937
  "title": "param",
938
938
  "description": "is the function",
@@ -968,15 +968,15 @@
968
968
  "description": null,
969
969
  "type": null
970
970
  },
971
- {
972
- "title": "example",
973
- "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
974
- },
975
971
  {
976
972
  "title": "function",
977
973
  "description": null,
978
974
  "name": null
979
975
  },
976
+ {
977
+ "title": "example",
978
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
979
+ },
980
980
  {
981
981
  "title": "param",
982
982
  "description": "The condition that returns true",
@@ -1020,15 +1020,15 @@
1020
1020
  "description": null,
1021
1021
  "type": null
1022
1022
  },
1023
- {
1024
- "title": "example",
1025
- "description": "sourceValue('$.key')"
1026
- },
1027
1023
  {
1028
1024
  "title": "function",
1029
1025
  "description": null,
1030
1026
  "name": null
1031
1027
  },
1028
+ {
1029
+ "title": "example",
1030
+ "description": "sourceValue('$.key')"
1031
+ },
1032
1032
  {
1033
1033
  "title": "param",
1034
1034
  "description": "JSONPath referencing a point in `state`.",
@@ -1063,15 +1063,15 @@
1063
1063
  "description": null,
1064
1064
  "type": null
1065
1065
  },
1066
- {
1067
- "title": "example",
1068
- "description": "dataPath('key')"
1069
- },
1070
1066
  {
1071
1067
  "title": "function",
1072
1068
  "description": null,
1073
1069
  "name": null
1074
1070
  },
1071
+ {
1072
+ "title": "example",
1073
+ "description": "dataPath('key')"
1074
+ },
1075
1075
  {
1076
1076
  "title": "param",
1077
1077
  "description": "JSONPath referencing a point in `data`.",
@@ -1106,15 +1106,15 @@
1106
1106
  "description": null,
1107
1107
  "type": null
1108
1108
  },
1109
- {
1110
- "title": "example",
1111
- "description": "dataValue('key')"
1112
- },
1113
1109
  {
1114
1110
  "title": "function",
1115
1111
  "description": null,
1116
1112
  "name": null
1117
1113
  },
1114
+ {
1115
+ "title": "example",
1116
+ "description": "dataValue('key')"
1117
+ },
1118
1118
  {
1119
1119
  "title": "param",
1120
1120
  "description": "JSONPath referencing a point in `data`.",
@@ -1149,15 +1149,15 @@
1149
1149
  "description": null,
1150
1150
  "type": null
1151
1151
  },
1152
- {
1153
- "title": "example",
1154
- "description": "lastReferenceValue('key')"
1155
- },
1156
1152
  {
1157
1153
  "title": "function",
1158
1154
  "description": null,
1159
1155
  "name": null
1160
1156
  },
1157
+ {
1158
+ "title": "example",
1159
+ "description": "lastReferenceValue('key')"
1160
+ },
1161
1161
  {
1162
1162
  "title": "param",
1163
1163
  "description": "JSONPath referencing a point in `references`.",
@@ -1193,15 +1193,15 @@
1193
1193
  "description": null,
1194
1194
  "type": null
1195
1195
  },
1196
- {
1197
- "title": "example",
1198
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
1199
- },
1200
1196
  {
1201
1197
  "title": "function",
1202
1198
  "description": null,
1203
1199
  "name": null
1204
1200
  },
1201
+ {
1202
+ "title": "example",
1203
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
1204
+ },
1205
1205
  {
1206
1206
  "title": "param",
1207
1207
  "description": "JSONPath referencing a point in `state`.",
@@ -1246,15 +1246,15 @@
1246
1246
  "description": null,
1247
1247
  "type": null
1248
1248
  },
1249
- {
1250
- "title": "example",
1251
- "description": "field('destination_field_name__c', 'value')"
1252
- },
1253
1249
  {
1254
1250
  "title": "function",
1255
1251
  "description": null,
1256
1252
  "name": null
1257
1253
  },
1254
+ {
1255
+ "title": "example",
1256
+ "description": "field('destination_field_name__c', 'value')"
1257
+ },
1258
1258
  {
1259
1259
  "title": "param",
1260
1260
  "description": "Name of the field",
@@ -1298,15 +1298,15 @@
1298
1298
  "description": null,
1299
1299
  "type": null
1300
1300
  },
1301
- {
1302
- "title": "example",
1303
- "description": "fields(list_of_fields)"
1304
- },
1305
1301
  {
1306
1302
  "title": "function",
1307
1303
  "description": null,
1308
1304
  "name": null
1309
1305
  },
1306
+ {
1307
+ "title": "example",
1308
+ "description": "fields(list_of_fields)"
1309
+ },
1310
1310
  {
1311
1311
  "title": "param",
1312
1312
  "description": "a list of fields",
@@ -1351,6 +1351,11 @@
1351
1351
  "description": null,
1352
1352
  "name": null
1353
1353
  },
1354
+ {
1355
+ "title": "public",
1356
+ "description": null,
1357
+ "type": null
1358
+ },
1354
1359
  {
1355
1360
  "title": "param",
1356
1361
  "description": null,
@@ -1380,6 +1385,83 @@
1380
1385
  ]
1381
1386
  },
1382
1387
  "valid": true
1388
+ },
1389
+ {
1390
+ "name": "group",
1391
+ "params": [
1392
+ "arrayOfObjects",
1393
+ "keyPath",
1394
+ "callback"
1395
+ ],
1396
+ "docs": {
1397
+ "description": "Groups an array of objects by a specified key path.",
1398
+ "tags": [
1399
+ {
1400
+ "title": "public",
1401
+ "description": null,
1402
+ "type": null
1403
+ },
1404
+ {
1405
+ "title": "example",
1406
+ "description": "const users = [\n { name: 'Alice', age: 25, city: 'New York' },\n { name: 'Bob', age: 30, city: 'San Francisco' },\n { name: 'Charlie', age: 25, city: 'New York' },\n { name: 'David', age: 30, city: 'San Francisco' }\n];\ngroup(users, 'city');\n// state is { data: { 'New York': [/Alice, Charlie/], 'San Francisco': [ /Bob, David / ] }"
1407
+ },
1408
+ {
1409
+ "title": "function",
1410
+ "description": null,
1411
+ "name": null
1412
+ },
1413
+ {
1414
+ "title": "public",
1415
+ "description": null,
1416
+ "type": null
1417
+ },
1418
+ {
1419
+ "title": "param",
1420
+ "description": "The array of objects to be grouped.",
1421
+ "type": {
1422
+ "type": "TypeApplication",
1423
+ "expression": {
1424
+ "type": "NameExpression",
1425
+ "name": "Array"
1426
+ },
1427
+ "applications": [
1428
+ {
1429
+ "type": "NameExpression",
1430
+ "name": "Object"
1431
+ }
1432
+ ]
1433
+ },
1434
+ "name": "arrayOfObjects"
1435
+ },
1436
+ {
1437
+ "title": "param",
1438
+ "description": "The key path to group by.",
1439
+ "type": {
1440
+ "type": "NameExpression",
1441
+ "name": "string"
1442
+ },
1443
+ "name": "keyPath"
1444
+ },
1445
+ {
1446
+ "title": "param",
1447
+ "description": "(Optional) Callback function",
1448
+ "type": {
1449
+ "type": "NameExpression",
1450
+ "name": "function"
1451
+ },
1452
+ "name": "callback"
1453
+ },
1454
+ {
1455
+ "title": "returns",
1456
+ "description": null,
1457
+ "type": {
1458
+ "type": "NameExpression",
1459
+ "name": "Operation"
1460
+ }
1461
+ }
1462
+ ]
1463
+ },
1464
+ "valid": true
1383
1465
  }
1384
1466
  ]
1385
1467
  }
package/dist/index.cjs CHANGED
@@ -43,6 +43,7 @@ __export(src_exports, {
43
43
  fn: () => import_language_common3.fn,
44
44
  fnIf: () => import_language_common3.fnIf,
45
45
  get: () => get,
46
+ group: () => import_language_common3.group,
46
47
  http: () => import_language_common3.http,
47
48
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
48
49
  merge: () => import_language_common3.merge,
@@ -217,6 +218,7 @@ __export(Adaptor_exports, {
217
218
  fn: () => import_language_common3.fn,
218
219
  fnIf: () => import_language_common3.fnIf,
219
220
  get: () => get,
221
+ group: () => import_language_common3.group,
220
222
  http: () => import_language_common3.http,
221
223
  lastReferenceValue: () => import_language_common3.lastReferenceValue,
222
224
  merge: () => import_language_common3.merge,
@@ -565,6 +567,7 @@ var src_default = Adaptor_exports;
565
567
  fn,
566
568
  fnIf,
567
569
  get,
570
+ group,
568
571
  http,
569
572
  lastReferenceValue,
570
573
  merge,
package/dist/index.js CHANGED
@@ -167,6 +167,7 @@ __export(Adaptor_exports, {
167
167
  fn: () => fn,
168
168
  fnIf: () => fnIf,
169
169
  get: () => get,
170
+ group: () => group,
170
171
  http: () => http,
171
172
  lastReferenceValue: () => lastReferenceValue,
172
173
  merge: () => merge,
@@ -215,6 +216,7 @@ import {
215
216
  fn,
216
217
  fnIf,
217
218
  http,
219
+ group,
218
220
  lastReferenceValue,
219
221
  merge,
220
222
  sourceValue
@@ -532,6 +534,7 @@ export {
532
534
  fn,
533
535
  fnIf,
534
536
  get,
537
+ group,
535
538
  http,
536
539
  lastReferenceValue,
537
540
  merge,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-dhis2",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "description": "DHIS2 Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -24,10 +24,10 @@
24
24
  "configuration-schema.json"
25
25
  ],
26
26
  "dependencies": {
27
- "@openfn/language-common": "^1.14.0",
28
27
  "axios": "^0.24.0",
29
28
  "lodash": "^4.17.21",
30
- "qs": "^6.11.0"
29
+ "qs": "^6.11.0",
30
+ "@openfn/language-common": "2.0.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "assertion-error": "2.0.0",
@@ -382,4 +382,4 @@ export function attr(attribute: string, value: string): object;
382
382
  * @returns {object}
383
383
  */
384
384
  export function dv(dataElement: string, value: string): object;
385
- export { alterState, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
385
+ export { alterState, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, http, group, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";