@openfn/language-kobotoolbox 2.2.0 → 2.4.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 +135 -1
- 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
|
@@ -99,6 +99,59 @@
|
|
|
99
99
|
},
|
|
100
100
|
"valid": true
|
|
101
101
|
},
|
|
102
|
+
{
|
|
103
|
+
"name": "fnIf",
|
|
104
|
+
"params": [
|
|
105
|
+
"condition",
|
|
106
|
+
"operation"
|
|
107
|
+
],
|
|
108
|
+
"docs": {
|
|
109
|
+
"description": "A custom operation that will only execute the function if the condition returns true",
|
|
110
|
+
"tags": [
|
|
111
|
+
{
|
|
112
|
+
"title": "public",
|
|
113
|
+
"description": null,
|
|
114
|
+
"type": null
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"title": "example",
|
|
118
|
+
"description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"title": "function",
|
|
122
|
+
"description": null,
|
|
123
|
+
"name": null
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"title": "param",
|
|
127
|
+
"description": "The condition that returns true",
|
|
128
|
+
"type": {
|
|
129
|
+
"type": "NameExpression",
|
|
130
|
+
"name": "Boolean"
|
|
131
|
+
},
|
|
132
|
+
"name": "condition"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"title": "param",
|
|
136
|
+
"description": "The operation needed to be executed.",
|
|
137
|
+
"type": {
|
|
138
|
+
"type": "NameExpression",
|
|
139
|
+
"name": "Operation"
|
|
140
|
+
},
|
|
141
|
+
"name": "operation"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"title": "returns",
|
|
145
|
+
"description": null,
|
|
146
|
+
"type": {
|
|
147
|
+
"type": "NameExpression",
|
|
148
|
+
"name": "Operation"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
"valid": true
|
|
154
|
+
},
|
|
102
155
|
{
|
|
103
156
|
"name": "sourceValue",
|
|
104
157
|
"params": [
|
|
@@ -473,6 +526,78 @@
|
|
|
473
526
|
},
|
|
474
527
|
"valid": true
|
|
475
528
|
},
|
|
529
|
+
{
|
|
530
|
+
"name": "group",
|
|
531
|
+
"params": [
|
|
532
|
+
"arrayOfObjects",
|
|
533
|
+
"keyPath",
|
|
534
|
+
"callback"
|
|
535
|
+
],
|
|
536
|
+
"docs": {
|
|
537
|
+
"description": "Groups an array of objects by a specified key path.",
|
|
538
|
+
"tags": [
|
|
539
|
+
{
|
|
540
|
+
"title": "public",
|
|
541
|
+
"description": null,
|
|
542
|
+
"type": null
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
"title": "example",
|
|
546
|
+
"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 / ] }"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"title": "function",
|
|
550
|
+
"description": null,
|
|
551
|
+
"name": null
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"title": "param",
|
|
555
|
+
"description": "The array of objects to be grouped.",
|
|
556
|
+
"type": {
|
|
557
|
+
"type": "TypeApplication",
|
|
558
|
+
"expression": {
|
|
559
|
+
"type": "NameExpression",
|
|
560
|
+
"name": "Array"
|
|
561
|
+
},
|
|
562
|
+
"applications": [
|
|
563
|
+
{
|
|
564
|
+
"type": "NameExpression",
|
|
565
|
+
"name": "Object"
|
|
566
|
+
}
|
|
567
|
+
]
|
|
568
|
+
},
|
|
569
|
+
"name": "arrayOfObjects"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"title": "param",
|
|
573
|
+
"description": "The key path to group by.",
|
|
574
|
+
"type": {
|
|
575
|
+
"type": "NameExpression",
|
|
576
|
+
"name": "string"
|
|
577
|
+
},
|
|
578
|
+
"name": "keyPath"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"title": "param",
|
|
582
|
+
"description": "(Optional) Callback function",
|
|
583
|
+
"type": {
|
|
584
|
+
"type": "NameExpression",
|
|
585
|
+
"name": "function"
|
|
586
|
+
},
|
|
587
|
+
"name": "callback"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
"title": "returns",
|
|
591
|
+
"description": null,
|
|
592
|
+
"type": {
|
|
593
|
+
"type": "NameExpression",
|
|
594
|
+
"name": "Operation"
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
},
|
|
599
|
+
"valid": true
|
|
600
|
+
},
|
|
476
601
|
{
|
|
477
602
|
"name": "cursor",
|
|
478
603
|
"params": [
|
|
@@ -480,7 +605,7 @@
|
|
|
480
605
|
"options"
|
|
481
606
|
],
|
|
482
607
|
"docs": {
|
|
483
|
-
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones
|
|
608
|
+
"description": "Sets a cursor property on state.\nSupports natural language dates like `now`, `today`, `yesterday`, `n hours ago`, `n days ago`, and `start`,\nwhich will be converted relative to the environment (ie, the Lightning or CLI locale). Custom timezones\nare not yet supported.\nYou can provide a formatter to customise the final cursor value, which is useful for normalising\ndifferent inputs. The custom formatter runs after natural language date conversion.\nSee the usage guide at {@link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
|
|
484
609
|
"tags": [
|
|
485
610
|
{
|
|
486
611
|
"title": "public",
|
|
@@ -538,6 +663,15 @@
|
|
|
538
663
|
},
|
|
539
664
|
"name": "options.defaultValue"
|
|
540
665
|
},
|
|
666
|
+
{
|
|
667
|
+
"title": "param",
|
|
668
|
+
"description": "custom formatter for the final cursor value",
|
|
669
|
+
"type": {
|
|
670
|
+
"type": "NameExpression",
|
|
671
|
+
"name": "Function"
|
|
672
|
+
},
|
|
673
|
+
"name": "options.format"
|
|
674
|
+
},
|
|
541
675
|
{
|
|
542
676
|
"title": "returns",
|
|
543
677
|
"description": null,
|
package/dist/index.cjs
CHANGED
|
@@ -29,9 +29,11 @@ __export(src_exports, {
|
|
|
29
29
|
field: () => import_language_common2.field,
|
|
30
30
|
fields: () => import_language_common2.fields,
|
|
31
31
|
fn: () => import_language_common2.fn,
|
|
32
|
+
fnIf: () => import_language_common2.fnIf,
|
|
32
33
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
33
34
|
getForms: () => getForms,
|
|
34
35
|
getSubmissions: () => getSubmissions,
|
|
36
|
+
group: () => import_language_common2.group,
|
|
35
37
|
http: () => import_language_common2.http,
|
|
36
38
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
37
39
|
merge: () => import_language_common2.merge,
|
|
@@ -51,9 +53,11 @@ __export(Adaptor_exports, {
|
|
|
51
53
|
field: () => import_language_common2.field,
|
|
52
54
|
fields: () => import_language_common2.fields,
|
|
53
55
|
fn: () => import_language_common2.fn,
|
|
56
|
+
fnIf: () => import_language_common2.fnIf,
|
|
54
57
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
55
58
|
getForms: () => getForms,
|
|
56
59
|
getSubmissions: () => getSubmissions,
|
|
60
|
+
group: () => import_language_common2.group,
|
|
57
61
|
http: () => import_language_common2.http,
|
|
58
62
|
lastReferenceValue: () => import_language_common2.lastReferenceValue,
|
|
59
63
|
merge: () => import_language_common2.merge,
|
|
@@ -149,9 +153,11 @@ var src_default = Adaptor_exports;
|
|
|
149
153
|
field,
|
|
150
154
|
fields,
|
|
151
155
|
fn,
|
|
156
|
+
fnIf,
|
|
152
157
|
getDeploymentInfo,
|
|
153
158
|
getForms,
|
|
154
159
|
getSubmissions,
|
|
160
|
+
group,
|
|
155
161
|
http,
|
|
156
162
|
lastReferenceValue,
|
|
157
163
|
merge,
|
package/dist/index.js
CHANGED
|
@@ -16,9 +16,11 @@ __export(Adaptor_exports, {
|
|
|
16
16
|
field: () => field,
|
|
17
17
|
fields: () => fields,
|
|
18
18
|
fn: () => fn,
|
|
19
|
+
fnIf: () => fnIf,
|
|
19
20
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
20
21
|
getForms: () => getForms,
|
|
21
22
|
getSubmissions: () => getSubmissions,
|
|
23
|
+
group: () => group,
|
|
22
24
|
http: () => http2,
|
|
23
25
|
lastReferenceValue: () => lastReferenceValue,
|
|
24
26
|
merge: () => merge,
|
|
@@ -39,7 +41,9 @@ import {
|
|
|
39
41
|
field,
|
|
40
42
|
fields,
|
|
41
43
|
fn,
|
|
44
|
+
fnIf,
|
|
42
45
|
http as http2,
|
|
46
|
+
group,
|
|
43
47
|
lastReferenceValue,
|
|
44
48
|
merge,
|
|
45
49
|
sourceValue
|
|
@@ -132,9 +136,11 @@ export {
|
|
|
132
136
|
field,
|
|
133
137
|
fields,
|
|
134
138
|
fn,
|
|
139
|
+
fnIf,
|
|
135
140
|
getDeploymentInfo,
|
|
136
141
|
getForms,
|
|
137
142
|
getSubmissions,
|
|
143
|
+
group,
|
|
138
144
|
http2 as http,
|
|
139
145
|
lastReferenceValue,
|
|
140
146
|
merge,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-kobotoolbox",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A Kobo Toolbox Language Pack for OpenFn",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"configuration-schema.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@openfn/language-common": "^1.
|
|
20
|
+
"@openfn/language-common": "^1.15.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"assertion-error": "^1.0.1",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -51,4 +51,4 @@ export function getSubmissions(params: object, callback: Function): Operation;
|
|
|
51
51
|
* @returns {Operation}
|
|
52
52
|
*/
|
|
53
53
|
export function getDeploymentInfo(params: object, callback: Function): Operation;
|
|
54
|
-
export { alterState, cursor, dataPath, dataValue, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|
|
54
|
+
export { alterState, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, group, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|