@frogbotai/piece-google-sheets 0.22.0 → 0.24.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/dist/shared.js ADDED
@@ -0,0 +1,136 @@
1
+ import { z } from 'zod';
2
+ export const rowNumber = z.number().int().positive().max(10_000_000);
3
+ export const sheetInput = z.object({
4
+ spreadsheetId: z.string().min(1),
5
+ sheetId: z.number().int().nonnegative(),
6
+ });
7
+ export const cell = z.json();
8
+ export const rowValues = z.union([
9
+ z.array(cell).min(1).max(18278),
10
+ z.record(z.string(), cell).refine((value) => Object.keys(value).length > 0),
11
+ ]);
12
+ export const valueInputOption = z.enum(['RAW', 'USER_ENTERED']).default('USER_ENTERED');
13
+ export const readInput = sheetInput.extend({
14
+ headerRow: rowNumber.default(1),
15
+ useHeaderNames: z.boolean().default(false),
16
+ });
17
+ export const rowOutput = z.object({ row: rowNumber, values: z.record(z.string(), z.string()) });
18
+ export const updateOutput = z
19
+ .object({
20
+ spreadsheetId: z.string().nullish(),
21
+ updatedRange: z.string().nullish(),
22
+ updatedRows: z.number().nullish(),
23
+ updatedColumns: z.number().nullish(),
24
+ updatedCells: z.number().nullish(),
25
+ })
26
+ .passthrough();
27
+ export const batchOutput = z
28
+ .object({ spreadsheetId: z.string().nullish(), replies: z.array(z.json()).nullish() })
29
+ .passthrough();
30
+ export const worksheetOutput = z
31
+ .object({
32
+ sheetId: z.number().int(),
33
+ title: z.string(),
34
+ index: z.number().nullish(),
35
+ gridProperties: z
36
+ .object({ rowCount: z.number().nullish(), columnCount: z.number().nullish() })
37
+ .passthrough()
38
+ .nullish(),
39
+ })
40
+ .passthrough();
41
+ export function requestOptions(req) {
42
+ req.signal?.throwIfAborted();
43
+ return {
44
+ signal: req.signal ?? undefined,
45
+ redirect: 'error',
46
+ maxRedirects: 0,
47
+ retry: false,
48
+ };
49
+ }
50
+ export function columnLabel(index) {
51
+ if (!Number.isInteger(index) || index < 0 || index >= 18278) {
52
+ throw new Error('Column index must be between 0 and 18277.');
53
+ }
54
+ let label = '';
55
+ for (let value = index; value >= 0; value = Math.floor(value / 26) - 1) {
56
+ label = String.fromCharCode(65 + (value % 26)) + label;
57
+ }
58
+ return label;
59
+ }
60
+ export function columnIndex(label) {
61
+ if (!/^[A-Z]{1,3}$/.test(label))
62
+ throw new Error(`Invalid column label '${label}'.`);
63
+ return [...label].reduce((index, char) => index * 26 + char.charCodeAt(0) - 64, 0) - 1;
64
+ }
65
+ export function sheetRange(title, range) {
66
+ return `'${title.replaceAll("'", "''")}'${range ? `!${range}` : ''}`;
67
+ }
68
+ export async function worksheet({ client, req, input }) {
69
+ const { data } = await client.sheets.spreadsheets.get({ spreadsheetId: input.spreadsheetId, fields: 'sheets.properties' }, requestOptions(req));
70
+ const result = data.sheets?.find((sheet) => sheet.properties?.sheetId === input.sheetId)?.properties;
71
+ if (!result?.title) {
72
+ throw new Error(`Worksheet ${input.sheetId} not found in spreadsheet '${input.spreadsheetId}'.`);
73
+ }
74
+ return result;
75
+ }
76
+ export async function readValues({ client, req, spreadsheetId, range, }) {
77
+ return ((await client.sheets.spreadsheets.values.get({ spreadsheetId, range }, requestOptions(req)))
78
+ .data.values ?? []);
79
+ }
80
+ export function mapRows({ values, startRow, headers, useHeaderNames, }) {
81
+ return values.map((values, index) => ({
82
+ row: startRow + index,
83
+ values: Object.fromEntries(Array.from({ length: Math.max(values.length, headers.length) }, (_, column) => [
84
+ useHeaderNames && headers[column] ? String(headers[column]) : columnLabel(column),
85
+ String(values[column] ?? ''),
86
+ ])),
87
+ }));
88
+ }
89
+ export async function readRows(args, startRow = 1, endRow) {
90
+ const sheet = await worksheet(args);
91
+ const count = sheet.gridProperties?.rowCount;
92
+ if (count != null && startRow > count)
93
+ return [];
94
+ const end = endRow == null ? '' : Math.min(endRow, count ?? endRow);
95
+ const values = await readValues({
96
+ ...args,
97
+ spreadsheetId: args.input.spreadsheetId,
98
+ range: sheetRange(sheet.title, `A${startRow}:ZZZ${end}`),
99
+ });
100
+ if (!values.length)
101
+ return [];
102
+ const headers = (await readValues({
103
+ ...args,
104
+ spreadsheetId: args.input.spreadsheetId,
105
+ range: sheetRange(sheet.title, `${args.input.headerRow}:${args.input.headerRow}`),
106
+ }))[0] ?? [];
107
+ return mapRows({ values, headers, startRow, useHeaderNames: args.input.useHeaderNames });
108
+ }
109
+ export function cells(values, updating = false) {
110
+ let ordered;
111
+ if (Array.isArray(values))
112
+ ordered = values;
113
+ else {
114
+ const entries = Object.entries(values).map(([key, value]) => [columnIndex(key), value]);
115
+ ordered = Array.from({ length: Math.max(...entries.map(([index]) => index)) + 1 }, () => null);
116
+ for (const [index, value] of entries)
117
+ ordered[index] = value;
118
+ }
119
+ return ordered.map((value) => {
120
+ if (value == null || value === '')
121
+ return updating ? null : '';
122
+ return typeof value === 'object'
123
+ ? JSON.stringify(value, null, updating ? 2 : undefined)
124
+ : value;
125
+ });
126
+ }
127
+ export function updatedRow(range) {
128
+ const match = range?.match(/![A-Z]+(\d+)(?::|$)/);
129
+ if (!match)
130
+ throw new Error('Google Sheets did not return an updated row range.');
131
+ return Number(match[1]);
132
+ }
133
+ export async function batch(args, requests) {
134
+ return (await args.client.sheets.spreadsheets.batchUpdate({ spreadsheetId: args.input.spreadsheetId, requestBody: { requests } }, requestOptions(args.req))).data;
135
+ }
136
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,C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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACvD,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAgC;IACzD,MAAM,KAAK,GAAG,KAAK,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAClF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,IAA2C,EAC3C,QAAoC;IAEpC,OAAO,CACL,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,WAAW,CAC/C,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,EAAE,EACtE,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,CACzB,CACF,CAAC,IAAI,CAAC;AACT,CAAC"}
@@ -0,0 +1,376 @@
1
+ import type { sheets_v4 } from 'googleapis';
2
+ import { z } from 'zod';
3
+ import { sheetInput, type SheetsArgs } from './shared.js';
4
+ declare const createSpreadsheetInput: z.ZodObject<{
5
+ title: z.ZodString;
6
+ folderId: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ export declare const createSpreadsheet: {
9
+ slug: "createSpreadsheet";
10
+ description: string;
11
+ input: z.ZodObject<{
12
+ title: z.ZodString;
13
+ folderId: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ output: z.ZodObject<{
16
+ id: z.ZodString;
17
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
+ webViewLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ createdTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ modifiedTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ }, z.core.$loose>;
22
+ idempotent: boolean;
23
+ run({ client, req, input }: SheetsArgs<z.output<typeof createSpreadsheetInput>>): Promise<import("googleapis").drive_v3.Schema$File>;
24
+ };
25
+ declare const createInput: z.ZodObject<{
26
+ spreadsheetId: z.ZodString;
27
+ title: z.ZodString;
28
+ headers: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ }, z.core.$strip>;
30
+ declare function addWorksheet(args: SheetsArgs<z.output<typeof createInput>>): Promise<{
31
+ [x: string]: unknown;
32
+ sheetId: number;
33
+ title: string;
34
+ index?: number | null | undefined;
35
+ gridProperties?: {
36
+ [x: string]: unknown;
37
+ rowCount?: number | null | undefined;
38
+ columnCount?: number | null | undefined;
39
+ } | null | undefined;
40
+ }>;
41
+ export declare const createWorksheet: {
42
+ slug: "createWorksheet";
43
+ description: string;
44
+ input: z.ZodObject<{
45
+ spreadsheetId: z.ZodString;
46
+ title: z.ZodString;
47
+ headers: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ }, z.core.$strip>;
49
+ output: z.ZodObject<{
50
+ sheetId: z.ZodNumber;
51
+ title: z.ZodString;
52
+ index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
53
+ gridProperties: z.ZodOptional<z.ZodNullable<z.ZodObject<{
54
+ rowCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
55
+ columnCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
56
+ }, z.core.$loose>>>;
57
+ }, z.core.$loose>;
58
+ idempotent: boolean;
59
+ run: typeof addWorksheet;
60
+ };
61
+ export declare const findOrCreateWorksheet: {
62
+ slug: "findOrCreateWorksheet";
63
+ description: string;
64
+ input: z.ZodObject<{
65
+ spreadsheetId: z.ZodString;
66
+ title: z.ZodString;
67
+ headers: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ }, z.core.$strip>;
69
+ output: z.ZodObject<{
70
+ found: z.ZodBoolean;
71
+ created: z.ZodBoolean;
72
+ worksheet: z.ZodObject<{
73
+ sheetId: z.ZodNumber;
74
+ title: z.ZodString;
75
+ index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
76
+ gridProperties: z.ZodOptional<z.ZodNullable<z.ZodObject<{
77
+ rowCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
+ columnCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
79
+ }, z.core.$loose>>>;
80
+ }, z.core.$loose>;
81
+ }, z.core.$strip>;
82
+ idempotent: boolean;
83
+ run(args: SheetsArgs<z.output<typeof createInput>>): Promise<{
84
+ found: boolean;
85
+ created: boolean;
86
+ worksheet: {
87
+ [x: string]: unknown;
88
+ sheetId: number;
89
+ title: string;
90
+ index?: number | null | undefined;
91
+ gridProperties?: {
92
+ [x: string]: unknown;
93
+ rowCount?: number | null | undefined;
94
+ columnCount?: number | null | undefined;
95
+ } | null | undefined;
96
+ };
97
+ }>;
98
+ };
99
+ declare const clearSheetInput: z.ZodObject<{
100
+ spreadsheetId: z.ZodString;
101
+ sheetId: z.ZodNumber;
102
+ preserveHeaders: z.ZodDefault<z.ZodBoolean>;
103
+ headerRow: z.ZodDefault<z.ZodNumber>;
104
+ }, z.core.$strip>;
105
+ export declare const clearWorksheet: {
106
+ slug: "clearWorksheet";
107
+ description: string;
108
+ input: z.ZodObject<{
109
+ spreadsheetId: z.ZodString;
110
+ sheetId: z.ZodNumber;
111
+ preserveHeaders: z.ZodDefault<z.ZodBoolean>;
112
+ headerRow: z.ZodDefault<z.ZodNumber>;
113
+ }, z.core.$strip>;
114
+ output: z.ZodObject<{
115
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
+ clearedRange: z.ZodOptional<z.ZodNullable<z.ZodString>>;
117
+ }, z.core.$strip>;
118
+ idempotent: boolean;
119
+ run(args: SheetsArgs<z.output<typeof clearSheetInput>>): Promise<sheets_v4.Schema$ClearValuesResponse>;
120
+ };
121
+ declare const rangeInput: z.ZodObject<{
122
+ spreadsheetId: z.ZodString;
123
+ sheetId: z.ZodNumber;
124
+ startRow: z.ZodNumber;
125
+ endRow: z.ZodOptional<z.ZodNumber>;
126
+ }, z.core.$strip>;
127
+ export declare const clearRows: {
128
+ slug: "clearRows";
129
+ description: string;
130
+ input: z.ZodObject<{
131
+ spreadsheetId: z.ZodString;
132
+ sheetId: z.ZodNumber;
133
+ startRow: z.ZodNumber;
134
+ endRow: z.ZodOptional<z.ZodNumber>;
135
+ }, z.core.$strip>;
136
+ output: z.ZodObject<{
137
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ clearedRange: z.ZodOptional<z.ZodNullable<z.ZodString>>;
139
+ }, z.core.$strip>;
140
+ idempotent: boolean;
141
+ run(args: SheetsArgs<z.output<typeof rangeInput>>): Promise<sheets_v4.Schema$ClearValuesResponse>;
142
+ };
143
+ export declare const deleteWorksheet: {
144
+ slug: "deleteWorksheet";
145
+ description: string;
146
+ input: z.ZodObject<{
147
+ spreadsheetId: z.ZodString;
148
+ sheetId: z.ZodNumber;
149
+ }, z.core.$strip>;
150
+ output: z.ZodObject<{
151
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
+ replies: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodJSONSchema>>>;
153
+ }, z.core.$loose>;
154
+ idempotent: boolean;
155
+ run: (args: SheetsArgs<z.output<typeof sheetInput>>) => Promise<sheets_v4.Schema$BatchUpdateSpreadsheetResponse>;
156
+ };
157
+ declare const renameInput: z.ZodObject<{
158
+ spreadsheetId: z.ZodString;
159
+ sheetId: z.ZodNumber;
160
+ title: z.ZodString;
161
+ }, z.core.$strip>;
162
+ export declare const renameWorksheet: {
163
+ slug: "renameWorksheet";
164
+ description: string;
165
+ input: z.ZodObject<{
166
+ spreadsheetId: z.ZodString;
167
+ sheetId: z.ZodNumber;
168
+ title: z.ZodString;
169
+ }, z.core.$strip>;
170
+ output: z.ZodObject<{
171
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ replies: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodJSONSchema>>>;
173
+ }, z.core.$loose>;
174
+ idempotent: boolean;
175
+ run: (args: SheetsArgs<z.output<typeof renameInput>>) => Promise<sheets_v4.Schema$BatchUpdateSpreadsheetResponse>;
176
+ };
177
+ declare const formatInput: z.ZodObject<{
178
+ spreadsheetId: z.ZodString;
179
+ sheetId: z.ZodNumber;
180
+ startRow: z.ZodNumber;
181
+ endRow: z.ZodOptional<z.ZodNumber>;
182
+ backgroundColor: z.ZodOptional<z.ZodString>;
183
+ textColor: z.ZodOptional<z.ZodString>;
184
+ bold: z.ZodOptional<z.ZodBoolean>;
185
+ italic: z.ZodOptional<z.ZodBoolean>;
186
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
187
+ }, z.core.$strip>;
188
+ export declare const formatRows: {
189
+ slug: "formatRows";
190
+ description: string;
191
+ input: z.ZodObject<{
192
+ spreadsheetId: z.ZodString;
193
+ sheetId: z.ZodNumber;
194
+ startRow: z.ZodNumber;
195
+ endRow: z.ZodOptional<z.ZodNumber>;
196
+ backgroundColor: z.ZodOptional<z.ZodString>;
197
+ textColor: z.ZodOptional<z.ZodString>;
198
+ bold: z.ZodOptional<z.ZodBoolean>;
199
+ italic: z.ZodOptional<z.ZodBoolean>;
200
+ strikethrough: z.ZodOptional<z.ZodBoolean>;
201
+ }, z.core.$strip>;
202
+ output: z.ZodObject<{
203
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
204
+ replies: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodJSONSchema>>>;
205
+ }, z.core.$loose>;
206
+ idempotent: boolean;
207
+ run(args: SheetsArgs<z.output<typeof formatInput>>): Promise<sheets_v4.Schema$BatchUpdateSpreadsheetResponse>;
208
+ };
209
+ declare const readRangeInput: z.ZodObject<{
210
+ spreadsheetId: z.ZodString;
211
+ sheetId: z.ZodNumber;
212
+ range: z.ZodOptional<z.ZodString>;
213
+ majorDimension: z.ZodDefault<z.ZodEnum<{
214
+ ROWS: "ROWS";
215
+ COLUMNS: "COLUMNS";
216
+ }>>;
217
+ valueRenderOption: z.ZodDefault<z.ZodEnum<{
218
+ FORMATTED_VALUE: "FORMATTED_VALUE";
219
+ UNFORMATTED_VALUE: "UNFORMATTED_VALUE";
220
+ FORMULA: "FORMULA";
221
+ }>>;
222
+ }, z.core.$strip>;
223
+ export declare const readRange: {
224
+ slug: "readRange";
225
+ description: string;
226
+ input: z.ZodObject<{
227
+ spreadsheetId: z.ZodString;
228
+ sheetId: z.ZodNumber;
229
+ range: z.ZodOptional<z.ZodString>;
230
+ majorDimension: z.ZodDefault<z.ZodEnum<{
231
+ ROWS: "ROWS";
232
+ COLUMNS: "COLUMNS";
233
+ }>>;
234
+ valueRenderOption: z.ZodDefault<z.ZodEnum<{
235
+ FORMATTED_VALUE: "FORMATTED_VALUE";
236
+ UNFORMATTED_VALUE: "UNFORMATTED_VALUE";
237
+ FORMULA: "FORMULA";
238
+ }>>;
239
+ }, z.core.$strip>;
240
+ output: z.ZodObject<{
241
+ range: z.ZodString;
242
+ majorDimension: z.ZodEnum<{
243
+ ROWS: "ROWS";
244
+ COLUMNS: "COLUMNS";
245
+ }>;
246
+ values: z.ZodArray<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>>;
247
+ }, z.core.$strip>;
248
+ idempotent: boolean;
249
+ run(args: SheetsArgs<z.output<typeof readRangeInput>>): Promise<{
250
+ range: string;
251
+ majorDimension: "ROWS" | "COLUMNS";
252
+ values: any[][];
253
+ }>;
254
+ };
255
+ declare const findSpreadsheetInput: z.ZodObject<{
256
+ name: z.ZodString;
257
+ exactMatch: z.ZodDefault<z.ZodBoolean>;
258
+ includeSharedDrives: z.ZodDefault<z.ZodBoolean>;
259
+ }, z.core.$strip>;
260
+ export declare const findSpreadsheets: {
261
+ slug: "findSpreadsheets";
262
+ description: string;
263
+ input: z.ZodObject<{
264
+ name: z.ZodString;
265
+ exactMatch: z.ZodDefault<z.ZodBoolean>;
266
+ includeSharedDrives: z.ZodDefault<z.ZodBoolean>;
267
+ }, z.core.$strip>;
268
+ output: z.ZodObject<{
269
+ found: z.ZodBoolean;
270
+ spreadsheets: z.ZodArray<z.ZodObject<{
271
+ id: z.ZodString;
272
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
273
+ webViewLink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
274
+ createdTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
275
+ modifiedTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
+ }, z.core.$loose>>;
277
+ }, z.core.$strip>;
278
+ idempotent: boolean;
279
+ run({ client, input, req }: SheetsArgs<z.output<typeof findSpreadsheetInput>>): Promise<{
280
+ found: boolean;
281
+ spreadsheets: import("googleapis").drive_v3.Schema$File[];
282
+ }>;
283
+ };
284
+ declare const findWorksheetInput: z.ZodObject<{
285
+ spreadsheetId: z.ZodString;
286
+ title: z.ZodString;
287
+ exactMatch: z.ZodDefault<z.ZodBoolean>;
288
+ }, z.core.$strip>;
289
+ export declare const findWorksheets: {
290
+ slug: "findWorksheets";
291
+ description: string;
292
+ input: z.ZodObject<{
293
+ spreadsheetId: z.ZodString;
294
+ title: z.ZodString;
295
+ exactMatch: z.ZodDefault<z.ZodBoolean>;
296
+ }, z.core.$strip>;
297
+ output: z.ZodObject<{
298
+ found: z.ZodBoolean;
299
+ worksheets: z.ZodArray<z.ZodObject<{
300
+ sheetId: z.ZodNumber;
301
+ title: z.ZodString;
302
+ index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
303
+ gridProperties: z.ZodOptional<z.ZodNullable<z.ZodObject<{
304
+ rowCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
305
+ columnCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
306
+ }, z.core.$loose>>>;
307
+ }, z.core.$loose>>;
308
+ }, z.core.$strip>;
309
+ idempotent: boolean;
310
+ run({ client, req, input }: SheetsArgs<z.output<typeof findWorksheetInput>>): Promise<{
311
+ found: boolean;
312
+ worksheets: sheets_v4.Schema$SheetProperties[];
313
+ }>;
314
+ };
315
+ declare const copyInput: z.ZodObject<{
316
+ spreadsheetId: z.ZodString;
317
+ sheetId: z.ZodNumber;
318
+ destinationSpreadsheetId: z.ZodString;
319
+ }, z.core.$strip>;
320
+ export declare const copyWorksheet: {
321
+ slug: "copyWorksheet";
322
+ description: string;
323
+ input: z.ZodObject<{
324
+ spreadsheetId: z.ZodString;
325
+ sheetId: z.ZodNumber;
326
+ destinationSpreadsheetId: z.ZodString;
327
+ }, z.core.$strip>;
328
+ output: z.ZodObject<{
329
+ sheetId: z.ZodNumber;
330
+ title: z.ZodString;
331
+ index: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
332
+ gridProperties: z.ZodOptional<z.ZodNullable<z.ZodObject<{
333
+ rowCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
334
+ columnCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
335
+ }, z.core.$loose>>>;
336
+ }, z.core.$loose>;
337
+ idempotent: boolean;
338
+ run({ client, req, input }: SheetsArgs<z.output<typeof copyInput>>): Promise<sheets_v4.Schema$SheetProperties>;
339
+ };
340
+ declare const columnInput: z.ZodObject<{
341
+ spreadsheetId: z.ZodString;
342
+ sheetId: z.ZodNumber;
343
+ name: z.ZodString;
344
+ index: z.ZodOptional<z.ZodNumber>;
345
+ headerRow: z.ZodDefault<z.ZodNumber>;
346
+ }, z.core.$strip>;
347
+ export declare const createColumn: {
348
+ slug: "createColumn";
349
+ description: string;
350
+ input: z.ZodObject<{
351
+ spreadsheetId: z.ZodString;
352
+ sheetId: z.ZodNumber;
353
+ name: z.ZodString;
354
+ index: z.ZodOptional<z.ZodNumber>;
355
+ headerRow: z.ZodDefault<z.ZodNumber>;
356
+ }, z.core.$strip>;
357
+ output: z.ZodObject<{
358
+ column: z.ZodString;
359
+ index: z.ZodNumber;
360
+ updates: z.ZodObject<{
361
+ spreadsheetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
362
+ updatedRange: z.ZodOptional<z.ZodNullable<z.ZodString>>;
363
+ updatedRows: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
364
+ updatedColumns: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
365
+ updatedCells: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
366
+ }, z.core.$loose>;
367
+ }, z.core.$strip>;
368
+ idempotent: boolean;
369
+ run(args: SheetsArgs<z.output<typeof columnInput>>): Promise<{
370
+ column: string;
371
+ index: number;
372
+ updates: sheets_v4.Schema$UpdateValuesResponse;
373
+ }>;
374
+ };
375
+ export {};
376
+ //# sourceMappingURL=worksheets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worksheets.d.ts","sourceRoot":"","sources":["../src/worksheets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAOL,UAAU,EAEV,KAAK,UAAU,EAIhB,MAAM,aAAa,CAAC;AAErB,QAAA,MAAM,sBAAsB;;;iBAG1B,CAAC;AAUH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;gCAMM,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;CAgBtF,CAAC;AAEF,QAAA,MAAM,WAAW;;;;iBAIf,CAAC;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;;;;;;;;;;GAkBzE;AACD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;CAO3B,CAAC;AACF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;cAMhB,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAA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