@frogbotai/piece-google-sheets 0.31.0 → 0.32.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/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # `@frogbotai/piece-google-sheets`
2
+
3
+ Read and write Google Sheets spreadsheets.
4
+
5
+ ## Usage
6
+
7
+ ```ts
8
+ import { createGoogle } from '@frogbotai/piece-google';
9
+ import { createGoogleSheets } from '@frogbotai/piece-google-sheets';
10
+
11
+ export const google = createGoogle({
12
+ oauth: {
13
+ clientId: process.env.GOOGLE_CLIENT_ID!,
14
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
15
+ },
16
+ });
17
+ export const googleSheets = createGoogleSheets({ oauth: google.oauth });
18
+ ```
19
+
20
+ ## OAuth scopes
21
+
22
+ Change the requested scopes with the factory's `scopes` option: `createGoogleSheets({ oauth, scopes: ({ defaultScopes }) => [...defaultScopes, 'spreadsheets.readonly'] })` adds one, and an array replaces the defaults. `googleSheetsScopes` maps each name to the provider's scope string. Names stand for `https://www.googleapis.com/auth/<name>`, except `openid`.
23
+
24
+ - Always requested: `openid`, `userinfo.email`, `userinfo.profile`.
25
+ - Defaults: `spreadsheets`, `drive.readonly`, `drive`.
26
+ - Also available: `spreadsheets.readonly`, `drive.file`.
package/dist/api.d.ts CHANGED
@@ -36,60 +36,5 @@ export declare const exportWorksheet: import("frogbot").PieceActionDefinition<z.
36
36
  }> & {
37
37
  slug: "exportWorksheet";
38
38
  };
39
- export declare const customApiCall: import("frogbot").PieceActionDefinition<z.ZodObject<{
40
- method: z.ZodDefault<z.ZodEnum<{
41
- GET: "GET";
42
- POST: "POST";
43
- PUT: "PUT";
44
- PATCH: "PATCH";
45
- DELETE: "DELETE";
46
- HEAD: "HEAD";
47
- }>>;
48
- path: z.ZodString;
49
- query: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
50
- headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
51
- body: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
52
- type: z.ZodLiteral<"json">;
53
- value: z.ZodJSONSchema;
54
- }, z.core.$strip>, z.ZodObject<{
55
- type: z.ZodLiteral<"raw">;
56
- value: z.ZodString;
57
- }, z.core.$strip>, z.ZodObject<{
58
- type: z.ZodLiteral<"form">;
59
- fields: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
60
- name: z.ZodString;
61
- value: z.ZodString;
62
- }, z.core.$strip>, z.ZodObject<{
63
- name: z.ZodString;
64
- file: z.ZodObject<{
65
- fileId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
66
- name: z.ZodOptional<z.ZodString>;
67
- }, z.core.$strip>;
68
- }, z.core.$strip>]>>;
69
- }, z.core.$strip>]>>;
70
- binary: z.ZodDefault<z.ZodBoolean>;
71
- filename: z.ZodDefault<z.ZodString>;
72
- failOnError: z.ZodDefault<z.ZodBoolean>;
73
- timeoutMs: z.ZodDefault<z.ZodNumber>;
74
- }, z.core.$strip>, z.ZodObject<{
75
- status: z.ZodNumber;
76
- headers: z.ZodRecord<z.ZodString, z.ZodString>;
77
- body: z.ZodOptional<z.ZodJSONSchema>;
78
- file: z.ZodOptional<z.ZodObject<{
79
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
80
- filename: z.ZodString;
81
- url: z.ZodOptional<z.ZodString>;
82
- }, z.core.$strip>>;
83
- }, z.core.$strip>, Record<string, never>, import("./client.js").GoogleSheetsClient, {
84
- status: number;
85
- headers: Record<string, string>;
86
- body?: z.core.util.JSONType | undefined;
87
- file?: {
88
- id: string | number;
89
- filename: string;
90
- url?: string | undefined;
91
- } | undefined;
92
- }> & {
93
- slug: "customApiCall";
94
- };
39
+ export declare const customApiCall: import("frogbot/pieces").CustomApiCallAction<Record<string, never>, import("./client.js").GoogleSheetsClient>;
95
40
  //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE1B,CAAC;AA4BH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFxB,CAAC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqE1B,CAAC;AAEH,eAAO,MAAM,aAAa,+GAUxB,CAAC"}
package/dist/api.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { defineAction } from './define.js';
3
- import { fileReference, loadFile, savedFile, saveFile } from './files.js';
2
+ import { defineAction, defineCustomApiCall } from './define.js';
3
+ import { savedFile, saveFile } from './files.js';
4
4
  import { requestOptions, sheetInput } from './shared.js';
5
5
  const exportInput = sheetInput.extend({
6
6
  format: z.enum([
@@ -75,128 +75,16 @@ export const exportWorksheet = defineAction({
75
75
  throw new Error('Worksheet export exceeded the redirect limit.');
76
76
  }
77
77
  });
78
- const customInput = z.object({
79
- method: z.enum([
80
- 'GET',
81
- 'POST',
82
- 'PUT',
83
- 'PATCH',
84
- 'DELETE',
85
- 'HEAD'
86
- ]).default('GET'),
87
- path: z.string().startsWith('/'),
88
- query: z.record(z.string(), z.union([
89
- z.string(),
90
- z.number(),
91
- z.boolean()
92
- ])).optional(),
93
- headers: z.record(z.string(), z.string()).optional(),
94
- body: z.union([
95
- z.object({
96
- type: z.literal('json'),
97
- value: z.json()
98
- }),
99
- z.object({
100
- type: z.literal('raw'),
101
- value: z.string()
102
- }),
103
- z.object({
104
- type: z.literal('form'),
105
- fields: z.array(z.union([
106
- z.object({
107
- name: z.string(),
108
- value: z.string()
109
- }),
110
- z.object({
111
- name: z.string(),
112
- file: fileReference
113
- })
114
- ]))
115
- })
116
- ]).optional(),
117
- binary: z.boolean().default(false),
118
- filename: z.string().min(1).default('response.bin'),
119
- failOnError: z.boolean().default(true),
120
- timeoutMs: z.number().int().positive().max(300_000).default(30_000)
121
- });
122
- export const customApiCall = defineAction({
123
- slug: 'customApiCall',
124
- description: 'Call a Sheets v4 endpoint under /spreadsheets with redirects disabled.',
125
- input: customInput,
126
- output: z.object({
127
- status: z.number().int(),
128
- headers: z.record(z.string(), z.string()),
129
- body: z.json().optional(),
130
- file: savedFile.optional()
131
- }),
132
- idempotent: false,
133
- async run ({ client, req, input }) {
134
- const url = new URL(`https://sheets.googleapis.com/v4${input.path}`);
135
- if (/[\\\r\n]/.test(input.path) || url.origin !== 'https://sheets.googleapis.com' || !/^\/v4\/spreadsheets(?:\/|$|:)/.test(url.pathname) || url.hash || url.username || url.password) {
136
- throw new Error('Custom API paths must remain inside the Google Sheets v4 spreadsheets API.');
137
- }
138
- const headers = new Headers(input.headers);
139
- for (const name of headers.keys()){
140
- if ([
141
- 'authorization',
142
- 'cookie',
143
- 'host',
144
- 'proxy-authorization',
145
- 'x-goog-api-key'
146
- ].includes(name)) {
147
- throw new Error(`Custom header '${name}' is reserved.`);
148
- }
149
- }
150
- let data;
151
- if (input.body?.type === 'form') {
152
- const form = new FormData();
153
- for (const field of input.body.fields){
154
- if ('value' in field) form.append(field.name, field.value);
155
- else {
156
- const file = await loadFile({
157
- req,
158
- file: field.file
159
- });
160
- form.append(field.name, file.blob, file.name);
161
- }
162
- }
163
- data = form;
164
- } else if (input.body) {
165
- data = input.body.value === null ? 'null' : input.body.value;
166
- if (input.body.type === 'json' && !headers.has('content-type')) {
167
- headers.set('content-type', 'application/json');
168
- }
169
- }
170
- const response = await client.auth.request({
171
- ...requestOptions(req),
172
- url: url.toString(),
173
- method: input.method,
174
- params: input.query,
175
- headers,
176
- data,
177
- timeout: input.timeoutMs,
178
- responseType: input.binary ? 'arraybuffer' : 'json',
179
- validateStatus: (status)=>input.failOnError ? status >= 200 && status < 300 : status < 300 || status >= 400
180
- });
181
- const result = {
182
- status: response.status,
183
- headers: Object.fromEntries(response.headers.entries())
184
- };
185
- if (input.binary) {
186
- return {
187
- ...result,
188
- file: await saveFile({
189
- req,
190
- data: Buffer.from(response.data),
191
- name: input.filename,
192
- mimeType: response.headers.get('content-type') ?? 'application/octet-stream'
193
- })
194
- };
195
- }
196
- return {
197
- ...result,
198
- body: response.data == null || response.data === '' ? null : z.json().parse(response.data)
199
- };
78
+ export const customApiCall = defineCustomApiCall({
79
+ name: 'Google Sheets',
80
+ description: 'Call a Sheets v4 endpoint under /spreadsheets with the connected credential. Returns { status, headers, body }.',
81
+ baseUrl: 'https://sheets.googleapis.com/v4',
82
+ path: /^\/spreadsheets(?:[/:]|$)/,
83
+ reservedHeaders: [
84
+ 'x-goog-api-key'
85
+ ],
86
+ authorize: async ({ client, url, headers })=>{
87
+ (await client.auth.getRequestHeaders(url)).forEach((value, key)=>headers.set(key, value));
200
88
  }
201
89
  });
202
90
 
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api.ts"],"names":["z","defineAction","fileReference","loadFile","savedFile","saveFile","requestOptions","sheetInput","exportInput","extend","format","enum","default","returnAsText","boolean","exportWorksheet","slug","description","input","output","union","object","text","string","file","idempotent","run","client","req","url","URL","encodeURIComponent","spreadsheetId","search","URLSearchParams","id","gid","String","sheetId","toString","redirects","options","method","responseType","redirect","validateStatus","status","response","origin","auth","request","transporter","location","headers","get","Error","protocol","port","username","password","hostname","endsWith","data","Buffer","from","name","mimeType","customInput","path","startsWith","query","record","number","optional","body","type","literal","value","json","fields","array","binary","filename","min","failOnError","timeoutMs","int","positive","max","customApiCall","test","pathname","hash","Headers","keys","includes","form","FormData","field","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8E,IAAI,GAAG+B,KAAK,CAAC9D,SAASe,IAAI;QAC3F;IACF;AACF,GAAG","file":"api.js"}
1
+ {"version":3,"sources":["../src/api.ts"],"names":["z","defineAction","defineCustomApiCall","savedFile","saveFile","requestOptions","sheetInput","exportInput","extend","format","enum","default","returnAsText","boolean","exportWorksheet","slug","description","input","output","union","object","text","string","file","idempotent","run","client","req","url","URL","encodeURIComponent","spreadsheetId","search","URLSearchParams","id","gid","String","sheetId","toString","redirects","options","method","responseType","redirect","validateStatus","status","response","origin","auth","request","transporter","location","headers","get","Error","protocol","port","username","password","hostname","endsWith","data","Buffer","from","name","mimeType","customApiCall","baseUrl","path","reservedHeaders","authorize","getRequestHeaders","forEach","value","key","set"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,cAAc;AAChE,SAASC,SAAS,EAAEC,QAAQ,QAAQ,aAAa;AACjD,SAASC,cAAc,EAAEC,UAAU,QAAQ,cAAc;AAEzD,MAAMC,cAAcD,WAAWE,MAAM,CAAC;IACpCC,QAAQT,EAAEU,IAAI,CAAC;QAAC;QAAO;KAAM,EAAEC,OAAO,CAAC;IACvCC,cAAcZ,EAAEa,OAAO,GAAGF,OAAO,CAAC;AACpC;AAEA,OAAO,MAAMG,kBAAkBb,aAAa;IAC1Cc,MAAM;IACNC,aAAa;IACbC,OAAOV;IACPW,QAAQlB,EAAEmB,KAAK,CAAC;QACdnB,EAAEoB,MAAM,CAAC;YAAEC,MAAMrB,EAAEsB,MAAM;YAAIb,QAAQT,EAAEU,IAAI,CAAC;gBAAC;gBAAO;aAAM;QAAE;QAC5DV,EAAEoB,MAAM,CAAC;YAAEG,MAAMpB;YAAWM,QAAQT,EAAEU,IAAI,CAAC;gBAAC;gBAAO;aAAM;QAAE;KAC5D;IACDc,YAAY;IACZ,MAAMC,KAAI,EAAEC,MAAM,EAAEC,GAAG,EAAEV,KAAK,EAAE;QAC9B,IAAIW,MAAM,IAAIC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EAAE/C,MAAMR,MAAM,EAAE;YAE7C,OAAO;gBACLc,MAAM,MAAMnB,SAAS;oBACnBuB;oBACAkC;oBACAG;oBACAC,UAAUhD,MAAMR,MAAM,KAAK,QAAQ,aAAa;gBAClD;gBACAA,QAAQQ,MAAMR,MAAM;YACtB;QACF;QAEA,MAAM,IAAI6C,MAAM;IAClB;AACF,GAAG;AAEH,OAAO,MAAMY,gBAAgBhE,oBAAoB;IAC/C8D,MAAM;IACNhD,aACE;IACFmD,SAAS;IACTC,MAAM;IACNC,iBAAiB;QAAC;KAAiB;IACnCC,WAAW,OAAO,EAAE5C,MAAM,EAAEE,GAAG,EAAEwB,OAAO,EAAE;QACvC,CAAA,MAAM1B,OAAOsB,IAAI,CAACuB,iBAAiB,CAAC3C,IAAG,EAAG4C,OAAO,CAAC,CAACC,OAAOC,MAAQtB,QAAQuB,GAAG,CAACD,KAAKD;IACtF;AACF,GAAG","file":"api.js"}
package/dist/config.d.ts CHANGED
@@ -3,5 +3,11 @@ export declare const googleSheetsAuth: z.ZodObject<{
3
3
  accessToken: z.ZodString;
4
4
  refreshToken: z.ZodOptional<z.ZodString>;
5
5
  }, z.core.$strip>;
6
- export declare const googleSheetsScopes: readonly ["https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/drive"];
6
+ export declare const googleSheetsScopes: {
7
+ readonly spreadsheets: "https://www.googleapis.com/auth/spreadsheets";
8
+ readonly 'spreadsheets.readonly': "https://www.googleapis.com/auth/spreadsheets.readonly";
9
+ readonly drive: "https://www.googleapis.com/auth/drive";
10
+ readonly 'drive.file': "https://www.googleapis.com/auth/drive.file";
11
+ readonly 'drive.readonly': "https://www.googleapis.com/auth/drive.readonly";
12
+ };
7
13
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,sJAIrB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC"}
package/dist/config.js CHANGED
@@ -9,10 +9,12 @@ export const googleSheetsAuth = z.object({
9
9
  secret: true
10
10
  })
11
11
  });
12
- export const googleSheetsScopes = [
13
- 'https://www.googleapis.com/auth/spreadsheets',
14
- 'https://www.googleapis.com/auth/drive.readonly',
15
- 'https://www.googleapis.com/auth/drive'
16
- ];
12
+ export const googleSheetsScopes = {
13
+ spreadsheets: 'https://www.googleapis.com/auth/spreadsheets',
14
+ 'spreadsheets.readonly': 'https://www.googleapis.com/auth/spreadsheets.readonly',
15
+ drive: 'https://www.googleapis.com/auth/drive',
16
+ 'drive.file': 'https://www.googleapis.com/auth/drive.file',
17
+ 'drive.readonly': 'https://www.googleapis.com/auth/drive.readonly'
18
+ };
17
19
 
18
20
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/config.ts"],"names":["z","googleSheetsAuth","object","accessToken","string","min","meta","label","secret","refreshToken","optional","googleSheetsScopes"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,mBAAmBD,EAAEE,MAAM,CAAC;IACvCC,aAAaH,EAAEI,MAAM,GAAGC,GAAG,CAAC,GAAGC,IAAI,CAAC;QAAEC,OAAO;QAAgBC,QAAQ;IAAK;IAC1EC,cAAcT,EAAEI,MAAM,GAAGM,QAAQ,GAAGJ,IAAI,CAAC;QAAEC,OAAO;QAAiBC,QAAQ;IAAK;AAClF,GAAG;AAEH,OAAO,MAAMG,qBAAqB;IAChC;IACA;IACA;CACD,CAAU","file":"config.js"}
1
+ {"version":3,"sources":["../src/config.ts"],"names":["z","googleSheetsAuth","object","accessToken","string","min","meta","label","secret","refreshToken","optional","googleSheetsScopes","spreadsheets","drive"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,mBAAmBD,EAAEE,MAAM,CAAC;IACvCC,aAAaH,EAAEI,MAAM,GAAGC,GAAG,CAAC,GAAGC,IAAI,CAAC;QAAEC,OAAO;QAAgBC,QAAQ;IAAK;IAC1EC,cAAcT,EAAEI,MAAM,GAAGM,QAAQ,GAAGJ,IAAI,CAAC;QAAEC,OAAO;QAAiBC,QAAQ;IAAK;AAClF,GAAG;AAEH,OAAO,MAAMG,qBAAqB;IAChCC,cAAc;IACd,yBAAyB;IACzBC,OAAO;IACP,cAAc;IACd,kBAAkB;AACpB,EAAW","file":"config.js"}
package/dist/define.d.ts CHANGED
@@ -3,5 +3,5 @@ export declare const defineAction: <const TSlug extends string, TInput extends i
3
3
  slug: TSlug;
4
4
  } : never) => import("frogbot").PieceActionDefinition<TInput, TOutput, Record<string, never>, GoogleSheetsClient, TOutput extends import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>> ? import("zod").infer<TOutput> : TResult> & {
5
5
  slug: TSlug;
6
- };
6
+ }, defineCustomApiCall: (config: import("frogbot/pieces").CustomApiCallConfig<GoogleSheetsClient>) => import("frogbot/pieces").CustomApiCallAction<Record<string, never>, GoogleSheetsClient>;
7
7
  //# sourceMappingURL=define.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAQ,YAAY;;;;CAA6C,CAAC"}
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,eAAO,MAAQ,YAAY;;;;GAAE,mBAAmB,uKAA6C,CAAC"}
package/dist/define.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { createPieceHelpers } from 'frogbot/pieces';
2
- export const { defineAction } = createPieceHelpers();
2
+ export const { defineAction, defineCustomApiCall } = createPieceHelpers();
3
3
 
4
4
  //# sourceMappingURL=define.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/define.ts"],"names":["createPieceHelpers","defineAction"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,iBAAiB;AAIpD,OAAO,MAAM,EAAEC,YAAY,EAAE,GAAGD,qBAAyC","file":"define.js"}
1
+ {"version":3,"sources":["../src/define.ts"],"names":["createPieceHelpers","defineAction","defineCustomApiCall"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,iBAAiB;AAIpD,OAAO,MAAM,EAAEC,YAAY,EAAEC,mBAAmB,EAAE,GAAGF,qBAAyC","file":"define.js"}
package/dist/files.d.ts CHANGED
@@ -1,21 +1,10 @@
1
1
  import type { FrogBotRequest } from 'frogbot';
2
2
  import { z } from 'zod';
3
- export declare const fileReference: z.ZodObject<{
4
- fileId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
5
- name: z.ZodOptional<z.ZodString>;
6
- }, z.core.$strip>;
7
3
  export declare const savedFile: z.ZodObject<{
8
4
  id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
9
5
  filename: z.ZodString;
10
6
  url: z.ZodOptional<z.ZodString>;
11
7
  }, z.core.$strip>;
12
- export declare function loadFile({ req, file, }: {
13
- req: FrogBotRequest;
14
- file: z.output<typeof fileReference>;
15
- }): Promise<{
16
- name: string;
17
- blob: Blob;
18
- }>;
19
8
  export declare function saveFile({ req, data, name, mimeType, }: {
20
9
  req: FrogBotRequest;
21
10
  data: Buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;iBAGxB,CAAC;AACH,eAAO,MAAM,SAAS;;;;iBAIpB,CAAC;AAEH,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,IAAI,GACL,EAAE;IACD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;CACtC;;;GAsCA;AAED,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;GAWA"}
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;iBAIpB,CAAC;AAEH,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;;;;GAWA"}
package/dist/files.js CHANGED
@@ -1,12 +1,5 @@
1
- import { createPieceFile, filesCollectionSlug, findPieceFile } from 'frogbot/pieces';
1
+ import { createPieceFile, filesCollectionSlug } from 'frogbot/pieces';
2
2
  import { z } from 'zod';
3
- export const fileReference = z.object({
4
- fileId: z.union([
5
- z.string(),
6
- z.number()
7
- ]),
8
- name: z.string().optional()
9
- });
10
3
  export const savedFile = z.object({
11
4
  id: z.union([
12
5
  z.string(),
@@ -15,48 +8,6 @@ export const savedFile = z.object({
15
8
  filename: z.string(),
16
9
  url: z.string().optional()
17
10
  });
18
- export async function loadFile({ req, file }) {
19
- const doc = await findPieceFile(req, 'Google Sheets', {
20
- id: file.fileId,
21
- depth: 0,
22
- req,
23
- overrideAccess: false
24
- });
25
- if (typeof doc.url !== 'string') throw new Error(`File '${file.fileId}' is unavailable.`);
26
- const config = await req.frogbot.config._internal.payloadConfig;
27
- const base = new URL(config.serverURL || req.url);
28
- const url = new URL(doc.url, base);
29
- if (![
30
- 'http:',
31
- 'https:'
32
- ].includes(url.protocol) || url.username || url.password) {
33
- throw new Error('Invalid file URL.');
34
- }
35
- const headers = new Headers();
36
- if (url.origin === base.origin) {
37
- for (const name of [
38
- 'authorization',
39
- 'cookie'
40
- ]){
41
- const value = req.headers.get(name);
42
- if (value) headers.set(name, value);
43
- }
44
- }
45
- const response = await fetch(url, {
46
- headers,
47
- signal: req.signal ?? undefined,
48
- redirect: 'error'
49
- });
50
- if (!response.ok) throw new Error(`File '${file.fileId}' is unavailable (${response.status}).`);
51
- return {
52
- name: String(file.name ?? doc.filename ?? 'upload'),
53
- blob: new Blob([
54
- await response.arrayBuffer()
55
- ], {
56
- type: String(doc.mimeType ?? 'application/octet-stream')
57
- })
58
- };
59
- }
60
11
  export async function saveFile({ req, data, name, mimeType }) {
61
12
  filesCollectionSlug(req, 'Google Sheets');
62
13
  req.signal?.throwIfAborted();
package/dist/files.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/files.ts"],"names":["createPieceFile","filesCollectionSlug","findPieceFile","z","fileReference","object","fileId","union","string","number","name","optional","savedFile","id","filename","url","loadFile","req","file","doc","depth","overrideAccess","Error","config","frogbot","_internal","payloadConfig","base","URL","serverURL","includes","protocol","username","password","headers","Headers","origin","value","get","set","response","fetch","signal","undefined","redirect","ok","status","String","blob","Blob","arrayBu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union","string","number","filename","url","optional","saveFile","req","data","name","mimeType","signal","throwIfAborted","doc","overrideAccess","file","mimetype","size","length"],"mappings":"AACA,SAASA,eAAe,EAAEC,mBAAmB,QAAQ,iBAAiB;AACtE,SAASC,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,YAAYD,EAAEE,MAAM,CAAC;IAChCC,IAAIH,EAAEI,KAAK,CAAC;QAACJ,EAAEK,MAAM;QAAIL,EAAEM,MAAM;KAAG;IACpCC,UAAUP,EAAEK,MAAM;IAClBG,KAAKR,EAAEK,MAAM,GAAGI,QAAQ;AAC1B,GAAG;AAEH,OAAO,eAAeC,SAAS,EAC7BC,GAAG,EACHC,IAAI,EACJC,IAAI,EACJC,QAAQ,EAMT;IACCf,oBAAoBY,KAAK;IAEzBA,IAAII,MAAM,EAAEC;IACZ,MAAMC,MAAM,MAAMnB,gBAAgBa,KAAK,iBAAiB;QACtDA;QACAO,gBAAgB;QAChBC,MAAM;YAAEP;YAAMC;YAAMO,UAAUN;YAAUO,MAAMT,KAAKU,MAAM;QAAC;IAC5D;IAEA,OAAO;QAAEnB,IAAIc,IAAId,EAAE;QAAEI,UAAUM;QAAM,GAAI,OAAOI,IAAIT,GAAG,KAAK,WAAW;YAAEA,KAAKS,IAAIT,GAAG;QAAC,IAAI,CAAC,CAAC;IAAE;AAChG","file":"files.js"}
package/dist/index.d.ts CHANGED
@@ -15,7 +15,20 @@ export declare const createGoogleSheets: import("frogbot").PieceFactory<{
15
15
  }, import("zod/v4/core").$strip>;
16
16
  readonly client: typeof createGoogleSheetsClient;
17
17
  readonly oauth: {
18
- readonly scopes: [...string[], "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/drive"];
18
+ readonly scopes: {
19
+ readonly catalog: {
20
+ readonly spreadsheets: "https://www.googleapis.com/auth/spreadsheets";
21
+ readonly 'spreadsheets.readonly': "https://www.googleapis.com/auth/spreadsheets.readonly";
22
+ readonly drive: "https://www.googleapis.com/auth/drive";
23
+ readonly 'drive.file': "https://www.googleapis.com/auth/drive.file";
24
+ readonly 'drive.readonly': "https://www.googleapis.com/auth/drive.readonly";
25
+ readonly openid: "openid";
26
+ readonly 'userinfo.email': "https://www.googleapis.com/auth/userinfo.email";
27
+ readonly 'userinfo.profile': "https://www.googleapis.com/auth/userinfo.profile";
28
+ };
29
+ readonly defaults: readonly ["spreadsheets", "drive.readonly", "drive"];
30
+ readonly required: ("openid" | "userinfo.email" | "userinfo.profile")[];
31
+ };
19
32
  readonly toAuth: ({ tokens }: {
20
33
  tokens: import("frogbot").OAuthTokens;
21
34
  }) => {
@@ -687,61 +700,6 @@ export declare const createGoogleSheets: import("frogbot").PieceFactory<{
687
700
  format: "csv" | "tsv";
688
701
  }> & {
689
702
  slug: "exportWorksheet";
690
- }, import("frogbot").PieceActionDefinition<import("zod").ZodObject<{
691
- method: import("zod").ZodDefault<import("zod").ZodEnum<{
692
- GET: "GET";
693
- POST: "POST";
694
- PUT: "PUT";
695
- PATCH: "PATCH";
696
- DELETE: "DELETE";
697
- HEAD: "HEAD";
698
- }>>;
699
- path: import("zod").ZodString;
700
- query: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber, import("zod").ZodBoolean]>>>;
701
- headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
702
- body: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
703
- type: import("zod").ZodLiteral<"json">;
704
- value: import("zod").ZodJSONSchema;
705
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
706
- type: import("zod").ZodLiteral<"raw">;
707
- value: import("zod").ZodString;
708
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
709
- type: import("zod").ZodLiteral<"form">;
710
- fields: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodObject<{
711
- name: import("zod").ZodString;
712
- value: import("zod").ZodString;
713
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
714
- name: import("zod").ZodString;
715
- file: import("zod").ZodObject<{
716
- fileId: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
717
- name: import("zod").ZodOptional<import("zod").ZodString>;
718
- }, import("zod/v4/core").$strip>;
719
- }, import("zod/v4/core").$strip>]>>;
720
- }, import("zod/v4/core").$strip>]>>;
721
- binary: import("zod").ZodDefault<import("zod").ZodBoolean>;
722
- filename: import("zod").ZodDefault<import("zod").ZodString>;
723
- failOnError: import("zod").ZodDefault<import("zod").ZodBoolean>;
724
- timeoutMs: import("zod").ZodDefault<import("zod").ZodNumber>;
725
- }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
726
- status: import("zod").ZodNumber;
727
- headers: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>;
728
- body: import("zod").ZodOptional<import("zod").ZodJSONSchema>;
729
- file: import("zod").ZodOptional<import("zod").ZodObject<{
730
- id: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodNumber]>;
731
- filename: import("zod").ZodString;
732
- url: import("zod").ZodOptional<import("zod").ZodString>;
733
- }, import("zod/v4/core").$strip>>;
734
- }, import("zod/v4/core").$strip>, Record<string, never>, import("./client.js").GoogleSheetsClient, {
735
- status: number;
736
- headers: Record<string, string>;
737
- body?: import("zod").JSONType | undefined;
738
- file?: {
739
- id: string | number;
740
- filename: string;
741
- url?: string | undefined;
742
- } | undefined;
743
- }> & {
744
- slug: "customApiCall";
745
- }];
703
+ }, import("frogbot/pieces").CustomApiCallAction<Record<string, never>, import("./client.js").GoogleSheetsClient>];
746
704
  }>;
747
705
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAoB,kBAAkB,EAAE,MAAM,aAA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EAAE,kBAAkB,EAAE,CAAC;AAC9B,eAAO,MAAM,mBAAmB,wbA4BtB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkD7B,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { googleOAuth } from '@frogbotai/piece-google';
1
+ import { googleOAuth, googleScopes } from '@frogbotai/piece-google';
2
2
  import { definePiece } from 'frogbot/pieces';
3
3
  import { customApiCall, exportWorksheet } from './api.js';
4
4
  import { createGoogleSheetsClient } from './client.js';
@@ -46,10 +46,18 @@ export const createGoogleSheets = definePiece({
46
46
  client: createGoogleSheetsClient,
47
47
  oauth: {
48
48
  ...googleOAuth,
49
- scopes: [
50
- ...googleOAuth.scopes,
51
- ...googleSheetsScopes
52
- ],
49
+ scopes: {
50
+ catalog: {
51
+ ...googleScopes,
52
+ ...googleSheetsScopes
53
+ },
54
+ defaults: [
55
+ 'spreadsheets',
56
+ 'drive.readonly',
57
+ 'drive'
58
+ ],
59
+ required: googleOAuth.scopes.required
60
+ },
53
61
  toAuth: ({ tokens })=>({
54
62
  accessToken: tokens.access_token ?? '',
55
63
  refreshToken: tokens.refresh_token
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["googleOAuth","definePiece","customApiCall","exportWorksheet","createGoogleSheetsClient","googleSheetsAuth","googleSheetsScopes","appendRow","appendRows","deleteRow","deleteRows","findOrCreateRow","findRows","getNextRows","getRow","getRows","insertRow","updateRow","updateRows","clearRows","clearWorksheet","copyWorksheet","createColumn","createSpreadsheet","createWorksheet","deleteWorksheet","findOrCreateWorksheet","findSpreadsheets","findWorksheets","formatRows","readRange","renameWorksheet","googleSheetsActions","createGoogleSheets","slug","label","admin","description","group","auth","client","oauth","scopes","toAuth","tokens","accessToken","access_token","refreshToken","refresh_token","actions"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,WAAW,QAAQ,iBAAiB;AAE7C,SAASC,aAAa,EAAEC,eAAe,QAAQ,WAAW;AAC1D,SAASC,wBAAwB,QAAQ,cAAc;AACvD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,cAAc;AACnE,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,eAAe,EACfC,QAAQ,EACRC,WAAW,EACXC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,SAAS,EACTC,UAAU,QACL,YAAY;AACnB,SACEC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,YAAY,EACZC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,qBAAqB,EACrBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,SAAS,EACTC,eAAe,QACV,kBAAkB;AAEzB,SAASzB,kBAAkB,GAAG;AAC9B,OAAO,MAAM0B,sBAAsB;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAU;AAEX,OAAO,MAAMC,qBAAqBhC,YAAY;IAC5CiC,MAAM;IACNC,OAAO;IACPC,OAAO;QACLC,aAAa;QACbC,OAAO;IACT;IACAC,MAAMlC;IACNmC,QAAQpC;IACRqC,OAAO;QACL,GAAGzC,WAAW;QACd0C,QAAQ;eAAI1C,YAAY0C,MAAM;eAAKpC;SAAmB;QACtDqC,QAAQ,CAAC,EAAEC,MAAM,EAAE,GAAM,CAAA;gBACvBC,aAAaD,OAAOE,YAAY,IAAI;gBACpCC,cAAcH,OAAOI,aAAa;YACpC,CAAA;IACF;IACAC,SAAS;QACP1C;QACAS;QACAR;QACAS;QACAC;QACAT;QACAC;QACAE;QACAD;QACAY;QACAC;QACAE;QACAN;QACAD;QACAM;QACAM;QACAF;QACAf;QACAD;QACAE;QACAe;QACAH;QACAC;QACAP;QACAC;QACAnB;QACAD;KACD;AACH,GAAG","file":"index.js"}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["googleOAuth","googleScopes","definePiece","customApiCall","exportWorksheet","createGoogleSheetsClient","googleSheetsAuth","googleSheetsScopes","appendRow","appendRows","deleteRow","deleteRows","findOrCreateRow","findRows","getNextRows","getRow","getRows","insertRow","updateRow","updateRows","clearRows","clearWorksheet","copyWorksheet","createColumn","createSpreadsheet","createWorksheet","deleteWorksheet","findOrCreateWorksheet","findSpreadsheets","findWorksheets","formatRows","readRange","renameWorksheet","googleSheetsActions","createGoogleSheets","slug","label","admin","description","group","auth","client","oauth","scopes","catalog","defaults","required","toAuth","tokens","accessToken","access_token","refreshToken","refresh_token","actions"],"mappings":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IACAC,SAAS;QACP7C;QACAS;QACAR;QACAS;QACAC;QACAT;QACAC;QACAE;QACAD;QACAY;QACAC;QACAE;QACAN;QACAD;QACAM;QACAM;QACAF;QACAf;QACAD;QACAE;QACAe;QACAH;QACAC;QACAP;QACAC;QACAnB;QACAD;KACD;AACH,GAAG","file":"index.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frogbotai/piece-google-sheets",
3
- "version": "0.31.0",
3
+ "version": "0.32.0",
4
4
  "description": "Google Sheets tools for FrogBot.",
5
5
  "license": "MIT",
6
6
  "author": "Colby Gilbert",
@@ -27,14 +27,14 @@
27
27
  "csv-parse": "^5.6.0",
28
28
  "googleapis": "^180.0.0",
29
29
  "zod": "^4.3.6",
30
- "@frogbotai/piece-google": "0.31.0"
30
+ "@frogbotai/piece-google": "0.32.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "frogbot": "0.31.0"
33
+ "frogbot": "0.32.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "typescript": "5.6.2",
37
- "frogbot": "0.31.0"
37
+ "frogbot": "0.32.0"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public"