@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.
- package/README.md +741 -741
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/analytics.d.ts +5 -4
- package/dist/api/analytics.js +5 -4
- package/dist/api/appConfiguration.d.ts +23 -18
- package/dist/api/appConfiguration.js +24 -18
- package/dist/api/appObjects.d.ts +54 -10
- package/dist/api/appObjects.js +75 -40
- package/dist/api/asset.d.ts +28 -22
- package/dist/api/asset.js +45 -56
- package/dist/api/attestation.d.ts +11 -3
- package/dist/api/attestation.js +12 -3
- package/dist/api/attestations.d.ts +12 -8
- package/dist/api/attestations.js +18 -21
- package/dist/api/authKit.d.ts +15 -10
- package/dist/api/authKit.js +17 -11
- package/dist/api/batch.d.ts +36 -25
- package/dist/api/batch.js +46 -39
- package/dist/api/bookings.d.ts +67 -11
- package/dist/api/bookings.js +82 -15
- package/dist/api/broadcasts.js +3 -17
- package/dist/api/claimSet.d.ts +26 -12
- package/dist/api/claimSet.js +32 -24
- package/dist/api/collection.d.ts +15 -10
- package/dist/api/collection.js +17 -11
- package/dist/api/comms.d.ts +12 -6
- package/dist/api/comms.js +12 -6
- package/dist/api/conditions.d.ts +7 -6
- package/dist/api/conditions.js +8 -6
- package/dist/api/contact.d.ts +6 -2
- package/dist/api/contact.js +25 -60
- package/dist/api/containers.d.ts +14 -10
- package/dist/api/containers.js +19 -14
- package/dist/api/crate.js +7 -9
- package/dist/api/dpp.d.ts +20 -13
- package/dist/api/dpp.js +23 -15
- package/dist/api/facets.d.ts +38 -13
- package/dist/api/facets.js +40 -15
- package/dist/api/files.d.ts +5 -2
- package/dist/api/files.js +7 -4
- package/dist/api/form.d.ts +8 -5
- package/dist/api/form.js +9 -5
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/integrations.d.ts +29 -17
- package/dist/api/integrations.js +32 -25
- package/dist/api/interactions.d.ts +11 -6
- package/dist/api/interactions.js +14 -23
- package/dist/api/jobs.d.ts +16 -6
- package/dist/api/jobs.js +30 -20
- package/dist/api/journeys.js +2 -14
- package/dist/api/journeysAnalytics.d.ts +8 -5
- package/dist/api/journeysAnalytics.js +8 -5
- package/dist/api/knowledge.d.ts +20 -14
- package/dist/api/knowledge.js +22 -15
- package/dist/api/location.d.ts +6 -3
- package/dist/api/location.js +8 -22
- package/dist/api/lots.d.ts +9 -5
- package/dist/api/lots.js +22 -26
- package/dist/api/loyalty.d.ts +25 -16
- package/dist/api/loyalty.js +33 -32
- package/dist/api/nfc.d.ts +3 -1
- package/dist/api/nfc.js +3 -1
- package/dist/api/order.d.ts +45 -39
- package/dist/api/order.js +48 -65
- package/dist/api/partner.d.ts +17 -14
- package/dist/api/partner.js +21 -22
- package/dist/api/payments.d.ts +60 -0
- package/dist/api/payments.js +94 -0
- package/dist/api/products.d.ts +35 -12
- package/dist/api/products.js +36 -13
- package/dist/api/proof.d.ts +41 -19
- package/dist/api/proof.js +44 -23
- package/dist/api/realtime.d.ts +3 -0
- package/dist/api/realtime.js +10 -2
- package/dist/api/segments.js +3 -15
- package/dist/api/serviceAccounts.d.ts +8 -5
- package/dist/api/serviceAccounts.js +9 -6
- package/dist/api/shop.d.ts +7 -5
- package/dist/api/shop.js +13 -19
- package/dist/api/subscriptions.d.ts +12 -10
- package/dist/api/subscriptions.js +17 -25
- package/dist/api/tags.d.ts +23 -20
- package/dist/api/tags.js +40 -52
- package/dist/api/template.d.ts +16 -11
- package/dist/api/template.js +19 -13
- package/dist/api/translations.js +2 -12
- package/dist/api/userGroups.d.ts +26 -16
- package/dist/api/userGroups.js +43 -30
- package/dist/api/variant.d.ts +10 -7
- package/dist/api/variant.js +11 -7
- package/dist/api/wallet.d.ts +14 -11
- package/dist/api/wallet.js +15 -12
- package/dist/baseline.css +194 -194
- package/dist/dataChanged.d.ts +74 -0
- package/dist/dataChanged.js +162 -0
- package/dist/docs/API_SUMMARY.md +1443 -1409
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1721
- package/dist/docs/analytics.md +1 -1
- package/dist/docs/api-versions.md +85 -85
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-objects.md +4 -4
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/attestations.md +8 -8
- package/dist/docs/bookings.md +105 -8
- package/dist/docs/caching.md +32 -3
- package/dist/docs/comms.md +689 -689
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/contact-search.md +2 -3
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/data-changed.md +91 -0
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/dpp.md +115 -115
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +252 -252
- package/dist/docs/iframe-responder.md +11 -0
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +544 -544
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +105 -105
- package/dist/docs/lists.md +157 -114
- package/dist/docs/lots.md +112 -112
- package/dist/docs/loyalty.md +348 -348
- package/dist/docs/members.md +183 -183
- package/dist/docs/memberships.md +150 -150
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +487 -485
- package/dist/docs/payments.md +94 -0
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +149 -139
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/service-accounts.md +64 -64
- package/dist/docs/standard-query.md +196 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/tag-ranges.md +106 -106
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/upgrading-to-3.md +550 -430
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/http.d.ts +6 -3
- package/dist/http.js +48 -19
- package/dist/iframeResponder.d.ts +7 -0
- package/dist/iframeResponder.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/list.d.ts +12 -0
- package/dist/list.js +59 -0
- package/dist/openapi.yaml +722 -660
- package/dist/testing/bookingsMemory.d.ts +29 -1
- package/dist/testing/bookingsMemory.js +89 -1
- package/dist/testing/index.js +4 -1
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/analytics.d.ts +7 -3
- package/dist/types/appManifest.d.ts +26 -4
- package/dist/types/appObjects.d.ts +27 -12
- package/dist/types/appOptions.d.ts +2 -2
- package/dist/types/asset.d.ts +5 -6
- package/dist/types/attestations.d.ts +7 -9
- package/dist/types/batch.d.ts +5 -5
- package/dist/types/bookings.d.ts +109 -6
- package/dist/types/comms.d.ts +9 -5
- package/dist/types/contact.d.ts +7 -4
- package/dist/types/containers.d.ts +2 -1
- package/dist/types/facets.d.ts +14 -2
- package/dist/types/files.d.ts +3 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/integrations.d.ts +2 -1
- package/dist/types/interaction.d.ts +15 -7
- package/dist/types/jobs.d.ts +1 -1
- package/dist/types/journeysAnalytics.d.ts +3 -2
- package/dist/types/knowledge.d.ts +6 -3
- package/dist/types/knowledge.js +0 -1
- package/dist/types/list.d.ts +30 -2
- package/dist/types/location.d.ts +7 -2
- package/dist/types/location.js +0 -1
- package/dist/types/lots.d.ts +5 -2
- package/dist/types/lots.js +0 -6
- package/dist/types/order.d.ts +22 -20
- package/dist/types/payments.d.ts +101 -0
- package/dist/types/payments.js +5 -0
- package/dist/types/product.d.ts +28 -11
- package/dist/types/proof.d.ts +7 -8
- package/dist/types/realtime.d.ts +5 -1
- package/dist/types/tags.d.ts +5 -3
- package/dist/types/userGroups.d.ts +3 -3
- package/dist/types/userGroups.js +0 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1443 -1409
- package/docs/admin-cards.md +189 -189
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1721
- package/docs/analytics.md +1 -1
- package/docs/api-versions.md +85 -85
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-objects.md +4 -4
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/attestations.md +8 -8
- package/docs/bookings.md +105 -8
- package/docs/caching.md +32 -3
- package/docs/comms.md +689 -689
- package/docs/connectors.md +340 -340
- package/docs/contact-search.md +2 -3
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/data-changed.md +91 -0
- package/docs/deploying-apps.md +340 -340
- package/docs/dpp.md +115 -115
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +252 -252
- package/docs/iframe-responder.md +11 -0
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +544 -544
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +105 -105
- package/docs/lists.md +157 -114
- package/docs/lots.md +112 -112
- package/docs/loyalty.md +348 -348
- package/docs/members.md +183 -183
- package/docs/memberships.md +150 -150
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +487 -485
- package/docs/payments.md +94 -0
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +149 -139
- package/docs/service-accounts.md +64 -64
- package/docs/standard-query.md +196 -187
- package/docs/tag-codes.md +97 -97
- package/docs/tag-ranges.md +106 -106
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/upgrading-to-3.md +550 -430
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +722 -660
- package/package.json +91 -91
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/lib/upgrade.mjs +708 -512
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
- package/scripts/upgrade.mjs +79 -56
- package/upgrade/3.json +2731 -2213
package/dist/api/bookings.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Booking, BookingSlot, BookingAllocation, CreateBookingInput, UpdateBookingInput, MoveBookingInput, BookingListOptions, CreateSlotInput, UpdateSlotInput, SlotListOptions, CreateBlockInput, BlockListOptions, FreeBusyQuery, FreeBusyResponse, BookingAccessOptions, MessageBookersInput, MessageBookersResult } from '../types/bookings.js';
|
|
1
|
+
import type { Booking, BookingSlot, BookingAllocation, CreateBookingInput, UpdateBookingInput, MoveBookingInput, BookingListOptions, CreateSlotInput, UpdateSlotInput, SlotListOptions, CreateBlockInput, BlockListOptions, FreeBusyQuery, FreeBusyResponse, BookingAccessOptions, MessageBookersInput, MessageBookersResult, BookingCheckoutInput, BookingCheckoutResult, BookingPayLinkResult, BookingRefundResult } from '../types/bookings.js';
|
|
2
2
|
import type { ListResult } from '../types/list.js';
|
|
3
3
|
export declare namespace bookings {
|
|
4
4
|
/**
|
|
@@ -13,26 +13,29 @@ export declare namespace bookings {
|
|
|
13
13
|
*/
|
|
14
14
|
function create(collectionId: string, appId: string, input: CreateBookingInput, admin?: boolean): Promise<Booking>;
|
|
15
15
|
/**
|
|
16
|
-
* List bookings (admin), a page at a time. `count` is how many match in all.
|
|
17
|
-
*
|
|
16
|
+
* List bookings (admin), a page at a time. `count` is how many match in all. `from` / `to` pick
|
|
17
|
+
* the bookings overlapping that time; `orderBy` sorts (earliest start first unless you say). There
|
|
18
|
+
* is no public list: a signed-in booker uses {@link mine}. GET /bookings
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* ```typescript
|
|
21
|
-
*
|
|
22
|
+
* const from = new Date()
|
|
23
|
+
* let page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50 })
|
|
22
24
|
* page.items // Booking[]
|
|
23
25
|
* page.count // how many match in all
|
|
24
26
|
* while (page.nextCursor) {
|
|
25
|
-
* page = await bookings.list(collectionId, appId, { status: 'confirmed', from:
|
|
27
|
+
* page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50, cursor: page.nextCursor })
|
|
26
28
|
* }
|
|
27
29
|
* ```
|
|
28
30
|
*/
|
|
29
31
|
function list(collectionId: string, appId: string, params?: BookingListOptions, admin?: boolean): Promise<ListResult<Booking>>;
|
|
30
32
|
/**
|
|
31
|
-
* The signed-in caller's own bookings (public), a page at a time.
|
|
33
|
+
* The signed-in caller's own bookings (public), a page at a time. Takes the same options as
|
|
34
|
+
* {@link list}, except `contactId`. GET /bookings/mine
|
|
32
35
|
*
|
|
33
36
|
* @example
|
|
34
37
|
* ```typescript
|
|
35
|
-
* const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date() })
|
|
38
|
+
* const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date(), orderBy: [{ startsAt: 'asc' }], limit: 20 })
|
|
36
39
|
* ```
|
|
37
40
|
*/
|
|
38
41
|
function mine(collectionId: string, appId: string, params?: Omit<BookingListOptions, 'contactId'>): Promise<ListResult<Booking>>;
|
|
@@ -46,17 +49,64 @@ export declare namespace bookings {
|
|
|
46
49
|
/**
|
|
47
50
|
* held / pending / waitlisted → confirmed (idempotent). A held booking whose hold has run out fails
|
|
48
51
|
* with HOLD_EXPIRED. Public: only the booker's own hold, when `ownerActions.bookings.confirm` allows.
|
|
52
|
+
*
|
|
53
|
+
* Paid bookings: a booking waiting for its payment is confirmed by the payment (PAYMENT_REQUIRED
|
|
54
|
+
* otherwise). Admin confirming a REQUEST that has a price turns it into a hold with a pay link for the
|
|
55
|
+
* booker (`payment.link`, emailed through `booking.payment_requested`); `{ payment: 'waive' }` confirms
|
|
56
|
+
* without payment (paid in cash, a free place).
|
|
49
57
|
* POST /bookings/:bookingId/confirm
|
|
50
58
|
*/
|
|
51
|
-
function confirm(collectionId: string, appId: string, bookingId: string, admin?: boolean, opts?: BookingAccessOptions
|
|
59
|
+
function confirm(collectionId: string, appId: string, bookingId: string, admin?: boolean, opts?: BookingAccessOptions & {
|
|
60
|
+
payment?: 'waive';
|
|
61
|
+
}): Promise<Booking>;
|
|
52
62
|
/**
|
|
53
63
|
* Cancel and give the places back (idempotent). Public: per `ownerActions.bookings.cancel` and its
|
|
54
64
|
* cutoff. `reason` is admin-only (public cancels record 'owner').
|
|
65
|
+
*
|
|
66
|
+
* Paid bookings are refunded: the booker's cancel follows the app's `bookingPayments.ownerCancelRefund`
|
|
67
|
+
* (full by default); staff choose with `refund`: 'full' (default) | 'none' | an amount in minor units.
|
|
55
68
|
* POST /bookings/:bookingId/cancel
|
|
56
69
|
*/
|
|
57
70
|
function cancel(collectionId: string, appId: string, bookingId: string, admin?: boolean, opts?: BookingAccessOptions & {
|
|
58
71
|
reason?: string;
|
|
72
|
+
refund?: 'full' | 'none' | number;
|
|
59
73
|
}): Promise<Booking>;
|
|
74
|
+
/**
|
|
75
|
+
* Book and pay. The same rules as `create` (public), then the app's `bookingPayments` decide:
|
|
76
|
+
* - pay now (the rules book as held / confirmed): the booking is held while the person pays on
|
|
77
|
+
* Stripe's page → go to `checkoutUrl`; Stripe's webhook confirms it.
|
|
78
|
+
* - a request (the rules book as pending): priced, nothing paid, `checkoutUrl: null`; staff approving it
|
|
79
|
+
* sends the booker a pay link.
|
|
80
|
+
* - free (no prices): booked the normal way, `checkoutUrl: null`.
|
|
81
|
+
* Name prices by id (`lines` for ticket types on a slot, `priceId` for an appointment's service); the
|
|
82
|
+
* server sets every amount.
|
|
83
|
+
* POST /bookings/checkout
|
|
84
|
+
*/
|
|
85
|
+
function checkout(collectionId: string, appId: string, input: BookingCheckoutInput): Promise<BookingCheckoutResult>;
|
|
86
|
+
/**
|
|
87
|
+
* The thank-you page: the booking a Checkout Session paid for (`session_id` in the success address).
|
|
88
|
+
* `confirming: true` while Stripe's webhook is still on its way: show "confirming your payment…" and
|
|
89
|
+
* read again in a moment.
|
|
90
|
+
* GET /bookings/by-session/:sessionId
|
|
91
|
+
*/
|
|
92
|
+
function bySession(collectionId: string, appId: string, sessionId: string): Promise<Booking & {
|
|
93
|
+
confirming: boolean;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* An approved request's pay link, for an app with its own pay page (the link in the email goes straight
|
|
97
|
+
* to Stripe). `token` is the `t` of `payment.link`. → `{ checkoutUrl }`, or `{ done: 'paid' | 'closed', url }`.
|
|
98
|
+
* POST /bookings/:bookingId/pay
|
|
99
|
+
*/
|
|
100
|
+
function pay(collectionId: string, appId: string, bookingId: string, token: string): Promise<BookingPayLinkResult>;
|
|
101
|
+
/**
|
|
102
|
+
* Refund a paid booking without cancelling it (admin): all that's left, or `amount` (minor units). A
|
|
103
|
+
* refund Stripe can't take now is retried by the platform (`refundPending: true`).
|
|
104
|
+
* POST /bookings/:bookingId/refund
|
|
105
|
+
*/
|
|
106
|
+
function refund(collectionId: string, appId: string, bookingId: string, opts?: {
|
|
107
|
+
amount?: number;
|
|
108
|
+
reason?: string;
|
|
109
|
+
}): Promise<BookingRefundResult>;
|
|
60
110
|
/**
|
|
61
111
|
* Move to a new slot / time, all-or-nothing (a failed move leaves the booking as it was).
|
|
62
112
|
* Public: per `ownerActions.bookings.move`; the create rules are re-checked for the new time.
|
|
@@ -92,11 +142,14 @@ export declare namespace bookings {
|
|
|
92
142
|
}>;
|
|
93
143
|
/**
|
|
94
144
|
* List slots, a page at a time. Public: open, public slots only, each with `remaining`.
|
|
145
|
+
* `from` / `to` pick the slots in that time; `orderBy` sorts them.
|
|
95
146
|
* GET /bookings/slots
|
|
96
147
|
*
|
|
97
148
|
* @example
|
|
98
149
|
* ```typescript
|
|
99
|
-
* const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, {
|
|
150
|
+
* const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, {
|
|
151
|
+
* from, to, available: true, orderBy: [{ startsAt: 'asc' }], limit: 50,
|
|
152
|
+
* })
|
|
100
153
|
* ```
|
|
101
154
|
*/
|
|
102
155
|
function list(collectionId: string, appId: string, params?: SlotListOptions, admin?: boolean): Promise<ListResult<BookingSlot>>;
|
|
@@ -116,11 +169,14 @@ export declare namespace bookings {
|
|
|
116
169
|
namespace blocks {
|
|
117
170
|
function create(collectionId: string, appId: string, input: CreateBlockInput): Promise<BookingAllocation>;
|
|
118
171
|
/**
|
|
119
|
-
* The blocks on a resource and/or in a date range, a page at a time
|
|
172
|
+
* The blocks on a resource and/or in a date range (`from` / `to`), a page at a time (`limit`,
|
|
173
|
+
* `cursor`). GET /bookings/blocks
|
|
120
174
|
*
|
|
121
175
|
* @example
|
|
122
176
|
* ```typescript
|
|
123
|
-
* const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, {
|
|
177
|
+
* const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, {
|
|
178
|
+
* resourceType: 'record', resourceId: 'staff-1', from: '2026-12-01T00:00:00Z', to: '2027-01-01T00:00:00Z', limit: 50,
|
|
179
|
+
* })
|
|
124
180
|
* ```
|
|
125
181
|
*/
|
|
126
182
|
function list(collectionId: string, appId: string, params?: BlockListOptions): Promise<ListResult<BookingAllocation>>;
|
package/dist/api/bookings.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// as what status, limits, time rules), ownerActions.bookings (cancel / move /
|
|
8
8
|
// confirm afterwards) and publicRead.bookings.freebusy.
|
|
9
9
|
import { request, post, patch, del, requestWithOptions } from '../http.js';
|
|
10
|
+
import { listQuery } from '../list.js';
|
|
10
11
|
function basePath(collectionId, appId, admin) {
|
|
11
12
|
const zone = admin ? 'admin' : 'public';
|
|
12
13
|
return `/${zone}/collection/${encodeURIComponent(collectionId)}/app/${encodeURIComponent(appId)}/bookings`;
|
|
@@ -46,33 +47,36 @@ export var bookings;
|
|
|
46
47
|
}
|
|
47
48
|
bookings.create = create;
|
|
48
49
|
/**
|
|
49
|
-
* List bookings (admin), a page at a time. `count` is how many match in all.
|
|
50
|
-
*
|
|
50
|
+
* List bookings (admin), a page at a time. `count` is how many match in all. `from` / `to` pick
|
|
51
|
+
* the bookings overlapping that time; `orderBy` sorts (earliest start first unless you say). There
|
|
52
|
+
* is no public list: a signed-in booker uses {@link mine}. GET /bookings
|
|
51
53
|
*
|
|
52
54
|
* @example
|
|
53
55
|
* ```typescript
|
|
54
|
-
*
|
|
56
|
+
* const from = new Date()
|
|
57
|
+
* let page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50 })
|
|
55
58
|
* page.items // Booking[]
|
|
56
59
|
* page.count // how many match in all
|
|
57
60
|
* while (page.nextCursor) {
|
|
58
|
-
* page = await bookings.list(collectionId, appId, { status: 'confirmed', from:
|
|
61
|
+
* page = await bookings.list(collectionId, appId, { status: 'confirmed', from, orderBy: [{ startsAt: 'desc' }], limit: 50, cursor: page.nextCursor })
|
|
59
62
|
* }
|
|
60
63
|
* ```
|
|
61
64
|
*/
|
|
62
65
|
async function list(collectionId, appId, params, admin = true) {
|
|
63
|
-
return request(`${basePath(collectionId, appId, admin)}${
|
|
66
|
+
return request(`${basePath(collectionId, appId, admin)}${listQuery(params)}`);
|
|
64
67
|
}
|
|
65
68
|
bookings.list = list;
|
|
66
69
|
/**
|
|
67
|
-
* The signed-in caller's own bookings (public), a page at a time.
|
|
70
|
+
* The signed-in caller's own bookings (public), a page at a time. Takes the same options as
|
|
71
|
+
* {@link list}, except `contactId`. GET /bookings/mine
|
|
68
72
|
*
|
|
69
73
|
* @example
|
|
70
74
|
* ```typescript
|
|
71
|
-
* const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date() })
|
|
75
|
+
* const { items, nextCursor, count } = await bookings.mine(collectionId, appId, { from: new Date(), orderBy: [{ startsAt: 'asc' }], limit: 20 })
|
|
72
76
|
* ```
|
|
73
77
|
*/
|
|
74
78
|
async function mine(collectionId, appId, params) {
|
|
75
|
-
return request(`${basePath(collectionId, appId, false)}/mine${
|
|
79
|
+
return request(`${basePath(collectionId, appId, false)}/mine${listQuery(params)}`);
|
|
76
80
|
}
|
|
77
81
|
bookings.mine = mine;
|
|
78
82
|
/**
|
|
@@ -93,21 +97,78 @@ export var bookings;
|
|
|
93
97
|
/**
|
|
94
98
|
* held / pending / waitlisted → confirmed (idempotent). A held booking whose hold has run out fails
|
|
95
99
|
* with HOLD_EXPIRED. Public: only the booker's own hold, when `ownerActions.bookings.confirm` allows.
|
|
100
|
+
*
|
|
101
|
+
* Paid bookings: a booking waiting for its payment is confirmed by the payment (PAYMENT_REQUIRED
|
|
102
|
+
* otherwise). Admin confirming a REQUEST that has a price turns it into a hold with a pay link for the
|
|
103
|
+
* booker (`payment.link`, emailed through `booking.payment_requested`); `{ payment: 'waive' }` confirms
|
|
104
|
+
* without payment (paid in cash, a free place).
|
|
96
105
|
* POST /bookings/:bookingId/confirm
|
|
97
106
|
*/
|
|
98
107
|
async function confirm(collectionId, appId, bookingId, admin = false, opts) {
|
|
99
|
-
return post(`${basePath(collectionId, appId, admin)}/${encodeURIComponent(bookingId)}/confirm`, {}, tokenHeaders(opts));
|
|
108
|
+
return post(`${basePath(collectionId, appId, admin)}/${encodeURIComponent(bookingId)}/confirm`, (opts === null || opts === void 0 ? void 0 : opts.payment) ? { payment: opts.payment } : {}, tokenHeaders(opts));
|
|
100
109
|
}
|
|
101
110
|
bookings.confirm = confirm;
|
|
102
111
|
/**
|
|
103
112
|
* Cancel and give the places back (idempotent). Public: per `ownerActions.bookings.cancel` and its
|
|
104
113
|
* cutoff. `reason` is admin-only (public cancels record 'owner').
|
|
114
|
+
*
|
|
115
|
+
* Paid bookings are refunded: the booker's cancel follows the app's `bookingPayments.ownerCancelRefund`
|
|
116
|
+
* (full by default); staff choose with `refund`: 'full' (default) | 'none' | an amount in minor units.
|
|
105
117
|
* POST /bookings/:bookingId/cancel
|
|
106
118
|
*/
|
|
107
119
|
async function cancel(collectionId, appId, bookingId, admin = false, opts) {
|
|
108
|
-
|
|
120
|
+
const body = {};
|
|
121
|
+
if (opts === null || opts === void 0 ? void 0 : opts.reason)
|
|
122
|
+
body.reason = opts.reason;
|
|
123
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.refund) !== undefined)
|
|
124
|
+
body.refund = opts.refund;
|
|
125
|
+
return post(`${basePath(collectionId, appId, admin)}/${encodeURIComponent(bookingId)}/cancel`, body, tokenHeaders(opts));
|
|
109
126
|
}
|
|
110
127
|
bookings.cancel = cancel;
|
|
128
|
+
// ==================== PAID BOOKINGS (docs/bookings.md, "Paid bookings") ====================
|
|
129
|
+
/**
|
|
130
|
+
* Book and pay. The same rules as `create` (public), then the app's `bookingPayments` decide:
|
|
131
|
+
* - pay now (the rules book as held / confirmed): the booking is held while the person pays on
|
|
132
|
+
* Stripe's page → go to `checkoutUrl`; Stripe's webhook confirms it.
|
|
133
|
+
* - a request (the rules book as pending): priced, nothing paid, `checkoutUrl: null`; staff approving it
|
|
134
|
+
* sends the booker a pay link.
|
|
135
|
+
* - free (no prices): booked the normal way, `checkoutUrl: null`.
|
|
136
|
+
* Name prices by id (`lines` for ticket types on a slot, `priceId` for an appointment's service); the
|
|
137
|
+
* server sets every amount.
|
|
138
|
+
* POST /bookings/checkout
|
|
139
|
+
*/
|
|
140
|
+
async function checkout(collectionId, appId, input) {
|
|
141
|
+
return post(`${basePath(collectionId, appId, false)}/checkout`, input);
|
|
142
|
+
}
|
|
143
|
+
bookings.checkout = checkout;
|
|
144
|
+
/**
|
|
145
|
+
* The thank-you page: the booking a Checkout Session paid for (`session_id` in the success address).
|
|
146
|
+
* `confirming: true` while Stripe's webhook is still on its way: show "confirming your payment…" and
|
|
147
|
+
* read again in a moment.
|
|
148
|
+
* GET /bookings/by-session/:sessionId
|
|
149
|
+
*/
|
|
150
|
+
async function bySession(collectionId, appId, sessionId) {
|
|
151
|
+
return request(`${basePath(collectionId, appId, false)}/by-session/${encodeURIComponent(sessionId)}`);
|
|
152
|
+
}
|
|
153
|
+
bookings.bySession = bySession;
|
|
154
|
+
/**
|
|
155
|
+
* An approved request's pay link, for an app with its own pay page (the link in the email goes straight
|
|
156
|
+
* to Stripe). `token` is the `t` of `payment.link`. → `{ checkoutUrl }`, or `{ done: 'paid' | 'closed', url }`.
|
|
157
|
+
* POST /bookings/:bookingId/pay
|
|
158
|
+
*/
|
|
159
|
+
async function pay(collectionId, appId, bookingId, token) {
|
|
160
|
+
return post(`${basePath(collectionId, appId, false)}/${encodeURIComponent(bookingId)}/pay`, { token });
|
|
161
|
+
}
|
|
162
|
+
bookings.pay = pay;
|
|
163
|
+
/**
|
|
164
|
+
* Refund a paid booking without cancelling it (admin): all that's left, or `amount` (minor units). A
|
|
165
|
+
* refund Stripe can't take now is retried by the platform (`refundPending: true`).
|
|
166
|
+
* POST /bookings/:bookingId/refund
|
|
167
|
+
*/
|
|
168
|
+
async function refund(collectionId, appId, bookingId, opts) {
|
|
169
|
+
return post(`${basePath(collectionId, appId, true)}/${encodeURIComponent(bookingId)}/refund`, opts || {});
|
|
170
|
+
}
|
|
171
|
+
bookings.refund = refund;
|
|
111
172
|
/**
|
|
112
173
|
* Move to a new slot / time, all-or-nothing (a failed move leaves the booking as it was).
|
|
113
174
|
* Public: per `ownerActions.bookings.move`; the create rules are re-checked for the new time.
|
|
@@ -166,15 +227,18 @@ export var bookings;
|
|
|
166
227
|
slots_1.createMany = createMany;
|
|
167
228
|
/**
|
|
168
229
|
* List slots, a page at a time. Public: open, public slots only, each with `remaining`.
|
|
230
|
+
* `from` / `to` pick the slots in that time; `orderBy` sorts them.
|
|
169
231
|
* GET /bookings/slots
|
|
170
232
|
*
|
|
171
233
|
* @example
|
|
172
234
|
* ```typescript
|
|
173
|
-
* const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, {
|
|
235
|
+
* const { items, nextCursor, count } = await bookings.slots.list(collectionId, appId, {
|
|
236
|
+
* from, to, available: true, orderBy: [{ startsAt: 'asc' }], limit: 50,
|
|
237
|
+
* })
|
|
174
238
|
* ```
|
|
175
239
|
*/
|
|
176
240
|
async function list(collectionId, appId, params, admin = false) {
|
|
177
|
-
return request(`${basePath(collectionId, appId, admin)}/slots${
|
|
241
|
+
return request(`${basePath(collectionId, appId, admin)}/slots${listQuery(params)}`);
|
|
178
242
|
}
|
|
179
243
|
slots_1.list = list;
|
|
180
244
|
/** GET /bookings/slots/:slotId */
|
|
@@ -205,15 +269,18 @@ export var bookings;
|
|
|
205
269
|
}
|
|
206
270
|
blocks.create = create;
|
|
207
271
|
/**
|
|
208
|
-
* The blocks on a resource and/or in a date range, a page at a time
|
|
272
|
+
* The blocks on a resource and/or in a date range (`from` / `to`), a page at a time (`limit`,
|
|
273
|
+
* `cursor`). GET /bookings/blocks
|
|
209
274
|
*
|
|
210
275
|
* @example
|
|
211
276
|
* ```typescript
|
|
212
|
-
* const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, {
|
|
277
|
+
* const { items, nextCursor } = await bookings.blocks.list(collectionId, appId, {
|
|
278
|
+
* resourceType: 'record', resourceId: 'staff-1', from: '2026-12-01T00:00:00Z', to: '2027-01-01T00:00:00Z', limit: 50,
|
|
279
|
+
* })
|
|
213
280
|
* ```
|
|
214
281
|
*/
|
|
215
282
|
async function list(collectionId, appId, params) {
|
|
216
|
-
return request(`${basePath(collectionId, appId, true)}/blocks${
|
|
283
|
+
return request(`${basePath(collectionId, appId, true)}/blocks${listQuery(params)}`);
|
|
217
284
|
}
|
|
218
285
|
blocks.list = list;
|
|
219
286
|
async function remove(collectionId, appId, blockId) {
|
package/dist/api/broadcasts.js
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
// src/api/broadcasts.ts
|
|
2
2
|
import { request, post, patch, del } from "../http.js";
|
|
3
|
-
|
|
4
|
-
const search = new URLSearchParams();
|
|
5
|
-
for (const [key, value] of Object.entries(params)) {
|
|
6
|
-
if (value === undefined || value === null || value === "")
|
|
7
|
-
continue;
|
|
8
|
-
if (typeof value === "boolean") {
|
|
9
|
-
search.set(key, value ? "true" : "false");
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
search.set(key, String(value));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const qs = search.toString();
|
|
16
|
-
return qs ? `?${qs}` : "";
|
|
17
|
-
}
|
|
3
|
+
import { listQuery } from "../list.js";
|
|
18
4
|
export var broadcasts;
|
|
19
5
|
(function (broadcasts) {
|
|
20
6
|
// CRUD: Create broadcast
|
|
@@ -34,7 +20,7 @@ export var broadcasts;
|
|
|
34
20
|
* ```
|
|
35
21
|
*/
|
|
36
22
|
async function list(collectionId, query = {}) {
|
|
37
|
-
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${
|
|
23
|
+
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${listQuery(query)}`;
|
|
38
24
|
return request(path);
|
|
39
25
|
}
|
|
40
26
|
broadcasts.list = list;
|
|
@@ -69,7 +55,7 @@ export var broadcasts;
|
|
|
69
55
|
* ```
|
|
70
56
|
*/
|
|
71
57
|
async function recipients(collectionId, id, query = {}) {
|
|
72
|
-
const qs =
|
|
58
|
+
const qs = listQuery(query);
|
|
73
59
|
const path = `/admin/collection/${encodeURIComponent(collectionId)}/broadcasts/${encodeURIComponent(id)}/recipients${qs}`;
|
|
74
60
|
return request(path);
|
|
75
61
|
}
|
package/dist/api/claimSet.d.ts
CHANGED
|
@@ -2,18 +2,23 @@ import { ClaimSetScope, ClaimSetRange, CreateClaimSetRangeRequest, UpdateClaimSe
|
|
|
2
2
|
import type { ListResult, ListOptions } from "../types/list.js";
|
|
3
3
|
export declare namespace claimSet {
|
|
4
4
|
/**
|
|
5
|
-
* Get all claim sets. Returns `{ items, nextCursor }`: the claim sets are in `items
|
|
6
|
-
*
|
|
5
|
+
* Get all claim sets, a page at a time. Returns `{ items, nextCursor }`: the claim sets are in `items`;
|
|
6
|
+
* pass `nextCursor` back as `cursor` for the next page (`null` means that was the last one).
|
|
7
7
|
* When collectionId is provided, returns claim sets for that collection.
|
|
8
8
|
* When omitted, returns all claim sets owned by the authenticated user.
|
|
9
9
|
* @param collectionId – Optional collection identifier
|
|
10
|
+
* @param options – `limit` (default 50) and `cursor`
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
13
|
* ```typescript
|
|
13
|
-
*
|
|
14
|
+
* let page = await claimSet.getAll('coll_123', { limit: 50 })
|
|
15
|
+
* while (page.nextCursor) page = await claimSet.getAll('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
16
|
+
*
|
|
17
|
+
* // Your own claim sets (no collection)
|
|
18
|
+
* const { items } = await claimSet.getAll(undefined, { limit: 50 })
|
|
14
19
|
* ```
|
|
15
20
|
*/
|
|
16
|
-
function getAll(collectionId?: string): Promise<ListResult<any>>;
|
|
21
|
+
function getAll(collectionId?: string, options?: ListOptions): Promise<ListResult<any>>;
|
|
17
22
|
/**
|
|
18
23
|
* Get a specific claim set by ID.
|
|
19
24
|
* @param claimSetId – The claim set identifier
|
|
@@ -52,17 +57,22 @@ export declare namespace claimSet {
|
|
|
52
57
|
/**
|
|
53
58
|
* Get assigned tags for a claim set — tags soft-assigned to a collection or product. Returns
|
|
54
59
|
* `{ items, nextCursor }` with the claim set's own fields (`id`, `name`, …) beside them: the tags are
|
|
55
|
-
* in `items
|
|
60
|
+
* in `items`, a page at a time. Pass `nextCursor` back as `cursor` for the next page (`null` means that
|
|
61
|
+
* was the last one).
|
|
56
62
|
* @param claimSetId – The claim set identifier
|
|
57
63
|
* @param collectionId – Optional collection identifier; omit for user-scoped access
|
|
64
|
+
* @param options – `limit` (default 50) and `cursor`
|
|
58
65
|
*
|
|
59
66
|
* @example
|
|
60
67
|
* ```typescript
|
|
61
|
-
*
|
|
62
|
-
* console.log(
|
|
68
|
+
* let page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50 })
|
|
69
|
+
* console.log(`Assigned tags of ${page.name}:`, page.items)
|
|
70
|
+
* while (page.nextCursor) {
|
|
71
|
+
* page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50, cursor: page.nextCursor })
|
|
72
|
+
* }
|
|
63
73
|
* ```
|
|
64
74
|
*/
|
|
65
|
-
function getAssignedTags(claimSetId: string, collectionId?: string): Promise<ListResult<any> & Record<string, any>>;
|
|
75
|
+
function getAssignedTags(claimSetId: string, collectionId?: string, options?: ListOptions): Promise<ListResult<any> & Record<string, any>>;
|
|
66
76
|
/**
|
|
67
77
|
* Create a single tag inside a claim set.
|
|
68
78
|
* @param claimSetId – The claim set identifier
|
|
@@ -114,15 +124,19 @@ export declare namespace claimSet {
|
|
|
114
124
|
function updateClaimData(collectionId: string, data: UpdateClaimDataRequest): Promise<any>;
|
|
115
125
|
namespace ranges {
|
|
116
126
|
/**
|
|
117
|
-
* The ranges in a set, lowest index first
|
|
118
|
-
*
|
|
127
|
+
* The ranges in a set, lowest index first, a page at a time (50 unless you give a `limit`). Returns
|
|
128
|
+
* `{ items, nextCursor }`: the ranges are in `items`; pass `nextCursor` back as `cursor` for the next
|
|
129
|
+
* page (`null` means that was the last one).
|
|
119
130
|
*
|
|
120
131
|
* @example
|
|
121
132
|
* ```typescript
|
|
122
|
-
*
|
|
133
|
+
* let page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50 })
|
|
134
|
+
* while (page.nextCursor) {
|
|
135
|
+
* page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50, cursor: page.nextCursor })
|
|
136
|
+
* }
|
|
123
137
|
* ```
|
|
124
138
|
*/
|
|
125
|
-
function list(scope: ClaimSetScope, claimSetId: string): Promise<ListResult<ClaimSetRange>>;
|
|
139
|
+
function list(scope: ClaimSetScope, claimSetId: string, options?: ListOptions): Promise<ListResult<ClaimSetRange>>;
|
|
126
140
|
/** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
|
|
127
141
|
function create(scope: ClaimSetScope, claimSetId: string, params: CreateClaimSetRangeRequest): Promise<ClaimSetRange>;
|
|
128
142
|
/** One range, with its counts refreshed. */
|
package/dist/api/claimSet.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { request, post, put, patch, del } from "../http.js";
|
|
2
|
+
import { listQuery } from "../list.js";
|
|
2
3
|
/**
|
|
3
4
|
* Returns the base path for claim set endpoints.
|
|
4
5
|
* When collectionId is provided, routes to the collection-scoped admin API.
|
|
@@ -19,19 +20,24 @@ function rangesBase(scope, claimSetId) {
|
|
|
19
20
|
export var claimSet;
|
|
20
21
|
(function (claimSet) {
|
|
21
22
|
/**
|
|
22
|
-
* Get all claim sets. Returns `{ items, nextCursor }`: the claim sets are in `items
|
|
23
|
-
*
|
|
23
|
+
* Get all claim sets, a page at a time. Returns `{ items, nextCursor }`: the claim sets are in `items`;
|
|
24
|
+
* pass `nextCursor` back as `cursor` for the next page (`null` means that was the last one).
|
|
24
25
|
* When collectionId is provided, returns claim sets for that collection.
|
|
25
26
|
* When omitted, returns all claim sets owned by the authenticated user.
|
|
26
27
|
* @param collectionId – Optional collection identifier
|
|
28
|
+
* @param options – `limit` (default 50) and `cursor`
|
|
27
29
|
*
|
|
28
30
|
* @example
|
|
29
31
|
* ```typescript
|
|
30
|
-
*
|
|
32
|
+
* let page = await claimSet.getAll('coll_123', { limit: 50 })
|
|
33
|
+
* while (page.nextCursor) page = await claimSet.getAll('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
34
|
+
*
|
|
35
|
+
* // Your own claim sets (no collection)
|
|
36
|
+
* const { items } = await claimSet.getAll(undefined, { limit: 50 })
|
|
31
37
|
* ```
|
|
32
38
|
*/
|
|
33
|
-
async function getAll(collectionId) {
|
|
34
|
-
return request(base(collectionId));
|
|
39
|
+
async function getAll(collectionId, options = {}) {
|
|
40
|
+
return request(`${base(collectionId)}${listQuery({ limit: options.limit, cursor: options.cursor })}`);
|
|
35
41
|
}
|
|
36
42
|
claimSet.getAll = getAll;
|
|
37
43
|
/**
|
|
@@ -87,18 +93,23 @@ export var claimSet;
|
|
|
87
93
|
/**
|
|
88
94
|
* Get assigned tags for a claim set — tags soft-assigned to a collection or product. Returns
|
|
89
95
|
* `{ items, nextCursor }` with the claim set's own fields (`id`, `name`, …) beside them: the tags are
|
|
90
|
-
* in `items
|
|
96
|
+
* in `items`, a page at a time. Pass `nextCursor` back as `cursor` for the next page (`null` means that
|
|
97
|
+
* was the last one).
|
|
91
98
|
* @param claimSetId – The claim set identifier
|
|
92
99
|
* @param collectionId – Optional collection identifier; omit for user-scoped access
|
|
100
|
+
* @param options – `limit` (default 50) and `cursor`
|
|
93
101
|
*
|
|
94
102
|
* @example
|
|
95
103
|
* ```typescript
|
|
96
|
-
*
|
|
97
|
-
* console.log(
|
|
104
|
+
* let page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50 })
|
|
105
|
+
* console.log(`Assigned tags of ${page.name}:`, page.items)
|
|
106
|
+
* while (page.nextCursor) {
|
|
107
|
+
* page = await claimSet.getAssignedTags('12', 'coll_123', { limit: 50, cursor: page.nextCursor })
|
|
108
|
+
* }
|
|
98
109
|
* ```
|
|
99
110
|
*/
|
|
100
|
-
async function getAssignedTags(claimSetId, collectionId) {
|
|
101
|
-
return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/assignedTags`);
|
|
111
|
+
async function getAssignedTags(claimSetId, collectionId, options = {}) {
|
|
112
|
+
return request(`${base(collectionId)}/${encodeURIComponent(claimSetId)}/assignedTags${listQuery({ limit: options.limit, cursor: options.cursor })}`);
|
|
102
113
|
}
|
|
103
114
|
claimSet.getAssignedTags = getAssignedTags;
|
|
104
115
|
/**
|
|
@@ -182,16 +193,20 @@ export var claimSet;
|
|
|
182
193
|
let ranges;
|
|
183
194
|
(function (ranges) {
|
|
184
195
|
/**
|
|
185
|
-
* The ranges in a set, lowest index first
|
|
186
|
-
*
|
|
196
|
+
* The ranges in a set, lowest index first, a page at a time (50 unless you give a `limit`). Returns
|
|
197
|
+
* `{ items, nextCursor }`: the ranges are in `items`; pass `nextCursor` back as `cursor` for the next
|
|
198
|
+
* page (`null` means that was the last one).
|
|
187
199
|
*
|
|
188
200
|
* @example
|
|
189
201
|
* ```typescript
|
|
190
|
-
*
|
|
202
|
+
* let page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50 })
|
|
203
|
+
* while (page.nextCursor) {
|
|
204
|
+
* page = await claimSet.ranges.list({ collectionId: 'coll_123' }, '12', { limit: 50, cursor: page.nextCursor })
|
|
205
|
+
* }
|
|
191
206
|
* ```
|
|
192
207
|
*/
|
|
193
|
-
async function list(scope, claimSetId) {
|
|
194
|
-
return request(rangesBase(scope, claimSetId));
|
|
208
|
+
async function list(scope, claimSetId, options = {}) {
|
|
209
|
+
return request(`${rangesBase(scope, claimSetId)}${listQuery({ limit: options.limit, cursor: options.cursor })}`);
|
|
195
210
|
}
|
|
196
211
|
ranges.list = list;
|
|
197
212
|
/** Reserve the set's next indexes and mint a code (and, for NTAG 424, a key) for each. */
|
|
@@ -243,15 +258,8 @@ export var claimSet;
|
|
|
243
258
|
* ```
|
|
244
259
|
*/
|
|
245
260
|
async function tags(scope, claimSetId, rangeId, options = {}) {
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
q.set('limit', String(options.limit));
|
|
249
|
-
if (options.cursor)
|
|
250
|
-
q.set('cursor', options.cursor);
|
|
251
|
-
if (options.keys)
|
|
252
|
-
q.set('keys', '1');
|
|
253
|
-
const qs = q.toString();
|
|
254
|
-
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags${qs ? `?${qs}` : ''}`);
|
|
261
|
+
const qs = listQuery({ limit: options.limit, cursor: options.cursor, keys: options.keys ? '1' : undefined });
|
|
262
|
+
return request(`${rangesBase(scope, claimSetId)}/${encodeURIComponent(rangeId)}/tags${qs}`);
|
|
255
263
|
}
|
|
256
264
|
ranges.tags = tags;
|
|
257
265
|
/** The next tag to program on a phone (lowest index without a chip), with its URL and key. */
|
package/dist/api/collection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CollectionResponse, CollectionCreateRequest, CollectionUpdateRequest, AppsConfigResponse, DomainTarget, HubAvailabilityResponse, CollectionUser, CollectionAccessLevel, InviteUserInput, CollectionReadiness } from "../types/collection.js";
|
|
2
|
-
import type { ListResult } from "../types/list.js";
|
|
2
|
+
import type { ListResult, ListOptions } from "../types/list.js";
|
|
3
3
|
export declare namespace collection {
|
|
4
4
|
/**
|
|
5
5
|
* What the collection's installed apps need and whether it's there (sign-in, customers, products,
|
|
@@ -17,18 +17,21 @@ export declare namespace collection {
|
|
|
17
17
|
*/
|
|
18
18
|
function get(collectionId: string, admin?: boolean): Promise<CollectionResponse>;
|
|
19
19
|
/**
|
|
20
|
-
* The collections the signed-in user can work on (admin)
|
|
21
|
-
*
|
|
20
|
+
* The collections the signed-in user can work on (admin), a page at a time. Page with `limit`
|
|
21
|
+
* (50 unless you say) and `cursor`. There is no public list of collections: read one with
|
|
22
|
+
* `collection.get`.
|
|
23
|
+
* @param options - `limit` and `cursor`
|
|
22
24
|
* @returns Promise resolving to `{ items, nextCursor }`, where `items` are CollectionResponse objects
|
|
23
25
|
* @throws ErrorResponse if the request fails
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* ```typescript
|
|
27
|
-
*
|
|
28
|
-
* items.forEach(c => console.log(c.id, c.title))
|
|
29
|
+
* let page = await collection.list({ limit: 50 })
|
|
30
|
+
* page.items.forEach(c => console.log(c.id, c.title))
|
|
31
|
+
* while (page.nextCursor) page = await collection.list({ limit: 50, cursor: page.nextCursor })
|
|
29
32
|
* ```
|
|
30
33
|
*/
|
|
31
|
-
function list(): Promise<ListResult<CollectionResponse>>;
|
|
34
|
+
function list(options?: ListOptions): Promise<ListResult<CollectionResponse>>;
|
|
32
35
|
/**
|
|
33
36
|
* Retrieve a collection by its shortId (public endpoint).
|
|
34
37
|
* @param shortId – The short identifier of the collection
|
|
@@ -197,18 +200,20 @@ export declare namespace collection {
|
|
|
197
200
|
/**
|
|
198
201
|
* List the users with access to a collection, each with their access level (admin only). Access is
|
|
199
202
|
* stored in the collection's `roles` map (userId → level); this resolves each to name/email.
|
|
200
|
-
*
|
|
203
|
+
* A page at a time: page with `limit` (50 unless you say) and `cursor`.
|
|
201
204
|
* GET /admin/collection/:collectionId/getUsers
|
|
202
205
|
* @param collectionId - Identifier of the collection
|
|
206
|
+
* @param options - `limit` and `cursor`
|
|
203
207
|
* @returns Promise resolving to `{ items, nextCursor }`, where `items` are the collection's users
|
|
204
208
|
*
|
|
205
209
|
* @example
|
|
206
210
|
* ```typescript
|
|
207
|
-
*
|
|
208
|
-
*
|
|
211
|
+
* let page = await collection.getUsers('coll_123', { limit: 50 })
|
|
212
|
+
* page.items.forEach(u => console.log(u.email, u.access))
|
|
213
|
+
* while (page.nextCursor) page = await collection.getUsers('coll_123', { limit: 50, cursor: page.nextCursor })
|
|
209
214
|
* ```
|
|
210
215
|
*/
|
|
211
|
-
function getUsers(collectionId: string): Promise<ListResult<CollectionUser>>;
|
|
216
|
+
function getUsers(collectionId: string, options?: ListOptions): Promise<ListResult<CollectionUser>>;
|
|
212
217
|
/**
|
|
213
218
|
* Grant, change, or remove a user's access level on a collection (admin only). Pass `null` or
|
|
214
219
|
* `'None'` to remove access. The server enforces privilege-escalation rules — you cannot grant an
|