@stndrds/schema 1.0.0-alpha.91 → 1.0.0-alpha.93

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/dist/index.d.mts CHANGED
@@ -1,138 +1,10 @@
1
- import { A as Attribute, a as AttributeType, R as RollupAttribute, T as Timestamps, L as LocationGranularity, b as Location, F as FormulaAttribute, C as CompletionStatus, S as StatusAttribute, c as SelectAttribute, M as MultiselectAttribute, P as Phone, d as Currency, O as ObjectRecord, D as DateAttribute, U as UserAttribute, e as DocumentAttribute, f as FeatureGate, g as TextAttribute, h as TextAreaAttribute, i as RichtextAttribute, j as RichtextFeature, N as NumberAttribute, k as CheckboxAttribute, l as PhoneAttribute, m as CurrencyAttribute, n as Option, o as LocationAttribute, p as FileAttribute, q as RelationAttribute, r as RatingAttribute, B as BilateralConfig, s as SingleRelationAttribute, t as MultiRelationAttribute, u as RelationTarget, v as FormulaReturnType, w as RollupFunction, x as ObjectDefinition, y as FlagValueType, z as FeatureFlagDefinition, E as FlagLevel, G as FeatureFlagsRepository, H as StaticFlagDefault, I as ResolvedFlag } from './validators-BFgj3O3w.mjs';
2
- export { J as AttributeGroup, K as BaseAttribute, Q as DEFAULT_VALIDATION_MESSAGES, V as DateFormat, W as DateValue, X as FORBIDDEN_PROPERTY_TYPES, Y as FeatureFlagsConfig, Z as FlagOverride, _ as ForbiddenPropertyType, $ as NON_SORTABLE_TYPES, a0 as NumberUnit, a1 as ObjectAttribute, a2 as OptionPropertyAttribute, a3 as PropertyAttribute, a4 as PropertySchema, a5 as PropertyType, a6 as RELATION_TARGET_ANY, a7 as RESERVED_ATTRIBUTE_NAMES, a8 as ReservedAttributeName, a9 as SYSTEM_FIELD_NAMES, aa as StatusGroup, ab as SystemFieldName, ac as ValidationMessages, ad as ValidationResult, ae as attributeConfigSchemas, af as checkboxConfigSchema, ag as computeRecordStatus, ah as createAttributeValidator, ai as createCheckboxValidator, aj as createCurrencyValidator, ak as createDateValidator, al as createDraftValidator, am as createFileValidator, an as createFormAttributeValidator, ao as createFormulaValidator, ap as createLocationValidator, aq as createMultiRelationValidator, ar as createMultiselectValidator, as as createNumberValidator, at as createObjectValidator, au as createPhoneValidator, av as createRatingValidator, aw as createRelationValidator, ax as createRichtextValidator, ay as createRollupValidator, az as createSelectValidator, aA as createSingleRelationValidator, aB as createStatusValidator, aC as createTextAreaValidator, aD as createTextValidator, aE as createUserValidator, aF as currencyConfigSchema, aG as dateConfigSchema, aH as documentConfigSchema, aI as fileConfigSchema, aJ as formatZodErrors, aK as formulaConfigSchema, aL as getAttributeConfigSchema, aM as getMissingRequiredAttributes, aN as hasOptions, aO as inferInverseCardinality, aP as isAttributeSortable, aQ as isBilateralRelation, aR as isRecordComplete, aS as isUniversalRelation, aT as locationConfigSchema, aU as multiselectConfigSchema, aV as numberConfigSchema, aW as parseAttributeConfig, aX as phoneConfigSchema, aY as ratingConfigSchema, aZ as relationConfigSchema, a_ as richtextConfigSchema, a$ as rollupConfigSchema, b0 as safeParseAttributeConfig, b1 as selectConfigSchema, b2 as statusConfigSchema, b3 as textConfigSchema, b4 as textareaConfigSchema, b5 as userConfigSchema, b6 as validateAttribute, b7 as validateAttributeConfig, b8 as validateDraft, b9 as validateDraftOrThrow, ba as validateObject, bb as validateObjectOrThrow } from './validators-BFgj3O3w.mjs';
3
- import { MimeType, IconName, ColorId, CountryIso3, CurrencyCode } from '@stndrds/constants';
1
+ import { S as SortRule, F as FilterState, W as WorkflowNode, a as FormNode, b as WorkflowNodeType, T as Timestamps, A as Attribute, R as RelationFieldConfig, c as FlowHeadingRow, d as FlowSeparatorRow, e as FlowTextRow, f as FlowRelationListRow, g as WorkflowSlot, h as WorkflowTheme, i as RelationBufferMap, j as AttributeType, V as ViewType, k as ViewConfig, C as ConfigOverrides, l as WorkflowStatus, m as WorkflowLayout, n as WorkflowConfig, o as WorkflowDefinition, I as InstanceStatus, p as WorkflowExecutionContext, q as WorkflowTransition, P as PendingAction, L as LocationGranularity, r as Location, s as FormulaAttribute, t as RollupAttribute, u as CompletionStatus, v as StatusAttribute, w as SelectAttribute, M as MultiselectAttribute, x as Phone, y as Currency, O as ObjectRecord, D as DateAttribute, U as UserAttribute, z as DocumentAttribute, B as FeatureGate, E as TextAttribute, G as TextAreaAttribute, H as RichtextAttribute, J as RichtextFeature, N as NumberAttribute, K as CheckboxAttribute, Q as PhoneAttribute, X as CurrencyAttribute, Y as Option, Z as LocationAttribute, _ as FileAttribute, $ as RelationAttribute, a0 as RatingAttribute, a1 as BilateralConfig, a2 as SingleRelationAttribute, a3 as MultiRelationAttribute, a4 as RelationTarget, a5 as FormulaReturnType, a6 as RollupFunction, a7 as MigrationDefinition, a8 as ObjectDefinition, a9 as DetailViewLayout, aa as SidePanelConfig, ab as Field, ac as AttributeGroupField, ad as FieldGroup, ae as RelationGroup, af as Group, ag as TableTab, ah as CreateMode, ai as DetailViewDefinition, aj as Tab, ak as ListViewDefinition, al as SlotMode, am as FlowFieldsRow, an as ConditionGroup, ao as ConditionRule, ap as FlagValueType, aq as FeatureFlagDefinition, ar as FlagLevel, as as FeatureFlagsRepository, at as StaticFlagDefault, au as ResolvedFlag, av as ViewDefinition, aw as ListViewConfig, ax as ListViewTab } from './validators-CwhyfvP7.mjs';
2
+ export { ay as AIActionConfig, az as AIActionType, aA as AINode, aB as ActivityTab, aC as AdvancedFilterState, aD as AssignNode, aE as AssignmentMapping, aF as AssignmentSource, aG as AttributeGroup, aH as BaseAttribute, aI as BufferedRecord, aJ as BuiltInTransform, aK as CalendarViewConfig, aL as CalendarViewDefinition, aM as CanvasViewport, aN as CheckboxFilterOperator, aO as CodeExecutionAction, aP as ConditionNode, aQ as ConditionOperator, aR as CurrencyFilterValue, aS as CustomTab, aT as DEFAULT_RETENTION_POLICY, aU as DEFAULT_THEME, aV as DEFAULT_VALIDATION_MESSAGES, aW as DateFilterOperator, aX as DateFormat, aY as DateValue, aZ as DetailViewConfig, a_ as DisplayRecord, a$ as DocumentGenerationAction, b0 as DocumentsTab, b1 as EndNode, b2 as ExtendedFilterRule, b3 as FORBIDDEN_PROPERTY_TYPES, b4 as FeatureFlagsConfig, b5 as FilterCombinator, b6 as FilterGroup, b7 as FilterOperator, b8 as FilterRule, b9 as FilterValue, ba as FlagOverride, bb as FlowDefinition, bc as FlowPage, bd as FlowRelation, be as FlowRow, bf as FlowRowField, bg as FlowRowType, bh as FlowSlot, bi as FlowStatus, bj as FlowsTab, bk as ForbiddenPropertyType, bl as FormDensity, bm as FormFieldRef, bn as FormTab, bo as GalleryViewConfig, bp as GalleryViewDefinition, bq as GeneratedDocument, br as InverseSource, bs as ListViewLayout, bt as MigrationError, bu as MigrationPreview, bv as MultiselectFilterOperator, bw as NON_SORTABLE_TYPES, bx as NO_VALUE_OPERATORS, by as NoValueOperator, bz as NodePosition, bA as NumberFilterOperator, bB as NumberUnit, bC as OPERATORS_BY_TYPE, bD as ObjectAttribute, bE as OptionPropertyAttribute, bF as PhoneFilterValue, bG as PropertyAttribute, bH as PropertySchema, bI as PropertyType, bJ as QueryState, bK as RELATION_TARGET_ANY, bL as RESERVED_ATTRIBUTE_NAMES, bM as RecordPatch, bN as RelationBuffer, bO as RelationFilterOperator, bP as RelationQualifierPatch, bQ as RelationSource, bR as RelativeDateValue, bS as ReservedAttributeName, bT as RetentionPolicy, bU as RichtextTab, bV as SYSTEM_FIELD_NAMES, bW as SchemaOperation, bX as SchemaTransform, bY as SelectFilterOperator, bZ as SortDirection, b_ as StartNode, b$ as StatusGroup, c0 as SystemFieldName, c1 as TabType, c2 as TableSource, c3 as TextFilterOperator, c4 as ThemeColors, c5 as ThemeLogo, c6 as ThemeTypography, c7 as TimelineViewConfig, c8 as TimelineViewDefinition, c9 as TransformSource, ca as ValidationMessages, cb as ValidationResult, cc as ViewOperation, cd as ViewOverlay, ce as ViewTransform, cf as WorkflowError, cg as WorkflowInstance, ch as and, ci as attributeConfigSchemas, cj as canResumeInstance, ck as checkboxConfigSchema, cl as computeRecordStatus, cm as createAttributeValidator, cn as createCheckboxValidator, co as createCurrencyValidator, cp as createDateValidator, cq as createDraftValidator, cr as createEmptyContext, cs as createFileValidator, ct as createFormAttributeValidator, cu as createFormulaValidator, cv as createLocationValidator, cw as createMultiRelationValidator, cx as createMultiselectValidator, cy as createNumberValidator, cz as createObjectValidator, cA as createPhoneValidator, cB as createRatingValidator, cC as createRelationValidator, cD as createRichtextValidator, cE as createRollupValidator, cF as createSelectValidator, cG as createSingleRelationValidator, cH as createStartTransition, cI as createStatusValidator, cJ as createTextAreaValidator, cK as createTextValidator, cL as createUserValidator, cM as currencyConfigSchema, cN as dateConfigSchema, cO as documentConfigSchema, cP as eq, cQ as fileConfigSchema, cR as formatZodErrors, cS as formulaConfigSchema, cT as generateCssVariables, cU as getAttributeConfigSchema, cV as getContextValue, cW as getMissingRequiredAttributes, cX as getRollupFilterOperators, cY as hasOptions, cZ as inValues, c_ as inferInverseCardinality, c$ as isAINode, d0 as isActivityTab, d1 as isAdvancedFormNode, d2 as isAssignNode, d3 as isAttributeSortable, d4 as isBilateralRelation, d5 as isCalendarView, d6 as isConditionGroup, d7 as isConditionNode, d8 as isConditionRule, d9 as isCustomTab, da as isDetailView, db as isDocumentsTab, dc as isEndNode, dd as isFieldGroup, de as isFlowDefinition, df as isFlowFieldsRow, dg as isFlowPublished, dh as isFlowRelationListRow, di as isFlowsTab, dj as isFormNode, dk as isFormTab, dl as isGalleryView, dm as isInstanceTerminal, dn as isInstanceWaiting, dp as isInverseSourceTab, dq as isLayoutRow, dr as isListView, ds as isNoValueOperator, dt as isRecordComplete, du as isRelationGroup, dv as isRelationSourceTab, dw as isRichtextTab, dx as isSimpleFormNode, dy as isStartNode, dz as isSystemFlow, dA as isSystemWorkflow, dB as isTableTab, dC as isTimelineView, dD as isUniversalRelation, dE as isWorkflowDefinition, dF as isWorkflowPublished, dG as locationConfigSchema, dH as mergeWithDefaults, dI as multiselectConfigSchema, dJ as neq, dK as numberConfigSchema, dL as or, dM as parseAttributeConfig, dN as phoneConfigSchema, dO as ratingConfigSchema, dP as relationConfigSchema, dQ as richtextConfigSchema, dR as rollupConfigSchema, dS as safeParseAttributeConfig, dT as selectConfigSchema, dU as setContextValue, dV as statusConfigSchema, dW as textConfigSchema, dX as textareaConfigSchema, dY as userConfigSchema, dZ as validateAttribute, d_ as validateAttributeConfig, d$ as validateDraft, e0 as validateDraftOrThrow, e1 as validateObject, e2 as validateObjectOrThrow } from './validators-CwhyfvP7.mjs';
3
+ import { MimeType, IconName, CountryIso3, CurrencyCode, ColorId } from '@stndrds/constants';
4
4
  import { Uuid, TenantId } from './utils.mjs';
5
5
  export { UserId, asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify } from './utils.mjs';
6
6
  import { z } from 'zod';
7
7
 
8
- /** Operators for text-based attributes */
9
- type TextFilterOperator = "is" | "is_not" | "contains" | "not_contains" | "starts_with" | "ends_with" | "is_empty" | "is_not_empty";
10
- /** Operators for number-based attributes */
11
- type NumberFilterOperator = "eq" | "neq" | "lt" | "gt" | "lte" | "gte" | "is_empty" | "is_not_empty";
12
- /** Operators for checkbox */
13
- type CheckboxFilterOperator = "is_checked" | "is_not_checked";
14
- /** Operators for date-based attributes */
15
- type DateFilterOperator = "is" | "is_not" | "before" | "after" | "on_or_before" | "on_or_after" | "is_within" | "is_empty" | "is_not_empty";
16
- /** Operators for select-based attributes (supports single or multi-value filtering) */
17
- type SelectFilterOperator = "is" | "is_not" | "any_of" | "none_of" | "is_empty" | "is_not_empty";
18
- /** Operators for multiselect-based attributes */
19
- type MultiselectFilterOperator = "contains" | "not_contains" | "is_empty" | "is_not_empty";
20
- /** Operators for relation-based attributes (supports single or multi-value filtering) */
21
- type RelationFilterOperator = "any_of" | "none_of" | "contains" | "not_contains" | "is_empty" | "is_not_empty";
22
- /** All possible filter operators */
23
- type FilterOperator = TextFilterOperator | NumberFilterOperator | CheckboxFilterOperator | DateFilterOperator | SelectFilterOperator | MultiselectFilterOperator | RelationFilterOperator;
24
- /** Relative date value for "is_within" operator */
25
- interface RelativeDateValue {
26
- amount: number;
27
- unit: "days" | "weeks" | "months" | "years";
28
- direction: "past" | "future";
29
- }
30
- /** Currency filter value with amount and optional currency codes
31
- * - code: undefined or [] = any currency
32
- * - code: string[] = filter by specific currencies
33
- */
34
- interface CurrencyFilterValue {
35
- value: number | null;
36
- code?: string[];
37
- }
38
- /** Phone filter value with number and optional country code */
39
- interface PhoneFilterValue {
40
- phoneNumber: string | null;
41
- countryCode?: string;
42
- }
43
- /** Filter value can be various types depending on the attribute */
44
- type FilterValue = string | number | boolean | string[] | RelativeDateValue | CurrencyFilterValue | PhoneFilterValue | null;
45
- /** A single filter rule */
46
- interface FilterRule {
47
- /** Attribute name to filter on */
48
- attribute: string;
49
- /** Filter operator */
50
- operator: FilterOperator;
51
- /** Filter value (null for operators like is_empty) */
52
- value: FilterValue;
53
- }
54
- /**
55
- * Extended filter rule with optional attribute definition.
56
- * When provided, enables smarter type-aware filtering (e.g., array operators for multiselect).
57
- */
58
- interface ExtendedFilterRule extends FilterRule {
59
- /** Full attribute definition for type-aware filtering */
60
- attributeDef?: Attribute;
61
- }
62
- /** Combinator for filter rules */
63
- type FilterCombinator = "and" | "or";
64
- /** Complete filter state (simple mode) */
65
- interface FilterState {
66
- /** How to combine rules */
67
- combinator: FilterCombinator;
68
- /** List of filter rules */
69
- rules: FilterRule[];
70
- }
71
- /**
72
- * A filter group containing rules (used in advanced mode)
73
- * Groups can be nested up to 2 levels deep
74
- */
75
- interface FilterGroup {
76
- /** Unique identifier for this group */
77
- id: string;
78
- /** How to combine rules within this group */
79
- combinator: FilterCombinator;
80
- /** List of filter rules in this group */
81
- rules: FilterRule[];
82
- }
83
- /**
84
- * Advanced filter state with nested groups
85
- * Structure: AdvancedFilterState -> FilterGroup[] -> FilterRule[]
86
- * Maximum 2 levels of nesting
87
- */
88
- interface AdvancedFilterState {
89
- /** How to combine groups at the top level */
90
- combinator: FilterCombinator;
91
- /** List of filter groups */
92
- groups: FilterGroup[];
93
- }
94
- /** Sort direction */
95
- type SortDirection = "asc" | "desc";
96
- /** A single sort rule */
97
- interface SortRule {
98
- /** Attribute name to sort by */
99
- attribute: string;
100
- /** Sort direction */
101
- direction: SortDirection;
102
- }
103
- /** Complete query state with search, filters, sorts, and pagination */
104
- interface QueryState {
105
- /** Full-text search query */
106
- search?: string;
107
- /** Filter configuration (simple mode) */
108
- filters?: FilterState;
109
- /** Advanced filter configuration (grouped mode) */
110
- advancedFilters?: AdvancedFilterState;
111
- /** Sort configuration (multiple sorts supported) */
112
- sorts?: SortRule[];
113
- /** Pagination */
114
- limit?: number;
115
- offset?: number;
116
- }
117
- /** Mapping of attribute types to their valid operators */
118
- declare const OPERATORS_BY_TYPE: Record<AttributeType, readonly FilterOperator[]>;
119
- /** Check if an operator requires a value */
120
- type NoValueOperator = "is_empty" | "is_not_empty" | "is_checked" | "is_not_checked";
121
- /** Operators that don't require a value */
122
- declare const NO_VALUE_OPERATORS: readonly NoValueOperator[];
123
- /**
124
- * Check if an operator requires a value
125
- */
126
- declare function isNoValueOperator(operator: FilterOperator): operator is NoValueOperator;
127
- /**
128
- * Get the filter operators for a rollup attribute based on its aggregation function and target type.
129
- *
130
- * - earliest / latest → date operators
131
- * - original → operators matching targetAttributeType (falls back to numeric if unknown)
132
- * - all other functions → numeric operators (sum, avg, count, percent, etc.)
133
- */
134
- declare function getRollupFilterOperators(attr: RollupAttribute): readonly FilterOperator[];
135
-
136
8
  /**
137
9
  * Generic list options for pagination and sorting
138
10
  */
@@ -140,1896 +12,222 @@ interface ListOptions {
140
12
  limit?: number;
141
13
  offset?: number;
142
14
  /** @deprecated Use sorts instead */
143
- orderBy?: string;
144
- /** @deprecated Use sorts instead */
145
- orderDirection?: "asc" | "desc";
146
- /** Multiple sort rules */
147
- sorts?: SortRule[];
148
- /** Filter state */
149
- filters?: FilterState;
150
- /**
151
- * Include soft-deleted records in results.
152
- * By default, soft-deleted records are excluded.
153
- * @default false
154
- */
155
- includeDeleted?: boolean;
156
- /**
157
- * Include related records in results.
158
- * For qualified relations (with properties), returns format: Array<{ id, props }>
159
- * For normal relations (without properties), returns legacy format: string[]
160
- */
161
- include?: string[];
162
- }
163
-
164
- /**
165
- * Storage provider type
166
- */
167
- type StorageProvider = "s3" | "gcs" | "azure" | "local" | "cloudflare-r2" | string;
168
- /**
169
- * File visibility level
170
- */
171
- type FileVisibility = "public" | "private" | "restricted";
172
- /**
173
- * File - Represents uploaded file metadata and storage info
174
- *
175
- * ARCHITECTURE:
176
- * - Fixed table (no custom attributes)
177
- * - Manages file storage, permissions, and metadata
178
- * - uploadedBy links to user_profiles table
179
- * - Supports soft delete via deletedAt
180
- *
181
- * @example
182
- * ```typescript
183
- * const file: File = {
184
- * id: "file-123",
185
- * tenantId: "tenant-456",
186
- * name: "contract-2025.pdf",
187
- * originalName: "Contract Acme Corp 2025.pdf",
188
- * mimeType: "application/pdf",
189
- * size: 2458624,
190
- * storageProvider: "s3",
191
- * storagePath: "tenants/456/files/2025/11/contract-2025.pdf",
192
- * storageBucket: "my-app-files",
193
- * url: "https://cdn.example.com/files/file-123",
194
- * uploadedBy: "profile-789",
195
- * folderPath: "/contracts/2025",
196
- * tags: ["contract", "legal"],
197
- * visibility: "restricted",
198
- * allowedUsers: ["profile-789", "profile-456"],
199
- * createdAt: new Date(),
200
- * updatedAt: new Date(),
201
- * };
202
- * ```
203
- */
204
- interface File extends Timestamps {
205
- id: Uuid;
206
- tenantId: Uuid;
207
- /**
208
- * File name (sanitized for storage)
209
- */
210
- name: string;
211
- /**
212
- * Original file name (as uploaded by user)
213
- */
214
- originalName: string;
215
- /**
216
- * MIME type (e.g., "application/pdf", "image/jpeg")
217
- */
218
- mimeType: MimeType | string;
219
- /**
220
- * File size in bytes
221
- */
222
- size: number;
223
- /**
224
- * Storage provider (s3, gcs, azure, local, etc.)
225
- */
226
- storageProvider: StorageProvider;
227
- /**
228
- * Path in the storage bucket
229
- */
230
- storagePath: string;
231
- /**
232
- * Storage bucket name (if applicable)
233
- */
234
- storageBucket?: string;
235
- /**
236
- * Public or signed URL to access the file
237
- */
238
- url: string;
239
- /**
240
- * User who uploaded the file (FK to user_profiles)
241
- * Optional for system-generated files or anonymous uploads.
242
- */
243
- uploadedBy?: Uuid;
244
- /**
245
- * Folder path for organization (e.g., "/contracts/2025")
246
- */
247
- folderPath?: string;
248
- /**
249
- * Tags for search and categorization
250
- */
251
- tags?: string[];
252
- /**
253
- * File visibility level
254
- * - public: Anyone with the URL can access
255
- * - private: Only uploadedBy can access
256
- * - restricted: Only specific users (allowedUsers) can access
257
- */
258
- visibility: FileVisibility;
259
- /**
260
- * List of user IDs authorized to access this file (if visibility = "restricted")
261
- */
262
- allowedUsers?: Uuid[];
263
- /**
264
- * Soft delete timestamp (null = not deleted)
265
- */
266
- deletedAt?: Date;
267
- }
268
- /**
269
- * Data required to create a new file record
270
- */
271
- /**
272
- * Data for creating a new file.
273
- * Tenant ID is automatically set from execution context.
274
- */
275
- interface CreateFile {
276
- name: string;
277
- originalName: string;
278
- mimeType: MimeType | string;
279
- size: number;
280
- storageProvider: StorageProvider;
281
- storagePath: string;
282
- storageBucket?: string;
283
- url: string;
284
- uploadedBy?: Uuid;
285
- folderPath?: string;
286
- tags?: string[];
287
- visibility?: FileVisibility;
288
- allowedUsers?: Uuid[];
289
- }
290
- /**
291
- * Data for updating an existing file record
292
- */
293
- interface UpdateFile {
294
- name?: string;
295
- folderPath?: string;
296
- tags?: string[];
297
- visibility?: FileVisibility;
298
- allowedUsers?: Uuid[];
299
- }
300
-
301
- /**
302
- * Document generated during workflow execution
303
- */
304
- interface GeneratedDocument {
305
- /** Document ID (file ID) */
306
- id: string;
307
- /** URL to access the document */
308
- url: string;
309
- /** Document filename */
310
- filename?: string;
311
- /** MIME type */
312
- mimeType?: string;
313
- /** File size in bytes */
314
- size?: number;
315
- /** Additional metadata */
316
- metadata?: Record<string, unknown>;
317
- /** IDs of Document records created (one per target slot) */
318
- attachedDocumentIds?: string[];
319
- }
320
- /**
321
- * Accumulated context during workflow execution.
322
- *
323
- * This context is built up as nodes execute and is passed to each node.
324
- * It contains all the data collected and generated during the workflow.
325
- *
326
- * @example
327
- * ```typescript
328
- * const context: WorkflowExecutionContext = {
329
- * slots: {
330
- * client: {
331
- * id: "rec_123",
332
- * firstName: "John",
333
- * lastName: "Doe",
334
- * email: "john@example.com",
335
- * type: "vip"
336
- * }
337
- * },
338
- * forms: {
339
- * "client-form": {
340
- * firstName: "John",
341
- * lastName: "Doe"
342
- * }
343
- * },
344
- * documents: {},
345
- * variables: {
346
- * totalAmount: 15000
347
- * },
348
- * conditionResults: {
349
- * "check-vip": true
350
- * }
351
- * };
352
- * ```
353
- */
354
- interface WorkflowExecutionContext {
355
- /**
356
- * Records created/modified during execution, indexed by slot ID.
357
- * Contains the full record data for each slot.
358
- */
359
- slots: Record<string, Record<string, unknown>>;
360
- /**
361
- * Form submissions indexed by node ID.
362
- * Contains the raw form data submitted at each form node.
363
- */
364
- forms: Record<string, Record<string, unknown>>;
365
- /**
366
- * Documents generated during execution, indexed by node ID.
367
- * Contains document metadata and URLs.
368
- */
369
- documents: Record<string, GeneratedDocument>;
370
- /**
371
- * Custom variables set during execution.
372
- * Can be used by action nodes to store computed values.
373
- */
374
- variables: Record<string, unknown>;
375
- /**
376
- * Results of condition evaluations for debugging.
377
- * Indexed by condition node ID.
378
- */
379
- conditionResults: Record<string, boolean>;
380
- /**
381
- * IDs of records created during workflow completion.
382
- * Used for idempotence (avoid creating duplicates on retry).
383
- * Indexed by slot ID.
384
- */
385
- createdRecordIds: Record<string, string>;
386
- }
387
- /**
388
- * Create an empty execution context
389
- */
390
- declare function createEmptyContext(): WorkflowExecutionContext;
391
- /**
392
- * Get a value from the context using dot notation path.
393
- *
394
- * Supports paths like:
395
- * - "slots.client.email"
396
- * - "forms.step1.amount"
397
- * - "variables.customVar"
398
- *
399
- * @param context - The execution context
400
- * @param path - Dot notation path to the value
401
- * @returns The value at the path, or undefined if not found
402
- *
403
- * @example
404
- * ```typescript
405
- * const email = getContextValue(context, "slots.client.email");
406
- * const amount = getContextValue(context, "forms.quote.amount");
407
- * ```
408
- */
409
- declare function getContextValue(context: WorkflowExecutionContext, path: string): unknown;
410
- /**
411
- * Set a value in the context using dot notation path.
412
- *
413
- * @param context - The execution context (mutated in place)
414
- * @param path - Dot notation path to set
415
- * @param value - Value to set
416
- *
417
- * @example
418
- * ```typescript
419
- * setContextValue(context, "variables.computed", 42);
420
- * setContextValue(context, "slots.client.status", "active");
421
- * ```
422
- */
423
- declare function setContextValue(context: WorkflowExecutionContext, path: string, value: unknown): void;
424
-
425
- /**
426
- * Represents a "slot" for an object to be created in the flow
427
- * Ex: "mr" for the first contact, "company" for the company
428
- *
429
- * Note: Named "Slot" to avoid confusion with DB entities
430
- *
431
- * @deprecated Use WorkflowSlot from types/workflows instead
432
- */
433
- interface FlowSlot {
434
- /** Unique identifier for the slot (ex: "mr", "mme", "company") */
435
- id: string;
436
- /** Name of the object to create (ex: "contacts", "companies") */
437
- objectName: string;
438
- /** Display label (ex: "Monsieur", "Madame") */
439
- label: string;
440
- /** Color to visually distinguish in the builder (from COLORS palette) */
441
- color?: ColorId;
442
- /** Optional icon */
443
- icon?: IconName;
444
- }
445
- /**
446
- * Configuration for relation fields in workflow/flow forms.
447
- * Controls which qualified properties are visible and whether
448
- * inline record creation is allowed.
449
- */
450
- interface RelationFieldConfig {
451
- /** Which qualified properties to display (all if omitted) */
452
- visibleProperties?: string[];
453
- /** Allow creating new target records inline (default: true) */
454
- allowCreate?: boolean;
455
- }
456
- /**
457
- * Field within a row (simplified - no span, auto-calculated)
458
- */
459
- interface FlowRowField {
460
- /** Unique field ID */
461
- id: string;
462
- /** Reference to FlowSlot.id */
463
- slotId: string;
464
- /** Attribute name on the object */
465
- attribute: string;
466
- /** Override label for this flow */
467
- label?: string;
468
- /** Override tooltip/description for this flow */
469
- tooltip?: string;
470
- /** Override required */
471
- required?: boolean;
472
- /** Relation-specific configuration (only for relation attributes) */
473
- relationConfig?: RelationFieldConfig;
474
- }
475
- /**
476
- * Row type discriminator.
477
- * - "fields" (or undefined): standard row with data fields
478
- * - "heading": section heading
479
- * - "separator": visual divider
480
- * - "text": static descriptive text
481
- */
482
- type FlowRowType = "fields" | "heading" | "separator" | "text";
483
- /**
484
- * Standard row containing data fields
485
- */
486
- interface FlowFieldsRow {
487
- /** Unique row ID */
488
- id: string;
489
- /** Display order within the page */
490
- order: number;
491
- /** Row type (optional for backward compat — defaults to "fields") */
492
- type?: "fields";
493
- /** Fields in this row (auto-distribute width) */
494
- fields: FlowRowField[];
495
- }
496
- /**
497
- * Heading row — renders a section title in the form
498
- */
499
- interface FlowHeadingRow {
500
- id: string;
501
- order: number;
502
- type: "heading";
503
- /** Heading text */
504
- content: string;
505
- /** Heading level (1 = large, 2 = medium, 3 = small) */
506
- level?: 1 | 2 | 3;
507
- }
508
- /**
509
- * Separator row — renders a visual divider
510
- */
511
- interface FlowSeparatorRow {
512
- id: string;
513
- order: number;
514
- type: "separator";
515
- }
516
- /**
517
- * Static text row — renders descriptive/instructional text
518
- */
519
- interface FlowTextRow {
520
- id: string;
521
- order: number;
522
- type: "text";
523
- /** Text content (supports basic markdown) */
524
- content: string;
525
- }
526
- /**
527
- * Union of all row types.
528
- * Use `isFlowFieldsRow()` / `isLayoutRow()` type guards for narrowing.
529
- */
530
- type FlowRow = FlowFieldsRow | FlowHeadingRow | FlowSeparatorRow | FlowTextRow;
531
- /** Check if a row is a standard fields row */
532
- declare function isFlowFieldsRow(row: FlowRow): row is FlowFieldsRow;
533
- /** Check if a row is a layout row (heading, separator, or text) */
534
- declare function isLayoutRow(row: FlowRow): row is FlowHeadingRow | FlowSeparatorRow | FlowTextRow;
535
- /**
536
- * Page/step in a flow
537
- */
538
- interface FlowPage {
539
- /** Unique page ID */
540
- id: string;
541
- /** Display label */
542
- label: string;
543
- /** Optional description */
544
- description?: string;
545
- /** Display order */
546
- order: number;
547
- /** Rows in this page */
548
- rows: FlowRow[];
549
- }
550
- /**
551
- * Defines how to link slots after creation
552
- * Ex: Link "mr" and "mme" to "company" via their "company" attribute
553
- */
554
- interface FlowRelation {
555
- /** Unique relation ID */
556
- id: string;
557
- /** Source slot that has the relation attribute */
558
- sourceSlotId: string;
559
- /** Relation attribute on the source slot */
560
- sourceAttribute: string;
561
- /** Target slot created in the same flow */
562
- targetSlotId: string;
563
- }
564
- /** Flow lifecycle status */
565
- type FlowStatus = "draft" | "published" | "archived";
566
- /**
567
- * Complete flow definition for multi-object creation
568
- *
569
- * @example
570
- * ```typescript
571
- * const coupleFlow: FlowDefinition = {
572
- * name: "couple-creation",
573
- * label: "Création Couple",
574
- * status: "published",
575
- * version: 1,
576
- * slots: [
577
- * { id: "mr", objectName: "contacts", label: "Monsieur" },
578
- * { id: "mme", objectName: "contacts", label: "Madame" },
579
- * { id: "company", objectName: "companies", label: "Entreprise" },
580
- * ],
581
- * pages: [...],
582
- * relations: [
583
- * { id: "mr-company", sourceSlotId: "mr", sourceAttribute: "company", targetSlotId: "company" },
584
- * ],
585
- * system: true,
586
- * };
587
- * ```
588
- */
589
- interface FlowDefinition {
590
- /** Database ID */
591
- id?: Uuid;
592
- /** Technical name (kebab-case) */
593
- name: string;
594
- /** Display label */
595
- label: string;
596
- /** Optional description */
597
- description?: string;
598
- /** Optional icon */
599
- icon?: IconName;
600
- /** Flow status */
601
- status: FlowStatus;
602
- /** Version for tracking modifications */
603
- version: number;
604
- /** Slots (objects) to create in this flow */
605
- slots: FlowSlot[];
606
- /** Pages/steps of the flow */
607
- pages: FlowPage[];
608
- /** Relations between created slots */
609
- relations: FlowRelation[];
610
- /** If true, defined in code (protected) */
611
- system?: boolean;
612
- /** Tenant ID for multi-tenant (optional if single-tenant) */
613
- tenantId?: string;
614
- /** Extensible metadata */
615
- metadata?: Record<string, unknown>;
616
- /** Timestamps */
617
- createdAt?: Date;
618
- updatedAt?: Date;
619
- }
620
- /**
621
- * Check if an object is a FlowDefinition
622
- */
623
- declare function isFlowDefinition(obj: unknown): obj is FlowDefinition;
624
- /**
625
- * Check if a flow is published and available for use
626
- */
627
- declare function isFlowPublished(flow: FlowDefinition): boolean;
628
- /**
629
- * Check if a flow is a system flow (defined in code)
630
- */
631
- declare function isSystemFlow(flow: FlowDefinition): boolean;
632
-
633
- /**
634
- * All supported comparison operators for condition rules
635
- */
636
- type ConditionOperator = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "contains" | "startsWith" | "endsWith" | "isEmpty" | "isNotEmpty" | "in" | "notIn";
637
- /**
638
- * A single condition rule that compares a field value against a target value.
639
- *
640
- * Field paths support dot notation for nested access:
641
- * - `slots.client.type` - Access slot record attribute
642
- * - `forms.step1.amount` - Access form submission data
643
- * - `context.variables.customVar` - Access custom variables
644
- *
645
- * @example
646
- * ```typescript
647
- * const rule: ConditionRule = {
648
- * field: "slots.client.type",
649
- * operator: "eq",
650
- * value: "vip"
651
- * };
652
- * ```
653
- */
654
- interface ConditionRule {
655
- /** Field path to evaluate (dot notation) */
656
- field: string;
657
- /** Comparison operator */
658
- operator: ConditionOperator;
659
- /** Value to compare against (type depends on operator) */
660
- value: unknown;
661
- }
662
- /**
663
- * A group of conditions combined with AND/OR logic.
664
- * Groups can be nested for complex conditions.
665
- *
666
- * @example Simple AND condition
667
- * ```typescript
668
- * const condition: ConditionGroup = {
669
- * operator: "and",
670
- * rules: [
671
- * { field: "slots.client.type", operator: "eq", value: "vip" },
672
- * { field: "slots.client.active", operator: "eq", value: true }
673
- * ]
674
- * };
675
- * ```
676
- *
677
- * @example Nested condition (VIP OR (Premium AND Active))
678
- * ```typescript
679
- * const condition: ConditionGroup = {
680
- * operator: "or",
681
- * rules: [
682
- * { field: "slots.client.type", operator: "eq", value: "vip" },
683
- * {
684
- * operator: "and",
685
- * rules: [
686
- * { field: "slots.client.type", operator: "eq", value: "premium" },
687
- * { field: "slots.client.active", operator: "eq", value: true }
688
- * ]
689
- * }
690
- * ]
691
- * };
692
- * ```
693
- */
694
- interface ConditionGroup {
695
- /** Logical operator to combine rules */
696
- operator: "and" | "or";
697
- /** Array of rules or nested groups */
698
- rules: Array<ConditionRule | ConditionGroup>;
699
- }
700
- /**
701
- * Check if an item is a ConditionRule (not a ConditionGroup)
702
- */
703
- declare function isConditionRule(item: ConditionRule | ConditionGroup): item is ConditionRule;
704
- /**
705
- * Check if an item is a ConditionGroup
706
- */
707
- declare function isConditionGroup(item: ConditionRule | ConditionGroup): item is ConditionGroup;
708
- /**
709
- * Create a simple equality condition
710
- */
711
- declare function eq(field: string, value: unknown): ConditionRule;
712
- /**
713
- * Create a simple inequality condition
714
- */
715
- declare function neq(field: string, value: unknown): ConditionRule;
716
- /**
717
- * Create an AND condition group
718
- */
719
- declare function and(...rules: Array<ConditionRule | ConditionGroup>): ConditionGroup;
720
- /**
721
- * Create an OR condition group
722
- */
723
- declare function or(...rules: Array<ConditionRule | ConditionGroup>): ConditionGroup;
724
- /**
725
- * Create an "in" condition (value in array)
726
- */
727
- declare function inValues(field: string, values: unknown[]): ConditionRule;
728
-
729
- /**
730
- * Structural definition for a workflow node type.
731
- * Centralizes all type-specific behavior (outputs, slots, validation).
732
- */
733
- interface NodeTypeDefinition<T extends WorkflowNode = WorkflowNode> {
734
- /** Node type identifier (discriminant) */
735
- type: T["type"];
736
- /** Whether this node has a single linear `next` output */
737
- isLinear: boolean;
738
- /** Whether this node is structural (start/end) vs action (form/condition/document) */
739
- structural: boolean;
740
- /** Get all output node IDs (for graph traversal) */
741
- getOutputs(node: T): string[];
742
- /** Set the next target for linear nodes (throws for non-linear) */
743
- setNext(node: T, targetId: string | null): T;
744
- /** Get all slot IDs referenced by this node */
745
- getSlotIds(node: T): string[];
746
- /** Validate node structure, return error messages */
747
- validate(node: T): string[];
748
- }
749
- declare class NodeTypeRegistryImpl {
750
- private definitions;
751
- register<T extends WorkflowNode>(definition: NodeTypeDefinition<T>): void;
752
- get(type: string): NodeTypeDefinition;
753
- has(type: string): boolean;
754
- getAll(): NodeTypeDefinition[];
755
- getActionTypes(): WorkflowNodeType[];
756
- }
757
- declare const nodeTypeRegistry: NodeTypeRegistryImpl;
758
- /**
759
- * Get the output node IDs from a node (for graph traversal).
760
- * Delegates to the registered node type definition.
761
- */
762
- declare function getNodeOutputs(node: WorkflowNode): string[];
763
- /**
764
- * Set the next target for a linear node.
765
- * Throws for non-linear nodes (condition, end).
766
- */
767
- declare function setNodeNext(node: WorkflowNode, targetId: string | null): WorkflowNode;
768
- /**
769
- * Get all slot IDs referenced by a node.
770
- * For form nodes: extracts from fields/rows.
771
- * For document nodes: returns targetSlotIds.
772
- * For other nodes: returns [].
773
- */
774
- declare function getNodeSlotIds(node: WorkflowNode): string[];
775
- /**
776
- * Validate a node's structure and return error messages.
777
- */
778
- declare function validateNode(node: WorkflowNode): string[];
779
- /**
780
- * Extract all field references (slotId + attribute pairs) from a FormNode.
781
- * Works with both simple mode (fields) and advanced mode (rows).
782
- */
783
- declare function getFormFieldRefs(node: FormNode): Array<{
784
- slotId: string;
785
- attribute: string;
786
- }>;
787
-
788
- /**
789
- * Base properties shared by all workflow nodes
790
- */
791
- interface BaseNode {
792
- /** Unique node identifier */
793
- id: string;
794
- }
795
- /**
796
- * Entry point of the workflow. Each workflow has exactly one StartNode.
797
- */
798
- interface StartNode extends BaseNode {
799
- type: "start";
800
- /** ID of the next node to execute (optional for drafts) */
801
- next?: string | null;
802
- }
803
- /**
804
- * Form node for collecting user input.
805
- *
806
- * Each FormNode acts as a "step" or "page" in the workflow.
807
- * It can contain fields from multiple slots, allowing complex forms
808
- * that collect data for different objects.
809
- *
810
- * @example Simple mode (single slot, quick setup)
811
- * ```typescript
812
- * const node: FormNode = {
813
- * type: "form",
814
- * id: "client-info",
815
- * label: "Client Information",
816
- * fields: [
817
- * { slotId: "client", attribute: "firstName" },
818
- * { slotId: "client", attribute: "lastName" },
819
- * ],
820
- * next: "check-vip"
821
- * };
822
- * ```
823
- *
824
- * @example Advanced mode (multiple slots, custom layout)
825
- * ```typescript
826
- * const node: FormNode = {
827
- * type: "form",
828
- * id: "couple-info",
829
- * label: "Couple Information",
830
- * rows: [
831
- * { id: "row-1", order: 1, fields: [
832
- * { id: "f1", slotId: "mr", attribute: "firstName" },
833
- * { id: "f2", slotId: "mme", attribute: "firstName" },
834
- * ]},
835
- * { id: "row-2", order: 2, fields: [
836
- * { id: "f3", slotId: "company", attribute: "name" },
837
- * ]},
838
- * ],
839
- * next: "check-vip"
840
- * };
841
- * ```
842
- */
843
- interface FormNode extends BaseNode {
844
- type: "form";
845
- /** Display label for the form step */
846
- label: string;
847
- /** Optional description */
848
- description?: string;
849
- /**
850
- * Simple mode: list of field references.
851
- * Each field specifies the slot and attribute.
852
- * Creates one field per row with equal width.
853
- * Mutually exclusive with `rows`.
854
- */
855
- fields?: FormFieldRef[];
856
- /**
857
- * Advanced mode: full row/field structure for custom layouts.
858
- * Each row can contain multiple fields from different slots.
859
- * Mutually exclusive with `fields`.
860
- */
861
- rows?: FlowRow[];
862
- /**
863
- * ID of the participant template allowed to fill this form.
864
- * If set, only this participant can execute this node.
865
- */
866
- participantId?: string | null;
867
- /** ID of the next node to execute (optional for drafts) */
868
- next?: string | null;
869
- }
870
- /**
871
- * Simple field reference for FormNode simple mode
872
- */
873
- interface FormFieldRef {
874
- /** Reference to WorkflowSlot.id */
875
- slotId: string;
876
- /** Attribute name on the object */
877
- attribute: string;
878
- /** Relation-specific config (only for relation attributes) */
879
- relationConfig?: RelationFieldConfig;
880
- }
881
- /**
882
- * Check if a FormNode uses simple mode (fields array)
883
- */
884
- declare function isSimpleFormNode(node: FormNode): boolean;
885
- /**
886
- * Check if a FormNode uses advanced mode (rows array)
887
- */
888
- declare function isAdvancedFormNode(node: FormNode): boolean;
889
-
890
- /**
891
- * Conditional branching node.
892
- * Evaluates a condition and routes to different nodes based on the result.
893
- *
894
- * @example
895
- * ```typescript
896
- * const node: ConditionNode = {
897
- * type: "condition",
898
- * id: "check-vip",
899
- * label: "Is VIP Customer?",
900
- * condition: {
901
- * operator: "or",
902
- * rules: [
903
- * { field: "slots.client.type", operator: "eq", value: "vip" },
904
- * { field: "slots.client.type", operator: "eq", value: "premium" }
905
- * ]
906
- * },
907
- * onTrue: "premium-flow",
908
- * onFalse: "standard-flow"
909
- * };
910
- * ```
911
- */
912
- interface ConditionNode extends BaseNode {
913
- type: "condition";
914
- /** Display label for the condition */
915
- label: string;
916
- /** Condition to evaluate */
917
- condition: ConditionGroup;
918
- /** ID of node to execute if condition is true (optional for drafts) */
919
- onTrue?: string | null;
920
- /** ID of node to execute if condition is false (optional for drafts) */
921
- onFalse?: string | null;
922
- }
923
- /**
924
- * Source for an assignment value.
925
- *
926
- * - `expression`: mustache template resolved at execution (text-like attrs only).
927
- * Uses `{{ slotId.attribute }}` dot notation, resolved via `renderLabelExpression`.
928
- * - `slot-ref`: reference to a slot's record for relation attributes.
929
- * Resolved at persistence time via `$slot:slotId` placeholder.
930
- * - `static`: fixed value set directly.
931
- */
932
- type AssignmentSource = {
933
- type: "expression";
934
- template: string;
935
- } | {
936
- type: "slot-ref";
937
- slotId: string;
938
- properties?: Record<string, unknown>;
939
- } | {
940
- type: "static";
941
- value: unknown;
942
- };
943
- /**
944
- * Single assignment: set one attribute on the target slot.
945
- */
946
- interface AssignmentMapping {
947
- /** Attribute name on the target slot's object */
948
- targetAttribute: string;
949
- /** Source of the value */
950
- source: AssignmentSource;
951
- }
952
- /**
953
- * Assign node: set values on a target slot's record.
954
- * All assignments target the same slot, selected at the node level.
955
- *
956
- * @example
957
- * ```typescript
958
- * const node: AssignNode = {
959
- * type: "assign",
960
- * id: "assign-client-data",
961
- * label: "Set Client Data",
962
- * targetSlotId: "client",
963
- * assignments: [
964
- * { targetAttribute: "company", source: { type: "slot-ref", slotId: "company" } },
965
- * { targetAttribute: "fullName", source: { type: "expression", template: "{{ client.firstName }} {{ client.lastName }}" } },
966
- * { targetAttribute: "status", source: { type: "static", value: "active" } },
967
- * ],
968
- * next: "end"
969
- * };
970
- * ```
971
- */
972
- interface AssignNode extends BaseNode {
973
- type: "assign";
974
- label: string;
975
- description?: string;
976
- /** Single target slot for all assignments */
977
- targetSlotId: string;
978
- /** List of attribute assignments */
979
- assignments: AssignmentMapping[];
980
- next?: string | null;
981
- }
982
- /**
983
- * AI action config — discriminated union for different AI capabilities.
984
- *
985
- * @example Document generation
986
- * ```typescript
987
- * const action: AIActionConfig = {
988
- * type: "document-generation",
989
- * templateId: "template-contract-v1",
990
- * inputSlotIds: ["client", "company"],
991
- * targetSlotIds: ["client"],
992
- * outputFormat: "pdf",
993
- * aiInstructions: "Generate a professional contract",
994
- * };
995
- * ```
996
- */
997
- type AIActionConfig = DocumentGenerationAction | CodeExecutionAction;
998
- /**
999
- * AI action type discriminant
1000
- */
1001
- type AIActionType = AIActionConfig["type"];
1002
- /**
1003
- * Generate a document (PDF/DOCX) from a template using an AI agent session.
1004
- */
1005
- interface DocumentGenerationAction {
1006
- type: "document-generation";
1007
- /** File ID of the uploaded DOCX template in storage */
1008
- templateId: string;
1009
- /** Slots whose data is context for the AI */
1010
- inputSlotIds: string[];
1011
- /** Slots to attach the generated document to */
1012
- targetSlotIds: string[];
1013
- /** Output format */
1014
- outputFormat: "pdf" | "docx";
1015
- /** Instructions for the AI agent on how to generate content */
1016
- aiInstructions?: string;
1017
- }
1018
- /**
1019
- * Execute code in a sandbox without AI (mode "code").
1020
- */
1021
- interface CodeExecutionAction {
1022
- type: "code-execution";
1023
- /** Code to execute (may contain Mustache expressions resolved from slots) */
1024
- code: string;
1025
- language: "javascript" | "typescript" | "python";
1026
- /** Slots injected as JSON environment variables */
1027
- inputSlotIds?: string[];
1028
- /** Variable name to capture stdout into the execution context */
1029
- outputVariable?: string;
1030
- /** Packages to install before execution */
1031
- packages?: string[];
1032
- }
1033
- /**
1034
- * AI node — runs an AI action (document generation, code execution, etc.)
1035
- *
1036
- * @example
1037
- * ```typescript
1038
- * const node: AINode = {
1039
- * type: "ai",
1040
- * id: "generate-contract",
1041
- * label: "Generate Contract",
1042
- * action: {
1043
- * type: "document-generation",
1044
- * templateId: "template-contract-v1",
1045
- * inputSlotIds: ["client", "company"],
1046
- * targetSlotIds: ["client"],
1047
- * outputFormat: "pdf",
1048
- * },
1049
- * next: "end-success",
1050
- * };
1051
- * ```
1052
- */
1053
- interface AINode extends BaseNode {
1054
- type: "ai";
1055
- label: string;
1056
- description?: string;
1057
- action: AIActionConfig;
1058
- /** Timeout in milliseconds (default: 120_000) */
1059
- timeoutMs?: number;
1060
- next?: string | null;
1061
- }
1062
- /**
1063
- * Terminal node marking the end of a workflow path.
1064
- * A workflow can have multiple EndNodes for different outcomes.
1065
- *
1066
- * @example
1067
- * ```typescript
1068
- * const successEnd: EndNode = {
1069
- * type: "end",
1070
- * id: "end-success",
1071
- * label: "Completed Successfully",
1072
- * status: "completed"
1073
- * };
1074
- *
1075
- * const declinedEnd: EndNode = {
1076
- * type: "end",
1077
- * id: "end-declined",
1078
- * label: "Customer Declined",
1079
- * status: "declined"
1080
- * };
1081
- * ```
1082
- */
1083
- interface EndNode extends BaseNode {
1084
- type: "end";
1085
- /** Optional display label */
1086
- label?: string;
1087
- /**
1088
- * Final status for the workflow instance.
1089
- * Common values: "completed", "declined", "cancelled", "expired"
1090
- */
1091
- status?: string;
1092
- }
1093
- /**
1094
- * Union of all workflow node types.
1095
- * Use discriminated union on `type` field for type narrowing.
1096
- */
1097
- type WorkflowNode = StartNode | FormNode | ConditionNode | AssignNode | AINode | EndNode;
1098
- /**
1099
- * All possible node types
1100
- */
1101
- type WorkflowNodeType = WorkflowNode["type"];
1102
- /**
1103
- * Check if a node is a StartNode
1104
- */
1105
- declare function isStartNode(node: WorkflowNode): node is StartNode;
1106
- /**
1107
- * Check if a node is a FormNode
1108
- */
1109
- declare function isFormNode(node: WorkflowNode): node is FormNode;
1110
- /**
1111
- * Check if a node is a ConditionNode
1112
- */
1113
- declare function isConditionNode(node: WorkflowNode): node is ConditionNode;
1114
- /**
1115
- * Check if a node is an AssignNode
1116
- */
1117
- declare function isAssignNode(node: WorkflowNode): node is AssignNode;
1118
- /**
1119
- * Check if a node is an AINode
1120
- */
1121
- declare function isAINode(node: WorkflowNode): node is AINode;
1122
- /**
1123
- * Check if a node is an EndNode
1124
- */
1125
- declare function isEndNode(node: WorkflowNode): node is EndNode;
1126
-
1127
- /**
1128
- * Logo configuration for external-facing interface
1129
- */
1130
- interface ThemeLogo {
1131
- /** URL to the logo image */
1132
- url: string;
1133
- /** Alt text for accessibility */
1134
- alt?: string;
1135
- /** Max height in pixels */
1136
- maxHeight?: number;
1137
- }
1138
- /**
1139
- * Color configuration for theming
1140
- */
1141
- interface ThemeColors {
1142
- /** Primary brand color (hex) */
1143
- primary?: string;
1144
- /** Primary color for text on primary background */
1145
- primaryForeground?: string;
1146
- /** Background color */
1147
- background?: string;
1148
- /** Foreground/text color */
1149
- foreground?: string;
1150
- /** Muted/secondary color */
1151
- muted?: string;
1152
- /** Border color */
1153
- border?: string;
1154
- /** Accent color for highlights */
1155
- accent?: string;
1156
- }
1157
- /**
1158
- * Typography configuration
1159
- */
1160
- interface ThemeTypography {
1161
- /** Font family for headings */
1162
- headingFont?: string;
1163
- /** Font family for body text */
1164
- bodyFont?: string;
1165
- /** Base font size in pixels */
1166
- baseFontSize?: number;
1167
- }
1168
- /**
1169
- * Complete theme configuration for external-facing workflow interface.
1170
- *
1171
- * Allows full branding customization for forms displayed to external users.
1172
- *
1173
- * @example
1174
- * ```typescript
1175
- * const theme: WorkflowTheme = {
1176
- * logo: {
1177
- * url: "https://example.com/logo.png",
1178
- * alt: "Company Logo",
1179
- * maxHeight: 48
1180
- * },
1181
- * colors: {
1182
- * primary: "#3B82F6",
1183
- * primaryForeground: "#FFFFFF",
1184
- * background: "#F8FAFC"
1185
- * },
1186
- * typography: {
1187
- * headingFont: "Inter, sans-serif",
1188
- * bodyFont: "Inter, sans-serif"
1189
- * },
1190
- * borderRadius: 8
1191
- * };
1192
- * ```
1193
- */
1194
- interface WorkflowTheme {
1195
- /** Logo configuration */
1196
- logo?: ThemeLogo;
1197
- /** Color palette */
1198
- colors?: ThemeColors;
1199
- /** Typography settings */
1200
- typography?: ThemeTypography;
1201
- /** Border radius for cards/buttons in pixels */
1202
- borderRadius?: number;
1203
- /** Show powered by badge */
1204
- showPoweredBy?: boolean;
1205
- /** Custom CSS (advanced) */
1206
- customCss?: string;
1207
- }
1208
- /**
1209
- * Default theme values
1210
- */
1211
- declare const DEFAULT_THEME: Required<Pick<WorkflowTheme, "borderRadius" | "showPoweredBy">>;
1212
- /**
1213
- * Merge a partial theme with defaults
1214
- */
1215
- declare function mergeWithDefaults(theme?: WorkflowTheme): WorkflowTheme;
1216
- /**
1217
- * Generate CSS variables from theme colors
1218
- */
1219
- declare function generateCssVariables(colors?: ThemeColors): Record<string, string>;
1220
-
1221
- /**
1222
- * Mode for slot initialization when starting a workflow
1223
- */
1224
- type SlotMode = "create" | "select" | "optional" | "create_if_not_empty";
1225
- /**
1226
- * Represents a "slot" for an object in the workflow.
1227
- * Slots define which objects are manipulated during workflow execution.
1228
- *
1229
- * @example
1230
- * ```typescript
1231
- * const clientSlot: WorkflowSlot = {
1232
- * id: "client",
1233
- * objectName: "contacts",
1234
- * label: "Client",
1235
- * mode: "optional",
1236
- * color: "blue",
1237
- * icon: "User"
1238
- * };
1239
- * ```
1240
- */
1241
- interface WorkflowSlot {
1242
- /** Unique identifier for the slot */
1243
- id: string;
1244
- /** Name of the object definition (e.g., "contacts", "companies") */
1245
- objectName: string;
1246
- /** Display label */
1247
- label: string;
1248
- /** How the slot is initialized at workflow start */
1249
- mode: SlotMode;
1250
- /** Color for visual distinction in the builder */
1251
- color?: ColorId;
1252
- /** Optional icon */
1253
- icon?: IconName;
1254
- /** Resolved object label (set by the backend in form context responses) */
1255
- objectLabel?: string;
1256
- }
1257
- /**
1258
- * Position of a node in the visual builder
1259
- */
1260
- interface NodePosition {
1261
- x: number;
1262
- y: number;
1263
- }
1264
- /**
1265
- * Viewport state for the canvas
1266
- */
1267
- interface CanvasViewport {
1268
- x: number;
1269
- y: number;
1270
- zoom: number;
1271
- }
1272
- /**
1273
- * Layout information for the workflow builder.
1274
- * Separated from business data to allow different visualizations.
1275
- */
1276
- interface WorkflowLayout {
1277
- /** Node positions by node ID */
1278
- positions: Record<string, NodePosition>;
1279
- /** Canvas viewport state */
1280
- viewport?: CanvasViewport;
1281
- }
1282
- /**
1283
- * Global configuration options for a workflow
1284
- */
1285
- interface WorkflowConfig {
1286
- /** Time-to-live for workflow instances (e.g., "30d") */
1287
- instanceTtl?: string;
1288
- /** Time-to-live for external participation links (e.g., "7d") */
1289
- externalLinkTtl?: string;
1290
- /** Whether external participants are allowed */
1291
- allowExternalParticipants?: boolean;
1292
- }
1293
- /**
1294
- * Workflow lifecycle status
1295
- */
1296
- type WorkflowStatus = "draft" | "published" | "archived";
1297
- /**
1298
- * Complete workflow definition (the "blueprint").
1299
- *
1300
- * This is the design-time representation of a workflow.
1301
- * When executed, a WorkflowInstance is created from this definition.
1302
- *
1303
- * @example
1304
- * ```typescript
1305
- * const workflow: WorkflowDefinition = {
1306
- * name: "client-onboarding",
1307
- * label: "Client Onboarding",
1308
- * status: "draft",
1309
- * version: 1,
1310
- * slots: [{ id: "client", objectName: "contacts", label: "Client", mode: "create" }],
1311
- * nodes: {
1312
- * "start": { type: "start", id: "start", next: "form-1" },
1313
- * "form-1": { type: "form", id: "form-1", label: "Info", slotId: "client", fields: ["name"], next: "end" },
1314
- * "end": { type: "end", id: "end" }
1315
- * },
1316
- * startNodeId: "start"
1317
- * };
1318
- * ```
1319
- */
1320
- interface WorkflowDefinition {
1321
- /** Database ID */
1322
- id?: Uuid;
1323
- /** Technical name (kebab-case, unique per tenant) */
1324
- name: string;
1325
- /** Display label */
1326
- label: string;
1327
- /** Optional description */
1328
- description?: string;
1329
- /** Optional icon */
1330
- icon?: IconName;
1331
- /** Workflow lifecycle status */
1332
- status: WorkflowStatus;
1333
- /** Version number (incremented on publish) */
1334
- version: number;
1335
- /** Slots (objects) manipulated in this workflow */
1336
- slots: WorkflowSlot[];
1337
- /** Nodes indexed by ID for O(1) access */
1338
- nodes: Record<string, WorkflowNode>;
1339
- /** ID of the start node */
1340
- startNodeId: string;
1341
- /** Layout information for the visual builder (optional, used by legacy canvas) */
1342
- layout?: WorkflowLayout;
1343
- /** Theming for external-facing interface */
1344
- theme?: WorkflowTheme;
1345
- /** Global configuration options */
1346
- config?: WorkflowConfig;
1347
- /** Tenant ID for multi-tenant isolation */
1348
- tenantId?: string;
1349
- /** If true, defined in code (protected from UI deletion) */
1350
- system?: boolean;
1351
- /** Extensible metadata */
1352
- metadata?: Record<string, unknown>;
1353
- /** Timestamps */
1354
- createdAt?: Date;
1355
- updatedAt?: Date;
1356
- }
1357
- /**
1358
- * Check if an object is a WorkflowDefinition
1359
- */
1360
- declare function isWorkflowDefinition(obj: unknown): obj is WorkflowDefinition;
1361
- /**
1362
- * Check if a workflow is published
1363
- */
1364
- declare function isWorkflowPublished(workflow: WorkflowDefinition): boolean;
1365
- /**
1366
- * Check if a workflow is a system workflow
1367
- */
1368
- declare function isSystemWorkflow(workflow: WorkflowDefinition): boolean;
1369
-
1370
- /**
1371
- * Status of a workflow instance
1372
- */
1373
- type InstanceStatus = "running" | "waiting" | "completed" | "failed" | "cancelled";
1374
- /**
1375
- * Record of a transition between nodes
1376
- */
1377
- interface WorkflowTransition {
1378
- /** Timestamp of the transition */
1379
- timestamp: Date;
1380
- /** ID of the source node */
1381
- fromNodeId: string | null;
1382
- /** ID of the target node */
1383
- toNodeId: string;
1384
- /** Type of the target node */
1385
- nodeType: string;
1386
- /** ID of the user/participant who triggered the transition */
1387
- triggeredBy?: string;
1388
- /** Duration of node execution in milliseconds */
1389
- durationMs?: number;
1390
- /** Metadata about the transition */
1391
- metadata?: Record<string, unknown>;
1392
- }
1393
- /**
1394
- * Error information when instance is in "failed" status
1395
- */
1396
- interface WorkflowError {
1397
- /** Error code for programmatic handling */
1398
- code: string;
1399
- /** Human-readable error message */
1400
- message: string;
1401
- /** ID of the node where error occurred */
1402
- nodeId?: string;
1403
- /** Stack trace (if available) */
1404
- stack?: string;
1405
- /** Additional error details */
1406
- details?: Record<string, unknown>;
1407
- /** Timestamp when error occurred */
1408
- timestamp: Date;
1409
- }
1410
- /**
1411
- * Information about the action the workflow is waiting for.
1412
- * Populated when status is "waiting".
1413
- */
1414
- interface PendingAction {
1415
- /** ID of the node waiting for action */
1416
- nodeId: string;
1417
- /** Type of the waiting node */
1418
- nodeType: "form" | "signature" | "approval";
1419
- /** Display label for the action */
1420
- nodeLabel: string;
1421
- /** ID of the participation required to complete this action */
1422
- requiredParticipationId?: string;
1423
- /** When the pending action expires */
1424
- expiresAt?: Date;
1425
- }
1426
- /**
1427
- * A specific execution of a workflow.
1428
- *
1429
- * Each instance maintains its own state, context, and history.
1430
- * The workflow definition is snapshotted at creation to ensure
1431
- * consistent execution even if the definition is later modified.
1432
- *
1433
- * @example
1434
- * ```typescript
1435
- * const instance: WorkflowInstance = {
1436
- * id: "inst_123",
1437
- * workflowId: "wf_456",
1438
- * workflowVersion: 3,
1439
- * workflowSnapshot: { ... }, // Full definition at creation time
1440
- * status: "waiting",
1441
- * currentNodeId: "client-form",
1442
- * context: { slots: {}, forms: {}, documents: {}, variables: {}, conditionResults: {} },
1443
- * history: [{ timestamp: new Date(), fromNodeId: null, toNodeId: "start", nodeType: "start" }],
1444
- * pendingAction: {
1445
- * nodeId: "client-form",
1446
- * nodeType: "form",
1447
- * nodeLabel: "Client Information",
1448
- * requiredParticipationId: "part_789"
1449
- * },
1450
- * startedBy: "user_001",
1451
- * tenantId: "tenant_abc",
1452
- * createdAt: new Date()
1453
- * };
1454
- * ```
1455
- */
1456
- interface WorkflowInstance {
1457
- /** Unique instance ID */
1458
- id: Uuid;
1459
- /** Reference to the workflow definition */
1460
- workflowId: Uuid;
1461
- /** Version of the workflow at creation time */
1462
- workflowVersion: number;
1463
- /** Complete snapshot of the workflow definition */
1464
- workflowSnapshot: WorkflowDefinition;
1465
- /** Current execution status */
1466
- status: InstanceStatus;
1467
- /** ID of the current node */
1468
- currentNodeId: string;
1469
- /** Accumulated execution context */
1470
- context: WorkflowExecutionContext;
1471
- /** History of node transitions */
1472
- history: WorkflowTransition[];
1473
- /** Current pending action (when status is "waiting") */
1474
- pendingAction?: PendingAction;
1475
- /** Error information (when status is "failed") */
1476
- error?: WorkflowError;
1477
- /** ID of the user who started the workflow */
1478
- startedBy: string;
1479
- /** Tenant ID for multi-tenant isolation */
1480
- tenantId: string;
1481
- /** When the instance expires */
1482
- expiresAt?: Date;
1483
- /** Timestamps */
1484
- createdAt: Date;
1485
- updatedAt: Date;
1486
- completedAt?: Date;
1487
- }
1488
- /**
1489
- * Check if an instance is in a terminal state
1490
- */
1491
- declare function isInstanceTerminal(instance: WorkflowInstance): boolean;
1492
- /**
1493
- * Check if an instance is waiting for external action
1494
- */
1495
- declare function isInstanceWaiting(instance: WorkflowInstance): boolean;
1496
- /**
1497
- * Check if an instance can be resumed
1498
- */
1499
- declare function canResumeInstance(instance: WorkflowInstance): boolean;
1500
- /**
1501
- * Create initial transition record for workflow start
1502
- */
1503
- declare function createStartTransition(startNodeId: string, startedBy: string): WorkflowTransition;
1504
-
1505
- /**
1506
- * Type of view - determines the config structure
1507
- */
1508
- type ViewType = "detail" | "list" | "calendar" | "timeline" | "gallery";
1509
- /**
1510
- * Creation behavior when clicking the "+" button
1511
- * - `redirect`: Create the record then navigate to its detail page
1512
- * - `inline`: Insert an empty row in the table (no navigation)
1513
- * - `modal`: Open a stacked modal for creation
1514
- */
1515
- type CreateMode = "redirect" | "inline" | "modal";
1516
- /**
1517
- * Inline attribute group configuration
1518
- * Groups multiple attributes into a single composite field with dropdown editing
1519
- */
1520
- interface AttributeGroupField {
1521
- /** Unique identifier for the group */
1522
- id: string;
1523
- /** Display label for the composite field */
1524
- label: string;
1525
- /** Description shown in the dropdown */
1526
- description?: string;
1527
- /** Attribute names to include in this group */
1528
- attributes: string[];
1529
- /**
1530
- * Template for the display value
1531
- * Uses {attributeName} syntax for interpolation
1532
- * @example "{billing_street}, {billing_city} {billing_postal_code}"
1533
- */
1534
- displayTemplate?: string;
1535
- }
1536
- /**
1537
- * Field definition within a form group
1538
- * Can be either a single attribute or an inline attribute group
1539
- */
1540
- interface Field {
1541
- /** Attribute name to display (for single attribute fields) */
1542
- attribute?: string;
1543
- /** Inline attribute group (groups multiple attributes into one composite field) */
1544
- attributeGroup?: AttributeGroupField;
1545
- /** Grid span (1-12 columns) */
1546
- span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
1547
- /** Override label for this view (only for single attribute fields) */
1548
- label?: string;
1549
- /** Force read-only display */
1550
- readOnly?: boolean;
1551
- }
1552
- /**
1553
- * Base properties shared by all group types
1554
- */
1555
- interface BaseGroup {
1556
- id: string;
1557
- label: string;
1558
- description?: string;
1559
- collapsible?: boolean;
1560
- collapsed?: boolean;
1561
- order?: number;
1562
- }
1563
- /**
1564
- * Group of fields for organizing forms (default group type)
1565
- */
1566
- interface FieldGroup extends BaseGroup {
1567
- /** Discriminant — optional for backward compatibility with existing data */
1568
- type?: "fields";
1569
- fields: Field[];
1570
- }
1571
- /**
1572
- * Group that displays related records for a relation attribute
1573
- */
1574
- interface RelationGroup extends BaseGroup {
1575
- type: "relation";
1576
- /** Relation attribute name on the source object */
1577
- attribute: string;
1578
- /** Columns to display (auto-detected from target object if empty) */
1579
- columns?: string[];
1580
- /** Read-only mode */
1581
- readOnly?: boolean;
1582
- /** Allow creating new related records */
1583
- allowCreate?: boolean;
1584
- /**
1585
- * Two-level traversal — display records from the target's relation.
1586
- * When set, parent rows become grouping headers and the sub-rows
1587
- * (from `through.attribute`) are the primary display.
1588
- *
1589
- * @example attribute = "members", through.attribute = "companies"
1590
- * → displays companies of each member
1591
- */
1592
- through?: {
1593
- /** Relation attribute on the first-level target object */
1594
- attribute: string;
1595
- };
1596
- }
1597
- /**
1598
- * Discriminated union of all group types
1599
- */
1600
- type Group = FieldGroup | RelationGroup;
1601
- type TabType = "form" | "table" | "custom" | "activity" | "richtext" | "flows" | "documents";
1602
- /**
1603
- * Base properties shared by all tab types
1604
- */
1605
- interface BaseTab {
1606
- id: string;
1607
- name: string;
1608
- label: string;
1609
- icon?: IconName;
1610
- order?: number;
1611
- }
1612
- /**
1613
- * Form layout density
1614
- */
1615
- type FormDensity = "compact" | "comfortable" | "spacious";
1616
- /**
1617
- * Form tab - displays attributes organized in groups
1618
- */
1619
- interface FormTab extends BaseTab {
1620
- type: "form";
1621
- groups: Group[];
1622
- /** Number of grid columns (1, 2, or 3). Default: 2 */
1623
- formColumns?: 1 | 2 | 3;
1624
- /** Layout density. Default: "comfortable" */
1625
- density?: FormDensity;
1626
- }
1627
- /**
1628
- * Direct relation on the current object
1629
- *
1630
- * @example Contact.companies → shows Companies linked via the "companies" relation
1631
- */
1632
- interface RelationSource {
1633
- type: "relation";
1634
- /** Relation attribute name on the current object */
1635
- attribute: string;
1636
- }
1637
- /**
1638
- * Inverse lookup — records from another object that point to us
1639
- *
1640
- * @example On Company, show Contacts where Contact.company = this Company
1641
- */
1642
- interface InverseSource {
1643
- type: "inverse";
1644
- /** Object name that has the relation to us */
1645
- object: string;
1646
- /** Relation attribute name on the source object that points to us */
1647
- attribute: string;
1648
- }
1649
- /**
1650
- * Where table data comes from — either a direct relation or an inverse lookup
1651
- */
1652
- type TableSource = RelationSource | InverseSource;
1653
- /**
1654
- * Table tab - displays related records in a table
1655
- *
1656
- * The `source` field determines where data comes from.
1657
- *
1658
- * @example Direct: source = { type: "relation", attribute: "members" }
1659
- * @example Inverse: source = { type: "inverse", object: "contacts", attribute: "company" }
1660
- */
1661
- interface TableTab extends BaseTab {
1662
- type: "table";
1663
- /** Where the data comes from */
1664
- source: TableSource;
1665
- /** Columns to display (attribute names from the resolved target object) */
1666
- columns: string[];
1667
- /**
1668
- * Traverse a 2nd-level relation to display nested data.
1669
- * When active, `columns` stores the 2nd-level object's attribute names.
1670
- *
1671
- * @example source.attribute = "members", through.attribute = "companies"
1672
- * → displays companies of each member
1673
- */
1674
- through?: {
1675
- /** Relation attribute on the first-level target object */
1676
- attribute: string;
1677
- /** Show _source and _target columns */
1678
- showSourceTarget?: boolean;
1679
- };
1680
- /** Allow creating new records */
1681
- allowCreate?: boolean;
1682
- /** Creation behavior when allowCreate is true. Default: "redirect" */
1683
- createMode?: CreateMode;
1684
- /** Allow inline editing */
1685
- allowEdit?: boolean;
1686
- /** Allow deleting records */
1687
- allowDelete?: boolean;
1688
- /** Default filters applied to the table */
1689
- filters?: FilterState;
1690
- /** Default sort rules */
1691
- sorts?: SortRule[];
1692
- }
1693
- /**
1694
- * Custom tab - renders a developer-defined component
1695
- */
1696
- interface CustomTab extends BaseTab {
1697
- type: "custom";
1698
- /** Component identifier to render */
1699
- component: string;
1700
- /** Props to pass to the component */
1701
- props?: Record<string, unknown>;
1702
- }
1703
- /**
1704
- * Activity tab - displays activity feed for the current record
1705
- */
1706
- interface ActivityTab extends BaseTab {
1707
- type: "activity";
1708
- limit?: number;
1709
- }
1710
- /**
1711
- * Richtext tab - displays a block editor for a richtext attribute
1712
- */
1713
- interface RichtextTab extends BaseTab {
1714
- type: "richtext";
1715
- /** Richtext attribute to display in the BlockEditor */
1716
- attribute: string;
1717
- /** Optional text attribute for an editable title input above the editor */
1718
- titleAttribute?: string;
1719
- }
1720
- /**
1721
- * Flows tab - displays workflow instances linked to the current record
1722
- */
1723
- interface FlowsTab extends BaseTab {
1724
- type: "flows";
1725
- allowStart?: boolean;
1726
- allowCancel?: boolean;
1727
- statusFilter?: InstanceStatus[];
1728
- columns?: ("workflow" | "status" | "startedBy" | "createdAt" | "updatedAt")[];
1729
- }
1730
- /**
1731
- * Documents tab - displays all documents attached to the record
1732
- */
1733
- interface DocumentsTab extends BaseTab {
1734
- type: "documents";
1735
- allowUpload?: boolean;
1736
- allowRemove?: boolean;
1737
- showProcessing?: boolean;
1738
- showRequiredWarnings?: boolean;
1739
- hideAttachments?: boolean;
1740
- }
1741
- /**
1742
- * Union of all tab types (for detail views)
1743
- */
1744
- type Tab = FormTab | TableTab | CustomTab | ActivityTab | RichtextTab | FlowsTab | DocumentsTab;
1745
- /**
1746
- * Detail view layout mode
1747
- * - `page`: Full view with multiple tabs
1748
- * - `modal`: Simplified view for modals (single FormTab, no tabs UI)
1749
- */
1750
- type DetailViewLayout = "page" | "modal";
1751
- /**
1752
- * List view layout mode
1753
- * - `table`: Table/grid layout
1754
- * - `kanban`: Kanban board layout (grouped by attribute)
1755
- */
1756
- type ListViewLayout = "table" | "kanban";
1757
- /**
1758
- * Tab within a list view — each tab carries its own full display configuration.
1759
- *
1760
- * @example
1761
- * ```typescript
1762
- * const tabs: ListViewTab[] = [
1763
- * { id: "all", label: "All Contacts", default: true, layout: "table", columns: ["name", "email", "status"] },
1764
- * { id: "active", label: "Active", layout: "table", columns: ["name", "email"], filters: activeFilter },
1765
- * { id: "pipeline", label: "Pipeline", layout: "kanban", columns: ["name", "amount"], groupByAttribute: "stage" },
1766
- * ];
1767
- * ```
1768
- */
1769
- interface ListViewTab {
1770
- /** Unique identifier */
1771
- id: string;
1772
- /** Display label */
1773
- label: string;
1774
- /** Icon */
1775
- icon?: IconName;
1776
- /** Default tab (shown on load) */
1777
- default?: boolean;
1778
- /** Layout mode */
1779
- layout: ListViewLayout;
1780
- /** Attribute names to display as columns */
1781
- columns: string[];
1782
- /** Column widths in pixels */
1783
- columnSizing?: Record<string, number>;
1784
- /** Filters applied to this tab */
1785
- filters?: FilterGroup;
1786
- /** Sort rules for this tab */
1787
- sorts?: SortRule[];
1788
- /** Attribute to group by (required when layout is "kanban") */
1789
- groupByAttribute?: string;
1790
- /** When true, the tab is read-only: no cell editing, no create, no delete */
1791
- readOnly?: boolean;
1792
- /** Creation behavior when clicking "+". Default: "redirect" */
1793
- createMode?: CreateMode;
1794
- /** User attribute to display on kanban cards (bottom-left) */
1795
- cardUserAttribute?: string;
1796
- /** Date attribute to display on kanban cards (bottom-right) */
1797
- cardDateAttribute?: string;
1798
- /** Order of kanban columns (by option value) - for kanban layout only */
1799
- kanbanColumnOrder?: string[];
1800
- /** Visibility of kanban columns (by option value) - for kanban layout only */
1801
- kanbanColumnVisibility?: Record<string, boolean>;
1802
- /** Pinned kanban columns (by option value) - for kanban layout only */
1803
- kanbanPinnedColumns?: string[];
1804
- }
1805
- /**
1806
- * Configuration for the side panel displayed alongside tab content.
1807
- * When present, a right-side panel shows the configured attributes as flat fields.
1808
- */
1809
- interface SidePanelConfig {
1810
- /** Attribute names to display as flat fields in the panel */
1811
- attributes: string[];
1812
- /** Width in pixels. @default 320 */
1813
- width?: number;
1814
- }
1815
- /**
1816
- * Configuration for detail views (RecordEditView)
1817
- */
1818
- interface DetailViewConfig {
1819
- /** Layout mode */
1820
- layout: DetailViewLayout;
1821
- /** Tabs in this view */
1822
- tabs: Tab[];
1823
- /** Optional side panel with flat attribute fields (not available for modal layout) */
1824
- sidePanel?: SidePanelConfig;
1825
- }
1826
- /**
1827
- * Configuration for list views (RecordsView)
1828
- *
1829
- * Each tab carries its own full config (layout, columns, filters, sorts, groupBy).
1830
- * The view only holds shared base filters applied to ALL tabs.
1831
- */
1832
- interface ListViewConfig {
1833
- /** Base filters applied to ALL tabs (scoping, tenant, etc.) */
1834
- defaultFilters?: FilterGroup;
1835
- /** Tabs — at least one required. Each carries its own full config. */
1836
- tabs: ListViewTab[];
1837
- }
1838
- /**
1839
- * Configuration for calendar views (future)
1840
- */
1841
- interface CalendarViewConfig {
1842
- /** Date attribute for positioning events */
1843
- dateAttribute: string;
1844
- /** End date attribute (for range events) */
1845
- endDateAttribute?: string;
1846
- /** Title attribute for event display */
1847
- titleAttribute: string;
1848
- /** Color attribute (status/select) */
1849
- colorAttribute?: string;
1850
- }
1851
- /**
1852
- * Configuration for timeline views (future)
1853
- */
1854
- interface TimelineViewConfig {
1855
- /** Date attribute for timeline positioning */
1856
- dateAttribute: string;
1857
- /** Group by attribute */
1858
- groupByAttribute?: string;
1859
- }
1860
- /**
1861
- * Configuration for gallery views (future)
1862
- */
1863
- interface GalleryViewConfig {
1864
- /** Image attribute to display */
1865
- imageAttribute: string;
1866
- /** Title attribute */
1867
- titleAttribute?: string;
1868
- /** Columns per row */
1869
- columnsPerRow?: number;
1870
- }
1871
- /**
1872
- * Union of all view configs
1873
- */
1874
- type ViewConfig = DetailViewConfig | ListViewConfig | CalendarViewConfig | TimelineViewConfig | GalleryViewConfig;
1875
- /**
1876
- * Base view properties shared by all view types
1877
- */
1878
- interface BaseViewDefinition {
1879
- /** Unique identifier (UUID, assigned by database) */
1880
- id?: string;
1881
- /** Technical name (kebab-case) */
1882
- name: string;
1883
- /** Display label */
1884
- label: string;
1885
- /** Description */
1886
- description?: string;
1887
- /** Icon */
1888
- icon?: IconName;
1889
- /** Object this view belongs to (object name) */
1890
- object: string;
1891
- /** Default view for this object+type combination */
1892
- default?: boolean;
1893
- /** Extensible metadata */
1894
- metadata?: Record<string, unknown>;
1895
- }
1896
- /**
1897
- * Detail view definition
1898
- */
1899
- interface DetailViewDefinition extends BaseViewDefinition {
1900
- type: "detail";
1901
- config: DetailViewConfig;
1902
- }
1903
- /**
1904
- * List view definition
1905
- */
1906
- interface ListViewDefinition extends BaseViewDefinition {
1907
- type: "list";
1908
- config: ListViewConfig;
1909
- }
1910
- /**
1911
- * Calendar view definition (future)
1912
- */
1913
- interface CalendarViewDefinition extends BaseViewDefinition {
1914
- type: "calendar";
1915
- config: CalendarViewConfig;
1916
- }
1917
- /**
1918
- * Timeline view definition (future)
1919
- */
1920
- interface TimelineViewDefinition extends BaseViewDefinition {
1921
- type: "timeline";
1922
- config: TimelineViewConfig;
1923
- }
1924
- /**
1925
- * Gallery view definition (future)
1926
- */
1927
- interface GalleryViewDefinition extends BaseViewDefinition {
1928
- type: "gallery";
1929
- config: GalleryViewConfig;
15
+ orderBy?: string;
16
+ /** @deprecated Use sorts instead */
17
+ orderDirection?: "asc" | "desc";
18
+ /** Multiple sort rules */
19
+ sorts?: SortRule[];
20
+ /** Filter state */
21
+ filters?: FilterState;
22
+ /**
23
+ * Include soft-deleted records in results.
24
+ * By default, soft-deleted records are excluded.
25
+ * @default false
26
+ */
27
+ includeDeleted?: boolean;
28
+ /**
29
+ * Include related records in results.
30
+ * For qualified relations (with properties), returns format: Array<{ id, props }>
31
+ * For normal relations (without properties), returns legacy format: string[]
32
+ */
33
+ include?: string[];
1930
34
  }
35
+
1931
36
  /**
1932
- * Unified view definition - discriminated union by type
1933
- */
1934
- type ViewDefinition = DetailViewDefinition | ListViewDefinition | CalendarViewDefinition | TimelineViewDefinition | GalleryViewDefinition;
1935
- /**
1936
- * Configuration overrides for user customizations
1937
- * Only stores the delta from the source view
37
+ * Structural definition for a workflow node type.
38
+ * Centralizes all type-specific behavior (outputs, slots, validation).
1938
39
  */
1939
- interface ConfigOverrides {
1940
- tabs?: ListViewTab[];
1941
- hiddenTabIds?: string[];
1942
- detailTabs?: Tab[];
1943
- hiddenDetailTabIds?: string[];
40
+ interface NodeTypeDefinition<T extends WorkflowNode = WorkflowNode> {
41
+ /** Node type identifier (discriminant) */
42
+ type: T["type"];
43
+ /** Whether this node has a single linear `next` output */
44
+ isLinear: boolean;
45
+ /** Whether this node is structural (start/end) vs action (form/condition/document) */
46
+ structural: boolean;
47
+ /** Get all output node IDs (for graph traversal) */
48
+ getOutputs(node: T): string[];
49
+ /** Set the next target for linear nodes (throws for non-linear) */
50
+ setNext(node: T, targetId: string | null): T;
51
+ /** Get all slot IDs referenced by this node */
52
+ getSlotIds(node: T): string[];
53
+ /** Validate node structure, return error messages */
54
+ validate(node: T): string[];
1944
55
  }
1945
- /**
1946
- * User customization overlay for a view
1947
- * Stored per user, merged at runtime with the source view
1948
- */
1949
- interface ViewOverlay {
1950
- /** Unique identifier */
1951
- id: string;
1952
- /** View ID this overlay applies to (UUID or virtual ID) */
1953
- viewId: string;
1954
- /** User ID who owns this overlay */
1955
- userId: string;
1956
- /** Configuration overrides (delta only) */
1957
- configOverrides: ConfigOverrides;
1958
- /** User's default view for this object (stored in overlay) */
1959
- isUserDefault?: boolean;
1960
- /** Created timestamp */
1961
- createdAt: Date;
1962
- /** Updated timestamp */
1963
- updatedAt: Date;
56
+ declare class NodeTypeRegistryImpl {
57
+ private definitions;
58
+ register<T extends WorkflowNode>(definition: NodeTypeDefinition<T>): void;
59
+ get(type: string): NodeTypeDefinition;
60
+ has(type: string): boolean;
61
+ getAll(): NodeTypeDefinition[];
62
+ getActionTypes(): WorkflowNodeType[];
1964
63
  }
64
+ declare const nodeTypeRegistry: NodeTypeRegistryImpl;
1965
65
  /**
1966
- * Check if a view is a detail view
1967
- */
1968
- declare function isDetailView(view: ViewDefinition): view is DetailViewDefinition;
1969
- /**
1970
- * Check if a view is a list view
1971
- */
1972
- declare function isListView(view: ViewDefinition): view is ListViewDefinition;
1973
- /**
1974
- * Check if a view is a calendar view
1975
- */
1976
- declare function isCalendarView(view: ViewDefinition): view is CalendarViewDefinition;
1977
- /**
1978
- * Check if a view is a timeline view
1979
- */
1980
- declare function isTimelineView(view: ViewDefinition): view is TimelineViewDefinition;
1981
- /**
1982
- * Check if a view is a gallery view
1983
- */
1984
- declare function isGalleryView(view: ViewDefinition): view is GalleryViewDefinition;
1985
- /**
1986
- * Check if a group is a field group (default type)
66
+ * Get the output node IDs from a node (for graph traversal).
67
+ * Delegates to the registered node type definition.
1987
68
  */
1988
- declare function isFieldGroup(group: Group): group is FieldGroup;
69
+ declare function getNodeOutputs(node: WorkflowNode): string[];
1989
70
  /**
1990
- * Check if a group is a relation group
71
+ * Set the next target for a linear node.
72
+ * Throws for non-linear nodes (condition, end).
1991
73
  */
1992
- declare function isRelationGroup(group: Group): group is RelationGroup;
74
+ declare function setNodeNext(node: WorkflowNode, targetId: string | null): WorkflowNode;
1993
75
  /**
1994
- * Check if a tab is a form tab
76
+ * Get all slot IDs referenced by a node.
77
+ * For form nodes: extracts from fields/rows.
78
+ * For document nodes: returns targetSlotIds.
79
+ * For other nodes: returns [].
1995
80
  */
1996
- declare function isFormTab(tab: Tab): tab is FormTab;
81
+ declare function getNodeSlotIds(node: WorkflowNode): string[];
1997
82
  /**
1998
- * Check if a tab is a table tab
83
+ * Validate a node's structure and return error messages.
1999
84
  */
2000
- declare function isTableTab(tab: Tab): tab is TableTab;
85
+ declare function validateNode(node: WorkflowNode): string[];
2001
86
  /**
2002
- * Check if a table tab uses a direct relation source
87
+ * Extract all field references (slotId + attribute pairs) from a FormNode.
88
+ * Works with both simple mode (fields) and advanced mode (rows).
2003
89
  */
2004
- declare function isRelationSourceTab(tab: Tab): tab is TableTab & {
2005
- source: RelationSource;
2006
- };
90
+ declare function getFormFieldRefs(node: FormNode): Array<{
91
+ slotId: string;
92
+ attribute: string;
93
+ }>;
94
+
2007
95
  /**
2008
- * Check if a table tab uses an inverse source
96
+ * Storage provider type
2009
97
  */
2010
- declare function isInverseSourceTab(tab: Tab): tab is TableTab & {
2011
- source: InverseSource;
2012
- };
98
+ type StorageProvider = "s3" | "gcs" | "azure" | "local" | "cloudflare-r2" | string;
2013
99
  /**
2014
- * Check if a tab is a custom tab
100
+ * File visibility level
2015
101
  */
2016
- declare function isCustomTab(tab: Tab): tab is CustomTab;
102
+ type FileVisibility = "public" | "private" | "restricted";
2017
103
  /**
2018
- * Check if a tab is an activity tab
104
+ * File - Represents uploaded file metadata and storage info
105
+ *
106
+ * ARCHITECTURE:
107
+ * - Fixed table (no custom attributes)
108
+ * - Manages file storage, permissions, and metadata
109
+ * - uploadedBy links to user_profiles table
110
+ * - Supports soft delete via deletedAt
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const file: File = {
115
+ * id: "file-123",
116
+ * tenantId: "tenant-456",
117
+ * name: "contract-2025.pdf",
118
+ * originalName: "Contract Acme Corp 2025.pdf",
119
+ * mimeType: "application/pdf",
120
+ * size: 2458624,
121
+ * storageProvider: "s3",
122
+ * storagePath: "tenants/456/files/2025/11/contract-2025.pdf",
123
+ * storageBucket: "my-app-files",
124
+ * url: "https://cdn.example.com/files/file-123",
125
+ * uploadedBy: "profile-789",
126
+ * folderPath: "/contracts/2025",
127
+ * tags: ["contract", "legal"],
128
+ * visibility: "restricted",
129
+ * allowedUsers: ["profile-789", "profile-456"],
130
+ * createdAt: new Date(),
131
+ * updatedAt: new Date(),
132
+ * };
133
+ * ```
2019
134
  */
2020
- declare function isActivityTab(tab: Tab): tab is ActivityTab;
135
+ interface File extends Timestamps {
136
+ id: Uuid;
137
+ tenantId: Uuid;
138
+ /**
139
+ * File name (sanitized for storage)
140
+ */
141
+ name: string;
142
+ /**
143
+ * Original file name (as uploaded by user)
144
+ */
145
+ originalName: string;
146
+ /**
147
+ * MIME type (e.g., "application/pdf", "image/jpeg")
148
+ */
149
+ mimeType: MimeType | string;
150
+ /**
151
+ * File size in bytes
152
+ */
153
+ size: number;
154
+ /**
155
+ * Storage provider (s3, gcs, azure, local, etc.)
156
+ */
157
+ storageProvider: StorageProvider;
158
+ /**
159
+ * Path in the storage bucket
160
+ */
161
+ storagePath: string;
162
+ /**
163
+ * Storage bucket name (if applicable)
164
+ */
165
+ storageBucket?: string;
166
+ /**
167
+ * Public or signed URL to access the file
168
+ */
169
+ url: string;
170
+ /**
171
+ * User who uploaded the file (FK to user_profiles)
172
+ * Optional for system-generated files or anonymous uploads.
173
+ */
174
+ uploadedBy?: Uuid;
175
+ /**
176
+ * Folder path for organization (e.g., "/contracts/2025")
177
+ */
178
+ folderPath?: string;
179
+ /**
180
+ * Tags for search and categorization
181
+ */
182
+ tags?: string[];
183
+ /**
184
+ * File visibility level
185
+ * - public: Anyone with the URL can access
186
+ * - private: Only uploadedBy can access
187
+ * - restricted: Only specific users (allowedUsers) can access
188
+ */
189
+ visibility: FileVisibility;
190
+ /**
191
+ * List of user IDs authorized to access this file (if visibility = "restricted")
192
+ */
193
+ allowedUsers?: Uuid[];
194
+ /**
195
+ * Soft delete timestamp (null = not deleted)
196
+ */
197
+ deletedAt?: Date;
198
+ }
2021
199
  /**
2022
- * Check if a tab is a richtext tab
200
+ * Data required to create a new file record
2023
201
  */
2024
- declare function isRichtextTab(tab: Tab): tab is RichtextTab;
2025
202
  /**
2026
- * Check if a tab is a flows tab
203
+ * Data for creating a new file.
204
+ * Tenant ID is automatically set from execution context.
2027
205
  */
2028
- declare function isFlowsTab(tab: Tab): tab is FlowsTab;
206
+ interface CreateFile {
207
+ name: string;
208
+ originalName: string;
209
+ mimeType: MimeType | string;
210
+ size: number;
211
+ storageProvider: StorageProvider;
212
+ storagePath: string;
213
+ storageBucket?: string;
214
+ url: string;
215
+ uploadedBy?: Uuid;
216
+ folderPath?: string;
217
+ tags?: string[];
218
+ visibility?: FileVisibility;
219
+ allowedUsers?: Uuid[];
220
+ }
2029
221
  /**
2030
- * Check if a tab is a documents tab
222
+ * Data for updating an existing file record
2031
223
  */
2032
- declare function isDocumentsTab(tab: Tab): tab is DocumentsTab;
224
+ interface UpdateFile {
225
+ name?: string;
226
+ folderPath?: string;
227
+ tags?: string[];
228
+ visibility?: FileVisibility;
229
+ allowedUsers?: Uuid[];
230
+ }
2033
231
 
2034
232
  /**
2035
233
  * Status of a workflow invitation
@@ -2250,7 +448,7 @@ interface FormFieldsRow {
2250
448
  * Backward-compatible: rows without `type` are treated as field rows.
2251
449
  * Layout rows (heading, separator, text) are shared with FlowRow types.
2252
450
  */
2253
- type FormFieldRow = FormFieldsRow | FlowHeadingRow | FlowSeparatorRow | FlowTextRow;
451
+ type FormFieldRow = FormFieldsRow | FlowHeadingRow | FlowSeparatorRow | FlowTextRow | FlowRelationListRow;
2254
452
  /** Check if a form row contains fields */
2255
453
  declare function isFormFieldsRow(row: FormFieldRow): row is FormFieldsRow;
2256
454
  /**
@@ -2283,6 +481,8 @@ interface FormContextResponse {
2283
481
  theme?: WorkflowTheme;
2284
482
  /** Access mode for the current user */
2285
483
  accessMode: "internal" | "external";
484
+ /** Preloaded relation buffers, indexed by slot ID then relation name */
485
+ relationBuffers?: Record<string, RelationBufferMap>;
2286
486
  }
2287
487
 
2288
488
  /**
@@ -3586,6 +1786,8 @@ interface DBView extends Timestamps {
3586
1786
  /** Default view for this object+type combination */
3587
1787
  default: boolean;
3588
1788
  metadata?: Record<string, unknown>;
1789
+ /** Schema version for migration tracking (added by schema_versioning migration, defaults to 1) */
1790
+ schema_version?: number;
3589
1791
  }
3590
1792
  /**
3591
1793
  * Data for creating a new view.
@@ -3602,6 +1804,7 @@ interface CreateDBView {
3602
1804
  config: ViewConfig;
3603
1805
  default?: boolean;
3604
1806
  metadata?: Record<string, unknown>;
1807
+ schema_version?: number;
3605
1808
  }
3606
1809
  /**
3607
1810
  * Data for updating a view.
@@ -3613,6 +1816,7 @@ interface UpdateDBView {
3613
1816
  config?: ViewConfig;
3614
1817
  default?: boolean;
3615
1818
  metadata?: Record<string, unknown>;
1819
+ schema_version?: number;
3616
1820
  }
3617
1821
  /**
3618
1822
  * Data for upserting a view (used by registry seeding).
@@ -3628,6 +1832,7 @@ interface UpsertDBView {
3628
1832
  config: ViewConfig;
3629
1833
  default?: boolean;
3630
1834
  metadata?: Record<string, unknown>;
1835
+ schema_version?: number;
3631
1836
  }
3632
1837
  /**
3633
1838
  * View overlay as stored in database
@@ -7271,6 +5476,69 @@ type ExtractAttributeRequired<T> = T extends {
7271
5476
  };
7272
5477
  } ? R : false;
7273
5478
 
5479
+ interface ChangeTypeOptions {
5480
+ /** Optional explicit transform function (used to resolve a BuiltInTransform) */
5481
+ transform?: (value: unknown) => unknown;
5482
+ }
5483
+ /**
5484
+ * Fluent builder for composing a MigrationDefinition.
5485
+ *
5486
+ * Operations are collected in declaration order. The builder tracks which
5487
+ * attribute names have been touched and throws on conflicting operations
5488
+ * (e.g., renaming then removing the same attribute within the same migration).
5489
+ *
5490
+ * @example
5491
+ * ```typescript
5492
+ * const migration = new MigrationBuilder(2)
5493
+ * .renameAttribute("firstName", "first_name")
5494
+ * .changeType("age", "text", "number")
5495
+ * .build();
5496
+ * ```
5497
+ */
5498
+ declare class MigrationBuilder {
5499
+ private readonly version;
5500
+ private readonly operations;
5501
+ /** Tracks attribute names that have already been referenced in this migration */
5502
+ private readonly touchedAttributes;
5503
+ constructor(version: number);
5504
+ private assertNotTouched;
5505
+ /**
5506
+ * Rename an attribute.
5507
+ * The reverse operation will rename it back.
5508
+ */
5509
+ renameAttribute(from: string, to: string): this;
5510
+ /**
5511
+ * Change the type of an attribute.
5512
+ *
5513
+ * The `transform` option accepts a function — it is used only to signal
5514
+ * intent; the actual built-in transform is resolved from the target type.
5515
+ */
5516
+ changeType(name: string, from: AttributeType, to: AttributeType, options?: ChangeTypeOptions): this;
5517
+ /**
5518
+ * Remove an attribute.
5519
+ *
5520
+ * The `backup_config` is intentionally left empty — the sync engine will
5521
+ * populate it from current DB state before applying the migration.
5522
+ */
5523
+ removeAttribute(name: string): this;
5524
+ /**
5525
+ * Add a new attribute.
5526
+ * The reverse operation will remove it (using the attribute definition as backup).
5527
+ */
5528
+ addAttribute(attribute: Attribute): this;
5529
+ /**
5530
+ * Update the configuration of an attribute (partial patch).
5531
+ *
5532
+ * The `from` config is intentionally left empty — the sync engine will
5533
+ * populate it from current DB state before applying the migration.
5534
+ */
5535
+ updateConfig(name: string, config: Partial<Record<string, unknown>>): this;
5536
+ /**
5537
+ * Produce the final MigrationDefinition with auto-generated reverse operations.
5538
+ */
5539
+ build(): MigrationDefinition;
5540
+ }
5541
+
7274
5542
  /**
7275
5543
  * Extract attribute info from a builder instance
7276
5544
  */
@@ -7347,6 +5615,7 @@ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
7347
5615
  private obj;
7348
5616
  private _labelExpression?;
7349
5617
  private _pluralLabel?;
5618
+ private _migrations;
7350
5619
  /**
7351
5620
  * Phantom type property for type extraction
7352
5621
  * Never used at runtime, only for TypeScript inference
@@ -7419,6 +5688,23 @@ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
7419
5688
  * ```
7420
5689
  */
7421
5690
  labelExpression(template: string): this;
5691
+ /**
5692
+ * Declare a schema migration for this object.
5693
+ *
5694
+ * - `version` must be >= 2 (version 1 is implicit — no migration needed).
5695
+ * - Versions must be declared in sequential order without gaps or duplicates.
5696
+ * - The callback receives a MigrationBuilder; call `.build()` is not required
5697
+ * (the ObjectBuilder calls it internally).
5698
+ *
5699
+ * @example
5700
+ * ```typescript
5701
+ * object({ name: "contacts", label: "Contact" })
5702
+ * .migration(2, (m) => m.renameAttribute("firstName", "first_name"))
5703
+ * .migration(3, (m) => m.changeType("age", "text", "number"))
5704
+ * .labelExpression("{{ first_name }}")
5705
+ * ```
5706
+ */
5707
+ migration(version: number, callback: (builder: MigrationBuilder) => unknown): this;
7422
5708
  /**
7423
5709
  * Build the final ObjectDefinition
7424
5710
  * @throws Error if required fields are missing or invalid
@@ -7959,6 +6245,7 @@ declare class TabBuilder {
7959
6245
  */
7960
6246
  declare class DetailViewBuilder {
7961
6247
  private data;
6248
+ private _version;
7962
6249
  constructor(name: string, label: string);
7963
6250
  /**
7964
6251
  * Set view description
@@ -7992,6 +6279,13 @@ declare class DetailViewBuilder {
7992
6279
  * Set metadata
7993
6280
  */
7994
6281
  metadata(value: Record<string, unknown>): this;
6282
+ /**
6283
+ * Set the schema version for this view definition.
6284
+ * Increment when making breaking changes to force client updates.
6285
+ * @param v - Version number (must be >= 1)
6286
+ * @default 1
6287
+ */
6288
+ version(v: number): this;
7995
6289
  /**
7996
6290
  * Configure a side panel with flat attribute fields displayed alongside tab content.
7997
6291
  * Not available for modal layout.
@@ -8112,6 +6406,7 @@ interface ListViewTabData {
8112
6406
  */
8113
6407
  declare class ListViewBuilder {
8114
6408
  private data;
6409
+ private _version;
8115
6410
  constructor(name: string, label: string);
8116
6411
  /**
8117
6412
  * Set view description
@@ -8134,6 +6429,13 @@ declare class ListViewBuilder {
8134
6429
  * Set metadata
8135
6430
  */
8136
6431
  metadata(value: Record<string, unknown>): this;
6432
+ /**
6433
+ * Set the schema version for this view definition.
6434
+ * Increment when making breaking changes to force client updates.
6435
+ * @param v - Version number (must be >= 1)
6436
+ * @default 1
6437
+ */
6438
+ version(v: number): this;
8137
6439
  /**
8138
6440
  * Set base filters applied to ALL tabs (scoping, tenant, etc.)
8139
6441
  * @example .baseFilter({ combinator: "and", rules: [{ attribute: "tenant", operator: "is", value: "acme" }] })
@@ -8436,6 +6738,22 @@ declare class WorkflowFormBuilder {
8436
6738
  * Add a static text row to the form
8437
6739
  */
8438
6740
  text(content: string): this;
6741
+ /**
6742
+ * Add a relation list row to the form.
6743
+ * Renders an editable list of related records for a given slot and relation.
6744
+ *
6745
+ * @param id - Unique row identifier
6746
+ * @param slotId - The slot containing the relation
6747
+ * @param relationName - The relation attribute name
6748
+ * @param options - Display and preload options
6749
+ */
6750
+ relationListField(id: string, slotId: string, relationName: string, options?: {
6751
+ preload?: boolean;
6752
+ columns?: string[];
6753
+ qualifiersInline?: boolean;
6754
+ modalFields?: "all" | string[];
6755
+ label?: string;
6756
+ }): this;
8439
6757
  /**
8440
6758
  * Set the next node and complete the form definition
8441
6759
  */
@@ -9569,4 +7887,4 @@ declare function resetViewToDefault(currentView: ViewDefinition, object: ObjectD
9569
7887
  */
9570
7888
  declare function isViewCustomized(view: ViewDefinition, object: ObjectDefinition): boolean;
9571
7889
 
9572
- export { type AIActionConfig, AIActionConfigSchema, type AIActionType, type AIAvailableModel, type AIBatchQuestion, type AIBatchQuestionAnswer, type AIBatchQuestionOption, type AIChatMessage, type AIChatMessagePart, type AIChatMessagePartType, type AICompactionSummary, type AIConversation, type AIMemoryEntry, type AIMemoryType, type AIMessage, type AIMessageAttachment, type AIMessageRole, type AINode, AINodeSchema, type AIProviderMetrics, type AIQuestion, type AIQuestionAnswer, type AIQuestionOption, type AIQuestionType, type AIThinkingLevel, type AITodoItem, type AITodoList, type AITodoStatus, type AIToolCall, type AIToolCallRecord, type AIToolCallStatus, type AIUsageMetrics, ALL_ACTIONS, ALL_SYSTEM_RESOURCES, type AccessLevel, type Action, type ActivityTab, ActivityTabConfig, type AddAttribute$1 as AddAttribute, type AdvancedFilterState, type AgentContentPart, type AgentDashboard, type AgentDefinition, type AgentEvent, type AgentExecutionConfig, type AgentGroup, type AgentGroupStatus, type AgentMessage, type AgentRun, type AgentRunStatus, type AgentSchedule, type AgentTrigger, type AgentTriggerType, type AnyAttributeBuilder, type AssignNode, AssignNodeSchema, type AssignRoleInput, type AssignmentMapping, AssignmentMappingSchema, type AssignmentSource, AssignmentSourceSchema, Attribute, type AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, AttributeType, type AttributeUsage, type AuditAction, type AuditActorType, type AuditChange, type AuditListOptions, type AuditLogEntry, type AuditResourceType, type AuditServiceOptions, AuthMethodSchema, BEHAVIOR_PROPERTIES, type BehaviorProperty, BilateralConfig, type BilateralValidationError, type BilateralValidationResult, type BoundingBox, type BuilderConfig, type CalendarViewConfig, type CalendarViewDefinition, type CanvasViewport, type ChatFileAttachment, CheckboxAttribute, type CheckboxFilterOperator, type CodeExecutionAction, CodeExecutionActionSchema, CompletionStatus, ConcurrentModificationError, type ConditionGroup, ConditionGroupSchema, type ConditionNode, ConditionNodeSchema, type ConditionOperator, ConditionOperatorSchema, type ConditionRule, ConditionRuleSchema, type ConfigOverrides, type CreateAIMessageInput, type CreateAuditLogInput, type CreateDBAttribute, type CreateDBObject, type CreateDBView, type CreateDBViewOverlay, type CreateDBWorkflow, type CreateDBWorkflowAccessGrant, type CreateDBWorkflowInstance, type CreateDBWorkflowInvitation, type CreateDocument, type CreateDocumentSlot, type CreateFile, type CreateGrantInput, type CreateInvitationInput, type CreateInvitationResult, type CreateMode, type CreateObjectRecord, type CreatePermissionInput, type CreateProcessingJob, type CreateRoleInput, type CreateSandboxExecution, CreateShareInputSchema, type CreateSignatureInput, type CreateUserProfile, Currency, CurrencyAttribute, type CurrencyFilterValue, type CustomAttributeValue, type CustomTab, CustomTabConfig, type DBAttribute, type DBObject, type DBView, type DBViewOverlay, type DBWorkflow, type DBWorkflowAccessGrant, type DBWorkflowInstance, type DBWorkflowInvitation, DEFAULT_LABEL_FALLBACK, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_FOR_NEW_USERS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DEFAULT_THEME, DateAttribute, type DateFilterOperator, type DefaultRoleName, type DefaultRolePermissionConfig, DetailViewBuilder, type DetailViewConfig, type DetailViewDefinition, type DetailViewLayout, type Document, DocumentAttribute, type DocumentData, type DocumentGenerationAction, DocumentGenerationActionSchema, type DocumentListOptions, type DocumentSlot, type DocumentStatus, type DocumentsTab, DocumentsTabConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type EffectivePermissions, type EndNode, EndNodeSchema, type ExtendedFilterRule, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractObjectRecord, type ExtractObjectRecordWithCustom, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, FeatureFlagDefinition, FeatureFlagsRepository, FeatureGate, type Field, type FieldGroup, type File, FileAttribute, type FileListOptions, FileNotFoundError, type FileVisibility, type FilterCombinator, type FilterGroup, type FilterOperator, type FilterRule, type FilterState, type FilterValue, FlagLevel, FlagRegistry, type FlagResolutionContext, FlagService, type FlagServiceOptions, FlagValueType, type FlowDefinition, type FlowFieldsRow, type FlowHeadingRow, type FlowPage, type FlowRelation, type FlowRow, type FlowRowField, FlowRowFieldSchema, FlowRowSchema, type FlowRowType, type FlowSeparatorRow, type FlowSlot, type FlowStatus, type FlowTextRow, type FlowsTab, FlowsTabConfig, ForbiddenError, type FormContextResponse, type FormDensity, type FormFieldContext, type FormFieldRef, FormFieldRefSchema, type FormFieldRow, type FormFieldsRow, type FormNode, type FormNodeInfo, FormNodeSchema, type FormTab, FormulaAttribute, FormulaReturnType, type GalleryViewConfig, type GalleryViewDefinition, type GenerateFallbackViewOptions, type GeneratedDocument, type GeocodingAdapter, type GeocodingAutocompleteParams, type GeocodingParams, type GeocodingSuggestion, type GlobalSearchGroupedOptions, type GlobalSearchGroupedResult, type GlobalSearchOptions, type GlobalSearchResultItem, type Group, GroupBuilder, type GroupedWorkflowNodes, IDENTITY_PROPERTIES, type IdentityProperty, type IdentityVerificationAdapter, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, type InstanceStatus, type InverseSource, type InvitationStatus, type InviteUserInput, type ListOptions, ListViewBuilder, type ListViewConfig, type ListViewDefinition, type ListViewLayout, type ListViewTab, ListViewTabConfigBuilder, Location, LocationAttribute, LocationGranularity, type ModelDefinition, MultiRelationAttribute, MultiselectAttribute, type MultiselectFilterOperator, NO_VALUE_OPERATORS, type NoValueOperator, type NodePosition, NodePositionSchema, type NodeTypeDefinition, NoopGeocodingAdapter, NotFoundError, NotSystemObjectError, NumberAttribute, type NumberFilterOperator, OPERATORS_BY_TYPE, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, type ObjectPermissions, ObjectRecord, ObjectReferencedError, type OcrAdapter, type OcrInput, type OcrOptions, type OcrPage, type OcrResult, type OcrTextBlock, type OperationResult, Option, PRESENTATION_PROPERTIES, type PendingAction, type Permission, type PermissionScope, Phone, PhoneAttribute, type PhoneFilterValue, type PhoneNormalizationResult, type PolicyContext, PolicyViolationError, type PresentationProperty, type ProcessingJob, type ProcessingJobStatus, type ProcessingJobType, type PropertyAttributeBuilder, ProtectedResourceError, ProtectedRoleError, type ProviderName, type QueryState, RatingAttribute, type ReadOnlyReason, type ReasoningPartData, type RecordMetadata, RecordNotFoundError, type RecordPolicy, type RecordReference, RecordReferencedError, RelationAttribute, type RelationFieldConfig, type RelationFilterOperator, type RelationGroup, RelationGroupBuilder, type RelationSource, RelationTarget, type RelativeDateValue, type ResetViewOptions, ResolvedFlag, type ResumeWorkflowApiInput, type RetryPolicy, type ReverseGeocodingParams, RichtextAttribute, RichtextFeature, type RichtextTab, RichtextTabConfig, type Role, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_ATTRIBUTES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, type SandboxExecution, type SandboxExecutionInput, type SandboxExecutionResult, type SandboxExecutionStatus, type SandboxMode, type SandboxTrigger, SchemaError, SchemaErrorCode, type SearchOptions, SelectAttribute, type SelectFilterOperator, ShareStatusSchema, type SidePanelConfig, type SignatureAdapter, type SignaturePosition, type SignatureRequestResult, type SignatureStatus, type SignatureStatusResult, type SignerRequest, type SignerStatus, SingleRelationAttribute, type SlotMode, SlotModeSchema, type SlotStatus, type SortDirection, type SortRule, type StartNode, StartNodeSchema, type StartWorkflowApiInput, StaticFlagDefault, StatusAttribute, type StorageProvider, SyncError, type SystemAttribute, type SystemAttributeName, type SystemFields, type SystemPermissions, type SystemResource, type Tab, TabBuilder, type TabType, type TableSource, type TableTab, TableTabConfig, TenantId, TextAreaAttribute, TextAttribute, type TextFilterOperator, type TextPartData, type ThemeColors, ThemeColorsSchema, type ThemeLogo, ThemeLogoSchema, type ThemeTypography, type ThinkingPartData, type TimelineViewConfig, type TimelineViewDefinition, Timestamps, type ToolPartData, type TypedAttribute, type TypedBuilderConfig, type TypedObjectRecord, USER_STATUSES, type UpdateDBAttribute, type UpdateDBObject, type UpdateDBView, type UpdateDBViewOverlay, type UpdateDBWorkflow, type UpdateDBWorkflowAccessGrant, type UpdateDBWorkflowInstance, type UpdateDBWorkflowInvitation, type UpdateDocument, type UpdateDocumentSlot, type UpdateFile, type UpdateProcessingJob, type UpdateRoleInput, type UpdateUserProfile, type UpsertDBAttribute, type UpsertDBObject, type UpsertDBView, UserAttribute, type UserProfile, UserProfileNotFoundError, type UserRoleAssignment, type UserStatus, Uuid, type ValidatedConditionGroup, type ValidatedWorkflowDefinition, type ValidatedWorkflowNode, ValidationError, type ValidationErrorDetail, type VerificationCheck, type VerificationResult, type VerifyInput, ViewBuilder, type ViewConfig, type ViewDefinition, type ViewOverlay, type ViewType, ViewportSchema, type WithCustomAttributes, WorkflowAIBuilder, type WorkflowAccessGrant, type WorkflowAccessMode, WorkflowAssignBuilder, WorkflowBuilder, WorkflowConditionBuilder, type WorkflowConfig, WorkflowConfigSchema, type WorkflowDefinition, WorkflowDefinitionSchema, WorkflowEndBuilder, type WorkflowError, type WorkflowEvent, type WorkflowEventType, type WorkflowExecutionContext, WorkflowFormBuilder, WorkflowFormRowBuilder, type WorkflowGrantRevokedEvent, type WorkflowInstance, type WorkflowInstanceCancelledEvent, type WorkflowInstanceCompletedEvent, type WorkflowInstanceFailedEvent, type WorkflowInstanceStartedEvent, type WorkflowInvitation, type WorkflowInvitationAcceptedEvent, type WorkflowInvitationCreatedEvent, type WorkflowInvitationExpiredEvent, type WorkflowLayout, WorkflowLayoutSchema, type WorkflowNode, type WorkflowNodeCompletedEvent, type WorkflowNodeEnteredEvent, type WorkflowNodeFailedEvent, WorkflowNodeSchema, type WorkflowNodeType, WorkflowShareSchema, WorkflowSimpleFormBuilder, type WorkflowSlot, WorkflowSlotSchema, WorkflowStartBuilder, type WorkflowStatus, WorkflowStatusSchema, type WorkflowTheme, WorkflowThemeSchema, type WorkflowTransition, type WorkflowZone, ZONE_CONFIG, ZONE_ORDER, accessLevelToActions, actionsToAccessLevel, and, applyRelationProps, assignNodeZones, booleanFlag, canAccessNode, canResumeInstance, checkbox, createEmptyContext, createFlagRegistry, createFlagService, createStartTransition, currency, date, detailView, document, eq, extractAttributeNames, file, flagRegistry, formatAttributeValue, formatPhoneForDisplay, formula, generateCssVariables, generateDefaultDetailView, generateDefaultListView, generateFallbackView, getActiveTab, getContextValue, getErrorMessage, getFormFieldRefs, getNodeOutputs, getNodeSlotIds, getRollupFilterOperators, getSystemAttributeList, getZoneAllowedTypes, group, groupNodesByZone, hasProperties, inValues, isAINode, isActivityTab, isAdvancedFormNode, isAssignNode, isBehaviorProperty, isCalendarView, isConditionGroup, isConditionNode, isConditionRule, isCustomTab, isDefaultRole, isDetailView, isDocumentsTab, isEmpty, isEndNode, isFieldGroup, isFlowDefinition, isFlowFieldsRow, isFlowPublished, isFlowsTab, isForbiddenError, isFormFieldsRow, isFormNode, isFormTab, isGalleryView, isGrantExpired, isGrantRevoked, isGrantValid, isIdentityProperty, isInstanceEvent, isInstanceTerminal, isInstanceWaiting, isInverseSourceTab, isInvitationAccepted, isInvitationExpired, isInvitationOrGrantEvent, isInvitationValid, isLabelExpression, isLayoutRow, isListView, isNoValueOperator, isNodeEvent, isNotEmpty, isNotFoundError, isPresentationProperty, isProtectedResourceError, isRelationGroup, isRelationSourceTab, isRichtextTab, isSchemaError, isSimpleFormNode, isStartNode, isSystemAttribute, isSystemAttributeObject, isSystemFlow, isSystemWorkflow, isTableTab, isTimelineView, isTokenRevoked, isValidationError, isViewCustomized, isWorkflowDefinition, isWorkflowPublished, jsonFlag, listView, location, mergeWithDefaults, multiselect, neq, nodeTypeRegistry, normalizePhoneNumber, number, numberFlag, object, or, parseRawPhoneInput, phone, rating, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, richtext, rollup, select, setContextValue, setNodeNext, status, stringFlag, text, textarea, toUndefinedIfEmpty, user, validateNode, validatePhoneNumber, view, viewRegistry, workflow };
7890
+ export { AIActionConfigSchema, type AIAvailableModel, type AIBatchQuestion, type AIBatchQuestionAnswer, type AIBatchQuestionOption, type AIChatMessage, type AIChatMessagePart, type AIChatMessagePartType, type AICompactionSummary, type AIConversation, type AIMemoryEntry, type AIMemoryType, type AIMessage, type AIMessageAttachment, type AIMessageRole, AINodeSchema, type AIProviderMetrics, type AIQuestion, type AIQuestionAnswer, type AIQuestionOption, type AIQuestionType, type AIThinkingLevel, type AITodoItem, type AITodoList, type AITodoStatus, type AIToolCall, type AIToolCallRecord, type AIToolCallStatus, type AIUsageMetrics, ALL_ACTIONS, ALL_SYSTEM_RESOURCES, type AccessLevel, type Action, ActivityTabConfig, type AddAttribute$1 as AddAttribute, type AgentContentPart, type AgentDashboard, type AgentDefinition, type AgentEvent, type AgentExecutionConfig, type AgentGroup, type AgentGroupStatus, type AgentMessage, type AgentRun, type AgentRunStatus, type AgentSchedule, type AgentTrigger, type AgentTriggerType, type AnyAttributeBuilder, AssignNodeSchema, type AssignRoleInput, AssignmentMappingSchema, AssignmentSourceSchema, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, AttributeType, type AttributeUsage, type AuditAction, type AuditActorType, type AuditChange, type AuditListOptions, type AuditLogEntry, type AuditResourceType, type AuditServiceOptions, AuthMethodSchema, BEHAVIOR_PROPERTIES, type BehaviorProperty, BilateralConfig, type BilateralValidationError, type BilateralValidationResult, type BoundingBox, type BuilderConfig, type ChatFileAttachment, CheckboxAttribute, CodeExecutionActionSchema, CompletionStatus, ConcurrentModificationError, ConditionGroup, ConditionGroupSchema, ConditionNodeSchema, ConditionOperatorSchema, ConditionRule, ConditionRuleSchema, ConfigOverrides, type CreateAIMessageInput, type CreateAuditLogInput, type CreateDBAttribute, type CreateDBObject, type CreateDBView, type CreateDBViewOverlay, type CreateDBWorkflow, type CreateDBWorkflowAccessGrant, type CreateDBWorkflowInstance, type CreateDBWorkflowInvitation, type CreateDocument, type CreateDocumentSlot, type CreateFile, type CreateGrantInput, type CreateInvitationInput, type CreateInvitationResult, CreateMode, type CreateObjectRecord, type CreatePermissionInput, type CreateProcessingJob, type CreateRoleInput, type CreateSandboxExecution, CreateShareInputSchema, type CreateSignatureInput, type CreateUserProfile, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, type DBAttribute, type DBObject, type DBView, type DBViewOverlay, type DBWorkflow, type DBWorkflowAccessGrant, type DBWorkflowInstance, type DBWorkflowInvitation, DEFAULT_LABEL_FALLBACK, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_FOR_NEW_USERS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DetailViewBuilder, DetailViewDefinition, DetailViewLayout, type Document, DocumentAttribute, type DocumentData, DocumentGenerationActionSchema, type DocumentListOptions, type DocumentSlot, type DocumentStatus, DocumentsTabConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type EffectivePermissions, EndNodeSchema, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractObjectRecord, type ExtractObjectRecordWithCustom, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, FeatureFlagDefinition, FeatureFlagsRepository, FeatureGate, Field, FieldGroup, type File, FileAttribute, type FileListOptions, FileNotFoundError, type FileVisibility, FilterState, FlagLevel, FlagRegistry, type FlagResolutionContext, FlagService, type FlagServiceOptions, FlagValueType, FlowFieldsRow, FlowHeadingRow, FlowRelationListRow, FlowRowFieldSchema, FlowRowSchema, FlowSeparatorRow, FlowTextRow, FlowsTabConfig, ForbiddenError, type FormContextResponse, type FormFieldContext, FormFieldRefSchema, type FormFieldRow, type FormFieldsRow, FormNode, type FormNodeInfo, FormNodeSchema, FormulaAttribute, FormulaReturnType, type GenerateFallbackViewOptions, type GeocodingAdapter, type GeocodingAutocompleteParams, type GeocodingParams, type GeocodingSuggestion, type GlobalSearchGroupedOptions, type GlobalSearchGroupedResult, type GlobalSearchOptions, type GlobalSearchResultItem, Group, GroupBuilder, type GroupedWorkflowNodes, IDENTITY_PROPERTIES, type IdentityProperty, type IdentityVerificationAdapter, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, InstanceStatus, type InvitationStatus, type InviteUserInput, type ListOptions, ListViewBuilder, ListViewConfig, ListViewDefinition, ListViewTab, ListViewTabConfigBuilder, Location, LocationAttribute, LocationGranularity, MigrationDefinition, type ModelDefinition, MultiRelationAttribute, MultiselectAttribute, NodePositionSchema, type NodeTypeDefinition, NoopGeocodingAdapter, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, type ObjectPermissions, ObjectRecord, ObjectReferencedError, type OcrAdapter, type OcrInput, type OcrOptions, type OcrPage, type OcrResult, type OcrTextBlock, type OperationResult, Option, PRESENTATION_PROPERTIES, PendingAction, type Permission, type PermissionScope, Phone, PhoneAttribute, type PhoneNormalizationResult, type PolicyContext, PolicyViolationError, type PresentationProperty, type ProcessingJob, type ProcessingJobStatus, type ProcessingJobType, type PropertyAttributeBuilder, ProtectedResourceError, ProtectedRoleError, type ProviderName, RatingAttribute, type ReadOnlyReason, type ReasoningPartData, type RecordMetadata, RecordNotFoundError, type RecordPolicy, type RecordReference, RecordReferencedError, RelationAttribute, RelationBufferMap, RelationFieldConfig, RelationGroup, RelationGroupBuilder, RelationTarget, type ResetViewOptions, ResolvedFlag, type ResumeWorkflowApiInput, type RetryPolicy, type ReverseGeocodingParams, RichtextAttribute, RichtextFeature, RichtextTabConfig, type Role, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_ATTRIBUTES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, type SandboxExecution, type SandboxExecutionInput, type SandboxExecutionResult, type SandboxExecutionStatus, type SandboxMode, type SandboxTrigger, SchemaError, SchemaErrorCode, type SearchOptions, SelectAttribute, ShareStatusSchema, SidePanelConfig, type SignatureAdapter, type SignaturePosition, type SignatureRequestResult, type SignatureStatus, type SignatureStatusResult, type SignerRequest, type SignerStatus, SingleRelationAttribute, SlotMode, SlotModeSchema, type SlotStatus, SortRule, StartNodeSchema, type StartWorkflowApiInput, StaticFlagDefault, StatusAttribute, type StorageProvider, SyncError, type SystemAttribute, type SystemAttributeName, type SystemFields, type SystemPermissions, type SystemResource, Tab, TabBuilder, TableTab, TableTabConfig, TenantId, TextAreaAttribute, TextAttribute, type TextPartData, ThemeColorsSchema, ThemeLogoSchema, type ThinkingPartData, Timestamps, type ToolPartData, type TypedAttribute, type TypedBuilderConfig, type TypedObjectRecord, USER_STATUSES, type UpdateDBAttribute, type UpdateDBObject, type UpdateDBView, type UpdateDBViewOverlay, type UpdateDBWorkflow, type UpdateDBWorkflowAccessGrant, type UpdateDBWorkflowInstance, type UpdateDBWorkflowInvitation, type UpdateDocument, type UpdateDocumentSlot, type UpdateFile, type UpdateProcessingJob, type UpdateRoleInput, type UpdateUserProfile, type UpsertDBAttribute, type UpsertDBObject, type UpsertDBView, UserAttribute, type UserProfile, UserProfileNotFoundError, type UserRoleAssignment, type UserStatus, Uuid, type ValidatedConditionGroup, type ValidatedWorkflowDefinition, type ValidatedWorkflowNode, ValidationError, type ValidationErrorDetail, type VerificationCheck, type VerificationResult, type VerifyInput, ViewBuilder, ViewConfig, ViewDefinition, ViewType, ViewportSchema, type WithCustomAttributes, WorkflowAIBuilder, type WorkflowAccessGrant, type WorkflowAccessMode, WorkflowAssignBuilder, WorkflowBuilder, WorkflowConditionBuilder, WorkflowConfig, WorkflowConfigSchema, WorkflowDefinition, WorkflowDefinitionSchema, WorkflowEndBuilder, type WorkflowEvent, type WorkflowEventType, WorkflowExecutionContext, WorkflowFormBuilder, WorkflowFormRowBuilder, type WorkflowGrantRevokedEvent, type WorkflowInstanceCancelledEvent, type WorkflowInstanceCompletedEvent, type WorkflowInstanceFailedEvent, type WorkflowInstanceStartedEvent, type WorkflowInvitation, type WorkflowInvitationAcceptedEvent, type WorkflowInvitationCreatedEvent, type WorkflowInvitationExpiredEvent, WorkflowLayout, WorkflowLayoutSchema, WorkflowNode, type WorkflowNodeCompletedEvent, type WorkflowNodeEnteredEvent, type WorkflowNodeFailedEvent, WorkflowNodeSchema, WorkflowNodeType, WorkflowShareSchema, WorkflowSimpleFormBuilder, WorkflowSlot, WorkflowSlotSchema, WorkflowStartBuilder, WorkflowStatus, WorkflowStatusSchema, WorkflowTheme, WorkflowThemeSchema, WorkflowTransition, type WorkflowZone, ZONE_CONFIG, ZONE_ORDER, accessLevelToActions, actionsToAccessLevel, applyRelationProps, assignNodeZones, booleanFlag, canAccessNode, checkbox, createFlagRegistry, createFlagService, currency, date, detailView, document, extractAttributeNames, file, flagRegistry, formatAttributeValue, formatPhoneForDisplay, formula, generateDefaultDetailView, generateDefaultListView, generateFallbackView, getActiveTab, getErrorMessage, getFormFieldRefs, getNodeOutputs, getNodeSlotIds, getSystemAttributeList, getZoneAllowedTypes, group, groupNodesByZone, hasProperties, isBehaviorProperty, isDefaultRole, isEmpty, isForbiddenError, isFormFieldsRow, isGrantExpired, isGrantRevoked, isGrantValid, isIdentityProperty, isInstanceEvent, isInvitationAccepted, isInvitationExpired, isInvitationOrGrantEvent, isInvitationValid, isLabelExpression, isNodeEvent, isNotEmpty, isNotFoundError, isPresentationProperty, isProtectedResourceError, isSchemaError, isSystemAttribute, isSystemAttributeObject, isTokenRevoked, isValidationError, isViewCustomized, jsonFlag, listView, location, multiselect, nodeTypeRegistry, normalizePhoneNumber, number, numberFlag, object, parseRawPhoneInput, phone, rating, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, richtext, rollup, select, setNodeNext, status, stringFlag, text, textarea, toUndefinedIfEmpty, user, validateNode, validatePhoneNumber, view, viewRegistry, workflow };