shipmail 0.6.2 → 0.6.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/README.md +11 -0
- package/dist/index.cjs +60 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -6
- package/dist/index.d.ts +77 -6
- package/dist/index.js +60 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -52,6 +52,14 @@ type ApiErrorBody = {
|
|
|
52
52
|
* the interrupted send attempt left behind.
|
|
53
53
|
*/
|
|
54
54
|
readonly message_id?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Present only on a refusal an organization owner can lift in Shipmail. One of
|
|
57
|
+
* `owner_confirmation_required`, `subscription_required`, `trial_capacity` or
|
|
58
|
+
* `purchased_capacity`; later servers may add values.
|
|
59
|
+
*/
|
|
60
|
+
readonly reason?: string | undefined;
|
|
61
|
+
/** Present with `reason`: the Shipmail page where the owner reviews and confirms. */
|
|
62
|
+
readonly action_url?: string | undefined;
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
type EmailRecipient = {
|
|
@@ -59,9 +67,9 @@ type EmailRecipient = {
|
|
|
59
67
|
readonly name?: string | null | undefined;
|
|
60
68
|
};
|
|
61
69
|
type EmailRecipientInput = EmailRecipient | string;
|
|
62
|
-
declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
70
|
+
declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delayed", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
63
71
|
type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
64
|
-
declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
72
|
+
declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delayed", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
65
73
|
type WebhookDeliveryEventType = (typeof WEBHOOK_DELIVERY_EVENT_TYPES)[number];
|
|
66
74
|
type StatusResponse = {
|
|
67
75
|
readonly status: string;
|
|
@@ -1350,7 +1358,7 @@ type InboxMessageAction = {
|
|
|
1350
1358
|
};
|
|
1351
1359
|
type MailboxRuleMatchMode = "all" | "any";
|
|
1352
1360
|
type MailboxRuleCondition = {
|
|
1353
|
-
readonly type: "from_is" | "from_contains" | "recipient_is" | "plus_tag_is" | "subject_contains";
|
|
1361
|
+
readonly type: "from_is" | "from_contains" | "recipient_is" | "recipient_contains" | "plus_tag_is" | "subject_contains";
|
|
1354
1362
|
readonly value: string;
|
|
1355
1363
|
} | {
|
|
1356
1364
|
readonly type: "has_attachment" | "list_unsubscribe_exists";
|
|
@@ -1406,6 +1414,7 @@ type MailboxForwarding = {
|
|
|
1406
1414
|
readonly mailbox_id: string;
|
|
1407
1415
|
readonly destination: string;
|
|
1408
1416
|
readonly sender: string | null;
|
|
1417
|
+
readonly recipient: string | null;
|
|
1409
1418
|
readonly status: "pending" | "active";
|
|
1410
1419
|
readonly verification_sent_at: string | null;
|
|
1411
1420
|
readonly verified_at: string | null;
|
|
@@ -1420,6 +1429,7 @@ type MailboxForwardingList = {
|
|
|
1420
1429
|
type CreateMailboxForwardingParams = {
|
|
1421
1430
|
readonly destination: string;
|
|
1422
1431
|
readonly sender?: string | null | undefined;
|
|
1432
|
+
readonly recipient?: string | null | undefined;
|
|
1423
1433
|
};
|
|
1424
1434
|
type CreateMailboxBaseParams = {
|
|
1425
1435
|
readonly domain_id: string;
|
|
@@ -2051,6 +2061,38 @@ declare class Newsletters extends ApiResource {
|
|
|
2051
2061
|
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
2052
2062
|
}
|
|
2053
2063
|
|
|
2064
|
+
type OrganizationAccess = {
|
|
2065
|
+
readonly object: "organization_access";
|
|
2066
|
+
readonly organization: {
|
|
2067
|
+
readonly id: string;
|
|
2068
|
+
readonly name: string;
|
|
2069
|
+
};
|
|
2070
|
+
readonly plan: "free" | "solo" | "pro" | "team" | "scale";
|
|
2071
|
+
/** Mailboxes can be created now, by the same rule mailbox creation applies. */
|
|
2072
|
+
readonly has_access: boolean;
|
|
2073
|
+
readonly trial: {
|
|
2074
|
+
readonly active: boolean;
|
|
2075
|
+
readonly ends_at: string | null;
|
|
2076
|
+
/** No subscription yet and the owner never had a trial. Checkout still confirms it. */
|
|
2077
|
+
readonly eligible: boolean;
|
|
2078
|
+
};
|
|
2079
|
+
readonly mailboxes: {
|
|
2080
|
+
readonly limit: number;
|
|
2081
|
+
readonly used: number;
|
|
2082
|
+
};
|
|
2083
|
+
/** Newsletter sending is available. It is not during a trial. */
|
|
2084
|
+
readonly newsletters_allowed: boolean;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
declare class Organization extends ApiResource {
|
|
2088
|
+
/**
|
|
2089
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
2090
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
2091
|
+
* payment.
|
|
2092
|
+
*/
|
|
2093
|
+
access(options?: MethodOptions): Promise<OrganizationAccess>;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2054
2096
|
type ReplyScanStatus = "completed";
|
|
2055
2097
|
type ReplyScan = {
|
|
2056
2098
|
readonly object: "reply_scan";
|
|
@@ -2181,6 +2223,8 @@ type Webhook = {
|
|
|
2181
2223
|
readonly description: string | null;
|
|
2182
2224
|
readonly mailbox_ids: readonly string[] | null;
|
|
2183
2225
|
readonly domain_ids: readonly string[] | null;
|
|
2226
|
+
readonly has_authorization: boolean;
|
|
2227
|
+
readonly has_standard_webhooks_secret: boolean;
|
|
2184
2228
|
readonly created_at: string;
|
|
2185
2229
|
readonly updated_at: string;
|
|
2186
2230
|
};
|
|
@@ -2193,6 +2237,10 @@ type CreateWebhookParams = {
|
|
|
2193
2237
|
readonly description?: string | undefined;
|
|
2194
2238
|
readonly mailbox_ids?: readonly string[] | null | undefined;
|
|
2195
2239
|
readonly domain_ids?: readonly string[] | null | undefined;
|
|
2240
|
+
/** Sent verbatim as the `Authorization` header of every delivery. Write-only. */
|
|
2241
|
+
readonly authorization?: string | null | undefined;
|
|
2242
|
+
/** A `whsec_` secret from the receiving service. Deliveries then carry Standard Webhooks signatures. Write-only. */
|
|
2243
|
+
readonly standard_webhooks_secret?: string | null | undefined;
|
|
2196
2244
|
};
|
|
2197
2245
|
type UpdateWebhookParams = {
|
|
2198
2246
|
readonly url?: string | undefined;
|
|
@@ -2201,6 +2249,10 @@ type UpdateWebhookParams = {
|
|
|
2201
2249
|
readonly active?: boolean | undefined;
|
|
2202
2250
|
readonly mailbox_ids?: readonly string[] | null | undefined;
|
|
2203
2251
|
readonly domain_ids?: readonly string[] | null | undefined;
|
|
2252
|
+
/** A string replaces the delivery `Authorization` header, `null` removes it. */
|
|
2253
|
+
readonly authorization?: string | null | undefined;
|
|
2254
|
+
/** A string replaces the Standard Webhooks signing secret, `null` removes it. */
|
|
2255
|
+
readonly standard_webhooks_secret?: string | null | undefined;
|
|
2204
2256
|
};
|
|
2205
2257
|
type ListWebhooksParams = PaginationParams;
|
|
2206
2258
|
type RotateSecretResponse = {
|
|
@@ -2285,6 +2337,7 @@ declare class ShipmailClient {
|
|
|
2285
2337
|
readonly members: Members;
|
|
2286
2338
|
readonly messages: Messages;
|
|
2287
2339
|
readonly newsletters: Newsletters;
|
|
2340
|
+
readonly organization: Organization;
|
|
2288
2341
|
readonly replyScans: ReplyScans;
|
|
2289
2342
|
readonly scheduledMessages: ScheduledMessages;
|
|
2290
2343
|
readonly suppressions: Suppressions;
|
|
@@ -2302,23 +2355,39 @@ declare class ShipmailClient {
|
|
|
2302
2355
|
private buildUrl;
|
|
2303
2356
|
}
|
|
2304
2357
|
|
|
2358
|
+
/** The `reason` values this SDK knows. A newer server may send others; they pass through. */
|
|
2359
|
+
declare const ERROR_RECOVERY_REASONS: readonly ["owner_confirmation_required", "subscription_required", "trial_capacity", "purchased_capacity"];
|
|
2360
|
+
/** What an organization owner can do in Shipmail to lift a refusal. */
|
|
2361
|
+
type ErrorRecovery = {
|
|
2362
|
+
readonly reason?: string | undefined;
|
|
2363
|
+
readonly actionUrl?: string | undefined;
|
|
2364
|
+
};
|
|
2305
2365
|
declare class ShipmailError extends Error {
|
|
2306
2366
|
readonly status: number | undefined;
|
|
2307
2367
|
readonly type: ErrorType | undefined;
|
|
2308
2368
|
readonly requestId: string | undefined;
|
|
2309
2369
|
readonly retryable: boolean;
|
|
2370
|
+
/**
|
|
2371
|
+
* Why an organization owner must act, when they can lift this refusal in Shipmail. The error's
|
|
2372
|
+
* type and status stay what they were. See ERROR_RECOVERY_REASONS.
|
|
2373
|
+
*/
|
|
2374
|
+
readonly reason: string | undefined;
|
|
2375
|
+
/** The Shipmail page to send the owner to. Retry with a new idempotency key afterwards. */
|
|
2376
|
+
readonly actionUrl: string | undefined;
|
|
2310
2377
|
constructor(message: string, options?: {
|
|
2311
2378
|
readonly status?: number | undefined;
|
|
2312
2379
|
readonly type?: ErrorType | undefined;
|
|
2313
2380
|
readonly requestId?: string | undefined;
|
|
2314
2381
|
readonly retryable?: boolean | undefined;
|
|
2382
|
+
readonly reason?: string | undefined;
|
|
2383
|
+
readonly actionUrl?: string | undefined;
|
|
2315
2384
|
});
|
|
2316
2385
|
}
|
|
2317
2386
|
declare class AuthenticationError extends ShipmailError {
|
|
2318
2387
|
constructor(message: string, requestId?: string);
|
|
2319
2388
|
}
|
|
2320
2389
|
declare class AuthorizationError extends ShipmailError {
|
|
2321
|
-
constructor(message: string, requestId?: string);
|
|
2390
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2322
2391
|
}
|
|
2323
2392
|
declare class ValidationError extends ShipmailError {
|
|
2324
2393
|
readonly details: readonly {
|
|
@@ -2333,10 +2402,12 @@ declare class ValidationError extends ShipmailError {
|
|
|
2333
2402
|
readonly message: string;
|
|
2334
2403
|
readonly code?: string | undefined;
|
|
2335
2404
|
}[] | undefined;
|
|
2405
|
+
readonly reason?: string | undefined;
|
|
2406
|
+
readonly actionUrl?: string | undefined;
|
|
2336
2407
|
});
|
|
2337
2408
|
}
|
|
2338
2409
|
declare class QuotaExceededError extends ShipmailError {
|
|
2339
|
-
constructor(message: string, requestId?: string);
|
|
2410
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2340
2411
|
}
|
|
2341
2412
|
declare class NotFoundError extends ShipmailError {
|
|
2342
2413
|
constructor(message: string, requestId?: string);
|
|
@@ -2386,4 +2457,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2386
2457
|
readonly toleranceInSeconds?: number | undefined;
|
|
2387
2458
|
}): Promise<WebhookEvent>;
|
|
2388
2459
|
|
|
2389
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
|
2460
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxForwardingParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, ERROR_RECOVERY_REASONS, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorRecovery, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxForwarding, type MailboxForwardingList, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OrganizationAccess, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,14 @@ type ApiErrorBody = {
|
|
|
52
52
|
* the interrupted send attempt left behind.
|
|
53
53
|
*/
|
|
54
54
|
readonly message_id?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Present only on a refusal an organization owner can lift in Shipmail. One of
|
|
57
|
+
* `owner_confirmation_required`, `subscription_required`, `trial_capacity` or
|
|
58
|
+
* `purchased_capacity`; later servers may add values.
|
|
59
|
+
*/
|
|
60
|
+
readonly reason?: string | undefined;
|
|
61
|
+
/** Present with `reason`: the Shipmail page where the owner reviews and confirms. */
|
|
62
|
+
readonly action_url?: string | undefined;
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
type EmailRecipient = {
|
|
@@ -59,9 +67,9 @@ type EmailRecipient = {
|
|
|
59
67
|
readonly name?: string | null | undefined;
|
|
60
68
|
};
|
|
61
69
|
type EmailRecipientInput = EmailRecipient | string;
|
|
62
|
-
declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
70
|
+
declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delayed", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
63
71
|
type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
|
|
64
|
-
declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
72
|
+
declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delayed", "message.delivered", "message.bounced", "message.complained", "mailbox.rule_matched", "mailbox.export.completed", "mailbox.export.failed", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered", "reply.overdue", "conversation.needs_action", "calendar.event_starting", "booking.created", "subscriber.added", "newsletter.sent"];
|
|
65
73
|
type WebhookDeliveryEventType = (typeof WEBHOOK_DELIVERY_EVENT_TYPES)[number];
|
|
66
74
|
type StatusResponse = {
|
|
67
75
|
readonly status: string;
|
|
@@ -1350,7 +1358,7 @@ type InboxMessageAction = {
|
|
|
1350
1358
|
};
|
|
1351
1359
|
type MailboxRuleMatchMode = "all" | "any";
|
|
1352
1360
|
type MailboxRuleCondition = {
|
|
1353
|
-
readonly type: "from_is" | "from_contains" | "recipient_is" | "plus_tag_is" | "subject_contains";
|
|
1361
|
+
readonly type: "from_is" | "from_contains" | "recipient_is" | "recipient_contains" | "plus_tag_is" | "subject_contains";
|
|
1354
1362
|
readonly value: string;
|
|
1355
1363
|
} | {
|
|
1356
1364
|
readonly type: "has_attachment" | "list_unsubscribe_exists";
|
|
@@ -1406,6 +1414,7 @@ type MailboxForwarding = {
|
|
|
1406
1414
|
readonly mailbox_id: string;
|
|
1407
1415
|
readonly destination: string;
|
|
1408
1416
|
readonly sender: string | null;
|
|
1417
|
+
readonly recipient: string | null;
|
|
1409
1418
|
readonly status: "pending" | "active";
|
|
1410
1419
|
readonly verification_sent_at: string | null;
|
|
1411
1420
|
readonly verified_at: string | null;
|
|
@@ -1420,6 +1429,7 @@ type MailboxForwardingList = {
|
|
|
1420
1429
|
type CreateMailboxForwardingParams = {
|
|
1421
1430
|
readonly destination: string;
|
|
1422
1431
|
readonly sender?: string | null | undefined;
|
|
1432
|
+
readonly recipient?: string | null | undefined;
|
|
1423
1433
|
};
|
|
1424
1434
|
type CreateMailboxBaseParams = {
|
|
1425
1435
|
readonly domain_id: string;
|
|
@@ -2051,6 +2061,38 @@ declare class Newsletters extends ApiResource {
|
|
|
2051
2061
|
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
2052
2062
|
}
|
|
2053
2063
|
|
|
2064
|
+
type OrganizationAccess = {
|
|
2065
|
+
readonly object: "organization_access";
|
|
2066
|
+
readonly organization: {
|
|
2067
|
+
readonly id: string;
|
|
2068
|
+
readonly name: string;
|
|
2069
|
+
};
|
|
2070
|
+
readonly plan: "free" | "solo" | "pro" | "team" | "scale";
|
|
2071
|
+
/** Mailboxes can be created now, by the same rule mailbox creation applies. */
|
|
2072
|
+
readonly has_access: boolean;
|
|
2073
|
+
readonly trial: {
|
|
2074
|
+
readonly active: boolean;
|
|
2075
|
+
readonly ends_at: string | null;
|
|
2076
|
+
/** No subscription yet and the owner never had a trial. Checkout still confirms it. */
|
|
2077
|
+
readonly eligible: boolean;
|
|
2078
|
+
};
|
|
2079
|
+
readonly mailboxes: {
|
|
2080
|
+
readonly limit: number;
|
|
2081
|
+
readonly used: number;
|
|
2082
|
+
};
|
|
2083
|
+
/** Newsletter sending is available. It is not during a trial. */
|
|
2084
|
+
readonly newsletters_allowed: boolean;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
declare class Organization extends ApiResource {
|
|
2088
|
+
/**
|
|
2089
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
2090
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
2091
|
+
* payment.
|
|
2092
|
+
*/
|
|
2093
|
+
access(options?: MethodOptions): Promise<OrganizationAccess>;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2054
2096
|
type ReplyScanStatus = "completed";
|
|
2055
2097
|
type ReplyScan = {
|
|
2056
2098
|
readonly object: "reply_scan";
|
|
@@ -2181,6 +2223,8 @@ type Webhook = {
|
|
|
2181
2223
|
readonly description: string | null;
|
|
2182
2224
|
readonly mailbox_ids: readonly string[] | null;
|
|
2183
2225
|
readonly domain_ids: readonly string[] | null;
|
|
2226
|
+
readonly has_authorization: boolean;
|
|
2227
|
+
readonly has_standard_webhooks_secret: boolean;
|
|
2184
2228
|
readonly created_at: string;
|
|
2185
2229
|
readonly updated_at: string;
|
|
2186
2230
|
};
|
|
@@ -2193,6 +2237,10 @@ type CreateWebhookParams = {
|
|
|
2193
2237
|
readonly description?: string | undefined;
|
|
2194
2238
|
readonly mailbox_ids?: readonly string[] | null | undefined;
|
|
2195
2239
|
readonly domain_ids?: readonly string[] | null | undefined;
|
|
2240
|
+
/** Sent verbatim as the `Authorization` header of every delivery. Write-only. */
|
|
2241
|
+
readonly authorization?: string | null | undefined;
|
|
2242
|
+
/** A `whsec_` secret from the receiving service. Deliveries then carry Standard Webhooks signatures. Write-only. */
|
|
2243
|
+
readonly standard_webhooks_secret?: string | null | undefined;
|
|
2196
2244
|
};
|
|
2197
2245
|
type UpdateWebhookParams = {
|
|
2198
2246
|
readonly url?: string | undefined;
|
|
@@ -2201,6 +2249,10 @@ type UpdateWebhookParams = {
|
|
|
2201
2249
|
readonly active?: boolean | undefined;
|
|
2202
2250
|
readonly mailbox_ids?: readonly string[] | null | undefined;
|
|
2203
2251
|
readonly domain_ids?: readonly string[] | null | undefined;
|
|
2252
|
+
/** A string replaces the delivery `Authorization` header, `null` removes it. */
|
|
2253
|
+
readonly authorization?: string | null | undefined;
|
|
2254
|
+
/** A string replaces the Standard Webhooks signing secret, `null` removes it. */
|
|
2255
|
+
readonly standard_webhooks_secret?: string | null | undefined;
|
|
2204
2256
|
};
|
|
2205
2257
|
type ListWebhooksParams = PaginationParams;
|
|
2206
2258
|
type RotateSecretResponse = {
|
|
@@ -2285,6 +2337,7 @@ declare class ShipmailClient {
|
|
|
2285
2337
|
readonly members: Members;
|
|
2286
2338
|
readonly messages: Messages;
|
|
2287
2339
|
readonly newsletters: Newsletters;
|
|
2340
|
+
readonly organization: Organization;
|
|
2288
2341
|
readonly replyScans: ReplyScans;
|
|
2289
2342
|
readonly scheduledMessages: ScheduledMessages;
|
|
2290
2343
|
readonly suppressions: Suppressions;
|
|
@@ -2302,23 +2355,39 @@ declare class ShipmailClient {
|
|
|
2302
2355
|
private buildUrl;
|
|
2303
2356
|
}
|
|
2304
2357
|
|
|
2358
|
+
/** The `reason` values this SDK knows. A newer server may send others; they pass through. */
|
|
2359
|
+
declare const ERROR_RECOVERY_REASONS: readonly ["owner_confirmation_required", "subscription_required", "trial_capacity", "purchased_capacity"];
|
|
2360
|
+
/** What an organization owner can do in Shipmail to lift a refusal. */
|
|
2361
|
+
type ErrorRecovery = {
|
|
2362
|
+
readonly reason?: string | undefined;
|
|
2363
|
+
readonly actionUrl?: string | undefined;
|
|
2364
|
+
};
|
|
2305
2365
|
declare class ShipmailError extends Error {
|
|
2306
2366
|
readonly status: number | undefined;
|
|
2307
2367
|
readonly type: ErrorType | undefined;
|
|
2308
2368
|
readonly requestId: string | undefined;
|
|
2309
2369
|
readonly retryable: boolean;
|
|
2370
|
+
/**
|
|
2371
|
+
* Why an organization owner must act, when they can lift this refusal in Shipmail. The error's
|
|
2372
|
+
* type and status stay what they were. See ERROR_RECOVERY_REASONS.
|
|
2373
|
+
*/
|
|
2374
|
+
readonly reason: string | undefined;
|
|
2375
|
+
/** The Shipmail page to send the owner to. Retry with a new idempotency key afterwards. */
|
|
2376
|
+
readonly actionUrl: string | undefined;
|
|
2310
2377
|
constructor(message: string, options?: {
|
|
2311
2378
|
readonly status?: number | undefined;
|
|
2312
2379
|
readonly type?: ErrorType | undefined;
|
|
2313
2380
|
readonly requestId?: string | undefined;
|
|
2314
2381
|
readonly retryable?: boolean | undefined;
|
|
2382
|
+
readonly reason?: string | undefined;
|
|
2383
|
+
readonly actionUrl?: string | undefined;
|
|
2315
2384
|
});
|
|
2316
2385
|
}
|
|
2317
2386
|
declare class AuthenticationError extends ShipmailError {
|
|
2318
2387
|
constructor(message: string, requestId?: string);
|
|
2319
2388
|
}
|
|
2320
2389
|
declare class AuthorizationError extends ShipmailError {
|
|
2321
|
-
constructor(message: string, requestId?: string);
|
|
2390
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2322
2391
|
}
|
|
2323
2392
|
declare class ValidationError extends ShipmailError {
|
|
2324
2393
|
readonly details: readonly {
|
|
@@ -2333,10 +2402,12 @@ declare class ValidationError extends ShipmailError {
|
|
|
2333
2402
|
readonly message: string;
|
|
2334
2403
|
readonly code?: string | undefined;
|
|
2335
2404
|
}[] | undefined;
|
|
2405
|
+
readonly reason?: string | undefined;
|
|
2406
|
+
readonly actionUrl?: string | undefined;
|
|
2336
2407
|
});
|
|
2337
2408
|
}
|
|
2338
2409
|
declare class QuotaExceededError extends ShipmailError {
|
|
2339
|
-
constructor(message: string, requestId?: string);
|
|
2410
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2340
2411
|
}
|
|
2341
2412
|
declare class NotFoundError extends ShipmailError {
|
|
2342
2413
|
constructor(message: string, requestId?: string);
|
|
@@ -2386,4 +2457,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2386
2457
|
readonly toleranceInSeconds?: number | undefined;
|
|
2387
2458
|
}): Promise<WebhookEvent>;
|
|
2388
2459
|
|
|
2389
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
|
2460
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxForwardingParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, ERROR_RECOVERY_REASONS, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorRecovery, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxForwarding, type MailboxForwardingList, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OrganizationAccess, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,12 @@ function apiKeyScopesGrant(grantedScopes, requiredScope) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// src/errors.ts
|
|
81
|
+
var ERROR_RECOVERY_REASONS = [
|
|
82
|
+
"owner_confirmation_required",
|
|
83
|
+
"subscription_required",
|
|
84
|
+
"trial_capacity",
|
|
85
|
+
"purchased_capacity"
|
|
86
|
+
];
|
|
81
87
|
var ShipmailError = class extends Error {
|
|
82
88
|
constructor(message, options) {
|
|
83
89
|
super(message);
|
|
@@ -86,6 +92,8 @@ var ShipmailError = class extends Error {
|
|
|
86
92
|
this.type = options?.type;
|
|
87
93
|
this.requestId = options?.requestId;
|
|
88
94
|
this.retryable = options?.retryable ?? false;
|
|
95
|
+
this.reason = options?.reason;
|
|
96
|
+
this.actionUrl = options?.actionUrl;
|
|
89
97
|
}
|
|
90
98
|
};
|
|
91
99
|
var AuthenticationError = class extends ShipmailError {
|
|
@@ -95,8 +103,14 @@ var AuthenticationError = class extends ShipmailError {
|
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
105
|
var AuthorizationError = class extends ShipmailError {
|
|
98
|
-
constructor(message, requestId) {
|
|
99
|
-
super(message, {
|
|
106
|
+
constructor(message, requestId, recovery) {
|
|
107
|
+
super(message, {
|
|
108
|
+
status: 403,
|
|
109
|
+
type: "authorization_error",
|
|
110
|
+
requestId,
|
|
111
|
+
retryable: false,
|
|
112
|
+
...recovery
|
|
113
|
+
});
|
|
100
114
|
this.name = "AuthorizationError";
|
|
101
115
|
}
|
|
102
116
|
};
|
|
@@ -106,15 +120,23 @@ var ValidationError = class extends ShipmailError {
|
|
|
106
120
|
status: 422,
|
|
107
121
|
type: "validation_error",
|
|
108
122
|
requestId: options?.requestId,
|
|
109
|
-
retryable: false
|
|
123
|
+
retryable: false,
|
|
124
|
+
reason: options?.reason,
|
|
125
|
+
actionUrl: options?.actionUrl
|
|
110
126
|
});
|
|
111
127
|
this.name = "ValidationError";
|
|
112
128
|
this.details = options?.details;
|
|
113
129
|
}
|
|
114
130
|
};
|
|
115
131
|
var QuotaExceededError = class extends ShipmailError {
|
|
116
|
-
constructor(message, requestId) {
|
|
117
|
-
super(message, {
|
|
132
|
+
constructor(message, requestId, recovery) {
|
|
133
|
+
super(message, {
|
|
134
|
+
status: 403,
|
|
135
|
+
type: "quota_exceeded",
|
|
136
|
+
requestId,
|
|
137
|
+
retryable: false,
|
|
138
|
+
...recovery
|
|
139
|
+
});
|
|
118
140
|
this.name = "QuotaExceededError";
|
|
119
141
|
}
|
|
120
142
|
};
|
|
@@ -175,15 +197,23 @@ var WebhookVerificationError = class extends ShipmailError {
|
|
|
175
197
|
function mapErrorFromResponse(status, body, requestId) {
|
|
176
198
|
const error = body.error;
|
|
177
199
|
const rid = error.request_id;
|
|
200
|
+
const recovery = {
|
|
201
|
+
reason: typeof error.reason === "string" ? error.reason : void 0,
|
|
202
|
+
actionUrl: typeof error.action_url === "string" ? error.action_url : void 0
|
|
203
|
+
};
|
|
178
204
|
switch (error.type) {
|
|
179
205
|
case "authentication_error":
|
|
180
206
|
return new AuthenticationError(error.message, rid);
|
|
181
207
|
case "authorization_error":
|
|
182
|
-
return new AuthorizationError(error.message, rid);
|
|
208
|
+
return new AuthorizationError(error.message, rid, recovery);
|
|
183
209
|
case "quota_exceeded":
|
|
184
|
-
return new QuotaExceededError(error.message, rid);
|
|
210
|
+
return new QuotaExceededError(error.message, rid, recovery);
|
|
185
211
|
case "validation_error":
|
|
186
|
-
return new ValidationError(error.message, {
|
|
212
|
+
return new ValidationError(error.message, {
|
|
213
|
+
requestId: rid,
|
|
214
|
+
details: error.details,
|
|
215
|
+
...recovery
|
|
216
|
+
});
|
|
187
217
|
case "not_found":
|
|
188
218
|
return new NotFoundError(error.message, rid);
|
|
189
219
|
case "rate_limit_error":
|
|
@@ -199,7 +229,8 @@ function mapErrorFromResponse(status, body, requestId) {
|
|
|
199
229
|
status,
|
|
200
230
|
type: error.type,
|
|
201
231
|
requestId: rid,
|
|
202
|
-
retryable: status >= 500
|
|
232
|
+
retryable: status >= 500,
|
|
233
|
+
...recovery
|
|
203
234
|
});
|
|
204
235
|
}
|
|
205
236
|
}
|
|
@@ -1366,6 +1397,22 @@ var Newsletters = class extends ApiResource {
|
|
|
1366
1397
|
}
|
|
1367
1398
|
};
|
|
1368
1399
|
|
|
1400
|
+
// src/resources/organization.ts
|
|
1401
|
+
var Organization = class extends ApiResource {
|
|
1402
|
+
/**
|
|
1403
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
1404
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
1405
|
+
* payment.
|
|
1406
|
+
*/
|
|
1407
|
+
access(options) {
|
|
1408
|
+
return this.client.request({
|
|
1409
|
+
method: "GET",
|
|
1410
|
+
path: "/organization/access",
|
|
1411
|
+
methodOptions: options
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1369
1416
|
// src/resources/reply-scans.ts
|
|
1370
1417
|
var ReplyScans = class extends ApiResource {
|
|
1371
1418
|
create(params, options) {
|
|
@@ -1614,7 +1661,7 @@ var Webhooks = class extends ApiResource {
|
|
|
1614
1661
|
};
|
|
1615
1662
|
|
|
1616
1663
|
// src/version.ts
|
|
1617
|
-
var VERSION = "0.6.
|
|
1664
|
+
var VERSION = "0.6.4";
|
|
1618
1665
|
|
|
1619
1666
|
// src/client.ts
|
|
1620
1667
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -1687,6 +1734,7 @@ var ShipmailClient = class {
|
|
|
1687
1734
|
this.members = new Members(this);
|
|
1688
1735
|
this.messages = new Messages(this);
|
|
1689
1736
|
this.newsletters = new Newsletters(this);
|
|
1737
|
+
this.organization = new Organization(this);
|
|
1690
1738
|
this.replyScans = new ReplyScans(this);
|
|
1691
1739
|
this.scheduledMessages = new ScheduledMessages(this);
|
|
1692
1740
|
this.suppressions = new Suppressions(this);
|
|
@@ -1806,6 +1854,7 @@ var CONFERENCING_PROVIDER_IDS = ["zoom", "google_meet"];
|
|
|
1806
1854
|
var WEBHOOK_EVENT_TYPES = [
|
|
1807
1855
|
"message.received",
|
|
1808
1856
|
"message.sent",
|
|
1857
|
+
"message.delayed",
|
|
1809
1858
|
"message.delivered",
|
|
1810
1859
|
"message.bounced",
|
|
1811
1860
|
"message.complained",
|
|
@@ -1897,6 +1946,6 @@ async function verifyWebhook(body, headers, secret, options) {
|
|
|
1897
1946
|
return parsed;
|
|
1898
1947
|
}
|
|
1899
1948
|
|
|
1900
|
-
export { API_KEY_SCOPES, API_KEY_SCOPE_DESCRIPTIONS, AuthenticationError, AuthorizationError, CONFERENCING_PROVIDER_IDS, ConflictError, ConnectionError, DOMAIN_STATUSES, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ReconciliationRequiredError, ShipmailClient, ShipmailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, apiKeyScopesGrant, ShipmailClient as default, isApiKeyScope, verifyWebhook };
|
|
1949
|
+
export { API_KEY_SCOPES, API_KEY_SCOPE_DESCRIPTIONS, AuthenticationError, AuthorizationError, CONFERENCING_PROVIDER_IDS, ConflictError, ConnectionError, DOMAIN_STATUSES, ERROR_RECOVERY_REASONS, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ReconciliationRequiredError, ShipmailClient, ShipmailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, apiKeyScopesGrant, ShipmailClient as default, isApiKeyScope, verifyWebhook };
|
|
1901
1950
|
//# sourceMappingURL=index.js.map
|
|
1902
1951
|
//# sourceMappingURL=index.js.map
|