@marlinjai/mail-sdk 0.10.0 → 0.11.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
@@ -157,6 +157,15 @@ What each piece does, and why:
157
157
  recorded as a miss (`matched: false` in `insertions` on `message.sent`, and in
158
158
  `mailings.languages`), so a drift between your form and the template shows up
159
159
  instead of passing silently.
160
+ - **Values for this one letter** go in `merge` on `mailings.create` (or
161
+ `mailings.update` while it is a draft): the same for everyone who gets the
162
+ mailing, above the contact's stored values and the workspace's defaults,
163
+ below a recipient's own. On a letter it may hold the reader's `first_name`
164
+ and `last_name`. `mail.mailings.resolve(id, { recipients })` is a dry run:
165
+ it answers what each recipient would be sent (every value's text and where
166
+ it comes from) without adding anybody, and `blocking` lists what would
167
+ refuse the send. A send in which a value inside a link's address is empty
168
+ for a recipient is refused with `unfilled_link` (422).
160
169
  - **The provider** (`provider_id`, required) is the sending account the
161
170
  workspace has set up: find its id with `mail.providers.list()` or on the
162
171
  dashboard's Providers page, and keep it in configuration next to the
package/dist/index.d.mts CHANGED
@@ -1238,10 +1238,10 @@ declare function createNamespaces(config: CoreConfig): {
1238
1238
  anomaly: {
1239
1239
  at: string;
1240
1240
  reason: string;
1241
+ blocking: boolean;
1241
1242
  mailing_id: string | null;
1242
1243
  sample: string;
1243
1244
  scope: "mailing" | "provider";
1244
- blocking: boolean;
1245
1245
  } | null;
1246
1246
  };
1247
1247
  from_name: string;
@@ -1267,10 +1267,10 @@ declare function createNamespaces(config: CoreConfig): {
1267
1267
  anomaly: {
1268
1268
  at: string;
1269
1269
  reason: string;
1270
+ blocking: boolean;
1270
1271
  mailing_id: string | null;
1271
1272
  sample: string;
1272
1273
  scope: "mailing" | "provider";
1273
- blocking: boolean;
1274
1274
  } | null;
1275
1275
  };
1276
1276
  from_name: string;
@@ -1311,10 +1311,10 @@ declare function createNamespaces(config: CoreConfig): {
1311
1311
  anomaly: {
1312
1312
  at: string;
1313
1313
  reason: string;
1314
+ blocking: boolean;
1314
1315
  mailing_id: string | null;
1315
1316
  sample: string;
1316
1317
  scope: "mailing" | "provider";
1317
- blocking: boolean;
1318
1318
  } | null;
1319
1319
  };
1320
1320
  from_name: string;
@@ -1340,10 +1340,10 @@ declare function createNamespaces(config: CoreConfig): {
1340
1340
  anomaly: {
1341
1341
  at: string;
1342
1342
  reason: string;
1343
+ blocking: boolean;
1343
1344
  mailing_id: string | null;
1344
1345
  sample: string;
1345
1346
  scope: "mailing" | "provider";
1346
- blocking: boolean;
1347
1347
  } | null;
1348
1348
  };
1349
1349
  from_name: string;
@@ -1382,10 +1382,10 @@ declare function createNamespaces(config: CoreConfig): {
1382
1382
  anomaly: {
1383
1383
  at: string;
1384
1384
  reason: string;
1385
+ blocking: boolean;
1385
1386
  mailing_id: string | null;
1386
1387
  sample: string;
1387
1388
  scope: "mailing" | "provider";
1388
- blocking: boolean;
1389
1389
  } | null;
1390
1390
  };
1391
1391
  from_name: string;
@@ -1411,10 +1411,10 @@ declare function createNamespaces(config: CoreConfig): {
1411
1411
  anomaly: {
1412
1412
  at: string;
1413
1413
  reason: string;
1414
+ blocking: boolean;
1414
1415
  mailing_id: string | null;
1415
1416
  sample: string;
1416
1417
  scope: "mailing" | "provider";
1417
- blocking: boolean;
1418
1418
  } | null;
1419
1419
  };
1420
1420
  from_name: string;
@@ -1453,10 +1453,10 @@ declare function createNamespaces(config: CoreConfig): {
1453
1453
  anomaly: {
1454
1454
  at: string;
1455
1455
  reason: string;
1456
+ blocking: boolean;
1456
1457
  mailing_id: string | null;
1457
1458
  sample: string;
1458
1459
  scope: "mailing" | "provider";
1459
- blocking: boolean;
1460
1460
  } | null;
1461
1461
  };
1462
1462
  from_name: string;
@@ -1482,10 +1482,10 @@ declare function createNamespaces(config: CoreConfig): {
1482
1482
  anomaly: {
1483
1483
  at: string;
1484
1484
  reason: string;
1485
+ blocking: boolean;
1485
1486
  mailing_id: string | null;
1486
1487
  sample: string;
1487
1488
  scope: "mailing" | "provider";
1488
- blocking: boolean;
1489
1489
  } | null;
1490
1490
  };
1491
1491
  from_name: string;
@@ -1538,10 +1538,10 @@ declare function createNamespaces(config: CoreConfig): {
1538
1538
  anomaly: {
1539
1539
  at: string;
1540
1540
  reason: string;
1541
+ blocking: boolean;
1541
1542
  mailing_id: string | null;
1542
1543
  sample: string;
1543
1544
  scope: "mailing" | "provider";
1544
- blocking: boolean;
1545
1545
  } | null;
1546
1546
  };
1547
1547
  from_name: string;
@@ -1567,10 +1567,10 @@ declare function createNamespaces(config: CoreConfig): {
1567
1567
  anomaly: {
1568
1568
  at: string;
1569
1569
  reason: string;
1570
+ blocking: boolean;
1570
1571
  mailing_id: string | null;
1571
1572
  sample: string;
1572
1573
  scope: "mailing" | "provider";
1573
- blocking: boolean;
1574
1574
  } | null;
1575
1575
  };
1576
1576
  from_name: string;
@@ -1610,10 +1610,10 @@ declare function createNamespaces(config: CoreConfig): {
1610
1610
  anomaly: {
1611
1611
  at: string;
1612
1612
  reason: string;
1613
+ blocking: boolean;
1613
1614
  mailing_id: string | null;
1614
1615
  sample: string;
1615
1616
  scope: "mailing" | "provider";
1616
- blocking: boolean;
1617
1617
  } | null;
1618
1618
  };
1619
1619
  from_name: string;
@@ -1639,10 +1639,10 @@ declare function createNamespaces(config: CoreConfig): {
1639
1639
  anomaly: {
1640
1640
  at: string;
1641
1641
  reason: string;
1642
+ blocking: boolean;
1642
1643
  mailing_id: string | null;
1643
1644
  sample: string;
1644
1645
  scope: "mailing" | "provider";
1645
- blocking: boolean;
1646
1646
  } | null;
1647
1647
  };
1648
1648
  from_name: string;
@@ -1764,6 +1764,10 @@ declare function createNamespaces(config: CoreConfig): {
1764
1764
  }>;
1765
1765
  messages: (id: string, query?: RouteQuery<"contacts.messages">, opts?: RequestOpts) => Promise<{
1766
1766
  data: {
1767
+ values: Record<string, {
1768
+ text: string;
1769
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
1770
+ }> | null;
1767
1771
  id: string;
1768
1772
  error: string | null;
1769
1773
  subject: string;
@@ -1774,11 +1778,11 @@ declare function createNamespaces(config: CoreConfig): {
1774
1778
  }> | null;
1775
1779
  locale: string | null;
1776
1780
  created_at: string;
1781
+ contact_id: string | null;
1777
1782
  provider_id: string;
1778
1783
  to: string;
1779
1784
  provider_message_id: string | null;
1780
1785
  mailing_id: string | null;
1781
- contact_id: string | null;
1782
1786
  recipient_id: string | null;
1783
1787
  outcome: "sent" | "failed";
1784
1788
  is_test: boolean;
@@ -1793,13 +1797,13 @@ declare function createNamespaces(config: CoreConfig): {
1793
1797
  id: string;
1794
1798
  email: string;
1795
1799
  version: number;
1800
+ contact_id: string;
1796
1801
  automation: {
1797
1802
  status: "draft" | "archived" | "paused" | "active";
1798
1803
  id: string;
1799
1804
  name: string;
1800
1805
  };
1801
1806
  automation_id: string;
1802
- contact_id: string;
1803
1807
  last_error: string | null;
1804
1808
  external_id: string | null;
1805
1809
  current_step_id: string | null;
@@ -1843,6 +1847,7 @@ declare function createNamespaces(config: CoreConfig): {
1843
1847
  data: {
1844
1848
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1845
1849
  id: string;
1850
+ merge: Record<string, string | number | boolean>;
1846
1851
  name: string | null;
1847
1852
  kind: "broadcast" | "automation" | "notification";
1848
1853
  template_id: string | null;
@@ -1889,6 +1894,7 @@ declare function createNamespaces(config: CoreConfig): {
1889
1894
  create: (body: RouteBody<"mailings.create">, opts?: RequestOpts) => Promise<{
1890
1895
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1891
1896
  id: string;
1897
+ merge: Record<string, string | number | boolean>;
1892
1898
  name: string | null;
1893
1899
  kind: "broadcast" | "automation" | "notification";
1894
1900
  template_id: string | null;
@@ -1940,6 +1946,7 @@ declare function createNamespaces(config: CoreConfig): {
1940
1946
  get: (id: string, opts?: RequestOpts) => Promise<{
1941
1947
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1942
1948
  id: string;
1949
+ merge: Record<string, string | number | boolean>;
1943
1950
  name: string | null;
1944
1951
  kind: "broadcast" | "automation" | "notification";
1945
1952
  template_id: string | null;
@@ -1993,6 +2000,7 @@ declare function createNamespaces(config: CoreConfig): {
1993
2000
  update: (id: string, body: RouteBody<"mailings.update">, opts?: RequestOpts) => Promise<{
1994
2001
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1995
2002
  id: string;
2003
+ merge: Record<string, string | number | boolean>;
1996
2004
  name: string | null;
1997
2005
  kind: "broadcast" | "automation" | "notification";
1998
2006
  template_id: string | null;
@@ -2057,9 +2065,9 @@ declare function createNamespaces(config: CoreConfig): {
2057
2065
  merge: Record<string, _marlinjai_mail_contract.JsonValue>;
2058
2066
  created_at: string;
2059
2067
  updated_at: string;
2068
+ contact_id: string | null;
2060
2069
  message_id: string | null;
2061
2070
  mailing_id: string;
2062
- contact_id: string | null;
2063
2071
  skip_reason: "cancelled" | "suppressed" | "not_subscribed" | "contact_erased" | "outcome_unknown" | null;
2064
2072
  attempts: number;
2065
2073
  last_error: string | null;
@@ -2070,9 +2078,50 @@ declare function createNamespaces(config: CoreConfig): {
2070
2078
  message_id: string;
2071
2079
  provider_message_id: string | null;
2072
2080
  }>;
2081
+ /**
2082
+ * A dry run: what each given recipient would be sent (every value's text
2083
+ * and the layer it comes from, each insertion's choice, the problems
2084
+ * found), without adding anybody. Without recipients: a reader with
2085
+ * nothing of their own.
2086
+ */
2087
+ resolve: (id: string, body?: RouteBody<"mailings.resolve">, opts?: RequestOpts) => Promise<{
2088
+ recipients: {
2089
+ values: Record<string, {
2090
+ text: string;
2091
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2092
+ }>;
2093
+ email: string | null;
2094
+ subject: string;
2095
+ insertions: Record<string, {
2096
+ value: string | null;
2097
+ chosen: string;
2098
+ matched: boolean;
2099
+ }> | null;
2100
+ locale: string;
2101
+ index: number | null;
2102
+ contact_id: string | null;
2103
+ problems: {
2104
+ value: string;
2105
+ message: string;
2106
+ kind: "unfilled_link" | "empty_value" | "insertion_miss";
2107
+ severity: "note" | "blocking";
2108
+ }[];
2109
+ }[];
2110
+ blocking: {
2111
+ value: string;
2112
+ recipients: number;
2113
+ }[];
2114
+ rejected: {
2115
+ reason: "unknown_contact" | "duplicate_in_batch";
2116
+ index: number;
2117
+ }[];
2118
+ names: string[];
2119
+ link_values: string[];
2120
+ }>;
2073
2121
  send: (id: string, opts?: RequestOpts) => Promise<{
2074
2122
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2075
2123
  id: string;
2124
+ merge: Record<string, string | number | boolean>;
2076
2125
  name: string | null;
2077
2126
  kind: "broadcast" | "automation" | "notification";
2078
2127
  template_id: string | null;
@@ -2124,6 +2173,7 @@ declare function createNamespaces(config: CoreConfig): {
2124
2173
  pause: (id: string, opts?: RequestOpts) => Promise<{
2125
2174
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2126
2175
  id: string;
2176
+ merge: Record<string, string | number | boolean>;
2127
2177
  name: string | null;
2128
2178
  kind: "broadcast" | "automation" | "notification";
2129
2179
  template_id: string | null;
@@ -2175,6 +2225,7 @@ declare function createNamespaces(config: CoreConfig): {
2175
2225
  resume: (id: string, opts?: RequestOpts) => Promise<{
2176
2226
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2177
2227
  id: string;
2228
+ merge: Record<string, string | number | boolean>;
2178
2229
  name: string | null;
2179
2230
  kind: "broadcast" | "automation" | "notification";
2180
2231
  template_id: string | null;
@@ -2226,6 +2277,7 @@ declare function createNamespaces(config: CoreConfig): {
2226
2277
  cancel: (id: string, opts?: RequestOpts) => Promise<{
2227
2278
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2228
2279
  id: string;
2280
+ merge: Record<string, string | number | boolean>;
2229
2281
  name: string | null;
2230
2282
  kind: "broadcast" | "automation" | "notification";
2231
2283
  template_id: string | null;
@@ -2277,6 +2329,7 @@ declare function createNamespaces(config: CoreConfig): {
2277
2329
  retryFailed: (id: string, body?: RouteBody<"mailings.retryFailed">, opts?: RequestOpts) => Promise<{
2278
2330
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2279
2331
  id: string;
2332
+ merge: Record<string, string | number | boolean>;
2280
2333
  name: string | null;
2281
2334
  kind: "broadcast" | "automation" | "notification";
2282
2335
  template_id: string | null;
@@ -2328,6 +2381,7 @@ declare function createNamespaces(config: CoreConfig): {
2328
2381
  duplicate: (id: string, opts?: RequestOpts) => Promise<{
2329
2382
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2330
2383
  id: string;
2384
+ merge: Record<string, string | number | boolean>;
2331
2385
  name: string | null;
2332
2386
  kind: "broadcast" | "automation" | "notification";
2333
2387
  template_id: string | null;
@@ -2387,6 +2441,7 @@ declare function createNamespaces(config: CoreConfig): {
2387
2441
  schedule: (id: string, body: RouteBody<"mailings.schedule">, opts?: RequestOpts) => Promise<{
2388
2442
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2389
2443
  id: string;
2444
+ merge: Record<string, string | number | boolean>;
2390
2445
  name: string | null;
2391
2446
  kind: "broadcast" | "automation" | "notification";
2392
2447
  template_id: string | null;
@@ -2438,6 +2493,7 @@ declare function createNamespaces(config: CoreConfig): {
2438
2493
  unschedule: (id: string, opts?: RequestOpts) => Promise<{
2439
2494
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2440
2495
  id: string;
2496
+ merge: Record<string, string | number | boolean>;
2441
2497
  name: string | null;
2442
2498
  kind: "broadcast" | "automation" | "notification";
2443
2499
  template_id: string | null;
@@ -2489,6 +2545,7 @@ declare function createNamespaces(config: CoreConfig): {
2489
2545
  setAbTest: (id: string, body: RouteBody<"mailings.setAbTest">, opts?: RequestOpts) => Promise<{
2490
2546
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2491
2547
  id: string;
2548
+ merge: Record<string, string | number | boolean>;
2492
2549
  name: string | null;
2493
2550
  kind: "broadcast" | "automation" | "notification";
2494
2551
  template_id: string | null;
@@ -2540,6 +2597,7 @@ declare function createNamespaces(config: CoreConfig): {
2540
2597
  clearAbTest: (id: string, opts?: RequestOpts) => Promise<{
2541
2598
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2542
2599
  id: string;
2600
+ merge: Record<string, string | number | boolean>;
2543
2601
  name: string | null;
2544
2602
  kind: "broadcast" | "automation" | "notification";
2545
2603
  template_id: string | null;
@@ -2591,6 +2649,7 @@ declare function createNamespaces(config: CoreConfig): {
2591
2649
  pickAbWinner: (id: string, body: RouteBody<"mailings.pickAbWinner">, opts?: RequestOpts) => Promise<{
2592
2650
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2593
2651
  id: string;
2652
+ merge: Record<string, string | number | boolean>;
2594
2653
  name: string | null;
2595
2654
  kind: "broadcast" | "automation" | "notification";
2596
2655
  template_id: string | null;
@@ -2679,12 +2738,12 @@ declare function createNamespaces(config: CoreConfig): {
2679
2738
  sent: number;
2680
2739
  planned: number;
2681
2740
  }[];
2682
- send_locale: string | null;
2683
- main_locale: string;
2684
2741
  fallback: {
2685
2742
  planned: number;
2686
2743
  wanted: string;
2687
2744
  }[];
2745
+ send_locale: string | null;
2746
+ main_locale: string;
2688
2747
  no_language: number;
2689
2748
  insertion_misses: {
2690
2749
  value: string;
@@ -2697,6 +2756,10 @@ declare function createNamespaces(config: CoreConfig): {
2697
2756
  messages: {
2698
2757
  list: (query?: RouteQuery<"messages.list">, opts?: RequestOpts) => Promise<{
2699
2758
  data: {
2759
+ values: Record<string, {
2760
+ text: string;
2761
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2762
+ }> | null;
2700
2763
  id: string;
2701
2764
  error: string | null;
2702
2765
  subject: string;
@@ -2707,11 +2770,11 @@ declare function createNamespaces(config: CoreConfig): {
2707
2770
  }> | null;
2708
2771
  locale: string | null;
2709
2772
  created_at: string;
2773
+ contact_id: string | null;
2710
2774
  provider_id: string;
2711
2775
  to: string;
2712
2776
  provider_message_id: string | null;
2713
2777
  mailing_id: string | null;
2714
- contact_id: string | null;
2715
2778
  recipient_id: string | null;
2716
2779
  outcome: "sent" | "failed";
2717
2780
  is_test: boolean;
@@ -2720,6 +2783,10 @@ declare function createNamespaces(config: CoreConfig): {
2720
2783
  next_cursor: string | null;
2721
2784
  }>;
2722
2785
  get: (id: string, opts?: RequestOpts) => Promise<{
2786
+ values: Record<string, {
2787
+ text: string;
2788
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2789
+ }> | null;
2723
2790
  id: string;
2724
2791
  error: string | null;
2725
2792
  subject: string;
@@ -2731,11 +2798,11 @@ declare function createNamespaces(config: CoreConfig): {
2731
2798
  locale: string | null;
2732
2799
  created_at: string;
2733
2800
  html: string;
2801
+ contact_id: string | null;
2734
2802
  provider_id: string;
2735
2803
  to: string;
2736
2804
  provider_message_id: string | null;
2737
2805
  mailing_id: string | null;
2738
- contact_id: string | null;
2739
2806
  recipient_id: string | null;
2740
2807
  outcome: "sent" | "failed";
2741
2808
  is_test: boolean;
@@ -5083,7 +5150,7 @@ declare function createNamespaces(config: CoreConfig): {
5083
5150
  entered: number;
5084
5151
  refused: number;
5085
5152
  results: {
5086
- reason: "suppressed" | "not_subscribed" | "unknown_contact" | "already_inside" | "re_entry_off" | "in_cooldown" | "excluded" | "not_active" | null;
5153
+ reason: "unknown_contact" | "suppressed" | "not_subscribed" | "already_inside" | "re_entry_off" | "in_cooldown" | "excluded" | "not_active" | null;
5087
5154
  email: string | null;
5088
5155
  contact_id: string | null;
5089
5156
  external_id: string | null;
@@ -5101,8 +5168,8 @@ declare function createNamespaces(config: CoreConfig): {
5101
5168
  id: string;
5102
5169
  email: string;
5103
5170
  version: number;
5104
- automation_id: string;
5105
5171
  contact_id: string;
5172
+ automation_id: string;
5106
5173
  last_error: string | null;
5107
5174
  external_id: string | null;
5108
5175
  current_step_id: string | null;
@@ -5129,8 +5196,8 @@ declare function createNamespaces(config: CoreConfig): {
5129
5196
  id: string;
5130
5197
  email: string;
5131
5198
  version: number;
5132
- automation_id: string;
5133
5199
  contact_id: string;
5200
+ automation_id: string;
5134
5201
  last_error: string | null;
5135
5202
  external_id: string | null;
5136
5203
  current_step_id: string | null;
@@ -5146,8 +5213,8 @@ declare function createNamespaces(config: CoreConfig): {
5146
5213
  id: string;
5147
5214
  email: string;
5148
5215
  version: number;
5149
- automation_id: string;
5150
5216
  contact_id: string;
5217
+ automation_id: string;
5151
5218
  last_error: string | null;
5152
5219
  external_id: string | null;
5153
5220
  current_step_id: string | null;
package/dist/index.d.ts CHANGED
@@ -1238,10 +1238,10 @@ declare function createNamespaces(config: CoreConfig): {
1238
1238
  anomaly: {
1239
1239
  at: string;
1240
1240
  reason: string;
1241
+ blocking: boolean;
1241
1242
  mailing_id: string | null;
1242
1243
  sample: string;
1243
1244
  scope: "mailing" | "provider";
1244
- blocking: boolean;
1245
1245
  } | null;
1246
1246
  };
1247
1247
  from_name: string;
@@ -1267,10 +1267,10 @@ declare function createNamespaces(config: CoreConfig): {
1267
1267
  anomaly: {
1268
1268
  at: string;
1269
1269
  reason: string;
1270
+ blocking: boolean;
1270
1271
  mailing_id: string | null;
1271
1272
  sample: string;
1272
1273
  scope: "mailing" | "provider";
1273
- blocking: boolean;
1274
1274
  } | null;
1275
1275
  };
1276
1276
  from_name: string;
@@ -1311,10 +1311,10 @@ declare function createNamespaces(config: CoreConfig): {
1311
1311
  anomaly: {
1312
1312
  at: string;
1313
1313
  reason: string;
1314
+ blocking: boolean;
1314
1315
  mailing_id: string | null;
1315
1316
  sample: string;
1316
1317
  scope: "mailing" | "provider";
1317
- blocking: boolean;
1318
1318
  } | null;
1319
1319
  };
1320
1320
  from_name: string;
@@ -1340,10 +1340,10 @@ declare function createNamespaces(config: CoreConfig): {
1340
1340
  anomaly: {
1341
1341
  at: string;
1342
1342
  reason: string;
1343
+ blocking: boolean;
1343
1344
  mailing_id: string | null;
1344
1345
  sample: string;
1345
1346
  scope: "mailing" | "provider";
1346
- blocking: boolean;
1347
1347
  } | null;
1348
1348
  };
1349
1349
  from_name: string;
@@ -1382,10 +1382,10 @@ declare function createNamespaces(config: CoreConfig): {
1382
1382
  anomaly: {
1383
1383
  at: string;
1384
1384
  reason: string;
1385
+ blocking: boolean;
1385
1386
  mailing_id: string | null;
1386
1387
  sample: string;
1387
1388
  scope: "mailing" | "provider";
1388
- blocking: boolean;
1389
1389
  } | null;
1390
1390
  };
1391
1391
  from_name: string;
@@ -1411,10 +1411,10 @@ declare function createNamespaces(config: CoreConfig): {
1411
1411
  anomaly: {
1412
1412
  at: string;
1413
1413
  reason: string;
1414
+ blocking: boolean;
1414
1415
  mailing_id: string | null;
1415
1416
  sample: string;
1416
1417
  scope: "mailing" | "provider";
1417
- blocking: boolean;
1418
1418
  } | null;
1419
1419
  };
1420
1420
  from_name: string;
@@ -1453,10 +1453,10 @@ declare function createNamespaces(config: CoreConfig): {
1453
1453
  anomaly: {
1454
1454
  at: string;
1455
1455
  reason: string;
1456
+ blocking: boolean;
1456
1457
  mailing_id: string | null;
1457
1458
  sample: string;
1458
1459
  scope: "mailing" | "provider";
1459
- blocking: boolean;
1460
1460
  } | null;
1461
1461
  };
1462
1462
  from_name: string;
@@ -1482,10 +1482,10 @@ declare function createNamespaces(config: CoreConfig): {
1482
1482
  anomaly: {
1483
1483
  at: string;
1484
1484
  reason: string;
1485
+ blocking: boolean;
1485
1486
  mailing_id: string | null;
1486
1487
  sample: string;
1487
1488
  scope: "mailing" | "provider";
1488
- blocking: boolean;
1489
1489
  } | null;
1490
1490
  };
1491
1491
  from_name: string;
@@ -1538,10 +1538,10 @@ declare function createNamespaces(config: CoreConfig): {
1538
1538
  anomaly: {
1539
1539
  at: string;
1540
1540
  reason: string;
1541
+ blocking: boolean;
1541
1542
  mailing_id: string | null;
1542
1543
  sample: string;
1543
1544
  scope: "mailing" | "provider";
1544
- blocking: boolean;
1545
1545
  } | null;
1546
1546
  };
1547
1547
  from_name: string;
@@ -1567,10 +1567,10 @@ declare function createNamespaces(config: CoreConfig): {
1567
1567
  anomaly: {
1568
1568
  at: string;
1569
1569
  reason: string;
1570
+ blocking: boolean;
1570
1571
  mailing_id: string | null;
1571
1572
  sample: string;
1572
1573
  scope: "mailing" | "provider";
1573
- blocking: boolean;
1574
1574
  } | null;
1575
1575
  };
1576
1576
  from_name: string;
@@ -1610,10 +1610,10 @@ declare function createNamespaces(config: CoreConfig): {
1610
1610
  anomaly: {
1611
1611
  at: string;
1612
1612
  reason: string;
1613
+ blocking: boolean;
1613
1614
  mailing_id: string | null;
1614
1615
  sample: string;
1615
1616
  scope: "mailing" | "provider";
1616
- blocking: boolean;
1617
1617
  } | null;
1618
1618
  };
1619
1619
  from_name: string;
@@ -1639,10 +1639,10 @@ declare function createNamespaces(config: CoreConfig): {
1639
1639
  anomaly: {
1640
1640
  at: string;
1641
1641
  reason: string;
1642
+ blocking: boolean;
1642
1643
  mailing_id: string | null;
1643
1644
  sample: string;
1644
1645
  scope: "mailing" | "provider";
1645
- blocking: boolean;
1646
1646
  } | null;
1647
1647
  };
1648
1648
  from_name: string;
@@ -1764,6 +1764,10 @@ declare function createNamespaces(config: CoreConfig): {
1764
1764
  }>;
1765
1765
  messages: (id: string, query?: RouteQuery<"contacts.messages">, opts?: RequestOpts) => Promise<{
1766
1766
  data: {
1767
+ values: Record<string, {
1768
+ text: string;
1769
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
1770
+ }> | null;
1767
1771
  id: string;
1768
1772
  error: string | null;
1769
1773
  subject: string;
@@ -1774,11 +1778,11 @@ declare function createNamespaces(config: CoreConfig): {
1774
1778
  }> | null;
1775
1779
  locale: string | null;
1776
1780
  created_at: string;
1781
+ contact_id: string | null;
1777
1782
  provider_id: string;
1778
1783
  to: string;
1779
1784
  provider_message_id: string | null;
1780
1785
  mailing_id: string | null;
1781
- contact_id: string | null;
1782
1786
  recipient_id: string | null;
1783
1787
  outcome: "sent" | "failed";
1784
1788
  is_test: boolean;
@@ -1793,13 +1797,13 @@ declare function createNamespaces(config: CoreConfig): {
1793
1797
  id: string;
1794
1798
  email: string;
1795
1799
  version: number;
1800
+ contact_id: string;
1796
1801
  automation: {
1797
1802
  status: "draft" | "archived" | "paused" | "active";
1798
1803
  id: string;
1799
1804
  name: string;
1800
1805
  };
1801
1806
  automation_id: string;
1802
- contact_id: string;
1803
1807
  last_error: string | null;
1804
1808
  external_id: string | null;
1805
1809
  current_step_id: string | null;
@@ -1843,6 +1847,7 @@ declare function createNamespaces(config: CoreConfig): {
1843
1847
  data: {
1844
1848
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1845
1849
  id: string;
1850
+ merge: Record<string, string | number | boolean>;
1846
1851
  name: string | null;
1847
1852
  kind: "broadcast" | "automation" | "notification";
1848
1853
  template_id: string | null;
@@ -1889,6 +1894,7 @@ declare function createNamespaces(config: CoreConfig): {
1889
1894
  create: (body: RouteBody<"mailings.create">, opts?: RequestOpts) => Promise<{
1890
1895
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1891
1896
  id: string;
1897
+ merge: Record<string, string | number | boolean>;
1892
1898
  name: string | null;
1893
1899
  kind: "broadcast" | "automation" | "notification";
1894
1900
  template_id: string | null;
@@ -1940,6 +1946,7 @@ declare function createNamespaces(config: CoreConfig): {
1940
1946
  get: (id: string, opts?: RequestOpts) => Promise<{
1941
1947
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1942
1948
  id: string;
1949
+ merge: Record<string, string | number | boolean>;
1943
1950
  name: string | null;
1944
1951
  kind: "broadcast" | "automation" | "notification";
1945
1952
  template_id: string | null;
@@ -1993,6 +2000,7 @@ declare function createNamespaces(config: CoreConfig): {
1993
2000
  update: (id: string, body: RouteBody<"mailings.update">, opts?: RequestOpts) => Promise<{
1994
2001
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
1995
2002
  id: string;
2003
+ merge: Record<string, string | number | boolean>;
1996
2004
  name: string | null;
1997
2005
  kind: "broadcast" | "automation" | "notification";
1998
2006
  template_id: string | null;
@@ -2057,9 +2065,9 @@ declare function createNamespaces(config: CoreConfig): {
2057
2065
  merge: Record<string, _marlinjai_mail_contract.JsonValue>;
2058
2066
  created_at: string;
2059
2067
  updated_at: string;
2068
+ contact_id: string | null;
2060
2069
  message_id: string | null;
2061
2070
  mailing_id: string;
2062
- contact_id: string | null;
2063
2071
  skip_reason: "cancelled" | "suppressed" | "not_subscribed" | "contact_erased" | "outcome_unknown" | null;
2064
2072
  attempts: number;
2065
2073
  last_error: string | null;
@@ -2070,9 +2078,50 @@ declare function createNamespaces(config: CoreConfig): {
2070
2078
  message_id: string;
2071
2079
  provider_message_id: string | null;
2072
2080
  }>;
2081
+ /**
2082
+ * A dry run: what each given recipient would be sent (every value's text
2083
+ * and the layer it comes from, each insertion's choice, the problems
2084
+ * found), without adding anybody. Without recipients: a reader with
2085
+ * nothing of their own.
2086
+ */
2087
+ resolve: (id: string, body?: RouteBody<"mailings.resolve">, opts?: RequestOpts) => Promise<{
2088
+ recipients: {
2089
+ values: Record<string, {
2090
+ text: string;
2091
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2092
+ }>;
2093
+ email: string | null;
2094
+ subject: string;
2095
+ insertions: Record<string, {
2096
+ value: string | null;
2097
+ chosen: string;
2098
+ matched: boolean;
2099
+ }> | null;
2100
+ locale: string;
2101
+ index: number | null;
2102
+ contact_id: string | null;
2103
+ problems: {
2104
+ value: string;
2105
+ message: string;
2106
+ kind: "unfilled_link" | "empty_value" | "insertion_miss";
2107
+ severity: "note" | "blocking";
2108
+ }[];
2109
+ }[];
2110
+ blocking: {
2111
+ value: string;
2112
+ recipients: number;
2113
+ }[];
2114
+ rejected: {
2115
+ reason: "unknown_contact" | "duplicate_in_batch";
2116
+ index: number;
2117
+ }[];
2118
+ names: string[];
2119
+ link_values: string[];
2120
+ }>;
2073
2121
  send: (id: string, opts?: RequestOpts) => Promise<{
2074
2122
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2075
2123
  id: string;
2124
+ merge: Record<string, string | number | boolean>;
2076
2125
  name: string | null;
2077
2126
  kind: "broadcast" | "automation" | "notification";
2078
2127
  template_id: string | null;
@@ -2124,6 +2173,7 @@ declare function createNamespaces(config: CoreConfig): {
2124
2173
  pause: (id: string, opts?: RequestOpts) => Promise<{
2125
2174
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2126
2175
  id: string;
2176
+ merge: Record<string, string | number | boolean>;
2127
2177
  name: string | null;
2128
2178
  kind: "broadcast" | "automation" | "notification";
2129
2179
  template_id: string | null;
@@ -2175,6 +2225,7 @@ declare function createNamespaces(config: CoreConfig): {
2175
2225
  resume: (id: string, opts?: RequestOpts) => Promise<{
2176
2226
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2177
2227
  id: string;
2228
+ merge: Record<string, string | number | boolean>;
2178
2229
  name: string | null;
2179
2230
  kind: "broadcast" | "automation" | "notification";
2180
2231
  template_id: string | null;
@@ -2226,6 +2277,7 @@ declare function createNamespaces(config: CoreConfig): {
2226
2277
  cancel: (id: string, opts?: RequestOpts) => Promise<{
2227
2278
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2228
2279
  id: string;
2280
+ merge: Record<string, string | number | boolean>;
2229
2281
  name: string | null;
2230
2282
  kind: "broadcast" | "automation" | "notification";
2231
2283
  template_id: string | null;
@@ -2277,6 +2329,7 @@ declare function createNamespaces(config: CoreConfig): {
2277
2329
  retryFailed: (id: string, body?: RouteBody<"mailings.retryFailed">, opts?: RequestOpts) => Promise<{
2278
2330
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2279
2331
  id: string;
2332
+ merge: Record<string, string | number | boolean>;
2280
2333
  name: string | null;
2281
2334
  kind: "broadcast" | "automation" | "notification";
2282
2335
  template_id: string | null;
@@ -2328,6 +2381,7 @@ declare function createNamespaces(config: CoreConfig): {
2328
2381
  duplicate: (id: string, opts?: RequestOpts) => Promise<{
2329
2382
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2330
2383
  id: string;
2384
+ merge: Record<string, string | number | boolean>;
2331
2385
  name: string | null;
2332
2386
  kind: "broadcast" | "automation" | "notification";
2333
2387
  template_id: string | null;
@@ -2387,6 +2441,7 @@ declare function createNamespaces(config: CoreConfig): {
2387
2441
  schedule: (id: string, body: RouteBody<"mailings.schedule">, opts?: RequestOpts) => Promise<{
2388
2442
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2389
2443
  id: string;
2444
+ merge: Record<string, string | number | boolean>;
2390
2445
  name: string | null;
2391
2446
  kind: "broadcast" | "automation" | "notification";
2392
2447
  template_id: string | null;
@@ -2438,6 +2493,7 @@ declare function createNamespaces(config: CoreConfig): {
2438
2493
  unschedule: (id: string, opts?: RequestOpts) => Promise<{
2439
2494
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2440
2495
  id: string;
2496
+ merge: Record<string, string | number | boolean>;
2441
2497
  name: string | null;
2442
2498
  kind: "broadcast" | "automation" | "notification";
2443
2499
  template_id: string | null;
@@ -2489,6 +2545,7 @@ declare function createNamespaces(config: CoreConfig): {
2489
2545
  setAbTest: (id: string, body: RouteBody<"mailings.setAbTest">, opts?: RequestOpts) => Promise<{
2490
2546
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2491
2547
  id: string;
2548
+ merge: Record<string, string | number | boolean>;
2492
2549
  name: string | null;
2493
2550
  kind: "broadcast" | "automation" | "notification";
2494
2551
  template_id: string | null;
@@ -2540,6 +2597,7 @@ declare function createNamespaces(config: CoreConfig): {
2540
2597
  clearAbTest: (id: string, opts?: RequestOpts) => Promise<{
2541
2598
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2542
2599
  id: string;
2600
+ merge: Record<string, string | number | boolean>;
2543
2601
  name: string | null;
2544
2602
  kind: "broadcast" | "automation" | "notification";
2545
2603
  template_id: string | null;
@@ -2591,6 +2649,7 @@ declare function createNamespaces(config: CoreConfig): {
2591
2649
  pickAbWinner: (id: string, body: RouteBody<"mailings.pickAbWinner">, opts?: RequestOpts) => Promise<{
2592
2650
  status: "draft" | "scheduled" | "sending" | "paused" | "sent" | "partially_failed" | "cancelled";
2593
2651
  id: string;
2652
+ merge: Record<string, string | number | boolean>;
2594
2653
  name: string | null;
2595
2654
  kind: "broadcast" | "automation" | "notification";
2596
2655
  template_id: string | null;
@@ -2679,12 +2738,12 @@ declare function createNamespaces(config: CoreConfig): {
2679
2738
  sent: number;
2680
2739
  planned: number;
2681
2740
  }[];
2682
- send_locale: string | null;
2683
- main_locale: string;
2684
2741
  fallback: {
2685
2742
  planned: number;
2686
2743
  wanted: string;
2687
2744
  }[];
2745
+ send_locale: string | null;
2746
+ main_locale: string;
2688
2747
  no_language: number;
2689
2748
  insertion_misses: {
2690
2749
  value: string;
@@ -2697,6 +2756,10 @@ declare function createNamespaces(config: CoreConfig): {
2697
2756
  messages: {
2698
2757
  list: (query?: RouteQuery<"messages.list">, opts?: RequestOpts) => Promise<{
2699
2758
  data: {
2759
+ values: Record<string, {
2760
+ text: string;
2761
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2762
+ }> | null;
2700
2763
  id: string;
2701
2764
  error: string | null;
2702
2765
  subject: string;
@@ -2707,11 +2770,11 @@ declare function createNamespaces(config: CoreConfig): {
2707
2770
  }> | null;
2708
2771
  locale: string | null;
2709
2772
  created_at: string;
2773
+ contact_id: string | null;
2710
2774
  provider_id: string;
2711
2775
  to: string;
2712
2776
  provider_message_id: string | null;
2713
2777
  mailing_id: string | null;
2714
- contact_id: string | null;
2715
2778
  recipient_id: string | null;
2716
2779
  outcome: "sent" | "failed";
2717
2780
  is_test: boolean;
@@ -2720,6 +2783,10 @@ declare function createNamespaces(config: CoreConfig): {
2720
2783
  next_cursor: string | null;
2721
2784
  }>;
2722
2785
  get: (id: string, opts?: RequestOpts) => Promise<{
2786
+ values: Record<string, {
2787
+ text: string;
2788
+ layer: "contact" | "recipient" | "mailing" | "workspace" | "fallback" | "empty";
2789
+ }> | null;
2723
2790
  id: string;
2724
2791
  error: string | null;
2725
2792
  subject: string;
@@ -2731,11 +2798,11 @@ declare function createNamespaces(config: CoreConfig): {
2731
2798
  locale: string | null;
2732
2799
  created_at: string;
2733
2800
  html: string;
2801
+ contact_id: string | null;
2734
2802
  provider_id: string;
2735
2803
  to: string;
2736
2804
  provider_message_id: string | null;
2737
2805
  mailing_id: string | null;
2738
- contact_id: string | null;
2739
2806
  recipient_id: string | null;
2740
2807
  outcome: "sent" | "failed";
2741
2808
  is_test: boolean;
@@ -5083,7 +5150,7 @@ declare function createNamespaces(config: CoreConfig): {
5083
5150
  entered: number;
5084
5151
  refused: number;
5085
5152
  results: {
5086
- reason: "suppressed" | "not_subscribed" | "unknown_contact" | "already_inside" | "re_entry_off" | "in_cooldown" | "excluded" | "not_active" | null;
5153
+ reason: "unknown_contact" | "suppressed" | "not_subscribed" | "already_inside" | "re_entry_off" | "in_cooldown" | "excluded" | "not_active" | null;
5087
5154
  email: string | null;
5088
5155
  contact_id: string | null;
5089
5156
  external_id: string | null;
@@ -5101,8 +5168,8 @@ declare function createNamespaces(config: CoreConfig): {
5101
5168
  id: string;
5102
5169
  email: string;
5103
5170
  version: number;
5104
- automation_id: string;
5105
5171
  contact_id: string;
5172
+ automation_id: string;
5106
5173
  last_error: string | null;
5107
5174
  external_id: string | null;
5108
5175
  current_step_id: string | null;
@@ -5129,8 +5196,8 @@ declare function createNamespaces(config: CoreConfig): {
5129
5196
  id: string;
5130
5197
  email: string;
5131
5198
  version: number;
5132
- automation_id: string;
5133
5199
  contact_id: string;
5200
+ automation_id: string;
5134
5201
  last_error: string | null;
5135
5202
  external_id: string | null;
5136
5203
  current_step_id: string | null;
@@ -5146,8 +5213,8 @@ declare function createNamespaces(config: CoreConfig): {
5146
5213
  id: string;
5147
5214
  email: string;
5148
5215
  version: number;
5149
- automation_id: string;
5150
5216
  contact_id: string;
5217
+ automation_id: string;
5151
5218
  last_error: string | null;
5152
5219
  external_id: string | null;
5153
5220
  current_step_id: string | null;
package/dist/index.js CHANGED
@@ -559,6 +559,13 @@ function createNamespaces(config) {
559
559
  addRecipients: (id, body, opts) => execute(config, "mailings.addRecipients", { params: { id }, body }, opts),
560
560
  listRecipients: (id, query, opts) => execute(config, "mailings.listRecipients", { params: { id }, query }, opts),
561
561
  test: (id, body, opts) => execute(config, "mailings.test", { params: { id }, body }, opts),
562
+ /**
563
+ * A dry run: what each given recipient would be sent (every value's text
564
+ * and the layer it comes from, each insertion's choice, the problems
565
+ * found), without adding anybody. Without recipients: a reader with
566
+ * nothing of their own.
567
+ */
568
+ resolve: (id, body = {}, opts) => execute(config, "mailings.resolve", { params: { id }, body }, opts),
562
569
  send: (id, opts) => execute(config, "mailings.send", { params: { id }, body: {} }, opts),
563
570
  pause: (id, opts) => execute(config, "mailings.pause", { params: { id }, body: {} }, opts),
564
571
  resume: (id, opts) => execute(config, "mailings.resume", { params: { id }, body: {} }, opts),
package/dist/index.mjs CHANGED
@@ -543,6 +543,13 @@ function createNamespaces(config) {
543
543
  addRecipients: (id, body, opts) => execute(config, "mailings.addRecipients", { params: { id }, body }, opts),
544
544
  listRecipients: (id, query, opts) => execute(config, "mailings.listRecipients", { params: { id }, query }, opts),
545
545
  test: (id, body, opts) => execute(config, "mailings.test", { params: { id }, body }, opts),
546
+ /**
547
+ * A dry run: what each given recipient would be sent (every value's text
548
+ * and the layer it comes from, each insertion's choice, the problems
549
+ * found), without adding anybody. Without recipients: a reader with
550
+ * nothing of their own.
551
+ */
552
+ resolve: (id, body = {}, opts) => execute(config, "mailings.resolve", { params: { id }, body }, opts),
546
553
  send: (id, opts) => execute(config, "mailings.send", { params: { id }, body: {} }, opts),
547
554
  pause: (id, opts) => execute(config, "mailings.pause", { params: { id }, body: {} }, opts),
548
555
  resume: (id, opts) => execute(config, "mailings.resume", { params: { id }, body: {} }, opts),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.10.0",
6
+ "version": "0.11.0",
7
7
  "description": "Typed client for the Lumitra Mail v1 API: Node and edge runtimes, retries with idempotency, cursor pagination, webhook verification",
8
8
  "license": "MIT",
9
9
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "LICENSE"
33
33
  ],
34
34
  "dependencies": {
35
- "@marlinjai/mail-contract": "^0.10.0"
35
+ "@marlinjai/mail-contract": "^0.11.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "zod": "^3.25.0"