mailchannels-sdk 0.3.6

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Yizack Rangel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ ![MailChannels](/docs/public/images/presentation.png)
2
+
3
+ # MailChannels
4
+
5
+ [![npm version][npm-version-src]][npm-version-href]
6
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
+ [![codecov][codecov-coverage-src]][codecov-coverage-href]
8
+
9
+ Node.js SDK to integrate [MailChannels API](https://docs.mailchannels.net/) into your JavaScript or TypeScript server-side applications.
10
+
11
+ <!-- #region overview -->
12
+ This library provides a simple way to interact with the [MailChannels API](https://docs.mailchannels.net/). It is written in TypeScript and can be used in both JavaScript and TypeScript projects and in different runtimes.
13
+ <!-- #endregion overview -->
14
+
15
+ <!-- #region note -->
16
+ > [!NOTE]
17
+ > This library is NOT officially maintained by [MailChannels Corporation](https://mailchannels.com/).
18
+ <!-- #endregion note -->
19
+
20
+ - [✨ Release Notes](CHANGELOG.md)
21
+ - [📖 Documentation](https://mailchannels.yizack.com)
22
+
23
+ ## Contents
24
+
25
+ - 🚀 [Features](#features)
26
+ - 📏 [Requirements](#requirements)
27
+ - 🏃 [Quick setup](#quick-setup)
28
+ - 🚧 [Roadmap](#roadmap)
29
+ - ⚖️ [License](#license)
30
+ - 💻 [Development](#development)
31
+
32
+ ## <a name="features">🚀 Features</a>
33
+
34
+ - Send transactional emails
35
+ - Check DKIM, SPF & Domain Lockdown
36
+ - Webhook notifications
37
+ - Manage sub-accounts
38
+ - Manage inbound domains
39
+ - Manage account lists
40
+ - Manage recipient lists
41
+
42
+ ## <a name="requirements">📏 Requirements</a>
43
+
44
+ - MailChannels account
45
+ - Email API key
46
+
47
+ ## <a name="quick-setup">🏃 Quick setup</a>
48
+
49
+ 1. Add `mailchannels-sdk` dependency to your project
50
+
51
+ ```sh
52
+ # npm
53
+ npm i mailchannels-sdk
54
+
55
+ # yarn
56
+ yarn add mailchannels-sdk
57
+
58
+ # pnpm
59
+ pnpm add mailchannels-sdk
60
+ ```
61
+
62
+ ## <a name="license">⚖️ License</a>
63
+
64
+ [MIT License](LICENSE)
65
+
66
+ <!-- #region roadmap -->
67
+ ## <a name="roadmap">🚧 Roadmap</a>
68
+
69
+ Already implemented features are marked with a checkmark. Please open an issue if you find any bugs or missing features.
70
+
71
+ ### [Email API](https://docs.mailchannels.net/email-api/api-reference/email-api)
72
+
73
+ - 📧 Emails
74
+ - ✅ Send an Email
75
+ - ✅ DKIM, SPF & Domain Lockdown Check
76
+ - 📢 Webhooks
77
+ - ✅ Enroll for Webhook Notifications
78
+ - ✅ Retrieve Customer Webhooks
79
+ - ✅ Delete Customer Webhooks
80
+ - ✅ Retrieve Webhook Signing Key
81
+ - 🪪 Sub-accounts
82
+ - ✅ Create Sub-account
83
+ - ✅ Retrieve Sub-accounts
84
+ - ✅ Delete Sub-account
85
+ - ✅ Suspend Sub-account
86
+ - ✅ Activate Sub-account
87
+ - ✅ Create Sub-account API Key
88
+ - ✅ Delete Sub-account API Key
89
+ - ✅ Retrieve Sub-account API Keys
90
+ - ✅ Create Sub-account SMTP password
91
+ - ✅ Delete Sub-account SMTP password
92
+ - ✅ Retrieve Sub-account SMTP Passwords
93
+
94
+ ### [Inbound API](https://docs.mailchannels.net/inbound-api/API-reference/inbound-api)
95
+
96
+ - 🌐 Domains
97
+ - ✅ Provision domain
98
+ - ✅ Remove domain
99
+ - ✅ List domains
100
+ - ✅ Bulk provision domains
101
+ - ✅ Add domain list entry
102
+ - ✅ Get domain list entries
103
+ - ✅ Delete domain list entry
104
+ - ✅ Create login link
105
+ - ✅ Set downstream address
106
+ - ✅ Fetch downstream addresses
107
+ - ✅ Update API key
108
+ - 📋 Lists
109
+ - ✅ Add item to customer list
110
+ - ✅ Delete item from customer list
111
+ - ✅ Get customer list entries
112
+ - 📥 Users
113
+ - ✅ Create a recipient
114
+ - ✅ Add item to recipient list
115
+ - ✅ Get recipient list entries
116
+ - ✅ Delete item from recipient list
117
+ - ⚙️ Service
118
+ - ✅ Retrieve the condition of the service
119
+ - ✅ Submit a false negative or false positive report
120
+ - ✅ Get a list of your subscriptions to MailChannels Inbound
121
+ <!-- #endregion roadmap -->
122
+
123
+ ## <a name="development">💻 Development</a>
124
+
125
+ <details>
126
+ <summary>Local development</summary>
127
+
128
+ ```sh
129
+ # Install dependencies
130
+ pnpm install
131
+
132
+ # Build the package
133
+ npm run build
134
+
135
+ # Run ESLint
136
+ npm run lint
137
+
138
+ # Run Vitest
139
+ npm run test
140
+ npm run test:watch
141
+
142
+ # Run typecheck
143
+ npm run test:types
144
+
145
+ # Release new version
146
+ npm run release
147
+ ```
148
+
149
+ </details>
150
+
151
+ <!-- Badges -->
152
+ [npm-version-src]: https://img.shields.io/npm/v/mailchannels-sdk.svg?style=flat&colorA=070a30&colorB=35a047
153
+ [npm-version-href]: https://npmjs.com/package/mailchannels-sdk
154
+
155
+ [npm-downloads-src]: https://img.shields.io/npm/dm/mailchannels-sdk.svg?style=flat&colorA=070a30&colorB=35a047
156
+ [npm-downloads-href]: https://npmjs.com/package/mailchannels-sdk
157
+
158
+ [codecov-coverage-src]: https://img.shields.io/codecov/c/github/yizack/mailchannels?style=flat&colorA=070a30&token=HTSBRHSJ5M
159
+ [codecov-coverage-href]: https://codecov.io/gh/Yizack/mailchannels
@@ -0,0 +1,16 @@
1
+ import { M as MailChannelsClient, E as Emails, W as Webhooks, S as SubAccounts, a as Service, D as Domains, U as Users, L as Lists } from './shared/mailchannels-sdk.BDB65ygx.mjs';
2
+ export { z as DomainsBulkProvisionOptions, B as DomainsBulkProvisionResponse, G as DomainsCreateLoginLinkResponse, x as DomainsData, I as DomainsDownstreamAddress, H as DomainsListDownstreamAddressesOptions, J as DomainsListDownstreamAddressesResponse, C as DomainsListOptions, F as DomainsListResponse, y as DomainsProvisionOptions, A as DomainsProvisionResponse, h as EmailsCheckDomainDkim, i as EmailsCheckDomainOptions, k as EmailsCheckDomainResponse, j as EmailsCheckDomainVerdict, c as EmailsSendAttachment, f as EmailsSendOptions, e as EmailsSendOptionsBase, b as EmailsSendRecipient, g as EmailsSendResponse, d as EmailsSendTracking, V as ListEntriesResponse, R as ListEntry, Q as ListEntryOptions, T as ListEntryResponse, P as ListNames, N as ServiceReportOptions, K as ServiceSubscriptionsResponse, l as SubAccountsAccount, p as SubAccountsApiKey, q as SubAccountsCreateApiKeyResponse, m as SubAccountsCreateResponse, t as SubAccountsCreateSmtpPasswordResponse, r as SubAccountsListApiKeyResponse, n as SubAccountsListOptions, o as SubAccountsListResponse, u as SubAccountsListSmtpPasswordResponse, s as SubAccountsSmtpPassword, O as SuccessResponse, v as WebhooksListResponse, w as WebhooksSigningKeyResponse } from './shared/mailchannels-sdk.BDB65ygx.mjs';
3
+ import 'ofetch';
4
+
5
+ declare class MailChannels extends MailChannelsClient {
6
+ readonly emails: Emails;
7
+ readonly webhooks: Webhooks;
8
+ readonly subAccounts: SubAccounts;
9
+ readonly service: Service;
10
+ readonly domains: Domains;
11
+ readonly users: Users;
12
+ readonly lists: Lists;
13
+ constructor(key: string);
14
+ }
15
+
16
+ export { MailChannels, MailChannelsClient };
@@ -0,0 +1,16 @@
1
+ import { M as MailChannelsClient, E as Emails, W as Webhooks, S as SubAccounts, a as Service, D as Domains, U as Users, L as Lists } from './shared/mailchannels-sdk.BDB65ygx.js';
2
+ export { z as DomainsBulkProvisionOptions, B as DomainsBulkProvisionResponse, G as DomainsCreateLoginLinkResponse, x as DomainsData, I as DomainsDownstreamAddress, H as DomainsListDownstreamAddressesOptions, J as DomainsListDownstreamAddressesResponse, C as DomainsListOptions, F as DomainsListResponse, y as DomainsProvisionOptions, A as DomainsProvisionResponse, h as EmailsCheckDomainDkim, i as EmailsCheckDomainOptions, k as EmailsCheckDomainResponse, j as EmailsCheckDomainVerdict, c as EmailsSendAttachment, f as EmailsSendOptions, e as EmailsSendOptionsBase, b as EmailsSendRecipient, g as EmailsSendResponse, d as EmailsSendTracking, V as ListEntriesResponse, R as ListEntry, Q as ListEntryOptions, T as ListEntryResponse, P as ListNames, N as ServiceReportOptions, K as ServiceSubscriptionsResponse, l as SubAccountsAccount, p as SubAccountsApiKey, q as SubAccountsCreateApiKeyResponse, m as SubAccountsCreateResponse, t as SubAccountsCreateSmtpPasswordResponse, r as SubAccountsListApiKeyResponse, n as SubAccountsListOptions, o as SubAccountsListResponse, u as SubAccountsListSmtpPasswordResponse, s as SubAccountsSmtpPassword, O as SuccessResponse, v as WebhooksListResponse, w as WebhooksSigningKeyResponse } from './shared/mailchannels-sdk.BDB65ygx.js';
3
+ import 'ofetch';
4
+
5
+ declare class MailChannels extends MailChannelsClient {
6
+ readonly emails: Emails;
7
+ readonly webhooks: Webhooks;
8
+ readonly subAccounts: SubAccounts;
9
+ readonly service: Service;
10
+ readonly domains: Domains;
11
+ readonly users: Users;
12
+ readonly lists: Lists;
13
+ constructor(key: string);
14
+ }
15
+
16
+ export { MailChannels, MailChannelsClient };
@@ -0,0 +1,54 @@
1
+ import { $fetch } from 'ofetch';
2
+ import { Emails, Webhooks, SubAccounts, Service, Domains, Users, Lists } from './modules.mjs';
3
+
4
+ class MailChannelsClient {
5
+ static BASE_URL = "https://api.mailchannels.net";
6
+ #headers;
7
+ constructor(key) {
8
+ if (!key) {
9
+ throw new Error("Missing MailChannels API key.");
10
+ }
11
+ this.#headers = {
12
+ "X-API-Key": key,
13
+ "Accept": "application/json",
14
+ "Content-Type": "application/json"
15
+ };
16
+ }
17
+ async _fetch(path, options) {
18
+ return $fetch(path, {
19
+ baseURL: MailChannelsClient.BASE_URL,
20
+ ...options,
21
+ headers: {
22
+ ...this.#headers,
23
+ ...options?.headers
24
+ }
25
+ });
26
+ }
27
+ async post(path, options) {
28
+ return this._fetch(path, { method: "POST", ...options });
29
+ }
30
+ async get(path, options) {
31
+ return this._fetch(path, { method: "GET", ...options });
32
+ }
33
+ async delete(path, options) {
34
+ return this._fetch(path, { method: "DELETE", ...options });
35
+ }
36
+ async put(path, options) {
37
+ return this._fetch(path, { method: "PUT", ...options });
38
+ }
39
+ }
40
+
41
+ class MailChannels extends MailChannelsClient {
42
+ emails = new Emails(this);
43
+ webhooks = new Webhooks(this);
44
+ subAccounts = new SubAccounts(this);
45
+ service = new Service(this);
46
+ domains = new Domains(this);
47
+ users = new Users(this);
48
+ lists = new Lists(this);
49
+ constructor(key) {
50
+ super(key);
51
+ }
52
+ }
53
+
54
+ export { MailChannels, MailChannelsClient };
@@ -0,0 +1,2 @@
1
+ export { D as Domains, z as DomainsBulkProvisionOptions, B as DomainsBulkProvisionResponse, G as DomainsCreateLoginLinkResponse, x as DomainsData, I as DomainsDownstreamAddress, H as DomainsListDownstreamAddressesOptions, J as DomainsListDownstreamAddressesResponse, C as DomainsListOptions, F as DomainsListResponse, y as DomainsProvisionOptions, A as DomainsProvisionResponse, E as Emails, h as EmailsCheckDomainDkim, i as EmailsCheckDomainOptions, k as EmailsCheckDomainResponse, j as EmailsCheckDomainVerdict, c as EmailsSendAttachment, f as EmailsSendOptions, e as EmailsSendOptionsBase, b as EmailsSendRecipient, g as EmailsSendResponse, d as EmailsSendTracking, V as ListEntriesResponse, R as ListEntry, Q as ListEntryOptions, T as ListEntryResponse, P as ListNames, L as Lists, a as Service, N as ServiceReportOptions, K as ServiceSubscriptionsResponse, S as SubAccounts, l as SubAccountsAccount, p as SubAccountsApiKey, q as SubAccountsCreateApiKeyResponse, m as SubAccountsCreateResponse, t as SubAccountsCreateSmtpPasswordResponse, r as SubAccountsListApiKeyResponse, n as SubAccountsListOptions, o as SubAccountsListResponse, u as SubAccountsListSmtpPasswordResponse, s as SubAccountsSmtpPassword, O as SuccessResponse, U as Users, W as Webhooks, v as WebhooksListResponse, w as WebhooksSigningKeyResponse } from './shared/mailchannels-sdk.BDB65ygx.mjs';
2
+ import 'ofetch';
@@ -0,0 +1,2 @@
1
+ export { D as Domains, z as DomainsBulkProvisionOptions, B as DomainsBulkProvisionResponse, G as DomainsCreateLoginLinkResponse, x as DomainsData, I as DomainsDownstreamAddress, H as DomainsListDownstreamAddressesOptions, J as DomainsListDownstreamAddressesResponse, C as DomainsListOptions, F as DomainsListResponse, y as DomainsProvisionOptions, A as DomainsProvisionResponse, E as Emails, h as EmailsCheckDomainDkim, i as EmailsCheckDomainOptions, k as EmailsCheckDomainResponse, j as EmailsCheckDomainVerdict, c as EmailsSendAttachment, f as EmailsSendOptions, e as EmailsSendOptionsBase, b as EmailsSendRecipient, g as EmailsSendResponse, d as EmailsSendTracking, V as ListEntriesResponse, R as ListEntry, Q as ListEntryOptions, T as ListEntryResponse, P as ListNames, L as Lists, a as Service, N as ServiceReportOptions, K as ServiceSubscriptionsResponse, S as SubAccounts, l as SubAccountsAccount, p as SubAccountsApiKey, q as SubAccountsCreateApiKeyResponse, m as SubAccountsCreateResponse, t as SubAccountsCreateSmtpPasswordResponse, r as SubAccountsListApiKeyResponse, n as SubAccountsListOptions, o as SubAccountsListResponse, u as SubAccountsListSmtpPasswordResponse, s as SubAccountsSmtpPassword, O as SuccessResponse, U as Users, W as Webhooks, v as WebhooksListResponse, w as WebhooksSigningKeyResponse } from './shared/mailchannels-sdk.BDB65ygx.js';
2
+ import 'ofetch';