@commandable/integration-data 0.0.5 → 0.0.7
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/credentials-index.d.ts.map +1 -1
- package/dist/credentials-index.js +183 -0
- package/dist/credentials-index.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/loader.d.ts +33 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +36 -4
- package/dist/loader.js.map +1 -1
- package/integrations/__tests__/liveHarness.ts +16 -3
- package/integrations/airtable/.env.test +9 -0
- package/integrations/airtable/.env.test.example +11 -0
- package/integrations/airtable/README.md +27 -0
- package/integrations/airtable/__tests__/get_handlers.test.ts +43 -5
- package/integrations/confluence/.env.test +25 -0
- package/integrations/confluence/.env.test.example +36 -0
- package/integrations/confluence/README.md +28 -0
- package/integrations/confluence/__tests__/get_handlers.test.ts +121 -0
- package/integrations/confluence/__tests__/usage_parity.test.ts +14 -0
- package/integrations/confluence/__tests__/write_handlers.test.ts +131 -0
- package/integrations/confluence/credentials.json +39 -0
- package/integrations/confluence/credentials_hint.md +4 -0
- package/integrations/confluence/credentials_hint_api_token.md +9 -0
- package/integrations/confluence/credentials_hint_oauth_token.md +8 -0
- package/integrations/confluence/handlers/add_comment.js +19 -0
- package/integrations/confluence/handlers/add_label.js +16 -0
- package/integrations/confluence/handlers/create_page.js +22 -0
- package/integrations/confluence/handlers/delete_page.js +17 -0
- package/integrations/confluence/handlers/get_comments.js +33 -0
- package/integrations/confluence/handlers/get_page_children.js +30 -0
- package/integrations/confluence/handlers/get_space.js +22 -0
- package/integrations/confluence/handlers/list_spaces.js +39 -0
- package/integrations/confluence/handlers/read_page.js +49 -0
- package/integrations/confluence/handlers/search_pages.js +42 -0
- package/integrations/confluence/handlers/update_page.js +42 -0
- package/integrations/confluence/manifest.json +85 -0
- package/integrations/confluence/prompt.md +55 -0
- package/integrations/confluence/schemas/add_comment.json +22 -0
- package/integrations/confluence/schemas/add_label.json +19 -0
- package/integrations/confluence/schemas/create_page.json +33 -0
- package/integrations/confluence/schemas/delete_page.json +23 -0
- package/integrations/confluence/schemas/empty.json +6 -0
- package/integrations/confluence/schemas/get_comments.json +24 -0
- package/integrations/confluence/schemas/get_page_children.json +28 -0
- package/integrations/confluence/schemas/get_space.json +18 -0
- package/integrations/confluence/schemas/list_spaces.json +36 -0
- package/integrations/confluence/schemas/read_page.json +28 -0
- package/integrations/confluence/schemas/search_pages.json +26 -0
- package/integrations/confluence/schemas/update_page.json +31 -0
- package/integrations/github/.env.test +16 -0
- package/integrations/github/.env.test.example +17 -0
- package/integrations/github/README.md +75 -0
- package/integrations/github/__tests__/get_handlers.test.ts +207 -12
- package/integrations/github/__tests__/write_handlers.test.ts +323 -55
- package/integrations/github/handlers/create_commit.js +10 -2
- package/integrations/github/handlers/create_file.js +46 -0
- package/integrations/github/handlers/create_pull_request_review.js +10 -0
- package/integrations/github/handlers/create_release.js +14 -0
- package/integrations/github/handlers/delete_branch.js +8 -0
- package/integrations/github/handlers/delete_file.js +22 -0
- package/integrations/github/handlers/edit_file.js +52 -0
- package/integrations/github/handlers/edit_files.js +107 -0
- package/integrations/github/handlers/fork_repo.js +10 -0
- package/integrations/github/handlers/get_commit.js +8 -0
- package/integrations/github/handlers/get_file_contents.js +21 -0
- package/integrations/github/handlers/get_job_logs.js +6 -0
- package/integrations/github/handlers/get_latest_release.js +4 -0
- package/integrations/github/handlers/get_me.js +4 -0
- package/integrations/github/handlers/get_pull_request.js +4 -0
- package/integrations/github/handlers/get_pull_request_diff.js +8 -0
- package/integrations/github/handlers/get_repo_tree.js +12 -0
- package/integrations/github/handlers/get_workflow_run.js +4 -0
- package/integrations/github/handlers/list_branches.js +6 -1
- package/integrations/github/handlers/list_commits.js +5 -6
- package/integrations/github/handlers/list_issue_comments.js +8 -0
- package/integrations/github/handlers/list_issues.js +5 -6
- package/integrations/github/handlers/list_labels.js +8 -0
- package/integrations/github/handlers/list_pull_request_comments.js +8 -0
- package/integrations/github/handlers/list_pull_request_files.js +8 -0
- package/integrations/github/handlers/list_pull_requests.js +7 -2
- package/integrations/github/handlers/list_releases.js +8 -0
- package/integrations/github/handlers/list_tags.js +8 -0
- package/integrations/github/handlers/list_workflow_runs.js +11 -0
- package/integrations/github/handlers/request_pull_request_reviewers.js +10 -0
- package/integrations/github/handlers/search_code.js +8 -0
- package/integrations/github/handlers/search_issues.js +8 -0
- package/integrations/github/handlers/search_pull_requests.js +8 -0
- package/integrations/github/handlers/search_repos.js +10 -0
- package/integrations/github/handlers/update_pull_request.js +13 -0
- package/integrations/github/manifest.json +86 -21
- package/integrations/github/prompt.md +36 -0
- package/integrations/github/schemas/create_file.json +13 -0
- package/integrations/github/schemas/create_pull_request_review.json +17 -0
- package/integrations/github/schemas/create_release.json +16 -0
- package/integrations/github/schemas/delete_branch.json +10 -0
- package/integrations/github/schemas/delete_file.json +13 -0
- package/integrations/github/schemas/edit_file.json +26 -0
- package/integrations/github/schemas/edit_files.json +39 -0
- package/integrations/github/schemas/fork_repo.json +11 -0
- package/integrations/github/schemas/get_commit.json +12 -0
- package/integrations/github/schemas/get_file_contents.json +11 -0
- package/integrations/github/schemas/get_job_logs.json +10 -0
- package/integrations/github/schemas/get_pull_request.json +10 -0
- package/integrations/github/schemas/get_pull_request_diff.json +10 -0
- package/integrations/github/schemas/get_repo_tree.json +12 -0
- package/integrations/github/schemas/get_workflow_run.json +10 -0
- package/integrations/github/schemas/list_branches.json +12 -0
- package/integrations/github/schemas/list_commits.json +5 -3
- package/integrations/github/schemas/list_issue_comments.json +12 -0
- package/integrations/github/schemas/list_issues.json +4 -2
- package/integrations/github/schemas/list_labels.json +11 -0
- package/integrations/github/schemas/list_pull_request_comments.json +12 -0
- package/integrations/github/schemas/list_pull_request_files.json +12 -0
- package/integrations/github/schemas/list_pull_requests.json +7 -1
- package/integrations/github/schemas/list_releases.json +11 -0
- package/integrations/github/schemas/list_tags.json +11 -0
- package/integrations/github/schemas/list_workflow_runs.json +18 -0
- package/integrations/github/schemas/request_pull_request_reviewers.json +20 -0
- package/integrations/github/schemas/search_code.json +10 -0
- package/integrations/github/schemas/search_issues.json +10 -0
- package/integrations/github/schemas/search_pull_requests.json +10 -0
- package/integrations/github/schemas/search_repos.json +12 -0
- package/integrations/github/schemas/update_pull_request.json +15 -0
- package/integrations/google-calendar/.env.test.example +11 -0
- package/integrations/google-calendar/README.md +41 -0
- package/integrations/google-calendar/__tests__/write_and_admin_handlers.test.ts +7 -20
- package/integrations/google-calendar/handlers/get_event.js +5 -1
- package/integrations/google-calendar/handlers/list_events.js +2 -0
- package/integrations/google-calendar/manifest.json +27 -18
- package/integrations/google-calendar/prompt.md +68 -0
- package/integrations/google-calendar/schemas/id_calendar_event.json +4 -2
- package/integrations/google-calendar/schemas/list_events.json +10 -8
- package/integrations/google-docs/README.md +30 -0
- package/integrations/google-docs/__tests__/get_handlers.test.ts +4 -19
- package/integrations/google-docs/__tests__/write_handlers.test.ts +31 -48
- package/integrations/google-docs/handlers/read_document.js +189 -0
- package/integrations/google-docs/manifest.json +16 -31
- package/integrations/google-docs/prompt.md +49 -0
- package/integrations/google-docs/schemas/{get_document_text.json → read_document.json} +5 -2
- package/integrations/google-docs/todo.md +18 -0
- package/integrations/google-drive/README.md +26 -0
- package/integrations/google-drive/__tests__/handlers.test.ts +43 -0
- package/integrations/google-drive/__tests__/usage_parity.test.ts +9 -0
- package/integrations/google-drive/handlers/get_file.js +2 -4
- package/integrations/google-drive/handlers/get_file_content.js +41 -0
- package/integrations/google-drive/handlers/list_files.js +15 -0
- package/integrations/google-drive/handlers/search_files.js +20 -0
- package/integrations/google-drive/handlers/share_file.js +20 -0
- package/integrations/google-drive/manifest.json +37 -10
- package/integrations/google-drive/prompt.md +59 -0
- package/integrations/google-drive/schemas/get_file.json +2 -2
- package/integrations/google-drive/schemas/get_file_content.json +11 -0
- package/integrations/google-drive/schemas/list_files.json +12 -0
- package/integrations/google-drive/schemas/search_files.json +14 -0
- package/integrations/google-drive/schemas/share_file.json +23 -0
- package/integrations/google-gmail/.env.test.example +11 -0
- package/integrations/google-gmail/README.md +49 -0
- package/integrations/google-gmail/__tests__/get_handlers.test.ts +134 -0
- package/integrations/google-gmail/__tests__/usage_parity.test.ts +9 -0
- package/integrations/google-gmail/__tests__/write_and_admin_handlers.test.ts +211 -0
- package/integrations/google-gmail/credentials.json +57 -0
- package/integrations/google-gmail/credentials_hint_oauth_token.md +8 -0
- package/integrations/google-gmail/credentials_hint_service_account.md +10 -0
- package/integrations/google-gmail/handlers/create_draft_email.js +27 -0
- package/integrations/google-gmail/handlers/create_label.js +12 -0
- package/integrations/google-gmail/handlers/delete_draft.js +13 -0
- package/integrations/google-gmail/handlers/delete_label.js +13 -0
- package/integrations/google-gmail/handlers/delete_message.js +13 -0
- package/integrations/google-gmail/handlers/delete_thread.js +13 -0
- package/integrations/google-gmail/handlers/get_draft.js +6 -0
- package/integrations/google-gmail/handlers/get_label.js +6 -0
- package/integrations/google-gmail/handlers/get_message.js +14 -0
- package/integrations/google-gmail/handlers/get_profile.js +5 -0
- package/integrations/google-gmail/handlers/get_thread.js +14 -0
- package/integrations/google-gmail/handlers/list_drafts.js +15 -0
- package/integrations/google-gmail/handlers/list_labels.js +5 -0
- package/integrations/google-gmail/handlers/list_messages.js +19 -0
- package/integrations/google-gmail/handlers/list_threads.js +19 -0
- package/integrations/google-gmail/handlers/modify_message.js +11 -0
- package/integrations/google-gmail/handlers/modify_thread.js +11 -0
- package/integrations/google-gmail/handlers/read_email.js +56 -0
- package/integrations/google-gmail/handlers/send_draft.js +15 -0
- package/integrations/google-gmail/handlers/send_email.js +22 -0
- package/integrations/google-gmail/handlers/trash_message.js +6 -0
- package/integrations/google-gmail/handlers/trash_thread.js +6 -0
- package/integrations/google-gmail/handlers/untrash_message.js +6 -0
- package/integrations/google-gmail/handlers/untrash_thread.js +6 -0
- package/integrations/google-gmail/handlers/update_label.js +15 -0
- package/integrations/google-gmail/manifest.json +44 -0
- package/integrations/google-gmail/prompt.md +52 -0
- package/integrations/google-gmail/schemas/create_draft_email.json +16 -0
- package/integrations/google-gmail/schemas/create_label.json +26 -0
- package/integrations/google-gmail/schemas/get_message.json +20 -0
- package/integrations/{google-docs/schemas/get_document_structured.json → google-gmail/schemas/get_profile.json} +4 -2
- package/integrations/google-gmail/schemas/get_thread.json +20 -0
- package/integrations/google-gmail/schemas/id_draft.json +16 -0
- package/integrations/google-gmail/schemas/id_label.json +16 -0
- package/integrations/google-gmail/schemas/id_message.json +16 -0
- package/integrations/google-gmail/schemas/id_thread.json +16 -0
- package/integrations/google-gmail/schemas/list_drafts.json +30 -0
- package/integrations/{google-sheet/schemas/get_developer_metadata.json → google-gmail/schemas/list_labels.json} +4 -3
- package/integrations/google-gmail/schemas/list_messages.json +35 -0
- package/integrations/google-gmail/schemas/list_threads.json +35 -0
- package/integrations/google-gmail/schemas/modify_message.json +24 -0
- package/integrations/google-gmail/schemas/modify_thread.json +24 -0
- package/integrations/google-gmail/schemas/read_email.json +10 -0
- package/integrations/google-gmail/schemas/send_draft.json +29 -0
- package/integrations/google-gmail/schemas/send_email.json +17 -0
- package/integrations/google-gmail/schemas/update_label.json +33 -0
- package/integrations/google-sheet/README.md +27 -0
- package/integrations/google-sheet/__tests__/get_handlers.test.ts +6 -52
- package/integrations/google-sheet/__tests__/write_handlers.test.ts +0 -20
- package/integrations/google-sheet/handlers/get_spreadsheet.js +2 -0
- package/integrations/google-sheet/handlers/read_sheet.js +75 -0
- package/integrations/google-sheet/manifest.json +13 -62
- package/integrations/google-sheet/prompt.md +49 -0
- package/integrations/google-sheet/schemas/get_spreadsheet.json +5 -4
- package/integrations/google-sheet/schemas/read_sheet.json +21 -0
- package/integrations/google-slides/README.md +28 -0
- package/integrations/google-slides/__tests__/get_handlers.test.ts +12 -9
- package/integrations/google-slides/handlers/read_presentation.js +51 -0
- package/integrations/google-slides/manifest.json +13 -13
- package/integrations/google-slides/prompt.md +56 -0
- package/integrations/hubspot/.env.test.example +20 -0
- package/integrations/hubspot/README.md +48 -0
- package/integrations/hubspot/__tests__/get_handlers.test.ts +151 -0
- package/integrations/hubspot/__tests__/usage_parity.test.ts +10 -0
- package/integrations/hubspot/__tests__/write_handlers.test.ts +244 -0
- package/integrations/hubspot/credentials.json +48 -0
- package/integrations/hubspot/credentials_hint.md +20 -0
- package/integrations/hubspot/credentials_hint_oauth_token.md +16 -0
- package/integrations/hubspot/handlers/archive_company.js +13 -0
- package/integrations/hubspot/handlers/archive_contact.js +13 -0
- package/integrations/hubspot/handlers/archive_deal.js +13 -0
- package/integrations/hubspot/handlers/archive_ticket.js +13 -0
- package/integrations/hubspot/handlers/create_association.js +18 -0
- package/integrations/hubspot/handlers/create_company.js +13 -0
- package/integrations/hubspot/handlers/create_contact.js +14 -0
- package/integrations/hubspot/handlers/create_deal.js +16 -0
- package/integrations/hubspot/handlers/create_note.js +44 -0
- package/integrations/hubspot/handlers/create_task.js +48 -0
- package/integrations/hubspot/handlers/create_ticket.js +15 -0
- package/integrations/hubspot/handlers/get_associations.js +14 -0
- package/integrations/hubspot/handlers/get_company.js +18 -0
- package/integrations/hubspot/handlers/get_contact.js +18 -0
- package/integrations/hubspot/handlers/get_deal.js +18 -0
- package/integrations/hubspot/handlers/get_ticket.js +20 -0
- package/integrations/hubspot/handlers/list_owners.js +12 -0
- package/integrations/hubspot/handlers/list_pipelines.js +5 -0
- package/integrations/hubspot/handlers/list_properties.js +11 -0
- package/integrations/hubspot/handlers/remove_association.js +22 -0
- package/integrations/hubspot/handlers/search_companies.js +43 -0
- package/integrations/hubspot/handlers/search_contacts.js +43 -0
- package/integrations/hubspot/handlers/search_deals.js +43 -0
- package/integrations/hubspot/handlers/search_notes.js +43 -0
- package/integrations/hubspot/handlers/search_tasks.js +43 -0
- package/integrations/hubspot/handlers/search_tickets.js +43 -0
- package/integrations/hubspot/handlers/update_company.js +13 -0
- package/integrations/hubspot/handlers/update_contact.js +14 -0
- package/integrations/hubspot/handlers/update_deal.js +16 -0
- package/integrations/hubspot/handlers/update_task.js +17 -0
- package/integrations/hubspot/handlers/update_ticket.js +15 -0
- package/integrations/hubspot/manifest.json +230 -0
- package/integrations/hubspot/prompt.md +69 -0
- package/integrations/hubspot/schemas/archive_company.json +13 -0
- package/integrations/hubspot/schemas/archive_contact.json +13 -0
- package/integrations/hubspot/schemas/archive_deal.json +9 -0
- package/integrations/hubspot/schemas/archive_ticket.json +9 -0
- package/integrations/hubspot/schemas/create_association.json +24 -0
- package/integrations/hubspot/schemas/create_company.json +14 -0
- package/integrations/hubspot/schemas/create_contact.json +15 -0
- package/integrations/hubspot/schemas/create_deal.json +20 -0
- package/integrations/hubspot/schemas/create_note.json +37 -0
- package/integrations/hubspot/schemas/create_task.json +51 -0
- package/integrations/hubspot/schemas/create_ticket.json +16 -0
- package/integrations/hubspot/schemas/empty.json +6 -0
- package/integrations/hubspot/schemas/get_associations.json +30 -0
- package/integrations/hubspot/schemas/get_company.json +27 -0
- package/integrations/hubspot/schemas/get_contact.json +27 -0
- package/integrations/hubspot/schemas/get_deal.json +20 -0
- package/integrations/hubspot/schemas/get_ticket.json +20 -0
- package/integrations/hubspot/schemas/list_owners.json +25 -0
- package/integrations/hubspot/schemas/list_pipelines.json +13 -0
- package/integrations/hubspot/schemas/list_properties.json +17 -0
- package/integrations/hubspot/schemas/remove_association.json +24 -0
- package/integrations/hubspot/schemas/search_companies.json +56 -0
- package/integrations/hubspot/schemas/search_contacts.json +56 -0
- package/integrations/hubspot/schemas/search_deals.json +43 -0
- package/integrations/hubspot/schemas/search_notes.json +43 -0
- package/integrations/hubspot/schemas/search_tasks.json +43 -0
- package/integrations/hubspot/schemas/search_tickets.json +43 -0
- package/integrations/hubspot/schemas/update_company.json +20 -0
- package/integrations/hubspot/schemas/update_contact.json +21 -0
- package/integrations/hubspot/schemas/update_deal.json +19 -0
- package/integrations/hubspot/schemas/update_task.json +31 -0
- package/integrations/hubspot/schemas/update_ticket.json +18 -0
- package/integrations/jira/.env.test +46 -0
- package/integrations/jira/.env.test.example +41 -0
- package/integrations/jira/README.md +46 -0
- package/integrations/jira/__tests__/get_handlers.test.ts +193 -0
- package/integrations/jira/__tests__/usage_parity.test.ts +14 -0
- package/integrations/jira/__tests__/write_handlers.test.ts +157 -0
- package/integrations/jira/credentials.json +39 -0
- package/integrations/jira/credentials_hint.md +4 -0
- package/integrations/jira/credentials_hint_api_token.md +6 -0
- package/integrations/jira/credentials_hint_oauth_token.md +6 -0
- package/integrations/jira/handlers/add_comment.js +9 -0
- package/integrations/jira/handlers/assign_issue.js +11 -0
- package/integrations/jira/handlers/create_issue.js +37 -0
- package/integrations/jira/handlers/create_sprint.js +19 -0
- package/integrations/jira/handlers/delete_issue.js +10 -0
- package/integrations/jira/handlers/get_backlog_issues.js +13 -0
- package/integrations/jira/handlers/get_board.js +6 -0
- package/integrations/jira/handlers/get_issue.js +63 -0
- package/integrations/jira/handlers/get_issue_comments.js +31 -0
- package/integrations/jira/handlers/get_myself.js +14 -0
- package/integrations/jira/handlers/get_project.js +28 -0
- package/integrations/jira/handlers/get_sprint.js +5 -0
- package/integrations/jira/handlers/get_sprint_issues.js +13 -0
- package/integrations/jira/handlers/get_transitions.js +23 -0
- package/integrations/jira/handlers/list_boards.js +34 -0
- package/integrations/jira/handlers/list_projects.js +29 -0
- package/integrations/jira/handlers/list_sprints.js +29 -0
- package/integrations/jira/handlers/move_issues_to_sprint.js +11 -0
- package/integrations/jira/handlers/search_issues.js +43 -0
- package/integrations/jira/handlers/search_users.js +21 -0
- package/integrations/jira/handlers/transition_issue.js +44 -0
- package/integrations/jira/handlers/update_issue.js +40 -0
- package/integrations/jira/handlers/update_sprint.js +20 -0
- package/integrations/jira/manifest.json +204 -0
- package/integrations/jira/prompt.md +80 -0
- package/integrations/jira/schemas/add_comment.json +16 -0
- package/integrations/jira/schemas/assign_issue.json +16 -0
- package/integrations/jira/schemas/create_issue.json +49 -0
- package/integrations/jira/schemas/create_sprint.json +29 -0
- package/integrations/jira/schemas/delete_issue.json +12 -0
- package/integrations/jira/schemas/empty.json +6 -0
- package/integrations/jira/schemas/get_backlog_issues.json +33 -0
- package/integrations/jira/schemas/get_board.json +13 -0
- package/integrations/jira/schemas/get_issue.json +23 -0
- package/integrations/jira/schemas/get_issue_comments.json +23 -0
- package/integrations/jira/schemas/get_project.json +17 -0
- package/integrations/jira/schemas/get_sprint.json +13 -0
- package/integrations/jira/schemas/get_sprint_issues.json +33 -0
- package/integrations/jira/schemas/get_transitions.json +12 -0
- package/integrations/jira/schemas/list_boards.json +27 -0
- package/integrations/jira/schemas/list_projects.json +22 -0
- package/integrations/jira/schemas/list_sprints.json +29 -0
- package/integrations/jira/schemas/move_issues_to_sprint.json +19 -0
- package/integrations/jira/schemas/search_issues.json +28 -0
- package/integrations/jira/schemas/search_users.json +18 -0
- package/integrations/jira/schemas/transition_issue.json +38 -0
- package/integrations/jira/schemas/update_issue.json +47 -0
- package/integrations/jira/schemas/update_sprint.json +33 -0
- package/integrations/new_integration_prompt.md +177 -2
- package/integrations/notion/.env.test +10 -0
- package/integrations/notion/.env.test.example +13 -0
- package/integrations/notion/README.md +42 -0
- package/integrations/notion/manifest.json +64 -35
- package/integrations/trello/.env.test +6 -0
- package/integrations/trello/.env.test.example +9 -0
- package/integrations/trello/README.md +50 -0
- package/package.json +7 -3
- package/integrations/google-calendar/handlers/update_event.js +0 -5
- package/integrations/google-calendar/schemas/update_event.json +0 -10
- package/integrations/google-docs/handlers/get_document.js +0 -12
- package/integrations/google-docs/handlers/get_document_structured.js +0 -6
- package/integrations/google-docs/handlers/get_document_text.js +0 -17
- package/integrations/google-docs/schemas/get_document.json +0 -11
- package/integrations/google-sheet/handlers/batch_clear_values_by_data_filter.js +0 -6
- package/integrations/google-sheet/handlers/batch_get_values.js +0 -16
- package/integrations/google-sheet/handlers/batch_update_values_by_data_filter.js +0 -16
- package/integrations/google-sheet/handlers/get_developer_metadata.js +0 -6
- package/integrations/google-sheet/handlers/get_spreadsheet_by_data_filter.js +0 -10
- package/integrations/google-sheet/handlers/get_values.js +0 -14
- package/integrations/google-sheet/handlers/get_values_by_data_filter.js +0 -14
- package/integrations/google-sheet/handlers/search_developer_metadata.js +0 -7
- package/integrations/google-sheet/schemas/batch_clear_values_by_data_filter.json +0 -10
- package/integrations/google-sheet/schemas/batch_get_values.json +0 -13
- package/integrations/google-sheet/schemas/batch_update_values_by_data_filter.json +0 -25
- package/integrations/google-sheet/schemas/get_spreadsheet_by_data_filter.json +0 -11
- package/integrations/google-sheet/schemas/get_values.json +0 -13
- package/integrations/google-sheet/schemas/get_values_by_data_filter.json +0 -17
- package/integrations/google-sheet/schemas/search_developer_metadata.json +0 -14
- package/integrations/google-slides/handlers/get_presentation.js +0 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
## File and folder IDs
|
|
2
|
+
|
|
3
|
+
Drive file and folder IDs appear in the URL:
|
|
4
|
+
- Files: `https://drive.google.com/file/d/{fileId}/view`
|
|
5
|
+
- Folders: `https://drive.google.com/drive/folders/{folderId}`
|
|
6
|
+
- Google Docs: `https://docs.google.com/document/d/{documentId}/edit`
|
|
7
|
+
|
|
8
|
+
Use `search_files` or `list_files` to find IDs programmatically.
|
|
9
|
+
|
|
10
|
+
## MIME types for Google Workspace files
|
|
11
|
+
|
|
12
|
+
When creating files with `create_file`, use these MIME types:
|
|
13
|
+
|
|
14
|
+
| File type | MIME type |
|
|
15
|
+
|---|---|
|
|
16
|
+
| Google Doc | `application/vnd.google-apps.document` |
|
|
17
|
+
| Google Sheet | `application/vnd.google-apps.spreadsheet` |
|
|
18
|
+
| Google Slides | `application/vnd.google-apps.presentation` |
|
|
19
|
+
| Google Forms | `application/vnd.google-apps.form` |
|
|
20
|
+
| Google Folder | `application/vnd.google-apps.folder` |
|
|
21
|
+
|
|
22
|
+
## Drive search query syntax
|
|
23
|
+
|
|
24
|
+
The `query` parameter in `search_files` uses the Drive search syntax:
|
|
25
|
+
|
|
26
|
+
- `name contains 'budget'` — file name contains string
|
|
27
|
+
- `name = 'exact name'` — exact file name match
|
|
28
|
+
- `mimeType = 'application/pdf'` — filter by MIME type
|
|
29
|
+
- `mimeType != 'application/vnd.google-apps.folder'` — exclude folders
|
|
30
|
+
- `'folderId' in parents` — files in a specific folder
|
|
31
|
+
- `modifiedTime > '2024-01-01T00:00:00'` — modified after date (RFC3339)
|
|
32
|
+
- `trashed = true` — only trashed files
|
|
33
|
+
- `starred = true` — only starred files
|
|
34
|
+
- `sharedWithMe = true` — files shared with the user
|
|
35
|
+
|
|
36
|
+
Combine with `and`, `or`, `not`: `name contains 'report' and mimeType = 'application/pdf' and modifiedTime > '2024-01-01T00:00:00'`
|
|
37
|
+
|
|
38
|
+
## Reading file contents
|
|
39
|
+
|
|
40
|
+
1. Use `search_files` or `list_files` to find the file (note its `id` and `mimeType`)
|
|
41
|
+
2. Call `get_file_content` with `fileId` and `mimeType`
|
|
42
|
+
- For Google Workspace files, the `mimeType` triggers automatic export
|
|
43
|
+
- For text/CSV/JSON files, content is returned directly
|
|
44
|
+
|
|
45
|
+
## Export formats
|
|
46
|
+
|
|
47
|
+
Google Workspace files must be exported (they have no binary content):
|
|
48
|
+
|
|
49
|
+
| Source | Default export | Alternative exports |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| Google Docs | `text/plain` | `text/html`, `application/vnd.openxmlformats-officedocument.wordprocessingml.document`, `application/pdf` |
|
|
52
|
+
| Google Sheets | `text/csv` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`, `application/pdf` |
|
|
53
|
+
| Google Slides | `text/plain` | `application/vnd.openxmlformats-officedocument.presentationml.presentation`, `application/pdf` |
|
|
54
|
+
|
|
55
|
+
## Sharing files
|
|
56
|
+
|
|
57
|
+
- Individual user: `share_file` with `type='user'`, `role='writer'`, `emailAddress='user@example.com'`
|
|
58
|
+
- Anyone with link: `share_file` with `type='anyone'`, `role='reader'`
|
|
59
|
+
- Whole domain: `share_file` with `type='domain'`, `role='reader'`, `domain='example.com'`
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"required": ["fileId"],
|
|
5
5
|
"additionalProperties": false,
|
|
6
6
|
"properties": {
|
|
7
|
-
"fileId": { "type": "string" }
|
|
7
|
+
"fileId": { "type": "string", "description": "Drive file or folder ID. Use search_files or list_files to find file IDs." },
|
|
8
|
+
"fields": { "type": "string", "description": "Comma-separated list of fields to return. Defaults to 'id,name,mimeType,modifiedTime,createdTime,size,parents,trashed,webViewLink'. See the Drive API fields reference for all available fields." }
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": ["fileId"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"fileId": { "type": "string", "description": "Drive file ID. Use search_files or list_files to find file IDs." },
|
|
7
|
+
"mimeType": { "type": "string", "description": "The file's MIME type, obtained from get_file or search_files. Required for Google Workspace files (Docs, Sheets, Slides) to trigger automatic text export. Google Docs files start with 'application/vnd.google-apps.'." },
|
|
8
|
+
"exportMimeType": { "type": "string", "description": "Override the export format. For Google Docs: 'text/plain', 'text/html', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'. For Sheets: 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'. For Slides: 'text/plain', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'. For any: 'application/pdf'." }
|
|
9
|
+
},
|
|
10
|
+
"additionalProperties": false
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"folderId": { "type": "string", "description": "Parent folder ID to list contents of. Omit to list files across all of Drive (not scoped to a folder). Use search_files with query=\"'root' in parents\" to list only root-level files." },
|
|
6
|
+
"pageSize": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 50, "description": "Maximum results per page. Defaults to 50. Use pageToken from the response for the next page." },
|
|
7
|
+
"pageToken": { "type": "string", "description": "Page token from a previous list_files response to retrieve the next page of results." },
|
|
8
|
+
"orderBy": { "type": "string", "description": "Sort order. Examples: 'modifiedTime desc', 'name', 'createdTime desc'. Default is unspecified." },
|
|
9
|
+
"fields": { "type": "string", "description": "Override the fields returned in each file. Defaults to 'nextPageToken,files(id,name,mimeType,modifiedTime,size,parents)'." }
|
|
10
|
+
},
|
|
11
|
+
"additionalProperties": false
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"query": { "type": "string", "description": "Raw Drive query string using the Drive search syntax. Examples: \"name contains 'budget' and mimeType = 'application/vnd.google-apps.spreadsheet'\", \"modifiedTime > '2024-01-01'\", \"'folderId' in parents\". Combined with name/mimeType shorthand via AND." },
|
|
6
|
+
"name": { "type": "string", "description": "Shorthand for name-based search. Translates to \"name contains 'value'\". Combined with query and mimeType via AND." },
|
|
7
|
+
"mimeType": { "type": "string", "description": "Filter by MIME type. Common values: 'application/vnd.google-apps.document' (Docs), 'application/vnd.google-apps.spreadsheet' (Sheets), 'application/vnd.google-apps.presentation' (Slides), 'application/vnd.google-apps.folder' (folders), 'application/pdf', 'text/plain'." },
|
|
8
|
+
"includeTrashed": { "type": "boolean", "description": "Include trashed files in results. Defaults to false (trashed files excluded)." },
|
|
9
|
+
"pageSize": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 20, "description": "Maximum results per page. Defaults to 20. Use pageToken from the response for the next page." },
|
|
10
|
+
"pageToken": { "type": "string", "description": "Page token from a previous search_files response to retrieve the next page of results." },
|
|
11
|
+
"fields": { "type": "string", "description": "Override the fields returned in each file. Defaults to 'nextPageToken,files(id,name,mimeType,modifiedTime,size,parents)'." }
|
|
12
|
+
},
|
|
13
|
+
"additionalProperties": false
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": ["fileId", "role", "type"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"fileId": { "type": "string", "description": "Drive file or folder ID to share." },
|
|
7
|
+
"role": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["reader", "commenter", "writer", "organizer", "owner"],
|
|
10
|
+
"description": "Permission level. 'reader' = view only, 'commenter' = view + comment, 'writer' = edit, 'organizer' = organize in shared drives, 'owner' = full ownership transfer."
|
|
11
|
+
},
|
|
12
|
+
"type": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"enum": ["user", "group", "domain", "anyone"],
|
|
15
|
+
"description": "Grantee type. 'user' requires emailAddress, 'group' requires emailAddress, 'domain' requires domain, 'anyone' grants access to all (use role='reader' for public link)."
|
|
16
|
+
},
|
|
17
|
+
"emailAddress": { "type": "string", "description": "Email address of the user or group to share with. Required when type is 'user' or 'group'." },
|
|
18
|
+
"domain": { "type": "string", "description": "Domain to share with (e.g. 'example.com'). Required when type is 'domain'." },
|
|
19
|
+
"sendNotificationEmail": { "type": "boolean", "description": "Whether to send a notification email to the new recipient. Defaults to true. Set to false to share silently." },
|
|
20
|
+
"emailMessage": { "type": "string", "description": "Custom message to include in the notification email." }
|
|
21
|
+
},
|
|
22
|
+
"additionalProperties": false
|
|
23
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Gmail live integration tests
|
|
2
|
+
# Shared Google credentials live in /.env.test.google — set those up first.
|
|
3
|
+
#
|
|
4
|
+
# Optional seed IDs — the suite will discover them automatically if omitted
|
|
5
|
+
GMAIL_TEST_MESSAGE_ID=
|
|
6
|
+
GMAIL_TEST_THREAD_ID=
|
|
7
|
+
# Email address to use for send/reply tests (must be accessible by the credential)
|
|
8
|
+
GMAIL_TEST_SEND_TO=
|
|
9
|
+
# Optional: specific message/thread to delete in delete tests
|
|
10
|
+
GMAIL_TEST_DELETE_MESSAGE_ID=
|
|
11
|
+
GMAIL_TEST_DELETE_THREAD_ID=
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Gmail
|
|
2
|
+
|
|
3
|
+
**25 tools** across 2 toolsets
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Credential variants
|
|
8
|
+
|
|
9
|
+
| Variant | Label |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `service_account` | Service Account (recommended) _(default)_ |
|
|
12
|
+
| `oauth_token` | OAuth Access Token (short-lived) |
|
|
13
|
+
|
|
14
|
+
## Toolsets
|
|
15
|
+
|
|
16
|
+
| Toolset | Description |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `email` | Search, read, compose, and send emails and drafts |
|
|
19
|
+
| `organize` | Label, archive, trash, and delete messages and threads |
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
| Tool | Scope | Toolset | Description |
|
|
24
|
+
|---|---|---|---|
|
|
25
|
+
| `get_profile` | read | `email` | Get mailbox profile details for the authenticated user, including email address, messages… |
|
|
26
|
+
| `list_messages` | read | `email` | List message IDs matching a Gmail search query or label filters. Returns only IDs and thr… |
|
|
27
|
+
| `read_email` | read | `email` | Read an email by message ID and return a flat, decoded result with subject, from, to, cc,… |
|
|
28
|
+
| `get_message` | read | `email` | Get the raw Gmail message resource by message ID. Returns the full nested payload includi… |
|
|
29
|
+
| `list_threads` | read | `email` | List thread IDs matching a Gmail search query or label filters. Similar to list_messages … |
|
|
30
|
+
| `get_thread` | read | `email` | Get a full thread resource by thread ID, including all messages in the conversation. Use … |
|
|
31
|
+
| `list_drafts` | read | `email` | List drafts in the mailbox. Returns draft IDs and the nested message ID. Use get_draft to… |
|
|
32
|
+
| `get_draft` | read | `email` | Get a draft by draft ID. Returns the draft object including the nested message resource. … |
|
|
33
|
+
| `send_email` | write | `email` | Send an email by providing flat fields: to, subject, and body. Handles MIME encoding and … |
|
|
34
|
+
| `create_draft_email` | write | `email` | Create a draft email using flat fields: subject, body, and optionally to, cc, bcc. Handle… |
|
|
35
|
+
| `delete_draft` | write | `email` | Permanently delete a draft by its draft ID. Use list_drafts to find draft IDs. This canno… |
|
|
36
|
+
| `send_draft` | write | `email` | Send an existing draft by draft ID, or send a one-off draft payload (provide raw instead … |
|
|
37
|
+
| `list_labels` | read | `organize` | List all labels in the user's mailbox, including system labels (INBOX, SENT, DRAFT, SPAM,… |
|
|
38
|
+
| `get_label` | read | `organize` | Get details for a specific label by its label ID. Returns name, type, visibility settings… |
|
|
39
|
+
| `modify_message` | write | `organize` | Add or remove labels on a single message. Provide addLabelIds, removeLabelIds, or both. C… |
|
|
40
|
+
| `trash_message` | write | `organize` | Move a message to the Trash. The message is not permanently deleted and can be restored w… |
|
|
41
|
+
| `untrash_message` | write | `organize` | Restore a message from Trash back to the Inbox. Use list_messages with labelIds=['TRASH']… |
|
|
42
|
+
| `delete_message` | write | `organize` | Permanently and immediately delete a message by ID. This cannot be undone. For recoverabl… |
|
|
43
|
+
| `modify_thread` | write | `organize` | Add or remove labels on all messages in a thread at once. Provide addLabelIds, removeLabe… |
|
|
44
|
+
| `trash_thread` | write | `organize` | Move an entire thread to Trash. All messages in the thread are trashed. Can be reversed w… |
|
|
45
|
+
| `untrash_thread` | write | `organize` | Restore an entire thread from Trash. Use list_threads with labelIds=['TRASH'] to find tra… |
|
|
46
|
+
| `delete_thread` | write | `organize` | Permanently and immediately delete an entire thread and all its messages. This cannot be … |
|
|
47
|
+
| `create_label` | admin | `organize` | Create a new mailbox label with optional visibility and color settings. Label names must … |
|
|
48
|
+
| `update_label` | admin | `organize` | Update (patch) an existing mailbox label's name, color, or visibility settings by label I… |
|
|
49
|
+
| `delete_label` | admin | `organize` | Permanently delete a mailbox label by label ID. Messages with this label will have it rem… |
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
|
2
|
+
import { createCredentialStore, createIntegrationNode, createProxy, createToolbox, safeCleanup } from '../../__tests__/liveHarness.js'
|
|
3
|
+
|
|
4
|
+
const env = process.env as Record<string, string | undefined>
|
|
5
|
+
|
|
6
|
+
interface VariantConfig {
|
|
7
|
+
key: string
|
|
8
|
+
credentials: () => Record<string, string>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const variants: VariantConfig[] = [
|
|
12
|
+
{
|
|
13
|
+
key: 'service_account',
|
|
14
|
+
credentials: () => ({ serviceAccountJson: env.GOOGLE_SERVICE_ACCOUNT_JSON || '', subject: env.GOOGLE_IMPERSONATE_SUBJECT || '' }),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'oauth_token',
|
|
18
|
+
credentials: () => ({ token: env.GOOGLE_TOKEN || '' }),
|
|
19
|
+
},
|
|
20
|
+
].filter(v => Object.values(v.credentials()).some(val => val.trim().length > 0))
|
|
21
|
+
|
|
22
|
+
const suiteOrSkip = variants.length > 0 ? describe : describe.skip
|
|
23
|
+
|
|
24
|
+
suiteOrSkip('google-gmail read handlers (live)', () => {
|
|
25
|
+
for (const variant of variants) {
|
|
26
|
+
describe(`variant: ${variant.key}`, () => {
|
|
27
|
+
const ctx: { email?: string, labelId?: string, messageId?: string, threadId?: string, draftId?: string } = {}
|
|
28
|
+
let gmail: ReturnType<typeof createToolbox>
|
|
29
|
+
|
|
30
|
+
beforeAll(async () => {
|
|
31
|
+
const credentialStore = createCredentialStore(async () => variant.credentials())
|
|
32
|
+
const proxy = createProxy(credentialStore)
|
|
33
|
+
gmail = createToolbox(
|
|
34
|
+
'google-gmail',
|
|
35
|
+
proxy,
|
|
36
|
+
createIntegrationNode('google-gmail', { label: 'Google Gmail', credentialId: 'google-gmail-creds', credentialVariant: variant.key }),
|
|
37
|
+
variant.key,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
const profile = await gmail.read('get_profile')({})
|
|
41
|
+
ctx.email = profile?.emailAddress
|
|
42
|
+
|
|
43
|
+
const labels = await gmail.read('list_labels')({})
|
|
44
|
+
ctx.labelId = labels?.labels?.[0]?.id
|
|
45
|
+
|
|
46
|
+
const listedMessages = await gmail.read('list_messages')({ maxResults: 5 })
|
|
47
|
+
ctx.messageId = listedMessages?.messages?.[0]?.id
|
|
48
|
+
if (ctx.messageId) {
|
|
49
|
+
const msg = await gmail.read('get_message')({ messageId: ctx.messageId, format: 'minimal' })
|
|
50
|
+
ctx.threadId = msg?.threadId
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (ctx.email) {
|
|
54
|
+
const draft = await gmail.write('create_draft_email')({
|
|
55
|
+
to: ctx.email,
|
|
56
|
+
subject: `CmdTest Gmail Draft ${Date.now()}`,
|
|
57
|
+
body: 'Draft created by integration live tests.',
|
|
58
|
+
})
|
|
59
|
+
ctx.draftId = draft?.id
|
|
60
|
+
}
|
|
61
|
+
}, 60000)
|
|
62
|
+
|
|
63
|
+
afterAll(async () => {
|
|
64
|
+
await safeCleanup(async () => ctx.draftId ? gmail.write('delete_draft')({ draftId: ctx.draftId }) : Promise.resolve())
|
|
65
|
+
}, 30000)
|
|
66
|
+
|
|
67
|
+
it('get_profile returns mailbox profile', async () => {
|
|
68
|
+
const result = await gmail.read('get_profile')({})
|
|
69
|
+
expect(result?.emailAddress || result?.messagesTotal !== undefined).toBeTruthy()
|
|
70
|
+
}, 30000)
|
|
71
|
+
|
|
72
|
+
it('list_labels returns labels', async () => {
|
|
73
|
+
const result = await gmail.read('list_labels')({})
|
|
74
|
+
expect(Array.isArray(result?.labels)).toBe(true)
|
|
75
|
+
}, 30000)
|
|
76
|
+
|
|
77
|
+
it('get_label returns a label when available', async () => {
|
|
78
|
+
if (!ctx.labelId)
|
|
79
|
+
return expect(true).toBe(true)
|
|
80
|
+
const result = await gmail.read('get_label')({ labelId: ctx.labelId })
|
|
81
|
+
expect(result?.id).toBe(ctx.labelId)
|
|
82
|
+
}, 30000)
|
|
83
|
+
|
|
84
|
+
it('list_messages returns messages list', async () => {
|
|
85
|
+
const result = await gmail.read('list_messages')({ maxResults: 10 })
|
|
86
|
+
expect(result?.resultSizeEstimate !== undefined || Array.isArray(result?.messages)).toBe(true)
|
|
87
|
+
}, 30000)
|
|
88
|
+
|
|
89
|
+
it('get_message returns a message when available', async () => {
|
|
90
|
+
if (!ctx.messageId)
|
|
91
|
+
return expect(true).toBe(true)
|
|
92
|
+
const result = await gmail.read('get_message')({ messageId: ctx.messageId, format: 'full' })
|
|
93
|
+
expect(result?.id).toBe(ctx.messageId)
|
|
94
|
+
}, 30000)
|
|
95
|
+
|
|
96
|
+
it('list_threads returns threads list', async () => {
|
|
97
|
+
const result = await gmail.read('list_threads')({ maxResults: 10 })
|
|
98
|
+
expect(result?.resultSizeEstimate !== undefined || Array.isArray(result?.threads)).toBe(true)
|
|
99
|
+
}, 30000)
|
|
100
|
+
|
|
101
|
+
it('get_thread returns a thread when available', async () => {
|
|
102
|
+
if (!ctx.threadId)
|
|
103
|
+
return expect(true).toBe(true)
|
|
104
|
+
const result = await gmail.read('get_thread')({ threadId: ctx.threadId, format: 'full' })
|
|
105
|
+
expect(result?.id).toBe(ctx.threadId)
|
|
106
|
+
}, 30000)
|
|
107
|
+
|
|
108
|
+
it('list_drafts returns drafts list', async () => {
|
|
109
|
+
const result = await gmail.read('list_drafts')({ maxResults: 10 })
|
|
110
|
+
expect(result?.resultSizeEstimate !== undefined || Array.isArray(result?.drafts)).toBe(true)
|
|
111
|
+
}, 30000)
|
|
112
|
+
|
|
113
|
+
it('get_draft returns draft details when available', async () => {
|
|
114
|
+
if (!ctx.draftId)
|
|
115
|
+
return expect(true).toBe(true)
|
|
116
|
+
const result = await gmail.read('get_draft')({ draftId: ctx.draftId })
|
|
117
|
+
expect(result?.id).toBe(ctx.draftId)
|
|
118
|
+
}, 30000)
|
|
119
|
+
|
|
120
|
+
it('read_email returns flat decoded message when a message is available', async () => {
|
|
121
|
+
if (!ctx.messageId)
|
|
122
|
+
return expect(true).toBe(true)
|
|
123
|
+
const result = await gmail.read('read_email')({ messageId: ctx.messageId })
|
|
124
|
+
expect(result?.id).toBe(ctx.messageId)
|
|
125
|
+
expect(typeof result?.subject).toBe('string')
|
|
126
|
+
expect(typeof result?.from).toBe('string')
|
|
127
|
+
expect(typeof result?.date).toBe('string')
|
|
128
|
+
expect(typeof result?.snippet).toBe('string')
|
|
129
|
+
expect(typeof result?.body).toBe('string')
|
|
130
|
+
expect(Array.isArray(result?.labelIds)).toBe(true)
|
|
131
|
+
}, 30000)
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { getMissingToolUsages } from '../../__tests__/usageParity.js'
|
|
3
|
+
|
|
4
|
+
describe('google-gmail static usage parity', () => {
|
|
5
|
+
it('every manifest tool is referenced in tests', () => {
|
|
6
|
+
const missing = getMissingToolUsages({ integrationName: 'google-gmail', importMetaUrl: import.meta.url })
|
|
7
|
+
expect(missing, `Missing handler usages in tests: ${missing.join(', ')}`).toEqual([])
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Buffer } from 'node:buffer'
|
|
2
|
+
import { beforeAll, describe, expect, it } from 'vitest'
|
|
3
|
+
import { createCredentialStore, createIntegrationNode, createProxy, createToolbox, safeCleanup } from '../../__tests__/liveHarness.js'
|
|
4
|
+
|
|
5
|
+
const env = process.env as Record<string, string | undefined>
|
|
6
|
+
|
|
7
|
+
interface VariantConfig {
|
|
8
|
+
key: string
|
|
9
|
+
credentials: () => Record<string, string>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const variants: VariantConfig[] = [
|
|
13
|
+
{
|
|
14
|
+
key: 'service_account',
|
|
15
|
+
credentials: () => ({ serviceAccountJson: env.GOOGLE_SERVICE_ACCOUNT_JSON || '', subject: env.GOOGLE_IMPERSONATE_SUBJECT || '' }),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
key: 'oauth_token',
|
|
19
|
+
credentials: () => ({ token: env.GOOGLE_TOKEN || '' }),
|
|
20
|
+
},
|
|
21
|
+
].filter(v => Object.values(v.credentials()).some(val => val.trim().length > 0))
|
|
22
|
+
|
|
23
|
+
const suiteOrSkip = variants.length > 0 ? describe : describe.skip
|
|
24
|
+
|
|
25
|
+
function makeRawMessage(toEmail: string, subject: string, text: string): string {
|
|
26
|
+
const mime = [
|
|
27
|
+
`To: ${toEmail}`,
|
|
28
|
+
`Subject: ${subject}`,
|
|
29
|
+
'MIME-Version: 1.0',
|
|
30
|
+
'Content-Type: text/plain; charset=UTF-8',
|
|
31
|
+
'',
|
|
32
|
+
text,
|
|
33
|
+
].join('\r\n')
|
|
34
|
+
return Buffer.from(mime, 'utf8').toString('base64url')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
suiteOrSkip('google-gmail write/admin handlers (live)', () => {
|
|
38
|
+
for (const variant of variants) {
|
|
39
|
+
describe(`variant: ${variant.key}`, () => {
|
|
40
|
+
const ctx: { email?: string, inboxLabelId?: string, messageId?: string, threadId?: string } = {}
|
|
41
|
+
let gmail: ReturnType<typeof createToolbox>
|
|
42
|
+
|
|
43
|
+
beforeAll(async () => {
|
|
44
|
+
const credentialStore = createCredentialStore(async () => variant.credentials())
|
|
45
|
+
const proxy = createProxy(credentialStore)
|
|
46
|
+
gmail = createToolbox(
|
|
47
|
+
'google-gmail',
|
|
48
|
+
proxy,
|
|
49
|
+
createIntegrationNode('google-gmail', { label: 'Google Gmail', credentialId: 'google-gmail-creds', credentialVariant: variant.key }),
|
|
50
|
+
variant.key,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const profile = await gmail.read('get_profile')({})
|
|
54
|
+
ctx.email = profile?.emailAddress
|
|
55
|
+
|
|
56
|
+
const labels = await gmail.read('list_labels')({})
|
|
57
|
+
ctx.inboxLabelId = labels?.labels?.find((l: any) => l?.name === 'INBOX')?.id || labels?.labels?.[0]?.id
|
|
58
|
+
|
|
59
|
+
const listedMessages = await gmail.read('list_messages')({ maxResults: 5 })
|
|
60
|
+
ctx.messageId = env.GMAIL_TEST_MESSAGE_ID || listedMessages?.messages?.[0]?.id
|
|
61
|
+
if (ctx.messageId) {
|
|
62
|
+
const msg = await gmail.read('get_message')({ messageId: ctx.messageId, format: 'minimal' })
|
|
63
|
+
ctx.threadId = env.GMAIL_TEST_THREAD_ID || msg?.threadId
|
|
64
|
+
}
|
|
65
|
+
}, 60000)
|
|
66
|
+
|
|
67
|
+
it('create_draft_email -> get_draft -> delete_draft', async () => {
|
|
68
|
+
if (!ctx.email)
|
|
69
|
+
return expect(true).toBe(true)
|
|
70
|
+
const created = await gmail.write('create_draft_email')({
|
|
71
|
+
to: ctx.email,
|
|
72
|
+
subject: `CmdTest Gmail Draft ${Date.now()}`,
|
|
73
|
+
body: 'Draft created by write tests.',
|
|
74
|
+
})
|
|
75
|
+
const draftId = created?.id
|
|
76
|
+
expect(draftId).toBeTruthy()
|
|
77
|
+
const got = await gmail.read('get_draft')({ draftId })
|
|
78
|
+
expect(got?.id).toBe(draftId)
|
|
79
|
+
const deleted = await gmail.write('delete_draft')({ draftId })
|
|
80
|
+
expect(deleted?.success === true || deleted === '').toBe(true)
|
|
81
|
+
}, 60000)
|
|
82
|
+
|
|
83
|
+
it('modify_message -> trash_message -> untrash_message on an existing message', async () => {
|
|
84
|
+
// Create a fresh draft so we own the message — avoids stale/trashed inbox IDs
|
|
85
|
+
const draft = await gmail.write('create_draft_email')({
|
|
86
|
+
to: ctx.email || 'noreply@example.com',
|
|
87
|
+
subject: `CmdTest Trash ${Date.now()}`,
|
|
88
|
+
body: 'Temporary message for trash/untrash test.',
|
|
89
|
+
})
|
|
90
|
+
const messageId = draft?.message?.id
|
|
91
|
+
const draftId = draft?.id
|
|
92
|
+
expect(messageId).toBeTruthy()
|
|
93
|
+
try {
|
|
94
|
+
const modified = await gmail.write('modify_message')({
|
|
95
|
+
messageId,
|
|
96
|
+
addLabelIds: ctx.inboxLabelId ? [ctx.inboxLabelId] : undefined,
|
|
97
|
+
})
|
|
98
|
+
expect(modified?.id).toBe(messageId)
|
|
99
|
+
const trashed = await gmail.write('trash_message')({ messageId })
|
|
100
|
+
expect(trashed?.id).toBe(messageId)
|
|
101
|
+
const untrashed = await gmail.write('untrash_message')({ messageId })
|
|
102
|
+
expect(untrashed?.id).toBe(messageId)
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
await safeCleanup(async () => draftId ? gmail.write('delete_draft')({ draftId }) : Promise.resolve())
|
|
106
|
+
}
|
|
107
|
+
}, 60000)
|
|
108
|
+
|
|
109
|
+
it('modify_thread -> trash_thread -> untrash_thread on an existing thread', async () => {
|
|
110
|
+
// Create a fresh draft so we own the thread — avoids stale inbox IDs
|
|
111
|
+
const draft = await gmail.write('create_draft_email')({
|
|
112
|
+
to: ctx.email || 'noreply@example.com',
|
|
113
|
+
subject: `CmdTest Thread Trash ${Date.now()}`,
|
|
114
|
+
body: 'Temporary message for thread trash/untrash test.',
|
|
115
|
+
})
|
|
116
|
+
const threadId = draft?.message?.threadId
|
|
117
|
+
const draftId = draft?.id
|
|
118
|
+
expect(threadId).toBeTruthy()
|
|
119
|
+
try {
|
|
120
|
+
const modified = await gmail.write('modify_thread')({
|
|
121
|
+
threadId,
|
|
122
|
+
addLabelIds: ctx.inboxLabelId ? [ctx.inboxLabelId] : undefined,
|
|
123
|
+
})
|
|
124
|
+
expect(modified?.id).toBe(threadId)
|
|
125
|
+
const trashed = await gmail.write('trash_thread')({ threadId })
|
|
126
|
+
expect(trashed?.id).toBe(threadId)
|
|
127
|
+
const untrashed = await gmail.write('untrash_thread')({ threadId })
|
|
128
|
+
expect(untrashed?.id).toBe(threadId)
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
await safeCleanup(async () => draftId ? gmail.write('delete_draft')({ draftId }) : Promise.resolve())
|
|
132
|
+
}
|
|
133
|
+
}, 60000)
|
|
134
|
+
|
|
135
|
+
it('create_label -> update_label -> delete_label', async () => {
|
|
136
|
+
const created = await gmail.admin('create_label')({
|
|
137
|
+
name: `CmdTest Label ${Date.now()}`,
|
|
138
|
+
labelListVisibility: 'labelShow',
|
|
139
|
+
messageListVisibility: 'show',
|
|
140
|
+
})
|
|
141
|
+
const labelId = created?.id
|
|
142
|
+
expect(labelId).toBeTruthy()
|
|
143
|
+
const updated = await gmail.admin('update_label')({
|
|
144
|
+
labelId,
|
|
145
|
+
name: `CmdTest Label Updated ${Date.now()}`,
|
|
146
|
+
labelListVisibility: 'labelHide',
|
|
147
|
+
})
|
|
148
|
+
expect(updated?.id).toBe(labelId)
|
|
149
|
+
const deleted = await gmail.admin('delete_label')({ labelId })
|
|
150
|
+
expect(deleted?.success === true || deleted === '').toBe(true)
|
|
151
|
+
}, 60000)
|
|
152
|
+
|
|
153
|
+
it('send_email sends mail when GMAIL_TEST_SEND_TO is set', async () => {
|
|
154
|
+
const to = env.GMAIL_TEST_SEND_TO
|
|
155
|
+
if (!to)
|
|
156
|
+
return expect(true).toBe(true)
|
|
157
|
+
const sent = await gmail.write('send_email')({
|
|
158
|
+
to,
|
|
159
|
+
subject: `CmdTest Gmail send_email ${Date.now()}`,
|
|
160
|
+
body: 'Message sent by integration live test via send_email.',
|
|
161
|
+
})
|
|
162
|
+
expect(sent?.id).toBeTruthy()
|
|
163
|
+
}, 60000)
|
|
164
|
+
|
|
165
|
+
it('send_draft sends mail when GMAIL_TEST_SEND_TO is set', async () => {
|
|
166
|
+
const to = env.GMAIL_TEST_SEND_TO
|
|
167
|
+
if (!to)
|
|
168
|
+
return expect(true).toBe(true)
|
|
169
|
+
const created = await gmail.write('create_draft_email')({
|
|
170
|
+
to,
|
|
171
|
+
subject: `CmdTest Gmail send_draft ${Date.now()}`,
|
|
172
|
+
body: 'Draft sent by integration live test.',
|
|
173
|
+
})
|
|
174
|
+
const draftId = created?.id
|
|
175
|
+
expect(draftId).toBeTruthy()
|
|
176
|
+
const sent = await gmail.write('send_draft')({ draftId })
|
|
177
|
+
expect(sent?.id || sent?.threadId).toBeTruthy()
|
|
178
|
+
}, 60000)
|
|
179
|
+
|
|
180
|
+
it('delete_message deletes message when GMAIL_TEST_DELETE_MESSAGE_ID is set', async () => {
|
|
181
|
+
const deleteMessageId = env.GMAIL_TEST_DELETE_MESSAGE_ID
|
|
182
|
+
if (!deleteMessageId)
|
|
183
|
+
return expect(true).toBe(true)
|
|
184
|
+
const deleted = await gmail.write('delete_message')({ messageId: deleteMessageId })
|
|
185
|
+
expect(deleted?.success === true || deleted === '').toBe(true)
|
|
186
|
+
}, 60000)
|
|
187
|
+
|
|
188
|
+
it('delete_thread deletes thread when GMAIL_TEST_DELETE_THREAD_ID is set', async () => {
|
|
189
|
+
const deleteThreadId = env.GMAIL_TEST_DELETE_THREAD_ID
|
|
190
|
+
if (!deleteThreadId)
|
|
191
|
+
return expect(true).toBe(true)
|
|
192
|
+
const deleted = await gmail.write('delete_thread')({ threadId: deleteThreadId })
|
|
193
|
+
expect(deleted?.success === true || deleted === '').toBe(true)
|
|
194
|
+
}, 60000)
|
|
195
|
+
|
|
196
|
+
it('send_draft supports raw payload mode', async () => {
|
|
197
|
+
const to = env.GMAIL_TEST_SEND_TO
|
|
198
|
+
if (!to)
|
|
199
|
+
return expect(true).toBe(true)
|
|
200
|
+
const raw = makeRawMessage(to, `CmdTest Gmail send_draft raw ${Date.now()}`, 'Raw payload draft-send mode.')
|
|
201
|
+
const sent = await gmail.write('send_draft')({ raw })
|
|
202
|
+
expect(sent?.id || sent?.threadId).toBeTruthy()
|
|
203
|
+
}, 60000)
|
|
204
|
+
|
|
205
|
+
it('cleanup helper remains available for optional future cleanup', async () => {
|
|
206
|
+
await safeCleanup(async () => Promise.resolve())
|
|
207
|
+
expect(true).toBe(true)
|
|
208
|
+
})
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"variants": {
|
|
3
|
+
"service_account": {
|
|
4
|
+
"label": "Service Account (recommended)",
|
|
5
|
+
"schema": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"serviceAccountJson": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "Service Account JSON",
|
|
11
|
+
"description": "Full service account key JSON (contents of the downloaded JSON file from Google Cloud)."
|
|
12
|
+
},
|
|
13
|
+
"subject": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"title": "Subject / impersonated user (optional)",
|
|
16
|
+
"description": "User email to impersonate via Google Workspace domain-wide delegation. Usually required for mailbox access."
|
|
17
|
+
},
|
|
18
|
+
"scopes": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"title": "OAuth scopes (optional)",
|
|
21
|
+
"description": "Optional override for OAuth scopes. Defaults to full Gmail access.",
|
|
22
|
+
"items": { "type": "string" }
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": ["serviceAccountJson"],
|
|
26
|
+
"additionalProperties": false
|
|
27
|
+
},
|
|
28
|
+
"injection": {
|
|
29
|
+
"headers": {
|
|
30
|
+
"Authorization": "Bearer {{token}}"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"preprocess": "google_service_account"
|
|
34
|
+
},
|
|
35
|
+
"oauth_token": {
|
|
36
|
+
"label": "OAuth Access Token (short-lived)",
|
|
37
|
+
"schema": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"token": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"title": "OAuth Access Token",
|
|
43
|
+
"description": "Short-lived Google OAuth access token with Gmail scopes."
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"required": ["token"],
|
|
47
|
+
"additionalProperties": false
|
|
48
|
+
},
|
|
49
|
+
"injection": {
|
|
50
|
+
"headers": {
|
|
51
|
+
"Authorization": "Bearer {{token}}"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"default": "service_account"
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Obtain a short-lived Google OAuth access token:
|
|
2
|
+
|
|
3
|
+
1. Use the Google OAuth 2.0 Playground (`https://developers.google.com/oauthplayground/`) or your own OAuth flow
|
|
4
|
+
2. Select scopes such as `https://www.googleapis.com/auth/gmail.modify` (and `https://www.googleapis.com/auth/gmail.send` if sending mail)
|
|
5
|
+
3. Exchange the authorization code for an access token
|
|
6
|
+
4. Paste the access token here
|
|
7
|
+
|
|
8
|
+
Note: OAuth access tokens are short-lived (typically 1 hour). For long-running automation, prefer the Service Account variant with Workspace delegation.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Set up a Google Cloud Service Account:
|
|
2
|
+
|
|
3
|
+
1. Open the [Google Cloud Console](https://console.cloud.google.com/)
|
|
4
|
+
2. Enable the **Gmail API** for your project
|
|
5
|
+
3. Go to **IAM & Admin -> Service Accounts** and create a new service account
|
|
6
|
+
4. Under **Keys**, click **Add Key -> Create new key -> JSON** and download the file
|
|
7
|
+
5. Paste the full contents of the JSON file here
|
|
8
|
+
6. For Google Workspace mailboxes, configure domain-wide delegation and set `subject` to the target user's email
|
|
9
|
+
|
|
10
|
+
For personal Gmail accounts, use the OAuth token variant instead.
|