@openfn/language-kobotoolbox 2.2.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 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": [
@@ -480,7 +533,7 @@
480
533
  "options"
481
534
  ],
482
535
  "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 \nare not yet supported.\nSee the usage guide at @{link https://docs.openfn.org/documentation/jobs/job-writing-guide#using-cursors}",
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}",
484
537
  "tags": [
485
538
  {
486
539
  "title": "public",
@@ -538,6 +591,15 @@
538
591
  },
539
592
  "name": "options.defaultValue"
540
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
+ },
541
603
  {
542
604
  "title": "returns",
543
605
  "description": null,
package/dist/index.cjs CHANGED
@@ -29,6 +29,7 @@ __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,
@@ -51,6 +52,7 @@ __export(Adaptor_exports, {
51
52
  field: () => import_language_common2.field,
52
53
  fields: () => import_language_common2.fields,
53
54
  fn: () => import_language_common2.fn,
55
+ fnIf: () => import_language_common2.fnIf,
54
56
  getDeploymentInfo: () => getDeploymentInfo,
55
57
  getForms: () => getForms,
56
58
  getSubmissions: () => getSubmissions,
@@ -149,6 +151,7 @@ var src_default = Adaptor_exports;
149
151
  field,
150
152
  fields,
151
153
  fn,
154
+ fnIf,
152
155
  getDeploymentInfo,
153
156
  getForms,
154
157
  getSubmissions,
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ __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,
@@ -39,6 +40,7 @@ import {
39
40
  field,
40
41
  fields,
41
42
  fn,
43
+ fnIf,
42
44
  http as http2,
43
45
  lastReferenceValue,
44
46
  merge,
@@ -132,6 +134,7 @@ export {
132
134
  field,
133
135
  fields,
134
136
  fn,
137
+ fnIf,
135
138
  getDeploymentInfo,
136
139
  getForms,
137
140
  getSubmissions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-kobotoolbox",
3
- "version": "2.2.0",
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,7 +17,7 @@
17
17
  "configuration-schema.json"
18
18
  ],
19
19
  "dependencies": {
20
- "@openfn/language-common": "^1.13.0"
20
+ "@openfn/language-common": "^1.14.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "assertion-error": "^1.0.1",
@@ -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, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";