@bernierllc/nevarmail 0.16.0 → 0.17.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
@@ -165,6 +165,7 @@ Bounces, spam complaints and manual suppressions block every category regardless
165
165
  | `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
166
166
  | `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
167
167
  | `getProjectAddress(projectId)` / `setProjectAddress(projectId, { physicalAddress, addressComponents? })` | `GET` / `PUT /api/v1/projects/{id}/address` | `org:read` / `org:write` |
168
+ | `getProjectMarketing(projectId)` / `setProjectMarketing(projectId, { marketingEnabled })` | `GET` / `PUT /api/v1/projects/{id}/marketing` | `org:read` / `org:write` |
168
169
  | `getInboxDbStatus` | `GET /api/v1/inbox-db/status` | `org:read` |
169
170
  | `connectInboxDb({ connectionString, provider? })` / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
170
171
 
package/dist/index.d.ts CHANGED
@@ -327,6 +327,7 @@ export interface Sender {
327
327
  }
328
328
  export interface CreateSenderInput {
329
329
  name: string;
330
+ /** Must be on a verified sending domain of the sender's project, else 400 `VALIDATION_ERROR`. */
330
331
  fromEmail: string;
331
332
  fromName?: string;
332
333
  replyToEmail?: string;
@@ -341,8 +342,20 @@ export interface CreateSenderInput {
341
342
  */
342
343
  projectId?: string;
343
344
  }
344
- /** A sender stays in the project it was created in, so `projectId` is create-only. */
345
- export type UpdateSenderInput = Partial<Omit<CreateSenderInput, "projectId">>;
345
+ /**
346
+ * A sender stays in the project it was created in, so `projectId` is create-only.
347
+ * `isActive: false` switches the sender off: it is never resolved for a send, and if
348
+ * it was the project default the default passes to the oldest usable sender.
349
+ * A sender linked to a provider identity (`providerSenderId`) keeps its `fromEmail`:
350
+ * changing it returns 400 `VALIDATION_ERROR` unless the same update relinks it (new `providerSenderId`).
351
+ * An omitted field is left as it is; `null` clears `fromName`, `replyToEmail` or `provider`.
352
+ */
353
+ export type UpdateSenderInput = Partial<Omit<CreateSenderInput, "projectId" | "fromName" | "replyToEmail" | "provider">> & {
354
+ fromName?: string | null;
355
+ replyToEmail?: string | null;
356
+ provider?: string | null;
357
+ isActive?: boolean;
358
+ };
346
359
  /** Result of `importSenders`: counts per outcome, then the project's senders. */
347
360
  export interface ImportSendersResult {
348
361
  /** Provider identities with no NevarMail sender yet — created. */
@@ -352,6 +365,8 @@ export interface ImportSendersResult {
352
365
  /** Already-imported senders whose address or verification changed at the provider. */
353
366
  refreshed: number;
354
367
  unchanged: number;
368
+ /** Linked senders whose identity is gone from the provider — marked `not_at_provider`, never selected. */
369
+ missing: number;
355
370
  senders: Sender[];
356
371
  }
357
372
  export interface DnsRecord {
@@ -529,6 +544,10 @@ export interface SetProjectAddressInput {
529
544
  /** Omitted or null clears any stored parts. Max 30. */
530
545
  addressComponents?: AddressComponent[] | null;
531
546
  }
547
+ /** A project's marketing switch: while off, every marketing send from the project is refused. */
548
+ export interface ProjectMarketing {
549
+ marketingEnabled: boolean;
550
+ }
532
551
  export interface NevarMailOptions {
533
552
  /**
534
553
  * A REST API key (`nvm_api_live_…` / `nvm_api_test_…`). An MCP key is
@@ -711,7 +730,12 @@ export declare class NevarMail {
711
730
  getSender(id: string): Promise<Sender>;
712
731
  /** PATCH /api/v1/senders/{id} — a partial update; the route has no PUT. */
713
732
  updateSender(id: string, input: UpdateSenderInput): Promise<Sender>;
714
- /** DELETE /api/v1/senders/{id} — 404 NOT_FOUND. */
733
+ /**
734
+ * DELETE /api/v1/senders/{id} — 404 NOT_FOUND. A sender linked to a provider identity
735
+ * (`providerSenderId`) returns 400 `VALIDATION_ERROR`: a re-sync would bring it back, so
736
+ * switch it off (`isActive: false`), or delete the identity at the provider and call
737
+ * `importSenders`, which marks it `not_at_provider`; after that it can be deleted.
738
+ */
715
739
  deleteSender(id: string): Promise<{
716
740
  deleted: boolean;
717
741
  }>;
@@ -754,6 +778,14 @@ export declare class NevarMail {
754
778
  * marketing send is refused without one. Blank: 422 `PHYSICAL_ADDRESS_REQUIRED`.
755
779
  */
756
780
  setProjectAddress(projectId: string, input: SetProjectAddressInput): Promise<ProjectAddress>;
781
+ /** GET /api/v1/projects/{id}/marketing — scope `org:read`; 404 NOT_FOUND for a project the key's user can't open. */
782
+ getProjectMarketing(projectId: string): Promise<ProjectMarketing>;
783
+ /**
784
+ * PUT /api/v1/projects/{id}/marketing — scope `org:write`. Turns marketing
785
+ * mail on or off for the project. Turning it on while the project's postal
786
+ * address is blank: 422 `PHYSICAL_ADDRESS_REQUIRED` (set it with `setProjectAddress`).
787
+ */
788
+ setProjectMarketing(projectId: string, input: ProjectMarketing): Promise<ProjectMarketing>;
757
789
  /** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
758
790
  getInboxDbStatus(): Promise<InboxDbStatus>;
759
791
  /**
package/dist/index.js CHANGED
@@ -420,7 +420,12 @@ export class NevarMail {
420
420
  body: input,
421
421
  });
422
422
  }
423
- /** DELETE /api/v1/senders/{id} — 404 NOT_FOUND. */
423
+ /**
424
+ * DELETE /api/v1/senders/{id} — 404 NOT_FOUND. A sender linked to a provider identity
425
+ * (`providerSenderId`) returns 400 `VALIDATION_ERROR`: a re-sync would bring it back, so
426
+ * switch it off (`isActive: false`), or delete the identity at the provider and call
427
+ * `importSenders`, which marks it `not_at_provider`; after that it can be deleted.
428
+ */
424
429
  deleteSender(id) {
425
430
  return this.request("DELETE", `/api/v1/senders/${encodeURIComponent(id)}`);
426
431
  }
@@ -489,6 +494,18 @@ export class NevarMail {
489
494
  setProjectAddress(projectId, input) {
490
495
  return this.request("PUT", `/api/v1/projects/${encodeURIComponent(projectId)}/address`, { body: input });
491
496
  }
497
+ /** GET /api/v1/projects/{id}/marketing — scope `org:read`; 404 NOT_FOUND for a project the key's user can't open. */
498
+ getProjectMarketing(projectId) {
499
+ return this.request("GET", `/api/v1/projects/${encodeURIComponent(projectId)}/marketing`);
500
+ }
501
+ /**
502
+ * PUT /api/v1/projects/{id}/marketing — scope `org:write`. Turns marketing
503
+ * mail on or off for the project. Turning it on while the project's postal
504
+ * address is blank: 422 `PHYSICAL_ADDRESS_REQUIRED` (set it with `setProjectAddress`).
505
+ */
506
+ setProjectMarketing(projectId, input) {
507
+ return this.request("PUT", `/api/v1/projects/${encodeURIComponent(projectId)}/marketing`, { body: input });
508
+ }
492
509
  // ── Inbox database ─────────────────────────────────────────────────────
493
510
  /** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
494
511
  getInboxDbStatus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.16.0",
3
+ "version": "0.17.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",