@proveanything/smartlinks 1.8.5 → 1.8.6

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.
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 1.8.5 | Generated: 2026-03-14T14:43:55.897Z
3
+ Version: 1.8.6 | Generated: 2026-03-17T21:25:13.155Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -30,6 +30,18 @@ For detailed guides on specific features:
30
30
  - **[AI-Native App Manifests](manifests.md)** - How AI workflows discover, configure, and import apps via structured manifests and prose guides
31
31
  - **[AI Guide Template](ai-guide-template.md)** - A sample for an app on how to build an AI setup guide
32
32
 
33
+ ## Choosing App Storage
34
+
35
+ When you need flexible app-specific data, choose the storage model based on shape and lifecycle, not just on what can hold JSON.
36
+
37
+ - **`appConfiguration.getConfig` / `setConfig`** - One config blob per scope. Best for settings, feature flags, and app setup.
38
+ - **`appConfiguration.getData` / `getDataItem` / `setDataItem`** - Small keyed documents attached to a scope. Best for lookup tables, content fragments, menus, FAQs, or a handful of standalone items where you already know the ID.
39
+ - **`app.records`** - Default choice for richer app-owned entities that need status, visibility, ownership zones, querying, filtering, parent-child links, or lifecycle fields.
40
+ - **`app.cases`** - Use when the entity is a workflow item that moves toward resolution and may need assignment, priority, and history.
41
+ - **`app.threads`** - Use for conversations, comments, Q&A, or any object centered on replies.
42
+
43
+ Rule of thumb: if you are modelling a real domain object that users will browse, filter, secure, or evolve over time, start with app objects. If you just need a simple keyed payload hanging off a collection or product, scoped data items are still a good fit.
44
+
33
45
  ## API Namespaces
34
46
 
35
47
  The Smartlinks SDK is organized into the following namespaces:
@@ -43,6 +55,7 @@ The Smartlinks SDK is organized into the following namespaces:
43
55
  - **crate** - Organize products in containers/crates for logistics and grouping.
44
56
  - **form** - Build and manage dynamic forms used by apps and workflows.
45
57
  - **appConfiguration** - Read/write app configuration and scoped data (collection/product/proof); hosts the deep-link registry. → [Guide](deep-link-discovery.md)
58
+ - **app** - Flexible app-scoped objects: use records for structured entities, cases for workflows, and threads for discussions. → [Guide](app-objects.md)
46
59
 
47
60
  — Identity & Access —
48
61
  - **auth** - Admin authentication and account ops: login/logout, tokens, account info.
@@ -72,7 +85,6 @@ The Smartlinks SDK is organized into the following namespaces:
72
85
 
73
86
  — Other —
74
87
  - **analytics** - Functions for analytics operations
75
- - **appObjects** - Functions for appObjects operations
76
88
  - **async** - Functions for async operations
77
89
  - **attestation** - Functions for attestation operations
78
90
  - **attestations** - Functions for attestations operations
@@ -5827,7 +5839,7 @@ type AppConfigOptions = {
5827
5839
 
5828
5840
  /** Configuration object for setConfig */
5829
5841
  config?: any
5830
- /** Data object for setDataItem */
5842
+ /** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
5831
5843
  data?: any
5832
5844
  }
5833
5845
  ```
@@ -5858,145 +5870,118 @@ type VerifyTokenResponse = {
5858
5870
 
5859
5871
  ## API Functions
5860
5872
 
5861
- ### analytics
5862
-
5863
- **track**(event: CollectionAnalyticsEvent,
5864
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5865
- Fire-and-forget collection analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5866
-
5867
- **track**(event: TagAnalyticsEvent,
5868
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5869
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5870
-
5871
- **configure**(config: AnalyticsBrowserConfig) → `void`
5872
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5873
-
5874
- **getSessionId**() → `AnalyticsSessionId | undefined`
5875
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5876
-
5877
- **getVisitorId**() → `string | undefined`
5878
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5879
-
5880
- **setVisitorId**(visitorId: string,
5881
- options?: AnalyticsVisitorIdOptions) → `string`
5882
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5883
-
5884
- **clearVisitorId**(options?: Pick<AnalyticsVisitorIdOptions, 'storage' | 'storageKey'>) → `void`
5885
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5886
-
5887
- **captureCampaignParams**(search?: string) → `Partial<CollectionAnalyticsEvent>`
5888
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5889
-
5890
- **setLocation**(location: TagAnalyticsEvent['location'] | null) → `void`
5891
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5892
-
5893
- **clearLocation**() → `void`
5894
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5895
-
5896
- **getLocation**() → `TagAnalyticsEvent['location'] | undefined`
5897
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5898
-
5899
- **detectDevice**() → `CollectionAnalyticsEvent['deviceType']`
5900
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5901
-
5902
- **captureLocation**(options: AnalyticsGeolocationCaptureOptions = {}) → `Promise<TagAnalyticsEvent['location'] | null>`
5903
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5904
-
5905
- **trackCollection**(event: Partial<CollectionAnalyticsEvent>,
5906
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5907
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5908
-
5909
- **trackTag**(event: Partial<TagAnalyticsEvent>,
5910
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5911
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5912
-
5913
- **trackPageView**(event: Partial<CollectionAnalyticsEvent>,
5914
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5915
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5916
-
5917
- **trackLinkClick**(event: AnalyticsLinkClickInput,
5918
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5919
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5920
-
5921
- **trackTagScan**(event: Partial<TagAnalyticsEvent>,
5922
- options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5923
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5924
-
5925
- **bindPageViews**(binding: AnalyticsPageViewBindingOptions = {}) → `() => void`
5926
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5927
-
5928
- **bindLinkTracking**(binding: AnalyticsLinkBindingOptions = {}) → `() => void`
5929
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5873
+ ### analytics.admin
5930
5874
 
5931
5875
  **summary**(collectionId: string,
5932
5876
  body: AnalyticsSummaryRequest) → `Promise<AnalyticsSummaryResponse>`
5933
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5934
5877
 
5935
5878
  **timeseries**(collectionId: string,
5936
5879
  body: AnalyticsTimeseriesRequest) → `Promise<AnalyticsTimeseriesResponse>`
5937
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5938
5880
 
5939
5881
  **breakdown**(collectionId: string,
5940
5882
  body: AnalyticsBreakdownRequest) → `Promise<AnalyticsBreakdownResponse>`
5941
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5942
5883
 
5943
5884
  **events**(collectionId: string,
5944
5885
  body: AnalyticsEventsRequest) → `Promise<AnalyticsEventsResponse>`
5945
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5946
5886
 
5947
5887
  **web**(collectionId: string,
5948
5888
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
5949
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5950
5889
 
5951
5890
  **clicks**(collectionId: string,
5952
5891
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
5953
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5954
5892
 
5955
5893
  **tagScans**(collectionId: string,
5956
5894
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsDashboardResponse>`
5957
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5958
5895
 
5959
5896
  **products**(collectionId: string,
5960
5897
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsProductsResponse>`
5961
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5962
5898
 
5963
5899
  **qrCodes**(collectionId: string,
5964
5900
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsQrCodesResponse>`
5965
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5966
5901
 
5967
5902
  **tags**(collectionId: string,
5968
5903
  body: LegacyAnalyticsRequest = {}) → `Promise<AnalyticsTagsResponse>`
5969
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5970
5904
 
5971
5905
  **weekly**(collectionId: string,
5972
5906
  body: AnalyticsWeeklyRequest = {}) → `Promise<AnalyticsTimeseriesResponse>`
5973
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5974
5907
 
5975
5908
  **country**(collectionId: string,
5976
5909
  body: AnalyticsCountryRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5977
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5978
5910
 
5979
5911
  **topPages**(collectionId: string,
5980
5912
  body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5981
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5982
5913
 
5983
5914
  **topReferrers**(collectionId: string,
5984
5915
  body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5985
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5986
5916
 
5987
5917
  **topCampaigns**(collectionId: string,
5988
5918
  body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5989
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5990
5919
 
5991
5920
  **topSources**(collectionId: string,
5992
5921
  body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5993
- Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5994
5922
 
5995
5923
  **topDestinations**(collectionId: string,
5996
5924
  body: AnalyticsClassicReportRequest = {}) → `Promise<AnalyticsBreakdownResponse>`
5925
+
5926
+ ### analytics.browser
5927
+
5928
+ **configure**(config: AnalyticsBrowserConfig) → `void`
5929
+
5930
+ **getSessionId**() → `AnalyticsSessionId | undefined`
5931
+
5932
+ **getVisitorId**() → `string | undefined`
5933
+
5934
+ **setVisitorId**(visitorId: string,
5935
+ options?: AnalyticsVisitorIdOptions) → `string`
5936
+
5937
+ **clearVisitorId**(options?: Pick<AnalyticsVisitorIdOptions, 'storage' | 'storageKey'>) → `void`
5938
+
5939
+ **captureCampaignParams**(search?: string) → `Partial<CollectionAnalyticsEvent>`
5940
+
5941
+ **setLocation**(location: TagAnalyticsEvent['location'] | null) → `void`
5942
+
5943
+ **clearLocation**() → `void`
5944
+
5945
+ **getLocation**() → `TagAnalyticsEvent['location'] | undefined`
5946
+
5947
+ **detectDevice**() → `CollectionAnalyticsEvent['deviceType']`
5948
+
5949
+ **captureLocation**(options: AnalyticsGeolocationCaptureOptions = {}) → `Promise<TagAnalyticsEvent['location'] | null>`
5950
+
5951
+ **trackCollection**(event: Partial<CollectionAnalyticsEvent>,
5952
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5953
+
5954
+ **trackTag**(event: Partial<TagAnalyticsEvent>,
5955
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5956
+
5957
+ **trackPageView**(event: Partial<CollectionAnalyticsEvent>,
5958
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5959
+
5960
+ **trackLinkClick**(event: AnalyticsLinkClickInput,
5961
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5962
+
5963
+ **trackTagScan**(event: Partial<TagAnalyticsEvent>,
5964
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5965
+
5966
+ **bindPageViews**(binding: AnalyticsPageViewBindingOptions = {}) → `() => void`
5967
+
5968
+ **bindLinkTracking**(binding: AnalyticsLinkBindingOptions = {}) → `() => void`
5969
+
5970
+ ### analytics.collection
5971
+
5972
+ **track**(event: CollectionAnalyticsEvent,
5973
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5974
+ Fire-and-forget collection analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5975
+
5976
+ ### analytics.tag
5977
+
5978
+ **track**(event: TagAnalyticsEvent,
5979
+ options?: AnalyticsTrackOptions) → `AnalyticsTrackResult`
5997
5980
  Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when available, falling back to `fetch(..., { keepalive: true })`.
5998
5981
 
5999
- ### app
5982
+ ### app.cases
5983
+
5984
+ Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
6000
5985
 
6001
5986
  **create**(collectionId: string,
6002
5987
  appId: string,
@@ -6051,11 +6036,105 @@ Append an entry to case history (admin only) POST /cases/:caseId/history
6051
6036
  caseId: string) → `Promise<RelatedResponse>`
6052
6037
  Get related threads and records for a case (admin only) GET /cases/:caseId/related
6053
6038
 
6039
+ ### app.records
6040
+
6041
+ General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
6042
+
6043
+ **create**(collectionId: string,
6044
+ appId: string,
6045
+ input: CreateRecordInput,
6046
+ admin: boolean = false) → `Promise<AppRecord>`
6047
+ Create a new record POST /records
6048
+
6049
+ **list**(collectionId: string,
6050
+ appId: string,
6051
+ params?: RecordListQueryParams,
6052
+ admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
6053
+ List records with optional query parameters GET /records
6054
+
6055
+ **get**(collectionId: string,
6056
+ appId: string,
6057
+ recordId: string,
6058
+ admin: boolean = false) → `Promise<AppRecord>`
6059
+ Get a single record by ID GET /records/:recordId
6060
+
6061
+ **update**(collectionId: string,
6062
+ appId: string,
6063
+ recordId: string,
6064
+ input: UpdateRecordInput,
6065
+ admin: boolean = false) → `Promise<AppRecord>`
6066
+ Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
6067
+
6068
+ **remove**(collectionId: string,
6069
+ appId: string,
6070
+ recordId: string,
6071
+ admin: boolean = false) → `Promise<`
6072
+ Soft delete a record DELETE /records/:recordId
6073
+
6074
+ **aggregate**(collectionId: string,
6075
+ appId: string,
6076
+ request: AggregateRequest,
6077
+ admin: boolean = false) → `Promise<AggregateResponse>`
6078
+ Get aggregate statistics for records POST /records/aggregate
6079
+
6080
+ ### app.threads
6081
+
6082
+ Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
6083
+
6084
+ **create**(collectionId: string,
6085
+ appId: string,
6086
+ input: CreateThreadInput,
6087
+ admin: boolean = false) → `Promise<AppThread>`
6088
+ Create a new thread POST /threads
6089
+
6090
+ **list**(collectionId: string,
6091
+ appId: string,
6092
+ params?: ThreadListQueryParams,
6093
+ admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
6094
+ List threads with optional query parameters GET /threads
6095
+
6096
+ **get**(collectionId: string,
6097
+ appId: string,
6098
+ threadId: string,
6099
+ admin: boolean = false) → `Promise<AppThread>`
6100
+ Get a single thread by ID GET /threads/:threadId
6101
+
6102
+ **update**(collectionId: string,
6103
+ appId: string,
6104
+ threadId: string,
6105
+ input: UpdateThreadInput,
6106
+ admin: boolean = false) → `Promise<AppThread>`
6107
+ Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
6108
+
6109
+ **remove**(collectionId: string,
6110
+ appId: string,
6111
+ threadId: string,
6112
+ admin: boolean = false) → `Promise<`
6113
+ Soft delete a thread DELETE /threads/:threadId
6114
+
6115
+ **reply**(collectionId: string,
6116
+ appId: string,
6117
+ threadId: string,
6118
+ input: ReplyInput,
6119
+ admin: boolean = false) → `Promise<AppThread>`
6120
+ Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
6121
+
6122
+ **aggregate**(collectionId: string,
6123
+ appId: string,
6124
+ request: AggregateRequest,
6125
+ admin: boolean = false) → `Promise<AggregateResponse>`
6126
+ Get aggregate statistics for threads POST /threads/aggregate
6127
+
6054
6128
  ### appConfiguration
6055
6129
 
6130
+ Scoped config and keyed data items for collections, products, variants, or batches. Best for settings and small standalone documents, not as the default answer for every app-owned entity.
6131
+
6056
6132
  **getConfig**(opts: AppConfigOptions) → `Promise<any>`
6057
6133
  Get app configuration for a collection/product scope. ```typescript const config = await appConfiguration.getConfig({ appId: 'warranty-portal', collectionId: 'my-collection' }); ```
6058
6134
 
6135
+ **getWidgetInstance**(opts: GetWidgetInstanceOptions) → `Promise<WidgetInstance<TWidget>>`
6136
+ Resolve a configured widget instance by ID from an app's stored config. This is a thin convenience wrapper over `getConfig()` that reads `config.widgets[widgetId]`. ```typescript const widget = await appConfiguration.getWidgetInstance({ collectionId: 'my-collection', appId: 'widget-toolkit', widgetId: 'launch-countdown' }) ```
6137
+
6059
6138
  **listWidgetInstances**(opts: Omit<GetWidgetInstanceOptions, 'widgetId'>) → `Promise<WidgetInstanceSummary[]>`
6060
6139
  List configured widget instances for an app. Useful for picker UIs, setup schemas, and widget-to-widget references. ```typescript const widgets = await appConfiguration.listWidgetInstances({ collectionId: 'my-collection', appId: 'widget-toolkit' }) ```
6061
6140
 
@@ -6066,16 +6145,16 @@ Set app configuration for a collection/product scope. Requires admin authenticat
6066
6145
  Delete app configuration for a collection/product scope. Requires admin authentication. ```typescript await appConfiguration.deleteConfig({ appId: 'warranty-portal', collectionId: 'my-collection', admin: true }); ```
6067
6146
 
6068
6147
  **getData**(opts: AppConfigOptions) → `Promise<any[]>`
6069
- Get all data items for an app within a scope. ```typescript const items = await appConfiguration.getData({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }); ```
6148
+ Get all keyed data items for an app within a scope. Best for a small set of standalone documents such as FAQs, menus, lookup tables, or content fragments where the caller typically knows the item IDs. If you are modelling richer app entities that need filtering, lifecycle fields, visibility, ownership, or relationships, prefer `app.records`, `app.cases`, or `app.threads` instead. ```typescript const items = await appConfiguration.getData({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123' }); ```
6070
6149
 
6071
6150
  **getDataItem**(opts: AppConfigOptions) → `Promise<any>`
6072
- Get a single data item by ID within a scope. ```typescript const item = await appConfiguration.getDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', itemId: 'manual-1' }); ```
6151
+ Get a single keyed data item by ID within a scope. This is ideal when you already know the exact ID of a simple scoped document. For richer domain objects that users browse or query, prefer `app.records`, `app.cases`, or `app.threads`. ```typescript const item = await appConfiguration.getDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', itemId: 'manual-1' }); ```
6073
6152
 
6074
6153
  **setDataItem**(opts: AppConfigOptions) → `Promise<any>`
6075
- Set/create a data item within a scope. Requires admin authentication. ```typescript await appConfiguration.setDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, data: { id: 'manual-1', title: 'User Manual', url: 'https://...' } }); ```
6154
+ Set/create a keyed data item within a scope. Requires admin authentication. Use this for simple scoped documents attached to a collection/product/variant/batch, especially when you want a small number of items with stable IDs. Do not treat this as the default write path for every app-owned entity. If the data starts behaving like a real object with lifecycle, filtering, visibility, ownership, history, or relationships, prefer `app.records`, `app.cases`, or `app.threads`. ```typescript await appConfiguration.setDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, data: { id: 'manual-1', title: 'User Manual', url: 'https://...' } }); ```
6076
6155
 
6077
6156
  **deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
6078
- Delete a data item by ID within a scope. Requires admin authentication. ```typescript await appConfiguration.deleteDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, itemId: 'manual-1' }); ```
6157
+ Delete a keyed data item by ID within a scope. Requires admin authentication. ```typescript await appConfiguration.deleteDataItem({ appId: 'product-docs', collectionId: 'my-collection', productId: 'product-123', admin: true, itemId: 'manual-1' }); ```
6079
6158
 
6080
6159
  **getWidgets**(collectionId: string,
6081
6160
  options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
@@ -6473,93 +6552,17 @@ Get all tags/codes assigned to a specific batch. Shows which claim set codes hav
6473
6552
  **appendBulk**(collectionId: string,
6474
6553
  body: BroadcastAppendBulkBody) → `Promise<AppendBulkResult>`
6475
6554
 
6476
- ### chat
6477
-
6478
- **create**(collectionId: string,
6479
- request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
6480
- Create a Responses API request (streaming or non-streaming)
6555
+ ### chat.completions
6481
6556
 
6482
6557
  **create**(collectionId: string,
6483
6558
  request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
6484
6559
  Create a chat completion (streaming or non-streaming)
6485
6560
 
6486
- **list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`
6487
- List available AI models
6488
-
6489
- **get**(collectionId: string, modelId: string) → `Promise<AIModel>`
6490
- Get specific model information
6491
-
6492
- **indexDocument**(collectionId: string,
6493
- request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
6494
- Index a document for RAG
6495
-
6496
- **configureAssistant**(collectionId: string,
6497
- request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
6498
- Configure AI assistant behavior
6499
-
6500
- **stats**(collectionId: string) → `Promise<SessionStatistics>`
6501
- Get session statistics
6502
-
6503
- **reset**(collectionId: string, userId: string) → `Promise<`
6504
- Reset rate limit for a user
6505
-
6506
- **generate**(collectionId: string,
6507
- request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
6508
- Generate a NotebookLM-style conversational podcast from product documents
6509
-
6510
- **getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
6511
- Get podcast generation status
6512
-
6513
- **generate**(collectionId: string,
6514
- request: TTSRequest) → `Promise<Blob>`
6515
- Generate text-to-speech audio
6516
-
6517
- **chat**(collectionId: string,
6518
- request: PublicChatRequest) → `Promise<PublicChatResponse>`
6519
- Chat with product assistant (RAG)
6520
-
6521
- **getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
6522
- Get session history
6523
-
6524
- **clearSession**(collectionId: string, sessionId: string) → `Promise<`
6525
- Clear session history
6561
+ ### chat.responses
6526
6562
 
6527
- **getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
6528
- Check rate limit status
6529
-
6530
- **getToken**(collectionId: string,
6531
- request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
6532
- Generate ephemeral token for Gemini Live
6533
-
6534
- **isSupported**() → `boolean`
6535
- Check if voice is supported in browser
6536
-
6537
- **listen**(language = 'en-US') → `Promise<string>`
6538
- Listen for voice input
6539
-
6540
- **speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
6541
- Speak text
6542
-
6543
- **generateContent**(collectionId: string,
6544
- params: AIGenerateContentRequest,
6545
- admin: boolean = true) → `Promise<any>`
6546
- Generate text/content via AI (admin)
6547
-
6548
- **generateImage**(collectionId: string, params: AIGenerateImageRequest) → `Promise<any>`
6549
- Generate an image via AI (admin)
6550
-
6551
- **searchPhotos**(collectionId: string,
6552
- params: AISearchPhotosRequest) → `Promise<AISearchPhotosPhoto[]>`
6553
- Search stock photos or similar via AI (admin)
6554
-
6555
- **uploadFile**(collectionId: string, params: any) → `Promise<any>`
6556
- Upload a file for AI usage (admin). Pass FormData for binary uploads.
6557
-
6558
- **createCache**(collectionId: string, params: any) → `Promise<any>`
6559
- Create or warm a cache for AI (admin)
6560
-
6561
- **postChat**(collectionId: string, params: any, admin: boolean = true) → `Promise<any>`
6562
- Post a chat message to the AI (admin or public)
6563
+ **create**(collectionId: string,
6564
+ request: ResponsesRequest) `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
6565
+ Create a Responses API request (streaming or non-streaming)
6563
6566
 
6564
6567
  ### claimSet
6565
6568
 
@@ -6990,6 +6993,14 @@ Public: Fetch a global location by ID GET /public/location/:locationId
6990
6993
  locationId: string) → `Promise<Location>`
6991
6994
  Public: Fetch a location for a collection; returns either a collection-owned or global fallback GET /public/collection/:collectionId/location/:locationId
6992
6995
 
6996
+ ### models
6997
+
6998
+ **list**(collectionId: string, params?: AIModelListParams) → `Promise<AIModelListResponse>`
6999
+ List available AI models
7000
+
7001
+ **get**(collectionId: string, modelId: string) → `Promise<AIModel>`
7002
+ Get specific model information
7003
+
6993
7004
  ### nfc
6994
7005
 
6995
7006
  **claimTag**(data: NfcClaimTagRequest) → `Promise<NfcTagInfo>`
@@ -7095,6 +7106,15 @@ Get individual order items for a specific product. Returns all matching items wi
7095
7106
  params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
7096
7107
  Get unique order IDs containing items for a specific product. Lightweight query that only returns order IDs, not full order objects. ```typescript // Get order IDs for a product const productOrders = await order.getOrderIdsByAttribute( 'coll_123', 'productId', 'prod_789', { limit: 500 } ) ```
7097
7108
 
7109
+ ### podcast
7110
+
7111
+ **generate**(collectionId: string,
7112
+ request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
7113
+ Generate a NotebookLM-style conversational podcast from product documents
7114
+
7115
+ **getStatus**(collectionId: string, podcastId: string) → `Promise<PodcastStatus>`
7116
+ Get podcast generation status
7117
+
7098
7118
  ### product
7099
7119
 
7100
7120
  **get**(collectionId: string,
@@ -7195,57 +7215,52 @@ Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product
7195
7215
  data: { targetProductId: string }) → `Promise<ProofResponse>`
7196
7216
  Migrate a proof to a different product within the same collection (admin only). Because the Firestore ledger document ID is `{productId}-{proofId}`, a proof cannot simply be re-assigned to another product by updating a field — the document must be re-keyed. This endpoint handles that atomically: 1. Reads the source ledger document (`{sourceProductId}-{proofId}`). 2. Writes a new document (`{targetProductId}-{proofId}`) with `productId` and `proofGroup` updated. The short `proofId` (nanoid) is unchanged. 3. Writes a migration history entry to the new document's `history` subcollection (snapshot of the original proof + migration metadata). 4. Copies all subcollections — `assets`, `attestations`, `history` — from the old document to the new one. 5. Deletes the old subcollections and then the old document. Repeated migrations are safe — each one appends a history record; no migration metadata is stored on the proof document itself. ```typescript const migrated = await proof.migrate('coll_123', 'prod_old', 'proof_abc', { targetProductId: 'prod_new', }) console.log(migrated.productId) // 'prod_new' ```
7197
7217
 
7218
+ ### publicClient
7219
+
7220
+ **chat**(collectionId: string,
7221
+ request: PublicChatRequest) → `Promise<PublicChatResponse>`
7222
+ Chat with product assistant (RAG)
7223
+
7224
+ **getSession**(collectionId: string, sessionId: string) → `Promise<Session>`
7225
+ Get session history
7226
+
7227
+ **clearSession**(collectionId: string, sessionId: string) → `Promise<`
7228
+ Clear session history
7229
+
7230
+ **getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
7231
+ Check rate limit status
7232
+
7233
+ **getToken**(collectionId: string,
7234
+ request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
7235
+ Generate ephemeral token for Gemini Live
7236
+
7198
7237
  ### qr
7199
7238
 
7200
7239
  **lookupShortCode**(shortId: string, code: string) → `Promise<QrShortCodeLookupResponse>`
7201
7240
  Resolve a short code to related resource identifiers.
7202
7241
 
7203
- ### realtime
7242
+ ### rag
7204
7243
 
7205
- **getPublicToken**(params: RealtimeTokenRequest) → `Promise<AblyTokenRequest>`
7206
- Get an Ably token for public (user-scoped) real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with appropriate permissions for the specified collection and optional app. Requires user authentication (Bearer token). ```ts const tokenRequest = await realtime.getPublicToken({ collectionId: 'my-collection-id', appId: 'my-app-id' }) // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to channels matching the pattern const channel = ably.channels.get('collection:my-collection-id:app:my-app-id:chat:general') await channel.subscribe('message', (msg) => console.log(msg.data)) ```
7207
-
7208
- **getAdminToken**() → `Promise<AblyTokenRequest>`
7209
- Get an Ably token for admin real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with admin permissions to receive system notifications and alerts. Admin users get subscribe-only (read-only) access to the interaction:{userId} channel pattern. Requires admin authentication (Bearer token). ```ts const tokenRequest = await realtime.getAdminToken() // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to admin interaction channel const userId = 'my-user-id' const channel = ably.channels.get(`interaction:${userId}`) await channel.subscribe((message) => { console.log('Admin notification:', message.data) }) ```
7210
-
7211
- ### records
7244
+ **indexDocument**(collectionId: string,
7245
+ request: IndexDocumentRequest) `Promise<IndexDocumentResponse>`
7246
+ Index a document for RAG
7212
7247
 
7213
- **create**(collectionId: string,
7214
- appId: string,
7215
- input: CreateRecordInput,
7216
- admin: boolean = false) → `Promise<AppRecord>`
7217
- Create a new record POST /records
7248
+ **configureAssistant**(collectionId: string,
7249
+ request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
7250
+ Configure AI assistant behavior
7218
7251
 
7219
- **list**(collectionId: string,
7220
- appId: string,
7221
- params?: RecordListQueryParams,
7222
- admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
7223
- List records with optional query parameters GET /records
7252
+ ### rateLimit
7224
7253
 
7225
- **get**(collectionId: string,
7226
- appId: string,
7227
- recordId: string,
7228
- admin: boolean = false) → `Promise<AppRecord>`
7229
- Get a single record by ID GET /records/:recordId
7254
+ **reset**(collectionId: string, userId: string) → `Promise<`
7255
+ Reset rate limit for a user
7230
7256
 
7231
- **update**(collectionId: string,
7232
- appId: string,
7233
- recordId: string,
7234
- input: UpdateRecordInput,
7235
- admin: boolean = false) → `Promise<AppRecord>`
7236
- Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
7257
+ ### realtime
7237
7258
 
7238
- **remove**(collectionId: string,
7239
- appId: string,
7240
- recordId: string,
7241
- admin: boolean = false) → `Promise<`
7242
- Soft delete a record DELETE /records/:recordId
7259
+ **getPublicToken**(params: RealtimeTokenRequest) → `Promise<AblyTokenRequest>`
7260
+ Get an Ably token for public (user-scoped) real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with appropriate permissions for the specified collection and optional app. Requires user authentication (Bearer token). ```ts const tokenRequest = await realtime.getPublicToken({ collectionId: 'my-collection-id', appId: 'my-app-id' }) // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to channels matching the pattern const channel = ably.channels.get('collection:my-collection-id:app:my-app-id:chat:general') await channel.subscribe('message', (msg) => console.log(msg.data)) ```
7243
7261
 
7244
- **aggregate**(collectionId: string,
7245
- appId: string,
7246
- request: AggregateRequest,
7247
- admin: boolean = false) → `Promise<AggregateResponse>`
7248
- Get aggregate statistics for records POST /records/aggregate
7262
+ **getAdminToken**() → `Promise<AblyTokenRequest>`
7263
+ Get an Ably token for admin real-time communication. This endpoint returns an Ably TokenRequest that can be used to initialize an Ably client with admin permissions to receive system notifications and alerts. Admin users get subscribe-only (read-only) access to the interaction:{userId} channel pattern. Requires admin authentication (Bearer token). ```ts const tokenRequest = await realtime.getAdminToken() // Use with Ably const ably = new Ably.Realtime.Promise({ authCallback: async (data, callback) => { callback(null, tokenRequest) } }) // Subscribe to admin interaction channel const userId = 'my-user-id' const channel = ably.channels.get(`interaction:${userId}`) await channel.subscribe((message) => { console.log('Admin notification:', message.data) }) ```
7249
7264
 
7250
7265
  ### segments
7251
7266
 
@@ -7272,6 +7287,11 @@ Get aggregate statistics for records POST /records/aggregate
7272
7287
  id: string,
7273
7288
  query: { limit?: number; offset?: number } = {}) → `Promise<SegmentRecipientsResponse>`
7274
7289
 
7290
+ ### sessions
7291
+
7292
+ **stats**(collectionId: string) → `Promise<SessionStatistics>`
7293
+ Get session statistics
7294
+
7275
7295
  ### tags
7276
7296
 
7277
7297
  **create**(collectionId: string,
@@ -7360,54 +7380,16 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
7360
7380
  **renderSource**(collectionId: string,
7361
7381
  body: TemplateRenderSourceRequest) → `Promise<TemplateRenderSourceResponse>`
7362
7382
 
7363
- ### threads
7364
-
7365
- **create**(collectionId: string,
7366
- appId: string,
7367
- input: CreateThreadInput,
7368
- admin: boolean = false) → `Promise<AppThread>`
7369
- Create a new thread POST /threads
7370
-
7371
- **list**(collectionId: string,
7372
- appId: string,
7373
- params?: ThreadListQueryParams,
7374
- admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
7375
- List threads with optional query parameters GET /threads
7376
-
7377
- **get**(collectionId: string,
7378
- appId: string,
7379
- threadId: string,
7380
- admin: boolean = false) → `Promise<AppThread>`
7381
- Get a single thread by ID GET /threads/:threadId
7382
-
7383
- **update**(collectionId: string,
7384
- appId: string,
7385
- threadId: string,
7386
- input: UpdateThreadInput,
7387
- admin: boolean = false) → `Promise<AppThread>`
7388
- Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
7383
+ ### tts
7389
7384
 
7390
- **remove**(collectionId: string,
7391
- appId: string,
7392
- threadId: string,
7393
- admin: boolean = false) → `Promise<`
7394
- Soft delete a thread DELETE /threads/:threadId
7395
-
7396
- **reply**(collectionId: string,
7397
- appId: string,
7398
- threadId: string,
7399
- input: ReplyInput,
7400
- admin: boolean = false) → `Promise<AppThread>`
7401
- Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
7402
-
7403
- **aggregate**(collectionId: string,
7404
- appId: string,
7405
- request: AggregateRequest,
7406
- admin: boolean = false) → `Promise<AggregateResponse>`
7407
- Get aggregate statistics for threads POST /threads/aggregate
7385
+ **generate**(collectionId: string,
7386
+ request: TTSRequest) → `Promise<Blob>`
7387
+ Generate text-to-speech audio
7408
7388
 
7409
7389
  ### userAppData
7410
7390
 
7391
+ User-owned app data stored per user and app, shared across collections.
7392
+
7411
7393
  **getConfig**(appId: string) → `Promise<any>`
7412
7394
  Get user's config blob for an app. This is a single JSON object stored per user+app. ```typescript const config = await userAppData.getConfig('allergy-tracker'); // Returns: { allergies: ['peanuts'], notifications: true } ```
7413
7395
 
@@ -7474,3 +7456,14 @@ Get serial numbers for a variant (admin only).
7474
7456
  codeId: string) → `Promise<any>`
7475
7457
  Look up a serial number by code for a variant (admin only).
7476
7458
 
7459
+ ### voice
7460
+
7461
+ **isSupported**() → `boolean`
7462
+ Check if voice is supported in browser
7463
+
7464
+ **listen**(language = 'en-US') → `Promise<string>`
7465
+ Listen for voice input
7466
+
7467
+ **speak**(text: string, options?: { voice?: string; rate?: number }) → `Promise<void>`
7468
+ Speak text
7469
+