notideus 1.0.0 → 1.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/README.md CHANGED
@@ -81,6 +81,26 @@ if (page.next_cursor) {
81
81
  }
82
82
  ```
83
83
 
84
+ ### Webhooks
85
+
86
+ ```ts
87
+ const created = await notideus.webhooks.create({ name: 'Production API', url: 'https://example.com/hook', events: ['email.delivered'] });
88
+ console.log(created.secret); // whsec_… — shown once
89
+ await notideus.webhooks.update(created.endpoint.id, { name: 'Production API', url: 'https://example.com/hook', events: ['email.delivered'], status: 'disabled' });
90
+ const log = await notideus.webhooks.deliveries.list({ endpoint_id: created.endpoint.id });
91
+ await notideus.webhooks.deliveries.redeliver(log.data[0].id);
92
+ const events = await notideus.webhooks.events();
93
+ ```
94
+
95
+ ### Inbound email
96
+
97
+ ```ts
98
+ const routes = await notideus.inbound.routes.list(); // { data, meta }
99
+ await notideus.inbound.routes.create({ domain_id, recipient: 'support', store: true });
100
+ const inbox = await notideus.inbound.messages.list({ q: 'billing' });
101
+ const raw = await notideus.inbound.messages.raw(inbox.data[0].id); // { data, contentType, filename }
102
+ ```
103
+
84
104
  ### Hosted unsubscribe (token-based, unauthenticated)
85
105
 
86
106
  ```ts
package/dist/index.cjs CHANGED
@@ -71,6 +71,44 @@ var ApiClient = class {
71
71
  }
72
72
  }
73
73
  }
74
+ // requestBinary downloads a binary endpoint (raw MIME, attachments). Auth
75
+ // headers are attached like request(); non-2xx responses raise NotideusError
76
+ // with the standard envelope. No retries — callers can re-invoke.
77
+ async requestBinary(path, options = {}) {
78
+ const headers = {
79
+ "User-Agent": `notideus-node/${VERSION}`
80
+ };
81
+ if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;
82
+ const controller = new AbortController();
83
+ const timer = setTimeout(() => controller.abort(), this.timeout);
84
+ const onCallerAbort = () => controller.abort();
85
+ if (options.signal) {
86
+ if (options.signal.aborted) controller.abort();
87
+ else options.signal.addEventListener("abort", onCallerAbort, { once: true });
88
+ }
89
+ try {
90
+ const res = await fetch(new URL(path, this.baseURL), { headers, signal: controller.signal });
91
+ if (!res.ok) throw await this.toError(res);
92
+ const disposition = res.headers.get("content-disposition") ?? "";
93
+ const match = CONTENT_DISPOSITION_FILENAME.exec(disposition);
94
+ return {
95
+ data: new Uint8Array(await res.arrayBuffer()),
96
+ contentType: res.headers.get("content-type") ?? "application/octet-stream",
97
+ filename: match ? match[1] : null
98
+ };
99
+ } catch (err) {
100
+ if (err instanceof NotideusError) throw err;
101
+ if (options.signal?.aborted) throw err;
102
+ throw new NotideusError({
103
+ code: controller.signal.aborted ? "request_timeout" : "network_error",
104
+ message: err instanceof Error ? err.message : String(err),
105
+ status: 0
106
+ });
107
+ } finally {
108
+ clearTimeout(timer);
109
+ options.signal?.removeEventListener("abort", onCallerAbort);
110
+ }
111
+ }
74
112
  delayMs(err, attempt) {
75
113
  if (err instanceof NotideusError && err.retryAfter != null) {
76
114
  return err.retryAfter * 1e3;
@@ -142,6 +180,7 @@ var ApiClient = class {
142
180
  });
143
181
  }
144
182
  };
183
+ var CONTENT_DISPOSITION_FILENAME = /filename="?([^";]+)"?/;
145
184
  function hasIdempotencyKey(body) {
146
185
  return typeof body === "object" && body !== null && body.idempotency_key != null;
147
186
  }
@@ -209,6 +248,68 @@ var EmailsResource = class {
209
248
  }
210
249
  };
211
250
 
251
+ // src/resources/inbound.ts
252
+ function routePath(id) {
253
+ return `/v1/inbound/routes/${encodeURIComponent(id)}`;
254
+ }
255
+ function messagePath(id) {
256
+ return `/v1/inbound/messages/${encodeURIComponent(id)}`;
257
+ }
258
+ var InboundRoutesResource = class {
259
+ constructor(client) {
260
+ this.client = client;
261
+ }
262
+ client;
263
+ async list() {
264
+ return this.client.request("GET", "/v1/inbound/routes");
265
+ }
266
+ async create(params) {
267
+ const res = await this.client.request("POST", "/v1/inbound/routes", { body: params });
268
+ return res.route;
269
+ }
270
+ async get(id) {
271
+ const res = await this.client.request("GET", routePath(id));
272
+ return res.route;
273
+ }
274
+ async update(id, params) {
275
+ const res = await this.client.request("PATCH", routePath(id), { body: params });
276
+ return res.route;
277
+ }
278
+ async delete(id) {
279
+ await this.client.request("DELETE", routePath(id));
280
+ }
281
+ };
282
+ var InboundMessagesResource = class {
283
+ constructor(client) {
284
+ this.client = client;
285
+ }
286
+ client;
287
+ async list(params = {}) {
288
+ const { q, route_id, cursor, limit } = params;
289
+ return this.client.request("GET", "/v1/inbound/messages", {
290
+ query: { q, route_id, cursor, limit }
291
+ });
292
+ }
293
+ async get(id) {
294
+ const res = await this.client.request("GET", messagePath(id));
295
+ return res.message;
296
+ }
297
+ async raw(id, options = {}) {
298
+ return this.client.requestBinary(`${messagePath(id)}/raw`, options);
299
+ }
300
+ async attachment(messageId, index, options = {}) {
301
+ return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);
302
+ }
303
+ };
304
+ var InboundResource = class {
305
+ routes;
306
+ messages;
307
+ constructor(client) {
308
+ this.routes = new InboundRoutesResource(client);
309
+ this.messages = new InboundMessagesResource(client);
310
+ }
311
+ };
312
+
212
313
  // src/resources/plans.ts
213
314
  var PlansResource = class {
214
315
  constructor(client) {
@@ -250,6 +351,73 @@ var UnsubscribeResource = class {
250
351
  }
251
352
  };
252
353
 
354
+ // src/resources/webhook-deliveries.ts
355
+ function deliveryPath(id) {
356
+ return `/v1/webhook-deliveries/${encodeURIComponent(id)}`;
357
+ }
358
+ var WebhookDeliveriesResource = class {
359
+ constructor(client) {
360
+ this.client = client;
361
+ }
362
+ client;
363
+ async list(params = {}) {
364
+ const { endpoint_id, event_type, status, cursor, limit } = params;
365
+ return this.client.request("GET", "/v1/webhook-deliveries", {
366
+ query: { endpoint_id, event_type, status, cursor, limit }
367
+ });
368
+ }
369
+ async get(id) {
370
+ return this.client.request("GET", deliveryPath(id));
371
+ }
372
+ async redeliver(id) {
373
+ const res = await this.client.request("POST", `${deliveryPath(id)}/redeliver`);
374
+ return res.delivery;
375
+ }
376
+ };
377
+
378
+ // src/resources/webhooks.ts
379
+ function webhookPath(id) {
380
+ return `/v1/webhooks/${encodeURIComponent(id)}`;
381
+ }
382
+ var WebhooksResource = class {
383
+ constructor(client) {
384
+ this.client = client;
385
+ this.deliveries = new WebhookDeliveriesResource(client);
386
+ }
387
+ client;
388
+ deliveries;
389
+ async list(params = {}) {
390
+ const { cursor, limit } = params;
391
+ return this.client.request("GET", "/v1/webhooks", { query: { cursor, limit } });
392
+ }
393
+ async create(params) {
394
+ return this.client.request("POST", "/v1/webhooks", { body: params });
395
+ }
396
+ async get(id) {
397
+ const res = await this.client.request("GET", webhookPath(id));
398
+ return res.endpoint;
399
+ }
400
+ async update(id, params) {
401
+ const res = await this.client.request("PATCH", webhookPath(id), { body: params });
402
+ return res.endpoint;
403
+ }
404
+ async delete(id) {
405
+ await this.client.request("DELETE", webhookPath(id));
406
+ }
407
+ async test(id, event) {
408
+ const res = await this.client.request(
409
+ "POST",
410
+ `${webhookPath(id)}/test`,
411
+ { body: event ? { event } : {} }
412
+ );
413
+ return res.delivery;
414
+ }
415
+ async events() {
416
+ const res = await this.client.request("GET", "/v1/webhooks/meta/events");
417
+ return res.data;
418
+ }
419
+ };
420
+
253
421
  // src/resources/whatsapp.ts
254
422
  var WhatsAppResource = class {
255
423
  messages;
@@ -284,6 +452,8 @@ var Notideus = class {
284
452
  whatsapp;
285
453
  unsubscribe;
286
454
  plans;
455
+ webhooks;
456
+ inbound;
287
457
  constructor(apiKey, options = {}) {
288
458
  this.client = new ApiClient({ ...options, apiKey });
289
459
  this.emails = new EmailsResource(this.client);
@@ -291,6 +461,8 @@ var Notideus = class {
291
461
  this.whatsapp = new WhatsAppResource(this.client);
292
462
  this.unsubscribe = new UnsubscribeResource(this.client);
293
463
  this.plans = new PlansResource(this.client);
464
+ this.webhooks = new WebhooksResource(this.client);
465
+ this.inbound = new InboundResource(this.client);
294
466
  }
295
467
  };
296
468
  // Annotate the CommonJS export names for ESM import in node:
@@ -1 +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;;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,EACrD;AACF;AAEO,IAAM,2BAAN,MAA+B;AAAA,EACpC,YAA6B,QAAmB;AAAnB;AAAA,EAAoB;AAAA,EAApB;AAAA,EAE7B,MAAM,KAAK,QAA+D;AACxE,UAAM,MAAM,MAAM,KAAK,OAAO,QAAqC,QAAQ,yBAAyB;AAAA,MAClG,MAAM;AAAA,IACR,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AAAA,EAEA,MAAM,UAAU,UAAmE;AACjF,UAAM,MAAM,MAAM,KAAK,OAAO,QAAqC,QAAQ,+BAA+B;AAAA,MACxG,MAAM,EAAE,SAAS;AAAA,IACnB,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AACF;;;APGO,IAAM,WAAN,MAAe;AAAA,EACH;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAiB,UAAyC,CAAC,GAAG;AACxE,SAAK,SAAS,IAAI,UAAU,EAAE,GAAG,SAAS,OAAO,CAAC;AAClD,SAAK,SAAS,IAAI,eAAe,KAAK,MAAM;AAC5C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,cAAc,IAAI,oBAAoB,KAAK,MAAM;AACtD,SAAK,QAAQ,IAAI,cAAc,KAAK,MAAM;AAAA,EAC5C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/client.ts","../src/resources/contacts.ts","../src/resources/emails.ts","../src/resources/inbound.ts","../src/resources/plans.ts","../src/resources/unsubscribe.ts","../src/resources/webhook-deliveries.ts","../src/resources/webhooks.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 { InboundResource } from './resources/inbound.js';\nimport { PlansResource } from './resources/plans.js';\nimport { UnsubscribeResource } from './resources/unsubscribe.js';\nimport { WebhooksResource } from './resources/webhooks.js';\nimport { WhatsAppResource } from './resources/whatsapp.js';\n\nexport { NotideusError } from './errors.js';\nexport type { BinaryResult, 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 CreateInboundRouteParams,\n InboundAttachment,\n InboundMessage,\n InboundMessageStatus,\n InboundRoute,\n InboundRouteStatus,\n ListInboundMessagesParams,\n ListInboundMessagesResponse,\n ListInboundRoutesResponse,\n UpdateInboundRouteParams\n} from './types/inbound.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';\nexport type {\n CreateWebhookParams,\n ListWebhookDeliveriesParams,\n ListWebhookDeliveriesResponse,\n ListWebhooksParams,\n ListWebhooksResponse,\n UpdateWebhookParams,\n WebhookAttempt,\n WebhookCreated,\n WebhookDelivery,\n WebhookDeliveryResult,\n WebhookDeliveryStatus,\n WebhookEndpoint,\n WebhookEndpointStatus,\n WebhookEventDescriptor\n} from './types/webhook.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 readonly webhooks: WebhooksResource;\n readonly inbound: InboundResource;\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 this.webhooks = new WebhooksResource(this.client);\n this.inbound = new InboundResource(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 interface BinaryResult {\n data: Uint8Array;\n contentType: string;\n filename: string | null;\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 // requestBinary downloads a binary endpoint (raw MIME, attachments). Auth\n // headers are attached like request(); non-2xx responses raise NotideusError\n // with the standard envelope. No retries — callers can re-invoke.\n async requestBinary(path: string, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n const headers: Record<string, string> = {\n 'User-Agent': `notideus-node/${VERSION}`\n };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\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 res = await fetch(new URL(path, this.baseURL), { headers, signal: controller.signal });\n if (!res.ok) throw await this.toError(res);\n const disposition = res.headers.get('content-disposition') ?? '';\n const match = CONTENT_DISPOSITION_FILENAME.exec(disposition);\n return {\n data: new Uint8Array(await res.arrayBuffer()),\n contentType: res.headers.get('content-type') ?? 'application/octet-stream',\n filename: match ? match[1] : null\n };\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 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\nconst CONTENT_DISPOSITION_FILENAME = /filename=\"?([^\";]+)\"?/;\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, BinaryResult } from '../client.js';\nimport type {\n CreateInboundRouteParams,\n InboundMessage,\n InboundRoute,\n ListInboundMessagesParams,\n ListInboundMessagesResponse,\n ListInboundRoutesResponse,\n UpdateInboundRouteParams\n} from '../types/inbound.js';\n\nfunction routePath(id: string): string {\n return `/v1/inbound/routes/${encodeURIComponent(id)}`;\n}\n\nfunction messagePath(id: string): string {\n return `/v1/inbound/messages/${encodeURIComponent(id)}`;\n}\n\nexport class InboundRoutesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(): Promise<ListInboundRoutesResponse> {\n return this.client.request<ListInboundRoutesResponse>('GET', '/v1/inbound/routes');\n }\n\n async create(params: CreateInboundRouteParams): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('POST', '/v1/inbound/routes', { body: params });\n return res.route;\n }\n\n async get(id: string): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('GET', routePath(id));\n return res.route;\n }\n\n async update(id: string, params: UpdateInboundRouteParams): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('PATCH', routePath(id), { body: params });\n return res.route;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', routePath(id));\n }\n}\n\nexport class InboundMessagesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: ListInboundMessagesParams = {}): Promise<ListInboundMessagesResponse> {\n const { q, route_id, cursor, limit } = params;\n return this.client.request<ListInboundMessagesResponse>('GET', '/v1/inbound/messages', {\n query: { q, route_id, cursor, limit }\n });\n }\n\n async get(id: string): Promise<InboundMessage> {\n const res = await this.client.request<{ message: InboundMessage }>('GET', messagePath(id));\n return res.message;\n }\n\n async raw(id: string, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n return this.client.requestBinary(`${messagePath(id)}/raw`, options);\n }\n\n async attachment(messageId: string, index: number, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);\n }\n}\n\nexport class InboundResource {\n readonly routes: InboundRoutesResource;\n readonly messages: InboundMessagesResource;\n\n constructor(client: ApiClient) {\n this.routes = new InboundRoutesResource(client);\n this.messages = new InboundMessagesResource(client);\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 {\n ListWebhookDeliveriesParams,\n ListWebhookDeliveriesResponse,\n WebhookDelivery,\n WebhookDeliveryResult\n} from '../types/webhook.js';\n\nfunction deliveryPath(id: string): string {\n return `/v1/webhook-deliveries/${encodeURIComponent(id)}`;\n}\n\nexport class WebhookDeliveriesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: ListWebhookDeliveriesParams = {}): Promise<ListWebhookDeliveriesResponse> {\n const { endpoint_id, event_type, status, cursor, limit } = params;\n return this.client.request<ListWebhookDeliveriesResponse>('GET', '/v1/webhook-deliveries', {\n query: { endpoint_id, event_type, status, cursor, limit }\n });\n }\n\n async get(id: string): Promise<WebhookDeliveryResult> {\n return this.client.request<WebhookDeliveryResult>('GET', deliveryPath(id));\n }\n\n async redeliver(id: string): Promise<WebhookDelivery> {\n const res = await this.client.request<{ delivery: WebhookDelivery }>('POST', `${deliveryPath(id)}/redeliver`);\n return res.delivery;\n }\n}\n","import type { ApiClient } from '../client.js';\nimport { WebhookDeliveriesResource } from './webhook-deliveries.js';\nimport type {\n CreateWebhookParams,\n ListWebhooksParams,\n ListWebhooksResponse,\n UpdateWebhookParams,\n WebhookCreated,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEventDescriptor\n} from '../types/webhook.js';\n\nfunction webhookPath(id: string): string {\n return `/v1/webhooks/${encodeURIComponent(id)}`;\n}\n\nexport class WebhooksResource {\n readonly deliveries: WebhookDeliveriesResource;\n\n constructor(private readonly client: ApiClient) {\n this.deliveries = new WebhookDeliveriesResource(client);\n }\n\n async list(params: ListWebhooksParams = {}): Promise<ListWebhooksResponse> {\n const { cursor, limit } = params;\n return this.client.request<ListWebhooksResponse>('GET', '/v1/webhooks', { query: { cursor, limit } });\n }\n\n async create(params: CreateWebhookParams): Promise<WebhookCreated> {\n return this.client.request<WebhookCreated>('POST', '/v1/webhooks', { body: params });\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const res = await this.client.request<{ endpoint: WebhookEndpoint }>('GET', webhookPath(id));\n return res.endpoint;\n }\n\n async update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint> {\n const res = await this.client.request<{ endpoint: WebhookEndpoint }>('PATCH', webhookPath(id), { body: params });\n return res.endpoint;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', webhookPath(id));\n }\n\n async test(id: string, event?: string): Promise<WebhookDelivery> {\n const res = await this.client.request<{ delivery: WebhookDelivery }>(\n 'POST',\n `${webhookPath(id)}/test`,\n { body: event ? { event } : {} }\n );\n return res.delivery;\n }\n\n async events(): Promise<WebhookEventDescriptor[]> {\n const res = await this.client.request<{ data: WebhookEventDescriptor[] }>('GET', '/v1/webhooks/meta/events');\n return res.data;\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;AAAA,EACA;AAAA,EAET,YAAY,SAA+B;AACzC,UAAM,QAAQ,OAAO;AACrB,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,aAAa,QAAQ;AAAA,EAC5B;AACF;;;ACjBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAC3B,IAAM,UAAU;AAuBT,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,UAAyB,CAAC,GAAG;AACvC,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,QAAQ,QAAQ,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAAA,EACzF;AAAA,EAEA,MAAM,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AI,eAAe,KAAK,MAAM;AAC5C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,cAAc,IAAI,oBAAoB,KAAK,MAAM;AACtD,SAAK,QAAQ,IAAI,cAAc,KAAK,MAAM;AAC1C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,UAAU,IAAI,gBAAgB,KAAK,MAAM;AAAA,EAChD;AACF;","names":[]}
package/dist/index.d.cts CHANGED
@@ -11,6 +11,11 @@ interface RequestOptions {
11
11
  authenticated?: boolean;
12
12
  signal?: AbortSignal;
13
13
  }
14
+ interface BinaryResult {
15
+ data: Uint8Array;
16
+ contentType: string;
17
+ filename: string | null;
18
+ }
14
19
  declare class ApiClient {
15
20
  private readonly apiKey?;
16
21
  private readonly baseURL;
@@ -19,6 +24,9 @@ declare class ApiClient {
19
24
  private readonly sleep;
20
25
  constructor(options?: ClientOptions);
21
26
  request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
27
+ requestBinary(path: string, options?: {
28
+ signal?: AbortSignal;
29
+ }): Promise<BinaryResult>;
22
30
  private delayMs;
23
31
  private attempt;
24
32
  private buildUrl;
@@ -128,6 +136,100 @@ declare class EmailsResource {
128
136
  sendBatch(emails: SendEmailParams[]): Promise<BatchItemResult[]>;
129
137
  }
130
138
 
139
+ type InboundRouteStatus = 'active' | 'disabled';
140
+ interface InboundRoute {
141
+ id: string;
142
+ domain_id: string;
143
+ recipient: string;
144
+ name: string;
145
+ webhook_endpoint_id: string | null;
146
+ store: boolean;
147
+ status: InboundRouteStatus;
148
+ created_at: string;
149
+ updated_at: string;
150
+ }
151
+ interface CreateInboundRouteParams {
152
+ domain_id: string;
153
+ recipient: string;
154
+ name?: string;
155
+ store: boolean;
156
+ webhook_endpoint_id?: string;
157
+ }
158
+ interface UpdateInboundRouteParams {
159
+ recipient: string;
160
+ name?: string;
161
+ store: boolean;
162
+ webhook_endpoint_id?: string;
163
+ }
164
+ interface ListInboundRoutesResponse {
165
+ data: InboundRoute[];
166
+ meta: {
167
+ simulate_enabled: boolean;
168
+ retention_days: number;
169
+ };
170
+ }
171
+ type InboundMessageStatus = 'received' | 'processed' | 'failed';
172
+ interface InboundAttachment {
173
+ name: string;
174
+ content_type: string;
175
+ size_kb: number;
176
+ key: string;
177
+ }
178
+ interface InboundMessage {
179
+ id: string;
180
+ route_id: string | null;
181
+ from_addr: string;
182
+ from_name: string;
183
+ to_addr: string;
184
+ subject: string;
185
+ text: string;
186
+ html: string;
187
+ headers: Record<string, string>;
188
+ attachments: InboundAttachment[];
189
+ spam_verdict: string | null;
190
+ size_kb: number;
191
+ status: InboundMessageStatus;
192
+ error: string | null;
193
+ received_at: string;
194
+ }
195
+ interface ListInboundMessagesParams {
196
+ q?: string;
197
+ route_id?: string;
198
+ cursor?: string;
199
+ limit?: number;
200
+ }
201
+ interface ListInboundMessagesResponse {
202
+ data: InboundMessage[];
203
+ next_cursor?: string;
204
+ }
205
+
206
+ declare class InboundRoutesResource {
207
+ private readonly client;
208
+ constructor(client: ApiClient);
209
+ list(): Promise<ListInboundRoutesResponse>;
210
+ create(params: CreateInboundRouteParams): Promise<InboundRoute>;
211
+ get(id: string): Promise<InboundRoute>;
212
+ update(id: string, params: UpdateInboundRouteParams): Promise<InboundRoute>;
213
+ delete(id: string): Promise<void>;
214
+ }
215
+ declare class InboundMessagesResource {
216
+ private readonly client;
217
+ constructor(client: ApiClient);
218
+ list(params?: ListInboundMessagesParams): Promise<ListInboundMessagesResponse>;
219
+ get(id: string): Promise<InboundMessage>;
220
+ raw(id: string, options?: {
221
+ signal?: AbortSignal;
222
+ }): Promise<BinaryResult>;
223
+ attachment(messageId: string, index: number, options?: {
224
+ signal?: AbortSignal;
225
+ }): Promise<BinaryResult>;
226
+ }
227
+ declare class InboundResource {
228
+ readonly routes: InboundRoutesResource;
229
+ readonly messages: InboundMessagesResource;
230
+ constructor(client: ApiClient);
231
+ }
232
+
131
233
  type PlanLocale = 'en' | 'fr';
132
234
  interface PlanTier {
133
235
  emails: number;
@@ -193,6 +295,102 @@ declare class UnsubscribeResource {
193
295
  preferences(token: string, topicIds: string[]): Promise<void>;
194
296
  }
195
297
 
298
+ type WebhookEndpointStatus = 'active' | 'disabled';
299
+ interface WebhookEndpoint {
300
+ id: string;
301
+ name: string;
302
+ url: string;
303
+ secret_prefix: string;
304
+ events: string[];
305
+ status: WebhookEndpointStatus;
306
+ created_at: string;
307
+ updated_at: string;
308
+ }
309
+ interface CreateWebhookParams {
310
+ name: string;
311
+ url: string;
312
+ events: string[];
313
+ }
314
+ interface UpdateWebhookParams {
315
+ name: string;
316
+ url: string;
317
+ events: string[];
318
+ status: WebhookEndpointStatus;
319
+ }
320
+ interface WebhookCreated {
321
+ endpoint: WebhookEndpoint;
322
+ secret: string;
323
+ }
324
+ interface ListWebhooksParams {
325
+ cursor?: string;
326
+ limit?: number;
327
+ }
328
+ interface ListWebhooksResponse {
329
+ data: WebhookEndpoint[];
330
+ next_cursor?: string;
331
+ }
332
+ type WebhookDeliveryStatus = 'pending' | 'success' | 'failed';
333
+ interface WebhookDelivery {
334
+ id: string;
335
+ endpoint_id: string;
336
+ event_type: string;
337
+ payload: unknown;
338
+ status: WebhookDeliveryStatus;
339
+ attempts: number;
340
+ last_status_code: number | null;
341
+ last_error: string | null;
342
+ delivered_at: string | null;
343
+ created_at: string;
344
+ }
345
+ interface WebhookAttempt {
346
+ attempt: number;
347
+ status_code: number | null;
348
+ error: string | null;
349
+ duration_ms: number;
350
+ created_at: string;
351
+ }
352
+ interface WebhookDeliveryResult {
353
+ delivery: WebhookDelivery;
354
+ attempts: WebhookAttempt[];
355
+ }
356
+ interface ListWebhookDeliveriesParams {
357
+ endpoint_id?: string;
358
+ event_type?: string;
359
+ status?: WebhookDeliveryStatus;
360
+ cursor?: string;
361
+ limit?: number;
362
+ }
363
+ interface ListWebhookDeliveriesResponse {
364
+ data: WebhookDelivery[];
365
+ next_cursor?: string;
366
+ }
367
+ interface WebhookEventDescriptor {
368
+ type: string;
369
+ description: string;
370
+ sample: unknown;
371
+ }
372
+
373
+ declare class WebhookDeliveriesResource {
374
+ private readonly client;
375
+ constructor(client: ApiClient);
376
+ list(params?: ListWebhookDeliveriesParams): Promise<ListWebhookDeliveriesResponse>;
377
+ get(id: string): Promise<WebhookDeliveryResult>;
378
+ redeliver(id: string): Promise<WebhookDelivery>;
379
+ }
380
+
381
+ declare class WebhooksResource {
382
+ private readonly client;
383
+ readonly deliveries: WebhookDeliveriesResource;
384
+ constructor(client: ApiClient);
385
+ list(params?: ListWebhooksParams): Promise<ListWebhooksResponse>;
386
+ create(params: CreateWebhookParams): Promise<WebhookCreated>;
387
+ get(id: string): Promise<WebhookEndpoint>;
388
+ update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint>;
389
+ delete(id: string): Promise<void>;
390
+ test(id: string, event?: string): Promise<WebhookDelivery>;
391
+ events(): Promise<WebhookEventDescriptor[]>;
392
+ }
393
+
196
394
  interface SendWhatsAppMessageParams {
197
395
  template_id: string;
198
396
  to: string[];
@@ -236,7 +434,9 @@ declare class Notideus {
236
434
  readonly whatsapp: WhatsAppResource;
237
435
  readonly unsubscribe: UnsubscribeResource;
238
436
  readonly plans: PlansResource;
437
+ readonly webhooks: WebhooksResource;
438
+ readonly inbound: InboundResource;
239
439
  constructor(apiKey?: string, options?: Omit<ClientOptions, 'apiKey'>);
240
440
  }
241
441
 
242
- export { type BatchItemError, type BatchItemResult, type BulkContactInput, type ClientOptions, type Contact, type ContactStatus, type ContactsTier, type CreateContactParams, type Email, type FreeAllowances, type ListContactsParams, type ListContactsResponse, Notideus, NotideusError, type Plan, type PlanCatalog, type PlanLocale, type PlanTier, type SendEmailParams, type SendWhatsAppMessageParams, type UnsubscribeInfo, type UnsubscribeTopic, type UpdateContactParams, type WhatsAppMessage };
442
+ export { type BatchItemError, type BatchItemResult, type BinaryResult, type BulkContactInput, type ClientOptions, type Contact, type ContactStatus, type ContactsTier, type CreateContactParams, type CreateInboundRouteParams, type CreateWebhookParams, type Email, type FreeAllowances, type InboundAttachment, type InboundMessage, type InboundMessageStatus, type InboundRoute, type InboundRouteStatus, type ListContactsParams, type ListContactsResponse, type ListInboundMessagesParams, type ListInboundMessagesResponse, type ListInboundRoutesResponse, type ListWebhookDeliveriesParams, type ListWebhookDeliveriesResponse, type ListWebhooksParams, type ListWebhooksResponse, Notideus, NotideusError, type Plan, type PlanCatalog, type PlanLocale, type PlanTier, type SendEmailParams, type SendWhatsAppMessageParams, type UnsubscribeInfo, type UnsubscribeTopic, type UpdateContactParams, type UpdateInboundRouteParams, type UpdateWebhookParams, type WebhookAttempt, type WebhookCreated, type WebhookDelivery, type WebhookDeliveryResult, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventDescriptor, type WhatsAppMessage };
package/dist/index.d.ts CHANGED
@@ -11,6 +11,11 @@ interface RequestOptions {
11
11
  authenticated?: boolean;
12
12
  signal?: AbortSignal;
13
13
  }
14
+ interface BinaryResult {
15
+ data: Uint8Array;
16
+ contentType: string;
17
+ filename: string | null;
18
+ }
14
19
  declare class ApiClient {
15
20
  private readonly apiKey?;
16
21
  private readonly baseURL;
@@ -19,6 +24,9 @@ declare class ApiClient {
19
24
  private readonly sleep;
20
25
  constructor(options?: ClientOptions);
21
26
  request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
27
+ requestBinary(path: string, options?: {
28
+ signal?: AbortSignal;
29
+ }): Promise<BinaryResult>;
22
30
  private delayMs;
23
31
  private attempt;
24
32
  private buildUrl;
@@ -128,6 +136,100 @@ declare class EmailsResource {
128
136
  sendBatch(emails: SendEmailParams[]): Promise<BatchItemResult[]>;
129
137
  }
130
138
 
139
+ type InboundRouteStatus = 'active' | 'disabled';
140
+ interface InboundRoute {
141
+ id: string;
142
+ domain_id: string;
143
+ recipient: string;
144
+ name: string;
145
+ webhook_endpoint_id: string | null;
146
+ store: boolean;
147
+ status: InboundRouteStatus;
148
+ created_at: string;
149
+ updated_at: string;
150
+ }
151
+ interface CreateInboundRouteParams {
152
+ domain_id: string;
153
+ recipient: string;
154
+ name?: string;
155
+ store: boolean;
156
+ webhook_endpoint_id?: string;
157
+ }
158
+ interface UpdateInboundRouteParams {
159
+ recipient: string;
160
+ name?: string;
161
+ store: boolean;
162
+ webhook_endpoint_id?: string;
163
+ }
164
+ interface ListInboundRoutesResponse {
165
+ data: InboundRoute[];
166
+ meta: {
167
+ simulate_enabled: boolean;
168
+ retention_days: number;
169
+ };
170
+ }
171
+ type InboundMessageStatus = 'received' | 'processed' | 'failed';
172
+ interface InboundAttachment {
173
+ name: string;
174
+ content_type: string;
175
+ size_kb: number;
176
+ key: string;
177
+ }
178
+ interface InboundMessage {
179
+ id: string;
180
+ route_id: string | null;
181
+ from_addr: string;
182
+ from_name: string;
183
+ to_addr: string;
184
+ subject: string;
185
+ text: string;
186
+ html: string;
187
+ headers: Record<string, string>;
188
+ attachments: InboundAttachment[];
189
+ spam_verdict: string | null;
190
+ size_kb: number;
191
+ status: InboundMessageStatus;
192
+ error: string | null;
193
+ received_at: string;
194
+ }
195
+ interface ListInboundMessagesParams {
196
+ q?: string;
197
+ route_id?: string;
198
+ cursor?: string;
199
+ limit?: number;
200
+ }
201
+ interface ListInboundMessagesResponse {
202
+ data: InboundMessage[];
203
+ next_cursor?: string;
204
+ }
205
+
206
+ declare class InboundRoutesResource {
207
+ private readonly client;
208
+ constructor(client: ApiClient);
209
+ list(): Promise<ListInboundRoutesResponse>;
210
+ create(params: CreateInboundRouteParams): Promise<InboundRoute>;
211
+ get(id: string): Promise<InboundRoute>;
212
+ update(id: string, params: UpdateInboundRouteParams): Promise<InboundRoute>;
213
+ delete(id: string): Promise<void>;
214
+ }
215
+ declare class InboundMessagesResource {
216
+ private readonly client;
217
+ constructor(client: ApiClient);
218
+ list(params?: ListInboundMessagesParams): Promise<ListInboundMessagesResponse>;
219
+ get(id: string): Promise<InboundMessage>;
220
+ raw(id: string, options?: {
221
+ signal?: AbortSignal;
222
+ }): Promise<BinaryResult>;
223
+ attachment(messageId: string, index: number, options?: {
224
+ signal?: AbortSignal;
225
+ }): Promise<BinaryResult>;
226
+ }
227
+ declare class InboundResource {
228
+ readonly routes: InboundRoutesResource;
229
+ readonly messages: InboundMessagesResource;
230
+ constructor(client: ApiClient);
231
+ }
232
+
131
233
  type PlanLocale = 'en' | 'fr';
132
234
  interface PlanTier {
133
235
  emails: number;
@@ -193,6 +295,102 @@ declare class UnsubscribeResource {
193
295
  preferences(token: string, topicIds: string[]): Promise<void>;
194
296
  }
195
297
 
298
+ type WebhookEndpointStatus = 'active' | 'disabled';
299
+ interface WebhookEndpoint {
300
+ id: string;
301
+ name: string;
302
+ url: string;
303
+ secret_prefix: string;
304
+ events: string[];
305
+ status: WebhookEndpointStatus;
306
+ created_at: string;
307
+ updated_at: string;
308
+ }
309
+ interface CreateWebhookParams {
310
+ name: string;
311
+ url: string;
312
+ events: string[];
313
+ }
314
+ interface UpdateWebhookParams {
315
+ name: string;
316
+ url: string;
317
+ events: string[];
318
+ status: WebhookEndpointStatus;
319
+ }
320
+ interface WebhookCreated {
321
+ endpoint: WebhookEndpoint;
322
+ secret: string;
323
+ }
324
+ interface ListWebhooksParams {
325
+ cursor?: string;
326
+ limit?: number;
327
+ }
328
+ interface ListWebhooksResponse {
329
+ data: WebhookEndpoint[];
330
+ next_cursor?: string;
331
+ }
332
+ type WebhookDeliveryStatus = 'pending' | 'success' | 'failed';
333
+ interface WebhookDelivery {
334
+ id: string;
335
+ endpoint_id: string;
336
+ event_type: string;
337
+ payload: unknown;
338
+ status: WebhookDeliveryStatus;
339
+ attempts: number;
340
+ last_status_code: number | null;
341
+ last_error: string | null;
342
+ delivered_at: string | null;
343
+ created_at: string;
344
+ }
345
+ interface WebhookAttempt {
346
+ attempt: number;
347
+ status_code: number | null;
348
+ error: string | null;
349
+ duration_ms: number;
350
+ created_at: string;
351
+ }
352
+ interface WebhookDeliveryResult {
353
+ delivery: WebhookDelivery;
354
+ attempts: WebhookAttempt[];
355
+ }
356
+ interface ListWebhookDeliveriesParams {
357
+ endpoint_id?: string;
358
+ event_type?: string;
359
+ status?: WebhookDeliveryStatus;
360
+ cursor?: string;
361
+ limit?: number;
362
+ }
363
+ interface ListWebhookDeliveriesResponse {
364
+ data: WebhookDelivery[];
365
+ next_cursor?: string;
366
+ }
367
+ interface WebhookEventDescriptor {
368
+ type: string;
369
+ description: string;
370
+ sample: unknown;
371
+ }
372
+
373
+ declare class WebhookDeliveriesResource {
374
+ private readonly client;
375
+ constructor(client: ApiClient);
376
+ list(params?: ListWebhookDeliveriesParams): Promise<ListWebhookDeliveriesResponse>;
377
+ get(id: string): Promise<WebhookDeliveryResult>;
378
+ redeliver(id: string): Promise<WebhookDelivery>;
379
+ }
380
+
381
+ declare class WebhooksResource {
382
+ private readonly client;
383
+ readonly deliveries: WebhookDeliveriesResource;
384
+ constructor(client: ApiClient);
385
+ list(params?: ListWebhooksParams): Promise<ListWebhooksResponse>;
386
+ create(params: CreateWebhookParams): Promise<WebhookCreated>;
387
+ get(id: string): Promise<WebhookEndpoint>;
388
+ update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint>;
389
+ delete(id: string): Promise<void>;
390
+ test(id: string, event?: string): Promise<WebhookDelivery>;
391
+ events(): Promise<WebhookEventDescriptor[]>;
392
+ }
393
+
196
394
  interface SendWhatsAppMessageParams {
197
395
  template_id: string;
198
396
  to: string[];
@@ -236,7 +434,9 @@ declare class Notideus {
236
434
  readonly whatsapp: WhatsAppResource;
237
435
  readonly unsubscribe: UnsubscribeResource;
238
436
  readonly plans: PlansResource;
437
+ readonly webhooks: WebhooksResource;
438
+ readonly inbound: InboundResource;
239
439
  constructor(apiKey?: string, options?: Omit<ClientOptions, 'apiKey'>);
240
440
  }
241
441
 
242
- export { type BatchItemError, type BatchItemResult, type BulkContactInput, type ClientOptions, type Contact, type ContactStatus, type ContactsTier, type CreateContactParams, type Email, type FreeAllowances, type ListContactsParams, type ListContactsResponse, Notideus, NotideusError, type Plan, type PlanCatalog, type PlanLocale, type PlanTier, type SendEmailParams, type SendWhatsAppMessageParams, type UnsubscribeInfo, type UnsubscribeTopic, type UpdateContactParams, type WhatsAppMessage };
442
+ export { type BatchItemError, type BatchItemResult, type BinaryResult, type BulkContactInput, type ClientOptions, type Contact, type ContactStatus, type ContactsTier, type CreateContactParams, type CreateInboundRouteParams, type CreateWebhookParams, type Email, type FreeAllowances, type InboundAttachment, type InboundMessage, type InboundMessageStatus, type InboundRoute, type InboundRouteStatus, type ListContactsParams, type ListContactsResponse, type ListInboundMessagesParams, type ListInboundMessagesResponse, type ListInboundRoutesResponse, type ListWebhookDeliveriesParams, type ListWebhookDeliveriesResponse, type ListWebhooksParams, type ListWebhooksResponse, Notideus, NotideusError, type Plan, type PlanCatalog, type PlanLocale, type PlanTier, type SendEmailParams, type SendWhatsAppMessageParams, type UnsubscribeInfo, type UnsubscribeTopic, type UpdateContactParams, type UpdateInboundRouteParams, type UpdateWebhookParams, type WebhookAttempt, type WebhookCreated, type WebhookDelivery, type WebhookDeliveryResult, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventDescriptor, type WhatsAppMessage };
package/dist/index.js CHANGED
@@ -44,6 +44,44 @@ var ApiClient = class {
44
44
  }
45
45
  }
46
46
  }
47
+ // requestBinary downloads a binary endpoint (raw MIME, attachments). Auth
48
+ // headers are attached like request(); non-2xx responses raise NotideusError
49
+ // with the standard envelope. No retries — callers can re-invoke.
50
+ async requestBinary(path, options = {}) {
51
+ const headers = {
52
+ "User-Agent": `notideus-node/${VERSION}`
53
+ };
54
+ if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;
55
+ const controller = new AbortController();
56
+ const timer = setTimeout(() => controller.abort(), this.timeout);
57
+ const onCallerAbort = () => controller.abort();
58
+ if (options.signal) {
59
+ if (options.signal.aborted) controller.abort();
60
+ else options.signal.addEventListener("abort", onCallerAbort, { once: true });
61
+ }
62
+ try {
63
+ const res = await fetch(new URL(path, this.baseURL), { headers, signal: controller.signal });
64
+ if (!res.ok) throw await this.toError(res);
65
+ const disposition = res.headers.get("content-disposition") ?? "";
66
+ const match = CONTENT_DISPOSITION_FILENAME.exec(disposition);
67
+ return {
68
+ data: new Uint8Array(await res.arrayBuffer()),
69
+ contentType: res.headers.get("content-type") ?? "application/octet-stream",
70
+ filename: match ? match[1] : null
71
+ };
72
+ } catch (err) {
73
+ if (err instanceof NotideusError) throw err;
74
+ if (options.signal?.aborted) throw err;
75
+ throw new NotideusError({
76
+ code: controller.signal.aborted ? "request_timeout" : "network_error",
77
+ message: err instanceof Error ? err.message : String(err),
78
+ status: 0
79
+ });
80
+ } finally {
81
+ clearTimeout(timer);
82
+ options.signal?.removeEventListener("abort", onCallerAbort);
83
+ }
84
+ }
47
85
  delayMs(err, attempt) {
48
86
  if (err instanceof NotideusError && err.retryAfter != null) {
49
87
  return err.retryAfter * 1e3;
@@ -115,6 +153,7 @@ var ApiClient = class {
115
153
  });
116
154
  }
117
155
  };
156
+ var CONTENT_DISPOSITION_FILENAME = /filename="?([^";]+)"?/;
118
157
  function hasIdempotencyKey(body) {
119
158
  return typeof body === "object" && body !== null && body.idempotency_key != null;
120
159
  }
@@ -182,6 +221,68 @@ var EmailsResource = class {
182
221
  }
183
222
  };
184
223
 
224
+ // src/resources/inbound.ts
225
+ function routePath(id) {
226
+ return `/v1/inbound/routes/${encodeURIComponent(id)}`;
227
+ }
228
+ function messagePath(id) {
229
+ return `/v1/inbound/messages/${encodeURIComponent(id)}`;
230
+ }
231
+ var InboundRoutesResource = class {
232
+ constructor(client) {
233
+ this.client = client;
234
+ }
235
+ client;
236
+ async list() {
237
+ return this.client.request("GET", "/v1/inbound/routes");
238
+ }
239
+ async create(params) {
240
+ const res = await this.client.request("POST", "/v1/inbound/routes", { body: params });
241
+ return res.route;
242
+ }
243
+ async get(id) {
244
+ const res = await this.client.request("GET", routePath(id));
245
+ return res.route;
246
+ }
247
+ async update(id, params) {
248
+ const res = await this.client.request("PATCH", routePath(id), { body: params });
249
+ return res.route;
250
+ }
251
+ async delete(id) {
252
+ await this.client.request("DELETE", routePath(id));
253
+ }
254
+ };
255
+ var InboundMessagesResource = class {
256
+ constructor(client) {
257
+ this.client = client;
258
+ }
259
+ client;
260
+ async list(params = {}) {
261
+ const { q, route_id, cursor, limit } = params;
262
+ return this.client.request("GET", "/v1/inbound/messages", {
263
+ query: { q, route_id, cursor, limit }
264
+ });
265
+ }
266
+ async get(id) {
267
+ const res = await this.client.request("GET", messagePath(id));
268
+ return res.message;
269
+ }
270
+ async raw(id, options = {}) {
271
+ return this.client.requestBinary(`${messagePath(id)}/raw`, options);
272
+ }
273
+ async attachment(messageId, index, options = {}) {
274
+ return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);
275
+ }
276
+ };
277
+ var InboundResource = class {
278
+ routes;
279
+ messages;
280
+ constructor(client) {
281
+ this.routes = new InboundRoutesResource(client);
282
+ this.messages = new InboundMessagesResource(client);
283
+ }
284
+ };
285
+
185
286
  // src/resources/plans.ts
186
287
  var PlansResource = class {
187
288
  constructor(client) {
@@ -223,6 +324,73 @@ var UnsubscribeResource = class {
223
324
  }
224
325
  };
225
326
 
327
+ // src/resources/webhook-deliveries.ts
328
+ function deliveryPath(id) {
329
+ return `/v1/webhook-deliveries/${encodeURIComponent(id)}`;
330
+ }
331
+ var WebhookDeliveriesResource = class {
332
+ constructor(client) {
333
+ this.client = client;
334
+ }
335
+ client;
336
+ async list(params = {}) {
337
+ const { endpoint_id, event_type, status, cursor, limit } = params;
338
+ return this.client.request("GET", "/v1/webhook-deliveries", {
339
+ query: { endpoint_id, event_type, status, cursor, limit }
340
+ });
341
+ }
342
+ async get(id) {
343
+ return this.client.request("GET", deliveryPath(id));
344
+ }
345
+ async redeliver(id) {
346
+ const res = await this.client.request("POST", `${deliveryPath(id)}/redeliver`);
347
+ return res.delivery;
348
+ }
349
+ };
350
+
351
+ // src/resources/webhooks.ts
352
+ function webhookPath(id) {
353
+ return `/v1/webhooks/${encodeURIComponent(id)}`;
354
+ }
355
+ var WebhooksResource = class {
356
+ constructor(client) {
357
+ this.client = client;
358
+ this.deliveries = new WebhookDeliveriesResource(client);
359
+ }
360
+ client;
361
+ deliveries;
362
+ async list(params = {}) {
363
+ const { cursor, limit } = params;
364
+ return this.client.request("GET", "/v1/webhooks", { query: { cursor, limit } });
365
+ }
366
+ async create(params) {
367
+ return this.client.request("POST", "/v1/webhooks", { body: params });
368
+ }
369
+ async get(id) {
370
+ const res = await this.client.request("GET", webhookPath(id));
371
+ return res.endpoint;
372
+ }
373
+ async update(id, params) {
374
+ const res = await this.client.request("PATCH", webhookPath(id), { body: params });
375
+ return res.endpoint;
376
+ }
377
+ async delete(id) {
378
+ await this.client.request("DELETE", webhookPath(id));
379
+ }
380
+ async test(id, event) {
381
+ const res = await this.client.request(
382
+ "POST",
383
+ `${webhookPath(id)}/test`,
384
+ { body: event ? { event } : {} }
385
+ );
386
+ return res.delivery;
387
+ }
388
+ async events() {
389
+ const res = await this.client.request("GET", "/v1/webhooks/meta/events");
390
+ return res.data;
391
+ }
392
+ };
393
+
226
394
  // src/resources/whatsapp.ts
227
395
  var WhatsAppResource = class {
228
396
  messages;
@@ -257,6 +425,8 @@ var Notideus = class {
257
425
  whatsapp;
258
426
  unsubscribe;
259
427
  plans;
428
+ webhooks;
429
+ inbound;
260
430
  constructor(apiKey, options = {}) {
261
431
  this.client = new ApiClient({ ...options, apiKey });
262
432
  this.emails = new EmailsResource(this.client);
@@ -264,6 +434,8 @@ var Notideus = class {
264
434
  this.whatsapp = new WhatsAppResource(this.client);
265
435
  this.unsubscribe = new UnsubscribeResource(this.client);
266
436
  this.plans = new PlansResource(this.client);
437
+ this.webhooks = new WebhooksResource(this.client);
438
+ this.inbound = new InboundResource(this.client);
267
439
  }
268
440
  };
269
441
  export {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../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","../src/index.ts"],"sourcesContent":["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","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"],"mappings":";AAOO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAA+B;AACzC,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AAA,EAE7B,MAAM,KAAK,QAA+D;AACxE,UAAM,MAAM,MAAM,KAAK,OAAO,QAAqC,QAAQ,yBAAyB;AAAA,MAClG,MAAM;AAAA,IACR,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AAAA,EAEA,MAAM,UAAU,UAAmE;AACjF,UAAM,MAAM,MAAM,KAAK,OAAO,QAAqC,QAAQ,+BAA+B;AAAA,MACxG,MAAM,EAAE,SAAS;AAAA,IACnB,CAAC;AACD,WAAO,IAAI;AAAA,EACb;AACF;;;ACGO,IAAM,WAAN,MAAe;AAAA,EACH;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAiB,UAAyC,CAAC,GAAG;AACxE,SAAK,SAAS,IAAI,UAAU,EAAE,GAAG,SAAS,OAAO,CAAC;AAClD,SAAK,SAAS,IAAI,eAAe,KAAK,MAAM;AAC5C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,cAAc,IAAI,oBAAoB,KAAK,MAAM;AACtD,SAAK,QAAQ,IAAI,cAAc,KAAK,MAAM;AAAA,EAC5C;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/resources/contacts.ts","../src/resources/emails.ts","../src/resources/inbound.ts","../src/resources/plans.ts","../src/resources/unsubscribe.ts","../src/resources/webhook-deliveries.ts","../src/resources/webhooks.ts","../src/resources/whatsapp.ts","../src/index.ts"],"sourcesContent":["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 interface BinaryResult {\n data: Uint8Array;\n contentType: string;\n filename: string | null;\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 // requestBinary downloads a binary endpoint (raw MIME, attachments). Auth\n // headers are attached like request(); non-2xx responses raise NotideusError\n // with the standard envelope. No retries — callers can re-invoke.\n async requestBinary(path: string, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n const headers: Record<string, string> = {\n 'User-Agent': `notideus-node/${VERSION}`\n };\n if (this.apiKey) headers.Authorization = `Bearer ${this.apiKey}`;\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 res = await fetch(new URL(path, this.baseURL), { headers, signal: controller.signal });\n if (!res.ok) throw await this.toError(res);\n const disposition = res.headers.get('content-disposition') ?? '';\n const match = CONTENT_DISPOSITION_FILENAME.exec(disposition);\n return {\n data: new Uint8Array(await res.arrayBuffer()),\n contentType: res.headers.get('content-type') ?? 'application/octet-stream',\n filename: match ? match[1] : null\n };\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 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\nconst CONTENT_DISPOSITION_FILENAME = /filename=\"?([^\";]+)\"?/;\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, BinaryResult } from '../client.js';\nimport type {\n CreateInboundRouteParams,\n InboundMessage,\n InboundRoute,\n ListInboundMessagesParams,\n ListInboundMessagesResponse,\n ListInboundRoutesResponse,\n UpdateInboundRouteParams\n} from '../types/inbound.js';\n\nfunction routePath(id: string): string {\n return `/v1/inbound/routes/${encodeURIComponent(id)}`;\n}\n\nfunction messagePath(id: string): string {\n return `/v1/inbound/messages/${encodeURIComponent(id)}`;\n}\n\nexport class InboundRoutesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(): Promise<ListInboundRoutesResponse> {\n return this.client.request<ListInboundRoutesResponse>('GET', '/v1/inbound/routes');\n }\n\n async create(params: CreateInboundRouteParams): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('POST', '/v1/inbound/routes', { body: params });\n return res.route;\n }\n\n async get(id: string): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('GET', routePath(id));\n return res.route;\n }\n\n async update(id: string, params: UpdateInboundRouteParams): Promise<InboundRoute> {\n const res = await this.client.request<{ route: InboundRoute }>('PATCH', routePath(id), { body: params });\n return res.route;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', routePath(id));\n }\n}\n\nexport class InboundMessagesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: ListInboundMessagesParams = {}): Promise<ListInboundMessagesResponse> {\n const { q, route_id, cursor, limit } = params;\n return this.client.request<ListInboundMessagesResponse>('GET', '/v1/inbound/messages', {\n query: { q, route_id, cursor, limit }\n });\n }\n\n async get(id: string): Promise<InboundMessage> {\n const res = await this.client.request<{ message: InboundMessage }>('GET', messagePath(id));\n return res.message;\n }\n\n async raw(id: string, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n return this.client.requestBinary(`${messagePath(id)}/raw`, options);\n }\n\n async attachment(messageId: string, index: number, options: { signal?: AbortSignal } = {}): Promise<BinaryResult> {\n return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);\n }\n}\n\nexport class InboundResource {\n readonly routes: InboundRoutesResource;\n readonly messages: InboundMessagesResource;\n\n constructor(client: ApiClient) {\n this.routes = new InboundRoutesResource(client);\n this.messages = new InboundMessagesResource(client);\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 {\n ListWebhookDeliveriesParams,\n ListWebhookDeliveriesResponse,\n WebhookDelivery,\n WebhookDeliveryResult\n} from '../types/webhook.js';\n\nfunction deliveryPath(id: string): string {\n return `/v1/webhook-deliveries/${encodeURIComponent(id)}`;\n}\n\nexport class WebhookDeliveriesResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(params: ListWebhookDeliveriesParams = {}): Promise<ListWebhookDeliveriesResponse> {\n const { endpoint_id, event_type, status, cursor, limit } = params;\n return this.client.request<ListWebhookDeliveriesResponse>('GET', '/v1/webhook-deliveries', {\n query: { endpoint_id, event_type, status, cursor, limit }\n });\n }\n\n async get(id: string): Promise<WebhookDeliveryResult> {\n return this.client.request<WebhookDeliveryResult>('GET', deliveryPath(id));\n }\n\n async redeliver(id: string): Promise<WebhookDelivery> {\n const res = await this.client.request<{ delivery: WebhookDelivery }>('POST', `${deliveryPath(id)}/redeliver`);\n return res.delivery;\n }\n}\n","import type { ApiClient } from '../client.js';\nimport { WebhookDeliveriesResource } from './webhook-deliveries.js';\nimport type {\n CreateWebhookParams,\n ListWebhooksParams,\n ListWebhooksResponse,\n UpdateWebhookParams,\n WebhookCreated,\n WebhookDelivery,\n WebhookEndpoint,\n WebhookEventDescriptor\n} from '../types/webhook.js';\n\nfunction webhookPath(id: string): string {\n return `/v1/webhooks/${encodeURIComponent(id)}`;\n}\n\nexport class WebhooksResource {\n readonly deliveries: WebhookDeliveriesResource;\n\n constructor(private readonly client: ApiClient) {\n this.deliveries = new WebhookDeliveriesResource(client);\n }\n\n async list(params: ListWebhooksParams = {}): Promise<ListWebhooksResponse> {\n const { cursor, limit } = params;\n return this.client.request<ListWebhooksResponse>('GET', '/v1/webhooks', { query: { cursor, limit } });\n }\n\n async create(params: CreateWebhookParams): Promise<WebhookCreated> {\n return this.client.request<WebhookCreated>('POST', '/v1/webhooks', { body: params });\n }\n\n async get(id: string): Promise<WebhookEndpoint> {\n const res = await this.client.request<{ endpoint: WebhookEndpoint }>('GET', webhookPath(id));\n return res.endpoint;\n }\n\n async update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint> {\n const res = await this.client.request<{ endpoint: WebhookEndpoint }>('PATCH', webhookPath(id), { body: params });\n return res.endpoint;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', webhookPath(id));\n }\n\n async test(id: string, event?: string): Promise<WebhookDelivery> {\n const res = await this.client.request<{ delivery: WebhookDelivery }>(\n 'POST',\n `${webhookPath(id)}/test`,\n { body: event ? { event } : {} }\n );\n return res.delivery;\n }\n\n async events(): Promise<WebhookEventDescriptor[]> {\n const res = await this.client.request<{ data: WebhookEventDescriptor[] }>('GET', '/v1/webhooks/meta/events');\n return res.data;\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","import { ApiClient, type ClientOptions } from './client.js';\nimport { ContactsResource } from './resources/contacts.js';\nimport { EmailsResource } from './resources/emails.js';\nimport { InboundResource } from './resources/inbound.js';\nimport { PlansResource } from './resources/plans.js';\nimport { UnsubscribeResource } from './resources/unsubscribe.js';\nimport { WebhooksResource } from './resources/webhooks.js';\nimport { WhatsAppResource } from './resources/whatsapp.js';\n\nexport { NotideusError } from './errors.js';\nexport type { BinaryResult, 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 CreateInboundRouteParams,\n InboundAttachment,\n InboundMessage,\n InboundMessageStatus,\n InboundRoute,\n InboundRouteStatus,\n ListInboundMessagesParams,\n ListInboundMessagesResponse,\n ListInboundRoutesResponse,\n UpdateInboundRouteParams\n} from './types/inbound.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';\nexport type {\n CreateWebhookParams,\n ListWebhookDeliveriesParams,\n ListWebhookDeliveriesResponse,\n ListWebhooksParams,\n ListWebhooksResponse,\n UpdateWebhookParams,\n WebhookAttempt,\n WebhookCreated,\n WebhookDelivery,\n WebhookDeliveryResult,\n WebhookDeliveryStatus,\n WebhookEndpoint,\n WebhookEndpointStatus,\n WebhookEventDescriptor\n} from './types/webhook.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 readonly webhooks: WebhooksResource;\n readonly inbound: InboundResource;\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 this.webhooks = new WebhooksResource(this.client);\n this.inbound = new InboundResource(this.client);\n }\n}\n"],"mappings":";AAOO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,SAA+B;AACzC,UAAM,QAAQ,OAAO;AACrB,SAAK,OAAO;AACZ,SAAK,OAAO,QAAQ;AACpB,SAAK,SAAS,QAAQ;AACtB,SAAK,aAAa,QAAQ;AAAA,EAC5B;AACF;;;ACjBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAC3B,IAAM,UAAU;AAuBT,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEjB,YAAY,UAAyB,CAAC,GAAG;AACvC,SAAK,SAAS,QAAQ;AACtB,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,UAAU,QAAQ,WAAW;AAClC,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,QAAQ,QAAQ,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAAA,EACzF;AAAA,EAEA,MAAM,QAAW,QAAgB,MAAc,UAA0B,CAAC,GAAe;AACvF,UAAM,aAAa,WAAW,UAAU,kBAAkB,QAAQ,IAAI;AACtE,QAAI,UAAU;AACd,eAAS;AACP,UAAI;AACF,eAAO,MAAM,KAAK,QAAW,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ACtD,SAAK,QAAQ,IAAI,cAAc,KAAK,MAAM;AAC1C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,UAAU,IAAI,gBAAgB,KAAK,MAAM;AAAA,EAChD;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notideus",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Official Node.js SDK for the Notideus email API",
5
5
  "keywords": [
6
6
  "notideus",
@@ -48,11 +48,11 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@eslint/js": "^9.13.0",
51
- "@types/node": "^22.7.0",
52
- "eslint": "^9.13.0",
51
+ "@types/node": "^26.6.4",
52
+ "eslint": "^10.12.0",
53
53
  "tsup": "^8.3.0",
54
54
  "typescript": "^5.6.0",
55
55
  "typescript-eslint": "^8.10.0",
56
- "vitest": "^3.0.0"
56
+ "vitest": "^5.0.3"
57
57
  }
58
58
  }