@bernierllc/nevarmail 0.15.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 +2 -0
- package/dist/index.d.ts +67 -3
- package/dist/index.js +31 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,6 +164,8 @@ Bounces, spam complaints and manual suppressions block every category regardless
|
|
|
164
164
|
| `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
|
|
165
165
|
| `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
|
|
166
166
|
| `listSuppressions` / `addSuppressions` | `/api/v1/suppressions` | `org:read` / `org:write` |
|
|
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` |
|
|
167
169
|
| `getInboxDbStatus` | `GET /api/v1/inbox-db/status` | `org:read` |
|
|
168
170
|
| `connectInboxDb({ connectionString, provider? })` / `testInboxDbConnection` | `POST /api/v1/inbox-db/connection` / `…/connection/test` | `org:write` |
|
|
169
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
|
-
/**
|
|
345
|
-
|
|
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 {
|
|
@@ -505,6 +520,34 @@ export interface ConnectInboxDbInput {
|
|
|
505
520
|
/** Defaults to `byo`. */
|
|
506
521
|
provider?: InboxDbProvider;
|
|
507
522
|
}
|
|
523
|
+
/** One structured part of a postal address (Places-style `addressComponents`). */
|
|
524
|
+
export interface AddressComponent {
|
|
525
|
+
longText: string;
|
|
526
|
+
shortText: string;
|
|
527
|
+
types: string[];
|
|
528
|
+
languageCode?: string;
|
|
529
|
+
}
|
|
530
|
+
/** A project's CAN-SPAM postal address, the one its marketing mail's footer prints. */
|
|
531
|
+
export interface ProjectAddress {
|
|
532
|
+
physicalAddress: string;
|
|
533
|
+
addressComponents: AddressComponent[] | null;
|
|
534
|
+
}
|
|
535
|
+
/** `getProjectAddress`: the project's address plus the org's as a suggestion. */
|
|
536
|
+
export interface ProjectAddressWithOrg extends ProjectAddress {
|
|
537
|
+
/** Empty when the org has no address set. */
|
|
538
|
+
orgPhysicalAddress: string;
|
|
539
|
+
orgAddressComponents: AddressComponent[] | null;
|
|
540
|
+
}
|
|
541
|
+
export interface SetProjectAddressInput {
|
|
542
|
+
/** Never blank: 422 `PHYSICAL_ADDRESS_REQUIRED`. Trimmed; max 500 chars. */
|
|
543
|
+
physicalAddress: string;
|
|
544
|
+
/** Omitted or null clears any stored parts. Max 30. */
|
|
545
|
+
addressComponents?: AddressComponent[] | null;
|
|
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
|
+
}
|
|
508
551
|
export interface NevarMailOptions {
|
|
509
552
|
/**
|
|
510
553
|
* A REST API key (`nvm_api_live_…` / `nvm_api_test_…`). An MCP key is
|
|
@@ -687,7 +730,12 @@ export declare class NevarMail {
|
|
|
687
730
|
getSender(id: string): Promise<Sender>;
|
|
688
731
|
/** PATCH /api/v1/senders/{id} — a partial update; the route has no PUT. */
|
|
689
732
|
updateSender(id: string, input: UpdateSenderInput): Promise<Sender>;
|
|
690
|
-
/**
|
|
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
|
+
*/
|
|
691
739
|
deleteSender(id: string): Promise<{
|
|
692
740
|
deleted: boolean;
|
|
693
741
|
}>;
|
|
@@ -722,6 +770,22 @@ export declare class NevarMail {
|
|
|
722
770
|
listSuppressions(options?: ListSuppressionsOptions): Promise<Paginated<Suppression>>;
|
|
723
771
|
/** POST /api/v1/suppressions — bulk add; see AddSuppressionsInput for the scope rules. */
|
|
724
772
|
addSuppressions(input: AddSuppressionsInput): Promise<AddSuppressionsResult>;
|
|
773
|
+
/** GET /api/v1/projects/{id}/address — scope `org:read`; 404 NOT_FOUND for a project the key's user can't open. */
|
|
774
|
+
getProjectAddress(projectId: string): Promise<ProjectAddressWithOrg>;
|
|
775
|
+
/**
|
|
776
|
+
* PUT /api/v1/projects/{id}/address — scope `org:write`. Sets the postal
|
|
777
|
+
* address the CAN-SPAM footer of the project's marketing mail carries; a
|
|
778
|
+
* marketing send is refused without one. Blank: 422 `PHYSICAL_ADDRESS_REQUIRED`.
|
|
779
|
+
*/
|
|
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>;
|
|
725
789
|
/** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
|
|
726
790
|
getInboxDbStatus(): Promise<InboxDbStatus>;
|
|
727
791
|
/**
|
package/dist/index.js
CHANGED
|
@@ -420,7 +420,12 @@ export class NevarMail {
|
|
|
420
420
|
body: input,
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
|
-
/**
|
|
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
|
}
|
|
@@ -476,6 +481,31 @@ export class NevarMail {
|
|
|
476
481
|
addSuppressions(input) {
|
|
477
482
|
return this.request("POST", "/api/v1/suppressions", { body: input });
|
|
478
483
|
}
|
|
484
|
+
// ── Projects ───────────────────────────────────────────────────────────
|
|
485
|
+
/** GET /api/v1/projects/{id}/address — scope `org:read`; 404 NOT_FOUND for a project the key's user can't open. */
|
|
486
|
+
getProjectAddress(projectId) {
|
|
487
|
+
return this.request("GET", `/api/v1/projects/${encodeURIComponent(projectId)}/address`);
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* PUT /api/v1/projects/{id}/address — scope `org:write`. Sets the postal
|
|
491
|
+
* address the CAN-SPAM footer of the project's marketing mail carries; a
|
|
492
|
+
* marketing send is refused without one. Blank: 422 `PHYSICAL_ADDRESS_REQUIRED`.
|
|
493
|
+
*/
|
|
494
|
+
setProjectAddress(projectId, input) {
|
|
495
|
+
return this.request("PUT", `/api/v1/projects/${encodeURIComponent(projectId)}/address`, { body: input });
|
|
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
|
+
}
|
|
479
509
|
// ── Inbox database ─────────────────────────────────────────────────────
|
|
480
510
|
/** GET /api/v1/inbox-db/status — scope `org:read`; 404 when no connection is stored. */
|
|
481
511
|
getInboxDbStatus() {
|
package/package.json
CHANGED