@proveanything/smartlinks 2.1.46 → 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 +99 -0
- package/dist/api/dpp.js +194 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -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 +1136 -809
- 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 -0
- 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 -484
- 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 +509 -3
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/dpp.d.ts +273 -0
- package/dist/types/dpp.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- 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 +1136 -809
- 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 -0
- 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 -484
- 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 +509 -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
|
|
|
@@ -148,6 +148,7 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
148
148
|
- **conditions** - Functions for conditions operations
|
|
149
149
|
- **config** - Functions for config operations
|
|
150
150
|
- **containers** - Functions for containers operations
|
|
151
|
+
- **dpp** - Functions for dpp operations
|
|
151
152
|
- **errors** - Functions for errors operations
|
|
152
153
|
- **facets** - Functions for facets operations
|
|
153
154
|
- **files** - Functions for files operations
|
|
@@ -182,6 +183,12 @@ The Smartlinks SDK is organized into the following namespaces:
|
|
|
182
183
|
|
|
183
184
|
Core HTTP functions for API configuration and communication:
|
|
184
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
|
+
|
|
185
192
|
**getHttpCacheDiagnostics**() → `void`
|
|
186
193
|
Snapshot of cache counters + current keys. Call from the console via `window.__slHttpDiag()`.
|
|
187
194
|
|
|
@@ -7054,418 +7061,418 @@ interface TransactionalSendError {
|
|
|
7054
7061
|
|
|
7055
7062
|
**EmailAttachmentSpec** = ``
|
|
7056
7063
|
|
|
7057
|
-
**TransactionalSendResult** = `// src/types/comms.ts
|
|
7058
|
-
// Communication and notification types for the Smartlinks API
|
|
7059
|
-
import type { IdField } from './common'
|
|
7060
|
-
import type { BroadcastChannel } from './broadcasts'
|
|
7061
|
-
|
|
7062
|
-
/**
|
|
7063
|
-
* Target subject for notifications (product, collection, etc.)
|
|
7064
|
-
*/
|
|
7065
|
-
export interface NotificationSubjectTarget {
|
|
7066
|
-
/** Type of target entity */
|
|
7067
|
-
type: 'product' | 'collection' | 'user' | 'batch' | 'proof'
|
|
7068
|
-
/** ID of the target entity */
|
|
7069
|
-
id: string
|
|
7070
|
-
}
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
// Analytics & logging (communication events)
|
|
7074
|
-
|
|
7075
|
-
export interface CommunicationEvent {
|
|
7076
|
-
orgId: string
|
|
7077
|
-
broadcastId?: string
|
|
7078
|
-
journeyId?: string
|
|
7079
|
-
userId?: string
|
|
7080
|
-
contactId?: string
|
|
7081
|
-
channel?: string
|
|
7082
|
-
timestamp: string
|
|
7083
|
-
eventType: string
|
|
7084
|
-
outcome?: string | null
|
|
7085
|
-
templateId?: string | null
|
|
7086
|
-
[k: string]: any
|
|
7087
|
-
}
|
|
7088
|
-
|
|
7089
|
-
export interface CommsQueryByUser {
|
|
7090
|
-
userId?: string
|
|
7091
|
-
contactId?: string
|
|
7092
|
-
from?: string
|
|
7093
|
-
to?: string
|
|
7094
|
-
limit?: number
|
|
7095
|
-
}
|
|
7096
|
-
|
|
7097
|
-
export type RecipientId = string
|
|
7098
|
-
export interface RecipientWithOutcome { id: string; outcome: string }
|
|
7099
|
-
|
|
7100
|
-
export interface CommsRecipientIdsQuery {
|
|
7101
|
-
broadcastId?: string
|
|
7102
|
-
journeyId?: string
|
|
7103
|
-
journeyStepId?: string
|
|
7104
|
-
idField?: IdField
|
|
7105
|
-
from?: string
|
|
7106
|
-
to?: string
|
|
7107
|
-
limit?: number
|
|
7108
|
-
}
|
|
7109
|
-
|
|
7110
|
-
export interface CommsRecipientsWithoutActionQuery {
|
|
7111
|
-
broadcastId?: string
|
|
7112
|
-
journeyId?: string
|
|
7113
|
-
actionId?: string
|
|
7114
|
-
appId?: string
|
|
7115
|
-
idField?: IdField
|
|
7116
|
-
from?: string
|
|
7117
|
-
to?: string
|
|
7118
|
-
limit?: number
|
|
7119
|
-
}
|
|
7120
|
-
|
|
7121
|
-
export interface CommsRecipientsWithActionQuery {
|
|
7122
|
-
broadcastId?: string
|
|
7123
|
-
journeyId?: string
|
|
7124
|
-
actionId?: string
|
|
7125
|
-
appId?: string
|
|
7126
|
-
outcome?: string
|
|
7127
|
-
idField?: IdField
|
|
7128
|
-
includeOutcome?: boolean
|
|
7129
|
-
from?: string
|
|
7130
|
-
to?: string
|
|
7131
|
-
limit?: number
|
|
7132
|
-
}
|
|
7133
|
-
|
|
7134
|
-
export interface LogCommunicationEventBody {
|
|
7135
|
-
broadcastId?: string
|
|
7136
|
-
journeyId?: string
|
|
7137
|
-
userId?: string
|
|
7138
|
-
contactId?: string
|
|
7139
|
-
channel?: string
|
|
7140
|
-
eventType: string
|
|
7141
|
-
outcome?: string
|
|
7142
|
-
templateId?: string
|
|
7143
|
-
timestamp?: string
|
|
7144
|
-
[k: string]: any
|
|
7145
|
-
}
|
|
7146
|
-
|
|
7147
|
-
export interface LogBulkCommunicationEventsBody {
|
|
7148
|
-
params: { broadcastId?: string; journeyId?: string; [k: string]: any }
|
|
7149
|
-
ids: string[]
|
|
7150
|
-
idField?: IdField
|
|
7151
|
-
}
|
|
7152
|
-
|
|
7153
|
-
export interface AppendResult { success: true }
|
|
7154
|
-
export interface AppendBulkResult { success: true; count: number }
|
|
7155
|
-
|
|
7156
|
-
// Common recipient type used by segments and broadcasts
|
|
7157
|
-
export type Recipient = import('./contact').Contact
|
|
7158
|
-
|
|
7159
|
-
// Shared page response shape for recipient listings
|
|
7160
|
-
export interface RecipientsPage {
|
|
7161
|
-
items: Recipient[]
|
|
7162
|
-
total: number
|
|
7163
|
-
limit: number
|
|
7164
|
-
offset: number
|
|
7165
|
-
note?: string
|
|
7166
|
-
}
|
|
7167
|
-
|
|
7168
|
-
// Web Push (public client registration)
|
|
7169
|
-
|
|
7170
|
-
export interface PushSubscriptionJSON {
|
|
7171
|
-
endpoint: string
|
|
7172
|
-
keys?: {
|
|
7173
|
-
p256dh?: string
|
|
7174
|
-
auth?: string
|
|
7175
|
-
}
|
|
7176
|
-
}
|
|
7177
|
-
|
|
7178
|
-
export interface PushVapidResponse { publicKey: string }
|
|
7179
|
-
export interface PushSubscribeResponse { ok: true; id: string }
|
|
7180
|
-
|
|
7181
|
-
// Public: register a push contact method
|
|
7182
|
-
export interface RegisterPushMethodRequest {
|
|
7183
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7184
|
-
contactId?: string
|
|
7185
|
-
endpoint: string
|
|
7186
|
-
keys: { p256dh: string; auth: string }
|
|
7187
|
-
meta?: Record<string, any>
|
|
7188
|
-
}
|
|
7189
|
-
|
|
7190
|
-
// Admin Comms Settings
|
|
7191
|
-
|
|
7192
|
-
export interface CommsSettings {
|
|
7193
|
-
unsub?: {
|
|
7194
|
-
requireToken?: boolean
|
|
7195
|
-
/** Secret for token generation; omitted unless includeSecret=true */
|
|
7196
|
-
secret?: string
|
|
7197
|
-
/** Convenience flag indicating a secret is set (masked responses) */
|
|
7198
|
-
hasSecret?: boolean
|
|
7199
|
-
}
|
|
7200
|
-
/** Map of topic keys to topic config */
|
|
7201
|
-
topics?: Record<string, TopicConfig>
|
|
7202
|
-
[k: string]: any
|
|
7203
|
-
}
|
|
7204
|
-
|
|
7205
|
-
export interface TopicConfig {
|
|
7206
|
-
label?: string
|
|
7207
|
-
description?: string
|
|
7208
|
-
/** Optional UI-only grouping labels */
|
|
7209
|
-
labels?: string[]
|
|
7210
|
-
/** Classification for UI and default policy guidance */
|
|
7211
|
-
classification?: 'transactional' | 'marketing'
|
|
7212
|
-
defaults?: {
|
|
7213
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7214
|
-
topics?: Record<string, boolean | undefined>
|
|
7215
|
-
/** Default consent policy when explicit preferences are absent */
|
|
7216
|
-
policy?: 'opt-in' | 'opt-out'
|
|
7217
|
-
/** Per-channel default policy (overrides policy when present) */
|
|
7218
|
-
byChannel?: Partial<Record<BroadcastChannel, 'opt-in' | 'opt-out'>>
|
|
7219
|
-
}
|
|
7220
|
-
rules?: {
|
|
7221
|
-
allowChannels?: BroadcastChannel[]
|
|
7222
|
-
allowUnsubscribe?: boolean
|
|
7223
|
-
required?: boolean
|
|
7224
|
-
}
|
|
7225
|
-
[k: string]: any
|
|
7226
|
-
}
|
|
7227
|
-
|
|
7228
|
-
export interface CommsSettingsGetResponse {
|
|
7229
|
-
ok: true
|
|
7230
|
-
settings: CommsSettings
|
|
7231
|
-
}
|
|
7232
|
-
|
|
7233
|
-
export type CommsSettingsPatchBody = Partial<CommsSettings>
|
|
7234
|
-
|
|
7235
|
-
// Public types listing (array form for public API)
|
|
7236
|
-
export interface CommsPublicTopicsResponse { ok: true; topics: Record<string, TopicConfig> }
|
|
7237
|
-
|
|
7238
|
-
export interface UnsubscribeQuery {
|
|
7239
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7240
|
-
contactId?: string
|
|
7241
|
-
topic?: string
|
|
7242
|
-
channel?: BroadcastChannel
|
|
7243
|
-
token?: string
|
|
7244
|
-
}
|
|
7245
|
-
|
|
7246
|
-
export interface UnsubscribeResponse { ok: true; applied?: { channels?: Record<string, boolean>; topics?: Record<string, boolean> } }
|
|
7247
|
-
|
|
7248
|
-
// Public sign-up (double opt-in)
|
|
7249
|
-
export interface CommsSignupRequest {
|
|
7250
|
-
email: string
|
|
7251
|
-
/**
|
|
7252
|
-
* Required: YOUR app's confirmation email — a template in this collection (SL.template) whose body
|
|
7253
|
-
* uses `{{ action_url }}` for the confirm link (`{{ topics }}` lists what they signed up for). The
|
|
7254
|
-
* platform sends no default sign-up email.
|
|
7255
|
-
*/
|
|
7256
|
-
templateId: string
|
|
7257
|
-
/** Topic ids from the collection's comm settings (e.g. ["newsletter"]). */
|
|
7258
|
-
topics?: string[]
|
|
7259
|
-
firstName?: string
|
|
7260
|
-
/**
|
|
7261
|
-
* The form's other answers — firstName/lastName/displayName/company/locale/timezone and
|
|
7262
|
-
* `customFields`. Applied to the contact when the address is confirmed, and only where the contact
|
|
7263
|
-
* has no value yet (never overwritten). Small: ~2 KB.
|
|
7264
|
-
*/
|
|
7265
|
-
fields?: { firstName?: string; lastName?: string; displayName?: string; company?: string; locale?: string; timezone?: string; customFields?: Record<string, string | number | boolean> }
|
|
7266
|
-
/** Your app id, recorded with the sent email. */
|
|
7267
|
-
appId?: string
|
|
7268
|
-
}
|
|
7269
|
-
export interface CommsSignupResponse { ok: true; pending: true }
|
|
7270
|
-
|
|
7271
|
-
// Public consent/preferences/subscribe
|
|
7272
|
-
export type ConsentChannels = Partial<Record<BroadcastChannel, boolean>>
|
|
7273
|
-
type SubjectType = import('./contact').SubjectType
|
|
7274
|
-
|
|
7275
|
-
export interface CommsConsentUpsertRequest {
|
|
7276
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7277
|
-
contactId?: string
|
|
7278
|
-
channels?: ConsentChannels
|
|
7279
|
-
topics?: Record<string, boolean>
|
|
7280
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7281
|
-
}
|
|
7282
|
-
|
|
7283
|
-
export interface CommsPreferencesUpsertRequest {
|
|
7284
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7285
|
-
contactId?: string
|
|
7286
|
-
subject?: { type: SubjectType; id: string; productId?: string }
|
|
7287
|
-
channels?: ConsentChannels
|
|
7288
|
-
topics?: Record<string, boolean>
|
|
7289
|
-
topicsByChannel?: Partial<Record<BroadcastChannel, Record<string, boolean>>>
|
|
7290
|
-
}
|
|
7291
|
-
|
|
7292
|
-
export interface CommsSubscribeRequest {
|
|
7293
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7294
|
-
contactId?: string
|
|
7295
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7296
|
-
subscribe: boolean
|
|
7297
|
-
source?: string
|
|
7298
|
-
}
|
|
7299
|
-
export interface CommsSubscribeResponse { ok: true; subscriptionId: string }
|
|
7300
|
-
|
|
7301
|
-
export interface CommsSubscriptionCheckQuery {
|
|
7302
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7303
|
-
contactId?: string
|
|
7304
|
-
subjectType: SubjectType
|
|
7305
|
-
subjectId: string
|
|
7306
|
-
productId?: string
|
|
7307
|
-
}
|
|
7308
|
-
export interface CommsSubscriptionCheckResponse { ok: true; subscribed: boolean }
|
|
7309
|
-
|
|
7310
|
-
export interface CommsListMethodsQuery {
|
|
7311
|
-
/** Optional: defaults to the signed-in user's own contact. Only collection admins may name another contact. */
|
|
7312
|
-
contactId?: string
|
|
7313
|
-
type?: BroadcastChannel
|
|
7314
|
-
}
|
|
7315
|
-
export interface CommsListMethodsResponse { ok: true; methods: import('./contact').CommMethod[] }
|
|
7316
|
-
|
|
7317
|
-
export interface RegisterEmailMethodRequest { contactId?: string; email?: string; userId?: string }
|
|
7318
|
-
export interface RegisterSmsMethodRequest { contactId?: string; phone?: string; userId?: string }
|
|
7319
|
-
export interface RegisterMethodResponse { ok: true; contactId: string }
|
|
7320
|
-
|
|
7321
|
-
export interface SubscriptionsResolveRequest {
|
|
7322
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7323
|
-
hints: { userId?: string; pushEndpoint?: string; email?: string }
|
|
7324
|
-
}
|
|
7325
|
-
export interface SubscriptionsResolveResponse {
|
|
7326
|
-
ok: true
|
|
7327
|
-
subject: { type: SubjectType; id: string; productId?: string }
|
|
7328
|
-
contacts: Array<{
|
|
7329
|
-
contactId: string
|
|
7330
|
-
subscribed: boolean
|
|
7331
|
-
channels?: Partial<Record<BroadcastChannel, boolean>>
|
|
7332
|
-
}>
|
|
7333
|
-
anySubscribed: boolean
|
|
7334
|
-
anyMethods: boolean
|
|
7335
|
-
}
|
|
7336
|
-
|
|
7337
|
-
// Transactional send (single-contact, single-message)
|
|
7338
|
-
|
|
7339
|
-
/**
|
|
7340
|
-
* Send a single message to one contact using a template.
|
|
7341
|
-
* No broadcast record is created; the send is logged directly to the
|
|
7342
|
-
* contact's communication history with sourceType: 'transactional'.
|
|
7343
|
-
*
|
|
7344
|
-
* POST /admin/collection/:collectionId/comm/send
|
|
7345
|
-
*/
|
|
7346
|
-
export interface TransactionalSendRequest {
|
|
7347
|
-
/** CRM contact UUID */
|
|
7348
|
-
contactId: string
|
|
7349
|
-
/** A saved template's id. Give this or `message`. */
|
|
7350
|
-
templateId?: string
|
|
7351
|
-
/**
|
|
7352
|
-
* A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
|
|
7353
|
-
* `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
|
|
7354
|
-
*/
|
|
7355
|
-
message?: TypedMessage
|
|
7356
|
-
/**
|
|
7357
|
-
* Channel to send on. Defaults to 'preferred', which auto-selects the
|
|
7358
|
-
* contact's best available channel respecting consent, suppression, and
|
|
7359
|
-
* template availability.
|
|
7360
|
-
*/
|
|
7361
|
-
channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
|
|
7362
|
-
/** Extra Liquid variables merged into the top-level render context */
|
|
7363
|
-
props?: Record<string, unknown>
|
|
7364
|
-
/** Context objects to hydrate into the Liquid template */
|
|
7365
|
-
include?: {
|
|
7366
|
-
/** Hydrate {{ collection }}. Default: true */
|
|
7367
|
-
collection?: boolean
|
|
7368
|
-
/** Hydrate {{ product }} from this product ID */
|
|
7369
|
-
productId?: string
|
|
7370
|
-
/** Hydrate {{ proof }} (requires productId) */
|
|
7371
|
-
proofId?: string
|
|
7372
|
-
/** Hydrate {{ user }} from contact.userId */
|
|
7373
|
-
user?: boolean
|
|
7374
|
-
/** Hydrate {{ appCase }} from this case UUID */
|
|
7375
|
-
appCase?: string
|
|
7376
|
-
/** Hydrate {{ appThread }} from this thread UUID */
|
|
7377
|
-
appThread?: string
|
|
7378
|
-
/** Hydrate {{ appRecord }} from this record UUID */
|
|
7379
|
-
appRecord?: string
|
|
7380
|
-
}
|
|
7381
|
-
/** Arbitrary label stored on the comms-events row (e.g. 'warranty-step-2') */
|
|
7382
|
-
ref?: string
|
|
7383
|
-
/** App context stored on the comms-events row */
|
|
7384
|
-
appId?: string
|
|
7385
|
-
/**
|
|
7386
|
-
* What the message is about: the record it was sent for and the admin screen that shows it, so it is a
|
|
7387
|
-
* link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
|
|
7388
|
-
* to the sending app.
|
|
7389
|
-
*/
|
|
7390
|
-
about?: MessageAbout
|
|
7391
|
-
/**
|
|
7392
|
-
* `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
|
|
7393
|
-
* suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
|
|
7394
|
-
*/
|
|
7395
|
-
category?: 'service'
|
|
7396
|
-
/**
|
|
7397
|
-
* Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
|
|
7398
|
-
* `attachmentsLeftOut` — the email still goes.
|
|
7399
|
-
*/
|
|
7400
|
-
attach?: EmailAttachmentSpec[]
|
|
7401
|
-
}
|
|
7402
|
-
|
|
7403
|
-
/**
|
|
7404
|
-
* One file for an email:
|
|
7405
|
-
* - `'calendar'` — the booking's `.ics` calendar invite (needs `include.booking` and `appId`)
|
|
7406
|
-
* - `{ asset }` — a file uploaded to this collection's assets
|
|
7407
|
-
* - `{ function }` — the app's (`appId`) own server function makes it (see server-functions.md, "Making an email attachment")
|
|
7408
|
-
* - `{ filename, contentType, content }` — a file you made, base64 (PDF, Office documents, images, text, CSV, calendar)
|
|
7409
|
-
* - `{ filename, file }` — a private file you made (e.g. `pdf.create` with `return: 'signedUrl'`)
|
|
7410
|
-
*/
|
|
7411
|
-
export type EmailAttachmentSpec =
|
|
7412
|
-
| 'calendar'
|
|
7413
|
-
| { asset: string }
|
|
7414
|
-
| { function: string }
|
|
7415
|
-
| { filename: string; contentType: string; content: string }
|
|
7416
|
-
| { filename: string; contentType?: string; file: string }
|
|
7417
|
-
|
|
7418
|
-
export interface TransactionalSendResponse {
|
|
7419
|
-
ok: true
|
|
7420
|
-
/** The channel the message was actually sent on */
|
|
7421
|
-
channel: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet'
|
|
7422
|
-
/** Provider message ID (email/SMS/WhatsApp); absent for push/wallet */
|
|
7423
|
-
messageId?: string
|
|
7424
|
-
/** Attachments that couldn't be made, and why (the email went without them) */
|
|
7425
|
-
attachmentsLeftOut?: string[]
|
|
7426
|
-
}
|
|
7427
|
-
|
|
7428
|
-
/** A message written there and then rather than a saved template. */
|
|
7429
|
-
export interface TypedMessage {
|
|
7430
|
-
subject?: string
|
|
7431
|
-
body: string
|
|
7432
|
-
/** The shorter text for SMS and WhatsApp (defaults to `body`). */
|
|
7433
|
-
sms?: string
|
|
7434
|
-
}
|
|
7435
|
-
|
|
7436
|
-
/**
|
|
7437
|
-
* What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
|
|
7438
|
-
* `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
|
|
7439
|
-
*/
|
|
7440
|
-
export interface MessageAbout {
|
|
7441
|
-
appId?: string
|
|
7442
|
-
/** What kind of record: `'booking'`, `'entry'`, `'case'`. */
|
|
7443
|
-
type: string
|
|
7444
|
-
id: string
|
|
7445
|
-
view?: string
|
|
7446
|
-
params?: Record<string, string>
|
|
7447
|
-
/** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
|
|
7448
|
-
label?: string
|
|
7449
|
-
}
|
|
7450
|
-
|
|
7451
|
-
export interface TransactionalSendError {
|
|
7452
|
-
ok: false
|
|
7453
|
-
/**
|
|
7454
|
-
* Error code. Known values:
|
|
7455
|
-
* - `transactional.contact_not_found`
|
|
7456
|
-
* - `transactional.template_not_found`
|
|
7457
|
-
* - `transactional.no_channel_available`
|
|
7458
|
-
* - `transactional.email_missing`
|
|
7459
|
-
* - `transactional.phone_missing`
|
|
7460
|
-
* - `transactional.whatsapp_missing`
|
|
7461
|
-
* - `transactional.no_push_methods`
|
|
7462
|
-
* - `transactional.no_wallet_passes` (`channel: 'wallet'`: the person has no wallet passes from this app)
|
|
7463
|
-
* - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
|
|
7464
|
-
* - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
|
|
7465
|
-
*/
|
|
7466
|
-
error: string
|
|
7467
|
-
}
|
|
7468
|
-
|
|
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
|
+
|
|
7469
7476
|
export type TransactionalSendResult =`
|
|
7470
7477
|
|
|
7471
7478
|
### config
|
|
@@ -8104,6 +8111,258 @@ interface DeleteCrateResponse {
|
|
|
8104
8111
|
}
|
|
8105
8112
|
```
|
|
8106
8113
|
|
|
8114
|
+
### dpp
|
|
8115
|
+
|
|
8116
|
+
**DppRegistry** (interface)
|
|
8117
|
+
```typescript
|
|
8118
|
+
interface DppRegistry {
|
|
8119
|
+
environment: DppEnvironment
|
|
8120
|
+
label: string
|
|
8121
|
+
practice: boolean
|
|
8122
|
+
portal: string | null
|
|
8123
|
+
clientId: string | null
|
|
8124
|
+
kid: string | null
|
|
8125
|
+
alg: string | null
|
|
8126
|
+
orgIdentifier: string | null
|
|
8127
|
+
hasKey: boolean
|
|
8128
|
+
publicPem: string | null
|
|
8129
|
+
publicJwk: { kty: string; crv: string; x: string; y: string } | null
|
|
8130
|
+
thumbprint: string | null
|
|
8131
|
+
keyCreatedAt: string | null
|
|
8132
|
+
lastCheck: { ok: boolean; at: string; message: string; status?: number | null } | null
|
|
8133
|
+
ready: boolean
|
|
8134
|
+
nextStep: DppRegistryNextStep
|
|
8135
|
+
}
|
|
8136
|
+
```
|
|
8137
|
+
|
|
8138
|
+
**SetDppRegistryInput** (interface)
|
|
8139
|
+
```typescript
|
|
8140
|
+
interface SetDppRegistryInput {
|
|
8141
|
+
clientId?: string | null
|
|
8142
|
+
kid?: string | null
|
|
8143
|
+
orgIdentifier?: string | null
|
|
8144
|
+
}
|
|
8145
|
+
```
|
|
8146
|
+
|
|
8147
|
+
**DppRegistryProductGroup** (interface)
|
|
8148
|
+
```typescript
|
|
8149
|
+
interface DppRegistryProductGroup {
|
|
8150
|
+
code: string
|
|
8151
|
+
label: string
|
|
8152
|
+
productSubGroups: { code: string; label: string }[]
|
|
8153
|
+
}
|
|
8154
|
+
```
|
|
8155
|
+
|
|
8156
|
+
**DppRegistryCheckResult** (interface)
|
|
8157
|
+
```typescript
|
|
8158
|
+
interface DppRegistryCheckResult {
|
|
8159
|
+
registry: DppRegistry
|
|
8160
|
+
productGroups: DppRegistryProductGroup[]
|
|
8161
|
+
}
|
|
8162
|
+
```
|
|
8163
|
+
|
|
8164
|
+
**DppViewFields** (interface)
|
|
8165
|
+
```typescript
|
|
8166
|
+
interface DppViewFields {
|
|
8167
|
+
pub: string[]
|
|
8168
|
+
res1: string[]
|
|
8169
|
+
res2: string[]
|
|
8170
|
+
res3: string[]
|
|
8171
|
+
}
|
|
8172
|
+
```
|
|
8173
|
+
|
|
8174
|
+
**DppGroup** (interface)
|
|
8175
|
+
```typescript
|
|
8176
|
+
interface DppGroup {
|
|
8177
|
+
productGroup: string
|
|
8178
|
+
label: string
|
|
8179
|
+
subGroups: {
|
|
8180
|
+
productSubGroup: string
|
|
8181
|
+
label: string
|
|
8182
|
+
fields: DppViewFields
|
|
8183
|
+
required: DppViewFields
|
|
8184
|
+
}[]
|
|
8185
|
+
}
|
|
8186
|
+
```
|
|
8187
|
+
|
|
8188
|
+
**DppPassportCheck** (interface)
|
|
8189
|
+
```typescript
|
|
8190
|
+
interface DppPassportCheck {
|
|
8191
|
+
ready: boolean
|
|
8192
|
+
missing: Partial<DppViewFields>
|
|
8193
|
+
problem?: string
|
|
8194
|
+
}
|
|
8195
|
+
```
|
|
8196
|
+
|
|
8197
|
+
**DppRegistration** (interface)
|
|
8198
|
+
```typescript
|
|
8199
|
+
interface DppRegistration {
|
|
8200
|
+
status: "processing" | "registered" | "rejected" | "not-sent" | "error"
|
|
8201
|
+
taskId?: string
|
|
8202
|
+
submittedAt?: string
|
|
8203
|
+
correlationId?: string | null
|
|
8204
|
+
registryId?: string | null
|
|
8205
|
+
registeredAt?: string
|
|
8206
|
+
problems?: { code: string; message: string }[] | null
|
|
8207
|
+
checkedAt?: string
|
|
8208
|
+
}
|
|
8209
|
+
```
|
|
8210
|
+
|
|
8211
|
+
**DppPassport** (interface)
|
|
8212
|
+
```typescript
|
|
8213
|
+
interface DppPassport {
|
|
8214
|
+
id: string
|
|
8215
|
+
url: string
|
|
8216
|
+
status: "active" | "withdrawn"
|
|
8217
|
+
productGroup: string
|
|
8218
|
+
productSubGroup: string | null
|
|
8219
|
+
granularity: DppGranularity
|
|
8220
|
+
modelIdentifier: string | null
|
|
8221
|
+
batchIdentifier: string | null
|
|
8222
|
+
productId: string | null
|
|
8223
|
+
batchId: string | null
|
|
8224
|
+
proofId: string | null
|
|
8225
|
+
public: DppFields
|
|
8226
|
+
restricted: DppFields
|
|
8227
|
+
version: number
|
|
8228
|
+
contentUpdatedAt: string | null
|
|
8229
|
+
registration: Partial<Record<DppEnvironment, DppRegistration>>
|
|
8230
|
+
check: DppPassportCheck
|
|
8231
|
+
createdAt: string
|
|
8232
|
+
updatedAt: string
|
|
8233
|
+
}
|
|
8234
|
+
```
|
|
8235
|
+
|
|
8236
|
+
**DppPassportInput** (interface)
|
|
8237
|
+
```typescript
|
|
8238
|
+
interface DppPassportInput {
|
|
8239
|
+
productGroup?: string
|
|
8240
|
+
productSubGroup?: string | null
|
|
8241
|
+
granularity?: DppGranularity
|
|
8242
|
+
modelIdentifier?: string | null
|
|
8243
|
+
batchIdentifier?: string | null
|
|
8244
|
+
productId?: string | null
|
|
8245
|
+
batchId?: string | null
|
|
8246
|
+
proofId?: string | null
|
|
8247
|
+
public?: DppFields | null
|
|
8248
|
+
restricted?: DppFields | null
|
|
8249
|
+
}
|
|
8250
|
+
```
|
|
8251
|
+
|
|
8252
|
+
**DppPassportSaveResult** (interface)
|
|
8253
|
+
```typescript
|
|
8254
|
+
interface DppPassportSaveResult {
|
|
8255
|
+
passport: DppPassport
|
|
8256
|
+
changed: boolean
|
|
8257
|
+
}
|
|
8258
|
+
```
|
|
8259
|
+
|
|
8260
|
+
**DppPassportBulkResult** (interface)
|
|
8261
|
+
```typescript
|
|
8262
|
+
interface DppPassportBulkResult {
|
|
8263
|
+
results: (
|
|
8264
|
+
| { index: number; ok: true; id: string; url: string; created: boolean; changed: boolean; version: number; check: DppPassportCheck }
|
|
8265
|
+
| { index: number; ok: false; errorCode: string; errorText: string }
|
|
8266
|
+
)[]
|
|
8267
|
+
created: number
|
|
8268
|
+
changed: number
|
|
8269
|
+
unchanged: number
|
|
8270
|
+
failed: number
|
|
8271
|
+
}
|
|
8272
|
+
```
|
|
8273
|
+
|
|
8274
|
+
**DppPassportVersion** (interface)
|
|
8275
|
+
```typescript
|
|
8276
|
+
interface DppPassportVersion {
|
|
8277
|
+
version: number
|
|
8278
|
+
savedAt: string
|
|
8279
|
+
savedBy: string | null
|
|
8280
|
+
}
|
|
8281
|
+
```
|
|
8282
|
+
|
|
8283
|
+
**DppPassportListQuery** (interface)
|
|
8284
|
+
```typescript
|
|
8285
|
+
interface DppPassportListQuery {
|
|
8286
|
+
productId?: string
|
|
8287
|
+
batchId?: string
|
|
8288
|
+
proofId?: string
|
|
8289
|
+
status?: "active" | "withdrawn"
|
|
8290
|
+
limit?: number
|
|
8291
|
+
offset?: number
|
|
8292
|
+
}
|
|
8293
|
+
```
|
|
8294
|
+
|
|
8295
|
+
**DppRegisterResult** (interface)
|
|
8296
|
+
```typescript
|
|
8297
|
+
interface DppRegisterResult {
|
|
8298
|
+
tasks: {
|
|
8299
|
+
taskId: string
|
|
8300
|
+
environment: DppEnvironment
|
|
8301
|
+
productGroup: string
|
|
8302
|
+
productSubGroup: string | null
|
|
8303
|
+
passportIds: string[]
|
|
8304
|
+
estimated: string | null
|
|
8305
|
+
status?: string
|
|
8306
|
+
outcome?: DppTaskOutcome | null
|
|
8307
|
+
passports?: ({ id: string } & Partial<DppRegistration>)[]
|
|
8308
|
+
}[]
|
|
8309
|
+
skipped: { id: string; reason: string; missing?: Partial<DppViewFields>; registryId?: string }[]
|
|
8310
|
+
}
|
|
8311
|
+
```
|
|
8312
|
+
|
|
8313
|
+
**DppTaskOutcome** (interface)
|
|
8314
|
+
```typescript
|
|
8315
|
+
interface DppTaskOutcome {
|
|
8316
|
+
outcomeResult: "SUCCEEDED" | "FAILED"
|
|
8317
|
+
outcomeMessage?: { code: string; message: string }
|
|
8318
|
+
}
|
|
8319
|
+
```
|
|
8320
|
+
|
|
8321
|
+
**DppTask** (interface)
|
|
8322
|
+
```typescript
|
|
8323
|
+
interface DppTask {
|
|
8324
|
+
taskId: string
|
|
8325
|
+
environment: DppEnvironment
|
|
8326
|
+
status: string | null
|
|
8327
|
+
outcome: DppTaskOutcome | null
|
|
8328
|
+
passportIds: string[]
|
|
8329
|
+
createdAt: string
|
|
8330
|
+
checkedAt: string | null
|
|
8331
|
+
}
|
|
8332
|
+
```
|
|
8333
|
+
|
|
8334
|
+
**DppTaskRefreshResult** (interface)
|
|
8335
|
+
```typescript
|
|
8336
|
+
interface DppTaskRefreshResult {
|
|
8337
|
+
taskId: string
|
|
8338
|
+
status: string | null
|
|
8339
|
+
outcome: DppTaskOutcome | null
|
|
8340
|
+
processingInfo: { submittedItems: number; compliantItems: number; nonCompliantItems: number } | null
|
|
8341
|
+
passports: ({ id: string } & Partial<DppRegistration>)[]
|
|
8342
|
+
}
|
|
8343
|
+
```
|
|
8344
|
+
|
|
8345
|
+
**DppDocument** (interface)
|
|
8346
|
+
```typescript
|
|
8347
|
+
interface DppDocument {
|
|
8348
|
+
digitalProductPassportId: string
|
|
8349
|
+
uniqueProductIdentifier: string
|
|
8350
|
+
granularity: string
|
|
8351
|
+
dppStatus: string
|
|
8352
|
+
lastUpdate: string
|
|
8353
|
+
contentSpecificationIds: string[]
|
|
8354
|
+
[field: string]: unknown
|
|
8355
|
+
}
|
|
8356
|
+
```
|
|
8357
|
+
|
|
8358
|
+
**DppEnvironment** = `"acc" | "prod" | "practice" | "local" | (string & {})`
|
|
8359
|
+
|
|
8360
|
+
**DppGranularity** = `"item" | "batch" | "model"`
|
|
8361
|
+
|
|
8362
|
+
**DppRegistryNextStep** = `"make-key" | "enter-service-account" | "enter-organisation-id" | "check" | "enrol-practice" | null`
|
|
8363
|
+
|
|
8364
|
+
**DppFields** = `Record<string, unknown>`
|
|
8365
|
+
|
|
8107
8366
|
### error
|
|
8108
8367
|
|
|
8109
8368
|
**ErrorResponse** (interface)
|
|
@@ -13333,36 +13592,36 @@ interface GuideStartOptions {
|
|
|
13333
13592
|
|
|
13334
13593
|
**AppConfigOptions** (type)
|
|
13335
13594
|
```typescript
|
|
13336
|
-
type AppConfigOptions = {
|
|
13337
|
-
/** The app ID */
|
|
13338
|
-
appId: string
|
|
13339
|
-
|
|
13340
|
-
/** Collection ID (required for most operations) */
|
|
13341
|
-
collectionId?: string
|
|
13342
|
-
/** Product ID (optional - for product-scoped config) */
|
|
13343
|
-
productId?: string
|
|
13344
|
-
/** Variant ID (optional - for variant-scoped config) */
|
|
13345
|
-
variantId?: string
|
|
13346
|
-
/** Batch ID (optional - for batch-scoped config) */
|
|
13347
|
-
batchId?: string
|
|
13348
|
-
|
|
13349
|
-
/** Item ID - required for getDataItem/deleteDataItem */
|
|
13350
|
-
itemId?: string
|
|
13351
|
-
|
|
13352
|
-
/**
|
|
13353
|
-
* Use admin endpoints instead of public.
|
|
13354
|
-
* This selects which endpoint is called; it does not by itself make root-level config fields private.
|
|
13355
|
-
*/
|
|
13356
|
-
admin?: boolean
|
|
13357
|
-
|
|
13358
|
-
/**
|
|
13359
|
-
* Configuration object for setConfig.
|
|
13360
|
-
* For admin-only values in app config, store them under a top-level `admin` object.
|
|
13361
|
-
* Public reads return the root config but omit `config.admin`.
|
|
13362
|
-
*/
|
|
13363
|
-
config?: any
|
|
13364
|
-
/** Data object for setDataItem. Best for small keyed scoped documents rather than richer app domain objects. */
|
|
13365
|
-
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
|
|
13366
13625
|
}
|
|
13367
13626
|
```
|
|
13368
13627
|
|
|
@@ -13786,70 +14045,70 @@ Fire-and-forget tag analytics event. Uses `navigator.sendBeacon()` when availabl
|
|
|
13786
14045
|
|
|
13787
14046
|
Workflow-oriented app objects for issues, requests, claims, and tasks that move through statuses and often need assignment or history.
|
|
13788
14047
|
|
|
13789
|
-
**create**(collectionId: string,
|
|
13790
|
-
appId: string,
|
|
13791
|
-
input: CreateCaseInput,
|
|
14048
|
+
**create**(collectionId: string,
|
|
14049
|
+
appId: string,
|
|
14050
|
+
input: CreateCaseInput,
|
|
13792
14051
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13793
14052
|
Create a new case POST /cases
|
|
13794
14053
|
|
|
13795
|
-
**list**(collectionId: string,
|
|
13796
|
-
appId: string,
|
|
13797
|
-
params?: CaseListQueryParams,
|
|
14054
|
+
**list**(collectionId: string,
|
|
14055
|
+
appId: string,
|
|
14056
|
+
params?: CaseListQueryParams,
|
|
13798
14057
|
admin: boolean = false) → `Promise<PaginatedResponse<AppCase>>`
|
|
13799
14058
|
List cases with optional query parameters GET /cases
|
|
13800
14059
|
|
|
13801
|
-
**get**(collectionId: string,
|
|
13802
|
-
appId: string,
|
|
13803
|
-
caseId: string,
|
|
14060
|
+
**get**(collectionId: string,
|
|
14061
|
+
appId: string,
|
|
14062
|
+
caseId: string,
|
|
13804
14063
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13805
14064
|
Get a single case by ID GET /cases/:caseId
|
|
13806
14065
|
|
|
13807
|
-
**update**(collectionId: string,
|
|
13808
|
-
appId: string,
|
|
13809
|
-
caseId: string,
|
|
13810
|
-
input: UpdateCaseInput,
|
|
14066
|
+
**update**(collectionId: string,
|
|
14067
|
+
appId: string,
|
|
14068
|
+
caseId: string,
|
|
14069
|
+
input: UpdateCaseInput,
|
|
13811
14070
|
admin: boolean = false) → `Promise<AppCase>`
|
|
13812
14071
|
Update a case PATCH /cases/:caseId Admin can update any field, public (owner) can only update data and owner zones
|
|
13813
14072
|
|
|
13814
|
-
**remove**(collectionId: string,
|
|
13815
|
-
appId: string,
|
|
13816
|
-
caseId: string,
|
|
14073
|
+
**remove**(collectionId: string,
|
|
14074
|
+
appId: string,
|
|
14075
|
+
caseId: string,
|
|
13817
14076
|
admin: boolean = false) → `Promise<`
|
|
13818
14077
|
Soft delete a case DELETE /cases/:caseId
|
|
13819
14078
|
|
|
13820
|
-
**aggregate**(collectionId: string,
|
|
13821
|
-
appId: string,
|
|
13822
|
-
request: AggregateRequest,
|
|
14079
|
+
**aggregate**(collectionId: string,
|
|
14080
|
+
appId: string,
|
|
14081
|
+
request: AggregateRequest,
|
|
13823
14082
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
13824
14083
|
Get aggregate statistics for cases POST /cases/aggregate
|
|
13825
14084
|
|
|
13826
|
-
**summary**(collectionId: string,
|
|
13827
|
-
appId: string,
|
|
14085
|
+
**summary**(collectionId: string,
|
|
14086
|
+
appId: string,
|
|
13828
14087
|
request?: CaseSummaryRequest) → `Promise<CaseSummaryResponse>`
|
|
13829
14088
|
Get case summary (admin only) POST /cases/summary
|
|
13830
14089
|
|
|
13831
|
-
**appendHistory**(collectionId: string,
|
|
13832
|
-
appId: string,
|
|
13833
|
-
caseId: string,
|
|
14090
|
+
**appendHistory**(collectionId: string,
|
|
14091
|
+
appId: string,
|
|
14092
|
+
caseId: string,
|
|
13834
14093
|
input: AppendHistoryInput) → `Promise<AppCase>`
|
|
13835
14094
|
Append an entry to case history (admin only) POST /cases/:caseId/history
|
|
13836
14095
|
|
|
13837
|
-
**related**(collectionId: string,
|
|
13838
|
-
appId: string,
|
|
14096
|
+
**related**(collectionId: string,
|
|
14097
|
+
appId: string,
|
|
13839
14098
|
caseId: string) → `Promise<RelatedResponse>`
|
|
13840
14099
|
Get related threads and records for a case (admin only) GET /cases/:caseId/related
|
|
13841
14100
|
|
|
13842
14101
|
### app.options
|
|
13843
14102
|
|
|
13844
|
-
**get**(collectionId: string,
|
|
13845
|
-
appId: string,
|
|
13846
|
-
source: string,
|
|
14103
|
+
**get**(collectionId: string,
|
|
14104
|
+
appId: string,
|
|
14105
|
+
source: string,
|
|
13847
14106
|
opts: { q?: string; version?: string; admin?: boolean } = {},) → `Promise<import('../types/appOptions').AppOptionsResponse>`
|
|
13848
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.
|
|
13849
14108
|
|
|
13850
|
-
**saveList**(collectionId: string,
|
|
13851
|
-
appId: string,
|
|
13852
|
-
listId: string,
|
|
14109
|
+
**saveList**(collectionId: string,
|
|
14110
|
+
appId: string,
|
|
14111
|
+
listId: string,
|
|
13853
14112
|
values: import('../types/appOptions') → `void`
|
|
13854
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.
|
|
13855
14114
|
|
|
@@ -13857,92 +14116,92 @@ Save a value list's values, in order (admins). Codes never change and are never
|
|
|
13857
14116
|
|
|
13858
14117
|
General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
|
|
13859
14118
|
|
|
13860
|
-
**create**(collectionId: string,
|
|
13861
|
-
appId: string,
|
|
13862
|
-
input: CreateRecordInput,
|
|
14119
|
+
**create**(collectionId: string,
|
|
14120
|
+
appId: string,
|
|
14121
|
+
input: CreateRecordInput,
|
|
13863
14122
|
admin: boolean = false) → `Promise<CreateRecordResponse>`
|
|
13864
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.
|
|
13865
14124
|
|
|
13866
|
-
**query**(collectionId: string,
|
|
13867
|
-
appId: string,
|
|
14125
|
+
**query**(collectionId: string,
|
|
14126
|
+
appId: string,
|
|
13868
14127
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
13869
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' } }, }) ```
|
|
13870
14129
|
|
|
13871
14130
|
**queryFields**(collectionId: string, appId: string) → `Promise<QueryDescription>`
|
|
13872
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
|
|
13873
14132
|
|
|
13874
|
-
**list**(collectionId: string,
|
|
13875
|
-
appId: string,
|
|
13876
|
-
params?: RecordListQueryParams,
|
|
14133
|
+
**list**(collectionId: string,
|
|
14134
|
+
appId: string,
|
|
14135
|
+
params?: RecordListQueryParams,
|
|
13877
14136
|
admin: boolean = false) → `Promise<PaginatedResponse<AppRecord>>`
|
|
13878
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`).
|
|
13879
14138
|
|
|
13880
|
-
**get**(collectionId: string,
|
|
13881
|
-
appId: string,
|
|
13882
|
-
recordId: string,
|
|
14139
|
+
**get**(collectionId: string,
|
|
14140
|
+
appId: string,
|
|
14141
|
+
recordId: string,
|
|
13883
14142
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
13884
14143
|
Get a single record by ID GET /records/:recordId
|
|
13885
14144
|
|
|
13886
|
-
**update**(collectionId: string,
|
|
13887
|
-
appId: string,
|
|
13888
|
-
recordId: string,
|
|
13889
|
-
input: UpdateRecordInput,
|
|
14145
|
+
**update**(collectionId: string,
|
|
14146
|
+
appId: string,
|
|
14147
|
+
recordId: string,
|
|
14148
|
+
input: UpdateRecordInput,
|
|
13890
14149
|
admin: boolean = false) → `Promise<AppRecord>`
|
|
13891
14150
|
Update a record PATCH /records/:recordId Admin can update any field, public (owner) can only update data and owner
|
|
13892
14151
|
|
|
13893
|
-
**updateWithToken**(collectionId: string,
|
|
13894
|
-
appId: string,
|
|
13895
|
-
recordId: string,
|
|
13896
|
-
data: Record<string, unknown>,
|
|
14152
|
+
**updateWithToken**(collectionId: string,
|
|
14153
|
+
appId: string,
|
|
14154
|
+
recordId: string,
|
|
14155
|
+
data: Record<string, unknown>,
|
|
13897
14156
|
editToken: string) → `Promise<AppRecord>`
|
|
13898
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 |
|
|
13899
14158
|
|
|
13900
|
-
**remove**(collectionId: string,
|
|
13901
|
-
appId: string,
|
|
13902
|
-
recordId: string,
|
|
14159
|
+
**remove**(collectionId: string,
|
|
14160
|
+
appId: string,
|
|
14161
|
+
recordId: string,
|
|
13903
14162
|
admin: boolean = false) → `Promise<`
|
|
13904
14163
|
Soft delete a record DELETE /records/:recordId
|
|
13905
14164
|
|
|
13906
|
-
**aggregate**(collectionId: string,
|
|
13907
|
-
appId: string,
|
|
13908
|
-
request: AggregateRequest,
|
|
14165
|
+
**aggregate**(collectionId: string,
|
|
14166
|
+
appId: string,
|
|
14167
|
+
request: AggregateRequest,
|
|
13909
14168
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
13910
14169
|
Get aggregate statistics for records POST /records/aggregate
|
|
13911
14170
|
|
|
13912
|
-
**restore**(collectionId: string,
|
|
13913
|
-
appId: string,
|
|
14171
|
+
**restore**(collectionId: string,
|
|
14172
|
+
appId: string,
|
|
13914
14173
|
recordId: string) → `Promise<AppRecord>`
|
|
13915
14174
|
Restore a soft-deleted record. POST /records/:recordId/restore (admin only)
|
|
13916
14175
|
|
|
13917
|
-
**upsert**(collectionId: string,
|
|
13918
|
-
appId: string,
|
|
14176
|
+
**upsert**(collectionId: string,
|
|
14177
|
+
appId: string,
|
|
13919
14178
|
input: UpsertRecordInput) → `Promise<UpsertRecordResponse>`
|
|
13920
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)
|
|
13921
14180
|
|
|
13922
|
-
**match**(collectionId: string,
|
|
13923
|
-
appId: string,
|
|
13924
|
-
input: MatchRecordsInput,
|
|
14181
|
+
**match**(collectionId: string,
|
|
14182
|
+
appId: string,
|
|
14183
|
+
input: MatchRecordsInput,
|
|
13925
14184
|
admin: boolean = false) → `Promise<MatchResult>`
|
|
13926
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 ```
|
|
13927
14186
|
|
|
13928
|
-
**bulkUpsert**(collectionId: string,
|
|
13929
|
-
appId: string,
|
|
14187
|
+
**bulkUpsert**(collectionId: string,
|
|
14188
|
+
appId: string,
|
|
13930
14189
|
records: BulkUpsertItem[]) → `Promise<BulkUpsertResult>`
|
|
13931
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)
|
|
13932
14191
|
|
|
13933
|
-
**bulkDelete**(collectionId: string,
|
|
13934
|
-
appId: string,
|
|
14192
|
+
**bulkDelete**(collectionId: string,
|
|
14193
|
+
appId: string,
|
|
13935
14194
|
input: BulkDeleteInput) → `Promise<BulkDeleteResult>`
|
|
13936
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' }, }); ```
|
|
13937
14196
|
|
|
13938
|
-
**resolveAll**(collectionId: string,
|
|
13939
|
-
appId: string,
|
|
13940
|
-
input: ResolveAllParams,
|
|
14197
|
+
**resolveAll**(collectionId: string,
|
|
14198
|
+
appId: string,
|
|
14199
|
+
input: ResolveAllParams,
|
|
13941
14200
|
admin: boolean = false) → `Promise<ResolveAllResult>`
|
|
13942
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
|
|
13943
14202
|
|
|
13944
|
-
**previewRule**(collectionId: string,
|
|
13945
|
-
appId: string,
|
|
14203
|
+
**previewRule**(collectionId: string,
|
|
14204
|
+
appId: string,
|
|
13946
14205
|
input: PreviewRuleParams) → `Promise<PreviewRuleResult>`
|
|
13947
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
|
|
13948
14207
|
|
|
@@ -13950,54 +14209,54 @@ Preview which products in the collection match a given facetRule. Admin only. Us
|
|
|
13950
14209
|
|
|
13951
14210
|
Conversation-oriented app objects for comments, discussions, Q&A, and reply-driven experiences.
|
|
13952
14211
|
|
|
13953
|
-
**create**(collectionId: string,
|
|
13954
|
-
appId: string,
|
|
13955
|
-
input: CreateThreadInput,
|
|
14212
|
+
**create**(collectionId: string,
|
|
14213
|
+
appId: string,
|
|
14214
|
+
input: CreateThreadInput,
|
|
13956
14215
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13957
14216
|
Create a new thread POST /threads
|
|
13958
14217
|
|
|
13959
|
-
**list**(collectionId: string,
|
|
13960
|
-
appId: string,
|
|
13961
|
-
params?: ThreadListQueryParams,
|
|
14218
|
+
**list**(collectionId: string,
|
|
14219
|
+
appId: string,
|
|
14220
|
+
params?: ThreadListQueryParams,
|
|
13962
14221
|
admin: boolean = false) → `Promise<PaginatedResponse<AppThread>>`
|
|
13963
14222
|
List threads with optional query parameters GET /threads
|
|
13964
14223
|
|
|
13965
|
-
**get**(collectionId: string,
|
|
13966
|
-
appId: string,
|
|
13967
|
-
threadId: string,
|
|
14224
|
+
**get**(collectionId: string,
|
|
14225
|
+
appId: string,
|
|
14226
|
+
threadId: string,
|
|
13968
14227
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13969
14228
|
Get a single thread by ID GET /threads/:threadId
|
|
13970
14229
|
|
|
13971
|
-
**update**(collectionId: string,
|
|
13972
|
-
appId: string,
|
|
13973
|
-
threadId: string,
|
|
13974
|
-
input: UpdateThreadInput,
|
|
14230
|
+
**update**(collectionId: string,
|
|
14231
|
+
appId: string,
|
|
14232
|
+
threadId: string,
|
|
14233
|
+
input: UpdateThreadInput,
|
|
13975
14234
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13976
14235
|
Update a thread PATCH /threads/:threadId Admin can update any field, public (owner) can only update body, tags, data, owner
|
|
13977
14236
|
|
|
13978
|
-
**remove**(collectionId: string,
|
|
13979
|
-
appId: string,
|
|
13980
|
-
threadId: string,
|
|
14237
|
+
**remove**(collectionId: string,
|
|
14238
|
+
appId: string,
|
|
14239
|
+
threadId: string,
|
|
13981
14240
|
admin: boolean = false) → `Promise<`
|
|
13982
14241
|
Soft delete a thread DELETE /threads/:threadId
|
|
13983
14242
|
|
|
13984
|
-
**reply**(collectionId: string,
|
|
13985
|
-
appId: string,
|
|
13986
|
-
threadId: string,
|
|
13987
|
-
input: ReplyInput,
|
|
14243
|
+
**reply**(collectionId: string,
|
|
14244
|
+
appId: string,
|
|
14245
|
+
threadId: string,
|
|
14246
|
+
input: ReplyInput,
|
|
13988
14247
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13989
14248
|
Add a reply to a thread POST /threads/:threadId/reply Atomically appends to replies array, increments replyCount, updates lastReplyAt
|
|
13990
14249
|
|
|
13991
|
-
**deleteReply**(collectionId: string,
|
|
13992
|
-
appId: string,
|
|
13993
|
-
threadId: string,
|
|
13994
|
-
replyId: string,
|
|
14250
|
+
**deleteReply**(collectionId: string,
|
|
14251
|
+
appId: string,
|
|
14252
|
+
threadId: string,
|
|
14253
|
+
replyId: string,
|
|
13995
14254
|
admin: boolean = false) → `Promise<AppThread>`
|
|
13996
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.
|
|
13997
14256
|
|
|
13998
|
-
**aggregate**(collectionId: string,
|
|
13999
|
-
appId: string,
|
|
14000
|
-
request: AggregateRequest,
|
|
14257
|
+
**aggregate**(collectionId: string,
|
|
14258
|
+
appId: string,
|
|
14259
|
+
request: AggregateRequest,
|
|
14001
14260
|
admin: boolean = false) → `Promise<AggregateResponse>`
|
|
14002
14261
|
Get aggregate statistics for threads POST /threads/aggregate
|
|
14003
14262
|
|
|
@@ -14032,19 +14291,19 @@ Set/create a keyed data item within a scope. Requires admin authentication. Use
|
|
|
14032
14291
|
**deleteDataItem**(opts: AppConfigOptions) → `Promise<void>`
|
|
14033
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' }); ```
|
|
14034
14293
|
|
|
14035
|
-
**getWidgets**(collectionId: string,
|
|
14294
|
+
**getWidgets**(collectionId: string,
|
|
14036
14295
|
options?: GetCollectionWidgetsOptions) → `Promise<CollectionWidgetsResponse>`
|
|
14037
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 }); ```
|
|
14038
14297
|
|
|
14039
14298
|
**resolveFeature**(system: SystemBlock | undefined, flag: string) → `boolean`
|
|
14040
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'); ```
|
|
14041
14300
|
|
|
14042
|
-
**getAppConfig**(collectionId: string,
|
|
14301
|
+
**getAppConfig**(collectionId: string,
|
|
14043
14302
|
options?: { force?: boolean }) → `Promise<AppsConfigResponse>`
|
|
14044
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); ```
|
|
14045
14304
|
|
|
14046
|
-
**isFeatureEnabled**(collectionId: string,
|
|
14047
|
-
flag: string,
|
|
14305
|
+
**isFeatureEnabled**(collectionId: string,
|
|
14306
|
+
flag: string,
|
|
14048
14307
|
options?: { force?: boolean }) → `Promise<boolean>`
|
|
14049
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(); } ```
|
|
14050
14309
|
|
|
@@ -14679,13 +14938,13 @@ Delete a slot (admin; refused while places are booked).
|
|
|
14679
14938
|
|
|
14680
14939
|
### chat.completions
|
|
14681
14940
|
|
|
14682
|
-
**create**(collectionId: string,
|
|
14941
|
+
**create**(collectionId: string,
|
|
14683
14942
|
request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
|
|
14684
14943
|
Create a chat completion (streaming or non-streaming)
|
|
14685
14944
|
|
|
14686
14945
|
### chat.responses
|
|
14687
14946
|
|
|
14688
|
-
**create**(collectionId: string,
|
|
14947
|
+
**create**(collectionId: string,
|
|
14689
14948
|
request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
|
|
14690
14949
|
Create a Responses API request (streaming or non-streaming)
|
|
14691
14950
|
|
|
@@ -14861,86 +15120,86 @@ Invite a user to a collection by email (admin only). Creates or links their acco
|
|
|
14861
15120
|
**getPushVapidPublicKey**(collectionId: string) → `Promise<import("../types/comms").PushVapidResponse>`
|
|
14862
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.
|
|
14863
15122
|
|
|
14864
|
-
**registerPush**(collectionId: string,
|
|
15123
|
+
**registerPush**(collectionId: string,
|
|
14865
15124
|
body: import("../types/comms") → `void`
|
|
14866
15125
|
Public: Register a Web Push subscription under unified comms. POST /public/collection/:collectionId/comm/push/register
|
|
14867
15126
|
|
|
14868
|
-
**getSettings**(collectionId: string,
|
|
15127
|
+
**getSettings**(collectionId: string,
|
|
14869
15128
|
opts: { includeSecret?: boolean } = {}) → `Promise<import("../types/comms").CommsSettingsGetResponse>`
|
|
14870
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.
|
|
14871
15130
|
|
|
14872
|
-
**patchSettings**(collectionId: string,
|
|
15131
|
+
**patchSettings**(collectionId: string,
|
|
14873
15132
|
body: import("../types/comms") → `void`
|
|
14874
15133
|
Admin: Patch comms settings for a collection. PATCH /admin/collection/:collectionId/comm.settings
|
|
14875
15134
|
|
|
14876
15135
|
**getPublicTopics**(collectionId: string) → `Promise<import("../types/comms").CommsPublicTopicsResponse>`
|
|
14877
15136
|
Public: Fetch configured topics for a collection. GET /public/collection/:collectionId/comm/topics
|
|
14878
15137
|
|
|
14879
|
-
**unsubscribe**(collectionId: string,
|
|
15138
|
+
**unsubscribe**(collectionId: string,
|
|
14880
15139
|
query: import("../types/comms") → `void`
|
|
14881
15140
|
Public: Unsubscribe a contact from a category or channel. GET /public/collection/:collectionId/comm/unsubscribe
|
|
14882
15141
|
|
|
14883
|
-
**signup**(collectionId: string,
|
|
15142
|
+
**signup**(collectionId: string,
|
|
14884
15143
|
body: import("../types/comms") → `void`
|
|
14885
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
|
|
14886
15145
|
|
|
14887
|
-
**upsertConsent**(collectionId: string,
|
|
15146
|
+
**upsertConsent**(collectionId: string,
|
|
14888
15147
|
body: import("../types/comms") → `void`
|
|
14889
15148
|
Public: Upsert default consent for a contact. POST /public/collection/:collectionId/comm/consent
|
|
14890
15149
|
|
|
14891
|
-
**upsertPreferences**(collectionId: string,
|
|
15150
|
+
**upsertPreferences**(collectionId: string,
|
|
14892
15151
|
body: import("../types/comms") → `void`
|
|
14893
15152
|
Public: Upsert preferences for a specific subject (or default if subject omitted). POST /public/collection/:collectionId/comm/preferences
|
|
14894
15153
|
|
|
14895
|
-
**subscribe**(collectionId: string,
|
|
15154
|
+
**subscribe**(collectionId: string,
|
|
14896
15155
|
body: import("../types/comms") → `void`
|
|
14897
15156
|
Public: Subscribe/unsubscribe contact to a subject. POST /public/collection/:collectionId/comm/subscribe
|
|
14898
15157
|
|
|
14899
|
-
**checkSubscription**(collectionId: string,
|
|
15158
|
+
**checkSubscription**(collectionId: string,
|
|
14900
15159
|
query: import("../types/comms") → `void`
|
|
14901
15160
|
Public: Check subscription status for a subject. GET /public/collection/:collectionId/comm/subscription/check
|
|
14902
15161
|
|
|
14903
|
-
**listMethods**(collectionId: string,
|
|
15162
|
+
**listMethods**(collectionId: string,
|
|
14904
15163
|
query: import("../types/comms") → `void`
|
|
14905
15164
|
Public: List registered contact methods. GET /public/collection/:collectionId/comm/methods
|
|
14906
15165
|
|
|
14907
|
-
**registerEmail**(collectionId: string,
|
|
15166
|
+
**registerEmail**(collectionId: string,
|
|
14908
15167
|
body: import("../types/comms") → `void`
|
|
14909
15168
|
Public: Register email method for a contact. POST /public/collection/:collectionId/comm/email/register
|
|
14910
15169
|
|
|
14911
|
-
**registerSms**(collectionId: string,
|
|
15170
|
+
**registerSms**(collectionId: string,
|
|
14912
15171
|
body: import("../types/comms") → `void`
|
|
14913
15172
|
Public: Register SMS method for a contact. POST /public/collection/:collectionId/comm/sms/register
|
|
14914
15173
|
|
|
14915
|
-
**resolveSubscriptions**(collectionId: string,
|
|
15174
|
+
**resolveSubscriptions**(collectionId: string,
|
|
14916
15175
|
body: import("../types/comms") → `void`
|
|
14917
15176
|
Public: Resolve contacts for a subject with identity hints. POST /public/collection/:collectionId/comm/subscriptions/resolve
|
|
14918
15177
|
|
|
14919
|
-
**queryByUser**(collectionId: string,
|
|
15178
|
+
**queryByUser**(collectionId: string,
|
|
14920
15179
|
body: CommsQueryByUser = {}) → `Promise<CommunicationEvent[]>`
|
|
14921
15180
|
Analytics: Query communication events by user or contact. POST /admin/collection/:collectionId/comm/query/by-user
|
|
14922
15181
|
|
|
14923
|
-
**queryRecipientIds**(collectionId: string,
|
|
15182
|
+
**queryRecipientIds**(collectionId: string,
|
|
14924
15183
|
body: CommsRecipientIdsQuery) → `Promise<RecipientId[]>`
|
|
14925
15184
|
Analytics: Recipient IDs for a communication source. POST /admin/collection/:collectionId/comm/query/recipient-ids
|
|
14926
15185
|
|
|
14927
|
-
**queryRecipientsWithoutAction**(collectionId: string,
|
|
15186
|
+
**queryRecipientsWithoutAction**(collectionId: string,
|
|
14928
15187
|
body: CommsRecipientsWithoutActionQuery) → `Promise<RecipientId[]>`
|
|
14929
15188
|
Analytics: Recipients who did not perform an action. POST /admin/collection/:collectionId/comm/query/recipients/without-action
|
|
14930
15189
|
|
|
14931
|
-
**queryRecipientsWithAction**(collectionId: string,
|
|
15190
|
+
**queryRecipientsWithAction**(collectionId: string,
|
|
14932
15191
|
body: CommsRecipientsWithActionQuery) → `Promise<RecipientId[] | RecipientWithOutcome[]>`
|
|
14933
15192
|
Analytics: Recipients who performed an action, optionally with outcome. POST /admin/collection/:collectionId/comm/query/recipients/with-action
|
|
14934
15193
|
|
|
14935
|
-
**sendTransactional**(collectionId: string,
|
|
15194
|
+
**sendTransactional**(collectionId: string,
|
|
14936
15195
|
body: TransactionalSendRequest) → `Promise<TransactionalSendResult>`
|
|
14937
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) } ```
|
|
14938
15197
|
|
|
14939
|
-
**logCommunicationEvent**(collectionId: string,
|
|
15198
|
+
**logCommunicationEvent**(collectionId: string,
|
|
14940
15199
|
body: LogCommunicationEventBody) → `Promise<AppendResult>`
|
|
14941
15200
|
Logging: Append a single communication event. POST /admin/collection/:collectionId/comm/log
|
|
14942
15201
|
|
|
14943
|
-
**logBulkCommunicationEvents**(collectionId: string,
|
|
15202
|
+
**logBulkCommunicationEvents**(collectionId: string,
|
|
14944
15203
|
body: LogBulkCommunicationEventsBody | ({ sourceId: string; ids: string[]; idField?: 'userId'|'contactId'; [k: string]: any }) → `void`
|
|
14945
15204
|
Logging: Append many communication events for a list of IDs. POST /admin/collection/:collectionId/comm/log/bulk
|
|
14946
15205
|
|
|
@@ -14971,7 +15230,7 @@ Returns all proof type definitions. Proof types are templates that specify which
|
|
|
14971
15230
|
|
|
14972
15231
|
### contact
|
|
14973
15232
|
|
|
14974
|
-
**query**(collectionId: string,
|
|
15233
|
+
**query**(collectionId: string,
|
|
14975
15234
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
14976
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 } } }) ```
|
|
14977
15236
|
|
|
@@ -14981,62 +15240,62 @@ What a contacts query can use: its fields and what each can filter, sort, group
|
|
|
14981
15240
|
**create**(collectionId: string, data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
14982
15241
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14983
15242
|
|
|
14984
|
-
**list**(collectionId: string,
|
|
15243
|
+
**list**(collectionId: string,
|
|
14985
15244
|
params?: { limit?: number; offset?: number; includeDeleted?: boolean }) → `Promise<ContactListResponse>`
|
|
14986
15245
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
14987
15246
|
|
|
14988
|
-
**search**({
|
|
14989
|
-
collectionId,
|
|
14990
|
-
q,
|
|
14991
|
-
typeahead,
|
|
14992
|
-
email,
|
|
14993
|
-
phone,
|
|
14994
|
-
id,
|
|
14995
|
-
userId,
|
|
14996
|
-
tags,
|
|
14997
|
-
tagsAll,
|
|
14998
|
-
source,
|
|
14999
|
-
locale,
|
|
15000
|
-
createdFrom,
|
|
15001
|
-
createdTo,
|
|
15002
|
-
externalIdKey,
|
|
15003
|
-
externalIdValue,
|
|
15004
|
-
customFieldKey,
|
|
15005
|
-
customFieldValue,
|
|
15006
|
-
limit,
|
|
15007
|
-
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,
|
|
15008
15267
|
}: ContactSearchParams) → `Promise<ContactSearchResponse>`
|
|
15009
15268
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15010
15269
|
|
|
15011
|
-
**get**(collectionId: string,
|
|
15012
|
-
contactId: string,
|
|
15270
|
+
**get**(collectionId: string,
|
|
15271
|
+
contactId: string,
|
|
15013
15272
|
params?: { includeDeleted?: boolean }) → `Promise<ContactResponse>`
|
|
15014
15273
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15015
15274
|
|
|
15016
|
-
**update**(collectionId: string,
|
|
15017
|
-
contactId: string,
|
|
15275
|
+
**update**(collectionId: string,
|
|
15276
|
+
contactId: string,
|
|
15018
15277
|
data: ContactUpdateRequest) → `Promise<ContactResponse>`
|
|
15019
15278
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15020
15279
|
|
|
15021
15280
|
**remove**(collectionId: string, contactId: string) → `Promise<void>`
|
|
15022
15281
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15023
15282
|
|
|
15024
|
-
**lookup**(collectionId: string,
|
|
15283
|
+
**lookup**(collectionId: string,
|
|
15025
15284
|
params: { email?: string; phone?: string }) → `Promise<ContactResponse>`
|
|
15026
15285
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15027
15286
|
|
|
15028
|
-
**upsert**(collectionId: string,
|
|
15287
|
+
**upsert**(collectionId: string,
|
|
15029
15288
|
data: ContactCreateRequest) → `Promise<ContactResponse>`
|
|
15030
15289
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15031
15290
|
|
|
15032
|
-
**publicUpsert**(collectionId: string,
|
|
15291
|
+
**publicUpsert**(collectionId: string,
|
|
15033
15292
|
data: PublicContactUpsertRequest) → `Promise<PublicContactUpsertResponse>`
|
|
15034
15293
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15035
15294
|
|
|
15036
15295
|
**publicGetMine**(collectionId: string) → `Promise<PublicGetMyContactResponse>`
|
|
15037
15296
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15038
15297
|
|
|
15039
|
-
**publicUpdateMine**(collectionId: string,
|
|
15298
|
+
**publicUpdateMine**(collectionId: string,
|
|
15040
15299
|
data: ContactPatch) → `Promise<PublicUpdateMyContactResponse>`
|
|
15041
15300
|
What a contacts query can use: its fields and what each can filter, sort, group or total. GET /admin/collection/:collectionId/contacts/query
|
|
15042
15301
|
|
|
@@ -15046,77 +15305,77 @@ Public: Get the contact schema for a collection. GET /public/collection/:collect
|
|
|
15046
15305
|
**erase**(collectionId: string, contactId: string, body?: any) → `Promise<ContactResponse>`
|
|
15047
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 }) } ```
|
|
15048
15307
|
|
|
15049
|
-
**findDuplicates**(collectionId: string,
|
|
15308
|
+
**findDuplicates**(collectionId: string,
|
|
15050
15309
|
params?: { limit?: number; offset?: number }) → `Promise<ContactDuplicatesResponse>`
|
|
15051
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) } ```
|
|
15052
15311
|
|
|
15053
|
-
**merge**(collectionId: string,
|
|
15054
|
-
keepContactId: string,
|
|
15312
|
+
**merge**(collectionId: string,
|
|
15313
|
+
keepContactId: string,
|
|
15055
15314
|
fromContactId: string) → `Promise<ContactMergeResponse>`
|
|
15056
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`).
|
|
15057
15316
|
|
|
15058
|
-
**linkLogin**(collectionId: string,
|
|
15317
|
+
**linkLogin**(collectionId: string,
|
|
15059
15318
|
userId: string) → `Promise<ContactLinkLoginResponse>`
|
|
15060
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 } ```
|
|
15061
15320
|
|
|
15062
|
-
**getUser**(collectionId: string,
|
|
15321
|
+
**getUser**(collectionId: string,
|
|
15063
15322
|
userId: string,) → `Promise<UserSearchResponse>`
|
|
15064
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 } ```
|
|
15065
15324
|
|
|
15066
15325
|
### containers
|
|
15067
15326
|
|
|
15068
|
-
**create**(collectionId: string,
|
|
15327
|
+
**create**(collectionId: string,
|
|
15069
15328
|
data: CreateContainerInput) → `Promise<Container>`
|
|
15070
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 }, }) ```
|
|
15071
15330
|
|
|
15072
|
-
**list**(collectionId: string,
|
|
15331
|
+
**list**(collectionId: string,
|
|
15073
15332
|
params?: ListContainersParams) → `Promise<ListContainersResponse>`
|
|
15074
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 }) ```
|
|
15075
15334
|
|
|
15076
|
-
**findForItem**(collectionId: string,
|
|
15335
|
+
**findForItem**(collectionId: string,
|
|
15077
15336
|
params: FindContainersForItemParams) → `Promise<FindContainersForItemResponse>`
|
|
15078
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', }) ```
|
|
15079
15338
|
|
|
15080
|
-
**get**(collectionId: string,
|
|
15081
|
-
containerId: string,
|
|
15339
|
+
**get**(collectionId: string,
|
|
15340
|
+
containerId: string,
|
|
15082
15341
|
params?: GetContainerParams) → `Promise<Container>`
|
|
15083
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, }) ```
|
|
15084
15343
|
|
|
15085
|
-
**update**(collectionId: string,
|
|
15086
|
-
containerId: string,
|
|
15344
|
+
**update**(collectionId: string,
|
|
15345
|
+
containerId: string,
|
|
15087
15346
|
data: UpdateContainerInput) → `Promise<Container>`
|
|
15088
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' }, }) ```
|
|
15089
15348
|
|
|
15090
|
-
**remove**(collectionId: string,
|
|
15349
|
+
**remove**(collectionId: string,
|
|
15091
15350
|
containerId: string) → `Promise<`
|
|
15092
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.
|
|
15093
15352
|
|
|
15094
|
-
**listItems**(collectionId: string,
|
|
15095
|
-
containerId: string,
|
|
15353
|
+
**listItems**(collectionId: string,
|
|
15354
|
+
containerId: string,
|
|
15096
15355
|
params?: ListContainerItemsParams) → `Promise<ContainerItemsResponse>`
|
|
15097
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 }) ```
|
|
15098
15357
|
|
|
15099
|
-
**addItems**(collectionId: string,
|
|
15100
|
-
containerId: string,
|
|
15358
|
+
**addItems**(collectionId: string,
|
|
15359
|
+
containerId: string,
|
|
15101
15360
|
data: AddContainerItemsInput) → `Promise<AddContainerItemsResponse>`
|
|
15102
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' }, ], }) ```
|
|
15103
15362
|
|
|
15104
|
-
**removeItems**(collectionId: string,
|
|
15105
|
-
containerId: string,
|
|
15363
|
+
**removeItems**(collectionId: string,
|
|
15364
|
+
containerId: string,
|
|
15106
15365
|
data: RemoveContainerItemsInput) → `Promise<RemoveContainerItemsResponse>`
|
|
15107
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`) ```
|
|
15108
15367
|
|
|
15109
|
-
**publicList**(collectionId: string,
|
|
15368
|
+
**publicList**(collectionId: string,
|
|
15110
15369
|
params?: ListContainersParams) → `Promise<PublicListContainersResponse>`
|
|
15111
15370
|
List containers (public). Soft-deleted containers and containers with `metadata.publicListing === false` are excluded from results.
|
|
15112
15371
|
|
|
15113
|
-
**publicGet**(collectionId: string,
|
|
15114
|
-
containerId: string,
|
|
15372
|
+
**publicGet**(collectionId: string,
|
|
15373
|
+
containerId: string,
|
|
15115
15374
|
params?: GetContainerParams) → `Promise<Container>`
|
|
15116
15375
|
Get a single container (public). Soft-deleted containers return a 404. Same `?tree` and `?includeContents` options as the admin version.
|
|
15117
15376
|
|
|
15118
|
-
**publicListItems**(collectionId: string,
|
|
15119
|
-
containerId: string,
|
|
15377
|
+
**publicListItems**(collectionId: string,
|
|
15378
|
+
containerId: string,
|
|
15120
15379
|
params?: Pick<ListContainerItemsParams, 'limit' | 'offset'>) → `Promise<ContainerItemsResponse>`
|
|
15121
15380
|
List current contents of a container (public). Returns only items where `removedAt` is null. No `?history` option on the public side.
|
|
15122
15381
|
|
|
@@ -15151,6 +15410,74 @@ Update a crate for a collection (admin only). ```typescript const updated = awai
|
|
|
15151
15410
|
crateId: string) → `Promise<DeleteCrateResponse>`
|
|
15152
15411
|
Delete a crate for a collection (admin only). This performs a soft delete. ```typescript await crate.remove('coll_123', 'crate_abc123') ```
|
|
15153
15412
|
|
|
15413
|
+
### dpp
|
|
15414
|
+
|
|
15415
|
+
**groups**(collectionId: string) → `Promise<DppGroup[]>`
|
|
15416
|
+
What passports can be made: product groups, their kinds, and each view's fields and required fields. GET /dpp/groups
|
|
15417
|
+
|
|
15418
|
+
**read**(collectionId: string, passportId: string, opts: { version?: number } = {}) → `Promise<DppDocument>`
|
|
15419
|
+
Read a passport as the public sees it, at its address (the EU JSON document), or an earlier version of it. No sign-in needed. GET /public/dpp/:collectionId/:passportId
|
|
15420
|
+
|
|
15421
|
+
**register**(collectionId: string, env: DppEnvironment, passportIds: string[], opts: { wait?: boolean } = {}) → `Promise<DppRegisterResult>`
|
|
15422
|
+
Send passports to the EU registry. They're grouped by product group and sent up to 100 at a time; the registry reads each one at its address. Passports still missing required fields, withdrawn or already registered come back in `skipped`. With `wait: true` the call waits (up to ~45 s) and returns each passport's outcome; otherwise follow up with `dpp.tasks.refresh`. POST /dpp/registry/:env/register
|
|
15423
|
+
|
|
15424
|
+
### dpp.passports
|
|
15425
|
+
|
|
15426
|
+
**list**(collectionId: string, q: DppPassportListQuery = {}) → `Promise<DppPassport[]>`
|
|
15427
|
+
GET /dpp/passports
|
|
15428
|
+
|
|
15429
|
+
**get**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15430
|
+
One passport, with `check` (what it's still missing) and its `url`. GET /dpp/passports/:id
|
|
15431
|
+
|
|
15432
|
+
**create**(collectionId: string, input: DppPassportInput & { productGroup: string }) → `Promise<DppPassport>`
|
|
15433
|
+
Make a passport. POST /dpp/passports
|
|
15434
|
+
|
|
15435
|
+
**update**(collectionId: string, passportId: string, input: DppPassportInput, opts: { replace?: boolean } = {}) → `Promise<DppPassportSaveResult>`
|
|
15436
|
+
Change a passport. `public` / `restricted` are merged into what's there unless `replace` is true. A change to what it says makes a new version. PUT /dpp/passports/:id
|
|
15437
|
+
|
|
15438
|
+
**upsert**(collectionId: string, input: DppPassportUpsertInput, opts: { merge?: boolean } = {}) → `Promise<DppPassportUpsertResult>`
|
|
15439
|
+
Publish the passport for a product, batch or item (`productId` / `batchId` / `proofId`) at a granularity: updates the one already there or makes it. The fields replace what's there (pass `merge: true` to merge). Saving the same content again changes nothing. PUT /dpp/passports/by-anchor ```typescript const { passport } = await dpp.passports.upsert(collectionId, { productId, productGroup: 'BATTERIES', productSubGroup: 'EV', granularity: 'model', public: { batteryChemistry: [...], manufacturerIdentification: {...} }, restricted: { dismantlingInformation: [...] }, }) if (!passport.check.ready) console.log('Still missing', passport.check.missing) ```
|
|
15440
|
+
|
|
15441
|
+
**upsertMany**(collectionId: string, items: DppPassportUpsertInput[], opts: { merge?: boolean } = {}) → `Promise<DppPassportBulkResult>`
|
|
15442
|
+
`upsert` for up to 500 passports at once (e.g. one per battery); each answers on its own. POST /dpp/passports/bulk
|
|
15443
|
+
|
|
15444
|
+
**versions**(collectionId: string, passportId: string) → `Promise<DppPassportVersion[]>`
|
|
15445
|
+
Its versions, newest first; read one with `dpp.read(collectionId, id, { version })`. GET /dpp/passports/:id/versions
|
|
15446
|
+
|
|
15447
|
+
**withdraw**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15448
|
+
No longer valid: stays at its address, marked invalid (the registry keeps its record). POST /dpp/passports/:id/withdraw
|
|
15449
|
+
|
|
15450
|
+
**restore**(collectionId: string, passportId: string) → `Promise<DppPassport>`
|
|
15451
|
+
Valid again. POST /dpp/passports/:id/restore
|
|
15452
|
+
|
|
15453
|
+
### dpp.registry
|
|
15454
|
+
|
|
15455
|
+
**list**(collectionId: string) → `Promise<DppRegistry[]>`
|
|
15456
|
+
Both environments, each with `nextStep` (what's left to connect). GET /dpp/registry
|
|
15457
|
+
|
|
15458
|
+
**get**(collectionId: string, env: DppEnvironment) → `Promise<DppRegistry>`
|
|
15459
|
+
One environment. GET /dpp/registry/:env
|
|
15460
|
+
|
|
15461
|
+
**makeKey**(collectionId: string, env: DppEnvironment, opts: { alg?: "ES256" | "ES384" | "ES512" } = {}) → `Promise<DppRegistry>`
|
|
15462
|
+
Make (or replace) the key the brand's Service Account trusts. The private key stays on SmartLinks' servers; show `publicPem` (or `publicJwk`) for the brand to add to its Service Account in the registry. Replacing the key clears `kid` — the registry gives the new key its own. POST /dpp/registry/:env/key
|
|
15463
|
+
|
|
15464
|
+
**set**(collectionId: string, env: DppEnvironment, input: SetDppRegistryInput) → `Promise<DppRegistry>`
|
|
15465
|
+
Save the Service Account's Client ID and key ID, and the brand's Organisation ID, from the registry. PUT /dpp/registry/:env
|
|
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
|
+
|
|
15470
|
+
**check**(collectionId: string, env: DppEnvironment) → `Promise<DppRegistryCheckResult>`
|
|
15471
|
+
Sign in to the registry and read its product groups — proves the connection works. POST /dpp/registry/:env/check
|
|
15472
|
+
|
|
15473
|
+
### dpp.tasks
|
|
15474
|
+
|
|
15475
|
+
**list**(collectionId: string, env: DppEnvironment) → `Promise<DppTask[]>`
|
|
15476
|
+
Requests sent to one environment, newest first. GET /dpp/registry/:env/tasks
|
|
15477
|
+
|
|
15478
|
+
**refresh**(collectionId: string, env: DppEnvironment, taskId: string) → `Promise<DppTaskRefreshResult>`
|
|
15479
|
+
Ask the registry how a request went and record it on its passports. POST /dpp/registry/:env/tasks/:taskId/refresh
|
|
15480
|
+
|
|
15154
15481
|
### errors
|
|
15155
15482
|
|
|
15156
15483
|
**report**(event: ClientErrorReport) → `Promise<`
|
|
@@ -15339,8 +15666,8 @@ Update whitelisted fields. PUT /integrations/flows/:id
|
|
|
15339
15666
|
**deleteFlow**(collectionId: string, id: string) → `Promise<`
|
|
15340
15667
|
Soft-delete a flow. DELETE /integrations/flows/:id
|
|
15341
15668
|
|
|
15342
|
-
**runFlow**(collectionId: string,
|
|
15343
|
-
id: string,
|
|
15669
|
+
**runFlow**(collectionId: string,
|
|
15670
|
+
id: string,
|
|
15344
15671
|
options: RunFlowInput & { async?: boolean } = {}) → `Promise<RunFlowResult>`
|
|
15345
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.
|
|
15346
15673
|
|
|
@@ -15368,8 +15695,8 @@ Is enhanced logging active for a connection? GET /integrations/logging/:connecti
|
|
|
15368
15695
|
**setLogging**(collectionId: string, connectionId: string, input: SetLoggingInput = {}) → `Promise<`
|
|
15369
15696
|
Enable enhanced logging. POST /integrations/logging/:connectionId (omit ttlMinutes = until cancelled)
|
|
15370
15697
|
|
|
15371
|
-
**listFailed**(collectionId: string,
|
|
15372
|
-
flowId: string,
|
|
15698
|
+
**listFailed**(collectionId: string,
|
|
15699
|
+
flowId: string,
|
|
15373
15700
|
query: { status?: 'failed' | 'dead'; limit?: number; cursor?: string } = {}) → `Promise<FailedRecordList>`
|
|
15374
15701
|
A flow's failed / dead records. GET /integrations/flows/:id/failed
|
|
15375
15702
|
|
|
@@ -15394,30 +15721,30 @@ Cancel enhanced logging now. DELETE /integrations/logging/:connectionId
|
|
|
15394
15721
|
**listConnectors**(collectionId: string) → `Promise<`
|
|
15395
15722
|
The collection's installed connector apps. GET /integrations/connectors
|
|
15396
15723
|
|
|
15397
|
-
**saveConnectorInstallation**(collectionId: string,
|
|
15398
|
-
appId: string,
|
|
15724
|
+
**saveConnectorInstallation**(collectionId: string,
|
|
15725
|
+
appId: string,
|
|
15399
15726
|
input: SaveConnectorInstallationInput) → `Promise<`
|
|
15400
15727
|
Save a connector's non-secret Connect-form values and/or settings. PUT /integrations/connectors/:appId/installation
|
|
15401
15728
|
|
|
15402
|
-
**runConnectorStep**(collectionId: string,
|
|
15403
|
-
appId: string,
|
|
15404
|
-
step: ConnectorConsoleStep,
|
|
15729
|
+
**runConnectorStep**(collectionId: string,
|
|
15730
|
+
appId: string,
|
|
15731
|
+
step: ConnectorConsoleStep,
|
|
15405
15732
|
input: Record<string, unknown> & { flowId?: string } = {}) → `Promise<T>`
|
|
15406
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
|
|
15407
15734
|
|
|
15408
|
-
**runConnectorAction**(collectionId: string,
|
|
15409
|
-
appId: string,
|
|
15410
|
-
action: string,
|
|
15735
|
+
**runConnectorAction**(collectionId: string,
|
|
15736
|
+
appId: string,
|
|
15737
|
+
action: string,
|
|
15411
15738
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15412
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 }
|
|
15413
15740
|
|
|
15414
|
-
**listConnectorActions**(collectionId: string,
|
|
15741
|
+
**listConnectorActions**(collectionId: string,
|
|
15415
15742
|
appId: string) → `Promise<`
|
|
15416
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
|
|
15417
15744
|
|
|
15418
|
-
**callConnectorAction**(collectionId: string,
|
|
15419
|
-
appId: string,
|
|
15420
|
-
action: string,
|
|
15745
|
+
**callConnectorAction**(collectionId: string,
|
|
15746
|
+
appId: string,
|
|
15747
|
+
action: string,
|
|
15421
15748
|
input: Record<string, unknown> = {}) → `Promise<T>`
|
|
15422
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 }
|
|
15423
15750
|
|
|
@@ -15651,82 +15978,82 @@ Paginated member product summaries.
|
|
|
15651
15978
|
|
|
15652
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.
|
|
15653
15980
|
|
|
15654
|
-
**list**(collectionId: string,
|
|
15981
|
+
**list**(collectionId: string,
|
|
15655
15982
|
params: { includeDeleted?: boolean } = {}) → `Promise<LoyaltyScheme[]>`
|
|
15656
15983
|
|
|
15657
|
-
**get**(collectionId: string,
|
|
15984
|
+
**get**(collectionId: string,
|
|
15658
15985
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15659
15986
|
|
|
15660
|
-
**create**(collectionId: string,
|
|
15987
|
+
**create**(collectionId: string,
|
|
15661
15988
|
body: CreateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15662
15989
|
|
|
15663
|
-
**update**(collectionId: string,
|
|
15664
|
-
schemeId: string,
|
|
15990
|
+
**update**(collectionId: string,
|
|
15991
|
+
schemeId: string,
|
|
15665
15992
|
body: UpdateLoyaltySchemeBody) → `Promise<LoyaltyScheme>`
|
|
15666
15993
|
|
|
15667
|
-
**remove**(collectionId: string,
|
|
15994
|
+
**remove**(collectionId: string,
|
|
15668
15995
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15669
15996
|
|
|
15670
|
-
**listEarningRules**(collectionId: string,
|
|
15997
|
+
**listEarningRules**(collectionId: string,
|
|
15671
15998
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
15672
15999
|
|
|
15673
|
-
**getEarningRule**(collectionId: string,
|
|
15674
|
-
schemeId: string,
|
|
16000
|
+
**getEarningRule**(collectionId: string,
|
|
16001
|
+
schemeId: string,
|
|
15675
16002
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
15676
16003
|
|
|
15677
|
-
**createEarningRule**(collectionId: string,
|
|
15678
|
-
schemeId: string,
|
|
16004
|
+
**createEarningRule**(collectionId: string,
|
|
16005
|
+
schemeId: string,
|
|
15679
16006
|
body: CreateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
15680
16007
|
|
|
15681
|
-
**updateEarningRule**(collectionId: string,
|
|
15682
|
-
schemeId: string,
|
|
15683
|
-
ruleId: string,
|
|
16008
|
+
**updateEarningRule**(collectionId: string,
|
|
16009
|
+
schemeId: string,
|
|
16010
|
+
ruleId: string,
|
|
15684
16011
|
body: UpdateLoyaltyEarningRuleBody) → `Promise<LoyaltyEarningRule>`
|
|
15685
16012
|
|
|
15686
|
-
**removeEarningRule**(collectionId: string,
|
|
15687
|
-
schemeId: string,
|
|
16013
|
+
**removeEarningRule**(collectionId: string,
|
|
16014
|
+
schemeId: string,
|
|
15688
16015
|
ruleId: string) → `Promise<LoyaltyEarningRule>`
|
|
15689
16016
|
|
|
15690
|
-
**listMembers**(collectionId: string,
|
|
15691
|
-
schemeId: string,
|
|
16017
|
+
**listMembers**(collectionId: string,
|
|
16018
|
+
schemeId: string,
|
|
15692
16019
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyMember>>`
|
|
15693
16020
|
|
|
15694
|
-
**getMember**(collectionId: string,
|
|
15695
|
-
schemeId: string,
|
|
16021
|
+
**getMember**(collectionId: string,
|
|
16022
|
+
schemeId: string,
|
|
15696
16023
|
contactId: string) → `Promise<LoyaltyMember>`
|
|
15697
16024
|
|
|
15698
|
-
**recordTransaction**(collectionId: string,
|
|
15699
|
-
schemeId: string,
|
|
15700
|
-
contactId: string,
|
|
16025
|
+
**recordTransaction**(collectionId: string,
|
|
16026
|
+
schemeId: string,
|
|
16027
|
+
contactId: string,
|
|
15701
16028
|
body: RecordLoyaltyTransactionBody) → `Promise<LoyaltyTransactionResult>`
|
|
15702
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.
|
|
15703
16030
|
|
|
15704
|
-
**getMemberHistory**(collectionId: string,
|
|
15705
|
-
schemeId: string,
|
|
15706
|
-
contactId: string,
|
|
16031
|
+
**getMemberHistory**(collectionId: string,
|
|
16032
|
+
schemeId: string,
|
|
16033
|
+
contactId: string,
|
|
15707
16034
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
15708
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.
|
|
15709
16036
|
|
|
15710
16037
|
**publicList**(collectionId: string) → `Promise<LoyaltyScheme[]>`
|
|
15711
16038
|
List active schemes for a collection. No authentication required.
|
|
15712
16039
|
|
|
15713
|
-
**publicGet**(collectionId: string,
|
|
16040
|
+
**publicGet**(collectionId: string,
|
|
15714
16041
|
schemeId: string) → `Promise<LoyaltyScheme>`
|
|
15715
16042
|
Get a single active scheme. No authentication required.
|
|
15716
16043
|
|
|
15717
|
-
**publicListEarningRules**(collectionId: string,
|
|
16044
|
+
**publicListEarningRules**(collectionId: string,
|
|
15718
16045
|
schemeId: string) → `Promise<LoyaltyEarningRule[]>`
|
|
15719
16046
|
List active earning rules for a scheme — useful for showing "how to earn" in a loyalty UI. No authentication required.
|
|
15720
16047
|
|
|
15721
16048
|
**publicGetMe**(collectionId: string) → `Promise<LoyaltySchemeWithMembership[]>`
|
|
15722
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
|
|
15723
16050
|
|
|
15724
|
-
**publicGetMine**(collectionId: string,
|
|
16051
|
+
**publicGetMine**(collectionId: string,
|
|
15725
16052
|
schemeId: string) → `Promise<LoyaltyMember>`
|
|
15726
16053
|
Get the authenticated caller's membership (balance + lifetimePoints) on a specific scheme. Requires authentication.
|
|
15727
16054
|
|
|
15728
|
-
**publicGetMineHistory**(collectionId: string,
|
|
15729
|
-
schemeId: string,
|
|
16055
|
+
**publicGetMineHistory**(collectionId: string,
|
|
16056
|
+
schemeId: string,
|
|
15730
16057
|
params: LoyaltyPaginationParams = {}) → `Promise<LoyaltyPaginatedResult<LoyaltyTransaction>>`
|
|
15731
16058
|
Get the authenticated caller's transaction history on a specific scheme. Ordered newest first. Requires authentication.
|
|
15732
16059
|
|
|
@@ -15764,98 +16091,98 @@ What the server offers, by group: `{ workOrders: [...], stock: [...], boms: [...
|
|
|
15764
16091
|
|
|
15765
16092
|
### order
|
|
15766
16093
|
|
|
15767
|
-
**create**(collectionId: string,
|
|
16094
|
+
**create**(collectionId: string,
|
|
15768
16095
|
data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
|
|
15769
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' } }) ```
|
|
15770
16097
|
|
|
15771
|
-
**get**(collectionId: string,
|
|
15772
|
-
orderId: string,
|
|
16098
|
+
**get**(collectionId: string,
|
|
16099
|
+
orderId: string,
|
|
15773
16100
|
params?: GetOrderParams) → `Promise<GetOrderResponse>`
|
|
15774
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 ```
|
|
15775
16102
|
|
|
15776
|
-
**update**(collectionId: string,
|
|
15777
|
-
orderId: string,
|
|
16103
|
+
**update**(collectionId: string,
|
|
16104
|
+
orderId: string,
|
|
15778
16105
|
data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
|
|
15779
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' } }) ```
|
|
15780
16107
|
|
|
15781
|
-
**remove**(collectionId: string,
|
|
16108
|
+
**remove**(collectionId: string,
|
|
15782
16109
|
orderId: string) → `Promise<DeleteOrderResponse>`
|
|
15783
16110
|
Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
|
|
15784
16111
|
|
|
15785
|
-
**list**(collectionId: string,
|
|
16112
|
+
**list**(collectionId: string,
|
|
15786
16113
|
params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
|
|
15787
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 }) ```
|
|
15788
16115
|
|
|
15789
|
-
**getItems**(collectionId: string,
|
|
15790
|
-
orderId: string,
|
|
16116
|
+
**getItems**(collectionId: string,
|
|
16117
|
+
orderId: string,
|
|
15791
16118
|
params?: GetOrderItemsParams) → `Promise<GetOrderItemsResponse>`
|
|
15792
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 }) ```
|
|
15793
16120
|
|
|
15794
|
-
**addItems**(collectionId: string,
|
|
15795
|
-
orderId: string,
|
|
16121
|
+
**addItems**(collectionId: string,
|
|
16122
|
+
orderId: string,
|
|
15796
16123
|
data: AddItemsRequest) → `Promise<AddItemsResponse>`
|
|
15797
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`) ```
|
|
15798
16125
|
|
|
15799
16126
|
**lineDone**(collectionId: string, orderId: string, itemId: string, by: number) → `Promise<OrderItem>`
|
|
15800
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) ```
|
|
15801
16128
|
|
|
15802
|
-
**removeItems**(collectionId: string,
|
|
15803
|
-
orderId: string,
|
|
16129
|
+
**removeItems**(collectionId: string,
|
|
16130
|
+
orderId: string,
|
|
15804
16131
|
data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
|
|
15805
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) ```
|
|
15806
16133
|
|
|
15807
|
-
**lookup**(collectionId: string,
|
|
16134
|
+
**lookup**(collectionId: string,
|
|
15808
16135
|
data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
|
|
15809
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' } ] }) ```
|
|
15810
16137
|
|
|
15811
|
-
**query**(collectionId: string,
|
|
16138
|
+
**query**(collectionId: string,
|
|
15812
16139
|
data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
|
|
15813
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 }) ```
|
|
15814
16141
|
|
|
15815
|
-
**reports**(collectionId: string,
|
|
16142
|
+
**reports**(collectionId: string,
|
|
15816
16143
|
params?: ReportsParams) → `Promise<ReportsResponse>`
|
|
15817
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 }) ```
|
|
15818
16145
|
|
|
15819
|
-
**findByProduct**(collectionId: string,
|
|
15820
|
-
productId: string,
|
|
16146
|
+
**findByProduct**(collectionId: string,
|
|
16147
|
+
productId: string,
|
|
15821
16148
|
params?: LookupByProductParams) → `Promise<LookupByProductResponse>`
|
|
15822
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`) }) ```
|
|
15823
16150
|
|
|
15824
|
-
**getAnalytics**(collectionId: string,
|
|
16151
|
+
**getAnalytics**(collectionId: string,
|
|
15825
16152
|
orderId: string) → `Promise<OrderAnalyticsResponse>`
|
|
15826
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`) }) } ```
|
|
15827
16154
|
|
|
15828
|
-
**getTimeline**(collectionId: string,
|
|
15829
|
-
orderId: string,
|
|
16155
|
+
**getTimeline**(collectionId: string,
|
|
16156
|
+
orderId: string,
|
|
15830
16157
|
params?: TimelineRequest) → `Promise<TimelineResponse>`
|
|
15831
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 }) ```
|
|
15832
16159
|
|
|
15833
|
-
**getLocationHistory**(collectionId: string,
|
|
15834
|
-
orderId: string,
|
|
16160
|
+
**getLocationHistory**(collectionId: string,
|
|
16161
|
+
orderId: string,
|
|
15835
16162
|
params?: LocationRequest) → `Promise<LocationResponse>`
|
|
15836
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}`) }) ```
|
|
15837
16164
|
|
|
15838
|
-
**getBulkAnalytics**(collectionId: string,
|
|
16165
|
+
**getBulkAnalytics**(collectionId: string,
|
|
15839
16166
|
data: BulkAnalyticsRequest) → `Promise<BulkAnalyticsResponse>`
|
|
15840
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`) } }) ```
|
|
15841
16168
|
|
|
15842
|
-
**getCollectionSummary**(collectionId: string,
|
|
16169
|
+
**getCollectionSummary**(collectionId: string,
|
|
15843
16170
|
params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
|
|
15844
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' }) ```
|
|
15845
16172
|
|
|
15846
|
-
**findOrdersByProduct**(collectionId: string,
|
|
15847
|
-
productId: string,
|
|
16173
|
+
**findOrdersByProduct**(collectionId: string,
|
|
16174
|
+
productId: string,
|
|
15848
16175
|
params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
|
|
15849
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`) ```
|
|
15850
16177
|
|
|
15851
|
-
**findItemsByProduct**(collectionId: string,
|
|
15852
|
-
productId: string,
|
|
16178
|
+
**findItemsByProduct**(collectionId: string,
|
|
16179
|
+
productId: string,
|
|
15853
16180
|
params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
|
|
15854
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`) ```
|
|
15855
16182
|
|
|
15856
|
-
**getOrderIdsByAttribute**(collectionId: string,
|
|
15857
|
-
attribute: 'productId',
|
|
15858
|
-
value: string,
|
|
16183
|
+
**getOrderIdsByAttribute**(collectionId: string,
|
|
16184
|
+
attribute: 'productId',
|
|
16185
|
+
value: string,
|
|
15859
16186
|
params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
|
|
15860
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 } ) ```
|
|
15861
16188
|
|
|
@@ -15889,7 +16216,7 @@ Move items (by membership), chips without an item (by membership) or containers
|
|
|
15889
16216
|
|
|
15890
16217
|
### podcast
|
|
15891
16218
|
|
|
15892
|
-
**generate**(collectionId: string,
|
|
16219
|
+
**generate**(collectionId: string,
|
|
15893
16220
|
request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
|
|
15894
16221
|
Generate a NotebookLM-style conversational podcast from product documents
|
|
15895
16222
|
|
|
@@ -15968,209 +16295,209 @@ Look up a serial number by code for a product (admin only).
|
|
|
15968
16295
|
|
|
15969
16296
|
### products
|
|
15970
16297
|
|
|
15971
|
-
**get**(collectionId: string,
|
|
15972
|
-
productId: string,
|
|
16298
|
+
**get**(collectionId: string,
|
|
16299
|
+
productId: string,
|
|
15973
16300
|
admin?: boolean) → `Promise<ProductResponse>`
|
|
15974
16301
|
|
|
15975
|
-
**list**(collectionId: string,
|
|
16302
|
+
**list**(collectionId: string,
|
|
15976
16303
|
admin?: boolean) → `Promise<ProductResponse[]>`
|
|
15977
16304
|
|
|
15978
|
-
**create**(collectionId: string,
|
|
16305
|
+
**create**(collectionId: string,
|
|
15979
16306
|
data: ProductCreateRequest) → `Promise<ProductResponse>`
|
|
15980
16307
|
|
|
15981
|
-
**update**(collectionId: string,
|
|
15982
|
-
productId: string,
|
|
16308
|
+
**update**(collectionId: string,
|
|
16309
|
+
productId: string,
|
|
15983
16310
|
data: ProductUpdateRequest) → `Promise<ProductResponse>`
|
|
15984
16311
|
|
|
15985
|
-
**remove**(collectionId: string,
|
|
16312
|
+
**remove**(collectionId: string,
|
|
15986
16313
|
productId: string) → `Promise<void>`
|
|
15987
16314
|
|
|
15988
|
-
**query**(collectionId: string,
|
|
15989
|
-
body: ProductQueryRequest,
|
|
16315
|
+
**query**(collectionId: string,
|
|
16316
|
+
body: ProductQueryRequest,
|
|
15990
16317
|
admin?: boolean) → `Promise<ProductQueryResponse>`
|
|
15991
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) ```
|
|
15992
16319
|
|
|
15993
|
-
**standardQuery**(collectionId: string,
|
|
16320
|
+
**standardQuery**(collectionId: string,
|
|
15994
16321
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
15995
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, }) ```
|
|
15996
16323
|
|
|
15997
16324
|
**standardQueryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
15998
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
|
|
15999
16326
|
|
|
16000
|
-
**clone**(collectionId: string,
|
|
16001
|
-
productId: string,
|
|
16327
|
+
**clone**(collectionId: string,
|
|
16328
|
+
productId: string,
|
|
16002
16329
|
body: Record<string, JsonValue> = {}) → `Promise<ProductResponse>`
|
|
16003
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
|
|
16004
16331
|
|
|
16005
|
-
**listAssets**(collectionId: string,
|
|
16006
|
-
productId: string,
|
|
16332
|
+
**listAssets**(collectionId: string,
|
|
16333
|
+
productId: string,
|
|
16007
16334
|
admin?: boolean) → `Promise<unknown>`
|
|
16008
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
|
|
16009
16336
|
|
|
16010
|
-
**createClaimWindow**(collectionId: string,
|
|
16011
|
-
productId: string,
|
|
16337
|
+
**createClaimWindow**(collectionId: string,
|
|
16338
|
+
productId: string,
|
|
16012
16339
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
16013
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
|
|
16014
16341
|
|
|
16015
|
-
**updateClaimWindow**(collectionId: string,
|
|
16016
|
-
productId: string,
|
|
16017
|
-
claimId: string,
|
|
16342
|
+
**updateClaimWindow**(collectionId: string,
|
|
16343
|
+
productId: string,
|
|
16344
|
+
claimId: string,
|
|
16018
16345
|
body: Record<string, JsonValue>) → `Promise<unknown>`
|
|
16019
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
|
|
16020
16347
|
|
|
16021
|
-
**refresh**(collectionId: string,
|
|
16348
|
+
**refresh**(collectionId: string,
|
|
16022
16349
|
productId: string) → `Promise<ProductResponse>`
|
|
16023
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
|
|
16024
16351
|
|
|
16025
|
-
**getSN**(collectionId: string,
|
|
16026
|
-
productId: string,
|
|
16027
|
-
startIndex: number = 0,
|
|
16352
|
+
**getSN**(collectionId: string,
|
|
16353
|
+
productId: string,
|
|
16354
|
+
startIndex: number = 0,
|
|
16028
16355
|
count: number = 10) → `Promise<unknown>`
|
|
16029
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
|
|
16030
16357
|
|
|
16031
|
-
**lookupSN**(collectionId: string,
|
|
16032
|
-
productId: string,
|
|
16358
|
+
**lookupSN**(collectionId: string,
|
|
16359
|
+
productId: string,
|
|
16033
16360
|
codeId: string) → `Promise<unknown>`
|
|
16034
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
|
|
16035
16362
|
|
|
16036
|
-
**publicLookupClaim**(collectionId: string,
|
|
16037
|
-
productId: string,
|
|
16363
|
+
**publicLookupClaim**(collectionId: string,
|
|
16364
|
+
productId: string,
|
|
16038
16365
|
claimId: string) → `Promise<unknown>`
|
|
16039
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
|
|
16040
16367
|
|
|
16041
|
-
**publicCreateClaim**(collectionId: string,
|
|
16042
|
-
productId: string,
|
|
16368
|
+
**publicCreateClaim**(collectionId: string,
|
|
16369
|
+
productId: string,
|
|
16043
16370
|
body: ProductClaimCreateRequestBody) → `Promise<unknown>`
|
|
16044
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
|
|
16045
16372
|
|
|
16046
16373
|
### proof
|
|
16047
16374
|
|
|
16048
|
-
**query**(collectionId: string,
|
|
16375
|
+
**query**(collectionId: string,
|
|
16049
16376
|
body: StandardQuery = {}) → `Promise<QueryResult>`
|
|
16050
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'] }, }) ```
|
|
16051
16378
|
|
|
16052
16379
|
**queryFields**(collectionId: string) → `Promise<QueryDescription>`
|
|
16053
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
|
|
16054
16381
|
|
|
16055
|
-
**get**(collectionId: string,
|
|
16056
|
-
productId: string,
|
|
16057
|
-
proofId: string,
|
|
16058
|
-
admin?: boolean,
|
|
16382
|
+
**get**(collectionId: string,
|
|
16383
|
+
productId: string,
|
|
16384
|
+
proofId: string,
|
|
16385
|
+
admin?: boolean,
|
|
16059
16386
|
include?: string[]) → `Promise<ProofResponse>`
|
|
16060
16387
|
Retrieves a single Proof by Collection ID, Product ID, and Proof ID. Both public and admin endpoints now include productId in the path.
|
|
16061
16388
|
|
|
16062
|
-
**list**(collectionId: string,
|
|
16389
|
+
**list**(collectionId: string,
|
|
16063
16390
|
include?: string[]) → `Promise<ProofResponse[]>`
|
|
16064
16391
|
List all Proofs for a Collection.
|
|
16065
16392
|
|
|
16066
|
-
**create**(collectionId: string,
|
|
16067
|
-
productId: string,
|
|
16393
|
+
**create**(collectionId: string,
|
|
16394
|
+
productId: string,
|
|
16068
16395
|
request: ProofCreateRequest) → `Promise<ProofResponse>`
|
|
16069
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`.
|
|
16070
16397
|
|
|
16071
|
-
**update**(collectionId: string,
|
|
16072
|
-
productId: string,
|
|
16073
|
-
proofId: string,
|
|
16398
|
+
**update**(collectionId: string,
|
|
16399
|
+
productId: string,
|
|
16400
|
+
proofId: string,
|
|
16074
16401
|
values: ProofUpdateRequest) → `Promise<ProofResponse>`
|
|
16075
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.
|
|
16076
16403
|
|
|
16077
|
-
**updateValues**(collectionId: string,
|
|
16078
|
-
productId: string,
|
|
16079
|
-
proofId: string,
|
|
16404
|
+
**updateValues**(collectionId: string,
|
|
16405
|
+
productId: string,
|
|
16406
|
+
proofId: string,
|
|
16080
16407
|
values: ProofValuesUpdateRequest) → `Promise<ProofResponse>`
|
|
16081
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.
|
|
16082
16409
|
|
|
16083
|
-
**claim**(collectionId: string,
|
|
16084
|
-
productId: string,
|
|
16085
|
-
proofId: string,
|
|
16410
|
+
**claim**(collectionId: string,
|
|
16411
|
+
productId: string,
|
|
16412
|
+
proofId: string,
|
|
16086
16413
|
values: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
16087
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
|
|
16088
16415
|
|
|
16089
|
-
**claimProduct**(collectionId: string,
|
|
16090
|
-
productId: string,
|
|
16416
|
+
**claimProduct**(collectionId: string,
|
|
16417
|
+
productId: string,
|
|
16091
16418
|
values?: ProofClaimRequest) → `Promise<ProofResponse>`
|
|
16092
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); ```
|
|
16093
16420
|
|
|
16094
|
-
**remove**(collectionId: string,
|
|
16095
|
-
productId: string,
|
|
16421
|
+
**remove**(collectionId: string,
|
|
16422
|
+
productId: string,
|
|
16096
16423
|
proofId: string) → `Promise<void>`
|
|
16097
16424
|
Delete a proof for a product (admin only). DELETE /admin/collection/:collectionId/product/:productId/proof/:proofId
|
|
16098
16425
|
|
|
16099
|
-
**getByUser**(collectionId: string,
|
|
16426
|
+
**getByUser**(collectionId: string,
|
|
16100
16427
|
userId: string) → `Promise<ProofResponse[]>`
|
|
16101
16428
|
Get proofs for a user in a collection (admin only). GET /admin/collection/:collectionId/proof/findByUser/:userId
|
|
16102
16429
|
|
|
16103
|
-
**getByProduct**(collectionId: string,
|
|
16430
|
+
**getByProduct**(collectionId: string,
|
|
16104
16431
|
productId: string) → `Promise<ProofResponse[]>`
|
|
16105
16432
|
Get proofs for a product (admin only). GET /admin/collection/:collectionId/product/:productId/proof
|
|
16106
16433
|
|
|
16107
|
-
**findByProduct**(collectionId: string,
|
|
16108
|
-
productId: string,
|
|
16434
|
+
**findByProduct**(collectionId: string,
|
|
16435
|
+
productId: string,
|
|
16109
16436
|
query: any) → `Promise<ProofResponse[]>`
|
|
16110
16437
|
Find proofs for a product (admin only). POST /admin/collection/:collectionId/product/:productId/proof/find
|
|
16111
16438
|
|
|
16112
|
-
**getByBatch**(collectionId: string,
|
|
16113
|
-
productId: string,
|
|
16439
|
+
**getByBatch**(collectionId: string,
|
|
16440
|
+
productId: string,
|
|
16114
16441
|
batchId: string) → `Promise<ProofResponse[]>`
|
|
16115
16442
|
Get proofs for a batch (admin only). GET /admin/collection/:collectionId/product/:productId/batch/:batchId/proof
|
|
16116
16443
|
|
|
16117
|
-
**migrate**(collectionId: string,
|
|
16118
|
-
productId: string,
|
|
16119
|
-
proofId: string,
|
|
16120
|
-
/** The destination product ID */
|
|
16444
|
+
**migrate**(collectionId: string,
|
|
16445
|
+
productId: string,
|
|
16446
|
+
proofId: string,
|
|
16447
|
+
/** The destination product ID */
|
|
16121
16448
|
data: { targetProductId: string }) → `Promise<ProofResponse>`
|
|
16122
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' ```
|
|
16123
16450
|
|
|
16124
|
-
**createGrant**(collectionId: string,
|
|
16125
|
-
productId: string,
|
|
16126
|
-
proofId: string,
|
|
16451
|
+
**createGrant**(collectionId: string,
|
|
16452
|
+
productId: string,
|
|
16453
|
+
proofId: string,
|
|
16127
16454
|
options: CreateGrantOptions) → `Promise<ProofGrant>`
|
|
16128
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}.
|
|
16129
16456
|
|
|
16130
|
-
**listGrants**(collectionId: string,
|
|
16131
|
-
productId: string,
|
|
16457
|
+
**listGrants**(collectionId: string,
|
|
16458
|
+
productId: string,
|
|
16132
16459
|
proofId: string) → `Promise<ProofGrant[]>`
|
|
16133
16460
|
List the active + past grants on a proof (owner / collection admin only). Tokens are never returned here.
|
|
16134
16461
|
|
|
16135
|
-
**revokeGrant**(collectionId: string,
|
|
16136
|
-
productId: string,
|
|
16137
|
-
proofId: string,
|
|
16462
|
+
**revokeGrant**(collectionId: string,
|
|
16463
|
+
productId: string,
|
|
16464
|
+
proofId: string,
|
|
16138
16465
|
grantId: string) → `Promise<void>`
|
|
16139
16466
|
Revoke a grant by id (owner / collection admin only). Takes effect immediately.
|
|
16140
16467
|
|
|
16141
|
-
**redeemGrant**(collectionId: string,
|
|
16142
|
-
productId: string,
|
|
16143
|
-
proofId: string,
|
|
16144
|
-
token: string,
|
|
16468
|
+
**redeemGrant**(collectionId: string,
|
|
16469
|
+
productId: string,
|
|
16470
|
+
proofId: string,
|
|
16471
|
+
token: string,
|
|
16145
16472
|
options?: RedeemGrantOptions) → `Promise<RedeemGrantResult>`
|
|
16146
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.
|
|
16147
16474
|
|
|
16148
|
-
**transfer**(collectionId: string,
|
|
16149
|
-
productId: string,
|
|
16150
|
-
proofId: string,
|
|
16475
|
+
**transfer**(collectionId: string,
|
|
16476
|
+
productId: string,
|
|
16477
|
+
proofId: string,
|
|
16151
16478
|
options: TransferProofOptions) → `Promise<TransferProofResult>`
|
|
16152
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' } }, }) ```
|
|
16153
16480
|
|
|
16154
|
-
**acceptTransfer**(collectionId: string,
|
|
16155
|
-
productId: string,
|
|
16156
|
-
proofId: string,
|
|
16481
|
+
**acceptTransfer**(collectionId: string,
|
|
16482
|
+
productId: string,
|
|
16483
|
+
proofId: string,
|
|
16157
16484
|
options: AcceptTransferOptions = {}) → `Promise<`
|
|
16158
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.
|
|
16159
16486
|
|
|
16160
|
-
**cancelTransfer**(collectionId: string,
|
|
16161
|
-
productId: string,
|
|
16162
|
-
proofId: string,
|
|
16487
|
+
**cancelTransfer**(collectionId: string,
|
|
16488
|
+
productId: string,
|
|
16489
|
+
proofId: string,
|
|
16163
16490
|
options: CancelTransferOptions = {}) → `Promise<`
|
|
16164
16491
|
Cancel a pending push transfer (current owner / collection admin only).
|
|
16165
16492
|
|
|
16166
|
-
**getTransfer**(collectionId: string,
|
|
16167
|
-
productId: string,
|
|
16493
|
+
**getTransfer**(collectionId: string,
|
|
16494
|
+
productId: string,
|
|
16168
16495
|
proofId: string) → `Promise<`
|
|
16169
16496
|
Get the active transfer/status for a proof (owner, collection admin, or the named recipient). Returns `{ transfer: null }` when nothing is in flight.
|
|
16170
16497
|
|
|
16171
16498
|
### publicClient
|
|
16172
16499
|
|
|
16173
|
-
**agentRun**(collectionId: string,
|
|
16500
|
+
**agentRun**(collectionId: string,
|
|
16174
16501
|
body: PublicAgentRunRequest) → `Promise<AgentRunResult>`
|
|
16175
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
|
|
16176
16503
|
|
|
@@ -16185,19 +16512,19 @@ Check rate limit status
|
|
|
16185
16512
|
|
|
16186
16513
|
### publicClient.sessions
|
|
16187
16514
|
|
|
16188
|
-
**create**(collectionId: string,
|
|
16515
|
+
**create**(collectionId: string,
|
|
16189
16516
|
body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
|
|
16190
16517
|
|
|
16191
|
-
**list**(collectionId: string,
|
|
16518
|
+
**list**(collectionId: string,
|
|
16192
16519
|
params?: { appId?: string; limit?: number }) → `Promise<`
|
|
16193
16520
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16194
16521
|
|
|
16195
16522
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
16196
16523
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16197
16524
|
|
|
16198
|
-
**append**(collectionId: string,
|
|
16199
|
-
id: string,
|
|
16200
|
-
items: ResponseInputItem[],
|
|
16525
|
+
**append**(collectionId: string,
|
|
16526
|
+
id: string,
|
|
16527
|
+
items: ResponseInputItem[],
|
|
16201
16528
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
16202
16529
|
List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
|
|
16203
16530
|
|
|
@@ -16327,9 +16654,9 @@ List sessions, most-recently-active first (optionally filtered by app).
|
|
|
16327
16654
|
**get**(collectionId: string, id: string) → `Promise<AiSession>`
|
|
16328
16655
|
Get one session, including its full transcript.
|
|
16329
16656
|
|
|
16330
|
-
**append**(collectionId: string,
|
|
16331
|
-
id: string,
|
|
16332
|
-
items: ResponseInputItem[],
|
|
16657
|
+
**append**(collectionId: string,
|
|
16658
|
+
id: string,
|
|
16659
|
+
items: ResponseInputItem[],
|
|
16333
16660
|
opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
|
|
16334
16661
|
Append Responses items (input/output/tool) to a session — the manual-persistence path.
|
|
16335
16662
|
|
|
@@ -16354,7 +16681,7 @@ The thank-you page: the order a Stripe checkout paid for, from the `session_id`
|
|
|
16354
16681
|
The signed-in buyer's orders, newest first, with their download links. @throws `SIGN_IN_REQUIRED`
|
|
16355
16682
|
|
|
16356
16683
|
**formatMoney**(amount: number, currency: string, locale?: string) → `string`
|
|
16357
|
-
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".
|
|
16358
16685
|
|
|
16359
16686
|
### shop.admin
|
|
16360
16687
|
|
|
@@ -16432,7 +16759,7 @@ Move to another plan's price. Up (a higher-ranked or dearer plan): at once, char
|
|
|
16432
16759
|
Stripe's page for the member's card, invoices and cancelling. Send them to `url`. @throws `NO_BILLING`
|
|
16433
16760
|
|
|
16434
16761
|
**describePrice**(p: { amount: number; currency: string; interval: 'month' | 'year' | null; intervalCount?: number }, locale?: string) → `string`
|
|
16435
|
-
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".
|
|
16436
16763
|
|
|
16437
16764
|
### subscriptions.admin
|
|
16438
16765
|
|
|
@@ -16583,17 +16910,17 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
|
|
|
16583
16910
|
|
|
16584
16911
|
### tools
|
|
16585
16912
|
|
|
16586
|
-
**run**(collectionId: string,
|
|
16587
|
-
name: K,
|
|
16588
|
-
args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
|
|
16589
|
-
export async function run<T = any>(
|
|
16590
|
-
collectionId: string,
|
|
16591
|
-
name: string,
|
|
16592
|
-
args?: Record<string, any>,
|
|
16593
|
-
): Promise<ToolRunResult<T>>
|
|
16594
|
-
export async function run(
|
|
16595
|
-
collectionId: string,
|
|
16596
|
-
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,
|
|
16597
16924
|
args: Record<string, any> =`
|
|
16598
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
|
|
16599
16926
|
|
|
@@ -16657,7 +16984,7 @@ Admin: replace the site's translation rules. They apply to new translations from
|
|
|
16657
16984
|
|
|
16658
16985
|
### tts
|
|
16659
16986
|
|
|
16660
|
-
**generate**(collectionId: string,
|
|
16987
|
+
**generate**(collectionId: string,
|
|
16661
16988
|
request: TTSRequest) → `Promise<Blob>`
|
|
16662
16989
|
Generate text-to-speech audio
|
|
16663
16990
|
|