@stndrds/schema 1.0.0-alpha.95 → 1.0.0-alpha.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/attributes-C-bhC0k5.d.ts +673 -0
  2. package/dist/attributes-DB76JqXm.d.mts +673 -0
  3. package/dist/chunk-2TEWGEUI.js +212 -0
  4. package/dist/chunk-4RGFTMQR.mjs +8 -0
  5. package/dist/chunk-5TLM4QXO.mjs +8 -0
  6. package/dist/chunk-67PQMHQA.mjs +199 -0
  7. package/dist/chunk-6HHSX6LP.js +64 -0
  8. package/dist/chunk-AHPXNPJC.js +105 -0
  9. package/dist/chunk-BEN6TE7Y.js +11 -0
  10. package/dist/chunk-BH3RPSC5.js +22 -0
  11. package/dist/chunk-BIQ35DLC.mjs +78 -0
  12. package/dist/chunk-CKZHFJQT.js +16 -0
  13. package/dist/chunk-E6XO2STS.js +11 -11
  14. package/dist/chunk-EIWGW2ML.mjs +99 -0
  15. package/dist/chunk-EKG35CSO.mjs +1 -0
  16. package/dist/chunk-IMEPIVTR.js +217 -0
  17. package/dist/chunk-J4ORNCAH.js +10 -0
  18. package/dist/chunk-KC4F3HB7.js +32 -0
  19. package/dist/chunk-LHXE7LLD.js +28 -0
  20. package/dist/chunk-MD6XGXTU.mjs +18 -0
  21. package/dist/chunk-N47XKY4R.js +14 -0
  22. package/dist/chunk-NXXSNUDI.mjs +8 -0
  23. package/dist/chunk-PKG3E5MW.mjs +18 -0
  24. package/dist/chunk-PZT3CIHD.mjs +192 -0
  25. package/dist/chunk-QL3UGPUG.mjs +60 -0
  26. package/dist/chunk-QY65ZSBL.js +16 -0
  27. package/dist/chunk-R6JFUC32.js +2 -0
  28. package/dist/chunk-RDXQ4CYT.mjs +9 -0
  29. package/dist/chunk-S5VJ2FZE.js +12 -0
  30. package/dist/chunk-SVII65W7.mjs +14 -0
  31. package/dist/chunk-U7VN3RUE.mjs +25 -0
  32. package/dist/chunk-VCPYYLCS.js +83 -0
  33. package/dist/chunk-VD3P2A6Q.js +10 -0
  34. package/dist/chunk-VPEV3W34.mjs +10 -0
  35. package/dist/chunk-WGFQMQMV.mjs +14 -0
  36. package/dist/chunk-X6VDDXG7.mjs +12 -0
  37. package/dist/chunk-XAORXFAX.mjs +1 -10
  38. package/dist/chunk-XEOG24K6.mjs +8 -0
  39. package/dist/chunk-XK6XC3V4.js +10 -0
  40. package/dist/chunk-XZ5B5MTG.js +20 -0
  41. package/dist/chunk-YKHC2AW6.js +10 -0
  42. package/dist/chunk-Z2T7ONKU.js +20 -0
  43. package/dist/chunk-ZFL7DXAE.mjs +28 -0
  44. package/dist/chunk-ZM7W2ZCF.mjs +20 -0
  45. package/dist/{validators-5XMwJOlV.d.ts → index-Bt-0XNSh.d.ts} +14 -1499
  46. package/dist/{validators-BCw4Sn01.d.mts → index-C9tOwUbK.d.mts} +14 -1499
  47. package/dist/index.d.mts +1267 -976
  48. package/dist/index.d.ts +1267 -976
  49. package/dist/index.js +1293 -1001
  50. package/dist/index.mjs +529 -785
  51. package/dist/types-B7nS2D1A.d.ts +39 -0
  52. package/dist/types-CjXbGsy8.d.mts +39 -0
  53. package/dist/utils.js +38 -20
  54. package/dist/utils.mjs +1 -20
  55. package/dist/validation/all.d.mts +23 -0
  56. package/dist/validation/all.d.ts +23 -0
  57. package/dist/validation/all.js +265 -0
  58. package/dist/validation/all.mjs +20 -0
  59. package/dist/validation/complex/currency.d.mts +15 -0
  60. package/dist/validation/complex/currency.d.ts +15 -0
  61. package/dist/validation/complex/currency.js +12 -0
  62. package/dist/validation/complex/currency.mjs +3 -0
  63. package/dist/validation/complex/file.d.mts +13 -0
  64. package/dist/validation/complex/file.d.ts +13 -0
  65. package/dist/validation/complex/file.js +12 -0
  66. package/dist/validation/complex/file.mjs +3 -0
  67. package/dist/validation/complex/location.d.mts +22 -0
  68. package/dist/validation/complex/location.d.ts +22 -0
  69. package/dist/validation/complex/location.js +12 -0
  70. package/dist/validation/complex/location.mjs +3 -0
  71. package/dist/validation/complex/phone.d.mts +22 -0
  72. package/dist/validation/complex/phone.d.ts +22 -0
  73. package/dist/validation/complex/phone.js +12 -0
  74. package/dist/validation/complex/phone.mjs +3 -0
  75. package/dist/validation/complex/relation.d.mts +25 -0
  76. package/dist/validation/complex/relation.d.ts +25 -0
  77. package/dist/validation/complex/relation.js +20 -0
  78. package/dist/validation/complex/relation.mjs +3 -0
  79. package/dist/validation/complex/richtext.d.mts +13 -0
  80. package/dist/validation/complex/richtext.d.ts +13 -0
  81. package/dist/validation/complex/richtext.js +12 -0
  82. package/dist/validation/complex/richtext.mjs +3 -0
  83. package/dist/validation/complex/select.d.mts +20 -0
  84. package/dist/validation/complex/select.d.ts +20 -0
  85. package/dist/validation/complex/select.js +20 -0
  86. package/dist/validation/complex/select.mjs +3 -0
  87. package/dist/validation/complex/user.d.mts +13 -0
  88. package/dist/validation/complex/user.d.ts +13 -0
  89. package/dist/validation/complex/user.js +12 -0
  90. package/dist/validation/complex/user.mjs +3 -0
  91. package/dist/validation/computed/formula.d.mts +14 -0
  92. package/dist/validation/computed/formula.d.ts +14 -0
  93. package/dist/validation/computed/formula.js +12 -0
  94. package/dist/validation/computed/formula.mjs +3 -0
  95. package/dist/validation/computed/rollup.d.mts +14 -0
  96. package/dist/validation/computed/rollup.d.ts +14 -0
  97. package/dist/validation/computed/rollup.js +12 -0
  98. package/dist/validation/computed/rollup.mjs +3 -0
  99. package/dist/validation/config/index.d.mts +421 -0
  100. package/dist/validation/config/index.d.ts +421 -0
  101. package/dist/validation/config/index.js +103 -0
  102. package/dist/validation/config/index.mjs +2 -0
  103. package/dist/validation/core/index.d.mts +85 -0
  104. package/dist/validation/core/index.d.ts +85 -0
  105. package/dist/validation/core/index.js +27 -0
  106. package/dist/validation/core/index.mjs +2 -0
  107. package/dist/validation/object/index.d.mts +6 -0
  108. package/dist/validation/object/index.d.ts +6 -0
  109. package/dist/validation/object/index.js +71 -0
  110. package/dist/validation/object/index.mjs +18 -0
  111. package/dist/validation/primitives/checkbox.d.mts +12 -0
  112. package/dist/validation/primitives/checkbox.d.ts +12 -0
  113. package/dist/validation/primitives/checkbox.js +12 -0
  114. package/dist/validation/primitives/checkbox.mjs +3 -0
  115. package/dist/validation/primitives/date.d.mts +12 -0
  116. package/dist/validation/primitives/date.d.ts +12 -0
  117. package/dist/validation/primitives/date.js +12 -0
  118. package/dist/validation/primitives/date.mjs +3 -0
  119. package/dist/validation/primitives/number.d.mts +12 -0
  120. package/dist/validation/primitives/number.d.ts +12 -0
  121. package/dist/validation/primitives/number.js +12 -0
  122. package/dist/validation/primitives/number.mjs +3 -0
  123. package/dist/validation/primitives/rating.d.mts +12 -0
  124. package/dist/validation/primitives/rating.d.ts +12 -0
  125. package/dist/validation/primitives/rating.js +12 -0
  126. package/dist/validation/primitives/rating.mjs +3 -0
  127. package/dist/validation/primitives/text.d.mts +17 -0
  128. package/dist/validation/primitives/text.d.ts +17 -0
  129. package/dist/validation/primitives/text.js +16 -0
  130. package/dist/validation/primitives/text.mjs +3 -0
  131. package/dist/validation/validators.d.mts +21 -2
  132. package/dist/validation/validators.d.ts +21 -2
  133. package/dist/validation/validators.js +265 -120
  134. package/dist/validation/validators.mjs +20 -120
  135. package/package.json +108 -5
  136. package/dist/chunk-4362R5F2.mjs +0 -780
  137. package/dist/chunk-7QUI6TSO.js +0 -780
@@ -1,677 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { IconName, CountryIso3, CurrencyCode, ColorId, MimeType } from '@stndrds/constants';
2
+ import { A as Attribute, j as AttributeType, f as RollupAttribute } from './attributes-C-bhC0k5.js';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-B7nS2D1A.js';
4
+ import { IconName, ColorId } from '@stndrds/constants';
3
5
  import { Uuid } from './utils.js';
4
6
 
5
- /**
6
- * Feature flag levels (resolution priority: user > tenant > global).
7
- *
8
- * - `global`: Applies to all tenants and users
9
- * - `tenant`: Applies to a specific tenant
10
- * - `user`: Applies to a specific user within a tenant
11
- */
12
- type FlagLevel = "global" | "tenant" | "user";
13
- /**
14
- * Flag value types supported by the system.
15
- */
16
- type FlagValueType = "boolean" | "string" | "number" | "json";
17
- /**
18
- * Definition of a feature flag.
19
- * Created using the flag builders (booleanFlag, stringFlag, etc.)
20
- */
21
- interface FeatureFlagDefinition<T = unknown> {
22
- /** Unique identifier for the flag (kebab-case) */
23
- name: string;
24
- /** Human-readable label */
25
- label: string;
26
- /** Optional description */
27
- description?: string;
28
- /** Type of the flag value */
29
- valueType: FlagValueType;
30
- /** Default value when no override exists */
31
- defaultValue: T;
32
- /** Levels at which this flag can be overridden */
33
- allowedLevels: FlagLevel[];
34
- /** Grouping category for UI */
35
- category?: string;
36
- /** System flag - cannot be modified via API */
37
- system?: boolean;
38
- }
39
- /**
40
- * Stored override for a feature flag.
41
- * Represents a row in the feature_flag_overrides table.
42
- */
43
- interface FlagOverride<T = unknown> {
44
- /** Name of the flag being overridden */
45
- flagName: string;
46
- /** Level of the override */
47
- level: FlagLevel;
48
- /** Target ID (tenantId for tenant-level, userId for user-level) */
49
- targetId?: string;
50
- /** Override value */
51
- value: T;
52
- /** Optional expiration date */
53
- expiresAt?: Date;
54
- /** Who created this override */
55
- createdBy?: string;
56
- /** When the override was created */
57
- createdAt: Date;
58
- /** When the override was last updated */
59
- updatedAt: Date;
60
- }
61
- /**
62
- * Resolved flag value with source information.
63
- * Result of flag resolution including where the value came from.
64
- */
65
- interface ResolvedFlag<T = unknown> {
66
- /** Flag name */
67
- name: string;
68
- /** Resolved value */
69
- value: T;
70
- /** Where the value came from */
71
- source: FlagLevel | "default";
72
- /** ID of the source (tenantId or userId) if not default */
73
- sourceId?: string;
74
- }
75
- /**
76
- * Feature gate configuration for conditional attribute visibility.
77
- * Used with the `.featureGate()` builder method.
78
- */
79
- interface FeatureGate {
80
- /** Name of the flag to check */
81
- flag: string;
82
- /**
83
- * Expected value for the gate to pass.
84
- * For boolean flags, defaults to `true`.
85
- * For other types, compares with strict equality.
86
- */
87
- expectedValue?: unknown;
88
- /**
89
- * Behavior when the gate fails.
90
- * - `hide`: Attribute is completely hidden (default)
91
- * - `show`: Attribute is shown regardless (no gating)
92
- * - `disable`: Attribute is visible but read-only
93
- */
94
- fallback?: "hide" | "show" | "disable";
95
- }
96
- /**
97
- * Repository interface for feature flag overrides storage.
98
- * Added to DatabaseAdapter as an optional repository.
99
- *
100
- * If not provided, only static defaults from module config are used.
101
- */
102
- interface FeatureFlagsRepository {
103
- /**
104
- * Get all overrides matching the criteria.
105
- * Returns overrides from the database (global, tenant, or user level).
106
- */
107
- getOverrides(options: {
108
- /** Filter by level */
109
- level?: FlagLevel;
110
- /** Filter by target ID (tenantId or userId) */
111
- targetId?: string;
112
- /** Filter by flag names (for efficient single/batch lookups) */
113
- flagNames?: string[];
114
- }): Promise<FlagOverride[]>;
115
- /**
116
- * Create or update an override.
117
- * Uses upsert semantics based on (flagName, level, targetId).
118
- */
119
- setOverride(override: Omit<FlagOverride, "createdAt" | "updatedAt">): Promise<FlagOverride>;
120
- /**
121
- * Delete an override.
122
- */
123
- deleteOverride(flagName: string, level: FlagLevel, targetId?: string): Promise<void>;
124
- }
125
- /**
126
- * Static flag default value for module configuration.
127
- */
128
- interface StaticFlagDefault {
129
- /** Flag name */
130
- name: string;
131
- /** Default value */
132
- value: unknown;
133
- }
134
- /**
135
- * Feature flags configuration for SchemaModule.
136
- */
137
- interface FeatureFlagsConfig {
138
- /**
139
- * Static default values for flags.
140
- * These are always applied and used when no database override exists.
141
- *
142
- * @example
143
- * ```typescript
144
- * featureFlags: {
145
- * defaults: [
146
- * { name: "architect-mode", value: false },
147
- * { name: "ai-chat", value: false },
148
- * { name: "tier", value: "free" },
149
- * ],
150
- * }
151
- * ```
152
- */
153
- defaults?: StaticFlagDefault[];
154
- }
155
-
156
- /**
157
- * Allowed attribute types in .qualifyWith()
158
- *
159
- * IMPORTANT: Complex types (formula, rollup, relation, file, user, document, richtext)
160
- * are NOT supported to avoid duplicating backend behavior.
161
- */
162
- type PropertyType = "text" | "textarea" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "select" | "multiselect" | "rating" | "location";
163
- /**
164
- * Forbidden property types that would require complex backend duplication
165
- */
166
- declare const FORBIDDEN_PROPERTY_TYPES: readonly ["formula", "rollup", "relation", "file", "user", "document", "richtext"];
167
- type ForbiddenPropertyType = (typeof FORBIDDEN_PROPERTY_TYPES)[number];
168
- /**
169
- * Union of attribute types allowed as qualified relation properties.
170
- *
171
- * These are the same Attribute types used for object attributes,
172
- * restricted to simple types that don't require complex backend duplication.
173
- */
174
- type PropertyAttribute = TextAttribute | TextAreaAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | SelectAttribute | MultiselectAttribute | RatingAttribute | LocationAttribute;
175
- /**
176
- * Schema defining properties for a qualified relation.
177
- *
178
- * Uses the same Attribute types as object attributes, enabling DRY builders:
179
- *
180
- * @example
181
- * ```typescript
182
- * relation({ name: "companies", label: "Companies" })
183
- * .to("companies").many()
184
- * .qualifyWith(
185
- * select({ name: "role", label: "Role" }).options([...]).required(),
186
- * number({ name: "shares", label: "Shares" }).min(0),
187
- * )
188
- * ```
189
- */
190
- interface PropertySchema {
191
- definitions: PropertyAttribute[];
192
- }
193
- /**
194
- * Property attribute types that have an `options` array.
195
- */
196
- type OptionPropertyAttribute = SelectAttribute | StatusAttribute | MultiselectAttribute;
197
- /**
198
- * Type guard to check if a property attribute has options.
199
- *
200
- * @param attr - The property attribute to check
201
- * @returns true if the attribute is a select, status, or multiselect type with options
202
- *
203
- * @example
204
- * ```typescript
205
- * for (const def of definitions) {
206
- * if (hasOptions(def)) {
207
- * // TypeScript knows def.options exists and is Option[]
208
- * for (const option of def.options) {
209
- * console.log(option.value);
210
- * }
211
- * }
212
- * }
213
- * ```
214
- */
215
- declare function hasOptions(attr: PropertyAttribute): attr is OptionPropertyAttribute;
216
-
217
- type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
218
- /**
219
- * Status group categorization
220
- */
221
- type StatusGroup = "idle" | "in_progress" | "finished";
222
- /**
223
- * Unified option type for select-like fields
224
- */
225
- interface Option {
226
- id: string;
227
- label: string;
228
- value: string;
229
- color?: ColorId;
230
- icon?: IconName;
231
- description?: string;
232
- group?: StatusGroup;
233
- /** Value of the inverse option for bilateral relations (e.g. "parent" → "child") */
234
- inverse?: string;
235
- }
236
- /**
237
- * Attribute grouping for UI organization
238
- */
239
- interface AttributeGroup {
240
- id: string;
241
- label: string;
242
- description?: string;
243
- attributeIds: string[];
244
- collapsible?: boolean;
245
- collapsed?: boolean;
246
- order?: number;
247
- }
248
- interface BaseAttribute<DefaultValueType = unknown> {
249
- id: Uuid;
250
- name: string;
251
- label: string;
252
- type: AttributeType;
253
- required: boolean;
254
- disabled?: boolean;
255
- placeholder?: string;
256
- description?: string;
257
- defaultValue?: DefaultValueType;
258
- icon?: IconName;
259
- order?: number;
260
- hidden?: boolean;
261
- archived?: boolean;
262
- deprecated?: boolean;
263
- system?: boolean;
264
- /**
265
- * Feature gate to conditionally show/hide/disable this attribute.
266
- * When the flag condition is not met, the attribute behavior depends on `fallback`:
267
- * - "hide" (default): Attribute is completely hidden
268
- * - "disable": Attribute is visible but read-only
269
- * - "show": No gating (useful for overriding parent settings)
270
- */
271
- featureGate?: FeatureGate;
272
- metadata?: Record<string, unknown>;
273
- }
274
- interface TextAttribute extends BaseAttribute<string> {
275
- type: "text";
276
- minLength?: number;
277
- maxLength?: number;
278
- pattern?: string;
279
- }
280
- type NumberUnit = "integer" | "decimal" | "percentage";
281
- interface NumberAttribute extends BaseAttribute<number> {
282
- type: "number";
283
- min?: number;
284
- max?: number;
285
- unit?: NumberUnit;
286
- decimals?: number;
287
- }
288
- interface CheckboxAttribute extends BaseAttribute<boolean> {
289
- type: "checkbox";
290
- }
291
- type DateFormat = "short" | "long" | "full" | "relative";
292
- type DateValue = string | "today";
293
- interface DateAttribute extends BaseAttribute<string> {
294
- type: "date";
295
- dateFormat?: DateFormat;
296
- minDate?: DateValue;
297
- maxDate?: DateValue;
298
- }
299
- interface Phone {
300
- countryCode: CountryIso3;
301
- phoneNumber: string;
302
- }
303
- interface PhoneAttribute extends BaseAttribute<Phone> {
304
- type: "phone";
305
- defaultCountryCode?: CountryIso3;
306
- }
307
- interface Currency {
308
- code: CurrencyCode;
309
- value: number;
310
- }
311
- interface CurrencyAttribute extends BaseAttribute<Currency> {
312
- type: "currency";
313
- defaultCurrency?: CurrencyCode;
314
- allowedCurrencies?: CurrencyCode[];
315
- }
316
- /**
317
- * StatusAttribute - For workflow states with semantic grouping (idle/in_progress/finished)
318
- * Use this for: Task status, Order status, Project phases, Process states
319
- * Use SelectAttribute for: Categories, Types, simple choices without workflow
320
- */
321
- interface StatusAttribute extends BaseAttribute<string> {
322
- type: "status";
323
- options: Option[];
324
- }
325
- interface Location {
326
- address?: string;
327
- address2?: string;
328
- city?: string;
329
- state?: string;
330
- postalCode?: string;
331
- country?: CountryIso3;
332
- latitude?: number;
333
- longitude?: number;
334
- }
335
- type LocationGranularity = "full" | "address" | "city" | "state" | "country" | "coordinates";
336
- interface LocationAttribute extends BaseAttribute<Location> {
337
- type: "location";
338
- granularity: LocationGranularity;
339
- enableAutocomplete?: boolean;
340
- enableMap?: boolean;
341
- defaultCountry?: CountryIso3;
342
- allowedCountries?: CountryIso3[];
343
- displayFormat?: "single_line" | "multi_line" | "compact";
344
- }
345
- /**
346
- * SelectAttribute - For simple single-choice selection
347
- * Use this for: Categories, Document types, Departments, Priorities
348
- * Options can be grouped (e.g., countries by continent) but no workflow logic
349
- */
350
- interface SelectAttribute extends BaseAttribute<string> {
351
- type: "select";
352
- options: Option[];
353
- }
354
- interface MultiselectAttribute extends BaseAttribute<string[]> {
355
- type: "multiselect";
356
- options: Option[];
357
- }
358
- interface FileAttribute extends BaseAttribute<string> {
359
- type: "file";
360
- maxFiles?: number;
361
- maxSize?: number;
362
- allowedTypes?: MimeType[] | readonly MimeType[];
363
- multiple?: boolean;
364
- }
365
- interface UserAttribute extends BaseAttribute<string> {
366
- type: "user";
367
- allowedRoles?: string[];
368
- multiple?: boolean;
369
- }
370
- /**
371
- * Wildcard marker for universal relations (can link to any object)
372
- * Use with `.toAny()` builder method
373
- */
374
- declare const RELATION_TARGET_ANY: "*";
375
- /**
376
- * Configuration for bilateral synchronization (bidirectional relations)
377
- */
378
- interface BilateralConfig {
379
- /** Target object containing the inverse attribute */
380
- object: string;
381
- /** Name of the inverse attribute */
382
- attribute: string;
383
- /** Optional cardinality override (inferred by default) */
384
- cardinality?: "one" | "many";
385
- /** When true, this side owns the storage direction for qualified properties.
386
- * Set to false on the inverse side (enriched at read time). */
387
- storageOwner?: boolean;
388
- }
389
- /**
390
- * Target object for a relation - defines which objects can be linked
391
- */
392
- interface RelationTarget {
393
- /** Object name (e.g., "companies", "contacts") or "*" for any object */
394
- object: string;
395
- /**
396
- * Display template for the label using mustache-like syntax
397
- * @example "{name}" or "{firstName} {lastName} — {email}"
398
- */
399
- displayTemplate?: string;
400
- /**
401
- * Optional filter to restrict available records
402
- * @example { status: "active" }
403
- */
404
- filter?: Record<string, unknown>;
405
- }
406
- /**
407
- * Base properties shared by both single and multi relation attributes
408
- *
409
- * Note: Deletion behavior is always "restrict" - if a record is referenced
410
- * by other records, it cannot be deleted until those references are removed.
411
- * This is enforced by RecordService.deleteRecord() which throws
412
- * RecordReferencedError when attempting to delete a referenced record.
413
- */
414
- interface RelationAttributeBase extends Omit<BaseAttribute<unknown>, "defaultValue"> {
415
- type: "relation";
416
- /** Target objects that can be linked */
417
- targets: RelationTarget[];
418
- /** Optional properties schema for qualified relations */
419
- properties?: PropertySchema;
420
- /** Configuration for bilateral synchronization (opt-in) */
421
- bilateral?: BilateralConfig;
422
- }
423
- /**
424
- * Single relation attribute (one-to-one or many-to-one)
425
- * Stores a single record ID or null
426
- */
427
- interface SingleRelationAttribute extends RelationAttributeBase {
428
- cardinality: "one";
429
- defaultValue?: string | null;
430
- }
431
- /**
432
- * Multi relation attribute (one-to-many or many-to-many)
433
- * Stores an array of record IDs
434
- */
435
- interface MultiRelationAttribute extends RelationAttributeBase {
436
- cardinality: "many";
437
- defaultValue?: string[];
438
- /** Minimum number of relations required */
439
- minItems?: number;
440
- /** Maximum number of relations allowed */
441
- maxItems?: number;
442
- }
443
- /**
444
- * RelationAttribute links to other objects/records
445
- * Discriminated union by cardinality for type-safe value handling
446
- *
447
- * @example Single relation (many-to-one)
448
- * ```typescript
449
- * relation({ name: "company", label: "Company" })
450
- * .to("companies")
451
- * .required()
452
- * // → Value: "rec-uuid-123" | null
453
- * ```
454
- *
455
- * @example Multi relation (many-to-many)
456
- * ```typescript
457
- * relation({ name: "contacts", label: "Contacts" })
458
- * .to("contacts", { displayTemplate: "{firstName} {lastName}" })
459
- * .many()
460
- * .maxItems(5)
461
- * // → Value: ["rec-1", "rec-2", ...]
462
- * ```
463
- *
464
- * @example Polymorphic relation (multiple target objects)
465
- * ```typescript
466
- * relation({ name: "linked", label: "Linked Items" })
467
- * .to("companies")
468
- * .to("contacts")
469
- * .to("deals")
470
- * .many()
471
- * // → Can link to records from any of these objects
472
- * ```
473
- */
474
- type RelationAttribute = SingleRelationAttribute | MultiRelationAttribute;
475
- /**
476
- * Check if a relation attribute is universal (can link to any object)
477
- * Universal relations have `targets: [{ object: "*" }]`
478
- */
479
- declare function isUniversalRelation(attr: RelationAttribute): boolean;
480
- /**
481
- * Check if a relation attribute has bilateral synchronization enabled
482
- */
483
- declare function isBilateralRelation(attr: RelationAttribute): attr is RelationAttribute & {
484
- bilateral: BilateralConfig;
485
- };
486
- /**
487
- * Infer the cardinality of the inverse relation
488
- * - one → many (contact.company ↔ company.contacts)
489
- * - many → many (contact.tags ↔ tag.contacts)
490
- */
491
- declare function inferInverseCardinality(cardinality: "one" | "many"): "one" | "many";
492
- interface TextAreaAttribute extends BaseAttribute<string> {
493
- type: "textarea";
494
- }
495
- /**
496
- * Available features for richtext editor
497
- */
498
- type RichtextFeature = "headings" | "bold" | "italic" | "lists" | "links" | "images" | "codeBlocks" | "tables";
499
- /**
500
- * RichtextAttribute - Rich text content using semantic markdown
501
- *
502
- * Stores content as semantic markdown string (with directives like :::callout).
503
- * Parsed at runtime to Tiptap JSON for editing.
504
- * Use this for: Notes, articles, descriptions, long-form content.
505
- *
506
- * @example
507
- * ```typescript
508
- * richtext({ name: "content", label: "Content" })
509
- * .features(["headings", "bold", "italic", "lists", "links"])
510
- * .required()
511
- * ```
512
- */
513
- interface RichtextAttribute extends BaseAttribute<string> {
514
- type: "richtext";
515
- /** Enabled features. If undefined, all features are enabled. */
516
- features?: RichtextFeature[];
517
- }
518
- interface RatingAttribute extends BaseAttribute<number> {
519
- type: "rating";
520
- max?: number;
521
- iconType?: "star" | "heart" | "thumbs" | "number";
522
- }
523
- /**
524
- * Return type for formula expressions
525
- */
526
- type FormulaReturnType = "text" | "number" | "boolean" | "date";
527
- /**
528
- * FormulaAttribute - Computed value based on other attributes
529
- *
530
- * Formulas are calculated at read-time and are always read-only.
531
- * Users cannot directly edit formula values.
532
- *
533
- * @example Simple calculation
534
- * ```typescript
535
- * formula({ name: "total", label: "Total" })
536
- * .expression("price * quantity")
537
- * .returns("number")
538
- * .decimals(2)
539
- * ```
540
- *
541
- * @example With functions
542
- * ```typescript
543
- * formula({ name: "fullName", label: "Full Name" })
544
- * .expression("CONCAT(firstName, ' ', lastName)")
545
- * .returns("text")
546
- * ```
547
- */
548
- interface FormulaAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
549
- type: "formula";
550
- /** Expression to evaluate (e.g., "price * quantity") */
551
- expression: string;
552
- /** Expected return type for formatting */
553
- returnType: FormulaReturnType;
554
- /** Decimal places for number results */
555
- decimals?: number;
556
- /** Whether to allow relation references in the expression (e.g., "company.name") */
557
- allowRelations?: boolean;
558
- /** Formula is always not required (read-only) */
559
- required: false;
560
- }
561
- /**
562
- * Aggregation functions for rollup attributes
563
- *
564
- * Categories:
565
- * - Numeric (sum, avg): Only for number, currency, rating types
566
- * - Date (earliest, latest): Only for date type
567
- * - Count (count, countValues, countUniqueValues, countEmpty): Universal
568
- * - Percent (percentEmpty, percentNotEmpty): Universal
569
- * - Lookup (original): Returns all values as array, rendered as target type
570
- */
571
- type RollupFunction = "sum" | "avg" | "earliest" | "latest" | "count" | "countValues" | "countUniqueValues" | "countEmpty" | "percentEmpty" | "percentNotEmpty" | "original";
572
- /**
573
- * RollupAttribute - Aggregates values from related records
574
- *
575
- * Rollups are calculated and stored (denormalized) for performance.
576
- * They are automatically recalculated when related records change.
577
- * Users cannot directly edit rollup values.
578
- *
579
- * @example Sum of related amounts
580
- * ```typescript
581
- * rollup({ name: "totalOrders", label: "Total Orders" })
582
- * .from("orders") // relation attribute name
583
- * .aggregate("amount") // target attribute to sum
584
- * .using("sum")
585
- * .decimals(2)
586
- * ```
587
- *
588
- * @example Count of related records
589
- * ```typescript
590
- * rollup({ name: "orderCount", label: "Number of Orders" })
591
- * .from("orders")
592
- * .using("count")
593
- * ```
594
- */
595
- interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
596
- type: "rollup";
597
- /** Name of the relation attribute on this object */
598
- relationAttribute: string;
599
- /**
600
- * Dot notation path for multi-level traversal (Phase 4+)
601
- * @example "orders.items" - traverse through orders to items
602
- */
603
- relationPath?: string;
604
- /** Attribute name on the target object to aggregate */
605
- targetAttribute: string;
606
- /** Aggregation function to apply */
607
- function: RollupFunction;
608
- /** Decimal places for numeric results */
609
- decimals?: number;
610
- /** Rollup is always not required (read-only) */
611
- required: false;
612
- /**
613
- * Cached type of the target attribute for display purposes
614
- * Used when function="original" to render values as the target type
615
- */
616
- targetAttributeType?: AttributeType;
617
- /**
618
- * Cached options from target attribute (for select/status/multiselect display)
619
- * Required when function="original" and target is a select-like type
620
- */
621
- targetAttributeOptions?: Option[];
622
- }
623
- /**
624
- * DocumentAttribute - References one or multiple documents with templates.
625
- *
626
- * Unlike FileAttribute which stores raw file references, DocumentAttribute
627
- * provides structured document handling with templates, multi-file support,
628
- * and automatic processing (OCR, signature, identity verification).
629
- *
630
- * @example Single document with template choice
631
- * ```typescript
632
- * document({ name: "identityDocument", label: "Pièce d'identité" })
633
- * .templates(["french_id_card", "passport"])
634
- * .autoProcess()
635
- * .required()
636
- * ```
637
- *
638
- * @example Multiple documents
639
- * ```typescript
640
- * document({ name: "contracts", label: "Contrats" })
641
- * .multiple()
642
- * .maxDocuments(10)
643
- * ```
644
- */
645
- interface DocumentAttribute extends BaseAttribute<string | string[]> {
646
- type: "document";
647
- /**
648
- * Allow multiple documents.
649
- * If true, value is string[] (document IDs).
650
- * If false/undefined, value is string (single document ID).
651
- */
652
- multiple?: boolean;
653
- /**
654
- * Maximum number of documents when multiple: true.
655
- */
656
- maxDocuments?: number;
657
- /**
658
- * Automatically trigger processing (OCR, verification) on upload.
659
- */
660
- autoProcess?: boolean;
661
- }
662
- type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
663
- /**
664
- * Attribute types that are not sortable by default.
665
- * These types have complex/binary values without a meaningful natural order.
666
- */
667
- declare const NON_SORTABLE_TYPES: ReadonlySet<AttributeType>;
668
- /**
669
- * Check if an attribute supports sorting based on its type.
670
- */
671
- declare function isAttributeSortable(attr: {
672
- type: AttributeType;
673
- }): boolean;
674
-
675
7
  /** Operators for text-based attributes */
676
8
  type TextFilterOperator = "is" | "is_not" | "contains" | "not_contains" | "starts_with" | "ends_with" | "is_empty" | "is_not_empty";
677
9
  /** Operators for number-based attributes */
@@ -1409,131 +741,6 @@ interface ConditionNode extends BaseNode {
1409
741
  /** ID of node to execute if condition is false (optional for drafts) */
1410
742
  onFalse?: string | null;
1411
743
  }
1412
- /**
1413
- * Source for an assignment value.
1414
- *
1415
- * - `expression`: mustache template resolved at execution (text-like attrs only).
1416
- * Uses `{{ slotId.attribute }}` dot notation, resolved via `renderLabelExpression`.
1417
- * - `slot-ref`: reference to a slot's record for relation attributes.
1418
- * Resolved at persistence time via `$slot:slotId` placeholder.
1419
- * - `static`: fixed value set directly.
1420
- */
1421
- type AssignmentSource = {
1422
- type: "expression";
1423
- template: string;
1424
- } | {
1425
- type: "slot-ref";
1426
- slotId: string;
1427
- properties?: Record<string, unknown>;
1428
- } | {
1429
- type: "static";
1430
- value: unknown;
1431
- };
1432
- /**
1433
- * Single assignment: set one attribute on the target slot.
1434
- */
1435
- interface AssignmentMapping {
1436
- /** Attribute name on the target slot's object */
1437
- targetAttribute: string;
1438
- /** Source of the value */
1439
- source: AssignmentSource;
1440
- }
1441
- /**
1442
- * Assign node: set values on a target slot's record.
1443
- * All assignments target the same slot, selected at the node level.
1444
- *
1445
- * @example
1446
- * ```typescript
1447
- * const node: AssignNode = {
1448
- * type: "assign",
1449
- * id: "assign-client-data",
1450
- * label: "Set Client Data",
1451
- * targetSlotId: "client",
1452
- * assignments: [
1453
- * { targetAttribute: "company", source: { type: "slot-ref", slotId: "company" } },
1454
- * { targetAttribute: "fullName", source: { type: "expression", template: "{{ client.firstName }} {{ client.lastName }}" } },
1455
- * { targetAttribute: "status", source: { type: "static", value: "active" } },
1456
- * ],
1457
- * next: "end"
1458
- * };
1459
- * ```
1460
- */
1461
- interface AssignNode extends BaseNode {
1462
- type: "assign";
1463
- label: string;
1464
- description?: string;
1465
- /** Single target slot for all assignments */
1466
- targetSlotId: string;
1467
- /** List of attribute assignments */
1468
- assignments: AssignmentMapping[];
1469
- next?: string | null;
1470
- }
1471
- /**
1472
- * AI node — runs an AI agent (inline or referenced from a definition).
1473
- *
1474
- * Two modes:
1475
- * - `sync`: runs the agent inline, workflow waits for result
1476
- * - `async`: enqueues a background agent run, workflow waits via event bus
1477
- *
1478
- * Two sources:
1479
- * - `definitionId`: load agent config from DB (existing background agent definition)
1480
- * - inline props: define the agent directly in the node (no DB record needed)
1481
- *
1482
- * When both `definitionId` and inline props are set, inline props override the definition.
1483
- *
1484
- * @example Inline sync agent
1485
- * ```typescript
1486
- * const node: AINode = {
1487
- * type: "ai",
1488
- * id: "generate",
1489
- * label: "Générer le contrat",
1490
- * mode: "sync",
1491
- * systemPrompt: "Tu es un expert en rédaction de contrats.",
1492
- * model: "claude-sonnet-4-6",
1493
- * tools: ["generate_document"],
1494
- * inputSlotIds: ["client"],
1495
- * targetSlotIds: ["client"],
1496
- * instructions: "Génère un contrat PDF pour ce client.",
1497
- * next: "end",
1498
- * };
1499
- * ```
1500
- *
1501
- * @example Referenced async agent
1502
- * ```typescript
1503
- * const node: AINode = {
1504
- * type: "ai",
1505
- * id: "enrich",
1506
- * label: "Enrichir le contact",
1507
- * mode: "async",
1508
- * definitionId: "my-enrichment-agent-id",
1509
- * inputSlotIds: ["contact"],
1510
- * instructions: "Enrichis le profil du contact.",
1511
- * next: "end",
1512
- * };
1513
- * ```
1514
- */
1515
- interface AINode extends BaseNode {
1516
- type: "ai";
1517
- label: string;
1518
- description?: string;
1519
- /** Execution mode */
1520
- mode: "sync" | "async";
1521
- /** ID of an existing agent_definition record in DB */
1522
- definitionId?: string;
1523
- systemPrompt?: string;
1524
- model?: string;
1525
- /** Tool names to expose to the agent. Example: ["generate_document", "execute_code"] */
1526
- tools?: string[];
1527
- maxIterations?: number;
1528
- /** User message injected as the agent's first message */
1529
- instructions?: string;
1530
- /** Slot IDs whose data is serialized into the agent's context */
1531
- inputSlotIds?: string[];
1532
- /** Slot IDs used as targets by the generate_document tool */
1533
- targetSlotIds?: string[];
1534
- timeoutMs?: number;
1535
- next?: string | null;
1536
- }
1537
744
  /**
1538
745
  * Terminal node marking the end of a workflow path.
1539
746
  * A workflow can have multiple EndNodes for different outcomes.
@@ -1569,7 +776,7 @@ interface EndNode extends BaseNode {
1569
776
  * Union of all workflow node types.
1570
777
  * Use discriminated union on `type` field for type narrowing.
1571
778
  */
1572
- type WorkflowNode = StartNode | FormNode | ConditionNode | AssignNode | AINode | EndNode;
779
+ type WorkflowNode = StartNode | FormNode | ConditionNode | EndNode;
1573
780
  /**
1574
781
  * All possible node types
1575
782
  */
@@ -1586,14 +793,6 @@ declare function isFormNode(node: WorkflowNode): node is FormNode;
1586
793
  * Check if a node is a ConditionNode
1587
794
  */
1588
795
  declare function isConditionNode(node: WorkflowNode): node is ConditionNode;
1589
- /**
1590
- * Check if a node is an AssignNode
1591
- */
1592
- declare function isAssignNode(node: WorkflowNode): node is AssignNode;
1593
- /**
1594
- * Check if a node is an AINode
1595
- */
1596
- declare function isAINode(node: WorkflowNode): node is AINode;
1597
796
  /**
1598
797
  * Check if a node is an EndNode
1599
798
  */
@@ -1890,18 +1089,13 @@ interface PendingAction {
1890
1089
  /** ID of the node waiting for action */
1891
1090
  nodeId: string;
1892
1091
  /** Type of the waiting node */
1893
- nodeType: "form" | "signature" | "approval" | "ai";
1092
+ nodeType: "form" | "signature" | "approval";
1894
1093
  /** Display label for the action */
1895
1094
  nodeLabel: string;
1896
1095
  /** ID of the participation required to complete this action */
1897
1096
  requiredParticipationId?: string;
1898
1097
  /** When the pending action expires */
1899
1098
  expiresAt?: Date;
1900
- /**
1901
- * Background agent run ID — set when nodeType is "ai" and mode is "async".
1902
- * Used to resume the workflow when the agent run completes.
1903
- */
1904
- agentRunId?: string;
1905
1099
  }
1906
1100
  /**
1907
1101
  * A specific execution of a workflow.
@@ -2780,638 +1974,6 @@ declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt"
2780
1974
  */
2781
1975
  type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
2782
1976
 
2783
- /**
2784
- * Format Zod validation errors into a consistent structure.
2785
- * This eliminates code duplication across multiple validation functions.
2786
- */
2787
- declare function formatZodErrors(error: z.ZodError): Array<{
2788
- path: string[];
2789
- message: string;
2790
- }>;
2791
- /**
2792
- * Validation messages for Zod validators.
2793
- * All functions receive the full Attribute to access label, type, etc.
2794
- * Can be customized for i18n support.
2795
- */
2796
- interface ValidationMessages {
2797
- required: (attr: Attribute) => string;
2798
- invalidType: (attr: Attribute, expected: string) => string;
2799
- minLength: (attr: Attribute, min: number) => string;
2800
- maxLength: (attr: Attribute, max: number) => string;
2801
- invalidPattern: (attr: Attribute) => string;
2802
- minValue: (attr: Attribute, min: number) => string;
2803
- maxValue: (attr: Attribute, max: number) => string;
2804
- mustBeInteger: (attr: Attribute) => string;
2805
- invalidDate: (attr: Attribute) => string;
2806
- invalidOption: (attr: Attribute, options: string[]) => string;
2807
- invalidId: (attr: Attribute) => string;
2808
- minItems: (attr: Attribute, min: number) => string;
2809
- maxItems: (attr: Attribute, max: number) => string;
2810
- invalidRichtext: (attr: Attribute) => string;
2811
- invalidPhone: (attr: Attribute) => string;
2812
- invalidCurrency: (attr: Attribute) => string;
2813
- invalidLocation: (attr: Attribute) => string;
2814
- }
2815
- declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
2816
- /**
2817
- * Text attribute config schema
2818
- */
2819
- declare const textConfigSchema: z.ZodObject<{
2820
- disabled: z.ZodOptional<z.ZodBoolean>;
2821
- placeholder: z.ZodOptional<z.ZodString>;
2822
- description: z.ZodOptional<z.ZodString>;
2823
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2824
- icon: z.ZodOptional<z.ZodString>;
2825
- order: z.ZodOptional<z.ZodNumber>;
2826
- hidden: z.ZodOptional<z.ZodBoolean>;
2827
- archived: z.ZodOptional<z.ZodBoolean>;
2828
- deprecated: z.ZodOptional<z.ZodBoolean>;
2829
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2830
- minLength: z.ZodOptional<z.ZodNumber>;
2831
- maxLength: z.ZodOptional<z.ZodNumber>;
2832
- pattern: z.ZodOptional<z.ZodString>;
2833
- }, z.core.$strip>;
2834
- /**
2835
- * Textarea attribute config schema
2836
- */
2837
- declare const textareaConfigSchema: z.ZodObject<{
2838
- disabled: z.ZodOptional<z.ZodBoolean>;
2839
- placeholder: z.ZodOptional<z.ZodString>;
2840
- description: z.ZodOptional<z.ZodString>;
2841
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2842
- icon: z.ZodOptional<z.ZodString>;
2843
- order: z.ZodOptional<z.ZodNumber>;
2844
- hidden: z.ZodOptional<z.ZodBoolean>;
2845
- archived: z.ZodOptional<z.ZodBoolean>;
2846
- deprecated: z.ZodOptional<z.ZodBoolean>;
2847
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2848
- }, z.core.$strip>;
2849
- /**
2850
- * Richtext attribute config schema
2851
- */
2852
- declare const richtextConfigSchema: z.ZodObject<{
2853
- disabled: z.ZodOptional<z.ZodBoolean>;
2854
- placeholder: z.ZodOptional<z.ZodString>;
2855
- description: z.ZodOptional<z.ZodString>;
2856
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2857
- icon: z.ZodOptional<z.ZodString>;
2858
- order: z.ZodOptional<z.ZodNumber>;
2859
- hidden: z.ZodOptional<z.ZodBoolean>;
2860
- archived: z.ZodOptional<z.ZodBoolean>;
2861
- deprecated: z.ZodOptional<z.ZodBoolean>;
2862
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2863
- features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2864
- headings: "headings";
2865
- bold: "bold";
2866
- italic: "italic";
2867
- lists: "lists";
2868
- links: "links";
2869
- images: "images";
2870
- codeBlocks: "codeBlocks";
2871
- tables: "tables";
2872
- }>>>;
2873
- }, z.core.$strip>;
2874
- /**
2875
- * Number attribute config schema
2876
- */
2877
- declare const numberConfigSchema: z.ZodObject<{
2878
- disabled: z.ZodOptional<z.ZodBoolean>;
2879
- placeholder: z.ZodOptional<z.ZodString>;
2880
- description: z.ZodOptional<z.ZodString>;
2881
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2882
- icon: z.ZodOptional<z.ZodString>;
2883
- order: z.ZodOptional<z.ZodNumber>;
2884
- hidden: z.ZodOptional<z.ZodBoolean>;
2885
- archived: z.ZodOptional<z.ZodBoolean>;
2886
- deprecated: z.ZodOptional<z.ZodBoolean>;
2887
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2888
- min: z.ZodOptional<z.ZodNumber>;
2889
- max: z.ZodOptional<z.ZodNumber>;
2890
- unit: z.ZodOptional<z.ZodEnum<{
2891
- percentage: "percentage";
2892
- integer: "integer";
2893
- decimal: "decimal";
2894
- }>>;
2895
- decimals: z.ZodOptional<z.ZodNumber>;
2896
- }, z.core.$strip>;
2897
- /**
2898
- * Checkbox attribute config schema
2899
- */
2900
- declare const checkboxConfigSchema: z.ZodObject<{
2901
- disabled: z.ZodOptional<z.ZodBoolean>;
2902
- placeholder: z.ZodOptional<z.ZodString>;
2903
- description: z.ZodOptional<z.ZodString>;
2904
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2905
- icon: z.ZodOptional<z.ZodString>;
2906
- order: z.ZodOptional<z.ZodNumber>;
2907
- hidden: z.ZodOptional<z.ZodBoolean>;
2908
- archived: z.ZodOptional<z.ZodBoolean>;
2909
- deprecated: z.ZodOptional<z.ZodBoolean>;
2910
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2911
- }, z.core.$strip>;
2912
- /**
2913
- * Date attribute config schema
2914
- */
2915
- declare const dateConfigSchema: z.ZodObject<{
2916
- disabled: z.ZodOptional<z.ZodBoolean>;
2917
- placeholder: z.ZodOptional<z.ZodString>;
2918
- description: z.ZodOptional<z.ZodString>;
2919
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2920
- icon: z.ZodOptional<z.ZodString>;
2921
- order: z.ZodOptional<z.ZodNumber>;
2922
- hidden: z.ZodOptional<z.ZodBoolean>;
2923
- archived: z.ZodOptional<z.ZodBoolean>;
2924
- deprecated: z.ZodOptional<z.ZodBoolean>;
2925
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2926
- dateFormat: z.ZodOptional<z.ZodEnum<{
2927
- short: "short";
2928
- long: "long";
2929
- full: "full";
2930
- relative: "relative";
2931
- }>>;
2932
- minDate: z.ZodOptional<z.ZodString>;
2933
- maxDate: z.ZodOptional<z.ZodString>;
2934
- }, z.core.$strip>;
2935
- /**
2936
- * Phone attribute config schema
2937
- */
2938
- declare const phoneConfigSchema: z.ZodObject<{
2939
- disabled: z.ZodOptional<z.ZodBoolean>;
2940
- placeholder: z.ZodOptional<z.ZodString>;
2941
- description: z.ZodOptional<z.ZodString>;
2942
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2943
- icon: z.ZodOptional<z.ZodString>;
2944
- order: z.ZodOptional<z.ZodNumber>;
2945
- hidden: z.ZodOptional<z.ZodBoolean>;
2946
- archived: z.ZodOptional<z.ZodBoolean>;
2947
- deprecated: z.ZodOptional<z.ZodBoolean>;
2948
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2949
- defaultCountryCode: z.ZodOptional<z.ZodString>;
2950
- }, z.core.$strip>;
2951
- /**
2952
- * Currency attribute config schema
2953
- */
2954
- declare const currencyConfigSchema: z.ZodObject<{
2955
- disabled: z.ZodOptional<z.ZodBoolean>;
2956
- placeholder: z.ZodOptional<z.ZodString>;
2957
- description: z.ZodOptional<z.ZodString>;
2958
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2959
- icon: z.ZodOptional<z.ZodString>;
2960
- order: z.ZodOptional<z.ZodNumber>;
2961
- hidden: z.ZodOptional<z.ZodBoolean>;
2962
- archived: z.ZodOptional<z.ZodBoolean>;
2963
- deprecated: z.ZodOptional<z.ZodBoolean>;
2964
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2965
- defaultCurrency: z.ZodOptional<z.ZodString>;
2966
- allowedCurrencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
2967
- }, z.core.$strip>;
2968
- /**
2969
- * Status attribute config schema
2970
- */
2971
- declare const statusConfigSchema: z.ZodObject<{
2972
- disabled: z.ZodOptional<z.ZodBoolean>;
2973
- placeholder: z.ZodOptional<z.ZodString>;
2974
- description: z.ZodOptional<z.ZodString>;
2975
- defaultValue: z.ZodOptional<z.ZodUnknown>;
2976
- icon: z.ZodOptional<z.ZodString>;
2977
- order: z.ZodOptional<z.ZodNumber>;
2978
- hidden: z.ZodOptional<z.ZodBoolean>;
2979
- archived: z.ZodOptional<z.ZodBoolean>;
2980
- deprecated: z.ZodOptional<z.ZodBoolean>;
2981
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2982
- options: z.ZodArray<z.ZodObject<{
2983
- id: z.ZodString;
2984
- label: z.ZodString;
2985
- value: z.ZodString;
2986
- color: z.ZodOptional<z.ZodString>;
2987
- icon: z.ZodOptional<z.ZodString>;
2988
- description: z.ZodOptional<z.ZodString>;
2989
- group: z.ZodOptional<z.ZodEnum<{
2990
- idle: "idle";
2991
- in_progress: "in_progress";
2992
- finished: "finished";
2993
- }>>;
2994
- inverse: z.ZodOptional<z.ZodString>;
2995
- }, z.core.$strip>>;
2996
- }, z.core.$strip>;
2997
- /**
2998
- * Location attribute config schema
2999
- */
3000
- declare const locationConfigSchema: z.ZodObject<{
3001
- disabled: z.ZodOptional<z.ZodBoolean>;
3002
- placeholder: z.ZodOptional<z.ZodString>;
3003
- description: z.ZodOptional<z.ZodString>;
3004
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3005
- icon: z.ZodOptional<z.ZodString>;
3006
- order: z.ZodOptional<z.ZodNumber>;
3007
- hidden: z.ZodOptional<z.ZodBoolean>;
3008
- archived: z.ZodOptional<z.ZodBoolean>;
3009
- deprecated: z.ZodOptional<z.ZodBoolean>;
3010
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3011
- granularity: z.ZodEnum<{
3012
- full: "full";
3013
- address: "address";
3014
- city: "city";
3015
- state: "state";
3016
- country: "country";
3017
- coordinates: "coordinates";
3018
- }>;
3019
- enableAutocomplete: z.ZodOptional<z.ZodBoolean>;
3020
- enableMap: z.ZodOptional<z.ZodBoolean>;
3021
- defaultCountry: z.ZodOptional<z.ZodString>;
3022
- allowedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
3023
- displayFormat: z.ZodOptional<z.ZodEnum<{
3024
- single_line: "single_line";
3025
- multi_line: "multi_line";
3026
- compact: "compact";
3027
- }>>;
3028
- }, z.core.$strip>;
3029
- /**
3030
- * Select attribute config schema
3031
- */
3032
- declare const selectConfigSchema: z.ZodObject<{
3033
- disabled: z.ZodOptional<z.ZodBoolean>;
3034
- placeholder: z.ZodOptional<z.ZodString>;
3035
- description: z.ZodOptional<z.ZodString>;
3036
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3037
- icon: z.ZodOptional<z.ZodString>;
3038
- order: z.ZodOptional<z.ZodNumber>;
3039
- hidden: z.ZodOptional<z.ZodBoolean>;
3040
- archived: z.ZodOptional<z.ZodBoolean>;
3041
- deprecated: z.ZodOptional<z.ZodBoolean>;
3042
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3043
- options: z.ZodArray<z.ZodObject<{
3044
- id: z.ZodString;
3045
- label: z.ZodString;
3046
- value: z.ZodString;
3047
- color: z.ZodOptional<z.ZodString>;
3048
- icon: z.ZodOptional<z.ZodString>;
3049
- description: z.ZodOptional<z.ZodString>;
3050
- group: z.ZodOptional<z.ZodEnum<{
3051
- idle: "idle";
3052
- in_progress: "in_progress";
3053
- finished: "finished";
3054
- }>>;
3055
- inverse: z.ZodOptional<z.ZodString>;
3056
- }, z.core.$strip>>;
3057
- }, z.core.$strip>;
3058
- /**
3059
- * Multiselect attribute config schema
3060
- */
3061
- declare const multiselectConfigSchema: z.ZodObject<{
3062
- disabled: z.ZodOptional<z.ZodBoolean>;
3063
- placeholder: z.ZodOptional<z.ZodString>;
3064
- description: z.ZodOptional<z.ZodString>;
3065
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3066
- icon: z.ZodOptional<z.ZodString>;
3067
- order: z.ZodOptional<z.ZodNumber>;
3068
- hidden: z.ZodOptional<z.ZodBoolean>;
3069
- archived: z.ZodOptional<z.ZodBoolean>;
3070
- deprecated: z.ZodOptional<z.ZodBoolean>;
3071
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3072
- options: z.ZodArray<z.ZodObject<{
3073
- id: z.ZodString;
3074
- label: z.ZodString;
3075
- value: z.ZodString;
3076
- color: z.ZodOptional<z.ZodString>;
3077
- icon: z.ZodOptional<z.ZodString>;
3078
- description: z.ZodOptional<z.ZodString>;
3079
- group: z.ZodOptional<z.ZodEnum<{
3080
- idle: "idle";
3081
- in_progress: "in_progress";
3082
- finished: "finished";
3083
- }>>;
3084
- inverse: z.ZodOptional<z.ZodString>;
3085
- }, z.core.$strip>>;
3086
- }, z.core.$strip>;
3087
- /**
3088
- * File attribute config schema
3089
- */
3090
- declare const fileConfigSchema: z.ZodObject<{
3091
- disabled: z.ZodOptional<z.ZodBoolean>;
3092
- placeholder: z.ZodOptional<z.ZodString>;
3093
- description: z.ZodOptional<z.ZodString>;
3094
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3095
- icon: z.ZodOptional<z.ZodString>;
3096
- order: z.ZodOptional<z.ZodNumber>;
3097
- hidden: z.ZodOptional<z.ZodBoolean>;
3098
- archived: z.ZodOptional<z.ZodBoolean>;
3099
- deprecated: z.ZodOptional<z.ZodBoolean>;
3100
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3101
- maxFiles: z.ZodOptional<z.ZodNumber>;
3102
- maxSize: z.ZodOptional<z.ZodNumber>;
3103
- allowedTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3104
- multiple: z.ZodOptional<z.ZodBoolean>;
3105
- }, z.core.$strip>;
3106
- /**
3107
- * User attribute config schema
3108
- */
3109
- declare const userConfigSchema: z.ZodObject<{
3110
- disabled: z.ZodOptional<z.ZodBoolean>;
3111
- placeholder: z.ZodOptional<z.ZodString>;
3112
- description: z.ZodOptional<z.ZodString>;
3113
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3114
- icon: z.ZodOptional<z.ZodString>;
3115
- order: z.ZodOptional<z.ZodNumber>;
3116
- hidden: z.ZodOptional<z.ZodBoolean>;
3117
- archived: z.ZodOptional<z.ZodBoolean>;
3118
- deprecated: z.ZodOptional<z.ZodBoolean>;
3119
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3120
- allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
3121
- multiple: z.ZodOptional<z.ZodBoolean>;
3122
- }, z.core.$strip>;
3123
- /**
3124
- * Relation attribute config schema
3125
- */
3126
- declare const relationConfigSchema: z.ZodObject<{
3127
- disabled: z.ZodOptional<z.ZodBoolean>;
3128
- placeholder: z.ZodOptional<z.ZodString>;
3129
- description: z.ZodOptional<z.ZodString>;
3130
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3131
- icon: z.ZodOptional<z.ZodString>;
3132
- order: z.ZodOptional<z.ZodNumber>;
3133
- hidden: z.ZodOptional<z.ZodBoolean>;
3134
- archived: z.ZodOptional<z.ZodBoolean>;
3135
- deprecated: z.ZodOptional<z.ZodBoolean>;
3136
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3137
- targets: z.ZodArray<z.ZodObject<{
3138
- object: z.ZodString;
3139
- displayTemplate: z.ZodOptional<z.ZodString>;
3140
- filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3141
- }, z.core.$strip>>;
3142
- cardinality: z.ZodEnum<{
3143
- one: "one";
3144
- many: "many";
3145
- }>;
3146
- minItems: z.ZodOptional<z.ZodNumber>;
3147
- maxItems: z.ZodOptional<z.ZodNumber>;
3148
- }, z.core.$strip>;
3149
- /**
3150
- * Rating attribute config schema
3151
- */
3152
- declare const ratingConfigSchema: z.ZodObject<{
3153
- disabled: z.ZodOptional<z.ZodBoolean>;
3154
- placeholder: z.ZodOptional<z.ZodString>;
3155
- description: z.ZodOptional<z.ZodString>;
3156
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3157
- icon: z.ZodOptional<z.ZodString>;
3158
- order: z.ZodOptional<z.ZodNumber>;
3159
- hidden: z.ZodOptional<z.ZodBoolean>;
3160
- archived: z.ZodOptional<z.ZodBoolean>;
3161
- deprecated: z.ZodOptional<z.ZodBoolean>;
3162
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3163
- max: z.ZodOptional<z.ZodNumber>;
3164
- iconType: z.ZodOptional<z.ZodEnum<{
3165
- number: "number";
3166
- heart: "heart";
3167
- star: "star";
3168
- thumbs: "thumbs";
3169
- }>>;
3170
- }, z.core.$strip>;
3171
- /**
3172
- * Formula attribute config schema
3173
- */
3174
- declare const formulaConfigSchema: z.ZodObject<{
3175
- disabled: z.ZodOptional<z.ZodBoolean>;
3176
- placeholder: z.ZodOptional<z.ZodString>;
3177
- description: z.ZodOptional<z.ZodString>;
3178
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3179
- icon: z.ZodOptional<z.ZodString>;
3180
- order: z.ZodOptional<z.ZodNumber>;
3181
- hidden: z.ZodOptional<z.ZodBoolean>;
3182
- archived: z.ZodOptional<z.ZodBoolean>;
3183
- deprecated: z.ZodOptional<z.ZodBoolean>;
3184
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3185
- expression: z.ZodString;
3186
- returnType: z.ZodEnum<{
3187
- number: "number";
3188
- boolean: "boolean";
3189
- text: "text";
3190
- date: "date";
3191
- }>;
3192
- decimals: z.ZodOptional<z.ZodNumber>;
3193
- allowRelations: z.ZodOptional<z.ZodBoolean>;
3194
- }, z.core.$strip>;
3195
- /**
3196
- * Rollup attribute config schema
3197
- */
3198
- declare const rollupConfigSchema: z.ZodObject<{
3199
- disabled: z.ZodOptional<z.ZodBoolean>;
3200
- placeholder: z.ZodOptional<z.ZodString>;
3201
- description: z.ZodOptional<z.ZodString>;
3202
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3203
- icon: z.ZodOptional<z.ZodString>;
3204
- order: z.ZodOptional<z.ZodNumber>;
3205
- hidden: z.ZodOptional<z.ZodBoolean>;
3206
- archived: z.ZodOptional<z.ZodBoolean>;
3207
- deprecated: z.ZodOptional<z.ZodBoolean>;
3208
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3209
- relationAttribute: z.ZodOptional<z.ZodString>;
3210
- relationPath: z.ZodOptional<z.ZodString>;
3211
- targetAttribute: z.ZodString;
3212
- function: z.ZodEnum<{
3213
- sum: "sum";
3214
- avg: "avg";
3215
- earliest: "earliest";
3216
- latest: "latest";
3217
- count: "count";
3218
- countValues: "countValues";
3219
- countUniqueValues: "countUniqueValues";
3220
- countEmpty: "countEmpty";
3221
- percentEmpty: "percentEmpty";
3222
- percentNotEmpty: "percentNotEmpty";
3223
- original: "original";
3224
- }>;
3225
- decimals: z.ZodOptional<z.ZodNumber>;
3226
- targetAttributeType: z.ZodOptional<z.ZodString>;
3227
- targetAttributeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
3228
- id: z.ZodString;
3229
- label: z.ZodString;
3230
- value: z.ZodString;
3231
- color: z.ZodOptional<z.ZodString>;
3232
- icon: z.ZodOptional<z.ZodString>;
3233
- description: z.ZodOptional<z.ZodString>;
3234
- group: z.ZodOptional<z.ZodEnum<{
3235
- idle: "idle";
3236
- in_progress: "in_progress";
3237
- finished: "finished";
3238
- }>>;
3239
- }, z.core.$strip>>>;
3240
- }, z.core.$strip>;
3241
- /**
3242
- * Document attribute config schema
3243
- */
3244
- declare const documentConfigSchema: z.ZodObject<{
3245
- disabled: z.ZodOptional<z.ZodBoolean>;
3246
- placeholder: z.ZodOptional<z.ZodString>;
3247
- description: z.ZodOptional<z.ZodString>;
3248
- defaultValue: z.ZodOptional<z.ZodUnknown>;
3249
- icon: z.ZodOptional<z.ZodString>;
3250
- order: z.ZodOptional<z.ZodNumber>;
3251
- hidden: z.ZodOptional<z.ZodBoolean>;
3252
- archived: z.ZodOptional<z.ZodBoolean>;
3253
- deprecated: z.ZodOptional<z.ZodBoolean>;
3254
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3255
- multiple: z.ZodOptional<z.ZodBoolean>;
3256
- maxDocuments: z.ZodOptional<z.ZodNumber>;
3257
- autoProcess: z.ZodOptional<z.ZodBoolean>;
3258
- }, z.core.$strip>;
3259
- /**
3260
- * Map of attribute type to config schema
3261
- */
3262
- declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
3263
- /**
3264
- * Get the config schema for a specific attribute type
3265
- */
3266
- declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
3267
- /**
3268
- * Validate attribute config for a specific type
3269
- * Returns the validated config with only allowed properties
3270
- */
3271
- declare function validateAttributeConfig(type: AttributeType, config: Record<string, unknown>): {
3272
- success: true;
3273
- data: Record<string, unknown>;
3274
- } | {
3275
- success: false;
3276
- errors: string[];
3277
- };
3278
- /**
3279
- * Validate and strip unknown properties from attribute config
3280
- * This ensures only allowed properties are stored in the database
3281
- */
3282
- declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
3283
- /**
3284
- * Safely parse attribute config, returning undefined for invalid configs
3285
- */
3286
- declare function safeParseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown> | undefined;
3287
- /**
3288
- * Create a Zod schema for a text attribute
3289
- */
3290
- declare function createTextValidator(attr: TextAttribute, messages?: ValidationMessages): z.ZodString;
3291
- /**
3292
- * Create a Zod schema for a number attribute
3293
- */
3294
- declare function createNumberValidator(attr: NumberAttribute, messages?: ValidationMessages): z.ZodNumber;
3295
- /**
3296
- * Create a Zod schema for a checkbox attribute
3297
- */
3298
- declare function createCheckboxValidator(_attr: CheckboxAttribute, _messages?: ValidationMessages): z.ZodBoolean;
3299
- /**
3300
- * Create a Zod schema for a date attribute
3301
- */
3302
- declare function createDateValidator(attr: DateAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3303
- /**
3304
- * Create a Zod schema for a phone attribute.
3305
- *
3306
- * Validates:
3307
- * - countryCode is a valid ISO3 country code
3308
- * - phoneNumber contains valid digits for the given country
3309
- *
3310
- * Transforms:
3311
- * - Normalizes phoneNumber to national digits without trunk prefix
3312
- */
3313
- declare function createPhoneValidator(attr: PhoneAttribute, messages?: ValidationMessages): z.ZodType<{
3314
- countryCode: string;
3315
- phoneNumber: string;
3316
- }>;
3317
- /**
3318
- * Create a Zod schema for a currency attribute
3319
- */
3320
- declare function createCurrencyValidator(attr: CurrencyAttribute, messages?: ValidationMessages): z.ZodType<{
3321
- code: string;
3322
- value: number;
3323
- }>;
3324
- /**
3325
- * Create a Zod schema for a status attribute
3326
- */
3327
- declare function createStatusValidator(attr: StatusAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
3328
- /**
3329
- * Create a Zod schema for a select attribute
3330
- */
3331
- declare function createSelectValidator(attr: SelectAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
3332
- /**
3333
- * Create a Zod schema for a multiselect attribute
3334
- */
3335
- declare function createMultiselectValidator(attr: MultiselectAttribute, messages?: ValidationMessages): z.ZodArray<z.ZodEnum<Readonly<Record<string, string>>>>;
3336
- /**
3337
- * Create a Zod schema for a location attribute
3338
- */
3339
- type LocationShape = {
3340
- address?: string;
3341
- address2?: string;
3342
- city?: string;
3343
- state?: string;
3344
- postalCode?: string;
3345
- country?: string;
3346
- latitude?: number;
3347
- longitude?: number;
3348
- };
3349
- declare function createLocationValidator(attr: LocationAttribute, messages?: ValidationMessages): z.ZodType<LocationShape>;
3350
- /**
3351
- * Create a Zod schema for a file attribute
3352
- * Supports both single file (UUID) and multiple files (array of UUIDs)
3353
- */
3354
- declare function createFileValidator(attr: FileAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3355
- /**
3356
- * Create a Zod schema for a user attribute
3357
- * Supports both single user (UUID) and multiple users (array of UUIDs)
3358
- */
3359
- declare function createUserValidator(attr: UserAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3360
- /**
3361
- * Create a Zod schema for a single relation attribute (cardinality: "one")
3362
- * Supports hybrid format `{ id, props }` from qualified relations.
3363
- * IMPORTANT: Validates the ID but preserves the original format (keeps props).
3364
- */
3365
- declare function createSingleRelationValidator(attr: SingleRelationAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3366
- /**
3367
- * Create a Zod schema for a multi relation attribute (cardinality: "many")
3368
- * Supports hybrid format arrays with `{ id, props }` items from qualified relations.
3369
- * IMPORTANT: Validates the IDs but preserves the original format (keeps props).
3370
- */
3371
- declare function createMultiRelationValidator(attr: MultiRelationAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3372
- /**
3373
- * Create a Zod schema for a relation attribute
3374
- * Dispatches to single or multi validator based on cardinality
3375
- */
3376
- declare function createRelationValidator(attr: RelationAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3377
- /**
3378
- * Create a Zod schema for a rating attribute
3379
- */
3380
- declare function createRatingValidator(attr: RatingAttribute, messages?: ValidationMessages): z.ZodNumber;
3381
- /**
3382
- * Create a Zod schema for a formula attribute.
3383
- * Formula attributes are read-only (computed at runtime).
3384
- * They accept any value during validation but are ignored during record creation/update.
3385
- */
3386
- declare function createFormulaValidator(_attr: FormulaAttribute, _messages?: ValidationMessages): z.ZodUnknown;
3387
- /**
3388
- * Create a Zod schema for a rollup attribute.
3389
- * Rollup attributes are read-only (computed from related records).
3390
- * They accept any value during validation but are ignored during record creation/update.
3391
- */
3392
- declare function createRollupValidator(_attr: RollupAttribute, _messages?: ValidationMessages): z.ZodUnknown;
3393
- /**
3394
- * Create a Zod schema for a textarea attribute.
3395
- * Validates that the value is a string.
3396
- */
3397
- declare function createTextAreaValidator(_attr: TextAreaAttribute, _messages?: ValidationMessages): z.ZodString;
3398
- /**
3399
- * Create a Zod schema for a richtext attribute.
3400
- * Validates semantic markdown content as a string.
3401
- *
3402
- * @example Valid richtext content (semantic markdown)
3403
- * ```typescript
3404
- * `# Heading
3405
- *
3406
- * Some paragraph text.
3407
- *
3408
- * :::callout{variant="info"}
3409
- * This is a callout block
3410
- * :::
3411
- * `
3412
- * ```
3413
- */
3414
- declare function createRichtextValidator(attr: RichtextAttribute, messages?: ValidationMessages): z.ZodTypeAny;
3415
1977
  /**
3416
1978
  * Create a Zod schema for any attribute type.
3417
1979
  * Returns a strict validator that does NOT handle optional fields.
@@ -3432,6 +1994,7 @@ declare function createAttributeValidator(attr: Attribute, messages?: Validation
3432
1994
  * @param messages - Custom validation messages for i18n support
3433
1995
  */
3434
1996
  declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
1997
+
3435
1998
  /**
3436
1999
  * Create a Zod schema for an entire object
3437
2000
  *
@@ -3440,16 +2003,14 @@ declare function createFormAttributeValidator(attr: Attribute, messages?: Valida
3440
2003
  */
3441
2004
  declare function createObjectValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
3442
2005
  /**
3443
- * Validation result
2006
+ * Create a Zod schema for draft validation.
2007
+ * All attributes become optional, but provided values are still validated.
2008
+ *
2009
+ * Uses passthrough mode to allow computed fields (formula, rollup) that may be
2010
+ * present in record data but are not part of the mutable schema.
3444
2011
  */
3445
- interface ValidationResult {
3446
- success: boolean;
3447
- data?: Record<string, unknown>;
3448
- errors?: Array<{
3449
- path: string[];
3450
- message: string;
3451
- }>;
3452
- }
2012
+ declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
2013
+
3453
2014
  /**
3454
2015
  * Validate data against an attribute schema
3455
2016
  */
@@ -3462,29 +2023,10 @@ declare function validateObject(objectDef: ObjectDefinition, data: Record<string
3462
2023
  * Validate and throw if invalid
3463
2024
  */
3464
2025
  declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
3465
- /**
3466
- * Create a Zod schema for draft validation.
3467
- * All attributes become optional, but provided values are still validated.
3468
- *
3469
- * Uses passthrough mode to allow computed fields (formula, rollup) that may be
3470
- * present in record data but are not part of the mutable schema.
3471
- */
3472
- declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
3473
2026
  /**
3474
2027
  * Validate data in draft mode.
3475
2028
  * - All attributes are treated as optional (no required validation)
3476
2029
  * - Provided values are still validated for format/type correctness
3477
- *
3478
- * Use this when creating records that may be incomplete (drafts).
3479
- *
3480
- * @example
3481
- * ```typescript
3482
- * const result = validateDraft(PRODUCT, { name: "Draft" });
3483
- * // → success even if "price" is required but missing
3484
- *
3485
- * const result2 = validateDraft(PRODUCT, { price: -10 });
3486
- * // → fails because price must be >= 0 (format validation still applies)
3487
- * ```
3488
2030
  */
3489
2031
  declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
3490
2032
  /**
@@ -3493,42 +2035,15 @@ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string,
3493
2035
  declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
3494
2036
  /**
3495
2037
  * Get the list of required attributes that are missing values.
3496
- *
3497
- * @example
3498
- * ```typescript
3499
- * const missing = getMissingRequiredAttributes(PRODUCT, { name: "Test" });
3500
- * // → [priceAttribute, statusAttribute] if price and status are required but missing
3501
- * ```
3502
2038
  */
3503
2039
  declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
3504
2040
  /**
3505
2041
  * Check if a record is complete (all required attributes have valid values).
3506
- *
3507
- * @returns `true` if all required values are present and valid, `false` otherwise
3508
2042
  */
3509
2043
  declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
3510
2044
  /**
3511
2045
  * Compute the completion status of a record based on its data.
3512
- *
3513
- * - `"complete"`: All required values are present and valid
3514
- * - `"draft"`: One or more required values are missing or invalid
3515
- *
3516
- * This function is used to dynamically determine the status when
3517
- * creating or updating records.
3518
- *
3519
- * @example
3520
- * ```typescript
3521
- * const status = computeRecordStatus(PRODUCT, {
3522
- * name: "Nike Air Max",
3523
- * price: 129.99,
3524
- * status: "active"
3525
- * });
3526
- * // → "complete"
3527
- *
3528
- * const status2 = computeRecordStatus(PRODUCT, { name: "Draft Product" });
3529
- * // → "draft" (missing required fields)
3530
- * ```
3531
2046
  */
3532
2047
  declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
3533
2048
 
3534
- export { type RelationAttribute as $, type Attribute as A, type FeatureGate as B, type ConfigOverrides as C, type DateAttribute as D, type TextAttribute as E, type FilterState as F, type TextAreaAttribute as G, type RichtextAttribute as H, type InstanceStatus as I, type RichtextFeature as J, type CheckboxAttribute as K, type LocationGranularity as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectRecord as O, type PendingAction as P, type PhoneAttribute as Q, type RelationFieldConfig as R, type SortRule as S, type Timestamps as T, type UserAttribute as U, type ViewType as V, type WorkflowNode as W, type CurrencyAttribute as X, type Option as Y, type LocationAttribute as Z, type FileAttribute as _, type FormNode as a, FORBIDDEN_PROPERTY_TYPES as a$, type RatingAttribute as a0, type BilateralConfig as a1, type SingleRelationAttribute as a2, type MultiRelationAttribute as a3, type RelationTarget as a4, type FormulaReturnType as a5, type RollupFunction as a6, type MigrationDefinition as a7, type ObjectDefinition as a8, type DetailViewLayout as a9, type AdvancedFilterState as aA, type AssignNode as aB, type AssignmentMapping as aC, type AssignmentSource as aD, type AttributeGroup as aE, type BaseAttribute as aF, type BufferedRecord as aG, type BuiltInTransform as aH, type CalendarViewConfig as aI, type CalendarViewDefinition as aJ, type CanvasViewport as aK, type CheckboxFilterOperator as aL, type ConditionNode as aM, type ConditionOperator as aN, type CurrencyFilterValue as aO, type CustomTab as aP, DEFAULT_RETENTION_POLICY as aQ, DEFAULT_THEME as aR, DEFAULT_VALIDATION_MESSAGES as aS, type DateFilterOperator as aT, type DateFormat as aU, type DateValue as aV, type DetailViewConfig as aW, type DisplayRecord as aX, type DocumentsTab as aY, type EndNode as aZ, type ExtendedFilterRule as a_, type SidePanelConfig as aa, type Field as ab, type AttributeGroupField as ac, type FieldGroup as ad, type RelationGroup as ae, type Group as af, type TableTab as ag, type CreateMode as ah, type DetailViewDefinition as ai, type Tab as aj, type ListViewDefinition as ak, type SlotMode as al, type FlowFieldsRow as am, type ConditionGroup as an, type ConditionRule as ao, type FlagValueType as ap, type FeatureFlagDefinition as aq, type FlagLevel as ar, type FeatureFlagsRepository as as, type StaticFlagDefault as at, type ResolvedFlag as au, type ViewDefinition as av, type ListViewConfig as aw, type ListViewTab as ax, type AINode as ay, type ActivityTab as az, type WorkflowNodeType as b, type TextFilterOperator as b$, type FeatureFlagsConfig as b0, type FilterCombinator as b1, type FilterGroup as b2, type FilterOperator as b3, type FilterRule as b4, type FilterValue as b5, type FlagOverride as b6, type FlowDefinition as b7, type FlowPage as b8, type FlowRelation as b9, type OptionPropertyAttribute as bA, type PhoneFilterValue as bB, type PropertyAttribute as bC, type PropertySchema as bD, type PropertyType as bE, type QueryState as bF, RELATION_TARGET_ANY as bG, RESERVED_ATTRIBUTE_NAMES as bH, type RecordPatch as bI, type RelationBuffer as bJ, type RelationFilterOperator as bK, type RelationQualifierPatch as bL, type RelationSource as bM, type RelativeDateValue as bN, type ReservedAttributeName as bO, type RetentionPolicy as bP, type RichtextTab as bQ, SYSTEM_FIELD_NAMES as bR, type SchemaOperation as bS, type SchemaTransform as bT, type SelectFilterOperator as bU, type SortDirection as bV, type StartNode as bW, type StatusGroup as bX, type SystemFieldName as bY, type TabType as bZ, type TableSource as b_, type FlowRow as ba, type FlowRowField as bb, type FlowRowType as bc, type FlowSlot as bd, type FlowStatus as be, type FlowsTab as bf, type ForbiddenPropertyType as bg, type FormDensity as bh, type FormFieldRef as bi, type FormTab as bj, type GalleryViewConfig as bk, type GalleryViewDefinition as bl, type GeneratedDocument as bm, type InverseSource as bn, type ListViewLayout as bo, type MigrationError as bp, type MigrationPreview as bq, type MultiselectFilterOperator as br, NON_SORTABLE_TYPES as bs, NO_VALUE_OPERATORS as bt, type NoValueOperator as bu, type NodePosition as bv, type NumberFilterOperator as bw, type NumberUnit as bx, OPERATORS_BY_TYPE as by, type ObjectAttribute as bz, type FlowHeadingRow as c, isAttributeSortable as c$, type ThemeColors as c0, type ThemeLogo as c1, type ThemeTypography as c2, type TimelineViewConfig as c3, type TimelineViewDefinition as c4, type TransformSource as c5, type ValidationMessages as c6, type ValidationResult as c7, type ViewOperation as c8, type ViewOverlay as c9, createRollupValidator as cA, createSelectValidator as cB, createSingleRelationValidator as cC, createStartTransition as cD, createStatusValidator as cE, createTextAreaValidator as cF, createTextValidator as cG, createUserValidator as cH, currencyConfigSchema as cI, dateConfigSchema as cJ, documentConfigSchema as cK, eq as cL, fileConfigSchema as cM, formatZodErrors as cN, formulaConfigSchema as cO, generateCssVariables as cP, getAttributeConfigSchema as cQ, getContextValue as cR, getMissingRequiredAttributes as cS, getRollupFilterOperators as cT, hasOptions as cU, inValues as cV, inferInverseCardinality as cW, isAINode as cX, isActivityTab as cY, isAdvancedFormNode as cZ, isAssignNode as c_, type ViewTransform as ca, type WorkflowError as cb, type WorkflowInstance as cc, and as cd, attributeConfigSchemas as ce, canResumeInstance as cf, checkboxConfigSchema as cg, computeRecordStatus as ch, createAttributeValidator as ci, createCheckboxValidator as cj, createCurrencyValidator as ck, createDateValidator as cl, createDraftValidator as cm, createEmptyContext as cn, createFileValidator as co, createFormAttributeValidator as cp, createFormulaValidator as cq, createLocationValidator as cr, createMultiRelationValidator as cs, createMultiselectValidator as ct, createNumberValidator as cu, createObjectValidator as cv, createPhoneValidator as cw, createRatingValidator as cx, createRelationValidator as cy, createRichtextValidator as cz, type FlowSeparatorRow as d, isBilateralRelation as d0, isCalendarView as d1, isConditionGroup as d2, isConditionNode as d3, isConditionRule as d4, isCustomTab as d5, isDetailView as d6, isDocumentsTab as d7, isEndNode as d8, isFieldGroup as d9, isWorkflowDefinition as dA, isWorkflowPublished as dB, locationConfigSchema as dC, mergeWithDefaults as dD, multiselectConfigSchema as dE, neq as dF, numberConfigSchema as dG, or as dH, parseAttributeConfig as dI, phoneConfigSchema as dJ, ratingConfigSchema as dK, relationConfigSchema as dL, richtextConfigSchema as dM, rollupConfigSchema as dN, safeParseAttributeConfig as dO, selectConfigSchema as dP, setContextValue as dQ, statusConfigSchema as dR, textConfigSchema as dS, textareaConfigSchema as dT, userConfigSchema as dU, validateAttribute as dV, validateAttributeConfig as dW, validateDraft as dX, validateDraftOrThrow as dY, validateObject as dZ, validateObjectOrThrow as d_, isFlowDefinition as da, isFlowFieldsRow as db, isFlowPublished as dc, isFlowRelationListRow as dd, isFlowsTab as de, isFormNode as df, isFormTab as dg, isGalleryView as dh, isInstanceTerminal as di, isInstanceWaiting as dj, isInverseSourceTab as dk, isLayoutRow as dl, isListView as dm, isNoValueOperator as dn, isRecordComplete as dp, isRelationGroup as dq, isRelationSourceTab as dr, isRichtextTab as ds, isSimpleFormNode as dt, isStartNode as du, isSystemFlow as dv, isSystemWorkflow as dw, isTableTab as dx, isTimelineView as dy, isUniversalRelation as dz, type FlowTextRow as e, type FlowRelationListRow as f, type WorkflowSlot as g, type WorkflowTheme as h, type RelationBufferMap as i, type AttributeType as j, type ViewConfig as k, type WorkflowStatus as l, type WorkflowLayout as m, type WorkflowConfig as n, type WorkflowDefinition as o, type WorkflowExecutionContext as p, type WorkflowTransition as q, type Location as r, type FormulaAttribute as s, type RollupAttribute as t, type CompletionStatus as u, type StatusAttribute as v, type SelectAttribute as w, type Phone as x, type Currency as y, type DocumentAttribute as z };
2049
+ export { type ListViewConfig as $, type WorkflowExecutionContext as A, type WorkflowTransition as B, type ConfigOverrides as C, type CompletionStatus as D, type ObjectDefinition as E, type FilterState as F, type DetailViewConfig as G, type DetailViewDefinition as H, type InstanceStatus as I, type DetailViewLayout as J, type SidePanelConfig as K, type Field as L, type MigrationDefinition as M, type AttributeGroupField as N, type ObjectRecord as O, type PendingAction as P, type FieldGroup as Q, type RelationFieldConfig as R, type SortRule as S, type Timestamps as T, type RelationGroup as U, type ViewType as V, type WorkflowNode as W, type Group as X, type TableTab as Y, type CreateMode as Z, type Tab as _, createAttributeValidator as a, type RelationQualifierPatch as a$, type ListViewDefinition as a0, type SlotMode as a1, type FlowFieldsRow as a2, type ConditionGroup as a3, type ConditionRule as a4, type ViewDefinition as a5, type ListViewTab as a6, type ActivityTab as a7, type AdvancedFilterState as a8, type BufferedRecord as a9, type FlowRowType as aA, type FlowSlot as aB, type FlowStatus as aC, type FlowsTab as aD, type FormDensity as aE, type FormFieldRef as aF, type FormTab as aG, type GalleryViewConfig as aH, type GalleryViewDefinition as aI, type GeneratedDocument as aJ, type InverseSource as aK, type ListViewLayout as aL, type MigrationError as aM, type MigrationPreview as aN, type MultiselectFilterOperator as aO, NO_VALUE_OPERATORS as aP, type NoValueOperator as aQ, type NodePosition as aR, type NumberFilterOperator as aS, OPERATORS_BY_TYPE as aT, type ObjectAttribute as aU, type PhoneFilterValue as aV, type QueryState as aW, RESERVED_ATTRIBUTE_NAMES as aX, type RecordPatch as aY, type RelationBuffer as aZ, type RelationFilterOperator as a_, type BuiltInTransform as aa, type CalendarViewConfig as ab, type CalendarViewDefinition as ac, type CanvasViewport as ad, type CheckboxFilterOperator as ae, type ConditionNode as af, type ConditionOperator as ag, type CurrencyFilterValue as ah, type CustomTab as ai, DEFAULT_RETENTION_POLICY as aj, DEFAULT_THEME as ak, type DateFilterOperator as al, type DisplayRecord as am, type DocumentsTab as an, type EndNode as ao, type ExtendedFilterRule as ap, type FilterCombinator as aq, type FilterGroup as ar, type FilterOperator as as, type FilterRule as at, type FilterValue as au, type FlowDefinition as av, type FlowPage as aw, type FlowRelation as ax, type FlowRow as ay, type FlowRowField as az, createDraftValidator as b, isSimpleFormNode as b$, type RelationSource as b0, type RelativeDateValue as b1, type ReservedAttributeName as b2, type RetentionPolicy as b3, type RichtextTab as b4, SYSTEM_FIELD_NAMES as b5, type SchemaOperation as b6, type SchemaTransform as b7, type SelectFilterOperator as b8, type SortDirection as b9, isAdvancedFormNode as bA, isCalendarView as bB, isConditionGroup as bC, isConditionNode as bD, isConditionRule as bE, isCustomTab as bF, isDetailView as bG, isDocumentsTab as bH, isEndNode as bI, isFieldGroup as bJ, isFlowDefinition as bK, isFlowFieldsRow as bL, isFlowPublished as bM, isFlowRelationListRow as bN, isFlowsTab as bO, isFormNode as bP, isFormTab as bQ, isGalleryView as bR, isInstanceTerminal as bS, isInstanceWaiting as bT, isInverseSourceTab as bU, isLayoutRow as bV, isListView as bW, isNoValueOperator as bX, isRelationGroup as bY, isRelationSourceTab as bZ, isRichtextTab as b_, type StartNode as ba, type SystemFieldName as bb, type TabType as bc, type TableSource as bd, type TextFilterOperator as be, type ThemeColors as bf, type ThemeLogo as bg, type ThemeTypography as bh, type TimelineViewConfig as bi, type TimelineViewDefinition as bj, type TransformSource as bk, type ViewOperation as bl, type ViewOverlay as bm, type ViewTransform as bn, type WorkflowError as bo, type WorkflowInstance as bp, and as bq, canResumeInstance as br, createEmptyContext as bs, createStartTransition as bt, eq as bu, generateCssVariables as bv, getContextValue as bw, getRollupFilterOperators as bx, inValues as by, isActivityTab as bz, computeRecordStatus as c, isStartNode as c0, isSystemFlow as c1, isSystemWorkflow as c2, isTableTab as c3, isTimelineView as c4, isWorkflowDefinition as c5, isWorkflowPublished as c6, mergeWithDefaults as c7, neq as c8, or as c9, setContextValue as ca, createFormAttributeValidator as d, createObjectValidator as e, validateDraft as f, getMissingRequiredAttributes as g, validateDraftOrThrow as h, isRecordComplete as i, validateObject as j, validateObjectOrThrow as k, type FormNode as l, type WorkflowNodeType as m, type FlowHeadingRow as n, type FlowSeparatorRow as o, type FlowTextRow as p, type FlowRelationListRow as q, type WorkflowSlot as r, type WorkflowTheme as s, type RelationBufferMap as t, type ViewConfig as u, validateAttribute as v, type WorkflowStatus as w, type WorkflowLayout as x, type WorkflowConfig as y, type WorkflowDefinition as z };