@frogbotai/piece-google-sheets 0.29.0 → 0.31.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/api.d.ts.map +1 -1
- package/dist/api.js +92 -58
- package/dist/api.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -3
- package/dist/client.js.map +1 -1
- package/dist/config.js +10 -3
- package/dist/config.js.map +1 -1
- package/dist/define.js +1 -0
- package/dist/define.js.map +1 -1
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +48 -34
- package/dist/files.js.map +1 -1
- package/dist/index.js +15 -11
- package/dist/index.js.map +1 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +320 -205
- package/dist/rows.js.map +1 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +81 -62
- package/dist/shared.js.map +1 -1
- package/dist/worksheets.d.ts.map +1 -1
- package/dist/worksheets.js +220 -128
- package/dist/worksheets.js.map +1 -1
- package/package.json +5 -5
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;
|
|
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"}
|
package/dist/api.js
CHANGED
|
@@ -3,90 +3,121 @@ import { defineAction } from './define.js';
|
|
|
3
3
|
import { fileReference, loadFile, savedFile, saveFile } from './files.js';
|
|
4
4
|
import { requestOptions, sheetInput } from './shared.js';
|
|
5
5
|
const exportInput = sheetInput.extend({
|
|
6
|
-
format: z.enum([
|
|
7
|
-
|
|
6
|
+
format: z.enum([
|
|
7
|
+
'csv',
|
|
8
|
+
'tsv'
|
|
9
|
+
]).default('csv'),
|
|
10
|
+
returnAsText: z.boolean().default(false)
|
|
8
11
|
});
|
|
9
12
|
export const exportWorksheet = defineAction({
|
|
10
13
|
slug: 'exportWorksheet',
|
|
11
14
|
description: 'Export the selected worksheet as formatted CSV or TSV text or a saved file.',
|
|
12
15
|
input: exportInput,
|
|
13
16
|
output: z.union([
|
|
14
|
-
z.object({
|
|
15
|
-
|
|
17
|
+
z.object({
|
|
18
|
+
text: z.string(),
|
|
19
|
+
format: z.enum([
|
|
20
|
+
'csv',
|
|
21
|
+
'tsv'
|
|
22
|
+
])
|
|
23
|
+
}),
|
|
24
|
+
z.object({
|
|
25
|
+
file: savedFile,
|
|
26
|
+
format: z.enum([
|
|
27
|
+
'csv',
|
|
28
|
+
'tsv'
|
|
29
|
+
])
|
|
30
|
+
})
|
|
16
31
|
]),
|
|
17
32
|
idempotent: true,
|
|
18
|
-
async run({ client, req, input }) {
|
|
33
|
+
async run ({ client, req, input }) {
|
|
19
34
|
let url = new URL(`https://docs.google.com/spreadsheets/d/${encodeURIComponent(input.spreadsheetId)}/export`);
|
|
20
35
|
url.search = new URLSearchParams({
|
|
21
36
|
format: input.format,
|
|
22
37
|
id: input.spreadsheetId,
|
|
23
|
-
gid: String(input.sheetId)
|
|
38
|
+
gid: String(input.sheetId)
|
|
24
39
|
}).toString();
|
|
25
|
-
for
|
|
40
|
+
for(let redirects = 0; redirects <= 5; redirects++){
|
|
26
41
|
const options = {
|
|
27
42
|
...requestOptions(req),
|
|
28
43
|
url: url.toString(),
|
|
29
44
|
method: 'GET',
|
|
30
45
|
responseType: 'arraybuffer',
|
|
31
46
|
redirect: 'manual',
|
|
32
|
-
validateStatus: (status)
|
|
47
|
+
validateStatus: (status)=>status >= 200 && status < 400
|
|
33
48
|
};
|
|
34
|
-
const response = url.origin === 'https://docs.google.com'
|
|
35
|
-
? await client.auth.request(options)
|
|
36
|
-
: await client.auth.transporter.request(options);
|
|
49
|
+
const response = url.origin === 'https://docs.google.com' ? await client.auth.request(options) : await client.auth.transporter.request(options);
|
|
37
50
|
if (response.status >= 300) {
|
|
38
51
|
const location = response.headers.get('location');
|
|
39
|
-
if (!location)
|
|
40
|
-
throw new Error('Worksheet export redirect is missing its destination.');
|
|
52
|
+
if (!location) throw new Error('Worksheet export redirect is missing its destination.');
|
|
41
53
|
url = new URL(location, url);
|
|
42
|
-
if (url.protocol !== 'https:' ||
|
|
43
|
-
url.port ||
|
|
44
|
-
url.username ||
|
|
45
|
-
url.password ||
|
|
46
|
-
!(url.hostname === 'docs.google.com' || url.hostname.endsWith('.googleusercontent.com'))) {
|
|
54
|
+
if (url.protocol !== 'https:' || url.port || url.username || url.password || !(url.hostname === 'docs.google.com' || url.hostname.endsWith('.googleusercontent.com'))) {
|
|
47
55
|
throw new Error('Worksheet export redirected outside Google.');
|
|
48
56
|
}
|
|
49
57
|
continue;
|
|
50
58
|
}
|
|
51
59
|
const data = Buffer.from(response.data);
|
|
52
|
-
if (input.returnAsText)
|
|
53
|
-
|
|
60
|
+
if (input.returnAsText) return {
|
|
61
|
+
text: data.toString('utf8'),
|
|
62
|
+
format: input.format
|
|
63
|
+
};
|
|
54
64
|
const name = `exported_sheet.${input.format}`;
|
|
55
65
|
return {
|
|
56
66
|
file: await saveFile({
|
|
57
67
|
req,
|
|
58
68
|
data,
|
|
59
69
|
name,
|
|
60
|
-
mimeType: input.format === 'csv' ? 'text/csv' : 'text/tab-separated-values'
|
|
70
|
+
mimeType: input.format === 'csv' ? 'text/csv' : 'text/tab-separated-values'
|
|
61
71
|
}),
|
|
62
|
-
format: input.format
|
|
72
|
+
format: input.format
|
|
63
73
|
};
|
|
64
74
|
}
|
|
65
75
|
throw new Error('Worksheet export exceeded the redirect limit.');
|
|
66
|
-
}
|
|
76
|
+
}
|
|
67
77
|
});
|
|
68
78
|
const customInput = z.object({
|
|
69
|
-
method: z.enum([
|
|
79
|
+
method: z.enum([
|
|
80
|
+
'GET',
|
|
81
|
+
'POST',
|
|
82
|
+
'PUT',
|
|
83
|
+
'PATCH',
|
|
84
|
+
'DELETE',
|
|
85
|
+
'HEAD'
|
|
86
|
+
]).default('GET'),
|
|
70
87
|
path: z.string().startsWith('/'),
|
|
71
|
-
query: z.record(z.string(), z.union([
|
|
88
|
+
query: z.record(z.string(), z.union([
|
|
89
|
+
z.string(),
|
|
90
|
+
z.number(),
|
|
91
|
+
z.boolean()
|
|
92
|
+
])).optional(),
|
|
72
93
|
headers: z.record(z.string(), z.string()).optional(),
|
|
73
|
-
body: z
|
|
74
|
-
.
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
}),
|
|
77
103
|
z.object({
|
|
78
104
|
type: z.literal('form'),
|
|
79
105
|
fields: z.array(z.union([
|
|
80
|
-
z.object({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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(),
|
|
86
117
|
binary: z.boolean().default(false),
|
|
87
118
|
filename: z.string().min(1).default('response.bin'),
|
|
88
119
|
failOnError: z.boolean().default(true),
|
|
89
|
-
timeoutMs: z.number().int().positive().max(300_000).default(30_000)
|
|
120
|
+
timeoutMs: z.number().int().positive().max(300_000).default(30_000)
|
|
90
121
|
});
|
|
91
122
|
export const customApiCall = defineAction({
|
|
92
123
|
slug: 'customApiCall',
|
|
@@ -96,39 +127,41 @@ export const customApiCall = defineAction({
|
|
|
96
127
|
status: z.number().int(),
|
|
97
128
|
headers: z.record(z.string(), z.string()),
|
|
98
129
|
body: z.json().optional(),
|
|
99
|
-
file: savedFile.optional()
|
|
130
|
+
file: savedFile.optional()
|
|
100
131
|
}),
|
|
101
132
|
idempotent: false,
|
|
102
|
-
async run({ client, req, input }) {
|
|
133
|
+
async run ({ client, req, input }) {
|
|
103
134
|
const url = new URL(`https://sheets.googleapis.com/v4${input.path}`);
|
|
104
|
-
if (/[\\\r\n]/.test(input.path) ||
|
|
105
|
-
url.origin !== 'https://sheets.googleapis.com' ||
|
|
106
|
-
!/^\/v4\/spreadsheets(?:\/|$|:)/.test(url.pathname) ||
|
|
107
|
-
url.hash ||
|
|
108
|
-
url.username ||
|
|
109
|
-
url.password) {
|
|
135
|
+
if (/[\\\r\n]/.test(input.path) || url.origin !== 'https://sheets.googleapis.com' || !/^\/v4\/spreadsheets(?:\/|$|:)/.test(url.pathname) || url.hash || url.username || url.password) {
|
|
110
136
|
throw new Error('Custom API paths must remain inside the Google Sheets v4 spreadsheets API.');
|
|
111
137
|
}
|
|
112
138
|
const headers = new Headers(input.headers);
|
|
113
|
-
for (const name of headers.keys())
|
|
114
|
-
if ([
|
|
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)) {
|
|
115
147
|
throw new Error(`Custom header '${name}' is reserved.`);
|
|
116
148
|
}
|
|
117
149
|
}
|
|
118
150
|
let data;
|
|
119
151
|
if (input.body?.type === 'form') {
|
|
120
152
|
const form = new FormData();
|
|
121
|
-
for (const field of input.body.fields)
|
|
122
|
-
if ('value' in field)
|
|
123
|
-
form.append(field.name, field.value);
|
|
153
|
+
for (const field of input.body.fields){
|
|
154
|
+
if ('value' in field) form.append(field.name, field.value);
|
|
124
155
|
else {
|
|
125
|
-
const file = await loadFile({
|
|
156
|
+
const file = await loadFile({
|
|
157
|
+
req,
|
|
158
|
+
file: field.file
|
|
159
|
+
});
|
|
126
160
|
form.append(field.name, file.blob, file.name);
|
|
127
161
|
}
|
|
128
162
|
}
|
|
129
163
|
data = form;
|
|
130
|
-
}
|
|
131
|
-
else if (input.body) {
|
|
164
|
+
} else if (input.body) {
|
|
132
165
|
data = input.body.value === null ? 'null' : input.body.value;
|
|
133
166
|
if (input.body.type === 'json' && !headers.has('content-type')) {
|
|
134
167
|
headers.set('content-type', 'application/json');
|
|
@@ -143,11 +176,11 @@ export const customApiCall = defineAction({
|
|
|
143
176
|
data,
|
|
144
177
|
timeout: input.timeoutMs,
|
|
145
178
|
responseType: input.binary ? 'arraybuffer' : 'json',
|
|
146
|
-
validateStatus: (status)
|
|
179
|
+
validateStatus: (status)=>input.failOnError ? status >= 200 && status < 300 : status < 300 || status >= 400
|
|
147
180
|
});
|
|
148
181
|
const result = {
|
|
149
182
|
status: response.status,
|
|
150
|
-
headers: Object.fromEntries(response.headers.entries())
|
|
183
|
+
headers: Object.fromEntries(response.headers.entries())
|
|
151
184
|
};
|
|
152
185
|
if (input.binary) {
|
|
153
186
|
return {
|
|
@@ -156,14 +189,15 @@ export const customApiCall = defineAction({
|
|
|
156
189
|
req,
|
|
157
190
|
data: Buffer.from(response.data),
|
|
158
191
|
name: input.filename,
|
|
159
|
-
mimeType: response.headers.get('content-type') ?? 'application/octet-stream'
|
|
160
|
-
})
|
|
192
|
+
mimeType: response.headers.get('content-type') ?? 'application/octet-stream'
|
|
193
|
+
})
|
|
161
194
|
};
|
|
162
195
|
}
|
|
163
196
|
return {
|
|
164
197
|
...result,
|
|
165
|
-
body: response.data == null || response.data === '' ? null : z.json().parse(response.data)
|
|
198
|
+
body: response.data == null || response.data === '' ? null : z.json().parse(response.data)
|
|
166
199
|
};
|
|
167
|
-
}
|
|
200
|
+
}
|
|
168
201
|
});
|
|
202
|
+
|
|
169
203
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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","append","blob","has","set","params","timeout","result","Object","fromEntries","entries","parse"],"mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,aAAa,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,aAAa;AAC1E,SAASC,cAAc,EAAEC,UAAU,QAAQ,cAAc;AAEzD,MAAMC,cAAcD,WAAWE,MAAM,CAAC;IACpCC,QAAQV,EAAEW,IAAI,CAAC;QAAC;QAAO;KAAM,EAAEC,OAAO,CAAC;IACvCC,cAAcb,EAAEc,OAAO,GAAGF,OAAO,CAAC;AACpC;AAEA,OAAO,MAAMG,kBAAkBd,aAAa;IAC1Ce,MAAM;IACNC,aAAa;IACbC,OAAOV;IACPW,QAAQnB,EAAEoB,KAAK,CAAC;QACdpB,EAAEqB,MAAM,CAAC;YAAEC,MAAMtB,EAAEuB,MAAM;YAAIb,QAAQV,EAAEW,IAAI,CAAC;gBAAC;gBAAO;aAAM;QAAE;QAC5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AAG,gBAAgB;YAC7CpC,gBAAgB,CAACC,SACf5B,MAAMkE,WAAW,GAAGtC,UAAU,OAAOA,SAAS,MAAMA,SAAS,OAAOA,UAAU;QAClF;QAEA,MAAM2D,SAAS;YACb3D,QAAQC,SAASD,MAAM;YACvBO,SAASqD,OAAOC,WAAW,CAAC5D,SAASM,OAAO,CAACuD,OAAO;QACtD;QAEA,IAAI1F,MAAM+D,MAAM,EAAE;YAChB,OAAO;gBACL,GAAGwB,MAAM;gBACTjF,MAAM,MAAMnB,SAAS;oBACnBuB;oBACAkC,MAAMC,OAAOC,IAAI,CAACjB,SAASe,IAAI;oBAC/BG,MAAM/C,MAAMgE,QAAQ;oBACpBhB,UAAUnB,SAASM,OAAO,CAACC,GAAG,CAAC,mBAAmB;gBACpD;YACF;QACF;QAEA,OAAO;YACL,GAAGmD,MAAM;YACT/B,MAAM3B,SAASe,IAAI,IAAI,QAAQf,SAASe,IAAI,KAAK,KAAK,OAAO9D,EAAE8E,IAAI,GAAG+B,KAAK,CAAC9D,SAASe,IAAI;QAC3F;IACF;AACF,GAAG","file":"api.js"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAInE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAInE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC;IACzB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC;CACvB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,CAUxF"}
|
package/dist/client.js
CHANGED
|
@@ -3,11 +3,22 @@ import { googleSheetsAuth } from './config.js';
|
|
|
3
3
|
export function createGoogleSheetsClient({ auth }) {
|
|
4
4
|
const credential = googleSheetsAuth.parse(auth);
|
|
5
5
|
const oauth = new google.auth.OAuth2();
|
|
6
|
-
oauth.setCredentials({
|
|
6
|
+
oauth.setCredentials({
|
|
7
|
+
access_token: credential.accessToken
|
|
8
|
+
});
|
|
7
9
|
return {
|
|
8
10
|
auth: oauth,
|
|
9
|
-
sheets: google.sheets({
|
|
10
|
-
|
|
11
|
+
sheets: google.sheets({
|
|
12
|
+
version: 'v4',
|
|
13
|
+
auth: oauth,
|
|
14
|
+
universeDomain: 'googleapis.com'
|
|
15
|
+
}),
|
|
16
|
+
drive: google.drive({
|
|
17
|
+
version: 'v3',
|
|
18
|
+
auth: oauth,
|
|
19
|
+
universeDomain: 'googleapis.com'
|
|
20
|
+
})
|
|
11
21
|
};
|
|
12
22
|
}
|
|
23
|
+
|
|
13
24
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/client.ts"],"names":["google","googleSheetsAuth","createGoogleSheetsClient","auth","credential","parse","oauth","OAuth2","setCredentials","access_token","accessToken","sheets","version","universeDomain","drive"],"mappings":"AAAA,SAAwBA,MAAM,QAAwB,aAAa;AAEnE,SAASC,gBAAgB,QAAQ,cAAc;AAQ/C,OAAO,SAASC,yBAAyB,EAAEC,IAAI,EAAqB;IAClE,MAAMC,aAAaH,iBAAiBI,KAAK,CAACF;IAC1C,MAAMG,QAAQ,IAAIN,OAAOG,IAAI,CAACI,MAAM;IACpCD,MAAME,cAAc,CAAC;QAAEC,cAAcL,WAAWM,WAAW;IAAC;IAE5D,OAAO;QACLP,MAAMG;QACNK,QAAQX,OAAOW,MAAM,CAAC;YAAEC,SAAS;YAAMT,MAAMG;YAAOO,gBAAgB;QAAiB;QACrFC,OAAOd,OAAOc,KAAK,CAAC;YAAEF,SAAS;YAAMT,MAAMG;YAAOO,gBAAgB;QAAiB;IACrF;AACF","file":"client.js"}
|
package/dist/config.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export const googleSheetsAuth = z.object({
|
|
3
|
-
accessToken: z.string().min(1).meta({
|
|
4
|
-
|
|
3
|
+
accessToken: z.string().min(1).meta({
|
|
4
|
+
label: 'Access token',
|
|
5
|
+
secret: true
|
|
6
|
+
}),
|
|
7
|
+
refreshToken: z.string().optional().meta({
|
|
8
|
+
label: 'Refresh token',
|
|
9
|
+
secret: true
|
|
10
|
+
})
|
|
5
11
|
});
|
|
6
12
|
export const googleSheetsScopes = [
|
|
7
13
|
'https://www.googleapis.com/auth/spreadsheets',
|
|
8
14
|
'https://www.googleapis.com/auth/drive.readonly',
|
|
9
|
-
'https://www.googleapis.com/auth/drive'
|
|
15
|
+
'https://www.googleapis.com/auth/drive'
|
|
10
16
|
];
|
|
17
|
+
|
|
11
18
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
package/dist/define.js
CHANGED
package/dist/define.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
package/dist/files.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/files.js
CHANGED
|
@@ -1,68 +1,82 @@
|
|
|
1
|
+
import { createPieceFile, filesCollectionSlug, findPieceFile } from 'frogbot/pieces';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
export const fileReference = z.object({
|
|
3
|
-
fileId: z.union([
|
|
4
|
-
|
|
4
|
+
fileId: z.union([
|
|
5
|
+
z.string(),
|
|
6
|
+
z.number()
|
|
7
|
+
]),
|
|
8
|
+
name: z.string().optional()
|
|
5
9
|
});
|
|
6
10
|
export const savedFile = z.object({
|
|
7
|
-
id: z.union([
|
|
11
|
+
id: z.union([
|
|
12
|
+
z.string(),
|
|
13
|
+
z.number()
|
|
14
|
+
]),
|
|
8
15
|
filename: z.string(),
|
|
9
|
-
url: z.string().optional()
|
|
16
|
+
url: z.string().optional()
|
|
10
17
|
});
|
|
11
|
-
export async function loadFile({ req, file
|
|
12
|
-
const
|
|
13
|
-
if (!collection) {
|
|
14
|
-
throw new Error('Google Sheets file uploads require a configured files collection.');
|
|
15
|
-
}
|
|
16
|
-
const doc = await req.frogbot.findByID({
|
|
17
|
-
collection,
|
|
18
|
+
export async function loadFile({ req, file }) {
|
|
19
|
+
const doc = await findPieceFile(req, 'Google Sheets', {
|
|
18
20
|
id: file.fileId,
|
|
19
21
|
depth: 0,
|
|
20
22
|
req,
|
|
21
|
-
overrideAccess: false
|
|
23
|
+
overrideAccess: false
|
|
22
24
|
});
|
|
23
|
-
if (typeof doc.url !== 'string')
|
|
24
|
-
throw new Error(`File '${file.fileId}' is unavailable.`);
|
|
25
|
+
if (typeof doc.url !== 'string') throw new Error(`File '${file.fileId}' is unavailable.`);
|
|
25
26
|
const config = await req.frogbot.config._internal.payloadConfig;
|
|
26
27
|
const base = new URL(config.serverURL || req.url);
|
|
27
28
|
const url = new URL(doc.url, base);
|
|
28
|
-
if (![
|
|
29
|
+
if (![
|
|
30
|
+
'http:',
|
|
31
|
+
'https:'
|
|
32
|
+
].includes(url.protocol) || url.username || url.password) {
|
|
29
33
|
throw new Error('Invalid file URL.');
|
|
30
34
|
}
|
|
31
35
|
const headers = new Headers();
|
|
32
36
|
if (url.origin === base.origin) {
|
|
33
|
-
for (const name of [
|
|
37
|
+
for (const name of [
|
|
38
|
+
'authorization',
|
|
39
|
+
'cookie'
|
|
40
|
+
]){
|
|
34
41
|
const value = req.headers.get(name);
|
|
35
|
-
if (value)
|
|
36
|
-
headers.set(name, value);
|
|
42
|
+
if (value) headers.set(name, value);
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
const response = await fetch(url, {
|
|
40
46
|
headers,
|
|
41
47
|
signal: req.signal ?? undefined,
|
|
42
|
-
redirect: 'error'
|
|
48
|
+
redirect: 'error'
|
|
43
49
|
});
|
|
44
|
-
if (!response.ok)
|
|
45
|
-
throw new Error(`File '${file.fileId}' is unavailable (${response.status}).`);
|
|
50
|
+
if (!response.ok) throw new Error(`File '${file.fileId}' is unavailable (${response.status}).`);
|
|
46
51
|
return {
|
|
47
52
|
name: String(file.name ?? doc.filename ?? 'upload'),
|
|
48
|
-
blob: new Blob([
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
blob: new Blob([
|
|
54
|
+
await response.arrayBuffer()
|
|
55
|
+
], {
|
|
56
|
+
type: String(doc.mimeType ?? 'application/octet-stream')
|
|
57
|
+
})
|
|
51
58
|
};
|
|
52
59
|
}
|
|
53
|
-
export async function saveFile({ req, data, name, mimeType
|
|
54
|
-
|
|
55
|
-
if (!collection) {
|
|
56
|
-
throw new Error('Google Sheets file downloads require a configured files collection.');
|
|
57
|
-
}
|
|
60
|
+
export async function saveFile({ req, data, name, mimeType }) {
|
|
61
|
+
filesCollectionSlug(req, 'Google Sheets');
|
|
58
62
|
req.signal?.throwIfAborted();
|
|
59
|
-
const doc = await req
|
|
60
|
-
collection,
|
|
61
|
-
data: {},
|
|
63
|
+
const doc = await createPieceFile(req, 'Google Sheets', {
|
|
62
64
|
req,
|
|
63
65
|
overrideAccess: false,
|
|
64
|
-
file: {
|
|
66
|
+
file: {
|
|
67
|
+
data,
|
|
68
|
+
name,
|
|
69
|
+
mimetype: mimeType,
|
|
70
|
+
size: data.length
|
|
71
|
+
}
|
|
65
72
|
});
|
|
66
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
id: doc.id,
|
|
75
|
+
filename: name,
|
|
76
|
+
...typeof doc.url === 'string' ? {
|
|
77
|
+
url: doc.url
|
|
78
|
+
} : {}
|
|
79
|
+
};
|
|
67
80
|
}
|
|
81
|
+
|
|
68
82
|
//# sourceMappingURL=files.js.map
|
package/dist/files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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","arrayBuffer","type","mimeType","saveFile","data","throwIfAborted","mimetype","size","length"],"mappings":"AACA,SAASA,eAAe,EAAEC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAiB;AACrF,SAASC,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,gBAAgBD,EAAEE,MAAM,CAAC;IACpCC,QAAQH,EAAEI,KAAK,CAAC;QAACJ,EAAEK,MAAM;QAAIL,EAAEM,MAAM;KAAG;IACxCC,MAAMP,EAAEK,MAAM,GAAGG,QAAQ;AAC3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;IACZ;IAEA,IAAI,CAACJ,SAASK,EAAE,EAAE,MAAM,IAAIvB,MAAM,CAAC,MAAM,EAAEJ,KAAKZ,MAAM,CAAC,kBAAkB,EAAEkC,SAASM,MAAM,CAAC,EAAE,CAAC;IAE9F,OAAO;QACLpC,MAAMqC,OAAO7B,KAAKR,IAAI,IAAIS,IAAIL,QAAQ,IAAI;QAC1CkC,MAAM,IAAIC,KAAK;YAAC,MAAMT,SAASU,WAAW;SAAG,EAAE;YAC7CC,MAAMJ,OAAO5B,IAAIiC,QAAQ,IAAI;QAC/B;IACF;AACF;AAEA,OAAO,eAAeC,SAAS,EAC7BpC,GAAG,EACHqC,IAAI,EACJ5C,IAAI,EACJ0C,QAAQ,EAMT;IACCnD,oBAAoBgB,KAAK;IAEzBA,IAAIyB,MAAM,EAAEa;IACZ,MAAMpC,MAAM,MAAMnB,gBAAgBiB,KAAK,iBAAiB;QACtDA;QACAI,gBAAgB;QAChBH,MAAM;YAAEoC;YAAM5C;YAAM8C,UAAUJ;YAAUK,MAAMH,KAAKI,MAAM;QAAC;IAC5D;IAEA,OAAO;QAAE7C,IAAIM,IAAIN,EAAE;QAAEC,UAAUJ;QAAM,GAAI,OAAOS,IAAIJ,GAAG,KAAK,WAAW;YAAEA,KAAKI,IAAIJ,GAAG;QAAC,IAAI,CAAC,CAAC;IAAE;AAChG","file":"files.js"}
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { definePiece } from 'frogbot/pieces';
|
|
|
3
3
|
import { customApiCall, exportWorksheet } from './api.js';
|
|
4
4
|
import { createGoogleSheetsClient } from './client.js';
|
|
5
5
|
import { googleSheetsAuth, googleSheetsScopes } from './config.js';
|
|
6
|
-
import { appendRow, appendRows, deleteRow, deleteRows, findOrCreateRow, findRows, getNextRows, getRow, getRows, insertRow, updateRow, updateRows
|
|
7
|
-
import { clearRows, clearWorksheet, copyWorksheet, createColumn, createSpreadsheet, createWorksheet, deleteWorksheet, findOrCreateWorksheet, findSpreadsheets, findWorksheets, formatRows, readRange, renameWorksheet
|
|
6
|
+
import { appendRow, appendRows, deleteRow, deleteRows, findOrCreateRow, findRows, getNextRows, getRow, getRows, insertRow, updateRow, updateRows } from './rows.js';
|
|
7
|
+
import { clearRows, clearWorksheet, copyWorksheet, createColumn, createSpreadsheet, createWorksheet, deleteWorksheet, findOrCreateWorksheet, findSpreadsheets, findWorksheets, formatRows, readRange, renameWorksheet } from './worksheets.js';
|
|
8
8
|
export { googleSheetsScopes };
|
|
9
9
|
export const googleSheetsActions = [
|
|
10
10
|
'appendRow',
|
|
@@ -33,24 +33,27 @@ export const googleSheetsActions = [
|
|
|
33
33
|
'copyWorksheet',
|
|
34
34
|
'createColumn',
|
|
35
35
|
'exportWorksheet',
|
|
36
|
-
'customApiCall'
|
|
36
|
+
'customApiCall'
|
|
37
37
|
];
|
|
38
38
|
export const createGoogleSheets = definePiece({
|
|
39
39
|
slug: 'google-sheets',
|
|
40
40
|
label: 'Google Sheets',
|
|
41
41
|
admin: {
|
|
42
42
|
description: 'Read, edit, and manage spreadsheets and worksheets',
|
|
43
|
-
group: 'Productivity'
|
|
43
|
+
group: 'Productivity'
|
|
44
44
|
},
|
|
45
45
|
auth: googleSheetsAuth,
|
|
46
46
|
client: createGoogleSheetsClient,
|
|
47
47
|
oauth: {
|
|
48
48
|
...googleOAuth,
|
|
49
|
-
scopes: [
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
49
|
+
scopes: [
|
|
50
|
+
...googleOAuth.scopes,
|
|
51
|
+
...googleSheetsScopes
|
|
52
|
+
],
|
|
53
|
+
toAuth: ({ tokens })=>({
|
|
54
|
+
accessToken: tokens.access_token ?? '',
|
|
55
|
+
refreshToken: tokens.refresh_token
|
|
56
|
+
})
|
|
54
57
|
},
|
|
55
58
|
actions: [
|
|
56
59
|
appendRow,
|
|
@@ -79,7 +82,8 @@ export const createGoogleSheets = definePiece({
|
|
|
79
82
|
copyWorksheet,
|
|
80
83
|
createColumn,
|
|
81
84
|
exportWorksheet,
|
|
82
|
-
customApiCall
|
|
83
|
-
]
|
|
85
|
+
customApiCall
|
|
86
|
+
]
|
|
84
87
|
});
|
|
88
|
+
|
|
85
89
|
//# sourceMappingURL=index.js.map
|