notideus 1.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -55,14 +55,21 @@ await notideus.emails.send({ from, to, subject, html?, text?, template_id?, vari
55
55
  await notideus.emails.sendBatch([{ /* same shape */ }, …]); // up to 100
56
56
  ```
57
57
 
58
- ### WhatsApp messages
58
+ ### Automation events
59
+
60
+ Send a custom event to start every active automation that matches its name. Provide exactly one recipient: an `email` address or an existing `contact_id`. The `202 Accepted` response confirms asynchronous dispatch, not email delivery.
59
61
 
60
62
  ```ts
61
- await notideus.whatsapp.messages.send({ template_id, to: ['+33612345678'], parameters: { 'body:1': 'Jane' } });
62
- await notideus.whatsapp.messages.sendBatch([…]);
63
+ const result = await notideus.events.send({
64
+ event: 'user.created',
65
+ email: 'ada@example.com', // or: contact_id: 'contact-uuid'
66
+ payload: { first_name: 'Ada', plan: 'Pro' },
67
+ idempotency_key: 'signup-42'
68
+ });
69
+ console.log(result.created, result.event.id);
63
70
  ```
64
71
 
65
- `send` returns one entry per recipient: `[{ id, to, status }]`.
72
+ Top-level payload fields fill matching template variables (for example `{{first_name}}`); `{{email}}` and `{{event_name}}` are built in. Replaying an `idempotency_key` returns the same event with `created: false` and never creates a duplicate run.
66
73
 
67
74
  ### Contacts
68
75
 
@@ -130,6 +137,9 @@ try {
130
137
  if (err instanceof NotideusError && err.code === 'rate_limited') {
131
138
  // err.retryAfter = seconds to wait
132
139
  }
140
+ if (err instanceof NotideusError && err.code === 'account_suspended') {
141
+ // err.reason = optional admin note explaining the suspension
142
+ }
133
143
  }
134
144
  ```
135
145
 
package/dist/index.cjs CHANGED
@@ -30,12 +30,14 @@ var NotideusError = class extends Error {
30
30
  code;
31
31
  status;
32
32
  retryAfter;
33
+ reason;
33
34
  constructor(options) {
34
35
  super(options.message);
35
36
  this.name = "NotideusError";
36
37
  this.code = options.code;
37
38
  this.status = options.status;
38
39
  this.retryAfter = options.retryAfter;
40
+ this.reason = options.reason;
39
41
  }
40
42
  };
41
43
 
@@ -165,10 +167,12 @@ var ApiClient = class {
165
167
  async toError(response) {
166
168
  let code = "unknown_error";
167
169
  let message = response.statusText || `HTTP ${response.status}`;
170
+ let reason;
168
171
  try {
169
172
  const parsed = await response.json();
170
173
  if (parsed.error?.code) code = parsed.error.code;
171
174
  if (parsed.error?.message) message = parsed.error.message;
175
+ if (typeof parsed.error?.reason === "string") reason = parsed.error.reason;
172
176
  } catch {
173
177
  }
174
178
  const retryAfterHeader = response.headers.get("retry-after");
@@ -176,7 +180,8 @@ var ApiClient = class {
176
180
  code,
177
181
  message,
178
182
  status: response.status,
179
- retryAfter: retryAfterHeader ? Number(retryAfterHeader) : void 0
183
+ retryAfter: retryAfterHeader ? Number(retryAfterHeader) : void 0,
184
+ reason
180
185
  });
181
186
  }
182
187
  };
@@ -248,6 +253,17 @@ var EmailsResource = class {
248
253
  }
249
254
  };
250
255
 
256
+ // src/resources/events.ts
257
+ var EventsResource = class {
258
+ constructor(client) {
259
+ this.client = client;
260
+ }
261
+ client;
262
+ async send(params) {
263
+ return this.client.request("POST", "/v1/events/send", { body: params });
264
+ }
265
+ };
266
+
251
267
  // src/resources/inbound.ts
252
268
  function routePath(id) {
253
269
  return `/v1/inbound/routes/${encodeURIComponent(id)}`;
@@ -285,9 +301,19 @@ var InboundMessagesResource = class {
285
301
  }
286
302
  client;
287
303
  async list(params = {}) {
288
- const { q, route_id, cursor, limit } = params;
304
+ const { q, route_id, folder, folder_id, unread, attachments, sort, cursor, limit } = params;
289
305
  return this.client.request("GET", "/v1/inbound/messages", {
290
- query: { q, route_id, cursor, limit }
306
+ query: {
307
+ q,
308
+ route_id,
309
+ folder,
310
+ folder_id,
311
+ unread: unread === void 0 ? void 0 : String(unread),
312
+ attachments: attachments === void 0 ? void 0 : String(attachments),
313
+ sort,
314
+ cursor,
315
+ limit
316
+ }
291
317
  });
292
318
  }
293
319
  async get(id) {
@@ -300,13 +326,45 @@ var InboundMessagesResource = class {
300
326
  async attachment(messageId, index, options = {}) {
301
327
  return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);
302
328
  }
329
+ async update(id, params) {
330
+ const res = await this.client.request("PATCH", messagePath(id), { body: params });
331
+ return res.message;
332
+ }
333
+ async delete(id) {
334
+ await this.client.request("DELETE", messagePath(id));
335
+ }
336
+ };
337
+ function folderPath(id) {
338
+ return `/v1/inbound/folders/${encodeURIComponent(id)}`;
339
+ }
340
+ var InboundFoldersResource = class {
341
+ constructor(client) {
342
+ this.client = client;
343
+ }
344
+ client;
345
+ async list() {
346
+ return this.client.request("GET", "/v1/inbound/folders");
347
+ }
348
+ async create(name) {
349
+ const res = await this.client.request("POST", "/v1/inbound/folders", { body: { name } });
350
+ return res.folder;
351
+ }
352
+ async update(id, name) {
353
+ const res = await this.client.request("PATCH", folderPath(id), { body: { name } });
354
+ return res.folder;
355
+ }
356
+ async delete(id) {
357
+ await this.client.request("DELETE", folderPath(id));
358
+ }
303
359
  };
304
360
  var InboundResource = class {
305
361
  routes;
306
362
  messages;
363
+ folders;
307
364
  constructor(client) {
308
365
  this.routes = new InboundRoutesResource(client);
309
366
  this.messages = new InboundMessagesResource(client);
367
+ this.folders = new InboundFoldersResource(client);
310
368
  }
311
369
  };
312
370
 
@@ -412,44 +470,23 @@ var WebhooksResource = class {
412
470
  );
413
471
  return res.delivery;
414
472
  }
473
+ // rotateSecret replaces the endpoint's signing secret; the new secret is
474
+ // returned exactly once. The old secret stops working immediately.
475
+ async rotateSecret(id) {
476
+ return this.client.request("POST", `${webhookPath(id)}/rotate-secret`, { body: {} });
477
+ }
415
478
  async events() {
416
479
  const res = await this.client.request("GET", "/v1/webhooks/meta/events");
417
480
  return res.data;
418
481
  }
419
482
  };
420
483
 
421
- // src/resources/whatsapp.ts
422
- var WhatsAppResource = class {
423
- messages;
424
- constructor(client) {
425
- this.messages = new WhatsAppMessagesResource(client);
426
- }
427
- };
428
- var WhatsAppMessagesResource = class {
429
- constructor(client) {
430
- this.client = client;
431
- }
432
- client;
433
- async send(params) {
434
- const res = await this.client.request("POST", "/v1/whatsapp/messages", {
435
- body: params
436
- });
437
- return res.data;
438
- }
439
- async sendBatch(messages) {
440
- const res = await this.client.request("POST", "/v1/whatsapp/messages/batch", {
441
- body: { messages }
442
- });
443
- return res.data;
444
- }
445
- };
446
-
447
484
  // src/index.ts
448
485
  var Notideus = class {
449
486
  client;
450
487
  emails;
488
+ events;
451
489
  contacts;
452
- whatsapp;
453
490
  unsubscribe;
454
491
  plans;
455
492
  webhooks;
@@ -457,8 +494,8 @@ var Notideus = class {
457
494
  constructor(apiKey, options = {}) {
458
495
  this.client = new ApiClient({ ...options, apiKey });
459
496
  this.emails = new EmailsResource(this.client);
497
+ this.events = new EventsResource(this.client);
460
498
  this.contacts = new ContactsResource(this.client);
461
- this.whatsapp = new WhatsAppResource(this.client);
462
499
  this.unsubscribe = new UnsubscribeResource(this.client);
463
500
  this.plans = new PlansResource(this.client);
464
501
  this.webhooks = new WebhooksResource(this.client);
@@ -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/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,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,QAAQ,MAAM,OAAO;AAAA,MACpD,SAAS,KAAK;AACZ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,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,UAAU,IAAI,gBAAgB,KAAK,MAAM;AAAA,EAChD;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/events.ts","../src/resources/inbound.ts","../src/resources/plans.ts","../src/resources/unsubscribe.ts","../src/resources/webhook-deliveries.ts","../src/resources/webhooks.ts"],"sourcesContent":["import { ApiClient, type ClientOptions } from './client.js';\nimport { ContactsResource } from './resources/contacts.js';\nimport { EmailsResource } from './resources/emails.js';\nimport { EventsResource } from './resources/events.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';\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 { AutomationEvent, SendEventParams, SendEventResult } from './types/event.js';\nexport type {\n CreateInboundRouteParams,\n InboundAttachment,\n InboundMessage,\n InboundMessageStatus,\n InboundRoute,\n InboundRouteStatus,\n InboxFolder,\n InboxFolderName,\n InboxFolderFilter,\n InboxCounts,\n InboxFolderOverview,\n UpdateInboundMessageParams,\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 { 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 events: EventsResource;\n readonly contacts: ContactsResource;\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.events = new EventsResource(this.client);\n this.contacts = new ContactsResource(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 /** Admin-provided note, present on account_suspended errors. */\n reason?: string;\n}\n\nexport class NotideusError extends Error {\n readonly code: string;\n readonly status: number;\n readonly retryAfter?: number;\n readonly reason?: string;\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 this.reason = options.reason;\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 let reason: string | undefined;\n try {\n const parsed = (await response.json()) as { error?: { code?: string; message?: string; reason?: string } };\n if (parsed.error?.code) code = parsed.error.code;\n if (parsed.error?.message) message = parsed.error.message;\n if (typeof parsed.error?.reason === 'string') reason = parsed.error.reason;\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 reason\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 } from '../client.js';\nimport type { SendEventParams, SendEventResult } from '../types/event.js';\n\nexport class EventsResource {\n constructor(private readonly client: ApiClient) {}\n\n async send(params: SendEventParams): Promise<SendEventResult> {\n return this.client.request<SendEventResult>('POST', '/v1/events/send', { body: params });\n }\n}\n","import type { ApiClient, BinaryResult } from '../client.js';\nimport type {\n CreateInboundRouteParams,\n InboundMessage,\n InboundRoute,\n InboxFolder,\n InboxFolderOverview,\n UpdateInboundMessageParams,\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, folder, folder_id, unread, attachments, sort, cursor, limit } = params;\n return this.client.request<ListInboundMessagesResponse>('GET', '/v1/inbound/messages', {\n query: {\n q,\n route_id,\n folder,\n folder_id,\n unread: unread === undefined ? undefined : String(unread),\n attachments: attachments === undefined ? undefined : String(attachments),\n sort,\n cursor,\n limit\n }\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 async update(id: string, params: UpdateInboundMessageParams): Promise<InboundMessage> {\n const res = await this.client.request<{ message: InboundMessage }>('PATCH', messagePath(id), { body: params });\n return res.message;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', messagePath(id));\n }\n}\n\nfunction folderPath(id: string): string {\n return `/v1/inbound/folders/${encodeURIComponent(id)}`;\n}\n\nexport class InboundFoldersResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(): Promise<InboxFolderOverview> {\n return this.client.request<InboxFolderOverview>('GET', '/v1/inbound/folders');\n }\n\n async create(name: string): Promise<InboxFolder> {\n const res = await this.client.request<{ folder: InboxFolder }>('POST', '/v1/inbound/folders', { body: { name } });\n return res.folder;\n }\n\n async update(id: string, name: string): Promise<InboxFolder> {\n const res = await this.client.request<{ folder: InboxFolder }>('PATCH', folderPath(id), { body: { name } });\n return res.folder;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', folderPath(id));\n }\n}\n\nexport class InboundResource {\n readonly routes: InboundRoutesResource;\n readonly messages: InboundMessagesResource;\n readonly folders: InboundFoldersResource;\n\n constructor(client: ApiClient) {\n this.routes = new InboundRoutesResource(client);\n this.messages = new InboundMessagesResource(client);\n this.folders = new InboundFoldersResource(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 // rotateSecret replaces the endpoint's signing secret; the new secret is\n // returned exactly once. The old secret stops working immediately.\n async rotateSecret(id: string): Promise<WebhookCreated> {\n return this.client.request<WebhookCreated>('POST', `${webhookPath(id)}/rotate-secret`, { body: {} });\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;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;AAC1B,SAAK,SAAS,QAAQ;AAAA,EACxB;AACF;;;ACrBA,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,Q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AK,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
@@ -95,6 +95,8 @@ declare class ContactsResource {
95
95
  interface SendEmailParams {
96
96
  from: string;
97
97
  to: string[];
98
+ cc?: string[];
99
+ bcc?: string[];
98
100
  subject: string;
99
101
  html?: string;
100
102
  text?: string;
@@ -104,6 +106,10 @@ interface SendEmailParams {
104
106
  variables?: Record<string, string>;
105
107
  tags?: string[];
106
108
  idempotency_key?: string;
109
+ /** Opt into open tracking (1px pixel injected at send time). Default false. */
110
+ track_opens?: boolean;
111
+ /** Opt into click tracking (links rewritten through the redirect). Default false. */
112
+ track_clicks?: boolean;
107
113
  }
108
114
  interface Email {
109
115
  id: string;
@@ -112,6 +118,8 @@ interface Email {
112
118
  template_id: string | null;
113
119
  from_address: string;
114
120
  to_emails: string[];
121
+ cc_emails: string[];
122
+ bcc_emails: string[];
115
123
  subject: string;
116
124
  html: string;
117
125
  size_kb: number;
@@ -136,6 +144,38 @@ declare class EmailsResource {
136
144
  sendBatch(emails: SendEmailParams[]): Promise<BatchItemResult[]>;
137
145
  }
138
146
 
147
+ interface SendEventBase {
148
+ event: string;
149
+ payload?: Record<string, unknown>;
150
+ idempotency_key?: string;
151
+ }
152
+ type SendEventParams = SendEventBase & ({
153
+ email: string;
154
+ contact_id?: never;
155
+ } | {
156
+ contact_id: string;
157
+ email?: never;
158
+ });
159
+ interface AutomationEvent {
160
+ id: string;
161
+ event: string;
162
+ email: string;
163
+ contact_id: string | null;
164
+ payload: Record<string, unknown>;
165
+ source: 'api' | 'test';
166
+ created_at: string;
167
+ }
168
+ interface SendEventResult {
169
+ event: AutomationEvent;
170
+ created: boolean;
171
+ }
172
+
173
+ declare class EventsResource {
174
+ private readonly client;
175
+ constructor(client: ApiClient);
176
+ send(params: SendEventParams): Promise<SendEventResult>;
177
+ }
178
+
139
179
  type InboundRouteStatus = 'active' | 'disabled';
140
180
  interface InboundRoute {
141
181
  id: string;
@@ -191,10 +231,46 @@ interface InboundMessage {
191
231
  status: InboundMessageStatus;
192
232
  error: string | null;
193
233
  received_at: string;
234
+ read_at: string | null;
235
+ starred: boolean;
236
+ folder: 'inbox' | 'archive' | 'trash';
237
+ folder_id: string | null;
238
+ }
239
+ type InboxFolderName = 'inbox' | 'archive' | 'trash';
240
+ type InboxFolderFilter = InboxFolderName | 'starred' | 'all';
241
+ interface InboxFolder {
242
+ id: string;
243
+ name: string;
244
+ created_at: string;
245
+ updated_at: string;
246
+ }
247
+ interface InboxCounts {
248
+ inbox: number;
249
+ unread: number;
250
+ starred: number;
251
+ archive: number;
252
+ trash: number;
253
+ all: number;
254
+ }
255
+ interface InboxFolderOverview {
256
+ data: InboxFolder[];
257
+ counts: InboxCounts;
258
+ route_unread: Record<string, number>;
259
+ }
260
+ interface UpdateInboundMessageParams {
261
+ read?: boolean;
262
+ starred?: boolean;
263
+ folder?: InboxFolderName;
264
+ folder_id?: string;
194
265
  }
195
266
  interface ListInboundMessagesParams {
196
267
  q?: string;
197
268
  route_id?: string;
269
+ folder?: InboxFolderFilter;
270
+ folder_id?: string;
271
+ unread?: boolean;
272
+ attachments?: boolean;
273
+ sort?: 'newest' | 'oldest';
198
274
  cursor?: string;
199
275
  limit?: number;
200
276
  }
@@ -223,10 +299,21 @@ declare class InboundMessagesResource {
223
299
  attachment(messageId: string, index: number, options?: {
224
300
  signal?: AbortSignal;
225
301
  }): Promise<BinaryResult>;
302
+ update(id: string, params: UpdateInboundMessageParams): Promise<InboundMessage>;
303
+ delete(id: string): Promise<void>;
304
+ }
305
+ declare class InboundFoldersResource {
306
+ private readonly client;
307
+ constructor(client: ApiClient);
308
+ list(): Promise<InboxFolderOverview>;
309
+ create(name: string): Promise<InboxFolder>;
310
+ update(id: string, name: string): Promise<InboxFolder>;
311
+ delete(id: string): Promise<void>;
226
312
  }
227
313
  declare class InboundResource {
228
314
  readonly routes: InboundRoutesResource;
229
315
  readonly messages: InboundMessagesResource;
316
+ readonly folders: InboundFoldersResource;
230
317
  constructor(client: ApiClient);
231
318
  }
232
319
 
@@ -388,50 +475,31 @@ declare class WebhooksResource {
388
475
  update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint>;
389
476
  delete(id: string): Promise<void>;
390
477
  test(id: string, event?: string): Promise<WebhookDelivery>;
478
+ rotateSecret(id: string): Promise<WebhookCreated>;
391
479
  events(): Promise<WebhookEventDescriptor[]>;
392
480
  }
393
481
 
394
- interface SendWhatsAppMessageParams {
395
- template_id: string;
396
- to: string[];
397
- parameters?: Record<string, string>;
398
- idempotency_key?: string;
399
- }
400
- interface WhatsAppMessage {
401
- id: string;
402
- to: string;
403
- status: string;
404
- }
405
-
406
- declare class WhatsAppResource {
407
- readonly messages: WhatsAppMessagesResource;
408
- constructor(client: ApiClient);
409
- }
410
- declare class WhatsAppMessagesResource {
411
- private readonly client;
412
- constructor(client: ApiClient);
413
- send(params: SendWhatsAppMessageParams): Promise<WhatsAppMessage[]>;
414
- sendBatch(messages: SendWhatsAppMessageParams[]): Promise<BatchItemResult[]>;
415
- }
416
-
417
482
  interface NotideusErrorOptions {
418
483
  code: string;
419
484
  message: string;
420
485
  status: number;
421
486
  retryAfter?: number;
487
+ /** Admin-provided note, present on account_suspended errors. */
488
+ reason?: string;
422
489
  }
423
490
  declare class NotideusError extends Error {
424
491
  readonly code: string;
425
492
  readonly status: number;
426
493
  readonly retryAfter?: number;
494
+ readonly reason?: string;
427
495
  constructor(options: NotideusErrorOptions);
428
496
  }
429
497
 
430
498
  declare class Notideus {
431
499
  private readonly client;
432
500
  readonly emails: EmailsResource;
501
+ readonly events: EventsResource;
433
502
  readonly contacts: ContactsResource;
434
- readonly whatsapp: WhatsAppResource;
435
503
  readonly unsubscribe: UnsubscribeResource;
436
504
  readonly plans: PlansResource;
437
505
  readonly webhooks: WebhooksResource;
@@ -439,4 +507,5 @@ declare class Notideus {
439
507
  constructor(apiKey?: string, options?: Omit<ClientOptions, 'apiKey'>);
440
508
  }
441
509
 
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 };
510
+ export { Notideus, NotideusError };
511
+ export type { AutomationEvent, BatchItemError, BatchItemResult, BinaryResult, BulkContactInput, ClientOptions, Contact, ContactStatus, ContactsTier, CreateContactParams, CreateInboundRouteParams, CreateWebhookParams, Email, FreeAllowances, InboundAttachment, InboundMessage, InboundMessageStatus, InboundRoute, InboundRouteStatus, InboxCounts, InboxFolder, InboxFolderFilter, InboxFolderName, InboxFolderOverview, ListContactsParams, ListContactsResponse, ListInboundMessagesParams, ListInboundMessagesResponse, ListInboundRoutesResponse, ListWebhookDeliveriesParams, ListWebhookDeliveriesResponse, ListWebhooksParams, ListWebhooksResponse, Plan, PlanCatalog, PlanLocale, PlanTier, SendEmailParams, SendEventParams, SendEventResult, UnsubscribeInfo, UnsubscribeTopic, UpdateContactParams, UpdateInboundMessageParams, UpdateInboundRouteParams, UpdateWebhookParams, WebhookAttempt, WebhookCreated, WebhookDelivery, WebhookDeliveryResult, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointStatus, WebhookEventDescriptor };
package/dist/index.d.ts CHANGED
@@ -95,6 +95,8 @@ declare class ContactsResource {
95
95
  interface SendEmailParams {
96
96
  from: string;
97
97
  to: string[];
98
+ cc?: string[];
99
+ bcc?: string[];
98
100
  subject: string;
99
101
  html?: string;
100
102
  text?: string;
@@ -104,6 +106,10 @@ interface SendEmailParams {
104
106
  variables?: Record<string, string>;
105
107
  tags?: string[];
106
108
  idempotency_key?: string;
109
+ /** Opt into open tracking (1px pixel injected at send time). Default false. */
110
+ track_opens?: boolean;
111
+ /** Opt into click tracking (links rewritten through the redirect). Default false. */
112
+ track_clicks?: boolean;
107
113
  }
108
114
  interface Email {
109
115
  id: string;
@@ -112,6 +118,8 @@ interface Email {
112
118
  template_id: string | null;
113
119
  from_address: string;
114
120
  to_emails: string[];
121
+ cc_emails: string[];
122
+ bcc_emails: string[];
115
123
  subject: string;
116
124
  html: string;
117
125
  size_kb: number;
@@ -136,6 +144,38 @@ declare class EmailsResource {
136
144
  sendBatch(emails: SendEmailParams[]): Promise<BatchItemResult[]>;
137
145
  }
138
146
 
147
+ interface SendEventBase {
148
+ event: string;
149
+ payload?: Record<string, unknown>;
150
+ idempotency_key?: string;
151
+ }
152
+ type SendEventParams = SendEventBase & ({
153
+ email: string;
154
+ contact_id?: never;
155
+ } | {
156
+ contact_id: string;
157
+ email?: never;
158
+ });
159
+ interface AutomationEvent {
160
+ id: string;
161
+ event: string;
162
+ email: string;
163
+ contact_id: string | null;
164
+ payload: Record<string, unknown>;
165
+ source: 'api' | 'test';
166
+ created_at: string;
167
+ }
168
+ interface SendEventResult {
169
+ event: AutomationEvent;
170
+ created: boolean;
171
+ }
172
+
173
+ declare class EventsResource {
174
+ private readonly client;
175
+ constructor(client: ApiClient);
176
+ send(params: SendEventParams): Promise<SendEventResult>;
177
+ }
178
+
139
179
  type InboundRouteStatus = 'active' | 'disabled';
140
180
  interface InboundRoute {
141
181
  id: string;
@@ -191,10 +231,46 @@ interface InboundMessage {
191
231
  status: InboundMessageStatus;
192
232
  error: string | null;
193
233
  received_at: string;
234
+ read_at: string | null;
235
+ starred: boolean;
236
+ folder: 'inbox' | 'archive' | 'trash';
237
+ folder_id: string | null;
238
+ }
239
+ type InboxFolderName = 'inbox' | 'archive' | 'trash';
240
+ type InboxFolderFilter = InboxFolderName | 'starred' | 'all';
241
+ interface InboxFolder {
242
+ id: string;
243
+ name: string;
244
+ created_at: string;
245
+ updated_at: string;
246
+ }
247
+ interface InboxCounts {
248
+ inbox: number;
249
+ unread: number;
250
+ starred: number;
251
+ archive: number;
252
+ trash: number;
253
+ all: number;
254
+ }
255
+ interface InboxFolderOverview {
256
+ data: InboxFolder[];
257
+ counts: InboxCounts;
258
+ route_unread: Record<string, number>;
259
+ }
260
+ interface UpdateInboundMessageParams {
261
+ read?: boolean;
262
+ starred?: boolean;
263
+ folder?: InboxFolderName;
264
+ folder_id?: string;
194
265
  }
195
266
  interface ListInboundMessagesParams {
196
267
  q?: string;
197
268
  route_id?: string;
269
+ folder?: InboxFolderFilter;
270
+ folder_id?: string;
271
+ unread?: boolean;
272
+ attachments?: boolean;
273
+ sort?: 'newest' | 'oldest';
198
274
  cursor?: string;
199
275
  limit?: number;
200
276
  }
@@ -223,10 +299,21 @@ declare class InboundMessagesResource {
223
299
  attachment(messageId: string, index: number, options?: {
224
300
  signal?: AbortSignal;
225
301
  }): Promise<BinaryResult>;
302
+ update(id: string, params: UpdateInboundMessageParams): Promise<InboundMessage>;
303
+ delete(id: string): Promise<void>;
304
+ }
305
+ declare class InboundFoldersResource {
306
+ private readonly client;
307
+ constructor(client: ApiClient);
308
+ list(): Promise<InboxFolderOverview>;
309
+ create(name: string): Promise<InboxFolder>;
310
+ update(id: string, name: string): Promise<InboxFolder>;
311
+ delete(id: string): Promise<void>;
226
312
  }
227
313
  declare class InboundResource {
228
314
  readonly routes: InboundRoutesResource;
229
315
  readonly messages: InboundMessagesResource;
316
+ readonly folders: InboundFoldersResource;
230
317
  constructor(client: ApiClient);
231
318
  }
232
319
 
@@ -388,50 +475,31 @@ declare class WebhooksResource {
388
475
  update(id: string, params: UpdateWebhookParams): Promise<WebhookEndpoint>;
389
476
  delete(id: string): Promise<void>;
390
477
  test(id: string, event?: string): Promise<WebhookDelivery>;
478
+ rotateSecret(id: string): Promise<WebhookCreated>;
391
479
  events(): Promise<WebhookEventDescriptor[]>;
392
480
  }
393
481
 
394
- interface SendWhatsAppMessageParams {
395
- template_id: string;
396
- to: string[];
397
- parameters?: Record<string, string>;
398
- idempotency_key?: string;
399
- }
400
- interface WhatsAppMessage {
401
- id: string;
402
- to: string;
403
- status: string;
404
- }
405
-
406
- declare class WhatsAppResource {
407
- readonly messages: WhatsAppMessagesResource;
408
- constructor(client: ApiClient);
409
- }
410
- declare class WhatsAppMessagesResource {
411
- private readonly client;
412
- constructor(client: ApiClient);
413
- send(params: SendWhatsAppMessageParams): Promise<WhatsAppMessage[]>;
414
- sendBatch(messages: SendWhatsAppMessageParams[]): Promise<BatchItemResult[]>;
415
- }
416
-
417
482
  interface NotideusErrorOptions {
418
483
  code: string;
419
484
  message: string;
420
485
  status: number;
421
486
  retryAfter?: number;
487
+ /** Admin-provided note, present on account_suspended errors. */
488
+ reason?: string;
422
489
  }
423
490
  declare class NotideusError extends Error {
424
491
  readonly code: string;
425
492
  readonly status: number;
426
493
  readonly retryAfter?: number;
494
+ readonly reason?: string;
427
495
  constructor(options: NotideusErrorOptions);
428
496
  }
429
497
 
430
498
  declare class Notideus {
431
499
  private readonly client;
432
500
  readonly emails: EmailsResource;
501
+ readonly events: EventsResource;
433
502
  readonly contacts: ContactsResource;
434
- readonly whatsapp: WhatsAppResource;
435
503
  readonly unsubscribe: UnsubscribeResource;
436
504
  readonly plans: PlansResource;
437
505
  readonly webhooks: WebhooksResource;
@@ -439,4 +507,5 @@ declare class Notideus {
439
507
  constructor(apiKey?: string, options?: Omit<ClientOptions, 'apiKey'>);
440
508
  }
441
509
 
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 };
510
+ export { Notideus, NotideusError };
511
+ export type { AutomationEvent, BatchItemError, BatchItemResult, BinaryResult, BulkContactInput, ClientOptions, Contact, ContactStatus, ContactsTier, CreateContactParams, CreateInboundRouteParams, CreateWebhookParams, Email, FreeAllowances, InboundAttachment, InboundMessage, InboundMessageStatus, InboundRoute, InboundRouteStatus, InboxCounts, InboxFolder, InboxFolderFilter, InboxFolderName, InboxFolderOverview, ListContactsParams, ListContactsResponse, ListInboundMessagesParams, ListInboundMessagesResponse, ListInboundRoutesResponse, ListWebhookDeliveriesParams, ListWebhookDeliveriesResponse, ListWebhooksParams, ListWebhooksResponse, Plan, PlanCatalog, PlanLocale, PlanTier, SendEmailParams, SendEventParams, SendEventResult, UnsubscribeInfo, UnsubscribeTopic, UpdateContactParams, UpdateInboundMessageParams, UpdateInboundRouteParams, UpdateWebhookParams, WebhookAttempt, WebhookCreated, WebhookDelivery, WebhookDeliveryResult, WebhookDeliveryStatus, WebhookEndpoint, WebhookEndpointStatus, WebhookEventDescriptor };
package/dist/index.js CHANGED
@@ -3,12 +3,14 @@ var NotideusError = class extends Error {
3
3
  code;
4
4
  status;
5
5
  retryAfter;
6
+ reason;
6
7
  constructor(options) {
7
8
  super(options.message);
8
9
  this.name = "NotideusError";
9
10
  this.code = options.code;
10
11
  this.status = options.status;
11
12
  this.retryAfter = options.retryAfter;
13
+ this.reason = options.reason;
12
14
  }
13
15
  };
14
16
 
@@ -138,10 +140,12 @@ var ApiClient = class {
138
140
  async toError(response) {
139
141
  let code = "unknown_error";
140
142
  let message = response.statusText || `HTTP ${response.status}`;
143
+ let reason;
141
144
  try {
142
145
  const parsed = await response.json();
143
146
  if (parsed.error?.code) code = parsed.error.code;
144
147
  if (parsed.error?.message) message = parsed.error.message;
148
+ if (typeof parsed.error?.reason === "string") reason = parsed.error.reason;
145
149
  } catch {
146
150
  }
147
151
  const retryAfterHeader = response.headers.get("retry-after");
@@ -149,7 +153,8 @@ var ApiClient = class {
149
153
  code,
150
154
  message,
151
155
  status: response.status,
152
- retryAfter: retryAfterHeader ? Number(retryAfterHeader) : void 0
156
+ retryAfter: retryAfterHeader ? Number(retryAfterHeader) : void 0,
157
+ reason
153
158
  });
154
159
  }
155
160
  };
@@ -221,6 +226,17 @@ var EmailsResource = class {
221
226
  }
222
227
  };
223
228
 
229
+ // src/resources/events.ts
230
+ var EventsResource = class {
231
+ constructor(client) {
232
+ this.client = client;
233
+ }
234
+ client;
235
+ async send(params) {
236
+ return this.client.request("POST", "/v1/events/send", { body: params });
237
+ }
238
+ };
239
+
224
240
  // src/resources/inbound.ts
225
241
  function routePath(id) {
226
242
  return `/v1/inbound/routes/${encodeURIComponent(id)}`;
@@ -258,9 +274,19 @@ var InboundMessagesResource = class {
258
274
  }
259
275
  client;
260
276
  async list(params = {}) {
261
- const { q, route_id, cursor, limit } = params;
277
+ const { q, route_id, folder, folder_id, unread, attachments, sort, cursor, limit } = params;
262
278
  return this.client.request("GET", "/v1/inbound/messages", {
263
- query: { q, route_id, cursor, limit }
279
+ query: {
280
+ q,
281
+ route_id,
282
+ folder,
283
+ folder_id,
284
+ unread: unread === void 0 ? void 0 : String(unread),
285
+ attachments: attachments === void 0 ? void 0 : String(attachments),
286
+ sort,
287
+ cursor,
288
+ limit
289
+ }
264
290
  });
265
291
  }
266
292
  async get(id) {
@@ -273,13 +299,45 @@ var InboundMessagesResource = class {
273
299
  async attachment(messageId, index, options = {}) {
274
300
  return this.client.requestBinary(`${messagePath(messageId)}/attachments/${index}`, options);
275
301
  }
302
+ async update(id, params) {
303
+ const res = await this.client.request("PATCH", messagePath(id), { body: params });
304
+ return res.message;
305
+ }
306
+ async delete(id) {
307
+ await this.client.request("DELETE", messagePath(id));
308
+ }
309
+ };
310
+ function folderPath(id) {
311
+ return `/v1/inbound/folders/${encodeURIComponent(id)}`;
312
+ }
313
+ var InboundFoldersResource = class {
314
+ constructor(client) {
315
+ this.client = client;
316
+ }
317
+ client;
318
+ async list() {
319
+ return this.client.request("GET", "/v1/inbound/folders");
320
+ }
321
+ async create(name) {
322
+ const res = await this.client.request("POST", "/v1/inbound/folders", { body: { name } });
323
+ return res.folder;
324
+ }
325
+ async update(id, name) {
326
+ const res = await this.client.request("PATCH", folderPath(id), { body: { name } });
327
+ return res.folder;
328
+ }
329
+ async delete(id) {
330
+ await this.client.request("DELETE", folderPath(id));
331
+ }
276
332
  };
277
333
  var InboundResource = class {
278
334
  routes;
279
335
  messages;
336
+ folders;
280
337
  constructor(client) {
281
338
  this.routes = new InboundRoutesResource(client);
282
339
  this.messages = new InboundMessagesResource(client);
340
+ this.folders = new InboundFoldersResource(client);
283
341
  }
284
342
  };
285
343
 
@@ -385,44 +443,23 @@ var WebhooksResource = class {
385
443
  );
386
444
  return res.delivery;
387
445
  }
446
+ // rotateSecret replaces the endpoint's signing secret; the new secret is
447
+ // returned exactly once. The old secret stops working immediately.
448
+ async rotateSecret(id) {
449
+ return this.client.request("POST", `${webhookPath(id)}/rotate-secret`, { body: {} });
450
+ }
388
451
  async events() {
389
452
  const res = await this.client.request("GET", "/v1/webhooks/meta/events");
390
453
  return res.data;
391
454
  }
392
455
  };
393
456
 
394
- // src/resources/whatsapp.ts
395
- var WhatsAppResource = class {
396
- messages;
397
- constructor(client) {
398
- this.messages = new WhatsAppMessagesResource(client);
399
- }
400
- };
401
- var WhatsAppMessagesResource = class {
402
- constructor(client) {
403
- this.client = client;
404
- }
405
- client;
406
- async send(params) {
407
- const res = await this.client.request("POST", "/v1/whatsapp/messages", {
408
- body: params
409
- });
410
- return res.data;
411
- }
412
- async sendBatch(messages) {
413
- const res = await this.client.request("POST", "/v1/whatsapp/messages/batch", {
414
- body: { messages }
415
- });
416
- return res.data;
417
- }
418
- };
419
-
420
457
  // src/index.ts
421
458
  var Notideus = class {
422
459
  client;
423
460
  emails;
461
+ events;
424
462
  contacts;
425
- whatsapp;
426
463
  unsubscribe;
427
464
  plans;
428
465
  webhooks;
@@ -430,8 +467,8 @@ var Notideus = class {
430
467
  constructor(apiKey, options = {}) {
431
468
  this.client = new ApiClient({ ...options, apiKey });
432
469
  this.emails = new EmailsResource(this.client);
470
+ this.events = new EventsResource(this.client);
433
471
  this.contacts = new ContactsResource(this.client);
434
- this.whatsapp = new WhatsAppResource(this.client);
435
472
  this.unsubscribe = new UnsubscribeResource(this.client);
436
473
  this.plans = new PlansResource(this.client);
437
474
  this.webhooks = new WebhooksResource(this.client);
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/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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,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;AAC1C,SAAK,WAAW,IAAI,iBAAiB,KAAK,MAAM;AAChD,SAAK,UAAU,IAAI,gBAAgB,KAAK,MAAM;AAAA,EAChD;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts","../src/resources/contacts.ts","../src/resources/emails.ts","../src/resources/events.ts","../src/resources/inbound.ts","../src/resources/plans.ts","../src/resources/unsubscribe.ts","../src/resources/webhook-deliveries.ts","../src/resources/webhooks.ts","../src/index.ts"],"sourcesContent":["export interface NotideusErrorOptions {\n code: string;\n message: string;\n status: number;\n retryAfter?: number;\n /** Admin-provided note, present on account_suspended errors. */\n reason?: string;\n}\n\nexport class NotideusError extends Error {\n readonly code: string;\n readonly status: number;\n readonly retryAfter?: number;\n readonly reason?: string;\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 this.reason = options.reason;\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 let reason: string | undefined;\n try {\n const parsed = (await response.json()) as { error?: { code?: string; message?: string; reason?: string } };\n if (parsed.error?.code) code = parsed.error.code;\n if (parsed.error?.message) message = parsed.error.message;\n if (typeof parsed.error?.reason === 'string') reason = parsed.error.reason;\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 reason\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 } from '../client.js';\nimport type { SendEventParams, SendEventResult } from '../types/event.js';\n\nexport class EventsResource {\n constructor(private readonly client: ApiClient) {}\n\n async send(params: SendEventParams): Promise<SendEventResult> {\n return this.client.request<SendEventResult>('POST', '/v1/events/send', { body: params });\n }\n}\n","import type { ApiClient, BinaryResult } from '../client.js';\nimport type {\n CreateInboundRouteParams,\n InboundMessage,\n InboundRoute,\n InboxFolder,\n InboxFolderOverview,\n UpdateInboundMessageParams,\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, folder, folder_id, unread, attachments, sort, cursor, limit } = params;\n return this.client.request<ListInboundMessagesResponse>('GET', '/v1/inbound/messages', {\n query: {\n q,\n route_id,\n folder,\n folder_id,\n unread: unread === undefined ? undefined : String(unread),\n attachments: attachments === undefined ? undefined : String(attachments),\n sort,\n cursor,\n limit\n }\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 async update(id: string, params: UpdateInboundMessageParams): Promise<InboundMessage> {\n const res = await this.client.request<{ message: InboundMessage }>('PATCH', messagePath(id), { body: params });\n return res.message;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', messagePath(id));\n }\n}\n\nfunction folderPath(id: string): string {\n return `/v1/inbound/folders/${encodeURIComponent(id)}`;\n}\n\nexport class InboundFoldersResource {\n constructor(private readonly client: ApiClient) {}\n\n async list(): Promise<InboxFolderOverview> {\n return this.client.request<InboxFolderOverview>('GET', '/v1/inbound/folders');\n }\n\n async create(name: string): Promise<InboxFolder> {\n const res = await this.client.request<{ folder: InboxFolder }>('POST', '/v1/inbound/folders', { body: { name } });\n return res.folder;\n }\n\n async update(id: string, name: string): Promise<InboxFolder> {\n const res = await this.client.request<{ folder: InboxFolder }>('PATCH', folderPath(id), { body: { name } });\n return res.folder;\n }\n\n async delete(id: string): Promise<void> {\n await this.client.request<void>('DELETE', folderPath(id));\n }\n}\n\nexport class InboundResource {\n readonly routes: InboundRoutesResource;\n readonly messages: InboundMessagesResource;\n readonly folders: InboundFoldersResource;\n\n constructor(client: ApiClient) {\n this.routes = new InboundRoutesResource(client);\n this.messages = new InboundMessagesResource(client);\n this.folders = new InboundFoldersResource(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 // rotateSecret replaces the endpoint's signing secret; the new secret is\n // returned exactly once. The old secret stops working immediately.\n async rotateSecret(id: string): Promise<WebhookCreated> {\n return this.client.request<WebhookCreated>('POST', `${webhookPath(id)}/rotate-secret`, { body: {} });\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 { ApiClient, type ClientOptions } from './client.js';\nimport { ContactsResource } from './resources/contacts.js';\nimport { EmailsResource } from './resources/emails.js';\nimport { EventsResource } from './resources/events.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';\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 { AutomationEvent, SendEventParams, SendEventResult } from './types/event.js';\nexport type {\n CreateInboundRouteParams,\n InboundAttachment,\n InboundMessage,\n InboundMessageStatus,\n InboundRoute,\n InboundRouteStatus,\n InboxFolder,\n InboxFolderName,\n InboxFolderFilter,\n InboxCounts,\n InboxFolderOverview,\n UpdateInboundMessageParams,\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 { 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 events: EventsResource;\n readonly contacts: ContactsResource;\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.events = new EventsResource(this.client);\n this.contacts = new ContactsResource(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":";AASO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EACA;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;AAC1B,SAAK,SAAS,QAAQ;AAAA,EACxB;AACF;;;ACrBA,IAAM,mBAAmB;AACzB,IAAM,qBAAqB;AAC3B,IAAM,UAAU;AAuBT,IAAM,YAAN,MAAgB;AAAA,EACJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,E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ACA;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,SAAS,IAAI,eAAe,KAAK,MAAM;AAC5C,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notideus",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Official Node.js SDK for the Notideus email API",
5
5
  "keywords": [
6
6
  "notideus",
@@ -11,8 +11,7 @@
11
11
  "sdk",
12
12
  "api client",
13
13
  "nodejs",
14
- "typescript",
15
- "whatsapp"
14
+ "typescript"
16
15
  ],
17
16
  "license": "MIT",
18
17
  "repository": "github:notideus/sdk-node",
@@ -47,10 +46,10 @@
47
46
  "prepublishOnly": "npm run build"
48
47
  },
49
48
  "devDependencies": {
50
- "@eslint/js": "^9.13.0",
49
+ "@eslint/js": "^10.0.1",
51
50
  "@types/node": "^26.6.4",
52
51
  "eslint": "^10.12.0",
53
- "tsup": "^8.3.0",
52
+ "tsup": "^9.0.0",
54
53
  "typescript": "^5.6.0",
55
54
  "typescript-eslint": "^8.10.0",
56
55
  "vitest": "^5.0.3"