@bernierllc/nevarmail 0.4.0 → 0.6.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
@@ -149,7 +149,9 @@ yourself can narrow a block; a default the server resolves cannot.
149
149
  | `listLists` / `createList` / `getList` | `/api/v1/lists` | `contacts:read` / `contacts:write` |
150
150
  | `addListContacts` | `POST /api/v1/lists/{id}/contacts` | `contacts:write` |
151
151
  | `listContacts` / `upsertContacts` / `updateContact` / `deleteContact` | `/api/v1/contacts` | `contacts:read` / `contacts:write` |
152
- | `listSenders` / `createSender` / `getSender` / `updateSender` / `deleteSender` | `/api/v1/senders` | `senders:read` / `senders:write` |
152
+ | `listSenders` / `createSender(input)` — `input.projectId?` targets a project when the org has more than one | `/api/v1/senders` | `senders:read` / `senders:write` |
153
+ | `getSender` / `updateSender` / `deleteSender` | `/api/v1/senders/{id}` | `senders:read` / `senders:write` |
154
+ | `importSenders({ projectId? })` — adopts the project's provider-account identities; re-run to pick up provider verification | `POST /api/v1/senders/import` | `senders:write` |
153
155
  | `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
154
156
  | `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
155
157
  | `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
package/dist/index.d.ts CHANGED
@@ -244,8 +244,26 @@ export interface CreateSenderInput {
244
244
  providerSenderId?: string;
245
245
  priority?: number;
246
246
  isDefault?: boolean;
247
+ /**
248
+ * Target project (UUID). Omit it when the org has only one project — it goes there.
249
+ * Several projects and no `projectId`: 400 `PROJECT_REQUIRED`. No project on the org:
250
+ * 422 `NO_PROJECT`. Key's user can't open the named project: 404 `NOT_FOUND`.
251
+ */
252
+ projectId?: string;
253
+ }
254
+ /** A sender stays in the project it was created in, so `projectId` is create-only. */
255
+ export type UpdateSenderInput = Partial<Omit<CreateSenderInput, "projectId">>;
256
+ /** Result of `importSenders`: counts per outcome, then the project's senders. */
257
+ export interface ImportSendersResult {
258
+ /** Provider identities with no NevarMail sender yet — created. */
259
+ imported: number;
260
+ /** Existing senders matched by address and stamped with the provider id. */
261
+ linked: number;
262
+ /** Already-imported senders whose address or verification changed at the provider. */
263
+ refreshed: number;
264
+ unchanged: number;
265
+ senders: Sender[];
247
266
  }
248
- export type UpdateSenderInput = Partial<CreateSenderInput>;
249
267
  export interface DnsRecord {
250
268
  type: "TXT" | "CNAME" | "MX";
251
269
  host: string;
@@ -461,6 +479,18 @@ export declare class NevarMail {
461
479
  listSenders(options?: PageOptions): Promise<Paginated<Sender>>;
462
480
  /** POST /api/v1/senders */
463
481
  createSender(input: CreateSenderInput): Promise<Sender>;
482
+ /**
483
+ * POST /api/v1/senders/import — adopt the sender identities already at the
484
+ * project's connected provider account instead of creating parallel ones.
485
+ * Idempotent; re-run it to pick up verification completed at the provider.
486
+ * `projectId` follows `createSender`: omit it only when the org has one
487
+ * project (else 400 `PROJECT_REQUIRED`); 404 `NOT_FOUND` for a project the
488
+ * key's user can't open; 400 `VALIDATION_ERROR` when that project has no
489
+ * connected provider account.
490
+ */
491
+ importSenders(options?: {
492
+ projectId?: string;
493
+ }): Promise<ImportSendersResult>;
464
494
  /** GET /api/v1/senders/{id} — 404 NOT_FOUND. */
465
495
  getSender(id: string): Promise<Sender>;
466
496
  /** PATCH /api/v1/senders/{id} — a partial update; the route has no PUT. */
package/dist/index.js CHANGED
@@ -311,6 +311,20 @@ export class NevarMail {
311
311
  createSender(input) {
312
312
  return this.request("POST", "/api/v1/senders", { body: input });
313
313
  }
314
+ /**
315
+ * POST /api/v1/senders/import — adopt the sender identities already at the
316
+ * project's connected provider account instead of creating parallel ones.
317
+ * Idempotent; re-run it to pick up verification completed at the provider.
318
+ * `projectId` follows `createSender`: omit it only when the org has one
319
+ * project (else 400 `PROJECT_REQUIRED`); 404 `NOT_FOUND` for a project the
320
+ * key's user can't open; 400 `VALIDATION_ERROR` when that project has no
321
+ * connected provider account.
322
+ */
323
+ importSenders(options = {}) {
324
+ return this.request("POST", "/api/v1/senders/import", {
325
+ query: { projectId: options.projectId },
326
+ });
327
+ }
314
328
  /** GET /api/v1/senders/{id} — 404 NOT_FOUND. */
315
329
  getSender(id) {
316
330
  return this.request("GET", `/api/v1/senders/${encodeURIComponent(id)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.4.0",
3
+ "version": "0.6.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",