@mindstone/mcp-server-google-workspace 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +97 -0
- package/README.md +71 -0
- package/SECURITY.md +38 -0
- package/dist/__fixtures__/accounts.d.ts +47 -0
- package/dist/__fixtures__/accounts.d.ts.map +1 -0
- package/dist/__fixtures__/accounts.js +56 -0
- package/dist/__fixtures__/accounts.js.map +1 -0
- package/dist/api/handler.d.ts +16 -0
- package/dist/api/handler.d.ts.map +1 -0
- package/dist/api/handler.js +68 -0
- package/dist/api/handler.js.map +1 -0
- package/dist/api/request.d.ts +13 -0
- package/dist/api/request.d.ts.map +1 -0
- package/dist/api/request.js +111 -0
- package/dist/api/request.js.map +1 -0
- package/dist/api/validators/endpoint.d.ts +8 -0
- package/dist/api/validators/endpoint.d.ts.map +1 -0
- package/dist/api/validators/endpoint.js +115 -0
- package/dist/api/validators/endpoint.js.map +1 -0
- package/dist/api/validators/parameter.d.ts +12 -0
- package/dist/api/validators/parameter.d.ts.map +1 -0
- package/dist/api/validators/parameter.js +155 -0
- package/dist/api/validators/parameter.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/accounts/index.d.ts +12 -0
- package/dist/modules/accounts/index.d.ts.map +1 -0
- package/dist/modules/accounts/index.js +41 -0
- package/dist/modules/accounts/index.js.map +1 -0
- package/dist/modules/accounts/manager.d.ts +40 -0
- package/dist/modules/accounts/manager.d.ts.map +1 -0
- package/dist/modules/accounts/manager.js +359 -0
- package/dist/modules/accounts/manager.js.map +1 -0
- package/dist/modules/accounts/oauth.d.ts +36 -0
- package/dist/modules/accounts/oauth.d.ts.map +1 -0
- package/dist/modules/accounts/oauth.js +112 -0
- package/dist/modules/accounts/oauth.js.map +1 -0
- package/dist/modules/accounts/token.d.ts +32 -0
- package/dist/modules/accounts/token.d.ts.map +1 -0
- package/dist/modules/accounts/token.js +305 -0
- package/dist/modules/accounts/token.js.map +1 -0
- package/dist/modules/accounts/types.d.ts +47 -0
- package/dist/modules/accounts/types.d.ts.map +1 -0
- package/dist/modules/accounts/types.js +16 -0
- package/dist/modules/accounts/types.js.map +1 -0
- package/dist/modules/accounts/unauthorized.d.ts +3 -0
- package/dist/modules/accounts/unauthorized.d.ts.map +1 -0
- package/dist/modules/accounts/unauthorized.js +44 -0
- package/dist/modules/accounts/unauthorized.js.map +1 -0
- package/dist/modules/attachments/cleanup-service.d.ts +44 -0
- package/dist/modules/attachments/cleanup-service.d.ts.map +1 -0
- package/dist/modules/attachments/cleanup-service.js +118 -0
- package/dist/modules/attachments/cleanup-service.js.map +1 -0
- package/dist/modules/attachments/index-service.d.ts +57 -0
- package/dist/modules/attachments/index-service.d.ts.map +1 -0
- package/dist/modules/attachments/index-service.js +110 -0
- package/dist/modules/attachments/index-service.js.map +1 -0
- package/dist/modules/attachments/response-transformer.d.ts +28 -0
- package/dist/modules/attachments/response-transformer.d.ts.map +1 -0
- package/dist/modules/attachments/response-transformer.js +64 -0
- package/dist/modules/attachments/response-transformer.js.map +1 -0
- package/dist/modules/attachments/service.d.ts +47 -0
- package/dist/modules/attachments/service.d.ts.map +1 -0
- package/dist/modules/attachments/service.js +362 -0
- package/dist/modules/attachments/service.js.map +1 -0
- package/dist/modules/attachments/transformer.d.ts +28 -0
- package/dist/modules/attachments/transformer.d.ts.map +1 -0
- package/dist/modules/attachments/transformer.js +31 -0
- package/dist/modules/attachments/transformer.js.map +1 -0
- package/dist/modules/attachments/types.d.ts +33 -0
- package/dist/modules/attachments/types.d.ts.map +1 -0
- package/dist/modules/attachments/types.js +9 -0
- package/dist/modules/attachments/types.js.map +1 -0
- package/dist/modules/calendar/index.d.ts +48 -0
- package/dist/modules/calendar/index.d.ts.map +1 -0
- package/dist/modules/calendar/index.js +61 -0
- package/dist/modules/calendar/index.js.map +1 -0
- package/dist/modules/calendar/scopes.d.ts +17 -0
- package/dist/modules/calendar/scopes.d.ts.map +1 -0
- package/dist/modules/calendar/scopes.js +39 -0
- package/dist/modules/calendar/scopes.js.map +1 -0
- package/dist/modules/calendar/service.d.ts +75 -0
- package/dist/modules/calendar/service.d.ts.map +1 -0
- package/dist/modules/calendar/service.js +705 -0
- package/dist/modules/calendar/service.js.map +1 -0
- package/dist/modules/calendar/types.d.ts +154 -0
- package/dist/modules/calendar/types.d.ts.map +1 -0
- package/dist/modules/calendar/types.js +11 -0
- package/dist/modules/calendar/types.js.map +1 -0
- package/dist/modules/comments/index.d.ts +12 -0
- package/dist/modules/comments/index.d.ts.map +1 -0
- package/dist/modules/comments/index.js +23 -0
- package/dist/modules/comments/index.js.map +1 -0
- package/dist/modules/comments/service.d.ts +39 -0
- package/dist/modules/comments/service.d.ts.map +1 -0
- package/dist/modules/comments/service.js +227 -0
- package/dist/modules/comments/service.js.map +1 -0
- package/dist/modules/comments/types.d.ts +67 -0
- package/dist/modules/comments/types.d.ts.map +1 -0
- package/dist/modules/comments/types.js +2 -0
- package/dist/modules/comments/types.js.map +1 -0
- package/dist/modules/contacts/index.d.ts +12 -0
- package/dist/modules/contacts/index.d.ts.map +1 -0
- package/dist/modules/contacts/index.js +18 -0
- package/dist/modules/contacts/index.js.map +1 -0
- package/dist/modules/contacts/scopes.d.ts +4 -0
- package/dist/modules/contacts/scopes.d.ts.map +1 -0
- package/dist/modules/contacts/scopes.js +11 -0
- package/dist/modules/contacts/scopes.js.map +1 -0
- package/dist/modules/contacts/types.d.ts +55 -0
- package/dist/modules/contacts/types.d.ts.map +1 -0
- package/dist/modules/contacts/types.js +14 -0
- package/dist/modules/contacts/types.js.map +1 -0
- package/dist/modules/docs/formatters.d.ts +30 -0
- package/dist/modules/docs/formatters.d.ts.map +1 -0
- package/dist/modules/docs/formatters.js +76 -0
- package/dist/modules/docs/formatters.js.map +1 -0
- package/dist/modules/docs/index.d.ts +9 -0
- package/dist/modules/docs/index.d.ts.map +1 -0
- package/dist/modules/docs/index.js +23 -0
- package/dist/modules/docs/index.js.map +1 -0
- package/dist/modules/docs/scopes.d.ts +17 -0
- package/dist/modules/docs/scopes.d.ts.map +1 -0
- package/dist/modules/docs/scopes.js +39 -0
- package/dist/modules/docs/scopes.js.map +1 -0
- package/dist/modules/docs/service.d.ts +58 -0
- package/dist/modules/docs/service.d.ts.map +1 -0
- package/dist/modules/docs/service.js +421 -0
- package/dist/modules/docs/service.js.map +1 -0
- package/dist/modules/docs/types.d.ts +75 -0
- package/dist/modules/docs/types.d.ts.map +1 -0
- package/dist/modules/docs/types.js +2 -0
- package/dist/modules/docs/types.js.map +1 -0
- package/dist/modules/drive/index.d.ts +9 -0
- package/dist/modules/drive/index.d.ts.map +1 -0
- package/dist/modules/drive/index.js +28 -0
- package/dist/modules/drive/index.js.map +1 -0
- package/dist/modules/drive/scopes.d.ts +19 -0
- package/dist/modules/drive/scopes.d.ts.map +1 -0
- package/dist/modules/drive/scopes.js +44 -0
- package/dist/modules/drive/scopes.js.map +1 -0
- package/dist/modules/drive/service.d.ts +33 -0
- package/dist/modules/drive/service.d.ts.map +1 -0
- package/dist/modules/drive/service.js +467 -0
- package/dist/modules/drive/service.js.map +1 -0
- package/dist/modules/drive/types.d.ts +55 -0
- package/dist/modules/drive/types.d.ts.map +1 -0
- package/dist/modules/drive/types.js +2 -0
- package/dist/modules/drive/types.js.map +1 -0
- package/dist/modules/forms/index.d.ts +13 -0
- package/dist/modules/forms/index.d.ts.map +1 -0
- package/dist/modules/forms/index.js +24 -0
- package/dist/modules/forms/index.js.map +1 -0
- package/dist/modules/forms/scopes.d.ts +21 -0
- package/dist/modules/forms/scopes.d.ts.map +1 -0
- package/dist/modules/forms/scopes.js +36 -0
- package/dist/modules/forms/scopes.js.map +1 -0
- package/dist/modules/forms/service.d.ts +52 -0
- package/dist/modules/forms/service.d.ts.map +1 -0
- package/dist/modules/forms/service.js +284 -0
- package/dist/modules/forms/service.js.map +1 -0
- package/dist/modules/forms/types.d.ts +399 -0
- package/dist/modules/forms/types.d.ts.map +1 -0
- package/dist/modules/forms/types.js +6 -0
- package/dist/modules/forms/types.js.map +1 -0
- package/dist/modules/gmail/constants.d.ts +69 -0
- package/dist/modules/gmail/constants.d.ts.map +1 -0
- package/dist/modules/gmail/constants.js +100 -0
- package/dist/modules/gmail/constants.js.map +1 -0
- package/dist/modules/gmail/index.d.ts +7 -0
- package/dist/modules/gmail/index.d.ts.map +1 -0
- package/dist/modules/gmail/index.js +16 -0
- package/dist/modules/gmail/index.js.map +1 -0
- package/dist/modules/gmail/scopes.d.ts +17 -0
- package/dist/modules/gmail/scopes.d.ts.map +1 -0
- package/dist/modules/gmail/scopes.js +39 -0
- package/dist/modules/gmail/scopes.js.map +1 -0
- package/dist/modules/gmail/service.d.ts +2 -0
- package/dist/modules/gmail/service.d.ts.map +1 -0
- package/dist/modules/gmail/service.js +2 -0
- package/dist/modules/gmail/service.js.map +1 -0
- package/dist/modules/gmail/services/attachment.d.ts +41 -0
- package/dist/modules/gmail/services/attachment.d.ts.map +1 -0
- package/dist/modules/gmail/services/attachment.js +143 -0
- package/dist/modules/gmail/services/attachment.js.map +1 -0
- package/dist/modules/gmail/services/base.d.ts +79 -0
- package/dist/modules/gmail/services/base.d.ts.map +1 -0
- package/dist/modules/gmail/services/base.js +124 -0
- package/dist/modules/gmail/services/base.js.map +1 -0
- package/dist/modules/gmail/services/draft.d.ts +104 -0
- package/dist/modules/gmail/services/draft.d.ts.map +1 -0
- package/dist/modules/gmail/services/draft.js +239 -0
- package/dist/modules/gmail/services/draft.js.map +1 -0
- package/dist/modules/gmail/services/email.d.ts +82 -0
- package/dist/modules/gmail/services/email.d.ts.map +1 -0
- package/dist/modules/gmail/services/email.js +462 -0
- package/dist/modules/gmail/services/email.js.map +1 -0
- package/dist/modules/gmail/services/label.d.ts +62 -0
- package/dist/modules/gmail/services/label.d.ts.map +1 -0
- package/dist/modules/gmail/services/label.js +501 -0
- package/dist/modules/gmail/services/label.js.map +1 -0
- package/dist/modules/gmail/services/mime-builder.d.ts +26 -0
- package/dist/modules/gmail/services/mime-builder.d.ts.map +1 -0
- package/dist/modules/gmail/services/mime-builder.js +83 -0
- package/dist/modules/gmail/services/mime-builder.js.map +1 -0
- package/dist/modules/gmail/services/search.d.ts +8 -0
- package/dist/modules/gmail/services/search.d.ts.map +1 -0
- package/dist/modules/gmail/services/search.js +76 -0
- package/dist/modules/gmail/services/search.js.map +1 -0
- package/dist/modules/gmail/services/settings.d.ts +14 -0
- package/dist/modules/gmail/services/settings.d.ts.map +1 -0
- package/dist/modules/gmail/services/settings.js +104 -0
- package/dist/modules/gmail/services/settings.js.map +1 -0
- package/dist/modules/gmail/types.d.ts +279 -0
- package/dist/modules/gmail/types.d.ts.map +1 -0
- package/dist/modules/gmail/types.js +11 -0
- package/dist/modules/gmail/types.js.map +1 -0
- package/dist/modules/sheets/a1Utils.d.ts +20 -0
- package/dist/modules/sheets/a1Utils.d.ts.map +1 -0
- package/dist/modules/sheets/a1Utils.js +252 -0
- package/dist/modules/sheets/a1Utils.js.map +1 -0
- package/dist/modules/sheets/cellShape.d.ts +48 -0
- package/dist/modules/sheets/cellShape.d.ts.map +1 -0
- package/dist/modules/sheets/cellShape.js +418 -0
- package/dist/modules/sheets/cellShape.js.map +1 -0
- package/dist/modules/sheets/errorRewriter.d.ts +6 -0
- package/dist/modules/sheets/errorRewriter.d.ts.map +1 -0
- package/dist/modules/sheets/errorRewriter.js +120 -0
- package/dist/modules/sheets/errorRewriter.js.map +1 -0
- package/dist/modules/sheets/formatters.d.ts +54 -0
- package/dist/modules/sheets/formatters.d.ts.map +1 -0
- package/dist/modules/sheets/formatters.js +270 -0
- package/dist/modules/sheets/formatters.js.map +1 -0
- package/dist/modules/sheets/index.d.ts +9 -0
- package/dist/modules/sheets/index.d.ts.map +1 -0
- package/dist/modules/sheets/index.js +23 -0
- package/dist/modules/sheets/index.js.map +1 -0
- package/dist/modules/sheets/scopes.d.ts +17 -0
- package/dist/modules/sheets/scopes.d.ts.map +1 -0
- package/dist/modules/sheets/scopes.js +39 -0
- package/dist/modules/sheets/scopes.js.map +1 -0
- package/dist/modules/sheets/service.d.ts +102 -0
- package/dist/modules/sheets/service.d.ts.map +1 -0
- package/dist/modules/sheets/service.js +1650 -0
- package/dist/modules/sheets/service.js.map +1 -0
- package/dist/modules/sheets/types.d.ts +271 -0
- package/dist/modules/sheets/types.d.ts.map +1 -0
- package/dist/modules/sheets/types.js +2 -0
- package/dist/modules/sheets/types.js.map +1 -0
- package/dist/modules/sheets/writeGuards.d.ts +31 -0
- package/dist/modules/sheets/writeGuards.d.ts.map +1 -0
- package/dist/modules/sheets/writeGuards.js +254 -0
- package/dist/modules/sheets/writeGuards.js.map +1 -0
- package/dist/modules/slides/formatters.d.ts +35 -0
- package/dist/modules/slides/formatters.d.ts.map +1 -0
- package/dist/modules/slides/formatters.js +96 -0
- package/dist/modules/slides/formatters.js.map +1 -0
- package/dist/modules/slides/index.d.ts +9 -0
- package/dist/modules/slides/index.d.ts.map +1 -0
- package/dist/modules/slides/index.js +23 -0
- package/dist/modules/slides/index.js.map +1 -0
- package/dist/modules/slides/scopes.d.ts +17 -0
- package/dist/modules/slides/scopes.d.ts.map +1 -0
- package/dist/modules/slides/scopes.js +39 -0
- package/dist/modules/slides/scopes.js.map +1 -0
- package/dist/modules/slides/service.d.ts +67 -0
- package/dist/modules/slides/service.d.ts.map +1 -0
- package/dist/modules/slides/service.js +394 -0
- package/dist/modules/slides/service.js.map +1 -0
- package/dist/modules/slides/types.d.ts +63 -0
- package/dist/modules/slides/types.d.ts.map +1 -0
- package/dist/modules/slides/types.js +2 -0
- package/dist/modules/slides/types.js.map +1 -0
- package/dist/modules/tasks/index.d.ts +13 -0
- package/dist/modules/tasks/index.d.ts.map +1 -0
- package/dist/modules/tasks/index.js +24 -0
- package/dist/modules/tasks/index.js.map +1 -0
- package/dist/modules/tasks/scopes.d.ts +18 -0
- package/dist/modules/tasks/scopes.d.ts.map +1 -0
- package/dist/modules/tasks/scopes.js +28 -0
- package/dist/modules/tasks/scopes.js.map +1 -0
- package/dist/modules/tasks/service.d.ts +72 -0
- package/dist/modules/tasks/service.d.ts.map +1 -0
- package/dist/modules/tasks/service.js +319 -0
- package/dist/modules/tasks/service.js.map +1 -0
- package/dist/modules/tasks/types.d.ts +118 -0
- package/dist/modules/tasks/types.d.ts.map +1 -0
- package/dist/modules/tasks/types.js +6 -0
- package/dist/modules/tasks/types.js.map +1 -0
- package/dist/modules/tools/registry.d.ts +28 -0
- package/dist/modules/tools/registry.d.ts.map +1 -0
- package/dist/modules/tools/registry.js +229 -0
- package/dist/modules/tools/registry.js.map +1 -0
- package/dist/modules/tools/scope-registry.d.ts +31 -0
- package/dist/modules/tools/scope-registry.d.ts.map +1 -0
- package/dist/modules/tools/scope-registry.js +52 -0
- package/dist/modules/tools/scope-registry.js.map +1 -0
- package/dist/oauth/client.d.ts +15 -0
- package/dist/oauth/client.d.ts.map +1 -0
- package/dist/oauth/client.js +136 -0
- package/dist/oauth/client.js.map +1 -0
- package/dist/resources/compose-email-template.d.ts +2 -0
- package/dist/resources/compose-email-template.d.ts.map +1 -0
- package/dist/resources/compose-email-template.js +711 -0
- package/dist/resources/compose-email-template.js.map +1 -0
- package/dist/scripts/health-check.d.ts +3 -0
- package/dist/scripts/health-check.d.ts.map +1 -0
- package/dist/scripts/health-check.js +22 -0
- package/dist/scripts/health-check.js.map +1 -0
- package/dist/scripts/setup-environment.d.ts +3 -0
- package/dist/scripts/setup-environment.d.ts.map +1 -0
- package/dist/scripts/setup-environment.js +91 -0
- package/dist/scripts/setup-environment.js.map +1 -0
- package/dist/scripts/setup-google-env.d.ts +3 -0
- package/dist/scripts/setup-google-env.d.ts.map +1 -0
- package/dist/scripts/setup-google-env.js +78 -0
- package/dist/scripts/setup-google-env.js.map +1 -0
- package/dist/services/base/BaseGoogleService.d.ts +52 -0
- package/dist/services/base/BaseGoogleService.d.ts.map +1 -0
- package/dist/services/base/BaseGoogleService.js +155 -0
- package/dist/services/base/BaseGoogleService.js.map +1 -0
- package/dist/services/calendar/index.d.ts +27 -0
- package/dist/services/calendar/index.d.ts.map +1 -0
- package/dist/services/calendar/index.js +146 -0
- package/dist/services/calendar/index.js.map +1 -0
- package/dist/services/contacts/index.d.ts +40 -0
- package/dist/services/contacts/index.d.ts.map +1 -0
- package/dist/services/contacts/index.js +137 -0
- package/dist/services/contacts/index.js.map +1 -0
- package/dist/services/docs/index.d.ts +4 -0
- package/dist/services/docs/index.d.ts.map +1 -0
- package/dist/services/docs/index.js +6 -0
- package/dist/services/docs/index.js.map +1 -0
- package/dist/services/drive/index.d.ts +4 -0
- package/dist/services/drive/index.d.ts.map +1 -0
- package/dist/services/drive/index.js +6 -0
- package/dist/services/drive/index.js.map +1 -0
- package/dist/services/gmail/index.d.ts +39 -0
- package/dist/services/gmail/index.d.ts.map +1 -0
- package/dist/services/gmail/index.js +337 -0
- package/dist/services/gmail/index.js.map +1 -0
- package/dist/services/sheets/index.d.ts +4 -0
- package/dist/services/sheets/index.d.ts.map +1 -0
- package/dist/services/sheets/index.js +6 -0
- package/dist/services/sheets/index.js.map +1 -0
- package/dist/services/slides/index.d.ts +4 -0
- package/dist/services/slides/index.d.ts.map +1 -0
- package/dist/services/slides/index.js +6 -0
- package/dist/services/slides/index.js.map +1 -0
- package/dist/tools/account-handlers.d.ts +28 -0
- package/dist/tools/account-handlers.d.ts.map +1 -0
- package/dist/tools/account-handlers.js +105 -0
- package/dist/tools/account-handlers.js.map +1 -0
- package/dist/tools/arg-aliases.d.ts +6 -0
- package/dist/tools/arg-aliases.d.ts.map +1 -0
- package/dist/tools/arg-aliases.js +22 -0
- package/dist/tools/arg-aliases.js.map +1 -0
- package/dist/tools/calendar-handlers.d.ts +83 -0
- package/dist/tools/calendar-handlers.d.ts.map +1 -0
- package/dist/tools/calendar-handlers.js +658 -0
- package/dist/tools/calendar-handlers.js.map +1 -0
- package/dist/tools/comments-handlers.d.ts +59 -0
- package/dist/tools/comments-handlers.d.ts.map +1 -0
- package/dist/tools/comments-handlers.js +138 -0
- package/dist/tools/comments-handlers.js.map +1 -0
- package/dist/tools/contacts-handlers.d.ts +36 -0
- package/dist/tools/contacts-handlers.d.ts.map +1 -0
- package/dist/tools/contacts-handlers.js +128 -0
- package/dist/tools/contacts-handlers.js.map +1 -0
- package/dist/tools/definitions/account.d.ts +3 -0
- package/dist/tools/definitions/account.d.ts.map +1 -0
- package/dist/tools/definitions/account.js +77 -0
- package/dist/tools/definitions/account.js.map +1 -0
- package/dist/tools/definitions/calendar.d.ts +3 -0
- package/dist/tools/definitions/calendar.d.ts.map +1 -0
- package/dist/tools/definitions/calendar.js +565 -0
- package/dist/tools/definitions/calendar.js.map +1 -0
- package/dist/tools/definitions/comments.d.ts +3 -0
- package/dist/tools/definitions/comments.d.ts.map +1 -0
- package/dist/tools/definitions/comments.js +207 -0
- package/dist/tools/definitions/comments.js.map +1 -0
- package/dist/tools/definitions/contacts.d.ts +3 -0
- package/dist/tools/definitions/contacts.d.ts.map +1 -0
- package/dist/tools/definitions/contacts.js +93 -0
- package/dist/tools/definitions/contacts.js.map +1 -0
- package/dist/tools/definitions/destructive-overrides.json +106 -0
- package/dist/tools/definitions/docs.d.ts +3 -0
- package/dist/tools/definitions/docs.d.ts.map +1 -0
- package/dist/tools/definitions/docs.js +416 -0
- package/dist/tools/definitions/docs.js.map +1 -0
- package/dist/tools/definitions/drive.d.ts +3 -0
- package/dist/tools/definitions/drive.d.ts.map +1 -0
- package/dist/tools/definitions/drive.js +587 -0
- package/dist/tools/definitions/drive.js.map +1 -0
- package/dist/tools/definitions/forms.d.ts +14 -0
- package/dist/tools/definitions/forms.d.ts.map +1 -0
- package/dist/tools/definitions/forms.js +189 -0
- package/dist/tools/definitions/forms.js.map +1 -0
- package/dist/tools/definitions/gmail.d.ts +3 -0
- package/dist/tools/definitions/gmail.d.ts.map +1 -0
- package/dist/tools/definitions/gmail.js +962 -0
- package/dist/tools/definitions/gmail.js.map +1 -0
- package/dist/tools/definitions/index.d.ts +33 -0
- package/dist/tools/definitions/index.d.ts.map +1 -0
- package/dist/tools/definitions/index.js +77 -0
- package/dist/tools/definitions/index.js.map +1 -0
- package/dist/tools/definitions/labels.d.ts +3 -0
- package/dist/tools/definitions/labels.d.ts.map +1 -0
- package/dist/tools/definitions/labels.js +662 -0
- package/dist/tools/definitions/labels.js.map +1 -0
- package/dist/tools/definitions/open-world-overrides.json +106 -0
- package/dist/tools/definitions/sheets.d.ts +3 -0
- package/dist/tools/definitions/sheets.d.ts.map +1 -0
- package/dist/tools/definitions/sheets.js +833 -0
- package/dist/tools/definitions/sheets.js.map +1 -0
- package/dist/tools/definitions/slides.d.ts +3 -0
- package/dist/tools/definitions/slides.d.ts.map +1 -0
- package/dist/tools/definitions/slides.js +383 -0
- package/dist/tools/definitions/slides.js.map +1 -0
- package/dist/tools/definitions/tasks.d.ts +11 -0
- package/dist/tools/definitions/tasks.d.ts.map +1 -0
- package/dist/tools/definitions/tasks.js +259 -0
- package/dist/tools/definitions/tasks.js.map +1 -0
- package/dist/tools/definitions.d.ts +8 -0
- package/dist/tools/definitions.d.ts.map +1 -0
- package/dist/tools/definitions.js +9 -0
- package/dist/tools/definitions.js.map +1 -0
- package/dist/tools/docs-handlers.d.ts +96 -0
- package/dist/tools/docs-handlers.d.ts.map +1 -0
- package/dist/tools/docs-handlers.js +250 -0
- package/dist/tools/docs-handlers.js.map +1 -0
- package/dist/tools/drive-handlers.d.ts +95 -0
- package/dist/tools/drive-handlers.d.ts.map +1 -0
- package/dist/tools/drive-handlers.js +506 -0
- package/dist/tools/drive-handlers.js.map +1 -0
- package/dist/tools/forms-handlers.d.ts +72 -0
- package/dist/tools/forms-handlers.d.ts.map +1 -0
- package/dist/tools/forms-handlers.js +435 -0
- package/dist/tools/forms-handlers.js.map +1 -0
- package/dist/tools/gmail-handlers.d.ts +320 -0
- package/dist/tools/gmail-handlers.d.ts.map +1 -0
- package/dist/tools/gmail-handlers.js +1040 -0
- package/dist/tools/gmail-handlers.js.map +1 -0
- package/dist/tools/param-normalizer.d.ts +2 -0
- package/dist/tools/param-normalizer.d.ts.map +1 -0
- package/dist/tools/param-normalizer.js +96 -0
- package/dist/tools/param-normalizer.js.map +1 -0
- package/dist/tools/server.d.ts +14 -0
- package/dist/tools/server.d.ts.map +1 -0
- package/dist/tools/server.js +733 -0
- package/dist/tools/server.js.map +1 -0
- package/dist/tools/sheets-handlers.d.ts +230 -0
- package/dist/tools/sheets-handlers.d.ts.map +1 -0
- package/dist/tools/sheets-handlers.js +589 -0
- package/dist/tools/sheets-handlers.js.map +1 -0
- package/dist/tools/slides-handlers.d.ts +90 -0
- package/dist/tools/slides-handlers.d.ts.map +1 -0
- package/dist/tools/slides-handlers.js +281 -0
- package/dist/tools/slides-handlers.js.map +1 -0
- package/dist/tools/tasks-handlers.d.ts +85 -0
- package/dist/tools/tasks-handlers.d.ts.map +1 -0
- package/dist/tools/tasks-handlers.js +265 -0
- package/dist/tools/tasks-handlers.js.map +1 -0
- package/dist/tools/type-guards.d.ts +491 -0
- package/dist/tools/type-guards.d.ts.map +1 -0
- package/dist/tools/type-guards.js +1325 -0
- package/dist/tools/type-guards.js.map +1 -0
- package/dist/tools/types.d.ts +298 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types.d.ts +70 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/atomicCredentialWrite.d.ts +5 -0
- package/dist/utils/atomicCredentialWrite.d.ts.map +1 -0
- package/dist/utils/atomicCredentialWrite.js +120 -0
- package/dist/utils/atomicCredentialWrite.js.map +1 -0
- package/dist/utils/emfileRetry.d.ts +3 -0
- package/dist/utils/emfileRetry.d.ts.map +1 -0
- package/dist/utils/emfileRetry.js +24 -0
- package/dist/utils/emfileRetry.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +67 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/request-timeout.d.ts +5 -0
- package/dist/utils/request-timeout.d.ts.map +1 -0
- package/dist/utils/request-timeout.js +27 -0
- package/dist/utils/request-timeout.js.map +1 -0
- package/dist/utils/safe-filename.d.ts +2 -0
- package/dist/utils/safe-filename.d.ts.map +1 -0
- package/dist/utils/safe-filename.js +24 -0
- package/dist/utils/safe-filename.js.map +1 -0
- package/dist/utils/scope-hierarchy.d.ts +35 -0
- package/dist/utils/scope-hierarchy.d.ts.map +1 -0
- package/dist/utils/scope-hierarchy.js +123 -0
- package/dist/utils/scope-hierarchy.js.map +1 -0
- package/dist/utils/service-initializer.d.ts +12 -0
- package/dist/utils/service-initializer.d.ts.map +1 -0
- package/dist/utils/service-initializer.js +87 -0
- package/dist/utils/service-initializer.js.map +1 -0
- package/dist/utils/untrusted-content.d.ts +3 -0
- package/dist/utils/untrusted-content.d.ts.map +1 -0
- package/dist/utils/untrusted-content.js +20 -0
- package/dist/utils/untrusted-content.js.map +1 -0
- package/dist/utils/workspace.d.ts +43 -0
- package/dist/utils/workspace.d.ts.map +1 -0
- package/dist/utils/workspace.js +98 -0
- package/dist/utils/workspace.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { scopeRegistry } from '../tools/scope-registry.js';
|
|
2
|
+
// Define Gmail scopes as constants for reuse and testing
|
|
3
|
+
// Reference: https://developers.google.com/gmail/api/auth/scopes
|
|
4
|
+
export const GMAIL_SCOPES = {
|
|
5
|
+
// Core functionality scopes (read, write, modify permissions)
|
|
6
|
+
READONLY: 'https://www.googleapis.com/auth/gmail.readonly',
|
|
7
|
+
SEND: 'https://www.googleapis.com/auth/gmail.send',
|
|
8
|
+
MODIFY: 'https://www.googleapis.com/auth/gmail.modify',
|
|
9
|
+
// Label management scope
|
|
10
|
+
LABELS: 'https://www.googleapis.com/auth/gmail.labels',
|
|
11
|
+
// Settings management scope
|
|
12
|
+
SETTINGS_BASIC: 'https://www.googleapis.com/auth/gmail.settings.basic'
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Register Gmail OAuth scopes at startup.
|
|
16
|
+
* Auth issues will be handled via 401 responses rather than pre-validation.
|
|
17
|
+
*
|
|
18
|
+
* IMPORTANT: The order of scope registration matters for auth URL generation.
|
|
19
|
+
* Core functionality scopes (readonly, send, modify) should be registered first,
|
|
20
|
+
* followed by feature-specific scopes (labels, settings).
|
|
21
|
+
*/
|
|
22
|
+
export function registerGmailScopes() {
|
|
23
|
+
// Register core functionality scopes first
|
|
24
|
+
scopeRegistry.registerScope('gmail', GMAIL_SCOPES.READONLY);
|
|
25
|
+
scopeRegistry.registerScope('gmail', GMAIL_SCOPES.SEND);
|
|
26
|
+
scopeRegistry.registerScope('gmail', GMAIL_SCOPES.MODIFY);
|
|
27
|
+
// Register feature-specific scopes
|
|
28
|
+
scopeRegistry.registerScope('gmail', GMAIL_SCOPES.LABELS);
|
|
29
|
+
// Register settings scope last (order matters for auth URL generation)
|
|
30
|
+
scopeRegistry.registerScope('gmail', GMAIL_SCOPES.SETTINGS_BASIC);
|
|
31
|
+
// Verify all scopes are registered
|
|
32
|
+
const registeredScopes = scopeRegistry.getAllScopes();
|
|
33
|
+
const requiredScopes = Object.values(GMAIL_SCOPES);
|
|
34
|
+
const missingScopes = requiredScopes.filter(scope => !registeredScopes.includes(scope));
|
|
35
|
+
if (missingScopes.length > 0) {
|
|
36
|
+
throw new Error(`Failed to register Gmail scopes: ${missingScopes.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/modules/gmail/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,yDAAyD;AACzD,iEAAiE;AACjE,MAAM,CAAC,MAAM,YAAY,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AE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/gmail/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { google } from 'googleapis';
|
|
2
|
+
import { IncomingGmailAttachment, OutgoingGmailAttachment } from '../types.js';
|
|
3
|
+
export declare class GmailAttachmentService {
|
|
4
|
+
private static instance;
|
|
5
|
+
private indexService;
|
|
6
|
+
private gmailClient?;
|
|
7
|
+
private constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Add attachment metadata to the index
|
|
10
|
+
*/
|
|
11
|
+
addAttachment(messageId: string, attachment: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
mimeType: string;
|
|
15
|
+
size: number;
|
|
16
|
+
}): void;
|
|
17
|
+
static getInstance(): GmailAttachmentService;
|
|
18
|
+
/**
|
|
19
|
+
* Updates the Gmail client instance
|
|
20
|
+
*/
|
|
21
|
+
updateClient(client: ReturnType<typeof google.gmail>): void;
|
|
22
|
+
private ensureClient;
|
|
23
|
+
/**
|
|
24
|
+
* Get attachment content from Gmail.
|
|
25
|
+
* Falls back to on-demand message fetch when the in-memory index misses.
|
|
26
|
+
*/
|
|
27
|
+
getAttachment(email: string, messageId: string, filename: string): Promise<IncomingGmailAttachment>;
|
|
28
|
+
/**
|
|
29
|
+
* Validate attachment content and size
|
|
30
|
+
*/
|
|
31
|
+
validateAttachment(attachment: OutgoingGmailAttachment): void;
|
|
32
|
+
/**
|
|
33
|
+
* Prepare attachment for sending
|
|
34
|
+
*/
|
|
35
|
+
prepareAttachment(attachment: OutgoingGmailAttachment): {
|
|
36
|
+
filename: string;
|
|
37
|
+
mimeType: string;
|
|
38
|
+
content: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../../src/modules/gmail/services/attachment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAY,MAAM,YAAY,CAAC;AAC9C,OAAO,EAEL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,aAAa,CAAC;AA0BrB,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAyB;IAChD,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,WAAW,CAAC,CAAkC;IAEtD,OAAO;IAIP;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE;QAC3C,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI;WAIM,WAAW,IAAI,sBAAsB;IAOnD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC;IAIpD,OAAO,CAAC,YAAY;IAWpB;;;OAGG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,CAAC;IAuFnC;;OAEG;IACH,kBAAkB,CAAC,UAAU,EAAE,uBAAuB,GAAG,IAAI;IAoB7D;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,uBAAuB,GAAG;QACtD,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;KACjB;CASF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { GmailError } from '../types.js';
|
|
2
|
+
import { AttachmentIndexService } from '../../attachments/index-service.js';
|
|
3
|
+
/**
|
|
4
|
+
* Recursively find all attachment parts in nested MIME structures.
|
|
5
|
+
* Inlined here (duplicated from email.ts) to avoid circular dependency
|
|
6
|
+
* (email.ts imports from attachment.ts).
|
|
7
|
+
*/
|
|
8
|
+
function findAttachmentParts(part) {
|
|
9
|
+
const attachments = [];
|
|
10
|
+
if (part.filename && part.body?.attachmentId) {
|
|
11
|
+
attachments.push(part);
|
|
12
|
+
}
|
|
13
|
+
if (part.parts) {
|
|
14
|
+
for (const subPart of part.parts) {
|
|
15
|
+
attachments.push(...findAttachmentParts(subPart));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return attachments;
|
|
19
|
+
}
|
|
20
|
+
export class GmailAttachmentService {
|
|
21
|
+
static instance;
|
|
22
|
+
indexService;
|
|
23
|
+
gmailClient;
|
|
24
|
+
constructor() {
|
|
25
|
+
this.indexService = AttachmentIndexService.getInstance();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add attachment metadata to the index
|
|
29
|
+
*/
|
|
30
|
+
addAttachment(messageId, attachment) {
|
|
31
|
+
this.indexService.addAttachment(messageId, attachment);
|
|
32
|
+
}
|
|
33
|
+
static getInstance() {
|
|
34
|
+
if (!GmailAttachmentService.instance) {
|
|
35
|
+
GmailAttachmentService.instance = new GmailAttachmentService();
|
|
36
|
+
}
|
|
37
|
+
return GmailAttachmentService.instance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Updates the Gmail client instance
|
|
41
|
+
*/
|
|
42
|
+
updateClient(client) {
|
|
43
|
+
this.gmailClient = client;
|
|
44
|
+
}
|
|
45
|
+
ensureClient() {
|
|
46
|
+
if (!this.gmailClient) {
|
|
47
|
+
throw new GmailError('Gmail client not initialized', 'CLIENT_ERROR', 'Please ensure the service is initialized');
|
|
48
|
+
}
|
|
49
|
+
return this.gmailClient;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get attachment content from Gmail.
|
|
53
|
+
* Falls back to on-demand message fetch when the in-memory index misses.
|
|
54
|
+
*/
|
|
55
|
+
async getAttachment(email, messageId, filename) {
|
|
56
|
+
try {
|
|
57
|
+
let metadata = this.indexService.getMetadata(messageId, filename);
|
|
58
|
+
if (!metadata) {
|
|
59
|
+
// On-demand fallback: fetch message and find attachment by filename
|
|
60
|
+
const client = this.ensureClient();
|
|
61
|
+
const { data: message } = await client.users.messages.get({
|
|
62
|
+
userId: 'me',
|
|
63
|
+
id: messageId,
|
|
64
|
+
format: 'full',
|
|
65
|
+
});
|
|
66
|
+
if (!message.payload) {
|
|
67
|
+
throw new GmailError(`Message ${messageId} not found or has no content`, 'ATTACHMENT_ERROR');
|
|
68
|
+
}
|
|
69
|
+
const attachmentParts = findAttachmentParts(message.payload);
|
|
70
|
+
// Case-insensitive filename matching
|
|
71
|
+
const matchedPart = attachmentParts.find(p => p.filename?.toLowerCase() === filename.toLowerCase());
|
|
72
|
+
if (!matchedPart || !matchedPart.body?.attachmentId) {
|
|
73
|
+
throw new GmailError(`No attachment named '${filename}' found in message ${messageId}`, 'ATTACHMENT_ERROR', `Available attachments: ${attachmentParts.map(p => p.filename).filter(Boolean).join(', ') || 'none'}`);
|
|
74
|
+
}
|
|
75
|
+
// Cache ALL discovered attachments for future requests
|
|
76
|
+
for (const part of attachmentParts) {
|
|
77
|
+
if (part.filename && part.body?.attachmentId) {
|
|
78
|
+
this.indexService.addAttachment(messageId, {
|
|
79
|
+
id: part.body.attachmentId,
|
|
80
|
+
name: part.filename,
|
|
81
|
+
mimeType: part.mimeType || 'application/octet-stream',
|
|
82
|
+
size: parseInt(String(part.body.size || '0')),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Use the matched part's actual filename for index lookup (handles case mismatch
|
|
87
|
+
// between user-provided filename and Gmail's stored filename)
|
|
88
|
+
const canonicalFilename = matchedPart.filename;
|
|
89
|
+
metadata = this.indexService.getMetadata(messageId, canonicalFilename);
|
|
90
|
+
if (!metadata) {
|
|
91
|
+
throw new GmailError(`Failed to index attachment '${filename}' from message ${messageId}`, 'ATTACHMENT_ERROR');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Proceed with download using the metadata
|
|
95
|
+
const client = this.ensureClient();
|
|
96
|
+
const { data } = await client.users.messages.attachments.get({
|
|
97
|
+
userId: 'me',
|
|
98
|
+
messageId,
|
|
99
|
+
id: metadata.originalId,
|
|
100
|
+
});
|
|
101
|
+
if (!data.data) {
|
|
102
|
+
throw new Error('No attachment data received');
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
id: metadata.originalId,
|
|
106
|
+
content: data.data,
|
|
107
|
+
size: metadata.size,
|
|
108
|
+
name: metadata.filename,
|
|
109
|
+
mimeType: metadata.mimeType,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof GmailError)
|
|
114
|
+
throw error;
|
|
115
|
+
throw new GmailError('Failed to get attachment', 'ATTACHMENT_ERROR', `Error: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Validate attachment content and size
|
|
120
|
+
*/
|
|
121
|
+
validateAttachment(attachment) {
|
|
122
|
+
if (!attachment.content && !attachment.path) {
|
|
123
|
+
throw new GmailError('Invalid attachment', 'VALIDATION_ERROR', 'Attachment requires either "content" (base64) or "path" (local file)');
|
|
124
|
+
}
|
|
125
|
+
// Gmail's attachment size limit is 25MB
|
|
126
|
+
const MAX_SIZE = 25 * 1024 * 1024;
|
|
127
|
+
if (attachment.size && attachment.size > MAX_SIZE) {
|
|
128
|
+
throw new GmailError('Invalid attachment', 'VALIDATION_ERROR', `Attachment size ${attachment.size} exceeds maximum allowed size ${MAX_SIZE}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Prepare attachment for sending
|
|
133
|
+
*/
|
|
134
|
+
prepareAttachment(attachment) {
|
|
135
|
+
this.validateAttachment(attachment);
|
|
136
|
+
return {
|
|
137
|
+
filename: attachment.name,
|
|
138
|
+
mimeType: attachment.mimeType,
|
|
139
|
+
content: attachment.content,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../../../src/modules/gmail/services/attachment.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAI5E;;;;GAIG;AACH,SAAS,mBAAmB,CAAC,IAAiB;IAC5C,MAAM,WAAW,GAAkB,EAAE,CAAC;IAEtC,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;QAC7C,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACjC,WAAW,CAAC,IAAI,CAAC,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAC,QAAQ,CAAyB;IACxC,YAAY,CAAyB;IACrC,WAAW,CAAmC;IAEtD;QACE,IAAI,CAAC,YAAY,GAAG,sBAAsB,CAAC,WAAW,EAAE,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,SAAiB,EAAE,UAKhC;QACC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACzD,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,CAAC;YACrC,sBAAsB,CAAC,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AClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,UAAU,CAAC,IAAI,iCAAiC,QAAQ,EAAE,CAC9E,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,UAAmC;QAKnD,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAEpC,OAAO;YACL,QAAQ,EAAE,UAAU,CAAC,IAAI;YACzB,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,OAAO,EAAE,UAAU,CAAC,OAAO;SAC5B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { google } from 'googleapis';
|
|
2
|
+
import { BaseGoogleService } from '../../../services/base/BaseGoogleService.js';
|
|
3
|
+
import { GetEmailsParams, SendEmailParams, SendEmailResponse, GetGmailSettingsParams, GetGmailSettingsResponse, GmailModuleConfig, GetEmailsResponse, DraftResponse, GetDraftsResponse, Label, GetLabelsResponse, GetLabelFiltersResponse, LabelFilter } from '../types.js';
|
|
4
|
+
import { ManageLabelParams, ManageLabelAssignmentParams, ManageLabelFilterParams } from './label.js';
|
|
5
|
+
import { ManageDraftParams } from './draft.js';
|
|
6
|
+
/**
|
|
7
|
+
* Gmail service implementation extending BaseGoogleService for common auth handling.
|
|
8
|
+
*/
|
|
9
|
+
export declare class GmailService extends BaseGoogleService<ReturnType<typeof google.gmail>> {
|
|
10
|
+
private emailService;
|
|
11
|
+
private searchService;
|
|
12
|
+
private draftService;
|
|
13
|
+
private settingsService;
|
|
14
|
+
private labelService;
|
|
15
|
+
private attachmentService;
|
|
16
|
+
private initialized;
|
|
17
|
+
constructor(config?: GmailModuleConfig);
|
|
18
|
+
private ensureInitialized;
|
|
19
|
+
/**
|
|
20
|
+
* Initialize the Gmail service
|
|
21
|
+
*/
|
|
22
|
+
initialize(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Ensures all services are properly initialized
|
|
25
|
+
*/
|
|
26
|
+
private checkInitialized;
|
|
27
|
+
/**
|
|
28
|
+
* Gets an authenticated Gmail client for the specified account.
|
|
29
|
+
*/
|
|
30
|
+
private getGmailClient;
|
|
31
|
+
getEmails(params: GetEmailsParams): Promise<GetEmailsResponse>;
|
|
32
|
+
getMessage(email: string, messageId: string): Promise<{
|
|
33
|
+
id: string;
|
|
34
|
+
threadId: string;
|
|
35
|
+
headers?: Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}>;
|
|
39
|
+
} | null>;
|
|
40
|
+
getThread(email: string, threadId: string, options?: {
|
|
41
|
+
maxMessages?: number;
|
|
42
|
+
offset?: number;
|
|
43
|
+
includeBody?: boolean;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
threadId: string;
|
|
46
|
+
messagesCount: number;
|
|
47
|
+
hasMore?: boolean;
|
|
48
|
+
nextOffset?: number;
|
|
49
|
+
messages: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
date: string;
|
|
52
|
+
from: string;
|
|
53
|
+
to: string[];
|
|
54
|
+
cc?: string[];
|
|
55
|
+
subject: string;
|
|
56
|
+
snippet?: string;
|
|
57
|
+
body?: {
|
|
58
|
+
text?: string;
|
|
59
|
+
html?: string;
|
|
60
|
+
};
|
|
61
|
+
attachments?: Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
filename: string;
|
|
64
|
+
mimeType: string;
|
|
65
|
+
size: number;
|
|
66
|
+
}>;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
69
|
+
sendEmail(params: SendEmailParams): Promise<SendEmailResponse>;
|
|
70
|
+
manageDraft(params: ManageDraftParams): Promise<DraftResponse | GetDraftsResponse | SendEmailResponse | void>;
|
|
71
|
+
getWorkspaceGmailSettings(params: GetGmailSettingsParams): Promise<GetGmailSettingsResponse>;
|
|
72
|
+
manageLabel(params: ManageLabelParams): Promise<Label | GetLabelsResponse | void>;
|
|
73
|
+
manageLabelAssignment(params: ManageLabelAssignmentParams): Promise<void>;
|
|
74
|
+
manageLabelFilter(params: ManageLabelFilterParams): Promise<LabelFilter | GetLabelFiltersResponse | void>;
|
|
75
|
+
trashMessage(email: string, messageId: string): Promise<void>;
|
|
76
|
+
untrashMessage(email: string, messageId: string): Promise<void>;
|
|
77
|
+
getAttachment(email: string, messageId: string, filename: string): Promise<import("../types.js").IncomingGmailAttachment>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/modules/gmail/services/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EAExB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EACjB,uBAAuB,EACvB,WAAW,EACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAQ/C;;GAEG;AACH,qBAAa,YAAa,SAAQ,iBAAiB,CAAC,UAAU,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAClF,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,iBAAiB,CAAyB;IAClD,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,CAAC,EAAE,iBAAiB;YAWxB,iBAAiB;IAO/B;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CA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D,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAIvE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { google } from 'googleapis';
|
|
2
|
+
import { BaseGoogleService } from '../../../services/base/BaseGoogleService.js';
|
|
3
|
+
import { GmailError } from '../types.js';
|
|
4
|
+
import { EmailService } from './email.js';
|
|
5
|
+
import { SearchService } from './search.js';
|
|
6
|
+
import { DraftService } from './draft.js';
|
|
7
|
+
import { SettingsService } from './settings.js';
|
|
8
|
+
import { LabelService } from './label.js';
|
|
9
|
+
import { GmailAttachmentService } from './attachment.js';
|
|
10
|
+
/**
|
|
11
|
+
* Gmail service implementation extending BaseGoogleService for common auth handling.
|
|
12
|
+
*/
|
|
13
|
+
export class GmailService extends BaseGoogleService {
|
|
14
|
+
emailService;
|
|
15
|
+
searchService;
|
|
16
|
+
draftService;
|
|
17
|
+
settingsService;
|
|
18
|
+
labelService;
|
|
19
|
+
attachmentService;
|
|
20
|
+
initialized = false;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
super({ serviceName: 'Gmail', version: 'v1' });
|
|
23
|
+
this.searchService = new SearchService();
|
|
24
|
+
this.attachmentService = GmailAttachmentService.getInstance();
|
|
25
|
+
this.emailService = new EmailService(this.searchService, this.attachmentService);
|
|
26
|
+
this.draftService = new DraftService(this.attachmentService);
|
|
27
|
+
this.settingsService = new SettingsService();
|
|
28
|
+
this.labelService = new LabelService();
|
|
29
|
+
}
|
|
30
|
+
async ensureInitialized(email) {
|
|
31
|
+
if (!this.initialized) {
|
|
32
|
+
await this.initialize();
|
|
33
|
+
}
|
|
34
|
+
await this.getGmailClient(email);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Initialize the Gmail service
|
|
38
|
+
*/
|
|
39
|
+
async initialize() {
|
|
40
|
+
try {
|
|
41
|
+
await super.initialize();
|
|
42
|
+
this.initialized = true;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw new GmailError('Failed to initialize Gmail service', 'INIT_ERROR', error instanceof Error ? error.message : 'Unknown error');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Ensures all services are properly initialized
|
|
50
|
+
*/
|
|
51
|
+
checkInitialized() {
|
|
52
|
+
if (!this.initialized) {
|
|
53
|
+
throw new GmailError('Gmail service not initialized', 'INIT_ERROR', 'Please call init() before using the service');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Gets an authenticated Gmail client for the specified account.
|
|
58
|
+
*/
|
|
59
|
+
async getGmailClient(email) {
|
|
60
|
+
if (!this.initialized) {
|
|
61
|
+
await this.initialize();
|
|
62
|
+
}
|
|
63
|
+
return this.getAuthenticatedClient(email, (auth) => {
|
|
64
|
+
const client = google.gmail({ version: 'v1', auth });
|
|
65
|
+
// Update service instances with new client
|
|
66
|
+
this.emailService.updateClient(client);
|
|
67
|
+
this.draftService.updateClient(client);
|
|
68
|
+
this.settingsService.updateClient(client);
|
|
69
|
+
this.labelService.updateClient(client);
|
|
70
|
+
this.attachmentService.updateClient(client);
|
|
71
|
+
return client;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async getEmails(params) {
|
|
75
|
+
await this.getGmailClient(params.email);
|
|
76
|
+
return this.emailService.getEmails(params);
|
|
77
|
+
}
|
|
78
|
+
async getMessage(email, messageId) {
|
|
79
|
+
await this.getGmailClient(email);
|
|
80
|
+
return this.emailService.getMessage(email, messageId);
|
|
81
|
+
}
|
|
82
|
+
async getThread(email, threadId, options) {
|
|
83
|
+
await this.getGmailClient(email);
|
|
84
|
+
return this.emailService.getThread(email, threadId, options);
|
|
85
|
+
}
|
|
86
|
+
async sendEmail(params) {
|
|
87
|
+
await this.getGmailClient(params.email);
|
|
88
|
+
return this.emailService.sendEmail(params);
|
|
89
|
+
}
|
|
90
|
+
async manageDraft(params) {
|
|
91
|
+
await this.getGmailClient(params.email);
|
|
92
|
+
return this.draftService.manageDraft(params);
|
|
93
|
+
}
|
|
94
|
+
async getWorkspaceGmailSettings(params) {
|
|
95
|
+
await this.getGmailClient(params.email);
|
|
96
|
+
return this.settingsService.getWorkspaceGmailSettings(params);
|
|
97
|
+
}
|
|
98
|
+
// Consolidated Label Management Methods
|
|
99
|
+
async manageLabel(params) {
|
|
100
|
+
await this.getGmailClient(params.email);
|
|
101
|
+
return this.labelService.manageLabel(params);
|
|
102
|
+
}
|
|
103
|
+
async manageLabelAssignment(params) {
|
|
104
|
+
await this.getGmailClient(params.email);
|
|
105
|
+
return this.labelService.manageLabelAssignment(params);
|
|
106
|
+
}
|
|
107
|
+
async manageLabelFilter(params) {
|
|
108
|
+
await this.getGmailClient(params.email);
|
|
109
|
+
return this.labelService.manageLabelFilter(params);
|
|
110
|
+
}
|
|
111
|
+
async trashMessage(email, messageId) {
|
|
112
|
+
await this.getGmailClient(email);
|
|
113
|
+
return this.emailService.trashMessage(email, messageId);
|
|
114
|
+
}
|
|
115
|
+
async untrashMessage(email, messageId) {
|
|
116
|
+
await this.getGmailClient(email);
|
|
117
|
+
return this.emailService.untrashMessage(email, messageId);
|
|
118
|
+
}
|
|
119
|
+
async getAttachment(email, messageId, filename) {
|
|
120
|
+
await this.ensureInitialized(email);
|
|
121
|
+
return this.attachmentService.getAttachment(email, messageId, filename);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/modules/gmail/services/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAML,UAAU,EASX,MAAM,aAAa,CAAC;AASrB,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa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C,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,MAAmC;QAC7D,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,MAA+B;QACrD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAa,EAAE,SAAiB;QACjD,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,KAAa,EAAE,SAAiB;QACnD,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,KAAa,EAAE,SAAiB,EAAE,QAAgB;QACpE,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { google } from 'googleapis';
|
|
2
|
+
import { OutgoingGmailAttachment } from '../types.js';
|
|
3
|
+
import { GmailAttachmentService } from './attachment.js';
|
|
4
|
+
export type DraftAction = 'create' | 'read' | 'update' | 'delete' | 'send';
|
|
5
|
+
export interface ManageDraftParams {
|
|
6
|
+
email: string;
|
|
7
|
+
action: DraftAction;
|
|
8
|
+
draftId?: string;
|
|
9
|
+
data?: DraftData;
|
|
10
|
+
}
|
|
11
|
+
export interface DraftData {
|
|
12
|
+
to: string[];
|
|
13
|
+
subject: string;
|
|
14
|
+
body: string;
|
|
15
|
+
cc?: string[];
|
|
16
|
+
bcc?: string[];
|
|
17
|
+
isHtml?: boolean;
|
|
18
|
+
threadId?: string;
|
|
19
|
+
inReplyTo?: string;
|
|
20
|
+
references?: string[];
|
|
21
|
+
attachments?: OutgoingGmailAttachment[];
|
|
22
|
+
}
|
|
23
|
+
export declare class DraftService {
|
|
24
|
+
private attachmentService;
|
|
25
|
+
private gmailClient?;
|
|
26
|
+
constructor(attachmentService: GmailAttachmentService);
|
|
27
|
+
initialize(): Promise<void>;
|
|
28
|
+
updateClient(client: ReturnType<typeof google.gmail>): void;
|
|
29
|
+
private ensureClient;
|
|
30
|
+
createDraft(email: string, data: DraftData): Promise<{
|
|
31
|
+
id: string;
|
|
32
|
+
message: {
|
|
33
|
+
id: string;
|
|
34
|
+
threadId: string;
|
|
35
|
+
labelIds: string[];
|
|
36
|
+
};
|
|
37
|
+
updated: string;
|
|
38
|
+
attachments: OutgoingGmailAttachment[] | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
listDrafts(email: string): Promise<{
|
|
41
|
+
drafts: {
|
|
42
|
+
id: string;
|
|
43
|
+
message: {
|
|
44
|
+
id: string;
|
|
45
|
+
threadId: string;
|
|
46
|
+
labelIds: string[];
|
|
47
|
+
};
|
|
48
|
+
updated: string;
|
|
49
|
+
}[];
|
|
50
|
+
nextPageToken: string | undefined;
|
|
51
|
+
resultSizeEstimate: number;
|
|
52
|
+
}>;
|
|
53
|
+
getDraft(email: string, draftId: string): Promise<{
|
|
54
|
+
id: string;
|
|
55
|
+
message: {
|
|
56
|
+
id: string;
|
|
57
|
+
threadId: string;
|
|
58
|
+
labelIds: string[];
|
|
59
|
+
};
|
|
60
|
+
updated: string;
|
|
61
|
+
}>;
|
|
62
|
+
updateDraft(email: string, draftId: string, data: DraftData): Promise<{
|
|
63
|
+
id: string;
|
|
64
|
+
message: {
|
|
65
|
+
id: string;
|
|
66
|
+
threadId: string;
|
|
67
|
+
labelIds: string[];
|
|
68
|
+
};
|
|
69
|
+
updated: string;
|
|
70
|
+
attachments: OutgoingGmailAttachment[] | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
deleteDraft(email: string, draftId: string): Promise<void>;
|
|
73
|
+
manageDraft(params: ManageDraftParams): Promise<void | {
|
|
74
|
+
id: string;
|
|
75
|
+
message: {
|
|
76
|
+
id: string;
|
|
77
|
+
threadId: string;
|
|
78
|
+
labelIds: string[];
|
|
79
|
+
};
|
|
80
|
+
updated: string;
|
|
81
|
+
} | {
|
|
82
|
+
drafts: {
|
|
83
|
+
id: string;
|
|
84
|
+
message: {
|
|
85
|
+
id: string;
|
|
86
|
+
threadId: string;
|
|
87
|
+
labelIds: string[];
|
|
88
|
+
};
|
|
89
|
+
updated: string;
|
|
90
|
+
}[];
|
|
91
|
+
nextPageToken: string | undefined;
|
|
92
|
+
resultSizeEstimate: number;
|
|
93
|
+
} | {
|
|
94
|
+
messageId: string;
|
|
95
|
+
threadId: string;
|
|
96
|
+
labelIds: string[] | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
sendDraft(email: string, draftId: string): Promise<{
|
|
99
|
+
messageId: string;
|
|
100
|
+
threadId: string;
|
|
101
|
+
labelIds: string[] | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../src/modules/gmail/services/draft.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAEL,uBAAuB,EAExB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBA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