@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,1325 @@
|
|
|
1
|
+
// Base Tool Arguments
|
|
2
|
+
// Email is now optional - resolveEmail() will handle fallback to instance account
|
|
3
|
+
export function isBaseToolArguments(args) {
|
|
4
|
+
return args.email === undefined || typeof args.email === 'string';
|
|
5
|
+
}
|
|
6
|
+
export function assertBaseToolArguments(args) {
|
|
7
|
+
if (!isBaseToolArguments(args)) {
|
|
8
|
+
throw new Error('Invalid email parameter - must be a string or undefined');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function readAliasedArg(args, canonicalKey, legacyKey) {
|
|
12
|
+
return (args[canonicalKey] ?? args[legacyKey]);
|
|
13
|
+
}
|
|
14
|
+
// Calendar Type Guards
|
|
15
|
+
export function isListCalendarsArgs(args) {
|
|
16
|
+
return args.email === undefined || typeof args.email === 'string';
|
|
17
|
+
}
|
|
18
|
+
export function assertListCalendarsArgs(args) {
|
|
19
|
+
if (!isListCalendarsArgs(args)) {
|
|
20
|
+
throw new Error('Invalid list calendars parameters - email must be a string or undefined');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function isCalendarEventParams(args) {
|
|
24
|
+
const maxResults = readAliasedArg(args, 'max_results', 'maxResults');
|
|
25
|
+
const timeMin = readAliasedArg(args, 'time_min', 'timeMin');
|
|
26
|
+
const timeMax = readAliasedArg(args, 'time_max', 'timeMax');
|
|
27
|
+
const calendarId = readAliasedArg(args, 'calendar_id', 'calendarId');
|
|
28
|
+
return (args.email === undefined || typeof args.email === 'string') &&
|
|
29
|
+
(args.query === undefined || typeof args.query === 'string') &&
|
|
30
|
+
(maxResults === undefined || typeof maxResults === 'number') &&
|
|
31
|
+
(timeMin === undefined || typeof timeMin === 'string') &&
|
|
32
|
+
(timeMax === undefined || typeof timeMax === 'string') &&
|
|
33
|
+
(calendarId === undefined || typeof calendarId === 'string');
|
|
34
|
+
}
|
|
35
|
+
export function assertCalendarEventParams(args) {
|
|
36
|
+
if (!isCalendarEventParams(args)) {
|
|
37
|
+
throw new Error('Invalid calendar event parameters');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function isEmailEventIdArgs(args) {
|
|
41
|
+
const eventId = readAliasedArg(args, 'event_id', 'eventId');
|
|
42
|
+
const calendarId = readAliasedArg(args, 'calendar_id', 'calendarId');
|
|
43
|
+
return (args.email === undefined || typeof args.email === 'string') &&
|
|
44
|
+
typeof eventId === 'string' &&
|
|
45
|
+
(calendarId === undefined || typeof calendarId === 'string');
|
|
46
|
+
}
|
|
47
|
+
export function assertEmailEventIdArgs(args) {
|
|
48
|
+
if (!isEmailEventIdArgs(args)) {
|
|
49
|
+
throw new Error('Missing required email or event_id parameter');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Shared attachment array validator — checks both key existence and value types
|
|
53
|
+
function isValidAttachmentsArray(attachments) {
|
|
54
|
+
if (!Array.isArray(attachments))
|
|
55
|
+
return false;
|
|
56
|
+
return attachments.every(a => {
|
|
57
|
+
if (typeof a !== 'object' || a === null)
|
|
58
|
+
return false;
|
|
59
|
+
const att = a;
|
|
60
|
+
// Path-based: path is the only required field; all others auto-resolved by resolveAttachmentFromPath()
|
|
61
|
+
if (typeof att.path === 'string') {
|
|
62
|
+
// Validate optional field types when present
|
|
63
|
+
if (att.content !== undefined && typeof att.content !== 'string')
|
|
64
|
+
return false;
|
|
65
|
+
if (att.name !== undefined && typeof att.name !== 'string')
|
|
66
|
+
return false;
|
|
67
|
+
if (att.mimeType !== undefined && typeof att.mimeType !== 'string')
|
|
68
|
+
return false;
|
|
69
|
+
if (att.size !== undefined && typeof att.size !== 'number')
|
|
70
|
+
return false;
|
|
71
|
+
if (att.id !== undefined && typeof att.id !== 'string')
|
|
72
|
+
return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
// Content-based: content + name required (mimeType defaults downstream)
|
|
76
|
+
if (typeof att.content === 'string' && typeof att.name === 'string') {
|
|
77
|
+
if (att.mimeType !== undefined && typeof att.mimeType !== 'string')
|
|
78
|
+
return false;
|
|
79
|
+
if (att.size !== undefined && typeof att.size !== 'number')
|
|
80
|
+
return false;
|
|
81
|
+
if (att.id !== undefined && typeof att.id !== 'string')
|
|
82
|
+
return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
// Legacy full-field: backwards compatible (all 5 original fields present)
|
|
86
|
+
return typeof att.id === 'string' &&
|
|
87
|
+
typeof att.name === 'string' &&
|
|
88
|
+
typeof att.mimeType === 'string' &&
|
|
89
|
+
typeof att.size === 'number' &&
|
|
90
|
+
typeof att.content === 'string';
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
// Gmail Type Guards
|
|
94
|
+
export function isSendEmailArgs(args) {
|
|
95
|
+
const isHtml = readAliasedArg(args, 'is_html', 'isHtml');
|
|
96
|
+
const replyToMessageId = readAliasedArg(args, 'reply_to_message_id', 'replyToMessageId');
|
|
97
|
+
return (args.email === undefined || typeof args.email === 'string') &&
|
|
98
|
+
Array.isArray(args.to) &&
|
|
99
|
+
args.to.every(to => typeof to === 'string') &&
|
|
100
|
+
typeof args.subject === 'string' &&
|
|
101
|
+
typeof args.body === 'string' &&
|
|
102
|
+
(args.cc === undefined || (Array.isArray(args.cc) && args.cc.every(cc => typeof cc === 'string'))) &&
|
|
103
|
+
(args.bcc === undefined || (Array.isArray(args.bcc) && args.bcc.every(bcc => typeof bcc === 'string'))) &&
|
|
104
|
+
(isHtml === undefined || typeof isHtml === 'boolean') &&
|
|
105
|
+
(replyToMessageId === undefined || typeof replyToMessageId === 'string') &&
|
|
106
|
+
(args.attachments === undefined || isValidAttachmentsArray(args.attachments));
|
|
107
|
+
}
|
|
108
|
+
export function assertSendEmailArgs(args) {
|
|
109
|
+
if (!isSendEmailArgs(args)) {
|
|
110
|
+
throw new Error('Invalid email parameters. Required: email, to, subject, body');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Drive Type Guards
|
|
114
|
+
export function isDriveFileListArgs(args) {
|
|
115
|
+
if (typeof args !== 'object' || args === null)
|
|
116
|
+
return false;
|
|
117
|
+
const params = args;
|
|
118
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
119
|
+
(params.options === undefined || (() => {
|
|
120
|
+
const opts = params.options;
|
|
121
|
+
return (opts.folderId === undefined || typeof opts.folderId === 'string') &&
|
|
122
|
+
(opts.query === undefined || typeof opts.query === 'string') &&
|
|
123
|
+
(opts.pageSize === undefined || typeof opts.pageSize === 'number') &&
|
|
124
|
+
(opts.orderBy === undefined || (Array.isArray(opts.orderBy) && opts.orderBy.every((o) => typeof o === 'string'))) &&
|
|
125
|
+
(opts.fields === undefined || (Array.isArray(opts.fields) && opts.fields.every((f) => typeof f === 'string')));
|
|
126
|
+
})());
|
|
127
|
+
}
|
|
128
|
+
export function assertDriveFileListArgs(args) {
|
|
129
|
+
if (!isDriveFileListArgs(args)) {
|
|
130
|
+
throw new Error('Invalid file list parameters. Required: email');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function isDriveSearchArgs(args) {
|
|
134
|
+
if (typeof args !== 'object' || args === null)
|
|
135
|
+
return false;
|
|
136
|
+
const params = args;
|
|
137
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
138
|
+
typeof params.options === 'object' && params.options !== null &&
|
|
139
|
+
(params.options.fullText === undefined || typeof params.options.fullText === 'string') &&
|
|
140
|
+
(params.options.mimeType === undefined || typeof params.options.mimeType === 'string') &&
|
|
141
|
+
(params.options.folderId === undefined || typeof params.options.folderId === 'string') &&
|
|
142
|
+
(params.options.trashed === undefined || typeof params.options.trashed === 'boolean') &&
|
|
143
|
+
(params.options.query === undefined || typeof params.options.query === 'string') &&
|
|
144
|
+
(params.options.pageSize === undefined || typeof params.options.pageSize === 'number');
|
|
145
|
+
}
|
|
146
|
+
export function assertDriveSearchArgs(args) {
|
|
147
|
+
if (!isDriveSearchArgs(args)) {
|
|
148
|
+
throw new Error('Invalid search parameters. Required: email, options');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
export function isDriveUploadArgs(args) {
|
|
152
|
+
if (typeof args !== 'object' || args === null)
|
|
153
|
+
return false;
|
|
154
|
+
const params = args;
|
|
155
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
156
|
+
typeof params.options === 'object' && params.options !== null &&
|
|
157
|
+
typeof params.options.name === 'string' &&
|
|
158
|
+
typeof params.options.content === 'string' &&
|
|
159
|
+
(params.options.mimeType === undefined || typeof params.options.mimeType === 'string') &&
|
|
160
|
+
(params.options.parents === undefined || (Array.isArray(params.options.parents) && params.options.parents.every(p => typeof p === 'string')));
|
|
161
|
+
}
|
|
162
|
+
export function assertDriveUploadArgs(args) {
|
|
163
|
+
if (!isDriveUploadArgs(args)) {
|
|
164
|
+
throw new Error('Invalid upload parameters. Required: email, options.name, options.content');
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export function isDriveDownloadArgs(args) {
|
|
168
|
+
if (typeof args !== 'object' || args === null)
|
|
169
|
+
return false;
|
|
170
|
+
const params = args;
|
|
171
|
+
const rawParams = args;
|
|
172
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
173
|
+
const mimeType = readAliasedArg(rawParams, 'mime_type', 'mimeType');
|
|
174
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
175
|
+
typeof fileId === 'string' &&
|
|
176
|
+
(mimeType === undefined || typeof mimeType === 'string');
|
|
177
|
+
}
|
|
178
|
+
export function assertDriveDownloadArgs(args) {
|
|
179
|
+
if (!isDriveDownloadArgs(args)) {
|
|
180
|
+
throw new Error('Invalid download parameters. Required: email, file_id');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
export function isDriveFolderArgs(args) {
|
|
184
|
+
if (typeof args !== 'object' || args === null)
|
|
185
|
+
return false;
|
|
186
|
+
const params = args;
|
|
187
|
+
const parentId = readAliasedArg(args, 'parent_id', 'parentId');
|
|
188
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
189
|
+
typeof params.name === 'string' &&
|
|
190
|
+
(parentId === undefined || typeof parentId === 'string');
|
|
191
|
+
}
|
|
192
|
+
export function assertDriveFolderArgs(args) {
|
|
193
|
+
if (!isDriveFolderArgs(args)) {
|
|
194
|
+
throw new Error('Invalid folder parameters. Required: email, name');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export function isDrivePermissionArgs(args) {
|
|
198
|
+
if (typeof args !== 'object' || args === null)
|
|
199
|
+
return false;
|
|
200
|
+
const params = args;
|
|
201
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
202
|
+
typeof params.options === 'object' && params.options !== null &&
|
|
203
|
+
typeof params.options.fileId === 'string' &&
|
|
204
|
+
['owner', 'organizer', 'fileOrganizer', 'writer', 'commenter', 'reader'].includes(params.options.role) &&
|
|
205
|
+
['user', 'group', 'domain', 'anyone'].includes(params.options.type) &&
|
|
206
|
+
(params.options.emailAddress === undefined || typeof params.options.emailAddress === 'string') &&
|
|
207
|
+
(params.options.domain === undefined || typeof params.options.domain === 'string') &&
|
|
208
|
+
(params.options.allowFileDiscovery === undefined || typeof params.options.allowFileDiscovery === 'boolean');
|
|
209
|
+
}
|
|
210
|
+
export function assertDrivePermissionArgs(args) {
|
|
211
|
+
if (!isDrivePermissionArgs(args)) {
|
|
212
|
+
throw new Error('Invalid permission parameters. Required: email, options.fileId, options.role, options.type');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export function isDriveDeleteArgs(args) {
|
|
216
|
+
if (typeof args !== 'object' || args === null)
|
|
217
|
+
return false;
|
|
218
|
+
const params = args;
|
|
219
|
+
const fileId = readAliasedArg(args, 'file_id', 'fileId');
|
|
220
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
221
|
+
typeof fileId === 'string';
|
|
222
|
+
}
|
|
223
|
+
export function assertDriveDeleteArgs(args) {
|
|
224
|
+
if (!isDriveDeleteArgs(args)) {
|
|
225
|
+
throw new Error('Invalid delete parameters. Required: email, file_id');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export function isDriveCopyArgs(args) {
|
|
229
|
+
if (typeof args !== 'object' || args === null)
|
|
230
|
+
return false;
|
|
231
|
+
const params = args;
|
|
232
|
+
const rawParams = args;
|
|
233
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
234
|
+
const parentId = readAliasedArg(rawParams, 'parent_id', 'parentId');
|
|
235
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
236
|
+
typeof fileId === 'string' &&
|
|
237
|
+
(params.name === undefined || typeof params.name === 'string') &&
|
|
238
|
+
(parentId === undefined || typeof parentId === 'string');
|
|
239
|
+
}
|
|
240
|
+
export function assertDriveCopyArgs(args) {
|
|
241
|
+
if (!isDriveCopyArgs(args)) {
|
|
242
|
+
throw new Error('Invalid copy parameters. Required: file_id');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export function isDriveMoveArgs(args) {
|
|
246
|
+
if (typeof args !== 'object' || args === null)
|
|
247
|
+
return false;
|
|
248
|
+
const params = args;
|
|
249
|
+
const rawParams = args;
|
|
250
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
251
|
+
const newParentId = readAliasedArg(rawParams, 'new_parent_id', 'newParentId');
|
|
252
|
+
const removeFromParents = readAliasedArg(rawParams, 'remove_from_parents', 'removeFromParents');
|
|
253
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
254
|
+
typeof fileId === 'string' &&
|
|
255
|
+
typeof newParentId === 'string' &&
|
|
256
|
+
(removeFromParents === undefined || typeof removeFromParents === 'string');
|
|
257
|
+
}
|
|
258
|
+
export function assertDriveMoveArgs(args) {
|
|
259
|
+
if (!isDriveMoveArgs(args)) {
|
|
260
|
+
throw new Error('Invalid move parameters. Required: file_id, new_parent_id');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export function isDriveTrashArgs(args) {
|
|
264
|
+
if (typeof args !== 'object' || args === null)
|
|
265
|
+
return false;
|
|
266
|
+
const params = args;
|
|
267
|
+
const fileId = readAliasedArg(args, 'file_id', 'fileId');
|
|
268
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
269
|
+
typeof fileId === 'string';
|
|
270
|
+
}
|
|
271
|
+
export function assertDriveTrashArgs(args) {
|
|
272
|
+
if (!isDriveTrashArgs(args)) {
|
|
273
|
+
throw new Error('Invalid trash/untrash parameters. Required: file_id');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
export function isDriveRevisionsArgs(args) {
|
|
277
|
+
if (typeof args !== 'object' || args === null)
|
|
278
|
+
return false;
|
|
279
|
+
const params = args;
|
|
280
|
+
const fileId = readAliasedArg(args, 'file_id', 'fileId');
|
|
281
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
282
|
+
typeof fileId === 'string';
|
|
283
|
+
}
|
|
284
|
+
export function assertDriveRevisionsArgs(args) {
|
|
285
|
+
if (!isDriveRevisionsArgs(args)) {
|
|
286
|
+
throw new Error('Invalid revisions parameters. Required: file_id');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
export function isDriveDownloadRevisionArgs(args) {
|
|
290
|
+
if (typeof args !== 'object' || args === null)
|
|
291
|
+
return false;
|
|
292
|
+
const params = args;
|
|
293
|
+
const rawParams = args;
|
|
294
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
295
|
+
const revisionId = readAliasedArg(rawParams, 'revision_id', 'revisionId');
|
|
296
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
297
|
+
typeof fileId === 'string' &&
|
|
298
|
+
typeof revisionId === 'string';
|
|
299
|
+
}
|
|
300
|
+
export function assertDriveDownloadRevisionArgs(args) {
|
|
301
|
+
if (!isDriveDownloadRevisionArgs(args)) {
|
|
302
|
+
throw new Error('Invalid download revision parameters. Required: file_id, revision_id');
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
// Label Management Type Guards
|
|
306
|
+
export function isManageLabelParams(args) {
|
|
307
|
+
if (typeof args !== 'object' || args === null)
|
|
308
|
+
return false;
|
|
309
|
+
const params = args;
|
|
310
|
+
const rawParams = args;
|
|
311
|
+
const labelId = readAliasedArg(rawParams, 'label_id', 'labelId');
|
|
312
|
+
const messageListVisibility = readAliasedArg(rawParams, 'message_list_visibility', 'messageListVisibility');
|
|
313
|
+
const labelListVisibility = readAliasedArg(rawParams, 'label_list_visibility', 'labelListVisibility');
|
|
314
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
315
|
+
typeof params.action === 'string' &&
|
|
316
|
+
['create', 'read', 'update', 'delete'].includes(params.action) &&
|
|
317
|
+
(labelId === undefined || typeof labelId === 'string') &&
|
|
318
|
+
(messageListVisibility === undefined || ['show', 'hide'].includes(messageListVisibility)) &&
|
|
319
|
+
(labelListVisibility === undefined || ['labelShow', 'labelHide', 'labelShowIfUnread'].includes(labelListVisibility)) &&
|
|
320
|
+
(params.data === undefined || (() => {
|
|
321
|
+
if (typeof params.data !== 'object' || params.data === null)
|
|
322
|
+
return false;
|
|
323
|
+
const data = params.data;
|
|
324
|
+
return (data.name === undefined || typeof data.name === 'string') &&
|
|
325
|
+
(data.messageListVisibility === undefined || ['show', 'hide'].includes(data.messageListVisibility)) &&
|
|
326
|
+
(data.labelListVisibility === undefined || ['labelShow', 'labelHide', 'labelShowIfUnread'].includes(data.labelListVisibility));
|
|
327
|
+
})());
|
|
328
|
+
}
|
|
329
|
+
export function assertManageLabelParams(args) {
|
|
330
|
+
if (!isManageLabelParams(args)) {
|
|
331
|
+
throw new Error('Invalid label management parameters. Required: email, action');
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
export function isManageLabelAssignmentParams(args) {
|
|
335
|
+
if (typeof args !== 'object' || args === null)
|
|
336
|
+
return false;
|
|
337
|
+
const params = args;
|
|
338
|
+
const rawParams = args;
|
|
339
|
+
const messageId = readAliasedArg(rawParams, 'message_id', 'messageId');
|
|
340
|
+
const labelIds = readAliasedArg(rawParams, 'label_ids', 'labelIds');
|
|
341
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
342
|
+
typeof params.action === 'string' &&
|
|
343
|
+
['add', 'remove'].includes(params.action) &&
|
|
344
|
+
typeof messageId === 'string' &&
|
|
345
|
+
Array.isArray(labelIds) &&
|
|
346
|
+
labelIds.every((id) => typeof id === 'string');
|
|
347
|
+
}
|
|
348
|
+
export function assertManageLabelAssignmentParams(args) {
|
|
349
|
+
if (!isManageLabelAssignmentParams(args)) {
|
|
350
|
+
throw new Error('Invalid label assignment parameters. Required: email, action, message_id, label_ids');
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
export function isManageLabelFilterParams(args) {
|
|
354
|
+
if (typeof args !== 'object' || args === null)
|
|
355
|
+
return false;
|
|
356
|
+
const params = args;
|
|
357
|
+
const rawParams = args;
|
|
358
|
+
const filterId = readAliasedArg(rawParams, 'filter_id', 'filterId');
|
|
359
|
+
const labelId = readAliasedArg(rawParams, 'label_id', 'labelId');
|
|
360
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
361
|
+
typeof params.action === 'string' &&
|
|
362
|
+
['create', 'read', 'update', 'delete'].includes(params.action) &&
|
|
363
|
+
(filterId === undefined || typeof filterId === 'string') &&
|
|
364
|
+
(labelId === undefined || typeof labelId === 'string') &&
|
|
365
|
+
(params.data === undefined || (() => {
|
|
366
|
+
if (typeof params.data !== 'object' || params.data === null)
|
|
367
|
+
return false;
|
|
368
|
+
const data = params.data;
|
|
369
|
+
return (data.criteria === undefined || (typeof data.criteria === 'object' && data.criteria !== null)) &&
|
|
370
|
+
(data.actions === undefined || (typeof data.actions === 'object' &&
|
|
371
|
+
data.actions !== null &&
|
|
372
|
+
typeof data.actions.addLabel === 'boolean'));
|
|
373
|
+
})());
|
|
374
|
+
}
|
|
375
|
+
export function assertManageLabelFilterParams(args) {
|
|
376
|
+
if (!isManageLabelFilterParams(args)) {
|
|
377
|
+
throw new Error('Invalid label filter parameters. Required: email, action');
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
// Draft Management Type Guards
|
|
381
|
+
export function isManageDraftParams(args) {
|
|
382
|
+
if (typeof args !== 'object' || args === null)
|
|
383
|
+
return false;
|
|
384
|
+
const params = args;
|
|
385
|
+
const rawParams = args;
|
|
386
|
+
const draftId = readAliasedArg(rawParams, 'draft_id', 'draftId');
|
|
387
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
388
|
+
typeof params.action === 'string' &&
|
|
389
|
+
['create', 'read', 'update', 'delete', 'send'].includes(params.action) &&
|
|
390
|
+
(draftId === undefined || typeof draftId === 'string') &&
|
|
391
|
+
(params.data === undefined || (() => {
|
|
392
|
+
if (typeof params.data !== 'object' || params.data === null)
|
|
393
|
+
return false;
|
|
394
|
+
const data = params.data;
|
|
395
|
+
return (data.to === undefined || (Array.isArray(data.to) && data.to.every(to => typeof to === 'string'))) &&
|
|
396
|
+
(data.subject === undefined || typeof data.subject === 'string') &&
|
|
397
|
+
(data.body === undefined || typeof data.body === 'string') &&
|
|
398
|
+
(data.cc === undefined || (Array.isArray(data.cc) && data.cc.every(cc => typeof cc === 'string'))) &&
|
|
399
|
+
(data.bcc === undefined || (Array.isArray(data.bcc) && data.bcc.every(bcc => typeof bcc === 'string'))) &&
|
|
400
|
+
(data.isHtml === undefined || typeof data.isHtml === 'boolean') &&
|
|
401
|
+
(data.attachments === undefined || isValidAttachmentsArray(data.attachments)) &&
|
|
402
|
+
(data.replyToMessageId === undefined || typeof data.replyToMessageId === 'string') &&
|
|
403
|
+
(data.threadId === undefined || typeof data.threadId === 'string') &&
|
|
404
|
+
(data.references === undefined || (Array.isArray(data.references) && data.references.every(ref => typeof ref === 'string'))) &&
|
|
405
|
+
(data.inReplyTo === undefined || typeof data.inReplyTo === 'string');
|
|
406
|
+
})());
|
|
407
|
+
}
|
|
408
|
+
export function isManageAttachmentParams(args) {
|
|
409
|
+
if (typeof args !== 'object' || args === null)
|
|
410
|
+
return false;
|
|
411
|
+
const params = args;
|
|
412
|
+
const rawParams = args;
|
|
413
|
+
const messageId = readAliasedArg(rawParams, 'message_id', 'messageId');
|
|
414
|
+
const mimeType = readAliasedArg(rawParams, 'mime_type', 'mimeType');
|
|
415
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
416
|
+
typeof params.action === 'string' &&
|
|
417
|
+
['download', 'upload', 'delete'].includes(params.action) &&
|
|
418
|
+
typeof params.source === 'string' &&
|
|
419
|
+
['email', 'calendar'].includes(params.source) &&
|
|
420
|
+
typeof messageId === 'string' &&
|
|
421
|
+
typeof params.filename === 'string' &&
|
|
422
|
+
(mimeType === undefined || typeof mimeType === 'string') &&
|
|
423
|
+
(params.content === undefined || typeof params.content === 'string');
|
|
424
|
+
}
|
|
425
|
+
export function assertManageAttachmentParams(args) {
|
|
426
|
+
if (!isManageAttachmentParams(args)) {
|
|
427
|
+
throw new Error('Invalid attachment management parameters. Required: email, action, source, message_id, filename');
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
export function assertManageDraftParams(args) {
|
|
431
|
+
if (!isManageDraftParams(args)) {
|
|
432
|
+
throw new Error('Invalid draft management parameters. Required: email, action');
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
// Contacts Type Guards
|
|
436
|
+
export function isGetContactsParams(args) {
|
|
437
|
+
if (typeof args !== 'object' || args === null)
|
|
438
|
+
return false;
|
|
439
|
+
const params = args;
|
|
440
|
+
const rawParams = args;
|
|
441
|
+
const personFields = readAliasedArg(rawParams, 'person_fields', 'personFields');
|
|
442
|
+
const pageSize = readAliasedArg(rawParams, 'page_size', 'pageSize');
|
|
443
|
+
const pageToken = readAliasedArg(rawParams, 'page_token', 'pageToken');
|
|
444
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
445
|
+
typeof personFields === 'string' &&
|
|
446
|
+
(pageSize === undefined || typeof pageSize === 'number') &&
|
|
447
|
+
(pageToken === undefined || typeof pageToken === 'string');
|
|
448
|
+
}
|
|
449
|
+
export function assertGetContactsParams(args) {
|
|
450
|
+
if (!isGetContactsParams(args)) {
|
|
451
|
+
throw new Error('Invalid contacts parameters. Required: email, person_fields');
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
export function isReadDocumentArgs(args) {
|
|
455
|
+
if (typeof args !== 'object' || args === null)
|
|
456
|
+
return false;
|
|
457
|
+
const params = args;
|
|
458
|
+
const rawParams = args;
|
|
459
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
460
|
+
const maxChars = readAliasedArg(rawParams, 'max_chars', 'maxChars');
|
|
461
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
462
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
463
|
+
typeof documentId === 'string' &&
|
|
464
|
+
(maxChars === undefined || typeof maxChars === 'number') &&
|
|
465
|
+
(returnJson === undefined || typeof returnJson === 'boolean');
|
|
466
|
+
}
|
|
467
|
+
export function assertReadDocumentArgs(args) {
|
|
468
|
+
if (!isReadDocumentArgs(args)) {
|
|
469
|
+
throw new Error('Invalid read document parameters. Required: email, document_id');
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
export function isCreateDocumentArgs(args) {
|
|
473
|
+
if (typeof args !== 'object' || args === null)
|
|
474
|
+
return false;
|
|
475
|
+
const params = args;
|
|
476
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
477
|
+
typeof params.title === 'string' &&
|
|
478
|
+
(params.content === undefined || typeof params.content === 'string');
|
|
479
|
+
}
|
|
480
|
+
export function assertCreateDocumentArgs(args) {
|
|
481
|
+
if (!isCreateDocumentArgs(args)) {
|
|
482
|
+
throw new Error('Invalid create document parameters. Required: email, title');
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
export function isAppendDocumentArgs(args) {
|
|
486
|
+
if (typeof args !== 'object' || args === null)
|
|
487
|
+
return false;
|
|
488
|
+
const params = args;
|
|
489
|
+
const documentId = readAliasedArg(args, 'document_id', 'documentId');
|
|
490
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
491
|
+
typeof documentId === 'string' &&
|
|
492
|
+
typeof params.text === 'string';
|
|
493
|
+
}
|
|
494
|
+
export function assertAppendDocumentArgs(args) {
|
|
495
|
+
if (!isAppendDocumentArgs(args)) {
|
|
496
|
+
throw new Error('Invalid append document parameters. Required: email, document_id, text');
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
export function isReplaceDocumentArgs(args) {
|
|
500
|
+
if (typeof args !== 'object' || args === null)
|
|
501
|
+
return false;
|
|
502
|
+
const params = args;
|
|
503
|
+
const documentId = readAliasedArg(args, 'document_id', 'documentId');
|
|
504
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
505
|
+
typeof documentId === 'string' &&
|
|
506
|
+
typeof params.content === 'string';
|
|
507
|
+
}
|
|
508
|
+
export function assertReplaceDocumentArgs(args) {
|
|
509
|
+
if (!isReplaceDocumentArgs(args)) {
|
|
510
|
+
throw new Error('Invalid replace document parameters. Required: email, document_id, content');
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
export function isFindReplaceArgs(args) {
|
|
514
|
+
if (typeof args !== 'object' || args === null)
|
|
515
|
+
return false;
|
|
516
|
+
const params = args;
|
|
517
|
+
const rawParams = args;
|
|
518
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
519
|
+
const findText = readAliasedArg(rawParams, 'find_text', 'findText');
|
|
520
|
+
const replaceText = readAliasedArg(rawParams, 'replace_text', 'replaceText');
|
|
521
|
+
const matchCase = readAliasedArg(rawParams, 'match_case', 'matchCase');
|
|
522
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
523
|
+
typeof documentId === 'string' &&
|
|
524
|
+
typeof findText === 'string' &&
|
|
525
|
+
typeof replaceText === 'string' &&
|
|
526
|
+
(matchCase === undefined || typeof matchCase === 'boolean');
|
|
527
|
+
}
|
|
528
|
+
export function assertFindReplaceArgs(args) {
|
|
529
|
+
if (!isFindReplaceArgs(args)) {
|
|
530
|
+
throw new Error('Invalid find/replace parameters. Required: email, document_id, find_text, replace_text');
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
export function isExtractIdArgs(args) {
|
|
534
|
+
if (typeof args !== 'object' || args === null)
|
|
535
|
+
return false;
|
|
536
|
+
const params = args;
|
|
537
|
+
return typeof params.input === 'string';
|
|
538
|
+
}
|
|
539
|
+
export function assertExtractIdArgs(args) {
|
|
540
|
+
if (!isExtractIdArgs(args)) {
|
|
541
|
+
throw new Error('Invalid extract ID parameters. Required: input');
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
export function isListTabsArgs(args) {
|
|
545
|
+
if (typeof args !== 'object' || args === null)
|
|
546
|
+
return false;
|
|
547
|
+
const params = args;
|
|
548
|
+
const rawParams = args;
|
|
549
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
550
|
+
const includeWordCount = readAliasedArg(rawParams, 'include_word_count', 'includeWordCount');
|
|
551
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
552
|
+
typeof documentId === 'string' &&
|
|
553
|
+
(includeWordCount === undefined || typeof includeWordCount === 'boolean');
|
|
554
|
+
}
|
|
555
|
+
export function assertListTabsArgs(args) {
|
|
556
|
+
if (!isListTabsArgs(args)) {
|
|
557
|
+
throw new Error('Invalid list tabs parameters. Required: email, document_id');
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
export function isBatchUpdateDocumentArgs(args) {
|
|
561
|
+
if (typeof args !== 'object' || args === null)
|
|
562
|
+
return false;
|
|
563
|
+
const params = args;
|
|
564
|
+
const rawParams = args;
|
|
565
|
+
const documentId = readAliasedArg(rawParams, 'document_id', 'documentId');
|
|
566
|
+
const writeControl = readAliasedArg(rawParams, 'write_control', 'writeControl');
|
|
567
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
568
|
+
// Required fields
|
|
569
|
+
if (params.email !== undefined && typeof params.email !== 'string')
|
|
570
|
+
return false;
|
|
571
|
+
if (typeof documentId !== 'string')
|
|
572
|
+
return false;
|
|
573
|
+
// requests must be a non-empty array of objects
|
|
574
|
+
if (!Array.isArray(params.requests) || params.requests.length === 0)
|
|
575
|
+
return false;
|
|
576
|
+
if (!params.requests.every(r => typeof r === 'object' && r !== null))
|
|
577
|
+
return false;
|
|
578
|
+
// Optional writeControl validation
|
|
579
|
+
if (writeControl !== undefined) {
|
|
580
|
+
if (typeof writeControl !== 'object' || writeControl === null)
|
|
581
|
+
return false;
|
|
582
|
+
const wc = writeControl;
|
|
583
|
+
if (wc.requiredRevisionId !== undefined && typeof wc.requiredRevisionId !== 'string')
|
|
584
|
+
return false;
|
|
585
|
+
}
|
|
586
|
+
// Optional returnJson validation
|
|
587
|
+
if (returnJson !== undefined && typeof returnJson !== 'boolean')
|
|
588
|
+
return false;
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
export function assertBatchUpdateDocumentArgs(args) {
|
|
592
|
+
if (!isBatchUpdateDocumentArgs(args)) {
|
|
593
|
+
throw new Error('Invalid batch update document parameters. Required: document_id, requests (non-empty array of objects)');
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
export function isReadPresentationArgs(args) {
|
|
597
|
+
if (typeof args !== 'object' || args === null)
|
|
598
|
+
return false;
|
|
599
|
+
const params = args;
|
|
600
|
+
const rawParams = args;
|
|
601
|
+
const presentationId = readAliasedArg(rawParams, 'presentation_id', 'presentationId');
|
|
602
|
+
const maxChars = readAliasedArg(rawParams, 'max_chars', 'maxChars');
|
|
603
|
+
const includeNotes = readAliasedArg(rawParams, 'include_notes', 'includeNotes');
|
|
604
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
605
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
606
|
+
typeof presentationId === 'string' &&
|
|
607
|
+
(maxChars === undefined || typeof maxChars === 'number') &&
|
|
608
|
+
(includeNotes === undefined || typeof includeNotes === 'boolean') &&
|
|
609
|
+
(returnJson === undefined || typeof returnJson === 'boolean');
|
|
610
|
+
}
|
|
611
|
+
export function assertReadPresentationArgs(args) {
|
|
612
|
+
if (!isReadPresentationArgs(args)) {
|
|
613
|
+
throw new Error('Invalid read presentation parameters. Required: email, presentation_id');
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
export function isCreatePresentationArgs(args) {
|
|
617
|
+
if (typeof args !== 'object' || args === null)
|
|
618
|
+
return false;
|
|
619
|
+
const params = args;
|
|
620
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
621
|
+
typeof params.title === 'string';
|
|
622
|
+
}
|
|
623
|
+
export function assertCreatePresentationArgs(args) {
|
|
624
|
+
if (!isCreatePresentationArgs(args)) {
|
|
625
|
+
throw new Error('Invalid create presentation parameters. Required: email, title');
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
export function isListSlidesArgs(args) {
|
|
629
|
+
if (typeof args !== 'object' || args === null)
|
|
630
|
+
return false;
|
|
631
|
+
const params = args;
|
|
632
|
+
const rawParams = args;
|
|
633
|
+
const presentationId = readAliasedArg(rawParams, 'presentation_id', 'presentationId');
|
|
634
|
+
const includeNotes = readAliasedArg(rawParams, 'include_notes', 'includeNotes');
|
|
635
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
636
|
+
typeof presentationId === 'string' &&
|
|
637
|
+
(includeNotes === undefined || typeof includeNotes === 'boolean');
|
|
638
|
+
}
|
|
639
|
+
export function assertListSlidesArgs(args) {
|
|
640
|
+
if (!isListSlidesArgs(args)) {
|
|
641
|
+
throw new Error('Invalid list slides parameters. Required: email, presentation_id');
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
export function isGetSlideArgs(args) {
|
|
645
|
+
if (typeof args !== 'object' || args === null)
|
|
646
|
+
return false;
|
|
647
|
+
const params = args;
|
|
648
|
+
const rawParams = args;
|
|
649
|
+
const presentationId = readAliasedArg(rawParams, 'presentation_id', 'presentationId');
|
|
650
|
+
const slideIndex = readAliasedArg(rawParams, 'slide_index', 'slideIndex');
|
|
651
|
+
const maxChars = readAliasedArg(rawParams, 'max_chars', 'maxChars');
|
|
652
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
653
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
654
|
+
typeof presentationId === 'string' &&
|
|
655
|
+
(slideIndex === undefined || typeof slideIndex === 'number') &&
|
|
656
|
+
(maxChars === undefined || typeof maxChars === 'number') &&
|
|
657
|
+
(returnJson === undefined || typeof returnJson === 'boolean');
|
|
658
|
+
}
|
|
659
|
+
export function assertGetSlideArgs(args) {
|
|
660
|
+
if (!isGetSlideArgs(args)) {
|
|
661
|
+
throw new Error('Invalid get slide parameters. Required: email, presentation_id');
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
export function isExtractPresentationIdArgs(args) {
|
|
665
|
+
if (typeof args !== 'object' || args === null)
|
|
666
|
+
return false;
|
|
667
|
+
const params = args;
|
|
668
|
+
return typeof params.input === 'string';
|
|
669
|
+
}
|
|
670
|
+
export function assertExtractPresentationIdArgs(args) {
|
|
671
|
+
if (!isExtractPresentationIdArgs(args)) {
|
|
672
|
+
throw new Error('Invalid extract presentation ID parameters. Required: input');
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
export function isReadSpreadsheetArgs(args) {
|
|
676
|
+
if (typeof args !== 'object' || args === null)
|
|
677
|
+
return false;
|
|
678
|
+
const params = args;
|
|
679
|
+
const rawParams = args;
|
|
680
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
681
|
+
const maxRows = readAliasedArg(rawParams, 'max_rows', 'maxRows');
|
|
682
|
+
const maxCols = readAliasedArg(rawParams, 'max_cols', 'maxCols');
|
|
683
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
684
|
+
const valueView = readAliasedArg(rawParams, 'value_view', 'valueView');
|
|
685
|
+
const anchorMode = readAliasedArg(rawParams, 'anchor_mode', 'anchorMode');
|
|
686
|
+
const continuationToken = readAliasedArg(rawParams, 'continuation_token', 'continuationToken');
|
|
687
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
688
|
+
typeof spreadsheetId === 'string' &&
|
|
689
|
+
(params.range === undefined || typeof params.range === 'string') &&
|
|
690
|
+
(maxRows === undefined || typeof maxRows === 'number') &&
|
|
691
|
+
(maxCols === undefined || typeof maxCols === 'number') &&
|
|
692
|
+
(returnJson === undefined || typeof returnJson === 'boolean') &&
|
|
693
|
+
(valueView === undefined || ['formatted', 'shaped', 'formula', 'unformatted'].includes(valueView)) &&
|
|
694
|
+
(anchorMode === undefined || ['auto', 'always', 'never'].includes(anchorMode)) &&
|
|
695
|
+
(continuationToken === undefined || typeof continuationToken === 'string');
|
|
696
|
+
}
|
|
697
|
+
export function assertReadSpreadsheetArgs(args) {
|
|
698
|
+
if (!isReadSpreadsheetArgs(args)) {
|
|
699
|
+
throw new Error('Invalid read spreadsheet parameters. Required: email, spreadsheet_id');
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
export function isReadSpreadsheetValuesArgs(args) {
|
|
703
|
+
if (typeof args !== 'object' || args === null)
|
|
704
|
+
return false;
|
|
705
|
+
const params = args;
|
|
706
|
+
const rawParams = args;
|
|
707
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
708
|
+
const majorDimension = readAliasedArg(rawParams, 'major_dimension', 'majorDimension');
|
|
709
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
710
|
+
const valueView = readAliasedArg(rawParams, 'value_view', 'valueView');
|
|
711
|
+
const anchorMode = readAliasedArg(rawParams, 'anchor_mode', 'anchorMode');
|
|
712
|
+
const continuationToken = readAliasedArg(rawParams, 'continuation_token', 'continuationToken');
|
|
713
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
714
|
+
typeof spreadsheetId === 'string' &&
|
|
715
|
+
typeof params.range === 'string' &&
|
|
716
|
+
(majorDimension === undefined || majorDimension === 'ROWS' || majorDimension === 'COLUMNS') &&
|
|
717
|
+
(returnJson === undefined || typeof returnJson === 'boolean') &&
|
|
718
|
+
(valueView === undefined || ['formatted', 'shaped', 'formula', 'unformatted'].includes(valueView)) &&
|
|
719
|
+
(anchorMode === undefined || ['auto', 'always', 'never'].includes(anchorMode)) &&
|
|
720
|
+
(continuationToken === undefined || typeof continuationToken === 'string');
|
|
721
|
+
}
|
|
722
|
+
export function assertReadSpreadsheetValuesArgs(args) {
|
|
723
|
+
if (!isReadSpreadsheetValuesArgs(args)) {
|
|
724
|
+
throw new Error('Invalid read spreadsheet values parameters. Required: email, spreadsheet_id, range');
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
export function isCreateSpreadsheetArgs(args) {
|
|
728
|
+
if (typeof args !== 'object' || args === null)
|
|
729
|
+
return false;
|
|
730
|
+
const params = args;
|
|
731
|
+
const sheetTitles = readAliasedArg(args, 'sheet_titles', 'sheetTitles');
|
|
732
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
733
|
+
typeof params.title === 'string' &&
|
|
734
|
+
(sheetTitles === undefined || (Array.isArray(sheetTitles) && sheetTitles.every(t => typeof t === 'string')));
|
|
735
|
+
}
|
|
736
|
+
export function assertCreateSpreadsheetArgs(args) {
|
|
737
|
+
if (!isCreateSpreadsheetArgs(args)) {
|
|
738
|
+
throw new Error('Invalid create spreadsheet parameters. Required: email, title');
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
export function isAppendSpreadsheetArgs(args) {
|
|
742
|
+
if (typeof args !== 'object' || args === null)
|
|
743
|
+
return false;
|
|
744
|
+
const params = args;
|
|
745
|
+
const rawParams = args;
|
|
746
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
747
|
+
const valueInputOption = readAliasedArg(rawParams, 'value_input_option', 'valueInputOption');
|
|
748
|
+
const overwriteFormulas = readAliasedArg(rawParams, 'overwrite_formulas', 'overwriteFormulas');
|
|
749
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
750
|
+
typeof spreadsheetId === 'string' &&
|
|
751
|
+
typeof params.range === 'string' &&
|
|
752
|
+
Array.isArray(params.values) &&
|
|
753
|
+
params.values.every(row => Array.isArray(row)) &&
|
|
754
|
+
(valueInputOption === undefined || valueInputOption === 'RAW' || valueInputOption === 'USER_ENTERED') &&
|
|
755
|
+
(overwriteFormulas === undefined || typeof overwriteFormulas === 'boolean');
|
|
756
|
+
}
|
|
757
|
+
export function assertAppendSpreadsheetArgs(args) {
|
|
758
|
+
if (!isAppendSpreadsheetArgs(args)) {
|
|
759
|
+
throw new Error('Invalid append spreadsheet parameters. Required: email, spreadsheet_id, range, values');
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
export function isUpdateSpreadsheetValuesArgs(args) {
|
|
763
|
+
if (typeof args !== 'object' || args === null)
|
|
764
|
+
return false;
|
|
765
|
+
const params = args;
|
|
766
|
+
const rawParams = args;
|
|
767
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
768
|
+
const valueInputOption = readAliasedArg(rawParams, 'value_input_option', 'valueInputOption');
|
|
769
|
+
const overwriteFormulas = readAliasedArg(rawParams, 'overwrite_formulas', 'overwriteFormulas');
|
|
770
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
771
|
+
typeof spreadsheetId === 'string' &&
|
|
772
|
+
typeof params.range === 'string' &&
|
|
773
|
+
Array.isArray(params.values) &&
|
|
774
|
+
params.values.every(row => Array.isArray(row)) &&
|
|
775
|
+
(valueInputOption === undefined || valueInputOption === 'RAW' || valueInputOption === 'USER_ENTERED') &&
|
|
776
|
+
(overwriteFormulas === undefined || typeof overwriteFormulas === 'boolean');
|
|
777
|
+
}
|
|
778
|
+
export function assertUpdateSpreadsheetValuesArgs(args) {
|
|
779
|
+
if (!isUpdateSpreadsheetValuesArgs(args)) {
|
|
780
|
+
throw new Error('Invalid update spreadsheet values parameters. Required: email, spreadsheet_id, range, values');
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
export function isClearSpreadsheetValuesArgs(args) {
|
|
784
|
+
if (typeof args !== 'object' || args === null)
|
|
785
|
+
return false;
|
|
786
|
+
const params = args;
|
|
787
|
+
const spreadsheetId = readAliasedArg(args, 'spreadsheet_id', 'spreadsheetId');
|
|
788
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
789
|
+
typeof spreadsheetId === 'string' &&
|
|
790
|
+
typeof params.range === 'string';
|
|
791
|
+
}
|
|
792
|
+
export function assertClearSpreadsheetValuesArgs(args) {
|
|
793
|
+
if (!isClearSpreadsheetValuesArgs(args)) {
|
|
794
|
+
throw new Error('Invalid clear spreadsheet values parameters. Required: email, spreadsheet_id, range');
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
export function isListSpreadsheetSheetsArgs(args) {
|
|
798
|
+
if (typeof args !== 'object' || args === null)
|
|
799
|
+
return false;
|
|
800
|
+
const params = args;
|
|
801
|
+
const spreadsheetId = readAliasedArg(args, 'spreadsheet_id', 'spreadsheetId');
|
|
802
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
803
|
+
typeof spreadsheetId === 'string';
|
|
804
|
+
}
|
|
805
|
+
export function assertListSpreadsheetSheetsArgs(args) {
|
|
806
|
+
if (!isListSpreadsheetSheetsArgs(args)) {
|
|
807
|
+
throw new Error('Invalid list spreadsheet sheets parameters. Required: email, spreadsheet_id');
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
export function isAddSpreadsheetSheetArgs(args) {
|
|
811
|
+
if (typeof args !== 'object' || args === null)
|
|
812
|
+
return false;
|
|
813
|
+
const params = args;
|
|
814
|
+
const rawParams = args;
|
|
815
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
816
|
+
const rowCount = readAliasedArg(rawParams, 'row_count', 'rowCount');
|
|
817
|
+
const columnCount = readAliasedArg(rawParams, 'column_count', 'columnCount');
|
|
818
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
819
|
+
typeof spreadsheetId === 'string' &&
|
|
820
|
+
typeof params.title === 'string' &&
|
|
821
|
+
(rowCount === undefined || typeof rowCount === 'number') &&
|
|
822
|
+
(columnCount === undefined || typeof columnCount === 'number');
|
|
823
|
+
}
|
|
824
|
+
export function assertAddSpreadsheetSheetArgs(args) {
|
|
825
|
+
if (!isAddSpreadsheetSheetArgs(args)) {
|
|
826
|
+
throw new Error('Invalid add spreadsheet sheet parameters. Required: email, spreadsheet_id, title');
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
export function isDeleteSpreadsheetSheetArgs(args) {
|
|
830
|
+
if (typeof args !== 'object' || args === null)
|
|
831
|
+
return false;
|
|
832
|
+
const params = args;
|
|
833
|
+
const rawParams = args;
|
|
834
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
835
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
836
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
837
|
+
typeof spreadsheetId === 'string' &&
|
|
838
|
+
typeof sheetId === 'number';
|
|
839
|
+
}
|
|
840
|
+
export function assertDeleteSpreadsheetSheetArgs(args) {
|
|
841
|
+
if (!isDeleteSpreadsheetSheetArgs(args)) {
|
|
842
|
+
throw new Error('Invalid delete spreadsheet sheet parameters. Required: email, spreadsheet_id, sheet_id');
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
export function isExtractSpreadsheetIdArgs(args) {
|
|
846
|
+
if (typeof args !== 'object' || args === null)
|
|
847
|
+
return false;
|
|
848
|
+
const params = args;
|
|
849
|
+
return typeof params.input === 'string';
|
|
850
|
+
}
|
|
851
|
+
export function assertExtractSpreadsheetIdArgs(args) {
|
|
852
|
+
if (!isExtractSpreadsheetIdArgs(args)) {
|
|
853
|
+
throw new Error('Invalid extract spreadsheet ID parameters. Required: input');
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
export function isBatchGetSpreadsheetValuesArgs(args) {
|
|
857
|
+
if (typeof args !== 'object' || args === null)
|
|
858
|
+
return false;
|
|
859
|
+
const params = args;
|
|
860
|
+
const rawParams = args;
|
|
861
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
862
|
+
const majorDimension = readAliasedArg(rawParams, 'major_dimension', 'majorDimension');
|
|
863
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
864
|
+
const valueView = readAliasedArg(rawParams, 'value_view', 'valueView');
|
|
865
|
+
const anchorMode = readAliasedArg(rawParams, 'anchor_mode', 'anchorMode');
|
|
866
|
+
const continuationToken = readAliasedArg(rawParams, 'continuation_token', 'continuationToken');
|
|
867
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
868
|
+
typeof spreadsheetId === 'string' &&
|
|
869
|
+
Array.isArray(params.ranges) &&
|
|
870
|
+
params.ranges.every(r => typeof r === 'string') &&
|
|
871
|
+
(majorDimension === undefined || majorDimension === 'ROWS' || majorDimension === 'COLUMNS') &&
|
|
872
|
+
(returnJson === undefined || typeof returnJson === 'boolean') &&
|
|
873
|
+
(valueView === undefined || ['formatted', 'shaped', 'formula', 'unformatted'].includes(valueView)) &&
|
|
874
|
+
(anchorMode === undefined || ['auto', 'always', 'never'].includes(anchorMode)) &&
|
|
875
|
+
(continuationToken === undefined || typeof continuationToken === 'string');
|
|
876
|
+
}
|
|
877
|
+
export function assertBatchGetSpreadsheetValuesArgs(args) {
|
|
878
|
+
if (!isBatchGetSpreadsheetValuesArgs(args)) {
|
|
879
|
+
throw new Error('Invalid batch get spreadsheet values parameters. Required: email, spreadsheet_id, ranges (array of strings)');
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
export function isBatchUpdateSpreadsheetValuesArgs(args) {
|
|
883
|
+
if (typeof args !== 'object' || args === null)
|
|
884
|
+
return false;
|
|
885
|
+
const params = args;
|
|
886
|
+
const rawParams = args;
|
|
887
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
888
|
+
const valueInputOption = readAliasedArg(rawParams, 'value_input_option', 'valueInputOption');
|
|
889
|
+
const overwriteFormulas = readAliasedArg(rawParams, 'overwrite_formulas', 'overwriteFormulas');
|
|
890
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
891
|
+
typeof spreadsheetId === 'string' &&
|
|
892
|
+
Array.isArray(params.data) &&
|
|
893
|
+
params.data.every(d => {
|
|
894
|
+
if (typeof d !== 'object' || d === null)
|
|
895
|
+
return false;
|
|
896
|
+
const item = d;
|
|
897
|
+
if (typeof item.range !== 'string')
|
|
898
|
+
return false;
|
|
899
|
+
if (!Array.isArray(item.values))
|
|
900
|
+
return false;
|
|
901
|
+
// Validate that values is a 2D array (each row must be an array)
|
|
902
|
+
return item.values.every(row => Array.isArray(row));
|
|
903
|
+
}) &&
|
|
904
|
+
(valueInputOption === undefined || valueInputOption === 'RAW' || valueInputOption === 'USER_ENTERED') &&
|
|
905
|
+
(overwriteFormulas === undefined || typeof overwriteFormulas === 'boolean');
|
|
906
|
+
}
|
|
907
|
+
export function assertBatchUpdateSpreadsheetValuesArgs(args) {
|
|
908
|
+
if (!isBatchUpdateSpreadsheetValuesArgs(args)) {
|
|
909
|
+
throw new Error('Invalid batch update spreadsheet values parameters. Required: email, spreadsheet_id, data (array of {range, values})');
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
export function isFindReplaceSpreadsheetArgs(args) {
|
|
913
|
+
if (typeof args !== 'object' || args === null)
|
|
914
|
+
return false;
|
|
915
|
+
const params = args;
|
|
916
|
+
const rawParams = args;
|
|
917
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
918
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
919
|
+
const matchCase = readAliasedArg(rawParams, 'match_case', 'matchCase');
|
|
920
|
+
const matchEntireCell = readAliasedArg(rawParams, 'match_entire_cell', 'matchEntireCell');
|
|
921
|
+
const searchByRegex = readAliasedArg(rawParams, 'search_by_regex', 'searchByRegex');
|
|
922
|
+
const includeFormulas = readAliasedArg(rawParams, 'include_formulas', 'includeFormulas');
|
|
923
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
924
|
+
typeof spreadsheetId === 'string' &&
|
|
925
|
+
typeof params.find === 'string' &&
|
|
926
|
+
typeof params.replacement === 'string' &&
|
|
927
|
+
(sheetId === undefined || typeof sheetId === 'number') &&
|
|
928
|
+
(matchCase === undefined || typeof matchCase === 'boolean') &&
|
|
929
|
+
(matchEntireCell === undefined || typeof matchEntireCell === 'boolean') &&
|
|
930
|
+
(searchByRegex === undefined || typeof searchByRegex === 'boolean') &&
|
|
931
|
+
(includeFormulas === undefined || typeof includeFormulas === 'boolean');
|
|
932
|
+
}
|
|
933
|
+
export function assertFindReplaceSpreadsheetArgs(args) {
|
|
934
|
+
if (!isFindReplaceSpreadsheetArgs(args)) {
|
|
935
|
+
throw new Error('Invalid find and replace parameters. Required: email, spreadsheet_id, find, replacement');
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
function isValidCellColor(color) {
|
|
939
|
+
if (typeof color !== 'object' || color === null)
|
|
940
|
+
return false;
|
|
941
|
+
const c = color;
|
|
942
|
+
return (c.red === undefined || typeof c.red === 'number') &&
|
|
943
|
+
(c.green === undefined || typeof c.green === 'number') &&
|
|
944
|
+
(c.blue === undefined || typeof c.blue === 'number') &&
|
|
945
|
+
(c.alpha === undefined || typeof c.alpha === 'number');
|
|
946
|
+
}
|
|
947
|
+
export function isFormatSpreadsheetCellsArgs(args) {
|
|
948
|
+
if (typeof args !== 'object' || args === null)
|
|
949
|
+
return false;
|
|
950
|
+
const params = args;
|
|
951
|
+
const rawParams = args;
|
|
952
|
+
const spreadsheetId = readAliasedArg(rawParams, 'spreadsheet_id', 'spreadsheetId');
|
|
953
|
+
const sheetId = readAliasedArg(rawParams, 'sheet_id', 'sheetId');
|
|
954
|
+
const startRowIndex = readAliasedArg(rawParams, 'start_row_index', 'startRowIndex');
|
|
955
|
+
const endRowIndex = readAliasedArg(rawParams, 'end_row_index', 'endRowIndex');
|
|
956
|
+
const startColumnIndex = readAliasedArg(rawParams, 'start_column_index', 'startColumnIndex');
|
|
957
|
+
const endColumnIndex = readAliasedArg(rawParams, 'end_column_index', 'endColumnIndex');
|
|
958
|
+
const fontSize = readAliasedArg(rawParams, 'font_size', 'fontSize');
|
|
959
|
+
const textColor = readAliasedArg(rawParams, 'text_color', 'textColor');
|
|
960
|
+
const backgroundColor = readAliasedArg(rawParams, 'background_color', 'backgroundColor');
|
|
961
|
+
const borderStyle = readAliasedArg(rawParams, 'border_style', 'borderStyle');
|
|
962
|
+
const borderColor = readAliasedArg(rawParams, 'border_color', 'borderColor');
|
|
963
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
964
|
+
typeof spreadsheetId === 'string' &&
|
|
965
|
+
typeof sheetId === 'number' &&
|
|
966
|
+
typeof startRowIndex === 'number' &&
|
|
967
|
+
typeof endRowIndex === 'number' &&
|
|
968
|
+
typeof startColumnIndex === 'number' &&
|
|
969
|
+
typeof endColumnIndex === 'number' &&
|
|
970
|
+
(params.bold === undefined || typeof params.bold === 'boolean') &&
|
|
971
|
+
(params.italic === undefined || typeof params.italic === 'boolean') &&
|
|
972
|
+
(params.underline === undefined || typeof params.underline === 'boolean') &&
|
|
973
|
+
(params.strikethrough === undefined || typeof params.strikethrough === 'boolean') &&
|
|
974
|
+
(fontSize === undefined || typeof fontSize === 'number') &&
|
|
975
|
+
(textColor === undefined || isValidCellColor(textColor)) &&
|
|
976
|
+
(backgroundColor === undefined || isValidCellColor(backgroundColor)) &&
|
|
977
|
+
(borderStyle === undefined || typeof borderStyle === 'string') &&
|
|
978
|
+
(borderColor === undefined || isValidCellColor(borderColor));
|
|
979
|
+
}
|
|
980
|
+
export function assertFormatSpreadsheetCellsArgs(args) {
|
|
981
|
+
if (!isFormatSpreadsheetCellsArgs(args)) {
|
|
982
|
+
throw new Error('Invalid format cells parameters. Required: email, spreadsheet_id, sheet_id, start_row_index, end_row_index, start_column_index, end_column_index');
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
export function isBatchUpdatePresentationArgs(args) {
|
|
986
|
+
if (typeof args !== 'object' || args === null)
|
|
987
|
+
return false;
|
|
988
|
+
const params = args;
|
|
989
|
+
const rawParams = args;
|
|
990
|
+
const presentationId = readAliasedArg(rawParams, 'presentation_id', 'presentationId');
|
|
991
|
+
const writeControl = readAliasedArg(rawParams, 'write_control', 'writeControl');
|
|
992
|
+
const returnJson = readAliasedArg(rawParams, 'return_json', 'returnJson');
|
|
993
|
+
// Required fields
|
|
994
|
+
if (params.email !== undefined && typeof params.email !== 'string')
|
|
995
|
+
return false;
|
|
996
|
+
if (typeof presentationId !== 'string')
|
|
997
|
+
return false;
|
|
998
|
+
// requests must be a non-empty array of objects
|
|
999
|
+
if (!Array.isArray(params.requests) || params.requests.length === 0)
|
|
1000
|
+
return false;
|
|
1001
|
+
if (!params.requests.every(r => typeof r === 'object' && r !== null))
|
|
1002
|
+
return false;
|
|
1003
|
+
// Optional writeControl validation
|
|
1004
|
+
if (writeControl !== undefined) {
|
|
1005
|
+
if (typeof writeControl !== 'object' || writeControl === null)
|
|
1006
|
+
return false;
|
|
1007
|
+
const wc = writeControl;
|
|
1008
|
+
if (wc.requiredRevisionId !== undefined && typeof wc.requiredRevisionId !== 'string')
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
// Optional returnJson validation
|
|
1012
|
+
if (returnJson !== undefined && typeof returnJson !== 'boolean')
|
|
1013
|
+
return false;
|
|
1014
|
+
return true;
|
|
1015
|
+
}
|
|
1016
|
+
export function assertBatchUpdatePresentationArgs(args) {
|
|
1017
|
+
if (!isBatchUpdatePresentationArgs(args)) {
|
|
1018
|
+
throw new Error('Invalid batch update presentation parameters. Required: presentation_id, requests (non-empty array of objects)');
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
export function isGetSlideThumbnailArgs(args) {
|
|
1022
|
+
if (typeof args !== 'object' || args === null)
|
|
1023
|
+
return false;
|
|
1024
|
+
const params = args;
|
|
1025
|
+
const rawParams = args;
|
|
1026
|
+
const presentationId = readAliasedArg(rawParams, 'presentation_id', 'presentationId');
|
|
1027
|
+
const slideId = readAliasedArg(rawParams, 'slide_id', 'slideId');
|
|
1028
|
+
const thumbnailSize = readAliasedArg(rawParams, 'thumbnail_size', 'thumbnailSize');
|
|
1029
|
+
// Required fields
|
|
1030
|
+
if (params.email !== undefined && typeof params.email !== 'string')
|
|
1031
|
+
return false;
|
|
1032
|
+
if (typeof presentationId !== 'string')
|
|
1033
|
+
return false;
|
|
1034
|
+
if (typeof slideId !== 'string')
|
|
1035
|
+
return false;
|
|
1036
|
+
// Optional thumbnailSize validation
|
|
1037
|
+
if (thumbnailSize !== undefined) {
|
|
1038
|
+
if (!['SMALL', 'MEDIUM', 'LARGE'].includes(thumbnailSize))
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
return true;
|
|
1042
|
+
}
|
|
1043
|
+
export function assertGetSlideThumbnailArgs(args) {
|
|
1044
|
+
if (!isGetSlideThumbnailArgs(args)) {
|
|
1045
|
+
throw new Error('Invalid get slide thumbnail parameters. Required: presentation_id, slide_id');
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
export function isListTaskListsArgs(args) {
|
|
1049
|
+
if (typeof args !== 'object' || args === null)
|
|
1050
|
+
return false;
|
|
1051
|
+
const params = args;
|
|
1052
|
+
return params.email === undefined || typeof params.email === 'string';
|
|
1053
|
+
}
|
|
1054
|
+
export function assertListTaskListsArgs(args) {
|
|
1055
|
+
if (!isListTaskListsArgs(args)) {
|
|
1056
|
+
throw new Error('Invalid list task lists parameters. email must be a string or undefined.');
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
export function isListTasksArgs(args) {
|
|
1060
|
+
if (typeof args !== 'object' || args === null)
|
|
1061
|
+
return false;
|
|
1062
|
+
const params = args;
|
|
1063
|
+
const rawParams = args;
|
|
1064
|
+
const taskListId = readAliasedArg(rawParams, 'task_list_id', 'taskListId');
|
|
1065
|
+
const maxResults = readAliasedArg(rawParams, 'max_results', 'maxResults');
|
|
1066
|
+
const pageToken = readAliasedArg(rawParams, 'page_token', 'pageToken');
|
|
1067
|
+
const showCompleted = readAliasedArg(rawParams, 'show_completed', 'showCompleted');
|
|
1068
|
+
const showHidden = readAliasedArg(rawParams, 'show_hidden', 'showHidden');
|
|
1069
|
+
const dueMin = readAliasedArg(rawParams, 'due_min', 'dueMin');
|
|
1070
|
+
const dueMax = readAliasedArg(rawParams, 'due_max', 'dueMax');
|
|
1071
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1072
|
+
(taskListId === undefined || typeof taskListId === 'string') &&
|
|
1073
|
+
(maxResults === undefined || typeof maxResults === 'number') &&
|
|
1074
|
+
(pageToken === undefined || typeof pageToken === 'string') &&
|
|
1075
|
+
(showCompleted === undefined || typeof showCompleted === 'boolean') &&
|
|
1076
|
+
(showHidden === undefined || typeof showHidden === 'boolean') &&
|
|
1077
|
+
(dueMin === undefined || typeof dueMin === 'string') &&
|
|
1078
|
+
(dueMax === undefined || typeof dueMax === 'string');
|
|
1079
|
+
}
|
|
1080
|
+
export function assertListTasksArgs(args) {
|
|
1081
|
+
if (!isListTasksArgs(args)) {
|
|
1082
|
+
throw new Error('Invalid list tasks parameters. Check parameter types.');
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
export function isCreateTaskArgs(args) {
|
|
1086
|
+
if (typeof args !== 'object' || args === null)
|
|
1087
|
+
return false;
|
|
1088
|
+
const params = args;
|
|
1089
|
+
const taskListId = readAliasedArg(args, 'task_list_id', 'taskListId');
|
|
1090
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1091
|
+
(taskListId === undefined || typeof taskListId === 'string') &&
|
|
1092
|
+
typeof params.title === 'string' &&
|
|
1093
|
+
(params.notes === undefined || typeof params.notes === 'string') &&
|
|
1094
|
+
(params.due === undefined || typeof params.due === 'string');
|
|
1095
|
+
}
|
|
1096
|
+
export function assertCreateTaskArgs(args) {
|
|
1097
|
+
if (!isCreateTaskArgs(args)) {
|
|
1098
|
+
throw new Error('Invalid create task parameters. Required: title (string).');
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
export function isUpdateTaskArgs(args) {
|
|
1102
|
+
if (typeof args !== 'object' || args === null)
|
|
1103
|
+
return false;
|
|
1104
|
+
const params = args;
|
|
1105
|
+
const rawParams = args;
|
|
1106
|
+
const taskListId = readAliasedArg(rawParams, 'task_list_id', 'taskListId');
|
|
1107
|
+
const taskId = readAliasedArg(rawParams, 'task_id', 'taskId');
|
|
1108
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1109
|
+
(taskListId === undefined || typeof taskListId === 'string') &&
|
|
1110
|
+
typeof taskId === 'string' &&
|
|
1111
|
+
(params.title === undefined || typeof params.title === 'string') &&
|
|
1112
|
+
(params.notes === undefined || typeof params.notes === 'string') &&
|
|
1113
|
+
(params.due === undefined || typeof params.due === 'string') &&
|
|
1114
|
+
(params.status === undefined || params.status === 'needsAction' || params.status === 'completed');
|
|
1115
|
+
}
|
|
1116
|
+
export function assertUpdateTaskArgs(args) {
|
|
1117
|
+
if (!isUpdateTaskArgs(args)) {
|
|
1118
|
+
throw new Error('Invalid update task parameters. Required: task_id (string). Optional: title, notes, due, status.');
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
export function isCompleteTaskArgs(args) {
|
|
1122
|
+
if (typeof args !== 'object' || args === null)
|
|
1123
|
+
return false;
|
|
1124
|
+
const params = args;
|
|
1125
|
+
const rawParams = args;
|
|
1126
|
+
const taskListId = readAliasedArg(rawParams, 'task_list_id', 'taskListId');
|
|
1127
|
+
const taskId = readAliasedArg(rawParams, 'task_id', 'taskId');
|
|
1128
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1129
|
+
(taskListId === undefined || typeof taskListId === 'string') &&
|
|
1130
|
+
typeof taskId === 'string';
|
|
1131
|
+
}
|
|
1132
|
+
export function assertCompleteTaskArgs(args) {
|
|
1133
|
+
if (!isCompleteTaskArgs(args)) {
|
|
1134
|
+
throw new Error('Invalid complete task parameters. Required: task_id (string).');
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
export function isDeleteTaskArgs(args) {
|
|
1138
|
+
if (typeof args !== 'object' || args === null)
|
|
1139
|
+
return false;
|
|
1140
|
+
const params = args;
|
|
1141
|
+
const rawParams = args;
|
|
1142
|
+
const taskListId = readAliasedArg(rawParams, 'task_list_id', 'taskListId');
|
|
1143
|
+
const taskId = readAliasedArg(rawParams, 'task_id', 'taskId');
|
|
1144
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1145
|
+
(taskListId === undefined || typeof taskListId === 'string') &&
|
|
1146
|
+
typeof taskId === 'string';
|
|
1147
|
+
}
|
|
1148
|
+
export function assertDeleteTaskArgs(args) {
|
|
1149
|
+
if (!isDeleteTaskArgs(args)) {
|
|
1150
|
+
throw new Error('Invalid delete task parameters. Required: task_id (string).');
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
export function isListFormsArgs(args) {
|
|
1154
|
+
if (typeof args !== 'object' || args === null)
|
|
1155
|
+
return false;
|
|
1156
|
+
const params = args;
|
|
1157
|
+
const maxResults = readAliasedArg(args, 'max_results', 'maxResults');
|
|
1158
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1159
|
+
(maxResults === undefined || typeof maxResults === 'number') &&
|
|
1160
|
+
(params.query === undefined || typeof params.query === 'string');
|
|
1161
|
+
}
|
|
1162
|
+
export function assertListFormsArgs(args) {
|
|
1163
|
+
if (!isListFormsArgs(args)) {
|
|
1164
|
+
throw new Error('Invalid list forms parameters. Optional: email, max_results, query.');
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
export function isGetFormArgs(args) {
|
|
1168
|
+
if (typeof args !== 'object' || args === null)
|
|
1169
|
+
return false;
|
|
1170
|
+
const params = args;
|
|
1171
|
+
const formId = readAliasedArg(args, 'form_id', 'formId');
|
|
1172
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1173
|
+
typeof formId === 'string';
|
|
1174
|
+
}
|
|
1175
|
+
export function assertGetFormArgs(args) {
|
|
1176
|
+
if (!isGetFormArgs(args)) {
|
|
1177
|
+
throw new Error('Invalid get form parameters. Required: form_id (string).');
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
export function isListFormResponsesArgs(args) {
|
|
1181
|
+
if (typeof args !== 'object' || args === null)
|
|
1182
|
+
return false;
|
|
1183
|
+
const params = args;
|
|
1184
|
+
const rawParams = args;
|
|
1185
|
+
const formId = readAliasedArg(rawParams, 'form_id', 'formId');
|
|
1186
|
+
const maxResults = readAliasedArg(rawParams, 'max_results', 'maxResults');
|
|
1187
|
+
const pageToken = readAliasedArg(rawParams, 'page_token', 'pageToken');
|
|
1188
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1189
|
+
typeof formId === 'string' &&
|
|
1190
|
+
(maxResults === undefined || typeof maxResults === 'number') &&
|
|
1191
|
+
(pageToken === undefined || typeof pageToken === 'string');
|
|
1192
|
+
}
|
|
1193
|
+
export function assertListFormResponsesArgs(args) {
|
|
1194
|
+
if (!isListFormResponsesArgs(args)) {
|
|
1195
|
+
throw new Error('Invalid list form responses parameters. Required: form_id (string). Optional: max_results, page_token.');
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
export function isGetFormResponseArgs(args) {
|
|
1199
|
+
if (typeof args !== 'object' || args === null)
|
|
1200
|
+
return false;
|
|
1201
|
+
const params = args;
|
|
1202
|
+
const rawParams = args;
|
|
1203
|
+
const formId = readAliasedArg(rawParams, 'form_id', 'formId');
|
|
1204
|
+
const responseId = readAliasedArg(rawParams, 'response_id', 'responseId');
|
|
1205
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1206
|
+
typeof formId === 'string' &&
|
|
1207
|
+
typeof responseId === 'string';
|
|
1208
|
+
}
|
|
1209
|
+
export function assertGetFormResponseArgs(args) {
|
|
1210
|
+
if (!isGetFormResponseArgs(args)) {
|
|
1211
|
+
throw new Error('Invalid get form response parameters. Required: form_id (string), response_id (string).');
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
export function isListCommentsArgs(args) {
|
|
1215
|
+
if (typeof args !== 'object' || args === null)
|
|
1216
|
+
return false;
|
|
1217
|
+
const params = args;
|
|
1218
|
+
const rawParams = args;
|
|
1219
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
1220
|
+
const pageSize = readAliasedArg(rawParams, 'page_size', 'pageSize');
|
|
1221
|
+
const pageToken = readAliasedArg(rawParams, 'page_token', 'pageToken');
|
|
1222
|
+
const includeDeleted = readAliasedArg(rawParams, 'include_deleted', 'includeDeleted');
|
|
1223
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1224
|
+
typeof fileId === 'string' &&
|
|
1225
|
+
(pageSize === undefined || typeof pageSize === 'number') &&
|
|
1226
|
+
(pageToken === undefined || typeof pageToken === 'string') &&
|
|
1227
|
+
(includeDeleted === undefined || typeof includeDeleted === 'boolean');
|
|
1228
|
+
}
|
|
1229
|
+
export function assertListCommentsArgs(args) {
|
|
1230
|
+
if (!isListCommentsArgs(args)) {
|
|
1231
|
+
throw new Error('Invalid list comments parameters. Required: file_id (string). Optional: page_size, page_token, include_deleted.');
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
export function isCreateCommentArgs(args) {
|
|
1235
|
+
if (typeof args !== 'object' || args === null)
|
|
1236
|
+
return false;
|
|
1237
|
+
const params = args;
|
|
1238
|
+
const fileId = readAliasedArg(args, 'file_id', 'fileId');
|
|
1239
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1240
|
+
typeof fileId === 'string' &&
|
|
1241
|
+
typeof params.content === 'string';
|
|
1242
|
+
}
|
|
1243
|
+
export function assertCreateCommentArgs(args) {
|
|
1244
|
+
if (!isCreateCommentArgs(args)) {
|
|
1245
|
+
throw new Error('Invalid create comment parameters. Required: file_id (string), content (string).');
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
export function isResolveCommentArgs(args) {
|
|
1249
|
+
if (typeof args !== 'object' || args === null)
|
|
1250
|
+
return false;
|
|
1251
|
+
const params = args;
|
|
1252
|
+
const rawParams = args;
|
|
1253
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
1254
|
+
const commentId = readAliasedArg(rawParams, 'comment_id', 'commentId');
|
|
1255
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1256
|
+
typeof fileId === 'string' &&
|
|
1257
|
+
typeof commentId === 'string' &&
|
|
1258
|
+
(params.action === 'resolve' || params.action === 'reopen');
|
|
1259
|
+
}
|
|
1260
|
+
export function assertResolveCommentArgs(args) {
|
|
1261
|
+
if (!isResolveCommentArgs(args)) {
|
|
1262
|
+
throw new Error('Invalid resolve comment parameters. Required: file_id (string), comment_id (string), action ("resolve" | "reopen").');
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
export function isReplyToCommentArgs(args) {
|
|
1266
|
+
if (typeof args !== 'object' || args === null)
|
|
1267
|
+
return false;
|
|
1268
|
+
const params = args;
|
|
1269
|
+
const rawParams = args;
|
|
1270
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
1271
|
+
const commentId = readAliasedArg(rawParams, 'comment_id', 'commentId');
|
|
1272
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1273
|
+
typeof fileId === 'string' &&
|
|
1274
|
+
typeof commentId === 'string' &&
|
|
1275
|
+
typeof params.content === 'string';
|
|
1276
|
+
}
|
|
1277
|
+
export function assertReplyToCommentArgs(args) {
|
|
1278
|
+
if (!isReplyToCommentArgs(args)) {
|
|
1279
|
+
throw new Error('Invalid reply to comment parameters. Required: file_id (string), comment_id (string), content (string).');
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
export function isDeleteCommentArgs(args) {
|
|
1283
|
+
if (typeof args !== 'object' || args === null)
|
|
1284
|
+
return false;
|
|
1285
|
+
const params = args;
|
|
1286
|
+
const rawParams = args;
|
|
1287
|
+
const fileId = readAliasedArg(rawParams, 'file_id', 'fileId');
|
|
1288
|
+
const commentId = readAliasedArg(rawParams, 'comment_id', 'commentId');
|
|
1289
|
+
return (params.email === undefined || typeof params.email === 'string') &&
|
|
1290
|
+
typeof fileId === 'string' &&
|
|
1291
|
+
typeof commentId === 'string';
|
|
1292
|
+
}
|
|
1293
|
+
export function assertDeleteCommentArgs(args) {
|
|
1294
|
+
if (!isDeleteCommentArgs(args)) {
|
|
1295
|
+
throw new Error('Invalid delete comment parameters. Required: file_id (string), comment_id (string).');
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
export function isGmailQuickActionArgs(args) {
|
|
1299
|
+
if (typeof args !== 'object' || args === null)
|
|
1300
|
+
return false;
|
|
1301
|
+
const params = args;
|
|
1302
|
+
const rawParams = args;
|
|
1303
|
+
// email is optional
|
|
1304
|
+
if (params.email !== undefined && typeof params.email !== 'string')
|
|
1305
|
+
return false;
|
|
1306
|
+
// At least one of message_id/messageId or message_ids/messageIds must be present
|
|
1307
|
+
const messageId = readAliasedArg(rawParams, 'message_id', 'messageId');
|
|
1308
|
+
const messageIds = readAliasedArg(rawParams, 'message_ids', 'messageIds');
|
|
1309
|
+
const hasMessageId = typeof messageId === 'string';
|
|
1310
|
+
const hasMessageIds = Array.isArray(messageIds) && messageIds.every(id => typeof id === 'string');
|
|
1311
|
+
if (!hasMessageId && !hasMessageIds)
|
|
1312
|
+
return false;
|
|
1313
|
+
// If both provided, both must be valid
|
|
1314
|
+
if (messageId !== undefined && typeof messageId !== 'string')
|
|
1315
|
+
return false;
|
|
1316
|
+
if (messageIds !== undefined && !Array.isArray(messageIds))
|
|
1317
|
+
return false;
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
export function assertGmailQuickActionArgs(args) {
|
|
1321
|
+
if (!isGmailQuickActionArgs(args)) {
|
|
1322
|
+
throw new Error('Invalid Gmail quick action parameters. Required: message_id (string) or message_ids (string array).');
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
//# sourceMappingURL=type-guards.js.map
|