@bernierllc/nevarmail 0.18.0 → 0.19.1

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
@@ -135,6 +135,9 @@ suppression blocks only its own.
135
135
  - **Name it**, and an opt-out from a *different* category's list does not block the send,
136
136
  and a category marked non-suppressable is exempt from opt-outs.
137
137
  - **Omit it**, and every active suppression of the project applies — the strict reading.
138
+ Only a **project-scoped key** may omit it on `sendEmail` / `scheduleEmail`: the send runs as
139
+ that project's default use case. An **org-wide key** that omits it gets
140
+ `422 USE_CASE_REQUIRED`; `listUseCases()` shows yours.
138
141
 
139
142
  Bounces, spam complaints and manual suppressions block every category regardless. Only a
140
143
  `use_case_id` you passed yourself can narrow a block; a default the server resolves cannot.
@@ -174,7 +177,8 @@ the two, not both). The slug must exist in exactly one project the key can open:
174
177
  | `getProjectAddress(projectId)` / `setProjectAddress(projectId, { physicalAddress, addressComponents? })` | `GET` / `PUT /api/v1/projects/{id}/address` | `org:read` / `org:write` |
175
178
  | `getProjectMarketing(projectId)` / `setProjectMarketing(projectId, { marketingEnabled })` | `GET` / `PUT /api/v1/projects/{id}/marketing` | `org:read` / `org:write` |
176
179
  | `getInboxDbStatus` | `GET /api/v1/inbox-db/status` | `org:read` |
177
- | `connectInboxDb({ connectionString, provider? })` / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
180
+ | `connectInboxDb({ connectionString, provider? })` (202, starts a background connect) / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
181
+ | `getInboxDbConnectAttempt` (poll until `status` is not `running`) | `GET /api/v1/inbox-db/connection` | `org:read` |
178
182
 
179
183
  Application-level details worth knowing before you hit them:
180
184
 
package/dist/index.d.ts CHANGED
@@ -30,7 +30,9 @@ export interface SendEmailInput {
30
30
  /**
31
31
  * The message category this send belongs to. Naming it is what lets a
32
32
  * recipient's opt-out from a DIFFERENT category stop blocking this one —
33
- * omit it and every active suppression row applies. See the README.
33
+ * omit it and every active suppression row applies. Required with an
34
+ * org-wide key (or `useCase` on `sendEmail`): 422 `USE_CASE_REQUIRED`. A project-scoped
35
+ * key may omit it and sends as its project's default use case. See the README.
34
36
  */
35
37
  use_case_id?: string;
36
38
  /**
@@ -66,6 +68,7 @@ export interface SendToListInput {
66
68
  fromName?: string;
67
69
  replyTo?: string;
68
70
  tags?: string[];
71
+ /** Omit to send as the default use case of the list's project, with any key. */
69
72
  use_case_id?: string;
70
73
  }
71
74
  export interface ScheduleEmailInput extends Omit<SendEmailInput, "templateId" | "variables" | "useCase"> {
@@ -575,6 +578,22 @@ export interface ConnectInboxDbInput {
575
578
  /** Defaults to `byo`. */
576
579
  provider?: InboxDbProvider;
577
580
  }
581
+ /** Progress of the latest inbox database connect. Never includes the connection string. */
582
+ export interface InboxDbConnectAttempt {
583
+ provider: InboxDbProvider;
584
+ status: "running" | "failed" | "succeeded";
585
+ /** The step running now, or the one that failed. */
586
+ step: "connecting" | "pgvector" | "privileges" | "schema" | "done";
587
+ /** Why it failed, in words a person can act on. */
588
+ error: string | null;
589
+ /** Statement a database admin can run to fix a privilege failure. */
590
+ fixSql: string | null;
591
+ /** Whether someone asked to be emailed when it finishes. */
592
+ notify: boolean;
593
+ canRetry: boolean;
594
+ startedAt: string;
595
+ finishedAt: string | null;
596
+ }
578
597
  /** One structured part of a postal address (Places-style `addressComponents`). */
579
598
  export interface AddressComponent {
580
599
  longText: string;
@@ -859,10 +878,13 @@ export declare class NevarMail {
859
878
  /** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
860
879
  getInboxDbStatus(): Promise<InboxDbStatus>;
861
880
  /**
862
- * POST /api/v1/inbox-db/connection — scope `org:write`; 201. Throws 422 when the database is
863
- * unreachable, lacks pgvector/permissions, or already holds another org's schema.
881
+ * POST /api/v1/inbox-db/connection — scope `org:write`; 202. Starts connecting in the
882
+ * background; poll {@link getInboxDbConnectAttempt} until `status` is not `running`.
883
+ * Throws 409 while another connect runs and 400 when Agent Inboxes isn't active.
864
884
  */
865
- connectInboxDb(input: ConnectInboxDbInput): Promise<InboxDbStatus>;
885
+ connectInboxDb(input: ConnectInboxDbInput): Promise<InboxDbConnectAttempt>;
886
+ /** GET /api/v1/inbox-db/connection — scope `org:read`; the latest connect attempt, 404 when none. */
887
+ getInboxDbConnectAttempt(): Promise<InboxDbConnectAttempt>;
866
888
  /** POST /api/v1/inbox-db/connection/test — scope `org:write`; 404 when nothing is stored. */
867
889
  testInboxDbConnection(): Promise<InboxDbStatus>;
868
890
  }
package/dist/index.js CHANGED
@@ -548,12 +548,17 @@ export class NevarMail {
548
548
  return this.request("GET", "/api/v1/inbox-db/status");
549
549
  }
550
550
  /**
551
- * POST /api/v1/inbox-db/connection — scope `org:write`; 201. Throws 422 when the database is
552
- * unreachable, lacks pgvector/permissions, or already holds another org's schema.
551
+ * POST /api/v1/inbox-db/connection — scope `org:write`; 202. Starts connecting in the
552
+ * background; poll {@link getInboxDbConnectAttempt} until `status` is not `running`.
553
+ * Throws 409 while another connect runs and 400 when Agent Inboxes isn't active.
553
554
  */
554
555
  connectInboxDb(input) {
555
556
  return this.request("POST", "/api/v1/inbox-db/connection", { body: input });
556
557
  }
558
+ /** GET /api/v1/inbox-db/connection — scope `org:read`; the latest connect attempt, 404 when none. */
559
+ getInboxDbConnectAttempt() {
560
+ return this.request("GET", "/api/v1/inbox-db/connection");
561
+ }
557
562
  /** POST /api/v1/inbox-db/connection/test — scope `org:write`; 404 when nothing is stored. */
558
563
  testInboxDbConnection() {
559
564
  return this.request("POST", "/api/v1/inbox-db/connection/test");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "description": "Official client for the NevarMail v1 API. Typed, retries 429/5xx, throws NevarMailError on every non-2xx.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",