@bernierllc/nevarmail 0.13.0 → 0.14.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 +3 -0
- package/dist/index.d.ts +42 -3
- package/dist/index.js +30 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -162,6 +162,8 @@ Bounces, spam complaints and manual suppressions block every category regardless
|
|
|
162
162
|
| `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
|
|
163
163
|
| `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
|
|
164
164
|
| `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
|
|
165
|
+
| `getInboxDbStatus` | `GET /api/v1/inbox-db/status` | `org:read` |
|
|
166
|
+
| `connectInboxDb({ connectionString, provider? })` / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
|
|
165
167
|
|
|
166
168
|
Application-level details worth knowing before you hit them:
|
|
167
169
|
|
|
@@ -179,6 +181,7 @@ Application-level details worth knowing before you hit them:
|
|
|
179
181
|
`use_case_id` with `scope: "account"` is a `400`. `projectId` names the project the rows land
|
|
180
182
|
in; omitted, they land in the use case's project, else in every project the key's owner can open.
|
|
181
183
|
- **Managed accounts cannot delete domains** — `deleteDomain` throws `403 MANAGED_ACCOUNT`.
|
|
184
|
+
- **The inbox-db connection string is sent once and never echoed.** `connectInboxDb` stores it encrypted; `InboxDbStatus` omits it. `schemaName` is the Postgres schema NevarMail owns in your database.
|
|
182
185
|
|
|
183
186
|
Anything still not covered — analytics, campaigns, webhook endpoints — goes through
|
|
184
187
|
`request()` (or `requestPaginated()` for list routes), which applies the same auth, envelope
|
package/dist/index.d.ts
CHANGED
|
@@ -439,6 +439,25 @@ export interface AddSuppressionsResult {
|
|
|
439
439
|
invalid: number;
|
|
440
440
|
provider_sync: "queued" | "skipped";
|
|
441
441
|
}
|
|
442
|
+
export type InboxDbProvider = "byo" | "supabase" | "neon";
|
|
443
|
+
/** The org's inbox database as NevarMail last recorded it. Never includes the connection string. */
|
|
444
|
+
export interface InboxDbStatus {
|
|
445
|
+
provider: InboxDbProvider;
|
|
446
|
+
/** `connected` | `error` | `schema_drift` | `schema_conflict` | `pending_verification`. */
|
|
447
|
+
status: string;
|
|
448
|
+
/** The Postgres schema NevarMail owns in the customer database (`nevarmail_<org-slug>_<hash8>`; bare `nevarmail` on connections made before per-org schemas). */
|
|
449
|
+
schemaName: string;
|
|
450
|
+
schemaVersion: string | null;
|
|
451
|
+
pgvectorAvailable: boolean;
|
|
452
|
+
lastHealthCheck: string | null;
|
|
453
|
+
createdAt: string;
|
|
454
|
+
}
|
|
455
|
+
export interface ConnectInboxDbInput {
|
|
456
|
+
/** Postgres connection string; sent once over TLS, stored encrypted, never returned. */
|
|
457
|
+
connectionString: string;
|
|
458
|
+
/** Defaults to `byo`. */
|
|
459
|
+
provider?: InboxDbProvider;
|
|
460
|
+
}
|
|
442
461
|
export interface NevarMailOptions {
|
|
443
462
|
/**
|
|
444
463
|
* A REST API key (`nvm_api_live_…` / `nvm_api_test_…`). An MCP key is
|
|
@@ -479,11 +498,22 @@ export declare class NevarMail {
|
|
|
479
498
|
* routes, where dropping it would make `total` unknowable to the caller.
|
|
480
499
|
*/
|
|
481
500
|
requestPaginated<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", path: string, options?: RequestOptions): Promise<Paginated<T>>;
|
|
482
|
-
/**
|
|
501
|
+
/**
|
|
502
|
+
* POST /api/v1/email/send — one transactional message. A marketing send
|
|
503
|
+
* whose use case's list has a Custom HTML unsubscribe page and none saved is
|
|
504
|
+
* a 409 LIST_UNSUB_PAGE_MISSING; the message names where to save one.
|
|
505
|
+
*/
|
|
483
506
|
sendEmail(input: SendEmailInput): Promise<EmailResult>;
|
|
484
|
-
/**
|
|
507
|
+
/**
|
|
508
|
+
* POST /api/v1/email/send-to-list — one message to every contact on a list.
|
|
509
|
+
* 409 LIST_UNSUB_PAGE_MISSING while the list's Custom HTML unsubscribe page
|
|
510
|
+
* is unsaved; nobody is mailed.
|
|
511
|
+
*/
|
|
485
512
|
sendEmailToList(input: SendToListInput): Promise<SendToListResult>;
|
|
486
|
-
/**
|
|
513
|
+
/**
|
|
514
|
+
* POST /api/v1/email/schedule — queue a send for a future instant. Same
|
|
515
|
+
* guards as sendEmail at schedule time, including 409 LIST_UNSUB_PAGE_MISSING.
|
|
516
|
+
*/
|
|
487
517
|
scheduleEmail(input: ScheduleEmailInput): Promise<ScheduledEmail>;
|
|
488
518
|
/** GET /api/v1/email/schedule — the org's scheduled sends, newest first. */
|
|
489
519
|
listScheduledEmails(): Promise<ScheduledEmail[]>;
|
|
@@ -615,5 +645,14 @@ export declare class NevarMail {
|
|
|
615
645
|
listSuppressions(options?: ListSuppressionsOptions): Promise<Paginated<Suppression>>;
|
|
616
646
|
/** POST /api/v1/suppressions — bulk add; see AddSuppressionsInput for the scope rules. */
|
|
617
647
|
addSuppressions(input: AddSuppressionsInput): Promise<AddSuppressionsResult>;
|
|
648
|
+
/** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
|
|
649
|
+
getInboxDbStatus(): Promise<InboxDbStatus>;
|
|
650
|
+
/**
|
|
651
|
+
* POST /api/v1/inbox-db/connection — scope `org:write`; 201. Throws 422 when the database is
|
|
652
|
+
* unreachable, lacks pgvector/permissions, or already holds another org's schema.
|
|
653
|
+
*/
|
|
654
|
+
connectInboxDb(input: ConnectInboxDbInput): Promise<InboxDbStatus>;
|
|
655
|
+
/** POST /api/v1/inbox-db/connection/test — scope `org:write`; 404 when nothing is stored. */
|
|
656
|
+
testInboxDbConnection(): Promise<InboxDbStatus>;
|
|
618
657
|
}
|
|
619
658
|
export default NevarMail;
|
package/dist/index.js
CHANGED
|
@@ -197,15 +197,26 @@ export class NevarMail {
|
|
|
197
197
|
return true;
|
|
198
198
|
return options.signal !== undefined && cause?.name === "AbortError";
|
|
199
199
|
}
|
|
200
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* POST /api/v1/email/send — one transactional message. A marketing send
|
|
202
|
+
* whose use case's list has a Custom HTML unsubscribe page and none saved is
|
|
203
|
+
* a 409 LIST_UNSUB_PAGE_MISSING; the message names where to save one.
|
|
204
|
+
*/
|
|
201
205
|
sendEmail(input) {
|
|
202
206
|
return this.request("POST", "/api/v1/email/send", { body: input });
|
|
203
207
|
}
|
|
204
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* POST /api/v1/email/send-to-list — one message to every contact on a list.
|
|
210
|
+
* 409 LIST_UNSUB_PAGE_MISSING while the list's Custom HTML unsubscribe page
|
|
211
|
+
* is unsaved; nobody is mailed.
|
|
212
|
+
*/
|
|
205
213
|
sendEmailToList(input) {
|
|
206
214
|
return this.request("POST", "/api/v1/email/send-to-list", { body: input });
|
|
207
215
|
}
|
|
208
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* POST /api/v1/email/schedule — queue a send for a future instant. Same
|
|
218
|
+
* guards as sendEmail at schedule time, including 409 LIST_UNSUB_PAGE_MISSING.
|
|
219
|
+
*/
|
|
209
220
|
scheduleEmail(input) {
|
|
210
221
|
return this.request("POST", "/api/v1/email/schedule", { body: input });
|
|
211
222
|
}
|
|
@@ -430,5 +441,21 @@ export class NevarMail {
|
|
|
430
441
|
addSuppressions(input) {
|
|
431
442
|
return this.request("POST", "/api/v1/suppressions", { body: input });
|
|
432
443
|
}
|
|
444
|
+
// ── Inbox database ─────────────────────────────────────────────────────
|
|
445
|
+
/** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
|
|
446
|
+
getInboxDbStatus() {
|
|
447
|
+
return this.request("GET", "/api/v1/inbox-db/status");
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* POST /api/v1/inbox-db/connection — scope `org:write`; 201. Throws 422 when the database is
|
|
451
|
+
* unreachable, lacks pgvector/permissions, or already holds another org's schema.
|
|
452
|
+
*/
|
|
453
|
+
connectInboxDb(input) {
|
|
454
|
+
return this.request("POST", "/api/v1/inbox-db/connection", { body: input });
|
|
455
|
+
}
|
|
456
|
+
/** POST /api/v1/inbox-db/connection/test — scope `org:write`; 404 when nothing is stored. */
|
|
457
|
+
testInboxDbConnection() {
|
|
458
|
+
return this.request("POST", "/api/v1/inbox-db/connection/test");
|
|
459
|
+
}
|
|
433
460
|
}
|
|
434
461
|
export default NevarMail;
|
package/package.json
CHANGED