@bernierllc/nevarmail 0.9.0 → 0.10.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/dist/index.d.ts CHANGED
@@ -153,6 +153,12 @@ export interface SubscriberList {
153
153
  orgId: string;
154
154
  name: string;
155
155
  description: string | null;
156
+ /**
157
+ * @deprecated since 0.10.0; removed in 1.0.0; no replacement. A list
158
+ * opt-out applies to that list; a project-wide opt-out is its own
159
+ * suppression. The API no longer returns this field; the client fills it
160
+ * with `"list"` when the server leaves it out.
161
+ */
156
162
  unsubScope: string;
157
163
  unsubHandler: string;
158
164
  customUnsubHtml: string | null;
@@ -181,6 +187,10 @@ export interface SubscriberList {
181
187
  export interface CreateListInput {
182
188
  name: string;
183
189
  description?: string;
190
+ /**
191
+ * @deprecated since 0.10.0; removed in 1.0.0; no replacement. The API
192
+ * ignores it: a list opt-out always applies to that list.
193
+ */
184
194
  unsubScope?: "list" | "global";
185
195
  unsubHandler?: "provider" | "hosted" | "custom_html";
186
196
  storageTier?: "provider" | "byo_database" | "local";
package/dist/index.js CHANGED
@@ -34,13 +34,15 @@ function sleep(ms) {
34
34
  }
35
35
  /**
36
36
  * Fills `useCaseId` and the deprecated `campaignId` from whichever the server
37
- * sent, so a pre-rename server still works; delete in 1.0.0.
37
+ * sent, so a pre-rename server still works, and the deprecated `unsubScope`
38
+ * the server no longer sends; delete in 1.0.0.
38
39
  */
40
+ let warnedUnsubScope = false;
39
41
  function withListAliases(list) {
40
42
  if (!list || typeof list !== "object")
41
43
  return list;
42
44
  const useCaseId = list.useCaseId ?? list.campaignId ?? null;
43
- return { ...list, useCaseId, campaignId: useCaseId };
45
+ return { ...list, useCaseId, campaignId: useCaseId, unsubScope: list.unsubScope ?? "list" };
44
46
  }
45
47
  export class NevarMail {
46
48
  baseUrl;
@@ -281,6 +283,11 @@ export class NevarMail {
281
283
  }
282
284
  /** POST /api/v1/lists — 409 DUPLICATE_NAME on a name the org already uses. */
283
285
  async createList(input) {
286
+ if (input.unsubScope !== undefined && !warnedUnsubScope) {
287
+ warnedUnsubScope = true;
288
+ console.warn("@bernierllc/nevarmail: createList unsubScope is deprecated and ignored by the API; " +
289
+ "an unsubscribe is scoped to its list and project. It is removed in 1.0.0.");
290
+ }
284
291
  return withListAliases(await this.request("POST", "/api/v1/lists", { body: input }));
285
292
  }
286
293
  /** GET /api/v1/lists/{id} — the v1 surface has no list update/delete routes. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bernierllc/nevarmail",
3
- "version": "0.9.0",
3
+ "version": "0.10.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",