@bubblelab/bubble-core 0.1.68 → 0.1.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bubble-bundle.d.ts +85 -85
- package/dist/bubbles/service-bubble/agi-inc.d.ts +112 -112
- package/dist/bubbles/service-bubble/ai-agent.d.ts +72 -72
- package/dist/bubbles/service-bubble/airtable.d.ts +156 -156
- package/dist/bubbles/service-bubble/apify/apify.d.ts +8 -8
- package/dist/bubbles/service-bubble/ashby/ashby.d.ts +108 -108
- package/dist/bubbles/service-bubble/ashby/ashby.js +1 -1
- package/dist/bubbles/service-bubble/ashby/ashby.js.map +1 -1
- package/dist/bubbles/service-bubble/browserbase/browserbase.d.ts +51 -51
- package/dist/bubbles/service-bubble/crustdata/crustdata.d.ts +22 -22
- package/dist/bubbles/service-bubble/eleven-labs.d.ts +56 -56
- package/dist/bubbles/service-bubble/firecrawl.d.ts +328 -328
- package/dist/bubbles/service-bubble/followupboss.d.ts +256 -256
- package/dist/bubbles/service-bubble/fullenrich/fullenrich.d.ts +40 -40
- package/dist/bubbles/service-bubble/github.d.ts +152 -152
- package/dist/bubbles/service-bubble/gmail.d.ts +576 -576
- package/dist/bubbles/service-bubble/google-calendar.d.ts +232 -232
- package/dist/bubbles/service-bubble/google-drive.d.ts +483 -156
- package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
- package/dist/bubbles/service-bubble/google-drive.js +339 -30
- package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
- package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +78 -78
- package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
- package/dist/bubbles/service-bubble/http.d.ts +16 -16
- package/dist/bubbles/service-bubble/insforge-db.d.ts +10 -10
- package/dist/bubbles/service-bubble/jira/jira.d.ts +54 -54
- package/dist/bubbles/service-bubble/notion/notion.d.ts +1032 -1032
- package/dist/bubbles/service-bubble/postgresql.d.ts +10 -10
- package/dist/bubbles/service-bubble/resend.d.ts +20 -20
- package/dist/bubbles/service-bubble/slack/slack.d.ts +182 -182
- package/dist/bubbles/service-bubble/storage.d.ts +40 -40
- package/dist/bubbles/service-bubble/stripe/stripe.d.ts +72 -72
- package/dist/bubbles/service-bubble/telegram.d.ts +936 -936
- package/dist/bubbles/tool-bubble/amazon-shopping-tool/amazon-shopping-tool.d.ts +26 -26
- package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/company-enrichment-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/get-trigger-detail-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +20 -20
- package/dist/bubbles/tool-bubble/instagram-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts +8 -8
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.d.ts.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js +31 -25
- package/dist/bubbles/tool-bubble/linkedin-connection-tool/linkedin-connection-tool.schema.js.map +1 -1
- package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +22 -22
- package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/people-search-tool.d.ts +18 -18
- package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +14 -14
- package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +8 -8
- package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +12 -12
- package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +16 -16
- package/dist/bubbles/tool-bubble/tool-template.d.ts +4 -4
- package/dist/bubbles/tool-bubble/twitter-tool.d.ts +18 -18
- package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +4 -4
- package/dist/bubbles/tool-bubble/web-search-tool.d.ts +10 -10
- package/dist/bubbles/tool-bubble/youtube-tool.d.ts +8 -8
- package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +16 -16
- package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +4 -4
- package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +82 -82
- package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +16 -16
- package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +10 -10
- package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +42 -42
- package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +4 -4
- package/dist/bubbles.json +355 -74
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-drive.d.ts","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/google-drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA2U3D,QAAA,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"google-drive.d.ts","sourceRoot":"","sources":["../../../src/bubbles/service-bubble/google-drive.ts"],"names":[],"mappings":"AAAA,OAAO,E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O,CAAC,OAAO,CAAC,iBAAiB,EAAE;QAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAC;YAqDvD,UAAU;IA6IxB,OAAO,CAAC,cAAc;YAuBR,YAAY;YAsFZ,SAAS;YAqDT,YAAY;YA4BZ,UAAU;YA8BV,WAAW;YA6BX,SAAS;YA2CT,QAAQ;YAoDR,MAAM;YAgDN,SAAS;IAwKvB;;OAEG;IACH,OAAO,CAAC,iBAAiB;YAcX,WAAW;YAsDX,OAAO;YA0BP,SAAS;IAuCvB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC,QAAQ;IAoChB,OAAO,CAAC,oBAAoB;IA4B5B,OAAO,CAAC,oBAAoB;IA+B5B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,wBAAwB;IA8BhC,SAAS,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;CAYjD"}
|
|
@@ -484,6 +484,15 @@ const GoogleDriveParamsSchema = z.discriminatedUnion('operation', [
|
|
|
484
484
|
.string()
|
|
485
485
|
.min(1, 'Document ID is required')
|
|
486
486
|
.describe('The ID of the Google Doc to retrieve'),
|
|
487
|
+
tab_id: z
|
|
488
|
+
.string()
|
|
489
|
+
.optional()
|
|
490
|
+
.describe('Specific tab ID to read. If omitted, reads first tab.'),
|
|
491
|
+
include_all_tabs: z
|
|
492
|
+
.boolean()
|
|
493
|
+
.optional()
|
|
494
|
+
.default(false)
|
|
495
|
+
.describe('Return info for all tabs including their plain text content'),
|
|
487
496
|
credentials: z
|
|
488
497
|
.record(z.nativeEnum(CredentialType), z.string())
|
|
489
498
|
.optional()
|
|
@@ -507,6 +516,79 @@ const GoogleDriveParamsSchema = z.discriminatedUnion('operation', [
|
|
|
507
516
|
.optional()
|
|
508
517
|
.default('replace')
|
|
509
518
|
.describe('Update mode: "replace" clears existing content first, "append" adds to the end'),
|
|
519
|
+
tab_id: z
|
|
520
|
+
.string()
|
|
521
|
+
.optional()
|
|
522
|
+
.describe('Tab to write to. If omitted, writes to first tab.'),
|
|
523
|
+
credentials: z
|
|
524
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
525
|
+
.optional()
|
|
526
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
527
|
+
}),
|
|
528
|
+
// Find and replace text operation (preserves formatting)
|
|
529
|
+
z.object({
|
|
530
|
+
operation: z
|
|
531
|
+
.literal('replace_text')
|
|
532
|
+
.describe('Find and replace text in a Google Doc while preserving formatting'),
|
|
533
|
+
document_id: z
|
|
534
|
+
.string()
|
|
535
|
+
.min(1, 'Document ID is required')
|
|
536
|
+
.describe('The ID of the Google Doc to perform replacements in'),
|
|
537
|
+
replacements: z
|
|
538
|
+
.array(z.object({
|
|
539
|
+
find: z.string().describe('Text to find'),
|
|
540
|
+
replace: z.string().describe('Text to replace with'),
|
|
541
|
+
match_case: z
|
|
542
|
+
.boolean()
|
|
543
|
+
.optional()
|
|
544
|
+
.default(true)
|
|
545
|
+
.describe('Whether to match case when finding text'),
|
|
546
|
+
}))
|
|
547
|
+
.describe('List of find/replace pairs'),
|
|
548
|
+
tab_id: z
|
|
549
|
+
.string()
|
|
550
|
+
.optional()
|
|
551
|
+
.describe('Tab to perform replacements in. If omitted, applies to all tabs.'),
|
|
552
|
+
credentials: z
|
|
553
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
554
|
+
.optional()
|
|
555
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
556
|
+
}),
|
|
557
|
+
// Copy document operation
|
|
558
|
+
z.object({
|
|
559
|
+
operation: z
|
|
560
|
+
.literal('copy_doc')
|
|
561
|
+
.describe('Create a copy of a Google Doc (useful for templates)'),
|
|
562
|
+
document_id: z
|
|
563
|
+
.string()
|
|
564
|
+
.min(1, 'Document ID is required')
|
|
565
|
+
.describe('Source document ID to copy'),
|
|
566
|
+
new_name: z
|
|
567
|
+
.string()
|
|
568
|
+
.min(1, 'New name is required')
|
|
569
|
+
.describe('Name for the new document'),
|
|
570
|
+
parent_folder_id: z
|
|
571
|
+
.string()
|
|
572
|
+
.optional()
|
|
573
|
+
.describe('Folder to place the copy in'),
|
|
574
|
+
credentials: z
|
|
575
|
+
.record(z.nativeEnum(CredentialType), z.string())
|
|
576
|
+
.optional()
|
|
577
|
+
.describe('Object mapping credential types to values (injected at runtime)'),
|
|
578
|
+
}),
|
|
579
|
+
// Create tab operation
|
|
580
|
+
z.object({
|
|
581
|
+
operation: z
|
|
582
|
+
.literal('create_tab')
|
|
583
|
+
.describe('Create a new tab in a Google Doc'),
|
|
584
|
+
document_id: z
|
|
585
|
+
.string()
|
|
586
|
+
.min(1, 'Document ID is required')
|
|
587
|
+
.describe('The ID of the Google Doc to add a tab to'),
|
|
588
|
+
title: z
|
|
589
|
+
.string()
|
|
590
|
+
.min(1, 'Tab title is required')
|
|
591
|
+
.describe('Title for the new tab'),
|
|
510
592
|
credentials: z
|
|
511
593
|
.record(z.nativeEnum(CredentialType), z.string())
|
|
512
594
|
.optional()
|
|
@@ -635,6 +717,18 @@ const GoogleDriveResultSchema = z.discriminatedUnion('operation', [
|
|
|
635
717
|
.string()
|
|
636
718
|
.optional()
|
|
637
719
|
.describe('Extracted plain text content from the document'),
|
|
720
|
+
tabs: z
|
|
721
|
+
.array(z.object({
|
|
722
|
+
tabId: z.string().describe('Unique tab identifier'),
|
|
723
|
+
title: z.string().describe('Tab title'),
|
|
724
|
+
index: z.number().describe('Tab position index'),
|
|
725
|
+
plainText: z
|
|
726
|
+
.string()
|
|
727
|
+
.optional()
|
|
728
|
+
.describe('Plain text content of the tab'),
|
|
729
|
+
}))
|
|
730
|
+
.optional()
|
|
731
|
+
.describe('All tabs in the document'),
|
|
638
732
|
error: z.string().describe('Error message if operation failed'),
|
|
639
733
|
}),
|
|
640
734
|
z.object({
|
|
@@ -654,6 +748,39 @@ const GoogleDriveResultSchema = z.discriminatedUnion('operation', [
|
|
|
654
748
|
.describe('The new revision ID after the update'),
|
|
655
749
|
error: z.string().describe('Error message if operation failed'),
|
|
656
750
|
}),
|
|
751
|
+
z.object({
|
|
752
|
+
operation: z
|
|
753
|
+
.literal('replace_text')
|
|
754
|
+
.describe('Find and replace text in a Google Doc'),
|
|
755
|
+
success: z
|
|
756
|
+
.boolean()
|
|
757
|
+
.describe('Whether the replacements were made successfully'),
|
|
758
|
+
replacements_made: z
|
|
759
|
+
.number()
|
|
760
|
+
.optional()
|
|
761
|
+
.describe('Total number of replacements made'),
|
|
762
|
+
error: z.string().describe('Error message if operation failed'),
|
|
763
|
+
}),
|
|
764
|
+
z.object({
|
|
765
|
+
operation: z.literal('copy_doc').describe('Create a copy of a Google Doc'),
|
|
766
|
+
success: z
|
|
767
|
+
.boolean()
|
|
768
|
+
.describe('Whether the document was copied successfully'),
|
|
769
|
+
new_document_id: z.string().optional().describe('ID of the new document'),
|
|
770
|
+
new_document_url: z
|
|
771
|
+
.string()
|
|
772
|
+
.optional()
|
|
773
|
+
.describe('URL to view the new document'),
|
|
774
|
+
error: z.string().describe('Error message if operation failed'),
|
|
775
|
+
}),
|
|
776
|
+
z.object({
|
|
777
|
+
operation: z
|
|
778
|
+
.literal('create_tab')
|
|
779
|
+
.describe('Create a new tab in a Google Doc'),
|
|
780
|
+
success: z.boolean().describe('Whether the tab was created successfully'),
|
|
781
|
+
tab_id: z.string().optional().describe('ID of the newly created tab'),
|
|
782
|
+
error: z.string().describe('Error message if operation failed'),
|
|
783
|
+
}),
|
|
657
784
|
]);
|
|
658
785
|
export class GoogleDriveBubble extends ServiceBubble {
|
|
659
786
|
static type = 'service';
|
|
@@ -785,6 +912,12 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
785
912
|
return await this.getDoc(this.params);
|
|
786
913
|
case 'update_doc':
|
|
787
914
|
return await this.updateDoc(this.params);
|
|
915
|
+
case 'replace_text':
|
|
916
|
+
return await this.replaceText(this.params);
|
|
917
|
+
case 'copy_doc':
|
|
918
|
+
return await this.copyDoc(this.params);
|
|
919
|
+
case 'create_tab':
|
|
920
|
+
return await this.createTab(this.params);
|
|
788
921
|
default:
|
|
789
922
|
throw new Error(`Unsupported operation: ${operation}`);
|
|
790
923
|
}
|
|
@@ -1146,44 +1279,88 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1146
1279
|
};
|
|
1147
1280
|
}
|
|
1148
1281
|
async getDoc(params) {
|
|
1149
|
-
const { document_id } = params;
|
|
1150
|
-
|
|
1282
|
+
const { document_id, tab_id, include_all_tabs } = params;
|
|
1283
|
+
// Always fetch with tabs to get full structure
|
|
1284
|
+
const url = `https://docs.googleapis.com/v1/documents/${document_id}?includeTabsContent=true`;
|
|
1151
1285
|
// Make the request to Google Docs API
|
|
1152
1286
|
const response = await this.makeGoogleApiRequest(url, 'GET');
|
|
1153
|
-
//
|
|
1154
|
-
const
|
|
1287
|
+
// Build tabs info if document has tabs
|
|
1288
|
+
const responseTabs = response.tabs;
|
|
1289
|
+
const tabs = responseTabs?.map((tab) => ({
|
|
1290
|
+
tabId: tab.tabProperties?.tabId || '',
|
|
1291
|
+
title: tab.tabProperties?.title || 'Untitled',
|
|
1292
|
+
index: tab.tabProperties?.index || 0,
|
|
1293
|
+
plainText: include_all_tabs
|
|
1294
|
+
? this.extractPlainTextFromTab(tab)
|
|
1295
|
+
: undefined,
|
|
1296
|
+
}));
|
|
1297
|
+
// Get content from specific tab or first tab
|
|
1298
|
+
const targetTab = tab_id
|
|
1299
|
+
? responseTabs?.find((t) => t.tabProperties?.tabId === tab_id)
|
|
1300
|
+
: responseTabs?.[0];
|
|
1301
|
+
// Extract plain text from the target tab, or fall back to document body for non-tabbed docs
|
|
1302
|
+
const plainText = targetTab
|
|
1303
|
+
? this.extractPlainTextFromTab(targetTab)
|
|
1304
|
+
: this.extractPlainTextFromDoc(response);
|
|
1155
1305
|
return {
|
|
1156
1306
|
operation: 'get_doc',
|
|
1157
1307
|
success: true,
|
|
1158
1308
|
document: response,
|
|
1159
1309
|
plainText,
|
|
1310
|
+
tabs,
|
|
1160
1311
|
error: '',
|
|
1161
1312
|
};
|
|
1162
1313
|
}
|
|
1163
1314
|
async updateDoc(params) {
|
|
1164
|
-
const { document_id, content, mode } = params;
|
|
1315
|
+
const { document_id, content, mode, tab_id } = params;
|
|
1165
1316
|
const url = `https://docs.googleapis.com/v1/documents/${document_id}:batchUpdate`;
|
|
1166
1317
|
// Build the requests array based on mode
|
|
1167
1318
|
const requests = [];
|
|
1168
1319
|
// Auto-detect markdown and parse if needed
|
|
1169
1320
|
const useMarkdown = isMarkdown(content);
|
|
1321
|
+
// Helper to build location object with optional tabId
|
|
1322
|
+
const buildLocation = (index) => {
|
|
1323
|
+
const location = { index };
|
|
1324
|
+
if (tab_id) {
|
|
1325
|
+
location.tabId = tab_id;
|
|
1326
|
+
}
|
|
1327
|
+
return location;
|
|
1328
|
+
};
|
|
1329
|
+
// Helper to build range object with optional tabId
|
|
1330
|
+
const buildRange = (startIndex, endIndex) => {
|
|
1331
|
+
const range = {
|
|
1332
|
+
startIndex,
|
|
1333
|
+
endIndex,
|
|
1334
|
+
};
|
|
1335
|
+
if (tab_id) {
|
|
1336
|
+
range.tabId = tab_id;
|
|
1337
|
+
}
|
|
1338
|
+
return range;
|
|
1339
|
+
};
|
|
1170
1340
|
if (mode === 'replace') {
|
|
1171
1341
|
// For replace mode, first get the document to find content length
|
|
1172
|
-
const docUrl = `https://docs.googleapis.com/v1/documents/${document_id}`;
|
|
1342
|
+
const docUrl = `https://docs.googleapis.com/v1/documents/${document_id}?includeTabsContent=true`;
|
|
1173
1343
|
const document = await this.makeGoogleApiRequest(docUrl, 'GET');
|
|
1174
|
-
// Get the end index
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1344
|
+
// Get the end index from the target tab or document body
|
|
1345
|
+
let endIndex = 1;
|
|
1346
|
+
if (tab_id && document.tabs) {
|
|
1347
|
+
const tabs = document.tabs;
|
|
1348
|
+
const targetTab = tabs.find((t) => t.tabProperties?.tabId === tab_id);
|
|
1349
|
+
const tabContent = targetTab?.documentTab?.body?.content || [];
|
|
1350
|
+
const lastElement = tabContent[tabContent.length - 1];
|
|
1351
|
+
endIndex = lastElement?.endIndex || 1;
|
|
1352
|
+
}
|
|
1353
|
+
else {
|
|
1354
|
+
const body = document.body;
|
|
1355
|
+
const contentElements = body?.content || [];
|
|
1356
|
+
const lastElement = contentElements[contentElements.length - 1];
|
|
1357
|
+
endIndex = lastElement?.endIndex || 1;
|
|
1358
|
+
}
|
|
1179
1359
|
// Only delete if there's content to delete (endIndex > 1)
|
|
1180
1360
|
if (endIndex > 1) {
|
|
1181
1361
|
requests.push({
|
|
1182
1362
|
deleteContentRange: {
|
|
1183
|
-
range:
|
|
1184
|
-
startIndex: 1,
|
|
1185
|
-
endIndex: endIndex - 1,
|
|
1186
|
-
},
|
|
1363
|
+
range: buildRange(1, endIndex - 1),
|
|
1187
1364
|
},
|
|
1188
1365
|
});
|
|
1189
1366
|
}
|
|
@@ -1193,18 +1370,24 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1193
1370
|
// Insert plain text first
|
|
1194
1371
|
requests.push({
|
|
1195
1372
|
insertText: {
|
|
1196
|
-
location:
|
|
1373
|
+
location: buildLocation(1),
|
|
1197
1374
|
text: parsed.plainText,
|
|
1198
1375
|
},
|
|
1199
1376
|
});
|
|
1200
|
-
// Add formatting requests
|
|
1201
|
-
|
|
1377
|
+
// Add formatting requests with tabId if provided
|
|
1378
|
+
for (const req of parsed.requests) {
|
|
1379
|
+
if (tab_id) {
|
|
1380
|
+
// Add tabId to range objects in formatting requests
|
|
1381
|
+
this.addTabIdToRequest(req, tab_id);
|
|
1382
|
+
}
|
|
1383
|
+
requests.push(req);
|
|
1384
|
+
}
|
|
1202
1385
|
}
|
|
1203
1386
|
else {
|
|
1204
1387
|
// Plain text - just insert
|
|
1205
1388
|
requests.push({
|
|
1206
1389
|
insertText: {
|
|
1207
|
-
location:
|
|
1390
|
+
location: buildLocation(1),
|
|
1208
1391
|
text: content,
|
|
1209
1392
|
},
|
|
1210
1393
|
});
|
|
@@ -1212,13 +1395,23 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1212
1395
|
}
|
|
1213
1396
|
else {
|
|
1214
1397
|
// For append mode, get document to find the end position
|
|
1215
|
-
const docUrl = `https://docs.googleapis.com/v1/documents/${document_id}`;
|
|
1398
|
+
const docUrl = `https://docs.googleapis.com/v1/documents/${document_id}?includeTabsContent=true`;
|
|
1216
1399
|
const document = await this.makeGoogleApiRequest(docUrl, 'GET');
|
|
1217
|
-
// Get the end index
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1400
|
+
// Get the end index from the target tab or document body
|
|
1401
|
+
let endIndex = 1;
|
|
1402
|
+
if (tab_id && document.tabs) {
|
|
1403
|
+
const tabs = document.tabs;
|
|
1404
|
+
const targetTab = tabs.find((t) => t.tabProperties?.tabId === tab_id);
|
|
1405
|
+
const tabContent = targetTab?.documentTab?.body?.content || [];
|
|
1406
|
+
const lastElement = tabContent[tabContent.length - 1];
|
|
1407
|
+
endIndex = lastElement?.endIndex || 1;
|
|
1408
|
+
}
|
|
1409
|
+
else {
|
|
1410
|
+
const body = document.body;
|
|
1411
|
+
const contentElements = body?.content || [];
|
|
1412
|
+
const lastElement = contentElements[contentElements.length - 1];
|
|
1413
|
+
endIndex = lastElement?.endIndex || 1;
|
|
1414
|
+
}
|
|
1222
1415
|
const insertIndex = endIndex - 1;
|
|
1223
1416
|
if (useMarkdown) {
|
|
1224
1417
|
// Parse markdown and get plain text + formatting requests
|
|
@@ -1226,18 +1419,23 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1226
1419
|
// Insert plain text first
|
|
1227
1420
|
requests.push({
|
|
1228
1421
|
insertText: {
|
|
1229
|
-
location:
|
|
1422
|
+
location: buildLocation(insertIndex),
|
|
1230
1423
|
text: parsed.plainText,
|
|
1231
1424
|
},
|
|
1232
1425
|
});
|
|
1233
|
-
// Add formatting requests
|
|
1234
|
-
|
|
1426
|
+
// Add formatting requests with tabId if provided
|
|
1427
|
+
for (const req of parsed.requests) {
|
|
1428
|
+
if (tab_id) {
|
|
1429
|
+
this.addTabIdToRequest(req, tab_id);
|
|
1430
|
+
}
|
|
1431
|
+
requests.push(req);
|
|
1432
|
+
}
|
|
1235
1433
|
}
|
|
1236
1434
|
else {
|
|
1237
1435
|
// Plain text - just insert
|
|
1238
1436
|
requests.push({
|
|
1239
1437
|
insertText: {
|
|
1240
|
-
location:
|
|
1438
|
+
location: buildLocation(insertIndex),
|
|
1241
1439
|
text: content,
|
|
1242
1440
|
},
|
|
1243
1441
|
});
|
|
@@ -1255,6 +1453,101 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1255
1453
|
error: '',
|
|
1256
1454
|
};
|
|
1257
1455
|
}
|
|
1456
|
+
/**
|
|
1457
|
+
* Adds tabId to range objects in formatting requests
|
|
1458
|
+
*/
|
|
1459
|
+
addTabIdToRequest(req, tabId) {
|
|
1460
|
+
for (const key of Object.keys(req)) {
|
|
1461
|
+
const value = req[key];
|
|
1462
|
+
if (value && typeof value === 'object') {
|
|
1463
|
+
if ('range' in value && typeof value.range === 'object') {
|
|
1464
|
+
value.range.tabId = tabId;
|
|
1465
|
+
}
|
|
1466
|
+
if ('location' in value && typeof value.location === 'object') {
|
|
1467
|
+
value.location.tabId = tabId;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
async replaceText(params) {
|
|
1473
|
+
const { document_id, replacements, tab_id } = params;
|
|
1474
|
+
const url = `https://docs.googleapis.com/v1/documents/${document_id}:batchUpdate`;
|
|
1475
|
+
// Build requests for each replacement
|
|
1476
|
+
const requests = replacements.map((r) => {
|
|
1477
|
+
const containsText = {
|
|
1478
|
+
text: r.find,
|
|
1479
|
+
matchCase: r.match_case ?? true,
|
|
1480
|
+
};
|
|
1481
|
+
// Add tabId if provided to target specific tab
|
|
1482
|
+
if (tab_id) {
|
|
1483
|
+
containsText.tabId = tab_id;
|
|
1484
|
+
}
|
|
1485
|
+
return {
|
|
1486
|
+
replaceAllText: {
|
|
1487
|
+
containsText,
|
|
1488
|
+
replaceText: r.replace,
|
|
1489
|
+
},
|
|
1490
|
+
};
|
|
1491
|
+
});
|
|
1492
|
+
// Make the batchUpdate request
|
|
1493
|
+
const response = await this.makeGoogleApiRequest(url, 'POST', {
|
|
1494
|
+
requests,
|
|
1495
|
+
});
|
|
1496
|
+
// Count total replacements made
|
|
1497
|
+
const replies = response.replies;
|
|
1498
|
+
const totalReplacements = replies?.reduce((sum, r) => sum + (r.replaceAllText?.occurrencesChanged || 0), 0) || 0;
|
|
1499
|
+
return {
|
|
1500
|
+
operation: 'replace_text',
|
|
1501
|
+
success: true,
|
|
1502
|
+
replacements_made: totalReplacements,
|
|
1503
|
+
error: '',
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
1506
|
+
async copyDoc(params) {
|
|
1507
|
+
const { document_id, new_name, parent_folder_id } = params;
|
|
1508
|
+
// Use Drive API copy endpoint
|
|
1509
|
+
const body = { name: new_name };
|
|
1510
|
+
if (parent_folder_id) {
|
|
1511
|
+
body.parents = [parent_folder_id];
|
|
1512
|
+
}
|
|
1513
|
+
const response = await this.makeGoogleApiRequest(`/files/${document_id}/copy?supportsAllDrives=true&fields=id,webViewLink`, 'POST', body);
|
|
1514
|
+
return {
|
|
1515
|
+
operation: 'copy_doc',
|
|
1516
|
+
success: true,
|
|
1517
|
+
new_document_id: response.id,
|
|
1518
|
+
new_document_url: response.webViewLink,
|
|
1519
|
+
error: '',
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
async createTab(params) {
|
|
1523
|
+
const { document_id, title } = params;
|
|
1524
|
+
const url = `https://docs.googleapis.com/v1/documents/${document_id}:batchUpdate`;
|
|
1525
|
+
// Create a new tab using the addTab request
|
|
1526
|
+
const requests = [
|
|
1527
|
+
{
|
|
1528
|
+
addTab: {
|
|
1529
|
+
tab: {
|
|
1530
|
+
tabProperties: {
|
|
1531
|
+
title,
|
|
1532
|
+
},
|
|
1533
|
+
},
|
|
1534
|
+
},
|
|
1535
|
+
},
|
|
1536
|
+
];
|
|
1537
|
+
// Make the batchUpdate request
|
|
1538
|
+
const response = await this.makeGoogleApiRequest(url, 'POST', {
|
|
1539
|
+
requests,
|
|
1540
|
+
});
|
|
1541
|
+
// Extract the new tab ID from the response
|
|
1542
|
+
const replies = response.replies;
|
|
1543
|
+
const newTabId = replies?.[0]?.addTab?.tab?.tabProperties?.tabId;
|
|
1544
|
+
return {
|
|
1545
|
+
operation: 'create_tab',
|
|
1546
|
+
success: true,
|
|
1547
|
+
tab_id: newTabId,
|
|
1548
|
+
error: '',
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1258
1551
|
/**
|
|
1259
1552
|
* Extracts plain text content from a Google Docs document body
|
|
1260
1553
|
*/
|
|
@@ -1263,8 +1556,24 @@ export class GoogleDriveBubble extends ServiceBubble {
|
|
|
1263
1556
|
if (!body?.content) {
|
|
1264
1557
|
return '';
|
|
1265
1558
|
}
|
|
1559
|
+
return this.extractPlainTextFromContent(body.content);
|
|
1560
|
+
}
|
|
1561
|
+
/**
|
|
1562
|
+
* Extracts plain text content from a Google Docs tab
|
|
1563
|
+
*/
|
|
1564
|
+
extractPlainTextFromTab(tab) {
|
|
1565
|
+
const body = tab?.documentTab?.body;
|
|
1566
|
+
if (!body?.content) {
|
|
1567
|
+
return '';
|
|
1568
|
+
}
|
|
1569
|
+
return this.extractPlainTextFromContent(body.content);
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Extracts plain text from a content array
|
|
1573
|
+
*/
|
|
1574
|
+
extractPlainTextFromContent(content) {
|
|
1266
1575
|
const textParts = [];
|
|
1267
|
-
for (const element of
|
|
1576
|
+
for (const element of content) {
|
|
1268
1577
|
const paragraph = element.paragraph;
|
|
1269
1578
|
if (paragraph?.elements) {
|
|
1270
1579
|
for (const elem of paragraph.elements) {
|