@bernierllc/nevarmail 0.31.0 → 0.32.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +19 -2
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -439,6 +439,10 @@ export interface Sender {
439
439
  createdAt: string;
440
440
  updatedAt: string;
441
441
  }
442
+ /** What `createSender` and `updateSender` return: the sender, plus the default it displaced (else `null`). */
443
+ export type SenderWriteResult = Sender & {
444
+ replacedDefaultSenderId: string | null;
445
+ };
442
446
  export interface CreateSenderInput {
443
447
  name: string;
444
448
  /** Must be on a verified sending domain of the sender's project, else 400 `VALIDATION_ERROR`. */
@@ -448,7 +452,20 @@ export interface CreateSenderInput {
448
452
  provider?: string;
449
453
  providerSenderId?: string;
450
454
  priority?: number;
455
+ /**
456
+ * Make this the project's default sender. When the project already has a default, the call
457
+ * fails with 409 `DEFAULT_SENDER_EXISTS` (`error.body.details` names `current_default_sender_id`
458
+ * and `current_default_from_email`) unless `replaceDefault: true` is also sent. A project's first
459
+ * sender becomes the default without it.
460
+ */
451
461
  isDefault?: boolean;
462
+ /** Confirms that `isDefault: true` may take the default from the sender that holds it. Ignored otherwise. */
463
+ replaceDefault?: boolean;
464
+ /**
465
+ * The default sender you were shown (`details.current_default_sender_id` of the 409) and confirmed
466
+ * replacing. If the default changed since, the call fails with 409 again. Optional with `replaceDefault`.
467
+ */
468
+ replaceDefaultSenderId?: string;
452
469
  /**
453
470
  * Target project (UUID). Omit it when the org has only one project — it goes there.
454
471
  * Several projects and no `projectId`: 400 `PROJECT_REQUIRED`. No project on the org:
@@ -1134,7 +1151,7 @@ export declare class NevarMail {
1134
1151
  /** GET /api/v1/senders — paged. */
1135
1152
  listSenders(options?: PageOptions): Promise<Paginated<Sender>>;
1136
1153
  /** POST /api/v1/senders */
1137
- createSender(input: CreateSenderInput): Promise<Sender>;
1154
+ createSender(input: CreateSenderInput): Promise<SenderWriteResult>;
1138
1155
  /**
1139
1156
  * POST /api/v1/senders/import — adopt the sender identities already at the
1140
1157
  * project's connected provider account instead of creating parallel ones.
@@ -1150,7 +1167,7 @@ export declare class NevarMail {
1150
1167
  /** GET /api/v1/senders/{id} — 404 NOT_FOUND. */
1151
1168
  getSender(id: string): Promise<Sender>;
1152
1169
  /** PATCH /api/v1/senders/{id} — a partial update; the route has no PUT. */
1153
- updateSender(id: string, input: UpdateSenderInput): Promise<Sender>;
1170
+ updateSender(id: string, input: UpdateSenderInput): Promise<SenderWriteResult>;
1154
1171
  /**
1155
1172
  * DELETE /api/v1/senders/{id} — 404 NOT_FOUND. A sender linked to a provider identity
1156
1173
  * (`providerSenderId`) returns 400 `VALIDATION_ERROR`: a re-sync would bring it back, so
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.31.0",
3
+ "version": "0.32.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",