@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
@@ -4,7 +4,7 @@
4
4
  * Separate from the `interactions` namespace. These types cover generic web
5
5
  * analytics, click tracking, and tag scan analytics for collection dashboards.
6
6
  */
7
- import type { ListResult, ListOptions } from './list.js';
7
+ import type { ListResult, ListOptions, OrderBy } from './list.js';
8
8
  export type AnalyticsSource = 'events' | 'tag';
9
9
  /**
10
10
  * Includes `scan_redirect` - logged automatically by the server (not the
@@ -274,10 +274,14 @@ export interface AnalyticsBreakdownResponse {
274
274
  metric: AnalyticsMetric;
275
275
  rows: AnalyticsBreakdownRow[];
276
276
  }
277
- /** Paging is `limit` (default 100) and `cursor`: pass the previous page's `nextCursor`. */
277
+ /**
278
+ * Paging is `limit` (default 100) and `cursor`: pass the previous page's `nextCursor`.
279
+ * The time window is `from` / `to`. Sort with `orderBy: [{ timestamp: 'asc' }]` (newest first without it).
280
+ */
278
281
  export interface AnalyticsEventsRequest extends AnalyticsFilterRequest, ListOptions {
279
282
  source: AnalyticsSource;
280
- sort?: AnalyticsSortOrder;
283
+ /** Sort by the event's time: `[{ timestamp: 'asc' }]` or `[{ timestamp: 'desc' }]` (the default). */
284
+ orderBy?: OrderBy<'timestamp'>;
281
285
  }
282
286
  /** `{ items, nextCursor, source, sort }`: the event rows are in `items`. This list does not report a total. */
283
287
  export interface AnalyticsEventsResponse extends ListResult<Record<string, any>> {
@@ -1,4 +1,4 @@
1
- import type { ListResult, ListOptions } from './list.js';
1
+ import type { ListResult, ListOptions, OrderBy, DateRange } from './list.js';
2
2
  /**
3
3
  * Visibility levels for app objects
4
4
  */
@@ -104,15 +104,17 @@ export interface AggregateResponse {
104
104
  }
105
105
  /**
106
106
  * Common query parameters for list endpoints. Paging is `limit` and `cursor` (from {@link ListOptions}):
107
- * pass the previous page's `nextCursor` as `cursor` to get the next page.
107
+ * pass the previous page's `nextCursor` as `cursor` to get the next page. Each list adds its own
108
+ * `orderBy` (the fields it sorts by). A date field takes a range: `createdAt: { gte, lte }`.
108
109
  */
109
110
  export interface ListQueryParams extends ListOptions {
110
- sort?: string;
111
111
  includeDeleted?: boolean;
112
112
  status?: string;
113
113
  productId?: string;
114
- createdAt?: string;
115
- updatedAt?: string;
114
+ /** Created on or after `gte`, on or before `lte`. */
115
+ createdAt?: DateRange;
116
+ /** Last changed on or after `gte`, on or before `lte`. */
117
+ updatedAt?: DateRange;
116
118
  }
117
119
  /**
118
120
  * App Case object
@@ -210,7 +212,10 @@ export interface CaseListQueryParams extends ListQueryParams {
210
212
  proofId?: string;
211
213
  contactId?: string;
212
214
  assignedTo?: string;
213
- closedAt?: string;
215
+ /** Closed on or after `gte`, on or before `lte`. */
216
+ closedAt?: DateRange;
217
+ /** Sort keys, most important first: `[{ priority: 'desc' }, { createdAt: 'asc' }]`. */
218
+ orderBy?: OrderBy<'createdAt' | 'updatedAt' | 'closedAt' | 'priority' | 'status' | 'category' | 'ref' | 'customId' | 'sourceSystem'>;
214
219
  }
215
220
  /**
216
221
  * Reply entry in a thread
@@ -319,6 +324,8 @@ export interface ThreadListQueryParams extends ListQueryParams {
319
324
  productId?: string;
320
325
  tag?: string;
321
326
  contactId?: string;
327
+ /** Sort keys, most important first: `[{ lastReplyAt: 'desc' }]`. */
328
+ orderBy?: OrderBy<'createdAt' | 'updatedAt' | 'lastReplyAt' | 'replyCount' | 'status'>;
322
329
  }
323
330
  /**
324
331
  * A single clause in a FacetRule. Tests one facet key against one or more values (OR semantics).
@@ -452,7 +459,7 @@ export interface MatchEntry extends AppRecord {
452
459
  }
453
460
  /**
454
461
  * Response from the match endpoint: `items` are the matched records, most specific first; `count` is
455
- * how many matched. It is not paged, so `nextCursor` is always `null`.
462
+ * how many matched. When you gave a `limit` and there are more, `nextCursor` carries on from there.
456
463
  */
457
464
  export interface MatchResult extends ListResult<MatchEntry> {
458
465
  /** Strategy used for this result */
@@ -501,6 +508,8 @@ export interface MatchRecordsInput {
501
508
  recordType?: string;
502
509
  /** Maximum records to return. Default 100, max 1000. */
503
510
  limit?: number;
511
+ /** A `nextCursor` from the previous answer: carries on from where that one stopped. */
512
+ cursor?: string;
504
513
  /** Include records whose startsAt is in the future. Default false. */
505
514
  includeScheduled?: boolean;
506
515
  /** Include records whose expiresAt is in the past. Default false. */
@@ -655,8 +664,12 @@ export interface RecordListQueryParams extends ListQueryParams {
655
664
  authorId?: string;
656
665
  parentType?: string;
657
666
  parentId?: string;
658
- startsAt?: string;
659
- expiresAt?: string;
667
+ /** Starts on or after `gte`, on or before `lte`. */
668
+ startsAt?: DateRange;
669
+ /** Expires on or after `gte`, on or before `lte`. */
670
+ expiresAt?: DateRange;
671
+ /** Sort keys, most important first: `[{ updatedAt: 'desc' }]`. */
672
+ orderBy?: OrderBy<'createdAt' | 'updatedAt' | 'startsAt' | 'expiresAt' | 'status' | 'recordType' | 'ref' | 'customId' | 'sourceSystem' | 'scopeType' | 'scopeId' | 'specificity' | 'label'>;
660
673
  /** Include records where startsAt is in the future. Default false. */
661
674
  includeScheduled?: boolean;
662
675
  /** Include records where expiresAt is in the past. Default false. */
@@ -692,8 +705,10 @@ export interface ResolveAllParams {
692
705
  recordType?: string;
693
706
  /** Only return records belonging to these tiers. */
694
707
  tiers?: Array<'proof' | 'batch' | 'variant' | 'product' | 'rule' | 'facet' | 'collection'>;
695
- /** Safety cap. Default 500, max 5000. */
708
+ /** The most to return. Default 500; at most 1000 in one answer (carry on with `cursor`). */
696
709
  limit?: number;
710
+ /** A `nextCursor` from the previous answer: carries on from where that one stopped. */
711
+ cursor?: string;
697
712
  /** Point-in-time for scheduling evaluation (ISO 8601). Defaults to now. */
698
713
  at?: string;
699
714
  /** Include records whose startsAt is in the future. Default false. */
@@ -703,8 +718,8 @@ export interface ResolveAllParams {
703
718
  }
704
719
  /**
705
720
  * Response from the resolve-all endpoint: `items` are every applicable record sorted by precedence
706
- * (most specific first), each at most once; `count` is how many were returned. It is not paged, so
707
- * `nextCursor` is always `null` (see `truncated`).
721
+ * (most specific first), each at most once; `count` is how many were returned. When you gave a `limit`
722
+ * and there are more, `nextCursor` carries on from there.
708
723
  */
709
724
  export interface ResolveAllResult extends ListResult<ResolveAllEntry> {
710
725
  /** The context echoed back from the request (for verification). */
@@ -27,8 +27,8 @@ export type AppOptionsResponse =
27
27
  };
28
28
  /**
29
29
  * What `app.options.get` returns: the standard list shape plus the picker's `version` and `mode`.
30
- * `count` is how many entries there are in all, where the server reports it. Pickers are not paged, so
31
- * `nextCursor` is always `null`.
30
+ * `count` is how many entries there are in all, where the server reports it. Entries come 50 at a time
31
+ * unless you give a `limit`; `nextCursor` is `null` on the last page.
32
32
  */
33
33
  export type AppOptionsList =
34
34
  /** `all`: every entry. `search`: the type is too large to send whole; these match `q`. */
@@ -1,4 +1,4 @@
1
- import type { ListOptions } from './list.js';
1
+ import type { ListOptions, OrderBy } from './list.js';
2
2
  /**
3
3
  * Slim reference to an asset embedded inside product and collection documents.
4
4
  * Use `asset.get()` with the `id` to retrieve the full `Asset` record.
@@ -177,7 +177,8 @@ export interface UploadFromUrlOptions {
177
177
  /** Optional: Upload via admin route instead of public */
178
178
  admin?: boolean;
179
179
  }
180
- export interface ListAssetsOptions {
180
+ /** `asset.list` options: the scope, an optional app, and paging (`limit`, 50 unless you say, and `cursor`). */
181
+ export interface ListAssetsOptions extends ListOptions {
181
182
  scope: {
182
183
  type: 'collection';
183
184
  collectionId: string;
@@ -193,8 +194,6 @@ export interface ListAssetsOptions {
193
194
  };
194
195
  /** Filter by app ID */
195
196
  appId?: string;
196
- /** How many to return. These lists are not paged: there is no cursor, and `nextCursor` is always `null`. */
197
- limit?: number;
198
197
  }
199
198
  export interface GetAssetOptions {
200
199
  assetId: string;
@@ -236,8 +235,8 @@ export interface AdminListAssetsOptions extends ListOptions {
236
235
  assetType?: 'Image' | 'Video' | 'Audio' | 'Document';
237
236
  /** Comma-separated label filter (any match) */
238
237
  labels?: string;
239
- sort?: 'createdAt' | 'name' | 'size' | 'assetType';
240
- order?: 'asc' | 'desc';
238
+ /** What to sort by: `[{ name: 'asc' }]`. */
239
+ orderBy?: OrderBy<'createdAt' | 'name' | 'size' | 'assetType'>;
241
240
  /**
242
241
  * Also list files that are normally left out: `temporary` (not kept yet) and `derived` (text, Markdown or fields
243
242
  * extracted from another file). Lists show only what people put there unless asked.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @see docs/attestations.md
10
10
  */
11
- import type { ListResult, ListOptions } from './list.js';
11
+ import type { ListResult, ListOptions, DateRange } from './list.js';
12
12
  /** Types of entities that can be the subject of an attestation. */
13
13
  export type AttestationSubjectType = 'container' | 'proof' | 'product' | 'tag' | 'serial' | 'order_item' | string;
14
14
  /**
@@ -245,10 +245,8 @@ export interface ListAttestationsParams extends ListOptions {
245
245
  * public caller can never use it to widen access.
246
246
  */
247
247
  moderationStatus?: AttestationModerationStatus;
248
- /** ISO 8601 lower bound (inclusive) */
249
- recordedAfter?: string;
250
- /** ISO 8601 upper bound (inclusive) */
251
- recordedBefore?: string;
248
+ /** Recorded on or after `gte`, on or before `lte` (both inclusive). */
249
+ recordedAt?: DateRange;
252
250
  }
253
251
  export interface AttestationSummaryParams {
254
252
  /** Required */
@@ -261,8 +259,8 @@ export interface AttestationSummaryParams {
261
259
  valueField?: string;
262
260
  /** Default `'day'` */
263
261
  groupBy?: AttestationGroupBy;
264
- recordedAfter?: string;
265
- recordedBefore?: string;
262
+ /** When it was recorded: `{ gte, lte }`, the same as on the list. */
263
+ recordedAt?: DateRange;
266
264
  /** Max number of buckets; default 200 */
267
265
  limit?: number;
268
266
  }
@@ -288,8 +286,8 @@ export interface AttestationTreeSummaryParams {
288
286
  valueField?: string;
289
287
  /** Default `'day'` */
290
288
  groupBy?: AttestationGroupBy;
291
- recordedAfter?: string;
292
- recordedBefore?: string;
289
+ /** When it was recorded: `{ gte, lte }`, the same as on the list. */
290
+ recordedAt?: DateRange;
293
291
  /** Max number of buckets; default 200 */
294
292
  limit?: number;
295
293
  /** Include container items in BFS traversal; default `true` */
@@ -1,3 +1,4 @@
1
+ import type { ListOptions } from './list.js';
1
2
  /**
2
3
  * Represents a Batch object. Dates are **ISO 8601 strings**.
3
4
  */
@@ -36,13 +37,12 @@ export interface BatchUpdateRequest {
36
37
  [key: string]: any;
37
38
  }
38
39
  /**
39
- * Options for `batch.searchInCollection`. The search answers in one page (it has no cursor):
40
- * `limit` is the most it returns.
40
+ * Options for `batch.searchInCollection`. `limit` is how many it returns (100 unless you say); when
41
+ * there are more, pass the answer's `nextCursor` back as `cursor`.
41
42
  */
42
- export interface SearchBatchesRequest {
43
- search?: string;
43
+ export interface SearchBatchesRequest extends ListOptions {
44
+ q?: string;
44
45
  productId?: string;
45
- limit?: number;
46
46
  }
47
47
  /**
48
48
  * Tag/code assigned to a batch.
@@ -1,4 +1,4 @@
1
- import type { ListResult, ListOptions } from './list.js';
1
+ import type { ListResult, ListOptions, OrderBy } from './list.js';
2
2
  export type BookingStatus = 'held' | 'pending' | 'confirmed' | 'completed' | 'cancelled' | 'no_show' | 'waitlisted';
3
3
  export type BookingVisibility = 'public' | 'owner' | 'admin';
4
4
  /** A claim on a resource's time: seats on a slot (`capacity`) or exclusive time (`exclusive`). */
@@ -192,8 +192,12 @@ export interface BookingListQueryParams {
192
192
  limit?: number;
193
193
  offset?: number;
194
194
  }
195
- /** `bookings.list` / `bookings.mine` options: the filters, plus `limit` and `cursor`. */
196
- export interface BookingListOptions extends Omit<BookingListQueryParams, 'offset'>, ListOptions {
195
+ /**
196
+ * `bookings.list` / `bookings.mine` options: the filters, plus `limit`, `cursor` and `orderBy`
197
+ * (earliest start first unless you say: `[{ startsAt: 'asc' }]`).
198
+ */
199
+ export interface BookingListOptions extends Omit<BookingListQueryParams, 'offset' | 'sort'>, ListOptions {
200
+ orderBy?: OrderBy<'startsAt' | 'endsAt' | 'createdAt' | 'updatedAt' | 'status' | 'ref' | 'customId' | 'sourceSystem'>;
197
201
  }
198
202
  export interface CreateSlotInput {
199
203
  startsAt: string | Date;
@@ -235,8 +239,9 @@ export interface SlotListQueryParams {
235
239
  limit?: number;
236
240
  offset?: number;
237
241
  }
238
- /** `bookings.slots.list` options: the filters, plus `limit` and `cursor`. */
239
- export interface SlotListOptions extends Omit<SlotListQueryParams, 'offset'>, ListOptions {
242
+ /** `bookings.slots.list` options: the filters, plus `limit`, `cursor` and `orderBy` (`[{ startsAt: 'asc' }]`). */
243
+ export interface SlotListOptions extends Omit<SlotListQueryParams, 'offset' | 'sort'>, ListOptions {
244
+ orderBy?: OrderBy<'startsAt' | 'endsAt' | 'createdAt' | 'updatedAt' | 'status' | 'capacity' | 'ref' | 'customId'>;
240
245
  }
241
246
  export interface CreateBlockInput {
242
247
  resourceType: string;
@@ -1,6 +1,6 @@
1
1
  import type { IdField } from './common.js';
2
2
  import type { BroadcastChannel } from './broadcasts.js';
3
- import type { ListResult } from './list.js';
3
+ import type { ListResult, ListOptions } from './list.js';
4
4
  /**
5
5
  * Target subject for notifications (product, collection, etc.)
6
6
  */
@@ -23,25 +23,25 @@ export interface CommunicationEvent {
23
23
  templateId?: string | null;
24
24
  [k: string]: any;
25
25
  }
26
- export interface CommsQueryByUser {
26
+ /** `comms.queryByUser` options: who, the time window (`from` / `to`), plus `limit` and `cursor`. */
27
+ export interface CommsQueryByUser extends ListOptions {
27
28
  userId?: string;
28
29
  contactId?: string;
29
30
  from?: string;
30
31
  to?: string;
31
- limit?: number;
32
32
  }
33
33
  export type RecipientId = string;
34
34
  export interface RecipientWithOutcome {
35
35
  id: string;
36
36
  outcome: string;
37
37
  }
38
- export interface CommsRecipientIdsQuery {
38
+ /** `comms.queryRecipientIds` options: the source, the time window (`from` / `to`), plus `limit` and `cursor`. */
39
+ export interface CommsRecipientIdsQuery extends ListOptions {
39
40
  broadcastId?: string;
40
41
  journeyId?: string;
41
42
  idField?: IdField;
42
43
  from?: string;
43
44
  to?: string;
44
- limit?: number;
45
45
  }
46
46
  /** Who a broadcast or journey reached that did NOT then do an interaction. */
47
47
  export interface CommsRecipientsWithoutInteractionQuery {
@@ -54,6 +54,8 @@ export interface CommsRecipientsWithoutInteractionQuery {
54
54
  from?: string;
55
55
  to?: string;
56
56
  limit?: number;
57
+ /** A `nextCursor` from the previous page. */
58
+ cursor?: string;
57
59
  }
58
60
  /** Who a broadcast or journey reached that then did an interaction. */
59
61
  export interface CommsRecipientsWithInteractionQuery {
@@ -68,6 +70,8 @@ export interface CommsRecipientsWithInteractionQuery {
68
70
  from?: string;
69
71
  to?: string;
70
72
  limit?: number;
73
+ /** A `nextCursor` from the previous page. */
74
+ cursor?: string;
71
75
  }
72
76
  export interface LogCommunicationEventBody {
73
77
  broadcastId?: string;
@@ -1,4 +1,4 @@
1
- import type { ListResult, ListOptions } from "./list.js";
1
+ import type { ListResult, ListOptions, DateRange } from "./list.js";
2
2
  export type ContactCustomFields = Record<string, any>;
3
3
  export interface Contact {
4
4
  contactId: string;
@@ -83,7 +83,10 @@ export interface ContactLinkLoginResponse {
83
83
  }
84
84
  /** `error` codes `contact.merge` can refuse with. */
85
85
  export type ContactMergeErrorCode = "INVALID_CONTACT" | "SAME_CONTACT" | "NOT_FOUND" | "KEEP_DELETED" | "LOGIN_CONFLICT" | "LOYALTY_CONFLICT";
86
- /** `contact.search` options: the collection, the filters, plus `limit` and `cursor`. */
86
+ /**
87
+ * `contact.search` options: the collection, the filters, plus `limit` and `cursor`. Free text is `q`;
88
+ * the creation date is a range, `createdAt: { gte, lte }`.
89
+ */
87
90
  export interface ContactSearchParams extends ListOptions {
88
91
  collectionId: string;
89
92
  q?: string;
@@ -96,8 +99,8 @@ export interface ContactSearchParams extends ListOptions {
96
99
  tagsAll?: string | string[];
97
100
  source?: string;
98
101
  locale?: string;
99
- createdFrom?: string;
100
- createdTo?: string;
102
+ /** When the contact was created: on or after `gte`, on or before `lte`. */
103
+ createdAt?: DateRange;
101
104
  externalIdKey?: string;
102
105
  externalIdValue?: string;
103
106
  customFieldKey?: string;
@@ -180,7 +180,8 @@ export interface ListContainerItemsParams extends ListOptions {
180
180
  /** When `true`, include removed items (full membership log); default `false` */
181
181
  history?: boolean;
182
182
  }
183
- export interface FindContainersForItemParams {
183
+ /** `containers.findForItem` options: the item to look for, plus `limit` (default 50) and `cursor`. */
184
+ export interface FindContainersForItemParams extends ListOptions {
184
185
  /** Required */
185
186
  itemType: ContainerItemType;
186
187
  /** Required: a tag's id, or an item's proof id (or its uid, `itm_…`) */
@@ -1,5 +1,5 @@
1
1
  import type { JsonValue, ProductQueryRequest } from "./product.js";
2
- import type { ListResult } from "./list.js";
2
+ import type { ListResult, ListOptions, DateRange } from "./list.js";
3
3
  export interface FacetDefinition {
4
4
  id?: string;
5
5
  orgId?: string;
@@ -81,11 +81,22 @@ export interface FacetValueResponse {
81
81
  facet: FacetDefinition;
82
82
  item: FacetValue;
83
83
  }
84
+ /**
85
+ * Body for `facets.query` / `facets.publicQuery`: which facets to count, and which products to count
86
+ * them over (`q`, `createdAt`, `updatedAt` and the filters in `query`, as in `products.query`). The answer
87
+ * is always complete, so there is no `limit` or `cursor`.
88
+ */
84
89
  export interface FacetQueryRequest {
85
90
  facetKeys?: string[];
86
91
  includeEmpty?: boolean;
87
92
  includeDeleted?: boolean;
88
93
  namespace?: string | null;
94
+ /** Search text: count only products that match it. */
95
+ q?: string;
96
+ /** Count only products created in this range. */
97
+ createdAt?: DateRange;
98
+ /** Count only products last updated in this range. */
99
+ updatedAt?: DateRange;
89
100
  query?: ProductQueryRequest["query"] & {
90
101
  facetEquals?: Record<string, JsonValue | JsonValue[]>;
91
102
  };
@@ -125,7 +136,8 @@ export interface FacetGetParams {
125
136
  includeValues?: boolean;
126
137
  includeDeleted?: boolean;
127
138
  }
128
- export interface FacetValueListParams {
139
+ /** `facets.listValues` options: `includeDeleted`, plus `limit` (default 50) and `cursor`. */
140
+ export interface FacetValueListParams extends ListOptions {
129
141
  includeDeleted?: boolean;
130
142
  }
131
143
  export interface FacetValueGetParams {
@@ -1,4 +1,5 @@
1
1
  import type { Asset } from "./asset.js";
2
+ import type { ListOptions } from "./list.js";
2
3
  /**
3
4
  * A file: an asset that's temporary, fetched from an address, extracted from another file, or made by something.
4
5
  * Files are private until kept, and stay out of asset lists (pickers, the Hub, the portal) unless kept.
@@ -33,13 +34,13 @@ export interface FetchedFile extends FileRecord {
33
34
  /** True when the source answered "not changed" (the same file is returned). */
34
35
  unchanged?: boolean;
35
36
  }
36
- export interface ListFilesQuery {
37
+ /** `files.list` options: the filters, plus `limit` and `cursor`. */
38
+ export interface ListFilesQuery extends ListOptions {
37
39
  origin?: "upload" | "fetched" | "derived" | "generated";
38
40
  retention?: "temporary" | "permanent";
39
41
  appId?: string;
40
42
  /** The results extracted from one file. */
41
43
  derivedFromId?: string;
42
- limit?: number;
43
44
  }
44
45
  export interface ExtractFileRequest {
45
46
  variant: FileExtractVariant;
@@ -266,7 +266,8 @@ export interface CreateFlowInput {
266
266
  export type UpdateFlowInput = Partial<Omit<CreateFlowInput, 'direction'>> & {
267
267
  status?: FlowStatus;
268
268
  };
269
- export interface ListFlowsQuery {
269
+ /** `integrations.listFlows` options: the filters, plus `limit` and `cursor`. */
270
+ export interface ListFlowsQuery extends ListOptions {
270
271
  direction?: FlowDirection;
271
272
  status?: FlowStatus;
272
273
  appId?: string;
@@ -1,6 +1,10 @@
1
1
  import type { IdField } from './common.js';
2
- import type { ListOptions } from './list.js';
3
- export interface AdminInteractionsQueryRequest {
2
+ import type { ListOptions, OrderBy } from './list.js';
3
+ /**
4
+ * Options for interactions.query(): the filters, the time window (`from` / `to`), plus `limit` and
5
+ * `cursor` to page the list.
6
+ */
7
+ export interface AdminInteractionsQueryRequest extends ListOptions {
4
8
  userId?: string;
5
9
  contactId?: string;
6
10
  appId?: string;
@@ -11,11 +15,12 @@ export interface AdminInteractionsQueryRequest {
11
15
  outcome?: string | null;
12
16
  from?: string;
13
17
  to?: string;
14
- limit?: number;
15
18
  includeDeleted?: boolean;
16
19
  latestPerEventId?: boolean;
17
- order?: 'ASC' | 'DESC';
18
- include?: Array<'interaction'>;
20
+ /** Sort by the event's time: `[{ timestamp: 'asc' }]` or `[{ timestamp: 'desc' }]`. */
21
+ orderBy?: OrderBy<'timestamp'>;
22
+ /** Bring each event's interaction type along: `['interaction']`. */
23
+ expand?: Array<'interaction'>;
19
24
  }
20
25
  export interface AdminInteractionsCountsByOutcomeRequest {
21
26
  appId?: string;
@@ -69,12 +74,15 @@ export interface PublicInteractionsCountsByOutcomeRequest {
69
74
  to?: string;
70
75
  limit?: number;
71
76
  }
72
- export interface PublicInteractionsByUserRequest {
77
+ /**
78
+ * Options for interactions.publicMyInteractions(): the filters, the time window (`from` / `to`), plus
79
+ * `limit` and `cursor` to page the list.
80
+ */
81
+ export interface PublicInteractionsByUserRequest extends ListOptions {
73
82
  appId?: string;
74
83
  interactionId?: string;
75
84
  from?: string;
76
85
  to?: string;
77
- limit?: number;
78
86
  }
79
87
  export interface InteractionEventRow {
80
88
  orgId: string;
@@ -14,7 +14,7 @@ export interface Job {
14
14
  queueName: string | null;
15
15
  status: JobStatus;
16
16
  }
17
- /** Options for jobs.listJobs(): `limit` and `cursor` page the list. */
17
+ /** Options for jobs.list(): `limit` and `cursor` page the list. */
18
18
  export interface ListJobsQuery extends ListOptions {
19
19
  state?: JobStatus;
20
20
  task?: string;
@@ -1,4 +1,5 @@
1
1
  import type { IdField } from './common.js';
2
+ import type { ListOptions } from './list.js';
2
3
  export interface JourneyStatsRequest {
3
4
  idField?: IdField;
4
5
  from?: string;
@@ -24,14 +25,14 @@ export interface JourneyStatsResponse {
24
25
  pending: number;
25
26
  }>;
26
27
  }
27
- export interface JourneyStepRecipientsRequest {
28
+ /** `journeysAnalytics.recipients` options: the filters, the time window (`from` / `to`), plus `limit` and `cursor`. */
29
+ export interface JourneyStepRecipientsRequest extends ListOptions {
28
30
  status?: 'entered' | 'completed' | 'pending';
29
31
  idField?: IdField;
30
32
  interactionId?: string;
31
33
  outcome?: string;
32
34
  from?: string;
33
35
  to?: string;
34
- limit?: number;
35
36
  }
36
37
  export interface JourneyFunnelReportRequest {
37
38
  idField?: IdField;
@@ -1,3 +1,4 @@
1
+ import type { ListOptions } from './list.js';
1
2
  /** Who may search a set: anyone, signed-in people, or the business's own staff and assistants. */
2
3
  export type KnowledgeVisibility = 'public' | 'customer' | 'staff';
3
4
  /** Where a set's passages come from. */
@@ -82,14 +83,16 @@ export interface KnowledgeDocument {
82
83
  /** Details to filter searches on, e.g. `{ productId: 'p1' }`. */
83
84
  meta?: Record<string, any>;
84
85
  }
85
- export interface KnowledgeSearchRequest {
86
- query: string;
86
+ /** What `knowledge.search` and `knowledge.publicSearch` take. */
87
+ export interface KnowledgeSearchRequest extends ListOptions {
88
+ /** What to look for, in words. */
89
+ q: string;
87
90
  /** Only these sets (ids or keys). Default: every set the caller may read. */
88
91
  sets?: string[];
89
92
  /** Exact matches on a passage's details, e.g. `{ productId: 'p1' }`. */
90
93
  filters?: Record<string, any>;
91
94
  /** How many results (default 8, at most 25). */
92
- k?: number;
95
+ limit?: number;
93
96
  }
94
97
  export interface KnowledgeSearchResult {
95
98
  id: string;
@@ -1,2 +1 @@
1
- // Knowledge search: a collection's AI-searchable content (prove docs/design/knowledge-search.md).
2
1
  export {};
@@ -15,10 +15,38 @@ export interface ListResult<T> {
15
15
  /** How many there are in all, where the list knows (not every list counts). */
16
16
  count?: number;
17
17
  }
18
- /** The paging options every list takes. */
18
+ /**
19
+ * The paging options every list takes. The exception is a small fixed set (a page's widgets, the facet
20
+ * definitions, config fields): it always comes back whole, so its function takes no options.
21
+ */
19
22
  export interface ListOptions {
20
- /** How many to return. Each list has its own default and maximum. */
23
+ /** How many to return. 50 unless the list says otherwise; each list has its own maximum. */
21
24
  limit?: number;
22
25
  /** A `nextCursor` from the previous page. */
23
26
  cursor?: string;
24
27
  }
28
+ /** Which way to sort. */
29
+ export type SortDirection = 'asc' | 'desc';
30
+ /**
31
+ * What to sort a list by: one `{ field: direction }` per sort key, most important first. Each list's
32
+ * options say which fields it sorts by.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * await app.cases.list('coll_123', 'support', { orderBy: [{ priority: 'desc' }, { createdAt: 'asc' }] })
37
+ * ```
38
+ */
39
+ export type OrderBy<Field extends string = string> = Array<Partial<Record<Field, SortDirection>>>;
40
+ /**
41
+ * A range on one of a record's date fields: on or after `gte`, on or before `lte`. Give a full date and
42
+ * time; a date with no time means midnight UTC at the start of that day.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * await contact.search({ collectionId, createdAt: { gte: '2026-11-01T00:00:00Z', lte: new Date() } })
47
+ * ```
48
+ */
49
+ export interface DateRange {
50
+ gte?: string | Date;
51
+ lte?: string | Date;
52
+ }
@@ -1,3 +1,4 @@
1
+ import type { ListOptions, OrderBy } from './list.js';
1
2
  export type Geofence = {
2
3
  type: 'bbox';
3
4
  minLat: number;
@@ -27,11 +28,15 @@ export interface Location {
27
28
  createdAt: string;
28
29
  updatedAt: string;
29
30
  }
30
- export interface LocationSearchQuery {
31
+ /** `location.search` options: the filters, plus `limit` and `cursor`. */
32
+ export interface LocationSearchQuery extends ListOptions {
33
+ /** Search text. */
31
34
  q?: string;
32
35
  category?: string;
33
36
  countryCode?: string;
34
37
  countryName?: string;
38
+ /** How many to return: 20 unless you say otherwise, at most 100. */
35
39
  limit?: number;
36
- sort?: 'name' | 'countryCode' | 'countryName';
40
+ /** Sort by one field: `[{ countryName: 'desc' }]`. By name unless you say otherwise. */
41
+ orderBy?: OrderBy<'name' | 'countryCode' | 'countryName'>;
37
42
  }
@@ -1,2 +1 @@
1
- // src/types/location.ts
2
1
  export {};
@@ -1,3 +1,4 @@
1
+ import type { ListOptions } from './list.js';
1
2
  export type LotStatus = 'open' | 'closed' | 'recalled' | 'archived';
2
3
  /** How a lot's member products are resolved. */
3
4
  export type LotSelector = {
@@ -54,9 +55,11 @@ export interface LotCreateInput {
54
55
  id?: string;
55
56
  }
56
57
  export type LotUpdateInput = Partial<LotCreateInput>;
57
- export interface ListLotsParams {
58
+ /** `lots.list` / `lots.publicList` options: the filters, plus `limit` (default 50) and `cursor`. */
59
+ export interface ListLotsParams extends ListOptions {
58
60
  status?: LotStatus;
59
- search?: string;
61
+ /** Search text. */
62
+ q?: string;
60
63
  /** Reverse lookup — lots containing this product id. */
61
64
  productId?: string;
62
65
  /** Admin only: include soft-deleted lots (default false). */