@openfn/language-googlesheets 2.3.1 → 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": [
@@ -614,6 +667,92 @@
614
667
  ]
615
668
  },
616
669
  "valid": true
670
+ },
671
+ {
672
+ "name": "cursor",
673
+ "params": [
674
+ "value",
675
+ "options"
676
+ ],
677
+ "docs": {
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}",
679
+ "tags": [
680
+ {
681
+ "title": "public",
682
+ "description": null,
683
+ "type": null
684
+ },
685
+ {
686
+ "title": "example",
687
+ "description": "cursor($.cursor, { defaultValue: 'today' })",
688
+ "caption": "Use a cursor from state if present, or else use the default value"
689
+ },
690
+ {
691
+ "title": "example",
692
+ "description": "cursor(22)",
693
+ "caption": "Use a pagination cursor"
694
+ },
695
+ {
696
+ "title": "function",
697
+ "description": null,
698
+ "name": null
699
+ },
700
+ {
701
+ "title": "param",
702
+ "description": "the cursor value. Usually an ISO date, natural language date, or page number",
703
+ "type": {
704
+ "type": "NameExpression",
705
+ "name": "any"
706
+ },
707
+ "name": "value"
708
+ },
709
+ {
710
+ "title": "param",
711
+ "description": "options to control the cursor.",
712
+ "type": {
713
+ "type": "NameExpression",
714
+ "name": "object"
715
+ },
716
+ "name": "options"
717
+ },
718
+ {
719
+ "title": "param",
720
+ "description": "set the cursor key. Will persist through the whole run.",
721
+ "type": {
722
+ "type": "NameExpression",
723
+ "name": "string"
724
+ },
725
+ "name": "options.key"
726
+ },
727
+ {
728
+ "title": "param",
729
+ "description": "the value to use if value is falsy",
730
+ "type": {
731
+ "type": "NameExpression",
732
+ "name": "any"
733
+ },
734
+ "name": "options.defaultValue"
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
+ },
745
+ {
746
+ "title": "returns",
747
+ "description": null,
748
+ "type": {
749
+ "type": "NameExpression",
750
+ "name": "Operation"
751
+ }
752
+ }
753
+ ]
754
+ },
755
+ "valid": false
617
756
  }
618
757
  ]
619
758
  }
package/dist/index.cjs CHANGED
@@ -23,6 +23,7 @@ __export(src_exports, {
23
23
  appendValues: () => appendValues,
24
24
  batchUpdateValues: () => batchUpdateValues,
25
25
  combine: () => import_language_common2.combine,
26
+ cursor: () => import_language_common2.cursor,
26
27
  dataPath: () => import_language_common2.dataPath,
27
28
  dataValue: () => import_language_common2.dataValue,
28
29
  default: () => src_default,
@@ -31,6 +32,7 @@ __export(src_exports, {
31
32
  field: () => import_language_common2.field,
32
33
  fields: () => import_language_common2.fields,
33
34
  fn: () => import_language_common2.fn,
35
+ fnIf: () => import_language_common2.fnIf,
34
36
  getValues: () => getValues,
35
37
  http: () => import_language_common2.http,
36
38
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
@@ -46,6 +48,7 @@ __export(Adaptor_exports, {
46
48
  appendValues: () => appendValues,
47
49
  batchUpdateValues: () => batchUpdateValues,
48
50
  combine: () => import_language_common2.combine,
51
+ cursor: () => import_language_common2.cursor,
49
52
  dataPath: () => import_language_common2.dataPath,
50
53
  dataValue: () => import_language_common2.dataValue,
51
54
  each: () => import_language_common2.each,
@@ -53,6 +56,7 @@ __export(Adaptor_exports, {
53
56
  field: () => import_language_common2.field,
54
57
  fields: () => import_language_common2.fields,
55
58
  fn: () => import_language_common2.fn,
59
+ fnIf: () => import_language_common2.fnIf,
56
60
  getValues: () => getValues,
57
61
  http: () => import_language_common2.http,
58
62
  lastReferenceValue: () => import_language_common2.lastReferenceValue,
@@ -201,6 +205,7 @@ var src_default = Adaptor_exports;
201
205
  appendValues,
202
206
  batchUpdateValues,
203
207
  combine,
208
+ cursor,
204
209
  dataPath,
205
210
  dataValue,
206
211
  each,
@@ -208,6 +213,7 @@ var src_default = Adaptor_exports;
208
213
  field,
209
214
  fields,
210
215
  fn,
216
+ fnIf,
211
217
  getValues,
212
218
  http,
213
219
  lastReferenceValue,
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ __export(Adaptor_exports, {
11
11
  appendValues: () => appendValues,
12
12
  batchUpdateValues: () => batchUpdateValues,
13
13
  combine: () => combine,
14
+ cursor: () => cursor,
14
15
  dataPath: () => dataPath,
15
16
  dataValue: () => dataValue,
16
17
  each: () => each,
@@ -18,6 +19,7 @@ __export(Adaptor_exports, {
18
19
  field: () => field,
19
20
  fields: () => fields,
20
21
  fn: () => fn,
22
+ fnIf: () => fnIf,
21
23
  getValues: () => getValues,
22
24
  http: () => http,
23
25
  lastReferenceValue: () => lastReferenceValue,
@@ -36,12 +38,14 @@ import { google } from "googleapis";
36
38
  import {
37
39
  alterState,
38
40
  combine,
41
+ cursor,
39
42
  dataPath,
40
43
  dataValue,
41
44
  each,
42
45
  field,
43
46
  fields,
44
47
  fn,
48
+ fnIf,
45
49
  http,
46
50
  lastReferenceValue,
47
51
  merge,
@@ -184,6 +188,7 @@ export {
184
188
  appendValues,
185
189
  batchUpdateValues,
186
190
  combine,
191
+ cursor,
187
192
  dataPath,
188
193
  dataValue,
189
194
  src_default as default,
@@ -192,6 +197,7 @@ export {
192
197
  field,
193
198
  fields,
194
199
  fn,
200
+ fnIf,
195
201
  getValues,
196
202
  http,
197
203
  lastReferenceValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/language-googlesheets",
3
- "version": "2.3.1",
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.12.0",
26
+ "@openfn/language-common": "^1.14.0",
27
27
  "googleapis": "100.0.0"
28
28
  },
29
29
  "devDependencies": {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Execute a sequence of operations.
2
+ * Execute a sequence of oper.
3
3
  * Wraps `language-common/execute`, and prepends initial state for http.
4
4
  * @example
5
5
  * execute(
@@ -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, 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";