@proveanything/smartlinks 2.2.1 → 3.0.0-alpha.0
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 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/adminCards.d.ts +8 -0
- package/dist/api/adminCards.js +9 -1
- package/dist/api/ai.d.ts +22 -11
- package/dist/api/ai.js +18 -14
- package/dist/api/analytics.d.ts +13 -0
- package/dist/api/analytics.js +13 -0
- package/dist/api/appConfiguration.d.ts +17 -14
- package/dist/api/appConfiguration.js +14 -12
- package/dist/api/appObjects.d.ts +80 -16
- package/dist/api/appObjects.js +74 -11
- package/dist/api/asset.d.ts +55 -19
- package/dist/api/asset.js +52 -32
- package/dist/api/attestation.d.ts +3 -2
- package/dist/api/attestation.js +1 -1
- package/dist/api/attestations.d.ts +22 -7
- package/dist/api/attestations.js +22 -7
- package/dist/api/authKit.d.ts +22 -5
- package/dist/api/authKit.js +21 -4
- package/dist/api/batch.d.ts +23 -16
- package/dist/api/batch.js +19 -13
- package/dist/api/bookings.d.ts +45 -9
- package/dist/api/bookings.js +39 -3
- package/dist/api/broadcasts.d.ts +26 -6
- package/dist/api/broadcasts.js +22 -2
- package/dist/api/claimSet.d.ts +48 -13
- package/dist/api/claimSet.js +43 -7
- package/dist/api/collection.d.ts +20 -6
- package/dist/api/collection.js +19 -8
- package/dist/api/comms.d.ts +43 -12
- package/dist/api/comms.js +43 -13
- package/dist/api/conditions.d.ts +12 -2
- package/dist/api/conditions.js +10 -1
- package/dist/api/config.d.ts +15 -2
- package/dist/api/config.js +12 -0
- package/dist/api/contact.d.ts +34 -13
- package/dist/api/contact.js +35 -10
- package/dist/api/containers.d.ts +41 -23
- package/dist/api/containers.js +37 -21
- package/dist/api/crate.d.ts +9 -8
- package/dist/api/crate.js +8 -8
- package/dist/api/dpp.d.ts +58 -10
- package/dist/api/dpp.js +57 -15
- package/dist/api/facets.d.ts +71 -0
- package/dist/api/facets.js +71 -0
- package/dist/api/files.d.ts +11 -5
- package/dist/api/files.js +9 -1
- package/dist/api/form.d.ts +9 -2
- package/dist/api/form.js +7 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/api/integrations.d.ts +82 -27
- package/dist/api/integrations.js +63 -7
- package/dist/api/interactions.d.ts +42 -6
- package/dist/api/interactions.js +41 -5
- package/dist/api/jobs.d.ts +9 -2
- package/dist/api/jobs.js +6 -0
- package/dist/api/journeys.d.ts +13 -2
- package/dist/api/journeys.js +10 -1
- package/dist/api/journeysAnalytics.d.ts +12 -3
- package/dist/api/journeysAnalytics.js +9 -1
- package/dist/api/knowledge.d.ts +43 -10
- package/dist/api/knowledge.js +37 -5
- package/dist/api/location.d.ts +10 -3
- package/dist/api/location.js +7 -1
- package/dist/api/lots.d.ts +40 -13
- package/dist/api/lots.js +38 -8
- package/dist/api/loyalty.d.ts +70 -12
- package/dist/api/loyalty.js +60 -3
- package/dist/api/nfc.d.ts +8 -2
- package/dist/api/nfc.js +6 -1
- package/dist/api/order.d.ts +51 -160
- package/dist/api/order.js +46 -208
- package/dist/api/partner.d.ts +41 -8
- package/dist/api/partner.js +36 -4
- package/dist/api/products.d.ts +41 -8
- package/dist/api/products.js +33 -4
- package/dist/api/proof.d.ts +50 -13
- package/dist/api/proof.js +43 -7
- package/dist/api/realtime.d.ts +1 -11
- package/dist/api/realtime.js +1 -22
- package/dist/api/secrets.d.ts +25 -5
- package/dist/api/secrets.js +21 -2
- package/dist/api/segments.d.ts +26 -6
- package/dist/api/segments.js +22 -2
- package/dist/api/serviceAccounts.d.ts +8 -1
- package/dist/api/serviceAccounts.js +8 -1
- package/dist/api/shop.d.ts +41 -13
- package/dist/api/shop.js +35 -4
- package/dist/api/subscriptions.d.ts +47 -12
- package/dist/api/subscriptions.js +40 -4
- package/dist/api/tags.d.ts +40 -19
- package/dist/api/tags.js +38 -18
- package/dist/api/template.d.ts +31 -3
- package/dist/api/template.js +27 -0
- package/dist/api/translations.d.ts +17 -2
- package/dist/api/translations.js +14 -0
- package/dist/api/userGroups.d.ts +35 -9
- package/dist/api/userGroups.js +30 -5
- package/dist/api/variant.d.ts +11 -3
- package/dist/api/variant.js +9 -2
- package/dist/api/wallet.d.ts +23 -10
- package/dist/api/wallet.js +20 -2
- package/dist/apiVersion.d.ts +1 -1
- package/dist/apiVersion.js +1 -1
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +1389 -2298
- package/dist/docs/PRODUCT_FACETS_SDK.md +10 -15
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/admin-lists-and-pickers.md +1 -1
- 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 +3 -2
- package/dist/docs/api-versions.md +85 -76
- 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 +38 -50
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assets.md +17 -3
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/attestations.md +5 -4
- package/dist/docs/auth-kit.md +1 -1
- package/dist/docs/bookings.md +442 -442
- package/dist/docs/comms.md +689 -686
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/contact-search.md +4 -3
- package/dist/docs/container-tracking.md +7 -7
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- 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/executor.md +1 -1
- package/dist/docs/files.md +69 -69
- package/dist/docs/forms.md +1 -1
- package/dist/docs/headless-providers.md +3 -3
- package/dist/docs/host-dependency-contract.md +252 -210
- package/dist/docs/i18n.md +292 -46
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +544 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +105 -102
- package/dist/docs/lists.md +114 -0
- package/dist/docs/lots.md +112 -111
- package/dist/docs/loyalty.md +348 -352
- package/dist/docs/members.md +183 -183
- package/dist/docs/memberships.md +150 -149
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +485 -485
- package/dist/docs/proof-claiming-methods.md +6 -6
- 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 +139 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/server-functions.md +2 -2
- package/dist/docs/service-accounts.md +64 -64
- package/dist/docs/shop.md +4 -2
- package/dist/docs/site-seo.md +2 -1
- package/dist/docs/standard-query.md +187 -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/translations.md +6 -1
- package/dist/docs/upgrading-to-3.md +430 -0
- package/dist/docs/user-groups.md +4 -4
- package/dist/docs/utils.md +1 -1
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/headless.d.ts +1 -1
- package/dist/headless.js +2 -2
- package/dist/http.d.ts +15 -2
- package/dist/http.js +60 -2
- package/dist/i18n.d.ts +2 -14
- package/dist/i18n.js +6 -23
- package/dist/index.d.ts +7 -8
- package/dist/index.js +2 -0
- package/dist/list.d.ts +24 -0
- package/dist/list.js +80 -0
- package/dist/mobile-admin/types.d.ts +0 -16
- package/dist/openapi.yaml +290 -2723
- package/dist/shared-dependencies.d.ts +3 -3
- package/dist/shared-dependencies.js +13 -5
- package/dist/site.d.ts +1 -7
- package/dist/site.js +1 -14
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/adminCards.d.ts +6 -3
- package/dist/types/ai.d.ts +0 -6
- package/dist/types/analytics.d.ts +5 -8
- package/dist/types/appManifest.d.ts +4 -5
- package/dist/types/appObjects.d.ts +14 -18
- package/dist/types/appObjects.js +0 -1
- package/dist/types/appOptions.d.ts +18 -0
- package/dist/types/asset.d.ts +3 -22
- package/dist/types/attestations.d.ts +7 -10
- package/dist/types/batch.d.ts +6 -14
- package/dist/types/bookings.d.ts +22 -4
- package/dist/types/broadcasts.d.ts +5 -13
- package/dist/types/broadcasts.js +0 -1
- package/dist/types/claimSet.d.ts +0 -5
- package/dist/types/comms.d.ts +11 -9
- package/dist/types/contact.d.ts +5 -29
- package/dist/types/contact.js +0 -13
- package/dist/types/containers.d.ts +15 -26
- package/dist/types/crate.d.ts +4 -12
- package/dist/types/dpp.d.ts +3 -3
- package/dist/types/dpp.js +0 -1
- package/dist/types/error.d.ts +8 -5
- package/dist/types/error.js +12 -5
- package/dist/types/facets.d.ts +15 -15
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/integrations.d.ts +3 -28
- package/dist/types/interaction.d.ts +3 -9
- package/dist/types/jobs.d.ts +3 -8
- package/dist/types/jobs.js +0 -1
- package/dist/types/journeys.d.ts +3 -8
- package/dist/types/journeys.js +0 -1
- package/dist/types/journeysAnalytics.d.ts +0 -1
- package/dist/types/list.d.ts +24 -0
- package/dist/types/list.js +2 -0
- package/dist/types/location.d.ts +0 -4
- package/dist/types/lots.d.ts +0 -9
- package/dist/types/loyalty.d.ts +0 -9
- package/dist/types/order.d.ts +7 -134
- package/dist/types/product.d.ts +11 -24
- package/dist/types/proof.d.ts +16 -0
- package/dist/types/realtime.d.ts +0 -29
- package/dist/types/segments.d.ts +5 -13
- package/dist/types/segments.js +0 -1
- package/dist/types/serviceAccounts.d.ts +3 -2
- package/dist/types/serviceAccounts.js +0 -1
- package/dist/types/shop.d.ts +5 -12
- package/dist/types/shop.js +0 -4
- package/dist/types/subscriptions.d.ts +18 -0
- package/dist/types/subscriptions.js +0 -8
- package/dist/types/tags.d.ts +6 -16
- package/dist/types/tags.js +0 -7
- package/dist/types/translations.d.ts +3 -9
- package/dist/types/variant.d.ts +0 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1389 -2298
- package/docs/PRODUCT_FACETS_SDK.md +10 -15
- package/docs/admin-cards.md +189 -189
- package/docs/admin-lists-and-pickers.md +1 -1
- 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 +3 -2
- package/docs/api-versions.md +85 -76
- 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 +38 -50
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assets.md +17 -3
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/attestations.md +5 -4
- package/docs/auth-kit.md +1 -1
- package/docs/bookings.md +442 -442
- package/docs/comms.md +689 -686
- package/docs/connectors.md +340 -340
- package/docs/contact-search.md +4 -3
- package/docs/container-tracking.md +7 -7
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/dpp.md +115 -115
- package/docs/entitlements.md +90 -90
- package/docs/executor.md +1 -1
- package/docs/files.md +69 -69
- package/docs/forms.md +1 -1
- package/docs/headless-providers.md +3 -3
- package/docs/host-dependency-contract.md +252 -210
- package/docs/i18n.md +292 -46
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +544 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +105 -102
- package/docs/lists.md +114 -0
- package/docs/lots.md +112 -111
- package/docs/loyalty.md +348 -352
- package/docs/members.md +183 -183
- package/docs/memberships.md +150 -149
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +485 -485
- package/docs/proof-claiming-methods.md +6 -6
- 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 +139 -138
- package/docs/server-functions.md +2 -2
- package/docs/service-accounts.md +64 -64
- package/docs/shop.md +4 -2
- package/docs/site-seo.md +2 -1
- package/docs/standard-query.md +187 -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/translations.md +6 -1
- package/docs/upgrading-to-3.md +430 -0
- package/docs/user-groups.md +4 -4
- package/docs/utils.md +1 -1
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +290 -2723
- package/package.json +91 -87
- 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 +512 -0
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
- package/scripts/upgrade.mjs +56 -0
- package/upgrade/3.json +2213 -0
package/dist/api/appObjects.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ListResult } from "../types/list.js";
|
|
3
|
+
import type { AppCase, CreateCaseInput, UpdateCaseInput, AppendHistoryInput, CaseSummaryRequest, CaseSummaryResponse, CaseListQueryParams, AppThread, CreateThreadInput, UpdateThreadInput, ReplyInput, ThreadListQueryParams, AppRecord, CreateRecordInput, CreateRecordResponse, UpdateRecordInput, UpsertRecordInput, UpsertRecordResponse, MatchRecordsInput, MatchResult, BulkUpsertItem, BulkUpsertResult, BulkDeleteResult, BulkDeleteInput, RecordListQueryParams, ResolveAllParams, ResolveAllResult, PreviewRuleParams, PreviewRuleResult, AggregateRequest, AggregateResponse, RelatedResponse } from '../types/appObjects.js';
|
|
3
4
|
export declare namespace app {
|
|
4
5
|
/**
|
|
5
6
|
* Pickers: the small, cached list behind "pick a machine" or "pick a hold reason".
|
|
@@ -10,12 +11,21 @@ export declare namespace app {
|
|
|
10
11
|
* `source` = `type:<record type or declared type id>` | `list:<list id>`. Admins (`admin: true`)
|
|
11
12
|
* see every entry; the public API lists public records and lists the app declares public. Hold on
|
|
12
13
|
* to `version` and pass it back to get `{ unchanged: true }` when nothing changed.
|
|
14
|
+
*
|
|
15
|
+
* Returns `{ items, nextCursor, count?, version, mode }`: the entries are in `items`, already sorted.
|
|
16
|
+
* A picker is not paged, so `nextCursor` is always `null`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const res = await app.options.get(collectionId, appId, 'type:machine', { admin: true })
|
|
21
|
+
* if (!res.unchanged) { options = res.items; version = res.version }
|
|
22
|
+
* ```
|
|
13
23
|
*/
|
|
14
24
|
function get(collectionId: string, appId: string, source: string, opts?: {
|
|
15
25
|
q?: string;
|
|
16
26
|
version?: string;
|
|
17
27
|
admin?: boolean;
|
|
18
|
-
}): Promise<import('../types/appOptions.js').
|
|
28
|
+
}): Promise<import('../types/appOptions.js').AppOptionsList>;
|
|
19
29
|
/**
|
|
20
30
|
* Save a value list's values, in order (admins). Codes never change and are never lost: a value left
|
|
21
31
|
* out stays, switched off, at the end. → the list as saved.
|
|
@@ -31,8 +41,22 @@ export declare namespace app {
|
|
|
31
41
|
/**
|
|
32
42
|
* List cases with optional query parameters
|
|
33
43
|
* GET /cases
|
|
44
|
+
*
|
|
45
|
+
* Returns `{ items, nextCursor, count }`: the cases are in `items`, `count` is how many match in
|
|
46
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
47
|
+
* `includeDeleted`, `contactId` and `assignedTo` are for admin calls (`admin = true`) only: the
|
|
48
|
+
* public list refuses a parameter it does not read.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* let page = await app.cases.list(collectionId, appId, { status: 'open', limit: 50 })
|
|
53
|
+
* console.log(page.items, page.count)
|
|
54
|
+
* while (page.nextCursor) {
|
|
55
|
+
* page = await app.cases.list(collectionId, appId, { status: 'open', limit: 50, cursor: page.nextCursor })
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
34
58
|
*/
|
|
35
|
-
function list(collectionId: string, appId: string, params?: CaseListQueryParams, admin?: boolean): Promise<
|
|
59
|
+
function list(collectionId: string, appId: string, params?: CaseListQueryParams, admin?: boolean): Promise<ListResult<AppCase>>;
|
|
36
60
|
/**
|
|
37
61
|
* Get a single case by ID
|
|
38
62
|
* GET /cases/:caseId
|
|
@@ -81,8 +105,22 @@ export declare namespace app {
|
|
|
81
105
|
/**
|
|
82
106
|
* List threads with optional query parameters
|
|
83
107
|
* GET /threads
|
|
108
|
+
*
|
|
109
|
+
* Returns `{ items, nextCursor, count }`: the threads are in `items`, `count` is how many match in
|
|
110
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
111
|
+
* `includeDeleted` and `contactId` are for admin calls (`admin = true`) only: the public list
|
|
112
|
+
* refuses a parameter it does not read.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* let page = await app.threads.list(collectionId, appId, { parentType: 'case', parentId: caseId, limit: 50 })
|
|
117
|
+
* console.log(page.items, page.count)
|
|
118
|
+
* while (page.nextCursor) {
|
|
119
|
+
* page = await app.threads.list(collectionId, appId, { parentType: 'case', parentId: caseId, limit: 50, cursor: page.nextCursor })
|
|
120
|
+
* }
|
|
121
|
+
* ```
|
|
84
122
|
*/
|
|
85
|
-
function list(collectionId: string, appId: string, params?: ThreadListQueryParams, admin?: boolean): Promise<
|
|
123
|
+
function list(collectionId: string, appId: string, params?: ThreadListQueryParams, admin?: boolean): Promise<ListResult<AppThread>>;
|
|
86
124
|
/**
|
|
87
125
|
* Get a single thread by ID
|
|
88
126
|
* GET /threads/:threadId
|
|
@@ -160,11 +198,25 @@ export declare namespace app {
|
|
|
160
198
|
/**
|
|
161
199
|
* List records with optional query parameters
|
|
162
200
|
* GET /records
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
201
|
+
*
|
|
202
|
+
* Returns `{ items, nextCursor, count }`: the records are in `items`, `count` is how many match in
|
|
203
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
204
|
+
*
|
|
205
|
+
* Public/owner callers only receive records with `status: "active"`.
|
|
206
|
+
* Admin callers can query all statuses (for example `draft`/`archived`).
|
|
207
|
+
* `qFields`, `dataFilter`, `contactId` and `includeDeleted` are for admin calls (`admin = true`)
|
|
208
|
+
* only: the public list refuses a parameter it does not read.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* let page = await app.records.list(collectionId, appId, { recordType: 'tip', limit: 100 })
|
|
213
|
+
* console.log(page.items, page.count)
|
|
214
|
+
* while (page.nextCursor) {
|
|
215
|
+
* page = await app.records.list(collectionId, appId, { recordType: 'tip', limit: 100, cursor: page.nextCursor })
|
|
216
|
+
* }
|
|
217
|
+
* ```
|
|
166
218
|
*/
|
|
167
|
-
function list(collectionId: string, appId: string, params?: RecordListQueryParams, admin?: boolean): Promise<
|
|
219
|
+
function list(collectionId: string, appId: string, params?: RecordListQueryParams, admin?: boolean): Promise<ListResult<AppRecord>>;
|
|
168
220
|
/**
|
|
169
221
|
* Get a single record by ID
|
|
170
222
|
* GET /records/:recordId
|
|
@@ -248,20 +300,21 @@ export declare namespace app {
|
|
|
248
300
|
function upsert(collectionId: string, appId: string, input: UpsertRecordInput): Promise<UpsertRecordResponse>;
|
|
249
301
|
/**
|
|
250
302
|
* Match records against a runtime target scope.
|
|
251
|
-
* Returns records whose scope is satisfied
|
|
252
|
-
*
|
|
303
|
+
* Returns `{ items, nextCursor, count, strategy }`: `items` are the records whose scope is satisfied
|
|
304
|
+
* by the target, most specific first, and `count` is how many matched. It is not paged
|
|
305
|
+
* (`nextCursor` is always `null`); cap the answer with `limit`.
|
|
253
306
|
* POST /records/match
|
|
254
307
|
*
|
|
255
|
-
|
|
308
|
+
* @param admin - false for public endpoint (visibility-filtered, active-only), true for admin
|
|
256
309
|
*
|
|
257
310
|
* @example
|
|
258
311
|
* ```ts
|
|
259
|
-
* const {
|
|
312
|
+
* const { items } = await app.records.match(collectionId, appId, {
|
|
260
313
|
* target: { productId: 'prod_abc', facets: { tier: ['gold'] } },
|
|
261
314
|
* strategy: 'best',
|
|
262
315
|
* recordType: 'nutrition',
|
|
263
316
|
* }, true);
|
|
264
|
-
*
|
|
317
|
+
* const best = items[0] // the single highest-specificity nutrition record
|
|
265
318
|
* ```
|
|
266
319
|
*/
|
|
267
320
|
function match(collectionId: string, appId: string, input: MatchRecordsInput, admin?: boolean): Promise<MatchResult>;
|
|
@@ -297,11 +350,22 @@ export declare namespace app {
|
|
|
297
350
|
function bulkDelete(collectionId: string, appId: string, input: BulkDeleteInput): Promise<BulkDeleteResult>;
|
|
298
351
|
/**
|
|
299
352
|
* Resolve every applicable record for a product context in one call.
|
|
300
|
-
* Returns
|
|
301
|
-
* deduplicated and sorted by
|
|
353
|
+
* Returns `{ items, nextCursor, count, context, truncated }`: `items` are the records across all
|
|
354
|
+
* tiers (proof, batch, variant, product, rule, facet, collection), deduplicated and sorted by
|
|
355
|
+
* specificity descending, each as `{ record, matchedAt, specificity }`. It is not paged
|
|
356
|
+
* (`nextCursor` is always `null`); `truncated` says the answer was cut at `limit`.
|
|
302
357
|
* POST /records/resolve-all
|
|
303
358
|
*
|
|
304
|
-
|
|
359
|
+
* @param admin - false for public (visibility-filtered, active-only), true for admin (all statuses)
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```ts
|
|
363
|
+
* const { items, truncated } = await app.records.resolveAll(collectionId, appId, {
|
|
364
|
+
* context: { productId: 'prod_abc' },
|
|
365
|
+
* recordType: 'nutrition',
|
|
366
|
+
* })
|
|
367
|
+
* for (const { record, matchedAt } of items) console.log(matchedAt, record.data)
|
|
368
|
+
* ```
|
|
305
369
|
*/
|
|
306
370
|
function resolveAll(collectionId: string, appId: string, input: ResolveAllParams, admin?: boolean): Promise<ResolveAllResult>;
|
|
307
371
|
/**
|
package/dist/api/appObjects.js
CHANGED
|
@@ -13,6 +13,15 @@ export var app;
|
|
|
13
13
|
* `source` = `type:<record type or declared type id>` | `list:<list id>`. Admins (`admin: true`)
|
|
14
14
|
* see every entry; the public API lists public records and lists the app declares public. Hold on
|
|
15
15
|
* to `version` and pass it back to get `{ unchanged: true }` when nothing changed.
|
|
16
|
+
*
|
|
17
|
+
* Returns `{ items, nextCursor, count?, version, mode }`: the entries are in `items`, already sorted.
|
|
18
|
+
* A picker is not paged, so `nextCursor` is always `null`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const res = await app.options.get(collectionId, appId, 'type:machine', { admin: true })
|
|
23
|
+
* if (!res.unchanged) { options = res.items; version = res.version }
|
|
24
|
+
* ```
|
|
16
25
|
*/
|
|
17
26
|
async function get(collectionId, appId, source, opts = {}) {
|
|
18
27
|
const zone = opts.admin ? 'admin' : 'public';
|
|
@@ -56,6 +65,20 @@ export var app;
|
|
|
56
65
|
/**
|
|
57
66
|
* List cases with optional query parameters
|
|
58
67
|
* GET /cases
|
|
68
|
+
*
|
|
69
|
+
* Returns `{ items, nextCursor, count }`: the cases are in `items`, `count` is how many match in
|
|
70
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
71
|
+
* `includeDeleted`, `contactId` and `assignedTo` are for admin calls (`admin = true`) only: the
|
|
72
|
+
* public list refuses a parameter it does not read.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* let page = await app.cases.list(collectionId, appId, { status: 'open', limit: 50 })
|
|
77
|
+
* console.log(page.items, page.count)
|
|
78
|
+
* while (page.nextCursor) {
|
|
79
|
+
* page = await app.cases.list(collectionId, appId, { status: 'open', limit: 50, cursor: page.nextCursor })
|
|
80
|
+
* }
|
|
81
|
+
* ```
|
|
59
82
|
*/
|
|
60
83
|
async function list(collectionId, appId, params, admin = false) {
|
|
61
84
|
const path = basePath(collectionId, appId, admin);
|
|
@@ -150,6 +173,20 @@ export var app;
|
|
|
150
173
|
/**
|
|
151
174
|
* List threads with optional query parameters
|
|
152
175
|
* GET /threads
|
|
176
|
+
*
|
|
177
|
+
* Returns `{ items, nextCursor, count }`: the threads are in `items`, `count` is how many match in
|
|
178
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
179
|
+
* `includeDeleted` and `contactId` are for admin calls (`admin = true`) only: the public list
|
|
180
|
+
* refuses a parameter it does not read.
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* let page = await app.threads.list(collectionId, appId, { parentType: 'case', parentId: caseId, limit: 50 })
|
|
185
|
+
* console.log(page.items, page.count)
|
|
186
|
+
* while (page.nextCursor) {
|
|
187
|
+
* page = await app.threads.list(collectionId, appId, { parentType: 'case', parentId: caseId, limit: 50, cursor: page.nextCursor })
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
153
190
|
*/
|
|
154
191
|
async function list(collectionId, appId, params, admin = false) {
|
|
155
192
|
const path = basePath(collectionId, appId, admin);
|
|
@@ -275,9 +312,23 @@ export var app;
|
|
|
275
312
|
/**
|
|
276
313
|
* List records with optional query parameters
|
|
277
314
|
* GET /records
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
315
|
+
*
|
|
316
|
+
* Returns `{ items, nextCursor, count }`: the records are in `items`, `count` is how many match in
|
|
317
|
+
* all, and `nextCursor` is `null` on the last page. Page with `limit` and `cursor`.
|
|
318
|
+
*
|
|
319
|
+
* Public/owner callers only receive records with `status: "active"`.
|
|
320
|
+
* Admin callers can query all statuses (for example `draft`/`archived`).
|
|
321
|
+
* `qFields`, `dataFilter`, `contactId` and `includeDeleted` are for admin calls (`admin = true`)
|
|
322
|
+
* only: the public list refuses a parameter it does not read.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* let page = await app.records.list(collectionId, appId, { recordType: 'tip', limit: 100 })
|
|
327
|
+
* console.log(page.items, page.count)
|
|
328
|
+
* while (page.nextCursor) {
|
|
329
|
+
* page = await app.records.list(collectionId, appId, { recordType: 'tip', limit: 100, cursor: page.nextCursor })
|
|
330
|
+
* }
|
|
331
|
+
* ```
|
|
281
332
|
*/
|
|
282
333
|
async function list(collectionId, appId, params, admin = false) {
|
|
283
334
|
const path = basePath(collectionId, appId, admin);
|
|
@@ -394,20 +445,21 @@ export var app;
|
|
|
394
445
|
records_1.upsert = upsert;
|
|
395
446
|
/**
|
|
396
447
|
* Match records against a runtime target scope.
|
|
397
|
-
* Returns records whose scope is satisfied
|
|
398
|
-
*
|
|
448
|
+
* Returns `{ items, nextCursor, count, strategy }`: `items` are the records whose scope is satisfied
|
|
449
|
+
* by the target, most specific first, and `count` is how many matched. It is not paged
|
|
450
|
+
* (`nextCursor` is always `null`); cap the answer with `limit`.
|
|
399
451
|
* POST /records/match
|
|
400
452
|
*
|
|
401
|
-
|
|
453
|
+
* @param admin - false for public endpoint (visibility-filtered, active-only), true for admin
|
|
402
454
|
*
|
|
403
455
|
* @example
|
|
404
456
|
* ```ts
|
|
405
|
-
* const {
|
|
457
|
+
* const { items } = await app.records.match(collectionId, appId, {
|
|
406
458
|
* target: { productId: 'prod_abc', facets: { tier: ['gold'] } },
|
|
407
459
|
* strategy: 'best',
|
|
408
460
|
* recordType: 'nutrition',
|
|
409
461
|
* }, true);
|
|
410
|
-
*
|
|
462
|
+
* const best = items[0] // the single highest-specificity nutrition record
|
|
411
463
|
* ```
|
|
412
464
|
*/
|
|
413
465
|
async function match(collectionId, appId, input, admin = false) {
|
|
@@ -455,11 +507,22 @@ export var app;
|
|
|
455
507
|
records_1.bulkDelete = bulkDelete;
|
|
456
508
|
/**
|
|
457
509
|
* Resolve every applicable record for a product context in one call.
|
|
458
|
-
* Returns
|
|
459
|
-
* deduplicated and sorted by
|
|
510
|
+
* Returns `{ items, nextCursor, count, context, truncated }`: `items` are the records across all
|
|
511
|
+
* tiers (proof, batch, variant, product, rule, facet, collection), deduplicated and sorted by
|
|
512
|
+
* specificity descending, each as `{ record, matchedAt, specificity }`. It is not paged
|
|
513
|
+
* (`nextCursor` is always `null`); `truncated` says the answer was cut at `limit`.
|
|
460
514
|
* POST /records/resolve-all
|
|
461
515
|
*
|
|
462
|
-
|
|
516
|
+
* @param admin - false for public (visibility-filtered, active-only), true for admin (all statuses)
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```ts
|
|
520
|
+
* const { items, truncated } = await app.records.resolveAll(collectionId, appId, {
|
|
521
|
+
* context: { productId: 'prod_abc' },
|
|
522
|
+
* recordType: 'nutrition',
|
|
523
|
+
* })
|
|
524
|
+
* for (const { record, matchedAt } of items) console.log(matchedAt, record.data)
|
|
525
|
+
* ```
|
|
463
526
|
*/
|
|
464
527
|
async function resolveAll(collectionId, appId, input, admin = false) {
|
|
465
528
|
const path = `${basePath(collectionId, appId, admin)}/resolve-all`;
|
package/dist/api/asset.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ListResult } from "../types/list.js";
|
|
2
|
+
import { Asset, AssetResponse, UploadAssetOptions, UploadFromUrlOptions, ListAssetsOptions, GetAssetOptions, RemoveAssetOptions, AdminListAssetsOptions, UpdateAssetOptions, ReplaceAssetFileOptions, DeleteAssetOptions, BulkDeleteAssetsOptions, RequestUploadTokenOptions, UploadTokenResponse, PublicTokenUploadOptions, CreateResumableUploadOptions, ResumableUploadHandle } from "../types/asset.js";
|
|
2
3
|
export declare namespace asset {
|
|
3
4
|
/**
|
|
4
5
|
* Error type for asset uploads
|
|
@@ -43,28 +44,51 @@ export declare namespace asset {
|
|
|
43
44
|
*/
|
|
44
45
|
function uploadFromUrl(options: UploadFromUrlOptions): Promise<Asset>;
|
|
45
46
|
function getForCollection(collectionId: string, assetId: string): Promise<AssetResponse>;
|
|
46
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The collection's own assets (public). Returns `{ items, nextCursor }`: the assets are in `items`.
|
|
49
|
+
* The list is not paged, so `nextCursor` is always `null`.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const { items } = await asset.listForCollection('my-collection')
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
function listForCollection(collectionId: string): Promise<ListResult<AssetResponse>>;
|
|
47
57
|
function getForProduct(collectionId: string, productId: string, assetId: string): Promise<AssetResponse>;
|
|
48
|
-
|
|
58
|
+
/**
|
|
59
|
+
* A product's assets (public). Returns `{ items, nextCursor }`: the assets are in `items`.
|
|
60
|
+
* The list is not paged, so `nextCursor` is always `null`.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const { items } = await asset.listForProduct('my-collection', 'wine-bottle')
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
function listForProduct(collectionId: string, productId: string): Promise<ListResult<AssetResponse>>;
|
|
49
68
|
function getForProof(collectionId: string, productId: string, proofId: string, assetId: string): Promise<AssetResponse>;
|
|
50
|
-
function listForProof(collectionId: string, productId: string, proofId: string, appId?: string): Promise<AssetResponse[]>;
|
|
51
69
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @param extraData - Arbitrary extra data to include (will be stringified as JSON)
|
|
60
|
-
* @param onProgress - Optional callback for upload progress (0-100)
|
|
61
|
-
* @returns Promise resolving to an AssetResponse object
|
|
70
|
+
* A proof's assets (public), optionally only one app's. Returns `{ items, nextCursor }`: the assets
|
|
71
|
+
* are in `items`. The list is not paged, so `nextCursor` is always `null`.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const { items } = await asset.listForProof('my-collection', 'wine-bottle', proofId, 'gallery')
|
|
76
|
+
* ```
|
|
62
77
|
*/
|
|
63
|
-
function
|
|
78
|
+
function listForProof(collectionId: string, productId: string, proofId: string, appId?: string): Promise<ListResult<AssetResponse>>;
|
|
64
79
|
/**
|
|
65
|
-
* List assets for a given scope
|
|
80
|
+
* List assets for a given scope (a collection, a product or a proof). Returns `{ items, nextCursor }`:
|
|
81
|
+
* the assets are in `items`. These lists are not paged, so `nextCursor` is always `null`.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const { items } = await asset.list({
|
|
86
|
+
* scope: { type: 'product', collectionId: 'my-collection', productId: 'wine-bottle' },
|
|
87
|
+
* appId: 'gallery',
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
66
90
|
*/
|
|
67
|
-
function list(options: ListAssetsOptions): Promise<Asset
|
|
91
|
+
function list(options: ListAssetsOptions): Promise<ListResult<Asset>>;
|
|
68
92
|
/**
|
|
69
93
|
* Get an asset by id within a scope (public)
|
|
70
94
|
*/
|
|
@@ -74,9 +98,21 @@ export declare namespace asset {
|
|
|
74
98
|
*/
|
|
75
99
|
function remove(options: RemoveAssetOptions): Promise<void>;
|
|
76
100
|
/**
|
|
77
|
-
* List assets for a collection with full filtering options.
|
|
101
|
+
* List assets for a collection with full filtering options (admin). Returns `{ items, nextCursor }`:
|
|
102
|
+
* the assets are in `items`, 50 at a time unless you give a `limit` (at most 200). Pass `nextCursor`
|
|
103
|
+
* back as `cursor` for the next page; `null` means that was the last one. `count` (how many match in
|
|
104
|
+
* all) is there when you gave a `limit` or a `cursor`.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* let page = await asset.listAdmin({ collectionId: 'my-collection', assetType: 'Image', limit: 20 })
|
|
109
|
+
* console.log(`${page.count} images`)
|
|
110
|
+
* while (page.nextCursor) {
|
|
111
|
+
* page = await asset.listAdmin({ collectionId: 'my-collection', assetType: 'Image', limit: 20, cursor: page.nextCursor })
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
78
114
|
*/
|
|
79
|
-
function listAdmin(options: AdminListAssetsOptions): Promise<
|
|
115
|
+
function listAdmin(options: AdminListAssetsOptions): Promise<ListResult<Asset>>;
|
|
80
116
|
/**
|
|
81
117
|
* Get a single asset by ID (admin).
|
|
82
118
|
*/
|
package/dist/api/asset.js
CHANGED
|
@@ -208,6 +208,15 @@ export var asset;
|
|
|
208
208
|
return request(path);
|
|
209
209
|
}
|
|
210
210
|
asset.getForCollection = getForCollection;
|
|
211
|
+
/**
|
|
212
|
+
* The collection's own assets (public). Returns `{ items, nextCursor }`: the assets are in `items`.
|
|
213
|
+
* The list is not paged, so `nextCursor` is always `null`.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const { items } = await asset.listForCollection('my-collection')
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
211
220
|
async function listForCollection(collectionId) {
|
|
212
221
|
const path = `/public/collection/${encodeURIComponent(collectionId)}/asset`;
|
|
213
222
|
return request(path);
|
|
@@ -219,6 +228,15 @@ export var asset;
|
|
|
219
228
|
return request(path);
|
|
220
229
|
}
|
|
221
230
|
asset.getForProduct = getForProduct;
|
|
231
|
+
/**
|
|
232
|
+
* A product's assets (public). Returns `{ items, nextCursor }`: the assets are in `items`.
|
|
233
|
+
* The list is not paged, so `nextCursor` is always `null`.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* const { items } = await asset.listForProduct('my-collection', 'wine-bottle')
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
222
240
|
async function listForProduct(collectionId, productId) {
|
|
223
241
|
const path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/asset`;
|
|
224
242
|
return request(path);
|
|
@@ -230,6 +248,15 @@ export var asset;
|
|
|
230
248
|
return request(path);
|
|
231
249
|
}
|
|
232
250
|
asset.getForProof = getForProof;
|
|
251
|
+
/**
|
|
252
|
+
* A proof's assets (public), optionally only one app's. Returns `{ items, nextCursor }`: the assets
|
|
253
|
+
* are in `items`. The list is not paged, so `nextCursor` is always `null`.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```typescript
|
|
257
|
+
* const { items } = await asset.listForProof('my-collection', 'wine-bottle', proofId, 'gallery')
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
233
260
|
async function listForProof(collectionId, productId, proofId, appId) {
|
|
234
261
|
let path = `/public/collection/${encodeURIComponent(collectionId)}/product/${encodeURIComponent(productId)}/proof/${encodeURIComponent(proofId)}/asset`;
|
|
235
262
|
if (appId) {
|
|
@@ -239,43 +266,24 @@ export var asset;
|
|
|
239
266
|
}
|
|
240
267
|
asset.listForProof = listForProof;
|
|
241
268
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* @
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*/
|
|
253
|
-
async function uploadAsset(collectionId, productId, proofId, file, extraData, onProgress) {
|
|
254
|
-
// Route through new upload API for backward compatibility
|
|
255
|
-
const res = await upload({
|
|
256
|
-
file,
|
|
257
|
-
name: file === null || file === void 0 ? void 0 : file.name,
|
|
258
|
-
metadata: extraData,
|
|
259
|
-
onProgress,
|
|
260
|
-
scope: { type: 'proof', collectionId, productId, proofId },
|
|
261
|
-
});
|
|
262
|
-
return res;
|
|
263
|
-
}
|
|
264
|
-
asset.uploadAsset = uploadAsset;
|
|
265
|
-
/**
|
|
266
|
-
* List assets for a given scope
|
|
269
|
+
* List assets for a given scope (a collection, a product or a proof). Returns `{ items, nextCursor }`:
|
|
270
|
+
* the assets are in `items`. These lists are not paged, so `nextCursor` is always `null`.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```typescript
|
|
274
|
+
* const { items } = await asset.list({
|
|
275
|
+
* scope: { type: 'product', collectionId: 'my-collection', productId: 'wine-bottle' },
|
|
276
|
+
* appId: 'gallery',
|
|
277
|
+
* })
|
|
278
|
+
* ```
|
|
267
279
|
*/
|
|
268
280
|
async function list(options) {
|
|
269
281
|
const base = buildScopeBase(options.scope);
|
|
270
282
|
const params = new URLSearchParams();
|
|
271
283
|
if (options.appId)
|
|
272
284
|
params.set('appId', options.appId);
|
|
273
|
-
if (options.mimeTypePrefix)
|
|
274
|
-
params.set('mimeTypePrefix', options.mimeTypePrefix);
|
|
275
285
|
if (typeof options.limit === 'number')
|
|
276
286
|
params.set('limit', String(options.limit));
|
|
277
|
-
if (typeof options.offset === 'number')
|
|
278
|
-
params.set('offset', String(options.offset));
|
|
279
287
|
const path = `${base}/asset${params.toString() ? `?${params}` : ''}`;
|
|
280
288
|
return request(path);
|
|
281
289
|
}
|
|
@@ -312,7 +320,19 @@ export var asset;
|
|
|
312
320
|
// Base: /api/admin/collection/:collectionId/assets
|
|
313
321
|
// ---------------------------------------------------------------------------
|
|
314
322
|
/**
|
|
315
|
-
* List assets for a collection with full filtering options.
|
|
323
|
+
* List assets for a collection with full filtering options (admin). Returns `{ items, nextCursor }`:
|
|
324
|
+
* the assets are in `items`, 50 at a time unless you give a `limit` (at most 200). Pass `nextCursor`
|
|
325
|
+
* back as `cursor` for the next page; `null` means that was the last one. `count` (how many match in
|
|
326
|
+
* all) is there when you gave a `limit` or a `cursor`.
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```typescript
|
|
330
|
+
* let page = await asset.listAdmin({ collectionId: 'my-collection', assetType: 'Image', limit: 20 })
|
|
331
|
+
* console.log(`${page.count} images`)
|
|
332
|
+
* while (page.nextCursor) {
|
|
333
|
+
* page = await asset.listAdmin({ collectionId: 'my-collection', assetType: 'Image', limit: 20, cursor: page.nextCursor })
|
|
334
|
+
* }
|
|
335
|
+
* ```
|
|
316
336
|
*/
|
|
317
337
|
async function listAdmin(options) {
|
|
318
338
|
const params = new URLSearchParams();
|
|
@@ -332,8 +352,8 @@ export var asset;
|
|
|
332
352
|
params.set('order', options.order);
|
|
333
353
|
if (typeof options.limit === 'number')
|
|
334
354
|
params.set('limit', String(options.limit));
|
|
335
|
-
if (
|
|
336
|
-
params.set('
|
|
355
|
+
if (options.cursor)
|
|
356
|
+
params.set('cursor', options.cursor);
|
|
337
357
|
if (options.include && options.include.length)
|
|
338
358
|
params.set('include', options.include.join(','));
|
|
339
359
|
const qs = params.toString();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRequest } from "../types/attestation.js";
|
|
2
|
+
import type { ListResult } from "../types/list.js";
|
|
2
3
|
/**
|
|
3
4
|
* @deprecated Legacy Firestore-backed attestation API.
|
|
4
5
|
*
|
|
@@ -16,10 +17,10 @@ import type { AttestationResponse, AttestationCreateRequest, AttestationUpdateRe
|
|
|
16
17
|
*/
|
|
17
18
|
export declare namespace attestation {
|
|
18
19
|
/**
|
|
19
|
-
* List all attestations for a proof
|
|
20
|
+
* List all attestations for a proof, in one list (no pages): `{ items, nextCursor: null }`.
|
|
20
21
|
* @deprecated Use `attestations.list()` with `subjectType='proof'` instead.
|
|
21
22
|
*/
|
|
22
|
-
function list(collectionId: string, productId: string, proofId: string): Promise<AttestationResponse
|
|
23
|
+
function list(collectionId: string, productId: string, proofId: string): Promise<ListResult<AttestationResponse>>;
|
|
23
24
|
/**
|
|
24
25
|
* Get a single attestation by ID.
|
|
25
26
|
* @deprecated Use `attestations.list()` with `subjectType='proof'` and filter by ID instead.
|
package/dist/api/attestation.js
CHANGED
|
@@ -17,7 +17,7 @@ import { request, post, put, del } from "../http.js";
|
|
|
17
17
|
export var attestation;
|
|
18
18
|
(function (attestation) {
|
|
19
19
|
/**
|
|
20
|
-
* List all attestations for a proof
|
|
20
|
+
* List all attestations for a proof, in one list (no pages): `{ items, nextCursor: null }`.
|
|
21
21
|
* @deprecated Use `attestations.list()` with `subjectType='proof'` instead.
|
|
22
22
|
*/
|
|
23
23
|
async function list(collectionId, productId, proofId) {
|
|
@@ -70,18 +70,22 @@ export declare namespace attestations {
|
|
|
70
70
|
* Returns all three data zones. Supports filtering by type and date range.
|
|
71
71
|
*
|
|
72
72
|
* @param collectionId - Collection context
|
|
73
|
-
* @param params - Query parameters; `subjectType` and `subjectId` are required
|
|
74
|
-
*
|
|
73
|
+
* @param params - Query parameters; `subjectType` and `subjectId` are required. Page with
|
|
74
|
+
* `limit` and `cursor`
|
|
75
|
+
* @returns `{ items: Attestation[], nextCursor }` — `nextCursor` is `null` on the last page
|
|
75
76
|
*
|
|
76
77
|
* @example
|
|
77
78
|
* ```typescript
|
|
78
|
-
*
|
|
79
|
+
* let page = await attestations.list('coll_123', {
|
|
79
80
|
* subjectType: 'container',
|
|
80
81
|
* subjectId: 'uuid-of-cask',
|
|
81
82
|
* attestationType: 'temperature',
|
|
82
83
|
* recordedAfter: '2025-01-01T00:00:00Z',
|
|
83
84
|
* limit: 50,
|
|
84
85
|
* })
|
|
86
|
+
* const records = page.items
|
|
87
|
+
* // next page: pass the cursor back with the same filters
|
|
88
|
+
* if (page.nextCursor) page = await attestations.list('coll_123', { ...filters, limit: 50, cursor: page.nextCursor })
|
|
85
89
|
* ```
|
|
86
90
|
*/
|
|
87
91
|
function list(collectionId: string, params: ListAttestationsParams): Promise<ListAttestationsResponse>;
|
|
@@ -200,12 +204,14 @@ export declare namespace attestations {
|
|
|
200
204
|
* The `audience` field in the response indicates the tier that was served.
|
|
201
205
|
*
|
|
202
206
|
* @param collectionId - Collection context
|
|
203
|
-
* @param params - Query parameters; `subjectType` and `subjectId` are required
|
|
204
|
-
*
|
|
207
|
+
* @param params - Query parameters; `subjectType` and `subjectId` are required. Page with
|
|
208
|
+
* `limit` and `cursor`
|
|
209
|
+
* @returns `{ items: Attestation[], nextCursor, audience: AttestationAudience }` — `nextCursor` is
|
|
210
|
+
* `null` on the last page
|
|
205
211
|
*
|
|
206
212
|
* @example
|
|
207
213
|
* ```typescript
|
|
208
|
-
* const {
|
|
214
|
+
* const { items: records, nextCursor, audience } = await attestations.publicList('coll_123', {
|
|
209
215
|
* subjectType: 'proof',
|
|
210
216
|
* subjectId: 'proof-uuid',
|
|
211
217
|
* })
|
|
@@ -304,7 +310,16 @@ export declare namespace attestations {
|
|
|
304
310
|
*
|
|
305
311
|
* @param collectionId - Collection context
|
|
306
312
|
* @param containerId - Container UUID
|
|
307
|
-
* @param params - Optional filters (attestationType, date range
|
|
313
|
+
* @param params - Optional filters (attestationType, date range) and paging (`limit`, `cursor`)
|
|
314
|
+
* @returns `{ items: Attestation[], nextCursor, audience }` — `nextCursor` is `null` on the last page
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```typescript
|
|
318
|
+
* const { items: records, nextCursor } = await attestations.publicContainerList('coll_123', containerId, {
|
|
319
|
+
* attestationType: 'temperature',
|
|
320
|
+
* limit: 50,
|
|
321
|
+
* })
|
|
322
|
+
* ```
|
|
308
323
|
*/
|
|
309
324
|
function publicContainerList(collectionId: string, containerId: string, params?: Omit<ListAttestationsParams, 'subjectType' | 'subjectId'>): Promise<PublicListAttestationsResponse>;
|
|
310
325
|
/**
|