@openfn/language-googlesheets 2.4.0 → 2.5.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
@@ -198,6 +198,59 @@
198
198
  },
199
199
  "valid": true
200
200
  },
201
+ {
202
+ "name": "fnIf",
203
+ "params": [
204
+ "condition",
205
+ "operation"
206
+ ],
207
+ "docs": {
208
+ "description": "A custom operation that will only execute the function if the condition returns true",
209
+ "tags": [
210
+ {
211
+ "title": "public",
212
+ "description": null,
213
+ "type": null
214
+ },
215
+ {
216
+ "title": "example",
217
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
218
+ },
219
+ {
220
+ "title": "function",
221
+ "description": null,
222
+ "name": null
223
+ },
224
+ {
225
+ "title": "param",
226
+ "description": "The condition that returns true",
227
+ "type": {
228
+ "type": "NameExpression",
229
+ "name": "Boolean"
230
+ },
231
+ "name": "condition"
232
+ },
233
+ {
234
+ "title": "param",
235
+ "description": "The operation needed to be executed.",
236
+ "type": {
237
+ "type": "NameExpression",
238
+ "name": "Operation"
239
+ },
240
+ "name": "operation"
241
+ },
242
+ {
243
+ "title": "returns",
244
+ "description": null,
245
+ "type": {
246
+ "type": "NameExpression",
247
+ "name": "Operation"
248
+ }
249
+ }
250
+ ]
251
+ },
252
+ "valid": true
253
+ },
201
254
  {
202
255
  "name": "sourceValue",
203
256
  "params": [
@@ -622,7 +675,7 @@
622
675
  "options"
623
676
  ],
624
677
  "docs": {
625
- "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}",
678
+ "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}",
626
679
  "tags": [
627
680
  {
628
681
  "title": "public",
@@ -680,6 +733,15 @@
680
733
  },
681
734
  "name": "options.defaultValue"
682
735
  },
736
+ {
737
+ "title": "param",
738
+ "description": "custom formatter for the final cursor value",
739
+ "type": {
740
+ "type": "NameExpression",
741
+ "name": "Function"
742
+ },
743
+ "name": "options.format"
744
+ },
683
745
  {
684
746
  "title": "returns",
685
747
  "description": null,
package/dist/index.cjs CHANGED
@@ -32,6 +32,7 @@ __export(src_exports, {
32
32
  field: () => import_language_common2.field,
33
33
  fields: () => import_language_common2.fields,
34
34
  fn: () => import_language_common2.fn,
35
+ fnIf: () => import_language_common2.fnIf,
35
36
  getValues: () => getValues,
36
37
  http: () => import_language_common2.http,
37
38
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
@@ -55,6 +56,7 @@ __export(Adaptor_exports, {
55
56
  field: () => import_language_common2.field,
56
57
  fields: () => import_language_common2.fields,
57
58
  fn: () => import_language_common2.fn,
59
+ fnIf: () => import_language_common2.fnIf,
58
60
  getValues: () => getValues,
59
61
  http: () => import_language_common2.http,
60
62
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
@@ -211,6 +213,7 @@ var src_default = Adaptor_exports;
211
213
  field,
212
214
  fields,
213
215
  fn,
216
+ fnIf,
214
217
  getValues,
215
218
  http,
216
219
  lastReferenceValue,
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ __export(Adaptor_exports, {
19
19
  field: () => field,
20
20
  fields: () => fields,
21
21
  fn: () => fn,
22
+ fnIf: () => fnIf,
22
23
  getValues: () => getValues,
23
24
  http: () => http,
24
25
  lastReferenceValue: () => lastReferenceValue,
@@ -44,6 +45,7 @@ import {
44
45
  field,
45
46
  fields,
46
47
  fn,
48
+ fnIf,
47
49
  http,
48
50
  lastReferenceValue,
49
51
  merge,
@@ -195,6 +197,7 @@ export {
195
197
  field,
196
198
  fields,
197
199
  fn,
200
+ fnIf,
198
201
  getValues,
199
202
  http,
200
203
  lastReferenceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-googlesheets",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "A Google Sheets Language Pack for OpenFn",
5
5
  "homepage": "https://docs.openfn.org",
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "configuration-schema.json"
24
24
  ],
25
25
  "dependencies": {
26
- "@openfn/language-common": "^1.13.0",
26
+ "@openfn/language-common": "^1.14.0",
27
27
  "googleapis": "100.0.0"
28
28
  },
29
29
  "devDependencies": {
@@ -75,4 +75,4 @@ export function batchUpdateValues(params: {
75
75
  * @returns {Operation} spreadsheet information
76
76
  */
77
77
  export function getValues(spreadsheetId: string, range: string, callback?: Function): Operation;
78
- export { alterState, combine, cursor, dataPath, dataValue, each, field, fields, fn, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
78
+ export { alterState, combine, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";