mailchannels-sdk 0.7.10 โ†’ 0.8.0-0

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 CHANGED
@@ -6,10 +6,12 @@
6
6
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
7
7
  [![codecov][codecov-coverage-src]][codecov-coverage-href]
8
8
 
9
- Node.js SDK to integrate [MailChannels API](https://docs.mailchannels.net/) into your JavaScript or TypeScript server-side applications.
9
+ > Built and tested against Email API `0.21.1`
10
+
11
+ Node.js SDK to integrate [MailChannels Email API](https://docs.mailchannels.net/email-api) into your JavaScript or TypeScript server-side applications.
10
12
 
11
13
  <!-- #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.
14
+ This library provides a simple way to interact with the [MailChannels Email API](https://docs.mailchannels.net/email-api). It is written in TypeScript and can be used in both JavaScript and TypeScript projects and in different runtimes.
13
15
  <!-- #endregion overview -->
14
16
 
15
17
  - [โœจ Release Notes](CHANGELOG.md)
@@ -18,18 +20,18 @@ This library provides a simple way to interact with the [MailChannels API](https
18
20
  ## Contents
19
21
 
20
22
  - ๐Ÿš€ [Features](#features)
21
- - ๐Ÿ“ [Requirements](#requirements)
23
+ - ๐Ÿ“ [Prerequisites](#prerequisites)
22
24
  - ๐Ÿ“ฆ [Installation](#installation)
23
25
  - ๐Ÿ“š [Usage](#usage)
24
26
  - ๐Ÿ“ [Naming Conventions](#naming-conventions)
27
+ - ๐Ÿงช [Local simulator](#local-simulator)
25
28
  - โš–๏ธ [License](#license)
26
29
  - ๐Ÿ’ป [Development](#development)
27
- - ๐Ÿงช [Local simulator](#local-simulator)
28
30
 
29
31
  ## <a name="features">๐Ÿš€ Features</a>
30
32
 
31
33
  <!-- #region features -->
32
- This SDK fully supports all features and operations available in the [MailChannels API](https://docs.mailchannels.net/). It is actively maintained to ensure compatibility and to quickly add support for new API features as they are released.
34
+ This SDK fully supports all features and operations available in the [MailChannels Email API](https://docs.mailchannels.net/email-api). It is actively maintained to ensure compatibility and to quickly add support for new API features as they are released.
33
35
 
34
36
  Some of the things you can do with the SDK:
35
37
 
@@ -41,14 +43,13 @@ Some of the things you can do with the SDK:
41
43
  - Retrieve metrics
42
44
  - Inspect webhook delivery batches
43
45
  - Handle suppressions
44
- - Configure inbound domains
45
- - Manage account and recipient lists
46
+ - Run a local simulator for development testing
46
47
 
47
48
  > [!TIP]
48
49
  > For a detailed reference mapping each SDK method to its corresponding MailChannels API endpoint reference, see the [SDK-API Mapping](https://mailchannels.yizack.com/sdk-api-mapping)
49
50
  <!-- #endregion features -->
50
51
 
51
- ## <a name="requirements">๐Ÿ“ Requirements</a>
52
+ ## <a name="prerequisites">๐Ÿ“ Prerequisites</a>
52
53
 
53
54
  - [Create a MailChannels account](https://www.mailchannels.com/pricing/#for_devs)
54
55
  - [Create an API key](https://console.mailchannels.net/settings/accountSettings#APIKeys)
@@ -101,59 +102,43 @@ Most properties in the MailChannels API use `snake_case`. To follow JavaScript c
101
102
  - While most fields match the API docs (just with `camelCase`), a few may be simplified or reorganized to feel more natural for JavaScript developers.
102
103
  <!-- #endregion naming-conventions -->
103
104
 
104
- ## <a name="license">โš–๏ธ License</a>
105
-
106
- [MIT License](LICENSE)
107
-
108
- ## <a name="development">๐Ÿ’ป Development</a>
109
-
110
- <details>
111
- <summary>Local development</summary>
112
-
113
- ```sh
114
- # Install dependencies
115
- pnpm install
116
-
117
- # Build the package
118
- pnpm build
119
-
120
- # Run Oxlint
121
- pnpm lint
105
+ ## <a name="local-simulator">๐Ÿงช Local simulator</a>
122
106
 
123
- # Run Vitest
124
- pnpm test
125
- pnpm test:watch
107
+ <!-- #region simulator -->
108
+ This package includes a local MailChannels simulator you can run via the CLI. It holds state in memory and emulates the SDK-supported endpoints, letting you develop and test your application locally without hitting the real MailChannels service.
126
109
 
127
- # Run typecheck
128
- pnpm test:types
110
+ | API | Source |
111
+ | ----------- | -------------------------------------------------------------------------------------------------------------- |
112
+ | Email API | [`src/simulator/email-api.mjs`](https://github.com/Yizack/mailchannels/blob/main/src/simulator/email-api.mjs) |
129
113
 
130
- # Refresh API parity fixtures
131
- pnpm parity:fixtures
114
+ > [!IMPORTANT]
115
+ > The simulator approximates the MailChannels service for local development and testing. It is not a production implementation and may differ from the live service.
132
116
 
133
- # Run the local Email API simulator
134
- pnpm simulate:email-api
117
+ ### Start the simulator
135
118
 
136
- # Release new version
137
- pnpm release
119
+ ```sh
120
+ # default: http://127.0.0.1:8787
121
+ npx mailchannels-sdk simulate
138
122
  ```
139
123
 
140
- </details>
141
-
142
- ## <a name="local-simulator">๐Ÿงช Local simulator</a>
124
+ ### Options
143
125
 
144
- This repo includes a small local MailChannels Email API simulator at [scripts/email-api-simulator.mjs](./scripts/email-api-simulator.mjs). It keeps state in memory and emulates the SDK-supported Email API endpoints so you can test your application without calling the real MailChannels service.
126
+ | Option | Description | Default |
127
+ | ----------------- | ----------------------- | ----------- |
128
+ | `--port <number>` | Port to listen on | `8787` |
129
+ | `--host <host>` | Host address | `127.0.0.1` |
130
+ | `--silent` | Suppress simulator logs | `false` |
145
131
 
146
- ### Start the simulator
132
+ You can override the bind address with the `--host` and `--port` options:
147
133
 
148
134
  ```sh
149
- # default: http://127.0.0.1:8787
150
- pnpm simulate:email-api
135
+ npx mailchannels-sdk simulate --host 127.0.0.1 --port 8787
151
136
  ```
152
137
 
153
- You can override the bind address with environment variables:
138
+ Disable logs with the `--silent` option:
154
139
 
155
140
  ```sh
156
- MAILCHANNELS_SIMULATOR_HOST=127.0.0.1 MAILCHANNELS_SIMULATOR_PORT=8787 pnpm simulate:email-api
141
+ npx mailchannels-sdk simulate --silent
157
142
  ```
158
143
 
159
144
  ### Point the SDK at the simulator
@@ -192,6 +177,48 @@ const { data, error } = await mailchannels.emails.send({
192
177
  - Webhook responses are simulated locally, but the simulator does not yet emit real webhook callbacks to your application
193
178
 
194
179
  The next planned expansion is outbound webhook delivery so client applications can test webhook ingestion flows against the simulator as well.
180
+ <!-- #endregion simulator -->
181
+
182
+ ## <a name="license">โš–๏ธ License</a>
183
+
184
+ [MIT License](LICENSE)
185
+
186
+ ## <a name="development">๐Ÿ’ป Development</a>
187
+
188
+ <details>
189
+ <summary>Local development</summary>
190
+
191
+ ```sh
192
+ # Install dependencies
193
+ pnpm install
194
+
195
+ # Build the package
196
+ pnpm build
197
+
198
+ # Run Oxlint
199
+ pnpm lint
200
+
201
+ # Run Vitest
202
+ pnpm test
203
+ pnpm test:watch
204
+
205
+ # Run typecheck
206
+ pnpm test:types
207
+
208
+ # Refresh API parity fixtures
209
+ pnpm parity:fixtures
210
+
211
+ # Run the local simulator
212
+ pnpm simulate
213
+
214
+ # Run a playground script
215
+ npx jiti playground/emails/send.ts
216
+
217
+ # Release new version
218
+ pnpm release
219
+ ```
220
+
221
+ </details>
195
222
 
196
223
  <!-- Badges -->
197
224
  [npm-version-src]: https://img.shields.io/npm/v/mailchannels-sdk.svg?style=flat&colorA=070a30&colorB=35a047