@openfn/language-commcare 2.3.0 → 3.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 +183 -44
- package/package.json +3 -5
- package/types/Adaptor.d.ts +4 -64
package/ast.json
CHANGED
|
@@ -1,5 +1,139 @@
|
|
|
1
1
|
{
|
|
2
2
|
"operations": [
|
|
3
|
+
{
|
|
4
|
+
"name": "execute",
|
|
5
|
+
"params": [
|
|
6
|
+
"operations"
|
|
7
|
+
],
|
|
8
|
+
"docs": {
|
|
9
|
+
"description": "Queries provided to the GET request",
|
|
10
|
+
"tags": [
|
|
11
|
+
{
|
|
12
|
+
"title": "typedef",
|
|
13
|
+
"description": null,
|
|
14
|
+
"type": {
|
|
15
|
+
"type": "NameExpression",
|
|
16
|
+
"name": "Object"
|
|
17
|
+
},
|
|
18
|
+
"name": "RequestQueries"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"title": "public",
|
|
22
|
+
"description": null,
|
|
23
|
+
"type": null
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"title": "property",
|
|
27
|
+
"description": "The maximum number of records to return. Default: 20. Maximum: 5000.",
|
|
28
|
+
"type": {
|
|
29
|
+
"type": "NameExpression",
|
|
30
|
+
"name": "number"
|
|
31
|
+
},
|
|
32
|
+
"name": "limit"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"title": "property",
|
|
36
|
+
"description": "The number of records to offset in the results. Default: 0",
|
|
37
|
+
"type": {
|
|
38
|
+
"type": "NameExpression",
|
|
39
|
+
"name": "number"
|
|
40
|
+
},
|
|
41
|
+
"name": "offset"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"title": "property",
|
|
45
|
+
"description": "Optional form XML namespace. See the [Commcare Docs](https://dimagi.atlassian.net/wiki/spaces/commcarepublic/pages/2143979045/Finding+a+Form%27s+XMLNS)",
|
|
46
|
+
"type": {
|
|
47
|
+
"type": "NameExpression",
|
|
48
|
+
"name": "string"
|
|
49
|
+
},
|
|
50
|
+
"name": "xmlns"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"title": "property",
|
|
54
|
+
"description": "Optional date (and time). Will return only forms that have had data modified since the passed in date.",
|
|
55
|
+
"type": {
|
|
56
|
+
"type": "NameExpression",
|
|
57
|
+
"name": "string"
|
|
58
|
+
},
|
|
59
|
+
"name": "indexed_on_start"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"title": "property",
|
|
63
|
+
"description": "Optional date (and time). Will return only forms that have had data modified before the passed in date.",
|
|
64
|
+
"type": {
|
|
65
|
+
"type": "NameExpression",
|
|
66
|
+
"name": "string"
|
|
67
|
+
},
|
|
68
|
+
"name": "indexed_on_end"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"title": "property",
|
|
72
|
+
"description": "Optional date (and time). Will return only forms that were received after the passed in date.",
|
|
73
|
+
"type": {
|
|
74
|
+
"type": "NameExpression",
|
|
75
|
+
"name": "string"
|
|
76
|
+
},
|
|
77
|
+
"name": "received_on_start"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"title": "property",
|
|
81
|
+
"description": "Optional date (and time). Will return only forms that were received before the passed in date.",
|
|
82
|
+
"type": {
|
|
83
|
+
"type": "NameExpression",
|
|
84
|
+
"name": "string"
|
|
85
|
+
},
|
|
86
|
+
"name": "received_on_end"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"title": "property",
|
|
90
|
+
"description": "The returned records will be limited to the application defined",
|
|
91
|
+
"type": {
|
|
92
|
+
"type": "NameExpression",
|
|
93
|
+
"name": "string"
|
|
94
|
+
},
|
|
95
|
+
"name": "app_id"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"title": "property",
|
|
99
|
+
"description": "A case UUID. Will only return forms which updated that case.",
|
|
100
|
+
"type": {
|
|
101
|
+
"type": "NameExpression",
|
|
102
|
+
"name": "string"
|
|
103
|
+
},
|
|
104
|
+
"name": "case_id"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"title": "property",
|
|
108
|
+
"description": "Optional user of group UUID used when getting cases",
|
|
109
|
+
"type": {
|
|
110
|
+
"type": "NameExpression",
|
|
111
|
+
"name": "string"
|
|
112
|
+
},
|
|
113
|
+
"name": "owner_id"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"title": "property",
|
|
117
|
+
"description": "Optional UUID for all cases last modified by that user",
|
|
118
|
+
"type": {
|
|
119
|
+
"type": "NameExpression",
|
|
120
|
+
"name": "string"
|
|
121
|
+
},
|
|
122
|
+
"name": "user_id"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"title": "property",
|
|
126
|
+
"description": "Optional case type to get all matching cases",
|
|
127
|
+
"type": {
|
|
128
|
+
"type": "NameExpression",
|
|
129
|
+
"name": "string"
|
|
130
|
+
},
|
|
131
|
+
"name": "type"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"valid": false
|
|
136
|
+
},
|
|
3
137
|
{
|
|
4
138
|
"name": "get",
|
|
5
139
|
"params": [
|
|
@@ -323,15 +457,15 @@
|
|
|
323
457
|
"description": null,
|
|
324
458
|
"type": null
|
|
325
459
|
},
|
|
326
|
-
{
|
|
327
|
-
"title": "example",
|
|
328
|
-
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
329
|
-
},
|
|
330
460
|
{
|
|
331
461
|
"title": "function",
|
|
332
462
|
"description": null,
|
|
333
463
|
"name": null
|
|
334
464
|
},
|
|
465
|
+
{
|
|
466
|
+
"title": "example",
|
|
467
|
+
"description": "fn(state => {\n // do some things to state\n return state;\n});"
|
|
468
|
+
},
|
|
335
469
|
{
|
|
336
470
|
"title": "param",
|
|
337
471
|
"description": "is the function",
|
|
@@ -367,15 +501,15 @@
|
|
|
367
501
|
"description": null,
|
|
368
502
|
"type": null
|
|
369
503
|
},
|
|
370
|
-
{
|
|
371
|
-
"title": "example",
|
|
372
|
-
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
373
|
-
},
|
|
374
504
|
{
|
|
375
505
|
"title": "function",
|
|
376
506
|
"description": null,
|
|
377
507
|
"name": null
|
|
378
508
|
},
|
|
509
|
+
{
|
|
510
|
+
"title": "example",
|
|
511
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
512
|
+
},
|
|
379
513
|
{
|
|
380
514
|
"title": "param",
|
|
381
515
|
"description": "The condition that returns true",
|
|
@@ -419,15 +553,15 @@
|
|
|
419
553
|
"description": null,
|
|
420
554
|
"type": null
|
|
421
555
|
},
|
|
422
|
-
{
|
|
423
|
-
"title": "example",
|
|
424
|
-
"description": "sourceValue('$.key')"
|
|
425
|
-
},
|
|
426
556
|
{
|
|
427
557
|
"title": "function",
|
|
428
558
|
"description": null,
|
|
429
559
|
"name": null
|
|
430
560
|
},
|
|
561
|
+
{
|
|
562
|
+
"title": "example",
|
|
563
|
+
"description": "sourceValue('$.key')"
|
|
564
|
+
},
|
|
431
565
|
{
|
|
432
566
|
"title": "param",
|
|
433
567
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -462,15 +596,15 @@
|
|
|
462
596
|
"description": null,
|
|
463
597
|
"type": null
|
|
464
598
|
},
|
|
465
|
-
{
|
|
466
|
-
"title": "example",
|
|
467
|
-
"description": "dataPath('key')"
|
|
468
|
-
},
|
|
469
599
|
{
|
|
470
600
|
"title": "function",
|
|
471
601
|
"description": null,
|
|
472
602
|
"name": null
|
|
473
603
|
},
|
|
604
|
+
{
|
|
605
|
+
"title": "example",
|
|
606
|
+
"description": "dataPath('key')"
|
|
607
|
+
},
|
|
474
608
|
{
|
|
475
609
|
"title": "param",
|
|
476
610
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -505,15 +639,15 @@
|
|
|
505
639
|
"description": null,
|
|
506
640
|
"type": null
|
|
507
641
|
},
|
|
508
|
-
{
|
|
509
|
-
"title": "example",
|
|
510
|
-
"description": "dataValue('key')"
|
|
511
|
-
},
|
|
512
642
|
{
|
|
513
643
|
"title": "function",
|
|
514
644
|
"description": null,
|
|
515
645
|
"name": null
|
|
516
646
|
},
|
|
647
|
+
{
|
|
648
|
+
"title": "example",
|
|
649
|
+
"description": "dataValue('key')"
|
|
650
|
+
},
|
|
517
651
|
{
|
|
518
652
|
"title": "param",
|
|
519
653
|
"description": "JSONPath referencing a point in `data`.",
|
|
@@ -548,15 +682,15 @@
|
|
|
548
682
|
"description": null,
|
|
549
683
|
"type": null
|
|
550
684
|
},
|
|
551
|
-
{
|
|
552
|
-
"title": "example",
|
|
553
|
-
"description": "lastReferenceValue('key')"
|
|
554
|
-
},
|
|
555
685
|
{
|
|
556
686
|
"title": "function",
|
|
557
687
|
"description": null,
|
|
558
688
|
"name": null
|
|
559
689
|
},
|
|
690
|
+
{
|
|
691
|
+
"title": "example",
|
|
692
|
+
"description": "lastReferenceValue('key')"
|
|
693
|
+
},
|
|
560
694
|
{
|
|
561
695
|
"title": "param",
|
|
562
696
|
"description": "JSONPath referencing a point in `references`.",
|
|
@@ -592,15 +726,15 @@
|
|
|
592
726
|
"description": null,
|
|
593
727
|
"type": null
|
|
594
728
|
},
|
|
595
|
-
{
|
|
596
|
-
"title": "example",
|
|
597
|
-
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
598
|
-
},
|
|
599
729
|
{
|
|
600
730
|
"title": "function",
|
|
601
731
|
"description": null,
|
|
602
732
|
"name": null
|
|
603
733
|
},
|
|
734
|
+
{
|
|
735
|
+
"title": "example",
|
|
736
|
+
"description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
|
|
737
|
+
},
|
|
604
738
|
{
|
|
605
739
|
"title": "param",
|
|
606
740
|
"description": "JSONPath referencing a point in `state`.",
|
|
@@ -644,15 +778,15 @@
|
|
|
644
778
|
"description": null,
|
|
645
779
|
"type": null
|
|
646
780
|
},
|
|
647
|
-
{
|
|
648
|
-
"title": "example",
|
|
649
|
-
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
650
|
-
},
|
|
651
781
|
{
|
|
652
782
|
"title": "function",
|
|
653
783
|
"description": null,
|
|
654
784
|
"name": null
|
|
655
785
|
},
|
|
786
|
+
{
|
|
787
|
+
"title": "example",
|
|
788
|
+
"description": "combine(\n create('foo'),\n delete('bar')\n)"
|
|
789
|
+
},
|
|
656
790
|
{
|
|
657
791
|
"title": "param",
|
|
658
792
|
"description": "Operations to be performed.",
|
|
@@ -688,15 +822,15 @@
|
|
|
688
822
|
"description": null,
|
|
689
823
|
"type": null
|
|
690
824
|
},
|
|
691
|
-
{
|
|
692
|
-
"title": "example",
|
|
693
|
-
"description": "field('destination_field_name__c', 'value')"
|
|
694
|
-
},
|
|
695
825
|
{
|
|
696
826
|
"title": "function",
|
|
697
827
|
"description": null,
|
|
698
828
|
"name": null
|
|
699
829
|
},
|
|
830
|
+
{
|
|
831
|
+
"title": "example",
|
|
832
|
+
"description": "field('destination_field_name__c', 'value')"
|
|
833
|
+
},
|
|
700
834
|
{
|
|
701
835
|
"title": "param",
|
|
702
836
|
"description": "Name of the field",
|
|
@@ -740,15 +874,15 @@
|
|
|
740
874
|
"description": null,
|
|
741
875
|
"type": null
|
|
742
876
|
},
|
|
743
|
-
{
|
|
744
|
-
"title": "example",
|
|
745
|
-
"description": "fields(list_of_fields)"
|
|
746
|
-
},
|
|
747
877
|
{
|
|
748
878
|
"title": "function",
|
|
749
879
|
"description": null,
|
|
750
880
|
"name": null
|
|
751
881
|
},
|
|
882
|
+
{
|
|
883
|
+
"title": "example",
|
|
884
|
+
"description": "fields(list_of_fields)"
|
|
885
|
+
},
|
|
752
886
|
{
|
|
753
887
|
"title": "param",
|
|
754
888
|
"description": "a list of fields",
|
|
@@ -793,6 +927,11 @@
|
|
|
793
927
|
"description": null,
|
|
794
928
|
"name": null
|
|
795
929
|
},
|
|
930
|
+
{
|
|
931
|
+
"title": "public",
|
|
932
|
+
"description": null,
|
|
933
|
+
"type": null
|
|
934
|
+
},
|
|
796
935
|
{
|
|
797
936
|
"title": "param",
|
|
798
937
|
"description": null,
|
|
@@ -837,15 +976,15 @@
|
|
|
837
976
|
"description": null,
|
|
838
977
|
"type": null
|
|
839
978
|
},
|
|
840
|
-
{
|
|
841
|
-
"title": "example",
|
|
842
|
-
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
843
|
-
},
|
|
844
979
|
{
|
|
845
980
|
"title": "function",
|
|
846
981
|
"description": null,
|
|
847
982
|
"name": null
|
|
848
983
|
},
|
|
984
|
+
{
|
|
985
|
+
"title": "example",
|
|
986
|
+
"description": "field(\"destination_string__c\", function(state) {\n return arrayToString(dataValue(\"path_of_array\")(state), ', ')\n})"
|
|
987
|
+
},
|
|
849
988
|
{
|
|
850
989
|
"title": "param",
|
|
851
990
|
"description": "Array of toString'able primatives.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-commcare",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Commcare Language Pack for OpenFn",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"js2xmlparser": "^1.0.0",
|
|
22
22
|
"lodash-fp": "^0.10.4",
|
|
23
23
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz",
|
|
24
|
-
"@openfn/language-common": "
|
|
24
|
+
"@openfn/language-common": "2.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@openfn/simple-ast": "^0.4.1",
|
|
@@ -30,9 +30,7 @@
|
|
|
30
30
|
"deep-eql": "^4.1.3",
|
|
31
31
|
"esno": "^0.16.3",
|
|
32
32
|
"mocha": "^9.2.2",
|
|
33
|
-
"
|
|
34
|
-
"rimraf": "^3.0.2",
|
|
35
|
-
"superagent-mock": "^4.0.0"
|
|
33
|
+
"rimraf": "^3.0.2"
|
|
36
34
|
},
|
|
37
35
|
"type": "module",
|
|
38
36
|
"types": "types/index.d.ts",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Queries provided to the GET request
|
|
3
3
|
* @typedef {Object} RequestQueries
|
|
4
|
+
* @public
|
|
4
5
|
* @property {number} limit - The maximum number of records to return. Default: 20. Maximum: 5000.
|
|
5
6
|
* @property {number} offset - The number of records to offset in the results. Default: 0
|
|
6
7
|
* @property {string} xmlns - Optional form XML namespace. See the [Commcare Docs](https://dimagi.atlassian.net/wiki/spaces/commcarepublic/pages/2143979045/Finding+a+Form%27s+XMLNS)
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
/**
|
|
18
19
|
* Queries provided to the submitXls request
|
|
19
20
|
* @typedef {Object} RequestOptions
|
|
21
|
+
* @public
|
|
20
22
|
* @property {string} case_type - Optional case type
|
|
21
23
|
* @property {string} search_field - Optional search field
|
|
22
24
|
* @property {string} create_new_cases - Optional for allowing to create new cases. Default `:on`
|
|
@@ -120,71 +122,9 @@ export function fetchReportData(reportId: string, params: RequestQueries, postUr
|
|
|
120
122
|
/**
|
|
121
123
|
* Queries provided to the GET request
|
|
122
124
|
*/
|
|
123
|
-
export type RequestQueries =
|
|
124
|
-
/**
|
|
125
|
-
* - The maximum number of records to return. Default: 20. Maximum: 5000.
|
|
126
|
-
*/
|
|
127
|
-
limit: number;
|
|
128
|
-
/**
|
|
129
|
-
* - The number of records to offset in the results. Default: 0
|
|
130
|
-
*/
|
|
131
|
-
offset: number;
|
|
132
|
-
/**
|
|
133
|
-
* - Optional form XML namespace. See the [Commcare Docs](https://dimagi.atlassian.net/wiki/spaces/commcarepublic/pages/2143979045/Finding+a+Form%27s+XMLNS)
|
|
134
|
-
*/
|
|
135
|
-
xmlns: string;
|
|
136
|
-
/**
|
|
137
|
-
* - Optional date (and time). Will return only forms that have had data modified since the passed in date.
|
|
138
|
-
*/
|
|
139
|
-
indexed_on_start: string;
|
|
140
|
-
/**
|
|
141
|
-
* - Optional date (and time). Will return only forms that have had data modified before the passed in date.
|
|
142
|
-
*/
|
|
143
|
-
indexed_on_end: string;
|
|
144
|
-
/**
|
|
145
|
-
* - Optional date (and time). Will return only forms that were received after the passed in date.
|
|
146
|
-
*/
|
|
147
|
-
received_on_start: string;
|
|
148
|
-
/**
|
|
149
|
-
* - Optional date (and time). Will return only forms that were received before the passed in date.
|
|
150
|
-
*/
|
|
151
|
-
received_on_end: string;
|
|
152
|
-
/**
|
|
153
|
-
* - The returned records will be limited to the application defined
|
|
154
|
-
*/
|
|
155
|
-
app_id: string;
|
|
156
|
-
/**
|
|
157
|
-
* - A case UUID. Will only return forms which updated that case.
|
|
158
|
-
*/
|
|
159
|
-
case_id: string;
|
|
160
|
-
/**
|
|
161
|
-
* - Optional user of group UUID used when getting cases
|
|
162
|
-
*/
|
|
163
|
-
owner_id: string;
|
|
164
|
-
/**
|
|
165
|
-
* - Optional UUID for all cases last modified by that user
|
|
166
|
-
*/
|
|
167
|
-
user_id: string;
|
|
168
|
-
/**
|
|
169
|
-
* - Optional case type to get all matching cases
|
|
170
|
-
*/
|
|
171
|
-
type: string;
|
|
172
|
-
};
|
|
125
|
+
export type RequestQueries = any;
|
|
173
126
|
/**
|
|
174
127
|
* Queries provided to the submitXls request
|
|
175
128
|
*/
|
|
176
|
-
export type RequestOptions =
|
|
177
|
-
/**
|
|
178
|
-
* - Optional case type
|
|
179
|
-
*/
|
|
180
|
-
case_type: string;
|
|
181
|
-
/**
|
|
182
|
-
* - Optional search field
|
|
183
|
-
*/
|
|
184
|
-
search_field: string;
|
|
185
|
-
/**
|
|
186
|
-
* - Optional for allowing to create new cases. Default `:on`
|
|
187
|
-
*/
|
|
188
|
-
create_new_cases: string;
|
|
189
|
-
};
|
|
129
|
+
export type RequestOptions = any;
|
|
190
130
|
export { fn, fnIf, alterState, arrayToString, combine, dataPath, dataValue, each, field, fields, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|