@proveanything/smartlinks 3.0.0-alpha.0 → 3.0.0-alpha.2

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.
Files changed (149) hide show
  1. package/README.md +7 -7
  2. package/dist/api/analytics.d.ts +5 -4
  3. package/dist/api/analytics.js +5 -4
  4. package/dist/api/appConfiguration.d.ts +23 -18
  5. package/dist/api/appConfiguration.js +24 -18
  6. package/dist/api/appObjects.d.ts +54 -10
  7. package/dist/api/appObjects.js +75 -40
  8. package/dist/api/asset.d.ts +28 -22
  9. package/dist/api/asset.js +45 -56
  10. package/dist/api/attestation.d.ts +11 -3
  11. package/dist/api/attestation.js +12 -3
  12. package/dist/api/attestations.d.ts +12 -8
  13. package/dist/api/attestations.js +18 -21
  14. package/dist/api/authKit.d.ts +15 -10
  15. package/dist/api/authKit.js +17 -11
  16. package/dist/api/batch.d.ts +36 -25
  17. package/dist/api/batch.js +46 -39
  18. package/dist/api/bookings.d.ts +18 -9
  19. package/dist/api/bookings.js +23 -13
  20. package/dist/api/broadcasts.js +3 -17
  21. package/dist/api/claimSet.d.ts +26 -12
  22. package/dist/api/claimSet.js +32 -24
  23. package/dist/api/collection.d.ts +15 -10
  24. package/dist/api/collection.js +17 -11
  25. package/dist/api/comms.d.ts +12 -6
  26. package/dist/api/comms.js +12 -6
  27. package/dist/api/conditions.d.ts +7 -6
  28. package/dist/api/conditions.js +8 -6
  29. package/dist/api/contact.d.ts +6 -2
  30. package/dist/api/contact.js +25 -60
  31. package/dist/api/containers.d.ts +14 -10
  32. package/dist/api/containers.js +19 -14
  33. package/dist/api/crate.js +7 -9
  34. package/dist/api/dpp.d.ts +20 -13
  35. package/dist/api/dpp.js +23 -15
  36. package/dist/api/facets.d.ts +38 -13
  37. package/dist/api/facets.js +40 -15
  38. package/dist/api/files.d.ts +5 -2
  39. package/dist/api/files.js +7 -4
  40. package/dist/api/form.d.ts +8 -5
  41. package/dist/api/form.js +9 -5
  42. package/dist/api/index.d.ts +0 -1
  43. package/dist/api/index.js +0 -1
  44. package/dist/api/integrations.d.ts +29 -17
  45. package/dist/api/integrations.js +32 -25
  46. package/dist/api/interactions.d.ts +11 -6
  47. package/dist/api/interactions.js +14 -23
  48. package/dist/api/jobs.d.ts +16 -6
  49. package/dist/api/jobs.js +30 -20
  50. package/dist/api/journeys.js +2 -14
  51. package/dist/api/journeysAnalytics.d.ts +8 -5
  52. package/dist/api/journeysAnalytics.js +8 -5
  53. package/dist/api/knowledge.d.ts +20 -14
  54. package/dist/api/knowledge.js +22 -15
  55. package/dist/api/location.d.ts +6 -3
  56. package/dist/api/location.js +8 -22
  57. package/dist/api/lots.d.ts +9 -5
  58. package/dist/api/lots.js +22 -26
  59. package/dist/api/loyalty.d.ts +25 -16
  60. package/dist/api/loyalty.js +33 -32
  61. package/dist/api/nfc.d.ts +3 -1
  62. package/dist/api/nfc.js +3 -1
  63. package/dist/api/order.d.ts +45 -39
  64. package/dist/api/order.js +48 -65
  65. package/dist/api/partner.d.ts +17 -14
  66. package/dist/api/partner.js +21 -22
  67. package/dist/api/products.d.ts +35 -12
  68. package/dist/api/products.js +36 -13
  69. package/dist/api/proof.d.ts +41 -19
  70. package/dist/api/proof.js +44 -23
  71. package/dist/api/segments.js +3 -15
  72. package/dist/api/serviceAccounts.d.ts +8 -5
  73. package/dist/api/serviceAccounts.js +9 -6
  74. package/dist/api/shop.d.ts +7 -5
  75. package/dist/api/shop.js +13 -19
  76. package/dist/api/subscriptions.d.ts +12 -10
  77. package/dist/api/subscriptions.js +17 -25
  78. package/dist/api/tags.d.ts +23 -20
  79. package/dist/api/tags.js +40 -52
  80. package/dist/api/template.d.ts +16 -11
  81. package/dist/api/template.js +19 -13
  82. package/dist/api/translations.js +2 -12
  83. package/dist/api/userGroups.d.ts +26 -16
  84. package/dist/api/userGroups.js +43 -30
  85. package/dist/api/variant.d.ts +10 -7
  86. package/dist/api/variant.js +11 -7
  87. package/dist/api/wallet.d.ts +14 -11
  88. package/dist/api/wallet.js +15 -12
  89. package/dist/docs/API_SUMMARY.md +289 -483
  90. package/dist/docs/ai.md +15 -15
  91. package/dist/docs/analytics.md +1 -1
  92. package/dist/docs/app-objects.md +4 -4
  93. package/dist/docs/attestations.md +8 -8
  94. package/dist/docs/contact-search.md +2 -3
  95. package/dist/docs/i18n.md +46 -292
  96. package/dist/docs/knowledge.md +3 -3
  97. package/dist/docs/lists.md +58 -15
  98. package/dist/docs/upgrading-to-3.md +238 -136
  99. package/dist/i18n.d.ts +14 -2
  100. package/dist/i18n.js +23 -6
  101. package/dist/list.d.ts +12 -0
  102. package/dist/list.js +59 -0
  103. package/dist/openapi.yaml +301 -662
  104. package/dist/types/analytics.d.ts +7 -3
  105. package/dist/types/appObjects.d.ts +27 -12
  106. package/dist/types/appOptions.d.ts +2 -2
  107. package/dist/types/asset.d.ts +5 -6
  108. package/dist/types/attestations.d.ts +7 -9
  109. package/dist/types/batch.d.ts +5 -5
  110. package/dist/types/bookings.d.ts +10 -5
  111. package/dist/types/comms.d.ts +9 -5
  112. package/dist/types/contact.d.ts +7 -4
  113. package/dist/types/containers.d.ts +2 -1
  114. package/dist/types/facets.d.ts +14 -2
  115. package/dist/types/files.d.ts +3 -2
  116. package/dist/types/integrations.d.ts +2 -1
  117. package/dist/types/interaction.d.ts +15 -7
  118. package/dist/types/jobs.d.ts +1 -1
  119. package/dist/types/journeysAnalytics.d.ts +3 -2
  120. package/dist/types/knowledge.d.ts +6 -3
  121. package/dist/types/knowledge.js +0 -1
  122. package/dist/types/list.d.ts +30 -2
  123. package/dist/types/location.d.ts +7 -2
  124. package/dist/types/location.js +0 -1
  125. package/dist/types/lots.d.ts +5 -2
  126. package/dist/types/lots.js +0 -6
  127. package/dist/types/order.d.ts +22 -20
  128. package/dist/types/product.d.ts +28 -11
  129. package/dist/types/proof.d.ts +7 -8
  130. package/dist/types/tags.d.ts +5 -3
  131. package/dist/types/userGroups.d.ts +3 -3
  132. package/dist/types/userGroups.js +0 -4
  133. package/dist/version.d.ts +1 -1
  134. package/dist/version.js +1 -1
  135. package/docs/API_SUMMARY.md +289 -483
  136. package/docs/ai.md +15 -15
  137. package/docs/analytics.md +1 -1
  138. package/docs/app-objects.md +4 -4
  139. package/docs/attestations.md +8 -8
  140. package/docs/contact-search.md +2 -3
  141. package/docs/i18n.md +46 -292
  142. package/docs/knowledge.md +3 -3
  143. package/docs/lists.md +58 -15
  144. package/docs/upgrading-to-3.md +238 -136
  145. package/openapi.yaml +301 -662
  146. package/package.json +91 -91
  147. package/scripts/lib/upgrade.mjs +216 -60
  148. package/scripts/upgrade.mjs +33 -10
  149. package/upgrade/3.json +2731 -2213
@@ -7,6 +7,7 @@
7
7
  // as what status, limits, time rules), ownerActions.bookings (cancel / move /
8
8
  // confirm afterwards) and publicRead.bookings.freebusy.
9
9
  import { request, post, patch, del, requestWithOptions } from '../http.js';
10
+ import { listQuery } from '../list.js';
10
11
  function basePath(collectionId, appId, admin) {
11
12
  const zone = admin ? 'admin' : 'public';
12
13
  return `/${zone}/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}/bookings`;
@@ -46,33 +47,36 @@ export var bookings;
46
47
  }
47
48
  bookings.create = create;
48
49
  /**
49
- * List bookings (admin), a page at a time. `count` is how many match in all. There is no public
50
- * list: a signed-in booker uses {@link mine}. GET /bookings
50
+ * List bookings (admin), a page at a time. `count` is how many match in all. `from` / `to` pick
51
+ * the bookings overlapping that time; `orderBy` sorts (earliest start first unless you say). There
52
+ * is no public list: a signed-in booker uses {@link mine}. GET /bookings
51
53
  *
52
54
  * @example
53
55
  * ```typescript
54
- * let page = await bookings.list(collectionId, appId, { status: 'confirmed', from: new Date(), limit: 50 })
56
+ * const from = new Date()
57
+ * let page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50 })
55
58
  * page.items // Booking[]
56
59
  * page.count // how many match in all
57
60
  * while (page.nextCursor) {
58
- * page = await bookings.list(collectionId, appId, { status: 'confirmed', from: new Date(), limit: 50, cursor: page.nextCursor })
61
+ * page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50, cursor: page.nextCursor })
59
62
  * }
60
63
  * ```
61
64
  */
62
65
  async function list(collectionId, appId, params, admin = true) {
63
- return request(`${basePath(collectionId, appId, admin)}${query(params)}`);
66
+ return request(`${basePath(collectionId, appId, admin)}${listQuery(params)}`);
64
67
  }
65
68
  bookings.list = list;
66
69
  /**
67
- * The signed-in caller's own bookings (public), a page at a time. GET /bookings/mine
70
+ * The signed-in caller's own bookings (public), a page at a time. Takes the same options as
71
+ * {@link list}, except `contactId`. GET /bookings/mine
68
72
  *
69
73
  * @example
70
74
  * ```typescript
71
- * const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date() })
75
+ * const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date(), orderBy: [{ startsAt: 'asc' }], limit: 20 })
72
76
  * ```
73
77
  */
74
78
  async function mine(collectionId, appId, params) {
75
- return request(`${basePath(collectionId, appId, false)}/mine${query(params)}`);
79
+ return request(`${basePath(collectionId, appId, false)}/mine${listQuery(params)}`);
76
80
  }
77
81
  bookings.mine = mine;
78
82
  /**
@@ -166,15 +170,18 @@ export var bookings;
166
170
  slots_1.createMany = createMany;
167
171
  /**
168
172
  * List slots, a page at a time. Public: open, public slots only, each with `remaining`.
173
+ * `from` / `to` pick the slots in that time; `orderBy` sorts them.
169
174
  * GET /bookings/slots
170
175
  *
171
176
  * @example
172
177
  * ```typescript
173
- * const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, { from, to, available: true })
178
+ * const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, {
179
+ * from, to, available: true, orderBy: [{ startsAt: 'asc' }], limit: 50,
180
+ * })
174
181
  * ```
175
182
  */
176
183
  async function list(collectionId, appId, params, admin = false) {
177
- return request(`${basePath(collectionId, appId, admin)}/slots${query(params)}`);
184
+ return request(`${basePath(collectionId, appId, admin)}/slots${listQuery(params)}`);
178
185
  }
179
186
  slots_1.list = list;
180
187
  /** GET /bookings/slots/:slotId */
@@ -205,15 +212,18 @@ export var bookings;
205
212
  }
206
213
  blocks.create = create;
207
214
  /**
208
- * The blocks on a resource and/or in a date range, a page at a time. GET /bookings/blocks
215
+ * The blocks on a resource and/or in a date range (`from` / `to`), a page at a time (`limit`,
216
+ * `cursor`). GET /bookings/blocks
209
217
  *
210
218
  * @example
211
219
  * ```typescript
212
- * const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, { resourceType: 'record', resourceId: 'staff-1' })
220
+ * const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, {
221
+ * resourceType: 'record', resourceId: 'staff-1', from: '2026-12-01T00:00:00Z', to: '2027-01-01T00:00:00Z', limit: 50,
222
+ * })
213
223
  * ```
214
224
  */
215
225
  async function list(collectionId, appId, params) {
216
- return request(`${basePath(collectionId, appId, true)}/blocks${query(params)}`);
226
+ return request(`${basePath(collectionId, appId, true)}/blocks${listQuery(params)}`);
217
227
  }
218
228
  blocks.list = list;
219
229
  async function remove(collectionId, appId, blockId) {
@@ -1,20 +1,6 @@
1
1
  // src/api/broadcasts.ts
2
2
  import { request, post, patch, del } from "../http.js";
3
- function encodeQuery(params) {
4
- const search = new URLSearchParams();
5
- for (const [key, value] of Object.entries(params)) {
6
- if (value === undefined || value === null || value === "")
7
- continue;
8
- if (typeof value === "boolean") {
9
- search.set(key, value ? "true" : "false");
10
- }
11
- else {
12
- search.set(key, String(value));
13
- }
14
- }
15
- const qs = search.toString();
16
- return qs ? `?${qs}` : "";
17
- }
3
+ import { listQuery } from "../list.js";
18
4
  export var broadcasts;
19
5
  (function (broadcasts) {
20
6
  // CRUD: Create broadcast
@@ -34,7 +20,7 @@ export var broadcasts;
34
20
  * ```
35
21
  */
36
22
  async function list(collectionId, query = {}) {
37
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeQuery(query)}`;
23
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${listQuery(query)}`;
38
24
  return request(path);
39
25
  }
40
26
  broadcasts.list = list;
@@ -69,7 +55,7 @@ export var broadcasts;
69
55
  * ```
70
56
  */
71
57
  async function recipients(collectionId, id, query = {}) {
72
- const qs = encodeQuery(query);
58
+ const qs = listQuery(query);
73
59
  const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/recipients${qs}`;
74
60
  return request(path);
75
61
  }
@@ -2,18 +2,23 @@ import { ClaimSetScope, ClaimSetRange, CreateClaimSetRangeRequest, UpdateClaimSe
2
2
  import type { ListResult, ListOptions } from "../types/list.js";
3
3
  export declare namespace claimSet {
4
4
  /**
5
- * Get all claim sets. Returns `{ items, nextCursor }`: the claim sets are in `items`. The list is not
6
- * paged, so `nextCursor` is always `null`.
5
+ * Get all claim sets, a page at a time. Returns `{ items, nextCursor }`: the claim sets are in `items`;
6
+ * pass `nextCursor` back as `cursor` for the next page (`null` means that was the last one).
7
7
  * When collectionId is provided, returns claim sets for that collection.
8
8
  * When omitted, returns all claim sets owned by the authenticated user.
9
9
  * @param collectionId – Optional collection identifier
10
+ * @param options – `limit` (default 50) and `cursor`
10
11
  *
11
12
  * @example
12
13
  * ```typescript
13
- * const { items } = await claimSet.getAll('coll_123')
14
+ * let page = await claimSet.getAll('coll_123', { limit: 50 })
15
+ * while (page.nextCursor) page = await claimSet.getAll('coll_123', { limit: 50, cursor: page.nextCursor })
16
+ *
17
+ * // Your own claim sets (no collection)
18
+ * const { items } = await claimSet.getAll(undefined, { limit: 50 })
14
19
  * ```
15
20
  */
16
- function getAll(collectionId?: string): Promise<ListResult<any>>;
21
+ function getAll(collectionId?: string, options?: ListOptions): Promise<ListResult<any>>;
17
22
  /**
18
23
  * Get a specific claim set by ID.
19
24
  * @param claimSetId – The claim set identifier
@@ -52,17 +57,22 @@ export declare namespace claimSet {
52
57
  /**
53
58
  * Get assigned tags for a claim set — tags soft-assigned to a collection or product. Returns
54
59
  * `{ items, nextCursor }` with the claim set's own fields (`id`, `name`, …) beside them: the tags are
55
- * in `items`. The list is not paged, so `nextCursor` is always `null`.
60
+ * in `items`, a page at a time. Pass `nextCursor` back as `cursor` for the next page (`null` means that
61
+ * was the last one).
56
62
  * @param claimSetId – The claim set identifier
57
63
  * @param collectionId – Optional collection identifier; omit for user-scoped access
64
+ * @param options – `limit` (default 50) and `cursor`
58
65
  *
59
66
  * @example
60
67
  * ```typescript
61
- * const { items, name } = await claimSet.getAssignedTags('12', 'coll_123')
62
- * console.log(`${items.length} tags of ${name} are assigned`)
68
+ * let page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50 })
69
+ * console.log(`Assigned tags of ${page.name}:`, page.items)
70
+ * while (page.nextCursor) {
71
+ * page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50, cursor: page.nextCursor })
72
+ * }
63
73
  * ```
64
74
  */
65
- function getAssignedTags(claimSetId: string, collectionId?: string): Promise<ListResult<any> & Record<string, any>>;
75
+ function getAssignedTags(claimSetId: string, collectionId?: string, options?: ListOptions): Promise<ListResult<any> & Record<string, any>>;
66
76
  /**
67
77
  * Create a single tag inside a claim set.
68
78
  * @param claimSetId – The claim set identifier
@@ -114,15 +124,19 @@ export declare namespace claimSet {
114
124
  function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
115
125
  namespace ranges {
116
126
  /**
117
- * The ranges in a set, lowest index first. Returns `{ items, nextCursor }`: the ranges are in `items`.
118
- * The list is not paged, so `nextCursor` is always `null`.
127
+ * The ranges in a set, lowest index first, a page at a time (50 unless you give a `limit`). Returns
128
+ * `{ items, nextCursor }`: the ranges are in `items`; pass `nextCursor` back as `cursor` for the next
129
+ * page (`null` means that was the last one).
119
130
  *
120
131
  * @example
121
132
  * ```typescript
122
- * const { items: ranges } = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12')
133
+ * let page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50 })
134
+ * while (page.nextCursor) {
135
+ * page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50, cursor: page.nextCursor })
136
+ * }
123
137
  * ```
124
138
  */
125
- function list(scope: ClaimSetScope, claimSetId: string): Promise<ListResult<ClaimSetRange>>;
139
+ function list(scope: ClaimSetScope, claimSetId: string, options?: ListOptions): Promise<ListResult<ClaimSetRange>>;
126
140
  /** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
127
141
  function create(scope: ClaimSetScope, claimSetId: string, params: CreateClaimSetRangeRequest): Promise<ClaimSetRange>;
128
142
  /** One range, with its counts refreshed. */
@@ -1,4 +1,5 @@
1
1
  import { request, post, put, patch, del } from "../http.js";
2
+ import { listQuery } from "../list.js";
2
3
  /**
3
4
  * Returns the base path for claim set endpoints.
4
5
  * When collectionId is provided, routes to the collection-scoped admin API.
@@ -19,19 +20,24 @@ function rangesBase(scope, claimSetId) {
19
20
  export var claimSet;
20
21
  (function (claimSet) {
21
22
  /**
22
- * Get all claim sets. Returns `{ items, nextCursor }`: the claim sets are in `items`. The list is not
23
- * paged, so `nextCursor` is always `null`.
23
+ * Get all claim sets, a page at a time. Returns `{ items, nextCursor }`: the claim sets are in `items`;
24
+ * pass `nextCursor` back as `cursor` for the next page (`null` means that was the last one).
24
25
  * When collectionId is provided, returns claim sets for that collection.
25
26
  * When omitted, returns all claim sets owned by the authenticated user.
26
27
  * @param collectionId – Optional collection identifier
28
+ * @param options – `limit` (default 50) and `cursor`
27
29
  *
28
30
  * @example
29
31
  * ```typescript
30
- * const { items } = await claimSet.getAll('coll_123')
32
+ * let page = await claimSet.getAll('coll_123', { limit: 50 })
33
+ * while (page.nextCursor) page = await claimSet.getAll('coll_123', { limit: 50, cursor: page.nextCursor })
34
+ *
35
+ * // Your own claim sets (no collection)
36
+ * const { items } = await claimSet.getAll(undefined, { limit: 50 })
31
37
  * ```
32
38
  */
33
- async function getAll(collectionId) {
34
- return request(base(collectionId));
39
+ async function getAll(collectionId, options = {}) {
40
+ return request(`${base(collectionId)}${listQuery({ limit: options.limit, cursor: options.cursor })}`);
35
41
  }
36
42
  claimSet.getAll = getAll;
37
43
  /**
@@ -87,18 +93,23 @@ export var claimSet;
87
93
  /**
88
94
  * Get assigned tags for a claim set — tags soft-assigned to a collection or product. Returns
89
95
  * `{ items, nextCursor }` with the claim set's own fields (`id`, `name`, …) beside them: the tags are
90
- * in `items`. The list is not paged, so `nextCursor` is always `null`.
96
+ * in `items`, a page at a time. Pass `nextCursor` back as `cursor` for the next page (`null` means that
97
+ * was the last one).
91
98
  * @param claimSetId – The claim set identifier
92
99
  * @param collectionId – Optional collection identifier; omit for user-scoped access
100
+ * @param options – `limit` (default 50) and `cursor`
93
101
  *
94
102
  * @example
95
103
  * ```typescript
96
- * const { items, name } = await claimSet.getAssignedTags('12', 'coll_123')
97
- * console.log(`${items.length} tags of ${name} are assigned`)
104
+ * let page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50 })
105
+ * console.log(`Assigned tags of ${page.name}:`, page.items)
106
+ * while (page.nextCursor) {
107
+ * page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50, cursor: page.nextCursor })
108
+ * }
98
109
  * ```
99
110
  */
100
- async function getAssignedTags(claimSetId, collectionId) {
101
- return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/assignedTags`);
111
+ async function getAssignedTags(claimSetId, collectionId, options = {}) {
112
+ return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/assignedTags${listQuery({ limit: options.limit, cursor: options.cursor })}`);
102
113
  }
103
114
  claimSet.getAssignedTags = getAssignedTags;
104
115
  /**
@@ -182,16 +193,20 @@ export var claimSet;
182
193
  let ranges;
183
194
  (function (ranges) {
184
195
  /**
185
- * The ranges in a set, lowest index first. Returns `{ items, nextCursor }`: the ranges are in `items`.
186
- * The list is not paged, so `nextCursor` is always `null`.
196
+ * The ranges in a set, lowest index first, a page at a time (50 unless you give a `limit`). Returns
197
+ * `{ items, nextCursor }`: the ranges are in `items`; pass `nextCursor` back as `cursor` for the next
198
+ * page (`null` means that was the last one).
187
199
  *
188
200
  * @example
189
201
  * ```typescript
190
- * const { items: ranges } = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12')
202
+ * let page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50 })
203
+ * while (page.nextCursor) {
204
+ * page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50, cursor: page.nextCursor })
205
+ * }
191
206
  * ```
192
207
  */
193
- async function list(scope, claimSetId) {
194
- return request(rangesBase(scope, claimSetId));
208
+ async function list(scope, claimSetId, options = {}) {
209
+ return request(`${rangesBase(scope, claimSetId)}${listQuery({ limit: options.limit, cursor: options.cursor })}`);
195
210
  }
196
211
  ranges.list = list;
197
212
  /** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
@@ -243,15 +258,8 @@ export var claimSet;
243
258
  * ```
244
259
  */
245
260
  async function tags(scope, claimSetId, rangeId, options = {}) {
246
- const q = new URLSearchParams();
247
- if (options.limit !== undefined)
248
- q.set('limit', String(options.limit));
249
- if (options.cursor)
250
- q.set('cursor', options.cursor);
251
- if (options.keys)
252
- q.set('keys', '1');
253
- const qs = q.toString();
254
- return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags${qs ? `?${qs}` : ''}`);
261
+ const qs = listQuery({ limit: options.limit, cursor: options.cursor, keys: options.keys ? '1' : undefined });
262
+ return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags${qs}`);
255
263
  }
256
264
  ranges.tags = tags;
257
265
  /** The next tag to program on a phone (lowest index without a chip), with its URL and key. */
@@ -1,5 +1,5 @@
1
1
  import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse, CollectionUser, CollectionAccessLevel, InviteUserInput, CollectionReadiness } from "../types/collection.js";
2
- import type { ListResult } from "../types/list.js";
2
+ import type { ListResult, ListOptions } from "../types/list.js";
3
3
  export declare namespace collection {
4
4
  /**
5
5
  * What the collection's installed apps need and whether it's there (sign-in, customers, products,
@@ -17,18 +17,21 @@ export declare namespace collection {
17
17
  */
18
18
  function get(collectionId: string, admin?: boolean): Promise<CollectionResponse>;
19
19
  /**
20
- * The collections the signed-in user can work on (admin). All of them come back in one answer:
21
- * `nextCursor` is always null. There is no public list of collections: read one with `collection.get`.
20
+ * The collections the signed-in user can work on (admin), a page at a time. Page with `limit`
21
+ * (50 unless you say) and `cursor`. There is no public list of collections: read one with
22
+ * `collection.get`.
23
+ * @param options - `limit` and `cursor`
22
24
  * @returns Promise resolving to `{ items, nextCursor }`, where `items` are CollectionResponse objects
23
25
  * @throws ErrorResponse if the request fails
24
26
  *
25
27
  * @example
26
28
  * ```typescript
27
- * const { items } = await collection.list()
28
- * items.forEach(c => console.log(c.id, c.title))
29
+ * let page = await collection.list({ limit: 50 })
30
+ * page.items.forEach(c => console.log(c.id, c.title))
31
+ * while (page.nextCursor) page = await collection.list({ limit: 50, cursor: page.nextCursor })
29
32
  * ```
30
33
  */
31
- function list(): Promise<ListResult<CollectionResponse>>;
34
+ function list(options?: ListOptions): Promise<ListResult<CollectionResponse>>;
32
35
  /**
33
36
  * Retrieve a collection by its shortId (public endpoint).
34
37
  * @param shortId – The short identifier of the collection
@@ -197,18 +200,20 @@ export declare namespace collection {
197
200
  /**
198
201
  * List the users with access to a collection, each with their access level (admin only). Access is
199
202
  * stored in the collection's `roles` map (userId → level); this resolves each to name/email.
200
- * All of them come back in one answer: `nextCursor` is always null.
203
+ * A page at a time: page with `limit` (50 unless you say) and `cursor`.
201
204
  * GET /admin/collection/:collectionId/getUsers
202
205
  * @param collectionId - Identifier of the collection
206
+ * @param options - `limit` and `cursor`
203
207
  * @returns Promise resolving to `{ items, nextCursor }`, where `items` are the collection's users
204
208
  *
205
209
  * @example
206
210
  * ```typescript
207
- * const { items: users } = await collection.getUsers('coll_123')
208
- * users.forEach(u => console.log(u.email, u.access))
211
+ * let page = await collection.getUsers('coll_123', { limit: 50 })
212
+ * page.items.forEach(u => console.log(u.email, u.access))
213
+ * while (page.nextCursor) page = await collection.getUsers('coll_123', { limit: 50, cursor: page.nextCursor })
209
214
  * ```
210
215
  */
211
- function getUsers(collectionId: string): Promise<ListResult<CollectionUser>>;
216
+ function getUsers(collectionId: string, options?: ListOptions): Promise<ListResult<CollectionUser>>;
212
217
  /**
213
218
  * Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
214
219
  * `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
@@ -1,5 +1,6 @@
1
1
  // src/api/collection.ts
2
2
  import { request, post, put, del } from "../http.js";
3
+ import { listQuery } from "../list.js";
3
4
  export var collection;
4
5
  (function (collection) {
5
6
  /**
@@ -26,19 +27,22 @@ export var collection;
26
27
  }
27
28
  collection.get = get;
28
29
  /**
29
- * The collections the signed-in user can work on (admin). All of them come back in one answer:
30
- * `nextCursor` is always null. There is no public list of collections: read one with `collection.get`.
30
+ * The collections the signed-in user can work on (admin), a page at a time. Page with `limit`
31
+ * (50 unless you say) and `cursor`. There is no public list of collections: read one with
32
+ * `collection.get`.
33
+ * @param options - `limit` and `cursor`
31
34
  * @returns Promise resolving to `{ items, nextCursor }`, where `items` are CollectionResponse objects
32
35
  * @throws ErrorResponse if the request fails
33
36
  *
34
37
  * @example
35
38
  * ```typescript
36
- * const { items } = await collection.list()
37
- * items.forEach(c => console.log(c.id, c.title))
39
+ * let page = await collection.list({ limit: 50 })
40
+ * page.items.forEach(c => console.log(c.id, c.title))
41
+ * while (page.nextCursor) page = await collection.list({ limit: 50, cursor: page.nextCursor })
38
42
  * ```
39
43
  */
40
- async function list() {
41
- return request('/admin/collection');
44
+ async function list(options = {}) {
45
+ return request(`/admin/collection${listQuery(options)}`);
42
46
  }
43
47
  collection.list = list;
44
48
  /**
@@ -282,19 +286,21 @@ export var collection;
282
286
  /**
283
287
  * List the users with access to a collection, each with their access level (admin only). Access is
284
288
  * stored in the collection's `roles` map (userId → level); this resolves each to name/email.
285
- * All of them come back in one answer: `nextCursor` is always null.
289
+ * A page at a time: page with `limit` (50 unless you say) and `cursor`.
286
290
  * GET /admin/collection/:collectionId/getUsers
287
291
  * @param collectionId - Identifier of the collection
292
+ * @param options - `limit` and `cursor`
288
293
  * @returns Promise resolving to `{ items, nextCursor }`, where `items` are the collection's users
289
294
  *
290
295
  * @example
291
296
  * ```typescript
292
- * const { items: users } = await collection.getUsers('coll_123')
293
- * users.forEach(u => console.log(u.email, u.access))
297
+ * let page = await collection.getUsers('coll_123', { limit: 50 })
298
+ * page.items.forEach(u => console.log(u.email, u.access))
299
+ * while (page.nextCursor) page = await collection.getUsers('coll_123', { limit: 50, cursor: page.nextCursor })
294
300
  * ```
295
301
  */
296
- async function getUsers(collectionId) {
297
- return request(`/admin/collection/${encodeURIComponent(collectionId)}/getUsers`);
302
+ async function getUsers(collectionId, options = {}) {
303
+ return request(`/admin/collection/${encodeURIComponent(collectionId)}/getUsers${listQuery(options)}`);
298
304
  }
299
305
  collection.getUsers = getUsers;
300
306
  /**
@@ -104,24 +104,30 @@ export declare namespace comms {
104
104
  */
105
105
  function resolveSubscriptions(collectionId: string, body: import("../types/comms.js").SubscriptionsResolveRequest): Promise<import("../types/comms.js").SubscriptionsResolveResponse>;
106
106
  /**
107
- * Analytics: Query communication events by user or contact. The events come back in one answer
108
- * (`nextCursor` is always null); `limit` is the most it returns.
107
+ * Analytics: Query communication events by user or contact, a page at a time (`limit` and `cursor`
108
+ * in the body). The time window is `from` / `to`.
109
109
  * POST /admin/collection/:collectionId/comm/query/by-user
110
110
  *
111
111
  * @example
112
112
  * ```typescript
113
- * const { items: events } = await comms.queryByUser(collectionId, { contactId, from: '2026-01-01', limit: 200 })
113
+ * const query = { contactId, from: '2026-01-01T00:00:00Z', limit: 200 }
114
+ * let page = await comms.queryByUser(collectionId, query)
115
+ * page.items // CommunicationEvent[]
116
+ * while (page.nextCursor) page = await comms.queryByUser(collectionId, { ...query, cursor: page.nextCursor })
114
117
  * ```
115
118
  */
116
119
  function queryByUser(collectionId: string, body?: CommsQueryByUser): Promise<ListResult<CommunicationEvent>>;
117
120
  /**
118
- * Analytics: Recipient IDs for a communication source. The ids come back in one answer
119
- * (`nextCursor` is always null); `limit` is the most it returns.
121
+ * Analytics: Recipient IDs for a communication source, a page at a time (`limit` and `cursor` in
122
+ * the body). The time window is `from` / `to`.
120
123
  * POST /admin/collection/:collectionId/comm/query/recipient-ids
121
124
  *
122
125
  * @example
123
126
  * ```typescript
124
- * const { items: ids } = await comms.queryRecipientIds(collectionId, { broadcastId, idField: 'contactId' })
127
+ * const query = { broadcastId, idField: 'contactId' as const, limit: 500 }
128
+ * let page = await comms.queryRecipientIds(collectionId, query)
129
+ * page.items // the ids
130
+ * while (page.nextCursor) page = await comms.queryRecipientIds(collectionId, { ...query, cursor: page.nextCursor })
125
131
  * ```
126
132
  */
127
133
  function queryRecipientIds(collectionId: string, body: CommsRecipientIdsQuery): Promise<ListResult<RecipientId>>;
package/dist/api/comms.js CHANGED
@@ -189,13 +189,16 @@ export var comms;
189
189
  }
190
190
  comms.resolveSubscriptions = resolveSubscriptions;
191
191
  /**
192
- * Analytics: Query communication events by user or contact. The events come back in one answer
193
- * (`nextCursor` is always null); `limit` is the most it returns.
192
+ * Analytics: Query communication events by user or contact, a page at a time (`limit` and `cursor`
193
+ * in the body). The time window is `from` / `to`.
194
194
  * POST /admin/collection/:collectionId/comm/query/by-user
195
195
  *
196
196
  * @example
197
197
  * ```typescript
198
- * const { items: events } = await comms.queryByUser(collectionId, { contactId, from: '2026-01-01', limit: 200 })
198
+ * const query = { contactId, from: '2026-01-01T00:00:00Z', limit: 200 }
199
+ * let page = await comms.queryByUser(collectionId, query)
200
+ * page.items // CommunicationEvent[]
201
+ * while (page.nextCursor) page = await comms.queryByUser(collectionId, { ...query, cursor: page.nextCursor })
199
202
  * ```
200
203
  */
201
204
  async function queryByUser(collectionId, body = {}) {
@@ -204,13 +207,16 @@ export var comms;
204
207
  }
205
208
  comms.queryByUser = queryByUser;
206
209
  /**
207
- * Analytics: Recipient IDs for a communication source. The ids come back in one answer
208
- * (`nextCursor` is always null); `limit` is the most it returns.
210
+ * Analytics: Recipient IDs for a communication source, a page at a time (`limit` and `cursor` in
211
+ * the body). The time window is `from` / `to`.
209
212
  * POST /admin/collection/:collectionId/comm/query/recipient-ids
210
213
  *
211
214
  * @example
212
215
  * ```typescript
213
- * const { items: ids } = await comms.queryRecipientIds(collectionId, { broadcastId, idField: 'contactId' })
216
+ * const query = { broadcastId, idField: 'contactId' as const, limit: 500 }
217
+ * let page = await comms.queryRecipientIds(collectionId, query)
218
+ * page.items // the ids
219
+ * while (page.nextCursor) page = await comms.queryRecipientIds(collectionId, { ...query, cursor: page.nextCursor })
214
220
  * ```
215
221
  */
216
222
  async function queryRecipientIds(collectionId, body) {
@@ -1,5 +1,5 @@
1
1
  import type { ConditionSet } from "../utils/conditions.js";
2
- import type { ListResult } from "../types/list.js";
2
+ import type { ListResult, ListOptions } from "../types/list.js";
3
3
  /** A saved condition: a named rule set pages, Hub blocks and apps refer to by id. */
4
4
  export interface SavedCondition extends ConditionSet {
5
5
  id: string;
@@ -22,16 +22,17 @@ export type SaveConditionRequest = Omit<SavedCondition, "id" | "deleted">;
22
22
  */
23
23
  export declare namespace conditions {
24
24
  /**
25
- * Every saved condition in the collection (removed ones left out). All of them come back in one
26
- * answer: `nextCursor` is always null.
25
+ * The collection's saved conditions (removed ones left out), a page at a time. Page with `limit`
26
+ * (50 unless you say) and `cursor`.
27
27
  *
28
28
  * @example
29
29
  * ```typescript
30
- * const { items } = await conditions.list('coll_123')
31
- * items.map(c => c.title) // ["UK only", "In the stadium"]
30
+ * let page = await conditions.list('coll_123')
31
+ * page.items.map(c => c.title) // ["UK only", "In the stadium"]
32
+ * while (page.nextCursor) page = await conditions.list('coll_123', false, { cursor: page.nextCursor })
32
33
  * ```
33
34
  */
34
- function list(collectionId: string, admin?: boolean): Promise<ListResult<SavedCondition>>;
35
+ function list(collectionId: string, admin?: boolean, options?: ListOptions): Promise<ListResult<SavedCondition>>;
35
36
  /**
36
37
  * One saved condition. Public reads 404 for a removed one; an admin read returns it with `deleted: true`.
37
38
  *
@@ -1,4 +1,5 @@
1
1
  import { request, post, put, del } from "../http.js";
2
+ import { listQuery } from "../list.js";
2
3
  /**
3
4
  * Saved conditions: named rule sets kept per collection (e.g. "UK only", "In the stadium"), so the same rule can be
4
5
  * reused by id. They're checked on the device with `utils.validateCondition({ conditionId, collection })`, which
@@ -12,17 +13,18 @@ export var conditions;
12
13
  const pub = (collectionId) => `/public/collection/${encodeURIComponent(collectionId)}/condition`;
13
14
  const adm = (collectionId) => `/admin/collection/${encodeURIComponent(collectionId)}/condition`;
14
15
  /**
15
- * Every saved condition in the collection (removed ones left out). All of them come back in one
16
- * answer: `nextCursor` is always null.
16
+ * The collection's saved conditions (removed ones left out), a page at a time. Page with `limit`
17
+ * (50 unless you say) and `cursor`.
17
18
  *
18
19
  * @example
19
20
  * ```typescript
20
- * const { items } = await conditions.list('coll_123')
21
- * items.map(c => c.title) // ["UK only", "In the stadium"]
21
+ * let page = await conditions.list('coll_123')
22
+ * page.items.map(c => c.title) // ["UK only", "In the stadium"]
23
+ * while (page.nextCursor) page = await conditions.list('coll_123', false, { cursor: page.nextCursor })
22
24
  * ```
23
25
  */
24
- async function list(collectionId, admin = false) {
25
- return request(admin ? adm(collectionId) : pub(collectionId));
26
+ async function list(collectionId, admin = false, options = {}) {
27
+ return request(`${admin ? adm(collectionId) : pub(collectionId)}${listQuery(options)}`);
26
28
  }
27
29
  conditions.list = list;
28
30
  /**
@@ -42,7 +42,8 @@ export declare namespace contact {
42
42
  }): Promise<ListResult<ContactResponse>>;
43
43
  /**
44
44
  * Search the collection's contacts (admin only), a page at a time: free text (`q`, with `typeahead`
45
- * for search-as-you-type), or filters on email, phone, id, tags, source, dates and custom fields.
45
+ * for search-as-you-type), or filters on email, phone, id, tags, source and custom fields. Filter by
46
+ * when the contact was created with a range: `createdAt: { gte, lte }`.
46
47
  * GET /admin/collection/:collectionId/contacts/search
47
48
  *
48
49
  * @example
@@ -50,9 +51,12 @@ export declare namespace contact {
50
51
  * let page = await contact.search({ collectionId, q: 'joh', typeahead: true, limit: 20 })
51
52
  * page.items // Contact[]
52
53
  * if (page.nextCursor) page = await contact.search({ collectionId, q: 'joh', typeahead: true, limit: 20, cursor: page.nextCursor })
54
+ *
55
+ * // Contacts created in November
56
+ * await contact.search({ collectionId, createdAt: { gte: '2026-11-01T00:00:00Z', lte: '2026-11-30T23:59:59Z' } })
53
57
  * ```
54
58
  */
55
- function search({ collectionId, q, typeahead, email, phone, id, userId, tags, tagsAll, source, locale, createdFrom, createdTo, externalIdKey, externalIdValue, customFieldKey, customFieldValue, limit, cursor, }: ContactSearchParams): Promise<ListResult<ContactResponse>>;
59
+ function search({ collectionId, tags, tagsAll, ...rest }: ContactSearchParams): Promise<ListResult<ContactResponse>>;
56
60
  function get(collectionId: string, contactId: string, params?: {
57
61
  includeDeleted?: boolean;
58
62
  }): Promise<ContactResponse>;