veryfront 0.0.49 → 0.0.51
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/ai/components.js +260 -56
- package/dist/ai/components.js.map +4 -4
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.js +12 -4
- package/dist/ai/index.js.map +2 -2
- package/dist/ai/primitives.js +55 -10
- package/dist/ai/primitives.js.map +3 -3
- package/dist/ai/react.js +140 -1
- package/dist/ai/react.js.map +3 -3
- package/dist/ai/workflow-react.js +458 -0
- package/dist/ai/workflow-react.js.map +7 -0
- package/dist/ai/workflow.js +5422 -0
- package/dist/ai/workflow.js.map +7 -0
- package/dist/cli.js +957 -215
- package/dist/components.js +12 -4
- package/dist/components.js.map +2 -2
- package/dist/config.js +12 -4
- package/dist/config.js.map +2 -2
- package/dist/data.js +12 -4
- package/dist/data.js.map +2 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +2 -2
- package/dist/integrations/_base/files/SETUP.md +667 -98
- package/dist/integrations/_base/files/app/api/integrations/status/route.ts +3 -3
- package/dist/integrations/_base/files/app/api/integrations/token-storage/route.ts +26 -0
- package/dist/integrations/_base/files/app/components/ServiceConnections.tsx +2 -1
- package/dist/integrations/_base/files/app/setup/page.tsx +869 -55
- package/dist/integrations/_base/files/lib/token-store-examples.ts +435 -0
- package/dist/integrations/_base/files/lib/token-store.ts +273 -23
- package/dist/integrations/airtable/connector.json +99 -0
- package/dist/integrations/airtable/files/ai/tools/create-record.ts +25 -0
- package/dist/integrations/airtable/files/ai/tools/get-base.ts +34 -0
- package/dist/integrations/airtable/files/ai/tools/get-record.ts +23 -0
- package/dist/integrations/airtable/files/ai/tools/list-bases.ts +19 -0
- package/dist/integrations/airtable/files/ai/tools/list-records.ts +47 -0
- package/dist/integrations/airtable/files/app/api/auth/airtable/callback/route.ts +11 -0
- package/dist/integrations/airtable/files/app/api/auth/airtable/route.ts +9 -0
- package/dist/integrations/airtable/files/lib/airtable-client.ts +244 -0
- package/dist/integrations/anthropic/README.md +181 -0
- package/dist/integrations/anthropic/connector.json +88 -0
- package/dist/integrations/anthropic/files/_env.example +4 -0
- package/dist/integrations/anthropic/files/ai/tools/get-organization.ts +36 -0
- package/dist/integrations/anthropic/files/ai/tools/get-usage.ts +100 -0
- package/dist/integrations/anthropic/files/ai/tools/list-api-keys.ts +64 -0
- package/dist/integrations/anthropic/files/ai/tools/list-members.ts +65 -0
- package/dist/integrations/anthropic/files/ai/tools/list-workspaces.ts +35 -0
- package/dist/integrations/anthropic/files/lib/anthropic-admin-client.ts +264 -0
- package/dist/integrations/asana/connector.json +85 -0
- package/dist/integrations/asana/files/_env.example +4 -0
- package/dist/integrations/asana/files/ai/tools/create-task.ts +34 -0
- package/dist/integrations/asana/files/ai/tools/get-task.ts +26 -0
- package/dist/integrations/asana/files/ai/tools/list-projects.ts +26 -0
- package/dist/integrations/asana/files/ai/tools/list-tasks.ts +50 -0
- package/dist/integrations/asana/files/ai/tools/update-task.ts +36 -0
- package/dist/integrations/asana/files/app/api/auth/asana/callback/route.ts +11 -0
- package/dist/integrations/asana/files/app/api/auth/asana/route.ts +7 -0
- package/dist/integrations/asana/files/lib/asana-client.ts +162 -0
- package/dist/integrations/aws/connector.json +72 -0
- package/dist/integrations/aws/files/_env.example +10 -0
- package/dist/integrations/aws/files/ai/tools/get-s3-object.ts +62 -0
- package/dist/integrations/aws/files/ai/tools/list-ec2-instances.ts +56 -0
- package/dist/integrations/aws/files/ai/tools/list-lambda-functions.ts +57 -0
- package/dist/integrations/aws/files/ai/tools/list-s3-buckets.ts +44 -0
- package/dist/integrations/aws/files/ai/tools/list-s3-objects.ts +58 -0
- package/dist/integrations/aws/files/lib/aws-client.ts +255 -0
- package/dist/integrations/bitbucket/connector.json +85 -0
- package/dist/integrations/bitbucket/files/_env.example +9 -0
- package/dist/integrations/bitbucket/files/ai/tools/create-pull-request.ts +83 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-issues.ts +112 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-pull-requests.ts +91 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-repositories.ts +78 -0
- package/dist/integrations/bitbucket/files/app/api/auth/bitbucket/callback/route.ts +11 -0
- package/dist/integrations/bitbucket/files/app/api/auth/bitbucket/route.ts +9 -0
- package/dist/integrations/bitbucket/files/lib/bitbucket-client.ts +316 -0
- package/dist/integrations/box/connector.json +85 -0
- package/dist/integrations/box/files/_env.example +4 -0
- package/dist/integrations/box/files/ai/tools/create-folder.ts +28 -0
- package/dist/integrations/box/files/ai/tools/get-file.ts +29 -0
- package/dist/integrations/box/files/ai/tools/list-files.ts +33 -0
- package/dist/integrations/box/files/ai/tools/search-files.ts +35 -0
- package/dist/integrations/box/files/ai/tools/upload-file.ts +32 -0
- package/dist/integrations/box/files/app/api/auth/box/callback/route.ts +11 -0
- package/dist/integrations/box/files/app/api/auth/box/route.ts +7 -0
- package/dist/integrations/box/files/lib/box-client.ts +280 -0
- package/dist/integrations/calendar/files/app/api/auth/calendar/callback/route.ts +7 -110
- package/dist/integrations/calendar/files/app/api/auth/calendar/route.ts +5 -25
- package/dist/integrations/clickup/connector.json +85 -0
- package/dist/integrations/clickup/files/_env.example +4 -0
- package/dist/integrations/clickup/files/ai/tools/create-task.ts +64 -0
- package/dist/integrations/clickup/files/ai/tools/get-task.ts +59 -0
- package/dist/integrations/clickup/files/ai/tools/list-lists.ts +109 -0
- package/dist/integrations/clickup/files/ai/tools/list-tasks.ts +95 -0
- package/dist/integrations/clickup/files/ai/tools/update-task.ts +85 -0
- package/dist/integrations/clickup/files/app/api/auth/clickup/callback/route.ts +11 -0
- package/dist/integrations/clickup/files/app/api/auth/clickup/route.ts +7 -0
- package/dist/integrations/clickup/files/lib/clickup-client.ts +439 -0
- package/dist/integrations/confluence/README.md +246 -0
- package/dist/integrations/confluence/connector.json +104 -0
- package/dist/integrations/confluence/files/_env.example +4 -0
- package/dist/integrations/confluence/files/ai/tools/create-page.ts +43 -0
- package/dist/integrations/confluence/files/ai/tools/get-page.ts +30 -0
- package/dist/integrations/confluence/files/ai/tools/list-spaces.ts +31 -0
- package/dist/integrations/confluence/files/ai/tools/search-content.ts +38 -0
- package/dist/integrations/confluence/files/ai/tools/update-page.ts +45 -0
- package/dist/integrations/confluence/files/app/api/auth/confluence/callback/route.ts +11 -0
- package/dist/integrations/confluence/files/app/api/auth/confluence/route.ts +9 -0
- package/dist/integrations/confluence/files/lib/confluence-client.ts +281 -0
- package/dist/integrations/discord/connector.json +100 -0
- package/dist/integrations/discord/files/_env.example +12 -0
- package/dist/integrations/discord/files/ai/tools/get-messages.ts +55 -0
- package/dist/integrations/discord/files/ai/tools/get-user.ts +32 -0
- package/dist/integrations/discord/files/ai/tools/list-channels.ts +32 -0
- package/dist/integrations/discord/files/ai/tools/list-guilds.ts +24 -0
- package/dist/integrations/discord/files/ai/tools/send-message.ts +33 -0
- package/dist/integrations/discord/files/app/api/auth/discord/callback/route.ts +11 -0
- package/dist/integrations/discord/files/app/api/auth/discord/route.ts +9 -0
- package/dist/integrations/discord/files/lib/discord-client.ts +273 -0
- package/dist/integrations/docs-google/connector.json +101 -0
- package/dist/integrations/docs-google/files/_env.example +8 -0
- package/dist/integrations/docs-google/files/ai/tools/create-document.ts +46 -0
- package/dist/integrations/docs-google/files/ai/tools/get-document.ts +46 -0
- package/dist/integrations/docs-google/files/ai/tools/list-documents.ts +42 -0
- package/dist/integrations/docs-google/files/ai/tools/search-documents.ts +38 -0
- package/dist/integrations/docs-google/files/ai/tools/update-document.ts +131 -0
- package/dist/integrations/docs-google/files/app/api/auth/docs-google/callback/route.ts +11 -0
- package/dist/integrations/docs-google/files/app/api/auth/docs-google/route.ts +9 -0
- package/dist/integrations/docs-google/files/lib/docs-client.ts +582 -0
- package/dist/integrations/drive/connector.json +134 -0
- package/dist/integrations/drive/files/_env.example +9 -0
- package/dist/integrations/drive/files/ai/tools/create-folder.ts +47 -0
- package/dist/integrations/drive/files/ai/tools/get-file.ts +55 -0
- package/dist/integrations/drive/files/ai/tools/list-files.ts +78 -0
- package/dist/integrations/drive/files/ai/tools/search-files.ts +79 -0
- package/dist/integrations/drive/files/ai/tools/upload-file.ts +59 -0
- package/dist/integrations/drive/files/app/api/auth/drive/callback/route.ts +11 -0
- package/dist/integrations/drive/files/app/api/auth/drive/route.ts +9 -0
- package/dist/integrations/drive/files/lib/drive-client.ts +359 -0
- package/dist/integrations/dropbox/connector.json +107 -0
- package/dist/integrations/dropbox/files/_env.example +24 -0
- package/dist/integrations/dropbox/files/ai/tools/get-account.ts +58 -0
- package/dist/integrations/dropbox/files/ai/tools/get-file.ts +61 -0
- package/dist/integrations/dropbox/files/ai/tools/list-files.ts +56 -0
- package/dist/integrations/dropbox/files/ai/tools/search-files.ts +70 -0
- package/dist/integrations/dropbox/files/ai/tools/upload-file.ts +48 -0
- package/dist/integrations/dropbox/files/app/api/auth/dropbox/callback/route.ts +11 -0
- package/dist/integrations/dropbox/files/app/api/auth/dropbox/route.ts +9 -0
- package/dist/integrations/dropbox/files/lib/dropbox-client.ts +397 -0
- package/dist/integrations/figma/INTEGRATION_SUMMARY.md +436 -0
- package/dist/integrations/figma/README.md +287 -0
- package/dist/integrations/figma/connector.json +100 -0
- package/dist/integrations/figma/files/_env.example +5 -0
- package/dist/integrations/figma/files/ai/tools/get-comments.ts +72 -0
- package/dist/integrations/figma/files/ai/tools/get-file.ts +54 -0
- package/dist/integrations/figma/files/ai/tools/list-files.ts +39 -0
- package/dist/integrations/figma/files/ai/tools/list-projects.ts +69 -0
- package/dist/integrations/figma/files/ai/tools/post-comment.ts +54 -0
- package/dist/integrations/figma/files/app/api/auth/figma/callback/route.ts +11 -0
- package/dist/integrations/figma/files/app/api/auth/figma/route.ts +9 -0
- package/dist/integrations/figma/files/lib/figma-client.ts +355 -0
- package/dist/integrations/figma/files/lib/types.ts +503 -0
- package/dist/integrations/freshdesk/connector.json +85 -0
- package/dist/integrations/freshdesk/files/_env.example +4 -0
- package/dist/integrations/freshdesk/files/ai/tools/create-ticket.ts +60 -0
- package/dist/integrations/freshdesk/files/ai/tools/get-ticket.ts +46 -0
- package/dist/integrations/freshdesk/files/ai/tools/list-contacts.ts +37 -0
- package/dist/integrations/freshdesk/files/ai/tools/list-tickets.ts +59 -0
- package/dist/integrations/freshdesk/files/ai/tools/update-ticket.ts +61 -0
- package/dist/integrations/freshdesk/files/app/api/auth/freshdesk/callback/route.ts +11 -0
- package/dist/integrations/freshdesk/files/app/api/auth/freshdesk/route.ts +7 -0
- package/dist/integrations/freshdesk/files/lib/freshdesk-client.ts +178 -0
- package/dist/integrations/github/files/app/api/auth/github/callback/route.ts +6 -127
- package/dist/integrations/github/files/app/api/auth/github/route.ts +4 -24
- package/dist/integrations/gitlab/connector.json +100 -0
- package/dist/integrations/gitlab/files/_env.example +7 -0
- package/dist/integrations/gitlab/files/ai/tools/create-issue.ts +49 -0
- package/dist/integrations/gitlab/files/ai/tools/get-issue.ts +56 -0
- package/dist/integrations/gitlab/files/ai/tools/list-merge-requests.ts +75 -0
- package/dist/integrations/gitlab/files/ai/tools/list-projects.ts +51 -0
- package/dist/integrations/gitlab/files/ai/tools/search-issues.ts +67 -0
- package/dist/integrations/gitlab/files/app/api/auth/gitlab/callback/route.ts +11 -0
- package/dist/integrations/gitlab/files/app/api/auth/gitlab/route.ts +9 -0
- package/dist/integrations/gitlab/files/lib/gitlab-client.ts +366 -0
- package/dist/integrations/gmail/files/app/api/auth/gmail/callback/route.ts +7 -108
- package/dist/integrations/gmail/files/app/api/auth/gmail/route.ts +5 -23
- package/dist/integrations/gmail/files/lib/gmail-client.ts +16 -55
- package/dist/integrations/hubspot/connector.json +98 -0
- package/dist/integrations/hubspot/files/_env.example +5 -0
- package/dist/integrations/hubspot/files/ai/tools/create-contact.ts +41 -0
- package/dist/integrations/hubspot/files/ai/tools/create-deal.ts +41 -0
- package/dist/integrations/hubspot/files/ai/tools/get-contact.ts +39 -0
- package/dist/integrations/hubspot/files/ai/tools/list-contacts.ts +43 -0
- package/dist/integrations/hubspot/files/ai/tools/list-deals.ts +41 -0
- package/dist/integrations/hubspot/files/app/api/auth/hubspot/callback/route.ts +11 -0
- package/dist/integrations/hubspot/files/app/api/auth/hubspot/route.ts +9 -0
- package/dist/integrations/hubspot/files/lib/hubspot-client.ts +393 -0
- package/dist/integrations/intercom/connector.json +85 -0
- package/dist/integrations/intercom/files/_env.example +4 -0
- package/dist/integrations/intercom/files/ai/tools/get-contact.ts +35 -0
- package/dist/integrations/intercom/files/ai/tools/get-conversation.ts +55 -0
- package/dist/integrations/intercom/files/ai/tools/list-contacts.ts +35 -0
- package/dist/integrations/intercom/files/ai/tools/list-conversations.ts +49 -0
- package/dist/integrations/intercom/files/ai/tools/send-message.ts +34 -0
- package/dist/integrations/intercom/files/app/api/auth/intercom/callback/route.ts +11 -0
- package/dist/integrations/intercom/files/app/api/auth/intercom/route.ts +7 -0
- package/dist/integrations/intercom/files/lib/intercom-client.ts +308 -0
- package/dist/integrations/jira/connector.json +109 -0
- package/dist/integrations/jira/files/ai/tools/create-issue.ts +47 -0
- package/dist/integrations/jira/files/ai/tools/get-issue.ts +57 -0
- package/dist/integrations/jira/files/ai/tools/list-projects.ts +30 -0
- package/dist/integrations/jira/files/ai/tools/search-issues.ts +49 -0
- package/dist/integrations/jira/files/ai/tools/update-issue.ts +81 -0
- package/dist/integrations/jira/files/app/api/auth/jira/callback/route.ts +11 -0
- package/dist/integrations/jira/files/app/api/auth/jira/route.ts +9 -0
- package/dist/integrations/jira/files/lib/jira-client.ts +338 -0
- package/dist/integrations/linear/connector.json +100 -0
- package/dist/integrations/linear/files/_env.example +6 -0
- package/dist/integrations/linear/files/ai/tools/create-issue.ts +71 -0
- package/dist/integrations/linear/files/ai/tools/get-issue.ts +55 -0
- package/dist/integrations/linear/files/ai/tools/list-projects.ts +43 -0
- package/dist/integrations/linear/files/ai/tools/search-issues.ts +54 -0
- package/dist/integrations/linear/files/ai/tools/update-issue.ts +71 -0
- package/dist/integrations/linear/files/app/api/auth/linear/callback/route.ts +11 -0
- package/dist/integrations/linear/files/app/api/auth/linear/route.ts +9 -0
- package/dist/integrations/linear/files/lib/linear-client.ts +464 -0
- package/dist/integrations/mailchimp/connector.json +85 -0
- package/dist/integrations/mailchimp/files/_env.example +4 -0
- package/dist/integrations/mailchimp/files/ai/tools/get-campaign.ts +45 -0
- package/dist/integrations/mailchimp/files/ai/tools/get-list.ts +51 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-campaigns.ts +46 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-lists.ts +46 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-members.ts +58 -0
- package/dist/integrations/mailchimp/files/app/api/auth/mailchimp/callback/route.ts +11 -0
- package/dist/integrations/mailchimp/files/app/api/auth/mailchimp/route.ts +7 -0
- package/dist/integrations/mailchimp/files/lib/mailchimp-client.ts +267 -0
- package/dist/integrations/mixpanel/connector.json +96 -0
- package/dist/integrations/mixpanel/files/_env.example +11 -0
- package/dist/integrations/mixpanel/files/ai/tools/get-funnel.ts +46 -0
- package/dist/integrations/mixpanel/files/ai/tools/get-retention.ts +64 -0
- package/dist/integrations/mixpanel/files/ai/tools/list-cohorts.ts +46 -0
- package/dist/integrations/mixpanel/files/ai/tools/query-events.ts +43 -0
- package/dist/integrations/mixpanel/files/ai/tools/track-event.ts +41 -0
- package/dist/integrations/mixpanel/files/lib/mixpanel-client.ts +319 -0
- package/dist/integrations/monday/connector.json +85 -0
- package/dist/integrations/monday/files/_env.example +4 -0
- package/dist/integrations/monday/files/ai/tools/create-item.ts +36 -0
- package/dist/integrations/monday/files/ai/tools/get-item.ts +31 -0
- package/dist/integrations/monday/files/ai/tools/list-boards.ts +29 -0
- package/dist/integrations/monday/files/ai/tools/list-items.ts +36 -0
- package/dist/integrations/monday/files/ai/tools/update-item.ts +36 -0
- package/dist/integrations/monday/files/app/api/auth/monday/callback/route.ts +11 -0
- package/dist/integrations/monday/files/app/api/auth/monday/route.ts +7 -0
- package/dist/integrations/monday/files/lib/monday-client.ts +329 -0
- package/dist/integrations/neon/connector.json +89 -0
- package/dist/integrations/neon/files/_env.example +6 -0
- package/dist/integrations/neon/files/ai/tools/describe-table.ts +38 -0
- package/dist/integrations/neon/files/ai/tools/list-branches.ts +35 -0
- package/dist/integrations/neon/files/ai/tools/list-projects.ts +31 -0
- package/dist/integrations/neon/files/ai/tools/list-tables.ts +49 -0
- package/dist/integrations/neon/files/ai/tools/query-database.ts +33 -0
- package/dist/integrations/neon/files/app/api/auth/neon/route.ts +51 -0
- package/dist/integrations/neon/files/lib/neon-client.ts +294 -0
- package/dist/integrations/notion/connector.json +87 -0
- package/dist/integrations/notion/files/_env.example +6 -0
- package/dist/integrations/notion/files/ai/tools/create-page.ts +32 -0
- package/dist/integrations/notion/files/ai/tools/query-database.ts +44 -0
- package/dist/integrations/notion/files/ai/tools/read-page.ts +34 -0
- package/dist/integrations/notion/files/ai/tools/search-notion.ts +51 -0
- package/dist/integrations/notion/files/app/api/auth/notion/callback/route.ts +11 -0
- package/dist/integrations/notion/files/app/api/auth/notion/route.ts +9 -0
- package/dist/integrations/notion/files/lib/notion-client.ts +218 -0
- package/dist/integrations/onedrive/connector.json +100 -0
- package/dist/integrations/onedrive/files/_env.example +23 -0
- package/dist/integrations/onedrive/files/ai/tools/download-file.ts +38 -0
- package/dist/integrations/onedrive/files/ai/tools/list-files.ts +63 -0
- package/dist/integrations/onedrive/files/ai/tools/search-files.ts +59 -0
- package/dist/integrations/onedrive/files/ai/tools/upload-file.ts +43 -0
- package/dist/integrations/onedrive/files/app/api/auth/onedrive/callback/route.ts +11 -0
- package/dist/integrations/onedrive/files/app/api/auth/onedrive/route.ts +9 -0
- package/dist/integrations/onedrive/files/lib/onedrive-client.ts +314 -0
- package/dist/integrations/outlook/README.md +308 -0
- package/dist/integrations/outlook/connector.json +98 -0
- package/dist/integrations/outlook/files/_env.example +8 -0
- package/dist/integrations/outlook/files/ai/tools/get-email.ts +47 -0
- package/dist/integrations/outlook/files/ai/tools/list-emails.ts +46 -0
- package/dist/integrations/outlook/files/ai/tools/list-folders.ts +22 -0
- package/dist/integrations/outlook/files/ai/tools/search-emails.ts +41 -0
- package/dist/integrations/outlook/files/ai/tools/send-email.ts +41 -0
- package/dist/integrations/outlook/files/app/api/auth/outlook/callback/route.ts +11 -0
- package/dist/integrations/outlook/files/app/api/auth/outlook/route.ts +9 -0
- package/dist/integrations/outlook/files/lib/outlook-client.ts +204 -0
- package/dist/integrations/pipedrive/connector.json +85 -0
- package/dist/integrations/pipedrive/files/_env.example +4 -0
- package/dist/integrations/pipedrive/files/ai/tools/create-deal.ts +44 -0
- package/dist/integrations/pipedrive/files/ai/tools/get-deal.ts +34 -0
- package/dist/integrations/pipedrive/files/ai/tools/list-deals.ts +40 -0
- package/dist/integrations/pipedrive/files/ai/tools/list-persons.ts +33 -0
- package/dist/integrations/pipedrive/files/ai/tools/update-deal.ts +46 -0
- package/dist/integrations/pipedrive/files/app/api/auth/pipedrive/callback/route.ts +11 -0
- package/dist/integrations/pipedrive/files/app/api/auth/pipedrive/route.ts +7 -0
- package/dist/integrations/pipedrive/files/lib/pipedrive-client.ts +259 -0
- package/dist/integrations/posthog/connector.json +84 -0
- package/dist/integrations/posthog/files/_env.example +6 -0
- package/dist/integrations/posthog/files/ai/tools/capture-event.ts +37 -0
- package/dist/integrations/posthog/files/ai/tools/get-trends.ts +44 -0
- package/dist/integrations/posthog/files/ai/tools/list-feature-flags.ts +38 -0
- package/dist/integrations/posthog/files/ai/tools/list-persons.ts +32 -0
- package/dist/integrations/posthog/files/lib/posthog-client.ts +286 -0
- package/dist/integrations/quickbooks/connector.json +85 -0
- package/dist/integrations/quickbooks/files/_env.example +4 -0
- package/dist/integrations/quickbooks/files/ai/tools/create-invoice.ts +48 -0
- package/dist/integrations/quickbooks/files/ai/tools/get-customer.ts +36 -0
- package/dist/integrations/quickbooks/files/ai/tools/get-invoice.ts +46 -0
- package/dist/integrations/quickbooks/files/ai/tools/list-customers.ts +37 -0
- package/dist/integrations/quickbooks/files/ai/tools/list-invoices.ts +40 -0
- package/dist/integrations/quickbooks/files/app/api/auth/quickbooks/callback/route.ts +11 -0
- package/dist/integrations/quickbooks/files/app/api/auth/quickbooks/route.ts +7 -0
- package/dist/integrations/quickbooks/files/lib/quickbooks-client.ts +252 -0
- package/dist/integrations/salesforce/connector.json +104 -0
- package/dist/integrations/salesforce/files/ai/tools/create-lead.ts +101 -0
- package/dist/integrations/salesforce/files/ai/tools/get-account.ts +53 -0
- package/dist/integrations/salesforce/files/ai/tools/list-accounts.ts +50 -0
- package/dist/integrations/salesforce/files/ai/tools/list-contacts.ts +54 -0
- package/dist/integrations/salesforce/files/ai/tools/list-opportunities.ts +55 -0
- package/dist/integrations/salesforce/files/app/api/auth/salesforce/callback/route.ts +11 -0
- package/dist/integrations/salesforce/files/app/api/auth/salesforce/route.ts +9 -0
- package/dist/integrations/salesforce/files/lib/salesforce-client.ts +539 -0
- package/dist/integrations/sentry/connector.json +84 -0
- package/dist/integrations/sentry/files/_env.example +6 -0
- package/dist/integrations/sentry/files/ai/tools/get-issue.ts +66 -0
- package/dist/integrations/sentry/files/ai/tools/list-issues.ts +57 -0
- package/dist/integrations/sentry/files/ai/tools/list-projects.ts +32 -0
- package/dist/integrations/sentry/files/ai/tools/resolve-issue.ts +28 -0
- package/dist/integrations/sentry/files/lib/sentry-client.ts +268 -0
- package/dist/integrations/servicenow/connector.json +66 -0
- package/dist/integrations/servicenow/files/_env.example +5 -0
- package/dist/integrations/servicenow/files/ai/tools/create-incident.ts +58 -0
- package/dist/integrations/servicenow/files/ai/tools/get-incident.ts +59 -0
- package/dist/integrations/servicenow/files/ai/tools/list-incidents.ts +72 -0
- package/dist/integrations/servicenow/files/ai/tools/search-knowledge.ts +48 -0
- package/dist/integrations/servicenow/files/ai/tools/update-incident.ts +60 -0
- package/dist/integrations/servicenow/files/app/api/auth/servicenow/callback/route.ts +89 -0
- package/dist/integrations/servicenow/files/app/api/auth/servicenow/route.ts +42 -0
- package/dist/integrations/servicenow/files/lib/servicenow-client.ts +239 -0
- package/dist/integrations/sharepoint/connector.json +99 -0
- package/dist/integrations/sharepoint/files/ai/tools/get-file.ts +93 -0
- package/dist/integrations/sharepoint/files/ai/tools/get-site.ts +51 -0
- package/dist/integrations/sharepoint/files/ai/tools/list-files.ts +63 -0
- package/dist/integrations/sharepoint/files/ai/tools/list-sites.ts +28 -0
- package/dist/integrations/sharepoint/files/ai/tools/upload-file.ts +72 -0
- package/dist/integrations/sharepoint/files/app/api/auth/sharepoint/callback/route.ts +11 -0
- package/dist/integrations/sharepoint/files/app/api/auth/sharepoint/route.ts +9 -0
- package/dist/integrations/sharepoint/files/lib/sharepoint-client.ts +420 -0
- package/dist/integrations/sheets/README.md +331 -0
- package/dist/integrations/sheets/connector.json +99 -0
- package/dist/integrations/sheets/files/_env.example +8 -0
- package/dist/integrations/sheets/files/ai/tools/create-spreadsheet.ts +85 -0
- package/dist/integrations/sheets/files/ai/tools/get-spreadsheet.ts +39 -0
- package/dist/integrations/sheets/files/ai/tools/list-spreadsheets.ts +41 -0
- package/dist/integrations/sheets/files/ai/tools/read-range.ts +35 -0
- package/dist/integrations/sheets/files/ai/tools/write-range.ts +51 -0
- package/dist/integrations/sheets/files/app/api/auth/sheets/callback/route.ts +11 -0
- package/dist/integrations/sheets/files/app/api/auth/sheets/route.ts +9 -0
- package/dist/integrations/sheets/files/lib/sheets-client.ts +425 -0
- package/dist/integrations/shopify/connector.json +99 -0
- package/dist/integrations/shopify/files/_env.example +5 -0
- package/dist/integrations/shopify/files/ai/tools/get-order.ts +49 -0
- package/dist/integrations/shopify/files/ai/tools/get-product.ts +39 -0
- package/dist/integrations/shopify/files/ai/tools/list-customers.ts +40 -0
- package/dist/integrations/shopify/files/ai/tools/list-orders.ts +52 -0
- package/dist/integrations/shopify/files/ai/tools/list-products.ts +39 -0
- package/dist/integrations/shopify/files/app/api/auth/shopify/callback/route.ts +11 -0
- package/dist/integrations/shopify/files/app/api/auth/shopify/route.ts +7 -0
- package/dist/integrations/shopify/files/lib/shopify-client.ts +198 -0
- package/dist/integrations/slack/files/app/api/auth/slack/callback/route.ts +6 -127
- package/dist/integrations/slack/files/app/api/auth/slack/route.ts +4 -24
- package/dist/integrations/snowflake/connector.json +151 -0
- package/dist/integrations/snowflake/files/_env.example +16 -0
- package/dist/integrations/snowflake/files/ai/tools/describe-table.ts +57 -0
- package/dist/integrations/snowflake/files/ai/tools/list-databases.ts +34 -0
- package/dist/integrations/snowflake/files/ai/tools/list-schemas.ts +40 -0
- package/dist/integrations/snowflake/files/ai/tools/list-tables.ts +49 -0
- package/dist/integrations/snowflake/files/ai/tools/run-query.ts +119 -0
- package/dist/integrations/snowflake/files/lib/snowflake-client.ts +389 -0
- package/dist/integrations/stripe/connector.json +97 -0
- package/dist/integrations/stripe/files/_env.example +6 -0
- package/dist/integrations/stripe/files/ai/tools/get-balance.ts +28 -0
- package/dist/integrations/stripe/files/ai/tools/get-customer.ts +26 -0
- package/dist/integrations/stripe/files/ai/tools/list-customers.ts +42 -0
- package/dist/integrations/stripe/files/ai/tools/list-payments.ts +45 -0
- package/dist/integrations/stripe/files/ai/tools/list-subscriptions.ts +67 -0
- package/dist/integrations/stripe/files/app/api/auth/stripe/route.ts +71 -0
- package/dist/integrations/stripe/files/lib/stripe-client.ts +376 -0
- package/dist/integrations/supabase/connector.json +101 -0
- package/dist/integrations/supabase/files/_env.example +6 -0
- package/dist/integrations/supabase/files/ai/tools/delete-row.ts +77 -0
- package/dist/integrations/supabase/files/ai/tools/insert-row.ts +35 -0
- package/dist/integrations/supabase/files/ai/tools/list-tables.ts +60 -0
- package/dist/integrations/supabase/files/ai/tools/query-table.ts +48 -0
- package/dist/integrations/supabase/files/ai/tools/update-row.ts +64 -0
- package/dist/integrations/supabase/files/app/api/auth/supabase/route.ts +91 -0
- package/dist/integrations/supabase/files/lib/supabase-client.ts +296 -0
- package/dist/integrations/teams/README.md +256 -0
- package/dist/integrations/teams/connector.json +99 -0
- package/dist/integrations/teams/files/ai/tools/get-messages.ts +55 -0
- package/dist/integrations/teams/files/ai/tools/list-channels.ts +28 -0
- package/dist/integrations/teams/files/ai/tools/list-chats.ts +41 -0
- package/dist/integrations/teams/files/ai/tools/list-teams.ts +27 -0
- package/dist/integrations/teams/files/ai/tools/send-message.ts +61 -0
- package/dist/integrations/teams/files/app/api/auth/teams/callback/route.ts +11 -0
- package/dist/integrations/teams/files/app/api/auth/teams/route.ts +9 -0
- package/dist/integrations/teams/files/lib/teams-client.ts +345 -0
- package/dist/integrations/trello/connector.json +85 -0
- package/dist/integrations/trello/files/_env.example +4 -0
- package/dist/integrations/trello/files/ai/tools/create-card.ts +54 -0
- package/dist/integrations/trello/files/ai/tools/get-card.ts +33 -0
- package/dist/integrations/trello/files/ai/tools/list-boards.ts +29 -0
- package/dist/integrations/trello/files/ai/tools/list-cards.ts +52 -0
- package/dist/integrations/trello/files/ai/tools/update-card.ts +65 -0
- package/dist/integrations/trello/files/app/api/auth/trello/callback/route.ts +11 -0
- package/dist/integrations/trello/files/app/api/auth/trello/route.ts +7 -0
- package/dist/integrations/trello/files/lib/trello-client.ts +202 -0
- package/dist/integrations/twilio/connector.json +146 -0
- package/dist/integrations/twilio/files/_env.example +14 -0
- package/dist/integrations/twilio/files/ai/tools/get-message.ts +58 -0
- package/dist/integrations/twilio/files/ai/tools/list-calls.ts +129 -0
- package/dist/integrations/twilio/files/ai/tools/list-messages.ts +97 -0
- package/dist/integrations/twilio/files/ai/tools/send-sms.ts +75 -0
- package/dist/integrations/twilio/files/ai/tools/send-whatsapp.ts +81 -0
- package/dist/integrations/twilio/files/lib/twilio-client.ts +375 -0
- package/dist/integrations/twitter/connector.json +87 -0
- package/dist/integrations/twitter/files/_env.example +6 -0
- package/dist/integrations/twitter/files/ai/tools/get-timeline.ts +59 -0
- package/dist/integrations/twitter/files/ai/tools/post-tweet.ts +49 -0
- package/dist/integrations/twitter/files/ai/tools/search-tweets.ts +71 -0
- package/dist/integrations/twitter/files/app/api/auth/twitter/callback/route.ts +11 -0
- package/dist/integrations/twitter/files/app/api/auth/twitter/route.ts +9 -0
- package/dist/integrations/twitter/files/lib/twitter-client.ts +236 -0
- package/dist/integrations/webex/connector.json +85 -0
- package/dist/integrations/webex/files/_env.example +4 -0
- package/dist/integrations/webex/files/ai/tools/create-meeting.ts +69 -0
- package/dist/integrations/webex/files/ai/tools/get-meeting.ts +31 -0
- package/dist/integrations/webex/files/ai/tools/list-meetings.ts +44 -0
- package/dist/integrations/webex/files/ai/tools/list-rooms.ts +35 -0
- package/dist/integrations/webex/files/ai/tools/send-message.ts +51 -0
- package/dist/integrations/webex/files/app/api/auth/webex/callback/route.ts +11 -0
- package/dist/integrations/webex/files/app/api/auth/webex/route.ts +7 -0
- package/dist/integrations/webex/files/lib/webex-client.ts +279 -0
- package/dist/integrations/xero/connector.json +85 -0
- package/dist/integrations/xero/files/_env.example +4 -0
- package/dist/integrations/xero/files/ai/tools/create-invoice.ts +65 -0
- package/dist/integrations/xero/files/ai/tools/get-contact.ts +40 -0
- package/dist/integrations/xero/files/ai/tools/get-invoice.ts +44 -0
- package/dist/integrations/xero/files/ai/tools/list-contacts.ts +54 -0
- package/dist/integrations/xero/files/ai/tools/list-invoices.ts +54 -0
- package/dist/integrations/xero/files/app/api/auth/xero/callback/route.ts +11 -0
- package/dist/integrations/xero/files/app/api/auth/xero/route.ts +7 -0
- package/dist/integrations/xero/files/lib/xero-client.ts +292 -0
- package/dist/integrations/zendesk/connector.json +61 -0
- package/dist/integrations/zendesk/files/_env.example +5 -0
- package/dist/integrations/zendesk/files/ai/tools/create-ticket.ts +82 -0
- package/dist/integrations/zendesk/files/ai/tools/get-ticket.ts +53 -0
- package/dist/integrations/zendesk/files/ai/tools/list-tickets.ts +60 -0
- package/dist/integrations/zendesk/files/ai/tools/search-tickets.ts +56 -0
- package/dist/integrations/zendesk/files/app/api/auth/zendesk/callback/route.ts +91 -0
- package/dist/integrations/zendesk/files/app/api/auth/zendesk/route.ts +41 -0
- package/dist/integrations/zendesk/files/lib/zendesk-client.ts +265 -0
- package/dist/integrations/zoom/connector.json +85 -0
- package/dist/integrations/zoom/files/_env.example +4 -0
- package/dist/integrations/zoom/files/ai/tools/create-meeting.ts +106 -0
- package/dist/integrations/zoom/files/ai/tools/delete-meeting.ts +32 -0
- package/dist/integrations/zoom/files/ai/tools/get-meeting.ts +44 -0
- package/dist/integrations/zoom/files/ai/tools/list-meetings.ts +47 -0
- package/dist/integrations/zoom/files/ai/tools/update-meeting.ts +111 -0
- package/dist/integrations/zoom/files/app/api/auth/zoom/callback/route.ts +11 -0
- package/dist/integrations/zoom/files/app/api/auth/zoom/route.ts +7 -0
- package/dist/integrations/zoom/files/lib/zoom-client.ts +228 -0
- package/dist/oauth/handlers.js +554 -0
- package/dist/oauth/handlers.js.map +7 -0
- package/dist/oauth/index.js +1157 -0
- package/dist/oauth/index.js.map +7 -0
- package/dist/oauth/providers.js +927 -0
- package/dist/oauth/providers.js.map +7 -0
- package/dist/oauth/token-store.js +82 -0
- package/dist/oauth/token-store.js.map +7 -0
- package/package.json +25 -1
- package/dist/integrations/calendar/files/lib/token-store.ts +0 -113
- package/dist/integrations/github/files/lib/token-store.ts +0 -113
- package/dist/integrations/gmail/files/lib/oauth.ts +0 -145
- package/dist/integrations/gmail/files/lib/token-store.ts +0 -113
- package/dist/integrations/slack/files/lib/oauth.ts +0 -145
- package/dist/integrations/slack/files/lib/token-store.ts +0 -113
- /package/dist/integrations/{calendar → docs-google}/files/lib/oauth.ts +0 -0
- /package/dist/integrations/{github → drive}/files/lib/oauth.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/platform/compat/runtime.ts", "../../../src/platform/compat/process.ts", "../../../src/core/oauth/providers/base.ts", "../../../src/core/oauth/providers/google.ts", "../../../src/core/oauth/providers/microsoft.ts", "../../../src/core/oauth/providers/atlassian.ts", "../../../src/core/oauth/providers/common.ts"],
|
|
4
|
+
"sourcesContent": ["export const isDeno = typeof Deno !== \"undefined\";\nexport const isNode =\n typeof (globalThis as { process?: { versions?: { node?: string } } }).process !== \"undefined\" &&\n (globalThis as { process?: { versions?: { node?: string } } }).process?.versions?.node !==\n undefined;\nexport const isBun = typeof (globalThis as { Bun?: unknown }).Bun !== \"undefined\";\nexport const isCloudflare = typeof globalThis !== \"undefined\" && \"caches\" in globalThis &&\n \"WebSocketPair\" in globalThis;\n\n/**\n * Detect if running in Node.js (vs Deno)\n * Use this function instead of the constant when runtime detection needs to happen\n * at call time (e.g., when bundled with esbuild's __esm lazy initialization pattern)\n */\nexport function isNodeRuntime(): boolean {\n // deno-lint-ignore no-explicit-any\n const _global = globalThis as any;\n return typeof Deno === \"undefined\" && typeof _global.process !== \"undefined\" &&\n !!_global.process?.versions?.node;\n}\n", "import { isDeno as IS_DENO } from \"./runtime.ts\";\n\nconst nodeProcess = (globalThis as { process?: typeof import(\"node:process\") }).process;\nconst hasNodeProcess = !!nodeProcess?.versions?.node;\n\nexport function getArgs(): string[] {\n if (IS_DENO) {\n return Deno.args;\n }\n if (hasNodeProcess) {\n return nodeProcess!.argv.slice(2);\n }\n return [];\n}\n\nexport function exit(code?: number): never {\n if (IS_DENO) {\n Deno.exit(code);\n }\n if (hasNodeProcess) {\n nodeProcess!.exit(code);\n }\n throw new Error(\"exit() is not supported in this runtime\");\n}\n\nexport function cwd(): string {\n if (IS_DENO) {\n return Deno.cwd();\n }\n if (hasNodeProcess) {\n return nodeProcess!.cwd();\n }\n throw new Error(\"cwd() is not supported in this runtime\");\n}\n\nexport function chdir(directory: string): void {\n if (IS_DENO) {\n Deno.chdir(directory);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.chdir(directory);\n return;\n }\n throw new Error(\"chdir() is not supported in this runtime\");\n }\n}\n\nexport function env(): Record<string, string> {\n if (IS_DENO) {\n return Deno.env.toObject();\n }\n if (hasNodeProcess) {\n return nodeProcess!.env as Record<string, string>;\n }\n return {};\n}\n\nexport function getEnv(key: string): string | undefined {\n if (IS_DENO) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess) {\n return nodeProcess!.env[key];\n }\n return undefined;\n}\n\n/**\n * Get an environment variable or throw if not set\n * @throws Error if the environment variable is not set\n */\nexport function requireEnv(key: string): string {\n const value = getEnv(key);\n if (value === undefined) {\n throw new Error(`Required environment variable \"${key}\" is not set`);\n }\n return value;\n}\n\nexport function setEnv(key: string, value: string): void {\n if (IS_DENO) {\n Deno.env.set(key, value);\n } else {\n if (hasNodeProcess) {\n nodeProcess!.env[key] = value;\n return;\n }\n throw new Error(\"setEnv() is not supported in this runtime\");\n }\n}\n\nexport function deleteEnv(key: string): void {\n if (IS_DENO) {\n Deno.env.delete(key);\n } else {\n if (hasNodeProcess) {\n delete nodeProcess!.env[key];\n return;\n }\n throw new Error(\"deleteEnv() is not supported in this runtime\");\n }\n}\n\nexport function pid(): number {\n if (IS_DENO) {\n return Deno.pid;\n }\n if (hasNodeProcess) {\n return nodeProcess!.pid;\n }\n return 0;\n}\n\nexport function ppid(): number {\n if (IS_DENO && \"ppid\" in Deno) {\n return Deno.ppid || 0;\n }\n if (hasNodeProcess) {\n return nodeProcess!.ppid || 0;\n }\n return 0;\n}\n\nexport function memoryUsage(): {\n rss: number;\n heapTotal: number;\n heapUsed: number;\n external: number;\n} {\n if (IS_DENO) {\n const usage = Deno.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external,\n };\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"memoryUsage() is not supported in this runtime\");\n }\n\n const usage = nodeProcess!.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external || 0,\n };\n}\n\n/**\n * Check if stdin is a TTY (terminal)\n */\nexport function isInteractive(): boolean {\n if (IS_DENO) {\n return Deno.stdin.isTerminal();\n }\n if (hasNodeProcess) {\n return nodeProcess!.stdin.isTTY ?? false;\n }\n return false;\n}\n\n/**\n * Get network interfaces\n */\nexport async function getNetworkInterfaces(): Promise<\n Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }>\n> {\n if (IS_DENO) {\n const interfaces = Deno.networkInterfaces();\n return interfaces.map((iface) => ({\n name: iface.name,\n address: iface.address,\n family: iface.family as \"IPv4\" | \"IPv6\",\n }));\n }\n\n if (!hasNodeProcess) {\n throw new Error(\"networkInterfaces() is not supported in this runtime\");\n }\n\n const os = await import(\"node:os\");\n const interfaces = os.networkInterfaces();\n const result: Array<{ name: string; address: string; family: \"IPv4\" | \"IPv6\" }> = [];\n\n for (const [name, addrs] of Object.entries(interfaces)) {\n if (!addrs) continue;\n for (const addr of addrs) {\n result.push({\n name,\n address: addr.address,\n family: addr.family as \"IPv4\" | \"IPv6\",\n });\n }\n }\n\n return result;\n}\n\n/**\n * Get runtime version string\n */\nexport function getRuntimeVersion(): string {\n if (IS_DENO) {\n return `Deno ${Deno.version.deno}`;\n }\n if (\"Bun\" in globalThis) {\n return `Bun ${(globalThis as unknown as { Bun: { version: string } }).Bun.version}`;\n }\n if (hasNodeProcess) {\n return `Node.js ${nodeProcess!.version}`;\n }\n return \"unknown\";\n}\n\n/**\n * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown\n */\nexport function onSignal(signal: \"SIGINT\" | \"SIGTERM\", handler: () => void): void {\n if (IS_DENO) {\n Deno.addSignalListener(signal, handler);\n } else if (hasNodeProcess) {\n nodeProcess!.on(signal, handler);\n }\n}\n\n/**\n * Unreference a timer to prevent it from keeping the process alive\n */\nexport function unrefTimer(timerId: ReturnType<typeof setInterval>): void {\n if (IS_DENO) {\n Deno.unrefTimer(timerId as number);\n } else if (timerId && typeof timerId === \"object\" && \"unref\" in timerId) {\n (timerId as { unref: () => void }).unref();\n }\n}\n\n/**\n * Get the executable path of the current runtime\n */\nexport function execPath(): string {\n if (IS_DENO) {\n return Deno.execPath();\n }\n if (hasNodeProcess) {\n return nodeProcess!.execPath;\n }\n return \"\";\n}\n\n/**\n * Get process uptime in seconds\n * Returns OS uptime on Deno, process uptime on Node.js\n */\nexport function uptime(): number {\n if (IS_DENO) {\n // Deno.osUptime() returns system uptime in seconds\n return Deno.osUptime?.() ?? 0;\n }\n if (hasNodeProcess) {\n // process.uptime() returns process uptime in seconds\n return nodeProcess!.uptime?.() ?? 0;\n }\n return 0;\n}\n\n/**\n * Get stdout stream for writing\n * Returns null if not available (e.g., in browser/workers)\n */\nexport function getStdout(): { write: (data: string) => void } | null {\n if (IS_DENO) {\n const encoder = new TextEncoder();\n return {\n write: (data: string) => {\n Deno.stdout.writeSync(encoder.encode(data));\n },\n };\n }\n if (hasNodeProcess && nodeProcess!.stdout) {\n return {\n write: (data: string) => {\n nodeProcess!.stdout.write(data);\n },\n };\n }\n return null;\n}\n\n// Cached Node.js modules for synchronous prompt\nlet cachedNodeFs: typeof import(\"node:fs\") | null = null;\n\n/**\n * Synchronous prompt function that works across Deno and Node.js\n * Displays a message and reads user input from stdin\n */\nexport function promptSync(message?: string): string | null {\n if (IS_DENO) {\n // Deno has a built-in prompt() function\n return prompt(message);\n }\n\n if (hasNodeProcess) {\n // Print the message\n if (message) {\n nodeProcess!.stdout.write(message + \" \");\n }\n\n // Lazy load fs module\n if (!cachedNodeFs) {\n // Dynamic import converted to sync require for bundling\n // @ts-ignore - dynamic require for Node.js\n cachedNodeFs = globalThis.require?.(\"node:fs\") || null;\n if (!cachedNodeFs) {\n // Try alternative approach\n try {\n // @ts-ignore: __require is injected by bundlers for Node.js require\n cachedNodeFs = __require(\"node:fs\");\n } catch {\n return null;\n }\n }\n }\n\n if (!cachedNodeFs) {\n return null;\n }\n\n // Read synchronously using fs\n // This works by reading from file descriptor 0 (stdin)\n // Use Uint8Array for cross-platform compatibility\n const bufferSize = 1024;\n const uint8Array = new Uint8Array(bufferSize);\n let input = \"\";\n\n try {\n // Read from stdin (fd 0) synchronously\n const bytesRead = cachedNodeFs.readSync(0, uint8Array, 0, bufferSize, null);\n if (bytesRead > 0) {\n const decoder = new TextDecoder(\"utf-8\");\n input = decoder.decode(uint8Array.subarray(0, bytesRead)).trim();\n }\n } catch {\n // If stdin is not available or EOF, return null\n return null;\n }\n\n return input || null;\n }\n\n return null;\n}\n", "/**\n * Base OAuth Provider\n *\n * Generic OAuth 2.0 implementation that can be extended for specific providers.\n */\n\nimport type {\n AuthorizationUrlOptions,\n OAuthProviderConfig,\n OAuthServiceConfig,\n OAuthState,\n OAuthTokens,\n TokenExchangeOptions,\n TokenExchangeResult,\n TokenStore,\n} from \"../types.ts\";\nimport { getEnv } from \"../../../platform/compat/process.ts\";\n\n/**\n * Generate cryptographically secure random string\n */\nfunction generateRandomString(length: number): string {\n const array = new Uint8Array(length);\n crypto.getRandomValues(array);\n return Array.from(array, (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\").slice(0, length);\n}\n\n/**\n * Generate PKCE code verifier\n */\nfunction generateCodeVerifier(): string {\n return generateRandomString(64);\n}\n\n/**\n * Generate PKCE code challenge from verifier\n */\nasync function generateCodeChallenge(verifier: string): Promise<string> {\n const encoder = new TextEncoder();\n const data = encoder.encode(verifier);\n const hash = await crypto.subtle.digest(\"SHA-256\", data);\n return btoa(String.fromCharCode(...new Uint8Array(hash)))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\");\n}\n\n/**\n * Base OAuth provider class\n */\nexport class OAuthProvider {\n protected config: OAuthProviderConfig;\n\n constructor(config: OAuthProviderConfig) {\n this.config = config;\n }\n\n /**\n * Get client ID from environment\n */\n getClientId(): string | null {\n return getEnv(this.config.clientIdEnvVar) || null;\n }\n\n /**\n * Get client secret from environment\n */\n getClientSecret(): string | null {\n return getEnv(this.config.clientSecretEnvVar) || null;\n }\n\n /**\n * Check if provider is configured\n */\n isConfigured(): boolean {\n return !!(this.getClientId() && this.getClientSecret());\n }\n\n /**\n * Create authorization URL\n */\n async createAuthorizationUrl(\n options: AuthorizationUrlOptions & { defaultScopes?: string[] } = {},\n ): Promise<{ url: string; state: OAuthState }> {\n const clientId = this.getClientId();\n if (!clientId) {\n throw new Error(`${this.config.clientIdEnvVar} not configured`);\n }\n\n const state = options.state || generateRandomString(32);\n const scopes = options.scopes || options.defaultScopes || [];\n const redirectUri = options.redirectUri || \"\";\n const usePkce = options.usePkce !== false;\n\n let codeVerifier: string | undefined;\n let codeChallenge: string | undefined;\n\n if (usePkce) {\n codeVerifier = generateCodeVerifier();\n codeChallenge = await generateCodeChallenge(codeVerifier);\n }\n\n const params = new URLSearchParams({\n client_id: clientId,\n redirect_uri: redirectUri,\n response_type: \"code\",\n state,\n ...(scopes.length > 0 && { scope: scopes.join(\" \") }),\n ...(codeChallenge && {\n code_challenge: codeChallenge,\n code_challenge_method: \"S256\",\n }),\n ...this.config.additionalAuthParams,\n ...options.additionalParams,\n });\n\n const oauthState: OAuthState = {\n state,\n codeVerifier,\n redirectUri,\n scopes,\n createdAt: Date.now(),\n };\n\n return {\n url: `${this.config.authorizationUrl}?${params.toString()}`,\n state: oauthState,\n };\n }\n\n /**\n * Exchange authorization code for tokens\n */\n async exchangeCode(options: TokenExchangeOptions): Promise<TokenExchangeResult> {\n const clientId = this.getClientId();\n const clientSecret = this.getClientSecret();\n\n if (!clientId || !clientSecret) {\n return {\n success: false,\n error: \"OAuth not configured\",\n errorDescription:\n `Missing ${this.config.clientIdEnvVar} or ${this.config.clientSecretEnvVar}`,\n };\n }\n\n const body = new URLSearchParams({\n grant_type: \"authorization_code\",\n code: options.code,\n redirect_uri: options.redirectUri,\n ...(options.codeVerifier && { code_verifier: options.codeVerifier }),\n ...(!this.config.useBasicAuth && {\n client_id: clientId,\n client_secret: clientSecret,\n }),\n ...this.config.additionalTokenParams,\n });\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Accept: \"application/json\",\n };\n\n if (this.config.useBasicAuth) {\n const credentials = btoa(`${clientId}:${clientSecret}`);\n headers.Authorization = `Basic ${credentials}`;\n }\n\n try {\n const response = await fetch(this.config.tokenUrl, {\n method: \"POST\",\n headers,\n body: body.toString(),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"token_exchange_failed\",\n errorDescription: data.error_description || `Status ${response.status}`,\n };\n }\n\n const mapping = this.config.tokenResponseMapping || {};\n const tokens: OAuthTokens = {\n accessToken: data[mapping.accessToken || \"access_token\"],\n refreshToken: data[mapping.refreshToken || \"refresh_token\"],\n tokenType: data[mapping.tokenType || \"token_type\"],\n scope: data[mapping.scope || \"scope\"],\n idToken: data.id_token,\n };\n\n const expiresIn = data[mapping.expiresIn || \"expires_in\"];\n if (expiresIn) {\n tokens.expiresAt = Date.now() + expiresIn * 1000;\n }\n\n return { success: true, tokens };\n } catch (error) {\n return {\n success: false,\n error: \"network_error\",\n errorDescription: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n }\n\n /**\n * Refresh access token\n */\n async refreshTokens(refreshToken: string): Promise<TokenExchangeResult> {\n const clientId = this.getClientId();\n const clientSecret = this.getClientSecret();\n\n if (!clientId || !clientSecret) {\n return {\n success: false,\n error: \"OAuth not configured\",\n };\n }\n\n const body = new URLSearchParams({\n grant_type: \"refresh_token\",\n refresh_token: refreshToken,\n ...(!this.config.useBasicAuth && {\n client_id: clientId,\n client_secret: clientSecret,\n }),\n });\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Accept: \"application/json\",\n };\n\n if (this.config.useBasicAuth) {\n const credentials = btoa(`${clientId}:${clientSecret}`);\n headers.Authorization = `Basic ${credentials}`;\n }\n\n try {\n const response = await fetch(this.config.tokenUrl, {\n method: \"POST\",\n headers,\n body: body.toString(),\n });\n\n const data = await response.json();\n\n if (!response.ok) {\n return {\n success: false,\n error: data.error || \"refresh_failed\",\n errorDescription: data.error_description,\n };\n }\n\n const mapping = this.config.tokenResponseMapping || {};\n const tokens: OAuthTokens = {\n accessToken: data[mapping.accessToken || \"access_token\"],\n refreshToken: data[mapping.refreshToken || \"refresh_token\"] || refreshToken,\n tokenType: data[mapping.tokenType || \"token_type\"],\n scope: data[mapping.scope || \"scope\"],\n };\n\n const expiresIn = data[mapping.expiresIn || \"expires_in\"];\n if (expiresIn) {\n tokens.expiresAt = Date.now() + expiresIn * 1000;\n }\n\n return { success: true, tokens };\n } catch (error) {\n return {\n success: false,\n error: \"network_error\",\n errorDescription: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n }\n\n /**\n * Revoke tokens\n */\n async revokeToken(token: string): Promise<boolean> {\n if (!this.config.revocationUrl) {\n return false;\n }\n\n try {\n const response = await fetch(this.config.revocationUrl, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n body: new URLSearchParams({ token }).toString(),\n });\n\n return response.ok;\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Service-specific OAuth handler\n */\nexport class OAuthService extends OAuthProvider {\n protected serviceConfig: OAuthServiceConfig;\n protected tokenStore?: TokenStore;\n\n constructor(config: OAuthServiceConfig, tokenStore?: TokenStore) {\n super(config);\n this.serviceConfig = config;\n this.tokenStore = tokenStore;\n }\n\n /**\n * Get service ID\n */\n get serviceId(): string {\n return this.serviceConfig.serviceId;\n }\n\n /**\n * Get API base URL\n */\n get apiBaseUrl(): string {\n return this.serviceConfig.apiBaseUrl;\n }\n\n /**\n * Create authorization URL with service defaults\n */\n override createAuthorizationUrl(\n options: AuthorizationUrlOptions = {},\n ): Promise<{ url: string; state: OAuthState }> {\n return super.createAuthorizationUrl({\n ...options,\n defaultScopes: this.serviceConfig.defaultScopes,\n });\n }\n\n /**\n * Get valid access token (refreshing if needed)\n */\n async getAccessToken(): Promise<string | null> {\n if (!this.tokenStore) {\n return null;\n }\n\n const tokens = await this.tokenStore.getTokens(this.serviceId);\n if (!tokens) {\n return null;\n }\n\n // Check if token is expired (with 5 min buffer)\n if (tokens.expiresAt && Date.now() > tokens.expiresAt - 300000) {\n if (tokens.refreshToken) {\n const result = await this.refreshTokens(tokens.refreshToken);\n if (result.success && result.tokens) {\n await this.tokenStore.setTokens(this.serviceId, result.tokens);\n return result.tokens.accessToken;\n }\n }\n return null;\n }\n\n return tokens.accessToken;\n }\n\n /**\n * Make authenticated API request\n */\n async fetch<T>(\n endpoint: string,\n options: RequestInit = {},\n ): Promise<T> {\n const token = await this.getAccessToken();\n if (!token) {\n throw new Error(`Not authenticated with ${this.serviceConfig.displayName}`);\n }\n\n const url = endpoint.startsWith(\"http\") ? endpoint : `${this.apiBaseUrl}${endpoint}`;\n\n const response = await fetch(url, {\n ...options,\n headers: {\n Authorization: `Bearer ${token}`,\n \"Content-Type\": \"application/json\",\n ...options.headers,\n },\n });\n\n if (!response.ok) {\n const error = await response.text();\n throw new Error(`${this.serviceConfig.displayName} API error: ${response.status} ${error}`);\n }\n\n return response.json();\n }\n}\n", "/**\n * Google OAuth Provider\n *\n * Pre-configured OAuth for Google services: Gmail, Calendar, Sheets, Drive\n */\n\nimport type { OAuthServiceConfig } from \"../types.ts\";\n\n/**\n * Base Google OAuth configuration\n */\nconst googleBase = {\n providerId: \"google\",\n displayName: \"Google\",\n authorizationUrl: \"https://accounts.google.com/o/oauth2/v2/auth\",\n tokenUrl: \"https://oauth2.googleapis.com/token\",\n userInfoUrl: \"https://www.googleapis.com/oauth2/v2/userinfo\",\n revocationUrl: \"https://oauth2.googleapis.com/revoke\",\n clientIdEnvVar: \"GOOGLE_CLIENT_ID\",\n clientSecretEnvVar: \"GOOGLE_CLIENT_SECRET\",\n additionalAuthParams: {\n access_type: \"offline\",\n prompt: \"consent\",\n },\n};\n\n/**\n * Gmail OAuth configuration\n */\nexport const gmailConfig: OAuthServiceConfig = {\n ...googleBase,\n serviceId: \"gmail\",\n displayName: \"Gmail\",\n apiBaseUrl: \"https://gmail.googleapis.com/gmail/v1\",\n defaultScopes: [\n \"https://www.googleapis.com/auth/gmail.readonly\",\n \"https://www.googleapis.com/auth/gmail.send\",\n \"https://www.googleapis.com/auth/gmail.compose\",\n \"https://www.googleapis.com/auth/gmail.labels\",\n ],\n};\n\n/**\n * Google Calendar OAuth configuration\n */\nexport const calendarConfig: OAuthServiceConfig = {\n ...googleBase,\n serviceId: \"calendar\",\n displayName: \"Google Calendar\",\n apiBaseUrl: \"https://www.googleapis.com/calendar/v3\",\n defaultScopes: [\n \"https://www.googleapis.com/auth/calendar.readonly\",\n \"https://www.googleapis.com/auth/calendar.events\",\n ],\n};\n\n/**\n * Google Sheets OAuth configuration\n */\nexport const sheetsConfig: OAuthServiceConfig = {\n ...googleBase,\n serviceId: \"sheets\",\n displayName: \"Google Sheets\",\n apiBaseUrl: \"https://sheets.googleapis.com/v4\",\n defaultScopes: [\n \"https://www.googleapis.com/auth/spreadsheets.readonly\",\n \"https://www.googleapis.com/auth/spreadsheets\",\n ],\n};\n\n/**\n * Google Drive OAuth configuration\n */\nexport const driveConfig: OAuthServiceConfig = {\n ...googleBase,\n serviceId: \"drive\",\n displayName: \"Google Drive\",\n apiBaseUrl: \"https://www.googleapis.com/drive/v3\",\n defaultScopes: [\n \"https://www.googleapis.com/auth/drive.readonly\",\n \"https://www.googleapis.com/auth/drive.file\",\n ],\n};\n\n/**\n * All Google service configurations\n */\nexport const googleServices = {\n gmail: gmailConfig,\n calendar: calendarConfig,\n sheets: sheetsConfig,\n drive: driveConfig,\n} as const;\n", "/**\n * Microsoft OAuth Provider\n *\n * Pre-configured OAuth for Microsoft services: Outlook, Teams, SharePoint, OneDrive\n */\n\nimport type { OAuthServiceConfig } from \"../types.ts\";\n\n/**\n * Base Microsoft OAuth configuration\n */\nconst microsoftBase = {\n providerId: \"microsoft\",\n displayName: \"Microsoft\",\n authorizationUrl: \"https://login.microsoftonline.com/common/oauth2/v2.0/authorize\",\n tokenUrl: \"https://login.microsoftonline.com/common/oauth2/v2.0/token\",\n userInfoUrl: \"https://graph.microsoft.com/v1.0/me\",\n clientIdEnvVar: \"MICROSOFT_CLIENT_ID\",\n clientSecretEnvVar: \"MICROSOFT_CLIENT_SECRET\",\n additionalAuthParams: {\n response_mode: \"query\",\n },\n};\n\n/**\n * Microsoft Outlook OAuth configuration\n */\nexport const outlookConfig: OAuthServiceConfig = {\n ...microsoftBase,\n serviceId: \"outlook\",\n displayName: \"Outlook\",\n apiBaseUrl: \"https://graph.microsoft.com/v1.0\",\n defaultScopes: [\n \"Mail.Read\",\n \"Mail.Send\",\n \"Mail.ReadWrite\",\n \"Calendars.Read\",\n \"Calendars.ReadWrite\",\n \"User.Read\",\n \"offline_access\",\n ],\n};\n\n/**\n * Microsoft Teams OAuth configuration\n */\nexport const teamsConfig: OAuthServiceConfig = {\n ...microsoftBase,\n serviceId: \"teams\",\n displayName: \"Microsoft Teams\",\n apiBaseUrl: \"https://graph.microsoft.com/v1.0\",\n defaultScopes: [\n \"Team.ReadBasic.All\",\n \"Channel.ReadBasic.All\",\n \"Chat.Read\",\n \"Chat.ReadWrite\",\n \"ChannelMessage.Read.All\",\n \"User.Read\",\n \"offline_access\",\n ],\n};\n\n/**\n * Microsoft SharePoint OAuth configuration\n */\nexport const sharePointConfig: OAuthServiceConfig = {\n ...microsoftBase,\n serviceId: \"sharepoint\",\n displayName: \"SharePoint\",\n apiBaseUrl: \"https://graph.microsoft.com/v1.0\",\n defaultScopes: [\n \"Sites.Read.All\",\n \"Sites.ReadWrite.All\",\n \"Files.Read.All\",\n \"Files.ReadWrite.All\",\n \"User.Read\",\n \"offline_access\",\n ],\n};\n\n/**\n * Microsoft OneDrive OAuth configuration\n */\nexport const oneDriveConfig: OAuthServiceConfig = {\n ...microsoftBase,\n serviceId: \"onedrive\",\n displayName: \"OneDrive\",\n apiBaseUrl: \"https://graph.microsoft.com/v1.0\",\n defaultScopes: [\n \"Files.Read\",\n \"Files.ReadWrite\",\n \"Files.Read.All\",\n \"Files.ReadWrite.All\",\n \"User.Read\",\n \"offline_access\",\n ],\n};\n\n/**\n * All Microsoft service configurations\n */\nexport const microsoftServices = {\n outlook: outlookConfig,\n teams: teamsConfig,\n sharepoint: sharePointConfig,\n onedrive: oneDriveConfig,\n} as const;\n", "/**\n * Atlassian OAuth Provider\n *\n * Pre-configured OAuth for Atlassian services: Jira, Confluence\n */\n\nimport type { OAuthServiceConfig } from \"../types.ts\";\n\n/**\n * Base Atlassian OAuth configuration\n */\nconst atlassianBase = {\n providerId: \"atlassian\",\n displayName: \"Atlassian\",\n authorizationUrl: \"https://auth.atlassian.com/authorize\",\n tokenUrl: \"https://auth.atlassian.com/oauth/token\",\n userInfoUrl: \"https://api.atlassian.com/me\",\n clientIdEnvVar: \"ATLASSIAN_CLIENT_ID\",\n clientSecretEnvVar: \"ATLASSIAN_CLIENT_SECRET\",\n additionalAuthParams: {\n audience: \"api.atlassian.com\",\n prompt: \"consent\",\n },\n};\n\n/**\n * Jira OAuth configuration\n */\nexport const jiraConfig: OAuthServiceConfig = {\n ...atlassianBase,\n serviceId: \"jira\",\n displayName: \"Jira\",\n apiBaseUrl: \"https://api.atlassian.com/ex/jira\",\n defaultScopes: [\n \"read:jira-work\",\n \"write:jira-work\",\n \"read:jira-user\",\n \"offline_access\",\n ],\n};\n\n/**\n * Confluence OAuth configuration\n */\nexport const confluenceConfig: OAuthServiceConfig = {\n ...atlassianBase,\n serviceId: \"confluence\",\n displayName: \"Confluence\",\n apiBaseUrl: \"https://api.atlassian.com/ex/confluence\",\n defaultScopes: [\n \"read:confluence-content.all\",\n \"write:confluence-content\",\n \"read:confluence-space.summary\",\n \"read:confluence-user\",\n \"offline_access\",\n ],\n};\n\n/**\n * Bitbucket OAuth configuration (also Atlassian)\n */\nexport const bitbucketConfig: OAuthServiceConfig = {\n ...atlassianBase,\n serviceId: \"bitbucket\",\n displayName: \"Bitbucket\",\n // Bitbucket has its own OAuth endpoints\n authorizationUrl: \"https://bitbucket.org/site/oauth2/authorize\",\n tokenUrl: \"https://bitbucket.org/site/oauth2/access_token\",\n clientIdEnvVar: \"BITBUCKET_CLIENT_ID\",\n clientSecretEnvVar: \"BITBUCKET_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.bitbucket.org/2.0\",\n additionalAuthParams: {},\n defaultScopes: [\n \"repository\",\n \"repository:write\",\n \"pullrequest\",\n \"pullrequest:write\",\n \"account\",\n ],\n};\n\n/**\n * All Atlassian service configurations\n */\nexport const atlassianServices = {\n jira: jiraConfig,\n confluence: confluenceConfig,\n bitbucket: bitbucketConfig,\n} as const;\n", "/**\n * Common OAuth Providers\n *\n * Pre-configured OAuth service configurations for popular SaaS providers.\n */\n\nimport type { OAuthServiceConfig } from \"../types.ts\";\n\n/**\n * GitHub OAuth configuration\n */\nexport const githubConfig: OAuthServiceConfig = {\n providerId: \"github\",\n serviceId: \"github\",\n displayName: \"GitHub\",\n authorizationUrl: \"https://github.com/login/oauth/authorize\",\n tokenUrl: \"https://github.com/login/oauth/access_token\",\n clientIdEnvVar: \"GITHUB_CLIENT_ID\",\n clientSecretEnvVar: \"GITHUB_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.github.com\",\n defaultScopes: [\"repo\", \"user\"],\n additionalAuthParams: {},\n};\n\n/**\n * Slack OAuth configuration\n */\nexport const slackConfig: OAuthServiceConfig = {\n providerId: \"slack\",\n serviceId: \"slack\",\n displayName: \"Slack\",\n authorizationUrl: \"https://slack.com/oauth/v2/authorize\",\n tokenUrl: \"https://slack.com/api/oauth.v2.access\",\n clientIdEnvVar: \"SLACK_CLIENT_ID\",\n clientSecretEnvVar: \"SLACK_CLIENT_SECRET\",\n apiBaseUrl: \"https://slack.com/api\",\n defaultScopes: [\"channels:read\", \"chat:write\", \"users:read\"],\n additionalAuthParams: {},\n};\n\n/**\n * Notion OAuth configuration\n */\nexport const notionConfig: OAuthServiceConfig = {\n providerId: \"notion\",\n serviceId: \"notion\",\n displayName: \"Notion\",\n authorizationUrl: \"https://api.notion.com/v1/oauth/authorize\",\n tokenUrl: \"https://api.notion.com/v1/oauth/token\",\n clientIdEnvVar: \"NOTION_CLIENT_ID\",\n clientSecretEnvVar: \"NOTION_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.notion.com/v1\",\n defaultScopes: [],\n useBasicAuth: true,\n additionalAuthParams: {\n owner: \"user\",\n },\n};\n\n/**\n * Figma OAuth configuration\n */\nexport const figmaConfig: OAuthServiceConfig = {\n providerId: \"figma\",\n serviceId: \"figma\",\n displayName: \"Figma\",\n authorizationUrl: \"https://www.figma.com/oauth\",\n tokenUrl: \"https://www.figma.com/api/oauth/token\",\n clientIdEnvVar: \"FIGMA_CLIENT_ID\",\n clientSecretEnvVar: \"FIGMA_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.figma.com/v1\",\n defaultScopes: [\"file_read\"],\n additionalAuthParams: {},\n};\n\n/**\n * Discord OAuth configuration\n */\nexport const discordConfig: OAuthServiceConfig = {\n providerId: \"discord\",\n serviceId: \"discord\",\n displayName: \"Discord\",\n authorizationUrl: \"https://discord.com/api/oauth2/authorize\",\n tokenUrl: \"https://discord.com/api/oauth2/token\",\n clientIdEnvVar: \"DISCORD_CLIENT_ID\",\n clientSecretEnvVar: \"DISCORD_CLIENT_SECRET\",\n apiBaseUrl: \"https://discord.com/api/v10\",\n defaultScopes: [\"identify\", \"guilds\"],\n additionalAuthParams: {},\n};\n\n/**\n * Linear OAuth configuration\n */\nexport const linearConfig: OAuthServiceConfig = {\n providerId: \"linear\",\n serviceId: \"linear\",\n displayName: \"Linear\",\n authorizationUrl: \"https://linear.app/oauth/authorize\",\n tokenUrl: \"https://api.linear.app/oauth/token\",\n clientIdEnvVar: \"LINEAR_CLIENT_ID\",\n clientSecretEnvVar: \"LINEAR_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.linear.app\",\n defaultScopes: [\"read\", \"write\"],\n additionalAuthParams: {},\n};\n\n/**\n * GitLab OAuth configuration\n */\nexport const gitlabConfig: OAuthServiceConfig = {\n providerId: \"gitlab\",\n serviceId: \"gitlab\",\n displayName: \"GitLab\",\n authorizationUrl: \"https://gitlab.com/oauth/authorize\",\n tokenUrl: \"https://gitlab.com/oauth/token\",\n clientIdEnvVar: \"GITLAB_CLIENT_ID\",\n clientSecretEnvVar: \"GITLAB_CLIENT_SECRET\",\n apiBaseUrl: \"https://gitlab.com/api/v4\",\n defaultScopes: [\"read_user\", \"api\"],\n additionalAuthParams: {},\n};\n\n/**\n * Airtable OAuth configuration\n */\nexport const airtableConfig: OAuthServiceConfig = {\n providerId: \"airtable\",\n serviceId: \"airtable\",\n displayName: \"Airtable\",\n authorizationUrl: \"https://airtable.com/oauth2/v1/authorize\",\n tokenUrl: \"https://airtable.com/oauth2/v1/token\",\n clientIdEnvVar: \"AIRTABLE_CLIENT_ID\",\n clientSecretEnvVar: \"AIRTABLE_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.airtable.com/v0\",\n defaultScopes: [\"data.records:read\", \"data.records:write\", \"schema.bases:read\"],\n useBasicAuth: true,\n additionalAuthParams: {},\n};\n\n/**\n * Dropbox OAuth configuration\n */\nexport const dropboxConfig: OAuthServiceConfig = {\n providerId: \"dropbox\",\n serviceId: \"dropbox\",\n displayName: \"Dropbox\",\n authorizationUrl: \"https://www.dropbox.com/oauth2/authorize\",\n tokenUrl: \"https://api.dropbox.com/oauth2/token\",\n clientIdEnvVar: \"DROPBOX_CLIENT_ID\",\n clientSecretEnvVar: \"DROPBOX_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.dropboxapi.com/2\",\n defaultScopes: [],\n additionalAuthParams: {\n token_access_type: \"offline\",\n },\n};\n\n/**\n * HubSpot OAuth configuration\n */\nexport const hubspotConfig: OAuthServiceConfig = {\n providerId: \"hubspot\",\n serviceId: \"hubspot\",\n displayName: \"HubSpot\",\n authorizationUrl: \"https://app.hubspot.com/oauth/authorize\",\n tokenUrl: \"https://api.hubapi.com/oauth/v1/token\",\n clientIdEnvVar: \"HUBSPOT_CLIENT_ID\",\n clientSecretEnvVar: \"HUBSPOT_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.hubapi.com\",\n defaultScopes: [\"crm.objects.contacts.read\", \"crm.objects.contacts.write\"],\n additionalAuthParams: {},\n};\n\n/**\n * Salesforce OAuth configuration\n */\nexport const salesforceConfig: OAuthServiceConfig = {\n providerId: \"salesforce\",\n serviceId: \"salesforce\",\n displayName: \"Salesforce\",\n authorizationUrl: \"https://login.salesforce.com/services/oauth2/authorize\",\n tokenUrl: \"https://login.salesforce.com/services/oauth2/token\",\n clientIdEnvVar: \"SALESFORCE_CLIENT_ID\",\n clientSecretEnvVar: \"SALESFORCE_CLIENT_SECRET\",\n apiBaseUrl: \"https://login.salesforce.com/services/data/v59.0\",\n defaultScopes: [\"api\", \"refresh_token\"],\n additionalAuthParams: {},\n};\n\n/**\n * Twitter/X OAuth configuration\n */\nexport const twitterConfig: OAuthServiceConfig = {\n providerId: \"twitter\",\n serviceId: \"twitter\",\n displayName: \"Twitter/X\",\n authorizationUrl: \"https://twitter.com/i/oauth2/authorize\",\n tokenUrl: \"https://api.twitter.com/2/oauth2/token\",\n clientIdEnvVar: \"TWITTER_CLIENT_ID\",\n clientSecretEnvVar: \"TWITTER_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.twitter.com/2\",\n defaultScopes: [\"tweet.read\", \"users.read\", \"offline.access\"],\n useBasicAuth: true,\n additionalAuthParams: {},\n};\n\n/**\n * Asana OAuth configuration\n */\nexport const asanaConfig: OAuthServiceConfig = {\n providerId: \"asana\",\n serviceId: \"asana\",\n displayName: \"Asana\",\n authorizationUrl: \"https://app.asana.com/-/oauth_authorize\",\n tokenUrl: \"https://app.asana.com/-/oauth_token\",\n clientIdEnvVar: \"ASANA_CLIENT_ID\",\n clientSecretEnvVar: \"ASANA_CLIENT_SECRET\",\n apiBaseUrl: \"https://app.asana.com/api/1.0\",\n defaultScopes: [\"default\"],\n additionalAuthParams: {},\n};\n\n/**\n * Monday.com OAuth configuration\n */\nexport const mondayConfig: OAuthServiceConfig = {\n providerId: \"monday\",\n serviceId: \"monday\",\n displayName: \"Monday.com\",\n authorizationUrl: \"https://auth.monday.com/oauth2/authorize\",\n tokenUrl: \"https://auth.monday.com/oauth2/token\",\n clientIdEnvVar: \"MONDAY_CLIENT_ID\",\n clientSecretEnvVar: \"MONDAY_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.monday.com/v2\",\n defaultScopes: [\"me:read\", \"boards:read\", \"boards:write\"],\n additionalAuthParams: {},\n};\n\n/**\n * Zoom OAuth configuration\n */\nexport const zoomConfig: OAuthServiceConfig = {\n providerId: \"zoom\",\n serviceId: \"zoom\",\n displayName: \"Zoom\",\n authorizationUrl: \"https://zoom.us/oauth/authorize\",\n tokenUrl: \"https://zoom.us/oauth/token\",\n clientIdEnvVar: \"ZOOM_CLIENT_ID\",\n clientSecretEnvVar: \"ZOOM_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.zoom.us/v2\",\n defaultScopes: [\"meeting:read\", \"meeting:write\", \"user:read\"],\n useBasicAuth: true,\n additionalAuthParams: {},\n};\n\n/**\n * Intercom OAuth configuration\n */\nexport const intercomConfig: OAuthServiceConfig = {\n providerId: \"intercom\",\n serviceId: \"intercom\",\n displayName: \"Intercom\",\n authorizationUrl: \"https://app.intercom.com/oauth\",\n tokenUrl: \"https://api.intercom.io/auth/eagle/token\",\n clientIdEnvVar: \"INTERCOM_CLIENT_ID\",\n clientSecretEnvVar: \"INTERCOM_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.intercom.io\",\n defaultScopes: [],\n additionalAuthParams: {},\n};\n\n/**\n * Freshdesk OAuth configuration\n */\nexport const freshdeskConfig: OAuthServiceConfig = {\n providerId: \"freshdesk\",\n serviceId: \"freshdesk\",\n displayName: \"Freshdesk\",\n authorizationUrl: \"https://accounts.freshworks.com/authorize\",\n tokenUrl: \"https://accounts.freshworks.com/oauth/token\",\n clientIdEnvVar: \"FRESHDESK_CLIENT_ID\",\n clientSecretEnvVar: \"FRESHDESK_CLIENT_SECRET\",\n apiBaseUrl: \"https://domain.freshdesk.com/api/v2\",\n defaultScopes: [\"freshdesk\"],\n additionalAuthParams: {},\n};\n\n/**\n * Mailchimp OAuth configuration\n */\nexport const mailchimpConfig: OAuthServiceConfig = {\n providerId: \"mailchimp\",\n serviceId: \"mailchimp\",\n displayName: \"Mailchimp\",\n authorizationUrl: \"https://login.mailchimp.com/oauth2/authorize\",\n tokenUrl: \"https://login.mailchimp.com/oauth2/token\",\n clientIdEnvVar: \"MAILCHIMP_CLIENT_ID\",\n clientSecretEnvVar: \"MAILCHIMP_CLIENT_SECRET\",\n apiBaseUrl: \"https://server.api.mailchimp.com/3.0\",\n defaultScopes: [],\n additionalAuthParams: {},\n};\n\n/**\n * Shopify OAuth configuration\n */\nexport const shopifyConfig: OAuthServiceConfig = {\n providerId: \"shopify\",\n serviceId: \"shopify\",\n displayName: \"Shopify\",\n authorizationUrl: \"https://shop.myshopify.com/admin/oauth/authorize\",\n tokenUrl: \"https://shop.myshopify.com/admin/oauth/access_token\",\n clientIdEnvVar: \"SHOPIFY_CLIENT_ID\",\n clientSecretEnvVar: \"SHOPIFY_CLIENT_SECRET\",\n apiBaseUrl: \"https://shop.myshopify.com/admin/api/2024-01\",\n defaultScopes: [\"read_products\", \"write_products\", \"read_orders\"],\n additionalAuthParams: {},\n};\n\n/**\n * QuickBooks OAuth configuration\n */\nexport const quickbooksConfig: OAuthServiceConfig = {\n providerId: \"quickbooks\",\n serviceId: \"quickbooks\",\n displayName: \"QuickBooks\",\n authorizationUrl: \"https://appcenter.intuit.com/connect/oauth2\",\n tokenUrl: \"https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer\",\n clientIdEnvVar: \"QUICKBOOKS_CLIENT_ID\",\n clientSecretEnvVar: \"QUICKBOOKS_CLIENT_SECRET\",\n apiBaseUrl: \"https://quickbooks.api.intuit.com/v3\",\n defaultScopes: [\"com.intuit.quickbooks.accounting\"],\n additionalAuthParams: {},\n};\n\n/**\n * Xero OAuth configuration\n */\nexport const xeroConfig: OAuthServiceConfig = {\n providerId: \"xero\",\n serviceId: \"xero\",\n displayName: \"Xero\",\n authorizationUrl: \"https://login.xero.com/identity/connect/authorize\",\n tokenUrl: \"https://identity.xero.com/connect/token\",\n clientIdEnvVar: \"XERO_CLIENT_ID\",\n clientSecretEnvVar: \"XERO_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.xero.com/api.xro/2.0\",\n defaultScopes: [\"openid\", \"profile\", \"email\", \"accounting.transactions\", \"offline_access\"],\n additionalAuthParams: {},\n};\n\n/**\n * Box OAuth configuration\n */\nexport const boxConfig: OAuthServiceConfig = {\n providerId: \"box\",\n serviceId: \"box\",\n displayName: \"Box\",\n authorizationUrl: \"https://account.box.com/api/oauth2/authorize\",\n tokenUrl: \"https://api.box.com/oauth2/token\",\n clientIdEnvVar: \"BOX_CLIENT_ID\",\n clientSecretEnvVar: \"BOX_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.box.com/2.0\",\n defaultScopes: [],\n additionalAuthParams: {},\n};\n\n/**\n * Webex OAuth configuration\n */\nexport const webexConfig: OAuthServiceConfig = {\n providerId: \"webex\",\n serviceId: \"webex\",\n displayName: \"Webex\",\n authorizationUrl: \"https://webexapis.com/v1/authorize\",\n tokenUrl: \"https://webexapis.com/v1/access_token\",\n clientIdEnvVar: \"WEBEX_CLIENT_ID\",\n clientSecretEnvVar: \"WEBEX_CLIENT_SECRET\",\n apiBaseUrl: \"https://webexapis.com/v1\",\n defaultScopes: [\"spark:all\", \"spark:kms\"],\n additionalAuthParams: {},\n};\n\n/**\n * Trello OAuth configuration\n */\nexport const trelloConfig: OAuthServiceConfig = {\n providerId: \"trello\",\n serviceId: \"trello\",\n displayName: \"Trello\",\n authorizationUrl: \"https://trello.com/1/authorize\",\n tokenUrl: \"https://trello.com/1/OAuthGetAccessToken\",\n clientIdEnvVar: \"TRELLO_CLIENT_ID\",\n clientSecretEnvVar: \"TRELLO_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.trello.com/1\",\n defaultScopes: [\"read\", \"write\"],\n additionalAuthParams: {\n expiration: \"never\",\n },\n};\n\n/**\n * Clickup OAuth configuration\n */\nexport const clickupConfig: OAuthServiceConfig = {\n providerId: \"clickup\",\n serviceId: \"clickup\",\n displayName: \"ClickUp\",\n authorizationUrl: \"https://app.clickup.com/api\",\n tokenUrl: \"https://api.clickup.com/api/v2/oauth/token\",\n clientIdEnvVar: \"CLICKUP_CLIENT_ID\",\n clientSecretEnvVar: \"CLICKUP_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.clickup.com/api/v2\",\n defaultScopes: [],\n additionalAuthParams: {},\n};\n\n/**\n * Pipedrive OAuth configuration\n */\nexport const pipedriveConfig: OAuthServiceConfig = {\n providerId: \"pipedrive\",\n serviceId: \"pipedrive\",\n displayName: \"Pipedrive\",\n authorizationUrl: \"https://oauth.pipedrive.com/oauth/authorize\",\n tokenUrl: \"https://oauth.pipedrive.com/oauth/token\",\n clientIdEnvVar: \"PIPEDRIVE_CLIENT_ID\",\n clientSecretEnvVar: \"PIPEDRIVE_CLIENT_SECRET\",\n apiBaseUrl: \"https://api.pipedrive.com/v1\",\n defaultScopes: [],\n additionalAuthParams: {},\n};\n\n/**\n * Export grouped services for convenience\n */\nexport const commonServices = {\n github: githubConfig,\n slack: slackConfig,\n notion: notionConfig,\n figma: figmaConfig,\n discord: discordConfig,\n linear: linearConfig,\n gitlab: gitlabConfig,\n airtable: airtableConfig,\n dropbox: dropboxConfig,\n hubspot: hubspotConfig,\n salesforce: salesforceConfig,\n twitter: twitterConfig,\n asana: asanaConfig,\n monday: mondayConfig,\n zoom: zoomConfig,\n intercom: intercomConfig,\n freshdesk: freshdeskConfig,\n mailchimp: mailchimpConfig,\n shopify: shopifyConfig,\n quickbooks: quickbooksConfig,\n xero: xeroConfig,\n box: boxConfig,\n webex: webexConfig,\n trello: trelloConfig,\n clickup: clickupConfig,\n pipedrive: pipedriveConfig,\n};\n"],
|
|
5
|
+
"mappings": ";AAAO,IAAM,SAAS,OAAO,SAAS;AAC/B,IAAM,SACX,OAAQ,WAA8D,YAAY,eACjF,WAA8D,SAAS,UAAU,SAChF;AACG,IAAM,QAAQ,OAAQ,WAAiC,QAAQ;AAC/D,IAAM,eAAe,OAAO,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oauth/token-store/memory.ts
|
|
2
|
+
var MemoryTokenStore = class {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.tokens = /* @__PURE__ */ new Map();
|
|
5
|
+
this.states = /* @__PURE__ */ new Map();
|
|
6
|
+
/** State expiration time in ms (10 minutes) */
|
|
7
|
+
this.stateExpirationMs = 10 * 60 * 1e3;
|
|
8
|
+
}
|
|
9
|
+
getTokens(serviceId) {
|
|
10
|
+
return Promise.resolve(this.tokens.get(serviceId) || null);
|
|
11
|
+
}
|
|
12
|
+
setTokens(serviceId, tokens) {
|
|
13
|
+
this.tokens.set(serviceId, tokens);
|
|
14
|
+
return Promise.resolve();
|
|
15
|
+
}
|
|
16
|
+
clearTokens(serviceId) {
|
|
17
|
+
this.tokens.delete(serviceId);
|
|
18
|
+
return Promise.resolve();
|
|
19
|
+
}
|
|
20
|
+
getState(state) {
|
|
21
|
+
const oauthState = this.states.get(state);
|
|
22
|
+
if (!oauthState) {
|
|
23
|
+
return Promise.resolve(null);
|
|
24
|
+
}
|
|
25
|
+
if (Date.now() - oauthState.createdAt > this.stateExpirationMs) {
|
|
26
|
+
this.states.delete(state);
|
|
27
|
+
return Promise.resolve(null);
|
|
28
|
+
}
|
|
29
|
+
return Promise.resolve(oauthState);
|
|
30
|
+
}
|
|
31
|
+
setState(oauthState) {
|
|
32
|
+
this.states.set(oauthState.state, oauthState);
|
|
33
|
+
this.cleanupExpiredStates();
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
clearState(state) {
|
|
37
|
+
this.states.delete(state);
|
|
38
|
+
return Promise.resolve();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Clean up expired states
|
|
42
|
+
*/
|
|
43
|
+
cleanupExpiredStates() {
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
for (const [state, oauthState] of this.states) {
|
|
46
|
+
if (now - oauthState.createdAt > this.stateExpirationMs) {
|
|
47
|
+
this.states.delete(state);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get all stored service IDs
|
|
53
|
+
*/
|
|
54
|
+
getConnectedServices() {
|
|
55
|
+
return Array.from(this.tokens.keys());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if a service is connected
|
|
59
|
+
*/
|
|
60
|
+
isConnected(serviceId) {
|
|
61
|
+
const tokens = this.tokens.get(serviceId);
|
|
62
|
+
if (!tokens)
|
|
63
|
+
return false;
|
|
64
|
+
if (tokens.expiresAt && Date.now() > tokens.expiresAt) {
|
|
65
|
+
return !!tokens.refreshToken;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Clear all tokens
|
|
71
|
+
*/
|
|
72
|
+
clearAll() {
|
|
73
|
+
this.tokens.clear();
|
|
74
|
+
this.states.clear();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var memoryTokenStore = new MemoryTokenStore();
|
|
78
|
+
export {
|
|
79
|
+
MemoryTokenStore,
|
|
80
|
+
memoryTokenStore
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=token-store.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core/oauth/token-store/memory.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * In-Memory Token Store\n *\n * Simple in-memory storage for OAuth tokens and state.\n * Suitable for development and single-instance deployments.\n */\n\nimport type { OAuthState, OAuthTokens, TokenStore } from \"../types.ts\";\n\n/**\n * In-memory token store implementation\n */\nexport class MemoryTokenStore implements TokenStore {\n private tokens: Map<string, OAuthTokens> = new Map();\n private states: Map<string, OAuthState> = new Map();\n\n /** State expiration time in ms (10 minutes) */\n private stateExpirationMs = 10 * 60 * 1000;\n\n getTokens(serviceId: string): Promise<OAuthTokens | null> {\n return Promise.resolve(this.tokens.get(serviceId) || null);\n }\n\n setTokens(serviceId: string, tokens: OAuthTokens): Promise<void> {\n this.tokens.set(serviceId, tokens);\n return Promise.resolve();\n }\n\n clearTokens(serviceId: string): Promise<void> {\n this.tokens.delete(serviceId);\n return Promise.resolve();\n }\n\n getState(state: string): Promise<OAuthState | null> {\n const oauthState = this.states.get(state);\n if (!oauthState) {\n return Promise.resolve(null);\n }\n\n // Check if state has expired\n if (Date.now() - oauthState.createdAt > this.stateExpirationMs) {\n this.states.delete(state);\n return Promise.resolve(null);\n }\n\n return Promise.resolve(oauthState);\n }\n\n setState(oauthState: OAuthState): Promise<void> {\n this.states.set(oauthState.state, oauthState);\n this.cleanupExpiredStates();\n return Promise.resolve();\n }\n\n clearState(state: string): Promise<void> {\n this.states.delete(state);\n return Promise.resolve();\n }\n\n /**\n * Clean up expired states\n */\n private cleanupExpiredStates(): void {\n const now = Date.now();\n for (const [state, oauthState] of this.states) {\n if (now - oauthState.createdAt > this.stateExpirationMs) {\n this.states.delete(state);\n }\n }\n }\n\n /**\n * Get all stored service IDs\n */\n getConnectedServices(): string[] {\n return Array.from(this.tokens.keys());\n }\n\n /**\n * Check if a service is connected\n */\n isConnected(serviceId: string): boolean {\n const tokens = this.tokens.get(serviceId);\n if (!tokens) return false;\n\n // Check if token is expired\n if (tokens.expiresAt && Date.now() > tokens.expiresAt) {\n // Token expired, but might be refreshable\n return !!tokens.refreshToken;\n }\n\n return true;\n }\n\n /**\n * Clear all tokens\n */\n clearAll(): void {\n this.tokens.clear();\n this.states.clear();\n }\n}\n\n/**\n * Default in-memory token store instance\n */\nexport const memoryTokenStore = new MemoryTokenStore();\n"],
|
|
5
|
+
"mappings": ";AAYO,IAAM,mBAAN,MAA6C;AAAA,EAA7C;AACL,SAAQ,SAAmC,oBAAI,IAAI;AACnD,SAAQ,SAAkC,oBAAI,IAAI;AAGlD;AAAA,SAAQ,oBAAoB,KAAK,KAAK;AAAA;AAAA,EAEtC,UAAU,WAAgD;AACxD,WAAO,QAAQ,QAAQ,KAAK,OAAO,IAAI,SAAS,KAA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Aa,KAAK,IAAI,IAAI,OAAO,WAAW;AAErD,aAAO,CAAC,CAAC,OAAO;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,WAAiB;AACf,SAAK,OAAO,MAAM;AAClB,SAAK,OAAO,MAAM;AAAA,EACpB;AACF;AAKO,IAAM,mBAAmB,IAAI,iBAAiB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.51",
|
|
4
4
|
"description": "Zero-config React meta-framework for building agentic AI applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -53,6 +53,30 @@
|
|
|
53
53
|
"./ai/dev": {
|
|
54
54
|
"types": "./dist/ai/dev.d.ts",
|
|
55
55
|
"import": "./dist/ai/dev.js"
|
|
56
|
+
},
|
|
57
|
+
"./ai/workflow": {
|
|
58
|
+
"types": "./dist/ai/workflow.d.ts",
|
|
59
|
+
"import": "./dist/ai/workflow.js"
|
|
60
|
+
},
|
|
61
|
+
"./ai/workflow/react": {
|
|
62
|
+
"types": "./dist/ai/workflow-react.d.ts",
|
|
63
|
+
"import": "./dist/ai/workflow-react.js"
|
|
64
|
+
},
|
|
65
|
+
"./oauth": {
|
|
66
|
+
"types": "./dist/oauth/index.d.ts",
|
|
67
|
+
"import": "./dist/oauth/index.js"
|
|
68
|
+
},
|
|
69
|
+
"./oauth/providers": {
|
|
70
|
+
"types": "./dist/oauth/providers.d.ts",
|
|
71
|
+
"import": "./dist/oauth/providers.js"
|
|
72
|
+
},
|
|
73
|
+
"./oauth/handlers": {
|
|
74
|
+
"types": "./dist/oauth/handlers.d.ts",
|
|
75
|
+
"import": "./dist/oauth/handlers.js"
|
|
76
|
+
},
|
|
77
|
+
"./oauth/token-store": {
|
|
78
|
+
"types": "./dist/oauth/token-store.d.ts",
|
|
79
|
+
"import": "./dist/oauth/token-store.js"
|
|
56
80
|
}
|
|
57
81
|
},
|
|
58
82
|
"files": [
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAuth Token Store
|
|
3
|
-
*
|
|
4
|
-
* Simple in-memory token store for development.
|
|
5
|
-
* Replace with a database or KV store for production.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface OAuthToken {
|
|
9
|
-
accessToken: string;
|
|
10
|
-
refreshToken?: string;
|
|
11
|
-
expiresAt?: number;
|
|
12
|
-
tokenType?: string;
|
|
13
|
-
scope?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface TokenStore {
|
|
17
|
-
getToken(userId: string, service: string): Promise<OAuthToken | null>;
|
|
18
|
-
setToken(userId: string, service: string, token: OAuthToken): Promise<void>;
|
|
19
|
-
revokeToken(userId: string, service: string): Promise<void>;
|
|
20
|
-
isConnected(userId: string, service: string): Promise<boolean>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// In-memory storage for development
|
|
24
|
-
// Use globalThis to share across esbuild bundles (each API route is bundled separately)
|
|
25
|
-
const TOKENS_KEY = "__veryfront_oauth_tokens__";
|
|
26
|
-
// deno-lint-ignore no-explicit-any
|
|
27
|
-
const globalStore = globalThis as any;
|
|
28
|
-
const tokens: Map<string, OAuthToken> = globalStore[TOKENS_KEY] ||= new Map<string, OAuthToken>();
|
|
29
|
-
|
|
30
|
-
function getKey(userId: string, service: string): string {
|
|
31
|
-
return `${userId}:${service}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Simple in-memory token store
|
|
36
|
-
*
|
|
37
|
-
* NOTE: This is for development only. In production, use:
|
|
38
|
-
* - Database (Postgres, SQLite, etc.)
|
|
39
|
-
* - KV store (Cloudflare Workers KV, Vercel KV, etc.)
|
|
40
|
-
* - Encrypted file storage
|
|
41
|
-
*/
|
|
42
|
-
export const tokenStore: TokenStore = {
|
|
43
|
-
getToken(userId: string, service: string): Promise<OAuthToken | null> {
|
|
44
|
-
const key = getKey(userId, service);
|
|
45
|
-
return Promise.resolve(tokens.get(key) || null);
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
setToken(
|
|
49
|
-
userId: string,
|
|
50
|
-
service: string,
|
|
51
|
-
token: OAuthToken,
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
const key = getKey(userId, service);
|
|
54
|
-
tokens.set(key, token);
|
|
55
|
-
return Promise.resolve();
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
revokeToken(userId: string, service: string): Promise<void> {
|
|
59
|
-
const key = getKey(userId, service);
|
|
60
|
-
tokens.delete(key);
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
async isConnected(userId: string, service: string): Promise<boolean> {
|
|
65
|
-
const token = await this.getToken(userId, service);
|
|
66
|
-
if (!token) return false;
|
|
67
|
-
// Check if token is not expired (if no expiry, token doesn't expire)
|
|
68
|
-
return !token.expiresAt || token.expiresAt > Date.now();
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Factory function to create a custom token store
|
|
74
|
-
*/
|
|
75
|
-
export function createTokenStore(options: {
|
|
76
|
-
get: (key: string) => Promise<string | null>;
|
|
77
|
-
set: (key: string, value: string) => Promise<void>;
|
|
78
|
-
delete: (key: string) => Promise<void>;
|
|
79
|
-
}): TokenStore {
|
|
80
|
-
return {
|
|
81
|
-
async getToken(userId: string, service: string): Promise<OAuthToken | null> {
|
|
82
|
-
const key = getKey(userId, service);
|
|
83
|
-
const data = await options.get(key);
|
|
84
|
-
if (!data) return null;
|
|
85
|
-
try {
|
|
86
|
-
return JSON.parse(data) as OAuthToken;
|
|
87
|
-
} catch {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
async setToken(
|
|
93
|
-
userId: string,
|
|
94
|
-
service: string,
|
|
95
|
-
token: OAuthToken,
|
|
96
|
-
): Promise<void> {
|
|
97
|
-
const key = getKey(userId, service);
|
|
98
|
-
await options.set(key, JSON.stringify(token));
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
async revokeToken(userId: string, service: string): Promise<void> {
|
|
102
|
-
const key = getKey(userId, service);
|
|
103
|
-
await options.delete(key);
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
async isConnected(userId: string, service: string): Promise<boolean> {
|
|
107
|
-
const token = await this.getToken(userId, service);
|
|
108
|
-
if (!token) return false;
|
|
109
|
-
// Check if token is not expired (if no expiry, token doesn't expire)
|
|
110
|
-
return !token.expiresAt || token.expiresAt > Date.now();
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAuth Token Store
|
|
3
|
-
*
|
|
4
|
-
* Simple in-memory token store for development.
|
|
5
|
-
* Replace with a database or KV store for production.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export interface OAuthToken {
|
|
9
|
-
accessToken: string;
|
|
10
|
-
refreshToken?: string;
|
|
11
|
-
expiresAt?: number;
|
|
12
|
-
tokenType?: string;
|
|
13
|
-
scope?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface TokenStore {
|
|
17
|
-
getToken(userId: string, service: string): Promise<OAuthToken | null>;
|
|
18
|
-
setToken(userId: string, service: string, token: OAuthToken): Promise<void>;
|
|
19
|
-
revokeToken(userId: string, service: string): Promise<void>;
|
|
20
|
-
isConnected(userId: string, service: string): Promise<boolean>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// In-memory storage for development
|
|
24
|
-
// Use globalThis to share across esbuild bundles (each API route is bundled separately)
|
|
25
|
-
const TOKENS_KEY = "__veryfront_oauth_tokens__";
|
|
26
|
-
// deno-lint-ignore no-explicit-any
|
|
27
|
-
const globalStore = globalThis as any;
|
|
28
|
-
const tokens: Map<string, OAuthToken> = globalStore[TOKENS_KEY] ||= new Map<string, OAuthToken>();
|
|
29
|
-
|
|
30
|
-
function getKey(userId: string, service: string): string {
|
|
31
|
-
return `${userId}:${service}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Simple in-memory token store
|
|
36
|
-
*
|
|
37
|
-
* NOTE: This is for development only. In production, use:
|
|
38
|
-
* - Database (Postgres, SQLite, etc.)
|
|
39
|
-
* - KV store (Cloudflare Workers KV, Vercel KV, etc.)
|
|
40
|
-
* - Encrypted file storage
|
|
41
|
-
*/
|
|
42
|
-
export const tokenStore: TokenStore = {
|
|
43
|
-
getToken(userId: string, service: string): Promise<OAuthToken | null> {
|
|
44
|
-
const key = getKey(userId, service);
|
|
45
|
-
return Promise.resolve(tokens.get(key) || null);
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
setToken(
|
|
49
|
-
userId: string,
|
|
50
|
-
service: string,
|
|
51
|
-
token: OAuthToken,
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
const key = getKey(userId, service);
|
|
54
|
-
tokens.set(key, token);
|
|
55
|
-
return Promise.resolve();
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
revokeToken(userId: string, service: string): Promise<void> {
|
|
59
|
-
const key = getKey(userId, service);
|
|
60
|
-
tokens.delete(key);
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
async isConnected(userId: string, service: string): Promise<boolean> {
|
|
65
|
-
const token = await this.getToken(userId, service);
|
|
66
|
-
if (!token) return false;
|
|
67
|
-
// Check if token is not expired (if no expiry, token doesn't expire)
|
|
68
|
-
return !token.expiresAt || token.expiresAt > Date.now();
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Factory function to create a custom token store
|
|
74
|
-
*/
|
|
75
|
-
export function createTokenStore(options: {
|
|
76
|
-
get: (key: string) => Promise<string | null>;
|
|
77
|
-
set: (key: string, value: string) => Promise<void>;
|
|
78
|
-
delete: (key: string) => Promise<void>;
|
|
79
|
-
}): TokenStore {
|
|
80
|
-
return {
|
|
81
|
-
async getToken(userId: string, service: string): Promise<OAuthToken | null> {
|
|
82
|
-
const key = getKey(userId, service);
|
|
83
|
-
const data = await options.get(key);
|
|
84
|
-
if (!data) return null;
|
|
85
|
-
try {
|
|
86
|
-
return JSON.parse(data) as OAuthToken;
|
|
87
|
-
} catch {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
async setToken(
|
|
93
|
-
userId: string,
|
|
94
|
-
service: string,
|
|
95
|
-
token: OAuthToken,
|
|
96
|
-
): Promise<void> {
|
|
97
|
-
const key = getKey(userId, service);
|
|
98
|
-
await options.set(key, JSON.stringify(token));
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
async revokeToken(userId: string, service: string): Promise<void> {
|
|
102
|
-
const key = getKey(userId, service);
|
|
103
|
-
await options.delete(key);
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
async isConnected(userId: string, service: string): Promise<boolean> {
|
|
107
|
-
const token = await this.getToken(userId, service);
|
|
108
|
-
if (!token) return false;
|
|
109
|
-
// Check if token is not expired (if no expiry, token doesn't expire)
|
|
110
|
-
return !token.expiresAt || token.expiresAt > Date.now();
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAuth Helper Functions
|
|
3
|
-
*
|
|
4
|
-
* Provides utilities for OAuth 2.0 authorization flows.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { type OAuthToken, tokenStore } from "./token-store.ts";
|
|
8
|
-
|
|
9
|
-
export interface OAuthProvider {
|
|
10
|
-
name: string;
|
|
11
|
-
authorizationUrl: string;
|
|
12
|
-
tokenUrl: string;
|
|
13
|
-
clientId: string;
|
|
14
|
-
clientSecret: string;
|
|
15
|
-
scopes: string[];
|
|
16
|
-
callbackPath: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Generate OAuth authorization URL
|
|
21
|
-
*/
|
|
22
|
-
export function getAuthorizationUrl(
|
|
23
|
-
provider: OAuthProvider,
|
|
24
|
-
state: string,
|
|
25
|
-
redirectUri: string,
|
|
26
|
-
): string {
|
|
27
|
-
const params = new URLSearchParams({
|
|
28
|
-
client_id: provider.clientId,
|
|
29
|
-
redirect_uri: redirectUri,
|
|
30
|
-
response_type: "code",
|
|
31
|
-
scope: provider.scopes.join(" "),
|
|
32
|
-
state,
|
|
33
|
-
access_type: "offline",
|
|
34
|
-
prompt: "consent",
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return `${provider.authorizationUrl}?${params.toString()}`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Exchange authorization code for tokens
|
|
42
|
-
*/
|
|
43
|
-
export async function exchangeCodeForTokens(
|
|
44
|
-
provider: OAuthProvider,
|
|
45
|
-
code: string,
|
|
46
|
-
redirectUri: string,
|
|
47
|
-
): Promise<OAuthToken> {
|
|
48
|
-
const response = await fetch(provider.tokenUrl, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
headers: {
|
|
51
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
52
|
-
},
|
|
53
|
-
body: new URLSearchParams({
|
|
54
|
-
client_id: provider.clientId,
|
|
55
|
-
client_secret: provider.clientSecret,
|
|
56
|
-
code,
|
|
57
|
-
grant_type: "authorization_code",
|
|
58
|
-
redirect_uri: redirectUri,
|
|
59
|
-
}),
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
if (!response.ok) {
|
|
63
|
-
const error = await response.text();
|
|
64
|
-
throw new Error(`Token exchange failed: ${response.status} - ${error}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const data = await response.json();
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
accessToken: data.access_token,
|
|
71
|
-
refreshToken: data.refresh_token,
|
|
72
|
-
expiresAt: data.expires_in ? Date.now() + (data.expires_in * 1000) : undefined,
|
|
73
|
-
tokenType: data.token_type || "Bearer",
|
|
74
|
-
scope: data.scope,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Refresh an expired access token
|
|
80
|
-
*/
|
|
81
|
-
export async function refreshAccessToken(
|
|
82
|
-
provider: OAuthProvider,
|
|
83
|
-
refreshToken: string,
|
|
84
|
-
): Promise<OAuthToken> {
|
|
85
|
-
const response = await fetch(provider.tokenUrl, {
|
|
86
|
-
method: "POST",
|
|
87
|
-
headers: {
|
|
88
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
89
|
-
},
|
|
90
|
-
body: new URLSearchParams({
|
|
91
|
-
client_id: provider.clientId,
|
|
92
|
-
client_secret: provider.clientSecret,
|
|
93
|
-
refresh_token: refreshToken,
|
|
94
|
-
grant_type: "refresh_token",
|
|
95
|
-
}),
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
if (!response.ok) {
|
|
99
|
-
const error = await response.text();
|
|
100
|
-
throw new Error(`Token refresh failed: ${response.status} - ${error}`);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const data = await response.json();
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
accessToken: data.access_token,
|
|
107
|
-
refreshToken: data.refresh_token || refreshToken,
|
|
108
|
-
expiresAt: data.expires_in ? Date.now() + (data.expires_in * 1000) : undefined,
|
|
109
|
-
tokenType: data.token_type || "Bearer",
|
|
110
|
-
scope: data.scope,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Get a valid access token, refreshing if necessary
|
|
116
|
-
*/
|
|
117
|
-
export async function getValidToken(
|
|
118
|
-
provider: OAuthProvider,
|
|
119
|
-
userId: string,
|
|
120
|
-
service: string,
|
|
121
|
-
): Promise<string | null> {
|
|
122
|
-
const token = await tokenStore.getToken(userId, service);
|
|
123
|
-
|
|
124
|
-
if (!token) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Check if token is expired (with 5 minute buffer)
|
|
129
|
-
// If no expiresAt, token doesn't expire (e.g., GitHub)
|
|
130
|
-
const isExpired = token.expiresAt ? token.expiresAt < Date.now() + 5 * 60 * 1000 : false;
|
|
131
|
-
|
|
132
|
-
if (isExpired && token.refreshToken) {
|
|
133
|
-
try {
|
|
134
|
-
const newToken = await refreshAccessToken(provider, token.refreshToken);
|
|
135
|
-
await tokenStore.setToken(userId, service, newToken);
|
|
136
|
-
return newToken.accessToken;
|
|
137
|
-
} catch {
|
|
138
|
-
// Refresh failed, user needs to re-authorize
|
|
139
|
-
await tokenStore.revokeToken(userId, service);
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return token.accessToken;
|
|
145
|
-
}
|