@proveanything/smartlinks 3.0.0-alpha.1 → 3.0.0-alpha.3

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 (272) hide show
  1. package/README.md +741 -741
  2. package/dist/README.md +573 -573
  3. package/dist/adminCardsView.js +55 -55
  4. package/dist/api/analytics.d.ts +5 -4
  5. package/dist/api/analytics.js +5 -4
  6. package/dist/api/appConfiguration.d.ts +23 -18
  7. package/dist/api/appConfiguration.js +24 -18
  8. package/dist/api/appObjects.d.ts +54 -10
  9. package/dist/api/appObjects.js +75 -40
  10. package/dist/api/asset.d.ts +28 -22
  11. package/dist/api/asset.js +45 -56
  12. package/dist/api/attestation.d.ts +11 -3
  13. package/dist/api/attestation.js +12 -3
  14. package/dist/api/attestations.d.ts +12 -8
  15. package/dist/api/attestations.js +18 -21
  16. package/dist/api/authKit.d.ts +15 -10
  17. package/dist/api/authKit.js +17 -11
  18. package/dist/api/batch.d.ts +36 -25
  19. package/dist/api/batch.js +46 -39
  20. package/dist/api/bookings.d.ts +67 -11
  21. package/dist/api/bookings.js +82 -15
  22. package/dist/api/broadcasts.js +3 -17
  23. package/dist/api/claimSet.d.ts +26 -12
  24. package/dist/api/claimSet.js +32 -24
  25. package/dist/api/collection.d.ts +15 -10
  26. package/dist/api/collection.js +17 -11
  27. package/dist/api/comms.d.ts +12 -6
  28. package/dist/api/comms.js +12 -6
  29. package/dist/api/conditions.d.ts +7 -6
  30. package/dist/api/conditions.js +8 -6
  31. package/dist/api/contact.d.ts +6 -2
  32. package/dist/api/contact.js +25 -60
  33. package/dist/api/containers.d.ts +14 -10
  34. package/dist/api/containers.js +19 -14
  35. package/dist/api/crate.js +7 -9
  36. package/dist/api/dpp.d.ts +20 -13
  37. package/dist/api/dpp.js +23 -15
  38. package/dist/api/facets.d.ts +38 -13
  39. package/dist/api/facets.js +40 -15
  40. package/dist/api/files.d.ts +5 -2
  41. package/dist/api/files.js +7 -4
  42. package/dist/api/form.d.ts +8 -5
  43. package/dist/api/form.js +9 -5
  44. package/dist/api/index.d.ts +1 -1
  45. package/dist/api/index.js +1 -1
  46. package/dist/api/integrations.d.ts +29 -17
  47. package/dist/api/integrations.js +32 -25
  48. package/dist/api/interactions.d.ts +11 -6
  49. package/dist/api/interactions.js +14 -23
  50. package/dist/api/jobs.d.ts +16 -6
  51. package/dist/api/jobs.js +30 -20
  52. package/dist/api/journeys.js +2 -14
  53. package/dist/api/journeysAnalytics.d.ts +8 -5
  54. package/dist/api/journeysAnalytics.js +8 -5
  55. package/dist/api/knowledge.d.ts +20 -14
  56. package/dist/api/knowledge.js +22 -15
  57. package/dist/api/location.d.ts +6 -3
  58. package/dist/api/location.js +8 -22
  59. package/dist/api/lots.d.ts +9 -5
  60. package/dist/api/lots.js +22 -26
  61. package/dist/api/loyalty.d.ts +25 -16
  62. package/dist/api/loyalty.js +33 -32
  63. package/dist/api/nfc.d.ts +3 -1
  64. package/dist/api/nfc.js +3 -1
  65. package/dist/api/order.d.ts +45 -39
  66. package/dist/api/order.js +48 -65
  67. package/dist/api/partner.d.ts +17 -14
  68. package/dist/api/partner.js +21 -22
  69. package/dist/api/payments.d.ts +60 -0
  70. package/dist/api/payments.js +94 -0
  71. package/dist/api/products.d.ts +35 -12
  72. package/dist/api/products.js +36 -13
  73. package/dist/api/proof.d.ts +41 -19
  74. package/dist/api/proof.js +44 -23
  75. package/dist/api/realtime.d.ts +3 -0
  76. package/dist/api/realtime.js +10 -2
  77. package/dist/api/segments.js +3 -15
  78. package/dist/api/serviceAccounts.d.ts +8 -5
  79. package/dist/api/serviceAccounts.js +9 -6
  80. package/dist/api/shop.d.ts +7 -5
  81. package/dist/api/shop.js +13 -19
  82. package/dist/api/subscriptions.d.ts +12 -10
  83. package/dist/api/subscriptions.js +17 -25
  84. package/dist/api/tags.d.ts +23 -20
  85. package/dist/api/tags.js +40 -52
  86. package/dist/api/template.d.ts +16 -11
  87. package/dist/api/template.js +19 -13
  88. package/dist/api/translations.js +2 -12
  89. package/dist/api/userGroups.d.ts +26 -16
  90. package/dist/api/userGroups.js +43 -30
  91. package/dist/api/variant.d.ts +10 -7
  92. package/dist/api/variant.js +11 -7
  93. package/dist/api/wallet.d.ts +14 -11
  94. package/dist/api/wallet.js +15 -12
  95. package/dist/baseline.css +194 -194
  96. package/dist/dataChanged.d.ts +74 -0
  97. package/dist/dataChanged.js +162 -0
  98. package/dist/docs/API_SUMMARY.md +1443 -1409
  99. package/dist/docs/admin-cards.md +189 -189
  100. package/dist/docs/agent-tools.md +156 -156
  101. package/dist/docs/ai-tools-and-skills.md +180 -180
  102. package/dist/docs/ai.md +1721 -1721
  103. package/dist/docs/analytics.md +1 -1
  104. package/dist/docs/api-versions.md +85 -85
  105. package/dist/docs/app-data-storage.md +277 -277
  106. package/dist/docs/app-docs.md +73 -73
  107. package/dist/docs/app-manifest.md +852 -852
  108. package/dist/docs/app-objects.md +4 -4
  109. package/dist/docs/app-records-pattern.md +388 -388
  110. package/dist/docs/appConfig.md +550 -550
  111. package/dist/docs/assistant-apps.md +172 -172
  112. package/dist/docs/assistant-context.md +119 -119
  113. package/dist/docs/attestations.md +8 -8
  114. package/dist/docs/bookings.md +105 -8
  115. package/dist/docs/caching.md +32 -3
  116. package/dist/docs/comms.md +689 -689
  117. package/dist/docs/connectors.md +340 -340
  118. package/dist/docs/contact-search.md +2 -3
  119. package/dist/docs/css-baseline.md +133 -133
  120. package/dist/docs/customer-guide.md +70 -70
  121. package/dist/docs/data-changed.md +91 -0
  122. package/dist/docs/deploying-apps.md +340 -340
  123. package/dist/docs/dpp.md +115 -115
  124. package/dist/docs/entitlements.md +90 -90
  125. package/dist/docs/files.md +69 -69
  126. package/dist/docs/host-dependency-contract.md +252 -252
  127. package/dist/docs/iframe-responder.md +11 -0
  128. package/dist/docs/integrations.md +322 -322
  129. package/dist/docs/interactions.md +544 -544
  130. package/dist/docs/item-context.md +181 -181
  131. package/dist/docs/knowledge.md +105 -105
  132. package/dist/docs/lists.md +157 -114
  133. package/dist/docs/lots.md +112 -112
  134. package/dist/docs/loyalty.md +348 -348
  135. package/dist/docs/members.md +183 -183
  136. package/dist/docs/memberships.md +150 -150
  137. package/dist/docs/mobile-admin-container.md +693 -693
  138. package/dist/docs/operations.md +281 -281
  139. package/dist/docs/overview.md +487 -485
  140. package/dist/docs/payments.md +94 -0
  141. package/dist/docs/proof-comms-triggers.md +142 -142
  142. package/dist/docs/proof-ownership-transfer.md +155 -155
  143. package/dist/docs/proof-product-data-scoping.md +462 -462
  144. package/dist/docs/proof-share-grants.md +305 -305
  145. package/dist/docs/realtime.md +149 -139
  146. package/dist/docs/records-admin-pattern.md +304 -304
  147. package/dist/docs/service-accounts.md +64 -64
  148. package/dist/docs/standard-query.md +196 -187
  149. package/dist/docs/tag-codes.md +97 -97
  150. package/dist/docs/tag-ranges.md +106 -106
  151. package/dist/docs/theme-tokens.md +252 -252
  152. package/dist/docs/upgrading-to-3.md +550 -430
  153. package/dist/docs/wallet-passes.md +107 -107
  154. package/dist/docs/websites.md +123 -123
  155. package/dist/http.d.ts +6 -3
  156. package/dist/http.js +48 -19
  157. package/dist/iframeResponder.d.ts +7 -0
  158. package/dist/iframeResponder.js +10 -0
  159. package/dist/index.d.ts +2 -0
  160. package/dist/index.js +2 -0
  161. package/dist/list.d.ts +12 -0
  162. package/dist/list.js +59 -0
  163. package/dist/openapi.yaml +722 -660
  164. package/dist/testing/bookingsMemory.d.ts +29 -1
  165. package/dist/testing/bookingsMemory.js +89 -1
  166. package/dist/testing/index.js +4 -1
  167. package/dist/theme-boot.js +82 -82
  168. package/dist/theme.css +75 -75
  169. package/dist/types/analytics.d.ts +7 -3
  170. package/dist/types/appManifest.d.ts +26 -4
  171. package/dist/types/appObjects.d.ts +27 -12
  172. package/dist/types/appOptions.d.ts +2 -2
  173. package/dist/types/asset.d.ts +5 -6
  174. package/dist/types/attestations.d.ts +7 -9
  175. package/dist/types/batch.d.ts +5 -5
  176. package/dist/types/bookings.d.ts +109 -6
  177. package/dist/types/comms.d.ts +9 -5
  178. package/dist/types/contact.d.ts +7 -4
  179. package/dist/types/containers.d.ts +2 -1
  180. package/dist/types/facets.d.ts +14 -2
  181. package/dist/types/files.d.ts +3 -2
  182. package/dist/types/index.d.ts +1 -0
  183. package/dist/types/index.js +1 -0
  184. package/dist/types/integrations.d.ts +2 -1
  185. package/dist/types/interaction.d.ts +15 -7
  186. package/dist/types/jobs.d.ts +1 -1
  187. package/dist/types/journeysAnalytics.d.ts +3 -2
  188. package/dist/types/knowledge.d.ts +6 -3
  189. package/dist/types/knowledge.js +0 -1
  190. package/dist/types/list.d.ts +30 -2
  191. package/dist/types/location.d.ts +7 -2
  192. package/dist/types/location.js +0 -1
  193. package/dist/types/lots.d.ts +5 -2
  194. package/dist/types/lots.js +0 -6
  195. package/dist/types/order.d.ts +22 -20
  196. package/dist/types/payments.d.ts +101 -0
  197. package/dist/types/payments.js +5 -0
  198. package/dist/types/product.d.ts +28 -11
  199. package/dist/types/proof.d.ts +7 -8
  200. package/dist/types/realtime.d.ts +5 -1
  201. package/dist/types/tags.d.ts +5 -3
  202. package/dist/types/userGroups.d.ts +3 -3
  203. package/dist/types/userGroups.js +0 -4
  204. package/dist/version.d.ts +1 -1
  205. package/dist/version.js +1 -1
  206. package/docs/API_SUMMARY.md +1443 -1409
  207. package/docs/admin-cards.md +189 -189
  208. package/docs/agent-tools.md +156 -156
  209. package/docs/ai-tools-and-skills.md +180 -180
  210. package/docs/ai.md +1721 -1721
  211. package/docs/analytics.md +1 -1
  212. package/docs/api-versions.md +85 -85
  213. package/docs/app-data-storage.md +277 -277
  214. package/docs/app-docs.md +73 -73
  215. package/docs/app-manifest.md +852 -852
  216. package/docs/app-objects.md +4 -4
  217. package/docs/app-records-pattern.md +388 -388
  218. package/docs/appConfig.md +550 -550
  219. package/docs/assistant-apps.md +172 -172
  220. package/docs/assistant-context.md +119 -119
  221. package/docs/attestations.md +8 -8
  222. package/docs/bookings.md +105 -8
  223. package/docs/caching.md +32 -3
  224. package/docs/comms.md +689 -689
  225. package/docs/connectors.md +340 -340
  226. package/docs/contact-search.md +2 -3
  227. package/docs/css-baseline.md +133 -133
  228. package/docs/customer-guide.md +70 -70
  229. package/docs/data-changed.md +91 -0
  230. package/docs/deploying-apps.md +340 -340
  231. package/docs/dpp.md +115 -115
  232. package/docs/entitlements.md +90 -90
  233. package/docs/files.md +69 -69
  234. package/docs/host-dependency-contract.md +252 -252
  235. package/docs/iframe-responder.md +11 -0
  236. package/docs/integrations.md +322 -322
  237. package/docs/interactions.md +544 -544
  238. package/docs/item-context.md +181 -181
  239. package/docs/knowledge.md +105 -105
  240. package/docs/lists.md +157 -114
  241. package/docs/lots.md +112 -112
  242. package/docs/loyalty.md +348 -348
  243. package/docs/members.md +183 -183
  244. package/docs/memberships.md +150 -150
  245. package/docs/mobile-admin-container.md +693 -693
  246. package/docs/operations.md +281 -281
  247. package/docs/overview.md +487 -485
  248. package/docs/payments.md +94 -0
  249. package/docs/proof-comms-triggers.md +142 -142
  250. package/docs/proof-ownership-transfer.md +155 -155
  251. package/docs/proof-product-data-scoping.md +462 -462
  252. package/docs/proof-share-grants.md +305 -305
  253. package/docs/realtime.md +149 -139
  254. package/docs/service-accounts.md +64 -64
  255. package/docs/standard-query.md +196 -187
  256. package/docs/tag-codes.md +97 -97
  257. package/docs/tag-ranges.md +106 -106
  258. package/docs/theme-lookbook.v1.json +120 -120
  259. package/docs/theme-tokens.md +252 -252
  260. package/docs/upgrading-to-3.md +550 -430
  261. package/docs/wallet-passes.md +107 -107
  262. package/docs/websites.md +123 -123
  263. package/openapi.yaml +722 -660
  264. package/package.json +91 -91
  265. package/scripts/headless-check.mjs +87 -87
  266. package/scripts/lib/bare-imports.mjs +57 -57
  267. package/scripts/lib/keyed-app-data.mjs +21 -21
  268. package/scripts/lib/upgrade.mjs +708 -512
  269. package/scripts/publish.mjs +272 -272
  270. package/scripts/register-release.mjs +91 -91
  271. package/scripts/upgrade.mjs +79 -56
  272. package/upgrade/3.json +2731 -2213
@@ -2,16 +2,17 @@ import type { PublicPlan, MySubscription, SubscriptionStartInput, SubscriptionSt
2
2
  import type { ListResult, ListOptions } from '../types/list.js';
3
3
  export declare namespace subscriptions {
4
4
  /**
5
- * Plans open to new members, each with its prices (monthly, yearly, one-off). All of them in one answer:
6
- * `nextCursor` is always null.
5
+ * Plans open to new members, each with its prices (monthly, yearly, one-off), a page at a time. Page
6
+ * with `limit` (50 unless you say) and `cursor`.
7
7
  *
8
8
  * @example
9
9
  * ```typescript
10
- * const { items: plans } = await subscriptions.plans(collectionId)
11
- * plans.map((p) => p.prices.map((price) => subscriptions.describePrice(price)))
10
+ * let page = await subscriptions.plans(collectionId, { limit: 50 })
11
+ * page.items.map((p) => p.prices.map((price) => subscriptions.describePrice(price)))
12
+ * while (page.nextCursor) page = await subscriptions.plans(collectionId, { limit: 50, cursor: page.nextCursor })
12
13
  * ```
13
14
  */
14
- function plans(collectionId: string): Promise<ListResult<PublicPlan>>;
15
+ function plans(collectionId: string, options?: ListOptions): Promise<ListResult<PublicPlan>>;
15
16
  /**
16
17
  * Join a plan: Stripe's checkout page for the chosen price. Send them to `checkoutUrl`. Signed in only (a
17
18
  * membership belongs to an account). The membership exists once Stripe confirms the payment.
@@ -31,16 +32,17 @@ export declare namespace subscriptions {
31
32
  */
32
33
  function start(collectionId: string, input: SubscriptionStartInput): Promise<SubscriptionStartResult>;
33
34
  /**
34
- * The signed-in member's memberships, newest first (ended ones too: check `live`). All of them in one
35
- * answer: `nextCursor` is always null.
35
+ * The signed-in member's memberships, newest first (ended ones too: check `live`), a page at a time.
36
+ * Page with `limit` (50 unless you say) and `cursor`.
36
37
  *
37
38
  * @example
38
39
  * ```typescript
39
- * const { items } = await subscriptions.mine(collectionId)
40
- * const current = items.find((s) => s.live)
40
+ * let page = await subscriptions.mine(collectionId)
41
+ * const current = page.items.find((s) => s.live)
42
+ * while (page.nextCursor) page = await subscriptions.mine(collectionId, { cursor: page.nextCursor })
41
43
  * ```
42
44
  */
43
- function mine(collectionId: string): Promise<ListResult<MySubscription>>;
45
+ function mine(collectionId: string, options?: ListOptions): Promise<ListResult<MySubscription>>;
44
46
  /**
45
47
  * Cancel: it ends at the end of the paid period, and access stays until then. A one-off plan or a staff
46
48
  * grant ends now. Undo with `resume` before the period ends.
@@ -5,33 +5,24 @@
5
5
  // (the member's `level` and user groups).
6
6
  import { request, post, put, patch, del } from '../http.js';
7
7
  import { describeRecurring } from '../utils/money.js';
8
+ import { listQuery } from '../list.js';
8
9
  const pub = (collectionId) => `/public/collection/${encodeURIComponent(collectionId)}/memberships`;
9
10
  const adm = (collectionId) => `/admin/collection/${encodeURIComponent(collectionId)}/memberships`;
10
- function qs(params) {
11
- if (!params)
12
- return '';
13
- const parts = [];
14
- for (const [k, v] of Object.entries(params)) {
15
- if (v === undefined || v === null || v === '')
16
- continue;
17
- parts.push(`${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`);
18
- }
19
- return parts.length ? `?${parts.join('&')}` : '';
20
- }
21
11
  export var subscriptions;
22
12
  (function (subscriptions) {
23
13
  /**
24
- * Plans open to new members, each with its prices (monthly, yearly, one-off). All of them in one answer:
25
- * `nextCursor` is always null.
14
+ * Plans open to new members, each with its prices (monthly, yearly, one-off), a page at a time. Page
15
+ * with `limit` (50 unless you say) and `cursor`.
26
16
  *
27
17
  * @example
28
18
  * ```typescript
29
- * const { items: plans } = await subscriptions.plans(collectionId)
30
- * plans.map((p) => p.prices.map((price) => subscriptions.describePrice(price)))
19
+ * let page = await subscriptions.plans(collectionId, { limit: 50 })
20
+ * page.items.map((p) => p.prices.map((price) => subscriptions.describePrice(price)))
21
+ * while (page.nextCursor) page = await subscriptions.plans(collectionId, { limit: 50, cursor: page.nextCursor })
31
22
  * ```
32
23
  */
33
- async function plans(collectionId) {
34
- return request(`${pub(collectionId)}/plans`);
24
+ async function plans(collectionId, options = {}) {
25
+ return request(`${pub(collectionId)}/plans${listQuery(options)}`);
35
26
  }
36
27
  subscriptions.plans = plans;
37
28
  /**
@@ -56,17 +47,18 @@ export var subscriptions;
56
47
  }
57
48
  subscriptions.start = start;
58
49
  /**
59
- * The signed-in member's memberships, newest first (ended ones too: check `live`). All of them in one
60
- * answer: `nextCursor` is always null.
50
+ * The signed-in member's memberships, newest first (ended ones too: check `live`), a page at a time.
51
+ * Page with `limit` (50 unless you say) and `cursor`.
61
52
  *
62
53
  * @example
63
54
  * ```typescript
64
- * const { items } = await subscriptions.mine(collectionId)
65
- * const current = items.find((s) => s.live)
55
+ * let page = await subscriptions.mine(collectionId)
56
+ * const current = page.items.find((s) => s.live)
57
+ * while (page.nextCursor) page = await subscriptions.mine(collectionId, { cursor: page.nextCursor })
66
58
  * ```
67
59
  */
68
- async function mine(collectionId) {
69
- return request(`${pub(collectionId)}/mine`);
60
+ async function mine(collectionId, options = {}) {
61
+ return request(`${pub(collectionId)}/mine${listQuery(options)}`);
70
62
  }
71
63
  subscriptions.mine = mine;
72
64
  /**
@@ -116,7 +108,7 @@ export var subscriptions;
116
108
  * ```
117
109
  */
118
110
  async function listPlans(collectionId, params) {
119
- return request(`${adm(collectionId)}/plans${qs(params)}`);
111
+ return request(`${adm(collectionId)}/plans${listQuery(params)}`);
120
112
  }
121
113
  admin.listPlans = listPlans;
122
114
  /** A plan with its prices and how many live members it has. */
@@ -167,7 +159,7 @@ export var subscriptions;
167
159
  * ```
168
160
  */
169
161
  async function list(collectionId, params) {
170
- return request(`${adm(collectionId)}/subscriptions${qs(params)}`);
162
+ return request(`${adm(collectionId)}/subscriptions${listQuery(params)}`);
171
163
  }
172
164
  admin.list = list;
173
165
  async function get(collectionId, subscriptionId) {
@@ -140,15 +140,15 @@ export declare namespace tags {
140
140
  * No embed support on the admin side.
141
141
  *
142
142
  * @param collectionId - Collection context
143
- * @param params - `refType` and `refId` are required
144
- * @returns `{ items: Tag[], nextCursor: null }`: every linked tag in one answer
143
+ * @param params - `refType` and `refId` are required; plus `limit` (default 50) and `cursor`
144
+ * @returns `{ items: Tag[], nextCursor: string | null }`: the linked tags, a page at a time
145
145
  *
146
146
  * @example
147
147
  * ```typescript
148
- * const { items: linked } = await tags.byRef('coll_123', {
149
- * refType: 'container',
150
- * refId: 'container-uuid',
151
- * })
148
+ * let page = await tags.byRef('coll_123', { refType: 'container', refId: 'container-uuid', limit: 50 })
149
+ * while (page.nextCursor) {
150
+ * page = await tags.byRef('coll_123', { refType: 'container', refId: 'container-uuid', limit: 50, cursor: page.nextCursor })
151
+ * }
152
152
  * ```
153
153
  */
154
154
  function byRef(collectionId: string, params: ReverseTagLookupParams): Promise<ListResult<Tag>>;
@@ -209,15 +209,15 @@ export declare namespace tags {
209
209
  * Returns deduplicated embedded objects alongside the tag array.
210
210
  *
211
211
  * @param collectionId - Collection context
212
- * @param data - `{ tagIds: string[], embed?: string }`
213
- * @returns `{ items: Tag[], nextCursor: null, count: number, embedded: TagEmbedded }`
212
+ * @param data - `{ tagIds: string[], embed?: string }`, plus `limit` (default 50) and `cursor`
213
+ * @returns `{ items: Tag[], nextCursor: string | null, count: number, embedded: TagEmbedded }`:
214
+ * the tags found, a page at a time
214
215
  *
215
216
  * @example
216
217
  * ```typescript
217
- * const { items, count, embedded } = await tags.lookupTags('coll_123', {
218
- * tagIds: ['NFC-001', 'NFC-002', 'NFC-003'],
219
- * embed: 'product,proof',
220
- * })
218
+ * const tagIds = ['NFC-001', 'NFC-002', 'NFC-003']
219
+ * // Every tag found comes back in the one answer: a look-up is never paged.
220
+ * const { items, embedded } = await tags.lookupTags('coll_123', { tagIds, embed: 'product,proof' })
221
221
  * ```
222
222
  */
223
223
  function lookupTags(collectionId: string, data: LookupTagsRequest): Promise<TagLookupResponse>;
@@ -227,8 +227,9 @@ export declare namespace tags {
227
227
  * `GET /public/collection/:collectionId/tags/lookup?tagIds=NFC-001,NFC-002&embed=product`
228
228
  *
229
229
  * @param collectionId - Collection context
230
- * @param params - `tagIds` is comma-separated; `embed` is optional
231
- * @returns `{ items: Tag[], nextCursor: null, count: number, embedded: TagEmbedded }`
230
+ * @param params - `tagIds` is comma-separated; `embed` is optional; plus `limit` (default 50) and `cursor`
231
+ * @returns `{ items: Tag[], nextCursor: string | null, count: number, embedded: TagEmbedded }`:
232
+ * the tags found, a page at a time
232
233
  *
233
234
  * @example
234
235
  * ```typescript
@@ -245,15 +246,16 @@ export declare namespace tags {
245
246
  * `GET /public/collection/:collectionId/tags/by-ref?refType=container&refId=<uuid>&embed=ref`
246
247
  *
247
248
  * @param collectionId - Collection context
248
- * @param params - `refType` and `refId` are required; `embed` is optional
249
- * @returns `{ items: Tag[], nextCursor: null, embedded: TagEmbedded }`
249
+ * @param params - `refType` and `refId` are required; `embed` is optional; plus `limit` (default 50) and `cursor`
250
+ * @returns `{ items: Tag[], nextCursor: string | null, embedded: TagEmbedded }`: the linked tags, a page at a time
250
251
  *
251
252
  * @example
252
253
  * ```typescript
253
- * const { items: linked, embedded } = await tags.publicByRef('coll_123', {
254
+ * const { items: linked, embedded, nextCursor } = await tags.publicByRef('coll_123', {
254
255
  * refType: 'container',
255
256
  * refId: 'container-uuid',
256
257
  * embed: 'container',
258
+ * limit: 50,
257
259
  * })
258
260
  * const container = embedded.containers?.[containerId]
259
261
  * ```
@@ -265,15 +267,16 @@ export declare namespace tags {
265
267
  * `POST /public/collection/:collectionId/tags/by-ref`
266
268
  *
267
269
  * @param collectionId - Collection context
268
- * @param data - `{ refType, refId, embed? }`
269
- * @returns `{ items: Tag[], nextCursor: null, embedded: TagEmbedded }`
270
+ * @param data - `{ refType, refId, embed? }`, plus `limit` (default 50) and `cursor`
271
+ * @returns `{ items: Tag[], nextCursor: string | null, embedded: TagEmbedded }`: the linked tags, a page at a time
270
272
  *
271
273
  * @example
272
274
  * ```typescript
273
- * const { items: linked, embedded } = await tags.publicByRefPost('coll_123', {
275
+ * const { items: linked, embedded, nextCursor } = await tags.publicByRefPost('coll_123', {
274
276
  * refType: 'container',
275
277
  * refId: 'container-uuid',
276
278
  * embed: 'container',
279
+ * limit: 50,
277
280
  * })
278
281
  * ```
279
282
  */
package/dist/api/tags.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/api/tags.ts
2
2
  import { request, post, put, del } from "../http.js";
3
+ import { listQuery } from "../list.js";
3
4
  /**
4
5
  * Tag Management API
5
6
  *
@@ -157,23 +158,16 @@ export var tags;
157
158
  * ```
158
159
  */
159
160
  async function list(collectionId, params) {
160
- const q = new URLSearchParams();
161
- if (params === null || params === void 0 ? void 0 : params.limit)
162
- q.append('limit', params.limit.toString());
163
- if (params === null || params === void 0 ? void 0 : params.cursor)
164
- q.append('cursor', params.cursor);
165
- if (params === null || params === void 0 ? void 0 : params.productId)
166
- q.append('productId', params.productId);
167
- if (params === null || params === void 0 ? void 0 : params.variantId)
168
- q.append('variantId', params.variantId);
169
- if (params === null || params === void 0 ? void 0 : params.batchId)
170
- q.append('batchId', params.batchId);
171
- if (params === null || params === void 0 ? void 0 : params.refType)
172
- q.append('refType', params.refType);
173
- if (params === null || params === void 0 ? void 0 : params.refId)
174
- q.append('refId', params.refId);
175
- const qs = q.toString();
176
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/tags${qs ? `?${qs}` : ''}`;
161
+ const qs = listQuery({
162
+ limit: (params === null || params === void 0 ? void 0 : params.limit) || undefined,
163
+ cursor: params === null || params === void 0 ? void 0 : params.cursor,
164
+ productId: params === null || params === void 0 ? void 0 : params.productId,
165
+ variantId: params === null || params === void 0 ? void 0 : params.variantId,
166
+ batchId: params === null || params === void 0 ? void 0 : params.batchId,
167
+ refType: params === null || params === void 0 ? void 0 : params.refType,
168
+ refId: params === null || params === void 0 ? void 0 : params.refId,
169
+ });
170
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/tags${qs}`;
177
171
  return request(path);
178
172
  }
179
173
  tags.list = list;
@@ -184,22 +178,20 @@ export var tags;
184
178
  * No embed support on the admin side.
185
179
  *
186
180
  * @param collectionId - Collection context
187
- * @param params - `refType` and `refId` are required
188
- * @returns `{ items: Tag[], nextCursor: null }`: every linked tag in one answer
181
+ * @param params - `refType` and `refId` are required; plus `limit` (default 50) and `cursor`
182
+ * @returns `{ items: Tag[], nextCursor: string | null }`: the linked tags, a page at a time
189
183
  *
190
184
  * @example
191
185
  * ```typescript
192
- * const { items: linked } = await tags.byRef('coll_123', {
193
- * refType: 'container',
194
- * refId: 'container-uuid',
195
- * })
186
+ * let page = await tags.byRef('coll_123', { refType: 'container', refId: 'container-uuid', limit: 50 })
187
+ * while (page.nextCursor) {
188
+ * page = await tags.byRef('coll_123', { refType: 'container', refId: 'container-uuid', limit: 50, cursor: page.nextCursor })
189
+ * }
196
190
  * ```
197
191
  */
198
192
  async function byRef(collectionId, params) {
199
- const q = new URLSearchParams();
200
- q.append('refType', params.refType);
201
- q.append('refId', params.refId);
202
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/tags/by-ref?${q.toString()}`;
193
+ const qs = listQuery({ refType: params.refType, refId: params.refId, limit: params.limit, cursor: params.cursor });
194
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/tags/by-ref${qs}`;
203
195
  return request(path);
204
196
  }
205
197
  tags.byRef = byRef;
@@ -278,15 +270,15 @@ export var tags;
278
270
  * Returns deduplicated embedded objects alongside the tag array.
279
271
  *
280
272
  * @param collectionId - Collection context
281
- * @param data - `{ tagIds: string[], embed?: string }`
282
- * @returns `{ items: Tag[], nextCursor: null, count: number, embedded: TagEmbedded }`
273
+ * @param data - `{ tagIds: string[], embed?: string }`, plus `limit` (default 50) and `cursor`
274
+ * @returns `{ items: Tag[], nextCursor: string | null, count: number, embedded: TagEmbedded }`:
275
+ * the tags found, a page at a time
283
276
  *
284
277
  * @example
285
278
  * ```typescript
286
- * const { items, count, embedded } = await tags.lookupTags('coll_123', {
287
- * tagIds: ['NFC-001', 'NFC-002', 'NFC-003'],
288
- * embed: 'product,proof',
289
- * })
279
+ * const tagIds = ['NFC-001', 'NFC-002', 'NFC-003']
280
+ * // Every tag found comes back in the one answer: a look-up is never paged.
281
+ * const { items, embedded } = await tags.lookupTags('coll_123', { tagIds, embed: 'product,proof' })
290
282
  * ```
291
283
  */
292
284
  async function lookupTags(collectionId, data) {
@@ -300,8 +292,9 @@ export var tags;
300
292
  * `GET /public/collection/:collectionId/tags/lookup?tagIds=NFC-001,NFC-002&embed=product`
301
293
  *
302
294
  * @param collectionId - Collection context
303
- * @param params - `tagIds` is comma-separated; `embed` is optional
304
- * @returns `{ items: Tag[], nextCursor: null, count: number, embedded: TagEmbedded }`
295
+ * @param params - `tagIds` is comma-separated; `embed` is optional; plus `limit` (default 50) and `cursor`
296
+ * @returns `{ items: Tag[], nextCursor: string | null, count: number, embedded: TagEmbedded }`:
297
+ * the tags found, a page at a time
305
298
  *
306
299
  * @example
307
300
  * ```typescript
@@ -312,11 +305,8 @@ export var tags;
312
305
  * ```
313
306
  */
314
307
  async function lookupTagsQuery(collectionId, params) {
315
- const q = new URLSearchParams();
316
- q.append('tagIds', params.tagIds);
317
- if (params.embed)
318
- q.append('embed', params.embed);
319
- const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/lookup?${q.toString()}`;
308
+ const qs = listQuery({ tagIds: String(params.tagIds), embed: params.embed });
309
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/lookup${qs}`;
320
310
  return request(path);
321
311
  }
322
312
  tags.lookupTagsQuery = lookupTagsQuery;
@@ -326,26 +316,23 @@ export var tags;
326
316
  * `GET /public/collection/:collectionId/tags/by-ref?refType=container&refId=<uuid>&embed=ref`
327
317
  *
328
318
  * @param collectionId - Collection context
329
- * @param params - `refType` and `refId` are required; `embed` is optional
330
- * @returns `{ items: Tag[], nextCursor: null, embedded: TagEmbedded }`
319
+ * @param params - `refType` and `refId` are required; `embed` is optional; plus `limit` (default 50) and `cursor`
320
+ * @returns `{ items: Tag[], nextCursor: string | null, embedded: TagEmbedded }`: the linked tags, a page at a time
331
321
  *
332
322
  * @example
333
323
  * ```typescript
334
- * const { items: linked, embedded } = await tags.publicByRef('coll_123', {
324
+ * const { items: linked, embedded, nextCursor } = await tags.publicByRef('coll_123', {
335
325
  * refType: 'container',
336
326
  * refId: 'container-uuid',
337
327
  * embed: 'container',
328
+ * limit: 50,
338
329
  * })
339
330
  * const container = embedded.containers?.[containerId]
340
331
  * ```
341
332
  */
342
333
  async function publicByRef(collectionId, params) {
343
- const q = new URLSearchParams();
344
- q.append('refType', params.refType);
345
- q.append('refId', params.refId);
346
- if (params.embed)
347
- q.append('embed', params.embed);
348
- const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/by-ref?${q.toString()}`;
334
+ const qs = listQuery({ refType: params.refType, refId: params.refId, embed: params.embed, limit: params.limit, cursor: params.cursor });
335
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/tags/by-ref${qs}`;
349
336
  return request(path);
350
337
  }
351
338
  tags.publicByRef = publicByRef;
@@ -355,15 +342,16 @@ export var tags;
355
342
  * `POST /public/collection/:collectionId/tags/by-ref`
356
343
  *
357
344
  * @param collectionId - Collection context
358
- * @param data - `{ refType, refId, embed? }`
359
- * @returns `{ items: Tag[], nextCursor: null, embedded: TagEmbedded }`
345
+ * @param data - `{ refType, refId, embed? }`, plus `limit` (default 50) and `cursor`
346
+ * @returns `{ items: Tag[], nextCursor: string | null, embedded: TagEmbedded }`: the linked tags, a page at a time
360
347
  *
361
348
  * @example
362
349
  * ```typescript
363
- * const { items: linked, embedded } = await tags.publicByRefPost('coll_123', {
350
+ * const { items: linked, embedded, nextCursor } = await tags.publicByRefPost('coll_123', {
364
351
  * refType: 'container',
365
352
  * refId: 'container-uuid',
366
353
  * embed: 'container',
354
+ * limit: 50,
367
355
  * })
368
356
  * ```
369
357
  */
@@ -1,16 +1,18 @@
1
1
  import type { Template, TemplateInput, TemplateUpdate, TemplatePublic, TemplateRenderRequest, TemplateRenderResponse, TemplateRenderSourceRequest, TemplateRenderSourceResponse } from "../types/index.js";
2
- import type { ListResult } from "../types/list.js";
2
+ import type { ListResult, ListOptions } from "../types/list.js";
3
3
  export declare namespace template {
4
4
  /**
5
- * Every template in the collection (admin), in one answer: `nextCursor` is always null.
5
+ * The templates in the collection (admin), 50 at a time unless you give a `limit` (at most 1000).
6
+ * Pass `nextCursor` back as `cursor` for the next page; `null` means that was the last one.
6
7
  *
7
8
  * @example
8
9
  * ```typescript
9
- * const { items } = await template.getAll('coll_123')
10
- * items // Template[]
10
+ * let page = await template.getAll('coll_123', { limit: 100 })
11
+ * page.items // Template[]
12
+ * while (page.nextCursor) page = await template.getAll('coll_123', { limit: 100, cursor: page.nextCursor })
11
13
  * ```
12
14
  */
13
- function getAll(collectionId: string): Promise<ListResult<Template>>;
15
+ function getAll(collectionId: string, options?: ListOptions): Promise<ListResult<Template>>;
14
16
  function get(collectionId: string, templateId: string): Promise<Template>;
15
17
  function create(collectionId: string, data: TemplateInput): Promise<Template>;
16
18
  function update(collectionId: string, templateId: string, data: TemplateUpdate): Promise<Template>;
@@ -19,27 +21,30 @@ export declare namespace template {
19
21
  url: string;
20
22
  }>;
21
23
  /**
22
- * The collection's templates that may be used publicly, in one answer: `nextCursor` is always null.
24
+ * The collection's templates that may be used publicly, 50 at a time unless you give a `limit`
25
+ * (at most 1000). Pass `nextCursor` back as `cursor` for the next page; `null` means that was the
26
+ * last one.
23
27
  *
24
28
  * @example
25
29
  * ```typescript
26
- * const { items } = await template.getAllowed('coll_123')
30
+ * const { items, nextCursor } = await template.getAllowed('coll_123', { limit: 100 })
27
31
  * items // TemplatePublic[]
28
32
  * ```
29
33
  */
30
- function getAllowed(collectionId: string): Promise<ListResult<TemplatePublic>>;
34
+ function getAllowed(collectionId: string, options?: ListOptions): Promise<ListResult<TemplatePublic>>;
31
35
  function getPublic(collectionId: string, templateId: string): Promise<TemplatePublic>;
32
36
  function getGlobal(templateId: string): Promise<TemplatePublic>;
33
37
  /**
34
- * The global templates this collection may use, in one answer: `nextCursor` is always null.
38
+ * The global templates this collection may use, 50 at a time unless you give a `limit` (at most
39
+ * 1000). Pass `nextCursor` back as `cursor` for the next page; `null` means that was the last one.
35
40
  *
36
41
  * @example
37
42
  * ```typescript
38
- * const { items } = await template.getAllowedGlobal('coll_123')
43
+ * const { items, nextCursor } = await template.getAllowedGlobal('coll_123', { limit: 100 })
39
44
  * items // TemplatePublic[]
40
45
  * ```
41
46
  */
42
- function getAllowedGlobal(collectionId: string): Promise<ListResult<TemplatePublic>>;
47
+ function getAllowedGlobal(collectionId: string, options?: ListOptions): Promise<ListResult<TemplatePublic>>;
43
48
  function render(collectionId: string, templateId: string, body: TemplateRenderRequest): Promise<TemplateRenderResponse>;
44
49
  function renderSource(collectionId: string, body: TemplateRenderSourceRequest): Promise<TemplateRenderSourceResponse>;
45
50
  }
@@ -1,18 +1,21 @@
1
1
  import { request, post, put, del as httpDel } from "../http.js";
2
+ import { listQuery } from "../list.js";
2
3
  export var template;
3
4
  (function (template) {
4
5
  // Admin APIs
5
6
  /**
6
- * Every template in the collection (admin), in one answer: `nextCursor` is always null.
7
+ * The templates in the collection (admin), 50 at a time unless you give a `limit` (at most 1000).
8
+ * Pass `nextCursor` back as `cursor` for the next page; `null` means that was the last one.
7
9
  *
8
10
  * @example
9
11
  * ```typescript
10
- * const { items } = await template.getAll('coll_123')
11
- * items // Template[]
12
+ * let page = await template.getAll('coll_123', { limit: 100 })
13
+ * page.items // Template[]
14
+ * while (page.nextCursor) page = await template.getAll('coll_123', { limit: 100, cursor: page.nextCursor })
12
15
  * ```
13
16
  */
14
- async function getAll(collectionId) {
15
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/template`;
17
+ async function getAll(collectionId, options = {}) {
18
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/template${listQuery({ limit: options.limit, cursor: options.cursor })}`;
16
19
  return request(path);
17
20
  }
18
21
  template.getAll = getAll;
@@ -46,16 +49,18 @@ export var template;
46
49
  template.uploadAsset = uploadAsset;
47
50
  // Public APIs
48
51
  /**
49
- * The collection's templates that may be used publicly, in one answer: `nextCursor` is always null.
52
+ * The collection's templates that may be used publicly, 50 at a time unless you give a `limit`
53
+ * (at most 1000). Pass `nextCursor` back as `cursor` for the next page; `null` means that was the
54
+ * last one.
50
55
  *
51
56
  * @example
52
57
  * ```typescript
53
- * const { items } = await template.getAllowed('coll_123')
58
+ * const { items, nextCursor } = await template.getAllowed('coll_123', { limit: 100 })
54
59
  * items // TemplatePublic[]
55
60
  * ```
56
61
  */
57
- async function getAllowed(collectionId) {
58
- const path = `/public/collection/${encodeURIComponent(collectionId)}/template/getAllowed`;
62
+ async function getAllowed(collectionId, options = {}) {
63
+ const path = `/public/collection/${encodeURIComponent(collectionId)}/template/getAllowed${listQuery({ limit: options.limit, cursor: options.cursor })}`;
59
64
  return request(path);
60
65
  }
61
66
  template.getAllowed = getAllowed;
@@ -70,16 +75,17 @@ export var template;
70
75
  }
71
76
  template.getGlobal = getGlobal;
72
77
  /**
73
- * The global templates this collection may use, in one answer: `nextCursor` is always null.
78
+ * The global templates this collection may use, 50 at a time unless you give a `limit` (at most
79
+ * 1000). Pass `nextCursor` back as `cursor` for the next page; `null` means that was the last one.
74
80
  *
75
81
  * @example
76
82
  * ```typescript
77
- * const { items } = await template.getAllowedGlobal('coll_123')
83
+ * const { items, nextCursor } = await template.getAllowedGlobal('coll_123', { limit: 100 })
78
84
  * items // TemplatePublic[]
79
85
  * ```
80
86
  */
81
- async function getAllowedGlobal(collectionId) {
82
- const path = `/public/template/getAllowed/${encodeURIComponent(collectionId)}`;
87
+ async function getAllowedGlobal(collectionId, options = {}) {
88
+ const path = `/public/template/getAllowed/${encodeURIComponent(collectionId)}${listQuery({ limit: options.limit, cursor: options.cursor })}`;
83
89
  return request(path);
84
90
  }
85
91
  template.getAllowedGlobal = getAllowedGlobal;
@@ -1,6 +1,7 @@
1
1
  import { isProxyEnabled, patch, post, put, request } from '../http.js';
2
2
  import { clearCachedTranslations, deriveTranslationContextKey, getCachedTranslations, getDefaultTranslationCacheTtlMs, hashTranslationText, normalizeTranslationText, setCachedTranslations, } from '../translationCache.js';
3
3
  import { trackTranslation, onActivity as onTranslationActivity, activity as translationActivity, translatingMessage as translatingLine } from '../translationActivity.js';
4
+ import { listQuery } from '../list.js';
4
5
  function normalizeLookupRequest(body) {
5
6
  var _a, _b, _c;
6
7
  const texts = Array.isArray(body.texts)
@@ -32,16 +33,6 @@ function normalizeLookupRequest(body) {
32
33
  texts,
33
34
  };
34
35
  }
35
- function buildTranslationListQuery(params = {}) {
36
- const query = new URLSearchParams();
37
- for (const [key, value] of Object.entries(params)) {
38
- if (value === undefined || value === null)
39
- continue;
40
- query.append(key, String(value));
41
- }
42
- const queryString = query.toString();
43
- return queryString ? `?${queryString}` : '';
44
- }
45
36
  function sameLanguage(left, right) {
46
37
  return left.trim().toLowerCase() === right.trim().toLowerCase();
47
38
  }
@@ -289,8 +280,7 @@ export var translations;
289
280
  * ```
290
281
  */
291
282
  async function list(collectionId, params) {
292
- const query = buildTranslationListQuery(params);
293
- const path = `/admin/collection/${encodeURIComponent(collectionId)}/translations${query}`;
283
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/translations${listQuery(params)}`;
294
284
  return request(path);
295
285
  }
296
286
  translations.list = list;