mailchannels-sdk 0.7.9 โ†’ 0.7.11

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
@@ -12,24 +12,19 @@ Node.js SDK to integrate [MailChannels API](https://docs.mailchannels.net/) into
12
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
13
  <!-- #endregion overview -->
14
14
 
15
- <!-- #region disclaimer -->
16
- > [!IMPORTANT]
17
- > **Disclaimer**: This library is not associated with [MailChannels Corporation](https://mailchannels.com/).
18
- <!-- #endregion disclaimer -->
19
-
20
15
  - [โœจ Release Notes](CHANGELOG.md)
21
16
  - [๐Ÿ“– Documentation](https://mailchannels.yizack.com)
22
17
 
23
18
  ## Contents
24
19
 
25
20
  - ๐Ÿš€ [Features](#features)
26
- - ๐Ÿ“ [Requirements](#requirements)
21
+ - ๐Ÿ“ [Prerequisites](#prerequisites)
27
22
  - ๐Ÿ“ฆ [Installation](#installation)
28
23
  - ๐Ÿ“š [Usage](#usage)
29
24
  - ๐Ÿ“ [Naming Conventions](#naming-conventions)
25
+ - ๐Ÿงช [Local simulator](#local-simulator)
30
26
  - โš–๏ธ [License](#license)
31
27
  - ๐Ÿ’ป [Development](#development)
32
- - ๐Ÿงช [Local simulator](#local-simulator)
33
28
 
34
29
  ## <a name="features">๐Ÿš€ Features</a>
35
30
 
@@ -46,6 +41,7 @@ Some of the things you can do with the SDK:
46
41
  - Retrieve metrics
47
42
  - Inspect webhook delivery batches
48
43
  - Handle suppressions
44
+ - Run a local simulator for development testing
49
45
  - Configure inbound domains
50
46
  - Manage account and recipient lists
51
47
 
@@ -53,7 +49,7 @@ Some of the things you can do with the SDK:
53
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)
54
50
  <!-- #endregion features -->
55
51
 
56
- ## <a name="requirements">๐Ÿ“ Requirements</a>
52
+ ## <a name="prerequisites">๐Ÿ“ Prerequisites</a>
57
53
 
58
54
  - [Create a MailChannels account](https://www.mailchannels.com/pricing/#for_devs)
59
55
  - [Create an API key](https://console.mailchannels.net/settings/accountSettings#APIKeys)
@@ -106,59 +102,44 @@ Most properties in the MailChannels API use `snake_case`. To follow JavaScript c
106
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.
107
103
  <!-- #endregion naming-conventions -->
108
104
 
109
- ## <a name="license">โš–๏ธ License</a>
110
-
111
- [MIT License](LICENSE)
112
-
113
- ## <a name="development">๐Ÿ’ป Development</a>
114
-
115
- <details>
116
- <summary>Local development</summary>
117
-
118
- ```sh
119
- # Install dependencies
120
- pnpm install
121
-
122
- # Build the package
123
- pnpm build
124
-
125
- # Run Oxlint
126
- pnpm lint
105
+ ## <a name="local-simulator">๐Ÿงช Local simulator</a>
127
106
 
128
- # Run Vitest
129
- pnpm test
130
- 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.
131
109
 
132
- # Run typecheck
133
- 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) |
113
+ | Inbound API | N/A |
134
114
 
135
- # Refresh API parity fixtures
136
- pnpm parity:fixtures
115
+ > [!IMPORTANT]
116
+ > The simulator approximates the MailChannels service for local development and testing. It is not a production implementation and may differ from the live service.
137
117
 
138
- # Run the local Email API simulator
139
- pnpm simulate:email-api
118
+ ### Start the simulator
140
119
 
141
- # Release new version
142
- pnpm release
120
+ ```sh
121
+ # default: http://127.0.0.1:8787
122
+ npx mailchannels-sdk simulate
143
123
  ```
144
124
 
145
- </details>
125
+ ### Options
146
126
 
147
- ## <a name="local-simulator">๐Ÿงช Local simulator</a>
127
+ | Option | Description | Default |
128
+ | ----------------- | ----------------------- | ----------- |
129
+ | `--port <number>` | Port to listen on | `8787` |
130
+ | `--host <host>` | Host address | `127.0.0.1` |
131
+ | `--silent` | Suppress simulator logs | `false` |
148
132
 
149
- 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.
150
-
151
- ### Start the simulator
133
+ You can override the bind address with the `--host` and `--port` options:
152
134
 
153
135
  ```sh
154
- # default: http://127.0.0.1:8787
155
- pnpm simulate:email-api
136
+ npx mailchannels-sdk simulate --host 127.0.0.1 --port 8787
156
137
  ```
157
138
 
158
- You can override the bind address with environment variables:
139
+ Disable logs with the `--silent` option:
159
140
 
160
141
  ```sh
161
- MAILCHANNELS_SIMULATOR_HOST=127.0.0.1 MAILCHANNELS_SIMULATOR_PORT=8787 pnpm simulate:email-api
142
+ npx mailchannels-sdk simulate --silent
162
143
  ```
163
144
 
164
145
  ### Point the SDK at the simulator
@@ -197,6 +178,45 @@ const { data, error } = await mailchannels.emails.send({
197
178
  - Webhook responses are simulated locally, but the simulator does not yet emit real webhook callbacks to your application
198
179
 
199
180
  The next planned expansion is outbound webhook delivery so client applications can test webhook ingestion flows against the simulator as well.
181
+ <!-- #endregion simulator -->
182
+
183
+ ## <a name="license">โš–๏ธ License</a>
184
+
185
+ [MIT License](LICENSE)
186
+
187
+ ## <a name="development">๐Ÿ’ป Development</a>
188
+
189
+ <details>
190
+ <summary>Local development</summary>
191
+
192
+ ```sh
193
+ # Install dependencies
194
+ pnpm install
195
+
196
+ # Build the package
197
+ pnpm build
198
+
199
+ # Run Oxlint
200
+ pnpm lint
201
+
202
+ # Run Vitest
203
+ pnpm test
204
+ pnpm test:watch
205
+
206
+ # Run typecheck
207
+ pnpm test:types
208
+
209
+ # Refresh API parity fixtures
210
+ pnpm parity:fixtures
211
+
212
+ # Run the local simulator
213
+ pnpm simulate
214
+
215
+ # Release new version
216
+ pnpm release
217
+ ```
218
+
219
+ </details>
200
220
 
201
221
  <!-- Badges -->
202
222
  [npm-version-src]: https://img.shields.io/npm/v/mailchannels-sdk.svg?style=flat&colorA=070a30&colorB=35a047