@openfn/language-dhis2 4.0.4 → 4.1.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 +53 -0
- package/dist/index.cjs +5 -2
- package/dist/index.js +5 -2
- 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": [
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __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,
|
|
45
46
|
http: () => import_language_common3.http,
|
|
46
47
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
@@ -146,7 +147,7 @@ var createHelper = (configuration = {}) => {
|
|
|
146
147
|
return response.data;
|
|
147
148
|
};
|
|
148
149
|
const getAttributes = async () => {
|
|
149
|
-
const url = generateUrl(configuration, {}, "
|
|
150
|
+
const url = generateUrl(configuration, {}, "trackedEntityAttributes");
|
|
150
151
|
const response = await get2(url);
|
|
151
152
|
return response.data;
|
|
152
153
|
};
|
|
@@ -182,7 +183,7 @@ var metadata = async (configuration = {}, helper) => {
|
|
|
182
183
|
})
|
|
183
184
|
)) ?? [];
|
|
184
185
|
const attributes = await helper.getAttributes() ?? [];
|
|
185
|
-
children.attributes = ((_b = attributes.
|
|
186
|
+
children.attributes = ((_b = attributes.trackedEntityAttributes) == null ? void 0 : _b.map(
|
|
186
187
|
(attr2) => (0, import_metadata.createEntity)(attr2.id, "attribute", {
|
|
187
188
|
datatype: "string",
|
|
188
189
|
label: attr2.displayName
|
|
@@ -214,6 +215,7 @@ __export(Adaptor_exports, {
|
|
|
214
215
|
fields: () => import_language_common3.fields,
|
|
215
216
|
findAttributeValue: () => findAttributeValue,
|
|
216
217
|
fn: () => import_language_common3.fn,
|
|
218
|
+
fnIf: () => import_language_common3.fnIf,
|
|
217
219
|
get: () => get,
|
|
218
220
|
http: () => import_language_common3.http,
|
|
219
221
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
@@ -561,6 +563,7 @@ var src_default = Adaptor_exports;
|
|
|
561
563
|
fields,
|
|
562
564
|
findAttributeValue,
|
|
563
565
|
fn,
|
|
566
|
+
fnIf,
|
|
564
567
|
get,
|
|
565
568
|
http,
|
|
566
569
|
lastReferenceValue,
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ var createHelper = (configuration = {}) => {
|
|
|
97
97
|
return response.data;
|
|
98
98
|
};
|
|
99
99
|
const getAttributes = async () => {
|
|
100
|
-
const url = generateUrl(configuration, {}, "
|
|
100
|
+
const url = generateUrl(configuration, {}, "trackedEntityAttributes");
|
|
101
101
|
const response = await get2(url);
|
|
102
102
|
return response.data;
|
|
103
103
|
};
|
|
@@ -133,7 +133,7 @@ var metadata = async (configuration = {}, helper) => {
|
|
|
133
133
|
})
|
|
134
134
|
)) ?? [];
|
|
135
135
|
const attributes = await helper.getAttributes() ?? [];
|
|
136
|
-
children.attributes = ((_b = attributes.
|
|
136
|
+
children.attributes = ((_b = attributes.trackedEntityAttributes) == null ? void 0 : _b.map(
|
|
137
137
|
(attr2) => createEntity(attr2.id, "attribute", {
|
|
138
138
|
datatype: "string",
|
|
139
139
|
label: attr2.displayName
|
|
@@ -165,6 +165,7 @@ __export(Adaptor_exports, {
|
|
|
165
165
|
fields: () => fields,
|
|
166
166
|
findAttributeValue: () => findAttributeValue,
|
|
167
167
|
fn: () => fn,
|
|
168
|
+
fnIf: () => fnIf,
|
|
168
169
|
get: () => get,
|
|
169
170
|
http: () => http,
|
|
170
171
|
lastReferenceValue: () => lastReferenceValue,
|
|
@@ -212,6 +213,7 @@ import {
|
|
|
212
213
|
field,
|
|
213
214
|
fields,
|
|
214
215
|
fn,
|
|
216
|
+
fnIf,
|
|
215
217
|
http,
|
|
216
218
|
lastReferenceValue,
|
|
217
219
|
merge,
|
|
@@ -528,6 +530,7 @@ export {
|
|
|
528
530
|
fields,
|
|
529
531
|
findAttributeValue,
|
|
530
532
|
fn,
|
|
533
|
+
fnIf,
|
|
531
534
|
get,
|
|
532
535
|
http,
|
|
533
536
|
lastReferenceValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-dhis2",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.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.14.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, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|