@proveanything/smartlinks 2.1.40 → 2.1.41
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 +754 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/collection.d.ts +8 -1
- package/dist/api/collection.js +10 -0
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +863 -835
- 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 +39 -39
- 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-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/bookings.md +442 -442
- package/dist/docs/comms.md +686 -686
- package/dist/docs/connectors.md +340 -340
- 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/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +210 -210
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +545 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +102 -102
- package/dist/docs/lots.md +111 -111
- package/dist/docs/loyalty.md +352 -352
- package/dist/docs/members.md +182 -182
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +482 -482
- 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 +138 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/standard-query.md +187 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/openapi.yaml +80 -3
- package/dist/theme-boot.js +78 -78
- package/dist/theme.css +75 -75
- package/dist/types/appManifest.d.ts +21 -0
- package/dist/types/collection.d.ts +26 -0
- package/docs/API_SUMMARY.md +863 -835
- 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 +39 -39
- 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-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/bookings.md +442 -442
- package/docs/comms.md +686 -686
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +210 -210
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +545 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +102 -102
- package/docs/lots.md +111 -111
- package/docs/loyalty.md +352 -352
- package/docs/members.md +182 -182
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +482 -482
- 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 +138 -138
- package/docs/standard-query.md +187 -187
- package/docs/tag-codes.md +97 -97
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +80 -3
- package/package.json +87 -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/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
package/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.41 | Generated: 2026-11-22T10:02:53.863Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -3163,6 +3163,7 @@ interface AppManifest {
|
|
|
3163
3163
|
linkable?: DeepLinkEntry[];
|
|
3164
3164
|
publicViews?: PublicView[];
|
|
3165
3165
|
adminViews?: AdminView[];
|
|
3166
|
+
requires?: AppRequirement[];
|
|
3166
3167
|
executor?: AppManifestExecutor;
|
|
3167
3168
|
functions?: AppManifestFunctions;
|
|
3168
3169
|
realtime?: {
|
|
@@ -3470,6 +3471,10 @@ type ServerFunctionFileInput = { base64: string; contentType: string }
|
|
|
3470
3471
|
|
|
3471
3472
|
**AppDocsAudience** = `'team' | 'admin' | 'customer' | 'developer'`
|
|
3472
3473
|
|
|
3474
|
+
**AppNeed** = `'signIn' | 'crm' | 'products' | 'claimableItems'`
|
|
3475
|
+
|
|
3476
|
+
**AppRequirement** = `AppNeed | { need: AppNeed`
|
|
3477
|
+
|
|
3473
3478
|
### appObjects
|
|
3474
3479
|
|
|
3475
3480
|
**PaginatedResponse<T>** (interface)
|
|
@@ -6536,6 +6541,26 @@ interface InviteUserInput {
|
|
|
6536
6541
|
}
|
|
6537
6542
|
```
|
|
6538
6543
|
|
|
6544
|
+
**ReadinessItem** (interface)
|
|
6545
|
+
```typescript
|
|
6546
|
+
interface ReadinessItem {
|
|
6547
|
+
level: 'problem' | 'warning' | 'info'
|
|
6548
|
+
code: string
|
|
6549
|
+
message: string
|
|
6550
|
+
app?: string
|
|
6551
|
+
appName?: string
|
|
6552
|
+
fix?: { label: string; open: { appId: string; view?: string }; studioPath: string }
|
|
6553
|
+
}
|
|
6554
|
+
```
|
|
6555
|
+
|
|
6556
|
+
**CollectionReadiness** (interface)
|
|
6557
|
+
```typescript
|
|
6558
|
+
interface CollectionReadiness {
|
|
6559
|
+
ready: boolean
|
|
6560
|
+
items: ReadinessItem[]
|
|
6561
|
+
}
|
|
6562
|
+
```
|
|
6563
|
+
|
|
6539
6564
|
**CollectionResponse** = `Collection`
|
|
6540
6565
|
|
|
6541
6566
|
**CollectionCreateRequest** = `Omit<Collection, 'id' | 'shortId'>`
|
|
@@ -6997,418 +7022,418 @@ interface TransactionalSendError {
|
|
|
6997
7022
|
|
|
6998
7023
|
**EmailAttachmentSpec** = ``
|
|
6999
7024
|
|
|
7000
|
-
**TransactionalSendResult** = `// src/types/comms.ts
|
|
7001
|
-
// Communication and notification types for the Smartlinks API
|
|
7002
|
-
import type { IdField } from './common'
|
|
7003
|
-
import type { BroadcastChannel } from './broadcasts'
|
|
7004
|
-
|
|
7005
|
-
/**
|
|
7006
|
-
* Target subject for notifications (product, collection, etc.)
|
|
7007
|
-
*/
|
|
7008
|
-
export interface NotificationSubjectTarget {
|
|
7009
|
-
/** Type of target entity */
|
|
7010
|
-
type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
|
|
7011
|
-
/** ID of the target entity */
|
|
7012
|
-
id: string
|
|
7013
|
-
}
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
// Analytics & logging (communication events)
|
|
7017
|
-
|
|
7018
|
-
export interface CommunicationEvent {
|
|
7019
|
-
orgId: string
|
|
7020
|
-
broadcastId?: string
|
|
7021
|
-
journeyId?: string
|
|
7022
|
-
userId?: string
|
|
7023
|
-
contactId?: string
|
|
7024
|
-
channel?: string
|
|
7025
|
-
timestamp: string
|
|
7026
|
-
eventType: string
|
|
7027
|
-
outcome?: string | null
|
|
7028
|
-
templateId?: string | null
|
|
7029
|
-
[k: string]: any
|
|
7030
|
-
}
|
|
7031
|
-
|
|
7032
|
-
export interface CommsQueryByUser {
|
|
7033
|
-
userId?: string
|
|
7034
|
-
contactId?: string
|
|
7035
|
-
from?: string
|
|
7036
|
-
to?: string
|
|
7037
|
-
limit?: number
|
|
7038
|
-
}
|
|
7039
|
-
|
|
7040
|
-
export type RecipientId = string
|
|
7041
|
-
export interface RecipientWithOutcome { id: string; outcome: string }
|
|
7042
|
-
|
|
7043
|
-
export interface CommsRecipientIdsQuery {
|
|
7044
|
-
broadcastId?: string
|
|
7045
|
-
journeyId?: string
|
|
7046
|
-
journeyStepId?: string
|
|
7047
|
-
idField?: IdField
|
|
7048
|
-
from?: string
|
|
7049
|
-
to?: string
|
|
7050
|
-
limit?: number
|
|
7051
|
-
}
|
|
7052
|
-
|
|
7053
|
-
export interface CommsRecipientsWithoutActionQuery {
|
|
7054
|
-
broadcastId?: string
|
|
7055
|
-
journeyId?: string
|
|
7056
|
-
actionId?: string
|
|
7057
|
-
appId?: string
|
|
7058
|
-
idField?: IdField
|
|
7059
|
-
from?: string
|
|
7060
|
-
to?: string
|
|
7061
|
-
limit?: number
|
|
7062
|
-
}
|
|
7063
|
-
|
|
7064
|
-
export interface CommsRecipientsWithActionQuery {
|
|
7065
|
-
broadcastId?: string
|
|
7066
|
-
journeyId?: string
|
|
7067
|
-
actionId?: string
|
|
7068
|
-
appId?: string
|
|
7069
|
-
outcome?: string
|
|
7070
|
-
idField?: IdField
|
|
7071
|
-
includeOutcome?: boolean
|
|
7072
|
-
from?: string
|
|
7073
|
-
to?: string
|
|
7074
|
-
limit?: number
|
|
7075
|
-
}
|
|
7076
|
-
|
|
7077
|
-
export interface LogCommunicationEventBody {
|
|
7078
|
-
broadcastId?: string
|
|
7079
|
-
journeyId?: string
|
|
7080
|
-
userId?: string
|
|
7081
|
-
contactId?: string
|
|
7082
|
-
channel?: string
|
|
7083
|
-
eventType: string
|
|
7084
|
-
outcome?: string
|
|
7085
|
-
templateId?: string
|
|
7086
|
-
timestamp?: string
|
|
7087
|
-
[k: string]: any
|
|
7088
|
-
}
|
|
7089
|
-
|
|
7090
|
-
export interface LogBulkCommunicationEventsBody {
|
|
7091
|
-
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
7092
|
-
ids: string[]
|
|
7093
|
-
idField?: IdField
|
|
7094
|
-
}
|
|
7095
|
-
|
|
7096
|
-
export interface AppendResult { success: true }
|
|
7097
|
-
export interface AppendBulkResult { success: true; count: number }
|
|
7098
|
-
|
|
7099
|
-
// Common recipient type used by segments and broadcasts
|
|
7100
|
-
export type Recipient = import('./contact').Contact
|
|
7101
|
-
|
|
7102
|
-
// Shared page response shape for recipient listings
|
|
7103
|
-
export interface RecipientsPage {
|
|
7104
|
-
items: Recipient[]
|
|
7105
|
-
total: number
|
|
7106
|
-
limit: number
|
|
7107
|
-
offset: number
|
|
7108
|
-
note?: string
|
|
7109
|
-
}
|
|
7110
|
-
|
|
7111
|
-
// Web Push (public client registration)
|
|
7112
|
-
|
|
7113
|
-
export interface PushSubscriptionJSON {
|
|
7114
|
-
endpoint: string
|
|
7115
|
-
keys?: {
|
|
7116
|
-
p256dh?: string
|
|
7117
|
-
auth?: string
|
|
7118
|
-
}
|
|
7119
|
-
}
|
|
7120
|
-
|
|
7121
|
-
export interface PushVapidResponse { publicKey: string }
|
|
7122
|
-
export interface PushSubscribeResponse { ok: true; id: string }
|
|
7123
|
-
|
|
7124
|
-
// Public: register a push contact method
|
|
7125
|
-
export interface RegisterPushMethodRequest {
|
|
7126
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7127
|
-
contactId?: string
|
|
7128
|
-
endpoint: string
|
|
7129
|
-
keys: { p256dh: string; auth: string }
|
|
7130
|
-
meta?: Record<string, any>
|
|
7131
|
-
}
|
|
7132
|
-
|
|
7133
|
-
// Admin Comms Settings
|
|
7134
|
-
|
|
7135
|
-
export interface CommsSettings {
|
|
7136
|
-
unsub?: {
|
|
7137
|
-
requireToken?: boolean
|
|
7138
|
-
/** Secret for token generation; omitted unless includeSecret=true */
|
|
7139
|
-
secret?: string
|
|
7140
|
-
/** Convenience flag indicating a secret is set (masked responses) */
|
|
7141
|
-
hasSecret?: boolean
|
|
7142
|
-
}
|
|
7143
|
-
/** Map of topic keys to topic config */
|
|
7144
|
-
topics?: Record<string, TopicConfig>
|
|
7145
|
-
[k: string]: any
|
|
7146
|
-
}
|
|
7147
|
-
|
|
7148
|
-
export interface TopicConfig {
|
|
7149
|
-
label?: string
|
|
7150
|
-
description?: string
|
|
7151
|
-
/** Optional UI-only grouping labels */
|
|
7152
|
-
labels?: string[]
|
|
7153
|
-
/** Classification for UI and default policy guidance */
|
|
7154
|
-
classification?: 'transactional' | 'marketing'
|
|
7155
|
-
defaults?: {
|
|
7156
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7157
|
-
topics?: Record<string, boolean | undefined>
|
|
7158
|
-
/** Default consent policy when explicit preferences are absent */
|
|
7159
|
-
policy?: 'opt-in' | 'opt-out'
|
|
7160
|
-
/** Per-channel default policy (overrides policy when present) */
|
|
7161
|
-
byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
|
|
7162
|
-
}
|
|
7163
|
-
rules?: {
|
|
7164
|
-
allowChannels?: BroadcastChannel[]
|
|
7165
|
-
allowUnsubscribe?: boolean
|
|
7166
|
-
required?: boolean
|
|
7167
|
-
}
|
|
7168
|
-
[k: string]: any
|
|
7169
|
-
}
|
|
7170
|
-
|
|
7171
|
-
export interface CommsSettingsGetResponse {
|
|
7172
|
-
ok: true
|
|
7173
|
-
settings: CommsSettings
|
|
7174
|
-
}
|
|
7175
|
-
|
|
7176
|
-
export type CommsSettingsPatchBody = Partial<CommsSettings>
|
|
7177
|
-
|
|
7178
|
-
// Public types listing (array form for public API)
|
|
7179
|
-
export interface CommsPublicTopicsResponse { ok: true; topics: Record<string, TopicConfig> }
|
|
7180
|
-
|
|
7181
|
-
export interface UnsubscribeQuery {
|
|
7182
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7183
|
-
contactId?: string
|
|
7184
|
-
topic?: string
|
|
7185
|
-
channel?: BroadcastChannel
|
|
7186
|
-
token?: string
|
|
7187
|
-
}
|
|
7188
|
-
|
|
7189
|
-
export interface UnsubscribeResponse { ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> } }
|
|
7190
|
-
|
|
7191
|
-
// Public sign-up (double opt-in)
|
|
7192
|
-
export interface CommsSignupRequest {
|
|
7193
|
-
email: string
|
|
7194
|
-
/**
|
|
7195
|
-
* Required: YOUR app's confirmation email — a template in this collection (SL.template) whose body
|
|
7196
|
-
* uses `{{ action_url }}` for the confirm link (`{{ topics }}` lists what they signed up for). The
|
|
7197
|
-
* platform sends no default sign-up email.
|
|
7198
|
-
*/
|
|
7199
|
-
templateId: string
|
|
7200
|
-
/** Topic ids from the collection's comm settings (e.g. ["newsletter"]). */
|
|
7201
|
-
topics?: string[]
|
|
7202
|
-
firstName?: string
|
|
7203
|
-
/**
|
|
7204
|
-
* The form's other answers — firstName/lastName/displayName/company/locale/timezone and
|
|
7205
|
-
* `customFields`. Applied to the contact when the address is confirmed, and only where the contact
|
|
7206
|
-
* has no value yet (never overwritten). Small: ~2 KB.
|
|
7207
|
-
*/
|
|
7208
|
-
fields?: { firstName?: string; lastName?: string; displayName?: string; company?: string; locale?: string; timezone?: string; customFields?: Record<string, string | number | boolean> }
|
|
7209
|
-
/** Your app id, recorded with the sent email. */
|
|
7210
|
-
appId?: string
|
|
7211
|
-
}
|
|
7212
|
-
export interface CommsSignupResponse { ok: true; pending: true }
|
|
7213
|
-
|
|
7214
|
-
// Public consent/preferences/subscribe
|
|
7215
|
-
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>
|
|
7216
|
-
type SubjectType = import('./contact').SubjectType
|
|
7217
|
-
|
|
7218
|
-
export interface CommsConsentUpsertRequest {
|
|
7219
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7220
|
-
contactId?: string
|
|
7221
|
-
channels?: ConsentChannels
|
|
7222
|
-
topics?: Record<string, boolean>
|
|
7223
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7224
|
-
}
|
|
7225
|
-
|
|
7226
|
-
export interface CommsPreferencesUpsertRequest {
|
|
7227
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7228
|
-
contactId?: string
|
|
7229
|
-
subject?: { type: SubjectType; id: string; productId?: string }
|
|
7230
|
-
channels?: ConsentChannels
|
|
7231
|
-
topics?: Record<string, boolean>
|
|
7232
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7233
|
-
}
|
|
7234
|
-
|
|
7235
|
-
export interface CommsSubscribeRequest {
|
|
7236
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7237
|
-
contactId?: string
|
|
7238
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7239
|
-
subscribe: boolean
|
|
7240
|
-
source?: string
|
|
7241
|
-
}
|
|
7242
|
-
export interface CommsSubscribeResponse { ok: true; subscriptionId: string }
|
|
7243
|
-
|
|
7244
|
-
export interface CommsSubscriptionCheckQuery {
|
|
7245
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7246
|
-
contactId?: string
|
|
7247
|
-
subjectType: SubjectType
|
|
7248
|
-
subjectId: string
|
|
7249
|
-
productId?: string
|
|
7250
|
-
}
|
|
7251
|
-
export interface CommsSubscriptionCheckResponse { ok: true; subscribed: boolean }
|
|
7252
|
-
|
|
7253
|
-
export interface CommsListMethodsQuery {
|
|
7254
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7255
|
-
contactId?: string
|
|
7256
|
-
type?: BroadcastChannel
|
|
7257
|
-
}
|
|
7258
|
-
export interface CommsListMethodsResponse { ok: true; methods: import('./contact').CommMethod[] }
|
|
7259
|
-
|
|
7260
|
-
export interface RegisterEmailMethodRequest { contactId?: string; email?: string; userId?: string }
|
|
7261
|
-
export interface RegisterSmsMethodRequest { contactId?: string; phone?: string; userId?: string }
|
|
7262
|
-
export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
7263
|
-
|
|
7264
|
-
export interface SubscriptionsResolveRequest {
|
|
7265
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7266
|
-
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7267
|
-
}
|
|
7268
|
-
export interface SubscriptionsResolveResponse {
|
|
7269
|
-
ok: true
|
|
7270
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7271
|
-
contacts: Array<{
|
|
7272
|
-
contactId: string
|
|
7273
|
-
subscribed: boolean
|
|
7274
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7275
|
-
}>
|
|
7276
|
-
anySubscribed: boolean
|
|
7277
|
-
anyMethods: boolean
|
|
7278
|
-
}
|
|
7279
|
-
|
|
7280
|
-
// Transactional send (single-contact, single-message)
|
|
7281
|
-
|
|
7282
|
-
/**
|
|
7283
|
-
* Send a single message to one contact using a template.
|
|
7284
|
-
* No broadcast record is created; the send is logged directly to the
|
|
7285
|
-
* contact's communication history with sourceType: 'transactional'.
|
|
7286
|
-
*
|
|
7287
|
-
* POST /admin/collection/:collectionId/comm/send
|
|
7288
|
-
*/
|
|
7289
|
-
export interface TransactionalSendRequest {
|
|
7290
|
-
/** CRM contact UUID */
|
|
7291
|
-
contactId: string
|
|
7292
|
-
/** A saved template's id. Give this or `message`. */
|
|
7293
|
-
templateId?: string
|
|
7294
|
-
/**
|
|
7295
|
-
* A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
|
|
7296
|
-
* `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
|
|
7297
|
-
*/
|
|
7298
|
-
message?: TypedMessage
|
|
7299
|
-
/**
|
|
7300
|
-
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
7301
|
-
* contact's best available channel respecting consent, suppression, and
|
|
7302
|
-
* template availability.
|
|
7303
|
-
*/
|
|
7304
|
-
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
7305
|
-
/** Extra Liquid variables merged into the top-level render context */
|
|
7306
|
-
props?: Record<string, unknown>
|
|
7307
|
-
/** Context objects to hydrate into the Liquid template */
|
|
7308
|
-
include?: {
|
|
7309
|
-
/** Hydrate {{ collection }}. Default: true */
|
|
7310
|
-
collection?: boolean
|
|
7311
|
-
/** Hydrate {{ product }} from this product ID */
|
|
7312
|
-
productId?: string
|
|
7313
|
-
/** Hydrate {{ proof }} (requires productId) */
|
|
7314
|
-
proofId?: string
|
|
7315
|
-
/** Hydrate {{ user }} from contact.userId */
|
|
7316
|
-
user?: boolean
|
|
7317
|
-
/** Hydrate {{ appCase }} from this case UUID */
|
|
7318
|
-
appCase?: string
|
|
7319
|
-
/** Hydrate {{ appThread }} from this thread UUID */
|
|
7320
|
-
appThread?: string
|
|
7321
|
-
/** Hydrate {{ appRecord }} from this record UUID */
|
|
7322
|
-
appRecord?: string
|
|
7323
|
-
}
|
|
7324
|
-
/** Arbitrary label stored on the comms-events row (e.g. 'warranty-step-2') */
|
|
7325
|
-
ref?: string
|
|
7326
|
-
/** App context stored on the comms-events row */
|
|
7327
|
-
appId?: string
|
|
7328
|
-
/**
|
|
7329
|
-
* What the message is about: the record it was sent for and the admin screen that shows it, so it is a
|
|
7330
|
-
* link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
|
|
7331
|
-
* to the sending app.
|
|
7332
|
-
*/
|
|
7333
|
-
about?: MessageAbout
|
|
7334
|
-
/**
|
|
7335
|
-
* `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
|
|
7336
|
-
* suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
|
|
7337
|
-
*/
|
|
7338
|
-
category?: 'service'
|
|
7339
|
-
/**
|
|
7340
|
-
* Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
|
|
7341
|
-
* `attachmentsLeftOut` — the email still goes.
|
|
7342
|
-
*/
|
|
7343
|
-
attach?: EmailAttachmentSpec[]
|
|
7344
|
-
}
|
|
7345
|
-
|
|
7346
|
-
/**
|
|
7347
|
-
* One file for an email:
|
|
7348
|
-
* - `'calendar'` — the booking's `.ics` calendar invite (needs `include.booking` and `appId`)
|
|
7349
|
-
* - `{ asset }` — a file uploaded to this collection's assets
|
|
7350
|
-
* - `{ function }` — the app's (`appId`) own server function makes it (see server-functions.md, "Making an email attachment")
|
|
7351
|
-
* - `{ filename, contentType, content }` — a file you made, base64 (PDF, Office documents, images, text, CSV, calendar)
|
|
7352
|
-
* - `{ filename, file }` — a private file you made (e.g. `pdf.create` with `return: 'signedUrl'`)
|
|
7353
|
-
*/
|
|
7354
|
-
export type EmailAttachmentSpec =
|
|
7355
|
-
| 'calendar'
|
|
7356
|
-
| { asset: string }
|
|
7357
|
-
| { function: string }
|
|
7358
|
-
| { filename: string; contentType: string; content: string }
|
|
7359
|
-
| { filename: string; contentType?: string; file: string }
|
|
7360
|
-
|
|
7361
|
-
export interface TransactionalSendResponse {
|
|
7362
|
-
ok: true
|
|
7363
|
-
/** The channel the message was actually sent on */
|
|
7364
|
-
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
7365
|
-
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
7366
|
-
messageId?: string
|
|
7367
|
-
/** Attachments that couldn't be made, and why (the email went without them) */
|
|
7368
|
-
attachmentsLeftOut?: string[]
|
|
7369
|
-
}
|
|
7370
|
-
|
|
7371
|
-
/** A message written there and then rather than a saved template. */
|
|
7372
|
-
export interface TypedMessage {
|
|
7373
|
-
subject?: string
|
|
7374
|
-
body: string
|
|
7375
|
-
/** The shorter text for SMS and WhatsApp (defaults to `body`). */
|
|
7376
|
-
sms?: string
|
|
7377
|
-
}
|
|
7378
|
-
|
|
7379
|
-
/**
|
|
7380
|
-
* What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
|
|
7381
|
-
* `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
|
|
7382
|
-
*/
|
|
7383
|
-
export interface MessageAbout {
|
|
7384
|
-
appId?: string
|
|
7385
|
-
/** What kind of record: `'booking'`, `'entry'`, `'case'`. */
|
|
7386
|
-
type: string
|
|
7387
|
-
id: string
|
|
7388
|
-
view?: string
|
|
7389
|
-
params?: Record<string, string>
|
|
7390
|
-
/** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
|
|
7391
|
-
label?: string
|
|
7392
|
-
}
|
|
7393
|
-
|
|
7394
|
-
export interface TransactionalSendError {
|
|
7395
|
-
ok: false
|
|
7396
|
-
/**
|
|
7397
|
-
* Error code. Known values:
|
|
7398
|
-
* - `transactional.contact_not_found`
|
|
7399
|
-
* - `transactional.template_not_found`
|
|
7400
|
-
* - `transactional.no_channel_available`
|
|
7401
|
-
* - `transactional.email_missing`
|
|
7402
|
-
* - `transactional.phone_missing`
|
|
7403
|
-
* - `transactional.whatsapp_missing`
|
|
7404
|
-
* - `transactional.no_push_methods`
|
|
7405
|
-
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7406
|
-
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7407
|
-
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7408
|
-
*/
|
|
7409
|
-
error: string
|
|
7410
|
-
}
|
|
7411
|
-
|
|
7025
|
+
**TransactionalSendResult** = `// src/types/comms.ts
|
|
7026
|
+
// Communication and notification types for the Smartlinks API
|
|
7027
|
+
import type { IdField } from './common'
|
|
7028
|
+
import type { BroadcastChannel } from './broadcasts'
|
|
7029
|
+
|
|
7030
|
+
/**
|
|
7031
|
+
* Target subject for notifications (product, collection, etc.)
|
|
7032
|
+
*/
|
|
7033
|
+
export interface NotificationSubjectTarget {
|
|
7034
|
+
/** Type of target entity */
|
|
7035
|
+
type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
|
|
7036
|
+
/** ID of the target entity */
|
|
7037
|
+
id: string
|
|
7038
|
+
}
|
|
7039
|
+
|
|
7040
|
+
|
|
7041
|
+
// Analytics & logging (communication events)
|
|
7042
|
+
|
|
7043
|
+
export interface CommunicationEvent {
|
|
7044
|
+
orgId: string
|
|
7045
|
+
broadcastId?: string
|
|
7046
|
+
journeyId?: string
|
|
7047
|
+
userId?: string
|
|
7048
|
+
contactId?: string
|
|
7049
|
+
channel?: string
|
|
7050
|
+
timestamp: string
|
|
7051
|
+
eventType: string
|
|
7052
|
+
outcome?: string | null
|
|
7053
|
+
templateId?: string | null
|
|
7054
|
+
[k: string]: any
|
|
7055
|
+
}
|
|
7056
|
+
|
|
7057
|
+
export interface CommsQueryByUser {
|
|
7058
|
+
userId?: string
|
|
7059
|
+
contactId?: string
|
|
7060
|
+
from?: string
|
|
7061
|
+
to?: string
|
|
7062
|
+
limit?: number
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
export type RecipientId = string
|
|
7066
|
+
export interface RecipientWithOutcome { id: string; outcome: string }
|
|
7067
|
+
|
|
7068
|
+
export interface CommsRecipientIdsQuery {
|
|
7069
|
+
broadcastId?: string
|
|
7070
|
+
journeyId?: string
|
|
7071
|
+
journeyStepId?: string
|
|
7072
|
+
idField?: IdField
|
|
7073
|
+
from?: string
|
|
7074
|
+
to?: string
|
|
7075
|
+
limit?: number
|
|
7076
|
+
}
|
|
7077
|
+
|
|
7078
|
+
export interface CommsRecipientsWithoutActionQuery {
|
|
7079
|
+
broadcastId?: string
|
|
7080
|
+
journeyId?: string
|
|
7081
|
+
actionId?: string
|
|
7082
|
+
appId?: string
|
|
7083
|
+
idField?: IdField
|
|
7084
|
+
from?: string
|
|
7085
|
+
to?: string
|
|
7086
|
+
limit?: number
|
|
7087
|
+
}
|
|
7088
|
+
|
|
7089
|
+
export interface CommsRecipientsWithActionQuery {
|
|
7090
|
+
broadcastId?: string
|
|
7091
|
+
journeyId?: string
|
|
7092
|
+
actionId?: string
|
|
7093
|
+
appId?: string
|
|
7094
|
+
outcome?: string
|
|
7095
|
+
idField?: IdField
|
|
7096
|
+
includeOutcome?: boolean
|
|
7097
|
+
from?: string
|
|
7098
|
+
to?: string
|
|
7099
|
+
limit?: number
|
|
7100
|
+
}
|
|
7101
|
+
|
|
7102
|
+
export interface LogCommunicationEventBody {
|
|
7103
|
+
broadcastId?: string
|
|
7104
|
+
journeyId?: string
|
|
7105
|
+
userId?: string
|
|
7106
|
+
contactId?: string
|
|
7107
|
+
channel?: string
|
|
7108
|
+
eventType: string
|
|
7109
|
+
outcome?: string
|
|
7110
|
+
templateId?: string
|
|
7111
|
+
timestamp?: string
|
|
7112
|
+
[k: string]: any
|
|
7113
|
+
}
|
|
7114
|
+
|
|
7115
|
+
export interface LogBulkCommunicationEventsBody {
|
|
7116
|
+
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
7117
|
+
ids: string[]
|
|
7118
|
+
idField?: IdField
|
|
7119
|
+
}
|
|
7120
|
+
|
|
7121
|
+
export interface AppendResult { success: true }
|
|
7122
|
+
export interface AppendBulkResult { success: true; count: number }
|
|
7123
|
+
|
|
7124
|
+
// Common recipient type used by segments and broadcasts
|
|
7125
|
+
export type Recipient = import('./contact').Contact
|
|
7126
|
+
|
|
7127
|
+
// Shared page response shape for recipient listings
|
|
7128
|
+
export interface RecipientsPage {
|
|
7129
|
+
items: Recipient[]
|
|
7130
|
+
total: number
|
|
7131
|
+
limit: number
|
|
7132
|
+
offset: number
|
|
7133
|
+
note?: string
|
|
7134
|
+
}
|
|
7135
|
+
|
|
7136
|
+
// Web Push (public client registration)
|
|
7137
|
+
|
|
7138
|
+
export interface PushSubscriptionJSON {
|
|
7139
|
+
endpoint: string
|
|
7140
|
+
keys?: {
|
|
7141
|
+
p256dh?: string
|
|
7142
|
+
auth?: string
|
|
7143
|
+
}
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
export interface PushVapidResponse { publicKey: string }
|
|
7147
|
+
export interface PushSubscribeResponse { ok: true; id: string }
|
|
7148
|
+
|
|
7149
|
+
// Public: register a push contact method
|
|
7150
|
+
export interface RegisterPushMethodRequest {
|
|
7151
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7152
|
+
contactId?: string
|
|
7153
|
+
endpoint: string
|
|
7154
|
+
keys: { p256dh: string; auth: string }
|
|
7155
|
+
meta?: Record<string, any>
|
|
7156
|
+
}
|
|
7157
|
+
|
|
7158
|
+
// Admin Comms Settings
|
|
7159
|
+
|
|
7160
|
+
export interface CommsSettings {
|
|
7161
|
+
unsub?: {
|
|
7162
|
+
requireToken?: boolean
|
|
7163
|
+
/** Secret for token generation; omitted unless includeSecret=true */
|
|
7164
|
+
secret?: string
|
|
7165
|
+
/** Convenience flag indicating a secret is set (masked responses) */
|
|
7166
|
+
hasSecret?: boolean
|
|
7167
|
+
}
|
|
7168
|
+
/** Map of topic keys to topic config */
|
|
7169
|
+
topics?: Record<string, TopicConfig>
|
|
7170
|
+
[k: string]: any
|
|
7171
|
+
}
|
|
7172
|
+
|
|
7173
|
+
export interface TopicConfig {
|
|
7174
|
+
label?: string
|
|
7175
|
+
description?: string
|
|
7176
|
+
/** Optional UI-only grouping labels */
|
|
7177
|
+
labels?: string[]
|
|
7178
|
+
/** Classification for UI and default policy guidance */
|
|
7179
|
+
classification?: 'transactional' | 'marketing'
|
|
7180
|
+
defaults?: {
|
|
7181
|
+
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7182
|
+
topics?: Record<string, boolean | undefined>
|
|
7183
|
+
/** Default consent policy when explicit preferences are absent */
|
|
7184
|
+
policy?: 'opt-in' | 'opt-out'
|
|
7185
|
+
/** Per-channel default policy (overrides policy when present) */
|
|
7186
|
+
byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
|
|
7187
|
+
}
|
|
7188
|
+
rules?: {
|
|
7189
|
+
allowChannels?: BroadcastChannel[]
|
|
7190
|
+
allowUnsubscribe?: boolean
|
|
7191
|
+
required?: boolean
|
|
7192
|
+
}
|
|
7193
|
+
[k: string]: any
|
|
7194
|
+
}
|
|
7195
|
+
|
|
7196
|
+
export interface CommsSettingsGetResponse {
|
|
7197
|
+
ok: true
|
|
7198
|
+
settings: CommsSettings
|
|
7199
|
+
}
|
|
7200
|
+
|
|
7201
|
+
export type CommsSettingsPatchBody = Partial<CommsSettings>
|
|
7202
|
+
|
|
7203
|
+
// Public types listing (array form for public API)
|
|
7204
|
+
export interface CommsPublicTopicsResponse { ok: true; topics: Record<string, TopicConfig> }
|
|
7205
|
+
|
|
7206
|
+
export interface UnsubscribeQuery {
|
|
7207
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7208
|
+
contactId?: string
|
|
7209
|
+
topic?: string
|
|
7210
|
+
channel?: BroadcastChannel
|
|
7211
|
+
token?: string
|
|
7212
|
+
}
|
|
7213
|
+
|
|
7214
|
+
export interface UnsubscribeResponse { ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> } }
|
|
7215
|
+
|
|
7216
|
+
// Public sign-up (double opt-in)
|
|
7217
|
+
export interface CommsSignupRequest {
|
|
7218
|
+
email: string
|
|
7219
|
+
/**
|
|
7220
|
+
* Required: YOUR app's confirmation email — a template in this collection (SL.template) whose body
|
|
7221
|
+
* uses `{{ action_url }}` for the confirm link (`{{ topics }}` lists what they signed up for). The
|
|
7222
|
+
* platform sends no default sign-up email.
|
|
7223
|
+
*/
|
|
7224
|
+
templateId: string
|
|
7225
|
+
/** Topic ids from the collection's comm settings (e.g. ["newsletter"]). */
|
|
7226
|
+
topics?: string[]
|
|
7227
|
+
firstName?: string
|
|
7228
|
+
/**
|
|
7229
|
+
* The form's other answers — firstName/lastName/displayName/company/locale/timezone and
|
|
7230
|
+
* `customFields`. Applied to the contact when the address is confirmed, and only where the contact
|
|
7231
|
+
* has no value yet (never overwritten). Small: ~2 KB.
|
|
7232
|
+
*/
|
|
7233
|
+
fields?: { firstName?: string; lastName?: string; displayName?: string; company?: string; locale?: string; timezone?: string; customFields?: Record<string, string | number | boolean> }
|
|
7234
|
+
/** Your app id, recorded with the sent email. */
|
|
7235
|
+
appId?: string
|
|
7236
|
+
}
|
|
7237
|
+
export interface CommsSignupResponse { ok: true; pending: true }
|
|
7238
|
+
|
|
7239
|
+
// Public consent/preferences/subscribe
|
|
7240
|
+
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>
|
|
7241
|
+
type SubjectType = import('./contact').SubjectType
|
|
7242
|
+
|
|
7243
|
+
export interface CommsConsentUpsertRequest {
|
|
7244
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7245
|
+
contactId?: string
|
|
7246
|
+
channels?: ConsentChannels
|
|
7247
|
+
topics?: Record<string, boolean>
|
|
7248
|
+
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7249
|
+
}
|
|
7250
|
+
|
|
7251
|
+
export interface CommsPreferencesUpsertRequest {
|
|
7252
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7253
|
+
contactId?: string
|
|
7254
|
+
subject?: { type: SubjectType; id: string; productId?: string }
|
|
7255
|
+
channels?: ConsentChannels
|
|
7256
|
+
topics?: Record<string, boolean>
|
|
7257
|
+
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7258
|
+
}
|
|
7259
|
+
|
|
7260
|
+
export interface CommsSubscribeRequest {
|
|
7261
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7262
|
+
contactId?: string
|
|
7263
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7264
|
+
subscribe: boolean
|
|
7265
|
+
source?: string
|
|
7266
|
+
}
|
|
7267
|
+
export interface CommsSubscribeResponse { ok: true; subscriptionId: string }
|
|
7268
|
+
|
|
7269
|
+
export interface CommsSubscriptionCheckQuery {
|
|
7270
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7271
|
+
contactId?: string
|
|
7272
|
+
subjectType: SubjectType
|
|
7273
|
+
subjectId: string
|
|
7274
|
+
productId?: string
|
|
7275
|
+
}
|
|
7276
|
+
export interface CommsSubscriptionCheckResponse { ok: true; subscribed: boolean }
|
|
7277
|
+
|
|
7278
|
+
export interface CommsListMethodsQuery {
|
|
7279
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7280
|
+
contactId?: string
|
|
7281
|
+
type?: BroadcastChannel
|
|
7282
|
+
}
|
|
7283
|
+
export interface CommsListMethodsResponse { ok: true; methods: import('./contact').CommMethod[] }
|
|
7284
|
+
|
|
7285
|
+
export interface RegisterEmailMethodRequest { contactId?: string; email?: string; userId?: string }
|
|
7286
|
+
export interface RegisterSmsMethodRequest { contactId?: string; phone?: string; userId?: string }
|
|
7287
|
+
export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
7288
|
+
|
|
7289
|
+
export interface SubscriptionsResolveRequest {
|
|
7290
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7291
|
+
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7292
|
+
}
|
|
7293
|
+
export interface SubscriptionsResolveResponse {
|
|
7294
|
+
ok: true
|
|
7295
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7296
|
+
contacts: Array<{
|
|
7297
|
+
contactId: string
|
|
7298
|
+
subscribed: boolean
|
|
7299
|
+
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7300
|
+
}>
|
|
7301
|
+
anySubscribed: boolean
|
|
7302
|
+
anyMethods: boolean
|
|
7303
|
+
}
|
|
7304
|
+
|
|
7305
|
+
// Transactional send (single-contact, single-message)
|
|
7306
|
+
|
|
7307
|
+
/**
|
|
7308
|
+
* Send a single message to one contact using a template.
|
|
7309
|
+
* No broadcast record is created; the send is logged directly to the
|
|
7310
|
+
* contact's communication history with sourceType: 'transactional'.
|
|
7311
|
+
*
|
|
7312
|
+
* POST /admin/collection/:collectionId/comm/send
|
|
7313
|
+
*/
|
|
7314
|
+
export interface TransactionalSendRequest {
|
|
7315
|
+
/** CRM contact UUID */
|
|
7316
|
+
contactId: string
|
|
7317
|
+
/** A saved template's id. Give this or `message`. */
|
|
7318
|
+
templateId?: string
|
|
7319
|
+
/**
|
|
7320
|
+
* A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
|
|
7321
|
+
* `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
|
|
7322
|
+
*/
|
|
7323
|
+
message?: TypedMessage
|
|
7324
|
+
/**
|
|
7325
|
+
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
7326
|
+
* contact's best available channel respecting consent, suppression, and
|
|
7327
|
+
* template availability.
|
|
7328
|
+
*/
|
|
7329
|
+
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
7330
|
+
/** Extra Liquid variables merged into the top-level render context */
|
|
7331
|
+
props?: Record<string, unknown>
|
|
7332
|
+
/** Context objects to hydrate into the Liquid template */
|
|
7333
|
+
include?: {
|
|
7334
|
+
/** Hydrate {{ collection }}. Default: true */
|
|
7335
|
+
collection?: boolean
|
|
7336
|
+
/** Hydrate {{ product }} from this product ID */
|
|
7337
|
+
productId?: string
|
|
7338
|
+
/** Hydrate {{ proof }} (requires productId) */
|
|
7339
|
+
proofId?: string
|
|
7340
|
+
/** Hydrate {{ user }} from contact.userId */
|
|
7341
|
+
user?: boolean
|
|
7342
|
+
/** Hydrate {{ appCase }} from this case UUID */
|
|
7343
|
+
appCase?: string
|
|
7344
|
+
/** Hydrate {{ appThread }} from this thread UUID */
|
|
7345
|
+
appThread?: string
|
|
7346
|
+
/** Hydrate {{ appRecord }} from this record UUID */
|
|
7347
|
+
appRecord?: string
|
|
7348
|
+
}
|
|
7349
|
+
/** Arbitrary label stored on the comms-events row (e.g. 'warranty-step-2') */
|
|
7350
|
+
ref?: string
|
|
7351
|
+
/** App context stored on the comms-events row */
|
|
7352
|
+
appId?: string
|
|
7353
|
+
/**
|
|
7354
|
+
* What the message is about: the record it was sent for and the admin screen that shows it, so it is a
|
|
7355
|
+
* link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
|
|
7356
|
+
* to the sending app.
|
|
7357
|
+
*/
|
|
7358
|
+
about?: MessageAbout
|
|
7359
|
+
/**
|
|
7360
|
+
* `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
|
|
7361
|
+
* suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
|
|
7362
|
+
*/
|
|
7363
|
+
category?: 'service'
|
|
7364
|
+
/**
|
|
7365
|
+
* Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
|
|
7366
|
+
* `attachmentsLeftOut` — the email still goes.
|
|
7367
|
+
*/
|
|
7368
|
+
attach?: EmailAttachmentSpec[]
|
|
7369
|
+
}
|
|
7370
|
+
|
|
7371
|
+
/**
|
|
7372
|
+
* One file for an email:
|
|
7373
|
+
* - `'calendar'` — the booking's `.ics` calendar invite (needs `include.booking` and `appId`)
|
|
7374
|
+
* - `{ asset }` — a file uploaded to this collection's assets
|
|
7375
|
+
* - `{ function }` — the app's (`appId`) own server function makes it (see server-functions.md, "Making an email attachment")
|
|
7376
|
+
* - `{ filename, contentType, content }` — a file you made, base64 (PDF, Office documents, images, text, CSV, calendar)
|
|
7377
|
+
* - `{ filename, file }` — a private file you made (e.g. `pdf.create` with `return: 'signedUrl'`)
|
|
7378
|
+
*/
|
|
7379
|
+
export type EmailAttachmentSpec =
|
|
7380
|
+
| 'calendar'
|
|
7381
|
+
| { asset: string }
|
|
7382
|
+
| { function: string }
|
|
7383
|
+
| { filename: string; contentType: string; content: string }
|
|
7384
|
+
| { filename: string; contentType?: string; file: string }
|
|
7385
|
+
|
|
7386
|
+
export interface TransactionalSendResponse {
|
|
7387
|
+
ok: true
|
|
7388
|
+
/** The channel the message was actually sent on */
|
|
7389
|
+
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
7390
|
+
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
7391
|
+
messageId?: string
|
|
7392
|
+
/** Attachments that couldn't be made, and why (the email went without them) */
|
|
7393
|
+
attachmentsLeftOut?: string[]
|
|
7394
|
+
}
|
|
7395
|
+
|
|
7396
|
+
/** A message written there and then rather than a saved template. */
|
|
7397
|
+
export interface TypedMessage {
|
|
7398
|
+
subject?: string
|
|
7399
|
+
body: string
|
|
7400
|
+
/** The shorter text for SMS and WhatsApp (defaults to `body`). */
|
|
7401
|
+
sms?: string
|
|
7402
|
+
}
|
|
7403
|
+
|
|
7404
|
+
/**
|
|
7405
|
+
* What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
|
|
7406
|
+
* `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
|
|
7407
|
+
*/
|
|
7408
|
+
export interface MessageAbout {
|
|
7409
|
+
appId?: string
|
|
7410
|
+
/** What kind of record: `'booking'`, `'entry'`, `'case'`. */
|
|
7411
|
+
type: string
|
|
7412
|
+
id: string
|
|
7413
|
+
view?: string
|
|
7414
|
+
params?: Record<string, string>
|
|
7415
|
+
/** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
|
|
7416
|
+
label?: string
|
|
7417
|
+
}
|
|
7418
|
+
|
|
7419
|
+
export interface TransactionalSendError {
|
|
7420
|
+
ok: false
|
|
7421
|
+
/**
|
|
7422
|
+
* Error code. Known values:
|
|
7423
|
+
* - `transactional.contact_not_found`
|
|
7424
|
+
* - `transactional.template_not_found`
|
|
7425
|
+
* - `transactional.no_channel_available`
|
|
7426
|
+
* - `transactional.email_missing`
|
|
7427
|
+
* - `transactional.phone_missing`
|
|
7428
|
+
* - `transactional.whatsapp_missing`
|
|
7429
|
+
* - `transactional.no_push_methods`
|
|
7430
|
+
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7431
|
+
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7432
|
+
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7433
|
+
*/
|
|
7434
|
+
error: string
|
|
7435
|
+
}
|
|
7436
|
+
|
|
7412
7437
|
export type TransactionalSendResult =`
|
|
7413
7438
|
|
|
7414
7439
|
### config
|
|
@@ -12982,36 +13007,36 @@ interface GuideStartOptions {
|
|
|
12982
13007
|
|
|
12983
13008
|
**AppConfigOptions** (type)
|
|
12984
13009
|
```typescript
|
|
12985
|
-
type AppConfigOptions = {
|
|
12986
|
-
/** The app ID */
|
|
12987
|
-
appId: string
|
|
12988
|
-
|
|
12989
|
-
/** Collection ID (required for most operations) */
|
|
12990
|
-
collectionId?: string
|
|
12991
|
-
/** Product ID (optional - for product-scoped config) */
|
|
12992
|
-
productId?: string
|
|
12993
|
-
/** Variant ID (optional - for variant-scoped config) */
|
|
12994
|
-
variantId?: string
|
|
12995
|
-
/** Batch ID (optional - for batch-scoped config) */
|
|
12996
|
-
batchId?: string
|
|
12997
|
-
|
|
12998
|
-
/** Item ID - required for getDataItem/deleteDataItem */
|
|
12999
|
-
itemId?: string
|
|
13000
|
-
|
|
13001
|
-
/**
|
|
13002
|
-
* Use admin endpoints instead of public.
|
|
13003
|
-
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
13004
|
-
*/
|
|
13005
|
-
admin?: boolean
|
|
13006
|
-
|
|
13007
|
-
/**
|
|
13008
|
-
* Configuration object for setConfig.
|
|
13009
|
-
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
13010
|
-
* Public reads return the root config but omit `config.admin`.
|
|
13011
|
-
*/
|
|
13012
|
-
config?: any
|
|
13013
|
-
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
13014
|
-
data?: any
|
|
13010
|
+
type AppConfigOptions = {
|
|
13011
|
+
/** The app ID */
|
|
13012
|
+
appId: string
|
|
13013
|
+
|
|
13014
|
+
/** Collection ID (required for most operations) */
|
|
13015
|
+
collectionId?: string
|
|
13016
|
+
/** Product ID (optional - for product-scoped config) */
|
|
13017
|
+
productId?: string
|
|
13018
|
+
/** Variant ID (optional - for variant-scoped config) */
|
|
13019
|
+
variantId?: string
|
|
13020
|
+
/** Batch ID (optional - for batch-scoped config) */
|
|
13021
|
+
batchId?: string
|
|
13022
|
+
|
|
13023
|
+
/** Item ID - required for getDataItem/deleteDataItem */
|
|
13024
|
+
itemId?: string
|
|
13025
|
+
|
|
13026
|
+
/**
|
|
13027
|
+
* Use admin endpoints instead of public.
|
|
13028
|
+
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
13029
|
+
*/
|
|
13030
|
+
admin?: boolean
|
|
13031
|
+
|
|
13032
|
+
/**
|
|
13033
|
+
* Configuration object for setConfig.
|
|
13034
|
+
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
13035
|
+
* Public reads return the root config but omit `config.admin`.
|
|
13036
|
+
*/
|
|
13037
|
+
config?: any
|
|
13038
|
+
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
13039
|
+
data?: any
|
|
13015
13040
|
}
|
|
13016
13041
|
```
|
|
13017
13042
|
|
|
@@ -13435,70 +13460,70 @@ Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when availabl
|
|
|
13435
13460
|
|
|
13436
13461
|
Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
|
|
13437
13462
|
|
|
13438
|
-
**create**(collectionId: string,
|
|
13439
|
-
appId: string,
|
|
13440
|
-
input: CreateCaseInput,
|
|
13463
|
+
**create**(collectionId: string,
|
|
13464
|
+
appId: string,
|
|
13465
|
+
input: CreateCaseInput,
|
|
13441
13466
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13442
13467
|
Create a new case POST /cases
|
|
13443
13468
|
|
|
13444
|
-
**list**(collectionId: string,
|
|
13445
|
-
appId: string,
|
|
13446
|
-
params?: CaseListQueryParams,
|
|
13469
|
+
**list**(collectionId: string,
|
|
13470
|
+
appId: string,
|
|
13471
|
+
params?: CaseListQueryParams,
|
|
13447
13472
|
admin: boolean = false) → `Promise<PaginatedResponse<AppCase>>`
|
|
13448
13473
|
List cases with optional query parameters GET /cases
|
|
13449
13474
|
|
|
13450
|
-
**get**(collectionId: string,
|
|
13451
|
-
appId: string,
|
|
13452
|
-
caseId: string,
|
|
13475
|
+
**get**(collectionId: string,
|
|
13476
|
+
appId: string,
|
|
13477
|
+
caseId: string,
|
|
13453
13478
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13454
13479
|
Get a single case by ID GET /cases/:caseId
|
|
13455
13480
|
|
|
13456
|
-
**update**(collectionId: string,
|
|
13457
|
-
appId: string,
|
|
13458
|
-
caseId: string,
|
|
13459
|
-
input: UpdateCaseInput,
|
|
13481
|
+
**update**(collectionId: string,
|
|
13482
|
+
appId: string,
|
|
13483
|
+
caseId: string,
|
|
13484
|
+
input: UpdateCaseInput,
|
|
13460
13485
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13461
13486
|
Update a case PATCH /cases/:caseId Admin can update any field, public (owner) can only update data and owner zones
|
|
13462
13487
|
|
|
13463
|
-
**remove**(collectionId: string,
|
|
13464
|
-
appId: string,
|
|
13465
|
-
caseId: string,
|
|
13488
|
+
**remove**(collectionId: string,
|
|
13489
|
+
appId: string,
|
|
13490
|
+
caseId: string,
|
|
13466
13491
|
admin: boolean = false) → `Promise<`
|
|
13467
13492
|
Soft delete a case DELETE /cases/:caseId
|
|
13468
13493
|
|
|
13469
|
-
**aggregate**(collectionId: string,
|
|
13470
|
-
appId: string,
|
|
13471
|
-
request: AggregateRequest,
|
|
13494
|
+
**aggregate**(collectionId: string,
|
|
13495
|
+
appId: string,
|
|
13496
|
+
request: AggregateRequest,
|
|
13472
13497
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
13473
13498
|
Get aggregate statistics for cases POST /cases/aggregate
|
|
13474
13499
|
|
|
13475
|
-
**summary**(collectionId: string,
|
|
13476
|
-
appId: string,
|
|
13500
|
+
**summary**(collectionId: string,
|
|
13501
|
+
appId: string,
|
|
13477
13502
|
request?: CaseSummaryRequest) → `Promise<CaseSummaryResponse>`
|
|
13478
13503
|
Get case summary (admin only) POST /cases/summary
|
|
13479
13504
|
|
|
13480
|
-
**appendHistory**(collectionId: string,
|
|
13481
|
-
appId: string,
|
|
13482
|
-
caseId: string,
|
|
13505
|
+
**appendHistory**(collectionId: string,
|
|
13506
|
+
appId: string,
|
|
13507
|
+
caseId: string,
|
|
13483
13508
|
input: AppendHistoryInput) → `Promise<AppCase>`
|
|
13484
13509
|
Append an entry to case history (admin only) POST /cases/:caseId/history
|
|
13485
13510
|
|
|
13486
|
-
**related**(collectionId: string,
|
|
13487
|
-
appId: string,
|
|
13511
|
+
**related**(collectionId: string,
|
|
13512
|
+
appId: string,
|
|
13488
13513
|
caseId: string) → `Promise<RelatedResponse>`
|
|
13489
13514
|
Get related threads and records for a case (admin only) GET /cases/:caseId/related
|
|
13490
13515
|
|
|
13491
13516
|
### app.options
|
|
13492
13517
|
|
|
13493
|
-
**get**(collectionId: string,
|
|
13494
|
-
appId: string,
|
|
13495
|
-
source: string,
|
|
13518
|
+
**get**(collectionId: string,
|
|
13519
|
+
appId: string,
|
|
13520
|
+
source: string,
|
|
13496
13521
|
opts: { q?: string; version?: string; admin?: boolean } = {},) → `Promise<import('../types/appOptions').AppOptionsResponse>`
|
|
13497
13522
|
`source` = `type:<record type or declared type id>` | `list:<list id>`. Admins (`admin: true`) see every entry; the public API lists public records and lists the app declares public. Hold on to `version` and pass it back to get `{ unchanged: true }` when nothing changed.
|
|
13498
13523
|
|
|
13499
|
-
**saveList**(collectionId: string,
|
|
13500
|
-
appId: string,
|
|
13501
|
-
listId: string,
|
|
13524
|
+
**saveList**(collectionId: string,
|
|
13525
|
+
appId: string,
|
|
13526
|
+
listId: string,
|
|
13502
13527
|
values: import('../types/appOptions') → `void`
|
|
13503
13528
|
Save a value list's values, in order (admins). Codes never change and are never lost: a value left out stays, switched off, at the end. → the list as saved.
|
|
13504
13529
|
|
|
@@ -13506,92 +13531,92 @@ Save a value list's values, in order (admins). Codes never change and are never
|
|
|
13506
13531
|
|
|
13507
13532
|
General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
|
|
13508
13533
|
|
|
13509
|
-
**create**(collectionId: string,
|
|
13510
|
-
appId: string,
|
|
13511
|
-
input: CreateRecordInput,
|
|
13534
|
+
**create**(collectionId: string,
|
|
13535
|
+
appId: string,
|
|
13536
|
+
input: CreateRecordInput,
|
|
13512
13537
|
admin: boolean = false) → `Promise<CreateRecordResponse>`
|
|
13513
13538
|
Create a new record POST /records When called on the public endpoint (admin = false) with an anonymous caller, and the app's `publicCreate.records.anonymous.edit.editToken` policy is enabled, the response includes a one-time `editToken` string. Store it immediately — it is never returned again.
|
|
13514
13539
|
|
|
13515
|
-
**query**(collectionId: string,
|
|
13516
|
-
appId: string,
|
|
13540
|
+
**query**(collectionId: string,
|
|
13541
|
+
appId: string,
|
|
13517
13542
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
13518
13543
|
The standard query on an app's records (admin only): filter, sort, page, count and total in one call, reaching into a record's own fields by path, and following a record to its `product` and its `contact`. POST /admin/collection/:collectionId/app/:appId/records/query Fields: id, recordType, ref, status, visibility, customId, productId, variantId, batchId, proofId, contactId, authorId, parentType, parentId, createdAt, updatedAt, startsAt, expiresAt, and the documents data, owner and admin, reached by path: `"data.status"`, `"data.line.name"`. ```typescript // How many work orders by status, and how many units on each await app.records.query(collectionId, appId, { where: { recordType: 'work_order' }, groupBy: ['data.status'], aggregates: { orders: { count: true }, units: { sum: 'data.qty' } }, }) ```
|
|
13519
13544
|
|
|
13520
13545
|
**queryFields**(collectionId: string, appId: string) → `Promise<QueryDescription>`
|
|
13521
13546
|
What a records query can use: its fields, what each can filter, sort, group or total, and its links. GET /admin/collection/:collectionId/app/:appId/records/query
|
|
13522
13547
|
|
|
13523
|
-
**list**(collectionId: string,
|
|
13524
|
-
appId: string,
|
|
13525
|
-
params?: RecordListQueryParams,
|
|
13548
|
+
**list**(collectionId: string,
|
|
13549
|
+
appId: string,
|
|
13550
|
+
params?: RecordListQueryParams,
|
|
13526
13551
|
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
13527
13552
|
List records with optional query parameters GET /records Public/owner callers only receive records with `status: "active"`. Admin callers can query all statuses (for example `draft`/`archived`).
|
|
13528
13553
|
|
|
13529
|
-
**get**(collectionId: string,
|
|
13530
|
-
appId: string,
|
|
13531
|
-
recordId: string,
|
|
13554
|
+
**get**(collectionId: string,
|
|
13555
|
+
appId: string,
|
|
13556
|
+
recordId: string,
|
|
13532
13557
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
13533
13558
|
Get a single record by ID GET /records/:recordId
|
|
13534
13559
|
|
|
13535
|
-
**update**(collectionId: string,
|
|
13536
|
-
appId: string,
|
|
13537
|
-
recordId: string,
|
|
13538
|
-
input: UpdateRecordInput,
|
|
13560
|
+
**update**(collectionId: string,
|
|
13561
|
+
appId: string,
|
|
13562
|
+
recordId: string,
|
|
13563
|
+
input: UpdateRecordInput,
|
|
13539
13564
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
13540
13565
|
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
13541
13566
|
|
|
13542
|
-
**updateWithToken**(collectionId: string,
|
|
13543
|
-
appId: string,
|
|
13544
|
-
recordId: string,
|
|
13545
|
-
data: Record<string, unknown>,
|
|
13567
|
+
**updateWithToken**(collectionId: string,
|
|
13568
|
+
appId: string,
|
|
13569
|
+
recordId: string,
|
|
13570
|
+
data: Record<string, unknown>,
|
|
13546
13571
|
editToken: string) → `Promise<AppRecord>`
|
|
13547
13572
|
Amend the `data` zone of a record using an anonymous edit token. PATCH /records/:recordId (public endpoint, no auth) This is the follow-up call after an anonymous `create()` that returned an `editToken`. Present the token via `X-Edit-Token` — the server validates it with a constant-time comparison and, if `windowMinutes` is configured in the policy, checks that the token has not expired. **Scope:** only the `data` zone may be modified via this path. `owner`, `admin`, `status`, `visibility`, and indexed fields are immutable to anonymous token holders. ```ts const record = await app.records.create(collectionId, appId, { recordType: 'payment', visibility: 'public', data: { amount: 9900, currency: 'USD' }, }) const { editToken } = record // store this immediately! // Later, once the payment gateway confirms: const updated = await app.records.updateWithToken( collectionId, appId, record.id, { amount: 9900, currency: 'USD', transactionId: 'txn_abc123' }, editToken, ) ``` ### Error codes | HTTP | `errorCode` | Meaning | |------|-----------------------|---------------------------------------------------| | 401 | `UNAUTHORIZED` | No auth token and no `X-Edit-Token` header | | 403 | `FORBIDDEN` | Policy not enabled, or token does not match | | 403 | `EDIT_WINDOW_EXPIRED` | `windowMinutes` elapsed since record creation | | 404 | `NOT_FOUND` | Record does not exist |
|
|
13548
13573
|
|
|
13549
|
-
**remove**(collectionId: string,
|
|
13550
|
-
appId: string,
|
|
13551
|
-
recordId: string,
|
|
13574
|
+
**remove**(collectionId: string,
|
|
13575
|
+
appId: string,
|
|
13576
|
+
recordId: string,
|
|
13552
13577
|
admin: boolean = false) → `Promise<`
|
|
13553
13578
|
Soft delete a record DELETE /records/:recordId
|
|
13554
13579
|
|
|
13555
|
-
**aggregate**(collectionId: string,
|
|
13556
|
-
appId: string,
|
|
13557
|
-
request: AggregateRequest,
|
|
13580
|
+
**aggregate**(collectionId: string,
|
|
13581
|
+
appId: string,
|
|
13582
|
+
request: AggregateRequest,
|
|
13558
13583
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
13559
13584
|
Get aggregate statistics for records POST /records/aggregate
|
|
13560
13585
|
|
|
13561
|
-
**restore**(collectionId: string,
|
|
13562
|
-
appId: string,
|
|
13586
|
+
**restore**(collectionId: string,
|
|
13587
|
+
appId: string,
|
|
13563
13588
|
recordId: string) → `Promise<AppRecord>`
|
|
13564
13589
|
Restore a soft-deleted record. POST /records/:recordId/restore (admin only)
|
|
13565
13590
|
|
|
13566
|
-
**upsert**(collectionId: string,
|
|
13567
|
-
appId: string,
|
|
13591
|
+
**upsert**(collectionId: string,
|
|
13592
|
+
appId: string,
|
|
13568
13593
|
input: UpsertRecordInput) → `Promise<UpsertRecordResponse>`
|
|
13569
13594
|
Upsert a record by ref — creates if no record with that ref exists, otherwise updates. Scope, specificity, and ref are canonicalized on write. POST /records/upsert (admin only)
|
|
13570
13595
|
|
|
13571
|
-
**match**(collectionId: string,
|
|
13572
|
-
appId: string,
|
|
13573
|
-
input: MatchRecordsInput,
|
|
13596
|
+
**match**(collectionId: string,
|
|
13597
|
+
appId: string,
|
|
13598
|
+
input: MatchRecordsInput,
|
|
13574
13599
|
admin: boolean = false) → `Promise<MatchResult>`
|
|
13575
13600
|
Match records against a runtime target scope. Returns records whose scope is satisfied by the target, ordered by specificity descending (most specific first). POST /records/match ```ts const { records, best } = await app.records.match(collectionId, appId, { target: { productId: 'prod_abc', facets: { tier: ['gold'] } }, strategy: 'best', recordType: 'nutrition', }, true); // best.nutrition → the single highest-specificity nutrition record ```
|
|
13576
13601
|
|
|
13577
|
-
**bulkUpsert**(collectionId: string,
|
|
13578
|
-
appId: string,
|
|
13602
|
+
**bulkUpsert**(collectionId: string,
|
|
13603
|
+
appId: string,
|
|
13579
13604
|
records: BulkUpsertItem[]) → `Promise<BulkUpsertResult>`
|
|
13580
13605
|
Upsert up to 500 records in a single transaction. Each row is individually error-isolated — a failure on one row does not abort the others. POST /records/bulk-upsert (admin only)
|
|
13581
13606
|
|
|
13582
|
-
**bulkDelete**(collectionId: string,
|
|
13583
|
-
appId: string,
|
|
13607
|
+
**bulkDelete**(collectionId: string,
|
|
13608
|
+
appId: string,
|
|
13584
13609
|
input: BulkDeleteInput) → `Promise<BulkDeleteResult>`
|
|
13585
13610
|
Soft-delete records in bulk. Supports two modes: - **refs mode**: explicit list of refs (max 1000) - **scope mode**: delete by scope anchor (productId / variantId / etc.) POST /records/bulk-delete (admin only) ```ts // Refs mode await app.records.bulkDelete(collectionId, appId, { refs: ['product:prod_abc', 'product:prod_xyz'], recordType: 'nutrition', }); // Scope mode await app.records.bulkDelete(collectionId, appId, { scope: { productId: 'prod_abc' }, }); ```
|
|
13586
13611
|
|
|
13587
|
-
**resolveAll**(collectionId: string,
|
|
13588
|
-
appId: string,
|
|
13589
|
-
input: ResolveAllParams,
|
|
13612
|
+
**resolveAll**(collectionId: string,
|
|
13613
|
+
appId: string,
|
|
13614
|
+
input: ResolveAllParams,
|
|
13590
13615
|
admin: boolean = false) → `Promise<ResolveAllResult>`
|
|
13591
13616
|
Resolve every applicable record for a product context in one call. Returns records across all tiers (proof, batch, variant, product, rule, facet, collection) deduplicated and sorted by specificity descending. POST /records/resolve-all
|
|
13592
13617
|
|
|
13593
|
-
**previewRule**(collectionId: string,
|
|
13594
|
-
appId: string,
|
|
13618
|
+
**previewRule**(collectionId: string,
|
|
13619
|
+
appId: string,
|
|
13595
13620
|
input: PreviewRuleParams) → `Promise<PreviewRuleResult>`
|
|
13596
13621
|
Preview which products in the collection match a given facetRule. Admin only. Use for live "matches N products" feedback while authoring a rule. POST /records/preview-rule
|
|
13597
13622
|
|
|
@@ -13599,54 +13624,54 @@ Preview which products in the collection match a given facetRule. Admin only. Us
|
|
|
13599
13624
|
|
|
13600
13625
|
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|
|
13601
13626
|
|
|
13602
|
-
**create**(collectionId: string,
|
|
13603
|
-
appId: string,
|
|
13604
|
-
input: CreateThreadInput,
|
|
13627
|
+
**create**(collectionId: string,
|
|
13628
|
+
appId: string,
|
|
13629
|
+
input: CreateThreadInput,
|
|
13605
13630
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13606
13631
|
Create a new thread POST /threads
|
|
13607
13632
|
|
|
13608
|
-
**list**(collectionId: string,
|
|
13609
|
-
appId: string,
|
|
13610
|
-
params?: ThreadListQueryParams,
|
|
13633
|
+
**list**(collectionId: string,
|
|
13634
|
+
appId: string,
|
|
13635
|
+
params?: ThreadListQueryParams,
|
|
13611
13636
|
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
13612
13637
|
List threads with optional query parameters GET /threads
|
|
13613
13638
|
|
|
13614
|
-
**get**(collectionId: string,
|
|
13615
|
-
appId: string,
|
|
13616
|
-
threadId: string,
|
|
13639
|
+
**get**(collectionId: string,
|
|
13640
|
+
appId: string,
|
|
13641
|
+
threadId: string,
|
|
13617
13642
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13618
13643
|
Get a single thread by ID GET /threads/:threadId
|
|
13619
13644
|
|
|
13620
|
-
**update**(collectionId: string,
|
|
13621
|
-
appId: string,
|
|
13622
|
-
threadId: string,
|
|
13623
|
-
input: UpdateThreadInput,
|
|
13645
|
+
**update**(collectionId: string,
|
|
13646
|
+
appId: string,
|
|
13647
|
+
threadId: string,
|
|
13648
|
+
input: UpdateThreadInput,
|
|
13624
13649
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13625
13650
|
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
13626
13651
|
|
|
13627
|
-
**remove**(collectionId: string,
|
|
13628
|
-
appId: string,
|
|
13629
|
-
threadId: string,
|
|
13652
|
+
**remove**(collectionId: string,
|
|
13653
|
+
appId: string,
|
|
13654
|
+
threadId: string,
|
|
13630
13655
|
admin: boolean = false) → `Promise<`
|
|
13631
13656
|
Soft delete a thread DELETE /threads/:threadId
|
|
13632
13657
|
|
|
13633
|
-
**reply**(collectionId: string,
|
|
13634
|
-
appId: string,
|
|
13635
|
-
threadId: string,
|
|
13636
|
-
input: ReplyInput,
|
|
13658
|
+
**reply**(collectionId: string,
|
|
13659
|
+
appId: string,
|
|
13660
|
+
threadId: string,
|
|
13661
|
+
input: ReplyInput,
|
|
13637
13662
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13638
13663
|
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
13639
13664
|
|
|
13640
|
-
**deleteReply**(collectionId: string,
|
|
13641
|
-
appId: string,
|
|
13642
|
-
threadId: string,
|
|
13643
|
-
replyId: string,
|
|
13665
|
+
**deleteReply**(collectionId: string,
|
|
13666
|
+
appId: string,
|
|
13667
|
+
threadId: string,
|
|
13668
|
+
replyId: string,
|
|
13644
13669
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13645
13670
|
Delete a single reply from a thread by its reply id (moderation). DELETE /threads/:threadId/reply/:replyId Authorised for the reply's author, the proof owner, or a collection admin.
|
|
13646
13671
|
|
|
13647
|
-
**aggregate**(collectionId: string,
|
|
13648
|
-
appId: string,
|
|
13649
|
-
request: AggregateRequest,
|
|
13672
|
+
**aggregate**(collectionId: string,
|
|
13673
|
+
appId: string,
|
|
13674
|
+
request: AggregateRequest,
|
|
13650
13675
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
13651
13676
|
Get aggregate statistics for threads POST /threads/aggregate
|
|
13652
13677
|
|
|
@@ -13681,19 +13706,19 @@ Set/create a keyed data item within a scope. Requires admin authentication. Use
|
|
|
13681
13706
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
13682
13707
|
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' }); ```
|
|
13683
13708
|
|
|
13684
|
-
**getWidgets**(collectionId: string,
|
|
13709
|
+
**getWidgets**(collectionId: string,
|
|
13685
13710
|
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
13686
13711
|
Fetches ALL widget data (manifests + bundle files) for a collection in one call. Returns everything needed to render widgets with zero additional requests. This solves N+1 query problems by fetching manifests, JavaScript bundles, and CSS files in parallel on the server. ```typescript // Fetch all widget data for a collection const { apps } = await Api.AppConfiguration.getWidgets(collectionId); // Returns: [{ appId, manifest, widget, container, admin }, ...] // widget / container: { js: { umd?, esm? }, css?, source?, styles? } // source / styles - the bundle inlined (when small enough); js / css - URLs otherwise. // admin - URL of the app's app.admin.json (setup / tunable options), or null. // Bundles don't ship React: they resolve shared libraries from the HOST's globals // (host-dependency-contract.md), so loading one is a host's job. // // Inside a host (Portal / Hub), an app showing ANOTHER app's widget should not load // bundles itself - use the host-provided EmbeddedWidget prop: // <EmbeddedWidget appId="raffle" size="standard" /> (docs/widgets.md) // Force refresh all widgets const { apps } = await Api.AppConfiguration.getWidgets(collectionId, { force: true }); ```
|
|
13687
13712
|
|
|
13688
13713
|
**resolveFeature**(system: SystemBlock | undefined, flag: string) → `boolean`
|
|
13689
13714
|
Resolve whether a feature flag is on, applying the `accountType` default: `enterprise` accounts default every flag to **on** unless `features[flag]` is explicitly `false`; `standard` accounts (or missing `accountType`) default every flag to **off** unless `features[flag]` is explicitly `true`. An explicit value always wins over the default either way. This is the same logic `isFeatureEnabled()` / `isFeatureEnabledSync()` use internally — call those instead in normal code. `system.features` and `accountType` are public data (no admin-only feature-check path exists), so there's no reason to fetch differently for an admin surface. This is exposed separately only for the rare case where you already have a `system` block in hand from somewhere other than `getAppConfig()` (e.g. server-rendered props) and want to resolve a flag from it directly. ```typescript const enabled = appConfiguration.resolveFeature(someSystemBlock, 'custom_domain'); ```
|
|
13690
13715
|
|
|
13691
|
-
**getAppConfig**(collectionId: string,
|
|
13716
|
+
**getAppConfig**(collectionId: string,
|
|
13692
13717
|
options?: { force?: boolean }) → `Promise<AppsConfigResponse>`
|
|
13693
13718
|
Fetch the collection's app catalog + `appConfig` entitlements data in one call — installed modules (`apps`), resolved entitlements (`system.features`, `system.meters`, etc.), and item-handling settings. This is `/public/collection/:id/app/config` (`collection.getAppsConfig()`), which now carries both; there's no need to separately call `appConfiguration.getConfig({ appId: 'appConfig' })` for public reads. Cached in-memory (and sessionStorage) for `ttl` so repeated calls across a page/session are cheap; pass `force` to bypass the cache after a mutation (e.g. after `entitlements-reconcile`). For admin-only data (`systemPrivate`), use `appConfiguration.getConfig({ collectionId, appId: 'appConfig', admin: true })` directly — this endpoint is public-only and never returns it. See docs/appConfig.md for the full contract. ```typescript const cfg = await appConfiguration.getAppConfig(collectionId); console.log(cfg.system?.features); ```
|
|
13694
13719
|
|
|
13695
|
-
**isFeatureEnabled**(collectionId: string,
|
|
13696
|
-
flag: string,
|
|
13720
|
+
**isFeatureEnabled**(collectionId: string,
|
|
13721
|
+
flag: string,
|
|
13697
13722
|
options?: { force?: boolean }) → `Promise<boolean>`
|
|
13698
13723
|
Check whether a feature flag is enabled for a collection, per `appConfig.system.features` — applying the `accountType` default (see `resolveFeature()`): enterprise accounts default every flag to on unless explicitly set to `false`. This is the standard way for subapps to gate features — it reads through the same cache as `getAppConfig`, so calling it repeatedly (e.g. once per component) does not re-fetch on every call. This is always async because the very first call for a collection has nothing to read yet. If you need a synchronous check (e.g. inside a render function), call this once during app init to warm the cache, then use `isFeatureEnabledSync()` afterwards. ```typescript if (await appConfiguration.isFeatureEnabled(collectionId, 'custom_domain')) { enableCustomDomainUI(); } ```
|
|
13699
13724
|
|
|
@@ -14325,13 +14350,13 @@ Delete a slot (admin; refused while places are booked).
|
|
|
14325
14350
|
|
|
14326
14351
|
### chat.completions
|
|
14327
14352
|
|
|
14328
|
-
**create**(collectionId: string,
|
|
14353
|
+
**create**(collectionId: string,
|
|
14329
14354
|
request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
|
|
14330
14355
|
Create a chat completion (streaming or non-streaming)
|
|
14331
14356
|
|
|
14332
14357
|
### chat.responses
|
|
14333
14358
|
|
|
14334
|
-
**create**(collectionId: string,
|
|
14359
|
+
**create**(collectionId: string,
|
|
14335
14360
|
request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
|
|
14336
14361
|
Create a Responses API request (streaming or non-streaming)
|
|
14337
14362
|
|
|
@@ -14425,6 +14450,9 @@ Record the chip a phone just programmed with this code.
|
|
|
14425
14450
|
|
|
14426
14451
|
### collection
|
|
14427
14452
|
|
|
14453
|
+
**readiness**(collectionId: string) → `Promise<CollectionReadiness>`
|
|
14454
|
+
What the collection's installed apps need and whether it's there (sign-in, customers, products, something to claim), in plain words, each with the screen that fixes it. Admin. Never fails on a part it can't read: that part is left out.
|
|
14455
|
+
|
|
14428
14456
|
**get**(collectionId: string, admin?: boolean) → `Promise<CollectionResponse>`
|
|
14429
14457
|
Retrieves a single Collection by its ID.
|
|
14430
14458
|
|
|
@@ -14504,86 +14532,86 @@ Invite a user to a collection by email (admin only). Creates or links their acco
|
|
|
14504
14532
|
**getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
|
|
14505
14533
|
Public: Get VAPID public key used for Web Push subscriptions. GET /public/collection/:collectionId/comm/push/vapidPublicKey Note: Key may be global; path is collection-scoped for consistency.
|
|
14506
14534
|
|
|
14507
|
-
**registerPush**(collectionId: string,
|
|
14535
|
+
**registerPush**(collectionId: string,
|
|
14508
14536
|
body: import("../types/comms") → `void`
|
|
14509
14537
|
Public: Register a Web Push subscription under unified comms. POST /public/collection/:collectionId/comm/push/register
|
|
14510
14538
|
|
|
14511
|
-
**getSettings**(collectionId: string,
|
|
14539
|
+
**getSettings**(collectionId: string,
|
|
14512
14540
|
opts: { includeSecret?: boolean } = {}) → `Promise<import("../types/comms").CommsSettingsGetResponse>`
|
|
14513
14541
|
Admin: Get current comms settings for a collection. GET /admin/collection/:collectionId/comm.settings Optional query: includeSecret=true to include unsub.secret in response.
|
|
14514
14542
|
|
|
14515
|
-
**patchSettings**(collectionId: string,
|
|
14543
|
+
**patchSettings**(collectionId: string,
|
|
14516
14544
|
body: import("../types/comms") → `void`
|
|
14517
14545
|
Admin: Patch comms settings for a collection. PATCH /admin/collection/:collectionId/comm.settings
|
|
14518
14546
|
|
|
14519
14547
|
**getPublicTopics**(collectionId: string) → `Promise<import("../types/comms").CommsPublicTopicsResponse>`
|
|
14520
14548
|
Public: Fetch configured topics for a collection. GET /public/collection/:collectionId/comm/topics
|
|
14521
14549
|
|
|
14522
|
-
**unsubscribe**(collectionId: string,
|
|
14550
|
+
**unsubscribe**(collectionId: string,
|
|
14523
14551
|
query: import("../types/comms") → `void`
|
|
14524
14552
|
Public: Unsubscribe a contact from a category or channel. GET /public/collection/:collectionId/comm/unsubscribe
|
|
14525
14553
|
|
|
14526
|
-
**signup**(collectionId: string,
|
|
14554
|
+
**signup**(collectionId: string,
|
|
14527
14555
|
body: import("../types/comms") → `void`
|
|
14528
14556
|
Public: sign an email address up for topics (a newsletter, updates) — works signed out. Double opt-in: nothing is consented until the address's owner clicks the confirmation link SmartLinks emails them. Always answers `{ ok: true, pending: true }` (it never reveals whether the address is already known). Topics must be ones configured in the collection's comm settings. Set comm settings `signup.confirmedUrl` to send people to your own page after confirming. POST /public/collection/:collectionId/comm/signup
|
|
14529
14557
|
|
|
14530
|
-
**upsertConsent**(collectionId: string,
|
|
14558
|
+
**upsertConsent**(collectionId: string,
|
|
14531
14559
|
body: import("../types/comms") → `void`
|
|
14532
14560
|
Public: Upsert default consent for a contact. POST /public/collection/:collectionId/comm/consent
|
|
14533
14561
|
|
|
14534
|
-
**upsertPreferences**(collectionId: string,
|
|
14562
|
+
**upsertPreferences**(collectionId: string,
|
|
14535
14563
|
body: import("../types/comms") → `void`
|
|
14536
14564
|
Public: Upsert preferences for a specific subject (or default if subject omitted). POST /public/collection/:collectionId/comm/preferences
|
|
14537
14565
|
|
|
14538
|
-
**subscribe**(collectionId: string,
|
|
14566
|
+
**subscribe**(collectionId: string,
|
|
14539
14567
|
body: import("../types/comms") → `void`
|
|
14540
14568
|
Public: Subscribe/unsubscribe contact to a subject. POST /public/collection/:collectionId/comm/subscribe
|
|
14541
14569
|
|
|
14542
|
-
**checkSubscription**(collectionId: string,
|
|
14570
|
+
**checkSubscription**(collectionId: string,
|
|
14543
14571
|
query: import("../types/comms") → `void`
|
|
14544
14572
|
Public: Check subscription status for a subject. GET /public/collection/:collectionId/comm/subscription/check
|
|
14545
14573
|
|
|
14546
|
-
**listMethods**(collectionId: string,
|
|
14574
|
+
**listMethods**(collectionId: string,
|
|
14547
14575
|
query: import("../types/comms") → `void`
|
|
14548
14576
|
Public: List registered contact methods. GET /public/collection/:collectionId/comm/methods
|
|
14549
14577
|
|
|
14550
|
-
**registerEmail**(collectionId: string,
|
|
14578
|
+
**registerEmail**(collectionId: string,
|
|
14551
14579
|
body: import("../types/comms") → `void`
|
|
14552
14580
|
Public: Register email method for a contact. POST /public/collection/:collectionId/comm/email/register
|
|
14553
14581
|
|
|
14554
|
-
**registerSms**(collectionId: string,
|
|
14582
|
+
**registerSms**(collectionId: string,
|
|
14555
14583
|
body: import("../types/comms") → `void`
|
|
14556
14584
|
Public: Register SMS method for a contact. POST /public/collection/:collectionId/comm/sms/register
|
|
14557
14585
|
|
|
14558
|
-
**resolveSubscriptions**(collectionId: string,
|
|
14586
|
+
**resolveSubscriptions**(collectionId: string,
|
|
14559
14587
|
body: import("../types/comms") → `void`
|
|
14560
14588
|
Public: Resolve contacts for a subject with identity hints. POST /public/collection/:collectionId/comm/subscriptions/resolve
|
|
14561
14589
|
|
|
14562
|
-
**queryByUser**(collectionId: string,
|
|
14590
|
+
**queryByUser**(collectionId: string,
|
|
14563
14591
|
body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
|
|
14564
14592
|
Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
|
|
14565
14593
|
|
|
14566
|
-
**queryRecipientIds**(collectionId: string,
|
|
14594
|
+
**queryRecipientIds**(collectionId: string,
|
|
14567
14595
|
body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
|
|
14568
14596
|
Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
14569
14597
|
|
|
14570
|
-
**queryRecipientsWithoutAction**(collectionId: string,
|
|
14598
|
+
**queryRecipientsWithoutAction**(collectionId: string,
|
|
14571
14599
|
body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
|
|
14572
14600
|
Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
14573
14601
|
|
|
14574
|
-
**queryRecipientsWithAction**(collectionId: string,
|
|
14602
|
+
**queryRecipientsWithAction**(collectionId: string,
|
|
14575
14603
|
body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
|
|
14576
14604
|
Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
14577
14605
|
|
|
14578
|
-
**sendTransactional**(collectionId: string,
|
|
14606
|
+
**sendTransactional**(collectionId: string,
|
|
14579
14607
|
body: TransactionalSendRequest) → `Promise<TransactionalSendResult>`
|
|
14580
14608
|
Send a single transactional message to one contact using a template. No broadcast record is created. The send is logged to the contact's communication history with sourceType: 'transactional'. POST /admin/collection/:collectionId/comm/send ```typescript const result = await comms.sendTransactional(collectionId, { contactId: 'e4f2a1b0-...', templateId: 'warranty-update', channel: 'preferred', props: { claimRef: 'CLM-0042', decision: 'approved' }, include: { productId: 'prod-abc123', appCase: 'c9d1e2f3-...' }, ref: 'warranty-decision-notification', appId: 'warrantyApp', }) if (result.ok) { console.log(`Sent via ${result.channel}`, result.messageId) } else { console.error('Send failed:', result.error) } ```
|
|
14581
14609
|
|
|
14582
|
-
**logCommunicationEvent**(collectionId: string,
|
|
14610
|
+
**logCommunicationEvent**(collectionId: string,
|
|
14583
14611
|
body: LogCommunicationEventBody) → `Promise<AppendResult>`
|
|
14584
14612
|
Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
|
|
14585
14613
|
|
|
14586
|
-
**logBulkCommunicationEvents**(collectionId: string,
|
|
14614
|
+
**logBulkCommunicationEvents**(collectionId: string,
|
|
14587
14615
|
body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
14588
14616
|
Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
|
|
14589
14617
|
|
|
@@ -14614,7 +14642,7 @@ Returns all proof type definitions. Proof types are templates that specify which
|
|
|
14614
14642
|
|
|
14615
14643
|
### contact
|
|
14616
14644
|
|
|
14617
|
-
**query**(collectionId: string,
|
|
14645
|
+
**query**(collectionId: string,
|
|
14618
14646
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
14619
14647
|
The standard query on contacts (admin only): filter, sort, page, count and total in one call. POST /admin/collection/:collectionId/contacts/query Fields: contactId, userId, firstName, lastName, displayName, company, email, phone, tags, source, locale, createdAt, updatedAt. Email and phone are the contact's main one. Deleted and erased contacts are never returned. ```typescript await contact.query(collectionId, { where: { tags: { hasAny: ['vip', 'trade'] }, createdAt: { gte: '2026-01-01' } }, select: ['contactId', 'firstName', 'email'], count: true, }) await contact.query(collectionId, { groupBy: ['company'], aggregates: { people: { count: true } } }) ```
|
|
14620
14648
|
|
|
@@ -14624,62 +14652,62 @@ What a contacts query can use: its fields and what each can filter, sort, group
|
|
|
14624
14652
|
**create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
14625
14653
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14626
14654
|
|
|
14627
|
-
**list**(collectionId: string,
|
|
14655
|
+
**list**(collectionId: string,
|
|
14628
14656
|
params?: { limit?: number; offset?: number; includeDeleted?: boolean }) → `Promise<ContactListResponse>`
|
|
14629
14657
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14630
14658
|
|
|
14631
|
-
**search**({
|
|
14632
|
-
collectionId,
|
|
14633
|
-
q,
|
|
14634
|
-
typeahead,
|
|
14635
|
-
email,
|
|
14636
|
-
phone,
|
|
14637
|
-
id,
|
|
14638
|
-
userId,
|
|
14639
|
-
tags,
|
|
14640
|
-
tagsAll,
|
|
14641
|
-
source,
|
|
14642
|
-
locale,
|
|
14643
|
-
createdFrom,
|
|
14644
|
-
createdTo,
|
|
14645
|
-
externalIdKey,
|
|
14646
|
-
externalIdValue,
|
|
14647
|
-
customFieldKey,
|
|
14648
|
-
customFieldValue,
|
|
14649
|
-
limit,
|
|
14650
|
-
offset,
|
|
14659
|
+
**search**({
|
|
14660
|
+
collectionId,
|
|
14661
|
+
q,
|
|
14662
|
+
typeahead,
|
|
14663
|
+
email,
|
|
14664
|
+
phone,
|
|
14665
|
+
id,
|
|
14666
|
+
userId,
|
|
14667
|
+
tags,
|
|
14668
|
+
tagsAll,
|
|
14669
|
+
source,
|
|
14670
|
+
locale,
|
|
14671
|
+
createdFrom,
|
|
14672
|
+
createdTo,
|
|
14673
|
+
externalIdKey,
|
|
14674
|
+
externalIdValue,
|
|
14675
|
+
customFieldKey,
|
|
14676
|
+
customFieldValue,
|
|
14677
|
+
limit,
|
|
14678
|
+
offset,
|
|
14651
14679
|
}: ContactSearchParams) → `Promise<ContactSearchResponse>`
|
|
14652
14680
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14653
14681
|
|
|
14654
|
-
**get**(collectionId: string,
|
|
14655
|
-
contactId: string,
|
|
14682
|
+
**get**(collectionId: string,
|
|
14683
|
+
contactId: string,
|
|
14656
14684
|
params?: { includeDeleted?: boolean }) → `Promise<ContactResponse>`
|
|
14657
14685
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14658
14686
|
|
|
14659
|
-
**update**(collectionId: string,
|
|
14660
|
-
contactId: string,
|
|
14687
|
+
**update**(collectionId: string,
|
|
14688
|
+
contactId: string,
|
|
14661
14689
|
data: ContactUpdateRequest) → `Promise<ContactResponse>`
|
|
14662
14690
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14663
14691
|
|
|
14664
14692
|
**remove**(collectionId: string, contactId: string) → `Promise<void>`
|
|
14665
14693
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14666
14694
|
|
|
14667
|
-
**lookup**(collectionId: string,
|
|
14695
|
+
**lookup**(collectionId: string,
|
|
14668
14696
|
params: { email?: string; phone?: string }) → `Promise<ContactResponse>`
|
|
14669
14697
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14670
14698
|
|
|
14671
|
-
**upsert**(collectionId: string,
|
|
14699
|
+
**upsert**(collectionId: string,
|
|
14672
14700
|
data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
14673
14701
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14674
14702
|
|
|
14675
|
-
**publicUpsert**(collectionId: string,
|
|
14703
|
+
**publicUpsert**(collectionId: string,
|
|
14676
14704
|
data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
|
|
14677
14705
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14678
14706
|
|
|
14679
14707
|
**publicGetMine**(collectionId: string) → `Promise<PublicGetMyContactResponse>`
|
|
14680
14708
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14681
14709
|
|
|
14682
|
-
**publicUpdateMine**(collectionId: string,
|
|
14710
|
+
**publicUpdateMine**(collectionId: string,
|
|
14683
14711
|
data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
|
|
14684
14712
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14685
14713
|
|
|
@@ -14689,77 +14717,77 @@ Public: Get the contact schema for a collection. GET /public/collection/:collect
|
|
|
14689
14717
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
14690
14718
|
Public: Get the contact schema for a collection. GET /public/collection/:collectionId/contact/schema Returns a ContactSchemaResponse describing all publicly visible contact fields. Core fields and collection-defined custom fields are merged into a single flat schema. Fields not in `publicVisibleFields` are stripped entirely from the response. Fields visible but not in `publicEditableFields` have `ui:disabled: true` in `uiSchema`. Use `fieldOrder` to render fields in the correct sequence, and `evaluateConditions` from the types package to handle conditional field visibility. ```typescript import { contact, evaluateConditions } from '@proveanything/smartlinks' const schema = await contact.publicGetSchema(collectionId) for (const fieldId of schema.fieldOrder) { const property = schema.schema.properties[fieldId] const ui = schema.uiSchema[fieldId] || {} const visible = evaluateConditions(property.conditions, property.showWhen, formValues) const disabled = ui['ui:disabled'] === true if (visible) renderField({ fieldId, property, ui, disabled }) } ```
|
|
14691
14719
|
|
|
14692
|
-
**findDuplicates**(collectionId: string,
|
|
14720
|
+
**findDuplicates**(collectionId: string,
|
|
14693
14721
|
params?: { limit?: number; offset?: number }) → `Promise<ContactDuplicatesResponse>`
|
|
14694
14722
|
Admin: pairs of contacts that look like one person. GET /admin/collection/:collectionId/contacts/duplicates The pattern it finds: someone the collection knew by email first (an import, a list, a form) who later signed in. Their sign-in got a second contact, which could not take the email the first one already held — so one contact has the email and no sign-in, the other the sign-in (and everything they did) and no email. The match is made on the server, on verified addresses only. Checks a window of contacts per call; while `more` is true, call again with `offset` moved on by `scanned`. ```typescript const { pairs } = await contact.findDuplicates(collectionId) for (const pair of pairs) { await contact.merge(collectionId, pair.keep.contactId, pair.merge.contactId) } ```
|
|
14695
14723
|
|
|
14696
|
-
**merge**(collectionId: string,
|
|
14697
|
-
keepContactId: string,
|
|
14724
|
+
**merge**(collectionId: string,
|
|
14725
|
+
keepContactId: string,
|
|
14698
14726
|
fromContactId: string) → `Promise<ContactMergeResponse>`
|
|
14699
14727
|
Admin: fold contact `fromContactId` INTO contact `keepContactId`. POST /admin/collection/:collectionId/contacts/:keepContactId/merge The kept contact gains the other's sign-in, emails and phones, and anything it had no value for; its own values win. Everything recorded against the other contact moves to the kept one. Consent is never loosened: an opt-out on either contact stays an opt-out. The other contact is soft-deleted and marked with `customFields.mergedInto`. Refused (HTTP 409, `error` = a `ContactMergeErrorCode`) when the two have different sign-ins (`LOGIN_CONFLICT`) or are both members of the same loyalty scheme (`LOYALTY_CONFLICT`).
|
|
14700
14728
|
|
|
14701
|
-
**linkLogin**(collectionId: string,
|
|
14729
|
+
**linkLogin**(collectionId: string,
|
|
14702
14730
|
userId: string) → `Promise<ContactLinkLoginResponse>`
|
|
14703
14731
|
Admin: the contact that carries a sign-in, attaching the sign-in first to the contact that already holds its verified email or phone. POST /admin/collection/:collectionId/contacts/link-login For a service about to create a contact for a `userId`: call this first and only create when it throws 404 (`NOTHING_TO_LINK`), so a person the collection already knows by email stays one contact. The address is read from the sign-in itself and must be verified; nothing the caller says about an email is used. Never creates a contact. ```typescript let contactId: string try { contactId = (await contact.linkLogin(collectionId, userId)).contactId } catch (err) { if (err.statusCode !== 404) throw err contactId = (await contact.create(collectionId, { userId, source: 'my-service' })).contactId } ```
|
|
14704
14732
|
|
|
14705
|
-
**getUser**(collectionId: string,
|
|
14733
|
+
**getUser**(collectionId: string,
|
|
14706
14734
|
userId: string,) → `Promise<UserSearchResponse>`
|
|
14707
14735
|
Admin: the contact that carries a sign-in, attaching the sign-in first to the contact that already holds its verified email or phone. POST /admin/collection/:collectionId/contacts/link-login For a service about to create a contact for a `userId`: call this first and only create when it throws 404 (`NOTHING_TO_LINK`), so a person the collection already knows by email stays one contact. The address is read from the sign-in itself and must be verified; nothing the caller says about an email is used. Never creates a contact. ```typescript let contactId: string try { contactId = (await contact.linkLogin(collectionId, userId)).contactId } catch (err) { if (err.statusCode !== 404) throw err contactId = (await contact.create(collectionId, { userId, source: 'my-service' })).contactId } ```
|
|
14708
14736
|
|
|
14709
14737
|
### containers
|
|
14710
14738
|
|
|
14711
|
-
**create**(collectionId: string,
|
|
14739
|
+
**create**(collectionId: string,
|
|
14712
14740
|
data: CreateContainerInput) → `Promise<Container>`
|
|
14713
14741
|
Create a new container (admin). ```typescript const cask = await containers.create('coll_123', { containerType: 'cask', ref: 'CASK-0042', name: 'Cask 42 — Single Malt', metadata: { distilleryYear: 2019, capacity: 200 }, }) ```
|
|
14714
14742
|
|
|
14715
|
-
**list**(collectionId: string,
|
|
14743
|
+
**list**(collectionId: string,
|
|
14716
14744
|
params?: ListContainersParams) → `Promise<ListContainersResponse>`
|
|
14717
14745
|
List containers (admin). Supports filtering by type, status, ref, parent, and top-level flag. ```typescript // All active pallets const { containers: pallets } = await containers.list('coll_123', { containerType: 'pallet', status: 'active', limit: 50, }) // Top-level containers only const { containers: roots } = await containers.list('coll_123', { topLevel: true }) ```
|
|
14718
14746
|
|
|
14719
|
-
**findForItem**(collectionId: string,
|
|
14747
|
+
**findForItem**(collectionId: string,
|
|
14720
14748
|
params: FindContainersForItemParams) → `Promise<FindContainersForItemResponse>`
|
|
14721
14749
|
Reverse lookup — find all containers currently holding a specific item (admin). ```typescript const { containers: holding } = await containers.findForItem('coll_123', { itemType: 'proof', itemId: 'unit-0007', productId: 'drill', }) ```
|
|
14722
14750
|
|
|
14723
|
-
**get**(collectionId: string,
|
|
14724
|
-
containerId: string,
|
|
14751
|
+
**get**(collectionId: string,
|
|
14752
|
+
containerId: string,
|
|
14725
14753
|
params?: GetContainerParams) → `Promise<Container>`
|
|
14726
14754
|
Get a single container by ID (admin). Pass `?tree=true` to recursively embed children, and/or `?includeContents=true` to embed the current item list. ```typescript // Flat const cask = await containers.get('coll_123', 'cask-uuid') // Full tree with contents const tree = await containers.get('coll_123', 'warehouse-uuid', { tree: true, treeDepth: 3, includeContents: true, }) ```
|
|
14727
14755
|
|
|
14728
|
-
**update**(collectionId: string,
|
|
14729
|
-
containerId: string,
|
|
14756
|
+
**update**(collectionId: string,
|
|
14757
|
+
containerId: string,
|
|
14730
14758
|
data: UpdateContainerInput) → `Promise<Container>`
|
|
14731
14759
|
Partially update a container (admin). Only fields present in the request body are modified. Pass `parentContainerId: null` to promote a container to top-level. ```typescript const updated = await containers.update('coll_123', 'cask-uuid', { status: 'archived', metadata: { bottledAt: '2025-04-01' }, }) ```
|
|
14732
14760
|
|
|
14733
|
-
**remove**(collectionId: string,
|
|
14761
|
+
**remove**(collectionId: string,
|
|
14734
14762
|
containerId: string) → `Promise<`
|
|
14735
14763
|
Soft-delete a container (admin). Sets `deletedAt`; the record and its full item history remain queryable by admins. Public API responses automatically exclude deleted containers.
|
|
14736
14764
|
|
|
14737
|
-
**listItems**(collectionId: string,
|
|
14738
|
-
containerId: string,
|
|
14765
|
+
**listItems**(collectionId: string,
|
|
14766
|
+
containerId: string,
|
|
14739
14767
|
params?: ListContainerItemsParams) → `Promise<ContainerItemsResponse>`
|
|
14740
14768
|
List items currently (or historically) inside a container (admin). Pass `history: true` to include removed items and see the full membership log. ```typescript // Current contents const { items } = await containers.listItems('coll_123', 'cask-uuid') // Full history including removed items const { items: history } = await containers.listItems('coll_123', 'cask-uuid', { history: true }) ```
|
|
14741
14769
|
|
|
14742
|
-
**addItems**(collectionId: string,
|
|
14743
|
-
containerId: string,
|
|
14770
|
+
**addItems**(collectionId: string,
|
|
14771
|
+
containerId: string,
|
|
14744
14772
|
data: AddContainerItemsInput) → `Promise<AddContainerItemsResponse>`
|
|
14745
14773
|
Add one or more items to a container (admin). Each item requires `itemType` and `itemId`. Pass `productId` / `proofId` for denormalisation convenience. ```typescript const { items } = await containers.addItems('coll_123', 'pallet-uuid', { items: [ { itemType: 'tag', itemId: 'NFC-00AABBCC' }, { itemType: 'proof', itemId: 'proof-uuid', productId: 'product-id' }, ], }) ```
|
|
14746
14774
|
|
|
14747
|
-
**removeItems**(collectionId: string,
|
|
14748
|
-
containerId: string,
|
|
14775
|
+
**removeItems**(collectionId: string,
|
|
14776
|
+
containerId: string,
|
|
14749
14777
|
data: RemoveContainerItemsInput) → `Promise<RemoveContainerItemsResponse>`
|
|
14750
14778
|
Soft-remove items from a container (admin). Sets `removedAt` on the specified `ContainerItem` records. The records are retained in the history log and can be queried with `history: true`. ```typescript const result = await containers.removeItems('coll_123', 'pallet-uuid', { ids: ['container-item-uuid-1', 'container-item-uuid-2'], }) console.log(`Removed ${result.removedCount} items`) ```
|
|
14751
14779
|
|
|
14752
|
-
**publicList**(collectionId: string,
|
|
14780
|
+
**publicList**(collectionId: string,
|
|
14753
14781
|
params?: ListContainersParams) → `Promise<PublicListContainersResponse>`
|
|
14754
14782
|
List containers (public). Soft-deleted containers and containers with `metadata.publicListing === false` are excluded from results.
|
|
14755
14783
|
|
|
14756
|
-
**publicGet**(collectionId: string,
|
|
14757
|
-
containerId: string,
|
|
14784
|
+
**publicGet**(collectionId: string,
|
|
14785
|
+
containerId: string,
|
|
14758
14786
|
params?: GetContainerParams) → `Promise<Container>`
|
|
14759
14787
|
Get a single container (public). Soft-deleted containers return a 404. Same `?tree` and `?includeContents` options as the admin version.
|
|
14760
14788
|
|
|
14761
|
-
**publicListItems**(collectionId: string,
|
|
14762
|
-
containerId: string,
|
|
14789
|
+
**publicListItems**(collectionId: string,
|
|
14790
|
+
containerId: string,
|
|
14763
14791
|
params?: Pick<ListContainerItemsParams, 'limit' | 'offset'>) → `Promise<ContainerItemsResponse>`
|
|
14764
14792
|
List current contents of a container (public). Returns only items where `removedAt` is null. No `?history` option on the public side.
|
|
14765
14793
|
|
|
@@ -14982,8 +15010,8 @@ Update whitelisted fields. PUT /integrations/flows/:id
|
|
|
14982
15010
|
**deleteFlow**(collectionId: string, id: string) → `Promise<`
|
|
14983
15011
|
Soft-delete a flow. DELETE /integrations/flows/:id
|
|
14984
15012
|
|
|
14985
|
-
**runFlow**(collectionId: string,
|
|
14986
|
-
id: string,
|
|
15013
|
+
**runFlow**(collectionId: string,
|
|
15014
|
+
id: string,
|
|
14987
15015
|
options: RunFlowInput & { async?: boolean } = {}) → `Promise<RunFlowResult>`
|
|
14988
15016
|
Run a flow now. POST /integrations/flows/:id/run - inline (default): resolves and returns the run summary. - options.async: enqueue on the worker, returns { enqueued: true }. Pass options.entityId to run for a single source entity.
|
|
14989
15017
|
|
|
@@ -15011,8 +15039,8 @@ Is enhanced logging active for a connection? GET /integrations/logging/:connecti
|
|
|
15011
15039
|
**setLogging**(collectionId: string, connectionId: string, input: SetLoggingInput = {}) → `Promise<`
|
|
15012
15040
|
Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled)
|
|
15013
15041
|
|
|
15014
|
-
**listFailed**(collectionId: string,
|
|
15015
|
-
flowId: string,
|
|
15042
|
+
**listFailed**(collectionId: string,
|
|
15043
|
+
flowId: string,
|
|
15016
15044
|
query: { status?: 'failed' | 'dead'; limit?: number; cursor?: string } = {}) → `Promise<FailedRecordList>`
|
|
15017
15045
|
A flow's failed / dead records. GET /integrations/flows/:id/failed
|
|
15018
15046
|
|
|
@@ -15037,30 +15065,30 @@ Cancel enhanced logging now. DELETE /integrations/logging/:connectionId
|
|
|
15037
15065
|
**listConnectors**(collectionId: string) → `Promise<`
|
|
15038
15066
|
The collection's installed connector apps. GET /integrations/connectors
|
|
15039
15067
|
|
|
15040
|
-
**saveConnectorInstallation**(collectionId: string,
|
|
15041
|
-
appId: string,
|
|
15068
|
+
**saveConnectorInstallation**(collectionId: string,
|
|
15069
|
+
appId: string,
|
|
15042
15070
|
input: SaveConnectorInstallationInput) → `Promise<`
|
|
15043
15071
|
Save a connector's non-secret Connect-form values and/or settings. PUT /integrations/connectors/:appId/installation
|
|
15044
15072
|
|
|
15045
|
-
**runConnectorStep**(collectionId: string,
|
|
15046
|
-
appId: string,
|
|
15047
|
-
step: ConnectorConsoleStep,
|
|
15073
|
+
**runConnectorStep**(collectionId: string,
|
|
15074
|
+
appId: string,
|
|
15075
|
+
step: ConnectorConsoleStep,
|
|
15048
15076
|
input: Record<string, unknown> & { flowId?: string } = {}) → `Promise<T>`
|
|
15049
15077
|
Run a connector step from the console: `testConnection` → ConnectorTestResult, `describeTarget` → ConnectorTargetSchema, `sample` → ConnectorRecords, and dry runs of `shape` ({ records }) → ConnectorShapeResult and `serialize` ({ documents }) → ConnectorSerializeResult. The server adds the installation; pass `flowId` to layer that flow's settings. POST /integrations/connectors/:appId/steps/:step
|
|
15050
15078
|
|
|
15051
|
-
**runConnectorAction**(collectionId: string,
|
|
15052
|
-
appId: string,
|
|
15053
|
-
action: string,
|
|
15079
|
+
**runConnectorAction**(collectionId: string,
|
|
15080
|
+
appId: string,
|
|
15081
|
+
action: string,
|
|
15054
15082
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15055
15083
|
Invoke a connector ACTION from the console (any visibility): redeem, enrol, adjust points, issue a coupon… The connector's function runs with its own credentials and is told who asked. POST /integrations/connectors/:appId/actions/:action { input }
|
|
15056
15084
|
|
|
15057
|
-
**listConnectorActions**(collectionId: string,
|
|
15085
|
+
**listConnectorActions**(collectionId: string,
|
|
15058
15086
|
appId: string) → `Promise<`
|
|
15059
15087
|
PUBLIC (the Hub, a site): the connector actions the caller may invoke — those declared `public`, plus `member` ones when signed in. GET /public/collection/:collectionId/connectors/:appId/actions
|
|
15060
15088
|
|
|
15061
|
-
**callConnectorAction**(collectionId: string,
|
|
15062
|
-
appId: string,
|
|
15063
|
-
action: string,
|
|
15089
|
+
**callConnectorAction**(collectionId: string,
|
|
15090
|
+
appId: string,
|
|
15091
|
+
action: string,
|
|
15064
15092
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15065
15093
|
PUBLIC (the Hub, a site): invoke a connector action — e.g. redeem a reward for the signed-in member. 401 SIGN_IN_REQUIRED for a `member` action without a session; 403 for an admin-only one; 400 with `missing[]` when a required input is absent. POST /public/collection/:collectionId/connectors/:appId/actions/:action { input }
|
|
15066
15094
|
|
|
@@ -15294,82 +15322,82 @@ Paginated member product summaries.
|
|
|
15294
15322
|
|
|
15295
15323
|
Loyalty programmes built on top of collections. Configure schemes and earning rules; contacts earn points automatically via interaction events. See the [Loyalty guide](loyalty.md) for the full walkthrough.
|
|
15296
15324
|
|
|
15297
|
-
**list**(collectionId: string,
|
|
15325
|
+
**list**(collectionId: string,
|
|
15298
15326
|
params: { includeDeleted?: boolean } = {}) → `Promise<LoyaltyScheme[]>`
|
|
15299
15327
|
|
|
15300
|
-
**get**(collectionId: string,
|
|
15328
|
+
**get**(collectionId: string,
|
|
15301
15329
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15302
15330
|
|
|
15303
|
-
**create**(collectionId: string,
|
|
15331
|
+
**create**(collectionId: string,
|
|
15304
15332
|
body: CreateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15305
15333
|
|
|
15306
|
-
**update**(collectionId: string,
|
|
15307
|
-
schemeId: string,
|
|
15334
|
+
**update**(collectionId: string,
|
|
15335
|
+
schemeId: string,
|
|
15308
15336
|
body: UpdateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15309
15337
|
|
|
15310
|
-
**remove**(collectionId: string,
|
|
15338
|
+
**remove**(collectionId: string,
|
|
15311
15339
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15312
15340
|
|
|
15313
|
-
**listEarningRules**(collectionId: string,
|
|
15341
|
+
**listEarningRules**(collectionId: string,
|
|
15314
15342
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
15315
15343
|
|
|
15316
|
-
**getEarningRule**(collectionId: string,
|
|
15317
|
-
schemeId: string,
|
|
15344
|
+
**getEarningRule**(collectionId: string,
|
|
15345
|
+
schemeId: string,
|
|
15318
15346
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
15319
15347
|
|
|
15320
|
-
**createEarningRule**(collectionId: string,
|
|
15321
|
-
schemeId: string,
|
|
15348
|
+
**createEarningRule**(collectionId: string,
|
|
15349
|
+
schemeId: string,
|
|
15322
15350
|
body: CreateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
15323
15351
|
|
|
15324
|
-
**updateEarningRule**(collectionId: string,
|
|
15325
|
-
schemeId: string,
|
|
15326
|
-
ruleId: string,
|
|
15352
|
+
**updateEarningRule**(collectionId: string,
|
|
15353
|
+
schemeId: string,
|
|
15354
|
+
ruleId: string,
|
|
15327
15355
|
body: UpdateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
15328
15356
|
|
|
15329
|
-
**removeEarningRule**(collectionId: string,
|
|
15330
|
-
schemeId: string,
|
|
15357
|
+
**removeEarningRule**(collectionId: string,
|
|
15358
|
+
schemeId: string,
|
|
15331
15359
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
15332
15360
|
|
|
15333
|
-
**listMembers**(collectionId: string,
|
|
15334
|
-
schemeId: string,
|
|
15361
|
+
**listMembers**(collectionId: string,
|
|
15362
|
+
schemeId: string,
|
|
15335
15363
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyMember>>`
|
|
15336
15364
|
|
|
15337
|
-
**getMember**(collectionId: string,
|
|
15338
|
-
schemeId: string,
|
|
15365
|
+
**getMember**(collectionId: string,
|
|
15366
|
+
schemeId: string,
|
|
15339
15367
|
contactId: string) → `Promise<LoyaltyMember>`
|
|
15340
15368
|
|
|
15341
|
-
**recordTransaction**(collectionId: string,
|
|
15342
|
-
schemeId: string,
|
|
15343
|
-
contactId: string,
|
|
15369
|
+
**recordTransaction**(collectionId: string,
|
|
15370
|
+
schemeId: string,
|
|
15371
|
+
contactId: string,
|
|
15344
15372
|
body: RecordLoyaltyTransactionBody) → `Promise<LoyaltyTransactionResult>`
|
|
15345
15373
|
Manually award or deduct points for a contact. - `points` must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE` - Supply `idempotencyKey` to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
|
|
15346
15374
|
|
|
15347
|
-
**getMemberHistory**(collectionId: string,
|
|
15348
|
-
schemeId: string,
|
|
15349
|
-
contactId: string,
|
|
15375
|
+
**getMemberHistory**(collectionId: string,
|
|
15376
|
+
schemeId: string,
|
|
15377
|
+
contactId: string,
|
|
15350
15378
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
15351
15379
|
Manually award or deduct points for a contact. - `points` must be a non-zero integer - Positive = award, negative = deduct - Deducting below zero returns HTTP 422 `INSUFFICIENT_BALANCE` - Supply `idempotencyKey` to safely retry without double-crediting Points earned via interaction events are awarded automatically by the server — this endpoint is for manual adjustments and admin overrides.
|
|
15352
15380
|
|
|
15353
15381
|
**publicList**(collectionId: string) → `Promise<LoyaltyScheme[]>`
|
|
15354
15382
|
List active schemes for a collection. No authentication required.
|
|
15355
15383
|
|
|
15356
|
-
**publicGet**(collectionId: string,
|
|
15384
|
+
**publicGet**(collectionId: string,
|
|
15357
15385
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15358
15386
|
Get a single active scheme. No authentication required.
|
|
15359
15387
|
|
|
15360
|
-
**publicListEarningRules**(collectionId: string,
|
|
15388
|
+
**publicListEarningRules**(collectionId: string,
|
|
15361
15389
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
15362
15390
|
List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.
|
|
15363
15391
|
|
|
15364
15392
|
**publicGetMe**(collectionId: string) → `Promise<LoyaltySchemeWithMembership[]>`
|
|
15365
15393
|
Get all active schemes with the caller's membership embedded in each. This is the primary entry point for a loyalty widget — one call gives you everything needed to render a user's loyalty status across all programs in a collection. - Authenticated: `member` is populated with balance + lifetimePoints (or null if not yet enrolled in that scheme) - Unauthenticated: `member` is null on all schemes
|
|
15366
15394
|
|
|
15367
|
-
**publicGetMine**(collectionId: string,
|
|
15395
|
+
**publicGetMine**(collectionId: string,
|
|
15368
15396
|
schemeId: string) → `Promise<LoyaltyMember>`
|
|
15369
15397
|
Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.
|
|
15370
15398
|
|
|
15371
|
-
**publicGetMineHistory**(collectionId: string,
|
|
15372
|
-
schemeId: string,
|
|
15399
|
+
**publicGetMineHistory**(collectionId: string,
|
|
15400
|
+
schemeId: string,
|
|
15373
15401
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
15374
15402
|
Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.
|
|
15375
15403
|
|
|
@@ -15407,98 +15435,98 @@ What the server offers, by group: `{ workOrders: [...], stock: [...], boms: [...
|
|
|
15407
15435
|
|
|
15408
15436
|
### order
|
|
15409
15437
|
|
|
15410
|
-
**create**(collectionId: string,
|
|
15438
|
+
**create**(collectionId: string,
|
|
15411
15439
|
data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
|
|
15412
15440
|
Create a new order with items. ```typescript const order = await order.create('coll_123', { orderRef: 'ORD-12345', customerId: 'CUST-789', items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'tag', itemId: 'TAG002' }, { itemType: 'serial', itemId: 'SN12345' } ], status: 'pending', metadata: { shipmentId: 'SHIP-789', destination: 'Warehouse B' } }) ```
|
|
15413
15441
|
|
|
15414
|
-
**get**(collectionId: string,
|
|
15415
|
-
orderId: string,
|
|
15442
|
+
**get**(collectionId: string,
|
|
15443
|
+
orderId: string,
|
|
15416
15444
|
params?: GetOrderParams) → `Promise<GetOrderResponse>`
|
|
15417
15445
|
Get a single order by ID. ```typescript // Get order without items (faster) const order = await order.get('coll_123', 'order_abc123') console.log(`Order has ${order.itemCount} items`) // Get order with items const orderWithItems = await order.get('coll_123', 'order_abc123', { includeItems: true }) console.log(orderWithItems.items) // Items array available ```
|
|
15418
15446
|
|
|
15419
|
-
**update**(collectionId: string,
|
|
15420
|
-
orderId: string,
|
|
15447
|
+
**update**(collectionId: string,
|
|
15448
|
+
orderId: string,
|
|
15421
15449
|
data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
|
|
15422
15450
|
Update order status or metadata. Items are managed separately via addItems/removeItems. ```typescript const updated = await order.update('coll_123', 'order_abc123', { status: 'shipped', metadata: { trackingNumber: '1Z999AA10123456784', shippedAt: '2026-02-02T14:30:00Z' } }) ```
|
|
15423
15451
|
|
|
15424
|
-
**remove**(collectionId: string,
|
|
15452
|
+
**remove**(collectionId: string,
|
|
15425
15453
|
orderId: string) → `Promise<DeleteOrderResponse>`
|
|
15426
15454
|
Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
|
|
15427
15455
|
|
|
15428
|
-
**list**(collectionId: string,
|
|
15456
|
+
**list**(collectionId: string,
|
|
15429
15457
|
params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
|
|
15430
15458
|
List orders for a collection with optional filters and pagination. Orders are returned in descending order by createdAt (newest first). ```typescript // List all orders (without items for better performance) const all = await order.list('coll_123') // List with filters const pending = await order.list('coll_123', { status: 'pending', limit: 50, offset: 0 }) // Filter by customer with items const customerOrders = await order.list('coll_123', { customerId: 'CUST-789', includeItems: true }) ```
|
|
15431
15459
|
|
|
15432
|
-
**getItems**(collectionId: string,
|
|
15433
|
-
orderId: string,
|
|
15460
|
+
**getItems**(collectionId: string,
|
|
15461
|
+
orderId: string,
|
|
15434
15462
|
params?: GetOrderItemsParams) → `Promise<GetOrderItemsResponse>`
|
|
15435
15463
|
Get items from an order with pagination support. Use this for orders with many items instead of includeItems. ```typescript // Get first page of items const page1 = await order.getItems('coll_123', 'order_abc123', { limit: 100, offset: 0 }) // Get next page const page2 = await order.getItems('coll_123', 'order_abc123', { limit: 100, offset: 100 }) ```
|
|
15436
15464
|
|
|
15437
|
-
**addItems**(collectionId: string,
|
|
15438
|
-
orderId: string,
|
|
15465
|
+
**addItems**(collectionId: string,
|
|
15466
|
+
orderId: string,
|
|
15439
15467
|
data: AddItemsRequest) → `Promise<AddItemsResponse>`
|
|
15440
15468
|
Add additional items to an existing order. ```typescript const updated = await order.addItems('coll_123', 'order_abc123', { items: [ { itemType: 'tag', itemId: 'TAG003' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) console.log(`Order now has ${updated.itemCount} items`) ```
|
|
15441
15469
|
|
|
15442
15470
|
**lineDone**(collectionId: string, orderId: string, itemId: string, by: number) → `Promise<OrderItem>`
|
|
15443
15471
|
Add to (or take from) how much of a line has been shipped or received. Atomic, so two receipts at once both count; it can't go below zero. ```typescript // 20 more caps arrived against a purchase order line await order.lineDone('coll_123', orderId, lineId, 20) ```
|
|
15444
15472
|
|
|
15445
|
-
**removeItems**(collectionId: string,
|
|
15446
|
-
orderId: string,
|
|
15473
|
+
**removeItems**(collectionId: string,
|
|
15474
|
+
orderId: string,
|
|
15447
15475
|
data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
|
|
15448
15476
|
Add to (or take from) how much of a line has been shipped or received. Atomic, so two receipts at once both count; it can't go below zero. ```typescript // 20 more caps arrived against a purchase order line await order.lineDone('coll_123', orderId, lineId, 20) ```
|
|
15449
15477
|
|
|
15450
|
-
**lookup**(collectionId: string,
|
|
15478
|
+
**lookup**(collectionId: string,
|
|
15451
15479
|
data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
|
|
15452
15480
|
Find all orders containing specific items (tags, proofs, or serial numbers). Use case: Scan a tag and immediately see if it's part of any order. ```typescript // Scan a tag and find associated orders const result = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' } ] }) if (result.orders.length > 0) { console.log(`Tag is part of ${result.orders.length} order(s)`) result.orders.forEach(ord => { console.log(`Order ${ord.orderRef}: ${ord.status}`) }) } // Batch lookup multiple items const batchResult = await order.lookup('coll_123', { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' }, { itemType: 'proof', itemId: 'proof_xyz' } ] }) ```
|
|
15453
15481
|
|
|
15454
|
-
**query**(collectionId: string,
|
|
15482
|
+
**query**(collectionId: string,
|
|
15455
15483
|
data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
|
|
15456
15484
|
Advanced query for orders with order-level and item-level filtering. More powerful than the basic list() function. ```typescript // Find pending orders created in January 2026 const result = await order.query('coll_123', { query: { status: 'pending', createdAfter: '2026-01-01T00:00:00Z', createdBefore: '2026-02-01T00:00:00Z', sortBy: 'createdAt', sortOrder: 'desc' }, limit: 50 }) // Find orders with specific metadata and item count const highPriority = await order.query('coll_123', { query: { metadata: { priority: 'high' }, minItemCount: 10, maxItemCount: 100 }, includeItems: true }) // Find orders containing a specific product batch const batchOrders = await order.query('coll_123', { query: { productId: 'prod_789', batchId: 'BATCH-2024-001' }, includeItems: true }) // Find an order containing one of several specific items const matched = await order.query('coll_123', { query: { items: [ { itemType: 'tag', itemId: 'TAG001' }, { itemType: 'serial', itemId: 'SN12345' } ] }, includeItems: true }) ```
|
|
15457
15485
|
|
|
15458
|
-
**reports**(collectionId: string,
|
|
15486
|
+
**reports**(collectionId: string,
|
|
15459
15487
|
params?: ReportsParams) → `Promise<ReportsResponse>`
|
|
15460
15488
|
Get reports and aggregations for orders. Provides analytics grouped by status, customer, product, date, etc. ```typescript // Get order counts by status const statusReport = await order.reports('coll_123', { groupByStatus: true }) console.log(statusReport.ordersByStatus) // { pending: 45, shipped: 123, completed: 789 } // Get comprehensive analytics const fullReport = await order.reports('coll_123', { groupByStatus: true, groupByProduct: true, includeItemStats: true, createdAfter: '2026-01-01T00:00:00Z' }) console.log(fullReport.itemStats?.avgItemsPerOrder) // Get top 10 customers by order count const topCustomers = await order.reports('coll_123', { groupByCustomer: true, topN: 10 }) ```
|
|
15461
15489
|
|
|
15462
|
-
**findByProduct**(collectionId: string,
|
|
15463
|
-
productId: string,
|
|
15490
|
+
**findByProduct**(collectionId: string,
|
|
15491
|
+
productId: string,
|
|
15464
15492
|
params?: LookupByProductParams) → `Promise<LookupByProductResponse>`
|
|
15465
15493
|
Find all orders containing items with a specific product ID. Uses the automatic productSummary tracking in order metadata. ```typescript // Find all orders with a specific product const result = await order.findByProduct('coll_123', 'product_abc123', { limit: 50, includeItems: false }) result.orders.forEach(ord => { const count = ord.metadata.productSummary?.['product_abc123'] ?? 0 console.log(`Order ${ord.orderRef} has ${count} items of this product`) }) ```
|
|
15466
15494
|
|
|
15467
|
-
**getAnalytics**(collectionId: string,
|
|
15495
|
+
**getAnalytics**(collectionId: string,
|
|
15468
15496
|
orderId: string) → `Promise<OrderAnalyticsResponse>`
|
|
15469
15497
|
Get comprehensive scan analytics for all tags in an order. Returns scan counts, timestamps, locations, devices, and per-tag summaries. ```typescript const analytics = await order.getAnalytics('coll_123', 'order_abc123') if (analytics.analytics) { console.log(`Total scans: ${analytics.analytics.totalScans}`) console.log(`Admin scans: ${analytics.analytics.adminScans}`) console.log(`Created at: ${analytics.analytics.estimatedCreatedAt}`) console.log(`Unique locations: ${analytics.analytics.uniqueLocations}`) analytics.analytics.tagSummaries.forEach(tag => { console.log(`Tag ${tag.tagId}: ${tag.totalScans} scans`) }) } ```
|
|
15470
15498
|
|
|
15471
|
-
**getTimeline**(collectionId: string,
|
|
15472
|
-
orderId: string,
|
|
15499
|
+
**getTimeline**(collectionId: string,
|
|
15500
|
+
orderId: string,
|
|
15473
15501
|
params?: TimelineRequest) → `Promise<TimelineResponse>`
|
|
15474
15502
|
Get chronological timeline of all scan events for an order's tags. Supports filtering by date range and admin/customer scans. ```typescript // Get all scan events const timeline = await order.getTimeline('coll_123', 'order_abc123') timeline.timeline.forEach(event => { console.log(`${event.timestamp}: ${event.eventType} by ${event.isAdmin ? 'admin' : 'customer'}`) }) // Get admin scans only from last week const adminScans = await order.getTimeline('coll_123', 'order_abc123', { isAdmin: true, from: '2026-02-01T00:00:00Z', limit: 500 }) ```
|
|
15475
15503
|
|
|
15476
|
-
**getLocationHistory**(collectionId: string,
|
|
15477
|
-
orderId: string,
|
|
15504
|
+
**getLocationHistory**(collectionId: string,
|
|
15505
|
+
orderId: string,
|
|
15478
15506
|
params?: LocationRequest) → `Promise<LocationResponse>`
|
|
15479
15507
|
Get location-based scan history for an order's tags. Shows where the order's tags have been scanned. ```typescript const locations = await order.getLocationHistory('coll_123', 'order_abc123', { limit: 100 }) console.log(`Order scanned in ${locations.count} locations`) locations.locations.forEach(scan => { console.log(`${scan.location} at ${scan.timestamp}`) }) ```
|
|
15480
15508
|
|
|
15481
|
-
**getBulkAnalytics**(collectionId: string,
|
|
15509
|
+
**getBulkAnalytics**(collectionId: string,
|
|
15482
15510
|
data: BulkAnalyticsRequest) → `Promise<BulkAnalyticsResponse>`
|
|
15483
15511
|
Get analytics summary for multiple orders at once. Efficient way to retrieve scan data for many orders. ```typescript const bulk = await order.getBulkAnalytics('coll_123', { orderIds: ['order_1', 'order_2', 'order_3'], from: '2026-01-01T00:00:00Z' }) bulk.results.forEach(result => { if (result.analytics) { console.log(`${result.orderRef}: ${result.analytics.totalScans} scans`) } }) ```
|
|
15484
15512
|
|
|
15485
|
-
**getCollectionSummary**(collectionId: string,
|
|
15513
|
+
**getCollectionSummary**(collectionId: string,
|
|
15486
15514
|
params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
|
|
15487
15515
|
Get collection-wide analytics summary across all orders. Returns daily scan counts and admin activity overview. ```typescript // Get all-time collection summary const summary = await order.getCollectionSummary('coll_123') console.log(`Admin activity count: ${summary.adminActivity.count}`) console.log('Scans by day:') summary.scansByDay.forEach(day => { console.log(` ${day.date}: ${day.scanCount} scans`) }) // Get summary for last 30 days const recentSummary = await order.getCollectionSummary('coll_123', { from: '2026-01-08T00:00:00Z', to: '2026-02-08T00:00:00Z' }) ```
|
|
15488
15516
|
|
|
15489
|
-
**findOrdersByProduct**(collectionId: string,
|
|
15490
|
-
productId: string,
|
|
15517
|
+
**findOrdersByProduct**(collectionId: string,
|
|
15518
|
+
productId: string,
|
|
15491
15519
|
params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
|
|
15492
15520
|
Find all orders containing items from a specific product. Uses indexed queries for fast lookups across order items. ```typescript // Find all orders containing a product const { orders, limit, offset } = await order.findOrdersByProduct('coll_123', 'prod_789', { limit: 100 }) console.log(`Product appears in ${orders.length} orders`) ```
|
|
15493
15521
|
|
|
15494
|
-
**findItemsByProduct**(collectionId: string,
|
|
15495
|
-
productId: string,
|
|
15522
|
+
**findItemsByProduct**(collectionId: string,
|
|
15523
|
+
productId: string,
|
|
15496
15524
|
params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
|
|
15497
15525
|
Get individual order items for a specific product. Returns all matching items with optional order summary. ```typescript // Get all items for a product const { items } = await order.findItemsByProduct('coll_123', 'prod_789', { includeOrder: true }) console.log(`Product delivered in ${items.length} order items`) ```
|
|
15498
15526
|
|
|
15499
|
-
**getOrderIdsByAttribute**(collectionId: string,
|
|
15500
|
-
attribute: 'productId',
|
|
15501
|
-
value: string,
|
|
15527
|
+
**getOrderIdsByAttribute**(collectionId: string,
|
|
15528
|
+
attribute: 'productId',
|
|
15529
|
+
value: string,
|
|
15502
15530
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
15503
15531
|
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 } ) ```
|
|
15504
15532
|
|
|
@@ -15532,7 +15560,7 @@ Move items (by membership), chips without an item (by membership) or containers
|
|
|
15532
15560
|
|
|
15533
15561
|
### podcast
|
|
15534
15562
|
|
|
15535
|
-
**generate**(collectionId: string,
|
|
15563
|
+
**generate**(collectionId: string,
|
|
15536
15564
|
request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
|
|
15537
15565
|
Generate a NotebookLM-style conversational podcast from product documents
|
|
15538
15566
|
|
|
@@ -15541,278 +15569,278 @@ Get podcast generation status
|
|
|
15541
15569
|
|
|
15542
15570
|
### product
|
|
15543
15571
|
|
|
15544
|
-
**get**(collectionId: string,
|
|
15545
|
-
productId: string,
|
|
15572
|
+
**get**(collectionId: string,
|
|
15573
|
+
productId: string,
|
|
15546
15574
|
admin?: boolean) → `Promise<ProductResponse>`
|
|
15547
15575
|
Retrieves a single Product Item by Collection ID and Product ID.
|
|
15548
15576
|
|
|
15549
|
-
**list**(collectionId: string,
|
|
15577
|
+
**list**(collectionId: string,
|
|
15550
15578
|
admin?: boolean) → `Promise<ProductResponse[]>`
|
|
15551
15579
|
List all Product Items for a Collection.
|
|
15552
15580
|
|
|
15553
|
-
**create**(collectionId: string,
|
|
15581
|
+
**create**(collectionId: string,
|
|
15554
15582
|
data: ProductCreateRequest) → `Promise<ProductResponse>`
|
|
15555
15583
|
Create a new product for a collection (admin only). The `data` payload follows the same shape as ProductResponse minus `id` and `collectionId`. **Hero Image Auto-Fetch:** You can pass `heroImage` as either: - A full asset object: `{ url: '...', thumbnails: {...} }` - A string URL: The system automatically fetches and stores the image ```typescript // Using a URL - auto-fetched and stored const product = await product.create(collectionId, { name: 'Wine Bottle', description: 'Premium red wine', heroImage: 'https://example.com/wine.jpg', // Auto-fetched! data: {} }); ```
|
|
15556
15584
|
|
|
15557
|
-
**update**(collectionId: string,
|
|
15558
|
-
productId: string,
|
|
15585
|
+
**update**(collectionId: string,
|
|
15586
|
+
productId: string,
|
|
15559
15587
|
data: ProductUpdateRequest) → `Promise<ProductResponse>`
|
|
15560
15588
|
Update a product for a collection (admin only). The `data` payload is a partial of ProductResponse minus `id` and `collectionId`. **Hero Image Auto-Fetch:** You can pass `heroImage` as either: - A full asset object: `{ url: '...', thumbnails: {...} }` - A string URL: The system automatically fetches and stores the image ```typescript // Update with new URL - auto-fetched and stored const product = await product.update(collectionId, productId, { heroImage: 'https://example.com/new-wine.jpg' // Auto-fetched! }); ```
|
|
15561
15589
|
|
|
15562
|
-
**remove**(collectionId: string,
|
|
15590
|
+
**remove**(collectionId: string,
|
|
15563
15591
|
productId: string) → `Promise<void>`
|
|
15564
15592
|
Delete a product for a collection (admin only).
|
|
15565
15593
|
|
|
15566
|
-
**find**(collectionId: string,
|
|
15594
|
+
**find**(collectionId: string,
|
|
15567
15595
|
body: ProductQueryRequest) → `Promise<ProductQueryResponse>`
|
|
15568
15596
|
|
|
15569
|
-
**publicFind**(collectionId: string,
|
|
15597
|
+
**publicFind**(collectionId: string,
|
|
15570
15598
|
params?: ProductPublicFindParams) → `Promise<ProductResponse[]>`
|
|
15571
15599
|
|
|
15572
|
-
**clone**(collectionId: string,
|
|
15573
|
-
productId: string,
|
|
15600
|
+
**clone**(collectionId: string,
|
|
15601
|
+
productId: string,
|
|
15574
15602
|
body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
|
|
15575
15603
|
|
|
15576
|
-
**listAssets**(collectionId: string,
|
|
15577
|
-
productId: string,
|
|
15604
|
+
**listAssets**(collectionId: string,
|
|
15605
|
+
productId: string,
|
|
15578
15606
|
admin?: boolean) → `Promise<unknown>`
|
|
15579
15607
|
|
|
15580
|
-
**createClaimWindow**(collectionId: string,
|
|
15581
|
-
productId: string,
|
|
15608
|
+
**createClaimWindow**(collectionId: string,
|
|
15609
|
+
productId: string,
|
|
15582
15610
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
15583
15611
|
|
|
15584
|
-
**updateClaimWindow**(collectionId: string,
|
|
15585
|
-
productId: string,
|
|
15586
|
-
claimId: string,
|
|
15612
|
+
**updateClaimWindow**(collectionId: string,
|
|
15613
|
+
productId: string,
|
|
15614
|
+
claimId: string,
|
|
15587
15615
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
15588
15616
|
|
|
15589
|
-
**refresh**(collectionId: string,
|
|
15617
|
+
**refresh**(collectionId: string,
|
|
15590
15618
|
productId: string) → `Promise<ProductResponse>`
|
|
15591
15619
|
|
|
15592
|
-
**getSN**(collectionId: string,
|
|
15593
|
-
productId: string,
|
|
15594
|
-
startIndex: number = 0,
|
|
15620
|
+
**getSN**(collectionId: string,
|
|
15621
|
+
productId: string,
|
|
15622
|
+
startIndex: number = 0,
|
|
15595
15623
|
count: number = 10) → `Promise<unknown>`
|
|
15596
15624
|
Get serial numbers for a product (admin only).
|
|
15597
15625
|
|
|
15598
|
-
**lookupSN**(collectionId: string,
|
|
15599
|
-
productId: string,
|
|
15626
|
+
**lookupSN**(collectionId: string,
|
|
15627
|
+
productId: string,
|
|
15600
15628
|
codeId: string) → `Promise<unknown>`
|
|
15601
15629
|
Look up a serial number by code for a product (admin only).
|
|
15602
15630
|
|
|
15603
|
-
**publicLookupClaim**(collectionId: string,
|
|
15604
|
-
productId: string,
|
|
15631
|
+
**publicLookupClaim**(collectionId: string,
|
|
15632
|
+
productId: string,
|
|
15605
15633
|
claimId: string) → `Promise<unknown>`
|
|
15606
15634
|
|
|
15607
|
-
**publicCreateClaim**(collectionId: string,
|
|
15608
|
-
productId: string,
|
|
15635
|
+
**publicCreateClaim**(collectionId: string,
|
|
15636
|
+
productId: string,
|
|
15609
15637
|
body: ProductClaimCreateRequestBody) → `Promise<unknown>`
|
|
15610
15638
|
|
|
15611
15639
|
### products
|
|
15612
15640
|
|
|
15613
|
-
**get**(collectionId: string,
|
|
15614
|
-
productId: string,
|
|
15641
|
+
**get**(collectionId: string,
|
|
15642
|
+
productId: string,
|
|
15615
15643
|
admin?: boolean) → `Promise<ProductResponse>`
|
|
15616
15644
|
|
|
15617
|
-
**list**(collectionId: string,
|
|
15645
|
+
**list**(collectionId: string,
|
|
15618
15646
|
admin?: boolean) → `Promise<ProductResponse[]>`
|
|
15619
15647
|
|
|
15620
|
-
**create**(collectionId: string,
|
|
15648
|
+
**create**(collectionId: string,
|
|
15621
15649
|
data: ProductCreateRequest) → `Promise<ProductResponse>`
|
|
15622
15650
|
|
|
15623
|
-
**update**(collectionId: string,
|
|
15624
|
-
productId: string,
|
|
15651
|
+
**update**(collectionId: string,
|
|
15652
|
+
productId: string,
|
|
15625
15653
|
data: ProductUpdateRequest) → `Promise<ProductResponse>`
|
|
15626
15654
|
|
|
15627
|
-
**remove**(collectionId: string,
|
|
15655
|
+
**remove**(collectionId: string,
|
|
15628
15656
|
productId: string) → `Promise<void>`
|
|
15629
15657
|
|
|
15630
|
-
**query**(collectionId: string,
|
|
15631
|
-
body: ProductQueryRequest,
|
|
15658
|
+
**query**(collectionId: string,
|
|
15659
|
+
body: ProductQueryRequest,
|
|
15632
15660
|
admin?: boolean) → `Promise<ProductQueryResponse>`
|
|
15633
15661
|
Query products in a collection with filtering, sorting, and pagination. authenticated admin context). Defaults to `false`, which targets the `/public` endpoint — consistent with `get`, `list`, and `listAssets`. ```typescript // Public query (default) await products.query(collectionId, { query: { search: 'cabernet' } }) // Admin query (authenticated) await products.query(collectionId, { query: { search: 'cabernet' } }, true) ```
|
|
15634
15662
|
|
|
15635
|
-
**standardQuery**(collectionId: string,
|
|
15663
|
+
**standardQuery**(collectionId: string,
|
|
15636
15664
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
15637
15665
|
The standard query on products (admin only): the one query shape every resource is moving to, with counts, totals and filtering by facet. It sits beside `products.query`, whose own body is unchanged. POST /admin/collection/:collectionId/products/standard/query Fields: id, name, description, sku, gtin, schemaType, status, sortOrder, createdAt, updatedAt, facets. Facets are filtered by key: the facet by its key or name, the value by its key or name. ```typescript await products.standardQuery(collectionId, { where: { facets: { brand: 'Breville', category: { in: ['Toasters', 'Kettles'] } }, status: 'active' }, select: ['id', 'name', 'sku'], count: true, }) ```
|
|
15638
15666
|
|
|
15639
15667
|
**standardQueryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
15640
15668
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15641
15669
|
|
|
15642
|
-
**clone**(collectionId: string,
|
|
15643
|
-
productId: string,
|
|
15670
|
+
**clone**(collectionId: string,
|
|
15671
|
+
productId: string,
|
|
15644
15672
|
body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
|
|
15645
15673
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15646
15674
|
|
|
15647
|
-
**listAssets**(collectionId: string,
|
|
15648
|
-
productId: string,
|
|
15675
|
+
**listAssets**(collectionId: string,
|
|
15676
|
+
productId: string,
|
|
15649
15677
|
admin?: boolean) → `Promise<unknown>`
|
|
15650
15678
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15651
15679
|
|
|
15652
|
-
**createClaimWindow**(collectionId: string,
|
|
15653
|
-
productId: string,
|
|
15680
|
+
**createClaimWindow**(collectionId: string,
|
|
15681
|
+
productId: string,
|
|
15654
15682
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
15655
15683
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15656
15684
|
|
|
15657
|
-
**updateClaimWindow**(collectionId: string,
|
|
15658
|
-
productId: string,
|
|
15659
|
-
claimId: string,
|
|
15685
|
+
**updateClaimWindow**(collectionId: string,
|
|
15686
|
+
productId: string,
|
|
15687
|
+
claimId: string,
|
|
15660
15688
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
15661
15689
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15662
15690
|
|
|
15663
|
-
**refresh**(collectionId: string,
|
|
15691
|
+
**refresh**(collectionId: string,
|
|
15664
15692
|
productId: string) → `Promise<ProductResponse>`
|
|
15665
15693
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15666
15694
|
|
|
15667
|
-
**getSN**(collectionId: string,
|
|
15668
|
-
productId: string,
|
|
15669
|
-
startIndex: number = 0,
|
|
15695
|
+
**getSN**(collectionId: string,
|
|
15696
|
+
productId: string,
|
|
15697
|
+
startIndex: number = 0,
|
|
15670
15698
|
count: number = 10) → `Promise<unknown>`
|
|
15671
15699
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15672
15700
|
|
|
15673
|
-
**lookupSN**(collectionId: string,
|
|
15674
|
-
productId: string,
|
|
15701
|
+
**lookupSN**(collectionId: string,
|
|
15702
|
+
productId: string,
|
|
15675
15703
|
codeId: string) → `Promise<unknown>`
|
|
15676
15704
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15677
15705
|
|
|
15678
|
-
**publicLookupClaim**(collectionId: string,
|
|
15679
|
-
productId: string,
|
|
15706
|
+
**publicLookupClaim**(collectionId: string,
|
|
15707
|
+
productId: string,
|
|
15680
15708
|
claimId: string) → `Promise<unknown>`
|
|
15681
15709
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15682
15710
|
|
|
15683
|
-
**publicCreateClaim**(collectionId: string,
|
|
15684
|
-
productId: string,
|
|
15711
|
+
**publicCreateClaim**(collectionId: string,
|
|
15712
|
+
productId: string,
|
|
15685
15713
|
body: ProductClaimCreateRequestBody) → `Promise<unknown>`
|
|
15686
15714
|
What a products standard query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/products/standard/query
|
|
15687
15715
|
|
|
15688
15716
|
### proof
|
|
15689
15717
|
|
|
15690
|
-
**query**(collectionId: string,
|
|
15718
|
+
**query**(collectionId: string,
|
|
15691
15719
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
15692
15720
|
The standard query on proofs (admin only): filter, sort, page, count and total a collection's proofs in one call, and follow a proof to its `product` and its `owner` (the owner's contact). POST /admin/collection/:collectionId/proof/query Fields: id, productId, userId (the owner's login id), batchId, variantId, lotId, status, claimable, createdAt, updatedAt. A proof's own values are not returned by this call. ```typescript // How many people own each product await proof.query(collectionId, { where: { userId: { isNull: false } }, groupBy: ['productId'], aggregates: { owners: { countDistinct: 'userId' } }, }) // The most recent owner of a product, with their name await proof.query(collectionId, { where: { productId: 'toaster', userId: { isNull: false } }, orderBy: [{ createdAt: 'desc' }], limit: 1, expand: { owner: ['firstName', 'lastName', 'email'] }, }) ```
|
|
15693
15721
|
|
|
15694
15722
|
**queryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
15695
15723
|
What a proofs query can use: its fields, what each can filter, sort, group or total, and its links. GET /admin/collection/:collectionId/proof/query
|
|
15696
15724
|
|
|
15697
|
-
**get**(collectionId: string,
|
|
15698
|
-
productId: string,
|
|
15699
|
-
proofId: string,
|
|
15700
|
-
admin?: boolean,
|
|
15725
|
+
**get**(collectionId: string,
|
|
15726
|
+
productId: string,
|
|
15727
|
+
proofId: string,
|
|
15728
|
+
admin?: boolean,
|
|
15701
15729
|
include?: string[]) → `Promise<ProofResponse>`
|
|
15702
15730
|
Retrieves a single Proof by Collection ID, Product ID, and Proof ID. Both public and admin endpoints now include productId in the path.
|
|
15703
15731
|
|
|
15704
|
-
**list**(collectionId: string,
|
|
15732
|
+
**list**(collectionId: string,
|
|
15705
15733
|
include?: string[]) → `Promise<ProofResponse[]>`
|
|
15706
15734
|
List all Proofs for a Collection.
|
|
15707
15735
|
|
|
15708
|
-
**create**(collectionId: string,
|
|
15709
|
-
productId: string,
|
|
15736
|
+
**create**(collectionId: string,
|
|
15737
|
+
productId: string,
|
|
15710
15738
|
request: ProofCreateRequest) → `Promise<ProofResponse>`
|
|
15711
15739
|
Create a proof for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof Pass the proof's content in a `proof` block, keyed by zone (see {@link ProofWrite}): ```ts proof.create(collectionId, productId, { proof: { values: { colour: 'red' }, // public + owner readable, owner + admin writable data: { serialNo: 1001 }, // public + owner readable, ADMIN-only writable admin: { costPrice: 4.20 }, // admin-only }, claimable: true, }) ``` Note: a top-level `data`/`admin` on the request body is legacy — top-level `data` gets folded into the values bag, so use `proof.data` for `proof.data`.
|
|
15712
15740
|
|
|
15713
|
-
**update**(collectionId: string,
|
|
15714
|
-
productId: string,
|
|
15715
|
-
proofId: string,
|
|
15741
|
+
**update**(collectionId: string,
|
|
15742
|
+
productId: string,
|
|
15743
|
+
proofId: string,
|
|
15716
15744
|
values: ProofUpdateRequest) → `Promise<ProofResponse>`
|
|
15717
15745
|
Update a proof for a product (admin only). PUT /admin/collection/:collectionId/product/:productId/proof/:proofId Pass the fields to change **at the root**, keyed by zone (see {@link ProofWrite}): ```ts proof.update(collectionId, productId, proofId, { data: { serialNo: 1002 }, // → proof.data (admin-only writable) values: { colour: 'blue' }, // → proof.values }) ``` Object zones deep-merge, so you can change one field without wiping the rest.
|
|
15718
15746
|
|
|
15719
|
-
**updateValues**(collectionId: string,
|
|
15720
|
-
productId: string,
|
|
15721
|
-
proofId: string,
|
|
15747
|
+
**updateValues**(collectionId: string,
|
|
15748
|
+
productId: string,
|
|
15749
|
+
proofId: string,
|
|
15722
15750
|
values: ProofValuesUpdateRequest) → `Promise<ProofResponse>`
|
|
15723
15751
|
Owner self-service update of a proof's owner-writable data. PUT /public/collection/:collectionId/product/:productId/proof/:proofId/values The public counterpart to admin `update` — the current OWNER (or a collection admin) editing their own proof, no admin credentials required. Only owner-writable zones are honoured (see {@link ProofValuesUpdateRequest}): ```ts proof.updateValues(collectionId, productId, proofId, { colour: 'blue', // → proof.values.colour (public) owner: { warranty: '2y' }, // → proof.values.owner (owner-scoped) personal: { nickname: 'Bo' }, // → proof.values.personal[callerUid] (private, own slot only) }) ``` `personal` always targets the caller's OWN slot — you cannot write another user's personal data, even as an admin. Object zones deep-merge (owner/personal merge field-by-field), so you can change one field without wiping the rest. Business-only zones (`data`/`admin`/`private`) are not writable here — use the admin `update` for those.
|
|
15724
15752
|
|
|
15725
|
-
**claim**(collectionId: string,
|
|
15726
|
-
productId: string,
|
|
15727
|
-
proofId: string,
|
|
15753
|
+
**claim**(collectionId: string,
|
|
15754
|
+
productId: string,
|
|
15755
|
+
proofId: string,
|
|
15728
15756
|
values: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
15729
15757
|
Claim a proof for a product using a proof ID (serial number, NFC tag, etc.). PUT /public/collection/:collectionId/product/:productId/proof/:proofId/claim
|
|
15730
15758
|
|
|
15731
|
-
**claimProduct**(collectionId: string,
|
|
15732
|
-
productId: string,
|
|
15759
|
+
**claimProduct**(collectionId: string,
|
|
15760
|
+
productId: string,
|
|
15733
15761
|
values?: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
15734
15762
|
Claim a product without providing a proof ID. System auto-generates a unique serial number on-demand. Requires allowAutoGenerateClaims to be enabled on the collection or product. PUT /public/collection/:collectionId/product/:productId/proof/claim ```typescript const proof = await proof.claimProduct( 'beauty-brand', 'moisturizer-pro', { purchaseDate: '2026-02-17', store: 'Target' } ); console.log('Auto-generated ID:', proof.id); ```
|
|
15735
15763
|
|
|
15736
|
-
**remove**(collectionId: string,
|
|
15737
|
-
productId: string,
|
|
15764
|
+
**remove**(collectionId: string,
|
|
15765
|
+
productId: string,
|
|
15738
15766
|
proofId: string) → `Promise<void>`
|
|
15739
15767
|
Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
15740
15768
|
|
|
15741
|
-
**getByUser**(collectionId: string,
|
|
15769
|
+
**getByUser**(collectionId: string,
|
|
15742
15770
|
userId: string) → `Promise<ProofResponse[]>`
|
|
15743
15771
|
Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
15744
15772
|
|
|
15745
|
-
**getByProduct**(collectionId: string,
|
|
15773
|
+
**getByProduct**(collectionId: string,
|
|
15746
15774
|
productId: string) → `Promise<ProofResponse[]>`
|
|
15747
15775
|
Get proofs for a product (admin only). GET /admin/collection/:collectionId/product/:productId/proof
|
|
15748
15776
|
|
|
15749
|
-
**findByProduct**(collectionId: string,
|
|
15750
|
-
productId: string,
|
|
15777
|
+
**findByProduct**(collectionId: string,
|
|
15778
|
+
productId: string,
|
|
15751
15779
|
query: any) → `Promise<ProofResponse[]>`
|
|
15752
15780
|
Find proofs for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof/find
|
|
15753
15781
|
|
|
15754
|
-
**getByBatch**(collectionId: string,
|
|
15755
|
-
productId: string,
|
|
15782
|
+
**getByBatch**(collectionId: string,
|
|
15783
|
+
productId: string,
|
|
15756
15784
|
batchId: string) → `Promise<ProofResponse[]>`
|
|
15757
15785
|
Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
|
|
15758
15786
|
|
|
15759
|
-
**migrate**(collectionId: string,
|
|
15760
|
-
productId: string,
|
|
15761
|
-
proofId: string,
|
|
15762
|
-
/** The destination product ID */
|
|
15787
|
+
**migrate**(collectionId: string,
|
|
15788
|
+
productId: string,
|
|
15789
|
+
proofId: string,
|
|
15790
|
+
/** The destination product ID */
|
|
15763
15791
|
data: { targetProductId: string }) → `Promise<ProofResponse>`
|
|
15764
15792
|
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' ```
|
|
15765
15793
|
|
|
15766
|
-
**createGrant**(collectionId: string,
|
|
15767
|
-
productId: string,
|
|
15768
|
-
proofId: string,
|
|
15794
|
+
**createGrant**(collectionId: string,
|
|
15795
|
+
productId: string,
|
|
15796
|
+
proofId: string,
|
|
15769
15797
|
options: CreateGrantOptions) → `Promise<ProofGrant>`
|
|
15770
15798
|
Create a share grant on a proof (owner / collection admin only). The returned grant includes `token` — the opaque bearer secret, available ONLY on this response. Embed it in a share link and hand recipients {@link redeemGrant} / {@link setGrantToken}.
|
|
15771
15799
|
|
|
15772
|
-
**listGrants**(collectionId: string,
|
|
15773
|
-
productId: string,
|
|
15800
|
+
**listGrants**(collectionId: string,
|
|
15801
|
+
productId: string,
|
|
15774
15802
|
proofId: string) → `Promise<ProofGrant[]>`
|
|
15775
15803
|
List the active + past grants on a proof (owner / collection admin only). Tokens are never returned here.
|
|
15776
15804
|
|
|
15777
|
-
**revokeGrant**(collectionId: string,
|
|
15778
|
-
productId: string,
|
|
15779
|
-
proofId: string,
|
|
15805
|
+
**revokeGrant**(collectionId: string,
|
|
15806
|
+
productId: string,
|
|
15807
|
+
proofId: string,
|
|
15780
15808
|
grantId: string) → `Promise<void>`
|
|
15781
15809
|
Revoke a grant by id (owner / collection admin only). Takes effect immediately.
|
|
15782
15810
|
|
|
15783
|
-
**redeemGrant**(collectionId: string,
|
|
15784
|
-
productId: string,
|
|
15785
|
-
proofId: string,
|
|
15786
|
-
token: string,
|
|
15811
|
+
**redeemGrant**(collectionId: string,
|
|
15812
|
+
productId: string,
|
|
15813
|
+
proofId: string,
|
|
15814
|
+
token: string,
|
|
15787
15815
|
options?: RedeemGrantOptions) → `Promise<RedeemGrantResult>`
|
|
15788
15816
|
Redeem a grant token (anonymous or signed-in). Records the redemption and returns the granted scope, or — for a `verify_owner` grant — an ownership assertion (never the account). After redeeming, call {@link setGrantToken} so subsequent data requests carry the token.
|
|
15789
15817
|
|
|
15790
|
-
**transfer**(collectionId: string,
|
|
15791
|
-
productId: string,
|
|
15792
|
-
proofId: string,
|
|
15818
|
+
**transfer**(collectionId: string,
|
|
15819
|
+
productId: string,
|
|
15820
|
+
proofId: string,
|
|
15793
15821
|
options: TransferProofOptions) → `Promise<TransferProofResult>`
|
|
15794
15822
|
Start a push transfer of a proof (current owner / collection admin only). Directed — hand it to a named recipient who then calls {@link acceptTransfer}: ```ts await proof.transfer(collectionId, productId, proofId, { toEmail: 'buyer@example.com' }) ``` Open release — make the proof claimable by anyone: ```ts await proof.transfer(collectionId, productId, proofId, { release: true }) ``` Send comms by naming templates per role (server decides who receives each): ```ts await proof.transfer(collectionId, productId, proofId, { toEmail: 'buyer@example.com', comms: { recipient: { templateId: 'transfer-incoming', props: { note: 'Enjoy!' } }, sender: { templateId: 'transfer-sent' }, }, }) ``` Direct to an SMS recipient by phone (E.164) and notify them by text: ```ts await proof.transfer(collectionId, productId, proofId, { toPhone: '+14155551234', comms: { recipient: { templateId: 'transfer-incoming', channel: 'sms' } }, }) ```
|
|
15795
15823
|
|
|
15796
|
-
**acceptTransfer**(collectionId: string,
|
|
15797
|
-
productId: string,
|
|
15798
|
-
proofId: string,
|
|
15824
|
+
**acceptTransfer**(collectionId: string,
|
|
15825
|
+
productId: string,
|
|
15826
|
+
proofId: string,
|
|
15799
15827
|
options: AcceptTransferOptions = {}) → `Promise<`
|
|
15800
15828
|
Accept a directed transfer (the named recipient only). Completes the ownership move — the proof's `userId` becomes the caller and the previous owner's private data and share grants are cleared/voided.
|
|
15801
15829
|
|
|
15802
|
-
**cancelTransfer**(collectionId: string,
|
|
15803
|
-
productId: string,
|
|
15804
|
-
proofId: string,
|
|
15830
|
+
**cancelTransfer**(collectionId: string,
|
|
15831
|
+
productId: string,
|
|
15832
|
+
proofId: string,
|
|
15805
15833
|
options: CancelTransferOptions = {}) → `Promise<`
|
|
15806
15834
|
Cancel a pending push transfer (current owner / collection admin only).
|
|
15807
15835
|
|
|
15808
|
-
**getTransfer**(collectionId: string,
|
|
15809
|
-
productId: string,
|
|
15836
|
+
**getTransfer**(collectionId: string,
|
|
15837
|
+
productId: string,
|
|
15810
15838
|
proofId: string) → `Promise<`
|
|
15811
15839
|
Get the active transfer/status for a proof (owner, collection admin, or the named recipient). Returns `{ transfer: null }` when nothing is in flight.
|
|
15812
15840
|
|
|
15813
15841
|
### publicClient
|
|
15814
15842
|
|
|
15815
|
-
**agentRun**(collectionId: string,
|
|
15843
|
+
**agentRun**(collectionId: string,
|
|
15816
15844
|
body: PublicAgentRunRequest) → `Promise<AgentRunResult>`
|
|
15817
15845
|
Public agent loop — run the orchestration-neutral tool loop on the consumer surface. Exposes an app's PUBLIC server functions (`agent.tool:true`, `visibility:'public'`) to a consumer assistant; built-in tools are opt-in by explicit `server_tools[]` allowlist only. The caller runs as the signed-in consumer ('owner', send the authKit bearer) or anonymous ('public'). POST /public/collection/:collectionId/ai/agent/run
|
|
15818
15846
|
|
|
@@ -15827,19 +15855,19 @@ Check rate limit status
|
|
|
15827
15855
|
|
|
15828
15856
|
### publicClient.sessions
|
|
15829
15857
|
|
|
15830
|
-
**create**(collectionId: string,
|
|
15858
|
+
**create**(collectionId: string,
|
|
15831
15859
|
body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
|
|
15832
15860
|
|
|
15833
|
-
**list**(collectionId: string,
|
|
15861
|
+
**list**(collectionId: string,
|
|
15834
15862
|
params?: { appId?: string; limit?: number }) → `Promise<`
|
|
15835
15863
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
15836
15864
|
|
|
15837
15865
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
15838
15866
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
15839
15867
|
|
|
15840
|
-
**append**(collectionId: string,
|
|
15841
|
-
id: string,
|
|
15842
|
-
items: ResponseInputItem[],
|
|
15868
|
+
**append**(collectionId: string,
|
|
15869
|
+
id: string,
|
|
15870
|
+
items: ResponseInputItem[],
|
|
15843
15871
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
15844
15872
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
15845
15873
|
|
|
@@ -15946,9 +15974,9 @@ List sessions, most-recently-active first (optionally filtered by app).
|
|
|
15946
15974
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
15947
15975
|
Get one session, including its full transcript.
|
|
15948
15976
|
|
|
15949
|
-
**append**(collectionId: string,
|
|
15950
|
-
id: string,
|
|
15951
|
-
items: ResponseInputItem[],
|
|
15977
|
+
**append**(collectionId: string,
|
|
15978
|
+
id: string,
|
|
15979
|
+
items: ResponseInputItem[],
|
|
15952
15980
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
15953
15981
|
Append Responses items (input/output/tool) to a session — the manual-persistence path.
|
|
15954
15982
|
|
|
@@ -16128,17 +16156,17 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
|
|
|
16128
16156
|
|
|
16129
16157
|
### tools
|
|
16130
16158
|
|
|
16131
|
-
**run**(collectionId: string,
|
|
16132
|
-
name: K,
|
|
16133
|
-
args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
|
|
16134
|
-
export async function run<T = any>(
|
|
16135
|
-
collectionId: string,
|
|
16136
|
-
name: string,
|
|
16137
|
-
args?: Record<string, any>,
|
|
16138
|
-
): Promise<ToolRunResult<T>>
|
|
16139
|
-
export async function run(
|
|
16140
|
-
collectionId: string,
|
|
16141
|
-
name: string,
|
|
16159
|
+
**run**(collectionId: string,
|
|
16160
|
+
name: K,
|
|
16161
|
+
args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
|
|
16162
|
+
export async function run<T = any>(
|
|
16163
|
+
collectionId: string,
|
|
16164
|
+
name: string,
|
|
16165
|
+
args?: Record<string, any>,
|
|
16166
|
+
): Promise<ToolRunResult<T>>
|
|
16167
|
+
export async function run(
|
|
16168
|
+
collectionId: string,
|
|
16169
|
+
name: string,
|
|
16142
16170
|
args: Record<string, any> =`
|
|
16143
16171
|
Invoke ONE built-in server tool directly — no model in the loop. This is the "direct code" caller of the orchestration-neutral tool registry: the SAME tools the agent loop and the Responses `server_tools` path run, but called as a plain, typed, deterministic API. A front end can use it two ways: (1) call a tool straight as an API (e.g. `pdf.render` / `pdf.extract` behind a PDF UX), or (2) drive its OWN agent loop and execute each model tool-call here. Capability-gated server-side to the caller's grants (same blast-radius rules as the agent loop). POST /admin/collection/:collectionId/ai/tools/:name/run
|
|
16144
16172
|
|
|
@@ -16202,7 +16230,7 @@ Admin: replace the site's translation rules. They apply to new translations from
|
|
|
16202
16230
|
|
|
16203
16231
|
### tts
|
|
16204
16232
|
|
|
16205
|
-
**generate**(collectionId: string,
|
|
16233
|
+
**generate**(collectionId: string,
|
|
16206
16234
|
request: TTSRequest) → `Promise<Blob>`
|
|
16207
16235
|
Generate text-to-speech audio
|
|
16208
16236
|
|