@marcoappio/marco-config 4.0.25 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/api.d.ts +9 -0
- package/dist/constants/api.d.ts.map +1 -0
- package/dist/constants/api.js +8 -0
- package/dist/constants/emailAccounts.d.ts.map +1 -1
- package/dist/constants/emailAccounts.js +14 -1
- package/dist/constants/emailProvider.js +1 -1
- package/dist/constants/index.d.ts +11 -3
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +7 -5
- package/dist/constants/messages.d.ts.map +1 -1
- package/dist/constants/oauth.d.ts +2 -2
- package/dist/constants/oauth.d.ts.map +1 -1
- package/dist/constants/oauth.js +5 -1
- package/dist/constants/user.d.ts +1 -1
- package/dist/constants/user.d.ts.map +1 -1
- package/dist/constants/user.js +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/marcoPublicConfig.d.ts +48 -0
- package/dist/marcoPublicConfig.d.ts.map +1 -0
- package/dist/marcoPublicConfig.js +132 -0
- package/dist/schemas/app.d.ts +2 -2
- package/dist/schemas/app.d.ts.map +1 -1
- package/dist/schemas/app.js +3 -3
- package/dist/schemas/auth.d.ts +1 -1
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/auth.js +2 -2
- package/dist/schemas/boolean.d.ts +5 -0
- package/dist/schemas/boolean.d.ts.map +1 -0
- package/dist/schemas/boolean.js +4 -0
- package/dist/schemas/emailAccount.d.ts +10 -10
- package/dist/schemas/emailAccount.d.ts.map +1 -1
- package/dist/schemas/emailAccount.js +13 -13
- package/dist/schemas/id.d.ts +1 -6
- package/dist/schemas/id.d.ts.map +1 -1
- package/dist/schemas/id.js +1 -2
- package/dist/schemas/index.d.ts +512 -60
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +23 -9
- package/dist/schemas/labels.d.ts +5 -0
- package/dist/schemas/labels.d.ts.map +1 -0
- package/dist/schemas/labels.js +5 -0
- package/dist/schemas/models/account.d.ts +3 -3
- package/dist/schemas/models/account.d.ts.map +1 -1
- package/dist/schemas/models/account.js +8 -8
- package/dist/schemas/models/contact.d.ts +2 -2
- package/dist/schemas/models/contact.d.ts.map +1 -1
- package/dist/schemas/models/contact.js +4 -4
- package/dist/schemas/models/draft.d.ts +9 -9
- package/dist/schemas/models/draft.d.ts.map +1 -1
- package/dist/schemas/models/draft.js +9 -9
- package/dist/schemas/models/index.d.ts +5 -5
- package/dist/schemas/models/index.d.ts.map +1 -1
- package/dist/schemas/models/index.js +5 -5
- package/dist/schemas/models/thread.d.ts +46 -28
- package/dist/schemas/models/thread.d.ts.map +1 -1
- package/dist/schemas/models/thread.js +12 -11
- package/dist/schemas/models/user.d.ts +71 -3
- package/dist/schemas/models/user.d.ts.map +1 -1
- package/dist/schemas/models/user.js +24 -5
- package/dist/schemas/mutators/index.d.ts +2 -0
- package/dist/schemas/mutators/index.d.ts.map +1 -0
- package/dist/schemas/mutators/index.js +1 -0
- package/dist/schemas/mutators/mutatorSchemas.d.ts +314 -0
- package/dist/schemas/mutators/mutatorSchemas.d.ts.map +1 -0
- package/dist/schemas/mutators/mutatorSchemas.js +229 -0
- package/dist/schemas/mutators/mutatorSchemas.test.d.ts +2 -0
- package/dist/schemas/mutators/mutatorSchemas.test.d.ts.map +1 -0
- package/dist/schemas/mutators/mutatorSchemas.test.js +39 -0
- package/dist/schemas/number.d.ts +5 -3
- package/dist/schemas/number.d.ts.map +1 -1
- package/dist/schemas/number.js +5 -4
- package/dist/schemas/oauth.d.ts +2 -2
- package/dist/schemas/oauth.d.ts.map +1 -1
- package/dist/schemas/oauth.js +3 -3
- package/dist/schemas/paginatedResponse.d.ts +10 -0
- package/dist/schemas/paginatedResponse.d.ts.map +1 -0
- package/dist/schemas/paginatedResponse.js +5 -0
- package/dist/schemas/pushNotifications.d.ts +3 -3
- package/dist/schemas/pushNotifications.d.ts.map +1 -1
- package/dist/schemas/pushNotifications.js +4 -3
- package/dist/schemas/string.d.ts +4 -2
- package/dist/schemas/string.d.ts.map +1 -1
- package/dist/schemas/string.js +5 -4
- package/dist/schemas/stripe.d.ts +43 -0
- package/dist/schemas/stripe.d.ts.map +1 -0
- package/dist/schemas/stripe.js +48 -0
- package/dist/schemas/websocket.d.ts +14 -0
- package/dist/schemas/websocket.d.ts.map +1 -0
- package/dist/schemas/websocket.js +10 -0
- package/dist/sdk/endpoints/createEndpointConfig.d.ts +12 -0
- package/dist/sdk/endpoints/createEndpointConfig.d.ts.map +1 -0
- package/dist/sdk/endpoints/createEndpointConfig.js +21 -0
- package/dist/sdk/endpoints/index.d.ts +308 -0
- package/dist/sdk/endpoints/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/index.js +6 -0
- package/dist/sdk/endpoints/private/draftAttachment/index.d.ts +31 -0
- package/dist/sdk/endpoints/private/draftAttachment/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/draftAttachment/index.js +4 -0
- package/dist/sdk/endpoints/private/draftAttachment/uploadDraftAttachment.d.ts +30 -0
- package/dist/sdk/endpoints/private/draftAttachment/uploadDraftAttachment.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/draftAttachment/uploadDraftAttachment.js +18 -0
- package/dist/sdk/endpoints/private/emailMessage/getEmailMessageAttachment.d.ts +21 -0
- package/dist/sdk/endpoints/private/emailMessage/getEmailMessageAttachment.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/emailMessage/getEmailMessageAttachment.js +16 -0
- package/dist/sdk/endpoints/private/emailMessage/index.d.ts +22 -0
- package/dist/sdk/endpoints/private/emailMessage/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/emailMessage/index.js +4 -0
- package/dist/sdk/endpoints/private/index.d.ts +156 -0
- package/dist/sdk/endpoints/private/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/index.js +12 -0
- package/dist/sdk/endpoints/private/models/account/getAccounts.d.ts +70 -0
- package/dist/sdk/endpoints/private/models/account/getAccounts.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/account/getAccounts.js +26 -0
- package/dist/sdk/endpoints/private/models/account/index.d.ts +2 -0
- package/dist/sdk/endpoints/private/models/account/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/account/index.js +1 -0
- package/dist/sdk/endpoints/private/models/contact/getContacts.d.ts +41 -0
- package/dist/sdk/endpoints/private/models/contact/getContacts.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/contact/getContacts.js +26 -0
- package/dist/sdk/endpoints/private/models/contact/index.d.ts +2 -0
- package/dist/sdk/endpoints/private/models/contact/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/contact/index.js +1 -0
- package/dist/sdk/endpoints/private/models/draft/getDrafts.d.ts +62 -0
- package/dist/sdk/endpoints/private/models/draft/getDrafts.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/draft/getDrafts.js +25 -0
- package/dist/sdk/endpoints/private/models/draft/index.d.ts +2 -0
- package/dist/sdk/endpoints/private/models/draft/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/draft/index.js +1 -0
- package/dist/sdk/endpoints/private/models/index.d.ts +13 -0
- package/dist/sdk/endpoints/private/models/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/index.js +12 -0
- package/dist/sdk/endpoints/private/models/thread/getThread.d.ts +63 -0
- package/dist/sdk/endpoints/private/models/thread/getThread.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/thread/getThread.js +17 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadByMessageId.d.ts +63 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadByMessageId.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadByMessageId.js +17 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadList.d.ts +79 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadList.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/thread/getThreadList.js +47 -0
- package/dist/sdk/endpoints/private/models/thread/getThreads.d.ts +83 -0
- package/dist/sdk/endpoints/private/models/thread/getThreads.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/thread/getThreads.js +36 -0
- package/dist/sdk/endpoints/private/models/thread/index.d.ts +5 -0
- package/dist/sdk/endpoints/private/models/thread/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/thread/index.js +4 -0
- package/dist/sdk/endpoints/private/models/user/getUser.d.ts +75 -0
- package/dist/sdk/endpoints/private/models/user/getUser.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/user/getUser.js +16 -0
- package/dist/sdk/endpoints/private/models/user/index.d.ts +2 -0
- package/dist/sdk/endpoints/private/models/user/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/models/user/index.js +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createAccount.d.ts +35 -0
- package/dist/sdk/endpoints/private/mutations/account/createAccount.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createAccount.js +18 -0
- package/dist/sdk/endpoints/private/mutations/account/createAlias.d.ts +42 -0
- package/dist/sdk/endpoints/private/mutations/account/createAlias.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createAlias.js +19 -0
- package/dist/sdk/endpoints/private/mutations/account/createLabel.d.ts +44 -0
- package/dist/sdk/endpoints/private/mutations/account/createLabel.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/createLabel.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAccount.d.ts +27 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAccount.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAccount.js +18 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAlias.d.ts +33 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAlias.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteAlias.js +19 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteLabel.d.ts +43 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteLabel.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/deleteLabel.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/index.d.ts +14 -0
- package/dist/sdk/endpoints/private/mutations/account/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/index.js +13 -0
- package/dist/sdk/endpoints/private/mutations/account/renameLabel.d.ts +49 -0
- package/dist/sdk/endpoints/private/mutations/account/renameLabel.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/renameLabel.js +21 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasName.d.ts +44 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasName.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasName.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasPrimary.d.ts +33 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasPrimary.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasPrimary.js +19 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasSignature.d.ts +44 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasSignature.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setAliasSignature.js +20 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigImap.d.ts +49 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigImap.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigImap.js +19 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigOauth.d.ts +42 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigOauth.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setConnectionConfigOauth.js +19 -0
- package/dist/sdk/endpoints/private/mutations/account/setSettings.d.ts +39 -0
- package/dist/sdk/endpoints/private/mutations/account/setSettings.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/account/setSettings.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/cancelSend.d.ts +28 -0
- package/dist/sdk/endpoints/private/mutations/draft/cancelSend.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/cancelSend.js +18 -0
- package/dist/sdk/endpoints/private/mutations/draft/createAttachment.d.ts +45 -0
- package/dist/sdk/endpoints/private/mutations/draft/createAttachment.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/createAttachment.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/createDraft.d.ts +60 -0
- package/dist/sdk/endpoints/private/mutations/draft/createDraft.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/createDraft.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteAttachment.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteAttachment.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteAttachment.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteDraft.d.ts +27 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteDraft.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/deleteDraft.js +18 -0
- package/dist/sdk/endpoints/private/mutations/draft/index.d.ts +10 -0
- package/dist/sdk/endpoints/private/mutations/draft/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/index.js +9 -0
- package/dist/sdk/endpoints/private/mutations/draft/replaceContent.d.ts +39 -0
- package/dist/sdk/endpoints/private/mutations/draft/replaceContent.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/replaceContent.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/scheduleSend.d.ts +45 -0
- package/dist/sdk/endpoints/private/mutations/draft/scheduleSend.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/scheduleSend.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/setEnvelope.d.ts +85 -0
- package/dist/sdk/endpoints/private/mutations/draft/setEnvelope.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/setEnvelope.js +19 -0
- package/dist/sdk/endpoints/private/mutations/draft/setFrom.d.ts +47 -0
- package/dist/sdk/endpoints/private/mutations/draft/setFrom.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/draft/setFrom.js +20 -0
- package/dist/sdk/endpoints/private/mutations/index.d.ts +11 -0
- package/dist/sdk/endpoints/private/mutations/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/index.js +10 -0
- package/dist/sdk/endpoints/private/mutations/thread/addLabel.d.ts +40 -0
- package/dist/sdk/endpoints/private/mutations/thread/addLabel.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/addLabel.js +19 -0
- package/dist/sdk/endpoints/private/mutations/thread/deleteThreads.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/thread/deleteThreads.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/deleteThreads.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/index.d.ts +11 -0
- package/dist/sdk/endpoints/private/mutations/thread/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/index.js +10 -0
- package/dist/sdk/endpoints/private/mutations/thread/removeLabel.d.ts +40 -0
- package/dist/sdk/endpoints/private/mutations/thread/removeLabel.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/removeLabel.js +19 -0
- package/dist/sdk/endpoints/private/mutations/thread/setArchive.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/thread/setArchive.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setArchive.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setFlagged.d.ts +35 -0
- package/dist/sdk/endpoints/private/mutations/thread/setFlagged.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setFlagged.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setInbox.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/thread/setInbox.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setInbox.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSeen.d.ts +35 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSeen.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSeen.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSnooze.d.ts +35 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSnooze.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSnooze.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSpam.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSpam.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setSpam.js +18 -0
- package/dist/sdk/endpoints/private/mutations/thread/setTrash.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/thread/setTrash.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/thread/setTrash.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/createFeedback.d.ts +34 -0
- package/dist/sdk/endpoints/private/mutations/user/createFeedback.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/createFeedback.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/createView.d.ts +38 -0
- package/dist/sdk/endpoints/private/mutations/user/createView.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/createView.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/deletePushToken.d.ts +23 -0
- package/dist/sdk/endpoints/private/mutations/user/deletePushToken.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/deletePushToken.js +17 -0
- package/dist/sdk/endpoints/private/mutations/user/deleteView.d.ts +28 -0
- package/dist/sdk/endpoints/private/mutations/user/deleteView.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/deleteView.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/index.d.ts +9 -0
- package/dist/sdk/endpoints/private/mutations/user/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/index.js +8 -0
- package/dist/sdk/endpoints/private/mutations/user/setFeedbackModalShown.d.ts +32 -0
- package/dist/sdk/endpoints/private/mutations/user/setFeedbackModalShown.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/setFeedbackModalShown.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/setPushToken.d.ts +37 -0
- package/dist/sdk/endpoints/private/mutations/user/setPushToken.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/setPushToken.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/setSettingsName.d.ts +33 -0
- package/dist/sdk/endpoints/private/mutations/user/setSettingsName.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/setSettingsName.js +18 -0
- package/dist/sdk/endpoints/private/mutations/user/updateView.d.ts +43 -0
- package/dist/sdk/endpoints/private/mutations/user/updateView.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/mutations/user/updateView.js +19 -0
- package/dist/sdk/endpoints/private/user/createBillingPortalSession.d.ts +30 -0
- package/dist/sdk/endpoints/private/user/createBillingPortalSession.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/createBillingPortalSession.js +19 -0
- package/dist/sdk/endpoints/private/user/createCheckoutSession.d.ts +27 -0
- package/dist/sdk/endpoints/private/user/createCheckoutSession.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/createCheckoutSession.js +20 -0
- package/dist/sdk/endpoints/private/user/deleteUser.d.ts +10 -0
- package/dist/sdk/endpoints/private/user/deleteUser.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/deleteUser.js +13 -0
- package/dist/sdk/endpoints/private/user/index.d.ts +90 -0
- package/dist/sdk/endpoints/private/user/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/index.js +10 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.d.ts +28 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.d.ts.map +1 -0
- package/dist/sdk/endpoints/private/user/uploadProfilePicture.js +19 -0
- package/dist/sdk/endpoints/public/auth/index.d.ts +133 -0
- package/dist/sdk/endpoints/public/auth/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/auth/index.js +8 -0
- package/dist/sdk/endpoints/public/auth/refreshAuth.d.ts +41 -0
- package/dist/sdk/endpoints/public/auth/refreshAuth.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/auth/refreshAuth.js +33 -0
- package/dist/sdk/endpoints/public/auth/sendAuthCode.d.ts +27 -0
- package/dist/sdk/endpoints/public/auth/sendAuthCode.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/auth/sendAuthCode.js +19 -0
- package/dist/sdk/endpoints/public/auth/verifyAuthCode.d.ts +68 -0
- package/dist/sdk/endpoints/public/auth/verifyAuthCode.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/auth/verifyAuthCode.js +36 -0
- package/dist/sdk/endpoints/public/config/index.d.ts +10 -0
- package/dist/sdk/endpoints/public/config/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/config/index.js +15 -0
- package/dist/sdk/endpoints/public/healthcheck/index.d.ts +8 -0
- package/dist/sdk/endpoints/public/healthcheck/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/healthcheck/index.js +10 -0
- package/dist/sdk/endpoints/public/index.d.ts +149 -0
- package/dist/sdk/endpoints/public/index.d.ts.map +1 -0
- package/dist/sdk/endpoints/public/index.js +8 -0
- package/dist/sdk/index.d.ts +485 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +6 -0
- package/dist/sdk/validation/errors.d.ts +338 -0
- package/dist/sdk/validation/errors.d.ts.map +1 -0
- package/dist/sdk/validation/errors.js +145 -0
- package/dist/sdk/validation/index.d.ts +178 -0
- package/dist/sdk/validation/index.d.ts.map +1 -0
- package/dist/sdk/validation/index.js +3 -0
- package/dist/sdk/validation/utils/flattenRequirements/flattenRequirements.d.ts +11 -0
- package/dist/sdk/validation/utils/flattenRequirements/flattenRequirements.d.ts.map +1 -0
- package/dist/sdk/validation/utils/flattenRequirements/flattenRequirements.js +22 -0
- package/dist/sdk/validation/utils/flattenRequirements/index.d.ts +2 -0
- package/dist/sdk/validation/utils/flattenRequirements/index.d.ts.map +1 -0
- package/dist/sdk/validation/utils/flattenRequirements/index.js +1 -0
- package/dist/sdk/validation/utils/index.d.ts +7 -0
- package/dist/sdk/validation/utils/index.d.ts.map +1 -0
- package/dist/sdk/validation/utils/index.js +4 -0
- package/dist/types/AuthData.d.ts +4 -0
- package/dist/types/AuthData.d.ts.map +1 -0
- package/dist/types/AuthData.js +1 -0
- package/dist/types/DraftAttachmentUploadStatus.d.ts +1 -1
- package/dist/types/DraftAttachmentUploadStatus.d.ts.map +1 -1
- package/dist/types/DraftStatus.d.ts +1 -1
- package/dist/types/DraftStatus.d.ts.map +1 -1
- package/dist/types/DraftType.d.ts +1 -1
- package/dist/types/DraftType.d.ts.map +1 -1
- package/dist/types/Endpoint.d.ts +25 -0
- package/dist/types/Endpoint.d.ts.map +1 -0
- package/dist/types/Endpoint.js +1 -0
- package/dist/types/IMAPConnectionStatus.d.ts +1 -1
- package/dist/types/IMAPConnectionStatus.d.ts.map +1 -1
- package/dist/types/IMAPSourceLocation.d.ts +1 -1
- package/dist/types/LabelSpecialUse.d.ts +1 -1
- package/dist/types/LabelSpecialUse.d.ts.map +1 -1
- package/dist/types/MarcoPlatform.d.ts +1 -1
- package/dist/types/MarcoPlatform.d.ts.map +1 -1
- package/dist/types/MessageRecipientType.d.ts +1 -1
- package/dist/types/MessageRecipientType.d.ts.map +1 -1
- package/dist/types/OAuthProvider.d.ts +1 -1
- package/dist/types/OAuthProvider.d.ts.map +1 -1
- package/dist/types/PokeEvent.d.ts +6 -0
- package/dist/types/PokeEvent.d.ts.map +1 -0
- package/dist/types/PokeEvent.js +1 -0
- package/dist/types/SDKError.d.ts +4 -0
- package/dist/types/SDKError.d.ts.map +1 -0
- package/dist/types/SDKError.js +1 -0
- package/dist/types/StripeSubscriptionStatus.d.ts +3 -0
- package/dist/types/StripeSubscriptionStatus.d.ts.map +1 -0
- package/dist/types/StripeSubscriptionStatus.js +10 -0
- package/dist/types/SubscriptionTier.d.ts +3 -0
- package/dist/types/SubscriptionTier.d.ts.map +1 -0
- package/dist/types/SubscriptionTier.js +1 -0
- package/dist/types/UserSettings.d.ts +15 -16
- package/dist/types/UserSettings.d.ts.map +1 -1
- package/dist/types/UserSettings.js +29 -15
- package/dist/types/index.d.ts +17 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +17 -11
- package/dist/utils/accounts/generateAccountColor.d.ts.map +1 -1
- package/dist/utils/accounts/generateAccountColor.js +15 -10
- package/dist/utils/accounts/index.d.ts +3 -1
- package/dist/utils/accounts/index.d.ts.map +1 -1
- package/dist/utils/accounts/index.js +4 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/labels/index.d.ts +3 -2
- package/dist/utils/labels/index.d.ts.map +1 -1
- package/dist/utils/labels/index.js +4 -1
- package/dist/utils/threads/index.d.ts +4 -2
- package/dist/utils/threads/index.d.ts.map +1 -1
- package/dist/utils/threads/index.js +6 -2
- package/dist/utils/threads/parseLabelIdList/index.d.ts +2 -0
- package/dist/utils/threads/parseLabelIdList/index.d.ts.map +1 -0
- package/dist/utils/threads/parseLabelIdList/index.js +1 -0
- package/dist/utils/threads/parseLabelIdList/parseLabelIdList.test.js +1 -1
- package/dist/utils/threads/processSearchTerm/index.d.ts +2 -0
- package/dist/utils/threads/processSearchTerm/index.d.ts.map +1 -0
- package/dist/utils/threads/processSearchTerm/index.js +1 -0
- package/dist/utils/threads/processSearchTerm/processSearchTerm.test.js +1 -1
- package/package.json +13 -28
- package/dist/appwrite/appwrite.d.ts +0 -77
- package/dist/appwrite/appwrite.d.ts.map +0 -1
- package/dist/appwrite/appwrite.js +0 -61
- package/dist/appwrite/appwrite.test.d.ts +0 -2
- package/dist/appwrite/appwrite.test.d.ts.map +0 -1
- package/dist/appwrite/appwrite.test.js +0 -920
- package/dist/appwrite/commands.d.ts +0 -5093
- package/dist/appwrite/commands.d.ts.map +0 -1
- package/dist/appwrite/commands.js +0 -208
- package/dist/appwrite/commands.test.d.ts +0 -2
- package/dist/appwrite/commands.test.d.ts.map +0 -1
- package/dist/appwrite/commands.test.js +0 -425
- package/dist/appwrite/decodedSchemas.d.ts +0 -35
- package/dist/appwrite/decodedSchemas.d.ts.map +0 -1
- package/dist/appwrite/decodedSchemas.js +0 -18
- package/dist/appwrite/functions.d.ts +0 -2806
- package/dist/appwrite/functions.d.ts.map +0 -1
- package/dist/appwrite/functions.js +0 -192
- package/dist/appwrite/functions.test.d.ts +0 -2
- package/dist/appwrite/functions.test.d.ts.map +0 -1
- package/dist/appwrite/functions.test.js +0 -370
- package/dist/appwrite/index.d.ts +0 -8
- package/dist/appwrite/index.d.ts.map +0 -1
- package/dist/appwrite/index.js +0 -5
- package/dist/appwrite/queryContracts/queryContracts.d.ts +0 -392
- package/dist/appwrite/queryContracts/queryContracts.d.ts.map +0 -1
- package/dist/appwrite/queryContracts/queryContracts.js +0 -299
- package/dist/appwrite/queryContracts/queryContracts.test.d.ts +0 -2
- package/dist/appwrite/queryContracts/queryContracts.test.d.ts.map +0 -1
- package/dist/appwrite/queryContracts/queryContracts.test.js +0 -39
- package/dist/appwrite/tableContract/identity.d.ts +0 -207
- package/dist/appwrite/tableContract/identity.d.ts.map +0 -1
- package/dist/appwrite/tableContract/identity.js +0 -169
- package/dist/appwrite/tableContract/index.d.ts +0 -3245
- package/dist/appwrite/tableContract/index.d.ts.map +0 -1
- package/dist/appwrite/tableContract/index.js +0 -94
- package/dist/appwrite/tableContract/index.test.d.ts +0 -2
- package/dist/appwrite/tableContract/index.test.d.ts.map +0 -1
- package/dist/appwrite/tableContract/index.test.js +0 -129
- package/dist/appwrite/tableContract/mailbox.d.ts +0 -300
- package/dist/appwrite/tableContract/mailbox.d.ts.map +0 -1
- package/dist/appwrite/tableContract/mailbox.js +0 -257
- package/dist/appwrite/tableContract/operational.d.ts +0 -247
- package/dist/appwrite/tableContract/operational.d.ts.map +0 -1
- package/dist/appwrite/tableContract/operational.js +0 -167
- package/dist/appwrite/tableContract/shared.d.ts +0 -145
- package/dist/appwrite/tableContract/shared.d.ts.map +0 -1
- package/dist/appwrite/tableContract/shared.js +0 -83
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/index.test.js +0 -106
- package/dist/schemas/models/mailboxAddress.test.d.ts +0 -2
- package/dist/schemas/models/mailboxAddress.test.d.ts.map +0 -1
- package/dist/schemas/models/mailboxAddress.test.js +0 -31
- package/dist/schemas/models/numericSemantics.test.d.ts +0 -2
- package/dist/schemas/models/numericSemantics.test.d.ts.map +0 -1
- package/dist/schemas/models/numericSemantics.test.js +0 -24
- package/dist/schemas/models/user.test.d.ts +0 -2
- package/dist/schemas/models/user.test.d.ts.map +0 -1
- package/dist/schemas/models/user.test.js +0 -18
- package/dist/schemas/scalars.d.ts +0 -13
- package/dist/schemas/scalars.d.ts.map +0 -1
- package/dist/schemas/scalars.js +0 -15
- package/dist/schemas/scalars.test.d.ts +0 -2
- package/dist/schemas/scalars.test.d.ts.map +0 -1
- package/dist/schemas/scalars.test.js +0 -44
- package/dist/schemas/schemaValues.test.d.ts +0 -2
- package/dist/schemas/schemaValues.test.d.ts.map +0 -1
- package/dist/schemas/schemaValues.test.js +0 -21
- package/dist/utils/valibot/index.d.ts +0 -3
- package/dist/utils/valibot/index.d.ts.map +0 -1
- package/dist/utils/valibot/index.js +0 -2
|
@@ -1,920 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
import { v } from '../utils/valibot/index.js';
|
|
3
|
-
import { appwrite } from './appwrite.js';
|
|
4
|
-
import { appwriteTableIds } from './tableContract/index.js';
|
|
5
|
-
const metadata = {
|
|
6
|
-
$createdAt: '2026-07-15T00:00:00.000Z',
|
|
7
|
-
$databaseId: 'marco',
|
|
8
|
-
$id: 'row-1',
|
|
9
|
-
$permissions: ['read("user:user-1")'],
|
|
10
|
-
$sequence: '1',
|
|
11
|
-
$updatedAt: '2026-07-15T00:00:00.000Z',
|
|
12
|
-
};
|
|
13
|
-
const rowFixture = (table, data, permissions = metadata.$permissions) => ({
|
|
14
|
-
...metadata,
|
|
15
|
-
$permissions: permissions,
|
|
16
|
-
$tableId: appwrite.ids.tables[table],
|
|
17
|
-
...data,
|
|
18
|
-
});
|
|
19
|
-
const validRows = {
|
|
20
|
-
accounts: rowFixture('accounts', {
|
|
21
|
-
colour: '#000000',
|
|
22
|
-
credential: null,
|
|
23
|
-
displayName: null,
|
|
24
|
-
initialSyncCompletedAt: null,
|
|
25
|
-
lastErrorCode: null,
|
|
26
|
-
lastSuccessfulSyncAt: null,
|
|
27
|
-
mailboxSyncState: null,
|
|
28
|
-
mailProcessedCount: 0,
|
|
29
|
-
mailTotalCount: 0,
|
|
30
|
-
pollShardAssignmentId: null,
|
|
31
|
-
pollShardId: null,
|
|
32
|
-
primaryAlias: 'alias-1',
|
|
33
|
-
primaryEmail: 'marco@example.com',
|
|
34
|
-
profile: 'user-1',
|
|
35
|
-
profileAssignmentKey: 'user-1',
|
|
36
|
-
provider: 'GMAIL',
|
|
37
|
-
state: 'CONNECTED',
|
|
38
|
-
}),
|
|
39
|
-
aliases: rowFixture('aliases', {
|
|
40
|
-
account: 'account-1',
|
|
41
|
-
accountAssignmentKey: 'account-1',
|
|
42
|
-
email: 'marco@example.com',
|
|
43
|
-
isPrimary: true,
|
|
44
|
-
name: 'Marco',
|
|
45
|
-
providerId: 'provider-1',
|
|
46
|
-
signature: '<p>Test signature</p>',
|
|
47
|
-
}),
|
|
48
|
-
commands: rowFixture('commands', {
|
|
49
|
-
account: null,
|
|
50
|
-
accountId: null,
|
|
51
|
-
attempts: 0,
|
|
52
|
-
canonicalRevision: null,
|
|
53
|
-
draftId: null,
|
|
54
|
-
errorCode: null,
|
|
55
|
-
kind: 'thread.archive',
|
|
56
|
-
payload: '{"threadId":"thread-1"}',
|
|
57
|
-
payloadHash: 'hash-1',
|
|
58
|
-
profile: 'user-1',
|
|
59
|
-
state: 'ACCEPTED',
|
|
60
|
-
submittedAt: '2026-07-15T00:00:00.000Z',
|
|
61
|
-
userId: 'user-1',
|
|
62
|
-
}),
|
|
63
|
-
contacts: rowFixture('contacts', {
|
|
64
|
-
displayName: 'Marco',
|
|
65
|
-
lastContactedAt: '2026-07-15T00:00:00.000Z',
|
|
66
|
-
messageCount: 0,
|
|
67
|
-
normalisedAddress: 'marco@example.com',
|
|
68
|
-
profile: 'user-1',
|
|
69
|
-
profileAssignmentKey: 'user-1',
|
|
70
|
-
searchText: 'marco',
|
|
71
|
-
}),
|
|
72
|
-
credentials: rowFixture('credentials', {
|
|
73
|
-
accountId: 'account-1',
|
|
74
|
-
encryptedPayload: 'encrypted-payload',
|
|
75
|
-
expiresAt: null,
|
|
76
|
-
provider: 'GMAIL',
|
|
77
|
-
refreshLeaseExpiresAt: null,
|
|
78
|
-
refreshLeaseId: null,
|
|
79
|
-
userId: 'user-1',
|
|
80
|
-
}),
|
|
81
|
-
drafts: rowFixture('drafts', {
|
|
82
|
-
account: 'account-1',
|
|
83
|
-
accountAssignmentKey: 'account-1',
|
|
84
|
-
attachmentMetadata: '[]',
|
|
85
|
-
contentHash: 'hash-1',
|
|
86
|
-
envelope: '{"bcc":[],"cc":[],"subject":null,"to":[]}',
|
|
87
|
-
errorCode: null,
|
|
88
|
-
executionLeaseExpiresAt: null,
|
|
89
|
-
executionLeaseId: null,
|
|
90
|
-
fromAlias: null,
|
|
91
|
-
html: '<p>Draft</p>',
|
|
92
|
-
referencedMessage: null,
|
|
93
|
-
revision: 0,
|
|
94
|
-
scheduledAt: null,
|
|
95
|
-
sequence: 0,
|
|
96
|
-
status: 'DRAFT',
|
|
97
|
-
type: 'COMPOSE',
|
|
98
|
-
}),
|
|
99
|
-
jobs: rowFixture('jobs', {
|
|
100
|
-
accountId: null,
|
|
101
|
-
attempts: 0,
|
|
102
|
-
commandId: 'command-1',
|
|
103
|
-
dedupeKey: 'dedupe-1',
|
|
104
|
-
errorCode: null,
|
|
105
|
-
kind: 'thread.archive',
|
|
106
|
-
leaseExpiresAt: null,
|
|
107
|
-
leaseId: null,
|
|
108
|
-
maxAttempts: 3,
|
|
109
|
-
nextRunAt: '2026-07-15T00:00:00.000Z',
|
|
110
|
-
payload: '{"threadId":"thread-1"}',
|
|
111
|
-
state: 'PENDING',
|
|
112
|
-
userId: 'user-1',
|
|
113
|
-
}),
|
|
114
|
-
labels: rowFixture('labels', {
|
|
115
|
-
account: 'account-1',
|
|
116
|
-
accountAssignmentKey: 'account-1',
|
|
117
|
-
name: null,
|
|
118
|
-
path: 'Inbox',
|
|
119
|
-
providerId: 'provider-1',
|
|
120
|
-
specialUse: 'INBOX',
|
|
121
|
-
totalCount: 0,
|
|
122
|
-
unreadCount: 0,
|
|
123
|
-
}),
|
|
124
|
-
mailboxSyncCandidates: rowFixture('mailboxSyncCandidates', {
|
|
125
|
-
account: 'account-1',
|
|
126
|
-
accountId: 'account-1',
|
|
127
|
-
generation: 1,
|
|
128
|
-
label: 'label-1',
|
|
129
|
-
labelId: 'label-1',
|
|
130
|
-
lane: 'HEAD',
|
|
131
|
-
mailboxPath: 'INBOX',
|
|
132
|
-
mailboxPriority: 1,
|
|
133
|
-
mailboxSortKey: '0000000001:INBOX',
|
|
134
|
-
providerId: 'provider-message-1',
|
|
135
|
-
receivedAt: '2026-07-15T00:00:00.000Z',
|
|
136
|
-
specialUse: 'INBOX',
|
|
137
|
-
uid: 1,
|
|
138
|
-
uidValidity: 1,
|
|
139
|
-
userId: 'user-1',
|
|
140
|
-
}),
|
|
141
|
-
mailboxSyncLanes: rowFixture('mailboxSyncLanes', {
|
|
142
|
-
account: 'test-account-id-1',
|
|
143
|
-
accountId: 'test-account-id-1',
|
|
144
|
-
commandId: 'sync_test-command-id-1',
|
|
145
|
-
cursor: null,
|
|
146
|
-
errorCode: null,
|
|
147
|
-
generation: 1,
|
|
148
|
-
lane: 'HEAD',
|
|
149
|
-
state: 'RUNNING',
|
|
150
|
-
userId: 'test-user-id-1',
|
|
151
|
-
}, []),
|
|
152
|
-
mailboxSyncStates: rowFixture('mailboxSyncStates', {
|
|
153
|
-
accountId: 'account-1',
|
|
154
|
-
errorCode: null,
|
|
155
|
-
lastEventAt: null,
|
|
156
|
-
lastSyncAt: null,
|
|
157
|
-
materialisationLeaseExpiresAt: null,
|
|
158
|
-
materialisationLeaseId: null,
|
|
159
|
-
nextPollAt: null,
|
|
160
|
-
provider: 'GMAIL',
|
|
161
|
-
providerCursor: null,
|
|
162
|
-
state: 'CURRENT',
|
|
163
|
-
uidValidity: null,
|
|
164
|
-
userId: 'user-1',
|
|
165
|
-
}),
|
|
166
|
-
messageLocations: rowFixture('messageLocations', {
|
|
167
|
-
account: 'account-1',
|
|
168
|
-
accountAssignmentKey: 'account-1',
|
|
169
|
-
flagged: false,
|
|
170
|
-
label: 'label-1',
|
|
171
|
-
labelAssignmentKey: 'label-1',
|
|
172
|
-
message: 'message-1',
|
|
173
|
-
messageAt: '2026-07-15T00:00:00.000Z',
|
|
174
|
-
seen: true,
|
|
175
|
-
thread: 'thread-1',
|
|
176
|
-
threadAssignmentKey: 'thread-1',
|
|
177
|
-
uid: 1,
|
|
178
|
-
uidValidity: 1,
|
|
179
|
-
}),
|
|
180
|
-
messages: rowFixture('messages', {
|
|
181
|
-
account: 'account-1',
|
|
182
|
-
accountAssignmentKey: 'account-1',
|
|
183
|
-
attachmentMetadata: '[]',
|
|
184
|
-
htmlFileId: null,
|
|
185
|
-
preview: 'Preview',
|
|
186
|
-
providerId: 'provider-1',
|
|
187
|
-
rawFileId: null,
|
|
188
|
-
receivedAt: null,
|
|
189
|
-
recipients: '[{"emailAddress":"recipient@example.com","name":"Recipient","type":"to"}]',
|
|
190
|
-
revision: 0,
|
|
191
|
-
rfcMessageId: null,
|
|
192
|
-
sender: 'marco@example.com',
|
|
193
|
-
senderName: 'Marco',
|
|
194
|
-
sentAt: '2026-07-15T00:00:00.000Z',
|
|
195
|
-
size: 1,
|
|
196
|
-
subject: 'Test subject',
|
|
197
|
-
thread: 'thread-1',
|
|
198
|
-
threadAssignmentKey: 'thread-1',
|
|
199
|
-
}),
|
|
200
|
-
oauthStates: rowFixture('oauthStates', {
|
|
201
|
-
accountId: 'account-1',
|
|
202
|
-
email: 'marco@example.com',
|
|
203
|
-
expiresAt: '2026-07-15T00:10:00.000Z',
|
|
204
|
-
nonceHash: 'test-nonce-hash-1',
|
|
205
|
-
operation: 'CONNECT',
|
|
206
|
-
profile: 'user-1',
|
|
207
|
-
provider: 'GMAIL',
|
|
208
|
-
returnUri: 'https://app.marcoapp.io/onboarding/loading',
|
|
209
|
-
userId: 'user-1',
|
|
210
|
-
}),
|
|
211
|
-
pollShardCoordinators: rowFixture('pollShardCoordinators', {
|
|
212
|
-
accountCursor: null,
|
|
213
|
-
}, []),
|
|
214
|
-
pollShards: rowFixture('pollShards', {
|
|
215
|
-
accountIds: ['test-account-id-1'],
|
|
216
|
-
errorCode: null,
|
|
217
|
-
generation: 1,
|
|
218
|
-
lastStartedAt: null,
|
|
219
|
-
leaseExpiresAt: null,
|
|
220
|
-
leaseId: null,
|
|
221
|
-
nextStartAt: '2026-07-15T00:00:30.000Z',
|
|
222
|
-
pollingSnapshot: '{"members":[],"version":1}',
|
|
223
|
-
scheduledExecutionId: null,
|
|
224
|
-
state: 'ACTIVE',
|
|
225
|
-
}, []),
|
|
226
|
-
profileAvatarCleanups: rowFixture('profileAvatarCleanups', {
|
|
227
|
-
claimedAt: null,
|
|
228
|
-
claimId: null,
|
|
229
|
-
fileId: 'test-file-id-1',
|
|
230
|
-
profile: 'user-1',
|
|
231
|
-
}, []),
|
|
232
|
-
profiles: rowFixture('profiles', {
|
|
233
|
-
avatarFileId: null,
|
|
234
|
-
deletionRequestedAt: null,
|
|
235
|
-
email: 'marco@example.com',
|
|
236
|
-
name: null,
|
|
237
|
-
onboardingState: null,
|
|
238
|
-
timezone: null,
|
|
239
|
-
}),
|
|
240
|
-
pushNotificationTokens: rowFixture('pushNotificationTokens', {
|
|
241
|
-
profile: 'user-1',
|
|
242
|
-
token: 'ExponentPushToken[token]',
|
|
243
|
-
userId: 'user-1',
|
|
244
|
-
}),
|
|
245
|
-
savedViews: rowFixture('savedViews', {
|
|
246
|
-
aliasIds: ['alias-1'],
|
|
247
|
-
icon: 'mail',
|
|
248
|
-
name: 'Unread',
|
|
249
|
-
profile: 'user-1',
|
|
250
|
-
}),
|
|
251
|
-
threadAliases: rowFixture('threadAliases', {
|
|
252
|
-
alias: 'alias-1',
|
|
253
|
-
aliasAssignmentKey: 'alias-1',
|
|
254
|
-
latestMessageAt: '2026-07-15T00:00:00.000Z',
|
|
255
|
-
thread: 'thread-1',
|
|
256
|
-
threadAssignmentKey: 'thread-1',
|
|
257
|
-
}),
|
|
258
|
-
threadLabels: rowFixture('threadLabels', {
|
|
259
|
-
label: 'label-1',
|
|
260
|
-
labelAssignmentKey: 'label-1',
|
|
261
|
-
latestMessageAt: '2026-07-15T00:00:00.000Z',
|
|
262
|
-
locationCount: 1,
|
|
263
|
-
thread: 'thread-1',
|
|
264
|
-
threadAssignmentKey: 'thread-1',
|
|
265
|
-
}),
|
|
266
|
-
threads: rowFixture('threads', {
|
|
267
|
-
account: 'account-1',
|
|
268
|
-
accountAssignmentKey: 'account-1',
|
|
269
|
-
archived: false,
|
|
270
|
-
firstMessageAt: '2026-07-14T00:00:00.000Z',
|
|
271
|
-
flagged: false,
|
|
272
|
-
flaggedLocationCount: 0,
|
|
273
|
-
hasAttachments: false,
|
|
274
|
-
labelIds: ['label-1'],
|
|
275
|
-
latestMessageAt: '2026-07-15T00:00:00.000Z',
|
|
276
|
-
latestMessageId: 'message-1',
|
|
277
|
-
messageCount: 1,
|
|
278
|
-
participants: 'sender@example.com recipient@example.com',
|
|
279
|
-
preview: 'Preview',
|
|
280
|
-
providerId: 'provider-1',
|
|
281
|
-
revision: 0,
|
|
282
|
-
searchText: 'preview',
|
|
283
|
-
seen: true,
|
|
284
|
-
senderEmail: 'sender@example.com',
|
|
285
|
-
senderName: 'Sender',
|
|
286
|
-
snoozedUntil: null,
|
|
287
|
-
spam: false,
|
|
288
|
-
subject: null,
|
|
289
|
-
trashed: false,
|
|
290
|
-
unseenLocationCount: 0,
|
|
291
|
-
}),
|
|
292
|
-
};
|
|
293
|
-
const validPollShardCoordinatorRow = validRows.pollShardCoordinators;
|
|
294
|
-
const pollShardCoordinatorSchema = Object.entries(appwrite.rowSchemas).find(([table]) => table === 'pollShardCoordinators')?.[1];
|
|
295
|
-
describe('appwrite', () => {
|
|
296
|
-
it('publishes the production browser and OAuth configuration', () => {
|
|
297
|
-
expect(appwrite.environments).toEqual(['development', 'production', 'staging']);
|
|
298
|
-
expect(appwrite.deployments).toEqual({
|
|
299
|
-
development: {
|
|
300
|
-
applicationUrl: 'https://app.staging.marcoapp.io',
|
|
301
|
-
endpoint: 'https://nyc.cloud.appwrite.io/v1',
|
|
302
|
-
oauthClientIds: {
|
|
303
|
-
google: '338197922176-oml1o2iputhhu3vijgue9h8sbfq17qme.apps.googleusercontent.com',
|
|
304
|
-
microsoft: 'd34106a5-5210-417e-bf38-6ddbe3aa91a7',
|
|
305
|
-
},
|
|
306
|
-
projectId: 'marco',
|
|
307
|
-
},
|
|
308
|
-
production: {
|
|
309
|
-
applicationUrl: 'https://app.marcoapp.io',
|
|
310
|
-
endpoint: 'https://platform.marcoapp.io/v1',
|
|
311
|
-
oauthClientIds: {
|
|
312
|
-
google: '338197922176-oml1o2iputhhu3vijgue9h8sbfq17qme.apps.googleusercontent.com',
|
|
313
|
-
microsoft: 'd34106a5-5210-417e-bf38-6ddbe3aa91a7',
|
|
314
|
-
},
|
|
315
|
-
projectId: 'marco',
|
|
316
|
-
},
|
|
317
|
-
staging: {
|
|
318
|
-
applicationUrl: 'https://app.staging.marcoapp.io',
|
|
319
|
-
endpoint: 'https://nyc.cloud.appwrite.io/v1',
|
|
320
|
-
oauthClientIds: {
|
|
321
|
-
google: '338197922176-oml1o2iputhhu3vijgue9h8sbfq17qme.apps.googleusercontent.com',
|
|
322
|
-
microsoft: 'd34106a5-5210-417e-bf38-6ddbe3aa91a7',
|
|
323
|
-
},
|
|
324
|
-
projectId: 'marco',
|
|
325
|
-
},
|
|
326
|
-
});
|
|
327
|
-
expect(appwrite.deployments.development).not.toBe(appwrite.deployments.staging);
|
|
328
|
-
expect(appwrite.deployments.development.oauthClientIds).not.toBe(appwrite.deployments.staging.oauthClientIds);
|
|
329
|
-
expect(appwrite.deployments.development.oauthClientIds).not.toBe(appwrite.deployments.production.oauthClientIds);
|
|
330
|
-
expect(appwrite.deployments.production.oauthClientIds).not.toBe(appwrite.deployments.staging.oauthClientIds);
|
|
331
|
-
});
|
|
332
|
-
it('exports the approved resource identifiers', () => {
|
|
333
|
-
expect(appwrite.ids).toEqual({
|
|
334
|
-
bucket: 'marco-files',
|
|
335
|
-
database: 'marco',
|
|
336
|
-
functions: { api: 'marco-api', worker: 'marco-worker' },
|
|
337
|
-
tables: {
|
|
338
|
-
accounts: 'accounts',
|
|
339
|
-
aliases: 'aliases',
|
|
340
|
-
commands: 'commands',
|
|
341
|
-
contacts: 'contacts',
|
|
342
|
-
credentials: 'credentials',
|
|
343
|
-
drafts: 'drafts',
|
|
344
|
-
jobs: 'jobs',
|
|
345
|
-
labels: 'labels',
|
|
346
|
-
mailboxSyncCandidates: 'mailbox_sync_candidates',
|
|
347
|
-
mailboxSyncLanes: 'mailbox_sync_lanes',
|
|
348
|
-
mailboxSyncStates: 'mailbox_sync_states',
|
|
349
|
-
messageLocations: 'message_locations',
|
|
350
|
-
messages: 'messages',
|
|
351
|
-
oauthStates: 'oauth_states',
|
|
352
|
-
pollShardCoordinators: 'poll_shard_coordinators',
|
|
353
|
-
pollShards: 'poll_shards',
|
|
354
|
-
profileAvatarCleanups: 'profile_avatar_cleanups',
|
|
355
|
-
profiles: 'profiles',
|
|
356
|
-
pushNotificationTokens: 'push_notification_tokens',
|
|
357
|
-
savedViews: 'saved_views',
|
|
358
|
-
threadAliases: 'thread_aliases',
|
|
359
|
-
threadLabels: 'thread_labels',
|
|
360
|
-
threads: 'threads',
|
|
361
|
-
},
|
|
362
|
-
});
|
|
363
|
-
});
|
|
364
|
-
it('generates every table definition and schema from the shared contract', () => {
|
|
365
|
-
expect(Object.keys(appwrite.tables).sort()).toEqual(Object.keys(appwrite.ids.tables).sort());
|
|
366
|
-
const tableKeys = Object.keys(appwrite.ids.tables);
|
|
367
|
-
for (const tableKey of tableKeys) {
|
|
368
|
-
const tableId = appwrite.ids.tables[tableKey];
|
|
369
|
-
const table = appwrite.tables[tableKey];
|
|
370
|
-
const dataSchema = appwrite.dataSchemas[tableKey];
|
|
371
|
-
const rowSchema = appwrite.rowSchemas[tableKey];
|
|
372
|
-
const dataKeys = Object.keys(dataSchema.entries);
|
|
373
|
-
expect(table.id).toBe(tableId);
|
|
374
|
-
expect(Object.keys(rowSchema.entries)).toEqual(['$createdAt', '$databaseId', '$id', '$permissions', '$sequence', '$tableId', '$updatedAt', ...dataKeys]);
|
|
375
|
-
expect(dataKeys.sort()).toEqual([...table.columns.map(column => column.key), ...(table.relationships ?? []).map(relationship => relationship.key)].sort());
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
it('publishes every physical table ID exactly once', () => {
|
|
379
|
-
expect([...appwriteTableIds]).toEqual(Object.values(appwrite.ids.tables));
|
|
380
|
-
expect(new Set(appwriteTableIds).size).toBe(appwriteTableIds.length);
|
|
381
|
-
});
|
|
382
|
-
it('publishes the explicit physical message-location contract', () => {
|
|
383
|
-
expect(appwrite.tables.messageLocations.columns).toEqual([
|
|
384
|
-
{ key: 'accountAssignmentKey', required: true, size: 36, type: 'string' },
|
|
385
|
-
{ key: 'flagged', required: true, type: 'boolean' },
|
|
386
|
-
{ key: 'labelAssignmentKey', required: true, size: 36, type: 'string' },
|
|
387
|
-
{ key: 'messageAt', required: true, type: 'datetime' },
|
|
388
|
-
{ key: 'seen', required: true, type: 'boolean' },
|
|
389
|
-
{ key: 'threadAssignmentKey', required: true, size: 36, type: 'string' },
|
|
390
|
-
{ key: 'uid', required: false, type: 'bigint' },
|
|
391
|
-
{ key: 'uidValidity', required: false, type: 'bigint' },
|
|
392
|
-
]);
|
|
393
|
-
expect(appwrite.tables.messageLocations.relationships).toEqual([
|
|
394
|
-
{ key: 'account', onDelete: 'cascade', relatedTableId: appwrite.ids.tables.accounts, type: 'manyToOne' },
|
|
395
|
-
{ key: 'label', onDelete: 'cascade', relatedTableId: appwrite.ids.tables.labels, type: 'manyToOne' },
|
|
396
|
-
{ key: 'message', onDelete: 'cascade', relatedTableId: appwrite.ids.tables.messages, type: 'manyToOne' },
|
|
397
|
-
{ key: 'thread', onDelete: 'cascade', relatedTableId: appwrite.ids.tables.threads, type: 'manyToOne' },
|
|
398
|
-
]);
|
|
399
|
-
});
|
|
400
|
-
it('enforces nullable positive message-location coordinates as a pair', () => {
|
|
401
|
-
const messageLocations = appwrite.dataSchemas.messageLocations;
|
|
402
|
-
for (const coordinates of [
|
|
403
|
-
{ uid: null, uidValidity: null },
|
|
404
|
-
{ uid: 1, uidValidity: 1 },
|
|
405
|
-
]) {
|
|
406
|
-
expect(v.safeParse(messageLocations, { ...validRows.messageLocations, ...coordinates }).success).toBe(true);
|
|
407
|
-
}
|
|
408
|
-
for (const coordinates of [
|
|
409
|
-
{ uid: null, uidValidity: 1 },
|
|
410
|
-
{ uid: 1, uidValidity: null },
|
|
411
|
-
{ uid: 0, uidValidity: 1 },
|
|
412
|
-
{ uid: 1, uidValidity: 0 },
|
|
413
|
-
]) {
|
|
414
|
-
expect(v.safeParse(messageLocations, { ...validRows.messageLocations, ...coordinates }).success).toBe(false);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
it('rejects zero mailbox-sync candidate coordinates', () => {
|
|
418
|
-
expect(v.safeParse(appwrite.dataSchemas.mailboxSyncCandidates.entries.uid, 0).success).toBe(false);
|
|
419
|
-
expect(v.safeParse(appwrite.dataSchemas.mailboxSyncCandidates.entries.uidValidity, 0).success).toBe(false);
|
|
420
|
-
});
|
|
421
|
-
it('rejects non-canonical persisted scheduling and lease fences', () => {
|
|
422
|
-
const fenceSchemas = [
|
|
423
|
-
appwrite.dataSchemas.credentials.entries.refreshLeaseExpiresAt,
|
|
424
|
-
appwrite.dataSchemas.drafts.entries.scheduledAt,
|
|
425
|
-
appwrite.dataSchemas.drafts.entries.executionLeaseExpiresAt,
|
|
426
|
-
appwrite.dataSchemas.mailboxSyncStates.entries.nextPollAt,
|
|
427
|
-
appwrite.dataSchemas.mailboxSyncStates.entries.materialisationLeaseExpiresAt,
|
|
428
|
-
appwrite.dataSchemas.jobs.entries.nextRunAt,
|
|
429
|
-
appwrite.dataSchemas.jobs.entries.leaseExpiresAt,
|
|
430
|
-
appwrite.dataSchemas.pollShards.entries.nextStartAt,
|
|
431
|
-
appwrite.dataSchemas.pollShards.entries.leaseExpiresAt,
|
|
432
|
-
appwrite.dataSchemas.threads.entries.snoozedUntil,
|
|
433
|
-
];
|
|
434
|
-
for (const schema of fenceSchemas) {
|
|
435
|
-
expect(v.safeParse(schema, '2026-06-31T12:00:30.000Z').success).toBe(false);
|
|
436
|
-
expect(v.safeParse(schema, '2026-07-23T12:00:30.000+00:00').success).toBe(false);
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
it('pins every generated wire row to its table ID', () => {
|
|
440
|
-
const tableKeys = Object.keys(appwrite.ids.tables);
|
|
441
|
-
for (const tableKey of tableKeys) {
|
|
442
|
-
const wrongTableId = tableKey === 'accounts' ? appwrite.ids.tables.aliases : appwrite.ids.tables.accounts;
|
|
443
|
-
const rowSchema = appwrite.rowSchemas[tableKey];
|
|
444
|
-
const row = validRows[tableKey];
|
|
445
|
-
expect(v.safeParse(rowSchema, row).success).toBe(true);
|
|
446
|
-
expect(v.safeParse(rowSchema, { ...row, $tableId: wrongTableId }).success).toBe(false);
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
it('exports the shared OAuth state contract', () => {
|
|
450
|
-
expect(appwrite.oauth).toMatchObject({
|
|
451
|
-
operations: ['CONNECT', 'REPLACE'],
|
|
452
|
-
providers: ['GMAIL', 'OUTLOOK'],
|
|
453
|
-
returnUris: ['https://app.marcoapp.io/onboarding/loading'],
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
for (const operation of ['CONNECT', 'REPLACE']) {
|
|
457
|
-
it(`accepts a persisted ${operation} OAuth state completing at production loading`, () => {
|
|
458
|
-
expect(v.safeParse(appwrite.rowSchemas.oauthStates, { ...validRows.oauthStates, operation }).success).toBe(true);
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
for (const returnUri of [
|
|
462
|
-
'https://app.marcoapp.io/onboarding/provider-selection',
|
|
463
|
-
'https://app.staging.marcoapp.io/onboarding/loading',
|
|
464
|
-
'https://attacker.example/onboarding/loading',
|
|
465
|
-
'https://app.marcoapp.io/onboarding/loading/unexpected',
|
|
466
|
-
]) {
|
|
467
|
-
it(`rejects persisted OAuth state with unapproved return URI ${returnUri}`, () => {
|
|
468
|
-
expect(v.safeParse(appwrite.rowSchemas.oauthStates, { ...validRows.oauthStates, returnUri }).success).toBe(false);
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
it('exports the final polling-only mailbox contract', () => {
|
|
472
|
-
expect(appwrite.mailboxSync).toEqual({
|
|
473
|
-
lanes: ['HEAD', 'BACKFILL'],
|
|
474
|
-
laneStates: ['PENDING', 'RUNNING', 'COMPLETED', 'FAILED'],
|
|
475
|
-
states: ['INITIAL', 'SYNCING', 'CURRENT', 'ERROR'],
|
|
476
|
-
});
|
|
477
|
-
expect(appwrite.polling).toEqual({ shardStates: ['ACTIVE', 'STOPPED', 'FAILED'] });
|
|
478
|
-
});
|
|
479
|
-
it('accepts CURRENT and rejects the retired IDLE mailbox sync state', () => {
|
|
480
|
-
expect(v.safeParse(appwrite.rowSchemas.mailboxSyncStates, { ...validRows.mailboxSyncStates, state: 'CURRENT' }).success).toBe(true);
|
|
481
|
-
expect(v.safeParse(appwrite.rowSchemas.mailboxSyncStates, { ...validRows.mailboxSyncStates, state: 'IDLE' }).success).toBe(false);
|
|
482
|
-
});
|
|
483
|
-
it('keys saved views by stable alias IDs', () => {
|
|
484
|
-
expect(v.safeParse(appwrite.rowSchemas.savedViews, validRows.savedViews).success).toBe(true);
|
|
485
|
-
expect(v.safeParse(appwrite.rowSchemas.savedViews, { ...validRows.savedViews, aliasEmails: ['marco@example.com'] }).success).toBe(false);
|
|
486
|
-
});
|
|
487
|
-
it('rejects a mailbox sync lane without a command identifier', () => {
|
|
488
|
-
expect(v.safeParse(appwrite.rowSchemas.mailboxSyncLanes, {
|
|
489
|
-
...validRows.mailboxSyncLanes,
|
|
490
|
-
commandId: '',
|
|
491
|
-
}).success).toBe(false);
|
|
492
|
-
});
|
|
493
|
-
it('rejects a poll shard with more than ten accounts', () => {
|
|
494
|
-
expect(v.safeParse(appwrite.rowSchemas.pollShards, {
|
|
495
|
-
...validRows.pollShards,
|
|
496
|
-
accountIds: Array.from({ length: 11 }, (_, index) => `test-account-id-${index + 1}`),
|
|
497
|
-
}).success).toBe(false);
|
|
498
|
-
});
|
|
499
|
-
it('accepts a populated poll shard snapshot', () => {
|
|
500
|
-
expect(v.safeParse(appwrite.rowSchemas.pollShards, {
|
|
501
|
-
...validRows.pollShards,
|
|
502
|
-
pollingSnapshot: '{"members":[]}',
|
|
503
|
-
}).success).toBe(true);
|
|
504
|
-
});
|
|
505
|
-
it('exports the strict server-only poll shard coordinator row contract', () => {
|
|
506
|
-
expect(pollShardCoordinatorSchema).toBeDefined();
|
|
507
|
-
if (pollShardCoordinatorSchema) {
|
|
508
|
-
for (const accountCursor of [null, 'test-account-id-1']) {
|
|
509
|
-
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, accountCursor }).success).toBe(true);
|
|
510
|
-
}
|
|
511
|
-
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, $permissions: ['read("user:test-user-id-1")'] }).success).toBe(false);
|
|
512
|
-
expect(v.safeParse(pollShardCoordinatorSchema, { ...validPollShardCoordinatorRow, unexpected: true }).success).toBe(false);
|
|
513
|
-
const { $id: _, ...rowWithoutId } = validPollShardCoordinatorRow;
|
|
514
|
-
expect(v.safeParse(pollShardCoordinatorSchema, rowWithoutId).success).toBe(false);
|
|
515
|
-
}
|
|
516
|
-
});
|
|
517
|
-
const serverOnlyPollingRows = [
|
|
518
|
-
{ row: validRows.mailboxSyncLanes, schema: appwrite.rowSchemas.mailboxSyncLanes },
|
|
519
|
-
{ row: validRows.pollShards, schema: appwrite.rowSchemas.pollShards },
|
|
520
|
-
];
|
|
521
|
-
for (const { row, schema } of serverOnlyPollingRows) {
|
|
522
|
-
it(`rejects client permissions on ${row.$tableId}`, () => {
|
|
523
|
-
expect(v.safeParse(schema, { ...row, $permissions: ['read("user:test-user-id-1")'] }).success).toBe(false);
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
const rowTestCases = Object.keys(validRows);
|
|
527
|
-
for (const table of rowTestCases) {
|
|
528
|
-
it(`accepts the ${table} wire row`, () => {
|
|
529
|
-
expect(v.safeParse(appwrite.rowSchemas[table], validRows[table]).success).toBe(true);
|
|
530
|
-
});
|
|
531
|
-
it(`rejects incomplete ${table} metadata`, () => {
|
|
532
|
-
const { $id: _, ...rowWithoutId } = validRows[table];
|
|
533
|
-
expect(v.safeParse(appwrite.rowSchemas[table], rowWithoutId).success).toBe(false);
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
it('normalises Appwrite relationship objects to row IDs', () => {
|
|
537
|
-
const account = v.parse(appwrite.rowSchemas.accounts, {
|
|
538
|
-
...validRows.accounts,
|
|
539
|
-
credential: { $id: 'credential-1' },
|
|
540
|
-
mailboxSyncState: { $id: 'mailbox-sync-state-1' },
|
|
541
|
-
primaryAlias: { $id: 'alias-1' },
|
|
542
|
-
profile: { $id: 'user-1' },
|
|
543
|
-
});
|
|
544
|
-
const alias = v.parse(appwrite.rowSchemas.aliases, { ...validRows.aliases, account: { $id: 'account-1' } });
|
|
545
|
-
const command = v.parse(appwrite.rowSchemas.commands, { ...validRows.commands, account: { $id: 'account-1' }, profile: { $id: 'user-1' } });
|
|
546
|
-
const contact = v.parse(appwrite.rowSchemas.contacts, { ...validRows.contacts, profile: { $id: 'user-1' } });
|
|
547
|
-
const draft = v.parse(appwrite.rowSchemas.drafts, {
|
|
548
|
-
...validRows.drafts,
|
|
549
|
-
account: { $id: 'account-1' },
|
|
550
|
-
fromAlias: { $id: 'alias-1' },
|
|
551
|
-
referencedMessage: { $id: 'message-1' },
|
|
552
|
-
});
|
|
553
|
-
const label = v.parse(appwrite.rowSchemas.labels, { ...validRows.labels, account: { $id: 'account-1' } });
|
|
554
|
-
const mailboxSyncCandidate = v.parse(appwrite.rowSchemas.mailboxSyncCandidates, {
|
|
555
|
-
...validRows.mailboxSyncCandidates,
|
|
556
|
-
account: { $id: 'account-1' },
|
|
557
|
-
label: { $id: 'label-1' },
|
|
558
|
-
});
|
|
559
|
-
const mailboxSyncLane = v.parse(appwrite.rowSchemas.mailboxSyncLanes, { ...validRows.mailboxSyncLanes, account: { $id: 'account-1' } });
|
|
560
|
-
const messageLocation = v.parse(appwrite.rowSchemas.messageLocations, {
|
|
561
|
-
...validRows.messageLocations,
|
|
562
|
-
account: { $id: 'account-1' },
|
|
563
|
-
label: { $id: 'label-1' },
|
|
564
|
-
message: { $id: 'message-1' },
|
|
565
|
-
thread: { $id: 'thread-1' },
|
|
566
|
-
});
|
|
567
|
-
const oauthState = v.parse(appwrite.rowSchemas.oauthStates, { ...validRows.oauthStates, profile: { $id: 'user-1' } });
|
|
568
|
-
const profileAvatarCleanup = v.parse(appwrite.rowSchemas.profileAvatarCleanups, { ...validRows.profileAvatarCleanups, profile: { $id: 'user-1' } });
|
|
569
|
-
const pushNotificationToken = v.parse(appwrite.rowSchemas.pushNotificationTokens, { ...validRows.pushNotificationTokens, profile: { $id: 'user-1' } });
|
|
570
|
-
const savedView = v.parse(appwrite.rowSchemas.savedViews, { ...validRows.savedViews, profile: { $id: 'user-1' } });
|
|
571
|
-
const thread = v.parse(appwrite.rowSchemas.threads, { ...validRows.threads, account: { $id: 'account-1' } });
|
|
572
|
-
const message = v.parse(appwrite.rowSchemas.messages, {
|
|
573
|
-
...validRows.messages,
|
|
574
|
-
account: { $id: 'account-1' },
|
|
575
|
-
thread: { $id: 'thread-1' },
|
|
576
|
-
});
|
|
577
|
-
const threadAlias = v.parse(appwrite.rowSchemas.threadAliases, {
|
|
578
|
-
...validRows.threadAliases,
|
|
579
|
-
alias: { $id: 'alias-1' },
|
|
580
|
-
thread: { $id: 'thread-1' },
|
|
581
|
-
});
|
|
582
|
-
const threadLabel = v.parse(appwrite.rowSchemas.threadLabels, {
|
|
583
|
-
...validRows.threadLabels,
|
|
584
|
-
label: { $id: 'label-1' },
|
|
585
|
-
thread: { $id: 'thread-1' },
|
|
586
|
-
});
|
|
587
|
-
expect(account.credential).toBe('credential-1');
|
|
588
|
-
expect(account.mailboxSyncState).toBe('mailbox-sync-state-1');
|
|
589
|
-
expect(account.primaryAlias).toBe('alias-1');
|
|
590
|
-
expect(account.profile).toBe('user-1');
|
|
591
|
-
expect(alias.account).toBe('account-1');
|
|
592
|
-
expect(command.account).toBe('account-1');
|
|
593
|
-
expect(command.profile).toBe('user-1');
|
|
594
|
-
expect(contact.profile).toBe('user-1');
|
|
595
|
-
expect(draft.account).toBe('account-1');
|
|
596
|
-
expect(draft.fromAlias).toBe('alias-1');
|
|
597
|
-
expect(draft.referencedMessage).toBe('message-1');
|
|
598
|
-
expect(label.account).toBe('account-1');
|
|
599
|
-
expect(mailboxSyncCandidate.account).toBe('account-1');
|
|
600
|
-
expect(mailboxSyncCandidate.label).toBe('label-1');
|
|
601
|
-
expect(mailboxSyncLane.account).toBe('account-1');
|
|
602
|
-
expect(messageLocation.account).toBe('account-1');
|
|
603
|
-
expect(messageLocation.label).toBe('label-1');
|
|
604
|
-
expect(messageLocation.message).toBe('message-1');
|
|
605
|
-
expect(messageLocation.thread).toBe('thread-1');
|
|
606
|
-
expect(oauthState.profile).toBe('user-1');
|
|
607
|
-
expect(profileAvatarCleanup.profile).toBe('user-1');
|
|
608
|
-
expect(pushNotificationToken.profile).toBe('user-1');
|
|
609
|
-
expect(savedView.profile).toBe('user-1');
|
|
610
|
-
expect(thread.account).toBe('account-1');
|
|
611
|
-
expect(message.account).toBe('account-1');
|
|
612
|
-
expect(message.thread).toBe('thread-1');
|
|
613
|
-
expect(threadAlias.alias).toBe('alias-1');
|
|
614
|
-
expect(threadAlias.thread).toBe('thread-1');
|
|
615
|
-
expect(threadLabel.label).toBe('label-1');
|
|
616
|
-
expect(threadLabel.thread).toBe('thread-1');
|
|
617
|
-
});
|
|
618
|
-
it('accepts backend message sender fields as plain nullable text', () => {
|
|
619
|
-
expect(v.safeParse(appwrite.rowSchemas.messages, {
|
|
620
|
-
...validRows.messages,
|
|
621
|
-
sender: 'not-an-email',
|
|
622
|
-
senderName: '',
|
|
623
|
-
}).success).toBe(true);
|
|
624
|
-
});
|
|
625
|
-
const requiredRelationshipFieldTestCases = [
|
|
626
|
-
{ field: 'account', row: { ...validRows.messages, account: null }, schema: appwrite.rowSchemas.messages, table: 'messages' },
|
|
627
|
-
{ field: 'thread', row: { ...validRows.messages, thread: null }, schema: appwrite.rowSchemas.messages, table: 'messages' },
|
|
628
|
-
{ field: 'account', row: { ...validRows.threads, account: null }, schema: appwrite.rowSchemas.threads, table: 'threads' },
|
|
629
|
-
{ field: 'alias', row: { ...validRows.threadAliases, alias: null }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
630
|
-
{ field: 'thread', row: { ...validRows.threadAliases, thread: null }, schema: appwrite.rowSchemas.threadAliases, table: 'threadAliases' },
|
|
631
|
-
{ field: 'label', row: { ...validRows.threadLabels, label: null }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
632
|
-
{ field: 'thread', row: { ...validRows.threadLabels, thread: null }, schema: appwrite.rowSchemas.threadLabels, table: 'threadLabels' },
|
|
633
|
-
];
|
|
634
|
-
for (const { field, row, schema, table } of requiredRelationshipFieldTestCases) {
|
|
635
|
-
it(`rejects nullable ${field} relationships on ${table}`, () => {
|
|
636
|
-
expect(v.safeParse(schema, row).success).toBe(false);
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
const nullableColumnTestCases = [
|
|
640
|
-
{
|
|
641
|
-
description: 'alias name',
|
|
642
|
-
row: { ...validRows.aliases, name: null },
|
|
643
|
-
schema: appwrite.rowSchemas.aliases,
|
|
644
|
-
},
|
|
645
|
-
{
|
|
646
|
-
description: 'alias signature',
|
|
647
|
-
row: { ...validRows.aliases, signature: null },
|
|
648
|
-
schema: appwrite.rowSchemas.aliases,
|
|
649
|
-
},
|
|
650
|
-
{
|
|
651
|
-
description: 'contact display name',
|
|
652
|
-
row: { ...validRows.contacts, displayName: null },
|
|
653
|
-
schema: appwrite.rowSchemas.contacts,
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
description: 'contact last-contacted timestamp',
|
|
657
|
-
row: { ...validRows.contacts, lastContactedAt: null },
|
|
658
|
-
schema: appwrite.rowSchemas.contacts,
|
|
659
|
-
},
|
|
660
|
-
{
|
|
661
|
-
description: 'saved-view icon',
|
|
662
|
-
row: { ...validRows.savedViews, icon: null },
|
|
663
|
-
schema: appwrite.rowSchemas.savedViews,
|
|
664
|
-
},
|
|
665
|
-
{
|
|
666
|
-
description: 'thread first-message timestamp',
|
|
667
|
-
row: { ...validRows.threads, firstMessageAt: null },
|
|
668
|
-
schema: appwrite.rowSchemas.threads,
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
description: 'thread sender email',
|
|
672
|
-
row: { ...validRows.threads, senderEmail: null },
|
|
673
|
-
schema: appwrite.rowSchemas.threads,
|
|
674
|
-
},
|
|
675
|
-
{
|
|
676
|
-
description: 'thread sender name',
|
|
677
|
-
row: { ...validRows.threads, senderName: null },
|
|
678
|
-
schema: appwrite.rowSchemas.threads,
|
|
679
|
-
},
|
|
680
|
-
];
|
|
681
|
-
for (const { description, row, schema } of nullableColumnTestCases) {
|
|
682
|
-
it(`accepts a wire row with a nullable ${description}`, () => {
|
|
683
|
-
expect(v.safeParse(schema, row).success).toBe(true);
|
|
684
|
-
});
|
|
685
|
-
}
|
|
686
|
-
it('accepts provider-derived RFC email addresses', () => {
|
|
687
|
-
const maximumLengthMailboxAddress = `${'a'.repeat(64)}@${'b'.repeat(63)}.${'c'.repeat(63)}.${'d'.repeat(63)}.${'e'.repeat(63)}`;
|
|
688
|
-
const mailboxAddresses = ['sender@example', 'first.last+tag@example.com', maximumLengthMailboxAddress];
|
|
689
|
-
expect(maximumLengthMailboxAddress).toHaveLength(320);
|
|
690
|
-
for (const mailboxAddress of mailboxAddresses) {
|
|
691
|
-
expect(v.safeParse(appwrite.rowSchemas.contacts, { ...validRows.contacts, normalisedAddress: mailboxAddress }).success).toBe(true);
|
|
692
|
-
expect(v.safeParse(appwrite.rowSchemas.threads, { ...validRows.threads, senderEmail: mailboxAddress }).success).toBe(true);
|
|
693
|
-
expect(v.safeParse(appwrite.decodedSchemas.draftEnvelope, JSON.stringify({ bcc: [mailboxAddress], cc: [mailboxAddress], subject: null, to: [mailboxAddress] })).success).toBe(true);
|
|
694
|
-
expect(v.safeParse(appwrite.decodedSchemas.messageRecipients, JSON.stringify([{ emailAddress: mailboxAddress, name: null, type: 'to' }])).success).toBe(true);
|
|
695
|
-
}
|
|
696
|
-
expect(v.safeParse(appwrite.rowSchemas.contacts, { ...validRows.contacts, normalisedAddress: '' }).success).toBe(false);
|
|
697
|
-
expect(v.safeParse(appwrite.rowSchemas.contacts, { ...validRows.contacts, normalisedAddress: 'invalid@@example.com' }).success).toBe(false);
|
|
698
|
-
expect(v.safeParse(appwrite.rowSchemas.contacts, { ...validRows.contacts, normalisedAddress: 'a'.repeat(321) }).success).toBe(false);
|
|
699
|
-
});
|
|
700
|
-
it('keeps account identity emails on the strict web-email boundary', () => {
|
|
701
|
-
expect(v.safeParse(appwrite.rowSchemas.accounts, { ...validRows.accounts, primaryEmail: 'sender@example' }).success).toBe(false);
|
|
702
|
-
expect(v.safeParse(appwrite.rowSchemas.aliases, { ...validRows.aliases, email: '"a@b"@example.com' }).success).toBe(false);
|
|
703
|
-
});
|
|
704
|
-
const { name: _aliasName, ...aliasWithoutName } = validRows.aliases;
|
|
705
|
-
const { signature: _aliasSignature, ...aliasWithoutSignature } = validRows.aliases;
|
|
706
|
-
const { displayName: _contactDisplayName, ...contactWithoutDisplayName } = validRows.contacts;
|
|
707
|
-
const { lastContactedAt: _contactLastContactedAt, ...contactWithoutLastContactedAt } = validRows.contacts;
|
|
708
|
-
const { icon: _savedViewIcon, ...savedViewWithoutIcon } = validRows.savedViews;
|
|
709
|
-
const { firstMessageAt: _threadFirstMessageAt, ...threadWithoutFirstMessageAt } = validRows.threads;
|
|
710
|
-
const { senderEmail: _threadSenderEmail, ...threadWithoutSenderEmail } = validRows.threads;
|
|
711
|
-
const { senderName: _threadSenderName, ...threadWithoutSenderName } = validRows.threads;
|
|
712
|
-
const missingNullableColumnTestCases = [
|
|
713
|
-
{
|
|
714
|
-
description: 'alias name',
|
|
715
|
-
row: aliasWithoutName,
|
|
716
|
-
schema: appwrite.rowSchemas.aliases,
|
|
717
|
-
},
|
|
718
|
-
{
|
|
719
|
-
description: 'alias signature',
|
|
720
|
-
row: aliasWithoutSignature,
|
|
721
|
-
schema: appwrite.rowSchemas.aliases,
|
|
722
|
-
},
|
|
723
|
-
{
|
|
724
|
-
description: 'contact display name',
|
|
725
|
-
row: contactWithoutDisplayName,
|
|
726
|
-
schema: appwrite.rowSchemas.contacts,
|
|
727
|
-
},
|
|
728
|
-
{
|
|
729
|
-
description: 'contact last-contacted timestamp',
|
|
730
|
-
row: contactWithoutLastContactedAt,
|
|
731
|
-
schema: appwrite.rowSchemas.contacts,
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
description: 'saved-view icon',
|
|
735
|
-
row: savedViewWithoutIcon,
|
|
736
|
-
schema: appwrite.rowSchemas.savedViews,
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
description: 'thread first-message timestamp',
|
|
740
|
-
row: threadWithoutFirstMessageAt,
|
|
741
|
-
schema: appwrite.rowSchemas.threads,
|
|
742
|
-
},
|
|
743
|
-
{
|
|
744
|
-
description: 'thread sender email',
|
|
745
|
-
row: threadWithoutSenderEmail,
|
|
746
|
-
schema: appwrite.rowSchemas.threads,
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
description: 'thread sender name',
|
|
750
|
-
row: threadWithoutSenderName,
|
|
751
|
-
schema: appwrite.rowSchemas.threads,
|
|
752
|
-
},
|
|
753
|
-
];
|
|
754
|
-
for (const { description, row, schema } of missingNullableColumnTestCases) {
|
|
755
|
-
it(`rejects a wire row missing its nullable ${description}`, () => {
|
|
756
|
-
expect(v.safeParse(schema, row).success).toBe(false);
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
const validOAuthStates = [
|
|
760
|
-
{ expected: true, operation: 'CONNECT', provider: 'GMAIL' },
|
|
761
|
-
{ expected: true, operation: 'REPLACE', provider: 'OUTLOOK' },
|
|
762
|
-
];
|
|
763
|
-
for (const { expected, operation, provider } of validOAuthStates) {
|
|
764
|
-
it(`accepts the ${operation} ${provider} OAuth state`, () => {
|
|
765
|
-
expect(v.safeParse(appwrite.rowSchemas.oauthStates, {
|
|
766
|
-
...validRows.oauthStates,
|
|
767
|
-
operation,
|
|
768
|
-
provider,
|
|
769
|
-
}).success).toBe(expected);
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
const invalidOAuthStates = [
|
|
773
|
-
{ description: 'an unknown operation', expected: false, value: { operation: 'UNKNOWN' } },
|
|
774
|
-
{ description: 'an unknown provider', expected: false, value: { provider: 'UNKNOWN' } },
|
|
775
|
-
{ description: 'a malformed return URL', expected: false, value: { returnUri: 'not-a-url' } },
|
|
776
|
-
{
|
|
777
|
-
description: 'an unapproved return destination',
|
|
778
|
-
expected: false,
|
|
779
|
-
value: { returnUri: 'https://attacker.example/onboarding/provider-selection' },
|
|
780
|
-
},
|
|
781
|
-
];
|
|
782
|
-
for (const { description, expected, value } of invalidOAuthStates) {
|
|
783
|
-
it(`rejects an OAuth state with ${description}`, () => {
|
|
784
|
-
expect(v.safeParse(appwrite.rowSchemas.oauthStates, { ...validRows.oauthStates, ...value }).success).toBe(expected);
|
|
785
|
-
});
|
|
786
|
-
}
|
|
787
|
-
const invalidSequences = [
|
|
788
|
-
{ description: 'numeric', value: 1 },
|
|
789
|
-
{ description: 'empty', value: '' },
|
|
790
|
-
];
|
|
791
|
-
for (const { description, value } of invalidSequences) {
|
|
792
|
-
it(`rejects ${description} Appwrite sequence metadata`, () => {
|
|
793
|
-
expect(v.safeParse(appwrite.rowSchemas.profiles, { ...validRows.profiles, $sequence: value }).success).toBe(false);
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
it('accepts a provider-canonical label name', () => {
|
|
797
|
-
expect(v.safeParse(appwrite.rowSchemas.labels, { ...validRows.labels, name: 'CATEGORY_PROMOTIONS' }).success).toBe(true);
|
|
798
|
-
});
|
|
799
|
-
it('accepts nullable thread text before body materialisation', () => {
|
|
800
|
-
expect(v.safeParse(appwrite.rowSchemas.threads, {
|
|
801
|
-
...validRows.threads,
|
|
802
|
-
participants: null,
|
|
803
|
-
preview: null,
|
|
804
|
-
searchText: null,
|
|
805
|
-
}).success).toBe(true);
|
|
806
|
-
});
|
|
807
|
-
const invalidAccountRows = [
|
|
808
|
-
{ description: 'an unknown state', row: { ...validRows.accounts, state: 'UNKNOWN' } },
|
|
809
|
-
{ description: 'an unknown database ID', row: { ...validRows.accounts, $databaseId: 'other' } },
|
|
810
|
-
{ description: 'a leading separator in $id', row: { ...validRows.accounts, $id: '-row-1' } },
|
|
811
|
-
{ description: 'an overlong $id', row: { ...validRows.accounts, $id: 'a'.repeat(37) } },
|
|
812
|
-
];
|
|
813
|
-
for (const testCase of invalidAccountRows) {
|
|
814
|
-
it(`rejects ${testCase.description}`, () => {
|
|
815
|
-
expect(v.safeParse(appwrite.rowSchemas.accounts, testCase.row).success).toBe(false);
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
const jsonTextTestCases = [
|
|
819
|
-
{
|
|
820
|
-
expected: [
|
|
821
|
-
{
|
|
822
|
-
fileId: 'test-file-id-1',
|
|
823
|
-
isAttachment: true,
|
|
824
|
-
mimeType: 'text/plain',
|
|
825
|
-
name: 'test-file-name-1.txt',
|
|
826
|
-
partNumber: '2',
|
|
827
|
-
size: 1,
|
|
828
|
-
},
|
|
829
|
-
],
|
|
830
|
-
invalidValue: '[{"fileId":"test-file-id-1"}]',
|
|
831
|
-
name: 'message attachments',
|
|
832
|
-
schema: appwrite.decodedSchemas.messageAttachments,
|
|
833
|
-
value: '[{"fileId":"test-file-id-1","isAttachment":true,"mimeType":"text/plain","name":"test-file-name-1.txt","partNumber":"2","size":1}]',
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
expected: [
|
|
837
|
-
{
|
|
838
|
-
fileId: 'test-file-id-1',
|
|
839
|
-
fileName: 'test-file-name-1.txt',
|
|
840
|
-
mimeType: 'text/plain',
|
|
841
|
-
size: 1,
|
|
842
|
-
},
|
|
843
|
-
],
|
|
844
|
-
invalidValue: '[{"fileId":"test-file-id-1"}]',
|
|
845
|
-
name: 'draft attachments',
|
|
846
|
-
schema: appwrite.decodedSchemas.draftAttachments,
|
|
847
|
-
value: '[{"fileId":"test-file-id-1","fileName":"test-file-name-1.txt","mimeType":"text/plain","size":1}]',
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
expected: { threadId: 'thread-1' },
|
|
851
|
-
invalidValue: '[]',
|
|
852
|
-
name: 'command payload',
|
|
853
|
-
schema: appwrite.decodedSchemas.commandPayload,
|
|
854
|
-
value: '{"threadId":"thread-1"}',
|
|
855
|
-
},
|
|
856
|
-
{
|
|
857
|
-
expected: { bcc: [], cc: [], subject: null, to: [] },
|
|
858
|
-
invalidValue: '[]',
|
|
859
|
-
name: 'draft envelope',
|
|
860
|
-
schema: appwrite.decodedSchemas.draftEnvelope,
|
|
861
|
-
value: '{"bcc":[],"cc":[],"subject":null,"to":[]}',
|
|
862
|
-
},
|
|
863
|
-
{
|
|
864
|
-
expected: { threadId: 'thread-1' },
|
|
865
|
-
invalidValue: '[]',
|
|
866
|
-
name: 'job payload',
|
|
867
|
-
schema: appwrite.decodedSchemas.jobPayload,
|
|
868
|
-
value: '{"threadId":"thread-1"}',
|
|
869
|
-
},
|
|
870
|
-
{
|
|
871
|
-
expected: [
|
|
872
|
-
{
|
|
873
|
-
emailAddress: 'recipient@example.com',
|
|
874
|
-
name: 'Recipient',
|
|
875
|
-
type: 'to',
|
|
876
|
-
},
|
|
877
|
-
],
|
|
878
|
-
invalidValue: '[{"emailAddress":"recipient@example.com"}]',
|
|
879
|
-
name: 'message recipients',
|
|
880
|
-
schema: appwrite.decodedSchemas.messageRecipients,
|
|
881
|
-
value: '[{"emailAddress":"recipient@example.com","name":"Recipient","type":"to"}]',
|
|
882
|
-
},
|
|
883
|
-
];
|
|
884
|
-
for (const testCase of jsonTextTestCases) {
|
|
885
|
-
it(`decodes ${testCase.name} JSON text`, () => {
|
|
886
|
-
const result = v.safeParse(testCase.schema, testCase.value);
|
|
887
|
-
expect(result.success).toBe(true);
|
|
888
|
-
if (result.success) {
|
|
889
|
-
const output = result.output;
|
|
890
|
-
expect(output).toEqual(testCase.expected);
|
|
891
|
-
}
|
|
892
|
-
expect(v.safeParse(testCase.schema, testCase.invalidValue).success).toBe(false);
|
|
893
|
-
expect(v.safeParse(testCase.schema, '{').success).toBe(false);
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
it('keeps persisted draft envelope constraints strict and bounded', () => {
|
|
897
|
-
const envelope = { bcc: ['sender@example'], cc: [], subject: 'a'.repeat(998), to: ['recipient@example.com'] };
|
|
898
|
-
expect(v.safeParse(appwrite.decodedSchemas.draftEnvelope, JSON.stringify(envelope)).success).toBe(true);
|
|
899
|
-
for (const invalidEnvelope of [
|
|
900
|
-
{ ...envelope, subject: 'a'.repeat(999) },
|
|
901
|
-
{ ...envelope, to: ['not-an-address'] },
|
|
902
|
-
{ ...envelope, unexpected: true },
|
|
903
|
-
]) {
|
|
904
|
-
expect(v.safeParse(appwrite.decodedSchemas.draftEnvelope, JSON.stringify(invalidEnvelope)).success).toBe(false);
|
|
905
|
-
}
|
|
906
|
-
});
|
|
907
|
-
it('keeps persisted draft attachment constraints strict and bounded', () => {
|
|
908
|
-
const attachment = { fileId: 'test-file-id-1', fileName: 'proposal.pdf', mimeType: 'application/pdf', size: 0 };
|
|
909
|
-
expect(v.safeParse(appwrite.decodedSchemas.draftAttachments, JSON.stringify([attachment])).success).toBe(true);
|
|
910
|
-
for (const invalidAttachment of [
|
|
911
|
-
{ ...attachment, fileId: '-invalid' },
|
|
912
|
-
{ ...attachment, fileName: 'a'.repeat(256) },
|
|
913
|
-
{ ...attachment, mimeType: 'x' },
|
|
914
|
-
{ ...attachment, size: -1 },
|
|
915
|
-
{ ...attachment, unexpected: true },
|
|
916
|
-
]) {
|
|
917
|
-
expect(v.safeParse(appwrite.decodedSchemas.draftAttachments, JSON.stringify([invalidAttachment])).success).toBe(false);
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
});
|