magicbell-js 0.0.2 → 0.0.4
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/commonjs/project-client/http/environment.d.ts +1 -1
- package/dist/commonjs/project-client/http/environment.d.ts.map +1 -1
- package/dist/commonjs/project-client/http/environment.js +1 -1
- package/dist/commonjs/project-client/http/environment.js.map +1 -1
- package/dist/commonjs/user-client/http/environment.d.ts +1 -1
- package/dist/commonjs/user-client/http/environment.d.ts.map +1 -1
- package/dist/commonjs/user-client/http/environment.js +1 -1
- package/dist/commonjs/user-client/http/environment.js.map +1 -1
- package/dist/esm/project-client/http/environment.d.ts +1 -1
- package/dist/esm/project-client/http/environment.d.ts.map +1 -1
- package/dist/esm/project-client/http/environment.js +1 -1
- package/dist/esm/project-client/http/environment.js.map +1 -1
- package/dist/esm/user-client/http/environment.d.ts +1 -1
- package/dist/esm/user-client/http/environment.d.ts.map +1 -1
- package/dist/esm/user-client/http/environment.js +1 -1
- package/dist/esm/user-client/http/environment.js.map +1 -1
- package/package.json +3 -2
- package/src/project-client/http/client.ts +71 -0
- package/src/project-client/http/environment.ts +3 -0
- package/src/project-client/http/error.ts +14 -0
- package/src/project-client/http/errors/validation-error.ts +25 -0
- package/src/project-client/http/handlers/handler-chain.ts +30 -0
- package/src/project-client/http/handlers/hook-handler.ts +78 -0
- package/src/project-client/http/handlers/request-validation-handler.ts +111 -0
- package/src/project-client/http/handlers/response-validation-handler.ts +203 -0
- package/src/project-client/http/handlers/retry-handler.ts +60 -0
- package/src/project-client/http/handlers/terminating-handler.ts +14 -0
- package/src/project-client/http/hooks/custom-hook.ts +25 -0
- package/src/project-client/http/hooks/hook.ts +41 -0
- package/src/project-client/http/index.ts +11 -0
- package/src/project-client/http/serialization/base-serializer.ts +139 -0
- package/src/project-client/http/serialization/header-serializer.ts +19 -0
- package/src/project-client/http/serialization/path-serializer.ts +12 -0
- package/src/project-client/http/serialization/query-serializer.ts +18 -0
- package/src/project-client/http/transport/request-builder.ts +242 -0
- package/src/project-client/http/transport/request-fetch-adapter.ts +131 -0
- package/src/project-client/http/transport/request.ts +222 -0
- package/src/project-client/http/transport/transport-hook-adapter.ts +91 -0
- package/src/project-client/http/transport/types.ts +50 -0
- package/src/project-client/http/types.ts +74 -0
- package/src/project-client/http/utils/content-type.ts +33 -0
- package/src/project-client/http/utils/line-decoder.ts +35 -0
- package/src/project-client/http/utils/response-matcher.ts +25 -0
- package/src/project-client/index.ts +94 -0
- package/src/project-client/services/base-service.ts +27 -0
- package/src/project-client/services/broadcasts/broadcasts-service.ts +115 -0
- package/src/project-client/services/broadcasts/index.ts +2 -0
- package/src/project-client/services/broadcasts/models/broadcast-collection.ts +54 -0
- package/src/project-client/services/broadcasts/models/broadcast-status.ts +60 -0
- package/src/project-client/services/broadcasts/models/broadcast.ts +143 -0
- package/src/project-client/services/broadcasts/models/email.ts +57 -0
- package/src/project-client/services/broadcasts/models/errors.ts +45 -0
- package/src/project-client/services/broadcasts/models/in-app.ts +57 -0
- package/src/project-client/services/broadcasts/models/index.ts +15 -0
- package/src/project-client/services/broadcasts/models/mobile-push.ts +57 -0
- package/src/project-client/services/broadcasts/models/overrides-channels.ts +82 -0
- package/src/project-client/services/broadcasts/models/overrides.ts +59 -0
- package/src/project-client/services/broadcasts/models/providers.ts +81 -0
- package/src/project-client/services/broadcasts/models/slack.ts +57 -0
- package/src/project-client/services/broadcasts/models/sms.ts +57 -0
- package/src/project-client/services/broadcasts/models/status-status.ts +7 -0
- package/src/project-client/services/broadcasts/models/summary.ts +51 -0
- package/src/project-client/services/broadcasts/models/web-push.ts +57 -0
- package/src/project-client/services/broadcasts/request-params.ts +5 -0
- package/src/project-client/services/channels/channels-service.ts +1017 -0
- package/src/project-client/services/channels/index.ts +2 -0
- package/src/project-client/services/channels/models/apns-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/apns-token-installation-id.ts +6 -0
- package/src/project-client/services/channels/models/apns-token.ts +90 -0
- package/src/project-client/services/channels/models/category-delivery-config-channels.ts +57 -0
- package/src/project-client/services/channels/models/category-delivery-config.ts +73 -0
- package/src/project-client/services/channels/models/channel.ts +11 -0
- package/src/project-client/services/channels/models/discard-result.ts +51 -0
- package/src/project-client/services/channels/models/expo-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/expo-token.ts +69 -0
- package/src/project-client/services/channels/models/fcm-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/fcm-token-installation-id.ts +6 -0
- package/src/project-client/services/channels/models/fcm-token.ts +75 -0
- package/src/project-client/services/channels/models/inbox-token-response-collection.ts +59 -0
- package/src/project-client/services/channels/models/inbox-token-response.ts +75 -0
- package/src/project-client/services/channels/models/index.ts +24 -0
- package/src/project-client/services/channels/models/keys.ts +51 -0
- package/src/project-client/services/channels/models/oauth.ts +57 -0
- package/src/project-client/services/channels/models/slack-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/slack-token-webhook.ts +45 -0
- package/src/project-client/services/channels/models/slack-token.ts +83 -0
- package/src/project-client/services/channels/models/teams-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/teams-token-webhook.ts +45 -0
- package/src/project-client/services/channels/models/teams-token.ts +76 -0
- package/src/project-client/services/channels/models/web-push-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/web-push-token.ts +77 -0
- package/src/project-client/services/channels/request-params.ts +45 -0
- package/src/project-client/services/common/index.ts +1 -0
- package/src/project-client/services/common/links.ts +57 -0
- package/src/project-client/services/events/events-service.ts +84 -0
- package/src/project-client/services/events/index.ts +2 -0
- package/src/project-client/services/events/models/event-collection.ts +54 -0
- package/src/project-client/services/events/models/event.ts +81 -0
- package/src/project-client/services/events/models/index.ts +2 -0
- package/src/project-client/services/events/request-params.ts +5 -0
- package/src/project-client/services/integrations/index.ts +2 -0
- package/src/project-client/services/integrations/integrations-service.ts +1965 -0
- package/src/project-client/services/integrations/models/apns-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/apns-config-payload.ts +81 -0
- package/src/project-client/services/integrations/models/apns-config.ts +64 -0
- package/src/project-client/services/integrations/models/awssns-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/awssns-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/awssns-config.ts +64 -0
- package/src/project-client/services/integrations/models/badge.ts +6 -0
- package/src/project-client/services/integrations/models/banner.ts +63 -0
- package/src/project-client/services/integrations/models/default-hover.ts +45 -0
- package/src/project-client/services/integrations/models/default-state.ts +45 -0
- package/src/project-client/services/integrations/models/default_.ts +90 -0
- package/src/project-client/services/integrations/models/dialog.ts +57 -0
- package/src/project-client/services/integrations/models/event-source-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/event-source-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/event-source-config.ts +64 -0
- package/src/project-client/services/integrations/models/expo-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/expo-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/expo-config.ts +64 -0
- package/src/project-client/services/integrations/models/fcm-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/fcm-config-payload.ts +105 -0
- package/src/project-client/services/integrations/models/fcm-config.ts +64 -0
- package/src/project-client/services/integrations/models/footer.ts +63 -0
- package/src/project-client/services/integrations/models/github-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/github-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/github-config.ts +64 -0
- package/src/project-client/services/integrations/models/header.ts +69 -0
- package/src/project-client/services/integrations/models/icon.ts +51 -0
- package/src/project-client/services/integrations/models/images.ts +45 -0
- package/src/project-client/services/integrations/models/inbox-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/inbox-config-payload.ts +60 -0
- package/src/project-client/services/integrations/models/inbox-config.ts +64 -0
- package/src/project-client/services/integrations/models/index.ts +75 -0
- package/src/project-client/services/integrations/models/integration-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/integration-config.ts +57 -0
- package/src/project-client/services/integrations/models/mailgun-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/mailgun-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/mailgun-config-payload.ts +70 -0
- package/src/project-client/services/integrations/models/mailgun-config.ts +64 -0
- package/src/project-client/services/integrations/models/notification.ts +61 -0
- package/src/project-client/services/integrations/models/payload-version.ts +6 -0
- package/src/project-client/services/integrations/models/ping-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/ping-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/ping-config.ts +64 -0
- package/src/project-client/services/integrations/models/region.ts +6 -0
- package/src/project-client/services/integrations/models/reply-to.ts +51 -0
- package/src/project-client/services/integrations/models/sendgrid-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/sendgrid-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/sendgrid-config-payload.ts +65 -0
- package/src/project-client/services/integrations/models/sendgrid-config.ts +64 -0
- package/src/project-client/services/integrations/models/ses-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/ses-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/ses-config-payload.ts +70 -0
- package/src/project-client/services/integrations/models/ses-config.ts +64 -0
- package/src/project-client/services/integrations/models/slack-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/slack-config-payload.ts +63 -0
- package/src/project-client/services/integrations/models/slack-config.ts +64 -0
- package/src/project-client/services/integrations/models/stripe-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/stripe-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/stripe-config.ts +64 -0
- package/src/project-client/services/integrations/models/templates-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/templates-config.ts +57 -0
- package/src/project-client/services/integrations/models/theme.ts +89 -0
- package/src/project-client/services/integrations/models/twilio-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/twilio-config-payload.ts +75 -0
- package/src/project-client/services/integrations/models/twilio-config.ts +64 -0
- package/src/project-client/services/integrations/models/type_.ts +5 -0
- package/src/project-client/services/integrations/models/unread-hover.ts +45 -0
- package/src/project-client/services/integrations/models/unread-state.ts +45 -0
- package/src/project-client/services/integrations/models/unread.ts +66 -0
- package/src/project-client/services/integrations/models/unseen-badge.ts +45 -0
- package/src/project-client/services/integrations/models/unseen-hover.ts +45 -0
- package/src/project-client/services/integrations/models/unseen-state.ts +45 -0
- package/src/project-client/services/integrations/models/unseen.ts +66 -0
- package/src/project-client/services/integrations/models/webpush-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/webpush-config-payload.ts +51 -0
- package/src/project-client/services/integrations/models/webpush-config.ts +64 -0
- package/src/project-client/services/integrations/request-params.ts +5 -0
- package/src/project-client/services/jwt/index.ts +2 -0
- package/src/project-client/services/jwt/jwt-service.ts +233 -0
- package/src/project-client/services/jwt/models/access-token-collection.ts +54 -0
- package/src/project-client/services/jwt/models/access-token.ts +69 -0
- package/src/project-client/services/jwt/models/create-project-token-request.ts +51 -0
- package/src/project-client/services/jwt/models/create-token-response.ts +63 -0
- package/src/project-client/services/jwt/models/create-user-token-request.ts +63 -0
- package/src/project-client/services/jwt/models/discard-token-response.ts +51 -0
- package/src/project-client/services/jwt/models/index.ts +6 -0
- package/src/project-client/services/jwt/request-params.ts +11 -0
- package/src/project-client/services/notifications/index.ts +2 -0
- package/src/project-client/services/notifications/models/delivery-plan-collection.ts +54 -0
- package/src/project-client/services/notifications/models/delivery-plan.ts +93 -0
- package/src/project-client/services/notifications/models/index.ts +2 -0
- package/src/project-client/services/notifications/notifications-service.ts +44 -0
- package/src/project-client/services/users/index.ts +2 -0
- package/src/project-client/services/users/models/index.ts +2 -0
- package/src/project-client/services/users/models/user-collection.ts +54 -0
- package/src/project-client/services/users/models/user.ts +99 -0
- package/src/project-client/services/users/request-params.ts +6 -0
- package/src/project-client/services/users/users-service.ts +117 -0
- package/src/project-client.ts +1 -0
- package/src/user-client/http/client.ts +71 -0
- package/src/user-client/http/environment.ts +3 -0
- package/src/user-client/http/error.ts +14 -0
- package/src/user-client/http/errors/validation-error.ts +25 -0
- package/src/user-client/http/handlers/handler-chain.ts +30 -0
- package/src/user-client/http/handlers/hook-handler.ts +78 -0
- package/src/user-client/http/handlers/request-validation-handler.ts +111 -0
- package/src/user-client/http/handlers/response-validation-handler.ts +203 -0
- package/src/user-client/http/handlers/retry-handler.ts +60 -0
- package/src/user-client/http/handlers/terminating-handler.ts +14 -0
- package/src/user-client/http/hooks/custom-hook.ts +25 -0
- package/src/user-client/http/hooks/hook.ts +41 -0
- package/src/user-client/http/index.ts +11 -0
- package/src/user-client/http/serialization/base-serializer.ts +139 -0
- package/src/user-client/http/serialization/header-serializer.ts +19 -0
- package/src/user-client/http/serialization/path-serializer.ts +12 -0
- package/src/user-client/http/serialization/query-serializer.ts +18 -0
- package/src/user-client/http/transport/request-builder.ts +242 -0
- package/src/user-client/http/transport/request-fetch-adapter.ts +131 -0
- package/src/user-client/http/transport/request.ts +222 -0
- package/src/user-client/http/transport/transport-hook-adapter.ts +91 -0
- package/src/user-client/http/transport/types.ts +50 -0
- package/src/user-client/http/types.ts +74 -0
- package/src/user-client/http/utils/content-type.ts +33 -0
- package/src/user-client/http/utils/line-decoder.ts +35 -0
- package/src/user-client/http/utils/response-matcher.ts +25 -0
- package/src/user-client/index.ts +54 -0
- package/src/user-client/services/base-service.ts +27 -0
- package/src/user-client/services/channels/channels-service.ts +1020 -0
- package/src/user-client/services/channels/index.ts +2 -0
- package/src/user-client/services/channels/models/apns-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/apns-token-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/apns-token-payload-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/apns-token-payload.ts +66 -0
- package/src/user-client/services/channels/models/apns-token.ts +90 -0
- package/src/user-client/services/channels/models/discard-result.ts +51 -0
- package/src/user-client/services/channels/models/expo-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/expo-token-payload.ts +45 -0
- package/src/user-client/services/channels/models/expo-token.ts +69 -0
- package/src/user-client/services/channels/models/fcm-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/fcm-token-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/fcm-token-payload-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/fcm-token-payload.ts +51 -0
- package/src/user-client/services/channels/models/fcm-token.ts +75 -0
- package/src/user-client/services/channels/models/inbox-token-response-collection.ts +59 -0
- package/src/user-client/services/channels/models/inbox-token-response.ts +75 -0
- package/src/user-client/services/channels/models/inbox-token.ts +51 -0
- package/src/user-client/services/channels/models/index.ts +33 -0
- package/src/user-client/services/channels/models/slack-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/slack-token-oauth.ts +57 -0
- package/src/user-client/services/channels/models/slack-token-payload-oauth.ts +57 -0
- package/src/user-client/services/channels/models/slack-token-payload-webhook.ts +45 -0
- package/src/user-client/services/channels/models/slack-token-payload.ts +64 -0
- package/src/user-client/services/channels/models/slack-token-webhook.ts +45 -0
- package/src/user-client/services/channels/models/slack-token.ts +88 -0
- package/src/user-client/services/channels/models/teams-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/teams-token-payload-webhook.ts +45 -0
- package/src/user-client/services/channels/models/teams-token-payload.ts +52 -0
- package/src/user-client/services/channels/models/teams-token-webhook.ts +45 -0
- package/src/user-client/services/channels/models/teams-token.ts +76 -0
- package/src/user-client/services/channels/models/web-push-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/web-push-token-keys.ts +51 -0
- package/src/user-client/services/channels/models/web-push-token-payload-keys.ts +51 -0
- package/src/user-client/services/channels/models/web-push-token.ts +82 -0
- package/src/user-client/services/channels/request-params.ts +41 -0
- package/src/user-client/services/common/index.ts +2 -0
- package/src/user-client/services/common/links.ts +57 -0
- package/src/user-client/services/common/web-push-token-payload.ts +58 -0
- package/src/user-client/services/integrations/index.ts +2 -0
- package/src/user-client/services/integrations/integrations-service.ts +278 -0
- package/src/user-client/services/integrations/models/authed-user.ts +75 -0
- package/src/user-client/services/integrations/models/banner.ts +63 -0
- package/src/user-client/services/integrations/models/default-hover.ts +45 -0
- package/src/user-client/services/integrations/models/default-state.ts +45 -0
- package/src/user-client/services/integrations/models/default_.ts +90 -0
- package/src/user-client/services/integrations/models/dialog.ts +57 -0
- package/src/user-client/services/integrations/models/enterprise.ts +51 -0
- package/src/user-client/services/integrations/models/footer.ts +63 -0
- package/src/user-client/services/integrations/models/header.ts +69 -0
- package/src/user-client/services/integrations/models/icon.ts +51 -0
- package/src/user-client/services/integrations/models/images.ts +45 -0
- package/src/user-client/services/integrations/models/inbox-config-payload.ts +60 -0
- package/src/user-client/services/integrations/models/incoming-webhook.ts +57 -0
- package/src/user-client/services/integrations/models/index.ts +29 -0
- package/src/user-client/services/integrations/models/slack-finish-install-response.ts +57 -0
- package/src/user-client/services/integrations/models/slack-installation.ts +136 -0
- package/src/user-client/services/integrations/models/slack-start-install-response-content.ts +57 -0
- package/src/user-client/services/integrations/models/slack-start-install.ts +63 -0
- package/src/user-client/services/integrations/models/team.ts +51 -0
- package/src/user-client/services/integrations/models/templates-installation.ts +57 -0
- package/src/user-client/services/integrations/models/theme-notification.ts +61 -0
- package/src/user-client/services/integrations/models/theme.ts +94 -0
- package/src/user-client/services/integrations/models/unread-hover.ts +45 -0
- package/src/user-client/services/integrations/models/unread-state.ts +45 -0
- package/src/user-client/services/integrations/models/unread.ts +66 -0
- package/src/user-client/services/integrations/models/unseen-badge.ts +45 -0
- package/src/user-client/services/integrations/models/unseen-hover.ts +45 -0
- package/src/user-client/services/integrations/models/unseen-state.ts +45 -0
- package/src/user-client/services/integrations/models/unseen.ts +66 -0
- package/src/user-client/services/integrations/models/web-push-start-installation-response.ts +51 -0
- package/src/user-client/services/notifications/index.ts +2 -0
- package/src/user-client/services/notifications/models/index.ts +2 -0
- package/src/user-client/services/notifications/models/notification-collection.ts +54 -0
- package/src/user-client/services/notifications/models/notification.ts +129 -0
- package/src/user-client/services/notifications/notifications-service.ts +189 -0
- package/src/user-client/services/notifications/request-params.ts +7 -0
- package/src/user-client.ts +1 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const mobilePush = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {MobilePush} mobilePush
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type MobilePush = z.infer<typeof mobilePush>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const mobilePushResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const mobilePushRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Email, email, emailRequest, emailResponse } from './email.js';
|
|
4
|
+
import { InApp, inApp, inAppRequest, inAppResponse } from './in-app.js';
|
|
5
|
+
import { MobilePush, mobilePush, mobilePushRequest, mobilePushResponse } from './mobile-push.js';
|
|
6
|
+
import { Slack, slack, slackRequest, slackResponse } from './slack.js';
|
|
7
|
+
import { Sms, sms, smsRequest, smsResponse } from './sms.js';
|
|
8
|
+
import { WebPush, webPush, webPushRequest, webPushResponse } from './web-push.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The shape of the model inside the application code - what the users use
|
|
12
|
+
*/
|
|
13
|
+
export const overridesChannels = z.lazy(() => {
|
|
14
|
+
return z.object({
|
|
15
|
+
email: email.optional(),
|
|
16
|
+
inApp: inApp.optional(),
|
|
17
|
+
mobilePush: mobilePush.optional(),
|
|
18
|
+
slack: slack.optional(),
|
|
19
|
+
sms: sms.optional(),
|
|
20
|
+
webPush: webPush.optional(),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @typedef {OverridesChannels} overridesChannels
|
|
27
|
+
* @property {Email}
|
|
28
|
+
* @property {InApp}
|
|
29
|
+
* @property {MobilePush}
|
|
30
|
+
* @property {Slack}
|
|
31
|
+
* @property {Sms}
|
|
32
|
+
* @property {WebPush}
|
|
33
|
+
*/
|
|
34
|
+
export type OverridesChannels = z.infer<typeof overridesChannels>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
38
|
+
* Is equal to application shape if all property names match the api schema
|
|
39
|
+
*/
|
|
40
|
+
export const overridesChannelsResponse = z.lazy(() => {
|
|
41
|
+
return z
|
|
42
|
+
.object({
|
|
43
|
+
email: emailResponse.optional(),
|
|
44
|
+
in_app: inAppResponse.optional(),
|
|
45
|
+
mobile_push: mobilePushResponse.optional(),
|
|
46
|
+
slack: slackResponse.optional(),
|
|
47
|
+
sms: smsResponse.optional(),
|
|
48
|
+
web_push: webPushResponse.optional(),
|
|
49
|
+
})
|
|
50
|
+
.transform((data) => ({
|
|
51
|
+
email: data['email'],
|
|
52
|
+
inApp: data['in_app'],
|
|
53
|
+
mobilePush: data['mobile_push'],
|
|
54
|
+
slack: data['slack'],
|
|
55
|
+
sms: data['sms'],
|
|
56
|
+
webPush: data['web_push'],
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
62
|
+
* Is equal to application shape if all property names match the api schema
|
|
63
|
+
*/
|
|
64
|
+
export const overridesChannelsRequest = z.lazy(() => {
|
|
65
|
+
return z
|
|
66
|
+
.object({
|
|
67
|
+
email: emailRequest.optional(),
|
|
68
|
+
inApp: inAppRequest.optional(),
|
|
69
|
+
mobilePush: mobilePushRequest.optional(),
|
|
70
|
+
slack: slackRequest.optional(),
|
|
71
|
+
sms: smsRequest.optional(),
|
|
72
|
+
webPush: webPushRequest.optional(),
|
|
73
|
+
})
|
|
74
|
+
.transform((data) => ({
|
|
75
|
+
email: data['email'],
|
|
76
|
+
in_app: data['inApp'],
|
|
77
|
+
mobile_push: data['mobilePush'],
|
|
78
|
+
slack: data['slack'],
|
|
79
|
+
sms: data['sms'],
|
|
80
|
+
web_push: data['webPush'],
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
OverridesChannels,
|
|
5
|
+
overridesChannels,
|
|
6
|
+
overridesChannelsRequest,
|
|
7
|
+
overridesChannelsResponse,
|
|
8
|
+
} from './overrides-channels.js';
|
|
9
|
+
import { Providers, providers, providersRequest, providersResponse } from './providers.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The shape of the model inside the application code - what the users use
|
|
13
|
+
*/
|
|
14
|
+
export const overrides = z.lazy(() => {
|
|
15
|
+
return z.object({
|
|
16
|
+
channels: overridesChannels.optional(),
|
|
17
|
+
providers: providers.optional(),
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @typedef {Overrides} overrides
|
|
24
|
+
* @property {OverridesChannels}
|
|
25
|
+
* @property {Providers}
|
|
26
|
+
*/
|
|
27
|
+
export type Overrides = z.infer<typeof overrides>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
31
|
+
* Is equal to application shape if all property names match the api schema
|
|
32
|
+
*/
|
|
33
|
+
export const overridesResponse = z.lazy(() => {
|
|
34
|
+
return z
|
|
35
|
+
.object({
|
|
36
|
+
channels: overridesChannelsResponse.optional(),
|
|
37
|
+
providers: providersResponse.optional(),
|
|
38
|
+
})
|
|
39
|
+
.transform((data) => ({
|
|
40
|
+
channels: data['channels'],
|
|
41
|
+
providers: data['providers'],
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
47
|
+
* Is equal to application shape if all property names match the api schema
|
|
48
|
+
*/
|
|
49
|
+
export const overridesRequest = z.lazy(() => {
|
|
50
|
+
return z
|
|
51
|
+
.object({
|
|
52
|
+
channels: overridesChannelsRequest.optional(),
|
|
53
|
+
providers: providersRequest.optional(),
|
|
54
|
+
})
|
|
55
|
+
.transform((data) => ({
|
|
56
|
+
channels: data['channels'],
|
|
57
|
+
providers: data['providers'],
|
|
58
|
+
}));
|
|
59
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const providers = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
amazonSes: z.any().optional(),
|
|
9
|
+
android: z.any().optional(),
|
|
10
|
+
ios: z.any().optional(),
|
|
11
|
+
mailgun: z.any().optional(),
|
|
12
|
+
postmark: z.any().optional(),
|
|
13
|
+
sendgrid: z.any().optional(),
|
|
14
|
+
slack: z.any().optional(),
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @typedef {Providers} providers
|
|
21
|
+
* @property {any}
|
|
22
|
+
* @property {any}
|
|
23
|
+
* @property {any}
|
|
24
|
+
* @property {any}
|
|
25
|
+
* @property {any}
|
|
26
|
+
* @property {any}
|
|
27
|
+
* @property {any}
|
|
28
|
+
*/
|
|
29
|
+
export type Providers = z.infer<typeof providers>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
33
|
+
* Is equal to application shape if all property names match the api schema
|
|
34
|
+
*/
|
|
35
|
+
export const providersResponse = z.lazy(() => {
|
|
36
|
+
return z
|
|
37
|
+
.object({
|
|
38
|
+
amazon_ses: z.any().optional(),
|
|
39
|
+
android: z.any().optional(),
|
|
40
|
+
ios: z.any().optional(),
|
|
41
|
+
mailgun: z.any().optional(),
|
|
42
|
+
postmark: z.any().optional(),
|
|
43
|
+
sendgrid: z.any().optional(),
|
|
44
|
+
slack: z.any().optional(),
|
|
45
|
+
})
|
|
46
|
+
.transform((data) => ({
|
|
47
|
+
amazonSes: data['amazon_ses'],
|
|
48
|
+
android: data['android'],
|
|
49
|
+
ios: data['ios'],
|
|
50
|
+
mailgun: data['mailgun'],
|
|
51
|
+
postmark: data['postmark'],
|
|
52
|
+
sendgrid: data['sendgrid'],
|
|
53
|
+
slack: data['slack'],
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
59
|
+
* Is equal to application shape if all property names match the api schema
|
|
60
|
+
*/
|
|
61
|
+
export const providersRequest = z.lazy(() => {
|
|
62
|
+
return z
|
|
63
|
+
.object({
|
|
64
|
+
amazonSes: z.any().optional(),
|
|
65
|
+
android: z.any().optional(),
|
|
66
|
+
ios: z.any().optional(),
|
|
67
|
+
mailgun: z.any().optional(),
|
|
68
|
+
postmark: z.any().optional(),
|
|
69
|
+
sendgrid: z.any().optional(),
|
|
70
|
+
slack: z.any().optional(),
|
|
71
|
+
})
|
|
72
|
+
.transform((data) => ({
|
|
73
|
+
amazon_ses: data['amazonSes'],
|
|
74
|
+
android: data['android'],
|
|
75
|
+
ios: data['ios'],
|
|
76
|
+
mailgun: data['mailgun'],
|
|
77
|
+
postmark: data['postmark'],
|
|
78
|
+
sendgrid: data['sendgrid'],
|
|
79
|
+
slack: data['slack'],
|
|
80
|
+
}));
|
|
81
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const slack = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {Slack} slack
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type Slack = z.infer<typeof slack>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const slackResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const slackRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const sms = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {Sms} sms
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type Sms = z.infer<typeof sms>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const smsResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const smsRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const summary = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
failures: z.number(),
|
|
9
|
+
total: z.number(),
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @typedef {Summary} summary
|
|
16
|
+
* @property {number} - The number of failures while processing the broadcast.
|
|
17
|
+
* @property {number} - The number of recipients that the broadcast was sent to.
|
|
18
|
+
*/
|
|
19
|
+
export type Summary = z.infer<typeof summary>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
23
|
+
* Is equal to application shape if all property names match the api schema
|
|
24
|
+
*/
|
|
25
|
+
export const summaryResponse = z.lazy(() => {
|
|
26
|
+
return z
|
|
27
|
+
.object({
|
|
28
|
+
failures: z.number(),
|
|
29
|
+
total: z.number(),
|
|
30
|
+
})
|
|
31
|
+
.transform((data) => ({
|
|
32
|
+
failures: data['failures'],
|
|
33
|
+
total: data['total'],
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
39
|
+
* Is equal to application shape if all property names match the api schema
|
|
40
|
+
*/
|
|
41
|
+
export const summaryRequest = z.lazy(() => {
|
|
42
|
+
return z
|
|
43
|
+
.object({
|
|
44
|
+
failures: z.number(),
|
|
45
|
+
total: z.number(),
|
|
46
|
+
})
|
|
47
|
+
.transform((data) => ({
|
|
48
|
+
failures: data['failures'],
|
|
49
|
+
total: data['total'],
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const webPush = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {WebPush} webPush
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type WebPush = z.infer<typeof webPush>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const webPushResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const webPushRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|