mailchannels-sdk 0.7.7 → 0.7.9
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 +1 -1
- package/dist/mailchannels.d.mts +50 -1
- package/dist/mailchannels.mjs +28 -0
- package/package.json +5 -5
package/README.md
CHANGED
package/dist/mailchannels.d.mts
CHANGED
|
@@ -510,6 +510,14 @@ type EmailsCheckDomainResponse = DataResponse<{
|
|
|
510
510
|
* A human-readable explanation of SPF check.
|
|
511
511
|
*/
|
|
512
512
|
reason?: string;
|
|
513
|
+
/**
|
|
514
|
+
* The SPF record that was used for the check.
|
|
515
|
+
*/
|
|
516
|
+
spfRecord?: string;
|
|
517
|
+
/**
|
|
518
|
+
* Error message if the SPF record lookup failed.
|
|
519
|
+
*/
|
|
520
|
+
spfRecordError?: string;
|
|
513
521
|
verdict: EmailsCheckDomainVerdict;
|
|
514
522
|
};
|
|
515
523
|
references?: string[];
|
|
@@ -809,6 +817,37 @@ interface WebhooksBatch {
|
|
|
809
817
|
webhook: string;
|
|
810
818
|
}
|
|
811
819
|
type WebhooksBatchesResponse = DataResponse<WebhooksBatch[]>;
|
|
820
|
+
interface WebhooksResendBatch {
|
|
821
|
+
/**
|
|
822
|
+
* Unique identifier for the webhook batch.
|
|
823
|
+
*/
|
|
824
|
+
batchId: number;
|
|
825
|
+
/**
|
|
826
|
+
* Customer handle associated with the webhook batch.
|
|
827
|
+
*/
|
|
828
|
+
customerHandle: string;
|
|
829
|
+
/**
|
|
830
|
+
* Webhook URL to which events in the batch were posted.
|
|
831
|
+
*/
|
|
832
|
+
webhook: string;
|
|
833
|
+
/**
|
|
834
|
+
* Timestamp of when the webhook batch was created.
|
|
835
|
+
*/
|
|
836
|
+
createdAt: string;
|
|
837
|
+
/**
|
|
838
|
+
* Number of events in the webhook batch.
|
|
839
|
+
*/
|
|
840
|
+
eventCount: number;
|
|
841
|
+
/**
|
|
842
|
+
* Duration of the webhook batch in milliseconds. `null` indicates that no response was returned from the webhook endpoint.
|
|
843
|
+
*/
|
|
844
|
+
duration: number | null;
|
|
845
|
+
/**
|
|
846
|
+
* HTTP status code returned by the webhook endpoint. `null` indicates that no response was returned from the webhook endpoint.
|
|
847
|
+
*/
|
|
848
|
+
statusCode: number | null;
|
|
849
|
+
}
|
|
850
|
+
type WebhooksResendBatchResponse = DataResponse<WebhooksResendBatch>;
|
|
812
851
|
declare class Webhooks {
|
|
813
852
|
protected mailchannels: MailChannelsClient;
|
|
814
853
|
constructor(mailchannels: MailChannelsClient);
|
|
@@ -889,6 +928,16 @@ declare class Webhooks {
|
|
|
889
928
|
* ```
|
|
890
929
|
*/
|
|
891
930
|
batches(options?: WebhooksBatchesOptions): Promise<WebhooksBatchesResponse>;
|
|
931
|
+
/**
|
|
932
|
+
* Synchronously resends the webhook batch with the provided `batchId` for the customer. The result is returned in the response.
|
|
933
|
+
* @param batchId - The ID of the batch to resend.
|
|
934
|
+
* @example
|
|
935
|
+
* ```ts
|
|
936
|
+
* const mailchannels = new MailChannels('your-api-key')
|
|
937
|
+
* const { data, error } = await mailchannels.webhooks.resendBatch(123)
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
resendBatch(batchId: number): Promise<WebhooksResendBatchResponse>;
|
|
892
941
|
}
|
|
893
942
|
interface SubAccountsAccount {
|
|
894
943
|
/**
|
|
@@ -2148,4 +2197,4 @@ declare class MailChannels extends MailChannelsClient {
|
|
|
2148
2197
|
readonly service: Service;
|
|
2149
2198
|
constructor(key: string, options?: MailChannelsClientOptions);
|
|
2150
2199
|
}
|
|
2151
|
-
export { DataResponse, Domains, DomainsBulkCreateLoginLinks, DomainsBulkCreateLoginLinksResponse, DomainsBulkProvisionOptions, DomainsBulkProvisionResponse, DomainsCreateLoginLink, DomainsCreateLoginLinkResponse, DomainsData, DomainsDownstreamAddress, DomainsListDownstreamAddressesOptions, DomainsListDownstreamAddressesResponse, DomainsListOptions, DomainsListResponse, DomainsProvisionOptions, DomainsProvisionResponse, Emails, EmailsCheckDomainOptions, EmailsCheckDomainResponse, EmailsCheckDomainVerdict, EmailsCreateDkimKeyOptions, EmailsCreateDkimKeyResponse, EmailsDkimKey, EmailsDkimKeyStatus, EmailsGetDkimKeysOptions, EmailsGetDkimKeysResponse, EmailsRotateDkimKeyOptions, EmailsRotateDkimKeyResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendDkim, EmailsSendOptions, EmailsSendPersonalization, EmailsSendRecipient, EmailsSendRecipientInput, EmailsSendResponse, EmailsSendTracking, EmailsUpdateDkimKeyOptions, ErrorResponse, ListEntriesResponse, ListEntry, ListEntryOptions, ListEntryResponse, ListNames, Lists, MailChannels, MailChannelsClient, type MailChannelsClientOptions, Metrics, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, Service, ServiceReportOptions, ServiceSubscriptionsResponse, SubAccounts, SubAccountsAccount, SubAccountsApiKey, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, Suppressions, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, Users, UsersCreateOptions, UsersCreateResponse, WebhookEvent, WebhookEventClick, WebhookEventComplained, WebhookEventDelivered, WebhookEventDropped, WebhookEventHardBounced, WebhookEventOpen, WebhookEventProcessed, WebhookEventSoftBounced, WebhookEventTest, WebhookEventType, WebhookEventUnsubscribed, WebhookEvents, Webhooks, WebhooksBatch, WebhooksBatchResponseStatus, WebhooksBatchStatus, WebhooksBatchesOptions, WebhooksBatchesResponse, WebhooksListResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse, WebhooksVerifyOptions };
|
|
2200
|
+
export { DataResponse, Domains, DomainsBulkCreateLoginLinks, DomainsBulkCreateLoginLinksResponse, DomainsBulkProvisionOptions, DomainsBulkProvisionResponse, DomainsCreateLoginLink, DomainsCreateLoginLinkResponse, DomainsData, DomainsDownstreamAddress, DomainsListDownstreamAddressesOptions, DomainsListDownstreamAddressesResponse, DomainsListOptions, DomainsListResponse, DomainsProvisionOptions, DomainsProvisionResponse, Emails, EmailsCheckDomainOptions, EmailsCheckDomainResponse, EmailsCheckDomainVerdict, EmailsCreateDkimKeyOptions, EmailsCreateDkimKeyResponse, EmailsDkimKey, EmailsDkimKeyStatus, EmailsGetDkimKeysOptions, EmailsGetDkimKeysResponse, EmailsRotateDkimKeyOptions, EmailsRotateDkimKeyResponse, EmailsSendAsyncResponse, EmailsSendAttachment, EmailsSendDkim, EmailsSendOptions, EmailsSendPersonalization, EmailsSendRecipient, EmailsSendRecipientInput, EmailsSendResponse, EmailsSendTracking, EmailsUpdateDkimKeyOptions, ErrorResponse, ListEntriesResponse, ListEntry, ListEntryOptions, ListEntryResponse, ListNames, Lists, MailChannels, MailChannelsClient, type MailChannelsClientOptions, Metrics, MetricsBucket, MetricsEngagement, MetricsEngagementResponse, MetricsOptions, MetricsPerformance, MetricsPerformanceResponse, MetricsRecipientBehaviour, MetricsRecipientBehaviourResponse, MetricsSenders, MetricsSendersOptions, MetricsSendersResponse, MetricsSendersType, MetricsUsageResponse, MetricsVolume, MetricsVolumeResponse, Service, ServiceReportOptions, ServiceSubscriptionsResponse, SubAccounts, SubAccountsAccount, SubAccountsApiKey, SubAccountsCreateApiKeyResponse, SubAccountsCreateResponse, SubAccountsCreateSmtpPasswordResponse, SubAccountsLimit, SubAccountsLimitResponse, SubAccountsListApiKeyOptions, SubAccountsListApiKeyResponse, SubAccountsListOptions, SubAccountsListResponse, SubAccountsListSmtpPasswordResponse, SubAccountsSmtpPassword, SubAccountsUsage, SubAccountsUsageResponse, SuccessResponse, Suppressions, SuppressionsCreateOptions, SuppressionsListEntry, SuppressionsListOptions, SuppressionsListResponse, SuppressionsSource, SuppressionsTypes, Users, UsersCreateOptions, UsersCreateResponse, WebhookEvent, WebhookEventClick, WebhookEventComplained, WebhookEventDelivered, WebhookEventDropped, WebhookEventHardBounced, WebhookEventOpen, WebhookEventProcessed, WebhookEventSoftBounced, WebhookEventTest, WebhookEventType, WebhookEventUnsubscribed, WebhookEvents, Webhooks, WebhooksBatch, WebhooksBatchResponseStatus, WebhooksBatchStatus, WebhooksBatchesOptions, WebhooksBatchesResponse, WebhooksListResponse, WebhooksResendBatch, WebhooksResendBatchResponse, WebhooksSigningKeyResponse, WebhooksValidateResponse, WebhooksVerifyOptions };
|
package/dist/mailchannels.mjs
CHANGED
|
@@ -842,6 +842,34 @@ var Webhooks = class Webhooks {
|
|
|
842
842
|
error: null
|
|
843
843
|
};
|
|
844
844
|
}
|
|
845
|
+
async resendBatch(batchId) {
|
|
846
|
+
let error = null;
|
|
847
|
+
const response = await this.mailchannels.post(`/tx/v1/webhook-batch/${batchId}/resend`, { onResponseError: async ({ response }) => {
|
|
848
|
+
error = getStatusError(response, {
|
|
849
|
+
[ErrorCode.BadRequest]: "Bad Request. The batch ID is invalid.",
|
|
850
|
+
[ErrorCode.NotFound]: `The batch '${batchId}' is not found for the customer.`
|
|
851
|
+
});
|
|
852
|
+
} }).catch((e) => {
|
|
853
|
+
error ||= getResultError(e, "Failed to resend webhook batch.");
|
|
854
|
+
return null;
|
|
855
|
+
});
|
|
856
|
+
if (!response) return {
|
|
857
|
+
data: null,
|
|
858
|
+
error
|
|
859
|
+
};
|
|
860
|
+
return {
|
|
861
|
+
data: clean({
|
|
862
|
+
batchId: response.batch_id,
|
|
863
|
+
customerHandle: response.customer_handle,
|
|
864
|
+
webhook: response.webhook,
|
|
865
|
+
createdAt: response.created_at,
|
|
866
|
+
eventCount: response.event_count,
|
|
867
|
+
duration: response.duration_in_ms,
|
|
868
|
+
statusCode: response.status_code
|
|
869
|
+
}),
|
|
870
|
+
error: null
|
|
871
|
+
};
|
|
872
|
+
}
|
|
845
873
|
};
|
|
846
874
|
var SubAccounts = class SubAccounts {
|
|
847
875
|
static COMPANY_PATTERN = /^.{3,128}$/;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailchannels-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
4
4
|
"description": "Node.js SDK to integrate MailChannels API into your JavaScript or TypeScript server-side applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
41
41
|
"@types/markdown-it": "^14.1.2",
|
|
42
|
-
"@types/node": "^25.
|
|
43
|
-
"@vitest/coverage-v8": "^4.1.
|
|
42
|
+
"@types/node": "^25.6.0",
|
|
43
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
44
44
|
"changelogen": "^0.6.2",
|
|
45
45
|
"jiti": "^2.6.1",
|
|
46
46
|
"obuild": "^0.4.33",
|
|
47
|
-
"oxlint": "^1.
|
|
47
|
+
"oxlint": "^1.60.0",
|
|
48
48
|
"scule": "^1.3.0",
|
|
49
49
|
"typescript": "^6.0.2",
|
|
50
50
|
"vitepress": "^2.0.0-alpha.17",
|
|
51
51
|
"vitepress-plugin-group-icons": "^1.7.3",
|
|
52
52
|
"vitepress-plugin-llms": "^1.12.0",
|
|
53
|
-
"vitest": "^4.1.
|
|
53
|
+
"vitest": "^4.1.4"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "obuild",
|