@openfn/language-kobotoolbox 2.1.0 → 2.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 +139 -0
- package/dist/index.cjs +6 -0
- package/dist/index.js +7 -1
- package/package.json +2 -3
- 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": [
|
|
@@ -472,6 +525,92 @@
|
|
|
472
525
|
]
|
|
473
526
|
},
|
|
474
527
|
"valid": true
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"name": "cursor",
|
|
531
|
+
"params": [
|
|
532
|
+
"value",
|
|
533
|
+
"options"
|
|
534
|
+
],
|
|
535
|
+
"docs": {
|
|
536
|
+
"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}",
|
|
537
|
+
"tags": [
|
|
538
|
+
{
|
|
539
|
+
"title": "public",
|
|
540
|
+
"description": null,
|
|
541
|
+
"type": null
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"title": "example",
|
|
545
|
+
"description": "cursor($.cursor, { defaultValue: 'today' })",
|
|
546
|
+
"caption": "Use a cursor from state if present, or else use the default value"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"title": "example",
|
|
550
|
+
"description": "cursor(22)",
|
|
551
|
+
"caption": "Use a pagination cursor"
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"title": "function",
|
|
555
|
+
"description": null,
|
|
556
|
+
"name": null
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"title": "param",
|
|
560
|
+
"description": "the cursor value. Usually an ISO date, natural language date, or page number",
|
|
561
|
+
"type": {
|
|
562
|
+
"type": "NameExpression",
|
|
563
|
+
"name": "any"
|
|
564
|
+
},
|
|
565
|
+
"name": "value"
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"title": "param",
|
|
569
|
+
"description": "options to control the cursor.",
|
|
570
|
+
"type": {
|
|
571
|
+
"type": "NameExpression",
|
|
572
|
+
"name": "object"
|
|
573
|
+
},
|
|
574
|
+
"name": "options"
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
"title": "param",
|
|
578
|
+
"description": "set the cursor key. Will persist through the whole run.",
|
|
579
|
+
"type": {
|
|
580
|
+
"type": "NameExpression",
|
|
581
|
+
"name": "string"
|
|
582
|
+
},
|
|
583
|
+
"name": "options.key"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"title": "param",
|
|
587
|
+
"description": "the value to use if value is falsy",
|
|
588
|
+
"type": {
|
|
589
|
+
"type": "NameExpression",
|
|
590
|
+
"name": "any"
|
|
591
|
+
},
|
|
592
|
+
"name": "options.defaultValue"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"title": "param",
|
|
596
|
+
"description": "custom formatter for the final cursor value",
|
|
597
|
+
"type": {
|
|
598
|
+
"type": "NameExpression",
|
|
599
|
+
"name": "Function"
|
|
600
|
+
},
|
|
601
|
+
"name": "options.format"
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
"title": "returns",
|
|
605
|
+
"description": null,
|
|
606
|
+
"type": {
|
|
607
|
+
"type": "NameExpression",
|
|
608
|
+
"name": "Operation"
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
]
|
|
612
|
+
},
|
|
613
|
+
"valid": false
|
|
475
614
|
}
|
|
476
615
|
]
|
|
477
616
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var src_exports = {};
|
|
21
21
|
__export(src_exports, {
|
|
22
22
|
alterState: () => import_language_common2.alterState,
|
|
23
|
+
cursor: () => import_language_common2.cursor,
|
|
23
24
|
dataPath: () => import_language_common2.dataPath,
|
|
24
25
|
dataValue: () => import_language_common2.dataValue,
|
|
25
26
|
default: () => src_default,
|
|
@@ -28,6 +29,7 @@ __export(src_exports, {
|
|
|
28
29
|
field: () => import_language_common2.field,
|
|
29
30
|
fields: () => import_language_common2.fields,
|
|
30
31
|
fn: () => import_language_common2.fn,
|
|
32
|
+
fnIf: () => import_language_common2.fnIf,
|
|
31
33
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
32
34
|
getForms: () => getForms,
|
|
33
35
|
getSubmissions: () => getSubmissions,
|
|
@@ -42,6 +44,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
42
44
|
var Adaptor_exports = {};
|
|
43
45
|
__export(Adaptor_exports, {
|
|
44
46
|
alterState: () => import_language_common2.alterState,
|
|
47
|
+
cursor: () => import_language_common2.cursor,
|
|
45
48
|
dataPath: () => import_language_common2.dataPath,
|
|
46
49
|
dataValue: () => import_language_common2.dataValue,
|
|
47
50
|
each: () => import_language_common2.each,
|
|
@@ -49,6 +52,7 @@ __export(Adaptor_exports, {
|
|
|
49
52
|
field: () => import_language_common2.field,
|
|
50
53
|
fields: () => import_language_common2.fields,
|
|
51
54
|
fn: () => import_language_common2.fn,
|
|
55
|
+
fnIf: () => import_language_common2.fnIf,
|
|
52
56
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
53
57
|
getForms: () => getForms,
|
|
54
58
|
getSubmissions: () => getSubmissions,
|
|
@@ -139,6 +143,7 @@ var src_default = Adaptor_exports;
|
|
|
139
143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
140
144
|
0 && (module.exports = {
|
|
141
145
|
alterState,
|
|
146
|
+
cursor,
|
|
142
147
|
dataPath,
|
|
143
148
|
dataValue,
|
|
144
149
|
each,
|
|
@@ -146,6 +151,7 @@ var src_default = Adaptor_exports;
|
|
|
146
151
|
field,
|
|
147
152
|
fields,
|
|
148
153
|
fn,
|
|
154
|
+
fnIf,
|
|
149
155
|
getDeploymentInfo,
|
|
150
156
|
getForms,
|
|
151
157
|
getSubmissions,
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var __export = (target, all) => {
|
|
|
8
8
|
var Adaptor_exports = {};
|
|
9
9
|
__export(Adaptor_exports, {
|
|
10
10
|
alterState: () => alterState,
|
|
11
|
+
cursor: () => cursor,
|
|
11
12
|
dataPath: () => dataPath,
|
|
12
13
|
dataValue: () => dataValue,
|
|
13
14
|
each: () => each,
|
|
@@ -15,6 +16,7 @@ __export(Adaptor_exports, {
|
|
|
15
16
|
field: () => field,
|
|
16
17
|
fields: () => fields,
|
|
17
18
|
fn: () => fn,
|
|
19
|
+
fnIf: () => fnIf,
|
|
18
20
|
getDeploymentInfo: () => getDeploymentInfo,
|
|
19
21
|
getForms: () => getForms,
|
|
20
22
|
getSubmissions: () => getSubmissions,
|
|
@@ -30,13 +32,15 @@ import {
|
|
|
30
32
|
http
|
|
31
33
|
} from "@openfn/language-common";
|
|
32
34
|
import {
|
|
33
|
-
fn,
|
|
34
35
|
alterState,
|
|
36
|
+
cursor,
|
|
35
37
|
dataPath,
|
|
36
38
|
dataValue,
|
|
37
39
|
each,
|
|
38
40
|
field,
|
|
39
41
|
fields,
|
|
42
|
+
fn,
|
|
43
|
+
fnIf,
|
|
40
44
|
http as http2,
|
|
41
45
|
lastReferenceValue,
|
|
42
46
|
merge,
|
|
@@ -121,6 +125,7 @@ function getDeploymentInfo(params, callback) {
|
|
|
121
125
|
var src_default = Adaptor_exports;
|
|
122
126
|
export {
|
|
123
127
|
alterState,
|
|
128
|
+
cursor,
|
|
124
129
|
dataPath,
|
|
125
130
|
dataValue,
|
|
126
131
|
src_default as default,
|
|
@@ -129,6 +134,7 @@ export {
|
|
|
129
134
|
field,
|
|
130
135
|
fields,
|
|
131
136
|
fn,
|
|
137
|
+
fnIf,
|
|
132
138
|
getDeploymentInfo,
|
|
133
139
|
getForms,
|
|
134
140
|
getSubmissions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-kobotoolbox",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A Kobo Toolbox Language Pack for OpenFn",
|
|
5
5
|
"homepage": "https://docs.openfn.org",
|
|
6
6
|
"repository": {
|
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
"configuration-schema.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@openfn/language-common": "^1.
|
|
20
|
+
"@openfn/language-common": "^1.14.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@openfn/buildtools": "^1.0.2",
|
|
24
23
|
"assertion-error": "^1.0.1",
|
|
25
24
|
"chai": "^3.4.0",
|
|
26
25
|
"deep-eql": "^0.1.3",
|
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 {
|
|
54
|
+
export { alterState, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|