@proveanything/smartlinks 1.1.18 → 1.1.20

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/API_SUMMARY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.1.18 | Generated: 2026-01-04T12:18:56.152Z
3
+ Version: 1.1.20 | Generated: 2026-01-05T11:30:32.718Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -389,6 +389,98 @@ interface BroadcastList {
389
389
  }
390
390
  ```
391
391
 
392
+ **BroadcastRecipientsResponse** (interface)
393
+ ```typescript
394
+ interface BroadcastRecipientsResponse {
395
+ items: import('./comms').Recipient[]
396
+ total: number
397
+ limit: number
398
+ offset: number
399
+ note?: string
400
+ }
401
+ ```
402
+
403
+ **BroadcastPreviewRequest** (interface)
404
+ ```typescript
405
+ interface BroadcastPreviewRequest {
406
+ contactId?: string
407
+ email?: string
408
+ props?: Record<string, any>
409
+ }
410
+ ```
411
+
412
+ **BroadcastPreviewResponse** (interface)
413
+ ```typescript
414
+ interface BroadcastPreviewResponse {
415
+ ok: boolean; html: string
416
+ }
417
+ ```
418
+
419
+ **BroadcastSendTestRequest** (interface)
420
+ ```typescript
421
+ interface BroadcastSendTestRequest {
422
+ to: string
423
+ subject?: string
424
+ props?: Record<string, any>
425
+ }
426
+ ```
427
+
428
+ **BroadcastSendTestResponse** (interface)
429
+ ```typescript
430
+ interface BroadcastSendTestResponse {
431
+ ok: boolean; id?: string
432
+ }
433
+ ```
434
+
435
+ **BroadcastSendManualRequest** (interface)
436
+ ```typescript
437
+ interface BroadcastSendManualRequest {
438
+ limit?: number
439
+ offset?: number
440
+ dryRun?: boolean
441
+ sharedContext?: Record<string, any>
442
+ }
443
+ ```
444
+
445
+ **BroadcastSendManualResponse** (interface)
446
+ ```typescript
447
+ interface BroadcastSendManualResponse {
448
+ ok: boolean
449
+ counts: { sent: number; failed: number; skipped: number }
450
+ page: { limit: number; offset: number; total: number }
451
+ results: Array<{
452
+ contactId: string
453
+ status: 'sent' | 'failed' | 'skipped' | 'dry_run'
454
+ id?: string
455
+ error?: string
456
+ message?: string
457
+ }>
458
+ }
459
+ ```
460
+
461
+ **BroadcastAppendEventBody** (interface)
462
+ ```typescript
463
+ interface BroadcastAppendEventBody {
464
+ broadcastId: string
465
+ contactId?: string
466
+ channel?: 'email'
467
+ templateId?: string
468
+ eventType: string
469
+ outcome?: 'success' | 'failed'
470
+ failureReason?: string
471
+ metadata?: Record<string, any>
472
+ }
473
+ ```
474
+
475
+ **BroadcastAppendBulkBody** (interface)
476
+ ```typescript
477
+ interface BroadcastAppendBulkBody {
478
+ ids: string[]
479
+ idField?: string
480
+ params: Record<string, any> // merged with collectionId server-side
481
+ }
482
+ ```
483
+
392
484
  ### claimSet
393
485
 
394
486
  **ClaimCodeRef** (interface)
@@ -679,8 +771,21 @@ interface AppendBulkResult {
679
771
  }
680
772
  ```
681
773
 
774
+ **RecipientsPage** (interface)
775
+ ```typescript
776
+ interface RecipientsPage {
777
+ items: Recipient[]
778
+ total: number
779
+ limit: number
780
+ offset: number
781
+ note?: string
782
+ }
783
+ ```
784
+
682
785
  **RecipientId** = `string`
683
786
 
787
+ **Recipient** = `import('./contact').Contact`
788
+
684
789
  ### contact
685
790
 
686
791
  **Contact** (interface)
@@ -1319,7 +1424,7 @@ interface SegmentList {
1319
1424
  **SegmentCalculateResult** (interface)
1320
1425
  ```typescript
1321
1426
  interface SegmentCalculateResult {
1322
- scheduled: true
1427
+ scheduled: boolean
1323
1428
  lastCalculatedAt?: string
1324
1429
  estimatedCount?: number | null
1325
1430
  note?: string
@@ -1329,7 +1434,7 @@ interface SegmentCalculateResult {
1329
1434
  **SegmentRecipientsResponse** (interface)
1330
1435
  ```typescript
1331
1436
  interface SegmentRecipientsResponse {
1332
- items: string[]
1437
+ items: import('./comms').Recipient[]
1333
1438
  limit: number
1334
1439
  offset: number
1335
1440
  total: number
@@ -1364,6 +1469,37 @@ interface TemplateBase {
1364
1469
  }
1365
1470
  ```
1366
1471
 
1472
+ **TemplateRenderRequest** (interface)
1473
+ ```typescript
1474
+ interface TemplateRenderRequest {
1475
+ props: Record<string, any>
1476
+ }
1477
+ ```
1478
+
1479
+ **TemplateRenderResponse** (interface)
1480
+ ```typescript
1481
+ interface TemplateRenderResponse {
1482
+ ok: boolean; html: string
1483
+ }
1484
+ ```
1485
+
1486
+ **TemplateRenderSourceRequest** (interface)
1487
+ ```typescript
1488
+ interface TemplateRenderSourceRequest {
1489
+ engine: 'liquid'
1490
+ source: string
1491
+ props?: Record<string, any>
1492
+ component?: string
1493
+ }
1494
+ ```
1495
+
1496
+ **TemplateRenderSourceResponse** (interface)
1497
+ ```typescript
1498
+ interface TemplateRenderSourceResponse {
1499
+ ok: boolean; html: string
1500
+ }
1501
+ ```
1502
+
1367
1503
  **TemplateInput** = `Omit<TemplateBase, 'id' | 'collectionId'>`
1368
1504
 
1369
1505
  **TemplateUpdate** = `Partial<Omit<TemplateBase, 'id' | 'collectionId'>>`
@@ -1793,6 +1929,28 @@ Look up a serial number by code for a batch (admin only).
1793
1929
  **remove**(collectionId: string,
1794
1930
  id: string) → `Promise<void>`
1795
1931
 
1932
+ **recipients**(collectionId: string,
1933
+ id: string,
1934
+ query: { limit?: number; offset?: number } = {}) → `Promise<BroadcastRecipientsResponse>`
1935
+
1936
+ **preview**(collectionId: string,
1937
+ id: string,
1938
+ body: BroadcastPreviewRequest) → `Promise<BroadcastPreviewResponse>`
1939
+
1940
+ **sendTest**(collectionId: string,
1941
+ id: string,
1942
+ body: BroadcastSendTestRequest) → `Promise<BroadcastSendTestResponse>`
1943
+
1944
+ **sendManual**(collectionId: string,
1945
+ id: string,
1946
+ body: BroadcastSendManualRequest) → `Promise<BroadcastSendManualResponse>`
1947
+
1948
+ **append**(collectionId: string,
1949
+ body: BroadcastAppendEventBody) → `Promise<AppendResult>`
1950
+
1951
+ **appendBulk**(collectionId: string,
1952
+ body: BroadcastAppendBulkBody) → `Promise<AppendBulkResult>`
1953
+
1796
1954
  ### claimSet
1797
1955
 
1798
1956
  **getAllForCollection**(collectionId: string) → `Promise<any[]>`
@@ -2229,6 +2387,13 @@ Resolve a short code to related resource identifiers.
2229
2387
 
2230
2388
  **getAllowedGlobal**(collectionId: string) → `Promise<TemplatePublic[]>`
2231
2389
 
2390
+ **render**(collectionId: string,
2391
+ templateId: string,
2392
+ body: TemplateRenderRequest) → `Promise<TemplateRenderResponse>`
2393
+
2394
+ **renderSource**(collectionId: string,
2395
+ body: TemplateRenderSourceRequest) → `Promise<TemplateRenderSourceResponse>`
2396
+
2232
2397
  ### variant
2233
2398
 
2234
2399
  **get**(collectionId: string,
@@ -1,8 +1,18 @@
1
- import type { ListBroadcastsQuery, BroadcastRecord, BroadcastList } from "../types/broadcasts";
1
+ import type { ListBroadcastsQuery, BroadcastRecord, BroadcastList, BroadcastRecipientsResponse, BroadcastPreviewRequest, BroadcastPreviewResponse, BroadcastSendTestRequest, BroadcastSendTestResponse, BroadcastSendManualRequest, BroadcastSendManualResponse, BroadcastAppendEventBody, BroadcastAppendBulkBody } from "../types/broadcasts";
2
+ import type { AppendResult, AppendBulkResult } from "../types/comms";
2
3
  export declare namespace broadcasts {
3
4
  function create(collectionId: string, body: Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>): Promise<BroadcastRecord>;
4
5
  function list(collectionId: string, query?: ListBroadcastsQuery): Promise<BroadcastList>;
5
6
  function get(collectionId: string, id: string): Promise<BroadcastRecord>;
6
7
  function update(collectionId: string, id: string, body: Partial<Omit<BroadcastRecord, 'id' | 'collectionId' | 'createdAt'>>): Promise<BroadcastRecord>;
7
8
  function remove(collectionId: string, id: string): Promise<void>;
9
+ function recipients(collectionId: string, id: string, query?: {
10
+ limit?: number;
11
+ offset?: number;
12
+ }): Promise<BroadcastRecipientsResponse>;
13
+ function preview(collectionId: string, id: string, body: BroadcastPreviewRequest): Promise<BroadcastPreviewResponse>;
14
+ function sendTest(collectionId: string, id: string, body: BroadcastSendTestRequest): Promise<BroadcastSendTestResponse>;
15
+ function sendManual(collectionId: string, id: string, body: BroadcastSendManualRequest): Promise<BroadcastSendManualResponse>;
16
+ function append(collectionId: string, body: BroadcastAppendEventBody): Promise<AppendResult>;
17
+ function appendBulk(collectionId: string, body: BroadcastAppendBulkBody): Promise<AppendBulkResult>;
8
18
  }
@@ -47,4 +47,41 @@ export var broadcasts;
47
47
  return del(path);
48
48
  }
49
49
  broadcasts.remove = remove;
50
+ // Recipients listing for a broadcast
51
+ async function recipients(collectionId, id, query = {}) {
52
+ const qs = encodeQuery(query);
53
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/recipients${qs}`;
54
+ return request(path);
55
+ }
56
+ broadcasts.recipients = recipients;
57
+ // Preview a broadcast template/email
58
+ async function preview(collectionId, id, body) {
59
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/preview`;
60
+ return post(path, body);
61
+ }
62
+ broadcasts.preview = preview;
63
+ // Send a single test email
64
+ async function sendTest(collectionId, id, body) {
65
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/send/test`;
66
+ return post(path, body);
67
+ }
68
+ broadcasts.sendTest = sendTest;
69
+ // Manually send a page of emails
70
+ async function sendManual(collectionId, id, body) {
71
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/send/manual`;
72
+ return post(path, body);
73
+ }
74
+ broadcasts.sendManual = sendManual;
75
+ // Append a single broadcast event
76
+ async function append(collectionId, body) {
77
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append`;
78
+ return post(path, body);
79
+ }
80
+ broadcasts.append = append;
81
+ // Append many broadcast events
82
+ async function appendBulk(collectionId, body) {
83
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/append/bulk`;
84
+ return post(path, body);
85
+ }
86
+ broadcasts.appendBulk = appendBulk;
50
87
  })(broadcasts || (broadcasts = {}));
@@ -1,4 +1,4 @@
1
- import type { Template, TemplateInput, TemplateUpdate, TemplatePublic } from "../types";
1
+ import type { Template, TemplateInput, TemplateUpdate, TemplatePublic, TemplateRenderRequest, TemplateRenderResponse, TemplateRenderSourceRequest, TemplateRenderSourceResponse } from "../types";
2
2
  export declare namespace template {
3
3
  function getAll(collectionId: string): Promise<Template[]>;
4
4
  function get(collectionId: string, templateId: string): Promise<Template>;
@@ -12,4 +12,6 @@ export declare namespace template {
12
12
  function getPublic(collectionId: string, templateId: string): Promise<TemplatePublic>;
13
13
  function getGlobal(templateId: string): Promise<TemplatePublic>;
14
14
  function getAllowedGlobal(collectionId: string): Promise<TemplatePublic[]>;
15
+ function render(collectionId: string, templateId: string, body: TemplateRenderRequest): Promise<TemplateRenderResponse>;
16
+ function renderSource(collectionId: string, body: TemplateRenderSourceRequest): Promise<TemplateRenderSourceResponse>;
15
17
  }
@@ -56,4 +56,16 @@ export var template;
56
56
  return request(path);
57
57
  }
58
58
  template.getAllowedGlobal = getAllowedGlobal;
59
+ // Render a template by ID (admin)
60
+ async function render(collectionId, templateId, body) {
61
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/${encodeURIComponent(templateId)}/render`;
62
+ return post(path, body);
63
+ }
64
+ template.render = render;
65
+ // Render from source (admin)
66
+ async function renderSource(collectionId, body) {
67
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/template/render/source`;
68
+ return post(path, body);
69
+ }
70
+ template.renderSource = renderSource;
59
71
  })(template || (template = {}));
@@ -29,3 +29,69 @@ export interface BroadcastList {
29
29
  limit: number;
30
30
  offset: number;
31
31
  }
32
+ export interface BroadcastRecipientsResponse {
33
+ items: import('./comms').Recipient[];
34
+ total: number;
35
+ limit: number;
36
+ offset: number;
37
+ note?: string;
38
+ }
39
+ export interface BroadcastPreviewRequest {
40
+ contactId?: string;
41
+ email?: string;
42
+ props?: Record<string, any>;
43
+ }
44
+ export interface BroadcastPreviewResponse {
45
+ ok: boolean;
46
+ html: string;
47
+ }
48
+ export interface BroadcastSendTestRequest {
49
+ to: string;
50
+ subject?: string;
51
+ props?: Record<string, any>;
52
+ }
53
+ export interface BroadcastSendTestResponse {
54
+ ok: boolean;
55
+ id?: string;
56
+ }
57
+ export interface BroadcastSendManualRequest {
58
+ limit?: number;
59
+ offset?: number;
60
+ dryRun?: boolean;
61
+ sharedContext?: Record<string, any>;
62
+ }
63
+ export interface BroadcastSendManualResponse {
64
+ ok: boolean;
65
+ counts: {
66
+ sent: number;
67
+ failed: number;
68
+ skipped: number;
69
+ };
70
+ page: {
71
+ limit: number;
72
+ offset: number;
73
+ total: number;
74
+ };
75
+ results: Array<{
76
+ contactId: string;
77
+ status: 'sent' | 'failed' | 'skipped' | 'dry_run';
78
+ id?: string;
79
+ error?: string;
80
+ message?: string;
81
+ }>;
82
+ }
83
+ export interface BroadcastAppendEventBody {
84
+ broadcastId: string;
85
+ contactId?: string;
86
+ channel?: 'email';
87
+ templateId?: string;
88
+ eventType: string;
89
+ outcome?: 'success' | 'failed';
90
+ failureReason?: string;
91
+ metadata?: Record<string, any>;
92
+ }
93
+ export interface BroadcastAppendBulkBody {
94
+ ids: string[];
95
+ idField?: string;
96
+ params: Record<string, any>;
97
+ }
@@ -189,3 +189,11 @@ export interface AppendBulkResult {
189
189
  success: true;
190
190
  count: number;
191
191
  }
192
+ export type Recipient = import('./contact').Contact;
193
+ export interface RecipientsPage {
194
+ items: Recipient[];
195
+ total: number;
196
+ limit: number;
197
+ offset: number;
198
+ note?: string;
199
+ }
@@ -26,13 +26,13 @@ export interface SegmentList {
26
26
  offset: number;
27
27
  }
28
28
  export interface SegmentCalculateResult {
29
- scheduled: true;
29
+ scheduled: boolean;
30
30
  lastCalculatedAt?: string;
31
31
  estimatedCount?: number | null;
32
32
  note?: string;
33
33
  }
34
34
  export interface SegmentRecipientsResponse {
35
- items: string[];
35
+ items: import('./comms').Recipient[];
36
36
  limit: number;
37
37
  offset: number;
38
38
  total: number;
@@ -28,3 +28,20 @@ export interface Template extends TemplateBase {
28
28
  export type TemplateInput = Omit<TemplateBase, 'id' | 'collectionId'>;
29
29
  export type TemplateUpdate = Partial<Omit<TemplateBase, 'id' | 'collectionId'>>;
30
30
  export type TemplatePublic = TemplateBase;
31
+ export interface TemplateRenderRequest {
32
+ props: Record<string, any>;
33
+ }
34
+ export interface TemplateRenderResponse {
35
+ ok: boolean;
36
+ html: string;
37
+ }
38
+ export interface TemplateRenderSourceRequest {
39
+ engine: 'liquid';
40
+ source: string;
41
+ props?: Record<string, any>;
42
+ component?: string;
43
+ }
44
+ export interface TemplateRenderSourceResponse {
45
+ ok: boolean;
46
+ html: string;
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",