@proveanything/smartlinks 2.1.17 → 2.1.19

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.
Files changed (80) hide show
  1. package/dist/adminViews.d.ts +104 -0
  2. package/dist/adminViews.js +275 -0
  3. package/dist/api/ai.d.ts +15 -5
  4. package/dist/api/ai.js +15 -9
  5. package/dist/api/aiGuide.d.ts +108 -0
  6. package/dist/api/aiGuide.js +161 -0
  7. package/dist/api/appObjects.d.ts +21 -0
  8. package/dist/api/appObjects.js +33 -1
  9. package/dist/api/authKit.d.ts +37 -1
  10. package/dist/api/authKit.js +51 -0
  11. package/dist/api/index.d.ts +2 -0
  12. package/dist/api/index.js +2 -0
  13. package/dist/api/operations.d.ts +36 -0
  14. package/dist/api/operations.js +56 -0
  15. package/dist/api/order.d.ts +12 -1
  16. package/dist/api/order.js +15 -0
  17. package/dist/api/userGroups.d.ts +78 -0
  18. package/dist/api/userGroups.js +124 -0
  19. package/dist/docs/API_SUMMARY.md +1111 -80
  20. package/dist/docs/admin-lists-and-pickers.md +140 -0
  21. package/dist/docs/admin-views.md +147 -0
  22. package/dist/docs/app-data-storage.md +277 -276
  23. package/dist/docs/app-manifest.md +2 -0
  24. package/dist/docs/auth-kit.md +872 -741
  25. package/dist/docs/comms.md +686 -644
  26. package/dist/docs/customer-guide.md +70 -0
  27. package/dist/docs/headless-providers.md +112 -112
  28. package/dist/docs/operations.md +281 -0
  29. package/dist/docs/overview.md +3 -0
  30. package/dist/docs/server-functions.md +87 -1
  31. package/dist/docs/ui-utils.md +123 -121
  32. package/dist/docs/user-groups.md +175 -0
  33. package/dist/docs/utils.md +17 -0
  34. package/dist/headless.js +38 -2
  35. package/dist/http.js +8 -0
  36. package/dist/iframeResponder.d.ts +15 -0
  37. package/dist/iframeResponder.js +39 -1
  38. package/dist/index.d.ts +3 -1
  39. package/dist/index.js +2 -0
  40. package/dist/live.d.ts +80 -0
  41. package/dist/live.js +315 -0
  42. package/dist/openapi.yaml +1864 -48
  43. package/dist/testing/index.d.ts +35 -0
  44. package/dist/testing/index.js +86 -0
  45. package/dist/types/appManifest.d.ts +297 -1
  46. package/dist/types/appOptions.d.ts +32 -0
  47. package/dist/types/appOptions.js +3 -0
  48. package/dist/types/authKit.d.ts +193 -4
  49. package/dist/types/comms.d.ts +41 -2
  50. package/dist/types/containers.d.ts +8 -0
  51. package/dist/types/headless.d.ts +49 -1
  52. package/dist/types/iframeResponder.d.ts +16 -1
  53. package/dist/types/index.d.ts +3 -0
  54. package/dist/types/index.js +3 -0
  55. package/dist/types/operations.d.ts +598 -0
  56. package/dist/types/operations.js +8 -0
  57. package/dist/types/order.d.ts +35 -6
  58. package/dist/types/userGroups.d.ts +103 -0
  59. package/dist/types/userGroups.js +5 -0
  60. package/dist/utils/conditions.d.ts +7 -0
  61. package/dist/utils/conditions.js +16 -9
  62. package/docs/API_SUMMARY.md +1111 -80
  63. package/docs/admin-lists-and-pickers.md +140 -0
  64. package/docs/admin-views.md +147 -0
  65. package/docs/app-data-storage.md +277 -276
  66. package/docs/app-manifest.md +2 -0
  67. package/docs/auth-kit.md +872 -741
  68. package/docs/comms.md +686 -644
  69. package/docs/customer-guide.md +70 -0
  70. package/docs/headless-providers.md +112 -112
  71. package/docs/operations.md +281 -0
  72. package/docs/overview.md +3 -0
  73. package/docs/server-functions.md +87 -1
  74. package/docs/ui-utils.md +123 -121
  75. package/docs/user-groups.md +175 -0
  76. package/docs/utils.md +17 -0
  77. package/openapi.yaml +1864 -48
  78. package/package.json +1 -1
  79. package/scripts/doctor.mjs +454 -428
  80. package/scripts/lib/keyed-app-data.mjs +21 -0
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.1.17 | Generated: 2026-11-11T09:04:21.796Z
3
+ Version: 2.1.19 | Generated: 2026-11-16T19:01:42.716Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -137,6 +137,7 @@ The Smartlinks SDK is organized into the following namespaces:
137
137
 
138
138
  — Other —
139
139
  - **adminCards** - Functions for adminCards operations
140
+ - **aiGuide** - Functions for aiGuide operations
140
141
  - **analytics** - Functions for analytics operations
141
142
  - **async** - Functions for async operations
142
143
  - **attestation** - Functions for attestation operations
@@ -154,6 +155,7 @@ The Smartlinks SDK is organized into the following namespaces:
154
155
  - **location** - Functions for location operations
155
156
  - **lots** - Functions for lots operations
156
157
  - **navigation** - Functions for navigation operations
158
+ - **operations** - Functions for operations operations
157
159
  - **order** - Functions for order operations
158
160
  - **partner** - Functions for partner operations
159
161
  - **products** - Functions for products operations
@@ -163,6 +165,7 @@ The Smartlinks SDK is organized into the following namespaces:
163
165
  - **tags** - Functions for tags operations
164
166
  - **template** - Functions for template operations
165
167
  - **translations** - Functions for translations operations
168
+ - **userGroups** - Functions for userGroups operations
166
169
 
167
170
  ## HTTP Utilities
168
171
 
@@ -2699,6 +2702,7 @@ interface AppFunctionDef {
2699
2702
  visibility?: AppFunctionVisibility;
2700
2703
  authority?: AppFunctionAuthority;
2701
2704
  elevated?: boolean;
2705
+ userGroups?: string[];
2702
2706
  capabilities?: string[];
2703
2707
  dataScope?: 'collection' | 'global';
2704
2708
  inputs?: AppFunctionInputs;
@@ -2864,16 +2868,44 @@ interface AppHistoryQuery {
2864
2868
  }
2865
2869
  ```
2866
2870
 
2871
+ **ServerFunctionMessage** (interface)
2872
+ ```typescript
2873
+ interface ServerFunctionMessage {
2874
+ contactId?: string;
2875
+ to?: 'caller';
2876
+ templateId?: string;
2877
+ message?: TypedMessage;
2878
+ channel?: 'preferred' | 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet';
2879
+ props?: Record<string, unknown>;
2880
+ include?: Record<string, unknown>;
2881
+ about?: MessageAbout;
2882
+ ref?: string;
2883
+ attach?: EmailAttachmentSpec[];
2884
+ }
2885
+ ```
2886
+
2867
2887
  **ServerFunctionSl** (interface)
2868
2888
  ```typescript
2869
2889
  interface ServerFunctionSl {
2890
+ workOrders: WorkOrdersApi;
2891
+ stock: StockApi;
2892
+ boms: BomsApi;
2893
+ madeFrom: MadeFromApi;
2894
+ operations: OperationsApi;
2870
2895
  bookings: ServerFunctionBookings;
2871
2896
  appRecords: {
2872
2897
  claim(fields: Record<string, any>): Promise<AppRecordClaimResult>;
2873
2898
  adjust(recordId: string, by: Record<string, number>, opts?: { atLeast?: Record<string, number>; atMost?: Record<string, number> }): Promise<any>;
2874
2899
  aggregate(params?: import('./appObjects').AggregateRequest): Promise<import('./appObjects').AggregateResponse & Record<string, unknown>>;
2900
+ all(recordType: string): Promise<any[]>;
2875
2901
  [method: string]: any;
2876
2902
  };
2903
+ appOptions: {
2904
+ get(source: string, opts?: { q?: string; version?: string }): Promise<import('./appOptions').AppOptionsResponse>;
2905
+ };
2906
+ userGroups: {
2907
+ members(keys?: string[]): Promise<Array<{ userId: string; name: string | null; email: string | null; userGroups: string[] }>>;
2908
+ };
2877
2909
  transaction(ops: RecordTransactionOp[], opts?: { idempotencyKey?: string }): Promise<{ results: any[]; replayed: boolean }>;
2878
2910
  history: {
2879
2911
  log(type: string, data?: Record<string, any>, opts?: { entityId?: string }): Promise<{ id: string }>;
@@ -2886,7 +2918,10 @@ interface ServerFunctionSl {
2886
2918
  forCaller(): Promise<CallerContact | null>;
2887
2919
  };
2888
2920
  interactions: { record(event: ServerFunctionInteractionEvent): Promise<{ eventId: string }> };
2921
+ messages: { send(input: ServerFunctionMessage): Promise<ServerFunctionMessageResult> };
2889
2922
  tools: { run<T = any>(name: string, args?: Record<string, any>): Promise<T> };
2923
+ assets: ServerFunctionAssets;
2924
+ ai: ServerFunctionAi;
2890
2925
  products: any;
2891
2926
  attestations: any;
2892
2927
  appData: AppDataHandle & { global: AppDataHandle; collection: AppDataHandle };
@@ -2894,6 +2929,66 @@ interface ServerFunctionSl {
2894
2929
  }
2895
2930
  ```
2896
2931
 
2932
+ **ServerFunctionAsset** (interface)
2933
+ ```typescript
2934
+ interface ServerFunctionAsset {
2935
+ id: string;
2936
+ appId: string | null;
2937
+ productId: string | null;
2938
+ proofId: string | null;
2939
+ name: string;
2940
+ assetType: string;
2941
+ mimeType: string | null;
2942
+ size: number | null;
2943
+ width: number | null;
2944
+ height: number | null;
2945
+ hash: string | null;
2946
+ url: string;
2947
+ assetUrl: string | null;
2948
+ thumbnail: string | null;
2949
+ labels: string[];
2950
+ metadata: Record<string, any>;
2951
+ versions: number;
2952
+ status: string;
2953
+ createdAt: string;
2954
+ updatedAt: string;
2955
+ }
2956
+ ```
2957
+
2958
+ **ServerFunctionAssets** (interface)
2959
+ ```typescript
2960
+ interface ServerFunctionAssets {
2961
+ get(assetId: string): Promise<ServerFunctionAsset | null>;
2962
+ list(params?: { productId?: string | null; proofId?: string | null; appId?: string | null; labels?: string | string[]; assetType?: string; limit?: number; offset?: number }): Promise<ServerFunctionAsset[]>;
2963
+ read(assetId: string, opts?: { as?: 'base64' }): Promise<{ id: string; name: string; contentType: string; size: number; base64: string }>;
2964
+ read(assetId: string, opts: { as: 'text' }): Promise<{ id: string; name: string; contentType: string; size: number; text: string }>;
2965
+ create(input: ServerFunctionFileInput & { name: string; productId?: string; proofId?: string; labels?: string[]; metadata?: Record<string, any> }): Promise<ServerFunctionAsset>;
2966
+ replace(assetId: string, input: ServerFunctionFileInput & { name?: string }): Promise<ServerFunctionAsset>;
2967
+ update(assetId: string, patch: { name?: string; labels?: string[]; metadata?: Record<string, any> }): Promise<ServerFunctionAsset>;
2968
+ remove(assetId: string): Promise<{ id: string; deleted: true }>;
2969
+ startUpload(input: { name: string; contentType: string; productId?: string; proofId?: string; replaceAssetId?: string }): Promise<{ uploadId: string; sessionUrl: string; expiresAt: string }>;
2970
+ finishUpload(uploadId: string, input?: { name?: string; metadata?: Record<string, any> }): Promise<ServerFunctionAsset>;
2971
+ }
2972
+ ```
2973
+
2974
+ **ServerFunctionAiRequest** (interface)
2975
+ ```typescript
2976
+ interface ServerFunctionAiRequest {
2977
+ prompt?: string;
2978
+ system?: string;
2979
+ files?: Array<{ assetId: string } | { base64: string; contentType: string } | { text: string; name?: string }>;
2980
+ schema?: Record<string, any>;
2981
+ quality?: 'fast' | 'best';
2982
+ }
2983
+ ```
2984
+
2985
+ **ServerFunctionAi** (interface)
2986
+ ```typescript
2987
+ interface ServerFunctionAi {
2988
+ generate<T = any>(request: ServerFunctionAiRequest): Promise<{ text: string; data?: T; model: string; usage: { inputTokens: number; outputTokens: number } }>;
2989
+ }
2990
+ ```
2991
+
2897
2992
  **ServerFunctionCaller** (interface)
2898
2993
  ```typescript
2899
2994
  interface ServerFunctionCaller {
@@ -2902,6 +2997,7 @@ interface ServerFunctionCaller {
2902
2997
  origin?: string | null;
2903
2998
  ip?: string | null;
2904
2999
  via: AppFunctionTriggerType;
3000
+ userGroups: readonly string[];
2905
3001
  }
2906
3002
  ```
2907
3003
 
@@ -3048,6 +3144,20 @@ interface PublicView {
3048
3144
  }
3049
3145
  ```
3050
3146
 
3147
+ **AdminView** (interface)
3148
+ ```typescript
3149
+ interface AdminView {
3150
+ id: string;
3151
+ title: string;
3152
+ path: string;
3153
+ group?: 'main' | 'settings' | 'record';
3154
+ within?: string;
3155
+ icon?: string;
3156
+ description?: string;
3157
+ params?: Record<string, string>;
3158
+ }
3159
+ ```
3160
+
3051
3161
  **AppManifest** (interface)
3052
3162
  ```typescript
3053
3163
  interface AppManifest {
@@ -3083,6 +3193,7 @@ interface AppManifest {
3083
3193
  };
3084
3194
  linkable?: DeepLinkEntry[];
3085
3195
  publicViews?: PublicView[];
3196
+ adminViews?: AdminView[];
3086
3197
  executor?: AppManifestExecutor;
3087
3198
  functions?: AppManifestFunctions;
3088
3199
  realtime?: { channels: RealtimeChannelDeclaration[] };
@@ -3336,6 +3447,13 @@ interface GetCollectionWidgetsOptions {
3336
3447
 
3337
3448
  **RecordTransactionOp** = ``
3338
3449
 
3450
+ **ServerFunctionMessageResult** = ``
3451
+
3452
+ **ServerFunctionFileInput** (type)
3453
+ ```typescript
3454
+ type ServerFunctionFileInput = { base64: string; contentType: string }
3455
+ ```
3456
+
3339
3457
  ### appObjects
3340
3458
 
3341
3459
  **PaginatedResponse<T>** (interface)
@@ -3897,6 +4015,30 @@ interface PublicCreateBranch {
3897
4015
 
3898
4016
  **MatchedAt** = ``
3899
4017
 
4018
+ ### appOptions
4019
+
4020
+ **AppOption** (interface)
4021
+ ```typescript
4022
+ interface AppOption {
4023
+ id: string;
4024
+ label: string;
4025
+ sublabel?: string;
4026
+ active: boolean;
4027
+ order: number | null;
4028
+ }
4029
+ ```
4030
+
4031
+ **AppOptionValueInput** (interface)
4032
+ ```typescript
4033
+ interface AppOptionValueInput {
4034
+ code: string;
4035
+ label?: string;
4036
+ active?: boolean;
4037
+ }
4038
+ ```
4039
+
4040
+ **AppOptionsResponse** = ``
4041
+
3900
4042
  ### asset
3901
4043
 
3902
4044
  **AssetRef** (interface)
@@ -5002,14 +5144,45 @@ interface UpsertContactResponse {
5002
5144
  **AuthKitBrandingConfig** (interface)
5003
5145
  ```typescript
5004
5146
  interface AuthKitBrandingConfig {
5005
- logoUrl?: string
5147
+ logoUrl?: string | null
5006
5148
  title?: string
5007
5149
  subtitle?: string
5150
+ registerTitle?: string
5151
+ registerSubtitle?: string
5008
5152
  primaryColor?: string
5009
5153
  secondaryColor?: string
5010
5154
  backgroundColor?: string
5011
- buttonStyle?: string
5155
+ buttonStyle?: 'rounded' | 'square' | 'pill' | string
5012
5156
  fontFamily?: string
5157
+ theme?: 'light' | 'dark' | 'auto'
5158
+ inheritHostStyles?: boolean
5159
+ minimal?: boolean
5160
+ customCss?: string
5161
+ termsUrl?: string
5162
+ privacyUrl?: string
5163
+ [key: string]: unknown
5164
+ }
5165
+ ```
5166
+
5167
+ **AuthKitEmailTemplate** (interface)
5168
+ ```typescript
5169
+ interface AuthKitEmailTemplate {
5170
+ subject?: string
5171
+ header?: string
5172
+ introText?: string
5173
+ buttonText?: string
5174
+ footerText?: string
5175
+ }
5176
+ ```
5177
+
5178
+ **AuthKitMfaConfig** (interface)
5179
+ ```typescript
5180
+ interface AuthKitMfaConfig {
5181
+ mode?: 'off' | 'optional' | 'risk-based' | 'always'
5182
+ factorsEnabled?: { email?: boolean; sms?: boolean; totp?: boolean; recoveryCodes?: boolean }
5183
+ minimumFactors?: number
5184
+ trustedDeviceDurationDays?: number
5185
+ enforceForAdmins?: boolean
5013
5186
  }
5014
5187
  ```
5015
5188
 
@@ -5017,8 +5190,33 @@ interface AuthKitBrandingConfig {
5017
5190
  ```typescript
5018
5191
  interface AuthKitConfig {
5019
5192
  id: string
5193
+ name?: string
5020
5194
  branding?: AuthKitBrandingConfig
5021
- enabledProviders?: string[]
5195
+ enabledProviders?: AuthKitProvider[]
5196
+ providerOrder?: AuthKitProvider[]
5197
+ emailDisplayMode?: 'form' | 'button'
5198
+ signupProminence?: 'none' | 'minimal' | 'balanced' | 'emphasized'
5199
+ signupRedirectUrl?: string
5200
+ googleClientId?: string
5201
+ googleOAuthFlow?: 'oneTap' | 'popup' | 'redirect'
5202
+ whitelistedGoogleDomains?: string[]
5203
+ appleClientIds?: string[]
5204
+ linkedInClientId?: string
5205
+ whatsappPrefillMessage?: string
5206
+ whatsappReply?: { enabled?: boolean; text?: string; cta?: { body?: string; buttonLabel?: string; buttonUrl?: string; mediaUrl?: string } }
5207
+ registrationFields?: Array<{ key: string; showDuringRegistration?: boolean; placement?: 'inline' | 'after'; required?: boolean }>
5208
+ collectNameOnPasswordlessSignup?: boolean
5209
+ emailVerificationMode?: 'immediate' | 'verify-auto-login' | 'verify-manual-login'
5210
+ emailVerificationGracePeriod?: number
5211
+ lockUnverifiedAfterGrace?: boolean
5212
+ allowPasswordReset?: boolean
5213
+ mfa?: AuthKitMfaConfig
5214
+ afterSignInUrl?: string
5215
+ allowedRedirectDomains?: string[]
5216
+ texts?: Partial<Record<AuthKitTextKey, string>>
5217
+ emailTemplates?: Partial<Record<AuthKitEmailKind, AuthKitEmailTemplate>>
5218
+ emailBranding?: { logoUrl?: string; buttonColor?: string; footerHtml?: string }
5219
+ secrets?: Record<string, { ref: string; hint?: string | null; collectionId?: string; setAt?: string }>
5022
5220
  customCss?: string
5023
5221
  termsUrl?: string
5024
5222
  privacyUrl?: string
@@ -5074,6 +5272,77 @@ interface AuthKitSetIdentityResponse {
5074
5272
  }
5075
5273
  ```
5076
5274
 
5275
+ **AuthKitSchema** (interface)
5276
+ ```typescript
5277
+ interface AuthKitSchema {
5278
+ providers: AuthKitProvider[]
5279
+ emailKinds: AuthKitEmailKind[]
5280
+ emailFields: Array<keyof AuthKitEmailTemplate>
5281
+ textKeys: AuthKitTextKey[]
5282
+ secrets: string[]
5283
+ serverOwned: string[]
5284
+ fields: Array<{ path: string; group: string; where: 'screens' | 'server' | 'both' | 'host'; default: unknown; description: string }>
5285
+ }
5286
+ ```
5287
+
5288
+ **AuthKitCheck** (interface)
5289
+ ```typescript
5290
+ interface AuthKitCheck {
5291
+ level: 'problem' | 'warning' | 'info'
5292
+ code: string
5293
+ message: string
5294
+ setting?: string
5295
+ }
5296
+ ```
5297
+
5298
+ **AuthKitSettingsResponse** (interface)
5299
+ ```typescript
5300
+ interface AuthKitSettingsResponse {
5301
+ authKitId: string
5302
+ ownLogins: 'own' | 'shared'
5303
+ config: AuthKitConfig
5304
+ effective: Required<Pick<AuthKitConfig, 'enabledProviders' | 'providerOrder' | 'signUp' | 'allowPasswordReset' | 'emailVerificationMode'>> & AuthKitConfig
5305
+ secrets: Record<string, { set: boolean; hint?: string | null; setAt?: string | null; legacy?: boolean }>
5306
+ checks: AuthKitCheck[]
5307
+ }
5308
+ ```
5309
+
5310
+ **AuthKitSetupRequest** (interface)
5311
+ ```typescript
5312
+ interface AuthKitSetupRequest {
5313
+ name?: string
5314
+ ownLogins?: boolean
5315
+ settings?: AuthKitConfigInput
5316
+ }
5317
+ ```
5318
+
5319
+ **AuthKitSetupResponse** (interface)
5320
+ ```typescript
5321
+ interface AuthKitSetupResponse {
5322
+ authKit: AuthKitConfig
5323
+ created: boolean
5324
+ ownLogins: 'own' | 'shared'
5325
+ changed: string[]
5326
+ }
5327
+ ```
5328
+
5329
+ **AuthKitEmailPreview** (interface)
5330
+ ```typescript
5331
+ interface AuthKitEmailPreview {
5332
+ kind: AuthKitEmailKind
5333
+ subject: string
5334
+ html: string
5335
+ }
5336
+ ```
5337
+
5338
+ **AuthKitSecretLink** (interface)
5339
+ ```typescript
5340
+ interface AuthKitSecretLink {
5341
+ url: string
5342
+ expiresAt: string
5343
+ }
5344
+ ```
5345
+
5077
5346
  **AuthKitSecurityConfig** (interface)
5078
5347
  ```typescript
5079
5348
  interface AuthKitSecurityConfig {
@@ -5128,6 +5397,12 @@ interface AuthKitLockoutPolicy {
5128
5397
 
5129
5398
  **VerifyStatus** = `'pending' | 'verified' | 'failed' | 'expired' | 'unknown'`
5130
5399
 
5400
+ **AuthKitProvider** = `'email' | 'magic-link' | 'phone' | 'whatsapp' | 'google' | 'apple' | 'microsoft' | 'linkedin'`
5401
+
5402
+ **AuthKitEmailKind** = `'passwordReset' | 'emailVerification' | 'magicLink' | 'memberInvite' | 'invite' | 'addedToCollection' | 'mfaCode' | 'providerLinked'`
5403
+
5404
+ **AuthKitTextKey** = ``
5405
+
5131
5406
  **AuthKitConfigInput** = ``
5132
5407
 
5133
5408
  **PasswordPolicyErrorCode** = ``
@@ -6576,7 +6851,8 @@ interface SubscriptionsResolveResponse {
6576
6851
  ```typescript
6577
6852
  interface TransactionalSendRequest {
6578
6853
  contactId: string
6579
- templateId: string
6854
+ templateId?: string
6855
+ message?: TypedMessage
6580
6856
  channel?: 'email' | 'sms' | 'whatsapp' | 'push' | 'wallet' | 'preferred'
6581
6857
  props?: Record<string, unknown>
6582
6858
  include?: {
@@ -6590,6 +6866,8 @@ interface TransactionalSendRequest {
6590
6866
  }
6591
6867
  ref?: string
6592
6868
  appId?: string
6869
+ about?: MessageAbout
6870
+ category?: 'service'
6593
6871
  attach?: EmailAttachmentSpec[]
6594
6872
  }
6595
6873
  ```
@@ -6604,6 +6882,27 @@ interface TransactionalSendResponse {
6604
6882
  }
6605
6883
  ```
6606
6884
 
6885
+ **TypedMessage** (interface)
6886
+ ```typescript
6887
+ interface TypedMessage {
6888
+ subject?: string
6889
+ body: string
6890
+ sms?: string
6891
+ }
6892
+ ```
6893
+
6894
+ **MessageAbout** (interface)
6895
+ ```typescript
6896
+ interface MessageAbout {
6897
+ appId?: string
6898
+ type: string
6899
+ id: string
6900
+ view?: string
6901
+ params?: Record<string, string>
6902
+ label?: string
6903
+ }
6904
+ ```
6905
+
6607
6906
  **TransactionalSendError** (interface)
6608
6907
  ```typescript
6609
6908
  interface TransactionalSendError {
@@ -6916,8 +7215,13 @@ export interface SubscriptionsResolveResponse {
6916
7215
  export interface TransactionalSendRequest {
6917
7216
  /** CRM contact UUID */
6918
7217
  contactId: string
6919
- /** Firestore template ID */
6920
- templateId: string
7218
+ /** A saved template's id. Give this or `message`. */
7219
+ templateId?: string
7220
+ /**
7221
+ * A typed message instead of a template: plain text, Liquid allowed (`{{ contact.firstName }}`).
7222
+ * `sms` is the shorter text for SMS and WhatsApp (defaults to `body`).
7223
+ */
7224
+ message?: TypedMessage
6921
7225
  /**
6922
7226
  * Channel to send on. Defaults to 'preferred', which auto-selects the
6923
7227
  * contact's best available channel respecting consent, suppression, and
@@ -6947,6 +7251,17 @@ export interface TransactionalSendRequest {
6947
7251
  ref?: string
6948
7252
  /** App context stored on the comms-events row */
6949
7253
  appId?: string
7254
+ /**
7255
+ * What the message is about: the record it was sent for and the admin screen that shows it, so it is a
7256
+ * link in Messages, on the contact's Activity, and on the conversation a reply opens. `appId` defaults
7257
+ * to the sending app.
7258
+ */
7259
+ about?: MessageAbout
7260
+ /**
7261
+ * `'service'` (a confirmation, a reminder, an update): an asked-for channel the person turned off, or a
7262
+ * suppressed email, is refused (`transactional.opted_out`). Marketing goes out as a campaign.
7263
+ */
7264
+ category?: 'service'
6950
7265
  /**
6951
7266
  * Files to attach (email only; at most 5, 10 MB in all). What can't be made is left out and listed in
6952
7267
  * `attachmentsLeftOut` — the email still goes.
@@ -6979,6 +7294,29 @@ export interface TransactionalSendResponse {
6979
7294
  attachmentsLeftOut?: string[]
6980
7295
  }
6981
7296
 
7297
+ /** A message written there and then rather than a saved template. */
7298
+ export interface TypedMessage {
7299
+ subject?: string
7300
+ body: string
7301
+ /** The shorter text for SMS and WhatsApp (defaults to `body`). */
7302
+ sms?: string
7303
+ }
7304
+
7305
+ /**
7306
+ * What a message is about (docs/comms.md, "What a message is about"). Ids only, never content.
7307
+ * `view` and `params` name one of the app's admin views (manifest `adminViews`, docs/admin-views.md).
7308
+ */
7309
+ export interface MessageAbout {
7310
+ appId?: string
7311
+ /** What kind of record: `'booking'`, `'entry'`, `'case'`. */
7312
+ type: string
7313
+ id: string
7314
+ view?: string
7315
+ params?: Record<string, string>
7316
+ /** A short label to show without looking the record up: `'Sat 3pm, table for 4'`. */
7317
+ label?: string
7318
+ }
7319
+
6982
7320
  export interface TransactionalSendError {
6983
7321
  ok: false
6984
7322
  /**
@@ -6991,6 +7329,8 @@ export interface TransactionalSendError {
6991
7329
  * - `transactional.whatsapp_missing`
6992
7330
  * - `transactional.no_push_methods`
6993
7331
  * - `transactional.no_wallet_methods`
7332
+ * - `transactional.opted_out` (category `'service'`: the person turned that channel off, or the email is suppressed)
7333
+ * - `transactional.template_or_message` / `transactional.message_invalid` / `transactional.about_invalid`
6994
7334
  */
6995
7335
  error: string
6996
7336
  }
@@ -7347,6 +7687,7 @@ interface Container {
7347
7687
  status: ContainerStatus
7348
7688
  metadata?: Record<string, any>
7349
7689
  parentContainerId?: string
7690
+ fixed?: boolean
7350
7691
  children?: Container[]
7351
7692
  items?: ContainerItem[]
7352
7693
  createdAt: string
@@ -7382,6 +7723,7 @@ interface CreateContainerInput {
7382
7723
  status?: ContainerStatus
7383
7724
  metadata?: Record<string, any>
7384
7725
  parentContainerId?: string
7726
+ fixed?: boolean
7385
7727
  }
7386
7728
  ```
7387
7729
 
@@ -7395,6 +7737,7 @@ interface UpdateContainerInput {
7395
7737
  status?: ContainerStatus
7396
7738
  metadata?: Record<string, any>
7397
7739
  parentContainerId?: string | null
7740
+ fixed?: boolean
7398
7741
  }
7399
7742
  ```
7400
7743
 
@@ -7802,6 +8145,27 @@ interface AppDataField {
7802
8145
  public?: boolean;
7803
8146
  to?: string;
7804
8147
  options?: string[];
8148
+ list?: string;
8149
+ }
8150
+ ```
8151
+
8152
+ **AppValueListValue** (interface)
8153
+ ```typescript
8154
+ interface AppValueListValue {
8155
+ code: string;
8156
+ label?: string;
8157
+ active?: boolean;
8158
+ }
8159
+ ```
8160
+
8161
+ **AppValueList** (interface)
8162
+ ```typescript
8163
+ interface AppValueList {
8164
+ label: string;
8165
+ description?: string;
8166
+ values: AppValueListValue[];
8167
+ editable?: boolean;
8168
+ public?: boolean;
7805
8169
  }
7806
8170
  ```
7807
8171
 
@@ -7817,6 +8181,14 @@ interface AppDataType {
7817
8181
  examples?: Array<Record<string, unknown>>;
7818
8182
  read?: { list?: string; get?: string; notes?: string };
7819
8183
  since?: string;
8184
+ title?: string;
8185
+ label?: string;
8186
+ sublabel?: string;
8187
+ activeField?: string;
8188
+ orderField?: string;
8189
+ small?: boolean;
8190
+ setup?: boolean;
8191
+ checked?: boolean;
7820
8192
  }
7821
8193
  ```
7822
8194
 
@@ -7825,6 +8197,7 @@ interface AppDataType {
7825
8197
  interface AppDataDeclaration {
7826
8198
  schemaVersion: string;
7827
8199
  types: Record<string, AppDataType>;
8200
+ lists?: Record<string, AppValueList>;
7828
8201
  }
7829
8202
  ```
7830
8203
 
@@ -7885,6 +8258,8 @@ interface IframeResponderOptions {
7885
8258
  ) => Promise<void>;
7886
8259
  onAuthLogout?: () => Promise<void>;
7887
8260
  onRouteChange?: (path: string, state: Record<string, string>) => void;
8261
+ onNavigable?: (info: { views: string[]; chrome: 'none' | 'full' }) => void;
8262
+ onNavigateResult?: (result: { ok: boolean; view: string | null; path: string | null; reason?: string }) => void;
7888
8263
  autoHeight?: boolean | { minHeight?: number };
7889
8264
  onResize?: (height: number) => void;
7890
8265
  onError?: (error: Error) => void;
@@ -7914,7 +8289,10 @@ interface SmartlinksIframeMessage {
7914
8289
  | 'smartlinks:redirect'
7915
8290
  | 'smartlinks:authkit:login'
7916
8291
  | 'smartlinks:authkit:logout'
7917
- | 'smartlinks:authkit:redirect';
8292
+ | 'smartlinks:authkit:redirect'
8293
+ | 'smartlinks:navigable'
8294
+ | 'smartlinks:navigate-result'
8295
+ | 'smartlinks:open-app';
7918
8296
  payload: Record<string, any>;
7919
8297
  messageId?: string;
7920
8298
  }
@@ -9640,6 +10018,355 @@ interface TagContext {
9640
10018
 
9641
10019
  **TagStatus** = `'valid' | 'rescan' | 'invalid' | 'error'`
9642
10020
 
10021
+ ### operations
10022
+
10023
+ **WorkOrderStage** (interface)
10024
+ ```typescript
10025
+ interface WorkOrderStage {
10026
+ key: string
10027
+ position: number
10028
+ status: WorkOrderStageStatus
10029
+ plannedStart: string | null
10030
+ plannedEnd: string | null
10031
+ startedAt: string | null
10032
+ doneAt: string | null
10033
+ quantityDone: number
10034
+ quantityScrapped: number
10035
+ data: Record<string, any>
10036
+ }
10037
+ ```
10038
+
10039
+ **WorkOrder** (interface)
10040
+ ```typescript
10041
+ interface WorkOrder {
10042
+ id: string
10043
+ collectionId: string
10044
+ appId: string
10045
+ ref: string
10046
+ kind: string | null
10047
+ productId: string | null
10048
+ variantId: string | null
10049
+ quantity: number
10050
+ unit: string
10051
+ dueAt: string | null
10052
+ priority: number
10053
+ status: WorkOrderStatus
10054
+ statusReason: string | null
10055
+ orderId: string | null
10056
+ orderItemId: string | null
10057
+ parentId: string | null
10058
+ outputBatchId: string | null
10059
+ stages: WorkOrderStage[]
10060
+ currentStage: string | null
10061
+ late: boolean
10062
+ data: Record<string, any>
10063
+ createdBy: string | null
10064
+ createdAt: string
10065
+ updatedAt: string
10066
+ closedAt: string | null
10067
+ }
10068
+ ```
10069
+
10070
+ **CreateWorkOrderInput** (interface)
10071
+ ```typescript
10072
+ interface CreateWorkOrderInput {
10073
+ ref: string
10074
+ kind?: string
10075
+ productId?: string
10076
+ variantId?: string
10077
+ quantity?: number
10078
+ unit?: string
10079
+ dueAt?: string | null
10080
+ priority?: number
10081
+ orderId?: string
10082
+ orderItemId?: string
10083
+ parentId?: string
10084
+ outputBatchId?: string
10085
+ data?: Record<string, any>
10086
+ stages?: WorkOrderStageInput[]
10087
+ }
10088
+ ```
10089
+
10090
+ **WorkOrderListParams** (interface)
10091
+ ```typescript
10092
+ interface WorkOrderListParams {
10093
+ status?: WorkOrderStatus | WorkOrderStatus[]
10094
+ appId?: string
10095
+ productId?: string
10096
+ orderId?: string
10097
+ parentId?: string
10098
+ kind?: string
10099
+ late?: boolean
10100
+ dueFrom?: string
10101
+ dueTo?: string
10102
+ q?: string
10103
+ sort?: 'due' | 'priority' | 'created' | 'ref'
10104
+ limit?: number
10105
+ offset?: number
10106
+ }
10107
+ ```
10108
+
10109
+ **WorkOrdersApi** (interface)
10110
+ ```typescript
10111
+ interface WorkOrdersApi {
10112
+ get(idOrRef: string): Promise<WorkOrder | null>
10113
+ list(params?: WorkOrderListParams): Promise<{ items: WorkOrder[]; total: number; limit: number; offset: number }>
10114
+ create(input: CreateWorkOrderInput): Promise<WorkOrder>
10115
+ update(idOrRef: string, patch: UpdateWorkOrderInput, opts?: { reason?: string }): Promise<WorkOrder>
10116
+ setStatus(idOrRef: string, status: WorkOrderStatus, opts?: { reason?: string }): Promise<WorkOrder>
10117
+ remove(idOrRef: string): Promise<{ id: string; deleted: true }>
10118
+ startStage(idOrRef: string, stage: string): Promise<WorkOrder>
10119
+ progress(idOrRef: string, stage: string, by: { done?: number; scrapped?: number }, opts?: { reason?: string; note?: string }): Promise<WorkOrder>
10120
+ completeStage(idOrRef: string, stage: string, opts?: { closeWorkOrder?: boolean }): Promise<WorkOrder>
10121
+ skipStage(idOrRef: string, stage: string, opts: { reason: string }): Promise<WorkOrder>
10122
+ planStage(idOrRef: string, stage: string, plan: { plannedStart?: string | null; plannedEnd?: string | null; data?: Record<string, any> }): Promise<WorkOrder>
10123
+ setStages(idOrRef: string, stages: WorkOrderStageInput[]): Promise<WorkOrder>
10124
+ }
10125
+ ```
10126
+
10127
+ **StockTarget** (interface)
10128
+ ```typescript
10129
+ interface StockTarget {
10130
+ type: string; id: string
10131
+ }
10132
+ ```
10133
+
10134
+ **StockLine** (interface)
10135
+ ```typescript
10136
+ interface StockLine {
10137
+ id: string
10138
+ containerId: string
10139
+ productId: string
10140
+ variantId: string | null
10141
+ batchId: string | null
10142
+ state: StockState
10143
+ allocatedTo: StockTarget | null
10144
+ quantity: number
10145
+ unit: string
10146
+ updatedAt: string
10147
+ }
10148
+ ```
10149
+
10150
+ **StockTotals** (interface)
10151
+ ```typescript
10152
+ interface StockTotals {
10153
+ available: number; allocated: number; held: number; quarantine: number; total: number; unit: string | null
10154
+ }
10155
+ ```
10156
+
10157
+ **StockItem** (interface)
10158
+ ```typescript
10159
+ interface StockItem {
10160
+ productId: string; variantId?: string; batchId?: string; quantity: number; unit?: string
10161
+ }
10162
+ ```
10163
+
10164
+ **StockMovementExtras** (interface)
10165
+ ```typescript
10166
+ interface StockMovementExtras {
10167
+ workOrderId?: string; reason?: string; note?: string
10168
+ }
10169
+ ```
10170
+
10171
+ **StockMovementOptions** (interface)
10172
+ ```typescript
10173
+ interface StockMovementOptions {
10174
+ idempotencyKey?: string
10175
+ }
10176
+ ```
10177
+
10178
+ **StockMovement** (interface)
10179
+ ```typescript
10180
+ interface StockMovement {
10181
+ movementId: string
10182
+ kind: 'receive' | 'produce' | 'consume' | 'move' | 'allocate' | 'release' | 'hold' | 'unhold' | 'adjust'
10183
+ productId: string
10184
+ quantity: number
10185
+ unit: string
10186
+ from?: (StockLine & { emptied?: boolean }) | null
10187
+ to?: StockLine | null
10188
+ replayed: boolean
10189
+ }
10190
+ ```
10191
+
10192
+ **StockPosition** (interface)
10193
+ ```typescript
10194
+ interface StockPosition {
10195
+ product: { id: string; variantId: string | null; name: string | null; unit: string | null }
10196
+ onHand: StockTotals
10197
+ where: Array<{ containerId: string; container: StockWhereLine['container']; path: string; place: StockWhereLine['place']; quantity: number; batchId: string | null; state: StockState; allocatedTo: StockTarget | null }>
10198
+ onOrder: { total: number; lines: Array<{ orderId: string; orderRef: string | null; supplier: string | null; quantity: number; dueAt: string | null }> }
10199
+ beingMade: { total: number; lines: Array<{ workOrderId: string; ref: string; quantity: number; stage: string | null; status: WorkOrderStatus; dueAt: string | null }> }
10200
+ needed: { total: number; lines: Array<{ orderId?: string; orderRef?: string | null; workOrderId?: string; ref?: string; forProductId: string; quantity: number; neededBy: string | null; why: 'ordered' | 'work order' | 'order, not yet in production' }> }
10201
+ projected: Array<{ date: string; balance: number }>
10202
+ shortfall: { quantity: number; firstShortOn: string } | null
10203
+ horizonDays: number
10204
+ undatedLines?: number
10205
+ asOf: string
10206
+ sources: { stock: string; orders: string; workOrders: string }
10207
+ }
10208
+ ```
10209
+
10210
+ **StockApi** (interface)
10211
+ ```typescript
10212
+ interface StockApi {
10213
+ lines(params?: { containerId?: string; productId?: string; variantId?: string; batchId?: string; state?: StockState; allocatedTo?: StockTarget; limit?: number; offset?: number }): Promise<{ items: StockLine[]; total: number; limit: number; offset: number }>
10214
+ totals(params: { productId: string; variantId?: string; batchId?: string }): Promise<StockTotals>
10215
+ where(params: { productId: string; variantId?: string; batchId?: string; state?: StockState }): Promise<StockWhereLine[]>
10216
+ position(params: { productId: string; variantId?: string; horizonDays?: number; includeWhere?: boolean }): Promise<StockPosition>
10217
+ short(params?: { horizonDays?: number; limit?: number }): Promise<{ horizonDays: number; items: Array<{ product: StockPosition['product']; shortfall: NonNullable<StockPosition['shortfall']>; onHand: StockTotals; onOrder: number; beingMade: number; needed: number }>; checked: number; asOf: string }>
10218
+ receive(input: StockItem & StockMovementExtras & { containerId: string; state?: 'available' | 'held' | 'quarantine' }, opts?: StockMovementOptions): Promise<StockMovement>
10219
+ produce(input: StockItem & StockMovementExtras & { containerId: string; state?: 'available' | 'held' | 'quarantine' }, opts?: StockMovementOptions): Promise<StockMovement>
10220
+ consume(input: StockItem & StockMovementExtras & { containerId: string; allocatedTo?: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
10221
+ move(input: StockItem & StockMovementExtras & { from: string; to: string; state?: StockState; allocatedTo?: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
10222
+ allocate(input: StockItem & StockMovementExtras & { containerId: string; to: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
10223
+ release(input: StockItem & StockMovementExtras & { containerId: string; from: StockTarget }, opts?: StockMovementOptions): Promise<StockMovement>
10224
+ hold(input: StockItem & StockMovementExtras & { containerId: string; state?: 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
10225
+ unhold(input: StockItem & StockMovementExtras & { containerId: string; state?: 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
10226
+ adjust(input: Omit<StockItem, 'quantity'> & StockMovementExtras & { containerId: string; by: number; state?: 'available' | 'held' | 'quarantine'; reason: string }, opts?: StockMovementOptions): Promise<StockMovement>
10227
+ }
10228
+ ```
10229
+
10230
+ **BomLine** (interface)
10231
+ ```typescript
10232
+ interface BomLine {
10233
+ componentProductId: string; componentVariantId?: string | null; quantity: number; unit?: string; optional?: boolean; note?: string | null
10234
+ }
10235
+ ```
10236
+
10237
+ **Bom** (interface)
10238
+ ```typescript
10239
+ interface Bom {
10240
+ id: string
10241
+ productId: string
10242
+ variantId: string | null
10243
+ version: number
10244
+ validFrom: string
10245
+ validTo: string | null
10246
+ yields: number
10247
+ note: string | null
10248
+ lines: Array<{ componentProductId: string; componentVariantId: string | null; quantity: number; unit: string; optional: boolean; note: string | null }>
10249
+ data: Record<string, any>
10250
+ createdBy: string | null
10251
+ createdAt: string
10252
+ }
10253
+ ```
10254
+
10255
+ **BomTreeNode** (interface)
10256
+ ```typescript
10257
+ interface BomTreeNode {
10258
+ productId: string; variantId: string | null; quantity: number; unit: string; optional: boolean; components: BomTreeNode[]
10259
+ }
10260
+ ```
10261
+
10262
+ **BomExplosion** (interface)
10263
+ ```typescript
10264
+ interface BomExplosion {
10265
+ productId: string
10266
+ variantId: string | null
10267
+ quantity: number
10268
+ hasBom: boolean
10269
+ tree: BomTreeNode[]
10270
+ materials: Array<{ productId: string; variantId: string | null; quantity: number; unit: string }>
10271
+ }
10272
+ ```
10273
+
10274
+ **BomsApi** (interface)
10275
+ ```typescript
10276
+ interface BomsApi {
10277
+ current(params: { productId: string; variantId?: string; at?: string }): Promise<Bom | null>
10278
+ versions(params: { productId: string; variantId?: string }): Promise<Bom[]>
10279
+ whereUsed(params: { componentProductId: string }): Promise<Array<{ productId: string; variantId: string | null; quantity: number; unit: string; yields: number; optional: boolean }>>
10280
+ explode(params: { productId: string; variantId?: string; quantity?: number; at?: string; includeOptional?: boolean }): Promise<BomExplosion>
10281
+ set(input: { productId: string; variantId?: string; lines: BomLine[]; yields?: number; note?: string; validFrom?: string; data?: Record<string, any> }): Promise<Bom>
10282
+ end(params: { productId: string; variantId?: string }): Promise<Bom | null>
10283
+ }
10284
+ ```
10285
+
10286
+ **MadeFromSubject** (interface)
10287
+ ```typescript
10288
+ interface MadeFromSubject {
10289
+ type: 'batch' | 'proof'; id: string
10290
+ }
10291
+ ```
10292
+
10293
+ **MadeFromSource** (interface)
10294
+ ```typescript
10295
+ interface MadeFromSource {
10296
+ type: 'batch' | 'proof' | 'product'; id: string
10297
+ }
10298
+ ```
10299
+
10300
+ **MadeFromEntry** (interface)
10301
+ ```typescript
10302
+ interface MadeFromEntry {
10303
+ id: string
10304
+ subject: MadeFromSubject
10305
+ source: MadeFromSource
10306
+ productId: string | null
10307
+ quantity: number | null
10308
+ unit: string | null
10309
+ workOrderId: string | null
10310
+ at: string
10311
+ by: string | null
10312
+ endedAt: string | null
10313
+ data: Record<string, any>
10314
+ }
10315
+ ```
10316
+
10317
+ **MadeFromTraceNode** (interface)
10318
+ ```typescript
10319
+ interface MadeFromTraceNode {
10320
+ source: MadeFromSource; productId: string | null; quantity: number | null; unit: string | null; at: string; workOrderId: string | null; madeFrom: MadeFromTraceNode[]
10321
+ }
10322
+ ```
10323
+
10324
+ **MadeFromApi** (interface)
10325
+ ```typescript
10326
+ interface MadeFromApi {
10327
+ of(subject: MadeFromSubject, opts?: { at?: string; includeEnded?: boolean }): Promise<MadeFromEntry[]>
10328
+ usedIn(source: MadeFromSource, opts?: { includeEnded?: boolean }): Promise<MadeFromEntry[]>
10329
+ trace(subject: MadeFromSubject, opts?: { depth?: number }): Promise<{ subject: MadeFromSubject; madeFrom: MadeFromTraceNode[] }>
10330
+ record(input: { subject: MadeFromSubject; sources: Array<MadeFromSource & { productId?: string; quantity?: number; unit?: string; data?: Record<string, any> }>; workOrderId?: string; at?: string }): Promise<MadeFromEntry[]>
10331
+ end(id: string, opts: { reason: string }): Promise<MadeFromEntry>
10332
+ }
10333
+ ```
10334
+
10335
+ **OperationStep** (interface)
10336
+ ```typescript
10337
+ interface OperationStep {
10338
+ op: string; args: any[]
10339
+ }
10340
+ ```
10341
+
10342
+ **OperationsApi** (interface)
10343
+ ```typescript
10344
+ interface OperationsApi {
10345
+ transaction(steps: OperationStep[]): Promise<{ results: any[] }>
10346
+ }
10347
+ ```
10348
+
10349
+ **OperationsAdmin** (interface)
10350
+ ```typescript
10351
+ interface OperationsAdmin {
10352
+ workOrders: WorkOrdersApi
10353
+ stock: StockApi
10354
+ boms: BomsApi
10355
+ madeFrom: MadeFromApi
10356
+ transaction: OperationsApi['transaction']
10357
+ }
10358
+ ```
10359
+
10360
+ **WorkOrderStatus** = `'open' | 'on-hold' | 'blocked' | 'done' | 'cancelled'`
10361
+
10362
+ **WorkOrderStageStatus** = `'pending' | 'active' | 'done' | 'skipped'`
10363
+
10364
+ **WorkOrderStageInput** = `string | { key: string`
10365
+
10366
+ **UpdateWorkOrderInput** = `Partial<Omit<CreateWorkOrderInput, 'ref' | 'stages' | 'parentId'>>`
10367
+
10368
+ **StockState** = `'available' | 'allocated' | 'held' | 'quarantine'`
10369
+
9643
10370
  ### order
9644
10371
 
9645
10372
  **OrderItem** (interface)
@@ -9647,18 +10374,44 @@ interface TagContext {
9647
10374
  interface OrderItem {
9648
10375
  id: string // UUID
9649
10376
  orderId: string // Parent order ID
9650
- itemType: 'tag' | 'proof' | 'serial' // Type of item
9651
- itemId: string // The tag ID, proof ID, or serial number
10377
+ itemType: 'tag' | 'proof' | 'serial' | 'product' // Type of item ('product' = a quantity line)
10378
+ itemId: string // The tag ID, proof ID, or serial number (the product ID on a quantity line)
9652
10379
  collectionId?: string // Collection ID
9653
10380
  productId?: string // Product ID
9654
10381
  variantId?: string | null // Variant ID
9655
10382
  batchId?: string | null // Batch ID
10383
+ quantity: number // How many (1 for an identified thing)
10384
+ unit?: string | null // The unit the quantity is in
10385
+ quantityDone: number // Shipped (sales) or received (purchase) so far
10386
+ dueAt?: string | null // When this line is wanted or expected, if different from the order's
9656
10387
  metadata: Record<string, any> // Item-specific metadata
9657
10388
  createdAt: string // ISO 8601 timestamp
9658
10389
  order?: OrderSummary // Optional order summary (when includeOrder=true)
9659
10390
  }
9660
10391
  ```
9661
10392
 
10393
+ **OrderItemInput** (interface)
10394
+ ```typescript
10395
+ interface OrderItemInput {
10396
+ itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
10397
+ itemId: string // Required: Item identifier
10398
+ metadata?: Record<string, any> // Optional: Item-specific data
10399
+ }
10400
+ ```
10401
+
10402
+ **OrderQuantityLineInput** (interface)
10403
+ ```typescript
10404
+ interface OrderQuantityLineInput {
10405
+ itemType?: 'product'
10406
+ productId: string // Required: The product
10407
+ variantId?: string
10408
+ quantity: number // Required: How many
10409
+ unit?: string
10410
+ dueAt?: string // Optional: When this line is wanted or expected
10411
+ metadata?: Record<string, any>
10412
+ }
10413
+ ```
10414
+
9662
10415
  **OrderSummary** (interface)
9663
10416
  ```typescript
9664
10417
  interface OrderSummary {
@@ -9679,6 +10432,9 @@ interface Order {
9679
10432
  orderRef?: string // Customer's own order reference/ID (e.g., "ORD-12345")
9680
10433
  customerId?: string // Customer's own customer ID (can map to CRM/contacts)
9681
10434
  status: string // e.g., "pending", "processing", "shipped", "completed"
10435
+ direction: OrderDirection // 'sales' (someone wants it from us) or 'purchase' (we want it from a supplier)
10436
+ partyId?: string | null // The supplier, on a purchase order
10437
+ dueAt?: string | null // When it is wanted or expected
9682
10438
  itemCount: number // Cached count of items (maintained automatically)
9683
10439
  metadata: {
9684
10440
  productSummary?: Record<string, number> // productId -> count (auto-maintained)
@@ -9693,11 +10449,10 @@ interface Order {
9693
10449
  **CreateOrderRequest** (interface)
9694
10450
  ```typescript
9695
10451
  interface CreateOrderRequest {
9696
- items: Array<{
9697
- itemType: 'tag' | 'proof' | 'serial' // Required: Type of item
9698
- itemId: string // Required: Item identifier
9699
- metadata?: Record<string, any> // Optional: Item-specific data
9700
- }>
10452
+ items: Array<OrderItemInput | OrderQuantityLineInput>
10453
+ direction?: OrderDirection // Optional: 'sales' (default) or 'purchase'
10454
+ partyId?: string // Optional: The supplier, on a purchase order
10455
+ dueAt?: string // Optional: When it is wanted or expected
9701
10456
  orderRef?: string // Optional: Your own order reference/ID
9702
10457
  customerId?: string // Optional: Your customer ID
9703
10458
  status?: string // Optional: Order status (default: "pending")
@@ -9715,6 +10470,9 @@ interface GetOrderParams {
9715
10470
  **UpdateOrderRequest** (interface)
9716
10471
  ```typescript
9717
10472
  interface UpdateOrderRequest {
10473
+ direction?: OrderDirection // Optional: 'sales' or 'purchase'
10474
+ partyId?: string | null // Optional: The supplier
10475
+ dueAt?: string | null // Optional: When it is wanted or expected
9718
10476
  orderRef?: string // Optional: Update order reference
9719
10477
  customerId?: string // Optional: Update customer ID
9720
10478
  status?: string // Optional: Update status
@@ -9737,6 +10495,8 @@ interface ListOrdersRequest {
9737
10495
  status?: string // Optional: Filter by status
9738
10496
  orderRef?: string // Optional: Filter by order reference
9739
10497
  customerId?: string // Optional: Filter by customer ID
10498
+ direction?: OrderDirection // Optional: Only sales, or only purchase, orders
10499
+ partyId?: string // Optional: Filter by supplier
9740
10500
  includeItems?: boolean // Optional: Include items array (default: false)
9741
10501
  }
9742
10502
  ```
@@ -10126,6 +10886,8 @@ interface CollectionSummaryResponse {
10126
10886
  }
10127
10887
  ```
10128
10888
 
10889
+ **OrderDirection** = `'sales' | 'purchase'`
10890
+
10129
10891
  ### product
10130
10892
 
10131
10893
  **ProductKey** (interface)
@@ -11132,6 +11894,107 @@ interface TranslationUpdateRequest {
11132
11894
 
11133
11895
  **TranslationLookupRequest** = `TranslationLookupSingleRequest | TranslationLookupBatchRequest`
11134
11896
 
11897
+ ### userGroups
11898
+
11899
+ **UserGroup** (interface)
11900
+ ```typescript
11901
+ interface UserGroup {
11902
+ id: string
11903
+ collectionId?: string
11904
+ key?: string
11905
+ name: string
11906
+ description?: string
11907
+ members?: string[]
11908
+ createdAt?: string
11909
+ updatedAt?: string
11910
+ deleted?: boolean
11911
+ deletedAt?: string | null
11912
+ [extra: string]: any
11913
+ }
11914
+ ```
11915
+
11916
+ **CreateUserGroupRequest** (interface)
11917
+ ```typescript
11918
+ interface CreateUserGroupRequest {
11919
+ name: string
11920
+ key?: string
11921
+ description?: string
11922
+ members?: string[]
11923
+ [extra: string]: any
11924
+ }
11925
+ ```
11926
+
11927
+ **UpdateUserGroupRequest** (interface)
11928
+ ```typescript
11929
+ interface UpdateUserGroupRequest {
11930
+ name?: string
11931
+ description?: string
11932
+ members?: string[]
11933
+ [extra: string]: any
11934
+ }
11935
+ ```
11936
+
11937
+ **UserGroupMember** (interface)
11938
+ ```typescript
11939
+ interface UserGroupMember {
11940
+ uid: string
11941
+ name?: string | null
11942
+ email?: string | null
11943
+ }
11944
+ ```
11945
+
11946
+ **UserGroupRef** (interface)
11947
+ ```typescript
11948
+ interface UserGroupRef {
11949
+ id: string
11950
+ key: string | null
11951
+ name: string | null
11952
+ }
11953
+ ```
11954
+
11955
+ **MyUserGroups** (interface)
11956
+ ```typescript
11957
+ interface MyUserGroups {
11958
+ userGroups: string[]
11959
+ userGroupIds: string[]
11960
+ }
11961
+ ```
11962
+
11963
+ **UserGroupChange** (interface)
11964
+ ```typescript
11965
+ interface UserGroupChange {
11966
+ id: string
11967
+ at: string
11968
+ type: UserGroupChangeType
11969
+ entityId: string | null
11970
+ data: {
11971
+ userGroupId: string
11972
+ key: string | null
11973
+ name: string | null
11974
+ userId?: string
11975
+ previousName?: string | null
11976
+ members?: string[]
11977
+ }
11978
+ actorType: string | null
11979
+ actorId: string | null
11980
+ }
11981
+ ```
11982
+
11983
+ **UserGroupHistoryParams** (interface)
11984
+ ```typescript
11985
+ interface UserGroupHistoryParams {
11986
+ userGroupId?: string
11987
+ userId?: string
11988
+ from?: string
11989
+ to?: string
11990
+ limit?: number
11991
+ }
11992
+ ```
11993
+
11994
+ **AddUserGroupMemberRequest** = ``
11995
+
11996
+ **UserGroupChangeType** = ``
11997
+
11135
11998
  ### variant
11136
11999
 
11137
12000
  **VariantResponse** (interface)
@@ -11221,6 +12084,81 @@ interface EmbeddedWidgetProps {
11221
12084
 
11222
12085
  **EmbeddedWidgetComponent** = `(props: EmbeddedWidgetProps) => any`
11223
12086
 
12087
+ ### aiGuide (api)
12088
+
12089
+ **GuideInfo** (interface)
12090
+ ```typescript
12091
+ interface GuideInfo {
12092
+ enabled: boolean
12093
+ name?: string
12094
+ modes?: { voice: boolean; text: boolean; start: 'voice' | 'text' }
12095
+ suggestions?: string[]
12096
+ handoff?: { kind: 'email' | 'phone' | 'url'; value: string } | null
12097
+ }
12098
+ ```
12099
+
12100
+ **ScreenContent** (interface)
12101
+ ```typescript
12102
+ interface ScreenContent {
12103
+ appId?: string | null
12104
+ title?: string | null
12105
+ content?: string | null
12106
+ }
12107
+ ```
12108
+
12109
+ **GuideWhere** (interface)
12110
+ ```typescript
12111
+ interface GuideWhere {
12112
+ appId?: string | null
12113
+ path?: string | null
12114
+ params?: Record<string, string>
12115
+ }
12116
+ ```
12117
+
12118
+ **GuideNavigate** (interface)
12119
+ ```typescript
12120
+ interface GuideNavigate {
12121
+ appId: string
12122
+ path: string
12123
+ params?: Record<string, string>
12124
+ }
12125
+ ```
12126
+
12127
+ **GuideCard** (interface)
12128
+ ```typescript
12129
+ interface GuideCard {
12130
+ title: string
12131
+ rows: Array<{ title: string; detail?: string | null; goTo?: string }>
12132
+ more?: number
12133
+ }
12134
+ ```
12135
+
12136
+ **GuideStartOptions** (interface)
12137
+ ```typescript
12138
+ interface GuideStartOptions {
12139
+ surface: GuideSurface
12140
+ mode?: 'voice' | 'text'
12141
+ productId?: string | null
12142
+ proofId?: string | null
12143
+ apps?: Array<{ id: string; title: string; kind?: 'core' | 'app'; channel?: string }>
12144
+ where?: GuideWhere
12145
+ language?: string
12146
+ screen?: ScreenContent
12147
+ readScreen?: () => Promise<ScreenContent | null> | ScreenContent | null
12148
+ showApp?: (appId: string) => Promise<void> | void
12149
+ openPage?: (to: GuideNavigate) => Promise<void> | void
12150
+ goTo?: (productId: string) => Promise<void> | void
12151
+ onShow?: (card: GuideCard) => void
12152
+ offerPerson?: (handoff: GuideInfo['handoff']) => Promise<void> | void
12153
+ onState?: (s: LiveState) => void
12154
+ onCaption?: (text: string) => void
12155
+ onReply?: (text: string) => void
12156
+ onError?: (message: string) => void
12157
+ }
12158
+ ```
12159
+
12160
+ **GuideSurface** = `'portal' | 'hub'`
12161
+
11224
12162
  ### appConfiguration (api)
11225
12163
 
11226
12164
  **AppConfigOptions** (type)
@@ -11707,6 +12645,20 @@ Append an entry to case history (admin only) POST /cases/:caseId/history
11707
12645
  caseId: string) → `Promise<RelatedResponse>`
11708
12646
  Get related threads and records for a case (admin only) GET /cases/:caseId/related
11709
12647
 
12648
+ ### app.options
12649
+
12650
+ **get**(collectionId: string,
12651
+ appId: string,
12652
+ source: string,
12653
+ opts: { q?: string; version?: string; admin?: boolean } = {},) → `Promise<import('../types/appOptions').AppOptionsResponse>`
12654
+ `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.
12655
+
12656
+ **saveList**(collectionId: string,
12657
+ appId: string,
12658
+ listId: string,
12659
+ values: import('../types/appOptions') → `void`
12660
+ 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.
12661
+
11710
12662
  ### app.records
11711
12663
 
11712
12664
  General-purpose structured app objects. Use these when a simple scoped data item grows into something queryable, lifecycle-aware, or access-controlled.
@@ -12325,8 +13277,29 @@ Give this AuthKit its **own logins** (admin): its members become accounts of thi
12325
13277
  **invite**(collectionId: string, authKitId: string, body: AuthKitInviteRequest) → `Promise<AuthKitInviteResponse>`
12326
13278
  Invite someone to be a member of a site with its own logins (admin). Makes their account if they have none (the only way in when the site is invitation only — `signUp: 'invite'`), finds or creates their contact in this collection with the `customFields` you pass (their level), links the two, and emails them a sign-in link to the site (`redirectUrl`, default the kit's) that works once for 7 days. The page it opens handles it like any magic link: `mode=magicLink&token=…` → {@link verifyMagicLink}. Inviting someone again sends a fresh link. Errors: `OWN_LOGINS_REQUIRED` (409), `INVALID_EMAIL` (400), `INVALID_REDIRECT_URL` (400, not one of this site's addresses), `TOO_MANY_INVITES` (429, 5 an hour per address).
12327
13279
 
13280
+ **schema**(collectionId: string) → `Promise<AuthKitSchema>`
13281
+ Every sign-in setting: its path, default, what reads it (`screens` / `server` / `both`), in plain words.
13282
+
13283
+ **setup**(collectionId: string, body: AuthKitSetupRequest = {}) → `Promise<AuthKitSetupResponse>`
13284
+ Set up the collection's sign-in in one call, safe to repeat: finds its sign-in (or makes one, with email + Google and confirm-then-signed-in, and makes it the collection's default), optionally gives it its own logins (ONE WAY — members of this site only; needed for invite-only) and saves a first settings patch. Errors: `INVALID_CONFIG` (400, `problems`), `OWN_LOGINS_REQUIRED` (409), `MEMBER_POOL_CONFLICT` (409), `SECRET_IN_SETTINGS` (400).
13285
+
13286
+ **settings**(collectionId: string, authKitId: string) → `Promise<AuthKitSettingsResponse>`
13287
+ What sign-in does now: the stored config, every default filled in, which secrets are set (masked), and checks.
13288
+
13289
+ **secretEntryLink**(collectionId: string, authKitId: string, name: string, opts: { label?: string } = {}) → `Promise<AuthKitSecretLink>`
13290
+ A one-time SmartLinks page where the PERSON types a secret (e.g. `linkedInClientSecret`) — so it never passes through a chat or your code. Give them the `url`; it works once, for 30 minutes. Asking again replaces the link. Check it landed with {@link settings} (`secrets.<name>.set`).
13291
+
13292
+ **setSecret**(collectionId: string, authKitId: string, name: string, value: string) → `Promise<`
13293
+ Store a secret you already hold (server-side code only — never ask a person to paste one to you). Returns the masked hint.
13294
+
13295
+ **removeSecret**(collectionId: string, authKitId: string, name: string) → `Promise<`
13296
+ Remove a secret (that provider then uses SmartLinks' own app).
13297
+
13298
+ **previewEmail**(collectionId: string, authKitId: string, kind: AuthKitEmailKind, draft: Pick<AuthKitConfigInput, 'emailTemplates' | 'emailBranding' | 'branding'> = {}) → `Promise<AuthKitEmailPreview>`
13299
+ An account email as it would be sent now — or with draft settings (`emailTemplates`, `emailBranding`, `branding`; checked like a save, nothing stored). Sample values stand in for the person and the link.
13300
+
12328
13301
  **remove**(collectionId: string, authKitId: string) → `Promise<void>`
12329
- Invite someone to be a member of a site with its own logins (admin). Makes their account if they have none (the only way in when the site is invitation only — `signUp: 'invite'`), finds or creates their contact in this collection with the `customFields` you pass (their level), links the two, and emails them a sign-in link to the site (`redirectUrl`, default the kit's) that works once for 7 days. The page it opens handles it like any magic link: `mode=magicLink&token=…` → {@link verifyMagicLink}. Inviting someone again sends a fresh link. Errors: `OWN_LOGINS_REQUIRED` (409), `INVALID_EMAIL` (400), `INVALID_REDIRECT_URL` (400, not one of this site's addresses), `TOO_MANY_INVITES` (429, 5 an hour per address).
13302
+ An account email as it would be sent now — or with draft settings (`emailTemplates`, `emailBranding`, `branding`; checked like a save, nothing stored). Sample values stand in for the person and the link.
12330
13303
 
12331
13304
  ### batch
12332
13305
 
@@ -12501,13 +13474,13 @@ Delete a slot (admin; refused while places are booked).
12501
13474
 
12502
13475
  ### chat.completions
12503
13476
 
12504
- **create**(collectionId: string,
13477
+ **create**(collectionId: string,
12505
13478
  request: ChatCompletionRequest) → `Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>>`
12506
13479
  Create a chat completion (streaming or non-streaming)
12507
13480
 
12508
13481
  ### chat.responses
12509
13482
 
12510
- **create**(collectionId: string,
13483
+ **create**(collectionId: string,
12511
13484
  request: ResponsesRequest) → `Promise<ResponsesResult | AsyncIterable<ResponsesStreamEvent>>`
12512
13485
  Create a Responses API request (streaming or non-streaming)
12513
13486
 
@@ -12891,6 +13864,14 @@ Get a single container (public). Soft-deleted containers return a 404. Same `?t
12891
13864
  params?: Pick<ListContainerItemsParams, 'limit' | 'offset'>) → `Promise<ContainerItemsResponse>`
12892
13865
  List current contents of a container (public). Returns only items where `removedAt` is null. No `?history` option on the public side.
12893
13866
 
13867
+ ### content
13868
+
13869
+ **provide**(handler: ContentHandler) → `() => void`
13870
+ An app says what its screen shows, in words (an exhibit's text, a recipe, a form's purpose). Called whenever an assistant needs it. Works in an iframe (the host asks by message) and in the same page (a direct component). Returns a function that stops providing.
13871
+
13872
+ **request**(options: { frame?: Window | null; reason?: string; timeoutMs?: number } = {}) → `Promise<ScreenContent | null>`
13873
+ A host asks what the app on screen shows: an app in an iframe (pass its window as `frame`), or apps in this page that called `provide`. Resolves null if nothing answers within the time.
13874
+
12894
13875
  ### crate
12895
13876
 
12896
13877
  **list**(collectionId: string,
@@ -13028,6 +14009,14 @@ Call an ADMIN app server function (surface `'admin'`; requires an admin session)
13028
14009
  **list**(collectionId: string, opts: FunctionCallOptions = {}) → `Promise<FunctionListResponse>`
13029
14010
  List the public functions available for a collection (discovery). Scoped to one app when an appId is given (or set as the SDK app context): `GET /public/collection/:c[/app/:appId]/functions`.
13030
14011
 
14012
+ ### guide
14013
+
14014
+ **get**(collectionId: string, surface?: GuideSurface) → `Promise<GuideInfo>`
14015
+ Is the guide on for this surface, and how does it present itself?
14016
+
14017
+ **start**(collectionId: string, options: GuideStartOptions) → `Promise<LiveHandle>`
14018
+ Start a live conversation with the guide. Resolves once connected; the handle pauses, stops, sends text.
14019
+
13031
14020
  ### http
13032
14021
 
13033
14022
  **get**(path: string) → `Promise<T>`
@@ -13436,97 +14425,108 @@ Validate an NFC tag payload (public). POST /public/nfc/validate
13436
14425
  **lookupTag**(tagId: string) → `Promise<NfcTagInfo[]>`
13437
14426
  Lookup a tag by its ID (public). GET /public/nfc/findByTag/:tagId
13438
14427
 
14428
+ ### operations
14429
+
14430
+ **admin**(collectionId: string, opts: { appId?: string } = {}) → `OperationsAdmin`
14431
+ The operations objects for one collection (admin). but a work order is always created for an app, so `workOrders.create` needs this. ```typescript const ops = operations.admin('coll_123', { appId: 'production' }) const caps = await ops.stock.position({ productId: 'brass-cap', horizonDays: 90 }) caps.onHand.available // 400 caps.shortfall // { quantity: 140, firstShortOn: '2026-12-14' } | null await ops.stock.move({ from: binId, to: cageId, productId: 'brass-cap', quantity: 100 }) await ops.workOrders.setStatus('19264', 'on-hold', { reason: 'Waiting for caps' }) ```
14432
+
14433
+ **describe**(collectionId: string) → `Promise<`
14434
+ What the server offers, by group: `{ workOrders: [...], stock: [...], boms: [...], madeFrom: [...] }`.
14435
+
13439
14436
  ### order
13440
14437
 
13441
- **create**(collectionId: string,
14438
+ **create**(collectionId: string,
13442
14439
  data: CreateOrderRequest) → `Promise<CreateOrderResponse>`
13443
14440
  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' } }) ```
13444
14441
 
13445
- **get**(collectionId: string,
13446
- orderId: string,
14442
+ **get**(collectionId: string,
14443
+ orderId: string,
13447
14444
  params?: GetOrderParams) → `Promise<GetOrderResponse>`
13448
14445
  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 ```
13449
14446
 
13450
- **update**(collectionId: string,
13451
- orderId: string,
14447
+ **update**(collectionId: string,
14448
+ orderId: string,
13452
14449
  data: UpdateOrderRequest) → `Promise<UpdateOrderResponse>`
13453
14450
  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' } }) ```
13454
14451
 
13455
- **remove**(collectionId: string,
14452
+ **remove**(collectionId: string,
13456
14453
  orderId: string) → `Promise<DeleteOrderResponse>`
13457
14454
  Delete an order and all its items (cascade delete). ```typescript await order.remove('coll_123', 'order_abc123') ```
13458
14455
 
13459
- **list**(collectionId: string,
14456
+ **list**(collectionId: string,
13460
14457
  params?: ListOrdersRequest) → `Promise<ListOrdersResponse>`
13461
14458
  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 }) ```
13462
14459
 
13463
- **getItems**(collectionId: string,
13464
- orderId: string,
14460
+ **getItems**(collectionId: string,
14461
+ orderId: string,
13465
14462
  params?: GetOrderItemsParams) → `Promise<GetOrderItemsResponse>`
13466
14463
  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 }) ```
13467
14464
 
13468
- **addItems**(collectionId: string,
13469
- orderId: string,
14465
+ **addItems**(collectionId: string,
14466
+ orderId: string,
13470
14467
  data: AddItemsRequest) → `Promise<AddItemsResponse>`
13471
14468
  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`) ```
13472
14469
 
13473
- **removeItems**(collectionId: string,
13474
- orderId: string,
14470
+ **lineDone**(collectionId: string, orderId: string, itemId: string, by: number) → `Promise<OrderItem>`
14471
+ 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) ```
14472
+
14473
+ **removeItems**(collectionId: string,
14474
+ orderId: string,
13475
14475
  data: RemoveItemsRequest) → `Promise<RemoveItemsResponse>`
13476
- Remove specific items from an order. ```typescript const updated = await order.removeItems('coll_123', 'order_abc123', { itemIds: ['item_001', 'item_002'] }) ```
14476
+ 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) ```
13477
14477
 
13478
- **lookup**(collectionId: string,
14478
+ **lookup**(collectionId: string,
13479
14479
  data: LookupOrdersRequest) → `Promise<LookupOrdersResponse>`
13480
14480
  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' } ] }) ```
13481
14481
 
13482
- **query**(collectionId: string,
14482
+ **query**(collectionId: string,
13483
14483
  data: QueryOrdersRequest) → `Promise<QueryOrdersResponse>`
13484
14484
  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 }) ```
13485
14485
 
13486
- **reports**(collectionId: string,
14486
+ **reports**(collectionId: string,
13487
14487
  params?: ReportsParams) → `Promise<ReportsResponse>`
13488
14488
  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 }) ```
13489
14489
 
13490
- **findByProduct**(collectionId: string,
13491
- productId: string,
14490
+ **findByProduct**(collectionId: string,
14491
+ productId: string,
13492
14492
  params?: LookupByProductParams) → `Promise<LookupByProductResponse>`
13493
14493
  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`) }) ```
13494
14494
 
13495
- **getAnalytics**(collectionId: string,
14495
+ **getAnalytics**(collectionId: string,
13496
14496
  orderId: string) → `Promise<OrderAnalyticsResponse>`
13497
14497
  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`) }) } ```
13498
14498
 
13499
- **getTimeline**(collectionId: string,
13500
- orderId: string,
14499
+ **getTimeline**(collectionId: string,
14500
+ orderId: string,
13501
14501
  params?: TimelineRequest) → `Promise<TimelineResponse>`
13502
14502
  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 }) ```
13503
14503
 
13504
- **getLocationHistory**(collectionId: string,
13505
- orderId: string,
14504
+ **getLocationHistory**(collectionId: string,
14505
+ orderId: string,
13506
14506
  params?: LocationRequest) → `Promise<LocationResponse>`
13507
14507
  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}`) }) ```
13508
14508
 
13509
- **getBulkAnalytics**(collectionId: string,
14509
+ **getBulkAnalytics**(collectionId: string,
13510
14510
  data: BulkAnalyticsRequest) → `Promise<BulkAnalyticsResponse>`
13511
14511
  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`) } }) ```
13512
14512
 
13513
- **getCollectionSummary**(collectionId: string,
14513
+ **getCollectionSummary**(collectionId: string,
13514
14514
  params?: SummaryRequest) → `Promise<CollectionSummaryResponse>`
13515
14515
  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' }) ```
13516
14516
 
13517
- **findOrdersByProduct**(collectionId: string,
13518
- productId: string,
14517
+ **findOrdersByProduct**(collectionId: string,
14518
+ productId: string,
13519
14519
  params?: FindOrdersByAttributeParams) → `Promise<FindOrdersByAttributeResponse>`
13520
14520
  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`) ```
13521
14521
 
13522
- **findItemsByProduct**(collectionId: string,
13523
- productId: string,
14522
+ **findItemsByProduct**(collectionId: string,
14523
+ productId: string,
13524
14524
  params?: FindItemsByAttributeParams) → `Promise<FindItemsByAttributeResponse>`
13525
14525
  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`) ```
13526
14526
 
13527
- **getOrderIdsByAttribute**(collectionId: string,
13528
- attribute: 'productId',
13529
- value: string,
14527
+ **getOrderIdsByAttribute**(collectionId: string,
14528
+ attribute: 'productId',
14529
+ value: string,
13530
14530
  params?: GetOrderIdsParams) → `Promise<GetOrderIdsResponse>`
13531
14531
  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 } ) ```
13532
14532
 
@@ -13555,7 +14555,7 @@ What phones reported about one chip (errors.report with entityType 'tag'), newes
13555
14555
 
13556
14556
  ### podcast
13557
14557
 
13558
- **generate**(collectionId: string,
14558
+ **generate**(collectionId: string,
13559
14559
  request: GeneratePodcastRequest) → `Promise<GeneratePodcastResponse>`
13560
14560
  Generate a NotebookLM-style conversational podcast from product documents
13561
14561
 
@@ -13821,11 +14821,11 @@ Get the active transfer/status for a proof (owner, collection admin, or the name
13821
14821
 
13822
14822
  ### publicClient
13823
14823
 
13824
- **chat**(collectionId: string,
14824
+ **chat**(collectionId: string,
13825
14825
  request: PublicChatRequest) → `Promise<PublicChatResponse>`
13826
14826
  Chat with product assistant (RAG)
13827
14827
 
13828
- **agentRun**(collectionId: string,
14828
+ **agentRun**(collectionId: string,
13829
14829
  body: PublicAgentRunRequest) → `Promise<AgentRunResult>`
13830
14830
  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
13831
14831
 
@@ -13838,25 +14838,21 @@ Clear session history
13838
14838
  **getRateLimit**(collectionId: string, userId: string) → `Promise<RateLimitStatus>`
13839
14839
  Check rate limit status
13840
14840
 
13841
- **getToken**(collectionId: string,
13842
- request: EphemeralTokenRequest) → `Promise<EphemeralTokenResponse>`
13843
- Generate ephemeral token for Gemini Live
13844
-
13845
14841
  ### publicClient.sessions
13846
14842
 
13847
- **create**(collectionId: string,
14843
+ **create**(collectionId: string,
13848
14844
  body: AiSessionCreate & { scope?: 'owner' | 'public' } = {}) → `Promise<AiSession>`
13849
14845
 
13850
- **list**(collectionId: string,
14846
+ **list**(collectionId: string,
13851
14847
  params?: { appId?: string; limit?: number }) → `Promise<`
13852
14848
  List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
13853
14849
 
13854
14850
  **get**(collectionId: string, id: string) → `Promise<AiSession>`
13855
14851
  List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
13856
14852
 
13857
- **append**(collectionId: string,
13858
- id: string,
13859
- items: ResponseInputItem[],
14853
+ **append**(collectionId: string,
14854
+ id: string,
14855
+ items: ResponseInputItem[],
13860
14856
  opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
13861
14857
  List the signed-in consumer's own ('owner') sessions — requires an authKit bearer.
13862
14858
 
@@ -13870,11 +14866,11 @@ Resolve a short code to related resource identifiers.
13870
14866
 
13871
14867
  ### rag
13872
14868
 
13873
- **indexDocument**(collectionId: string,
14869
+ **indexDocument**(collectionId: string,
13874
14870
  request: IndexDocumentRequest) → `Promise<IndexDocumentResponse>`
13875
14871
  Index a document for RAG
13876
14872
 
13877
- **configureAssistant**(collectionId: string,
14873
+ **configureAssistant**(collectionId: string,
13878
14874
  request: ConfigureAssistantRequest) → `Promise<ConfigureAssistantResponse>`
13879
14875
  Configure AI assistant behavior
13880
14876
 
@@ -13970,9 +14966,9 @@ List sessions, most-recently-active first (optionally filtered by app).
13970
14966
  **get**(collectionId: string, id: string) → `Promise<AiSession>`
13971
14967
  Get one session, including its full transcript.
13972
14968
 
13973
- **append**(collectionId: string,
13974
- id: string,
13975
- items: ResponseInputItem[],
14969
+ **append**(collectionId: string,
14970
+ id: string,
14971
+ items: ResponseInputItem[],
13976
14972
  opts?: { usage?: Record<string, any> }) → `Promise<AiSession>`
13977
14973
  Append Responses items (input/output/tool) to a session — the manual-persistence path.
13978
14974
 
@@ -14077,17 +15073,17 @@ Reverse lookup by ref via POST (public). `POST /public/collection/:collectionId/
14077
15073
 
14078
15074
  ### tools
14079
15075
 
14080
- **run**(collectionId: string,
14081
- name: K,
14082
- args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
14083
- export async function run<T = any>(
14084
- collectionId: string,
14085
- name: string,
14086
- args?: Record<string, any>,
14087
- ): Promise<ToolRunResult<T>>
14088
- export async function run(
14089
- collectionId: string,
14090
- name: string,
15076
+ **run**(collectionId: string,
15077
+ name: K,
15078
+ args: AiToolArgsMap[K],) → `Promise<ToolRunResult>
15079
+ export async function run<T = any>(
15080
+ collectionId: string,
15081
+ name: string,
15082
+ args?: Record<string, any>,
15083
+ ): Promise<ToolRunResult<T>>
15084
+ export async function run(
15085
+ collectionId: string,
15086
+ name: string,
14091
15087
  args: Record<string, any> =`
14092
15088
  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
14093
15089
 
@@ -14120,7 +15116,7 @@ Invoke ONE built-in server tool directly — no model in the loop. This is the "
14120
15116
 
14121
15117
  ### tts
14122
15118
 
14123
- **generate**(collectionId: string,
15119
+ **generate**(collectionId: string,
14124
15120
  request: TTSRequest) → `Promise<Blob>`
14125
15121
  Generate text-to-speech audio
14126
15122
 
@@ -14149,6 +15145,41 @@ Create or update a user data item. The item object must include an `id` field. `
14149
15145
  **remove**(appId: string, itemId: string) → `Promise<void>`
14150
15146
  Delete a user data item by ID. ```typescript await userAppData.remove('garden-planner', 'bed-1'); ```
14151
15147
 
15148
+ ### userGroups
15149
+
15150
+ **mine**(collectionId: string) → `Promise<MyUserGroups>`
15151
+ The signed-in person's own user groups in this collection. Not signed in → both lists empty. Nobody can ask about anyone else with this. ```typescript const { userGroups: mine } = await userGroups.mine('coll_123') const canRelease = mine.includes('qc-controller') ```
15152
+
15153
+ **list**(collectionId: string) → `Promise<UserGroup[]>`
15154
+ Every user group in the collection (admin).
15155
+
15156
+ **get**(collectionId: string, userGroupId: string) → `Promise<UserGroup>`
15157
+ One user group (admin).
15158
+
15159
+ **create**(collectionId: string, data: CreateUserGroupRequest) → `Promise<UserGroup>`
15160
+ Create a user group (admin). Its key is made from the name unless you give one. ```typescript const qc = await userGroups.create('coll_123', { name: 'QC Controllers' }) qc.key // 'qc-controllers' ```
15161
+
15162
+ **update**(collectionId: string, userGroupId: string, data: UpdateUserGroupRequest) → `Promise<UserGroup>`
15163
+ Change a user group (admin): its name, description, or anything else you keep on it. The key stays. To change who is in it, prefer `addMember` / `removeMember`: saving a whole `members` list here can overwrite a change someone else made at the same moment.
15164
+
15165
+ **remove**(collectionId: string, userGroupId: string) → `Promise<UserGroup>`
15166
+ Delete a user group (admin). Its members lose whatever it allowed.
15167
+
15168
+ **members**(collectionId: string, userGroupId: string) → `Promise<UserGroupMember[]>`
15169
+ The people in a user group, with name and email (admin).
15170
+
15171
+ **addMember**(collectionId: string, userGroupId: string, who: AddUserGroupMemberRequest) → `Promise<UserGroup>`
15172
+ Add one person (admin), by user id or by email. By email, the person is found in the collection's logins or added to them (no welcome email is sent). Adding someone who is already in changes nothing. ```typescript await userGroups.addMember('coll_123', qc.id, { email: 'sam@example.com', name: 'Sam' }) ```
15173
+
15174
+ **removeMember**(collectionId: string, userGroupId: string, userId: string) → `Promise<UserGroup>`
15175
+ Remove one person (admin).
15176
+
15177
+ **history**(collectionId: string, params: UserGroupHistoryParams = {}) → `Promise<UserGroupChange[]>`
15178
+ What changed, newest first (admin): user groups created, renamed and deleted, and every person added or removed, each with the admin who did it (`actorId`) and when (`at`). Give `userGroupId` for one user group, `userId` for everything about one person, or neither for the whole collection. Covers the last 30 days unless you give `from` / `to` (at most 400 days). Takes about a second. ```typescript const who = await userGroups.history('coll_123', { userId: 'uid_1' }) // [{ at, type: 'usergroup.member-added', actorId: 'uid_admin', data: { key: 'qc-controllers', userId: 'uid_1', … } }] ```
15179
+
15180
+ **ofUser**(collectionId: string, userId: string) → `Promise<UserGroupRef[]>`
15181
+ The user groups one person is in (admin).
15182
+
14152
15183
  ### variant
14153
15184
 
14154
15185
  **get**(collectionId: string,