@openfn/language-kobotoolbox 2.3.0 → 2.4.1

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 CHANGED
@@ -52,6 +52,112 @@
52
52
  ]
53
53
  },
54
54
  "valid": true
55
+ },
56
+ {
57
+ "name": "getSubmissions",
58
+ "params": [
59
+ "params",
60
+ "callback"
61
+ ],
62
+ "docs": {
63
+ "description": "Get submissions for a specific form",
64
+ "tags": [
65
+ {
66
+ "title": "example",
67
+ "description": "getSubmissions({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\n console.log(state.data);\n return state;\n});"
68
+ },
69
+ {
70
+ "title": "function",
71
+ "description": null,
72
+ "name": null
73
+ },
74
+ {
75
+ "title": "public",
76
+ "description": null,
77
+ "type": null
78
+ },
79
+ {
80
+ "title": "param",
81
+ "description": "Form Id and data to make the fetch or filter",
82
+ "type": {
83
+ "type": "NameExpression",
84
+ "name": "object"
85
+ },
86
+ "name": "params"
87
+ },
88
+ {
89
+ "title": "param",
90
+ "description": "(Optional) Callback function to execute after fetching form submissions",
91
+ "type": {
92
+ "type": "NameExpression",
93
+ "name": "function"
94
+ },
95
+ "name": "callback"
96
+ },
97
+ {
98
+ "title": "returns",
99
+ "description": null,
100
+ "type": {
101
+ "type": "NameExpression",
102
+ "name": "Operation"
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ "valid": true
108
+ },
109
+ {
110
+ "name": "getDeploymentInfo",
111
+ "params": [
112
+ "params",
113
+ "callback"
114
+ ],
115
+ "docs": {
116
+ "description": "Get deployment information for a specific form",
117
+ "tags": [
118
+ {
119
+ "title": "example",
120
+ "description": "getDeploymentInfo({formId: 'aXecHjmbATuF6iGFmvBLBX'}, state => {\n console.log(state.data);\n return state;\n});"
121
+ },
122
+ {
123
+ "title": "function",
124
+ "description": null,
125
+ "name": null
126
+ },
127
+ {
128
+ "title": "public",
129
+ "description": null,
130
+ "type": null
131
+ },
132
+ {
133
+ "title": "param",
134
+ "description": "Form Id and data to make the fetch or filter",
135
+ "type": {
136
+ "type": "NameExpression",
137
+ "name": "object"
138
+ },
139
+ "name": "params"
140
+ },
141
+ {
142
+ "title": "param",
143
+ "description": "(Optional) Callback function to execute after fetching form deployment information",
144
+ "type": {
145
+ "type": "NameExpression",
146
+ "name": "function"
147
+ },
148
+ "name": "callback"
149
+ },
150
+ {
151
+ "title": "returns",
152
+ "description": null,
153
+ "type": {
154
+ "type": "NameExpression",
155
+ "name": "Operation"
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ "valid": true
55
161
  }
56
162
  ],
57
163
  "exports": [],
@@ -69,15 +175,15 @@
69
175
  "description": null,
70
176
  "type": null
71
177
  },
72
- {
73
- "title": "example",
74
- "description": "fn(state => {\n // do some things to state\n return state;\n});"
75
- },
76
178
  {
77
179
  "title": "function",
78
180
  "description": null,
79
181
  "name": null
80
182
  },
183
+ {
184
+ "title": "example",
185
+ "description": "fn(state => {\n // do some things to state\n return state;\n});"
186
+ },
81
187
  {
82
188
  "title": "param",
83
189
  "description": "is the function",
@@ -113,15 +219,15 @@
113
219
  "description": null,
114
220
  "type": null
115
221
  },
116
- {
117
- "title": "example",
118
- "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
119
- },
120
222
  {
121
223
  "title": "function",
122
224
  "description": null,
123
225
  "name": null
124
226
  },
227
+ {
228
+ "title": "example",
229
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
230
+ },
125
231
  {
126
232
  "title": "param",
127
233
  "description": "The condition that returns true",
@@ -165,15 +271,15 @@
165
271
  "description": null,
166
272
  "type": null
167
273
  },
168
- {
169
- "title": "example",
170
- "description": "sourceValue('$.key')"
171
- },
172
274
  {
173
275
  "title": "function",
174
276
  "description": null,
175
277
  "name": null
176
278
  },
279
+ {
280
+ "title": "example",
281
+ "description": "sourceValue('$.key')"
282
+ },
177
283
  {
178
284
  "title": "param",
179
285
  "description": "JSONPath referencing a point in `state`.",
@@ -208,15 +314,15 @@
208
314
  "description": null,
209
315
  "type": null
210
316
  },
211
- {
212
- "title": "example",
213
- "description": "dataPath('key')"
214
- },
215
317
  {
216
318
  "title": "function",
217
319
  "description": null,
218
320
  "name": null
219
321
  },
322
+ {
323
+ "title": "example",
324
+ "description": "dataPath('key')"
325
+ },
220
326
  {
221
327
  "title": "param",
222
328
  "description": "JSONPath referencing a point in `data`.",
@@ -251,15 +357,15 @@
251
357
  "description": null,
252
358
  "type": null
253
359
  },
254
- {
255
- "title": "example",
256
- "description": "dataValue('key')"
257
- },
258
360
  {
259
361
  "title": "function",
260
362
  "description": null,
261
363
  "name": null
262
364
  },
365
+ {
366
+ "title": "example",
367
+ "description": "dataValue('key')"
368
+ },
263
369
  {
264
370
  "title": "param",
265
371
  "description": "JSONPath referencing a point in `data`.",
@@ -294,15 +400,15 @@
294
400
  "description": null,
295
401
  "type": null
296
402
  },
297
- {
298
- "title": "example",
299
- "description": "lastReferenceValue('key')"
300
- },
301
403
  {
302
404
  "title": "function",
303
405
  "description": null,
304
406
  "name": null
305
407
  },
408
+ {
409
+ "title": "example",
410
+ "description": "lastReferenceValue('key')"
411
+ },
306
412
  {
307
413
  "title": "param",
308
414
  "description": "JSONPath referencing a point in `references`.",
@@ -338,15 +444,15 @@
338
444
  "description": null,
339
445
  "type": null
340
446
  },
341
- {
342
- "title": "example",
343
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
344
- },
345
447
  {
346
448
  "title": "function",
347
449
  "description": null,
348
450
  "name": null
349
451
  },
452
+ {
453
+ "title": "example",
454
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
455
+ },
350
456
  {
351
457
  "title": "param",
352
458
  "description": "JSONPath referencing a point in `state`.",
@@ -391,15 +497,15 @@
391
497
  "description": null,
392
498
  "type": null
393
499
  },
394
- {
395
- "title": "example",
396
- "description": "field('destination_field_name__c', 'value')"
397
- },
398
500
  {
399
501
  "title": "function",
400
502
  "description": null,
401
503
  "name": null
402
504
  },
505
+ {
506
+ "title": "example",
507
+ "description": "field('destination_field_name__c', 'value')"
508
+ },
403
509
  {
404
510
  "title": "param",
405
511
  "description": "Name of the field",
@@ -443,15 +549,15 @@
443
549
  "description": null,
444
550
  "type": null
445
551
  },
446
- {
447
- "title": "example",
448
- "description": "fields(list_of_fields)"
449
- },
450
552
  {
451
553
  "title": "function",
452
554
  "description": null,
453
555
  "name": null
454
556
  },
557
+ {
558
+ "title": "example",
559
+ "description": "fields(list_of_fields)"
560
+ },
455
561
  {
456
562
  "title": "param",
457
563
  "description": "a list of fields",
@@ -496,6 +602,11 @@
496
602
  "description": null,
497
603
  "name": null
498
604
  },
605
+ {
606
+ "title": "public",
607
+ "description": null,
608
+ "type": null
609
+ },
499
610
  {
500
611
  "title": "param",
501
612
  "description": null,
@@ -526,6 +637,83 @@
526
637
  },
527
638
  "valid": true
528
639
  },
640
+ {
641
+ "name": "group",
642
+ "params": [
643
+ "arrayOfObjects",
644
+ "keyPath",
645
+ "callback"
646
+ ],
647
+ "docs": {
648
+ "description": "Groups an array of objects by a specified key path.",
649
+ "tags": [
650
+ {
651
+ "title": "public",
652
+ "description": null,
653
+ "type": null
654
+ },
655
+ {
656
+ "title": "example",
657
+ "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 / ] }"
658
+ },
659
+ {
660
+ "title": "function",
661
+ "description": null,
662
+ "name": null
663
+ },
664
+ {
665
+ "title": "public",
666
+ "description": null,
667
+ "type": null
668
+ },
669
+ {
670
+ "title": "param",
671
+ "description": "The array of objects to be grouped.",
672
+ "type": {
673
+ "type": "TypeApplication",
674
+ "expression": {
675
+ "type": "NameExpression",
676
+ "name": "Array"
677
+ },
678
+ "applications": [
679
+ {
680
+ "type": "NameExpression",
681
+ "name": "Object"
682
+ }
683
+ ]
684
+ },
685
+ "name": "arrayOfObjects"
686
+ },
687
+ {
688
+ "title": "param",
689
+ "description": "The key path to group by.",
690
+ "type": {
691
+ "type": "NameExpression",
692
+ "name": "string"
693
+ },
694
+ "name": "keyPath"
695
+ },
696
+ {
697
+ "title": "param",
698
+ "description": "(Optional) Callback function",
699
+ "type": {
700
+ "type": "NameExpression",
701
+ "name": "function"
702
+ },
703
+ "name": "callback"
704
+ },
705
+ {
706
+ "title": "returns",
707
+ "description": null,
708
+ "type": {
709
+ "type": "NameExpression",
710
+ "name": "Operation"
711
+ }
712
+ }
713
+ ]
714
+ },
715
+ "valid": true
716
+ },
529
717
  {
530
718
  "name": "cursor",
531
719
  "params": [
@@ -540,6 +728,11 @@
540
728
  "description": null,
541
729
  "type": null
542
730
  },
731
+ {
732
+ "title": "function",
733
+ "description": null,
734
+ "name": null
735
+ },
543
736
  {
544
737
  "title": "example",
545
738
  "description": "cursor($.cursor, { defaultValue: 'today' })",
@@ -550,11 +743,6 @@
550
743
  "description": "cursor(22)",
551
744
  "caption": "Use a pagination cursor"
552
745
  },
553
- {
554
- "title": "function",
555
- "description": null,
556
- "name": null
557
- },
558
746
  {
559
747
  "title": "param",
560
748
  "description": "the cursor value. Usually an ISO date, natural language date, or page number",
package/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(src_exports, {
33
33
  getDeploymentInfo: () => getDeploymentInfo,
34
34
  getForms: () => getForms,
35
35
  getSubmissions: () => getSubmissions,
36
+ group: () => import_language_common2.group,
36
37
  http: () => import_language_common2.http,
37
38
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
38
39
  merge: () => import_language_common2.merge,
@@ -56,6 +57,7 @@ __export(Adaptor_exports, {
56
57
  getDeploymentInfo: () => getDeploymentInfo,
57
58
  getForms: () => getForms,
58
59
  getSubmissions: () => getSubmissions,
60
+ group: () => import_language_common2.group,
59
61
  http: () => import_language_common2.http,
60
62
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
61
63
  merge: () => import_language_common2.merge,
@@ -155,6 +157,7 @@ var src_default = Adaptor_exports;
155
157
  getDeploymentInfo,
156
158
  getForms,
157
159
  getSubmissions,
160
+ group,
158
161
  http,
159
162
  lastReferenceValue,
160
163
  merge,
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ __export(Adaptor_exports, {
20
20
  getDeploymentInfo: () => getDeploymentInfo,
21
21
  getForms: () => getForms,
22
22
  getSubmissions: () => getSubmissions,
23
+ group: () => group,
23
24
  http: () => http2,
24
25
  lastReferenceValue: () => lastReferenceValue,
25
26
  merge: () => merge,
@@ -42,6 +43,7 @@ import {
42
43
  fn,
43
44
  fnIf,
44
45
  http as http2,
46
+ group,
45
47
  lastReferenceValue,
46
48
  merge,
47
49
  sourceValue
@@ -138,6 +140,7 @@ export {
138
140
  getDeploymentInfo,
139
141
  getForms,
140
142
  getSubmissions,
143
+ group,
141
144
  http2 as http,
142
145
  lastReferenceValue,
143
146
  merge,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-kobotoolbox",
3
- "version": "2.3.0",
3
+ "version": "2.4.1",
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.14.0"
20
+ "@openfn/language-common": "^1.15.1"
21
21
  },
22
22
  "devDependencies": {
23
23
  "assertion-error": "^1.0.1",
@@ -33,6 +33,7 @@ export function getForms(params: object, callback: Function): Operation;
33
33
  * return state;
34
34
  * });
35
35
  * @function
36
+ * @public
36
37
  * @param {object} params - Form Id and data to make the fetch or filter
37
38
  * @param {function} callback - (Optional) Callback function to execute after fetching form submissions
38
39
  * @returns {Operation}
@@ -46,9 +47,10 @@ export function getSubmissions(params: object, callback: Function): Operation;
46
47
  * return state;
47
48
  * });
48
49
  * @function
50
+ * @public
49
51
  * @param {object} params - Form Id and data to make the fetch or filter
50
52
  * @param {function} callback - (Optional) Callback function to execute after fetching form deployment information
51
53
  * @returns {Operation}
52
54
  */
53
55
  export function getDeploymentInfo(params: object, callback: Function): Operation;
54
- export { alterState, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
56
+ export { alterState, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, group, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";