@openfn/language-dhis2 4.0.5 → 4.2.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 +125 -0
- package/dist/index.cjs +6 -0
- package/dist/index.js +6 -0
- package/package.json +2 -2
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -954,6 +954,59 @@
|
|
|
954
954
|
},
|
|
955
955
|
"valid": true
|
|
956
956
|
},
|
|
957
|
+
{
|
|
958
|
+
"name": "fnIf",
|
|
959
|
+
"params": [
|
|
960
|
+
"condition",
|
|
961
|
+
"operation"
|
|
962
|
+
],
|
|
963
|
+
"docs": {
|
|
964
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
965
|
+
"tags": [
|
|
966
|
+
{
|
|
967
|
+
"title": "public",
|
|
968
|
+
"description": null,
|
|
969
|
+
"type": null
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
"title": "example",
|
|
973
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
974
|
+
},
|
|
975
|
+
{
|
|
976
|
+
"title": "function",
|
|
977
|
+
"description": null,
|
|
978
|
+
"name": null
|
|
979
|
+
},
|
|
980
|
+
{
|
|
981
|
+
"title": "param",
|
|
982
|
+
"description": "The condition that returns true",
|
|
983
|
+
"type": {
|
|
984
|
+
"type": "NameExpression",
|
|
985
|
+
"name": "Boolean"
|
|
986
|
+
},
|
|
987
|
+
"name": "condition"
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
"title": "param",
|
|
991
|
+
"description": "The operation needed to be executed.",
|
|
992
|
+
"type": {
|
|
993
|
+
"type": "NameExpression",
|
|
994
|
+
"name": "Operation"
|
|
995
|
+
},
|
|
996
|
+
"name": "operation"
|
|
997
|
+
},
|
|
998
|
+
{
|
|
999
|
+
"title": "returns",
|
|
1000
|
+
"description": null,
|
|
1001
|
+
"type": {
|
|
1002
|
+
"type": "NameExpression",
|
|
1003
|
+
"name": "Operation"
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
]
|
|
1007
|
+
},
|
|
1008
|
+
"valid": true
|
|
1009
|
+
},
|
|
957
1010
|
{
|
|
958
1011
|
"name": "sourceValue",
|
|
959
1012
|
"params": [
|
|
@@ -1327,6 +1380,78 @@
|
|
|
1327
1380
|
]
|
|
1328
1381
|
},
|
|
1329
1382
|
"valid": true
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
"name": "group",
|
|
1386
|
+
"params": [
|
|
1387
|
+
"arrayOfObjects",
|
|
1388
|
+
"keyPath",
|
|
1389
|
+
"callback"
|
|
1390
|
+
],
|
|
1391
|
+
"docs": {
|
|
1392
|
+
"description": "Groups an array of objects by a specified key path.",
|
|
1393
|
+
"tags": [
|
|
1394
|
+
{
|
|
1395
|
+
"title": "public",
|
|
1396
|
+
"description": null,
|
|
1397
|
+
"type": null
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
"title": "example",
|
|
1401
|
+
"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 / ] }"
|
|
1402
|
+
},
|
|
1403
|
+
{
|
|
1404
|
+
"title": "function",
|
|
1405
|
+
"description": null,
|
|
1406
|
+
"name": null
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
"title": "param",
|
|
1410
|
+
"description": "The array of objects to be grouped.",
|
|
1411
|
+
"type": {
|
|
1412
|
+
"type": "TypeApplication",
|
|
1413
|
+
"expression": {
|
|
1414
|
+
"type": "NameExpression",
|
|
1415
|
+
"name": "Array"
|
|
1416
|
+
},
|
|
1417
|
+
"applications": [
|
|
1418
|
+
{
|
|
1419
|
+
"type": "NameExpression",
|
|
1420
|
+
"name": "Object"
|
|
1421
|
+
}
|
|
1422
|
+
]
|
|
1423
|
+
},
|
|
1424
|
+
"name": "arrayOfObjects"
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
"title": "param",
|
|
1428
|
+
"description": "The key path to group by.",
|
|
1429
|
+
"type": {
|
|
1430
|
+
"type": "NameExpression",
|
|
1431
|
+
"name": "string"
|
|
1432
|
+
},
|
|
1433
|
+
"name": "keyPath"
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
"title": "param",
|
|
1437
|
+
"description": "(Optional) Callback function",
|
|
1438
|
+
"type": {
|
|
1439
|
+
"type": "NameExpression",
|
|
1440
|
+
"name": "function"
|
|
1441
|
+
},
|
|
1442
|
+
"name": "callback"
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
"title": "returns",
|
|
1446
|
+
"description": null,
|
|
1447
|
+
"type": {
|
|
1448
|
+
"type": "NameExpression",
|
|
1449
|
+
"name": "Operation"
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
]
|
|
1453
|
+
},
|
|
1454
|
+
"valid": true
|
|
1330
1455
|
}
|
|
1331
1456
|
]
|
|
1332
1457
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,9 @@ __export(src_exports, {
|
|
|
41
41
|
fields: () => import_language_common3.fields,
|
|
42
42
|
findAttributeValue: () => findAttributeValue,
|
|
43
43
|
fn: () => import_language_common3.fn,
|
|
44
|
+
fnIf: () => import_language_common3.fnIf,
|
|
44
45
|
get: () => get,
|
|
46
|
+
group: () => import_language_common3.group,
|
|
45
47
|
http: () => import_language_common3.http,
|
|
46
48
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
47
49
|
merge: () => import_language_common3.merge,
|
|
@@ -214,7 +216,9 @@ __export(Adaptor_exports, {
|
|
|
214
216
|
fields: () => import_language_common3.fields,
|
|
215
217
|
findAttributeValue: () => findAttributeValue,
|
|
216
218
|
fn: () => import_language_common3.fn,
|
|
219
|
+
fnIf: () => import_language_common3.fnIf,
|
|
217
220
|
get: () => get,
|
|
221
|
+
group: () => import_language_common3.group,
|
|
218
222
|
http: () => import_language_common3.http,
|
|
219
223
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
220
224
|
merge: () => import_language_common3.merge,
|
|
@@ -561,7 +565,9 @@ var src_default = Adaptor_exports;
|
|
|
561
565
|
fields,
|
|
562
566
|
findAttributeValue,
|
|
563
567
|
fn,
|
|
568
|
+
fnIf,
|
|
564
569
|
get,
|
|
570
|
+
group,
|
|
565
571
|
http,
|
|
566
572
|
lastReferenceValue,
|
|
567
573
|
merge,
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,9 @@ __export(Adaptor_exports, {
|
|
|
165
165
|
fields: () => fields,
|
|
166
166
|
findAttributeValue: () => findAttributeValue,
|
|
167
167
|
fn: () => fn,
|
|
168
|
+
fnIf: () => fnIf,
|
|
168
169
|
get: () => get,
|
|
170
|
+
group: () => group,
|
|
169
171
|
http: () => http,
|
|
170
172
|
lastReferenceValue: () => lastReferenceValue,
|
|
171
173
|
merge: () => merge,
|
|
@@ -212,7 +214,9 @@ import {
|
|
|
212
214
|
field,
|
|
213
215
|
fields,
|
|
214
216
|
fn,
|
|
217
|
+
fnIf,
|
|
215
218
|
http,
|
|
219
|
+
group,
|
|
216
220
|
lastReferenceValue,
|
|
217
221
|
merge,
|
|
218
222
|
sourceValue
|
|
@@ -528,7 +532,9 @@ export {
|
|
|
528
532
|
fields,
|
|
529
533
|
findAttributeValue,
|
|
530
534
|
fn,
|
|
535
|
+
fnIf,
|
|
531
536
|
get,
|
|
537
|
+
group,
|
|
532
538
|
http,
|
|
533
539
|
lastReferenceValue,
|
|
534
540
|
merge,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-dhis2",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "DHIS2 Language Pack for OpenFn",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"configuration-schema.json"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@openfn/language-common": "^1.
|
|
27
|
+
"@openfn/language-common": "^1.15.0",
|
|
28
28
|
"axios": "^0.24.0",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
30
|
"qs": "^6.11.0"
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -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, 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";
|