@openfn/language-dhis2 6.2.0 → 6.3.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 +7 -0
- package/dist/index.js +6 -0
- package/package.json +1 -1
- package/types/Adaptor.d.ts +11 -0
package/ast.json
CHANGED
|
@@ -891,6 +891,59 @@
|
|
|
891
891
|
},
|
|
892
892
|
"valid": true
|
|
893
893
|
},
|
|
894
|
+
{
|
|
895
|
+
"name": "findAttributeValueById",
|
|
896
|
+
"params": [
|
|
897
|
+
"trackedEntity",
|
|
898
|
+
"attributeUid"
|
|
899
|
+
],
|
|
900
|
+
"docs": {
|
|
901
|
+
"description": "Gets an attribute value by its uid",
|
|
902
|
+
"tags": [
|
|
903
|
+
{
|
|
904
|
+
"title": "public",
|
|
905
|
+
"description": null,
|
|
906
|
+
"type": null
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
"title": "example",
|
|
910
|
+
"description": "findAttributeValueById(state.tei, 'y1w2R6leVmh')"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
"title": "function",
|
|
914
|
+
"description": null,
|
|
915
|
+
"name": null
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
"title": "param",
|
|
919
|
+
"description": "A tracked entity instance (TEI) object",
|
|
920
|
+
"type": {
|
|
921
|
+
"type": "NameExpression",
|
|
922
|
+
"name": "Object"
|
|
923
|
+
},
|
|
924
|
+
"name": "trackedEntity"
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
"title": "param",
|
|
928
|
+
"description": "The uid to search for in the TEI's attributes",
|
|
929
|
+
"type": {
|
|
930
|
+
"type": "NameExpression",
|
|
931
|
+
"name": "string"
|
|
932
|
+
},
|
|
933
|
+
"name": "attributeUid"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
"title": "returns",
|
|
937
|
+
"description": null,
|
|
938
|
+
"type": {
|
|
939
|
+
"type": "NameExpression",
|
|
940
|
+
"name": "string"
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
]
|
|
944
|
+
},
|
|
945
|
+
"valid": true
|
|
946
|
+
},
|
|
894
947
|
{
|
|
895
948
|
"name": "findAttributeValue",
|
|
896
949
|
"params": [
|
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(src_exports, {
|
|
|
41
41
|
field: () => import_language_common3.field,
|
|
42
42
|
fields: () => import_language_common3.fields,
|
|
43
43
|
findAttributeValue: () => findAttributeValue,
|
|
44
|
+
findAttributeValueById: () => findAttributeValueById,
|
|
44
45
|
fn: () => import_language_common3.fn,
|
|
45
46
|
fnIf: () => import_language_common3.fnIf,
|
|
46
47
|
get: () => get,
|
|
@@ -222,6 +223,7 @@ __export(Adaptor_exports, {
|
|
|
222
223
|
field: () => import_language_common3.field,
|
|
223
224
|
fields: () => import_language_common3.fields,
|
|
224
225
|
findAttributeValue: () => findAttributeValue,
|
|
226
|
+
findAttributeValueById: () => findAttributeValueById,
|
|
225
227
|
fn: () => import_language_common3.fn,
|
|
226
228
|
fnIf: () => import_language_common3.fnIf,
|
|
227
229
|
get: () => get,
|
|
@@ -618,6 +620,10 @@ function destroy(resourceType, path, data = null, options = {}, callback = false
|
|
|
618
620
|
});
|
|
619
621
|
};
|
|
620
622
|
}
|
|
623
|
+
function findAttributeValueById(trackedEntity, attributeUid) {
|
|
624
|
+
var _a, _b;
|
|
625
|
+
return (_b = (_a = trackedEntity == null ? void 0 : trackedEntity.attributes) == null ? void 0 : _a.find((a) => (a == null ? void 0 : a.attribute) == attributeUid)) == null ? void 0 : _b.value;
|
|
626
|
+
}
|
|
621
627
|
function findAttributeValue(trackedEntity, attributeDisplayName) {
|
|
622
628
|
var _a, _b;
|
|
623
629
|
return (_b = (_a = trackedEntity == null ? void 0 : trackedEntity.attributes) == null ? void 0 : _a.find(
|
|
@@ -681,6 +687,7 @@ var src_default = Adaptor_exports;
|
|
|
681
687
|
field,
|
|
682
688
|
fields,
|
|
683
689
|
findAttributeValue,
|
|
690
|
+
findAttributeValueById,
|
|
684
691
|
fn,
|
|
685
692
|
fnIf,
|
|
686
693
|
get,
|
package/dist/index.js
CHANGED
|
@@ -169,6 +169,7 @@ __export(Adaptor_exports, {
|
|
|
169
169
|
field: () => field,
|
|
170
170
|
fields: () => fields,
|
|
171
171
|
findAttributeValue: () => findAttributeValue,
|
|
172
|
+
findAttributeValueById: () => findAttributeValueById,
|
|
172
173
|
fn: () => fn,
|
|
173
174
|
fnIf: () => fnIf,
|
|
174
175
|
get: () => get,
|
|
@@ -581,6 +582,10 @@ function destroy(resourceType, path, data = null, options = {}, callback = false
|
|
|
581
582
|
});
|
|
582
583
|
};
|
|
583
584
|
}
|
|
585
|
+
function findAttributeValueById(trackedEntity, attributeUid) {
|
|
586
|
+
var _a, _b;
|
|
587
|
+
return (_b = (_a = trackedEntity == null ? void 0 : trackedEntity.attributes) == null ? void 0 : _a.find((a) => (a == null ? void 0 : a.attribute) == attributeUid)) == null ? void 0 : _b.value;
|
|
588
|
+
}
|
|
584
589
|
function findAttributeValue(trackedEntity, attributeDisplayName) {
|
|
585
590
|
var _a, _b;
|
|
586
591
|
return (_b = (_a = trackedEntity == null ? void 0 : trackedEntity.attributes) == null ? void 0 : _a.find(
|
|
@@ -644,6 +649,7 @@ export {
|
|
|
644
649
|
field,
|
|
645
650
|
fields,
|
|
646
651
|
findAttributeValue,
|
|
652
|
+
findAttributeValueById,
|
|
647
653
|
fn,
|
|
648
654
|
fnIf,
|
|
649
655
|
get,
|
package/package.json
CHANGED
package/types/Adaptor.d.ts
CHANGED
|
@@ -405,6 +405,17 @@ export function destroy(resourceType: string, path: string, data?: any, options?
|
|
|
405
405
|
operationName: string;
|
|
406
406
|
resourceType: string;
|
|
407
407
|
}, callback?: Function): Operation;
|
|
408
|
+
/**
|
|
409
|
+
* Gets an attribute value by its uid
|
|
410
|
+
* @public
|
|
411
|
+
* @example
|
|
412
|
+
* findAttributeValueById(state.tei, 'y1w2R6leVmh')
|
|
413
|
+
* @function
|
|
414
|
+
* @param {Object} trackedEntity - A tracked entity instance (TEI) object
|
|
415
|
+
* @param {string} attributeUid - The uid to search for in the TEI's attributes
|
|
416
|
+
* @returns {string}
|
|
417
|
+
*/
|
|
418
|
+
export function findAttributeValueById(trackedEntity: any, attributeUid: string): string;
|
|
408
419
|
/**
|
|
409
420
|
* Gets an attribute value by its case-insensitive display name
|
|
410
421
|
* @public
|