@squadbase/vite-server 0.1.3-dev.15 → 0.1.3-dev.16
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/cli/index.js +2105 -2700
- package/dist/connectors/airtable-oauth.js +16 -5
- package/dist/connectors/airtable.js +16 -5
- package/dist/connectors/amplitude.js +16 -5
- package/dist/connectors/anthropic.js +16 -5
- package/dist/connectors/asana.js +16 -5
- package/dist/connectors/attio.js +16 -5
- package/dist/connectors/backlog-api-key.js +16 -5
- package/dist/connectors/customerio.js +16 -5
- package/dist/connectors/dbt.js +16 -5
- package/dist/connectors/gamma.js +16 -5
- package/dist/connectors/gemini.js +16 -5
- package/dist/connectors/gmail-oauth.js +16 -5
- package/dist/connectors/gmail.js +68 -34
- package/dist/connectors/google-ads.js +16 -5
- package/dist/connectors/google-analytics-oauth.js +16 -5
- package/dist/connectors/google-analytics.js +16 -5
- package/dist/connectors/google-calendar-oauth.js +16 -5
- package/dist/connectors/google-calendar.js +71 -48
- package/dist/connectors/{google-drive-oauth.d.ts → google-docs.d.ts} +1 -1
- package/dist/connectors/google-docs.js +585 -0
- package/dist/connectors/google-drive.d.ts +1 -1
- package/dist/connectors/google-drive.js +391 -327
- package/dist/connectors/google-sheets.d.ts +1 -1
- package/dist/connectors/google-sheets.js +210 -280
- package/dist/connectors/google-slides.d.ts +1 -1
- package/dist/connectors/google-slides.js +198 -335
- package/dist/connectors/grafana.js +16 -5
- package/dist/connectors/hubspot-oauth.js +16 -5
- package/dist/connectors/hubspot.js +16 -5
- package/dist/connectors/intercom-oauth.js +16 -5
- package/dist/connectors/intercom.js +16 -5
- package/dist/connectors/jira-api-key.js +16 -5
- package/dist/connectors/kintone-api-token.js +133 -59
- package/dist/connectors/kintone.js +16 -5
- package/dist/connectors/linkedin-ads.js +16 -5
- package/dist/connectors/mailchimp-oauth.js +16 -5
- package/dist/connectors/mailchimp.js +16 -5
- package/dist/connectors/mixpanel.js +16 -5
- package/dist/connectors/notion-oauth.js +16 -5
- package/dist/connectors/notion.js +16 -5
- package/dist/connectors/openai.js +16 -5
- package/dist/connectors/sentry.js +16 -5
- package/dist/connectors/shopify-oauth.js +16 -5
- package/dist/connectors/shopify.js +16 -5
- package/dist/connectors/stripe-api-key.js +16 -5
- package/dist/connectors/stripe-oauth.js +16 -5
- package/dist/connectors/wix-store.js +16 -5
- package/dist/connectors/zendesk-oauth.js +16 -5
- package/dist/connectors/zendesk.js +16 -5
- package/dist/index.js +2100 -2695
- package/dist/main.js +2100 -2695
- package/dist/vite-plugin.js +2100 -2695
- package/package.json +7 -15
- package/dist/connectors/google-drive-oauth.js +0 -879
- package/dist/connectors/google-sheets-oauth.d.ts +0 -5
- package/dist/connectors/google-sheets-oauth.js +0 -821
- package/dist/connectors/google-slides-oauth.d.ts +0 -5
- package/dist/connectors/google-slides-oauth.js +0 -742
|
@@ -149,16 +149,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
149
149
|
* Filters connections by connectorKey internally.
|
|
150
150
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
151
151
|
*/
|
|
152
|
-
createTools(connections, config) {
|
|
152
|
+
createTools(connections, config, opts) {
|
|
153
153
|
const myConnections = connections.filter(
|
|
154
154
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
155
155
|
);
|
|
156
156
|
const result = {};
|
|
157
157
|
for (const t of Object.values(this.tools)) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
const tool = t.createTool(myConnections, config);
|
|
159
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
160
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
161
|
+
...tool,
|
|
162
|
+
toModelOutput: async (options) => {
|
|
163
|
+
if (!originalToModelOutput) {
|
|
164
|
+
return opts.truncateOutput(options.output);
|
|
165
|
+
}
|
|
166
|
+
const modelOutput = await originalToModelOutput(options);
|
|
167
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
168
|
+
return opts.truncateOutput(modelOutput.value);
|
|
169
|
+
}
|
|
170
|
+
return modelOutput;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
162
173
|
}
|
|
163
174
|
return result;
|
|
164
175
|
}
|
|
@@ -279,16 +279,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
279
279
|
* Filters connections by connectorKey internally.
|
|
280
280
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
281
281
|
*/
|
|
282
|
-
createTools(connections, config) {
|
|
282
|
+
createTools(connections, config, opts) {
|
|
283
283
|
const myConnections = connections.filter(
|
|
284
284
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
285
285
|
);
|
|
286
286
|
const result = {};
|
|
287
287
|
for (const t of Object.values(this.tools)) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
const tool = t.createTool(myConnections, config);
|
|
289
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
290
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
291
|
+
...tool,
|
|
292
|
+
toModelOutput: async (options) => {
|
|
293
|
+
if (!originalToModelOutput) {
|
|
294
|
+
return opts.truncateOutput(options.output);
|
|
295
|
+
}
|
|
296
|
+
const modelOutput = await originalToModelOutput(options);
|
|
297
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
298
|
+
return opts.truncateOutput(modelOutput.value);
|
|
299
|
+
}
|
|
300
|
+
return modelOutput;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
292
303
|
}
|
|
293
304
|
return result;
|
|
294
305
|
}
|
|
@@ -239,16 +239,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
239
239
|
* Filters connections by connectorKey internally.
|
|
240
240
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
241
241
|
*/
|
|
242
|
-
createTools(connections, config) {
|
|
242
|
+
createTools(connections, config, opts) {
|
|
243
243
|
const myConnections = connections.filter(
|
|
244
244
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
245
245
|
);
|
|
246
246
|
const result = {};
|
|
247
247
|
for (const t of Object.values(this.tools)) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
const tool = t.createTool(myConnections, config);
|
|
249
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
250
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
251
|
+
...tool,
|
|
252
|
+
toModelOutput: async (options) => {
|
|
253
|
+
if (!originalToModelOutput) {
|
|
254
|
+
return opts.truncateOutput(options.output);
|
|
255
|
+
}
|
|
256
|
+
const modelOutput = await originalToModelOutput(options);
|
|
257
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
258
|
+
return opts.truncateOutput(modelOutput.value);
|
|
259
|
+
}
|
|
260
|
+
return modelOutput;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
252
263
|
}
|
|
253
264
|
return result;
|
|
254
265
|
}
|
|
@@ -106,16 +106,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
106
106
|
* Filters connections by connectorKey internally.
|
|
107
107
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
108
108
|
*/
|
|
109
|
-
createTools(connections, config) {
|
|
109
|
+
createTools(connections, config, opts) {
|
|
110
110
|
const myConnections = connections.filter(
|
|
111
111
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
112
112
|
);
|
|
113
113
|
const result = {};
|
|
114
114
|
for (const t of Object.values(this.tools)) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
const tool = t.createTool(myConnections, config);
|
|
116
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
117
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
118
|
+
...tool,
|
|
119
|
+
toModelOutput: async (options) => {
|
|
120
|
+
if (!originalToModelOutput) {
|
|
121
|
+
return opts.truncateOutput(options.output);
|
|
122
|
+
}
|
|
123
|
+
const modelOutput = await originalToModelOutput(options);
|
|
124
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
125
|
+
return opts.truncateOutput(modelOutput.value);
|
|
126
|
+
}
|
|
127
|
+
return modelOutput;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
119
130
|
}
|
|
120
131
|
return result;
|
|
121
132
|
}
|
package/dist/connectors/asana.js
CHANGED
|
@@ -276,16 +276,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
276
276
|
* Filters connections by connectorKey internally.
|
|
277
277
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
278
278
|
*/
|
|
279
|
-
createTools(connections, config) {
|
|
279
|
+
createTools(connections, config, opts) {
|
|
280
280
|
const myConnections = connections.filter(
|
|
281
281
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
282
282
|
);
|
|
283
283
|
const result = {};
|
|
284
284
|
for (const t of Object.values(this.tools)) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
const tool = t.createTool(myConnections, config);
|
|
286
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
287
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
288
|
+
...tool,
|
|
289
|
+
toModelOutput: async (options) => {
|
|
290
|
+
if (!originalToModelOutput) {
|
|
291
|
+
return opts.truncateOutput(options.output);
|
|
292
|
+
}
|
|
293
|
+
const modelOutput = await originalToModelOutput(options);
|
|
294
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
295
|
+
return opts.truncateOutput(modelOutput.value);
|
|
296
|
+
}
|
|
297
|
+
return modelOutput;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
289
300
|
}
|
|
290
301
|
return result;
|
|
291
302
|
}
|
package/dist/connectors/attio.js
CHANGED
|
@@ -229,16 +229,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
229
229
|
* Filters connections by connectorKey internally.
|
|
230
230
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
231
231
|
*/
|
|
232
|
-
createTools(connections, config) {
|
|
232
|
+
createTools(connections, config, opts) {
|
|
233
233
|
const myConnections = connections.filter(
|
|
234
234
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
235
235
|
);
|
|
236
236
|
const result = {};
|
|
237
237
|
for (const t of Object.values(this.tools)) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
const tool = t.createTool(myConnections, config);
|
|
239
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
240
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
241
|
+
...tool,
|
|
242
|
+
toModelOutput: async (options) => {
|
|
243
|
+
if (!originalToModelOutput) {
|
|
244
|
+
return opts.truncateOutput(options.output);
|
|
245
|
+
}
|
|
246
|
+
const modelOutput = await originalToModelOutput(options);
|
|
247
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
248
|
+
return opts.truncateOutput(modelOutput.value);
|
|
249
|
+
}
|
|
250
|
+
return modelOutput;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
242
253
|
}
|
|
243
254
|
return result;
|
|
244
255
|
}
|
|
@@ -174,16 +174,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
174
174
|
* Filters connections by connectorKey internally.
|
|
175
175
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
176
176
|
*/
|
|
177
|
-
createTools(connections, config) {
|
|
177
|
+
createTools(connections, config, opts) {
|
|
178
178
|
const myConnections = connections.filter(
|
|
179
179
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
180
180
|
);
|
|
181
181
|
const result = {};
|
|
182
182
|
for (const t of Object.values(this.tools)) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
const tool = t.createTool(myConnections, config);
|
|
184
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
185
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
186
|
+
...tool,
|
|
187
|
+
toModelOutput: async (options) => {
|
|
188
|
+
if (!originalToModelOutput) {
|
|
189
|
+
return opts.truncateOutput(options.output);
|
|
190
|
+
}
|
|
191
|
+
const modelOutput = await originalToModelOutput(options);
|
|
192
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
193
|
+
return opts.truncateOutput(modelOutput.value);
|
|
194
|
+
}
|
|
195
|
+
return modelOutput;
|
|
196
|
+
}
|
|
197
|
+
};
|
|
187
198
|
}
|
|
188
199
|
return result;
|
|
189
200
|
}
|
|
@@ -257,16 +257,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
257
257
|
* Filters connections by connectorKey internally.
|
|
258
258
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
259
259
|
*/
|
|
260
|
-
createTools(connections, config) {
|
|
260
|
+
createTools(connections, config, opts) {
|
|
261
261
|
const myConnections = connections.filter(
|
|
262
262
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
263
263
|
);
|
|
264
264
|
const result = {};
|
|
265
265
|
for (const t of Object.values(this.tools)) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
266
|
+
const tool = t.createTool(myConnections, config);
|
|
267
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
268
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
269
|
+
...tool,
|
|
270
|
+
toModelOutput: async (options) => {
|
|
271
|
+
if (!originalToModelOutput) {
|
|
272
|
+
return opts.truncateOutput(options.output);
|
|
273
|
+
}
|
|
274
|
+
const modelOutput = await originalToModelOutput(options);
|
|
275
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
276
|
+
return opts.truncateOutput(modelOutput.value);
|
|
277
|
+
}
|
|
278
|
+
return modelOutput;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
270
281
|
}
|
|
271
282
|
return result;
|
|
272
283
|
}
|
package/dist/connectors/dbt.js
CHANGED
|
@@ -399,16 +399,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
399
399
|
* Filters connections by connectorKey internally.
|
|
400
400
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
401
401
|
*/
|
|
402
|
-
createTools(connections, config) {
|
|
402
|
+
createTools(connections, config, opts) {
|
|
403
403
|
const myConnections = connections.filter(
|
|
404
404
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
405
405
|
);
|
|
406
406
|
const result = {};
|
|
407
407
|
for (const t of Object.values(this.tools)) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
408
|
+
const tool = t.createTool(myConnections, config);
|
|
409
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
410
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
411
|
+
...tool,
|
|
412
|
+
toModelOutput: async (options) => {
|
|
413
|
+
if (!originalToModelOutput) {
|
|
414
|
+
return opts.truncateOutput(options.output);
|
|
415
|
+
}
|
|
416
|
+
const modelOutput = await originalToModelOutput(options);
|
|
417
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
418
|
+
return opts.truncateOutput(modelOutput.value);
|
|
419
|
+
}
|
|
420
|
+
return modelOutput;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
412
423
|
}
|
|
413
424
|
return result;
|
|
414
425
|
}
|
package/dist/connectors/gamma.js
CHANGED
|
@@ -233,16 +233,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
233
233
|
* Filters connections by connectorKey internally.
|
|
234
234
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
235
235
|
*/
|
|
236
|
-
createTools(connections, config) {
|
|
236
|
+
createTools(connections, config, opts) {
|
|
237
237
|
const myConnections = connections.filter(
|
|
238
238
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
239
239
|
);
|
|
240
240
|
const result = {};
|
|
241
241
|
for (const t of Object.values(this.tools)) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
const tool = t.createTool(myConnections, config);
|
|
243
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
244
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
245
|
+
...tool,
|
|
246
|
+
toModelOutput: async (options) => {
|
|
247
|
+
if (!originalToModelOutput) {
|
|
248
|
+
return opts.truncateOutput(options.output);
|
|
249
|
+
}
|
|
250
|
+
const modelOutput = await originalToModelOutput(options);
|
|
251
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
252
|
+
return opts.truncateOutput(modelOutput.value);
|
|
253
|
+
}
|
|
254
|
+
return modelOutput;
|
|
255
|
+
}
|
|
256
|
+
};
|
|
246
257
|
}
|
|
247
258
|
return result;
|
|
248
259
|
}
|
|
@@ -106,16 +106,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
106
106
|
* Filters connections by connectorKey internally.
|
|
107
107
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
108
108
|
*/
|
|
109
|
-
createTools(connections, config) {
|
|
109
|
+
createTools(connections, config, opts) {
|
|
110
110
|
const myConnections = connections.filter(
|
|
111
111
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
112
112
|
);
|
|
113
113
|
const result = {};
|
|
114
114
|
for (const t of Object.values(this.tools)) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
const tool = t.createTool(myConnections, config);
|
|
116
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
117
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
118
|
+
...tool,
|
|
119
|
+
toModelOutput: async (options) => {
|
|
120
|
+
if (!originalToModelOutput) {
|
|
121
|
+
return opts.truncateOutput(options.output);
|
|
122
|
+
}
|
|
123
|
+
const modelOutput = await originalToModelOutput(options);
|
|
124
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
125
|
+
return opts.truncateOutput(modelOutput.value);
|
|
126
|
+
}
|
|
127
|
+
return modelOutput;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
119
130
|
}
|
|
120
131
|
return result;
|
|
121
132
|
}
|
|
@@ -188,16 +188,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
188
188
|
* Filters connections by connectorKey internally.
|
|
189
189
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
190
190
|
*/
|
|
191
|
-
createTools(connections, config) {
|
|
191
|
+
createTools(connections, config, opts) {
|
|
192
192
|
const myConnections = connections.filter(
|
|
193
193
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
194
194
|
);
|
|
195
195
|
const result = {};
|
|
196
196
|
for (const t of Object.values(this.tools)) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
const tool = t.createTool(myConnections, config);
|
|
198
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
199
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
200
|
+
...tool,
|
|
201
|
+
toModelOutput: async (options) => {
|
|
202
|
+
if (!originalToModelOutput) {
|
|
203
|
+
return opts.truncateOutput(options.output);
|
|
204
|
+
}
|
|
205
|
+
const modelOutput = await originalToModelOutput(options);
|
|
206
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
207
|
+
return opts.truncateOutput(modelOutput.value);
|
|
208
|
+
}
|
|
209
|
+
return modelOutput;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
201
212
|
}
|
|
202
213
|
return result;
|
|
203
214
|
}
|
package/dist/connectors/gmail.js
CHANGED
|
@@ -55,17 +55,17 @@ var parameters = {
|
|
|
55
55
|
type: "base64EncodedJson",
|
|
56
56
|
secret: true,
|
|
57
57
|
required: true
|
|
58
|
-
}),
|
|
59
|
-
delegatedUserEmail: new ParameterDefinition({
|
|
60
|
-
slug: "delegated-user-email",
|
|
61
|
-
name: "Delegated User Email",
|
|
62
|
-
description: "The email address of the Google Workspace user whose Gmail mailbox the service account will access via domain-wide delegation.",
|
|
63
|
-
envVarBaseKey: "GMAIL_DELEGATED_USER_EMAIL",
|
|
64
|
-
type: "text",
|
|
65
|
-
secret: false,
|
|
66
|
-
required: true
|
|
67
58
|
})
|
|
68
59
|
};
|
|
60
|
+
var delegatedUserEmailParameter = new ParameterDefinition({
|
|
61
|
+
slug: "delegated-user-email",
|
|
62
|
+
name: "Delegated User Email",
|
|
63
|
+
description: "The email address of the Google Workspace user whose Gmail mailbox the service account will access via domain-wide delegation. Collected during the setup flow.",
|
|
64
|
+
envVarBaseKey: "GMAIL_DELEGATED_USER_EMAIL",
|
|
65
|
+
type: "text",
|
|
66
|
+
secret: false,
|
|
67
|
+
required: false
|
|
68
|
+
});
|
|
69
69
|
|
|
70
70
|
// ../connectors/src/connectors/gmail/sdk/index.ts
|
|
71
71
|
var TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
@@ -96,7 +96,7 @@ function buildJwt(clientEmail, privateKey, subject, nowSec) {
|
|
|
96
96
|
}
|
|
97
97
|
function createClient(params) {
|
|
98
98
|
const serviceAccountKeyJsonBase64 = params[parameters.serviceAccountKeyJsonBase64.slug];
|
|
99
|
-
const delegatedUserEmail = params[
|
|
99
|
+
const delegatedUserEmail = params[delegatedUserEmailParameter.slug];
|
|
100
100
|
if (!serviceAccountKeyJsonBase64) {
|
|
101
101
|
throw new Error(
|
|
102
102
|
`gmail: missing required parameter: ${parameters.serviceAccountKeyJsonBase64.slug}`
|
|
@@ -104,7 +104,7 @@ function createClient(params) {
|
|
|
104
104
|
}
|
|
105
105
|
if (!delegatedUserEmail) {
|
|
106
106
|
throw new Error(
|
|
107
|
-
`gmail: missing required parameter: ${
|
|
107
|
+
`gmail: missing required parameter: ${delegatedUserEmailParameter.slug}`
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
let serviceAccountKey;
|
|
@@ -346,16 +346,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
346
346
|
* Filters connections by connectorKey internally.
|
|
347
347
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
348
348
|
*/
|
|
349
|
-
createTools(connections, config) {
|
|
349
|
+
createTools(connections, config, opts) {
|
|
350
350
|
const myConnections = connections.filter(
|
|
351
351
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
352
352
|
);
|
|
353
353
|
const result = {};
|
|
354
354
|
for (const t of Object.values(this.tools)) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
const tool = t.createTool(myConnections, config);
|
|
356
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
357
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
358
|
+
...tool,
|
|
359
|
+
toModelOutput: async (options) => {
|
|
360
|
+
if (!originalToModelOutput) {
|
|
361
|
+
return opts.truncateOutput(options.output);
|
|
362
|
+
}
|
|
363
|
+
const modelOutput = await originalToModelOutput(options);
|
|
364
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
365
|
+
return opts.truncateOutput(modelOutput.value);
|
|
366
|
+
}
|
|
367
|
+
return modelOutput;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
359
370
|
}
|
|
360
371
|
return result;
|
|
361
372
|
}
|
|
@@ -423,7 +434,7 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
423
434
|
try {
|
|
424
435
|
const { GoogleAuth } = await import("google-auth-library");
|
|
425
436
|
const keyJsonBase64 = parameters.serviceAccountKeyJsonBase64.getValue(connection2);
|
|
426
|
-
const delegatedUserEmail =
|
|
437
|
+
const delegatedUserEmail = delegatedUserEmailParameter.getValue(connection2);
|
|
427
438
|
const credentials = JSON.parse(
|
|
428
439
|
Buffer.from(keyJsonBase64, "base64").toString("utf-8")
|
|
429
440
|
);
|
|
@@ -477,40 +488,54 @@ All paths are relative to https://gmail.googleapis.com/gmail/v1/users. Use '/me'
|
|
|
477
488
|
var requestToolName = `gmail_${requestTool.name}`;
|
|
478
489
|
var gmailOnboarding = new ConnectorOnboarding({
|
|
479
490
|
connectionSetupInstructions: {
|
|
480
|
-
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Gmail\uFF08\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF09\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002
|
|
481
|
-
|
|
482
|
-
1.
|
|
491
|
+
ja: `\u4EE5\u4E0B\u306E\u624B\u9806\u3067Gmail\uFF08\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\uFF09\u30B3\u30CD\u30AF\u30B7\u30E7\u30F3\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002\u63A5\u7D9A\u4F5C\u6210\u6642\u306B\u306F\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8JSON\u306E\u307F\u304C\u8A2D\u5B9A\u6E08\u307F\u3067\u3001\u59D4\u4EFB\u5BFE\u8C61\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3053\u306E\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u53D6\u5F97\u3057\u307E\u3059\u3002
|
|
492
|
+
|
|
493
|
+
1. \`askUserQuestion\` \u3067\u3001\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u304CDomain-wide Delegation\u3067\u4EE3\u7406\u30A2\u30AF\u30BB\u30B9\u3059\u308BGoogle Workspace\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u30D2\u30A2\u30EA\u30F3\u30B0\u3059\u308B:
|
|
494
|
+
- \`question\`: \u300CGmail\u3092\u53C2\u7167\u3059\u308BGoogle Workspace\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u300D
|
|
495
|
+
- \`header\`: \u300C\u30E1\u30FC\u30EB\u5165\u529B\u300D
|
|
496
|
+
- \`options\`: \`[{ label: "\u4F8B: user@example.com", description: "\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u304C\u4EE3\u7406\u30A2\u30AF\u30BB\u30B9\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u306E\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B" }, { label: "\u5225\u306E\u4F8B: admin@example.com", description: "\u7BA1\u7406\u8005\u30E6\u30FC\u30B6\u30FC\u3084\u5171\u6709\u30E1\u30FC\u30EB\u30DC\u30C3\u30AF\u30B9\u306E\u30A2\u30C9\u30EC\u30B9\u3067\u3082\u53EF" }]\` \uFF08\`allowFreeText: true\` \u306E\u305F\u3081\u81EA\u7531\u5165\u529B\u53EF\uFF09
|
|
497
|
+
2. \u53D7\u3051\u53D6\u3063\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 \`updateConnectionParameters\` \u3067\u4FDD\u5B58\u3059\u308B:
|
|
498
|
+
- \`parameterSlug\`: \`"delegated-user-email"\`
|
|
499
|
+
- \`options\`: \`[{ value: <\u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9>, label: <\u540C\u3058\u5024> }]\`\uFF081\u4EF6\u306E\u307F\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u81EA\u52D5\u9078\u629E\u3055\u308C\u308B\uFF09
|
|
500
|
+
3. \`${requestToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30E6\u30FC\u30B6\u30FC\u306E\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u3092\u53D6\u5F97\u3059\u308B:
|
|
483
501
|
- \`method\`: \`"GET"\`
|
|
484
502
|
- \`path\`: \`"/me/profile"\`
|
|
485
|
-
|
|
503
|
+
4. \u30A8\u30E9\u30FC\u304C\u8FD4\u3055\u308C\u305F\u5834\u5408\u3001\u4EE5\u4E0B\u3092\u78BA\u8A8D\u3059\u308B\u3088\u3046\u30E6\u30FC\u30B6\u30FC\u306B\u4F1D\u3048\u308B:
|
|
486
504
|
- \u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u30C9\u30E1\u30A4\u30F3\u5168\u4F53\u306E\u59D4\u4EFB\u304C\u6709\u52B9\u304B
|
|
487
505
|
- Google Workspace\u7BA1\u7406\u30B3\u30F3\u30BD\u30FC\u30EB\u3067Gmail API\u30B9\u30B3\u30FC\u30D7\u304C\u8A31\u53EF\u3055\u308C\u3066\u3044\u308B\u304B
|
|
488
|
-
- \
|
|
489
|
-
|
|
506
|
+
- \u5165\u529B\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u304C\u6B63\u3057\u3044\u304B
|
|
507
|
+
5. \`${requestToolName}\` \u3092\u547C\u3073\u51FA\u3057\u3066\u30E9\u30D9\u30EB\u4E00\u89A7\u3092\u53D6\u5F97\u3059\u308B:
|
|
490
508
|
- \`method\`: \`"GET"\`
|
|
491
509
|
- \`path\`: \`"/me/labels"\`
|
|
492
|
-
|
|
493
|
-
- \`email\`: \
|
|
510
|
+
6. \`updateConnectionContext\` \u3092\u547C\u3073\u51FA\u3059:
|
|
511
|
+
- \`email\`: \u8A2D\u5B9A\u3057\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9
|
|
494
512
|
- \`labels\`: \u4E3B\u8981\u306A\u30E9\u30D9\u30EB\u540D\u4E00\u89A7\uFF08\u30AB\u30F3\u30DE\u533A\u5207\u308A\u3001INBOX, SENT, DRAFT, SPAM, TRASH\u7B49\u306E\u30B7\u30B9\u30C6\u30E0\u30E9\u30D9\u30EB\u3092\u542B\u3080\uFF09
|
|
495
513
|
- \`note\`: \u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u5185\u5BB9\u306E\u7C21\u5358\u306A\u8AAC\u660E
|
|
496
514
|
|
|
497
515
|
#### \u5236\u7D04
|
|
498
516
|
- **\u30BB\u30C3\u30C8\u30A2\u30C3\u30D7\u4E2D\u306B\u30E1\u30C3\u30BB\u30FC\u30B8\u672C\u6587\u3092\u8AAD\u307F\u53D6\u3089\u306A\u3044\u3053\u3068**\u3002\u5B9F\u884C\u3057\u3066\u3088\u3044\u306E\u306F\u4E0A\u8A18\u624B\u9806\u3067\u6307\u5B9A\u3055\u308C\u305F\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB\u53D6\u5F97\u3068\u30E9\u30D9\u30EB\u4E00\u89A7\u53D6\u5F97\u306E\u307F
|
|
499
517
|
- \u30C4\u30FC\u30EB\u9593\u306F1\u6587\u3060\u3051\u66F8\u3044\u3066\u5373\u6B21\u306E\u30C4\u30FC\u30EB\u547C\u3073\u51FA\u3057\u3002\u4E0D\u8981\u306A\u8AAC\u660E\u306F\u7701\u7565\u3057\u3001\u52B9\u7387\u7684\u306B\u9032\u3081\u308B`,
|
|
500
|
-
en: `Follow these steps to set up the Gmail (Service Account) connection.
|
|
501
|
-
|
|
502
|
-
1. Call
|
|
518
|
+
en: `Follow these steps to set up the Gmail (Service Account) connection. Only the service account JSON is provided at connection creation time \u2014 the delegated user email is collected during this setup flow.
|
|
519
|
+
|
|
520
|
+
1. Call \`askUserQuestion\` to ask the user for the Google Workspace user email the service account will impersonate via Domain-wide Delegation:
|
|
521
|
+
- \`question\`: "Please enter the email address of the Google Workspace user whose Gmail mailbox you want to access"
|
|
522
|
+
- \`header\`: "Email input"
|
|
523
|
+
- \`options\`: \`[{ label: "e.g., user@example.com", description: "The user whose mailbox the service account will impersonate" }, { label: "e.g., admin@example.com", description: "An admin user or shared mailbox is also fine" }]\` (free text entry is allowed because \`allowFreeText: true\`)
|
|
524
|
+
2. Save the email via \`updateConnectionParameters\`:
|
|
525
|
+
- \`parameterSlug\`: \`"delegated-user-email"\`
|
|
526
|
+
- \`options\`: \`[{ value: <entered email>, label: <same value> }]\` (a single option is auto-selected)
|
|
527
|
+
3. Call \`${requestToolName}\` to get the user's profile:
|
|
503
528
|
- \`method\`: \`"GET"\`
|
|
504
529
|
- \`path\`: \`"/me/profile"\`
|
|
505
|
-
|
|
530
|
+
4. If an error is returned, ask the user to verify:
|
|
506
531
|
- Domain-wide delegation is enabled for the service account
|
|
507
532
|
- Gmail API scope is authorized in Google Workspace admin console
|
|
508
|
-
- The
|
|
509
|
-
|
|
533
|
+
- The entered email address is correct
|
|
534
|
+
5. Call \`${requestToolName}\` to get the label list:
|
|
510
535
|
- \`method\`: \`"GET"\`
|
|
511
536
|
- \`path\`: \`"/me/labels"\`
|
|
512
|
-
|
|
513
|
-
- \`email\`: The
|
|
537
|
+
6. Call \`updateConnectionContext\`:
|
|
538
|
+
- \`email\`: The configured email address
|
|
514
539
|
- \`labels\`: Key label names (comma-separated, including system labels like INBOX, SENT, DRAFT, SPAM, TRASH)
|
|
515
540
|
- \`note\`: Brief description of the setup
|
|
516
541
|
|
|
@@ -696,7 +721,16 @@ thread.messages.forEach(m => console.log(m.snippet));
|
|
|
696
721
|
"base64"
|
|
697
722
|
).toString("utf-8")
|
|
698
723
|
);
|
|
699
|
-
const delegatedUserEmail = params[
|
|
724
|
+
const delegatedUserEmail = params[delegatedUserEmailParameter.slug];
|
|
725
|
+
if (!delegatedUserEmail) {
|
|
726
|
+
if (!credentials.client_email || !credentials.private_key) {
|
|
727
|
+
return {
|
|
728
|
+
success: false,
|
|
729
|
+
error: "Service account JSON must contain client_email and private_key"
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
return { success: true };
|
|
733
|
+
}
|
|
700
734
|
const auth = new GoogleAuth({
|
|
701
735
|
credentials,
|
|
702
736
|
scopes: ["https://www.googleapis.com/auth/gmail.readonly"],
|
|
@@ -220,16 +220,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
220
220
|
* Filters connections by connectorKey internally.
|
|
221
221
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
222
222
|
*/
|
|
223
|
-
createTools(connections, config) {
|
|
223
|
+
createTools(connections, config, opts) {
|
|
224
224
|
const myConnections = connections.filter(
|
|
225
225
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
226
226
|
);
|
|
227
227
|
const result = {};
|
|
228
228
|
for (const t of Object.values(this.tools)) {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
const tool = t.createTool(myConnections, config);
|
|
230
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
231
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
232
|
+
...tool,
|
|
233
|
+
toModelOutput: async (options) => {
|
|
234
|
+
if (!originalToModelOutput) {
|
|
235
|
+
return opts.truncateOutput(options.output);
|
|
236
|
+
}
|
|
237
|
+
const modelOutput = await originalToModelOutput(options);
|
|
238
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
239
|
+
return opts.truncateOutput(modelOutput.value);
|
|
240
|
+
}
|
|
241
|
+
return modelOutput;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
233
244
|
}
|
|
234
245
|
return result;
|
|
235
246
|
}
|
|
@@ -217,16 +217,27 @@ var ConnectorPlugin = class _ConnectorPlugin {
|
|
|
217
217
|
* Filters connections by connectorKey internally.
|
|
218
218
|
* Returns tools keyed as `${connectorKey}_${toolName}`.
|
|
219
219
|
*/
|
|
220
|
-
createTools(connections, config) {
|
|
220
|
+
createTools(connections, config, opts) {
|
|
221
221
|
const myConnections = connections.filter(
|
|
222
222
|
(c) => _ConnectorPlugin.deriveKey(c.connector.slug, c.connector.authType) === this.connectorKey
|
|
223
223
|
);
|
|
224
224
|
const result = {};
|
|
225
225
|
for (const t of Object.values(this.tools)) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
226
|
+
const tool = t.createTool(myConnections, config);
|
|
227
|
+
const originalToModelOutput = tool.toModelOutput;
|
|
228
|
+
result[`${this.connectorKey}_${t.name}`] = {
|
|
229
|
+
...tool,
|
|
230
|
+
toModelOutput: async (options) => {
|
|
231
|
+
if (!originalToModelOutput) {
|
|
232
|
+
return opts.truncateOutput(options.output);
|
|
233
|
+
}
|
|
234
|
+
const modelOutput = await originalToModelOutput(options);
|
|
235
|
+
if (modelOutput.type === "text" || modelOutput.type === "json") {
|
|
236
|
+
return opts.truncateOutput(modelOutput.value);
|
|
237
|
+
}
|
|
238
|
+
return modelOutput;
|
|
239
|
+
}
|
|
240
|
+
};
|
|
230
241
|
}
|
|
231
242
|
return result;
|
|
232
243
|
}
|