@openfn/language-googlesheets 2.4.0 → 2.5.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
@@ -89,6 +89,107 @@
89
89
  },
90
90
  "valid": false
91
91
  },
92
+ {
93
+ "name": "batchUpdateValues",
94
+ "params": [
95
+ "params",
96
+ "callback"
97
+ ],
98
+ "docs": {
99
+ "description": "Batch update values in a Spreadsheet.",
100
+ "tags": [
101
+ {
102
+ "title": "example",
103
+ "description": "batchUpdateValues({\n spreadsheetId: '1O-a4_RgPF_p8W3I6b5M9wobA3-CBW8hLClZfUik5sos',\n range: 'Sheet1!A1:E1',\n values: [\n ['From expression', '$15', '2', '3/15/2016'],\n ['Really now!', '$100', '1', '3/20/2016'],\n ],\n})"
104
+ },
105
+ {
106
+ "title": "function",
107
+ "description": null,
108
+ "name": null
109
+ },
110
+ {
111
+ "title": "public",
112
+ "description": null,
113
+ "type": null
114
+ },
115
+ {
116
+ "title": "param",
117
+ "description": "Data object to add to the spreadsheet.",
118
+ "type": {
119
+ "type": "NameExpression",
120
+ "name": "Object"
121
+ },
122
+ "name": "params"
123
+ },
124
+ {
125
+ "title": "param",
126
+ "description": "The spreadsheet ID.",
127
+ "type": {
128
+ "type": "OptionalType",
129
+ "expression": {
130
+ "type": "NameExpression",
131
+ "name": "string"
132
+ }
133
+ },
134
+ "name": "params.spreadsheetId"
135
+ },
136
+ {
137
+ "title": "param",
138
+ "description": "The range of values to update.",
139
+ "type": {
140
+ "type": "OptionalType",
141
+ "expression": {
142
+ "type": "NameExpression",
143
+ "name": "string"
144
+ }
145
+ },
146
+ "name": "params.range"
147
+ },
148
+ {
149
+ "title": "param",
150
+ "description": "(Optional) Value update options. Defaults to 'USER_ENTERED'",
151
+ "type": {
152
+ "type": "OptionalType",
153
+ "expression": {
154
+ "type": "NameExpression",
155
+ "name": "string"
156
+ }
157
+ },
158
+ "name": "params.valueInputOption"
159
+ },
160
+ {
161
+ "title": "param",
162
+ "description": "A 2d array of values to update.",
163
+ "type": {
164
+ "type": "OptionalType",
165
+ "expression": {
166
+ "type": "NameExpression",
167
+ "name": "array"
168
+ }
169
+ },
170
+ "name": "params.values"
171
+ },
172
+ {
173
+ "title": "param",
174
+ "description": "(Optional) callback function",
175
+ "type": {
176
+ "type": "NameExpression",
177
+ "name": "function"
178
+ },
179
+ "name": "callback"
180
+ },
181
+ {
182
+ "title": "returns",
183
+ "description": "spreadsheet information",
184
+ "type": {
185
+ "type": "NameExpression",
186
+ "name": "Operation"
187
+ }
188
+ }
189
+ ]
190
+ },
191
+ "valid": false
192
+ },
92
193
  {
93
194
  "name": "getValues",
94
195
  "params": [
@@ -168,23 +269,76 @@
168
269
  "description": null,
169
270
  "type": null
170
271
  },
272
+ {
273
+ "title": "function",
274
+ "description": null,
275
+ "name": null
276
+ },
171
277
  {
172
278
  "title": "example",
173
279
  "description": "fn(state => {\n // do some things to state\n return state;\n});"
174
280
  },
281
+ {
282
+ "title": "param",
283
+ "description": "is the function",
284
+ "type": {
285
+ "type": "NameExpression",
286
+ "name": "Function"
287
+ },
288
+ "name": "func"
289
+ },
290
+ {
291
+ "title": "returns",
292
+ "description": null,
293
+ "type": {
294
+ "type": "NameExpression",
295
+ "name": "Operation"
296
+ }
297
+ }
298
+ ]
299
+ },
300
+ "valid": true
301
+ },
302
+ {
303
+ "name": "fnIf",
304
+ "params": [
305
+ "condition",
306
+ "operation"
307
+ ],
308
+ "docs": {
309
+ "description": "A custom operation that will only execute the function if the condition returns true",
310
+ "tags": [
311
+ {
312
+ "title": "public",
313
+ "description": null,
314
+ "type": null
315
+ },
175
316
  {
176
317
  "title": "function",
177
318
  "description": null,
178
319
  "name": null
179
320
  },
321
+ {
322
+ "title": "example",
323
+ "description": "fnIf((state) => state?.data?.name, get(\"https://example.com\"));"
324
+ },
180
325
  {
181
326
  "title": "param",
182
- "description": "is the function",
327
+ "description": "The condition that returns true",
183
328
  "type": {
184
329
  "type": "NameExpression",
185
- "name": "Function"
330
+ "name": "Boolean"
186
331
  },
187
- "name": "func"
332
+ "name": "condition"
333
+ },
334
+ {
335
+ "title": "param",
336
+ "description": "The operation needed to be executed.",
337
+ "type": {
338
+ "type": "NameExpression",
339
+ "name": "Operation"
340
+ },
341
+ "name": "operation"
188
342
  },
189
343
  {
190
344
  "title": "returns",
@@ -211,15 +365,15 @@
211
365
  "description": null,
212
366
  "type": null
213
367
  },
214
- {
215
- "title": "example",
216
- "description": "sourceValue('$.key')"
217
- },
218
368
  {
219
369
  "title": "function",
220
370
  "description": null,
221
371
  "name": null
222
372
  },
373
+ {
374
+ "title": "example",
375
+ "description": "sourceValue('$.key')"
376
+ },
223
377
  {
224
378
  "title": "param",
225
379
  "description": "JSONPath referencing a point in `state`.",
@@ -254,15 +408,15 @@
254
408
  "description": null,
255
409
  "type": null
256
410
  },
257
- {
258
- "title": "example",
259
- "description": "dataPath('key')"
260
- },
261
411
  {
262
412
  "title": "function",
263
413
  "description": null,
264
414
  "name": null
265
415
  },
416
+ {
417
+ "title": "example",
418
+ "description": "dataPath('key')"
419
+ },
266
420
  {
267
421
  "title": "param",
268
422
  "description": "JSONPath referencing a point in `data`.",
@@ -297,15 +451,15 @@
297
451
  "description": null,
298
452
  "type": null
299
453
  },
300
- {
301
- "title": "example",
302
- "description": "dataValue('key')"
303
- },
304
454
  {
305
455
  "title": "function",
306
456
  "description": null,
307
457
  "name": null
308
458
  },
459
+ {
460
+ "title": "example",
461
+ "description": "dataValue('key')"
462
+ },
309
463
  {
310
464
  "title": "param",
311
465
  "description": "JSONPath referencing a point in `data`.",
@@ -340,15 +494,15 @@
340
494
  "description": null,
341
495
  "type": null
342
496
  },
343
- {
344
- "title": "example",
345
- "description": "lastReferenceValue('key')"
346
- },
347
497
  {
348
498
  "title": "function",
349
499
  "description": null,
350
500
  "name": null
351
501
  },
502
+ {
503
+ "title": "example",
504
+ "description": "lastReferenceValue('key')"
505
+ },
352
506
  {
353
507
  "title": "param",
354
508
  "description": "JSONPath referencing a point in `references`.",
@@ -384,15 +538,15 @@
384
538
  "description": null,
385
539
  "type": null
386
540
  },
387
- {
388
- "title": "example",
389
- "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
390
- },
391
541
  {
392
542
  "title": "function",
393
543
  "description": null,
394
544
  "name": null
395
545
  },
546
+ {
547
+ "title": "example",
548
+ "description": "each(\"$.[*]\",\n create(\"SObject\",\n field(\"FirstName\", sourceValue(\"$.firstName\"))\n )\n)"
549
+ },
396
550
  {
397
551
  "title": "param",
398
552
  "description": "JSONPath referencing a point in `state`.",
@@ -436,15 +590,15 @@
436
590
  "description": null,
437
591
  "type": null
438
592
  },
439
- {
440
- "title": "example",
441
- "description": "combine(\n create('foo'),\n delete('bar')\n)"
442
- },
443
593
  {
444
594
  "title": "function",
445
595
  "description": null,
446
596
  "name": null
447
597
  },
598
+ {
599
+ "title": "example",
600
+ "description": "combine(\n create('foo'),\n delete('bar')\n)"
601
+ },
448
602
  {
449
603
  "title": "param",
450
604
  "description": "Operations to be performed.",
@@ -480,15 +634,15 @@
480
634
  "description": null,
481
635
  "type": null
482
636
  },
483
- {
484
- "title": "example",
485
- "description": "field('destination_field_name__c', 'value')"
486
- },
487
637
  {
488
638
  "title": "function",
489
639
  "description": null,
490
640
  "name": null
491
641
  },
642
+ {
643
+ "title": "example",
644
+ "description": "field('destination_field_name__c', 'value')"
645
+ },
492
646
  {
493
647
  "title": "param",
494
648
  "description": "Name of the field",
@@ -532,15 +686,15 @@
532
686
  "description": null,
533
687
  "type": null
534
688
  },
535
- {
536
- "title": "example",
537
- "description": "fields(list_of_fields)"
538
- },
539
689
  {
540
690
  "title": "function",
541
691
  "description": null,
542
692
  "name": null
543
693
  },
694
+ {
695
+ "title": "example",
696
+ "description": "fields(list_of_fields)"
697
+ },
544
698
  {
545
699
  "title": "param",
546
700
  "description": "a list of fields",
@@ -585,6 +739,11 @@
585
739
  "description": null,
586
740
  "name": null
587
741
  },
742
+ {
743
+ "title": "public",
744
+ "description": null,
745
+ "type": null
746
+ },
588
747
  {
589
748
  "title": "param",
590
749
  "description": null,
@@ -622,13 +781,18 @@
622
781
  "options"
623
782
  ],
624
783
  "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}",
784
+ "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
785
  "tags": [
627
786
  {
628
787
  "title": "public",
629
788
  "description": null,
630
789
  "type": null
631
790
  },
791
+ {
792
+ "title": "function",
793
+ "description": null,
794
+ "name": null
795
+ },
632
796
  {
633
797
  "title": "example",
634
798
  "description": "cursor($.cursor, { defaultValue: 'today' })",
@@ -639,11 +803,6 @@
639
803
  "description": "cursor(22)",
640
804
  "caption": "Use a pagination cursor"
641
805
  },
642
- {
643
- "title": "function",
644
- "description": null,
645
- "name": null
646
- },
647
806
  {
648
807
  "title": "param",
649
808
  "description": "the cursor value. Usually an ISO date, natural language date, or page number",
@@ -680,6 +839,15 @@
680
839
  },
681
840
  "name": "options.defaultValue"
682
841
  },
842
+ {
843
+ "title": "param",
844
+ "description": "custom formatter for the final cursor value",
845
+ "type": {
846
+ "type": "NameExpression",
847
+ "name": "Function"
848
+ },
849
+ "name": "options.format"
850
+ },
683
851
  {
684
852
  "title": "returns",
685
853
  "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.1",
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.15.1",
27
27
  "googleapis": "100.0.0"
28
28
  },
29
29
  "devDependencies": {
@@ -49,6 +49,7 @@ export function appendValues(params: {
49
49
  * ],
50
50
  * })
51
51
  * @function
52
+ * @public
52
53
  * @param {Object} params - Data object to add to the spreadsheet.
53
54
  * @param {string} [params.spreadsheetId] The spreadsheet ID.
54
55
  * @param {string} [params.range] The range of values to update.
@@ -75,4 +76,4 @@ export function batchUpdateValues(params: {
75
76
  * @returns {Operation} spreadsheet information
76
77
  */
77
78
  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";
79
+ export { alterState, combine, cursor, dataPath, dataValue, each, field, fields, fn, fnIf, http, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";