@proveanything/smartlinks 3.0.0-alpha.1 → 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 (145) 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/knowledge.md +3 -3
  96. package/dist/docs/lists.md +58 -15
  97. package/dist/docs/upgrading-to-3.md +238 -136
  98. package/dist/list.d.ts +12 -0
  99. package/dist/list.js +59 -0
  100. package/dist/openapi.yaml +301 -662
  101. package/dist/types/analytics.d.ts +7 -3
  102. package/dist/types/appObjects.d.ts +27 -12
  103. package/dist/types/appOptions.d.ts +2 -2
  104. package/dist/types/asset.d.ts +5 -6
  105. package/dist/types/attestations.d.ts +7 -9
  106. package/dist/types/batch.d.ts +5 -5
  107. package/dist/types/bookings.d.ts +10 -5
  108. package/dist/types/comms.d.ts +9 -5
  109. package/dist/types/contact.d.ts +7 -4
  110. package/dist/types/containers.d.ts +2 -1
  111. package/dist/types/facets.d.ts +14 -2
  112. package/dist/types/files.d.ts +3 -2
  113. package/dist/types/integrations.d.ts +2 -1
  114. package/dist/types/interaction.d.ts +15 -7
  115. package/dist/types/jobs.d.ts +1 -1
  116. package/dist/types/journeysAnalytics.d.ts +3 -2
  117. package/dist/types/knowledge.d.ts +6 -3
  118. package/dist/types/knowledge.js +0 -1
  119. package/dist/types/list.d.ts +30 -2
  120. package/dist/types/location.d.ts +7 -2
  121. package/dist/types/location.js +0 -1
  122. package/dist/types/lots.d.ts +5 -2
  123. package/dist/types/lots.js +0 -6
  124. package/dist/types/order.d.ts +22 -20
  125. package/dist/types/product.d.ts +28 -11
  126. package/dist/types/proof.d.ts +7 -8
  127. package/dist/types/tags.d.ts +5 -3
  128. package/dist/types/userGroups.d.ts +3 -3
  129. package/dist/types/userGroups.js +0 -4
  130. package/dist/version.d.ts +1 -1
  131. package/dist/version.js +1 -1
  132. package/docs/API_SUMMARY.md +289 -483
  133. package/docs/ai.md +15 -15
  134. package/docs/analytics.md +1 -1
  135. package/docs/app-objects.md +4 -4
  136. package/docs/attestations.md +8 -8
  137. package/docs/contact-search.md +2 -3
  138. package/docs/knowledge.md +3 -3
  139. package/docs/lists.md +58 -15
  140. package/docs/upgrading-to-3.md +238 -136
  141. package/openapi.yaml +301 -662
  142. package/package.json +1 -1
  143. package/scripts/lib/upgrade.mjs +216 -60
  144. package/scripts/upgrade.mjs +33 -10
  145. package/upgrade/3.json +2731 -2213
package/dist/api/order.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/api/order.ts
2
2
  import { request, post, put, del, requestWithOptions } from "../http.js";
3
+ import { listQuery } from "../list.js";
3
4
  /**
4
5
  * Order Management API
5
6
  *
@@ -135,7 +136,7 @@ export var order;
135
136
  * // Filter by customer with items
136
137
  * const customerOrders = await order.list('coll_123', {
137
138
  * customerId: 'CUST-789',
138
- * includeItems: true
139
+ * expand: ['items']
139
140
  * })
140
141
  *
141
142
  * // Purchase orders from one supplier
@@ -143,31 +144,13 @@ export var order;
143
144
  * ```
144
145
  */
145
146
  async function list(collectionId, params) {
146
- const queryParams = new URLSearchParams();
147
- if (params === null || params === void 0 ? void 0 : params.limit)
148
- queryParams.append('limit', params.limit.toString());
149
- if (params === null || params === void 0 ? void 0 : params.cursor)
150
- queryParams.append('cursor', params.cursor);
151
- if (params === null || params === void 0 ? void 0 : params.status)
152
- queryParams.append('status', params.status);
153
- if (params === null || params === void 0 ? void 0 : params.orderRef)
154
- queryParams.append('orderRef', params.orderRef);
155
- if (params === null || params === void 0 ? void 0 : params.customerId)
156
- queryParams.append('customerId', params.customerId);
157
- if (params === null || params === void 0 ? void 0 : params.direction)
158
- queryParams.append('direction', params.direction);
159
- if (params === null || params === void 0 ? void 0 : params.partyId)
160
- queryParams.append('partyId', params.partyId);
161
- if (params === null || params === void 0 ? void 0 : params.includeItems)
162
- queryParams.append('includeItems', 'true');
163
- const query = queryParams.toString();
164
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/orders${query ? `?${query}` : ''}`;
147
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/orders${listQuery(params)}`;
165
148
  return request(path);
166
149
  }
167
150
  order.list = list;
168
151
  /**
169
152
  * Get items from an order with pagination support.
170
- * Use this for orders with many items instead of includeItems.
153
+ * Use this for orders with many items instead of `expand: ['items']`.
171
154
  *
172
155
  * @param collectionId - Identifier of the parent collection
173
156
  * @param orderId - Order ID
@@ -187,13 +170,7 @@ export var order;
187
170
  * ```
188
171
  */
189
172
  async function getItems(collectionId, orderId, params) {
190
- const queryParams = new URLSearchParams();
191
- if (params === null || params === void 0 ? void 0 : params.limit)
192
- queryParams.append('limit', params.limit.toString());
193
- if (params === null || params === void 0 ? void 0 : params.cursor)
194
- queryParams.append('cursor', params.cursor);
195
- const query = queryParams.toString();
196
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/orders/${encodeURIComponent(orderId)}/items${query ? `?${query}` : ''}`;
173
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/orders/${encodeURIComponent(orderId)}/items${listQuery(params)}`;
197
174
  return request(path);
198
175
  }
199
176
  order.getItems = getItems;
@@ -276,21 +253,18 @@ export var order;
276
253
  * More powerful than the basic list() function.
277
254
  *
278
255
  * @param collectionId - Identifier of the parent collection
279
- * @param data - Query parameters with filters and sorting, plus `limit` and `cursor` for paging
256
+ * @param data - The filters (`query`), plus `orderBy`, the date ranges `createdAt` / `updatedAt`,
257
+ * `expand: ['items']`, and `limit` and `cursor` for paging. These all sit beside `query`, not inside it.
280
258
  * @returns Promise resolving to `{ items, nextCursor }`: the matching orders, and the cursor for the next page (null on the last)
281
259
  * @throws ErrorResponse if the request fails
282
260
  *
283
261
  * @example
284
262
  * ```typescript
285
- * // Find pending orders created in January 2026
263
+ * // Find pending orders created in January 2026, newest first
286
264
  * const result = await order.query('coll_123', {
287
- * query: {
288
- * status: 'pending',
289
- * createdAfter: '2026-01-01T00:00:00Z',
290
- * createdBefore: '2026-02-01T00:00:00Z',
291
- * sortBy: 'createdAt',
292
- * sortOrder: 'desc'
293
- * },
265
+ * query: { status: 'pending' },
266
+ * createdAt: { gte: '2026-01-01T00:00:00Z', lte: '2026-02-01T00:00:00Z' },
267
+ * orderBy: [{ createdAt: 'desc' }],
294
268
  * limit: 50
295
269
  * })
296
270
  * console.log(result.items.length)
@@ -298,40 +272,42 @@ export var order;
298
272
  * // The next page: the same query with the cursor
299
273
  * if (result.nextCursor) {
300
274
  * const next = await order.query('coll_123', {
301
- * query: { status: 'pending', sortBy: 'createdAt', sortOrder: 'desc' },
275
+ * query: { status: 'pending' },
276
+ * createdAt: { gte: '2026-01-01T00:00:00Z', lte: '2026-02-01T00:00:00Z' },
277
+ * orderBy: [{ createdAt: 'desc' }],
302
278
  * limit: 50,
303
279
  * cursor: result.nextCursor
304
280
  * })
305
281
  * }
306
282
  *
307
- * // Find orders with specific metadata and item count
283
+ * // Find orders with specific metadata and item count, with their items
308
284
  * const highPriority = await order.query('coll_123', {
309
285
  * query: {
310
286
  * metadata: { priority: 'high' },
311
287
  * minItemCount: 10,
312
288
  * maxItemCount: 100
313
289
  * },
314
- * includeItems: true
290
+ * expand: ['items']
315
291
  * })
316
292
  *
317
- * // Find orders containing a specific product batch
293
+ * // Find orders containing a specific product batch
318
294
  * const batchOrders = await order.query('coll_123', {
319
295
  * query: {
320
- * productId: 'prod_789',
321
- * batchId: 'BATCH-2024-001'
322
- * },
323
- * includeItems: true
324
- * })
325
- *
326
- * // Find an order containing one of several specific items
327
- * const matched = await order.query('coll_123', {
328
- * query: {
329
- * items: [
330
- * { itemType: 'tag', itemId: 'TAG001' },
331
- * { itemType: 'serial', itemId: 'SN12345' }
332
- * ]
296
+ * productId: 'prod_789',
297
+ * batchId: 'BATCH-2024-001'
298
+ * },
299
+ * expand: ['items']
300
+ * })
301
+ *
302
+ * // Find an order containing one of several specific items
303
+ * const matched = await order.query('coll_123', {
304
+ * query: {
305
+ * items: [
306
+ * { itemType: 'tag', itemId: 'TAG001' },
307
+ * { itemType: 'serial', itemId: 'SN12345' }
308
+ * ]
333
309
  * },
334
- * includeItems: true
310
+ * expand: ['items']
335
311
  * })
336
312
  * ```
337
313
  */
@@ -442,20 +418,23 @@ export var order;
442
418
  *
443
419
  * @param collectionId - Identifier of the parent collection
444
420
  * @param orderId - Order ID
445
- * @param params - Optional filters (limit, date range, isAdmin)
446
- * @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scan events (one list, no
447
- * pages: `limit` says how many, default 1000), with the order they belong to
421
+ * @param params - Optional filters (`from` / `to` time window, `isAdmin`), plus `limit` and `cursor` for paging
422
+ * @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scan events, a page at a
423
+ * time (`limit` says how many, default 1000), with the order they belong to
448
424
  * @throws ErrorResponse if the request fails
449
425
  *
450
426
  * @example
451
427
  * ```typescript
452
- * // Get all scan events
453
- * const timeline = await order.getTimeline('coll_123', 'order_abc123')
428
+ * // The first page of scan events
429
+ * let timeline = await order.getTimeline('coll_123', 'order_abc123')
454
430
  *
455
431
  * timeline.items.forEach(event => {
456
432
  * console.log(`${event.timestamp}: ${event.eventType} by ${event.isAdmin ? 'admin' : 'customer'}`)
457
433
  * })
458
434
  *
435
+ * // The next page
436
+ * if (timeline.nextCursor) timeline = await order.getTimeline('coll_123', 'order_abc123', { cursor: timeline.nextCursor })
437
+ *
459
438
  * // Get admin scans only from last week
460
439
  * const adminScans = await order.getTimeline('coll_123', 'order_abc123', {
461
440
  * isAdmin: true,
@@ -475,21 +454,25 @@ export var order;
475
454
  *
476
455
  * @param collectionId - Identifier of the parent collection
477
456
  * @param orderId - Order ID
478
- * @param params - Optional limit parameter
479
- * @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scans that have a location
480
- * (one list, no pages: `limit` says how many, default 1000), with the order they belong to
457
+ * @param params - Optional `limit` and `cursor` for paging
458
+ * @returns Promise resolving to `{ items, nextCursor, orderRef, orderId }`: the scans that have a location,
459
+ * a page at a time (`limit` says how many, default 1000), with the order they belong to
481
460
  * @throws ErrorResponse if the request fails
482
461
  *
483
462
  * @example
484
463
  * ```typescript
485
- * const locations = await order.getLocationHistory('coll_123', 'order_abc123', {
464
+ * let locations = await order.getLocationHistory('coll_123', 'order_abc123', {
486
465
  * limit: 100
487
466
  * })
488
467
  *
489
- * console.log(`Order has ${locations.items.length} scans with a location`)
490
468
  * locations.items.forEach(scan => {
491
469
  * console.log(`${scan.location} at ${scan.timestamp}`)
492
470
  * })
471
+ *
472
+ * // The next page
473
+ * if (locations.nextCursor) {
474
+ * locations = await order.getLocationHistory('coll_123', 'order_abc123', { limit: 100, cursor: locations.nextCursor })
475
+ * }
493
476
  * ```
494
477
  */
495
478
  async function getLocationHistory(collectionId, orderId, params) {
@@ -1,5 +1,5 @@
1
1
  import { Partner, PartnerClaimSet, CreatePartnerClaimSetRequest, PartnerTagHit, ClientErrorEvent } from "../types/index.js";
2
- import type { ListResult } from "../types/list.js";
2
+ import type { ListResult, ListOptions } from "../types/list.js";
3
3
  /**
4
4
  * Partners: organisations above collections (FanConnect, Zenith Coins, …) that own NFC claim sets and
5
5
  * assign their tags into collections their people administer. Partners and their members are set up by
@@ -9,26 +9,29 @@ import type { ListResult } from "../types/list.js";
9
9
  export declare namespace partner {
10
10
  /**
11
11
  * The partners you belong to, with your role in each. Returns `{ items, nextCursor }`: the partners are
12
- * in `items` (empty for everyone else). The list is not paged, so `nextCursor` is always `null`.
12
+ * in `items` (empty for everyone else). A page at a time (`limit` and `cursor`; 50 unless you say
13
+ * otherwise).
13
14
  *
14
15
  * @example
15
16
  * ```typescript
16
- * const { items: partners } = await partner.list()
17
+ * let page = await partner.list()
18
+ * while (page.nextCursor) page = await partner.list({ cursor: page.nextCursor })
17
19
  * ```
18
20
  */
19
- function list(): Promise<ListResult<Partner>>;
21
+ function list(options?: ListOptions): Promise<ListResult<Partner>>;
20
22
  /** One partner (owners also see its members). */
21
23
  function get(partnerId: string): Promise<Partner>;
22
24
  /**
23
- * The partner's claim sets. Returns `{ items, nextCursor }`: the sets are in `items`. The list is not
24
- * paged, so `nextCursor` is always `null`.
25
+ * The partner's claim sets. Returns `{ items, nextCursor }`: the sets are in `items`. A page at a time
26
+ * (`limit` and `cursor`; 50 unless you say otherwise).
25
27
  *
26
28
  * @example
27
29
  * ```typescript
28
- * const { items: sets } = await partner.claimSets(partnerId)
30
+ * let page = await partner.claimSets(partnerId)
31
+ * while (page.nextCursor) page = await partner.claimSets(partnerId, { cursor: page.nextCursor })
29
32
  * ```
30
33
  */
31
- function claimSets(partnerId: string): Promise<ListResult<PartnerClaimSet>>;
34
+ function claimSets(partnerId: string, options?: ListOptions): Promise<ListResult<PartnerClaimSet>>;
32
35
  /** One of the partner's claim sets. */
33
36
  function getClaimSet(partnerId: string, claimSetId: string): Promise<PartnerClaimSet>;
34
37
  /** A new claim set for the partner, on one of its tap domains (owners and admins). */
@@ -36,8 +39,8 @@ export declare namespace partner {
36
39
  /**
37
40
  * Find a tag across the partner's sets by its chip UID (8 or 14 hex) or its code (printed or bare).
38
41
  * Returns `{ items, nextCursor }`: `items` has one hit for each of the partner's sets the tag is in
39
- * (usually one; none if the tag isn't the partner's). Never returns keys. The list is not paged, so
40
- * `nextCursor` is always `null`.
42
+ * (usually one; none if the tag isn't the partner's). Never returns keys. A look-up is never paged: every
43
+ * hit comes back in the one answer.
41
44
  *
42
45
  * @example
43
46
  * ```typescript
@@ -51,13 +54,13 @@ export declare namespace partner {
51
54
  /**
52
55
  * What phones reported about one chip (errors.report with entityType 'tag'), newest first: a tag that
53
56
  * failed to program or register, with the host's NFC log in context. For a chip in the partner's sets,
54
- * or attempts that named one of them. Returns `{ items, nextCursor }`: the ten latest reports are in
55
- * `items`. The list is not paged, so `nextCursor` is always `null`.
57
+ * or attempts that named one of them. Returns `{ items, nextCursor }`: the latest reports are in
58
+ * `items` (ten unless `limit` says otherwise); `cursor` is the previous page's `nextCursor`.
56
59
  *
57
60
  * @example
58
61
  * ```typescript
59
- * const { items: attempts } = await partner.tagAttempts(partnerId, '04A1B2C3D4E5F6')
62
+ * const { items: attempts } = await partner.tagAttempts(partnerId, '04A1B2C3D4E5F6', { limit: 20 })
60
63
  * ```
61
64
  */
62
- function tagAttempts(partnerId: string, uid: string): Promise<ListResult<ClientErrorEvent>>;
65
+ function tagAttempts(partnerId: string, uid: string, options?: ListOptions): Promise<ListResult<ClientErrorEvent>>;
63
66
  }
@@ -1,4 +1,5 @@
1
1
  import { request, post } from "../http.js";
2
+ import { listQuery } from "../list.js";
2
3
  /**
3
4
  * Partners: organisations above collections (FanConnect, Zenith Coins, …) that own NFC claim sets and
4
5
  * assign their tags into collections their people administer. Partners and their members are set up by
@@ -9,15 +10,17 @@ export var partner;
9
10
  (function (partner) {
10
11
  /**
11
12
  * The partners you belong to, with your role in each. Returns `{ items, nextCursor }`: the partners are
12
- * in `items` (empty for everyone else). The list is not paged, so `nextCursor` is always `null`.
13
+ * in `items` (empty for everyone else). A page at a time (`limit` and `cursor`; 50 unless you say
14
+ * otherwise).
13
15
  *
14
16
  * @example
15
17
  * ```typescript
16
- * const { items: partners } = await partner.list()
18
+ * let page = await partner.list()
19
+ * while (page.nextCursor) page = await partner.list({ cursor: page.nextCursor })
17
20
  * ```
18
21
  */
19
- async function list() {
20
- return request(`/admin/partner`);
22
+ async function list(options = {}) {
23
+ return request(`/admin/partner${listQuery(options)}`);
21
24
  }
22
25
  partner.list = list;
23
26
  /** One partner (owners also see its members). */
@@ -26,16 +29,17 @@ export var partner;
26
29
  }
27
30
  partner.get = get;
28
31
  /**
29
- * The partner's claim sets. Returns `{ items, nextCursor }`: the sets are in `items`. The list is not
30
- * paged, so `nextCursor` is always `null`.
32
+ * The partner's claim sets. Returns `{ items, nextCursor }`: the sets are in `items`. A page at a time
33
+ * (`limit` and `cursor`; 50 unless you say otherwise).
31
34
  *
32
35
  * @example
33
36
  * ```typescript
34
- * const { items: sets } = await partner.claimSets(partnerId)
37
+ * let page = await partner.claimSets(partnerId)
38
+ * while (page.nextCursor) page = await partner.claimSets(partnerId, { cursor: page.nextCursor })
35
39
  * ```
36
40
  */
37
- async function claimSets(partnerId) {
38
- return request(`/admin/partner/${encodeURIComponent(partnerId)}/claimSet`);
41
+ async function claimSets(partnerId, options = {}) {
42
+ return request(`/admin/partner/${encodeURIComponent(partnerId)}/claimSet${listQuery(options)}`);
39
43
  }
40
44
  partner.claimSets = claimSets;
41
45
  /** One of the partner's claim sets. */
@@ -51,8 +55,8 @@ export var partner;
51
55
  /**
52
56
  * Find a tag across the partner's sets by its chip UID (8 or 14 hex) or its code (printed or bare).
53
57
  * Returns `{ items, nextCursor }`: `items` has one hit for each of the partner's sets the tag is in
54
- * (usually one; none if the tag isn't the partner's). Never returns keys. The list is not paged, so
55
- * `nextCursor` is always `null`.
58
+ * (usually one; none if the tag isn't the partner's). Never returns keys. A look-up is never paged: every
59
+ * hit comes back in the one answer.
56
60
  *
57
61
  * @example
58
62
  * ```typescript
@@ -60,27 +64,22 @@ export var partner;
60
64
  * ```
61
65
  */
62
66
  async function lookupTags(partnerId, query) {
63
- const q = new URLSearchParams();
64
- if (query.uid)
65
- q.set('uid', query.uid);
66
- if (query.code)
67
- q.set('code', query.code);
68
- return request(`/admin/partner/${encodeURIComponent(partnerId)}/tags/lookup?${q}`);
67
+ return request(`/admin/partner/${encodeURIComponent(partnerId)}/tags/lookup${listQuery(query)}`);
69
68
  }
70
69
  partner.lookupTags = lookupTags;
71
70
  /**
72
71
  * What phones reported about one chip (errors.report with entityType 'tag'), newest first: a tag that
73
72
  * failed to program or register, with the host's NFC log in context. For a chip in the partner's sets,
74
- * or attempts that named one of them. Returns `{ items, nextCursor }`: the ten latest reports are in
75
- * `items`. The list is not paged, so `nextCursor` is always `null`.
73
+ * or attempts that named one of them. Returns `{ items, nextCursor }`: the latest reports are in
74
+ * `items` (ten unless `limit` says otherwise); `cursor` is the previous page's `nextCursor`.
76
75
  *
77
76
  * @example
78
77
  * ```typescript
79
- * const { items: attempts } = await partner.tagAttempts(partnerId, '04A1B2C3D4E5F6')
78
+ * const { items: attempts } = await partner.tagAttempts(partnerId, '04A1B2C3D4E5F6', { limit: 20 })
80
79
  * ```
81
80
  */
82
- async function tagAttempts(partnerId, uid) {
83
- return request(`/admin/partner/${encodeURIComponent(partnerId)}/tags/attempts?uid=${encodeURIComponent(uid)}`);
81
+ async function tagAttempts(partnerId, uid, options = {}) {
82
+ return request(`/admin/partner/${encodeURIComponent(partnerId)}/tags/attempts${listQuery(Object.assign({ uid }, options))}`);
84
83
  }
85
84
  partner.tagAttempts = tagAttempts;
86
85
  })(partner || (partner = {}));
@@ -1,30 +1,41 @@
1
1
  import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
2
2
  import { JsonValue, ProductClaimCreateRequestBody, ProductCreateRequest, ProductQueryMeta, ProductQueryRequest, ProductResponse, ProductUpdateRequest } from "../types/product.js";
3
3
  import type { AssetResponse } from "../types/asset.js";
4
- import type { ListResult } from "../types/list.js";
4
+ import type { ListResult, ListOptions } from "../types/list.js";
5
5
  export declare namespace products {
6
6
  function get(collectionId: string, productId: string, admin?: boolean): Promise<ProductResponse>;
7
7
  /**
8
- * Every product in a collection, in one list (no pages). For filtering, sorting and paging use
8
+ * The products in a collection, a page at a time. For searching, filtering and sorting use
9
9
  * `products.query`.
10
10
  *
11
11
  * @param collectionId - Identifier of the parent collection
12
12
  * @param admin - When `true`, targets the `/admin` endpoint; otherwise the `/public` one
13
+ * @param options - `limit` (default 50) and `cursor`; `expand: ['facets']` gives each product's facets
14
+ * as full values instead of their keys
13
15
  *
14
16
  * @example
15
17
  * ```typescript
16
- * const { items } = await products.list(collectionId)
18
+ * let page = await products.list(collectionId, false, { limit: 50 })
19
+ * while (page.nextCursor) {
20
+ * page = await products.list(collectionId, false, { limit: 50, cursor: page.nextCursor })
21
+ * }
22
+ *
23
+ * // Admin, with full facet values
24
+ * const { items } = await products.list(collectionId, true, { expand: ['facets'] })
17
25
  * ```
18
26
  */
19
- function list(collectionId: string, admin?: boolean): Promise<ListResult<ProductResponse>>;
27
+ function list(collectionId: string, admin?: boolean, options?: ListOptions & {
28
+ expand?: Array<'facets'>;
29
+ }): Promise<ListResult<ProductResponse>>;
20
30
  function create(collectionId: string, data: ProductCreateRequest): Promise<ProductResponse>;
21
31
  function update(collectionId: string, productId: string, data: ProductUpdateRequest): Promise<ProductResponse>;
22
32
  function remove(collectionId: string, productId: string): Promise<void>;
23
33
  /**
24
- * Query products in a collection with filtering, sorting, and paging.
34
+ * Query products in a collection with search, filtering, sorting, and paging.
25
35
  *
26
36
  * @param collectionId - Identifier of the parent collection
27
- * @param body - Filters and sorting, plus `limit` (default 50) and `cursor` for paging
37
+ * @param body - `q` (search text), `orderBy`, `createdAt` / `updatedAt` (date ranges), `expand: ['facets']`
38
+ * and the other filters in `query`, plus `limit` (default 50) and `cursor` for paging
28
39
  * @param admin - When `true`, targets the `/admin` endpoint (requires an
29
40
  * authenticated admin context). Defaults to `false`, which targets the
30
41
  * `/public` endpoint — consistent with `get`, `list`, and `listAssets`.
@@ -35,15 +46,23 @@ export declare namespace products {
35
46
  * @example
36
47
  * ```typescript
37
48
  * // Public query (default)
38
- * const { items, nextCursor, count } = await products.query(collectionId, { query: { search: 'cabernet' }, limit: 20 })
49
+ * const { items, nextCursor, count } = await products.query(collectionId, { q: 'cabernet', limit: 20 })
39
50
  *
40
51
  * // The next page: the same query with the cursor
41
52
  * if (nextCursor) {
42
- * await products.query(collectionId, { query: { search: 'cabernet' }, limit: 20, cursor: nextCursor })
53
+ * await products.query(collectionId, { q: 'cabernet', limit: 20, cursor: nextCursor })
43
54
  * }
44
55
  *
56
+ * // Newest first, created this month, active only, with full facet values
57
+ * await products.query(collectionId, {
58
+ * orderBy: [{ createdAt: 'desc' }],
59
+ * createdAt: { gte: '2026-11-01T00:00:00Z', lte: '2026-11-30T23:59:59Z' },
60
+ * query: { status: ['active'] },
61
+ * expand: ['facets'],
62
+ * })
63
+ *
45
64
  * // Admin query (authenticated)
46
- * await products.query(collectionId, { query: { search: 'cabernet' } }, true)
65
+ * await products.query(collectionId, { q: 'cabernet' }, true)
47
66
  * ```
48
67
  */
49
68
  function query(collectionId: string, body: ProductQueryRequest, admin?: boolean): Promise<ListResult<ProductResponse> & {
@@ -72,16 +91,20 @@ export declare namespace products {
72
91
  function standardQueryFields(collectionId: string): Promise<QueryDescription>;
73
92
  function clone(collectionId: string, productId: string, body?: Record<string, JsonValue>): Promise<ProductResponse>;
74
93
  /**
75
- * A product's assets (images, documents), in one list (no pages).
94
+ * A product's assets (images, documents), a page at a time.
76
95
  *
77
96
  * @param admin - When `true`, targets the `/admin` endpoint; otherwise the `/public` one
97
+ * @param options - `limit` (default 50) and `cursor`
78
98
  *
79
99
  * @example
80
100
  * ```typescript
81
- * const { items } = await products.listAssets(collectionId, productId)
101
+ * let page = await products.listAssets(collectionId, productId, false, { limit: 50 })
102
+ * while (page.nextCursor) {
103
+ * page = await products.listAssets(collectionId, productId, false, { limit: 50, cursor: page.nextCursor })
104
+ * }
82
105
  * ```
83
106
  */
84
- function listAssets(collectionId: string, productId: string, admin?: boolean): Promise<ListResult<AssetResponse>>;
107
+ function listAssets(collectionId: string, productId: string, admin?: boolean, options?: ListOptions): Promise<ListResult<AssetResponse>>;
85
108
  function createClaimWindow(collectionId: string, productId: string, body: Record<string, JsonValue>): Promise<unknown>;
86
109
  function updateClaimWindow(collectionId: string, productId: string, claimId: string, body: Record<string, JsonValue>): Promise<unknown>;
87
110
  function refresh(collectionId: string, productId: string): Promise<ProductResponse>;
@@ -1,4 +1,5 @@
1
1
  import { del, post, put, request } from "../http.js";
2
+ import { listQuery } from "../list.js";
2
3
  export var products;
3
4
  (function (products) {
4
5
  async function get(collectionId, productId, admin) {
@@ -8,20 +9,29 @@ export var products;
8
9
  }
9
10
  products.get = get;
10
11
  /**
11
- * Every product in a collection, in one list (no pages). For filtering, sorting and paging use
12
+ * The products in a collection, a page at a time. For searching, filtering and sorting use
12
13
  * `products.query`.
13
14
  *
14
15
  * @param collectionId - Identifier of the parent collection
15
16
  * @param admin - When `true`, targets the `/admin` endpoint; otherwise the `/public` one
17
+ * @param options - `limit` (default 50) and `cursor`; `expand: ['facets']` gives each product's facets
18
+ * as full values instead of their keys
16
19
  *
17
20
  * @example
18
21
  * ```typescript
19
- * const { items } = await products.list(collectionId)
22
+ * let page = await products.list(collectionId, false, { limit: 50 })
23
+ * while (page.nextCursor) {
24
+ * page = await products.list(collectionId, false, { limit: 50, cursor: page.nextCursor })
25
+ * }
26
+ *
27
+ * // Admin, with full facet values
28
+ * const { items } = await products.list(collectionId, true, { expand: ['facets'] })
20
29
  * ```
21
30
  */
22
- async function list(collectionId, admin) {
31
+ async function list(collectionId, admin, options = {}) {
23
32
  const base = admin ? '/admin' : '/public';
24
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/products`;
33
+ const qs = listQuery({ limit: options.limit, cursor: options.cursor, expand: options.expand });
34
+ const path = `${base}/collection/${encodeURIComponent(collectionId)}/products${qs}`;
25
35
  return request(path);
26
36
  }
27
37
  products.list = list;
@@ -41,10 +51,11 @@ export var products;
41
51
  }
42
52
  products.remove = remove;
43
53
  /**
44
- * Query products in a collection with filtering, sorting, and paging.
54
+ * Query products in a collection with search, filtering, sorting, and paging.
45
55
  *
46
56
  * @param collectionId - Identifier of the parent collection
47
- * @param body - Filters and sorting, plus `limit` (default 50) and `cursor` for paging
57
+ * @param body - `q` (search text), `orderBy`, `createdAt` / `updatedAt` (date ranges), `expand: ['facets']`
58
+ * and the other filters in `query`, plus `limit` (default 50) and `cursor` for paging
48
59
  * @param admin - When `true`, targets the `/admin` endpoint (requires an
49
60
  * authenticated admin context). Defaults to `false`, which targets the
50
61
  * `/public` endpoint — consistent with `get`, `list`, and `listAssets`.
@@ -55,15 +66,23 @@ export var products;
55
66
  * @example
56
67
  * ```typescript
57
68
  * // Public query (default)
58
- * const { items, nextCursor, count } = await products.query(collectionId, { query: { search: 'cabernet' }, limit: 20 })
69
+ * const { items, nextCursor, count } = await products.query(collectionId, { q: 'cabernet', limit: 20 })
59
70
  *
60
71
  * // The next page: the same query with the cursor
61
72
  * if (nextCursor) {
62
- * await products.query(collectionId, { query: { search: 'cabernet' }, limit: 20, cursor: nextCursor })
73
+ * await products.query(collectionId, { q: 'cabernet', limit: 20, cursor: nextCursor })
63
74
  * }
64
75
  *
76
+ * // Newest first, created this month, active only, with full facet values
77
+ * await products.query(collectionId, {
78
+ * orderBy: [{ createdAt: 'desc' }],
79
+ * createdAt: { gte: '2026-11-01T00:00:00Z', lte: '2026-11-30T23:59:59Z' },
80
+ * query: { status: ['active'] },
81
+ * expand: ['facets'],
82
+ * })
83
+ *
65
84
  * // Admin query (authenticated)
66
- * await products.query(collectionId, { query: { search: 'cabernet' } }, true)
85
+ * await products.query(collectionId, { q: 'cabernet' }, true)
67
86
  * ```
68
87
  */
69
88
  async function query(collectionId, body, admin) {
@@ -107,18 +126,22 @@ export var products;
107
126
  }
108
127
  products.clone = clone;
109
128
  /**
110
- * A product's assets (images, documents), in one list (no pages).
129
+ * A product's assets (images, documents), a page at a time.
111
130
  *
112
131
  * @param admin - When `true`, targets the `/admin` endpoint; otherwise the `/public` one
132
+ * @param options - `limit` (default 50) and `cursor`
113
133
  *
114
134
  * @example
115
135
  * ```typescript
116
- * const { items } = await products.listAssets(collectionId, productId)
136
+ * let page = await products.listAssets(collectionId, productId, false, { limit: 50 })
137
+ * while (page.nextCursor) {
138
+ * page = await products.listAssets(collectionId, productId, false, { limit: 50, cursor: page.nextCursor })
139
+ * }
117
140
  * ```
118
141
  */
119
- async function listAssets(collectionId, productId, admin) {
142
+ async function listAssets(collectionId, productId, admin, options = {}) {
120
143
  const base = admin ? '/admin' : '/public';
121
- const path = `${base}/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/asset`;
144
+ const path = `${base}/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/asset${listQuery({ limit: options.limit, cursor: options.cursor })}`;
122
145
  return request(path);
123
146
  }
124
147
  products.listAssets = listAssets;