@bernierllc/nevarmail 0.18.0 → 0.19.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
@@ -174,7 +174,8 @@ the two, not both). The slug must exist in exactly one project the key can open:
174
174
  | `getProjectAddress(projectId)` / `setProjectAddress(projectId, { physicalAddress, addressComponents? })` | `GET` / `PUT /api/v1/projects/{id}/address` | `org:read` / `org:write` |
175
175
  | `getProjectMarketing(projectId)` / `setProjectMarketing(projectId, { marketingEnabled })` | `GET` / `PUT /api/v1/projects/{id}/marketing` | `org:read` / `org:write` |
176
176
  | `getInboxDbStatus` | `GET /api/v1/inbox-db/status` | `org:read` |
177
- | `connectInboxDb({ connectionString, provider? })` / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
177
+ | `connectInboxDb({ connectionString, provider? })` (202, starts a background connect) / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
178
+ | `getInboxDbConnectAttempt` (poll until `status` is not `running`) | `GET /api/v1/inbox-db/connection` | `org:read` |
178
179
 
179
180
  Application-level details worth knowing before you hit them:
180
181
 
package/dist/index.d.ts CHANGED
@@ -575,6 +575,22 @@ export interface ConnectInboxDbInput {
575
575
  /** Defaults to `byo`. */
576
576
  provider?: InboxDbProvider;
577
577
  }
578
+ /** Progress of the latest inbox database connect. Never includes the connection string. */
579
+ export interface InboxDbConnectAttempt {
580
+ provider: InboxDbProvider;
581
+ status: "running" | "failed" | "succeeded";
582
+ /** The step running now, or the one that failed. */
583
+ step: "connecting" | "pgvector" | "privileges" | "schema" | "done";
584
+ /** Why it failed, in words a person can act on. */
585
+ error: string | null;
586
+ /** Statement a database admin can run to fix a privilege failure. */
587
+ fixSql: string | null;
588
+ /** Whether someone asked to be emailed when it finishes. */
589
+ notify: boolean;
590
+ canRetry: boolean;
591
+ startedAt: string;
592
+ finishedAt: string | null;
593
+ }
578
594
  /** One structured part of a postal address (Places-style `addressComponents`). */
579
595
  export interface AddressComponent {
580
596
  longText: string;
@@ -859,10 +875,13 @@ export declare class NevarMail {
859
875
  /** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
860
876
  getInboxDbStatus(): Promise<InboxDbStatus>;
861
877
  /**
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.
878
+ * POST /api/v1/inbox-db/connection — scope `org:write`; 202. Starts connecting in the
879
+ * background; poll {@link getInboxDbConnectAttempt} until `status` is not `running`.
880
+ * Throws 409 while another connect runs and 400 when Agent Inboxes isn't active.
864
881
  */
865
- connectInboxDb(input: ConnectInboxDbInput): Promise<InboxDbStatus>;
882
+ connectInboxDb(input: ConnectInboxDbInput): Promise<InboxDbConnectAttempt>;
883
+ /** GET /api/v1/inbox-db/connection — scope `org:read`; the latest connect attempt, 404 when none. */
884
+ getInboxDbConnectAttempt(): Promise<InboxDbConnectAttempt>;
866
885
  /** POST /api/v1/inbox-db/connection/test — scope `org:write`; 404 when nothing is stored. */
867
886
  testInboxDbConnection(): Promise<InboxDbStatus>;
868
887
  }
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.0",
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",