@proveanything/smartlinks 2.1.47 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +754 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/dpp.d.ts +6 -0
- package/dist/api/dpp.js +12 -0
- package/dist/api/shop.d.ts +5 -1
- package/dist/api/shop.js +7 -7
- package/dist/api/subscriptions.d.ts +2 -1
- package/dist/api/subscriptions.js +4 -12
- package/dist/apiVersion.d.ts +9 -0
- package/dist/apiVersion.js +15 -0
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +821 -811
- 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/api-versions.md +76 -0
- 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/dpp.md +115 -99
- 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/i18n.md +9 -9
- 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 +183 -183
- package/dist/docs/memberships.md +149 -149
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +485 -485
- package/dist/docs/proof-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/server-functions.md +1 -1
- package/dist/docs/service-accounts.md +64 -64
- 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/http.d.ts +14 -0
- package/dist/http.js +65 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/openapi.yaml +6 -3
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/dpp.d.ts +14 -5
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/money.d.ts +15 -0
- package/dist/utils/money.js +72 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/docs/API_SUMMARY.md +821 -811
- 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/api-versions.md +76 -0
- 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/dpp.md +115 -99
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +210 -210
- package/docs/i18n.md +9 -9
- 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 +183 -183
- package/docs/memberships.md +149 -149
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +485 -485
- 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/server-functions.md +1 -1
- package/docs/service-accounts.md +64 -64
- 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 +6 -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/dist/docs/API_SUMMARY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Smartlinks API Summary
|
|
2
2
|
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0 | Generated: 2026-11-24T13:11:42.707Z
|
|
4
4
|
|
|
5
5
|
This is a concise summary of all available API functions and types.
|
|
6
6
|
|
|
@@ -183,6 +183,12 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
183
183
|
|
|
184
184
|
Core HTTP functions for API configuration and communication:
|
|
185
185
|
|
|
186
|
+
**getClientHeaders**() → `Record<string, string>`
|
|
187
|
+
The identity headers for this client: API version, SDK release and (in an app) the app.
|
|
188
|
+
|
|
189
|
+
**getApiVersion**() → `string`
|
|
190
|
+
The API version this client asks for (the SDK's own, unless `initializeApi({ apiVersion })` set another).
|
|
191
|
+
|
|
186
192
|
**getHttpCacheDiagnostics**() → `void`
|
|
187
193
|
Snapshot of cache counters + current keys. Call from the console via `window.__slHttpDiag()`.
|
|
188
194
|
|
|
@@ -7055,418 +7061,418 @@ interface TransactionalSendError {
|
|
|
7055
7061
|
|
|
7056
7062
|
**EmailAttachmentSpec** = ``
|
|
7057
7063
|
|
|
7058
|
-
**TransactionalSendResult** = `// src/types/comms.ts
|
|
7059
|
-
// Communication and notification types for the Smartlinks API
|
|
7060
|
-
import type { IdField } from './common'
|
|
7061
|
-
import type { BroadcastChannel } from './broadcasts'
|
|
7062
|
-
|
|
7063
|
-
/**
|
|
7064
|
-
* Target subject for notifications (product, collection, etc.)
|
|
7065
|
-
*/
|
|
7066
|
-
export interface NotificationSubjectTarget {
|
|
7067
|
-
/** Type of target entity */
|
|
7068
|
-
type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
|
|
7069
|
-
/** ID of the target entity */
|
|
7070
|
-
id: string
|
|
7071
|
-
}
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
// Analytics & logging (communication events)
|
|
7075
|
-
|
|
7076
|
-
export interface CommunicationEvent {
|
|
7077
|
-
orgId: string
|
|
7078
|
-
broadcastId?: string
|
|
7079
|
-
journeyId?: string
|
|
7080
|
-
userId?: string
|
|
7081
|
-
contactId?: string
|
|
7082
|
-
channel?: string
|
|
7083
|
-
timestamp: string
|
|
7084
|
-
eventType: string
|
|
7085
|
-
outcome?: string | null
|
|
7086
|
-
templateId?: string | null
|
|
7087
|
-
[k: string]: any
|
|
7088
|
-
}
|
|
7089
|
-
|
|
7090
|
-
export interface CommsQueryByUser {
|
|
7091
|
-
userId?: string
|
|
7092
|
-
contactId?: string
|
|
7093
|
-
from?: string
|
|
7094
|
-
to?: string
|
|
7095
|
-
limit?: number
|
|
7096
|
-
}
|
|
7097
|
-
|
|
7098
|
-
export type RecipientId = string
|
|
7099
|
-
export interface RecipientWithOutcome { id: string; outcome: string }
|
|
7100
|
-
|
|
7101
|
-
export interface CommsRecipientIdsQuery {
|
|
7102
|
-
broadcastId?: string
|
|
7103
|
-
journeyId?: string
|
|
7104
|
-
journeyStepId?: string
|
|
7105
|
-
idField?: IdField
|
|
7106
|
-
from?: string
|
|
7107
|
-
to?: string
|
|
7108
|
-
limit?: number
|
|
7109
|
-
}
|
|
7110
|
-
|
|
7111
|
-
export interface CommsRecipientsWithoutActionQuery {
|
|
7112
|
-
broadcastId?: string
|
|
7113
|
-
journeyId?: string
|
|
7114
|
-
actionId?: string
|
|
7115
|
-
appId?: string
|
|
7116
|
-
idField?: IdField
|
|
7117
|
-
from?: string
|
|
7118
|
-
to?: string
|
|
7119
|
-
limit?: number
|
|
7120
|
-
}
|
|
7121
|
-
|
|
7122
|
-
export interface CommsRecipientsWithActionQuery {
|
|
7123
|
-
broadcastId?: string
|
|
7124
|
-
journeyId?: string
|
|
7125
|
-
actionId?: string
|
|
7126
|
-
appId?: string
|
|
7127
|
-
outcome?: string
|
|
7128
|
-
idField?: IdField
|
|
7129
|
-
includeOutcome?: boolean
|
|
7130
|
-
from?: string
|
|
7131
|
-
to?: string
|
|
7132
|
-
limit?: number
|
|
7133
|
-
}
|
|
7134
|
-
|
|
7135
|
-
export interface LogCommunicationEventBody {
|
|
7136
|
-
broadcastId?: string
|
|
7137
|
-
journeyId?: string
|
|
7138
|
-
userId?: string
|
|
7139
|
-
contactId?: string
|
|
7140
|
-
channel?: string
|
|
7141
|
-
eventType: string
|
|
7142
|
-
outcome?: string
|
|
7143
|
-
templateId?: string
|
|
7144
|
-
timestamp?: string
|
|
7145
|
-
[k: string]: any
|
|
7146
|
-
}
|
|
7147
|
-
|
|
7148
|
-
export interface LogBulkCommunicationEventsBody {
|
|
7149
|
-
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
7150
|
-
ids: string[]
|
|
7151
|
-
idField?: IdField
|
|
7152
|
-
}
|
|
7153
|
-
|
|
7154
|
-
export interface AppendResult { success: true }
|
|
7155
|
-
export interface AppendBulkResult { success: true; count: number }
|
|
7156
|
-
|
|
7157
|
-
// Common recipient type used by segments and broadcasts
|
|
7158
|
-
export type Recipient = import('./contact').Contact
|
|
7159
|
-
|
|
7160
|
-
// Shared page response shape for recipient listings
|
|
7161
|
-
export interface RecipientsPage {
|
|
7162
|
-
items: Recipient[]
|
|
7163
|
-
total: number
|
|
7164
|
-
limit: number
|
|
7165
|
-
offset: number
|
|
7166
|
-
note?: string
|
|
7167
|
-
}
|
|
7168
|
-
|
|
7169
|
-
// Web Push (public client registration)
|
|
7170
|
-
|
|
7171
|
-
export interface PushSubscriptionJSON {
|
|
7172
|
-
endpoint: string
|
|
7173
|
-
keys?: {
|
|
7174
|
-
p256dh?: string
|
|
7175
|
-
auth?: string
|
|
7176
|
-
}
|
|
7177
|
-
}
|
|
7178
|
-
|
|
7179
|
-
export interface PushVapidResponse { publicKey: string }
|
|
7180
|
-
export interface PushSubscribeResponse { ok: true; id: string }
|
|
7181
|
-
|
|
7182
|
-
// Public: register a push contact method
|
|
7183
|
-
export interface RegisterPushMethodRequest {
|
|
7184
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7185
|
-
contactId?: string
|
|
7186
|
-
endpoint: string
|
|
7187
|
-
keys: { p256dh: string; auth: string }
|
|
7188
|
-
meta?: Record<string, any>
|
|
7189
|
-
}
|
|
7190
|
-
|
|
7191
|
-
// Admin Comms Settings
|
|
7192
|
-
|
|
7193
|
-
export interface CommsSettings {
|
|
7194
|
-
unsub?: {
|
|
7195
|
-
requireToken?: boolean
|
|
7196
|
-
/** Secret for token generation; omitted unless includeSecret=true */
|
|
7197
|
-
secret?: string
|
|
7198
|
-
/** Convenience flag indicating a secret is set (masked responses) */
|
|
7199
|
-
hasSecret?: boolean
|
|
7200
|
-
}
|
|
7201
|
-
/** Map of topic keys to topic config */
|
|
7202
|
-
topics?: Record<string, TopicConfig>
|
|
7203
|
-
[k: string]: any
|
|
7204
|
-
}
|
|
7205
|
-
|
|
7206
|
-
export interface TopicConfig {
|
|
7207
|
-
label?: string
|
|
7208
|
-
description?: string
|
|
7209
|
-
/** Optional UI-only grouping labels */
|
|
7210
|
-
labels?: string[]
|
|
7211
|
-
/** Classification for UI and default policy guidance */
|
|
7212
|
-
classification?: 'transactional' | 'marketing'
|
|
7213
|
-
defaults?: {
|
|
7214
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7215
|
-
topics?: Record<string, boolean | undefined>
|
|
7216
|
-
/** Default consent policy when explicit preferences are absent */
|
|
7217
|
-
policy?: 'opt-in' | 'opt-out'
|
|
7218
|
-
/** Per-channel default policy (overrides policy when present) */
|
|
7219
|
-
byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
|
|
7220
|
-
}
|
|
7221
|
-
rules?: {
|
|
7222
|
-
allowChannels?: BroadcastChannel[]
|
|
7223
|
-
allowUnsubscribe?: boolean
|
|
7224
|
-
required?: boolean
|
|
7225
|
-
}
|
|
7226
|
-
[k: string]: any
|
|
7227
|
-
}
|
|
7228
|
-
|
|
7229
|
-
export interface CommsSettingsGetResponse {
|
|
7230
|
-
ok: true
|
|
7231
|
-
settings: CommsSettings
|
|
7232
|
-
}
|
|
7233
|
-
|
|
7234
|
-
export type CommsSettingsPatchBody = Partial<CommsSettings>
|
|
7235
|
-
|
|
7236
|
-
// Public types listing (array form for public API)
|
|
7237
|
-
export interface CommsPublicTopicsResponse { ok: true; topics: Record<string, TopicConfig> }
|
|
7238
|
-
|
|
7239
|
-
export interface UnsubscribeQuery {
|
|
7240
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7241
|
-
contactId?: string
|
|
7242
|
-
topic?: string
|
|
7243
|
-
channel?: BroadcastChannel
|
|
7244
|
-
token?: string
|
|
7245
|
-
}
|
|
7246
|
-
|
|
7247
|
-
export interface UnsubscribeResponse { ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> } }
|
|
7248
|
-
|
|
7249
|
-
// Public sign-up (double opt-in)
|
|
7250
|
-
export interface CommsSignupRequest {
|
|
7251
|
-
email: string
|
|
7252
|
-
/**
|
|
7253
|
-
* Required: YOUR app's confirmation email — a template in this collection (SL.template) whose body
|
|
7254
|
-
* uses `{{ action_url }}` for the confirm link (`{{ topics }}` lists what they signed up for). The
|
|
7255
|
-
* platform sends no default sign-up email.
|
|
7256
|
-
*/
|
|
7257
|
-
templateId: string
|
|
7258
|
-
/** Topic ids from the collection's comm settings (e.g. ["newsletter"]). */
|
|
7259
|
-
topics?: string[]
|
|
7260
|
-
firstName?: string
|
|
7261
|
-
/**
|
|
7262
|
-
* The form's other answers — firstName/lastName/displayName/company/locale/timezone and
|
|
7263
|
-
* `customFields`. Applied to the contact when the address is confirmed, and only where the contact
|
|
7264
|
-
* has no value yet (never overwritten). Small: ~2 KB.
|
|
7265
|
-
*/
|
|
7266
|
-
fields?: { firstName?: string; lastName?: string; displayName?: string; company?: string; locale?: string; timezone?: string; customFields?: Record<string, string | number | boolean> }
|
|
7267
|
-
/** Your app id, recorded with the sent email. */
|
|
7268
|
-
appId?: string
|
|
7269
|
-
}
|
|
7270
|
-
export interface CommsSignupResponse { ok: true; pending: true }
|
|
7271
|
-
|
|
7272
|
-
// Public consent/preferences/subscribe
|
|
7273
|
-
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>
|
|
7274
|
-
type SubjectType = import('./contact').SubjectType
|
|
7275
|
-
|
|
7276
|
-
export interface CommsConsentUpsertRequest {
|
|
7277
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7278
|
-
contactId?: string
|
|
7279
|
-
channels?: ConsentChannels
|
|
7280
|
-
topics?: Record<string, boolean>
|
|
7281
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7282
|
-
}
|
|
7283
|
-
|
|
7284
|
-
export interface CommsPreferencesUpsertRequest {
|
|
7285
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7286
|
-
contactId?: string
|
|
7287
|
-
subject?: { type: SubjectType; id: string; productId?: string }
|
|
7288
|
-
channels?: ConsentChannels
|
|
7289
|
-
topics?: Record<string, boolean>
|
|
7290
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7291
|
-
}
|
|
7292
|
-
|
|
7293
|
-
export interface CommsSubscribeRequest {
|
|
7294
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7295
|
-
contactId?: string
|
|
7296
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7297
|
-
subscribe: boolean
|
|
7298
|
-
source?: string
|
|
7299
|
-
}
|
|
7300
|
-
export interface CommsSubscribeResponse { ok: true; subscriptionId: string }
|
|
7301
|
-
|
|
7302
|
-
export interface CommsSubscriptionCheckQuery {
|
|
7303
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7304
|
-
contactId?: string
|
|
7305
|
-
subjectType: SubjectType
|
|
7306
|
-
subjectId: string
|
|
7307
|
-
productId?: string
|
|
7308
|
-
}
|
|
7309
|
-
export interface CommsSubscriptionCheckResponse { ok: true; subscribed: boolean }
|
|
7310
|
-
|
|
7311
|
-
export interface CommsListMethodsQuery {
|
|
7312
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7313
|
-
contactId?: string
|
|
7314
|
-
type?: BroadcastChannel
|
|
7315
|
-
}
|
|
7316
|
-
export interface CommsListMethodsResponse { ok: true; methods: import('./contact').CommMethod[] }
|
|
7317
|
-
|
|
7318
|
-
export interface RegisterEmailMethodRequest { contactId?: string; email?: string; userId?: string }
|
|
7319
|
-
export interface RegisterSmsMethodRequest { contactId?: string; phone?: string; userId?: string }
|
|
7320
|
-
export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
7321
|
-
|
|
7322
|
-
export interface SubscriptionsResolveRequest {
|
|
7323
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7324
|
-
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7325
|
-
}
|
|
7326
|
-
export interface SubscriptionsResolveResponse {
|
|
7327
|
-
ok: true
|
|
7328
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7329
|
-
contacts: Array<{
|
|
7330
|
-
contactId: string
|
|
7331
|
-
subscribed: boolean
|
|
7332
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7333
|
-
}>
|
|
7334
|
-
anySubscribed: boolean
|
|
7335
|
-
anyMethods: boolean
|
|
7336
|
-
}
|
|
7337
|
-
|
|
7338
|
-
// Transactional send (single-contact, single-message)
|
|
7339
|
-
|
|
7340
|
-
/**
|
|
7341
|
-
* Send a single message to one contact using a template.
|
|
7342
|
-
* No broadcast record is created; the send is logged directly to the
|
|
7343
|
-
* contact's communication history with sourceType: 'transactional'.
|
|
7344
|
-
*
|
|
7345
|
-
* POST /admin/collection/:collectionId/comm/send
|
|
7346
|
-
*/
|
|
7347
|
-
export interface TransactionalSendRequest {
|
|
7348
|
-
/** CRM contact UUID */
|
|
7349
|
-
contactId: string
|
|
7350
|
-
/** A saved template's id. Give this or `message`. */
|
|
7351
|
-
templateId?: string
|
|
7352
|
-
/**
|
|
7353
|
-
* A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
|
|
7354
|
-
* `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
|
|
7355
|
-
*/
|
|
7356
|
-
message?: TypedMessage
|
|
7357
|
-
/**
|
|
7358
|
-
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
7359
|
-
* contact's best available channel respecting consent, suppression, and
|
|
7360
|
-
* template availability.
|
|
7361
|
-
*/
|
|
7362
|
-
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
7363
|
-
/** Extra Liquid variables merged into the top-level render context */
|
|
7364
|
-
props?: Record<string, unknown>
|
|
7365
|
-
/** Context objects to hydrate into the Liquid template */
|
|
7366
|
-
include?: {
|
|
7367
|
-
/** Hydrate {{ collection }}. Default: true */
|
|
7368
|
-
collection?: boolean
|
|
7369
|
-
/** Hydrate {{ product }} from this product ID */
|
|
7370
|
-
productId?: string
|
|
7371
|
-
/** Hydrate {{ proof }} (requires productId) */
|
|
7372
|
-
proofId?: string
|
|
7373
|
-
/** Hydrate {{ user }} from contact.userId */
|
|
7374
|
-
user?: boolean
|
|
7375
|
-
/** Hydrate {{ appCase }} from this case UUID */
|
|
7376
|
-
appCase?: string
|
|
7377
|
-
/** Hydrate {{ appThread }} from this thread UUID */
|
|
7378
|
-
appThread?: string
|
|
7379
|
-
/** Hydrate {{ appRecord }} from this record UUID */
|
|
7380
|
-
appRecord?: string
|
|
7381
|
-
}
|
|
7382
|
-
/** Arbitrary label stored on the comms-events row (e.g. 'warranty-step-2') */
|
|
7383
|
-
ref?: string
|
|
7384
|
-
/** App context stored on the comms-events row */
|
|
7385
|
-
appId?: string
|
|
7386
|
-
/**
|
|
7387
|
-
* What the message is about: the record it was sent for and the admin screen that shows it, so it is a
|
|
7388
|
-
* link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
|
|
7389
|
-
* to the sending app.
|
|
7390
|
-
*/
|
|
7391
|
-
about?: MessageAbout
|
|
7392
|
-
/**
|
|
7393
|
-
* `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
|
|
7394
|
-
* suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
|
|
7395
|
-
*/
|
|
7396
|
-
category?: 'service'
|
|
7397
|
-
/**
|
|
7398
|
-
* Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
|
|
7399
|
-
* `attachmentsLeftOut` — the email still goes.
|
|
7400
|
-
*/
|
|
7401
|
-
attach?: EmailAttachmentSpec[]
|
|
7402
|
-
}
|
|
7403
|
-
|
|
7404
|
-
/**
|
|
7405
|
-
* One file for an email:
|
|
7406
|
-
* - `'calendar'` — the booking's `.ics` calendar invite (needs `include.booking` and `appId`)
|
|
7407
|
-
* - `{ asset }` — a file uploaded to this collection's assets
|
|
7408
|
-
* - `{ function }` — the app's (`appId`) own server function makes it (see server-functions.md, "Making an email attachment")
|
|
7409
|
-
* - `{ filename, contentType, content }` — a file you made, base64 (PDF, Office documents, images, text, CSV, calendar)
|
|
7410
|
-
* - `{ filename, file }` — a private file you made (e.g. `pdf.create` with `return: 'signedUrl'`)
|
|
7411
|
-
*/
|
|
7412
|
-
export type EmailAttachmentSpec =
|
|
7413
|
-
| 'calendar'
|
|
7414
|
-
| { asset: string }
|
|
7415
|
-
| { function: string }
|
|
7416
|
-
| { filename: string; contentType: string; content: string }
|
|
7417
|
-
| { filename: string; contentType?: string; file: string }
|
|
7418
|
-
|
|
7419
|
-
export interface TransactionalSendResponse {
|
|
7420
|
-
ok: true
|
|
7421
|
-
/** The channel the message was actually sent on */
|
|
7422
|
-
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
7423
|
-
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
7424
|
-
messageId?: string
|
|
7425
|
-
/** Attachments that couldn't be made, and why (the email went without them) */
|
|
7426
|
-
attachmentsLeftOut?: string[]
|
|
7427
|
-
}
|
|
7428
|
-
|
|
7429
|
-
/** A message written there and then rather than a saved template. */
|
|
7430
|
-
export interface TypedMessage {
|
|
7431
|
-
subject?: string
|
|
7432
|
-
body: string
|
|
7433
|
-
/** The shorter text for SMS and WhatsApp (defaults to `body`). */
|
|
7434
|
-
sms?: string
|
|
7435
|
-
}
|
|
7436
|
-
|
|
7437
|
-
/**
|
|
7438
|
-
* What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
|
|
7439
|
-
* `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
|
|
7440
|
-
*/
|
|
7441
|
-
export interface MessageAbout {
|
|
7442
|
-
appId?: string
|
|
7443
|
-
/** What kind of record: `'booking'`, `'entry'`, `'case'`. */
|
|
7444
|
-
type: string
|
|
7445
|
-
id: string
|
|
7446
|
-
view?: string
|
|
7447
|
-
params?: Record<string, string>
|
|
7448
|
-
/** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
|
|
7449
|
-
label?: string
|
|
7450
|
-
}
|
|
7451
|
-
|
|
7452
|
-
export interface TransactionalSendError {
|
|
7453
|
-
ok: false
|
|
7454
|
-
/**
|
|
7455
|
-
* Error code. Known values:
|
|
7456
|
-
* - `transactional.contact_not_found`
|
|
7457
|
-
* - `transactional.template_not_found`
|
|
7458
|
-
* - `transactional.no_channel_available`
|
|
7459
|
-
* - `transactional.email_missing`
|
|
7460
|
-
* - `transactional.phone_missing`
|
|
7461
|
-
* - `transactional.whatsapp_missing`
|
|
7462
|
-
* - `transactional.no_push_methods`
|
|
7463
|
-
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7464
|
-
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7465
|
-
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7466
|
-
*/
|
|
7467
|
-
error: string
|
|
7468
|
-
}
|
|
7469
|
-
|
|
7064
|
+
**TransactionalSendResult** = `// src/types/comms.ts
|
|
7065
|
+
// Communication and notification types for the Smartlinks API
|
|
7066
|
+
import type { IdField } from './common'
|
|
7067
|
+
import type { BroadcastChannel } from './broadcasts'
|
|
7068
|
+
|
|
7069
|
+
/**
|
|
7070
|
+
* Target subject for notifications (product, collection, etc.)
|
|
7071
|
+
*/
|
|
7072
|
+
export interface NotificationSubjectTarget {
|
|
7073
|
+
/** Type of target entity */
|
|
7074
|
+
type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
|
|
7075
|
+
/** ID of the target entity */
|
|
7076
|
+
id: string
|
|
7077
|
+
}
|
|
7078
|
+
|
|
7079
|
+
|
|
7080
|
+
// Analytics & logging (communication events)
|
|
7081
|
+
|
|
7082
|
+
export interface CommunicationEvent {
|
|
7083
|
+
orgId: string
|
|
7084
|
+
broadcastId?: string
|
|
7085
|
+
journeyId?: string
|
|
7086
|
+
userId?: string
|
|
7087
|
+
contactId?: string
|
|
7088
|
+
channel?: string
|
|
7089
|
+
timestamp: string
|
|
7090
|
+
eventType: string
|
|
7091
|
+
outcome?: string | null
|
|
7092
|
+
templateId?: string | null
|
|
7093
|
+
[k: string]: any
|
|
7094
|
+
}
|
|
7095
|
+
|
|
7096
|
+
export interface CommsQueryByUser {
|
|
7097
|
+
userId?: string
|
|
7098
|
+
contactId?: string
|
|
7099
|
+
from?: string
|
|
7100
|
+
to?: string
|
|
7101
|
+
limit?: number
|
|
7102
|
+
}
|
|
7103
|
+
|
|
7104
|
+
export type RecipientId = string
|
|
7105
|
+
export interface RecipientWithOutcome { id: string; outcome: string }
|
|
7106
|
+
|
|
7107
|
+
export interface CommsRecipientIdsQuery {
|
|
7108
|
+
broadcastId?: string
|
|
7109
|
+
journeyId?: string
|
|
7110
|
+
journeyStepId?: string
|
|
7111
|
+
idField?: IdField
|
|
7112
|
+
from?: string
|
|
7113
|
+
to?: string
|
|
7114
|
+
limit?: number
|
|
7115
|
+
}
|
|
7116
|
+
|
|
7117
|
+
export interface CommsRecipientsWithoutActionQuery {
|
|
7118
|
+
broadcastId?: string
|
|
7119
|
+
journeyId?: string
|
|
7120
|
+
actionId?: string
|
|
7121
|
+
appId?: string
|
|
7122
|
+
idField?: IdField
|
|
7123
|
+
from?: string
|
|
7124
|
+
to?: string
|
|
7125
|
+
limit?: number
|
|
7126
|
+
}
|
|
7127
|
+
|
|
7128
|
+
export interface CommsRecipientsWithActionQuery {
|
|
7129
|
+
broadcastId?: string
|
|
7130
|
+
journeyId?: string
|
|
7131
|
+
actionId?: string
|
|
7132
|
+
appId?: string
|
|
7133
|
+
outcome?: string
|
|
7134
|
+
idField?: IdField
|
|
7135
|
+
includeOutcome?: boolean
|
|
7136
|
+
from?: string
|
|
7137
|
+
to?: string
|
|
7138
|
+
limit?: number
|
|
7139
|
+
}
|
|
7140
|
+
|
|
7141
|
+
export interface LogCommunicationEventBody {
|
|
7142
|
+
broadcastId?: string
|
|
7143
|
+
journeyId?: string
|
|
7144
|
+
userId?: string
|
|
7145
|
+
contactId?: string
|
|
7146
|
+
channel?: string
|
|
7147
|
+
eventType: string
|
|
7148
|
+
outcome?: string
|
|
7149
|
+
templateId?: string
|
|
7150
|
+
timestamp?: string
|
|
7151
|
+
[k: string]: any
|
|
7152
|
+
}
|
|
7153
|
+
|
|
7154
|
+
export interface LogBulkCommunicationEventsBody {
|
|
7155
|
+
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
7156
|
+
ids: string[]
|
|
7157
|
+
idField?: IdField
|
|
7158
|
+
}
|
|
7159
|
+
|
|
7160
|
+
export interface AppendResult { success: true }
|
|
7161
|
+
export interface AppendBulkResult { success: true; count: number }
|
|
7162
|
+
|
|
7163
|
+
// Common recipient type used by segments and broadcasts
|
|
7164
|
+
export type Recipient = import('./contact').Contact
|
|
7165
|
+
|
|
7166
|
+
// Shared page response shape for recipient listings
|
|
7167
|
+
export interface RecipientsPage {
|
|
7168
|
+
items: Recipient[]
|
|
7169
|
+
total: number
|
|
7170
|
+
limit: number
|
|
7171
|
+
offset: number
|
|
7172
|
+
note?: string
|
|
7173
|
+
}
|
|
7174
|
+
|
|
7175
|
+
// Web Push (public client registration)
|
|
7176
|
+
|
|
7177
|
+
export interface PushSubscriptionJSON {
|
|
7178
|
+
endpoint: string
|
|
7179
|
+
keys?: {
|
|
7180
|
+
p256dh?: string
|
|
7181
|
+
auth?: string
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
|
|
7185
|
+
export interface PushVapidResponse { publicKey: string }
|
|
7186
|
+
export interface PushSubscribeResponse { ok: true; id: string }
|
|
7187
|
+
|
|
7188
|
+
// Public: register a push contact method
|
|
7189
|
+
export interface RegisterPushMethodRequest {
|
|
7190
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7191
|
+
contactId?: string
|
|
7192
|
+
endpoint: string
|
|
7193
|
+
keys: { p256dh: string; auth: string }
|
|
7194
|
+
meta?: Record<string, any>
|
|
7195
|
+
}
|
|
7196
|
+
|
|
7197
|
+
// Admin Comms Settings
|
|
7198
|
+
|
|
7199
|
+
export interface CommsSettings {
|
|
7200
|
+
unsub?: {
|
|
7201
|
+
requireToken?: boolean
|
|
7202
|
+
/** Secret for token generation; omitted unless includeSecret=true */
|
|
7203
|
+
secret?: string
|
|
7204
|
+
/** Convenience flag indicating a secret is set (masked responses) */
|
|
7205
|
+
hasSecret?: boolean
|
|
7206
|
+
}
|
|
7207
|
+
/** Map of topic keys to topic config */
|
|
7208
|
+
topics?: Record<string, TopicConfig>
|
|
7209
|
+
[k: string]: any
|
|
7210
|
+
}
|
|
7211
|
+
|
|
7212
|
+
export interface TopicConfig {
|
|
7213
|
+
label?: string
|
|
7214
|
+
description?: string
|
|
7215
|
+
/** Optional UI-only grouping labels */
|
|
7216
|
+
labels?: string[]
|
|
7217
|
+
/** Classification for UI and default policy guidance */
|
|
7218
|
+
classification?: 'transactional' | 'marketing'
|
|
7219
|
+
defaults?: {
|
|
7220
|
+
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7221
|
+
topics?: Record<string, boolean | undefined>
|
|
7222
|
+
/** Default consent policy when explicit preferences are absent */
|
|
7223
|
+
policy?: 'opt-in' | 'opt-out'
|
|
7224
|
+
/** Per-channel default policy (overrides policy when present) */
|
|
7225
|
+
byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
|
|
7226
|
+
}
|
|
7227
|
+
rules?: {
|
|
7228
|
+
allowChannels?: BroadcastChannel[]
|
|
7229
|
+
allowUnsubscribe?: boolean
|
|
7230
|
+
required?: boolean
|
|
7231
|
+
}
|
|
7232
|
+
[k: string]: any
|
|
7233
|
+
}
|
|
7234
|
+
|
|
7235
|
+
export interface CommsSettingsGetResponse {
|
|
7236
|
+
ok: true
|
|
7237
|
+
settings: CommsSettings
|
|
7238
|
+
}
|
|
7239
|
+
|
|
7240
|
+
export type CommsSettingsPatchBody = Partial<CommsSettings>
|
|
7241
|
+
|
|
7242
|
+
// Public types listing (array form for public API)
|
|
7243
|
+
export interface CommsPublicTopicsResponse { ok: true; topics: Record<string, TopicConfig> }
|
|
7244
|
+
|
|
7245
|
+
export interface UnsubscribeQuery {
|
|
7246
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7247
|
+
contactId?: string
|
|
7248
|
+
topic?: string
|
|
7249
|
+
channel?: BroadcastChannel
|
|
7250
|
+
token?: string
|
|
7251
|
+
}
|
|
7252
|
+
|
|
7253
|
+
export interface UnsubscribeResponse { ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> } }
|
|
7254
|
+
|
|
7255
|
+
// Public sign-up (double opt-in)
|
|
7256
|
+
export interface CommsSignupRequest {
|
|
7257
|
+
email: string
|
|
7258
|
+
/**
|
|
7259
|
+
* Required: YOUR app's confirmation email — a template in this collection (SL.template) whose body
|
|
7260
|
+
* uses `{{ action_url }}` for the confirm link (`{{ topics }}` lists what they signed up for). The
|
|
7261
|
+
* platform sends no default sign-up email.
|
|
7262
|
+
*/
|
|
7263
|
+
templateId: string
|
|
7264
|
+
/** Topic ids from the collection's comm settings (e.g. ["newsletter"]). */
|
|
7265
|
+
topics?: string[]
|
|
7266
|
+
firstName?: string
|
|
7267
|
+
/**
|
|
7268
|
+
* The form's other answers — firstName/lastName/displayName/company/locale/timezone and
|
|
7269
|
+
* `customFields`. Applied to the contact when the address is confirmed, and only where the contact
|
|
7270
|
+
* has no value yet (never overwritten). Small: ~2 KB.
|
|
7271
|
+
*/
|
|
7272
|
+
fields?: { firstName?: string; lastName?: string; displayName?: string; company?: string; locale?: string; timezone?: string; customFields?: Record<string, string | number | boolean> }
|
|
7273
|
+
/** Your app id, recorded with the sent email. */
|
|
7274
|
+
appId?: string
|
|
7275
|
+
}
|
|
7276
|
+
export interface CommsSignupResponse { ok: true; pending: true }
|
|
7277
|
+
|
|
7278
|
+
// Public consent/preferences/subscribe
|
|
7279
|
+
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>
|
|
7280
|
+
type SubjectType = import('./contact').SubjectType
|
|
7281
|
+
|
|
7282
|
+
export interface CommsConsentUpsertRequest {
|
|
7283
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7284
|
+
contactId?: string
|
|
7285
|
+
channels?: ConsentChannels
|
|
7286
|
+
topics?: Record<string, boolean>
|
|
7287
|
+
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7288
|
+
}
|
|
7289
|
+
|
|
7290
|
+
export interface CommsPreferencesUpsertRequest {
|
|
7291
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7292
|
+
contactId?: string
|
|
7293
|
+
subject?: { type: SubjectType; id: string; productId?: string }
|
|
7294
|
+
channels?: ConsentChannels
|
|
7295
|
+
topics?: Record<string, boolean>
|
|
7296
|
+
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7297
|
+
}
|
|
7298
|
+
|
|
7299
|
+
export interface CommsSubscribeRequest {
|
|
7300
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7301
|
+
contactId?: string
|
|
7302
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7303
|
+
subscribe: boolean
|
|
7304
|
+
source?: string
|
|
7305
|
+
}
|
|
7306
|
+
export interface CommsSubscribeResponse { ok: true; subscriptionId: string }
|
|
7307
|
+
|
|
7308
|
+
export interface CommsSubscriptionCheckQuery {
|
|
7309
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7310
|
+
contactId?: string
|
|
7311
|
+
subjectType: SubjectType
|
|
7312
|
+
subjectId: string
|
|
7313
|
+
productId?: string
|
|
7314
|
+
}
|
|
7315
|
+
export interface CommsSubscriptionCheckResponse { ok: true; subscribed: boolean }
|
|
7316
|
+
|
|
7317
|
+
export interface CommsListMethodsQuery {
|
|
7318
|
+
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7319
|
+
contactId?: string
|
|
7320
|
+
type?: BroadcastChannel
|
|
7321
|
+
}
|
|
7322
|
+
export interface CommsListMethodsResponse { ok: true; methods: import('./contact').CommMethod[] }
|
|
7323
|
+
|
|
7324
|
+
export interface RegisterEmailMethodRequest { contactId?: string; email?: string; userId?: string }
|
|
7325
|
+
export interface RegisterSmsMethodRequest { contactId?: string; phone?: string; userId?: string }
|
|
7326
|
+
export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
7327
|
+
|
|
7328
|
+
export interface SubscriptionsResolveRequest {
|
|
7329
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7330
|
+
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7331
|
+
}
|
|
7332
|
+
export interface SubscriptionsResolveResponse {
|
|
7333
|
+
ok: true
|
|
7334
|
+
subject: { type: SubjectType; id: string; productId?: string }
|
|
7335
|
+
contacts: Array<{
|
|
7336
|
+
contactId: string
|
|
7337
|
+
subscribed: boolean
|
|
7338
|
+
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7339
|
+
}>
|
|
7340
|
+
anySubscribed: boolean
|
|
7341
|
+
anyMethods: boolean
|
|
7342
|
+
}
|
|
7343
|
+
|
|
7344
|
+
// Transactional send (single-contact, single-message)
|
|
7345
|
+
|
|
7346
|
+
/**
|
|
7347
|
+
* Send a single message to one contact using a template.
|
|
7348
|
+
* No broadcast record is created; the send is logged directly to the
|
|
7349
|
+
* contact's communication history with sourceType: 'transactional'.
|
|
7350
|
+
*
|
|
7351
|
+
* POST /admin/collection/:collectionId/comm/send
|
|
7352
|
+
*/
|
|
7353
|
+
export interface TransactionalSendRequest {
|
|
7354
|
+
/** CRM contact UUID */
|
|
7355
|
+
contactId: string
|
|
7356
|
+
/** A saved template's id. Give this or `message`. */
|
|
7357
|
+
templateId?: string
|
|
7358
|
+
/**
|
|
7359
|
+
* A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
|
|
7360
|
+
* `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
|
|
7361
|
+
*/
|
|
7362
|
+
message?: TypedMessage
|
|
7363
|
+
/**
|
|
7364
|
+
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
7365
|
+
* contact's best available channel respecting consent, suppression, and
|
|
7366
|
+
* template availability.
|
|
7367
|
+
*/
|
|
7368
|
+
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
7369
|
+
/** Extra Liquid variables merged into the top-level render context */
|
|
7370
|
+
props?: Record<string, unknown>
|
|
7371
|
+
/** Context objects to hydrate into the Liquid template */
|
|
7372
|
+
include?: {
|
|
7373
|
+
/** Hydrate {{ collection }}. Default: true */
|
|
7374
|
+
collection?: boolean
|
|
7375
|
+
/** Hydrate {{ product }} from this product ID */
|
|
7376
|
+
productId?: string
|
|
7377
|
+
/** Hydrate {{ proof }} (requires productId) */
|
|
7378
|
+
proofId?: string
|
|
7379
|
+
/** Hydrate {{ user }} from contact.userId */
|
|
7380
|
+
user?: boolean
|
|
7381
|
+
/** Hydrate {{ appCase }} from this case UUID */
|
|
7382
|
+
appCase?: string
|
|
7383
|
+
/** Hydrate {{ appThread }} from this thread UUID */
|
|
7384
|
+
appThread?: string
|
|
7385
|
+
/** Hydrate {{ appRecord }} from this record UUID */
|
|
7386
|
+
appRecord?: string
|
|
7387
|
+
}
|
|
7388
|
+
/** Arbitrary label stored on the comms-events row (e.g. 'warranty-step-2') */
|
|
7389
|
+
ref?: string
|
|
7390
|
+
/** App context stored on the comms-events row */
|
|
7391
|
+
appId?: string
|
|
7392
|
+
/**
|
|
7393
|
+
* What the message is about: the record it was sent for and the admin screen that shows it, so it is a
|
|
7394
|
+
* link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
|
|
7395
|
+
* to the sending app.
|
|
7396
|
+
*/
|
|
7397
|
+
about?: MessageAbout
|
|
7398
|
+
/**
|
|
7399
|
+
* `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
|
|
7400
|
+
* suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
|
|
7401
|
+
*/
|
|
7402
|
+
category?: 'service'
|
|
7403
|
+
/**
|
|
7404
|
+
* Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
|
|
7405
|
+
* `attachmentsLeftOut` — the email still goes.
|
|
7406
|
+
*/
|
|
7407
|
+
attach?: EmailAttachmentSpec[]
|
|
7408
|
+
}
|
|
7409
|
+
|
|
7410
|
+
/**
|
|
7411
|
+
* One file for an email:
|
|
7412
|
+
* - `'calendar'` — the booking's `.ics` calendar invite (needs `include.booking` and `appId`)
|
|
7413
|
+
* - `{ asset }` — a file uploaded to this collection's assets
|
|
7414
|
+
* - `{ function }` — the app's (`appId`) own server function makes it (see server-functions.md, "Making an email attachment")
|
|
7415
|
+
* - `{ filename, contentType, content }` — a file you made, base64 (PDF, Office documents, images, text, CSV, calendar)
|
|
7416
|
+
* - `{ filename, file }` — a private file you made (e.g. `pdf.create` with `return: 'signedUrl'`)
|
|
7417
|
+
*/
|
|
7418
|
+
export type EmailAttachmentSpec =
|
|
7419
|
+
| 'calendar'
|
|
7420
|
+
| { asset: string }
|
|
7421
|
+
| { function: string }
|
|
7422
|
+
| { filename: string; contentType: string; content: string }
|
|
7423
|
+
| { filename: string; contentType?: string; file: string }
|
|
7424
|
+
|
|
7425
|
+
export interface TransactionalSendResponse {
|
|
7426
|
+
ok: true
|
|
7427
|
+
/** The channel the message was actually sent on */
|
|
7428
|
+
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
7429
|
+
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
7430
|
+
messageId?: string
|
|
7431
|
+
/** Attachments that couldn't be made, and why (the email went without them) */
|
|
7432
|
+
attachmentsLeftOut?: string[]
|
|
7433
|
+
}
|
|
7434
|
+
|
|
7435
|
+
/** A message written there and then rather than a saved template. */
|
|
7436
|
+
export interface TypedMessage {
|
|
7437
|
+
subject?: string
|
|
7438
|
+
body: string
|
|
7439
|
+
/** The shorter text for SMS and WhatsApp (defaults to `body`). */
|
|
7440
|
+
sms?: string
|
|
7441
|
+
}
|
|
7442
|
+
|
|
7443
|
+
/**
|
|
7444
|
+
* What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
|
|
7445
|
+
* `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
|
|
7446
|
+
*/
|
|
7447
|
+
export interface MessageAbout {
|
|
7448
|
+
appId?: string
|
|
7449
|
+
/** What kind of record: `'booking'`, `'entry'`, `'case'`. */
|
|
7450
|
+
type: string
|
|
7451
|
+
id: string
|
|
7452
|
+
view?: string
|
|
7453
|
+
params?: Record<string, string>
|
|
7454
|
+
/** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
|
|
7455
|
+
label?: string
|
|
7456
|
+
}
|
|
7457
|
+
|
|
7458
|
+
export interface TransactionalSendError {
|
|
7459
|
+
ok: false
|
|
7460
|
+
/**
|
|
7461
|
+
* Error code. Known values:
|
|
7462
|
+
* - `transactional.contact_not_found`
|
|
7463
|
+
* - `transactional.template_not_found`
|
|
7464
|
+
* - `transactional.no_channel_available`
|
|
7465
|
+
* - `transactional.email_missing`
|
|
7466
|
+
* - `transactional.phone_missing`
|
|
7467
|
+
* - `transactional.whatsapp_missing`
|
|
7468
|
+
* - `transactional.no_push_methods`
|
|
7469
|
+
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7470
|
+
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7471
|
+
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7472
|
+
*/
|
|
7473
|
+
error: string
|
|
7474
|
+
}
|
|
7475
|
+
|
|
7470
7476
|
export type TransactionalSendResult =`
|
|
7471
7477
|
|
|
7472
7478
|
### config
|
|
@@ -8112,6 +8118,7 @@ interface DeleteCrateResponse {
|
|
|
8112
8118
|
interface DppRegistry {
|
|
8113
8119
|
environment: DppEnvironment
|
|
8114
8120
|
label: string
|
|
8121
|
+
practice: boolean
|
|
8115
8122
|
portal: string | null
|
|
8116
8123
|
clientId: string | null
|
|
8117
8124
|
kid: string | null
|
|
@@ -8348,11 +8355,11 @@ interface DppDocument {
|
|
|
8348
8355
|
}
|
|
8349
8356
|
```
|
|
8350
8357
|
|
|
8351
|
-
**DppEnvironment** = `"acc" | "prod" | "local" | (string & {})`
|
|
8358
|
+
**DppEnvironment** = `"acc" | "prod" | "practice" | "local" | (string & {})`
|
|
8352
8359
|
|
|
8353
8360
|
**DppGranularity** = `"item" | "batch" | "model"`
|
|
8354
8361
|
|
|
8355
|
-
**DppRegistryNextStep** = `"make-key" | "enter-service-account" | "enter-organisation-id" | "check" | null`
|
|
8362
|
+
**DppRegistryNextStep** = `"make-key" | "enter-service-account" | "enter-organisation-id" | "check" | "enrol-practice" | null`
|
|
8356
8363
|
|
|
8357
8364
|
**DppFields** = `Record<string, unknown>`
|
|
8358
8365
|
|
|
@@ -13585,36 +13592,36 @@ interface GuideStartOptions {
|
|
|
13585
13592
|
|
|
13586
13593
|
**AppConfigOptions** (type)
|
|
13587
13594
|
```typescript
|
|
13588
|
-
type AppConfigOptions = {
|
|
13589
|
-
/** The app ID */
|
|
13590
|
-
appId: string
|
|
13591
|
-
|
|
13592
|
-
/** Collection ID (required for most operations) */
|
|
13593
|
-
collectionId?: string
|
|
13594
|
-
/** Product ID (optional - for product-scoped config) */
|
|
13595
|
-
productId?: string
|
|
13596
|
-
/** Variant ID (optional - for variant-scoped config) */
|
|
13597
|
-
variantId?: string
|
|
13598
|
-
/** Batch ID (optional - for batch-scoped config) */
|
|
13599
|
-
batchId?: string
|
|
13600
|
-
|
|
13601
|
-
/** Item ID - required for getDataItem/deleteDataItem */
|
|
13602
|
-
itemId?: string
|
|
13603
|
-
|
|
13604
|
-
/**
|
|
13605
|
-
* Use admin endpoints instead of public.
|
|
13606
|
-
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
13607
|
-
*/
|
|
13608
|
-
admin?: boolean
|
|
13609
|
-
|
|
13610
|
-
/**
|
|
13611
|
-
* Configuration object for setConfig.
|
|
13612
|
-
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
13613
|
-
* Public reads return the root config but omit `config.admin`.
|
|
13614
|
-
*/
|
|
13615
|
-
config?: any
|
|
13616
|
-
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
13617
|
-
data?: any
|
|
13595
|
+
type AppConfigOptions = {
|
|
13596
|
+
/** The app ID */
|
|
13597
|
+
appId: string
|
|
13598
|
+
|
|
13599
|
+
/** Collection ID (required for most operations) */
|
|
13600
|
+
collectionId?: string
|
|
13601
|
+
/** Product ID (optional - for product-scoped config) */
|
|
13602
|
+
productId?: string
|
|
13603
|
+
/** Variant ID (optional - for variant-scoped config) */
|
|
13604
|
+
variantId?: string
|
|
13605
|
+
/** Batch ID (optional - for batch-scoped config) */
|
|
13606
|
+
batchId?: string
|
|
13607
|
+
|
|
13608
|
+
/** Item ID - required for getDataItem/deleteDataItem */
|
|
13609
|
+
itemId?: string
|
|
13610
|
+
|
|
13611
|
+
/**
|
|
13612
|
+
* Use admin endpoints instead of public.
|
|
13613
|
+
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
13614
|
+
*/
|
|
13615
|
+
admin?: boolean
|
|
13616
|
+
|
|
13617
|
+
/**
|
|
13618
|
+
* Configuration object for setConfig.
|
|
13619
|
+
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
13620
|
+
* Public reads return the root config but omit `config.admin`.
|
|
13621
|
+
*/
|
|
13622
|
+
config?: any
|
|
13623
|
+
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
13624
|
+
data?: any
|
|
13618
13625
|
}
|
|
13619
13626
|
```
|
|
13620
13627
|
|
|
@@ -14038,70 +14045,70 @@ Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when availabl
|
|
|
14038
14045
|
|
|
14039
14046
|
Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
|
|
14040
14047
|
|
|
14041
|
-
**create**(collectionId: string,
|
|
14042
|
-
appId: string,
|
|
14043
|
-
input: CreateCaseInput,
|
|
14048
|
+
**create**(collectionId: string,
|
|
14049
|
+
appId: string,
|
|
14050
|
+
input: CreateCaseInput,
|
|
14044
14051
|
admin: boolean = false) → `Promise<AppCase>`
|
|
14045
14052
|
Create a new case POST /cases
|
|
14046
14053
|
|
|
14047
|
-
**list**(collectionId: string,
|
|
14048
|
-
appId: string,
|
|
14049
|
-
params?: CaseListQueryParams,
|
|
14054
|
+
**list**(collectionId: string,
|
|
14055
|
+
appId: string,
|
|
14056
|
+
params?: CaseListQueryParams,
|
|
14050
14057
|
admin: boolean = false) → `Promise<PaginatedResponse<AppCase>>`
|
|
14051
14058
|
List cases with optional query parameters GET /cases
|
|
14052
14059
|
|
|
14053
|
-
**get**(collectionId: string,
|
|
14054
|
-
appId: string,
|
|
14055
|
-
caseId: string,
|
|
14060
|
+
**get**(collectionId: string,
|
|
14061
|
+
appId: string,
|
|
14062
|
+
caseId: string,
|
|
14056
14063
|
admin: boolean = false) → `Promise<AppCase>`
|
|
14057
14064
|
Get a single case by ID GET /cases/:caseId
|
|
14058
14065
|
|
|
14059
|
-
**update**(collectionId: string,
|
|
14060
|
-
appId: string,
|
|
14061
|
-
caseId: string,
|
|
14062
|
-
input: UpdateCaseInput,
|
|
14066
|
+
**update**(collectionId: string,
|
|
14067
|
+
appId: string,
|
|
14068
|
+
caseId: string,
|
|
14069
|
+
input: UpdateCaseInput,
|
|
14063
14070
|
admin: boolean = false) → `Promise<AppCase>`
|
|
14064
14071
|
Update a case PATCH /cases/:caseId Admin can update any field, public (owner) can only update data and owner zones
|
|
14065
14072
|
|
|
14066
|
-
**remove**(collectionId: string,
|
|
14067
|
-
appId: string,
|
|
14068
|
-
caseId: string,
|
|
14073
|
+
**remove**(collectionId: string,
|
|
14074
|
+
appId: string,
|
|
14075
|
+
caseId: string,
|
|
14069
14076
|
admin: boolean = false) → `Promise<`
|
|
14070
14077
|
Soft delete a case DELETE /cases/:caseId
|
|
14071
14078
|
|
|
14072
|
-
**aggregate**(collectionId: string,
|
|
14073
|
-
appId: string,
|
|
14074
|
-
request: AggregateRequest,
|
|
14079
|
+
**aggregate**(collectionId: string,
|
|
14080
|
+
appId: string,
|
|
14081
|
+
request: AggregateRequest,
|
|
14075
14082
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
14076
14083
|
Get aggregate statistics for cases POST /cases/aggregate
|
|
14077
14084
|
|
|
14078
|
-
**summary**(collectionId: string,
|
|
14079
|
-
appId: string,
|
|
14085
|
+
**summary**(collectionId: string,
|
|
14086
|
+
appId: string,
|
|
14080
14087
|
request?: CaseSummaryRequest) → `Promise<CaseSummaryResponse>`
|
|
14081
14088
|
Get case summary (admin only) POST /cases/summary
|
|
14082
14089
|
|
|
14083
|
-
**appendHistory**(collectionId: string,
|
|
14084
|
-
appId: string,
|
|
14085
|
-
caseId: string,
|
|
14090
|
+
**appendHistory**(collectionId: string,
|
|
14091
|
+
appId: string,
|
|
14092
|
+
caseId: string,
|
|
14086
14093
|
input: AppendHistoryInput) → `Promise<AppCase>`
|
|
14087
14094
|
Append an entry to case history (admin only) POST /cases/:caseId/history
|
|
14088
14095
|
|
|
14089
|
-
**related**(collectionId: string,
|
|
14090
|
-
appId: string,
|
|
14096
|
+
**related**(collectionId: string,
|
|
14097
|
+
appId: string,
|
|
14091
14098
|
caseId: string) → `Promise<RelatedResponse>`
|
|
14092
14099
|
Get related threads and records for a case (admin only) GET /cases/:caseId/related
|
|
14093
14100
|
|
|
14094
14101
|
### app.options
|
|
14095
14102
|
|
|
14096
|
-
**get**(collectionId: string,
|
|
14097
|
-
appId: string,
|
|
14098
|
-
source: string,
|
|
14103
|
+
**get**(collectionId: string,
|
|
14104
|
+
appId: string,
|
|
14105
|
+
source: string,
|
|
14099
14106
|
opts: { q?: string; version?: string; admin?: boolean } = {},) → `Promise<import('../types/appOptions').AppOptionsResponse>`
|
|
14100
14107
|
`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.
|
|
14101
14108
|
|
|
14102
|
-
**saveList**(collectionId: string,
|
|
14103
|
-
appId: string,
|
|
14104
|
-
listId: string,
|
|
14109
|
+
**saveList**(collectionId: string,
|
|
14110
|
+
appId: string,
|
|
14111
|
+
listId: string,
|
|
14105
14112
|
values: import('../types/appOptions') → `void`
|
|
14106
14113
|
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.
|
|
14107
14114
|
|
|
@@ -14109,92 +14116,92 @@ Save a value list's values, in order (admins). Codes never change and are never
|
|
|
14109
14116
|
|
|
14110
14117
|
General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
|
|
14111
14118
|
|
|
14112
|
-
**create**(collectionId: string,
|
|
14113
|
-
appId: string,
|
|
14114
|
-
input: CreateRecordInput,
|
|
14119
|
+
**create**(collectionId: string,
|
|
14120
|
+
appId: string,
|
|
14121
|
+
input: CreateRecordInput,
|
|
14115
14122
|
admin: boolean = false) → `Promise<CreateRecordResponse>`
|
|
14116
14123
|
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.
|
|
14117
14124
|
|
|
14118
|
-
**query**(collectionId: string,
|
|
14119
|
-
appId: string,
|
|
14125
|
+
**query**(collectionId: string,
|
|
14126
|
+
appId: string,
|
|
14120
14127
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
14121
14128
|
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' } }, }) ```
|
|
14122
14129
|
|
|
14123
14130
|
**queryFields**(collectionId: string, appId: string) → `Promise<QueryDescription>`
|
|
14124
14131
|
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
|
|
14125
14132
|
|
|
14126
|
-
**list**(collectionId: string,
|
|
14127
|
-
appId: string,
|
|
14128
|
-
params?: RecordListQueryParams,
|
|
14133
|
+
**list**(collectionId: string,
|
|
14134
|
+
appId: string,
|
|
14135
|
+
params?: RecordListQueryParams,
|
|
14129
14136
|
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
14130
14137
|
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`).
|
|
14131
14138
|
|
|
14132
|
-
**get**(collectionId: string,
|
|
14133
|
-
appId: string,
|
|
14134
|
-
recordId: string,
|
|
14139
|
+
**get**(collectionId: string,
|
|
14140
|
+
appId: string,
|
|
14141
|
+
recordId: string,
|
|
14135
14142
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
14136
14143
|
Get a single record by ID GET /records/:recordId
|
|
14137
14144
|
|
|
14138
|
-
**update**(collectionId: string,
|
|
14139
|
-
appId: string,
|
|
14140
|
-
recordId: string,
|
|
14141
|
-
input: UpdateRecordInput,
|
|
14145
|
+
**update**(collectionId: string,
|
|
14146
|
+
appId: string,
|
|
14147
|
+
recordId: string,
|
|
14148
|
+
input: UpdateRecordInput,
|
|
14142
14149
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
14143
14150
|
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
14144
14151
|
|
|
14145
|
-
**updateWithToken**(collectionId: string,
|
|
14146
|
-
appId: string,
|
|
14147
|
-
recordId: string,
|
|
14148
|
-
data: Record<string, unknown>,
|
|
14152
|
+
**updateWithToken**(collectionId: string,
|
|
14153
|
+
appId: string,
|
|
14154
|
+
recordId: string,
|
|
14155
|
+
data: Record<string, unknown>,
|
|
14149
14156
|
editToken: string) → `Promise<AppRecord>`
|
|
14150
14157
|
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 |
|
|
14151
14158
|
|
|
14152
|
-
**remove**(collectionId: string,
|
|
14153
|
-
appId: string,
|
|
14154
|
-
recordId: string,
|
|
14159
|
+
**remove**(collectionId: string,
|
|
14160
|
+
appId: string,
|
|
14161
|
+
recordId: string,
|
|
14155
14162
|
admin: boolean = false) → `Promise<`
|
|
14156
14163
|
Soft delete a record DELETE /records/:recordId
|
|
14157
14164
|
|
|
14158
|
-
**aggregate**(collectionId: string,
|
|
14159
|
-
appId: string,
|
|
14160
|
-
request: AggregateRequest,
|
|
14165
|
+
**aggregate**(collectionId: string,
|
|
14166
|
+
appId: string,
|
|
14167
|
+
request: AggregateRequest,
|
|
14161
14168
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
14162
14169
|
Get aggregate statistics for records POST /records/aggregate
|
|
14163
14170
|
|
|
14164
|
-
**restore**(collectionId: string,
|
|
14165
|
-
appId: string,
|
|
14171
|
+
**restore**(collectionId: string,
|
|
14172
|
+
appId: string,
|
|
14166
14173
|
recordId: string) → `Promise<AppRecord>`
|
|
14167
14174
|
Restore a soft-deleted record. POST /records/:recordId/restore (admin only)
|
|
14168
14175
|
|
|
14169
|
-
**upsert**(collectionId: string,
|
|
14170
|
-
appId: string,
|
|
14176
|
+
**upsert**(collectionId: string,
|
|
14177
|
+
appId: string,
|
|
14171
14178
|
input: UpsertRecordInput) → `Promise<UpsertRecordResponse>`
|
|
14172
14179
|
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)
|
|
14173
14180
|
|
|
14174
|
-
**match**(collectionId: string,
|
|
14175
|
-
appId: string,
|
|
14176
|
-
input: MatchRecordsInput,
|
|
14181
|
+
**match**(collectionId: string,
|
|
14182
|
+
appId: string,
|
|
14183
|
+
input: MatchRecordsInput,
|
|
14177
14184
|
admin: boolean = false) → `Promise<MatchResult>`
|
|
14178
14185
|
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 ```
|
|
14179
14186
|
|
|
14180
|
-
**bulkUpsert**(collectionId: string,
|
|
14181
|
-
appId: string,
|
|
14187
|
+
**bulkUpsert**(collectionId: string,
|
|
14188
|
+
appId: string,
|
|
14182
14189
|
records: BulkUpsertItem[]) → `Promise<BulkUpsertResult>`
|
|
14183
14190
|
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)
|
|
14184
14191
|
|
|
14185
|
-
**bulkDelete**(collectionId: string,
|
|
14186
|
-
appId: string,
|
|
14192
|
+
**bulkDelete**(collectionId: string,
|
|
14193
|
+
appId: string,
|
|
14187
14194
|
input: BulkDeleteInput) → `Promise<BulkDeleteResult>`
|
|
14188
14195
|
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' }, }); ```
|
|
14189
14196
|
|
|
14190
|
-
**resolveAll**(collectionId: string,
|
|
14191
|
-
appId: string,
|
|
14192
|
-
input: ResolveAllParams,
|
|
14197
|
+
**resolveAll**(collectionId: string,
|
|
14198
|
+
appId: string,
|
|
14199
|
+
input: ResolveAllParams,
|
|
14193
14200
|
admin: boolean = false) → `Promise<ResolveAllResult>`
|
|
14194
14201
|
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
|
|
14195
14202
|
|
|
14196
|
-
**previewRule**(collectionId: string,
|
|
14197
|
-
appId: string,
|
|
14203
|
+
**previewRule**(collectionId: string,
|
|
14204
|
+
appId: string,
|
|
14198
14205
|
input: PreviewRuleParams) → `Promise<PreviewRuleResult>`
|
|
14199
14206
|
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
|
|
14200
14207
|
|
|
@@ -14202,54 +14209,54 @@ Preview which products in the collection match a given facetRule. Admin only. Us
|
|
|
14202
14209
|
|
|
14203
14210
|
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|
|
14204
14211
|
|
|
14205
|
-
**create**(collectionId: string,
|
|
14206
|
-
appId: string,
|
|
14207
|
-
input: CreateThreadInput,
|
|
14212
|
+
**create**(collectionId: string,
|
|
14213
|
+
appId: string,
|
|
14214
|
+
input: CreateThreadInput,
|
|
14208
14215
|
admin: boolean = false) → `Promise<AppThread>`
|
|
14209
14216
|
Create a new thread POST /threads
|
|
14210
14217
|
|
|
14211
|
-
**list**(collectionId: string,
|
|
14212
|
-
appId: string,
|
|
14213
|
-
params?: ThreadListQueryParams,
|
|
14218
|
+
**list**(collectionId: string,
|
|
14219
|
+
appId: string,
|
|
14220
|
+
params?: ThreadListQueryParams,
|
|
14214
14221
|
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
14215
14222
|
List threads with optional query parameters GET /threads
|
|
14216
14223
|
|
|
14217
|
-
**get**(collectionId: string,
|
|
14218
|
-
appId: string,
|
|
14219
|
-
threadId: string,
|
|
14224
|
+
**get**(collectionId: string,
|
|
14225
|
+
appId: string,
|
|
14226
|
+
threadId: string,
|
|
14220
14227
|
admin: boolean = false) → `Promise<AppThread>`
|
|
14221
14228
|
Get a single thread by ID GET /threads/:threadId
|
|
14222
14229
|
|
|
14223
|
-
**update**(collectionId: string,
|
|
14224
|
-
appId: string,
|
|
14225
|
-
threadId: string,
|
|
14226
|
-
input: UpdateThreadInput,
|
|
14230
|
+
**update**(collectionId: string,
|
|
14231
|
+
appId: string,
|
|
14232
|
+
threadId: string,
|
|
14233
|
+
input: UpdateThreadInput,
|
|
14227
14234
|
admin: boolean = false) → `Promise<AppThread>`
|
|
14228
14235
|
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
14229
14236
|
|
|
14230
|
-
**remove**(collectionId: string,
|
|
14231
|
-
appId: string,
|
|
14232
|
-
threadId: string,
|
|
14237
|
+
**remove**(collectionId: string,
|
|
14238
|
+
appId: string,
|
|
14239
|
+
threadId: string,
|
|
14233
14240
|
admin: boolean = false) → `Promise<`
|
|
14234
14241
|
Soft delete a thread DELETE /threads/:threadId
|
|
14235
14242
|
|
|
14236
|
-
**reply**(collectionId: string,
|
|
14237
|
-
appId: string,
|
|
14238
|
-
threadId: string,
|
|
14239
|
-
input: ReplyInput,
|
|
14243
|
+
**reply**(collectionId: string,
|
|
14244
|
+
appId: string,
|
|
14245
|
+
threadId: string,
|
|
14246
|
+
input: ReplyInput,
|
|
14240
14247
|
admin: boolean = false) → `Promise<AppThread>`
|
|
14241
14248
|
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
14242
14249
|
|
|
14243
|
-
**deleteReply**(collectionId: string,
|
|
14244
|
-
appId: string,
|
|
14245
|
-
threadId: string,
|
|
14246
|
-
replyId: string,
|
|
14250
|
+
**deleteReply**(collectionId: string,
|
|
14251
|
+
appId: string,
|
|
14252
|
+
threadId: string,
|
|
14253
|
+
replyId: string,
|
|
14247
14254
|
admin: boolean = false) → `Promise<AppThread>`
|
|
14248
14255
|
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.
|
|
14249
14256
|
|
|
14250
|
-
**aggregate**(collectionId: string,
|
|
14251
|
-
appId: string,
|
|
14252
|
-
request: AggregateRequest,
|
|
14257
|
+
**aggregate**(collectionId: string,
|
|
14258
|
+
appId: string,
|
|
14259
|
+
request: AggregateRequest,
|
|
14253
14260
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
14254
14261
|
Get aggregate statistics for threads POST /threads/aggregate
|
|
14255
14262
|
|
|
@@ -14284,19 +14291,19 @@ Set/create a keyed data item within a scope. Requires admin authentication. Use
|
|
|
14284
14291
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
14285
14292
|
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' }); ```
|
|
14286
14293
|
|
|
14287
|
-
**getWidgets**(collectionId: string,
|
|
14294
|
+
**getWidgets**(collectionId: string,
|
|
14288
14295
|
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
14289
14296
|
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 }); ```
|
|
14290
14297
|
|
|
14291
14298
|
**resolveFeature**(system: SystemBlock | undefined, flag: string) → `boolean`
|
|
14292
14299
|
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'); ```
|
|
14293
14300
|
|
|
14294
|
-
**getAppConfig**(collectionId: string,
|
|
14301
|
+
**getAppConfig**(collectionId: string,
|
|
14295
14302
|
options?: { force?: boolean }) → `Promise<AppsConfigResponse>`
|
|
14296
14303
|
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); ```
|
|
14297
14304
|
|
|
14298
|
-
**isFeatureEnabled**(collectionId: string,
|
|
14299
|
-
flag: string,
|
|
14305
|
+
**isFeatureEnabled**(collectionId: string,
|
|
14306
|
+
flag: string,
|
|
14300
14307
|
options?: { force?: boolean }) → `Promise<boolean>`
|
|
14301
14308
|
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(); } ```
|
|
14302
14309
|
|
|
@@ -14931,13 +14938,13 @@ Delete a slot (admin; refused while places are booked).
|
|
|
14931
14938
|
|
|
14932
14939
|
### chat.completions
|
|
14933
14940
|
|
|
14934
|
-
**create**(collectionId: string,
|
|
14941
|
+
**create**(collectionId: string,
|
|
14935
14942
|
request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
|
|
14936
14943
|
Create a chat completion (streaming or non-streaming)
|
|
14937
14944
|
|
|
14938
14945
|
### chat.responses
|
|
14939
14946
|
|
|
14940
|
-
**create**(collectionId: string,
|
|
14947
|
+
**create**(collectionId: string,
|
|
14941
14948
|
request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
|
|
14942
14949
|
Create a Responses API request (streaming or non-streaming)
|
|
14943
14950
|
|
|
@@ -15113,86 +15120,86 @@ Invite a user to a collection by email (admin only). Creates or links their acco
|
|
|
15113
15120
|
**getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
|
|
15114
15121
|
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.
|
|
15115
15122
|
|
|
15116
|
-
**registerPush**(collectionId: string,
|
|
15123
|
+
**registerPush**(collectionId: string,
|
|
15117
15124
|
body: import("../types/comms") → `void`
|
|
15118
15125
|
Public: Register a Web Push subscription under unified comms. POST /public/collection/:collectionId/comm/push/register
|
|
15119
15126
|
|
|
15120
|
-
**getSettings**(collectionId: string,
|
|
15127
|
+
**getSettings**(collectionId: string,
|
|
15121
15128
|
opts: { includeSecret?: boolean } = {}) → `Promise<import("../types/comms").CommsSettingsGetResponse>`
|
|
15122
15129
|
Admin: Get current comms settings for a collection. GET /admin/collection/:collectionId/comm.settings Optional query: includeSecret=true to include unsub.secret in response.
|
|
15123
15130
|
|
|
15124
|
-
**patchSettings**(collectionId: string,
|
|
15131
|
+
**patchSettings**(collectionId: string,
|
|
15125
15132
|
body: import("../types/comms") → `void`
|
|
15126
15133
|
Admin: Patch comms settings for a collection. PATCH /admin/collection/:collectionId/comm.settings
|
|
15127
15134
|
|
|
15128
15135
|
**getPublicTopics**(collectionId: string) → `Promise<import("../types/comms").CommsPublicTopicsResponse>`
|
|
15129
15136
|
Public: Fetch configured topics for a collection. GET /public/collection/:collectionId/comm/topics
|
|
15130
15137
|
|
|
15131
|
-
**unsubscribe**(collectionId: string,
|
|
15138
|
+
**unsubscribe**(collectionId: string,
|
|
15132
15139
|
query: import("../types/comms") → `void`
|
|
15133
15140
|
Public: Unsubscribe a contact from a category or channel. GET /public/collection/:collectionId/comm/unsubscribe
|
|
15134
15141
|
|
|
15135
|
-
**signup**(collectionId: string,
|
|
15142
|
+
**signup**(collectionId: string,
|
|
15136
15143
|
body: import("../types/comms") → `void`
|
|
15137
15144
|
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
|
|
15138
15145
|
|
|
15139
|
-
**upsertConsent**(collectionId: string,
|
|
15146
|
+
**upsertConsent**(collectionId: string,
|
|
15140
15147
|
body: import("../types/comms") → `void`
|
|
15141
15148
|
Public: Upsert default consent for a contact. POST /public/collection/:collectionId/comm/consent
|
|
15142
15149
|
|
|
15143
|
-
**upsertPreferences**(collectionId: string,
|
|
15150
|
+
**upsertPreferences**(collectionId: string,
|
|
15144
15151
|
body: import("../types/comms") → `void`
|
|
15145
15152
|
Public: Upsert preferences for a specific subject (or default if subject omitted). POST /public/collection/:collectionId/comm/preferences
|
|
15146
15153
|
|
|
15147
|
-
**subscribe**(collectionId: string,
|
|
15154
|
+
**subscribe**(collectionId: string,
|
|
15148
15155
|
body: import("../types/comms") → `void`
|
|
15149
15156
|
Public: Subscribe/unsubscribe contact to a subject. POST /public/collection/:collectionId/comm/subscribe
|
|
15150
15157
|
|
|
15151
|
-
**checkSubscription**(collectionId: string,
|
|
15158
|
+
**checkSubscription**(collectionId: string,
|
|
15152
15159
|
query: import("../types/comms") → `void`
|
|
15153
15160
|
Public: Check subscription status for a subject. GET /public/collection/:collectionId/comm/subscription/check
|
|
15154
15161
|
|
|
15155
|
-
**listMethods**(collectionId: string,
|
|
15162
|
+
**listMethods**(collectionId: string,
|
|
15156
15163
|
query: import("../types/comms") → `void`
|
|
15157
15164
|
Public: List registered contact methods. GET /public/collection/:collectionId/comm/methods
|
|
15158
15165
|
|
|
15159
|
-
**registerEmail**(collectionId: string,
|
|
15166
|
+
**registerEmail**(collectionId: string,
|
|
15160
15167
|
body: import("../types/comms") → `void`
|
|
15161
15168
|
Public: Register email method for a contact. POST /public/collection/:collectionId/comm/email/register
|
|
15162
15169
|
|
|
15163
|
-
**registerSms**(collectionId: string,
|
|
15170
|
+
**registerSms**(collectionId: string,
|
|
15164
15171
|
body: import("../types/comms") → `void`
|
|
15165
15172
|
Public: Register SMS method for a contact. POST /public/collection/:collectionId/comm/sms/register
|
|
15166
15173
|
|
|
15167
|
-
**resolveSubscriptions**(collectionId: string,
|
|
15174
|
+
**resolveSubscriptions**(collectionId: string,
|
|
15168
15175
|
body: import("../types/comms") → `void`
|
|
15169
15176
|
Public: Resolve contacts for a subject with identity hints. POST /public/collection/:collectionId/comm/subscriptions/resolve
|
|
15170
15177
|
|
|
15171
|
-
**queryByUser**(collectionId: string,
|
|
15178
|
+
**queryByUser**(collectionId: string,
|
|
15172
15179
|
body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
|
|
15173
15180
|
Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
|
|
15174
15181
|
|
|
15175
|
-
**queryRecipientIds**(collectionId: string,
|
|
15182
|
+
**queryRecipientIds**(collectionId: string,
|
|
15176
15183
|
body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
|
|
15177
15184
|
Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
15178
15185
|
|
|
15179
|
-
**queryRecipientsWithoutAction**(collectionId: string,
|
|
15186
|
+
**queryRecipientsWithoutAction**(collectionId: string,
|
|
15180
15187
|
body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
|
|
15181
15188
|
Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
15182
15189
|
|
|
15183
|
-
**queryRecipientsWithAction**(collectionId: string,
|
|
15190
|
+
**queryRecipientsWithAction**(collectionId: string,
|
|
15184
15191
|
body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
|
|
15185
15192
|
Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
15186
15193
|
|
|
15187
|
-
**sendTransactional**(collectionId: string,
|
|
15194
|
+
**sendTransactional**(collectionId: string,
|
|
15188
15195
|
body: TransactionalSendRequest) → `Promise<TransactionalSendResult>`
|
|
15189
15196
|
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) } ```
|
|
15190
15197
|
|
|
15191
|
-
**logCommunicationEvent**(collectionId: string,
|
|
15198
|
+
**logCommunicationEvent**(collectionId: string,
|
|
15192
15199
|
body: LogCommunicationEventBody) → `Promise<AppendResult>`
|
|
15193
15200
|
Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
|
|
15194
15201
|
|
|
15195
|
-
**logBulkCommunicationEvents**(collectionId: string,
|
|
15202
|
+
**logBulkCommunicationEvents**(collectionId: string,
|
|
15196
15203
|
body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
15197
15204
|
Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
|
|
15198
15205
|
|
|
@@ -15223,7 +15230,7 @@ Returns all proof type definitions. Proof types are templates that specify which
|
|
|
15223
15230
|
|
|
15224
15231
|
### contact
|
|
15225
15232
|
|
|
15226
|
-
**query**(collectionId: string,
|
|
15233
|
+
**query**(collectionId: string,
|
|
15227
15234
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
15228
15235
|
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 } } }) ```
|
|
15229
15236
|
|
|
@@ -15233,62 +15240,62 @@ What a contacts query can use: its fields and what each can filter, sort, group
|
|
|
15233
15240
|
**create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
15234
15241
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15235
15242
|
|
|
15236
|
-
**list**(collectionId: string,
|
|
15243
|
+
**list**(collectionId: string,
|
|
15237
15244
|
params?: { limit?: number; offset?: number; includeDeleted?: boolean }) → `Promise<ContactListResponse>`
|
|
15238
15245
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15239
15246
|
|
|
15240
|
-
**search**({
|
|
15241
|
-
collectionId,
|
|
15242
|
-
q,
|
|
15243
|
-
typeahead,
|
|
15244
|
-
email,
|
|
15245
|
-
phone,
|
|
15246
|
-
id,
|
|
15247
|
-
userId,
|
|
15248
|
-
tags,
|
|
15249
|
-
tagsAll,
|
|
15250
|
-
source,
|
|
15251
|
-
locale,
|
|
15252
|
-
createdFrom,
|
|
15253
|
-
createdTo,
|
|
15254
|
-
externalIdKey,
|
|
15255
|
-
externalIdValue,
|
|
15256
|
-
customFieldKey,
|
|
15257
|
-
customFieldValue,
|
|
15258
|
-
limit,
|
|
15259
|
-
offset,
|
|
15247
|
+
**search**({
|
|
15248
|
+
collectionId,
|
|
15249
|
+
q,
|
|
15250
|
+
typeahead,
|
|
15251
|
+
email,
|
|
15252
|
+
phone,
|
|
15253
|
+
id,
|
|
15254
|
+
userId,
|
|
15255
|
+
tags,
|
|
15256
|
+
tagsAll,
|
|
15257
|
+
source,
|
|
15258
|
+
locale,
|
|
15259
|
+
createdFrom,
|
|
15260
|
+
createdTo,
|
|
15261
|
+
externalIdKey,
|
|
15262
|
+
externalIdValue,
|
|
15263
|
+
customFieldKey,
|
|
15264
|
+
customFieldValue,
|
|
15265
|
+
limit,
|
|
15266
|
+
offset,
|
|
15260
15267
|
}: ContactSearchParams) → `Promise<ContactSearchResponse>`
|
|
15261
15268
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15262
15269
|
|
|
15263
|
-
**get**(collectionId: string,
|
|
15264
|
-
contactId: string,
|
|
15270
|
+
**get**(collectionId: string,
|
|
15271
|
+
contactId: string,
|
|
15265
15272
|
params?: { includeDeleted?: boolean }) → `Promise<ContactResponse>`
|
|
15266
15273
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15267
15274
|
|
|
15268
|
-
**update**(collectionId: string,
|
|
15269
|
-
contactId: string,
|
|
15275
|
+
**update**(collectionId: string,
|
|
15276
|
+
contactId: string,
|
|
15270
15277
|
data: ContactUpdateRequest) → `Promise<ContactResponse>`
|
|
15271
15278
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15272
15279
|
|
|
15273
15280
|
**remove**(collectionId: string, contactId: string) → `Promise<void>`
|
|
15274
15281
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15275
15282
|
|
|
15276
|
-
**lookup**(collectionId: string,
|
|
15283
|
+
**lookup**(collectionId: string,
|
|
15277
15284
|
params: { email?: string; phone?: string }) → `Promise<ContactResponse>`
|
|
15278
15285
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15279
15286
|
|
|
15280
|
-
**upsert**(collectionId: string,
|
|
15287
|
+
**upsert**(collectionId: string,
|
|
15281
15288
|
data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
15282
15289
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15283
15290
|
|
|
15284
|
-
**publicUpsert**(collectionId: string,
|
|
15291
|
+
**publicUpsert**(collectionId: string,
|
|
15285
15292
|
data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
|
|
15286
15293
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15287
15294
|
|
|
15288
15295
|
**publicGetMine**(collectionId: string) → `Promise<PublicGetMyContactResponse>`
|
|
15289
15296
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15290
15297
|
|
|
15291
|
-
**publicUpdateMine**(collectionId: string,
|
|
15298
|
+
**publicUpdateMine**(collectionId: string,
|
|
15292
15299
|
data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
|
|
15293
15300
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15294
15301
|
|
|
@@ -15298,77 +15305,77 @@ Public: Get the contact schema for a collection. GET /public/collection/:collect
|
|
|
15298
15305
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
15299
15306
|
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 }) } ```
|
|
15300
15307
|
|
|
15301
|
-
**findDuplicates**(collectionId: string,
|
|
15308
|
+
**findDuplicates**(collectionId: string,
|
|
15302
15309
|
params?: { limit?: number; offset?: number }) → `Promise<ContactDuplicatesResponse>`
|
|
15303
15310
|
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) } ```
|
|
15304
15311
|
|
|
15305
|
-
**merge**(collectionId: string,
|
|
15306
|
-
keepContactId: string,
|
|
15312
|
+
**merge**(collectionId: string,
|
|
15313
|
+
keepContactId: string,
|
|
15307
15314
|
fromContactId: string) → `Promise<ContactMergeResponse>`
|
|
15308
15315
|
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`).
|
|
15309
15316
|
|
|
15310
|
-
**linkLogin**(collectionId: string,
|
|
15317
|
+
**linkLogin**(collectionId: string,
|
|
15311
15318
|
userId: string) → `Promise<ContactLinkLoginResponse>`
|
|
15312
15319
|
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 } ```
|
|
15313
15320
|
|
|
15314
|
-
**getUser**(collectionId: string,
|
|
15321
|
+
**getUser**(collectionId: string,
|
|
15315
15322
|
userId: string,) → `Promise<UserSearchResponse>`
|
|
15316
15323
|
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 } ```
|
|
15317
15324
|
|
|
15318
15325
|
### containers
|
|
15319
15326
|
|
|
15320
|
-
**create**(collectionId: string,
|
|
15327
|
+
**create**(collectionId: string,
|
|
15321
15328
|
data: CreateContainerInput) → `Promise<Container>`
|
|
15322
15329
|
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 }, }) ```
|
|
15323
15330
|
|
|
15324
|
-
**list**(collectionId: string,
|
|
15331
|
+
**list**(collectionId: string,
|
|
15325
15332
|
params?: ListContainersParams) → `Promise<ListContainersResponse>`
|
|
15326
15333
|
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 }) ```
|
|
15327
15334
|
|
|
15328
|
-
**findForItem**(collectionId: string,
|
|
15335
|
+
**findForItem**(collectionId: string,
|
|
15329
15336
|
params: FindContainersForItemParams) → `Promise<FindContainersForItemResponse>`
|
|
15330
15337
|
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', }) ```
|
|
15331
15338
|
|
|
15332
|
-
**get**(collectionId: string,
|
|
15333
|
-
containerId: string,
|
|
15339
|
+
**get**(collectionId: string,
|
|
15340
|
+
containerId: string,
|
|
15334
15341
|
params?: GetContainerParams) → `Promise<Container>`
|
|
15335
15342
|
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, }) ```
|
|
15336
15343
|
|
|
15337
|
-
**update**(collectionId: string,
|
|
15338
|
-
containerId: string,
|
|
15344
|
+
**update**(collectionId: string,
|
|
15345
|
+
containerId: string,
|
|
15339
15346
|
data: UpdateContainerInput) → `Promise<Container>`
|
|
15340
15347
|
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' }, }) ```
|
|
15341
15348
|
|
|
15342
|
-
**remove**(collectionId: string,
|
|
15349
|
+
**remove**(collectionId: string,
|
|
15343
15350
|
containerId: string) → `Promise<`
|
|
15344
15351
|
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.
|
|
15345
15352
|
|
|
15346
|
-
**listItems**(collectionId: string,
|
|
15347
|
-
containerId: string,
|
|
15353
|
+
**listItems**(collectionId: string,
|
|
15354
|
+
containerId: string,
|
|
15348
15355
|
params?: ListContainerItemsParams) → `Promise<ContainerItemsResponse>`
|
|
15349
15356
|
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 }) ```
|
|
15350
15357
|
|
|
15351
|
-
**addItems**(collectionId: string,
|
|
15352
|
-
containerId: string,
|
|
15358
|
+
**addItems**(collectionId: string,
|
|
15359
|
+
containerId: string,
|
|
15353
15360
|
data: AddContainerItemsInput) → `Promise<AddContainerItemsResponse>`
|
|
15354
15361
|
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' }, ], }) ```
|
|
15355
15362
|
|
|
15356
|
-
**removeItems**(collectionId: string,
|
|
15357
|
-
containerId: string,
|
|
15363
|
+
**removeItems**(collectionId: string,
|
|
15364
|
+
containerId: string,
|
|
15358
15365
|
data: RemoveContainerItemsInput) → `Promise<RemoveContainerItemsResponse>`
|
|
15359
15366
|
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`) ```
|
|
15360
15367
|
|
|
15361
|
-
**publicList**(collectionId: string,
|
|
15368
|
+
**publicList**(collectionId: string,
|
|
15362
15369
|
params?: ListContainersParams) → `Promise<PublicListContainersResponse>`
|
|
15363
15370
|
List containers (public). Soft-deleted containers and containers with `metadata.publicListing === false` are excluded from results.
|
|
15364
15371
|
|
|
15365
|
-
**publicGet**(collectionId: string,
|
|
15366
|
-
containerId: string,
|
|
15372
|
+
**publicGet**(collectionId: string,
|
|
15373
|
+
containerId: string,
|
|
15367
15374
|
params?: GetContainerParams) → `Promise<Container>`
|
|
15368
15375
|
Get a single container (public). Soft-deleted containers return a 404. Same `?tree` and `?includeContents` options as the admin version.
|
|
15369
15376
|
|
|
15370
|
-
**publicListItems**(collectionId: string,
|
|
15371
|
-
containerId: string,
|
|
15377
|
+
**publicListItems**(collectionId: string,
|
|
15378
|
+
containerId: string,
|
|
15372
15379
|
params?: Pick<ListContainerItemsParams, 'limit' | 'offset'>) → `Promise<ContainerItemsResponse>`
|
|
15373
15380
|
List current contents of a container (public). Returns only items where `removedAt` is null. No `?history` option on the public side.
|
|
15374
15381
|
|
|
@@ -15457,6 +15464,9 @@ Make (or replace) the key the brand's Service Account trusts. The private key st
|
|
|
15457
15464
|
**set**(collectionId: string, env: DppEnvironment, input: SetDppRegistryInput) → `Promise<DppRegistry>`
|
|
15458
15465
|
Save the Service Account's Client ID and key ID, and the brand's Organisation ID, from the registry. PUT /dpp/registry/:env
|
|
15459
15466
|
|
|
15467
|
+
**enrolPractice**(collectionId: string) → `Promise<DppRegistryCheckResult>`
|
|
15468
|
+
Connect the brand to the SmartLinks PRACTICE registry in one step — key, enrolment, Service Account and check — to try publishing and registering before the brand is verified with the EU. Never the EU: label it as practice wherever it's shown. POST /dpp/registry/practice/enrol
|
|
15469
|
+
|
|
15460
15470
|
**check**(collectionId: string, env: DppEnvironment) → `Promise<DppRegistryCheckResult>`
|
|
15461
15471
|
Sign in to the registry and read its product groups — proves the connection works. POST /dpp/registry/:env/check
|
|
15462
15472
|
|
|
@@ -15656,8 +15666,8 @@ Update whitelisted fields. PUT /integrations/flows/:id
|
|
|
15656
15666
|
**deleteFlow**(collectionId: string, id: string) → `Promise<`
|
|
15657
15667
|
Soft-delete a flow. DELETE /integrations/flows/:id
|
|
15658
15668
|
|
|
15659
|
-
**runFlow**(collectionId: string,
|
|
15660
|
-
id: string,
|
|
15669
|
+
**runFlow**(collectionId: string,
|
|
15670
|
+
id: string,
|
|
15661
15671
|
options: RunFlowInput & { async?: boolean } = {}) → `Promise<RunFlowResult>`
|
|
15662
15672
|
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.
|
|
15663
15673
|
|
|
@@ -15685,8 +15695,8 @@ Is enhanced logging active for a connection? GET /integrations/logging/:connecti
|
|
|
15685
15695
|
**setLogging**(collectionId: string, connectionId: string, input: SetLoggingInput = {}) → `Promise<`
|
|
15686
15696
|
Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled)
|
|
15687
15697
|
|
|
15688
|
-
**listFailed**(collectionId: string,
|
|
15689
|
-
flowId: string,
|
|
15698
|
+
**listFailed**(collectionId: string,
|
|
15699
|
+
flowId: string,
|
|
15690
15700
|
query: { status?: 'failed' | 'dead'; limit?: number; cursor?: string } = {}) → `Promise<FailedRecordList>`
|
|
15691
15701
|
A flow's failed / dead records. GET /integrations/flows/:id/failed
|
|
15692
15702
|
|
|
@@ -15711,30 +15721,30 @@ Cancel enhanced logging now. DELETE /integrations/logging/:connectionId
|
|
|
15711
15721
|
**listConnectors**(collectionId: string) → `Promise<`
|
|
15712
15722
|
The collection's installed connector apps. GET /integrations/connectors
|
|
15713
15723
|
|
|
15714
|
-
**saveConnectorInstallation**(collectionId: string,
|
|
15715
|
-
appId: string,
|
|
15724
|
+
**saveConnectorInstallation**(collectionId: string,
|
|
15725
|
+
appId: string,
|
|
15716
15726
|
input: SaveConnectorInstallationInput) → `Promise<`
|
|
15717
15727
|
Save a connector's non-secret Connect-form values and/or settings. PUT /integrations/connectors/:appId/installation
|
|
15718
15728
|
|
|
15719
|
-
**runConnectorStep**(collectionId: string,
|
|
15720
|
-
appId: string,
|
|
15721
|
-
step: ConnectorConsoleStep,
|
|
15729
|
+
**runConnectorStep**(collectionId: string,
|
|
15730
|
+
appId: string,
|
|
15731
|
+
step: ConnectorConsoleStep,
|
|
15722
15732
|
input: Record<string, unknown> & { flowId?: string } = {}) → `Promise<T>`
|
|
15723
15733
|
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
|
|
15724
15734
|
|
|
15725
|
-
**runConnectorAction**(collectionId: string,
|
|
15726
|
-
appId: string,
|
|
15727
|
-
action: string,
|
|
15735
|
+
**runConnectorAction**(collectionId: string,
|
|
15736
|
+
appId: string,
|
|
15737
|
+
action: string,
|
|
15728
15738
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15729
15739
|
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 }
|
|
15730
15740
|
|
|
15731
|
-
**listConnectorActions**(collectionId: string,
|
|
15741
|
+
**listConnectorActions**(collectionId: string,
|
|
15732
15742
|
appId: string) → `Promise<`
|
|
15733
15743
|
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
|
|
15734
15744
|
|
|
15735
|
-
**callConnectorAction**(collectionId: string,
|
|
15736
|
-
appId: string,
|
|
15737
|
-
action: string,
|
|
15745
|
+
**callConnectorAction**(collectionId: string,
|
|
15746
|
+
appId: string,
|
|
15747
|
+
action: string,
|
|
15738
15748
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15739
15749
|
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 }
|
|
15740
15750
|
|
|
@@ -15968,82 +15978,82 @@ Paginated member product summaries.
|
|
|
15968
15978
|
|
|
15969
15979
|
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.
|
|
15970
15980
|
|
|
15971
|
-
**list**(collectionId: string,
|
|
15981
|
+
**list**(collectionId: string,
|
|
15972
15982
|
params: { includeDeleted?: boolean } = {}) → `Promise<LoyaltyScheme[]>`
|
|
15973
15983
|
|
|
15974
|
-
**get**(collectionId: string,
|
|
15984
|
+
**get**(collectionId: string,
|
|
15975
15985
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15976
15986
|
|
|
15977
|
-
**create**(collectionId: string,
|
|
15987
|
+
**create**(collectionId: string,
|
|
15978
15988
|
body: CreateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15979
15989
|
|
|
15980
|
-
**update**(collectionId: string,
|
|
15981
|
-
schemeId: string,
|
|
15990
|
+
**update**(collectionId: string,
|
|
15991
|
+
schemeId: string,
|
|
15982
15992
|
body: UpdateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15983
15993
|
|
|
15984
|
-
**remove**(collectionId: string,
|
|
15994
|
+
**remove**(collectionId: string,
|
|
15985
15995
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15986
15996
|
|
|
15987
|
-
**listEarningRules**(collectionId: string,
|
|
15997
|
+
**listEarningRules**(collectionId: string,
|
|
15988
15998
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
15989
15999
|
|
|
15990
|
-
**getEarningRule**(collectionId: string,
|
|
15991
|
-
schemeId: string,
|
|
16000
|
+
**getEarningRule**(collectionId: string,
|
|
16001
|
+
schemeId: string,
|
|
15992
16002
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
15993
16003
|
|
|
15994
|
-
**createEarningRule**(collectionId: string,
|
|
15995
|
-
schemeId: string,
|
|
16004
|
+
**createEarningRule**(collectionId: string,
|
|
16005
|
+
schemeId: string,
|
|
15996
16006
|
body: CreateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
15997
16007
|
|
|
15998
|
-
**updateEarningRule**(collectionId: string,
|
|
15999
|
-
schemeId: string,
|
|
16000
|
-
ruleId: string,
|
|
16008
|
+
**updateEarningRule**(collectionId: string,
|
|
16009
|
+
schemeId: string,
|
|
16010
|
+
ruleId: string,
|
|
16001
16011
|
body: UpdateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
16002
16012
|
|
|
16003
|
-
**removeEarningRule**(collectionId: string,
|
|
16004
|
-
schemeId: string,
|
|
16013
|
+
**removeEarningRule**(collectionId: string,
|
|
16014
|
+
schemeId: string,
|
|
16005
16015
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
16006
16016
|
|
|
16007
|
-
**listMembers**(collectionId: string,
|
|
16008
|
-
schemeId: string,
|
|
16017
|
+
**listMembers**(collectionId: string,
|
|
16018
|
+
schemeId: string,
|
|
16009
16019
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyMember>>`
|
|
16010
16020
|
|
|
16011
|
-
**getMember**(collectionId: string,
|
|
16012
|
-
schemeId: string,
|
|
16021
|
+
**getMember**(collectionId: string,
|
|
16022
|
+
schemeId: string,
|
|
16013
16023
|
contactId: string) → `Promise<LoyaltyMember>`
|
|
16014
16024
|
|
|
16015
|
-
**recordTransaction**(collectionId: string,
|
|
16016
|
-
schemeId: string,
|
|
16017
|
-
contactId: string,
|
|
16025
|
+
**recordTransaction**(collectionId: string,
|
|
16026
|
+
schemeId: string,
|
|
16027
|
+
contactId: string,
|
|
16018
16028
|
body: RecordLoyaltyTransactionBody) → `Promise<LoyaltyTransactionResult>`
|
|
16019
16029
|
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.
|
|
16020
16030
|
|
|
16021
|
-
**getMemberHistory**(collectionId: string,
|
|
16022
|
-
schemeId: string,
|
|
16023
|
-
contactId: string,
|
|
16031
|
+
**getMemberHistory**(collectionId: string,
|
|
16032
|
+
schemeId: string,
|
|
16033
|
+
contactId: string,
|
|
16024
16034
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
16025
16035
|
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.
|
|
16026
16036
|
|
|
16027
16037
|
**publicList**(collectionId: string) → `Promise<LoyaltyScheme[]>`
|
|
16028
16038
|
List active schemes for a collection. No authentication required.
|
|
16029
16039
|
|
|
16030
|
-
**publicGet**(collectionId: string,
|
|
16040
|
+
**publicGet**(collectionId: string,
|
|
16031
16041
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
16032
16042
|
Get a single active scheme. No authentication required.
|
|
16033
16043
|
|
|
16034
|
-
**publicListEarningRules**(collectionId: string,
|
|
16044
|
+
**publicListEarningRules**(collectionId: string,
|
|
16035
16045
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
16036
16046
|
List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.
|
|
16037
16047
|
|
|
16038
16048
|
**publicGetMe**(collectionId: string) → `Promise<LoyaltySchemeWithMembership[]>`
|
|
16039
16049
|
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
|
|
16040
16050
|
|
|
16041
|
-
**publicGetMine**(collectionId: string,
|
|
16051
|
+
**publicGetMine**(collectionId: string,
|
|
16042
16052
|
schemeId: string) → `Promise<LoyaltyMember>`
|
|
16043
16053
|
Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.
|
|
16044
16054
|
|
|
16045
|
-
**publicGetMineHistory**(collectionId: string,
|
|
16046
|
-
schemeId: string,
|
|
16055
|
+
**publicGetMineHistory**(collectionId: string,
|
|
16056
|
+
schemeId: string,
|
|
16047
16057
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
16048
16058
|
Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.
|
|
16049
16059
|
|
|
@@ -16081,98 +16091,98 @@ What the server offers, by group: `{ workOrders: [...], stock: [...], boms: [...
|
|
|
16081
16091
|
|
|
16082
16092
|
### order
|
|
16083
16093
|
|
|
16084
|
-
**create**(collectionId: string,
|
|
16094
|
+
**create**(collectionId: string,
|
|
16085
16095
|
data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
|
|
16086
16096
|
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' } }) ```
|
|
16087
16097
|
|
|
16088
|
-
**get**(collectionId: string,
|
|
16089
|
-
orderId: string,
|
|
16098
|
+
**get**(collectionId: string,
|
|
16099
|
+
orderId: string,
|
|
16090
16100
|
params?: GetOrderParams) → `Promise<GetOrderResponse>`
|
|
16091
16101
|
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 ```
|
|
16092
16102
|
|
|
16093
|
-
**update**(collectionId: string,
|
|
16094
|
-
orderId: string,
|
|
16103
|
+
**update**(collectionId: string,
|
|
16104
|
+
orderId: string,
|
|
16095
16105
|
data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
|
|
16096
16106
|
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' } }) ```
|
|
16097
16107
|
|
|
16098
|
-
**remove**(collectionId: string,
|
|
16108
|
+
**remove**(collectionId: string,
|
|
16099
16109
|
orderId: string) → `Promise<DeleteOrderResponse>`
|
|
16100
16110
|
Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
|
|
16101
16111
|
|
|
16102
|
-
**list**(collectionId: string,
|
|
16112
|
+
**list**(collectionId: string,
|
|
16103
16113
|
params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
|
|
16104
16114
|
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 }) ```
|
|
16105
16115
|
|
|
16106
|
-
**getItems**(collectionId: string,
|
|
16107
|
-
orderId: string,
|
|
16116
|
+
**getItems**(collectionId: string,
|
|
16117
|
+
orderId: string,
|
|
16108
16118
|
params?: GetOrderItemsParams) → `Promise<GetOrderItemsResponse>`
|
|
16109
16119
|
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 }) ```
|
|
16110
16120
|
|
|
16111
|
-
**addItems**(collectionId: string,
|
|
16112
|
-
orderId: string,
|
|
16121
|
+
**addItems**(collectionId: string,
|
|
16122
|
+
orderId: string,
|
|
16113
16123
|
data: AddItemsRequest) → `Promise<AddItemsResponse>`
|
|
16114
16124
|
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`) ```
|
|
16115
16125
|
|
|
16116
16126
|
**lineDone**(collectionId: string, orderId: string, itemId: string, by: number) → `Promise<OrderItem>`
|
|
16117
16127
|
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) ```
|
|
16118
16128
|
|
|
16119
|
-
**removeItems**(collectionId: string,
|
|
16120
|
-
orderId: string,
|
|
16129
|
+
**removeItems**(collectionId: string,
|
|
16130
|
+
orderId: string,
|
|
16121
16131
|
data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
|
|
16122
16132
|
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) ```
|
|
16123
16133
|
|
|
16124
|
-
**lookup**(collectionId: string,
|
|
16134
|
+
**lookup**(collectionId: string,
|
|
16125
16135
|
data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
|
|
16126
16136
|
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' } ] }) ```
|
|
16127
16137
|
|
|
16128
|
-
**query**(collectionId: string,
|
|
16138
|
+
**query**(collectionId: string,
|
|
16129
16139
|
data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
|
|
16130
16140
|
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 }) ```
|
|
16131
16141
|
|
|
16132
|
-
**reports**(collectionId: string,
|
|
16142
|
+
**reports**(collectionId: string,
|
|
16133
16143
|
params?: ReportsParams) → `Promise<ReportsResponse>`
|
|
16134
16144
|
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 }) ```
|
|
16135
16145
|
|
|
16136
|
-
**findByProduct**(collectionId: string,
|
|
16137
|
-
productId: string,
|
|
16146
|
+
**findByProduct**(collectionId: string,
|
|
16147
|
+
productId: string,
|
|
16138
16148
|
params?: LookupByProductParams) → `Promise<LookupByProductResponse>`
|
|
16139
16149
|
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`) }) ```
|
|
16140
16150
|
|
|
16141
|
-
**getAnalytics**(collectionId: string,
|
|
16151
|
+
**getAnalytics**(collectionId: string,
|
|
16142
16152
|
orderId: string) → `Promise<OrderAnalyticsResponse>`
|
|
16143
16153
|
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`) }) } ```
|
|
16144
16154
|
|
|
16145
|
-
**getTimeline**(collectionId: string,
|
|
16146
|
-
orderId: string,
|
|
16155
|
+
**getTimeline**(collectionId: string,
|
|
16156
|
+
orderId: string,
|
|
16147
16157
|
params?: TimelineRequest) → `Promise<TimelineResponse>`
|
|
16148
16158
|
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 }) ```
|
|
16149
16159
|
|
|
16150
|
-
**getLocationHistory**(collectionId: string,
|
|
16151
|
-
orderId: string,
|
|
16160
|
+
**getLocationHistory**(collectionId: string,
|
|
16161
|
+
orderId: string,
|
|
16152
16162
|
params?: LocationRequest) → `Promise<LocationResponse>`
|
|
16153
16163
|
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}`) }) ```
|
|
16154
16164
|
|
|
16155
|
-
**getBulkAnalytics**(collectionId: string,
|
|
16165
|
+
**getBulkAnalytics**(collectionId: string,
|
|
16156
16166
|
data: BulkAnalyticsRequest) → `Promise<BulkAnalyticsResponse>`
|
|
16157
16167
|
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`) } }) ```
|
|
16158
16168
|
|
|
16159
|
-
**getCollectionSummary**(collectionId: string,
|
|
16169
|
+
**getCollectionSummary**(collectionId: string,
|
|
16160
16170
|
params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
|
|
16161
16171
|
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' }) ```
|
|
16162
16172
|
|
|
16163
|
-
**findOrdersByProduct**(collectionId: string,
|
|
16164
|
-
productId: string,
|
|
16173
|
+
**findOrdersByProduct**(collectionId: string,
|
|
16174
|
+
productId: string,
|
|
16165
16175
|
params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
|
|
16166
16176
|
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`) ```
|
|
16167
16177
|
|
|
16168
|
-
**findItemsByProduct**(collectionId: string,
|
|
16169
|
-
productId: string,
|
|
16178
|
+
**findItemsByProduct**(collectionId: string,
|
|
16179
|
+
productId: string,
|
|
16170
16180
|
params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
|
|
16171
16181
|
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`) ```
|
|
16172
16182
|
|
|
16173
|
-
**getOrderIdsByAttribute**(collectionId: string,
|
|
16174
|
-
attribute: 'productId',
|
|
16175
|
-
value: string,
|
|
16183
|
+
**getOrderIdsByAttribute**(collectionId: string,
|
|
16184
|
+
attribute: 'productId',
|
|
16185
|
+
value: string,
|
|
16176
16186
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
16177
16187
|
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 } ) ```
|
|
16178
16188
|
|
|
@@ -16206,7 +16216,7 @@ Move items (by membership), chips without an item (by membership) or containers
|
|
|
16206
16216
|
|
|
16207
16217
|
### podcast
|
|
16208
16218
|
|
|
16209
|
-
**generate**(collectionId: string,
|
|
16219
|
+
**generate**(collectionId: string,
|
|
16210
16220
|
request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
|
|
16211
16221
|
Generate a NotebookLM-style conversational podcast from product documents
|
|
16212
16222
|
|
|
@@ -16285,209 +16295,209 @@ Look up a serial number by code for a product (admin only).
|
|
|
16285
16295
|
|
|
16286
16296
|
### products
|
|
16287
16297
|
|
|
16288
|
-
**get**(collectionId: string,
|
|
16289
|
-
productId: string,
|
|
16298
|
+
**get**(collectionId: string,
|
|
16299
|
+
productId: string,
|
|
16290
16300
|
admin?: boolean) → `Promise<ProductResponse>`
|
|
16291
16301
|
|
|
16292
|
-
**list**(collectionId: string,
|
|
16302
|
+
**list**(collectionId: string,
|
|
16293
16303
|
admin?: boolean) → `Promise<ProductResponse[]>`
|
|
16294
16304
|
|
|
16295
|
-
**create**(collectionId: string,
|
|
16305
|
+
**create**(collectionId: string,
|
|
16296
16306
|
data: ProductCreateRequest) → `Promise<ProductResponse>`
|
|
16297
16307
|
|
|
16298
|
-
**update**(collectionId: string,
|
|
16299
|
-
productId: string,
|
|
16308
|
+
**update**(collectionId: string,
|
|
16309
|
+
productId: string,
|
|
16300
16310
|
data: ProductUpdateRequest) → `Promise<ProductResponse>`
|
|
16301
16311
|
|
|
16302
|
-
**remove**(collectionId: string,
|
|
16312
|
+
**remove**(collectionId: string,
|
|
16303
16313
|
productId: string) → `Promise<void>`
|
|
16304
16314
|
|
|
16305
|
-
**query**(collectionId: string,
|
|
16306
|
-
body: ProductQueryRequest,
|
|
16315
|
+
**query**(collectionId: string,
|
|
16316
|
+
body: ProductQueryRequest,
|
|
16307
16317
|
admin?: boolean) → `Promise<ProductQueryResponse>`
|
|
16308
16318
|
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) ```
|
|
16309
16319
|
|
|
16310
|
-
**standardQuery**(collectionId: string,
|
|
16320
|
+
**standardQuery**(collectionId: string,
|
|
16311
16321
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
16312
16322
|
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, }) ```
|
|
16313
16323
|
|
|
16314
16324
|
**standardQueryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
16315
16325
|
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
|
|
16316
16326
|
|
|
16317
|
-
**clone**(collectionId: string,
|
|
16318
|
-
productId: string,
|
|
16327
|
+
**clone**(collectionId: string,
|
|
16328
|
+
productId: string,
|
|
16319
16329
|
body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
|
|
16320
16330
|
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
|
|
16321
16331
|
|
|
16322
|
-
**listAssets**(collectionId: string,
|
|
16323
|
-
productId: string,
|
|
16332
|
+
**listAssets**(collectionId: string,
|
|
16333
|
+
productId: string,
|
|
16324
16334
|
admin?: boolean) → `Promise<unknown>`
|
|
16325
16335
|
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
|
|
16326
16336
|
|
|
16327
|
-
**createClaimWindow**(collectionId: string,
|
|
16328
|
-
productId: string,
|
|
16337
|
+
**createClaimWindow**(collectionId: string,
|
|
16338
|
+
productId: string,
|
|
16329
16339
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
16330
16340
|
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
|
|
16331
16341
|
|
|
16332
|
-
**updateClaimWindow**(collectionId: string,
|
|
16333
|
-
productId: string,
|
|
16334
|
-
claimId: string,
|
|
16342
|
+
**updateClaimWindow**(collectionId: string,
|
|
16343
|
+
productId: string,
|
|
16344
|
+
claimId: string,
|
|
16335
16345
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
16336
16346
|
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
|
|
16337
16347
|
|
|
16338
|
-
**refresh**(collectionId: string,
|
|
16348
|
+
**refresh**(collectionId: string,
|
|
16339
16349
|
productId: string) → `Promise<ProductResponse>`
|
|
16340
16350
|
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
|
|
16341
16351
|
|
|
16342
|
-
**getSN**(collectionId: string,
|
|
16343
|
-
productId: string,
|
|
16344
|
-
startIndex: number = 0,
|
|
16352
|
+
**getSN**(collectionId: string,
|
|
16353
|
+
productId: string,
|
|
16354
|
+
startIndex: number = 0,
|
|
16345
16355
|
count: number = 10) → `Promise<unknown>`
|
|
16346
16356
|
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
|
|
16347
16357
|
|
|
16348
|
-
**lookupSN**(collectionId: string,
|
|
16349
|
-
productId: string,
|
|
16358
|
+
**lookupSN**(collectionId: string,
|
|
16359
|
+
productId: string,
|
|
16350
16360
|
codeId: string) → `Promise<unknown>`
|
|
16351
16361
|
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
|
|
16352
16362
|
|
|
16353
|
-
**publicLookupClaim**(collectionId: string,
|
|
16354
|
-
productId: string,
|
|
16363
|
+
**publicLookupClaim**(collectionId: string,
|
|
16364
|
+
productId: string,
|
|
16355
16365
|
claimId: string) → `Promise<unknown>`
|
|
16356
16366
|
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
|
|
16357
16367
|
|
|
16358
|
-
**publicCreateClaim**(collectionId: string,
|
|
16359
|
-
productId: string,
|
|
16368
|
+
**publicCreateClaim**(collectionId: string,
|
|
16369
|
+
productId: string,
|
|
16360
16370
|
body: ProductClaimCreateRequestBody) → `Promise<unknown>`
|
|
16361
16371
|
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
|
|
16362
16372
|
|
|
16363
16373
|
### proof
|
|
16364
16374
|
|
|
16365
|
-
**query**(collectionId: string,
|
|
16375
|
+
**query**(collectionId: string,
|
|
16366
16376
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
16367
16377
|
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'] }, }) ```
|
|
16368
16378
|
|
|
16369
16379
|
**queryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
16370
16380
|
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
|
|
16371
16381
|
|
|
16372
|
-
**get**(collectionId: string,
|
|
16373
|
-
productId: string,
|
|
16374
|
-
proofId: string,
|
|
16375
|
-
admin?: boolean,
|
|
16382
|
+
**get**(collectionId: string,
|
|
16383
|
+
productId: string,
|
|
16384
|
+
proofId: string,
|
|
16385
|
+
admin?: boolean,
|
|
16376
16386
|
include?: string[]) → `Promise<ProofResponse>`
|
|
16377
16387
|
Retrieves a single Proof by Collection ID, Product ID, and Proof ID. Both public and admin endpoints now include productId in the path.
|
|
16378
16388
|
|
|
16379
|
-
**list**(collectionId: string,
|
|
16389
|
+
**list**(collectionId: string,
|
|
16380
16390
|
include?: string[]) → `Promise<ProofResponse[]>`
|
|
16381
16391
|
List all Proofs for a Collection.
|
|
16382
16392
|
|
|
16383
|
-
**create**(collectionId: string,
|
|
16384
|
-
productId: string,
|
|
16393
|
+
**create**(collectionId: string,
|
|
16394
|
+
productId: string,
|
|
16385
16395
|
request: ProofCreateRequest) → `Promise<ProofResponse>`
|
|
16386
16396
|
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`.
|
|
16387
16397
|
|
|
16388
|
-
**update**(collectionId: string,
|
|
16389
|
-
productId: string,
|
|
16390
|
-
proofId: string,
|
|
16398
|
+
**update**(collectionId: string,
|
|
16399
|
+
productId: string,
|
|
16400
|
+
proofId: string,
|
|
16391
16401
|
values: ProofUpdateRequest) → `Promise<ProofResponse>`
|
|
16392
16402
|
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.
|
|
16393
16403
|
|
|
16394
|
-
**updateValues**(collectionId: string,
|
|
16395
|
-
productId: string,
|
|
16396
|
-
proofId: string,
|
|
16404
|
+
**updateValues**(collectionId: string,
|
|
16405
|
+
productId: string,
|
|
16406
|
+
proofId: string,
|
|
16397
16407
|
values: ProofValuesUpdateRequest) → `Promise<ProofResponse>`
|
|
16398
16408
|
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.
|
|
16399
16409
|
|
|
16400
|
-
**claim**(collectionId: string,
|
|
16401
|
-
productId: string,
|
|
16402
|
-
proofId: string,
|
|
16410
|
+
**claim**(collectionId: string,
|
|
16411
|
+
productId: string,
|
|
16412
|
+
proofId: string,
|
|
16403
16413
|
values: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
16404
16414
|
Claim a proof for a product using a proof ID (serial number, NFC tag, etc.). PUT /public/collection/:collectionId/product/:productId/proof/:proofId/claim
|
|
16405
16415
|
|
|
16406
|
-
**claimProduct**(collectionId: string,
|
|
16407
|
-
productId: string,
|
|
16416
|
+
**claimProduct**(collectionId: string,
|
|
16417
|
+
productId: string,
|
|
16408
16418
|
values?: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
16409
16419
|
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); ```
|
|
16410
16420
|
|
|
16411
|
-
**remove**(collectionId: string,
|
|
16412
|
-
productId: string,
|
|
16421
|
+
**remove**(collectionId: string,
|
|
16422
|
+
productId: string,
|
|
16413
16423
|
proofId: string) → `Promise<void>`
|
|
16414
16424
|
Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
16415
16425
|
|
|
16416
|
-
**getByUser**(collectionId: string,
|
|
16426
|
+
**getByUser**(collectionId: string,
|
|
16417
16427
|
userId: string) → `Promise<ProofResponse[]>`
|
|
16418
16428
|
Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
16419
16429
|
|
|
16420
|
-
**getByProduct**(collectionId: string,
|
|
16430
|
+
**getByProduct**(collectionId: string,
|
|
16421
16431
|
productId: string) → `Promise<ProofResponse[]>`
|
|
16422
16432
|
Get proofs for a product (admin only). GET /admin/collection/:collectionId/product/:productId/proof
|
|
16423
16433
|
|
|
16424
|
-
**findByProduct**(collectionId: string,
|
|
16425
|
-
productId: string,
|
|
16434
|
+
**findByProduct**(collectionId: string,
|
|
16435
|
+
productId: string,
|
|
16426
16436
|
query: any) → `Promise<ProofResponse[]>`
|
|
16427
16437
|
Find proofs for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof/find
|
|
16428
16438
|
|
|
16429
|
-
**getByBatch**(collectionId: string,
|
|
16430
|
-
productId: string,
|
|
16439
|
+
**getByBatch**(collectionId: string,
|
|
16440
|
+
productId: string,
|
|
16431
16441
|
batchId: string) → `Promise<ProofResponse[]>`
|
|
16432
16442
|
Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
|
|
16433
16443
|
|
|
16434
|
-
**migrate**(collectionId: string,
|
|
16435
|
-
productId: string,
|
|
16436
|
-
proofId: string,
|
|
16437
|
-
/** The destination product ID */
|
|
16444
|
+
**migrate**(collectionId: string,
|
|
16445
|
+
productId: string,
|
|
16446
|
+
proofId: string,
|
|
16447
|
+
/** The destination product ID */
|
|
16438
16448
|
data: { targetProductId: string }) → `Promise<ProofResponse>`
|
|
16439
16449
|
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' ```
|
|
16440
16450
|
|
|
16441
|
-
**createGrant**(collectionId: string,
|
|
16442
|
-
productId: string,
|
|
16443
|
-
proofId: string,
|
|
16451
|
+
**createGrant**(collectionId: string,
|
|
16452
|
+
productId: string,
|
|
16453
|
+
proofId: string,
|
|
16444
16454
|
options: CreateGrantOptions) → `Promise<ProofGrant>`
|
|
16445
16455
|
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}.
|
|
16446
16456
|
|
|
16447
|
-
**listGrants**(collectionId: string,
|
|
16448
|
-
productId: string,
|
|
16457
|
+
**listGrants**(collectionId: string,
|
|
16458
|
+
productId: string,
|
|
16449
16459
|
proofId: string) → `Promise<ProofGrant[]>`
|
|
16450
16460
|
List the active + past grants on a proof (owner / collection admin only). Tokens are never returned here.
|
|
16451
16461
|
|
|
16452
|
-
**revokeGrant**(collectionId: string,
|
|
16453
|
-
productId: string,
|
|
16454
|
-
proofId: string,
|
|
16462
|
+
**revokeGrant**(collectionId: string,
|
|
16463
|
+
productId: string,
|
|
16464
|
+
proofId: string,
|
|
16455
16465
|
grantId: string) → `Promise<void>`
|
|
16456
16466
|
Revoke a grant by id (owner / collection admin only). Takes effect immediately.
|
|
16457
16467
|
|
|
16458
|
-
**redeemGrant**(collectionId: string,
|
|
16459
|
-
productId: string,
|
|
16460
|
-
proofId: string,
|
|
16461
|
-
token: string,
|
|
16468
|
+
**redeemGrant**(collectionId: string,
|
|
16469
|
+
productId: string,
|
|
16470
|
+
proofId: string,
|
|
16471
|
+
token: string,
|
|
16462
16472
|
options?: RedeemGrantOptions) → `Promise<RedeemGrantResult>`
|
|
16463
16473
|
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.
|
|
16464
16474
|
|
|
16465
|
-
**transfer**(collectionId: string,
|
|
16466
|
-
productId: string,
|
|
16467
|
-
proofId: string,
|
|
16475
|
+
**transfer**(collectionId: string,
|
|
16476
|
+
productId: string,
|
|
16477
|
+
proofId: string,
|
|
16468
16478
|
options: TransferProofOptions) → `Promise<TransferProofResult>`
|
|
16469
16479
|
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' } }, }) ```
|
|
16470
16480
|
|
|
16471
|
-
**acceptTransfer**(collectionId: string,
|
|
16472
|
-
productId: string,
|
|
16473
|
-
proofId: string,
|
|
16481
|
+
**acceptTransfer**(collectionId: string,
|
|
16482
|
+
productId: string,
|
|
16483
|
+
proofId: string,
|
|
16474
16484
|
options: AcceptTransferOptions = {}) → `Promise<`
|
|
16475
16485
|
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.
|
|
16476
16486
|
|
|
16477
|
-
**cancelTransfer**(collectionId: string,
|
|
16478
|
-
productId: string,
|
|
16479
|
-
proofId: string,
|
|
16487
|
+
**cancelTransfer**(collectionId: string,
|
|
16488
|
+
productId: string,
|
|
16489
|
+
proofId: string,
|
|
16480
16490
|
options: CancelTransferOptions = {}) → `Promise<`
|
|
16481
16491
|
Cancel a pending push transfer (current owner / collection admin only).
|
|
16482
16492
|
|
|
16483
|
-
**getTransfer**(collectionId: string,
|
|
16484
|
-
productId: string,
|
|
16493
|
+
**getTransfer**(collectionId: string,
|
|
16494
|
+
productId: string,
|
|
16485
16495
|
proofId: string) → `Promise<`
|
|
16486
16496
|
Get the active transfer/status for a proof (owner, collection admin, or the named recipient). Returns `{ transfer: null }` when nothing is in flight.
|
|
16487
16497
|
|
|
16488
16498
|
### publicClient
|
|
16489
16499
|
|
|
16490
|
-
**agentRun**(collectionId: string,
|
|
16500
|
+
**agentRun**(collectionId: string,
|
|
16491
16501
|
body: PublicAgentRunRequest) → `Promise<AgentRunResult>`
|
|
16492
16502
|
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
|
|
16493
16503
|
|
|
@@ -16502,19 +16512,19 @@ Check rate limit status
|
|
|
16502
16512
|
|
|
16503
16513
|
### publicClient.sessions
|
|
16504
16514
|
|
|
16505
|
-
**create**(collectionId: string,
|
|
16515
|
+
**create**(collectionId: string,
|
|
16506
16516
|
body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
|
|
16507
16517
|
|
|
16508
|
-
**list**(collectionId: string,
|
|
16518
|
+
**list**(collectionId: string,
|
|
16509
16519
|
params?: { appId?: string; limit?: number }) → `Promise<`
|
|
16510
16520
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16511
16521
|
|
|
16512
16522
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
16513
16523
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16514
16524
|
|
|
16515
|
-
**append**(collectionId: string,
|
|
16516
|
-
id: string,
|
|
16517
|
-
items: ResponseInputItem[],
|
|
16525
|
+
**append**(collectionId: string,
|
|
16526
|
+
id: string,
|
|
16527
|
+
items: ResponseInputItem[],
|
|
16518
16528
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
16519
16529
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16520
16530
|
|
|
@@ -16644,9 +16654,9 @@ List sessions, most-recently-active first (optionally filtered by app).
|
|
|
16644
16654
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
16645
16655
|
Get one session, including its full transcript.
|
|
16646
16656
|
|
|
16647
|
-
**append**(collectionId: string,
|
|
16648
|
-
id: string,
|
|
16649
|
-
items: ResponseInputItem[],
|
|
16657
|
+
**append**(collectionId: string,
|
|
16658
|
+
id: string,
|
|
16659
|
+
items: ResponseInputItem[],
|
|
16650
16660
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
16651
16661
|
Append Responses items (input/output/tool) to a session — the manual-persistence path.
|
|
16652
16662
|
|
|
@@ -16671,7 +16681,7 @@ The thank-you page: the order a Stripe checkout paid for, from the `session_id`
|
|
|
16671
16681
|
The signed-in buyer's orders, newest first, with their download links. @throws `SIGN_IN_REQUIRED`
|
|
16672
16682
|
|
|
16673
16683
|
**formatMoney**(amount: number, currency: string, locale?: string) → `string`
|
|
16674
|
-
Format minor units as money
|
|
16684
|
+
Format minor units as money, in the page's language unless `locale` says otherwise: `formatMoney(1299, 'EUR')` → "€12.99" in English, "12,99 €" in German. Zero-decimal currencies (JPY, KRW) are whole units: `formatMoney(1299, 'JPY')` → "¥1,299".
|
|
16675
16685
|
|
|
16676
16686
|
### shop.admin
|
|
16677
16687
|
|
|
@@ -16749,7 +16759,7 @@ Move to another plan's price. Up (a higher-ranked or dearer plan): at once, char
|
|
|
16749
16759
|
Stripe's page for the member's card, invoices and cancelling. Send them to `url`. @throws `NO_BILLING`
|
|
16750
16760
|
|
|
16751
16761
|
**describePrice**(p: { amount: number; currency: string; interval: 'month' | 'year' | null; intervalCount?: number }, locale?: string) → `string`
|
|
16752
|
-
Format a plan price for people: "£15 a month", "
|
|
16762
|
+
Format a plan price for people, in the page's language unless `locale` says otherwise: "£15 a month", "15 € pro Monat", "40 € tous les 3 mois", "99 € una tantum".
|
|
16753
16763
|
|
|
16754
16764
|
### subscriptions.admin
|
|
16755
16765
|
|
|
@@ -16900,17 +16910,17 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
|
|
|
16900
16910
|
|
|
16901
16911
|
### tools
|
|
16902
16912
|
|
|
16903
|
-
**run**(collectionId: string,
|
|
16904
|
-
name: K,
|
|
16905
|
-
args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
|
|
16906
|
-
export async function run<T = any>(
|
|
16907
|
-
collectionId: string,
|
|
16908
|
-
name: string,
|
|
16909
|
-
args?: Record<string, any>,
|
|
16910
|
-
): Promise<ToolRunResult<T>>
|
|
16911
|
-
export async function run(
|
|
16912
|
-
collectionId: string,
|
|
16913
|
-
name: string,
|
|
16913
|
+
**run**(collectionId: string,
|
|
16914
|
+
name: K,
|
|
16915
|
+
args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
|
|
16916
|
+
export async function run<T = any>(
|
|
16917
|
+
collectionId: string,
|
|
16918
|
+
name: string,
|
|
16919
|
+
args?: Record<string, any>,
|
|
16920
|
+
): Promise<ToolRunResult<T>>
|
|
16921
|
+
export async function run(
|
|
16922
|
+
collectionId: string,
|
|
16923
|
+
name: string,
|
|
16914
16924
|
args: Record<string, any> =`
|
|
16915
16925
|
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
|
|
16916
16926
|
|
|
@@ -16974,7 +16984,7 @@ Admin: replace the site's translation rules. They apply to new translations from
|
|
|
16974
16984
|
|
|
16975
16985
|
### tts
|
|
16976
16986
|
|
|
16977
|
-
**generate**(collectionId: string,
|
|
16987
|
+
**generate**(collectionId: string,
|
|
16978
16988
|
request: TTSRequest) → `Promise<Blob>`
|
|
16979
16989
|
Generate text-to-speech audio
|
|
16980
16990
|
|