@bernierllc/nevarmail 0.7.0 → 0.9.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
@@ -123,14 +123,21 @@ request into three. Sends are not idempotent; a retry after a `5xx` may deliver
123
123
 
124
124
  ## Use cases and suppression scope
125
125
 
126
+ Suppressions are per project. `checkSuppression(email, useCaseId?, projectId?)` answers for
127
+ one project: `projectId`, else the project of `useCaseId`, else the organization's only
128
+ project. An organization with several projects gets `400 PROJECT_REQUIRED` when neither is
129
+ passed. A bounce or spam complaint on a provider account blocks every project; any other
130
+ suppression blocks only its own.
131
+
126
132
  `use_case_id` names the message category a send belongs to. It is the difference between
127
133
  "this person unsubscribed from your newsletter" and "this person can no longer be emailed":
128
134
 
129
- - **Name it**, and an opt-out scoped to a *different* category does not block the send.
130
- - **Omit it**, and every active suppression on that address applies — the strict reading.
135
+ - **Name it**, and an opt-out from a *different* category's list does not block the send,
136
+ and a category marked non-suppressable is exempt from opt-outs.
137
+ - **Omit it**, and every active suppression of the project applies — the strict reading.
131
138
 
132
- Bounces and spam complaints block everything regardless. Only a `use_case_id` you passed
133
- yourself can narrow a block; a default the server resolves cannot.
139
+ Bounces, spam complaints and manual suppressions block every category regardless. Only a
140
+ `use_case_id` you passed yourself can narrow a block; a default the server resolves cannot.
134
141
 
135
142
  ## Methods
136
143
 
@@ -169,7 +176,8 @@ Application-level details worth knowing before you hit them:
169
176
  other delete throws on a missing resource.
170
177
  - **Lists have no update or delete** — the API exposes none; the SDK does not invent them.
171
178
  - **Suppression scope is cross-field**: `scope: "use_case"` requires `use_case_id`, and
172
- `use_case_id` with `scope: "account"` is a `400`.
179
+ `use_case_id` with `scope: "account"` is a `400`. `projectId` names the project the rows land
180
+ in; omitted, they land in the use case's project, else in every project the key's owner can open.
173
181
  - **Managed accounts cannot delete domains** — `deleteDomain` throws `403 MANAGED_ACCOUNT`.
174
182
 
175
183
  Anything still not covered — analytics, campaigns, webhook endpoints — goes through
package/dist/index.d.ts CHANGED
@@ -363,6 +363,12 @@ export interface AddSuppressionsInput {
363
363
  /** Default `"account"`. `"use_case"` requires `use_case_id`; `use_case_id` with `"account"` is a 400. */
364
364
  scope?: "account" | "use_case";
365
365
  use_case_id?: string;
366
+ /**
367
+ * The project the rows land in. Omitted: the use case's project, else every
368
+ * project the key's owner can open (one row per project; counts are rows, summed). A
369
+ * `use_case_id` of another project is a `422 USE_CASE_PROJECT_MISMATCH`.
370
+ */
371
+ projectId?: string;
366
372
  /** Default `"unsubscribe"` — the only reason that queues provider sync. */
367
373
  reason?: SuppressionReason;
368
374
  }
@@ -425,10 +431,13 @@ export declare class NevarMail {
425
431
  cancelled: boolean;
426
432
  }>;
427
433
  /**
428
- * GET /api/v1/suppressions/check — would a send to this address be blocked?
429
- * Omitting `useCaseId` is the strict answer: every active suppression counts.
434
+ * GET /api/v1/suppressions/check — would a send from this project to this
435
+ * address be blocked? Suppressions are per project. `projectId` defaults to
436
+ * the use case's project, else the org's only one (400 PROJECT_REQUIRED in a
437
+ * multi-project org). Omitting `useCaseId` is the strict answer: every list
438
+ * opt-out of the project counts.
430
439
  */
431
- checkSuppression(email: string, useCaseId?: string): Promise<SuppressionCheck>;
440
+ checkSuppression(email: string, useCaseId?: string, projectId?: string): Promise<SuppressionCheck>;
432
441
  /** GET /api/v1/preferences — one recipient's per-category subscriptions. */
433
442
  getPreferences(email: string): Promise<RecipientPreferences>;
434
443
  /**
package/dist/index.js CHANGED
@@ -216,12 +216,15 @@ export class NevarMail {
216
216
  return this.request("DELETE", `/api/v1/email/schedule/${encodeURIComponent(id)}`);
217
217
  }
218
218
  /**
219
- * GET /api/v1/suppressions/check — would a send to this address be blocked?
220
- * Omitting `useCaseId` is the strict answer: every active suppression counts.
219
+ * GET /api/v1/suppressions/check — would a send from this project to this
220
+ * address be blocked? Suppressions are per project. `projectId` defaults to
221
+ * the use case's project, else the org's only one (400 PROJECT_REQUIRED in a
222
+ * multi-project org). Omitting `useCaseId` is the strict answer: every list
223
+ * opt-out of the project counts.
221
224
  */
222
- checkSuppression(email, useCaseId) {
225
+ checkSuppression(email, useCaseId, projectId) {
223
226
  return this.request("GET", "/api/v1/suppressions/check", {
224
- query: { email, use_case_id: useCaseId },
227
+ query: { email, use_case_id: useCaseId, project_id: projectId },
225
228
  });
226
229
  }
227
230
  /** GET /api/v1/preferences — one recipient's per-category subscriptions. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.7.0",
3
+ "version": "0.9.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",