@zyphr-dev/node-sdk 0.1.36 → 0.1.38
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/README.md +39 -0
- package/dist/index.cjs +773 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1193 -522
- package/dist/index.d.ts +1193 -522
- package/dist/index.js +737 -47
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
- package/src/.openapi-generator/FILES +7 -0
- package/src/clientAuth.ts +182 -0
- package/src/errors.ts +29 -16
- package/src/index.ts +4 -1
- package/src/src/apis/AuthEmailOTPApi.ts +1 -1
- package/src/src/apis/AuthEmailTemplatesApi.ts +1 -1
- package/src/src/apis/AuthEmailVerificationApi.ts +1 -1
- package/src/src/apis/AuthLoginApi.ts +1 -1
- package/src/src/apis/AuthMFAApi.ts +1 -1
- package/src/src/apis/AuthMagicLinksApi.ts +1 -1
- package/src/src/apis/AuthOAuthApi.ts +28 -25
- package/src/src/apis/AuthOrganizationsApi.ts +1 -1
- package/src/src/apis/AuthPasswordResetApi.ts +1 -1
- package/src/src/apis/AuthPhoneApi.ts +1 -1
- package/src/src/apis/AuthRegistrationApi.ts +70 -5
- package/src/src/apis/AuthSessionsApi.ts +1 -1
- package/src/src/apis/AuthUserDirectoryApi.ts +596 -0
- package/src/src/apis/AuthUserProfileApi.ts +1 -63
- package/src/src/apis/AuthWebAuthnApi.ts +1 -1
- package/src/src/apis/DevicesApi.ts +1 -1
- package/src/src/apis/DomainsApi.ts +1 -1
- package/src/src/apis/EmailsApi.ts +1 -1
- package/src/src/apis/ExecutionsApi.ts +1 -1
- package/src/src/apis/InboundEmailApi.ts +1 -1
- package/src/src/apis/InboxApi.ts +1 -1
- package/src/src/apis/MuseApi.ts +1 -1
- package/src/src/apis/PushApi.ts +1 -1
- package/src/src/apis/SMSApi.ts +1 -1
- package/src/src/apis/SlackApi.ts +1 -1
- package/src/src/apis/SubscribersApi.ts +1 -1
- package/src/src/apis/TemplatesApi.ts +78 -1
- package/src/src/apis/TopicsApi.ts +1 -1
- package/src/src/apis/UtilityApi.ts +1 -1
- package/src/src/apis/WaaSApplicationsApi.ts +1 -1
- package/src/src/apis/WaaSDeliveriesApi.ts +1 -1
- package/src/src/apis/WaaSEndpointsApi.ts +1 -1
- package/src/src/apis/WaaSEventTypesApi.ts +1 -1
- package/src/src/apis/WaaSEventsApi.ts +1 -1
- package/src/src/apis/WaaSPortalApi.ts +1 -1
- package/src/src/apis/WebhooksApi.ts +1 -1
- package/src/src/apis/index.ts +1 -0
- package/src/src/models/AddDomain200Response.ts +1 -1
- package/src/src/models/AddDomain200ResponseMeta.ts +1 -1
- package/src/src/models/AddDomainRequest.ts +1 -1
- package/src/src/models/AddOrganizationMemberRequest.ts +1 -1
- package/src/src/models/AddTopicSubscribersRequest.ts +1 -1
- package/src/src/models/ApiError.ts +1 -1
- package/src/src/models/ApiErrorError.ts +1 -1
- package/src/src/models/ApiErrorMeta.ts +1 -1
- package/src/src/models/AuthEmailTemplate.ts +1 -1
- package/src/src/models/AuthEmailTemplateDefault.ts +1 -1
- package/src/src/models/AuthEmailTemplateDefaultResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplateDeleteResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplateDeleteResponseData.ts +1 -1
- package/src/src/models/AuthEmailTemplateListResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplatePreviewDraft.ts +1 -1
- package/src/src/models/AuthEmailTemplatePreviewRequest.ts +1 -1
- package/src/src/models/AuthEmailTemplatePreviewResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplatePreviewResult.ts +1 -1
- package/src/src/models/AuthEmailTemplateResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplateTestRequest.ts +1 -1
- package/src/src/models/AuthEmailTemplateTestResponse.ts +1 -1
- package/src/src/models/AuthEmailTemplateTestResult.ts +1 -1
- package/src/src/models/AuthEmailTemplateVersion.ts +1 -1
- package/src/src/models/AuthEmailTemplateVersionsResponse.ts +1 -1
- package/src/src/models/AuthEmailType.ts +1 -1
- package/src/src/models/AuthLoginResponse.ts +1 -1
- package/src/src/models/AuthLoginResult.ts +1 -1
- package/src/src/models/AuthLoginResultMfaChallenge.ts +1 -1
- package/src/src/models/AuthResult.ts +1 -1
- package/src/src/models/AuthResultResponse.ts +1 -1
- package/src/src/models/AuthSession.ts +1 -1
- package/src/src/models/AuthTokens.ts +1 -1
- package/src/src/models/AuthUser.ts +1 -1
- package/src/src/models/AuthUserResponse.ts +1 -1
- package/src/src/models/AuthUserResponseData.ts +1 -1
- package/src/src/models/BatchPublishWaaSEvents201Response.ts +1 -1
- package/src/src/models/BatchRecipient.ts +1 -1
- package/src/src/models/BulkRetryWebhookDeliveriesRequest.ts +1 -1
- package/src/src/models/BulkUpsertAuthEmailTemplatesRequest.ts +1 -1
- package/src/src/models/BulkUpsertAuthEmailTemplatesResponse.ts +1 -1
- package/src/src/models/Category.ts +1 -1
- package/src/src/models/CategoryListResponse.ts +1 -1
- package/src/src/models/CategoryResponse.ts +1 -1
- package/src/src/models/ConfirmEmailVerificationRequest.ts +1 -1
- package/src/src/models/ConfirmEmailVerificationResponse.ts +1 -1
- package/src/src/models/ConfirmEmailVerificationResponseData.ts +1 -1
- package/src/src/models/ConsentHistoryEntry.ts +1 -1
- package/src/src/models/ConsentHistoryResponse.ts +1 -1
- package/src/src/models/ConsentRecordResponse.ts +1 -1
- package/src/src/models/ConsentRecordResponseData.ts +1 -1
- package/src/src/models/ConsentStatus.ts +1 -1
- package/src/src/models/ConsentStatusResponse.ts +1 -1
- package/src/src/models/ConsentWithdrawResponse.ts +1 -1
- package/src/src/models/ConvertAnonymousUserRequest.ts +1 -1
- package/src/src/models/ConvertAnonymousUserRequestOneOf.ts +1 -1
- package/src/src/models/ConvertAnonymousUserRequestOneOf1.ts +1 -1
- package/src/src/models/ConvertAnonymousUserRequestOneOf1AppleUser.ts +1 -1
- package/src/src/models/ConvertAnonymousUserRequestOneOf1AppleUserName.ts +1 -1
- package/src/src/models/CreateCategoryRequest.ts +1 -1
- package/src/src/models/CreateOrganizationRequest.ts +1 -1
- package/src/src/models/CreateSubscriberRequest.ts +1 -1
- package/src/src/models/CreateTemplateRequest.ts +1 -1
- package/src/src/models/CreateTopicRequest.ts +1 -1
- package/src/src/models/CreateWaaSApplication201Response.ts +1 -1
- package/src/src/models/CreateWaaSApplicationRequest.ts +1 -1
- package/src/src/models/CreateWaaSEndpoint201Response.ts +1 -1
- package/src/src/models/CreateWaaSEndpointRequest.ts +1 -1
- package/src/src/models/CreateWaaSEndpointResponse.ts +1 -1
- package/src/src/models/CreateWaaSEventType201Response.ts +1 -1
- package/src/src/models/CreateWaaSEventTypeRequest.ts +1 -1
- package/src/src/models/CreateWebhookRequest.ts +1 -1
- package/src/src/models/DeleteDomainResponse.ts +1 -1
- package/src/src/models/DeleteDomainResponseData.ts +1 -1
- package/src/src/models/DeleteResult.ts +1 -1
- package/src/src/models/DeleteResultData.ts +1 -1
- package/src/src/models/Device.ts +1 -1
- package/src/src/models/DeviceListResponse.ts +1 -1
- package/src/src/models/DevicePushTopic.ts +1 -1
- package/src/src/models/DevicePushTopicListResponse.ts +1 -1
- package/src/src/models/DevicePushTopicListResponseMeta.ts +1 -1
- package/src/src/models/DeviceResponse.ts +1 -1
- package/src/src/models/DeviceStats.ts +1 -1
- package/src/src/models/DeviceStatsResponse.ts +1 -1
- package/src/src/models/DnsRecord.ts +1 -1
- package/src/src/models/DomainListResponse.ts +1 -1
- package/src/src/models/DomainListResponseMeta.ts +1 -1
- package/src/src/models/DomainResponse.ts +1 -1
- package/src/src/models/EmailAddress.ts +1 -1
- package/src/src/models/EmailAttachment.ts +1 -1
- package/src/src/models/EmailEvent.ts +1 -1
- package/src/src/models/EmailEventsResponse.ts +1 -1
- package/src/src/models/EmailListResponse.ts +1 -1
- package/src/src/models/EmailMessage.ts +1 -1
- package/src/src/models/EmailResponse.ts +1 -1
- package/src/src/models/EmailTrackingClickLink.ts +1 -1
- package/src/src/models/EmailTrackingClicks.ts +1 -1
- package/src/src/models/EmailTrackingData.ts +1 -1
- package/src/src/models/EmailTrackingOpens.ts +1 -1
- package/src/src/models/EmailTrackingResponse.ts +1 -1
- package/src/src/models/EndUserDeleteResponse.ts +1 -1
- package/src/src/models/EndUserDeleteResponseData.ts +1 -1
- package/src/src/models/ExecutionCancelResponse.ts +1 -1
- package/src/src/models/ExecutionCancelResponseData.ts +1 -1
- package/src/src/models/ExecutionResponse.ts +1 -1
- package/src/src/models/ExecutionRetryResponse.ts +1 -1
- package/src/src/models/ExecutionRetryResponseData.ts +1 -1
- package/src/src/models/ForgotPasswordRequest.ts +1 -1
- package/src/src/models/GenerateSubscriberToken200Response.ts +1 -1
- package/src/src/models/GenerateSubscriberToken200ResponseData.ts +1 -1
- package/src/src/models/GenerateSubscriberTokenRequest.ts +1 -1
- package/src/src/models/GenerateWaaSPortalToken201Response.ts +1 -1
- package/src/src/models/GetDomain200Response.ts +1 -1
- package/src/src/models/GetDomain200ResponseMeta.ts +1 -1
- package/src/src/models/GetWaaSEndpoint200Response.ts +1 -1
- package/src/src/models/GetWaaSUsage200Response.ts +1 -1
- package/src/src/models/InAppNotification.ts +1 -1
- package/src/src/models/InboundAttachmentUrlResponse.ts +1 -1
- package/src/src/models/InboundAttachmentUrlResponseData.ts +1 -1
- package/src/src/models/InboundEmail.ts +1 -1
- package/src/src/models/InboundEmailAttachment.ts +1 -1
- package/src/src/models/InboundEmailFrom.ts +1 -1
- package/src/src/models/InboundEmailListResponse.ts +1 -1
- package/src/src/models/InboundEmailListResponseMeta.ts +1 -1
- package/src/src/models/InboundEmailResponse.ts +1 -1
- package/src/src/models/InboxListMeta.ts +1 -1
- package/src/src/models/InboxListResponse.ts +1 -1
- package/src/src/models/InboxNotificationResponse.ts +1 -1
- package/src/src/models/InviteEndUserRequest.ts +110 -0
- package/src/src/models/ListWaaSApplications200Response.ts +1 -1
- package/src/src/models/ListWaaSEndpointDeliveries200Response.ts +1 -1
- package/src/src/models/ListWaaSEndpoints200Response.ts +1 -1
- package/src/src/models/ListWaaSEventTypes200Response.ts +1 -1
- package/src/src/models/LoginRequest.ts +1 -1
- package/src/src/models/MagicLinkSendRequest.ts +1 -1
- package/src/src/models/MagicLinkVerifyRequest.ts +1 -1
- package/src/src/models/MagicLinkVerifyResponse.ts +1 -1
- package/src/src/models/MagicLinkVerifyResponseData.ts +1 -1
- package/src/src/models/MarkAllInboxReadRequest.ts +1 -1
- package/src/src/models/MarkAllReadData.ts +1 -1
- package/src/src/models/MarkAllReadResponse.ts +1 -1
- package/src/src/models/MarkAllSubscriberNotificationsReadRequest.ts +1 -1
- package/src/src/models/MarkInboxReadRequest.ts +1 -1
- package/src/src/models/MfaBackupCodesResponse.ts +1 -1
- package/src/src/models/MfaBackupCodesResponseData.ts +1 -1
- package/src/src/models/MfaDisableRequest.ts +1 -1
- package/src/src/models/MfaDisableResponse.ts +1 -1
- package/src/src/models/MfaDisableResponseData.ts +1 -1
- package/src/src/models/MfaEnrollRequest.ts +1 -1
- package/src/src/models/MfaEnrollmentResponse.ts +1 -1
- package/src/src/models/MfaEnrollmentResponseData.ts +1 -1
- package/src/src/models/MfaRegenerateBackupCodesRequest.ts +1 -1
- package/src/src/models/MfaStatusResponse.ts +1 -1
- package/src/src/models/MfaStatusResponseData.ts +1 -1
- package/src/src/models/MfaVerifyBackupRequest.ts +1 -1
- package/src/src/models/MfaVerifyBackupResponse.ts +1 -1
- package/src/src/models/MfaVerifyBackupResponseData.ts +1 -1
- package/src/src/models/MfaVerifyEnrollmentRequest.ts +1 -1
- package/src/src/models/MfaVerifyEnrollmentResponse.ts +1 -1
- package/src/src/models/MfaVerifyEnrollmentResponseData.ts +1 -1
- package/src/src/models/MfaVerifyRequest.ts +1 -1
- package/src/src/models/OAuthAuthorizationUrlResponse.ts +1 -1
- package/src/src/models/OAuthAuthorizationUrlResponseData.ts +1 -1
- package/src/src/models/OAuthCallbackRequest.ts +1 -1
- package/src/src/models/OAuthCallbackResponse.ts +1 -1
- package/src/src/models/OAuthCallbackResponseData.ts +1 -1
- package/src/src/models/OAuthConnection.ts +1 -1
- package/src/src/models/OAuthConnectionInfoResponse.ts +1 -1
- package/src/src/models/OAuthConnectionInfoResponseData.ts +1 -1
- package/src/src/models/OAuthConnectionsResponse.ts +1 -1
- package/src/src/models/OAuthConnectionsResponseData.ts +1 -1
- package/src/src/models/OAuthProvider.ts +1 -1
- package/src/src/models/OAuthProviderInfo.ts +1 -1
- package/src/src/models/OAuthProviderName.ts +56 -0
- package/src/src/models/OAuthProvidersResponse.ts +1 -1
- package/src/src/models/OAuthProvidersResponseData.ts +1 -1
- package/src/src/models/OAuthTokensRefreshResponse.ts +1 -1
- package/src/src/models/OAuthTokensRefreshResponseData.ts +1 -1
- package/src/src/models/OAuthTokensResponse.ts +1 -1
- package/src/src/models/OAuthTokensResponseData.ts +1 -1
- package/src/src/models/Organization.ts +1 -1
- package/src/src/models/OrganizationListResponse.ts +1 -1
- package/src/src/models/OrganizationListResponseMeta.ts +1 -1
- package/src/src/models/OrganizationMembersListResponse.ts +1 -1
- package/src/src/models/OrganizationMembership.ts +1 -1
- package/src/src/models/OrganizationMembershipResponse.ts +1 -1
- package/src/src/models/OrganizationMembershipWithUser.ts +1 -1
- package/src/src/models/OrganizationResponse.ts +1 -1
- package/src/src/models/PaginationMeta.ts +1 -1
- package/src/src/models/PasswordRequirements.ts +1 -1
- package/src/src/models/PasswordRequirementsResponse.ts +1 -1
- package/src/src/models/PasswordRequirementsResponseData.ts +1 -1
- package/src/src/models/PayloadTooLargeError.ts +1 -1
- package/src/src/models/PayloadTooLargeErrorError.ts +1 -1
- package/src/src/models/PayloadTooLargeErrorErrorDetails.ts +1 -1
- package/src/src/models/PhoneAuthAvailabilityResponse.ts +1 -1
- package/src/src/models/PhoneAuthAvailabilityResponseData.ts +1 -1
- package/src/src/models/PhoneLoginVerifyRequest.ts +1 -1
- package/src/src/models/PhoneOtpSendRequest.ts +1 -1
- package/src/src/models/PhoneOtpSentResponse.ts +1 -1
- package/src/src/models/PhoneOtpSentResponseData.ts +1 -1
- package/src/src/models/PhoneRegisterVerifyRequest.ts +1 -1
- package/src/src/models/PreferenceListResponse.ts +1 -1
- package/src/src/models/PublishWaaSEvent201Response.ts +1 -1
- package/src/src/models/PushDetailResponse.ts +1 -1
- package/src/src/models/PushEvent.ts +1 -1
- package/src/src/models/PushListResponse.ts +1 -1
- package/src/src/models/PushMessage.ts +1 -1
- package/src/src/models/PushMessageDetail.ts +1 -1
- package/src/src/models/PushMessageDetailAllOfActionButtons.ts +1 -1
- package/src/src/models/PushStatsData.ts +1 -1
- package/src/src/models/PushStatsResponse.ts +1 -1
- package/src/src/models/PushTopicDevice.ts +1 -1
- package/src/src/models/PushTopicDeviceListResponse.ts +1 -1
- package/src/src/models/PushTopicSubscribeData.ts +1 -1
- package/src/src/models/PushTopicSubscribeResponse.ts +1 -1
- package/src/src/models/PushTopicUnsubscribeData.ts +1 -1
- package/src/src/models/PushTopicUnsubscribeResponse.ts +1 -1
- package/src/src/models/RefreshOAuthTokensRequest.ts +1 -1
- package/src/src/models/RefreshSessionRequest.ts +1 -1
- package/src/src/models/RefreshTokenResponse.ts +1 -1
- package/src/src/models/RefreshTokenResponseData.ts +1 -1
- package/src/src/models/RegisterDeviceRequest.ts +1 -1
- package/src/src/models/RegisterRequest.ts +1 -1
- package/src/src/models/RemoveTopicSubscribersRequest.ts +1 -1
- package/src/src/models/RenameWebAuthnCredentialRequest.ts +1 -1
- package/src/src/models/RenderTemplateRequest.ts +1 -1
- package/src/src/models/ReplayWebhookEventsRequest.ts +1 -1
- package/src/src/models/RequestMeta.ts +1 -1
- package/src/src/models/ResetPasswordRequest.ts +1 -1
- package/src/src/models/ResetPasswordResponse.ts +1 -1
- package/src/src/models/ResubscribeRequest.ts +1 -1
- package/src/src/models/ResubscribeResponse.ts +1 -1
- package/src/src/models/RevokeAllSessionsResponse.ts +1 -1
- package/src/src/models/RevokeAllSessionsResponseData.ts +1 -1
- package/src/src/models/RevokeSessionRequest.ts +1 -1
- package/src/src/models/SendBatchEmailRequest.ts +1 -1
- package/src/src/models/SendBatchEmailResponse.ts +1 -1
- package/src/src/models/SendBatchEmailResult.ts +1 -1
- package/src/src/models/SendBatchEmailResultItem.ts +1 -1
- package/src/src/models/SendBatchInAppMeta.ts +1 -1
- package/src/src/models/SendBatchInAppRequest.ts +1 -1
- package/src/src/models/SendBatchInAppResponse.ts +1 -1
- package/src/src/models/SendBatchSmsData.ts +1 -1
- package/src/src/models/SendBatchSmsRequest.ts +1 -1
- package/src/src/models/SendBatchSmsResponse.ts +1 -1
- package/src/src/models/SendEmailOtpRegistrationRequest.ts +1 -1
- package/src/src/models/SendEmailRequest.ts +1 -1
- package/src/src/models/SendEmailResponse.ts +1 -1
- package/src/src/models/SendEmailResponseData.ts +1 -1
- package/src/src/models/SendEmailResponseMeta.ts +1 -1
- package/src/src/models/SendEmailVerificationRequest.ts +1 -1
- package/src/src/models/SendInAppMeta.ts +1 -1
- package/src/src/models/SendInAppRequest.ts +1 -1
- package/src/src/models/SendInAppResponse.ts +1 -1
- package/src/src/models/SendPushRequest.ts +1 -1
- package/src/src/models/SendPushRequestActionButtonsInner.ts +1 -1
- package/src/src/models/SendPushResponse.ts +1 -1
- package/src/src/models/SendPushResponseData.ts +1 -1
- package/src/src/models/SendPushToTopicData.ts +1 -1
- package/src/src/models/SendPushToTopicRequest.ts +1 -1
- package/src/src/models/SendPushToTopicResponse.ts +1 -1
- package/src/src/models/SendSlackMessageRequest.ts +1 -1
- package/src/src/models/SendSlackMessageResponse.ts +1 -1
- package/src/src/models/SendSlackMessageResult.ts +1 -1
- package/src/src/models/SendSmsData.ts +1 -1
- package/src/src/models/SendSmsRequest.ts +1 -1
- package/src/src/models/SendSmsResponse.ts +1 -1
- package/src/src/models/SendTemplateTestEmailRequest.ts +74 -0
- package/src/src/models/SendTestSmsData.ts +1 -1
- package/src/src/models/SendTestSmsRequest.ts +1 -1
- package/src/src/models/SendTestSmsResponse.ts +1 -1
- package/src/src/models/SendWebhookTestEventRequest.ts +1 -1
- package/src/src/models/SessionListResponse.ts +1 -1
- package/src/src/models/SessionListResponseData.ts +1 -1
- package/src/src/models/SessionListResponseDataSessionInfo.ts +1 -1
- package/src/src/models/SetDomainInboundRequest.ts +1 -1
- package/src/src/models/SetEndUserClaimsRequest.ts +65 -0
- package/src/src/models/SetPreferencesRequest.ts +1 -1
- package/src/src/models/SetPreferencesRequestPreferencesInner.ts +1 -1
- package/src/src/models/SignInAnonymouslyRequest.ts +17 -1
- package/src/src/models/SignInWithGameCenterRequest.ts +111 -0
- package/src/src/models/SlackMessage.ts +1 -1
- package/src/src/models/SlackMessageListResponse.ts +1 -1
- package/src/src/models/SlackMessageListResponseMeta.ts +1 -1
- package/src/src/models/SlackMessageResponse.ts +1 -1
- package/src/src/models/SlackMessageStatus.ts +1 -1
- package/src/src/models/SlackMessageSummary.ts +1 -1
- package/src/src/models/SmsBatchResultMessage.ts +1 -1
- package/src/src/models/SmsBatchResultSummary.ts +1 -1
- package/src/src/models/SmsConfig.ts +1 -1
- package/src/src/models/SmsConfigDeleteResponse.ts +1 -1
- package/src/src/models/SmsConfigDeleteResponseData.ts +1 -1
- package/src/src/models/SmsConfigResponse.ts +1 -1
- package/src/src/models/SmsDetailResponse.ts +1 -1
- package/src/src/models/SmsListResponse.ts +1 -1
- package/src/src/models/SmsListResponseMeta.ts +1 -1
- package/src/src/models/SmsMessage.ts +1 -1
- package/src/src/models/SmsMessageDetail.ts +1 -1
- package/src/src/models/SubscribePushTopicRequest.ts +1 -1
- package/src/src/models/Subscriber.ts +1 -1
- package/src/src/models/SubscriberListResponse.ts +1 -1
- package/src/src/models/SubscriberPreference.ts +1 -1
- package/src/src/models/SubscriberResponse.ts +1 -1
- package/src/src/models/SuccessResult.ts +1 -1
- package/src/src/models/SwitchOrganizationRequest.ts +1 -1
- package/src/src/models/SwitchOrganizationResponse.ts +1 -1
- package/src/src/models/SwitchOrganizationResponseData.ts +1 -1
- package/src/src/models/SwitchOrganizationResponseDataTokens.ts +1 -1
- package/src/src/models/SwitchOrganizationResponseDataUser.ts +1 -1
- package/src/src/models/Template.ts +1 -1
- package/src/src/models/TemplateListResponse.ts +1 -1
- package/src/src/models/TemplateRenderResponse.ts +1 -1
- package/src/src/models/TemplateRenderedContent.ts +1 -1
- package/src/src/models/TemplateResponse.ts +1 -1
- package/src/src/models/TestWebhookTransformRequest.ts +1 -1
- package/src/src/models/Topic.ts +1 -1
- package/src/src/models/TopicDeleteResponse.ts +1 -1
- package/src/src/models/TopicDeleteResponseData.ts +1 -1
- package/src/src/models/TopicListResponse.ts +1 -1
- package/src/src/models/TopicResponse.ts +1 -1
- package/src/src/models/TopicStatsData.ts +1 -1
- package/src/src/models/TopicStatsDataTopicsBySubscriberCountInner.ts +1 -1
- package/src/src/models/TopicStatsResponse.ts +1 -1
- package/src/src/models/TopicSubscriber.ts +1 -1
- package/src/src/models/TopicSubscriberListResponse.ts +1 -1
- package/src/src/models/TopicSubscribersAddResponse.ts +1 -1
- package/src/src/models/TopicSubscribersAddResult.ts +1 -1
- package/src/src/models/TopicSubscribersRemoveResponse.ts +1 -1
- package/src/src/models/TopicSubscribersRemoveResult.ts +1 -1
- package/src/src/models/UnreadCountData.ts +1 -1
- package/src/src/models/UnreadCountResponse.ts +1 -1
- package/src/src/models/Unsubscribe.ts +1 -1
- package/src/src/models/UnsubscribeListResponse.ts +1 -1
- package/src/src/models/UnsubscribeRequest.ts +1 -1
- package/src/src/models/UnsubscribeResponse.ts +1 -1
- package/src/src/models/UpdateCategoryRequest.ts +1 -1
- package/src/src/models/UpdateEndUserByApplicationRequest.ts +97 -0
- package/src/src/models/UpdateEndUserRequest.ts +1 -1
- package/src/src/models/UpdateOrganizationMemberRoleRequest.ts +1 -1
- package/src/src/models/UpdateOrganizationRequest.ts +1 -1
- package/src/src/models/UpdateSubscriberPreferencesRequest.ts +1 -1
- package/src/src/models/UpdateSubscriberPreferencesRequestPreferencesInner.ts +1 -1
- package/src/src/models/UpdateSubscriberRequest.ts +1 -1
- package/src/src/models/UpdateTemplateRequest.ts +1 -1
- package/src/src/models/UpdateTopicRequest.ts +1 -1
- package/src/src/models/UpdateWaaSApplicationRequest.ts +1 -1
- package/src/src/models/UpdateWaaSEndpointRequest.ts +1 -1
- package/src/src/models/UpdateWaaSEventTypeRequest.ts +1 -1
- package/src/src/models/UpdateWebhookRequest.ts +1 -1
- package/src/src/models/UpsertAuthEmailTemplateRequest.ts +1 -1
- package/src/src/models/UpsertSmsConfigRequest.ts +1 -1
- package/src/src/models/UserDevicesDeleteResponse.ts +1 -1
- package/src/src/models/UserDevicesDeleteResponseData.ts +1 -1
- package/src/src/models/V1MuseSubjectsSuggestPostRequest.ts +1 -1
- package/src/src/models/ValidateResetTokenRequest.ts +1 -1
- package/src/src/models/ValidateResetTokenResponse.ts +1 -1
- package/src/src/models/ValidateResetTokenResponseData.ts +1 -1
- package/src/src/models/VerificationStatusResponse.ts +1 -1
- package/src/src/models/VerificationStatusResponseData.ts +1 -1
- package/src/src/models/VerifyDomainResponse.ts +1 -1
- package/src/src/models/VerifyDomainResponseData.ts +1 -1
- package/src/src/models/VerifyEmailOtpLoginRequest.ts +1 -1
- package/src/src/models/VerifyEmailOtpRegistrationRequest.ts +1 -1
- package/src/src/models/VerifySmsConfigData.ts +1 -1
- package/src/src/models/VerifySmsConfigResponse.ts +1 -1
- package/src/src/models/WaaSApplication.ts +1 -1
- package/src/src/models/WaaSBatchPublishRequest.ts +1 -1
- package/src/src/models/WaaSBatchPublishResponse.ts +1 -1
- package/src/src/models/WaaSDelivery.ts +1 -1
- package/src/src/models/WaaSEndpoint.ts +1 -1
- package/src/src/models/WaaSEventType.ts +1 -1
- package/src/src/models/WaaSPortalTokenRequest.ts +1 -1
- package/src/src/models/WaaSPortalTokenRequestTheme.ts +1 -1
- package/src/src/models/WaaSPortalTokenResponse.ts +1 -1
- package/src/src/models/WaaSPublishEventRequest.ts +1 -1
- package/src/src/models/WaaSPublishEventResponse.ts +1 -1
- package/src/src/models/WaaSUsageResponse.ts +1 -1
- package/src/src/models/WebAuthnChallengeOptions.ts +1 -1
- package/src/src/models/WebAuthnCredential.ts +1 -1
- package/src/src/models/WebAuthnCredentialListResponse.ts +1 -1
- package/src/src/models/WebAuthnCredentialListResponseData.ts +1 -1
- package/src/src/models/WebAuthnCredentialResponse.ts +1 -1
- package/src/src/models/WebAuthnStartAuthRequest.ts +1 -1
- package/src/src/models/WebAuthnStartAuthResponse.ts +1 -1
- package/src/src/models/WebAuthnStartRegistrationRequest.ts +1 -1
- package/src/src/models/WebAuthnStartRegistrationResponse.ts +1 -1
- package/src/src/models/WebAuthnStatusResponse.ts +1 -1
- package/src/src/models/WebAuthnStatusResponseData.ts +1 -1
- package/src/src/models/WebAuthnVerifyAuthRequest.ts +1 -1
- package/src/src/models/WebAuthnVerifyRegistrationRequest.ts +1 -1
- package/src/src/models/WebAuthnVerifyRegistrationResponse.ts +1 -1
- package/src/src/models/WebAuthnVerifyRegistrationResponseData.ts +1 -1
- package/src/src/models/Webhook.ts +1 -1
- package/src/src/models/WebhookAccountMetricsResponse.ts +1 -1
- package/src/src/models/WebhookBulkRetryResponse.ts +1 -1
- package/src/src/models/WebhookCircuitState.ts +1 -1
- package/src/src/models/WebhookCircuitStateResponse.ts +1 -1
- package/src/src/models/WebhookCreateResponse.ts +1 -1
- package/src/src/models/WebhookCreateResponseData.ts +1 -1
- package/src/src/models/WebhookDeleteResponse.ts +1 -1
- package/src/src/models/WebhookDeleteResponseData.ts +1 -1
- package/src/src/models/WebhookDelivery.ts +1 -1
- package/src/src/models/WebhookDeliveryDetail.ts +1 -1
- package/src/src/models/WebhookDeliveryListResponse.ts +1 -1
- package/src/src/models/WebhookDeliveryResponse.ts +1 -1
- package/src/src/models/WebhookDeliveryRetryResponse.ts +1 -1
- package/src/src/models/WebhookDeliveryRetryResponseData.ts +1 -1
- package/src/src/models/WebhookEventTypesResponse.ts +1 -1
- package/src/src/models/WebhookEventTypesResponseData.ts +1 -1
- package/src/src/models/WebhookIpsResponse.ts +1 -1
- package/src/src/models/WebhookIpsResponseData.ts +1 -1
- package/src/src/models/WebhookJobResponse.ts +1 -1
- package/src/src/models/WebhookListResponse.ts +1 -1
- package/src/src/models/WebhookMetricsResponse.ts +1 -1
- package/src/src/models/WebhookRegion.ts +1 -1
- package/src/src/models/WebhookRegionsResponse.ts +1 -1
- package/src/src/models/WebhookRegionsResponseData.ts +1 -1
- package/src/src/models/WebhookReplayResponse.ts +1 -1
- package/src/src/models/WebhookResponse.ts +1 -1
- package/src/src/models/WebhookSecretRotateResponse.ts +1 -1
- package/src/src/models/WebhookSecretRotateResponseData.ts +1 -1
- package/src/src/models/WebhookTestEventResponse.ts +1 -1
- package/src/src/models/WebhookTestEventResponseData.ts +1 -1
- package/src/src/models/WebhookTransformTestResponse.ts +1 -1
- package/src/src/models/WebhookUsageResponse.ts +1 -1
- package/src/src/models/WebhookVersion.ts +1 -1
- package/src/src/models/WebhookVersionsResponse.ts +1 -1
- package/src/src/models/WebhookVersionsResponseData.ts +1 -1
- package/src/src/models/WithdrawSubscriberConsentRequest.ts +1 -1
- package/src/src/models/WorkflowExecution.ts +1 -1
- package/src/src/models/WorkflowExecutionStatus.ts +1 -1
- package/src/src/models/WorkflowStepExecution.ts +1 -1
- package/src/src/models/WorkflowStepExecutionStatus.ts +1 -1
- package/src/src/models/index.ts +6 -0
- package/src/src/runtime.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyphr-dev/node-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Official Zyphr SDK for Node.js, React, and React Native",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -49,10 +49,15 @@
|
|
|
49
49
|
"openapi"
|
|
50
50
|
],
|
|
51
51
|
"license": "MIT",
|
|
52
|
-
"homepage": "https://
|
|
52
|
+
"homepage": "https://zyphr.dev/docs/sdks/node",
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/ArcRaz/zyphr.git",
|
|
56
|
+
"directory": "packages/sdk/node"
|
|
57
|
+
},
|
|
53
58
|
"bugs": {
|
|
54
59
|
"email": "support@zyphr.dev",
|
|
55
|
-
"url": "https://
|
|
60
|
+
"url": "https://zyphr.dev/docs"
|
|
56
61
|
},
|
|
57
62
|
"engines": {
|
|
58
63
|
"node": ">=18.0.0"
|
|
@@ -14,6 +14,7 @@ src/apis/AuthPasswordResetApi.ts
|
|
|
14
14
|
src/apis/AuthPhoneApi.ts
|
|
15
15
|
src/apis/AuthRegistrationApi.ts
|
|
16
16
|
src/apis/AuthSessionsApi.ts
|
|
17
|
+
src/apis/AuthUserDirectoryApi.ts
|
|
17
18
|
src/apis/AuthUserProfileApi.ts
|
|
18
19
|
src/apis/AuthWebAuthnApi.ts
|
|
19
20
|
src/apis/DevicesApi.ts
|
|
@@ -166,6 +167,7 @@ src/models/InboundEmailResponse.ts
|
|
|
166
167
|
src/models/InboxListMeta.ts
|
|
167
168
|
src/models/InboxListResponse.ts
|
|
168
169
|
src/models/InboxNotificationResponse.ts
|
|
170
|
+
src/models/InviteEndUserRequest.ts
|
|
169
171
|
src/models/ListWaaSApplications200Response.ts
|
|
170
172
|
src/models/ListWaaSEndpointDeliveries200Response.ts
|
|
171
173
|
src/models/ListWaaSEndpoints200Response.ts
|
|
@@ -210,6 +212,7 @@ src/models/OAuthConnectionsResponse.ts
|
|
|
210
212
|
src/models/OAuthConnectionsResponseData.ts
|
|
211
213
|
src/models/OAuthProvider.ts
|
|
212
214
|
src/models/OAuthProviderInfo.ts
|
|
215
|
+
src/models/OAuthProviderName.ts
|
|
213
216
|
src/models/OAuthProvidersResponse.ts
|
|
214
217
|
src/models/OAuthProvidersResponseData.ts
|
|
215
218
|
src/models/OAuthTokensRefreshResponse.ts
|
|
@@ -304,6 +307,7 @@ src/models/SendSlackMessageResult.ts
|
|
|
304
307
|
src/models/SendSmsData.ts
|
|
305
308
|
src/models/SendSmsRequest.ts
|
|
306
309
|
src/models/SendSmsResponse.ts
|
|
310
|
+
src/models/SendTemplateTestEmailRequest.ts
|
|
307
311
|
src/models/SendTestSmsData.ts
|
|
308
312
|
src/models/SendTestSmsRequest.ts
|
|
309
313
|
src/models/SendTestSmsResponse.ts
|
|
@@ -312,9 +316,11 @@ src/models/SessionListResponse.ts
|
|
|
312
316
|
src/models/SessionListResponseData.ts
|
|
313
317
|
src/models/SessionListResponseDataSessionInfo.ts
|
|
314
318
|
src/models/SetDomainInboundRequest.ts
|
|
319
|
+
src/models/SetEndUserClaimsRequest.ts
|
|
315
320
|
src/models/SetPreferencesRequest.ts
|
|
316
321
|
src/models/SetPreferencesRequestPreferencesInner.ts
|
|
317
322
|
src/models/SignInAnonymouslyRequest.ts
|
|
323
|
+
src/models/SignInWithGameCenterRequest.ts
|
|
318
324
|
src/models/SlackMessage.ts
|
|
319
325
|
src/models/SlackMessageListResponse.ts
|
|
320
326
|
src/models/SlackMessageListResponseMeta.ts
|
|
@@ -370,6 +376,7 @@ src/models/UnsubscribeListResponse.ts
|
|
|
370
376
|
src/models/UnsubscribeRequest.ts
|
|
371
377
|
src/models/UnsubscribeResponse.ts
|
|
372
378
|
src/models/UpdateCategoryRequest.ts
|
|
379
|
+
src/models/UpdateEndUserByApplicationRequest.ts
|
|
373
380
|
src/models/UpdateEndUserRequest.ts
|
|
374
381
|
src/models/UpdateOrganizationMemberRoleRequest.ts
|
|
375
382
|
src/models/UpdateOrganizationRequest.ts
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zyphr client-side auth (sc-7326, Option A).
|
|
3
|
+
*
|
|
4
|
+
* `ZyphrClient` is a browser / React Native-safe entry point for Auth-as-a-Service.
|
|
5
|
+
* Unlike the server `Zyphr` client (which requires a secret API key and, for auth,
|
|
6
|
+
* an application SECRET key), `ZyphrClient` is constructed with ONLY the publishable
|
|
7
|
+
* application key (`za_pub_*`) — the key that is safe to ship in a client bundle —
|
|
8
|
+
* plus, once the user is authenticated, their end-user access token.
|
|
9
|
+
*
|
|
10
|
+
* It deliberately exposes ONLY the end-user-scoped auth surface (login, registration,
|
|
11
|
+
* sessions, magic links, OAuth, phone, email-OTP, profile, MFA, WebAuthn, password
|
|
12
|
+
* reset, email verification) and device registration for push. It does NOT expose
|
|
13
|
+
* server-only APIs (emails, templates, webhooks, the secret-key user directory, etc.),
|
|
14
|
+
* because those require a secret this client must never hold.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { ZyphrClient } from '@zyphr-dev/node-sdk';
|
|
19
|
+
*
|
|
20
|
+
* const zyphr = new ZyphrClient({ applicationKey: 'za_pub_xxx' });
|
|
21
|
+
*
|
|
22
|
+
* const login = await zyphr.auth.login.loginEndUser({ ... });
|
|
23
|
+
* zyphr.setAccessToken(login.data.tokens.access_token);
|
|
24
|
+
*
|
|
25
|
+
* const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { Configuration } from './src/runtime.js';
|
|
30
|
+
import type { Middleware, ResponseContext } from './src/runtime.js';
|
|
31
|
+
import {
|
|
32
|
+
AuthEmailOTPApi,
|
|
33
|
+
AuthEmailVerificationApi,
|
|
34
|
+
AuthLoginApi,
|
|
35
|
+
AuthMFAApi,
|
|
36
|
+
AuthMagicLinksApi,
|
|
37
|
+
AuthOAuthApi,
|
|
38
|
+
AuthOrganizationsApi,
|
|
39
|
+
AuthPasswordResetApi,
|
|
40
|
+
AuthPhoneApi,
|
|
41
|
+
AuthRegistrationApi,
|
|
42
|
+
AuthSessionsApi,
|
|
43
|
+
AuthUserProfileApi,
|
|
44
|
+
AuthWebAuthnApi,
|
|
45
|
+
DevicesApi,
|
|
46
|
+
} from './src/apis/index.js';
|
|
47
|
+
import { parseErrorResponse } from './errors.js';
|
|
48
|
+
|
|
49
|
+
export interface ZyphrClientOptions {
|
|
50
|
+
/** Publishable application key (za_pub_*) — safe to embed in a client bundle. */
|
|
51
|
+
applicationKey: string;
|
|
52
|
+
/** Override the base API URL (defaults to https://api.zyphr.dev/v1). */
|
|
53
|
+
baseUrl?: string;
|
|
54
|
+
/** Optional end-user access token, if you already have a session on construction. */
|
|
55
|
+
accessToken?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const errorMiddleware: Middleware = {
|
|
59
|
+
async post(context: ResponseContext): Promise<Response | void> {
|
|
60
|
+
if (context.response.status >= 200 && context.response.status < 300) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
throw await parseErrorResponse(context.response);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Thrown when a secret-shaped credential is passed to the client-safe SDK. This
|
|
69
|
+
* is a guardrail against accidentally shipping a secret in a client bundle.
|
|
70
|
+
*/
|
|
71
|
+
export class ZyphrClientCredentialError extends Error {
|
|
72
|
+
constructor(message: string) {
|
|
73
|
+
super(message);
|
|
74
|
+
this.name = 'ZyphrClientCredentialError';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Prefixes that must NEVER reach a client bundle. */
|
|
79
|
+
const SECRET_KEY_PREFIXES = ['za_sec_', 'zy_live_', 'zy_test_'];
|
|
80
|
+
|
|
81
|
+
export class ZyphrClient {
|
|
82
|
+
readonly auth: {
|
|
83
|
+
readonly login: AuthLoginApi;
|
|
84
|
+
readonly registration: AuthRegistrationApi;
|
|
85
|
+
readonly sessions: AuthSessionsApi;
|
|
86
|
+
readonly emailVerification: AuthEmailVerificationApi;
|
|
87
|
+
readonly passwordReset: AuthPasswordResetApi;
|
|
88
|
+
readonly mfa: AuthMFAApi;
|
|
89
|
+
readonly magicLinks: AuthMagicLinksApi;
|
|
90
|
+
readonly oauth: AuthOAuthApi;
|
|
91
|
+
readonly organizations: AuthOrganizationsApi;
|
|
92
|
+
readonly phone: AuthPhoneApi;
|
|
93
|
+
readonly emailOtp: AuthEmailOTPApi;
|
|
94
|
+
readonly profile: AuthUserProfileApi;
|
|
95
|
+
readonly webauthn: AuthWebAuthnApi;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** Device registration for push (takes an OS-acquired token). */
|
|
99
|
+
readonly devices: DevicesApi;
|
|
100
|
+
|
|
101
|
+
private readonly applicationKey: string;
|
|
102
|
+
private accessToken?: string;
|
|
103
|
+
|
|
104
|
+
constructor(options: ZyphrClientOptions) {
|
|
105
|
+
if (!options.applicationKey) {
|
|
106
|
+
throw new ZyphrClientCredentialError('applicationKey (za_pub_*) is required');
|
|
107
|
+
}
|
|
108
|
+
// Guardrail: reject secret-shaped credentials so a secret can't be shipped
|
|
109
|
+
// in a client bundle by mistake.
|
|
110
|
+
if (SECRET_KEY_PREFIXES.some((p) => options.applicationKey.startsWith(p))) {
|
|
111
|
+
throw new ZyphrClientCredentialError(
|
|
112
|
+
'ZyphrClient must be constructed with a publishable application key (za_pub_*), ' +
|
|
113
|
+
'never a secret key. Secret keys must stay server-side.'
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (!options.applicationKey.startsWith('za_pub_')) {
|
|
117
|
+
throw new ZyphrClientCredentialError(
|
|
118
|
+
'applicationKey must be a publishable application key (za_pub_*).'
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
this.applicationKey = options.applicationKey;
|
|
123
|
+
this.accessToken = options.accessToken;
|
|
124
|
+
|
|
125
|
+
const config = new Configuration({
|
|
126
|
+
basePath: options.baseUrl,
|
|
127
|
+
// The only credential this client sends automatically is the publishable
|
|
128
|
+
// application key. End-user Bearer tokens are attached per-request via
|
|
129
|
+
// authedRequest() so token rotation doesn't require rebuilding the client.
|
|
130
|
+
apiKey: (name: string) => (name === 'X-Application-Key' ? this.applicationKey : ''),
|
|
131
|
+
middleware: [errorMiddleware],
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
this.auth = {
|
|
135
|
+
login: new AuthLoginApi(config),
|
|
136
|
+
registration: new AuthRegistrationApi(config),
|
|
137
|
+
sessions: new AuthSessionsApi(config),
|
|
138
|
+
emailVerification: new AuthEmailVerificationApi(config),
|
|
139
|
+
passwordReset: new AuthPasswordResetApi(config),
|
|
140
|
+
mfa: new AuthMFAApi(config),
|
|
141
|
+
magicLinks: new AuthMagicLinksApi(config),
|
|
142
|
+
oauth: new AuthOAuthApi(config),
|
|
143
|
+
organizations: new AuthOrganizationsApi(config),
|
|
144
|
+
phone: new AuthPhoneApi(config),
|
|
145
|
+
emailOtp: new AuthEmailOTPApi(config),
|
|
146
|
+
profile: new AuthUserProfileApi(config),
|
|
147
|
+
webauthn: new AuthWebAuthnApi(config),
|
|
148
|
+
};
|
|
149
|
+
this.devices = new DevicesApi(config);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Store the end-user access token for subsequent authedRequest() calls. */
|
|
153
|
+
setAccessToken(accessToken: string | undefined): void {
|
|
154
|
+
this.accessToken = accessToken;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** True when an end-user access token is currently set. */
|
|
158
|
+
get isAuthenticated(): boolean {
|
|
159
|
+
return Boolean(this.accessToken);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Build request overrides that authenticate as the current end user: the
|
|
164
|
+
* stored Bearer token plus the publishable application key required by
|
|
165
|
+
* user-scoped endpoints. Pass an explicit token to override the stored one.
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* const me = await zyphr.auth.profile.getEndUser(zyphr.authedRequest());
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
authedRequest(accessToken?: string): RequestInit {
|
|
173
|
+
const token = accessToken ?? this.accessToken;
|
|
174
|
+
const headers: Record<string, string> = {
|
|
175
|
+
'X-Application-Key': this.applicationKey,
|
|
176
|
+
};
|
|
177
|
+
if (token) {
|
|
178
|
+
headers.Authorization = `Bearer ${token}`;
|
|
179
|
+
}
|
|
180
|
+
return { headers };
|
|
181
|
+
}
|
|
182
|
+
}
|
package/src/errors.ts
CHANGED
|
@@ -43,8 +43,8 @@ export class ZyphrError extends Error {
|
|
|
43
43
|
* Thrown when the API returns a 400/422 validation error.
|
|
44
44
|
*/
|
|
45
45
|
export class ZyphrValidationError extends ZyphrError {
|
|
46
|
-
constructor(message: string, details?: Record<string, unknown
|
|
47
|
-
super({ message, status: 422, code
|
|
46
|
+
constructor(message: string, details?: Record<string, unknown>, code = 'validation_error') {
|
|
47
|
+
super({ message, status: 422, code, details });
|
|
48
48
|
this.name = 'ZyphrValidationError';
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -53,8 +53,8 @@ export class ZyphrValidationError extends ZyphrError {
|
|
|
53
53
|
* Thrown when the API returns a 401/403 authentication error.
|
|
54
54
|
*/
|
|
55
55
|
export class ZyphrAuthenticationError extends ZyphrError {
|
|
56
|
-
constructor(message: string) {
|
|
57
|
-
super({ message, status: 401, code
|
|
56
|
+
constructor(message: string, code = 'authentication_error') {
|
|
57
|
+
super({ message, status: 401, code });
|
|
58
58
|
this.name = 'ZyphrAuthenticationError';
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -65,8 +65,8 @@ export class ZyphrAuthenticationError extends ZyphrError {
|
|
|
65
65
|
export class ZyphrRateLimitError extends ZyphrError {
|
|
66
66
|
readonly retryAfter?: number;
|
|
67
67
|
|
|
68
|
-
constructor(message: string, retryAfter?: number) {
|
|
69
|
-
super({ message, status: 429, code
|
|
68
|
+
constructor(message: string, retryAfter?: number, code = 'rate_limit_exceeded') {
|
|
69
|
+
super({ message, status: 429, code });
|
|
70
70
|
this.name = 'ZyphrRateLimitError';
|
|
71
71
|
this.retryAfter = retryAfter;
|
|
72
72
|
}
|
|
@@ -76,8 +76,8 @@ export class ZyphrRateLimitError extends ZyphrError {
|
|
|
76
76
|
* Thrown when the API returns a 404 not found error.
|
|
77
77
|
*/
|
|
78
78
|
export class ZyphrNotFoundError extends ZyphrError {
|
|
79
|
-
constructor(message: string) {
|
|
80
|
-
super({ message, status: 404, code
|
|
79
|
+
constructor(message: string, code = 'not_found') {
|
|
80
|
+
super({ message, status: 404, code });
|
|
81
81
|
this.name = 'ZyphrNotFoundError';
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -93,8 +93,13 @@ export class ZyphrNotFoundError extends ZyphrError {
|
|
|
93
93
|
* @see https://zyphr.dev/resources/api-limits
|
|
94
94
|
*/
|
|
95
95
|
export class ZyphrPayloadTooLargeError extends ZyphrError {
|
|
96
|
-
constructor(
|
|
97
|
-
|
|
96
|
+
constructor(
|
|
97
|
+
message: string,
|
|
98
|
+
details?: Record<string, unknown>,
|
|
99
|
+
requestId?: string,
|
|
100
|
+
code = 'payload_too_large',
|
|
101
|
+
) {
|
|
102
|
+
super({ message, status: 413, code, details, requestId });
|
|
98
103
|
this.name = 'ZyphrPayloadTooLargeError';
|
|
99
104
|
}
|
|
100
105
|
|
|
@@ -145,25 +150,33 @@ export async function parseErrorResponse(response: Response): Promise<ZyphrError
|
|
|
145
150
|
const error = (body.error ?? {}) as Record<string, unknown>;
|
|
146
151
|
const meta = (body.meta ?? {}) as Record<string, unknown>;
|
|
147
152
|
const message = (error.message as string) ?? response.statusText ?? 'Unknown error';
|
|
148
|
-
|
|
153
|
+
// Coerce a missing / null / empty code to `undefined` so the typed-error
|
|
154
|
+
// constructors fall back to their generic default (a bare `null`/'' from a
|
|
155
|
+
// malformed or proxy-mangled response would otherwise be preserved verbatim).
|
|
156
|
+
const code = (error.code as string | undefined) || undefined;
|
|
149
157
|
const requestId = meta.request_id as string | undefined;
|
|
150
158
|
const details = error.details as Record<string, unknown> | undefined;
|
|
151
159
|
|
|
160
|
+
// Preserve the API's machine-readable `error.code` on the typed error so
|
|
161
|
+
// consumers can branch on it (e.g. `account_frozen`, `otp_invalid`,
|
|
162
|
+
// `email_not_found`) instead of matching `message` text. The subclass
|
|
163
|
+
// identity and `status` are unchanged; when the body omits a code we fall
|
|
164
|
+
// back to each subclass's generic default (older API responses).
|
|
152
165
|
switch (response.status) {
|
|
153
166
|
case 400:
|
|
154
167
|
case 422:
|
|
155
|
-
return new ZyphrValidationError(message, details);
|
|
168
|
+
return new ZyphrValidationError(message, details, code);
|
|
156
169
|
case 401:
|
|
157
170
|
case 403:
|
|
158
|
-
return new ZyphrAuthenticationError(message);
|
|
171
|
+
return new ZyphrAuthenticationError(message, code);
|
|
159
172
|
case 404:
|
|
160
|
-
return new ZyphrNotFoundError(message);
|
|
173
|
+
return new ZyphrNotFoundError(message, code);
|
|
161
174
|
case 413:
|
|
162
|
-
return new ZyphrPayloadTooLargeError(message, details, requestId);
|
|
175
|
+
return new ZyphrPayloadTooLargeError(message, details, requestId, code);
|
|
163
176
|
case 429: {
|
|
164
177
|
const retryAfterHeader = response.headers.get('Retry-After');
|
|
165
178
|
const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : undefined;
|
|
166
|
-
return new ZyphrRateLimitError(message, retryAfter);
|
|
179
|
+
return new ZyphrRateLimitError(message, retryAfter, code);
|
|
167
180
|
}
|
|
168
181
|
default:
|
|
169
182
|
return new ZyphrError({ message, status: response.status, code, requestId, details });
|
package/src/index.ts
CHANGED
|
@@ -21,5 +21,8 @@ export * from './src/models/index.js';
|
|
|
21
21
|
// Error classes
|
|
22
22
|
export * from './errors.js';
|
|
23
23
|
|
|
24
|
-
// Client
|
|
24
|
+
// Client (server-side; requires secret keys)
|
|
25
25
|
export * from './client.js';
|
|
26
|
+
|
|
27
|
+
// Client-safe auth (browser / React Native; publishable key only) — sc-7326
|
|
28
|
+
export * from './clientAuth.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
4
|
* Zyphr API
|
|
5
|
-
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
* Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account\'s current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
6
6
|
*
|
|
7
7
|
* The version of the OpenAPI document: 1.0.0
|
|
8
8
|
* Contact: support@zyphr.dev
|