@bubblelab/bubble-core 0.1.83 → 0.1.85
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/dist/bubble-bundle.d.ts +114 -114
- package/dist/bubbles/service-bubble/agi-inc.d.ts +52 -52
- package/dist/bubbles/service-bubble/ai-agent.d.ts +20 -20
- package/dist/bubbles/service-bubble/airtable.d.ts +138 -138
- package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +2 -2
- package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +20 -20
- package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +30 -30
- package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +26 -26
- package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +56 -56
- package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +16 -16
- package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +31 -31
- package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +8 -8
- package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +153 -153
- package/dist/bubbles/service-bubble/apify/apify.d.ts +12 -12
- package/dist/bubbles/service-bubble/ashby/ashby.d.ts +18 -18
- package/dist/bubbles/service-bubble/ashby/ashby.schema.d.ts +18 -18
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +20 -20
- package/dist/bubbles/service-bubble/browserbase/browserbase.schema.d.ts +20 -20
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +12 -12
- package/dist/bubbles/service-bubble/crustdata/crustdata.schema.d.ts +16 -16
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +24 -24
- package/dist/bubbles/service-bubble/firecrawl.d.ts +68 -68
- package/dist/bubbles/service-bubble/followupboss.d.ts +124 -124
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +12 -12
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.schema.d.ts +12 -12
- package/dist/bubbles/service-bubble/github.d.ts +36 -36
- package/dist/bubbles/service-bubble/gmail.d.ts +64 -64
- package/dist/bubbles/service-bubble/google-calendar.d.ts +24 -24
- package/dist/bubbles/service-bubble/google-drive.d.ts +48 -48
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +22 -22
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +22 -22
- package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
- package/dist/bubbles/service-bubble/http.d.ts +8 -8
- package/dist/bubbles/service-bubble/insforge-db.d.ts +10 -10
- package/dist/bubbles/service-bubble/jira/jira.d.ts +20 -20
- package/dist/bubbles/service-bubble/jira/jira.schema.d.ts +20 -20
- package/dist/bubbles/service-bubble/notion/notion.d.ts +68 -68
- package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +36 -36
- package/dist/bubbles/service-bubble/postgresql.d.ts +10 -10
- package/dist/bubbles/service-bubble/resend.d.ts +8 -8
- package/dist/bubbles/service-bubble/slack/slack.d.ts +97 -97
- package/dist/bubbles/service-bubble/slack/slack.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/slack/slack.js +0 -133
- package/dist/bubbles/service-bubble/slack/slack.js.map +1 -1
- package/dist/bubbles/service-bubble/storage.d.ts +20 -20
- package/dist/bubbles/service-bubble/stripe/stripe.d.ts +38 -38
- package/dist/bubbles/service-bubble/stripe/stripe.schema.d.ts +38 -38
- package/dist/bubbles/service-bubble/telegram.d.ts +52 -52
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.schema.d.ts +14 -14
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts +2 -2
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts +2 -2
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +30 -30
- package/dist/bubbles/tool-bubble/list-airtable-bases-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/list-airtable-tables-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/people-search-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +12 -4
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/research-agent-tool.js +168 -15
- package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +40 -40
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +14 -14
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +24 -24
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +8 -8
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +52 -52
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +4 -4
- package/dist/bubbles.json +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/utils/json-parsing.d.ts +9 -0
- package/dist/utils/json-parsing.d.ts.map +1 -1
- package/dist/utils/json-parsing.js +61 -2
- package/dist/utils/json-parsing.js.map +1 -1
- package/dist/utils/zod-schema.d.ts.map +1 -1
- package/dist/utils/zod-schema.js +16 -8
- package/dist/utils/zod-schema.js.map +1 -1
- package/package.json +2 -2
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts +0 -31
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js +0 -184
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js.map +0 -1
- package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
- package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/google-sheets.js +0 -904
- package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
- package/dist/bubbles/service-bubble/slack.d.ts +0 -5869
- package/dist/bubbles/service-bubble/slack.d.ts.map +0 -1
- package/dist/bubbles/service-bubble/slack.js +0 -1536
- package/dist/bubbles/service-bubble/slack.js.map +0 -1
- package/dist/recording/types.d.ts +0 -68
- package/dist/recording/types.d.ts.map +0 -1
- package/dist/recording/types.js +0 -13
- package/dist/recording/types.js.map +0 -1
|
@@ -1,904 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ServiceBubble } from '../../types/service-bubble-class.js';
|
|
3
|
-
import { CredentialType } from '@bubblelab/shared-schemas';
|
|
4
|
-
// Define value range schema
|
|
5
|
-
const ValueRangeSchema = z
|
|
6
|
-
.object({
|
|
7
|
-
range: z.string().describe('The A1 notation range'),
|
|
8
|
-
majorDimension: z
|
|
9
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
10
|
-
.optional()
|
|
11
|
-
.describe('Major dimension of the values'),
|
|
12
|
-
values: z
|
|
13
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
14
|
-
.describe('The data values as array of arrays'),
|
|
15
|
-
})
|
|
16
|
-
.describe('Range of values in a spreadsheet');
|
|
17
|
-
// Define spreadsheet info schema
|
|
18
|
-
const SpreadsheetInfoSchema = z
|
|
19
|
-
.object({
|
|
20
|
-
spreadsheetId: z.string().describe('Unique spreadsheet identifier'),
|
|
21
|
-
properties: z
|
|
22
|
-
.object({
|
|
23
|
-
title: z.string().describe('Spreadsheet title'),
|
|
24
|
-
locale: z.string().optional().describe('Spreadsheet locale'),
|
|
25
|
-
autoRecalc: z.string().optional().describe('Auto recalc setting'),
|
|
26
|
-
timeZone: z.string().optional().describe('Time zone'),
|
|
27
|
-
})
|
|
28
|
-
.optional()
|
|
29
|
-
.describe('Spreadsheet properties'),
|
|
30
|
-
sheets: z
|
|
31
|
-
.array(z
|
|
32
|
-
.object({
|
|
33
|
-
properties: z
|
|
34
|
-
.object({
|
|
35
|
-
sheetId: z.number().describe('Sheet ID'),
|
|
36
|
-
title: z.string().describe('Sheet title'),
|
|
37
|
-
index: z.number().describe('Sheet index'),
|
|
38
|
-
sheetType: z.string().optional().describe('Sheet type'),
|
|
39
|
-
gridProperties: z
|
|
40
|
-
.object({
|
|
41
|
-
rowCount: z
|
|
42
|
-
.number()
|
|
43
|
-
.optional()
|
|
44
|
-
.describe('Number of rows in the sheet'),
|
|
45
|
-
columnCount: z
|
|
46
|
-
.number()
|
|
47
|
-
.optional()
|
|
48
|
-
.describe('Number of columns in the sheet'),
|
|
49
|
-
})
|
|
50
|
-
.optional()
|
|
51
|
-
.describe('Grid properties of the sheet'),
|
|
52
|
-
})
|
|
53
|
-
.describe('Sheet properties'),
|
|
54
|
-
})
|
|
55
|
-
.describe('Sheet information'))
|
|
56
|
-
.optional()
|
|
57
|
-
.describe('List of sheets in the spreadsheet'),
|
|
58
|
-
spreadsheetUrl: z.string().optional().describe('URL to the spreadsheet'),
|
|
59
|
-
})
|
|
60
|
-
.describe('Google Sheets spreadsheet information');
|
|
61
|
-
// Define the parameters schema for Google Sheets operations
|
|
62
|
-
const GoogleSheetsParamsSchema = z.discriminatedUnion('operation', [
|
|
63
|
-
// Read values operation
|
|
64
|
-
z.object({
|
|
65
|
-
operation: z.literal('read_values').describe('Read values from a range'),
|
|
66
|
-
spreadsheet_id: z
|
|
67
|
-
.string()
|
|
68
|
-
.min(1, 'Spreadsheet ID is required')
|
|
69
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
70
|
-
range: z
|
|
71
|
-
.string()
|
|
72
|
-
.min(1, 'Range is required')
|
|
73
|
-
.describe('A1 notation range (e.g., "Sheet1!A1:B10")'),
|
|
74
|
-
major_dimension: z
|
|
75
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
76
|
-
.optional()
|
|
77
|
-
.default('ROWS')
|
|
78
|
-
.describe('Major dimension for the values'),
|
|
79
|
-
value_render_option: z
|
|
80
|
-
.enum(['FORMATTED_VALUE', 'UNFORMATTED_VALUE', 'FORMULA'])
|
|
81
|
-
.optional()
|
|
82
|
-
.default('FORMATTED_VALUE')
|
|
83
|
-
.describe('How values should be represented in the output'),
|
|
84
|
-
date_time_render_option: z
|
|
85
|
-
.enum(['SERIAL_NUMBER', 'FORMATTED_STRING'])
|
|
86
|
-
.optional()
|
|
87
|
-
.default('SERIAL_NUMBER')
|
|
88
|
-
.describe('How date/time values should be rendered'),
|
|
89
|
-
credentials: z
|
|
90
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
91
|
-
.optional()
|
|
92
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
93
|
-
}),
|
|
94
|
-
// Write values operation
|
|
95
|
-
z.object({
|
|
96
|
-
operation: z.literal('write_values').describe('Write values to a range'),
|
|
97
|
-
spreadsheet_id: z
|
|
98
|
-
.string()
|
|
99
|
-
.min(1, 'Spreadsheet ID is required')
|
|
100
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
101
|
-
range: z
|
|
102
|
-
.string()
|
|
103
|
-
.min(1, 'Range is required')
|
|
104
|
-
.describe('A1 notation range (e.g., "Sheet1!A1:B10")'),
|
|
105
|
-
values: z
|
|
106
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
107
|
-
.min(1, 'Values array cannot be empty')
|
|
108
|
-
.describe('Data to write as array of arrays'),
|
|
109
|
-
major_dimension: z
|
|
110
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
111
|
-
.optional()
|
|
112
|
-
.default('ROWS')
|
|
113
|
-
.describe('Major dimension for the values'),
|
|
114
|
-
value_input_option: z
|
|
115
|
-
.enum(['RAW', 'USER_ENTERED'])
|
|
116
|
-
.optional()
|
|
117
|
-
.default('USER_ENTERED')
|
|
118
|
-
.describe('How input data should be interpreted'),
|
|
119
|
-
include_values_in_response: z
|
|
120
|
-
.boolean()
|
|
121
|
-
.optional()
|
|
122
|
-
.default(false)
|
|
123
|
-
.describe('Include updated values in response'),
|
|
124
|
-
credentials: z
|
|
125
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
126
|
-
.optional()
|
|
127
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
128
|
-
}),
|
|
129
|
-
// Update values operation
|
|
130
|
-
z.object({
|
|
131
|
-
operation: z
|
|
132
|
-
.literal('update_values')
|
|
133
|
-
.describe('Update values in a specific range'),
|
|
134
|
-
spreadsheet_id: z
|
|
135
|
-
.string()
|
|
136
|
-
.min(1, 'Spreadsheet ID is required')
|
|
137
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
138
|
-
range: z
|
|
139
|
-
.string()
|
|
140
|
-
.min(1, 'Range is required')
|
|
141
|
-
.describe('A1 notation range (e.g., "Sheet1!A1:B10")'),
|
|
142
|
-
values: z
|
|
143
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
144
|
-
.min(1, 'Values array cannot be empty')
|
|
145
|
-
.describe('Data to update as array of arrays'),
|
|
146
|
-
major_dimension: z
|
|
147
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
148
|
-
.optional()
|
|
149
|
-
.default('ROWS')
|
|
150
|
-
.describe('Major dimension for the values'),
|
|
151
|
-
value_input_option: z
|
|
152
|
-
.enum(['RAW', 'USER_ENTERED'])
|
|
153
|
-
.optional()
|
|
154
|
-
.default('USER_ENTERED')
|
|
155
|
-
.describe('How input data should be interpreted'),
|
|
156
|
-
include_values_in_response: z
|
|
157
|
-
.boolean()
|
|
158
|
-
.optional()
|
|
159
|
-
.default(false)
|
|
160
|
-
.describe('Include updated values in response'),
|
|
161
|
-
credentials: z
|
|
162
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
163
|
-
.optional()
|
|
164
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
165
|
-
}),
|
|
166
|
-
// Append values operation
|
|
167
|
-
z.object({
|
|
168
|
-
operation: z
|
|
169
|
-
.literal('append_values')
|
|
170
|
-
.describe('Append values to the end of a table'),
|
|
171
|
-
spreadsheet_id: z
|
|
172
|
-
.string()
|
|
173
|
-
.min(1, 'Spreadsheet ID is required')
|
|
174
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
175
|
-
range: z
|
|
176
|
-
.string()
|
|
177
|
-
.min(1, 'Range is required')
|
|
178
|
-
.describe('A1 notation range to search for table (e.g., "Sheet1!A:A")'),
|
|
179
|
-
values: z
|
|
180
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
181
|
-
.min(1, 'Values array cannot be empty')
|
|
182
|
-
.describe('Data to append as array of arrays'),
|
|
183
|
-
major_dimension: z
|
|
184
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
185
|
-
.optional()
|
|
186
|
-
.default('ROWS')
|
|
187
|
-
.describe('Major dimension for the values'),
|
|
188
|
-
value_input_option: z
|
|
189
|
-
.enum(['RAW', 'USER_ENTERED'])
|
|
190
|
-
.optional()
|
|
191
|
-
.default('USER_ENTERED')
|
|
192
|
-
.describe('How input data should be interpreted'),
|
|
193
|
-
insert_data_option: z
|
|
194
|
-
.enum(['OVERWRITE', 'INSERT_ROWS'])
|
|
195
|
-
.optional()
|
|
196
|
-
.default('INSERT_ROWS')
|
|
197
|
-
.describe('How data should be inserted'),
|
|
198
|
-
include_values_in_response: z
|
|
199
|
-
.boolean()
|
|
200
|
-
.optional()
|
|
201
|
-
.default(false)
|
|
202
|
-
.describe('Include appended values in response'),
|
|
203
|
-
credentials: z
|
|
204
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
205
|
-
.optional()
|
|
206
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
207
|
-
}),
|
|
208
|
-
// Clear values operation
|
|
209
|
-
z.object({
|
|
210
|
-
operation: z.literal('clear_values').describe('Clear values from a range'),
|
|
211
|
-
spreadsheet_id: z
|
|
212
|
-
.string()
|
|
213
|
-
.min(1, 'Spreadsheet ID is required')
|
|
214
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
215
|
-
range: z
|
|
216
|
-
.string()
|
|
217
|
-
.min(1, 'Range is required')
|
|
218
|
-
.describe('A1 notation range (e.g., "Sheet1!A1:B10")'),
|
|
219
|
-
credentials: z
|
|
220
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
221
|
-
.optional()
|
|
222
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
223
|
-
}),
|
|
224
|
-
// Batch read values operation
|
|
225
|
-
z.object({
|
|
226
|
-
operation: z
|
|
227
|
-
.literal('batch_read_values')
|
|
228
|
-
.describe('Read multiple ranges at once'),
|
|
229
|
-
spreadsheet_id: z
|
|
230
|
-
.string()
|
|
231
|
-
.min(1, 'Spreadsheet ID is required')
|
|
232
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
233
|
-
ranges: z
|
|
234
|
-
.array(z.string())
|
|
235
|
-
.min(1, 'At least one range is required')
|
|
236
|
-
.describe('Array of A1 notation ranges'),
|
|
237
|
-
major_dimension: z
|
|
238
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
239
|
-
.optional()
|
|
240
|
-
.default('ROWS')
|
|
241
|
-
.describe('Major dimension for the values'),
|
|
242
|
-
value_render_option: z
|
|
243
|
-
.enum(['FORMATTED_VALUE', 'UNFORMATTED_VALUE', 'FORMULA'])
|
|
244
|
-
.optional()
|
|
245
|
-
.default('FORMATTED_VALUE')
|
|
246
|
-
.describe('How values should be represented in the output'),
|
|
247
|
-
date_time_render_option: z
|
|
248
|
-
.enum(['SERIAL_NUMBER', 'FORMATTED_STRING'])
|
|
249
|
-
.optional()
|
|
250
|
-
.default('SERIAL_NUMBER')
|
|
251
|
-
.describe('How date/time values should be rendered'),
|
|
252
|
-
credentials: z
|
|
253
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
254
|
-
.optional()
|
|
255
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
256
|
-
}),
|
|
257
|
-
// Batch update values operation
|
|
258
|
-
z.object({
|
|
259
|
-
operation: z
|
|
260
|
-
.literal('batch_update_values')
|
|
261
|
-
.describe('Update multiple ranges at once'),
|
|
262
|
-
spreadsheet_id: z
|
|
263
|
-
.string()
|
|
264
|
-
.min(1, 'Spreadsheet ID is required')
|
|
265
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
266
|
-
value_ranges: z
|
|
267
|
-
.array(z.object({
|
|
268
|
-
range: z.string().describe('A1 notation range'),
|
|
269
|
-
values: z
|
|
270
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
271
|
-
.describe('Data values'),
|
|
272
|
-
major_dimension: z
|
|
273
|
-
.enum(['ROWS', 'COLUMNS'])
|
|
274
|
-
.optional()
|
|
275
|
-
.default('ROWS'),
|
|
276
|
-
}))
|
|
277
|
-
.min(1, 'At least one value range is required')
|
|
278
|
-
.describe('Array of value ranges to update'),
|
|
279
|
-
value_input_option: z
|
|
280
|
-
.enum(['RAW', 'USER_ENTERED'])
|
|
281
|
-
.optional()
|
|
282
|
-
.default('USER_ENTERED')
|
|
283
|
-
.describe('How input data should be interpreted'),
|
|
284
|
-
include_values_in_response: z
|
|
285
|
-
.boolean()
|
|
286
|
-
.optional()
|
|
287
|
-
.default(false)
|
|
288
|
-
.describe('Include updated values in response'),
|
|
289
|
-
credentials: z
|
|
290
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
291
|
-
.optional()
|
|
292
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
293
|
-
}),
|
|
294
|
-
// Get spreadsheet info operation
|
|
295
|
-
z.object({
|
|
296
|
-
operation: z
|
|
297
|
-
.literal('get_spreadsheet_info')
|
|
298
|
-
.describe('Get spreadsheet metadata and properties'),
|
|
299
|
-
spreadsheet_id: z
|
|
300
|
-
.string()
|
|
301
|
-
.min(1, 'Spreadsheet ID is required')
|
|
302
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
303
|
-
include_grid_data: z
|
|
304
|
-
.boolean()
|
|
305
|
-
.optional()
|
|
306
|
-
.default(false)
|
|
307
|
-
.describe('Include grid data in response'),
|
|
308
|
-
credentials: z
|
|
309
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
310
|
-
.optional()
|
|
311
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
312
|
-
}),
|
|
313
|
-
// Create spreadsheet operation
|
|
314
|
-
z.object({
|
|
315
|
-
operation: z
|
|
316
|
-
.literal('create_spreadsheet')
|
|
317
|
-
.describe('Create a new spreadsheet'),
|
|
318
|
-
title: z
|
|
319
|
-
.string()
|
|
320
|
-
.min(1, 'Spreadsheet title is required')
|
|
321
|
-
.describe('Title for the new spreadsheet'),
|
|
322
|
-
sheet_titles: z
|
|
323
|
-
.array(z.string())
|
|
324
|
-
.optional()
|
|
325
|
-
.default(['Sheet1'])
|
|
326
|
-
.describe('Titles for the initial sheets'),
|
|
327
|
-
credentials: z
|
|
328
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
329
|
-
.optional()
|
|
330
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
331
|
-
}),
|
|
332
|
-
// Add sheet operation
|
|
333
|
-
z.object({
|
|
334
|
-
operation: z
|
|
335
|
-
.literal('add_sheet')
|
|
336
|
-
.describe('Add a new sheet to spreadsheet'),
|
|
337
|
-
spreadsheet_id: z
|
|
338
|
-
.string()
|
|
339
|
-
.min(1, 'Spreadsheet ID is required')
|
|
340
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
341
|
-
sheet_title: z
|
|
342
|
-
.string()
|
|
343
|
-
.min(1, 'Sheet title is required')
|
|
344
|
-
.describe('Title for the new sheet'),
|
|
345
|
-
row_count: z
|
|
346
|
-
.number()
|
|
347
|
-
.min(1)
|
|
348
|
-
.optional()
|
|
349
|
-
.default(1000)
|
|
350
|
-
.describe('Number of rows in the new sheet'),
|
|
351
|
-
column_count: z
|
|
352
|
-
.number()
|
|
353
|
-
.min(1)
|
|
354
|
-
.optional()
|
|
355
|
-
.default(26)
|
|
356
|
-
.describe('Number of columns in the new sheet'),
|
|
357
|
-
credentials: z
|
|
358
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
359
|
-
.optional()
|
|
360
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
361
|
-
}),
|
|
362
|
-
// Delete sheet operation
|
|
363
|
-
z.object({
|
|
364
|
-
operation: z
|
|
365
|
-
.literal('delete_sheet')
|
|
366
|
-
.describe('Delete a sheet from spreadsheet'),
|
|
367
|
-
spreadsheet_id: z
|
|
368
|
-
.string()
|
|
369
|
-
.min(1, 'Spreadsheet ID is required')
|
|
370
|
-
.describe('Google Sheets spreadsheet ID'),
|
|
371
|
-
sheet_id: z
|
|
372
|
-
.number()
|
|
373
|
-
.min(0, 'Sheet ID must be non-negative')
|
|
374
|
-
.describe('ID of the sheet to delete'),
|
|
375
|
-
credentials: z
|
|
376
|
-
.record(z.nativeEnum(CredentialType), z.string())
|
|
377
|
-
.optional()
|
|
378
|
-
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
379
|
-
}),
|
|
380
|
-
]);
|
|
381
|
-
// Define result schemas for different operations
|
|
382
|
-
const GoogleSheetsResultSchema = z.discriminatedUnion('operation', [
|
|
383
|
-
z.object({
|
|
384
|
-
operation: z.literal('read_values').describe('Read values from a range'),
|
|
385
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
386
|
-
range: z.string().optional().describe('The range that was read'),
|
|
387
|
-
values: z
|
|
388
|
-
.array(z.array(z.union([z.string(), z.number(), z.boolean()])))
|
|
389
|
-
.optional()
|
|
390
|
-
.describe('The values that were read'),
|
|
391
|
-
major_dimension: z
|
|
392
|
-
.string()
|
|
393
|
-
.optional()
|
|
394
|
-
.describe('Major dimension of the returned values'),
|
|
395
|
-
error: z.string().describe('Error message if operation failed'),
|
|
396
|
-
}),
|
|
397
|
-
z.object({
|
|
398
|
-
operation: z.literal('write_values').describe('Write values to a range'),
|
|
399
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
400
|
-
updated_range: z.string().optional().describe('The range that was updated'),
|
|
401
|
-
updated_rows: z.number().optional().describe('Number of rows updated'),
|
|
402
|
-
updated_columns: z
|
|
403
|
-
.number()
|
|
404
|
-
.optional()
|
|
405
|
-
.describe('Number of columns updated'),
|
|
406
|
-
updated_cells: z.number().optional().describe('Number of cells updated'),
|
|
407
|
-
updated_data: ValueRangeSchema.optional().describe('Updated data if requested'),
|
|
408
|
-
error: z.string().describe('Error message if operation failed'),
|
|
409
|
-
}),
|
|
410
|
-
z.object({
|
|
411
|
-
operation: z
|
|
412
|
-
.literal('update_values')
|
|
413
|
-
.describe('Update values in a specific range'),
|
|
414
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
415
|
-
updated_range: z.string().optional().describe('The range that was updated'),
|
|
416
|
-
updated_rows: z.number().optional().describe('Number of rows updated'),
|
|
417
|
-
updated_columns: z
|
|
418
|
-
.number()
|
|
419
|
-
.optional()
|
|
420
|
-
.describe('Number of columns updated'),
|
|
421
|
-
updated_cells: z.number().optional().describe('Number of cells updated'),
|
|
422
|
-
updated_data: ValueRangeSchema.optional().describe('Updated data if requested'),
|
|
423
|
-
error: z.string().describe('Error message if operation failed'),
|
|
424
|
-
}),
|
|
425
|
-
z.object({
|
|
426
|
-
operation: z
|
|
427
|
-
.literal('append_values')
|
|
428
|
-
.describe('Append values to the end of a table'),
|
|
429
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
430
|
-
table_range: z
|
|
431
|
-
.string()
|
|
432
|
-
.optional()
|
|
433
|
-
.describe('The table range values were appended to'),
|
|
434
|
-
updated_range: z.string().optional().describe('The range that was updated'),
|
|
435
|
-
updated_rows: z.number().optional().describe('Number of rows updated'),
|
|
436
|
-
updated_columns: z
|
|
437
|
-
.number()
|
|
438
|
-
.optional()
|
|
439
|
-
.describe('Number of columns updated'),
|
|
440
|
-
updated_cells: z.number().optional().describe('Number of cells updated'),
|
|
441
|
-
error: z.string().describe('Error message if operation failed'),
|
|
442
|
-
}),
|
|
443
|
-
z.object({
|
|
444
|
-
operation: z.literal('clear_values').describe('Clear values from a range'),
|
|
445
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
446
|
-
cleared_range: z.string().optional().describe('The range that was cleared'),
|
|
447
|
-
error: z.string().describe('Error message if operation failed'),
|
|
448
|
-
}),
|
|
449
|
-
z.object({
|
|
450
|
-
operation: z
|
|
451
|
-
.literal('batch_read_values')
|
|
452
|
-
.describe('Read multiple ranges at once'),
|
|
453
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
454
|
-
value_ranges: z
|
|
455
|
-
.array(ValueRangeSchema)
|
|
456
|
-
.optional()
|
|
457
|
-
.describe('Array of value ranges that were read'),
|
|
458
|
-
error: z.string().describe('Error message if operation failed'),
|
|
459
|
-
}),
|
|
460
|
-
z.object({
|
|
461
|
-
operation: z
|
|
462
|
-
.literal('batch_update_values')
|
|
463
|
-
.describe('Update multiple ranges at once'),
|
|
464
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
465
|
-
total_updated_rows: z
|
|
466
|
-
.number()
|
|
467
|
-
.optional()
|
|
468
|
-
.describe('Total number of rows updated across all ranges'),
|
|
469
|
-
total_updated_columns: z
|
|
470
|
-
.number()
|
|
471
|
-
.optional()
|
|
472
|
-
.describe('Total number of columns updated across all ranges'),
|
|
473
|
-
total_updated_cells: z
|
|
474
|
-
.number()
|
|
475
|
-
.optional()
|
|
476
|
-
.describe('Total number of cells updated across all ranges'),
|
|
477
|
-
total_updated_sheets: z
|
|
478
|
-
.number()
|
|
479
|
-
.optional()
|
|
480
|
-
.describe('Total number of sheets updated'),
|
|
481
|
-
responses: z
|
|
482
|
-
.array(z
|
|
483
|
-
.object({
|
|
484
|
-
updated_range: z
|
|
485
|
-
.string()
|
|
486
|
-
.optional()
|
|
487
|
-
.describe('Range that was updated'),
|
|
488
|
-
updated_rows: z
|
|
489
|
-
.number()
|
|
490
|
-
.optional()
|
|
491
|
-
.describe('Number of rows updated in this range'),
|
|
492
|
-
updated_columns: z
|
|
493
|
-
.number()
|
|
494
|
-
.optional()
|
|
495
|
-
.describe('Number of columns updated in this range'),
|
|
496
|
-
updated_cells: z
|
|
497
|
-
.number()
|
|
498
|
-
.optional()
|
|
499
|
-
.describe('Number of cells updated in this range'),
|
|
500
|
-
})
|
|
501
|
-
.describe('Individual range update response'))
|
|
502
|
-
.optional()
|
|
503
|
-
.describe('Individual update responses'),
|
|
504
|
-
error: z.string().describe('Error message if operation failed'),
|
|
505
|
-
}),
|
|
506
|
-
z.object({
|
|
507
|
-
operation: z
|
|
508
|
-
.literal('get_spreadsheet_info')
|
|
509
|
-
.describe('Get spreadsheet metadata and properties'),
|
|
510
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
511
|
-
spreadsheet: SpreadsheetInfoSchema.optional().describe('Spreadsheet information'),
|
|
512
|
-
error: z.string().describe('Error message if operation failed'),
|
|
513
|
-
}),
|
|
514
|
-
z.object({
|
|
515
|
-
operation: z
|
|
516
|
-
.literal('create_spreadsheet')
|
|
517
|
-
.describe('Create a new spreadsheet'),
|
|
518
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
519
|
-
spreadsheet: SpreadsheetInfoSchema.optional().describe('Created spreadsheet information'),
|
|
520
|
-
error: z.string().describe('Error message if operation failed'),
|
|
521
|
-
}),
|
|
522
|
-
z.object({
|
|
523
|
-
operation: z
|
|
524
|
-
.literal('add_sheet')
|
|
525
|
-
.describe('Add a new sheet to spreadsheet'),
|
|
526
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
527
|
-
sheet_id: z.number().optional().describe('ID of the added sheet'),
|
|
528
|
-
sheet_title: z.string().optional().describe('Title of the added sheet'),
|
|
529
|
-
error: z.string().describe('Error message if operation failed'),
|
|
530
|
-
}),
|
|
531
|
-
z.object({
|
|
532
|
-
operation: z
|
|
533
|
-
.literal('delete_sheet')
|
|
534
|
-
.describe('Delete a sheet from spreadsheet'),
|
|
535
|
-
success: z.boolean().describe('Whether the operation was successful'),
|
|
536
|
-
deleted_sheet_id: z.number().optional().describe('ID of the deleted sheet'),
|
|
537
|
-
error: z.string().describe('Error message if operation failed'),
|
|
538
|
-
}),
|
|
539
|
-
]);
|
|
540
|
-
export class GoogleSheetsBubble extends ServiceBubble {
|
|
541
|
-
static type = 'service';
|
|
542
|
-
static service = 'google-sheets';
|
|
543
|
-
static authType = 'oauth';
|
|
544
|
-
static bubbleName = 'google-sheets';
|
|
545
|
-
static schema = GoogleSheetsParamsSchema;
|
|
546
|
-
static resultSchema = GoogleSheetsResultSchema;
|
|
547
|
-
static shortDescription = 'Google Sheets integration for spreadsheet operations';
|
|
548
|
-
static longDescription = `
|
|
549
|
-
Google Sheets service integration for comprehensive spreadsheet data management.
|
|
550
|
-
Use cases:
|
|
551
|
-
- Read and write spreadsheet data with flexible ranges
|
|
552
|
-
- Batch operations for efficient data processing
|
|
553
|
-
- Create and manage spreadsheets and sheets
|
|
554
|
-
- Clear and append data with various formatting options
|
|
555
|
-
- Handle formulas, formatted values, and raw data
|
|
556
|
-
|
|
557
|
-
Security Features:
|
|
558
|
-
- OAuth 2.0 authentication with Google
|
|
559
|
-
- Scoped access permissions for Google Sheets
|
|
560
|
-
- Secure data validation and sanitization
|
|
561
|
-
- User-controlled access to spreadsheet data
|
|
562
|
-
`;
|
|
563
|
-
static alias = 'sheets';
|
|
564
|
-
constructor(params = {
|
|
565
|
-
operation: 'read_values',
|
|
566
|
-
spreadsheet_id: '',
|
|
567
|
-
range: 'Sheet1!A1:B10',
|
|
568
|
-
}, context) {
|
|
569
|
-
super(params, context);
|
|
570
|
-
}
|
|
571
|
-
async testCredential() {
|
|
572
|
-
const credential = this.chooseCredential();
|
|
573
|
-
if (!credential) {
|
|
574
|
-
throw new Error('Google Sheets credentials are required');
|
|
575
|
-
}
|
|
576
|
-
try {
|
|
577
|
-
// Test the credentials by making a simple API call
|
|
578
|
-
const response = await fetch('https://sheets.googleapis.com/v4/spreadsheets/test', {
|
|
579
|
-
headers: {
|
|
580
|
-
Authorization: `Bearer ${credential}`,
|
|
581
|
-
'Content-Type': 'application/json',
|
|
582
|
-
},
|
|
583
|
-
});
|
|
584
|
-
// Even if the spreadsheet doesn't exist, a 404 with proper auth means credentials work
|
|
585
|
-
return response.status === 404 || response.ok;
|
|
586
|
-
}
|
|
587
|
-
catch {
|
|
588
|
-
return false;
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
async makeSheetsApiRequest(endpoint, method = 'GET', body, headers = {}) {
|
|
592
|
-
const url = endpoint.startsWith('https://')
|
|
593
|
-
? endpoint
|
|
594
|
-
: `https://sheets.googleapis.com/v4${endpoint}`;
|
|
595
|
-
const requestHeaders = {
|
|
596
|
-
Authorization: `Bearer ${this.chooseCredential()}`,
|
|
597
|
-
'Content-Type': 'application/json',
|
|
598
|
-
...headers,
|
|
599
|
-
};
|
|
600
|
-
const requestInit = {
|
|
601
|
-
method,
|
|
602
|
-
headers: requestHeaders,
|
|
603
|
-
};
|
|
604
|
-
if (body && method !== 'GET') {
|
|
605
|
-
requestInit.body = JSON.stringify(body);
|
|
606
|
-
}
|
|
607
|
-
const response = await fetch(url, requestInit);
|
|
608
|
-
if (!response.ok) {
|
|
609
|
-
const errorText = await response.text();
|
|
610
|
-
throw new Error(`Google Sheets API error: ${response.status} ${response.statusText} - ${errorText}`);
|
|
611
|
-
}
|
|
612
|
-
// Handle empty responses
|
|
613
|
-
const contentType = response.headers.get('content-type');
|
|
614
|
-
if (contentType && contentType.includes('application/json')) {
|
|
615
|
-
return await response.json();
|
|
616
|
-
}
|
|
617
|
-
else {
|
|
618
|
-
return await response.text();
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
async performAction(context) {
|
|
622
|
-
void context;
|
|
623
|
-
const { operation } = this.params;
|
|
624
|
-
try {
|
|
625
|
-
const result = await (async () => {
|
|
626
|
-
switch (operation) {
|
|
627
|
-
case 'read_values':
|
|
628
|
-
return await this.readValues(this.params);
|
|
629
|
-
case 'write_values':
|
|
630
|
-
return await this.writeValues(this.params);
|
|
631
|
-
case 'update_values':
|
|
632
|
-
return await this.updateValues(this.params);
|
|
633
|
-
case 'append_values':
|
|
634
|
-
return await this.appendValues(this.params);
|
|
635
|
-
case 'clear_values':
|
|
636
|
-
return await this.clearValues(this.params);
|
|
637
|
-
case 'batch_read_values':
|
|
638
|
-
return await this.batchReadValues(this.params);
|
|
639
|
-
case 'batch_update_values':
|
|
640
|
-
return await this.batchUpdateValues(this.params);
|
|
641
|
-
case 'get_spreadsheet_info':
|
|
642
|
-
return await this.getSpreadsheetInfo(this.params);
|
|
643
|
-
case 'create_spreadsheet':
|
|
644
|
-
return await this.createSpreadsheet(this.params);
|
|
645
|
-
case 'add_sheet':
|
|
646
|
-
return await this.addSheet(this.params);
|
|
647
|
-
case 'delete_sheet':
|
|
648
|
-
return await this.deleteSheet(this.params);
|
|
649
|
-
default:
|
|
650
|
-
throw new Error(`Unsupported operation: ${operation}`);
|
|
651
|
-
}
|
|
652
|
-
})();
|
|
653
|
-
return result;
|
|
654
|
-
}
|
|
655
|
-
catch (error) {
|
|
656
|
-
return {
|
|
657
|
-
operation,
|
|
658
|
-
success: false,
|
|
659
|
-
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
async readValues(params) {
|
|
664
|
-
const { spreadsheet_id, range, major_dimension, value_render_option, date_time_render_option, } = params;
|
|
665
|
-
const queryParams = new URLSearchParams({
|
|
666
|
-
majorDimension: major_dimension || 'ROWS',
|
|
667
|
-
valueRenderOption: value_render_option || 'FORMATTED_VALUE',
|
|
668
|
-
dateTimeRenderOption: date_time_render_option || 'SERIAL_NUMBER',
|
|
669
|
-
});
|
|
670
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values/${encodeURIComponent(range)}?${queryParams.toString()}`);
|
|
671
|
-
return {
|
|
672
|
-
operation: 'read_values',
|
|
673
|
-
success: true,
|
|
674
|
-
range: response.range,
|
|
675
|
-
values: response.values || [],
|
|
676
|
-
major_dimension: response.majorDimension,
|
|
677
|
-
error: '',
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
async writeValues(params) {
|
|
681
|
-
const { spreadsheet_id, range, values, major_dimension, value_input_option, include_values_in_response, } = params;
|
|
682
|
-
const queryParams = new URLSearchParams({
|
|
683
|
-
valueInputOption: value_input_option || 'USER_ENTERED',
|
|
684
|
-
includeValuesInResponse: include_values_in_response?.toString() || 'false',
|
|
685
|
-
});
|
|
686
|
-
const body = {
|
|
687
|
-
range,
|
|
688
|
-
majorDimension: major_dimension,
|
|
689
|
-
values,
|
|
690
|
-
};
|
|
691
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values/${encodeURIComponent(range)}?${queryParams.toString()}`, 'PUT', body);
|
|
692
|
-
return {
|
|
693
|
-
operation: 'write_values',
|
|
694
|
-
success: true,
|
|
695
|
-
updated_range: response.updatedRange,
|
|
696
|
-
updated_rows: response.updatedRows,
|
|
697
|
-
updated_columns: response.updatedColumns,
|
|
698
|
-
updated_cells: response.updatedCells,
|
|
699
|
-
updated_data: response.updatedData,
|
|
700
|
-
error: '',
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
async updateValues(params) {
|
|
704
|
-
const { spreadsheet_id, range, values, major_dimension, value_input_option, include_values_in_response, } = params;
|
|
705
|
-
const queryParams = new URLSearchParams({
|
|
706
|
-
valueInputOption: value_input_option || 'USER_ENTERED',
|
|
707
|
-
includeValuesInResponse: include_values_in_response?.toString() || 'false',
|
|
708
|
-
});
|
|
709
|
-
const body = {
|
|
710
|
-
range,
|
|
711
|
-
majorDimension: major_dimension,
|
|
712
|
-
values,
|
|
713
|
-
};
|
|
714
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values/${encodeURIComponent(range)}?${queryParams.toString()}`, 'PUT', body);
|
|
715
|
-
return {
|
|
716
|
-
operation: 'update_values',
|
|
717
|
-
success: true,
|
|
718
|
-
updated_range: response.updatedRange,
|
|
719
|
-
updated_rows: response.updatedRows,
|
|
720
|
-
updated_columns: response.updatedColumns,
|
|
721
|
-
updated_cells: response.updatedCells,
|
|
722
|
-
updated_data: response.updatedData,
|
|
723
|
-
error: '',
|
|
724
|
-
};
|
|
725
|
-
}
|
|
726
|
-
async appendValues(params) {
|
|
727
|
-
const { spreadsheet_id, range, values, major_dimension, value_input_option, insert_data_option, include_values_in_response, } = params;
|
|
728
|
-
const queryParams = new URLSearchParams({
|
|
729
|
-
valueInputOption: value_input_option || 'USER_ENTERED',
|
|
730
|
-
insertDataOption: insert_data_option || 'INSERT_ROWS',
|
|
731
|
-
includeValuesInResponse: include_values_in_response?.toString() || 'false',
|
|
732
|
-
});
|
|
733
|
-
const body = {
|
|
734
|
-
range,
|
|
735
|
-
majorDimension: major_dimension,
|
|
736
|
-
values,
|
|
737
|
-
};
|
|
738
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values/${encodeURIComponent(range)}:append?${queryParams.toString()}`, 'POST', body);
|
|
739
|
-
return {
|
|
740
|
-
operation: 'append_values',
|
|
741
|
-
success: true,
|
|
742
|
-
table_range: response.tableRange,
|
|
743
|
-
updated_range: response.updates?.updatedRange,
|
|
744
|
-
updated_rows: response.updates?.updatedRows,
|
|
745
|
-
updated_columns: response.updates?.updatedColumns,
|
|
746
|
-
updated_cells: response.updates?.updatedCells,
|
|
747
|
-
error: '',
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
async clearValues(params) {
|
|
751
|
-
const { spreadsheet_id, range } = params;
|
|
752
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values/${encodeURIComponent(range)}:clear`, 'POST', {});
|
|
753
|
-
return {
|
|
754
|
-
operation: 'clear_values',
|
|
755
|
-
success: true,
|
|
756
|
-
cleared_range: response.clearedRange,
|
|
757
|
-
error: '',
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
async batchReadValues(params) {
|
|
761
|
-
const { spreadsheet_id, ranges, major_dimension, value_render_option, date_time_render_option, } = params;
|
|
762
|
-
const queryParams = new URLSearchParams({
|
|
763
|
-
majorDimension: major_dimension || 'ROWS',
|
|
764
|
-
valueRenderOption: value_render_option || 'FORMATTED_VALUE',
|
|
765
|
-
dateTimeRenderOption: date_time_render_option || 'SERIAL_NUMBER',
|
|
766
|
-
});
|
|
767
|
-
// Add multiple ranges
|
|
768
|
-
ranges.forEach((range) => queryParams.append('ranges', range));
|
|
769
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values:batchGet?${queryParams.toString()}`);
|
|
770
|
-
return {
|
|
771
|
-
operation: 'batch_read_values',
|
|
772
|
-
success: true,
|
|
773
|
-
value_ranges: response.valueRanges || [],
|
|
774
|
-
error: '',
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
async batchUpdateValues(params) {
|
|
778
|
-
const { spreadsheet_id, value_ranges, value_input_option, include_values_in_response, } = params;
|
|
779
|
-
const body = {
|
|
780
|
-
valueInputOption: value_input_option,
|
|
781
|
-
includeValuesInResponse: include_values_in_response,
|
|
782
|
-
data: value_ranges.map((vr) => ({
|
|
783
|
-
range: vr.range,
|
|
784
|
-
majorDimension: vr.major_dimension,
|
|
785
|
-
values: vr.values,
|
|
786
|
-
})),
|
|
787
|
-
};
|
|
788
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}/values:batchUpdate`, 'POST', body);
|
|
789
|
-
return {
|
|
790
|
-
operation: 'batch_update_values',
|
|
791
|
-
success: true,
|
|
792
|
-
total_updated_rows: response.totalUpdatedRows,
|
|
793
|
-
total_updated_columns: response.totalUpdatedColumns,
|
|
794
|
-
total_updated_cells: response.totalUpdatedCells,
|
|
795
|
-
total_updated_sheets: response.totalUpdatedSheets,
|
|
796
|
-
responses: response.responses?.map((r) => ({
|
|
797
|
-
updated_range: r.updatedRange,
|
|
798
|
-
updated_rows: r.updatedRows,
|
|
799
|
-
updated_columns: r.updatedColumns,
|
|
800
|
-
updated_cells: r.updatedCells,
|
|
801
|
-
})),
|
|
802
|
-
error: '',
|
|
803
|
-
};
|
|
804
|
-
}
|
|
805
|
-
async getSpreadsheetInfo(params) {
|
|
806
|
-
const { spreadsheet_id, include_grid_data } = params;
|
|
807
|
-
const queryParams = new URLSearchParams();
|
|
808
|
-
if (include_grid_data) {
|
|
809
|
-
queryParams.set('includeGridData', 'true');
|
|
810
|
-
}
|
|
811
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}?${queryParams.toString()}`);
|
|
812
|
-
return {
|
|
813
|
-
operation: 'get_spreadsheet_info',
|
|
814
|
-
success: true,
|
|
815
|
-
spreadsheet: response,
|
|
816
|
-
error: '',
|
|
817
|
-
};
|
|
818
|
-
}
|
|
819
|
-
async createSpreadsheet(params) {
|
|
820
|
-
const { title, sheet_titles } = params;
|
|
821
|
-
if (!sheet_titles) {
|
|
822
|
-
throw new Error('Sheet titles are required');
|
|
823
|
-
}
|
|
824
|
-
const body = {
|
|
825
|
-
properties: {
|
|
826
|
-
title,
|
|
827
|
-
},
|
|
828
|
-
sheets: sheet_titles.map((sheetTitle, index) => ({
|
|
829
|
-
properties: {
|
|
830
|
-
title: sheetTitle,
|
|
831
|
-
index,
|
|
832
|
-
sheetType: 'GRID',
|
|
833
|
-
gridProperties: {
|
|
834
|
-
rowCount: 1000,
|
|
835
|
-
columnCount: 26,
|
|
836
|
-
},
|
|
837
|
-
},
|
|
838
|
-
})),
|
|
839
|
-
};
|
|
840
|
-
const response = await this.makeSheetsApiRequest('/spreadsheets', 'POST', body);
|
|
841
|
-
return {
|
|
842
|
-
operation: 'create_spreadsheet',
|
|
843
|
-
success: true,
|
|
844
|
-
spreadsheet: response,
|
|
845
|
-
error: '',
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
async addSheet(params) {
|
|
849
|
-
const { spreadsheet_id, sheet_title, row_count, column_count } = params;
|
|
850
|
-
const body = {
|
|
851
|
-
requests: [
|
|
852
|
-
{
|
|
853
|
-
addSheet: {
|
|
854
|
-
properties: {
|
|
855
|
-
title: sheet_title,
|
|
856
|
-
sheetType: 'GRID',
|
|
857
|
-
gridProperties: {
|
|
858
|
-
rowCount: row_count,
|
|
859
|
-
columnCount: column_count,
|
|
860
|
-
},
|
|
861
|
-
},
|
|
862
|
-
},
|
|
863
|
-
},
|
|
864
|
-
],
|
|
865
|
-
};
|
|
866
|
-
const response = await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}:batchUpdate`, 'POST', body);
|
|
867
|
-
const addSheetResponse = response.replies?.[0]?.addSheet;
|
|
868
|
-
return {
|
|
869
|
-
operation: 'add_sheet',
|
|
870
|
-
success: true,
|
|
871
|
-
sheet_id: addSheetResponse?.properties?.sheetId,
|
|
872
|
-
sheet_title: addSheetResponse?.properties?.title,
|
|
873
|
-
error: '',
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
async deleteSheet(params) {
|
|
877
|
-
const { spreadsheet_id, sheet_id } = params;
|
|
878
|
-
const body = {
|
|
879
|
-
requests: [
|
|
880
|
-
{
|
|
881
|
-
deleteSheet: {
|
|
882
|
-
sheetId: sheet_id,
|
|
883
|
-
},
|
|
884
|
-
},
|
|
885
|
-
],
|
|
886
|
-
};
|
|
887
|
-
await this.makeSheetsApiRequest(`/spreadsheets/${spreadsheet_id}:batchUpdate`, 'POST', body);
|
|
888
|
-
return {
|
|
889
|
-
operation: 'delete_sheet',
|
|
890
|
-
success: true,
|
|
891
|
-
deleted_sheet_id: sheet_id,
|
|
892
|
-
error: '',
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
chooseCredential() {
|
|
896
|
-
const { credentials } = this.params;
|
|
897
|
-
if (!credentials || typeof credentials !== 'object') {
|
|
898
|
-
throw new Error('No Google Sheets credentials provided');
|
|
899
|
-
}
|
|
900
|
-
// Google Sheets bubble uses GOOGLE_SHEETS_CRED credentials
|
|
901
|
-
return credentials[CredentialType.GOOGLE_SHEETS_CRED];
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
//# sourceMappingURL=google-sheets.js.map
|