@bernierllc/nevarmail 0.30.0 → 0.31.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
@@ -180,6 +180,8 @@ the two, not both). The slug must exist in exactly one project the key can open:
180
180
  | `listUseCases({ projectId?, includeArchived? })` / `createUseCase(input)` — `input.projectId?` as for `createSender` | `/api/v1/use-cases` | `use-cases:read` / `use-cases:write` |
181
181
  | `getUseCase` / `updateUseCase` / `archiveUseCase` / `restoreUseCase` — delete archives; restore undoes it | `/api/v1/use-cases/{id}` | `use-cases:read` / `use-cases:write` |
182
182
  | `importSenders({ projectId? })` — adopts the project's provider-account identities; re-run to pick up provider verification | `POST /api/v1/senders/import` | `senders:write` |
183
+ | `getSendingPause({ projectId? })` — the org's pause, or one project's; `paused` is effective (an org pause covers every project), `local` is that scope alone | `GET /api/v1/safety/pause`, `GET /api/v1/projects/{id}/safety/pause` | `org:read` |
184
+ | `pauseSending({ projectId?, reason? })` / `resumeSending({ projectId? })` — stops or restarts all new mail; paused sends throw `423 SENDING_PAUSED`. A key pinned to one project cannot pause the org (`403 KEY_PROJECT_SCOPED`) | `PUT /api/v1/safety/pause`, `PUT /api/v1/projects/{id}/safety/pause` | `sending:pause` |
183
185
  | `listDomains` / `createDomain(domain, { projectId })` / `getDomain` / `deleteDomain` | `/api/v1/domains` | `domains:read` / `domains:write` |
184
186
  | `getDomainDnsRecords` / `verifyDomain` | `/api/v1/domains/{id}/…` | `domains:read` / `domains:write` |
185
187
  | `getDomainBrandedTracking` / `enableDomainBrandedTracking` | `GET` / `POST /api/v1/domains/{id}/branded-tracking` | `domains:read` / `domains:write` |
package/dist/index.d.ts CHANGED
@@ -470,6 +470,34 @@ export type UpdateSenderInput = Partial<Omit<CreateSenderInput, "projectId" | "f
470
470
  provider?: string | null;
471
471
  isActive?: boolean;
472
472
  };
473
+ /** Who paused a scope. `apiKeyId` is set when a key or OAuth token did it. */
474
+ export interface SendingPauseActor {
475
+ kind: "user" | "api_key" | "oauth";
476
+ userId: string;
477
+ apiKeyId: string | null;
478
+ }
479
+ /**
480
+ * GET/PUT `/api/v1/safety/pause` and `/api/v1/projects/{id}/safety/pause`.
481
+ * `paused` is the effective answer (an org pause covers every project);
482
+ * `local` is the scope asked about on its own.
483
+ */
484
+ export interface SendingPause {
485
+ paused: boolean;
486
+ /** Which pause is in force; the org's wins. Null while sending. */
487
+ level: "org" | "project" | null;
488
+ local: {
489
+ paused: boolean;
490
+ pausedAt: string | null;
491
+ pausedBy: SendingPauseActor | null;
492
+ reason: string | null;
493
+ };
494
+ /** Whether this key may change the pause (holds `sending:pause` and is not pinned elsewhere). */
495
+ canPause: boolean;
496
+ }
497
+ /** `projectId` omitted: the whole org. */
498
+ export interface SendingPauseScope {
499
+ projectId?: string;
500
+ }
473
501
  /** A use case: the message category a project files mail under (`use_case_id` / `useCase` on a send). */
474
502
  export interface UseCase {
475
503
  groupId?: string | null;
@@ -1159,6 +1187,22 @@ export declare class NevarMail {
1159
1187
  archiveUseCase(id: string): Promise<UseCase>;
1160
1188
  /** POST /api/v1/use-cases/{id}/restore — idempotent on an active use case. */
1161
1189
  restoreUseCase(id: string): Promise<UseCase>;
1190
+ /**
1191
+ * GET /api/v1/safety/pause, or /api/v1/projects/{id}/safety/pause with
1192
+ * `projectId`. Scope `org:read`.
1193
+ */
1194
+ getSendingPause(options?: SendingPauseScope): Promise<SendingPause>;
1195
+ /**
1196
+ * Stops all new mail for the org, or one project with `projectId`, until
1197
+ * `resumeSending`. Sends then fail with 423 `SENDING_PAUSED`. Scope
1198
+ * `sending:pause`; a key pinned to one project cannot pause the org
1199
+ * (403 `KEY_PROJECT_SCOPED`). `reason` (max 500 chars) is shown to the team.
1200
+ */
1201
+ pauseSending(options?: SendingPauseScope & {
1202
+ reason?: string;
1203
+ }): Promise<SendingPause>;
1204
+ /** Lifts the org's or one project's pause. A project stays paused while its org is. Scope `sending:pause`. */
1205
+ resumeSending(options?: SendingPauseScope): Promise<SendingPause>;
1162
1206
  /** GET /api/v1/domains — paged; list rows carry extras single reads do not. */
1163
1207
  listDomains(options?: PageOptions): Promise<Paginated<Domain>>;
1164
1208
  /**
package/dist/index.js CHANGED
@@ -608,6 +608,35 @@ export class NevarMail {
608
608
  restoreUseCase(id) {
609
609
  return this.request("POST", `/api/v1/use-cases/${encodeURIComponent(id)}/restore`);
610
610
  }
611
+ // ── Sending pause ──────────────────────────────────────────────────────
612
+ /**
613
+ * GET /api/v1/safety/pause, or /api/v1/projects/{id}/safety/pause with
614
+ * `projectId`. Scope `org:read`.
615
+ */
616
+ getSendingPause(options = {}) {
617
+ return options.projectId !== undefined
618
+ ? this.request("GET", `/api/v1/projects/${encodeURIComponent(options.projectId)}/safety/pause`)
619
+ : this.request("GET", "/api/v1/safety/pause");
620
+ }
621
+ /**
622
+ * Stops all new mail for the org, or one project with `projectId`, until
623
+ * `resumeSending`. Sends then fail with 423 `SENDING_PAUSED`. Scope
624
+ * `sending:pause`; a key pinned to one project cannot pause the org
625
+ * (403 `KEY_PROJECT_SCOPED`). `reason` (max 500 chars) is shown to the team.
626
+ */
627
+ pauseSending(options = {}) {
628
+ const body = { paused: true, reason: options.reason };
629
+ return options.projectId !== undefined
630
+ ? this.request("PUT", `/api/v1/projects/${encodeURIComponent(options.projectId)}/safety/pause`, { body })
631
+ : this.request("PUT", "/api/v1/safety/pause", { body });
632
+ }
633
+ /** Lifts the org's or one project's pause. A project stays paused while its org is. Scope `sending:pause`. */
634
+ resumeSending(options = {}) {
635
+ const body = { paused: false };
636
+ return options.projectId !== undefined
637
+ ? this.request("PUT", `/api/v1/projects/${encodeURIComponent(options.projectId)}/safety/pause`, { body })
638
+ : this.request("PUT", "/api/v1/safety/pause", { body });
639
+ }
611
640
  // ── Domains ────────────────────────────────────────────────────────────
612
641
  /** GET /api/v1/domains — paged; list rows carry extras single reads do not. */
613
642
  listDomains(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.30.0",
3
+ "version": "0.31.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",