notideus 0.1.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/LICENSE +21 -0
- package/README.md +171 -0
- package/dist/index.cjs +301 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +242 -0
- package/dist/index.d.ts +242 -0
- package/dist/index.js +273 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Notideus
|
|
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,171 @@
|
|
|
1
|
+
# notideus
|
|
2
|
+
|
|
3
|
+
Official Node.js SDK for the [Notideus](https://notideus.io) email API.
|
|
4
|
+
|
|
5
|
+
Zero runtime dependencies. Requires Node.js 18+ (global `fetch`). Ships ESM
|
|
6
|
+
and CommonJS builds with TypeScript declarations.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install notideus
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quickstart
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Notideus } from 'notideus';
|
|
18
|
+
|
|
19
|
+
const notideus = new Notideus(process.env.NOTIDEUS_API_KEY);
|
|
20
|
+
|
|
21
|
+
const email = await notideus.emails.send({
|
|
22
|
+
from: 'Acme Inc <noreply@acme.com>',
|
|
23
|
+
to: ['jane@example.com'],
|
|
24
|
+
subject: 'Welcome',
|
|
25
|
+
html: '<p>Hi {{name}}</p>',
|
|
26
|
+
variables: { name: 'Jane' },
|
|
27
|
+
tags: ['welcome'],
|
|
28
|
+
idempotency_key: 'req-123'
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Configuration
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
new Notideus(apiKey?, {
|
|
36
|
+
baseURL?, // default https://api.notideus.io — override for self-hosting
|
|
37
|
+
timeout?, // request timeout ms, default 30000
|
|
38
|
+
maxRetries? // default 2 — see Retry below
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The key is optional: `plans` and `unsubscribe` work without one. Calling an
|
|
43
|
+
authenticated resource without a key surfaces the API's 401 as a
|
|
44
|
+
`NotideusError`.
|
|
45
|
+
|
|
46
|
+
## Resources
|
|
47
|
+
|
|
48
|
+
Params and responses use snake_case exactly like the API. Payloads from the
|
|
49
|
+
[API reference](https://notideus.io/docs) work verbatim.
|
|
50
|
+
|
|
51
|
+
### Emails
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
await notideus.emails.send({ from, to, subject, html?, text?, template_id?, variables?, tags?, headers?, reply_to?, idempotency_key? });
|
|
55
|
+
await notideus.emails.sendBatch([{ /* same shape */ }, …]); // up to 100
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### WhatsApp messages
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
await notideus.whatsapp.messages.send({ template_id, to: ['+33612345678'], parameters: { 'body:1': 'Jane' } });
|
|
62
|
+
await notideus.whatsapp.messages.sendBatch([…]);
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`send` returns one entry per recipient: `[{ id, to, status }]`.
|
|
66
|
+
|
|
67
|
+
### Contacts
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
await notideus.contacts.create({ email, properties?, topic_ids? });
|
|
71
|
+
await notideus.contacts.get('jane@example.com');
|
|
72
|
+
await notideus.contacts.update('jane@example.com', { properties: { plan: 'pro' } });
|
|
73
|
+
await notideus.contacts.delete('jane@example.com');
|
|
74
|
+
await notideus.contacts.unsubscribe('jane@example.com');
|
|
75
|
+
await notideus.contacts.resubscribe('jane@example.com');
|
|
76
|
+
await notideus.contacts.bulk([{ email, properties? }, …]); // up to 1000
|
|
77
|
+
|
|
78
|
+
const page = await notideus.contacts.list({ limit: 100, status: 'subscribed' });
|
|
79
|
+
if (page.next_cursor) {
|
|
80
|
+
const next = await notideus.contacts.list({ cursor: page.next_cursor });
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Hosted unsubscribe (token-based, unauthenticated)
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const info = await notideus.unsubscribe.info(token);
|
|
88
|
+
await notideus.unsubscribe.unsubscribe(token); // whole contact
|
|
89
|
+
await notideus.unsubscribe.unsubscribe(token, [topicId]); // specific topics
|
|
90
|
+
await notideus.unsubscribe.preferences(token, [topicId]); // desired subscribed set
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Plans (unauthenticated)
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
const catalog = await notideus.plans.list({ locale: 'fr' });
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Error handling
|
|
100
|
+
|
|
101
|
+
Request-level failures throw `NotideusError`:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { NotideusError } from 'notideus';
|
|
105
|
+
|
|
106
|
+
try {
|
|
107
|
+
await notideus.emails.send({…});
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (err instanceof NotideusError && err.code === 'from_domain_not_verified') { … }
|
|
110
|
+
if (err instanceof NotideusError && err.code === 'rate_limited') {
|
|
111
|
+
// err.retryAfter = seconds to wait
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Batch sends never throw per item — inspect the results instead:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
const results = await notideus.emails.sendBatch([…]);
|
|
120
|
+
for (const item of results) {
|
|
121
|
+
if ('error' in item) console.error(item.index, item.error.code, item.error.message);
|
|
122
|
+
else console.log(item.index, item.id);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
A whole-batch failure (401, 402 `quota_exceeded`, 400 `batch_too_large`)
|
|
127
|
+
still throws.
|
|
128
|
+
|
|
129
|
+
## Retry behavior
|
|
130
|
+
|
|
131
|
+
The SDK retries network errors, 5xx and 429 (honoring `Retry-After`) with
|
|
132
|
+
exponential backoff — but only idempotent requests: reads/writes other than
|
|
133
|
+
POST, and sends that include an `idempotency_key` (matching the API's replay
|
|
134
|
+
semantics, so a retried send never double-sends). Set `maxRetries: 0` to
|
|
135
|
+
disable.
|
|
136
|
+
|
|
137
|
+
## Self-hosting / local development
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
const notideus = new Notideus(process.env.NOTIDEUS_API_KEY, {
|
|
141
|
+
baseURL: 'http://localhost:8080'
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npm install
|
|
149
|
+
npm run build # dual ESM/CJS + d.ts to dist/
|
|
150
|
+
npm test # vitest, mocked fetch — no infra needed
|
|
151
|
+
npm run typecheck
|
|
152
|
+
npm run lint
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Releasing
|
|
156
|
+
|
|
157
|
+
1. Update `version` in `package.json` and merge to `main`.
|
|
158
|
+
2. Create a GitHub Release with tag `v<version>` — it must match `package.json`, the workflow verifies this and fails otherwise.
|
|
159
|
+
3. The `publish` workflow runs the full gate (`npm ci`, typecheck, lint, test, build) and then **publishes directly to npm via OIDC trusted publishing** — no tokens or secrets. npm exchanges a short-lived OIDC token minted by GitHub Actions, bound to this repo's `publish.yml`.
|
|
160
|
+
4. Publishes carry `--provenance`, which gives the package npm's **Verified Source** checkmark.
|
|
161
|
+
|
|
162
|
+
**One-time setup** (after the first manual publish, since the package must
|
|
163
|
+
exist on the registry): run locally, logged into npm:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm trust github notideus --repo notideus/sdk-node --file publish.yml --allow-publish
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The very first release (`0.1.0`) is published manually once (`npm publish`,
|
|
170
|
+
with your 2FA), then the trust binding is created, then all subsequent
|
|
171
|
+
releases are fully automatic.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
Notideus: () => Notideus,
|
|
24
|
+
NotideusError: () => NotideusError
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/errors.ts
|
|
29
|
+
var NotideusError = class extends Error {
|
|
30
|
+
code;
|
|
31
|
+
status;
|
|
32
|
+
retryAfter;
|
|
33
|
+
constructor(options) {
|
|
34
|
+
super(options.message);
|
|
35
|
+
this.name = "NotideusError";
|
|
36
|
+
this.code = options.code;
|
|
37
|
+
this.status = options.status;
|
|
38
|
+
this.retryAfter = options.retryAfter;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// src/client.ts
|
|
43
|
+
var DEFAULT_BASE_URL = "https://api.notideus.io";
|
|
44
|
+
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
45
|
+
var VERSION = "0.1.0";
|
|
46
|
+
var ApiClient = class {
|
|
47
|
+
apiKey;
|
|
48
|
+
baseURL;
|
|
49
|
+
timeout;
|
|
50
|
+
maxRetries;
|
|
51
|
+
sleep;
|
|
52
|
+
constructor(options = {}) {
|
|
53
|
+
this.apiKey = options.apiKey;
|
|
54
|
+
this.baseURL = options.baseURL ?? DEFAULT_BASE_URL;
|
|
55
|
+
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
56
|
+
this.maxRetries = options.maxRetries ?? 2;
|
|
57
|
+
this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
58
|
+
}
|
|
59
|
+
async request(method, path, options = {}) {
|
|
60
|
+
const idempotent = method !== "POST" || hasIdempotencyKey(options.body);
|
|
61
|
+
let attempt = 0;
|
|
62
|
+
for (; ; ) {
|
|
63
|
+
try {
|
|
64
|
+
return await this.attempt(method, path, options);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
if (!idempotent || !isRetriable(err) || attempt >= this.maxRetries) {
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
await this.sleep(this.delayMs(err, attempt));
|
|
70
|
+
attempt += 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
delayMs(err, attempt) {
|
|
75
|
+
if (err instanceof NotideusError && err.retryAfter != null) {
|
|
76
|
+
return err.retryAfter * 1e3;
|
|
77
|
+
}
|
|
78
|
+
return Math.min(1e3 * 2 ** attempt, 8e3) + Math.floor(Math.random() * 250);
|
|
79
|
+
}
|
|
80
|
+
async attempt(method, path, options) {
|
|
81
|
+
const url = this.buildUrl(path, options.query);
|
|
82
|
+
const headers = {
|
|
83
|
+
"User-Agent": `notideus-node/${VERSION}`
|
|
84
|
+
};
|
|
85
|
+
if (options.authenticated !== false && this.apiKey) {
|
|
86
|
+
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
87
|
+
}
|
|
88
|
+
let body;
|
|
89
|
+
if (options.body !== void 0) {
|
|
90
|
+
headers["Content-Type"] = "application/json";
|
|
91
|
+
body = JSON.stringify(options.body);
|
|
92
|
+
}
|
|
93
|
+
const controller = new AbortController();
|
|
94
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
95
|
+
const onCallerAbort = () => controller.abort();
|
|
96
|
+
if (options.signal) {
|
|
97
|
+
if (options.signal.aborted) controller.abort();
|
|
98
|
+
else options.signal.addEventListener("abort", onCallerAbort, { once: true });
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const response = await fetch(url, { method, headers, body, signal: controller.signal });
|
|
102
|
+
if (response.status === 204) return void 0;
|
|
103
|
+
if (!response.ok) throw await this.toError(response);
|
|
104
|
+
return await response.json();
|
|
105
|
+
} catch (err) {
|
|
106
|
+
if (err instanceof NotideusError) throw err;
|
|
107
|
+
if (options.signal?.aborted) throw err;
|
|
108
|
+
throw new NotideusError({
|
|
109
|
+
code: controller.signal.aborted ? "request_timeout" : "network_error",
|
|
110
|
+
message: err instanceof Error ? err.message : String(err),
|
|
111
|
+
status: 0
|
|
112
|
+
});
|
|
113
|
+
} finally {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
options.signal?.removeEventListener("abort", onCallerAbort);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
buildUrl(path, query) {
|
|
119
|
+
const url = new URL(path, this.baseURL);
|
|
120
|
+
if (query) {
|
|
121
|
+
for (const [key, value] of Object.entries(query)) {
|
|
122
|
+
if (value !== void 0) url.searchParams.set(key, String(value));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return url.toString();
|
|
126
|
+
}
|
|
127
|
+
async toError(response) {
|
|
128
|
+
let code = "unknown_error";
|
|
129
|
+
let message = response.statusText || `HTTP ${response.status}`;
|
|
130
|
+
try {
|
|
131
|
+
const parsed = await response.json();
|
|
132
|
+
if (parsed.error?.code) code = parsed.error.code;
|
|
133
|
+
if (parsed.error?.message) message = parsed.error.message;
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
const retryAfterHeader = response.headers.get("retry-after");
|
|
137
|
+
return new NotideusError({
|
|
138
|
+
code,
|
|
139
|
+
message,
|
|
140
|
+
status: response.status,
|
|
141
|
+
retryAfter: retryAfterHeader ? Number(retryAfterHeader) : void 0
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
function hasIdempotencyKey(body) {
|
|
146
|
+
return typeof body === "object" && body !== null && body.idempotency_key != null;
|
|
147
|
+
}
|
|
148
|
+
function isRetriable(err) {
|
|
149
|
+
if (!(err instanceof NotideusError)) return false;
|
|
150
|
+
if (err.code === "network_error" || err.code === "request_timeout") return true;
|
|
151
|
+
return err.status === 429 || err.status >= 500;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// src/resources/contacts.ts
|
|
155
|
+
function contactPath(email) {
|
|
156
|
+
return `/v1/contacts/${encodeURIComponent(email)}`;
|
|
157
|
+
}
|
|
158
|
+
var ContactsResource = class {
|
|
159
|
+
constructor(client) {
|
|
160
|
+
this.client = client;
|
|
161
|
+
}
|
|
162
|
+
client;
|
|
163
|
+
async list(params = {}) {
|
|
164
|
+
const { limit, status, email, cursor } = params;
|
|
165
|
+
return this.client.request("GET", "/v1/contacts", {
|
|
166
|
+
query: { limit, status, email, cursor }
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
async create(params) {
|
|
170
|
+
return this.client.request("POST", "/v1/contacts", { body: params });
|
|
171
|
+
}
|
|
172
|
+
async get(email) {
|
|
173
|
+
return this.client.request("GET", contactPath(email));
|
|
174
|
+
}
|
|
175
|
+
async update(email, params) {
|
|
176
|
+
return this.client.request("PATCH", contactPath(email), { body: params });
|
|
177
|
+
}
|
|
178
|
+
async delete(email) {
|
|
179
|
+
await this.client.request("DELETE", contactPath(email));
|
|
180
|
+
}
|
|
181
|
+
async bulk(contacts) {
|
|
182
|
+
const res = await this.client.request("POST", "/v1/contacts/bulk", {
|
|
183
|
+
body: { contacts }
|
|
184
|
+
});
|
|
185
|
+
return res.data;
|
|
186
|
+
}
|
|
187
|
+
async unsubscribe(email) {
|
|
188
|
+
return this.client.request("POST", `${contactPath(email)}/unsubscribe`);
|
|
189
|
+
}
|
|
190
|
+
async resubscribe(email) {
|
|
191
|
+
return this.client.request("POST", `${contactPath(email)}/resubscribe`);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// src/resources/emails.ts
|
|
196
|
+
var EmailsResource = class {
|
|
197
|
+
constructor(client) {
|
|
198
|
+
this.client = client;
|
|
199
|
+
}
|
|
200
|
+
client;
|
|
201
|
+
async send(params) {
|
|
202
|
+
return this.client.request("POST", "/v1/emails", { body: params });
|
|
203
|
+
}
|
|
204
|
+
async sendBatch(emails) {
|
|
205
|
+
const res = await this.client.request("POST", "/v1/emails/batch", {
|
|
206
|
+
body: { emails }
|
|
207
|
+
});
|
|
208
|
+
return res.data;
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/resources/plans.ts
|
|
213
|
+
var PlansResource = class {
|
|
214
|
+
constructor(client) {
|
|
215
|
+
this.client = client;
|
|
216
|
+
}
|
|
217
|
+
client;
|
|
218
|
+
async list(params = {}) {
|
|
219
|
+
return this.client.request("GET", "/v1/plans", {
|
|
220
|
+
query: { locale: params.locale },
|
|
221
|
+
authenticated: false
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/resources/unsubscribe.ts
|
|
227
|
+
var UnsubscribeResource = class {
|
|
228
|
+
constructor(client) {
|
|
229
|
+
this.client = client;
|
|
230
|
+
}
|
|
231
|
+
client;
|
|
232
|
+
async info(token) {
|
|
233
|
+
return this.client.request("GET", "/v1/unsubscribe/info", {
|
|
234
|
+
query: { t: token },
|
|
235
|
+
authenticated: false
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async unsubscribe(token, topicIds) {
|
|
239
|
+
const body = { token };
|
|
240
|
+
if (topicIds !== void 0) {
|
|
241
|
+
body.topic_ids = topicIds;
|
|
242
|
+
}
|
|
243
|
+
await this.client.request("POST", "/v1/unsubscribe", { body, authenticated: false });
|
|
244
|
+
}
|
|
245
|
+
async preferences(token, topicIds) {
|
|
246
|
+
await this.client.request("POST", "/v1/unsubscribe/preferences", {
|
|
247
|
+
body: { token, topic_ids: topicIds },
|
|
248
|
+
authenticated: false
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// src/resources/whatsapp.ts
|
|
254
|
+
var WhatsAppResource = class {
|
|
255
|
+
messages;
|
|
256
|
+
constructor(client) {
|
|
257
|
+
this.messages = new WhatsAppMessagesResource(client);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
var WhatsAppMessagesResource = class {
|
|
261
|
+
constructor(client) {
|
|
262
|
+
this.client = client;
|
|
263
|
+
}
|
|
264
|
+
client;
|
|
265
|
+
async send(params) {
|
|
266
|
+
const res = await this.client.request("POST", "/v1/whatsapp/messages", {
|
|
267
|
+
body: params
|
|
268
|
+
});
|
|
269
|
+
return res.data;
|
|
270
|
+
}
|
|
271
|
+
async sendBatch(messages) {
|
|
272
|
+
const res = await this.client.request("POST", "/v1/whatsapp/messages/batch", {
|
|
273
|
+
body: { messages }
|
|
274
|
+
});
|
|
275
|
+
return res.data;
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// src/index.ts
|
|
280
|
+
var Notideus = class {
|
|
281
|
+
client;
|
|
282
|
+
emails;
|
|
283
|
+
contacts;
|
|
284
|
+
whatsapp;
|
|
285
|
+
unsubscribe;
|
|
286
|
+
plans;
|
|
287
|
+
constructor(apiKey, options = {}) {
|
|
288
|
+
this.client = new ApiClient({ ...options, apiKey });
|
|
289
|
+
this.emails = new EmailsResource(this.client);
|
|
290
|
+
this.contacts = new ContactsResource(this.client);
|
|
291
|
+
this.whatsapp = new WhatsAppResource(this.client);
|
|
292
|
+
this.unsubscribe = new UnsubscribeResource(this.client);
|
|
293
|
+
this.plans = new PlansResource(this.client);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
297
|
+
0 && (module.exports = {
|
|
298
|
+
Notideus,
|
|
299
|
+
NotideusError
|
|
300
|
+
});
|
|
301
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/client.ts","../src/resources/contacts.ts","../src/resources/emails.ts","../src/resources/plans.ts","../src/resources/unsubscribe.ts","../src/resources/whatsapp.ts"],"sourcesContent":["import { ApiClient, type ClientOptions } from './client.js';\nimport { ContactsResource } from './resources/contacts.js';\nimport { EmailsResource } from './resources/emails.js';\nimport { PlansResource } from './resources/plans.js';\nimport { UnsubscribeResource } from './resources/unsubscribe.js';\nimport { WhatsAppResource } from './resources/whatsapp.js';\n\nexport { NotideusError } from './errors.js';\nexport type { ClientOptions } from './client.js';\nexport type { BatchItemError, BatchItemResult } from './types/common.js';\nexport type {\n BulkContactInput,\n Contact,\n ContactStatus,\n CreateContactParams,\n ListContactsParams,\n ListContactsResponse,\n UpdateContactParams\n} from './types/contact.js';\nexport type { Email, SendEmailParams } from './types/email.js';\nexport type {\n ContactsTier,\n FreeAllowances,\n Plan,\n PlanCatalog,\n PlanLocale,\n PlanTier\n} from './types/plans.js';\nexport type { SendWhatsAppMessageParams, WhatsAppMessage } from './types/whatsapp.js';\nexport type { UnsubscribeInfo, UnsubscribeTopic } from './types/unsubscribe.js';\n\nexport class Notideus {\n private readonly client: ApiClient;\n readonly emails: EmailsResource;\n readonly contacts: ContactsResource;\n readonly whatsapp: WhatsAppResource;\n readonly unsubscribe: UnsubscribeResource;\n readonly plans: PlansResource;\n\n constructor(apiKey?: string, options: Omit<ClientOptions, 'apiKey'> = {}) {\n this.client = new ApiClient({ ...options, apiKey });\n this.emails = new EmailsResource(this.client);\n this.contacts = new ContactsResource(this.client);\n this.whatsapp = new WhatsAppResource(this.client);\n this.unsubscribe = new UnsubscribeResource(this.client);\n this.plans = new PlansResource(this.client);\n }\n}\n","export interface NotideusErrorOptions {\n code: string;\n message: string;\n status: number;\n retryAfter?: number;\n}\n\nexport class NotideusError extends Error {\n readonly code: string;\n readonly status: number;\n readonly retryAfter?: number;\n\n constructor(options: NotideusErrorOptions) {\n super(options.message);\n this.name = 'NotideusError';\n this.code = options.code;\n this.status = options.status;\n this.retryAfter = options.retryAfter;\n }\n}\n","import { NotideusError } from './errors.js';\n\nconst DEFAULT_BASE_URL = 'https://api.notideus.io';\nconst DEFAULT_TIMEOUT_MS = 30_000;\nconst VERSION = '0.1.0';\n\nexport interface ClientOptions {\n apiKey?: string;\n baseURL?: string;\n timeout?: number;\n maxRetries?: number;\n sleep?: (ms: number) => Promise<void>;\n}\n\nexport interface RequestOptions {\n query?: Record<string, string | number | undefined>;\n body?: unknown;\n authenticated?: boolean;\n signal?: AbortSignal;\n}\n\nexport class ApiClient {\n private readonly apiKey?: string;\n private readonly baseURL: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly sleep: (ms: number) => Promise<void>;\n\n constructor(options: ClientOptions = {}) {\n this.apiKey = options.apiKey;\n this.baseURL = options.baseURL ?? DEFAULT_BASE_URL;\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;\n this.maxRetries = options.maxRetries ?? 2;\n this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));\n }\n\n async request<T>(method: string, path: string, options: RequestOptions = {}): Promise<T> {\n const idempotent = method !== 'POST' || hasIdempotencyKey(options.body);\n let attempt = 0;\n for (;;) {\n try {\n return await this.attempt<T>(method, path, options);\n } catch (err) {\n if (!idempotent || !isRetriable(err) || attempt >= this.maxRetries) {\n throw err;\n }\n await this.sleep(this.delayMs(err, attempt));\n attempt += 1;\n }\n }\n }\n\n private delayMs(err: unknown, attempt: number): number {\n if (err instanceof NotideusError && err.retryAfter != null) {\n return err.retryAfter * 1000;\n }\n return Math.min(1000 * 2 ** attempt, 8000) + Math.floor(Math.random() * 250);\n }\n\n private async attempt<T>(method: string, path: string, options: RequestOptions): Promise<T> {\n const url = this.buildUrl(path, options.query);\n const headers: Record<string, string> = {\n 'User-Agent': `notideus-node/${VERSION}`\n };\n if (options.authenticated !== false && this.apiKey) {\n headers.Authorization = `Bearer ${this.apiKey}`;\n }\n let body: string | undefined;\n if (options.body !== undefined) {\n headers['Content-Type'] = 'application/json';\n body = JSON.stringify(options.body);\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n const onCallerAbort = () => controller.abort();\n if (options.signal) {\n if (options.signal.aborted) controller.abort();\n else options.signal.addEventListener('abort', onCallerAbort, { once: true });\n }\n\n try {\n const response = await fetch(url, { method, headers, body, signal: controller.signal });\n if (response.status === 204) return undefined as T;\n if (!response.ok) throw await this.toError(response);\n return (await response.json()) as T;\n } catch (err) {\n if (err instanceof NotideusError) throw err;\n if (options.signal?.aborted) throw err;\n throw new NotideusError({\n code: controller.signal.aborted ? 'request_timeout' : 'network_error',\n message: err instanceof Error ? err.message : String(err),\n status: 0\n });\n } finally {\n clearTimeout(timer);\n options.signal?.removeEventListener('abort', onCallerAbort);\n }\n }\n\n private buildUrl(path: string, query?: RequestOptions['query']): string {\n const url = new URL(path, this.baseURL);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) url.searchParams.set(key, String(value));\n }\n }\n return url.toString();\n }\n\n private async toError(response: Response): Promise<NotideusError> {\n let code = 'unknown_error';\n let message = response.statusText || `HTTP ${response.status}`;\n try {\n const parsed = (await response.json()) as { error?: { code?: string; message?: string } };\n if (parsed.error?.code) code = parsed.error.code;\n if (parsed.error?.message) message = parsed.error.message;\n } catch {\n // non-JSON error body — keep the defaults\n }\n const retryAfterHeader = response.headers.get('retry-after');\n return new NotideusError({\n code,\n message,\n status: response.status,\n retryAfter: retryAfterHeader ? Number(retryAfterHeader) : undefined\n });\n }\n}\n\nfunction hasIdempotencyKey(body: unknown): boolean {\n return (\n typeof body === 'object' &&\n body !== null &&\n (body as Record<string, unknown>).idempotency_key != null\n );\n}\n\nfunction isRetriable(err: unknown): boolean {\n if (!(err instanceof NotideusError)) return false;\n if (err.code === 'network_error' || err.code === 'request_timeout') return true;\n return err.status === 429 || err.status >= 500;\n}\n","import type { ApiClient } from '../client.js';\nimport type { BatchItemResult } from '../types/common.js';\nimport type {\n BulkContactInput,\n Contact,\n CreateContactParams,\n ListContactsParams,\n ListContactsResponse,\n UpdateContactParams\n} from '../types/contact.js';\n\nfunction contactPath(email: string): string {\n return `/v1/contacts/${encodeURIComponent(email)}`;\n}\n\nexport class ContactsResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: ListContactsParams = {}): Promise<ListContactsResponse> {\n const { limit, status, email, cursor } = params;\n return this.client.request<ListContactsResponse>('GET', '/v1/contacts', {\n query: { limit, status, email, cursor }\n });\n }\n\n async create(params: CreateContactParams): Promise<Contact> {\n return this.client.request<Contact>('POST', '/v1/contacts', { body: params });\n }\n\n async get(email: string): Promise<Contact> {\n return this.client.request<Contact>('GET', contactPath(email));\n }\n\n async update(email: string, params: UpdateContactParams): Promise<Contact> {\n return this.client.request<Contact>('PATCH', contactPath(email), { body: params });\n }\n\n async delete(email: string): Promise<void> {\n await this.client.request<void>('DELETE', contactPath(email));\n }\n\n async bulk(contacts: BulkContactInput[]): Promise<BatchItemResult[]> {\n const res = await this.client.request<{ data: BatchItemResult[] }>('POST', '/v1/contacts/bulk', {\n body: { contacts }\n });\n return res.data;\n }\n\n async unsubscribe(email: string): Promise<Contact> {\n return this.client.request<Contact>('POST', `${contactPath(email)}/unsubscribe`);\n }\n\n async resubscribe(email: string): Promise<Contact> {\n return this.client.request<Contact>('POST', `${contactPath(email)}/resubscribe`);\n }\n}\n","import type { ApiClient } from '../client.js';\nimport type { BatchItemResult } from '../types/common.js';\nimport type { Email, SendEmailParams } from '../types/email.js';\n\nexport class EmailsResource {\n constructor(private readonly client: ApiClient) {}\n\n async send(params: SendEmailParams): Promise<Email> {\n return this.client.request<Email>('POST', '/v1/emails', { body: params });\n }\n\n async sendBatch(emails: SendEmailParams[]): Promise<BatchItemResult[]> {\n const res = await this.client.request<{ data: BatchItemResult[] }>('POST', '/v1/emails/batch', {\n body: { emails }\n });\n return res.data;\n }\n}\n","import type { ApiClient } from '../client.js';\nimport type { PlanCatalog, PlanLocale } from '../types/plans.js';\n\nexport class PlansResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: { locale?: PlanLocale } = {}): Promise<PlanCatalog> {\n return this.client.request<PlanCatalog>('GET', '/v1/plans', {\n query: { locale: params.locale },\n authenticated: false\n });\n }\n}\n","import type { ApiClient } from '../client.js';\nimport type { UnsubscribeInfo } from '../types/unsubscribe.js';\n\nexport class UnsubscribeResource {\n constructor(private readonly client: ApiClient) {}\n\n async info(token: string): Promise<UnsubscribeInfo> {\n return this.client.request<UnsubscribeInfo>('GET', '/v1/unsubscribe/info', {\n query: { t: token },\n authenticated: false\n });\n }\n\n async unsubscribe(token: string, topicIds?: string[]): Promise<void> {\n const body: Record<string, unknown> = { token };\n if (topicIds !== undefined) {\n body.topic_ids = topicIds;\n }\n await this.client.request<void>('POST', '/v1/unsubscribe', { body, authenticated: false });\n }\n\n async preferences(token: string, topicIds: string[]): Promise<void> {\n await this.client.request<void>('POST', '/v1/unsubscribe/preferences', {\n body: { token, topic_ids: topicIds },\n authenticated: false\n });\n }\n}\n","import type { ApiClient } from '../client.js';\nimport type { BatchItemResult } from '../types/common.js';\nimport type { SendWhatsAppMessageParams, WhatsAppMessage } from '../types/whatsapp.js';\n\nexport class WhatsAppResource {\n readonly messages: WhatsAppMessagesResource;\n\n constructor(client: ApiClient) {\n this.messages = new WhatsAppMessagesResource(client);\n }\n}\n\nexport class WhatsAppMessagesResource {\n constructor(private readonly client: ApiClient) {}\n\n async send(params: SendWhatsAppMessageParams): Promise<WhatsAppMessage[]> {\n const res = await this.client.request<{ data: WhatsAppMessage[] }>('POST', '/v1/whatsapp/messages', {\n body: params\n });\n return res.data;\n }\n\n async sendBatch(messages: SendWhatsAppMessageParams[]): Promise<BatchItemResult[]> {\n const res = await this.client.request<{ data: BatchItemResult[] }>('POST', '/v1/whatsapp/messages/batch', {\n body: { messages }\n });\n return res.data;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;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