@stndrds/schema 0.1.0-alpha.57 → 0.1.0-alpha.59

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.
@@ -0,0 +1,1631 @@
1
+ import { z } from 'zod';
2
+ import { CurrencyCode, IconName, ColorId, CountryIso3, MimeType } from '@stndrds/constants';
3
+ import { Uuid } from './utils.mjs';
4
+
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
+ }): Promise<FlagOverride[]>;
113
+ /**
114
+ * Create or update an override.
115
+ * Uses upsert semantics based on (flagName, level, targetId).
116
+ */
117
+ setOverride(override: Omit<FlagOverride, "createdAt" | "updatedAt">): Promise<FlagOverride>;
118
+ /**
119
+ * Delete an override.
120
+ */
121
+ deleteOverride(flagName: string, level: FlagLevel, targetId?: string): Promise<void>;
122
+ }
123
+ /**
124
+ * Static flag default value for module configuration.
125
+ */
126
+ interface StaticFlagDefault {
127
+ /** Flag name */
128
+ name: string;
129
+ /** Default value */
130
+ value: unknown;
131
+ }
132
+ /**
133
+ * Feature flags configuration for SchemaModule.
134
+ */
135
+ interface FeatureFlagsConfig {
136
+ /**
137
+ * Static default values for flags.
138
+ * These are always applied and used when no database override exists.
139
+ *
140
+ * @example
141
+ * ```typescript
142
+ * featureFlags: {
143
+ * defaults: [
144
+ * { name: "architect-mode", value: false },
145
+ * { name: "ai-chat", value: false },
146
+ * { name: "tier", value: "free" },
147
+ * ],
148
+ * }
149
+ * ```
150
+ */
151
+ defaults?: StaticFlagDefault[];
152
+ }
153
+
154
+ /**
155
+ * Allowed property types in .qualifyWith()
156
+ *
157
+ * IMPORTANT: Complex types (formula, rollup, relation, file, user, document)
158
+ * are NOT supported to avoid duplicating backend behavior.
159
+ */
160
+ type PropertyType = "text" | "textarea" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "select" | "multiselect" | "rating" | "location";
161
+ /**
162
+ * Forbidden property types that would require complex backend duplication
163
+ */
164
+ declare const FORBIDDEN_PROPERTY_TYPES: readonly ["formula", "rollup", "relation", "file", "user", "document", "richtext"];
165
+ type ForbiddenPropertyType = (typeof FORBIDDEN_PROPERTY_TYPES)[number];
166
+ /**
167
+ * Base interface for all property definitions
168
+ */
169
+ interface BasePropertyDefinition {
170
+ name: string;
171
+ label?: string;
172
+ required?: boolean;
173
+ description?: string;
174
+ }
175
+ /**
176
+ * Text property definition
177
+ */
178
+ interface TextPropertyDefinition extends BasePropertyDefinition {
179
+ type: "text";
180
+ minLength?: number;
181
+ maxLength?: number;
182
+ pattern?: string;
183
+ placeholder?: string;
184
+ }
185
+ /**
186
+ * Textarea property definition
187
+ */
188
+ interface TextareaPropertyDefinition extends BasePropertyDefinition {
189
+ type: "textarea";
190
+ minLength?: number;
191
+ maxLength?: number;
192
+ placeholder?: string;
193
+ }
194
+ /**
195
+ * Number property definition
196
+ */
197
+ interface NumberPropertyDefinition extends BasePropertyDefinition {
198
+ type: "number";
199
+ min?: number;
200
+ max?: number;
201
+ decimal?: number;
202
+ integer?: boolean;
203
+ placeholder?: string;
204
+ }
205
+ /**
206
+ * Checkbox property definition
207
+ */
208
+ interface CheckboxPropertyDefinition extends BasePropertyDefinition {
209
+ type: "checkbox";
210
+ }
211
+ /**
212
+ * Date property definition
213
+ */
214
+ interface DatePropertyDefinition extends BasePropertyDefinition {
215
+ type: "date";
216
+ includeTime?: boolean;
217
+ min?: string;
218
+ max?: string;
219
+ }
220
+ /**
221
+ * Phone property definition
222
+ */
223
+ interface PhonePropertyDefinition extends BasePropertyDefinition {
224
+ type: "phone";
225
+ }
226
+ /**
227
+ * Currency property definition
228
+ */
229
+ interface CurrencyPropertyDefinition extends BasePropertyDefinition {
230
+ type: "currency";
231
+ currency?: CurrencyCode;
232
+ min?: number;
233
+ max?: number;
234
+ }
235
+ /**
236
+ * Status property definition
237
+ */
238
+ interface StatusPropertyDefinition extends BasePropertyDefinition {
239
+ type: "status";
240
+ options: Array<Option & {
241
+ group: StatusGroup;
242
+ }>;
243
+ }
244
+ /**
245
+ * Select property definition
246
+ */
247
+ interface SelectPropertyDefinition extends BasePropertyDefinition {
248
+ type: "select";
249
+ options: Option[];
250
+ }
251
+ /**
252
+ * Multiselect property definition
253
+ */
254
+ interface MultiselectPropertyDefinition extends BasePropertyDefinition {
255
+ type: "multiselect";
256
+ options: Option[];
257
+ maxSelections?: number;
258
+ }
259
+ /**
260
+ * Rating property definition
261
+ */
262
+ interface RatingPropertyDefinition extends BasePropertyDefinition {
263
+ type: "rating";
264
+ max?: number;
265
+ icon?: IconName;
266
+ }
267
+ /**
268
+ * Location property definition
269
+ */
270
+ interface LocationPropertyDefinition extends BasePropertyDefinition {
271
+ type: "location";
272
+ }
273
+ /**
274
+ * Union of all property definitions
275
+ */
276
+ type PropertyDefinition = TextPropertyDefinition | TextareaPropertyDefinition | NumberPropertyDefinition | CheckboxPropertyDefinition | DatePropertyDefinition | PhonePropertyDefinition | CurrencyPropertyDefinition | StatusPropertyDefinition | SelectPropertyDefinition | MultiselectPropertyDefinition | RatingPropertyDefinition | LocationPropertyDefinition;
277
+ /**
278
+ * Schema defining properties for a qualified relation
279
+ *
280
+ * @example
281
+ * ```typescript
282
+ * const schema: PropertySchema = {
283
+ * definitions: [
284
+ * { name: "role", type: "select", options: [...], required: true },
285
+ * { name: "shares", type: "number", min: 0 },
286
+ * { name: "percentage", type: "number", min: 0, max: 100, decimal: 2 }
287
+ * ]
288
+ * };
289
+ * ```
290
+ */
291
+ interface PropertySchema {
292
+ definitions: PropertyDefinition[];
293
+ }
294
+
295
+ type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
296
+ /**
297
+ * Status group categorization
298
+ */
299
+ type StatusGroup = "idle" | "in_progress" | "finished";
300
+ /**
301
+ * Unified option type for select-like fields
302
+ */
303
+ interface Option {
304
+ id: string;
305
+ label: string;
306
+ value: string;
307
+ color?: ColorId;
308
+ icon?: IconName;
309
+ description?: string;
310
+ group?: StatusGroup;
311
+ }
312
+ /**
313
+ * Attribute grouping for UI organization
314
+ */
315
+ interface AttributeGroup {
316
+ id: string;
317
+ label: string;
318
+ description?: string;
319
+ attributeIds: string[];
320
+ collapsible?: boolean;
321
+ collapsed?: boolean;
322
+ order?: number;
323
+ }
324
+ interface BaseAttribute<DefaultValueType = unknown> {
325
+ id: Uuid;
326
+ name: string;
327
+ label: string;
328
+ type: AttributeType;
329
+ required: boolean;
330
+ disabled?: boolean;
331
+ placeholder?: string;
332
+ description?: string;
333
+ defaultValue?: DefaultValueType;
334
+ icon?: IconName;
335
+ order?: number;
336
+ hidden?: boolean;
337
+ archived?: boolean;
338
+ deprecated?: boolean;
339
+ system?: boolean;
340
+ /**
341
+ * Feature gate to conditionally show/hide/disable this attribute.
342
+ * When the flag condition is not met, the attribute behavior depends on `fallback`:
343
+ * - "hide" (default): Attribute is completely hidden
344
+ * - "disable": Attribute is visible but read-only
345
+ * - "show": No gating (useful for overriding parent settings)
346
+ */
347
+ featureGate?: FeatureGate;
348
+ metadata?: Record<string, unknown>;
349
+ }
350
+ interface TextAttribute extends BaseAttribute<string> {
351
+ type: "text";
352
+ minLength?: number;
353
+ maxLength?: number;
354
+ pattern?: string;
355
+ }
356
+ type NumberUnit = "integer" | "decimal" | "percentage";
357
+ interface NumberAttribute extends BaseAttribute<number> {
358
+ type: "number";
359
+ min?: number;
360
+ max?: number;
361
+ unit?: NumberUnit;
362
+ decimals?: number;
363
+ }
364
+ interface CheckboxAttribute extends BaseAttribute<boolean> {
365
+ type: "checkbox";
366
+ }
367
+ type DateFormat = "short" | "long" | "full" | "relative";
368
+ type DateValue = string | "today";
369
+ interface DateAttribute extends BaseAttribute<string> {
370
+ type: "date";
371
+ dateFormat?: DateFormat;
372
+ minDate?: DateValue;
373
+ maxDate?: DateValue;
374
+ }
375
+ interface Phone {
376
+ countryCode: CountryIso3;
377
+ phoneNumber: string;
378
+ }
379
+ interface PhoneAttribute extends BaseAttribute<Phone> {
380
+ type: "phone";
381
+ defaultCountryCode?: CountryIso3;
382
+ }
383
+ interface Currency {
384
+ code: CurrencyCode;
385
+ value: number;
386
+ }
387
+ interface CurrencyAttribute extends BaseAttribute<Currency> {
388
+ type: "currency";
389
+ defaultCurrency?: CurrencyCode;
390
+ allowedCurrencies?: CurrencyCode[];
391
+ }
392
+ /**
393
+ * StatusAttribute - For workflow states with semantic grouping (idle/in_progress/finished)
394
+ * Use this for: Task status, Order status, Project phases, Process states
395
+ * Use SelectAttribute for: Categories, Types, simple choices without workflow
396
+ */
397
+ interface StatusAttribute extends BaseAttribute<string> {
398
+ type: "status";
399
+ options: Option[];
400
+ }
401
+ interface Location {
402
+ address?: string;
403
+ address2?: string;
404
+ city?: string;
405
+ state?: string;
406
+ postalCode?: string;
407
+ country?: CountryIso3;
408
+ latitude?: number;
409
+ longitude?: number;
410
+ }
411
+ type LocationGranularity = "full" | "address" | "city" | "state" | "country" | "coordinates";
412
+ interface LocationAttribute extends BaseAttribute<Location> {
413
+ type: "location";
414
+ granularity: LocationGranularity;
415
+ enableAutocomplete?: boolean;
416
+ enableMap?: boolean;
417
+ defaultCountry?: CountryIso3;
418
+ allowedCountries?: CountryIso3[];
419
+ displayFormat?: "single_line" | "multi_line" | "compact";
420
+ }
421
+ /**
422
+ * SelectAttribute - For simple single-choice selection
423
+ * Use this for: Categories, Document types, Departments, Priorities
424
+ * Options can be grouped (e.g., countries by continent) but no workflow logic
425
+ */
426
+ interface SelectAttribute extends BaseAttribute<string> {
427
+ type: "select";
428
+ options: Option[];
429
+ }
430
+ interface MultiselectAttribute extends BaseAttribute<string[]> {
431
+ type: "multiselect";
432
+ options: Option[];
433
+ }
434
+ interface FileAttribute extends BaseAttribute<string> {
435
+ type: "file";
436
+ maxFiles?: number;
437
+ maxSize?: number;
438
+ allowedTypes?: MimeType[] | readonly MimeType[];
439
+ multiple?: boolean;
440
+ }
441
+ interface UserAttribute extends BaseAttribute<string> {
442
+ type: "user";
443
+ allowedRoles?: string[];
444
+ multiple?: boolean;
445
+ }
446
+ /**
447
+ * Wildcard marker for universal relations (can link to any object)
448
+ * Use with `.toAny()` builder method
449
+ */
450
+ declare const RELATION_TARGET_ANY: "*";
451
+ /**
452
+ * Target object for a relation - defines which objects can be linked
453
+ */
454
+ interface RelationTarget {
455
+ /** Object name (e.g., "companies", "contacts") or "*" for any object */
456
+ object: string;
457
+ /**
458
+ * Display template for the label using mustache-like syntax
459
+ * @example "{name}" or "{firstName} {lastName} — {email}"
460
+ */
461
+ displayTemplate?: string;
462
+ /**
463
+ * Optional filter to restrict available records
464
+ * @example { status: "active" }
465
+ */
466
+ filter?: Record<string, unknown>;
467
+ }
468
+ /**
469
+ * Base properties shared by both single and multi relation attributes
470
+ *
471
+ * Note: Deletion behavior is always "restrict" - if a record is referenced
472
+ * by other records, it cannot be deleted until those references are removed.
473
+ * This is enforced by RecordService.deleteRecord() which throws
474
+ * RecordReferencedError when attempting to delete a referenced record.
475
+ */
476
+ interface RelationAttributeBase extends Omit<BaseAttribute<unknown>, "defaultValue"> {
477
+ type: "relation";
478
+ /** Target objects that can be linked */
479
+ targets: RelationTarget[];
480
+ /** Optional properties schema for qualified relations */
481
+ properties?: PropertySchema;
482
+ }
483
+ /**
484
+ * Single relation attribute (one-to-one or many-to-one)
485
+ * Stores a single record ID or null
486
+ */
487
+ interface SingleRelationAttribute extends RelationAttributeBase {
488
+ cardinality: "one";
489
+ defaultValue?: string | null;
490
+ }
491
+ /**
492
+ * Multi relation attribute (one-to-many or many-to-many)
493
+ * Stores an array of record IDs
494
+ */
495
+ interface MultiRelationAttribute extends RelationAttributeBase {
496
+ cardinality: "many";
497
+ defaultValue?: string[];
498
+ /** Minimum number of relations required */
499
+ minItems?: number;
500
+ /** Maximum number of relations allowed */
501
+ maxItems?: number;
502
+ }
503
+ /**
504
+ * RelationAttribute links to other objects/records
505
+ * Discriminated union by cardinality for type-safe value handling
506
+ *
507
+ * @example Single relation (many-to-one)
508
+ * ```typescript
509
+ * relation({ name: "company", label: "Company" })
510
+ * .to("companies")
511
+ * .required()
512
+ * // → Value: "rec-uuid-123" | null
513
+ * ```
514
+ *
515
+ * @example Multi relation (many-to-many)
516
+ * ```typescript
517
+ * relation({ name: "contacts", label: "Contacts" })
518
+ * .to("contacts", { displayTemplate: "{firstName} {lastName}" })
519
+ * .many()
520
+ * .maxItems(5)
521
+ * // → Value: ["rec-1", "rec-2", ...]
522
+ * ```
523
+ *
524
+ * @example Polymorphic relation (multiple target objects)
525
+ * ```typescript
526
+ * relation({ name: "linked", label: "Linked Items" })
527
+ * .to("companies")
528
+ * .to("contacts")
529
+ * .to("deals")
530
+ * .many()
531
+ * // → Can link to records from any of these objects
532
+ * ```
533
+ */
534
+ type RelationAttribute = SingleRelationAttribute | MultiRelationAttribute;
535
+ /**
536
+ * Check if a relation attribute is universal (can link to any object)
537
+ * Universal relations have `targets: [{ object: "*" }]`
538
+ */
539
+ declare function isUniversalRelation(attr: RelationAttribute): boolean;
540
+ interface TextAreaAttribute extends BaseAttribute<string> {
541
+ type: "textarea";
542
+ }
543
+ /**
544
+ * Available features for richtext editor
545
+ */
546
+ type RichtextFeature = "headings" | "bold" | "italic" | "lists" | "links" | "images" | "codeBlocks" | "tables";
547
+ /**
548
+ * RichtextAttribute - Rich text content using semantic markdown
549
+ *
550
+ * Stores content as semantic markdown string (with directives like :::callout).
551
+ * Parsed at runtime to Tiptap JSON for editing.
552
+ * Use this for: Notes, articles, descriptions, long-form content.
553
+ *
554
+ * @example
555
+ * ```typescript
556
+ * richtext({ name: "content", label: "Content" })
557
+ * .features(["headings", "bold", "italic", "lists", "links"])
558
+ * .required()
559
+ * ```
560
+ */
561
+ interface RichtextAttribute extends BaseAttribute<string> {
562
+ type: "richtext";
563
+ /** Enabled features. If undefined, all features are enabled. */
564
+ features?: RichtextFeature[];
565
+ }
566
+ interface RatingAttribute extends BaseAttribute<number> {
567
+ type: "rating";
568
+ max?: number;
569
+ iconType?: "star" | "heart" | "thumbs" | "number";
570
+ }
571
+ /**
572
+ * Return type for formula expressions
573
+ */
574
+ type FormulaReturnType = "text" | "number" | "boolean" | "date";
575
+ /**
576
+ * FormulaAttribute - Computed value based on other attributes
577
+ *
578
+ * Formulas are calculated at read-time and are always read-only.
579
+ * Users cannot directly edit formula values.
580
+ *
581
+ * @example Simple calculation
582
+ * ```typescript
583
+ * formula({ name: "total", label: "Total" })
584
+ * .expression("price * quantity")
585
+ * .returns("number")
586
+ * .decimals(2)
587
+ * ```
588
+ *
589
+ * @example With functions
590
+ * ```typescript
591
+ * formula({ name: "fullName", label: "Full Name" })
592
+ * .expression("CONCAT(firstName, ' ', lastName)")
593
+ * .returns("text")
594
+ * ```
595
+ */
596
+ interface FormulaAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
597
+ type: "formula";
598
+ /** Expression to evaluate (e.g., "price * quantity") */
599
+ expression: string;
600
+ /** Expected return type for formatting */
601
+ returnType: FormulaReturnType;
602
+ /** Decimal places for number results */
603
+ decimals?: number;
604
+ /** Whether to allow relation references in the expression (e.g., "company.name") */
605
+ allowRelations?: boolean;
606
+ /** Formula is always not required (read-only) */
607
+ required: false;
608
+ }
609
+ /**
610
+ * Aggregation functions for rollup attributes
611
+ *
612
+ * Categories:
613
+ * - Numeric (sum, avg): Only for number, currency, rating types
614
+ * - Date (earliest, latest): Only for date type
615
+ * - Count (count, countValues, countUniqueValues, countEmpty): Universal
616
+ * - Percent (percentEmpty, percentNotEmpty): Universal
617
+ * - Lookup (original): Returns all values as array, rendered as target type
618
+ */
619
+ type RollupFunction = "sum" | "avg" | "earliest" | "latest" | "count" | "countValues" | "countUniqueValues" | "countEmpty" | "percentEmpty" | "percentNotEmpty" | "original";
620
+ /**
621
+ * RollupAttribute - Aggregates values from related records
622
+ *
623
+ * Rollups are calculated and stored (denormalized) for performance.
624
+ * They are automatically recalculated when related records change.
625
+ * Users cannot directly edit rollup values.
626
+ *
627
+ * @example Sum of related amounts
628
+ * ```typescript
629
+ * rollup({ name: "totalOrders", label: "Total Orders" })
630
+ * .from("orders") // relation attribute name
631
+ * .aggregate("amount") // target attribute to sum
632
+ * .using("sum")
633
+ * .decimals(2)
634
+ * ```
635
+ *
636
+ * @example Count of related records
637
+ * ```typescript
638
+ * rollup({ name: "orderCount", label: "Number of Orders" })
639
+ * .from("orders")
640
+ * .using("count")
641
+ * ```
642
+ */
643
+ interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
644
+ type: "rollup";
645
+ /** Name of the relation attribute on this object */
646
+ relationAttribute: string;
647
+ /**
648
+ * Dot notation path for multi-level traversal (Phase 4+)
649
+ * @example "orders.items" - traverse through orders to items
650
+ */
651
+ relationPath?: string;
652
+ /** Attribute name on the target object to aggregate */
653
+ targetAttribute: string;
654
+ /** Aggregation function to apply */
655
+ function: RollupFunction;
656
+ /** Decimal places for numeric results */
657
+ decimals?: number;
658
+ /** Rollup is always not required (read-only) */
659
+ required: false;
660
+ /**
661
+ * Cached type of the target attribute for display purposes
662
+ * Used when function="original" to render values as the target type
663
+ */
664
+ targetAttributeType?: AttributeType;
665
+ /**
666
+ * Cached options from target attribute (for select/status/multiselect display)
667
+ * Required when function="original" and target is a select-like type
668
+ */
669
+ targetAttributeOptions?: Option[];
670
+ }
671
+ /**
672
+ * DocumentAttribute - References one or multiple documents with templates.
673
+ *
674
+ * Unlike FileAttribute which stores raw file references, DocumentAttribute
675
+ * provides structured document handling with templates, multi-file support,
676
+ * and automatic processing (OCR, signature, identity verification).
677
+ *
678
+ * @example Single document with template choice
679
+ * ```typescript
680
+ * document({ name: "identityDocument", label: "Pièce d'identité" })
681
+ * .templates(["french_id_card", "passport"])
682
+ * .autoProcess()
683
+ * .required()
684
+ * ```
685
+ *
686
+ * @example Multiple documents with fixed template
687
+ * ```typescript
688
+ * document({ name: "contracts", label: "Contrats" })
689
+ * .template("signable_contract")
690
+ * .multiple()
691
+ * .maxDocuments(10)
692
+ * ```
693
+ */
694
+ interface DocumentAttribute extends BaseAttribute<string | string[]> {
695
+ type: "document";
696
+ /**
697
+ * Single template ID (strict mode).
698
+ * If set, only documents using this template can be attached.
699
+ */
700
+ templateId?: string;
701
+ /**
702
+ * Multiple allowed template IDs.
703
+ * User can choose which template to use when uploading.
704
+ */
705
+ allowedTemplates?: string[];
706
+ /**
707
+ * Allow multiple documents.
708
+ * If true, value is string[] (document IDs).
709
+ * If false/undefined, value is string (single document ID).
710
+ */
711
+ multiple?: boolean;
712
+ /**
713
+ * Maximum number of documents when multiple: true.
714
+ */
715
+ maxDocuments?: number;
716
+ /**
717
+ * Automatically trigger processing (OCR, verification) on upload.
718
+ */
719
+ autoProcess?: boolean;
720
+ }
721
+ type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
722
+
723
+ /**
724
+ * Timestamps for tracking creation and updates
725
+ */
726
+ interface Timestamps {
727
+ createdAt: Date;
728
+ updatedAt: Date;
729
+ }
730
+ /**
731
+ * Sharing mode for multi-tenant object access.
732
+ *
733
+ * - `private`: Object is only visible to its owner tenant (default)
734
+ * - `shared`: Object is readable by all tenants, but only writable by the owner tenant
735
+ *
736
+ * Records inherit the sharing mode of their parent object.
737
+ */
738
+ type SharingMode = "private" | "shared";
739
+ /**
740
+ * Object definition - Represents a database table/entity
741
+ */
742
+ interface ObjectDefinition {
743
+ id?: Uuid;
744
+ name: string;
745
+ label: string;
746
+ pluralLabel?: string;
747
+ description?: string;
748
+ icon?: IconName;
749
+ /**
750
+ * Template expression used to compute the object's display label.
751
+ * Supports variable interpolation and pipes for formatting.
752
+ *
753
+ * @example
754
+ * ```typescript
755
+ * // Simple attribute reference
756
+ * labelExpression: "{{ name }}"
757
+ *
758
+ * // Multiple attributes
759
+ * labelExpression: "{{ firstName }} {{ lastName }}"
760
+ *
761
+ * // With pipes for formatting
762
+ * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
763
+ * ```
764
+ *
765
+ * Available pipes: UPPER, LOWER, capitalize, trim
766
+ */
767
+ labelExpression: string;
768
+ attributes: Attribute[];
769
+ system?: boolean;
770
+ /**
771
+ * Sharing mode for multi-tenant access.
772
+ * - `private`: Only visible to the owner tenant (default)
773
+ * - `shared`: Readable by all tenants, writable only by the owner
774
+ *
775
+ * Records inherit the sharing mode of their parent object.
776
+ * @default "private"
777
+ */
778
+ sharingMode?: SharingMode;
779
+ metadata?: Record<string, unknown>;
780
+ }
781
+ /**
782
+ * Links an attribute to an object
783
+ */
784
+ interface ObjectAttribute {
785
+ objectId: Uuid;
786
+ attributeId: Uuid;
787
+ order?: number;
788
+ required?: boolean;
789
+ }
790
+ /**
791
+ * Completion status of a record based on data completeness.
792
+ *
793
+ * - `draft`: Record is missing one or more required attribute values.
794
+ * Can be saved but is considered incomplete.
795
+ * - `complete`: All required attribute values are present and valid.
796
+ * Record is ready for use.
797
+ *
798
+ * This is different from workflow status (e.g., "pending", "approved").
799
+ * Completion status is computed dynamically based on the object schema.
800
+ */
801
+ type CompletionStatus = "draft" | "complete";
802
+ /**
803
+ * Record - Instance of an Object (a row in the database)
804
+ */
805
+ interface ObjectRecord extends Timestamps {
806
+ id: Uuid;
807
+ objectId: Uuid;
808
+ /**
809
+ * Display label computed from the object's labelExpression.
810
+ * Computed dynamically based on record values.
811
+ *
812
+ * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
813
+ */
814
+ label: string;
815
+ /**
816
+ * Completion status of the record.
817
+ * - `draft`: Missing required values, record is incomplete
818
+ * - `complete`: All required values present and valid
819
+ *
820
+ * Computed dynamically based on the object's schema.
821
+ */
822
+ completionStatus: CompletionStatus;
823
+ values: Record<string, unknown>;
824
+ /**
825
+ * Custom metadata for the record.
826
+ * Use this for UI/UX state, feature flags, or any application-specific data.
827
+ * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
828
+ */
829
+ metadata?: Record<string, unknown>;
830
+ /**
831
+ * Soft delete timestamp.
832
+ * If set, the record is considered deleted but can be restored.
833
+ * Queries exclude soft-deleted records by default.
834
+ */
835
+ deletedAt?: Date | null;
836
+ /**
837
+ * User ID who created this record.
838
+ * Automatically set by RecordService when userId is configured.
839
+ * Optional for backward compatibility with existing records.
840
+ */
841
+ createdBy?: string;
842
+ /**
843
+ * User ID who last updated this record.
844
+ * Automatically set by RecordService when userId is configured.
845
+ * Optional for backward compatibility with existing records.
846
+ */
847
+ lastUpdatedBy?: string;
848
+ }
849
+ /**
850
+ * System-managed field names on ObjectRecord.
851
+ * These are stored as SQL columns (not in JSONB `values`).
852
+ *
853
+ * Use this in adapters to determine if a filter/sort attribute is a table column
854
+ * vs. a JSONB value field.
855
+ *
856
+ * @example
857
+ * ```typescript
858
+ * if (SYSTEM_FIELD_NAMES.includes(filter.attribute)) {
859
+ * // Filter on SQL column (e.g., WHERE created_at > ...)
860
+ * } else {
861
+ * // Filter on JSONB field (e.g., WHERE values->>'name' = ...)
862
+ * }
863
+ * ```
864
+ */
865
+ declare const SYSTEM_FIELD_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy"];
866
+ /**
867
+ * Type for system field names
868
+ */
869
+ type SystemFieldName = (typeof SYSTEM_FIELD_NAMES)[number];
870
+ /**
871
+ * Reserved attribute names that cannot be used for custom attributes.
872
+ * These names conflict with ObjectRecord properties.
873
+ *
874
+ * Includes:
875
+ * - System fields (id, createdAt, updatedAt, createdBy, lastUpdatedBy)
876
+ * - Other ObjectRecord properties (objectId, label, completionStatus, values, metadata, deletedAt)
877
+ *
878
+ * @example
879
+ * ```typescript
880
+ * if (RESERVED_ATTRIBUTE_NAMES.includes(attributeName)) {
881
+ * throw new Error(`"${attributeName}" is a reserved name`);
882
+ * }
883
+ * ```
884
+ */
885
+ declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "objectId", "label", "completionStatus", "values", "metadata", "deletedAt"];
886
+ /**
887
+ * Type for reserved attribute names
888
+ */
889
+ type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
890
+
891
+ /**
892
+ * Format Zod validation errors into a consistent structure.
893
+ * This eliminates code duplication across multiple validation functions.
894
+ */
895
+ declare function formatZodErrors(error: z.ZodError): Array<{
896
+ path: string[];
897
+ message: string;
898
+ }>;
899
+
900
+ /**
901
+ * Validation messages for Zod validators.
902
+ * All functions receive the full Attribute to access label, type, etc.
903
+ * Can be customized for i18n support.
904
+ */
905
+ interface ValidationMessages {
906
+ required: (attr: Attribute) => string;
907
+ invalidType: (attr: Attribute, expected: string) => string;
908
+ minLength: (attr: Attribute, min: number) => string;
909
+ maxLength: (attr: Attribute, max: number) => string;
910
+ invalidPattern: (attr: Attribute) => string;
911
+ minValue: (attr: Attribute, min: number) => string;
912
+ maxValue: (attr: Attribute, max: number) => string;
913
+ mustBeInteger: (attr: Attribute) => string;
914
+ invalidDate: (attr: Attribute) => string;
915
+ invalidOption: (attr: Attribute, options: string[]) => string;
916
+ invalidId: (attr: Attribute) => string;
917
+ minItems: (attr: Attribute, min: number) => string;
918
+ maxItems: (attr: Attribute, max: number) => string;
919
+ invalidRichtext: (attr: Attribute) => string;
920
+ invalidPhone: (attr: Attribute) => string;
921
+ invalidCurrency: (attr: Attribute) => string;
922
+ invalidLocation: (attr: Attribute) => string;
923
+ }
924
+ declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
925
+ /**
926
+ * Text attribute config schema
927
+ */
928
+ declare const textConfigSchema: z.ZodObject<{
929
+ disabled: z.ZodOptional<z.ZodBoolean>;
930
+ placeholder: z.ZodOptional<z.ZodString>;
931
+ description: z.ZodOptional<z.ZodString>;
932
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
933
+ icon: z.ZodOptional<z.ZodString>;
934
+ order: z.ZodOptional<z.ZodNumber>;
935
+ hidden: z.ZodOptional<z.ZodBoolean>;
936
+ archived: z.ZodOptional<z.ZodBoolean>;
937
+ deprecated: z.ZodOptional<z.ZodBoolean>;
938
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
939
+ minLength: z.ZodOptional<z.ZodNumber>;
940
+ maxLength: z.ZodOptional<z.ZodNumber>;
941
+ pattern: z.ZodOptional<z.ZodString>;
942
+ }, z.core.$strip>;
943
+ /**
944
+ * Textarea attribute config schema
945
+ */
946
+ declare const textareaConfigSchema: z.ZodObject<{
947
+ disabled: z.ZodOptional<z.ZodBoolean>;
948
+ placeholder: z.ZodOptional<z.ZodString>;
949
+ description: z.ZodOptional<z.ZodString>;
950
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
951
+ icon: z.ZodOptional<z.ZodString>;
952
+ order: z.ZodOptional<z.ZodNumber>;
953
+ hidden: z.ZodOptional<z.ZodBoolean>;
954
+ archived: z.ZodOptional<z.ZodBoolean>;
955
+ deprecated: z.ZodOptional<z.ZodBoolean>;
956
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
957
+ }, z.core.$strip>;
958
+ /**
959
+ * Richtext attribute config schema
960
+ */
961
+ declare const richtextConfigSchema: z.ZodObject<{
962
+ disabled: z.ZodOptional<z.ZodBoolean>;
963
+ placeholder: z.ZodOptional<z.ZodString>;
964
+ description: z.ZodOptional<z.ZodString>;
965
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
966
+ icon: z.ZodOptional<z.ZodString>;
967
+ order: z.ZodOptional<z.ZodNumber>;
968
+ hidden: z.ZodOptional<z.ZodBoolean>;
969
+ archived: z.ZodOptional<z.ZodBoolean>;
970
+ deprecated: z.ZodOptional<z.ZodBoolean>;
971
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
972
+ features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
973
+ headings: "headings";
974
+ bold: "bold";
975
+ italic: "italic";
976
+ lists: "lists";
977
+ links: "links";
978
+ images: "images";
979
+ codeBlocks: "codeBlocks";
980
+ tables: "tables";
981
+ }>>>;
982
+ }, z.core.$strip>;
983
+ /**
984
+ * Number attribute config schema
985
+ */
986
+ declare const numberConfigSchema: z.ZodObject<{
987
+ disabled: z.ZodOptional<z.ZodBoolean>;
988
+ placeholder: z.ZodOptional<z.ZodString>;
989
+ description: z.ZodOptional<z.ZodString>;
990
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
991
+ icon: z.ZodOptional<z.ZodString>;
992
+ order: z.ZodOptional<z.ZodNumber>;
993
+ hidden: z.ZodOptional<z.ZodBoolean>;
994
+ archived: z.ZodOptional<z.ZodBoolean>;
995
+ deprecated: z.ZodOptional<z.ZodBoolean>;
996
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
997
+ min: z.ZodOptional<z.ZodNumber>;
998
+ max: z.ZodOptional<z.ZodNumber>;
999
+ unit: z.ZodOptional<z.ZodEnum<{
1000
+ percentage: "percentage";
1001
+ integer: "integer";
1002
+ decimal: "decimal";
1003
+ }>>;
1004
+ decimals: z.ZodOptional<z.ZodNumber>;
1005
+ }, z.core.$strip>;
1006
+ /**
1007
+ * Checkbox attribute config schema
1008
+ */
1009
+ declare const checkboxConfigSchema: z.ZodObject<{
1010
+ disabled: z.ZodOptional<z.ZodBoolean>;
1011
+ placeholder: z.ZodOptional<z.ZodString>;
1012
+ description: z.ZodOptional<z.ZodString>;
1013
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1014
+ icon: z.ZodOptional<z.ZodString>;
1015
+ order: z.ZodOptional<z.ZodNumber>;
1016
+ hidden: z.ZodOptional<z.ZodBoolean>;
1017
+ archived: z.ZodOptional<z.ZodBoolean>;
1018
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1019
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1020
+ }, z.core.$strip>;
1021
+ /**
1022
+ * Date attribute config schema
1023
+ */
1024
+ declare const dateConfigSchema: z.ZodObject<{
1025
+ disabled: z.ZodOptional<z.ZodBoolean>;
1026
+ placeholder: z.ZodOptional<z.ZodString>;
1027
+ description: z.ZodOptional<z.ZodString>;
1028
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1029
+ icon: z.ZodOptional<z.ZodString>;
1030
+ order: z.ZodOptional<z.ZodNumber>;
1031
+ hidden: z.ZodOptional<z.ZodBoolean>;
1032
+ archived: z.ZodOptional<z.ZodBoolean>;
1033
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1034
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1035
+ dateFormat: z.ZodOptional<z.ZodEnum<{
1036
+ short: "short";
1037
+ long: "long";
1038
+ full: "full";
1039
+ relative: "relative";
1040
+ }>>;
1041
+ minDate: z.ZodOptional<z.ZodString>;
1042
+ maxDate: z.ZodOptional<z.ZodString>;
1043
+ }, z.core.$strip>;
1044
+ /**
1045
+ * Phone attribute config schema
1046
+ */
1047
+ declare const phoneConfigSchema: z.ZodObject<{
1048
+ disabled: z.ZodOptional<z.ZodBoolean>;
1049
+ placeholder: z.ZodOptional<z.ZodString>;
1050
+ description: z.ZodOptional<z.ZodString>;
1051
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1052
+ icon: z.ZodOptional<z.ZodString>;
1053
+ order: z.ZodOptional<z.ZodNumber>;
1054
+ hidden: z.ZodOptional<z.ZodBoolean>;
1055
+ archived: z.ZodOptional<z.ZodBoolean>;
1056
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1057
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1058
+ defaultCountryCode: z.ZodOptional<z.ZodString>;
1059
+ }, z.core.$strip>;
1060
+ /**
1061
+ * Currency attribute config schema
1062
+ */
1063
+ declare const currencyConfigSchema: z.ZodObject<{
1064
+ disabled: z.ZodOptional<z.ZodBoolean>;
1065
+ placeholder: z.ZodOptional<z.ZodString>;
1066
+ description: z.ZodOptional<z.ZodString>;
1067
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1068
+ icon: z.ZodOptional<z.ZodString>;
1069
+ order: z.ZodOptional<z.ZodNumber>;
1070
+ hidden: z.ZodOptional<z.ZodBoolean>;
1071
+ archived: z.ZodOptional<z.ZodBoolean>;
1072
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1073
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1074
+ defaultCurrency: z.ZodOptional<z.ZodString>;
1075
+ allowedCurrencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
1076
+ }, z.core.$strip>;
1077
+ /**
1078
+ * Status attribute config schema
1079
+ */
1080
+ declare const statusConfigSchema: z.ZodObject<{
1081
+ disabled: z.ZodOptional<z.ZodBoolean>;
1082
+ placeholder: z.ZodOptional<z.ZodString>;
1083
+ description: z.ZodOptional<z.ZodString>;
1084
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1085
+ icon: z.ZodOptional<z.ZodString>;
1086
+ order: z.ZodOptional<z.ZodNumber>;
1087
+ hidden: z.ZodOptional<z.ZodBoolean>;
1088
+ archived: z.ZodOptional<z.ZodBoolean>;
1089
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1090
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1091
+ options: z.ZodArray<z.ZodObject<{
1092
+ id: z.ZodString;
1093
+ label: z.ZodString;
1094
+ value: z.ZodString;
1095
+ color: z.ZodOptional<z.ZodString>;
1096
+ icon: z.ZodOptional<z.ZodString>;
1097
+ description: z.ZodOptional<z.ZodString>;
1098
+ group: z.ZodOptional<z.ZodEnum<{
1099
+ in_progress: "in_progress";
1100
+ idle: "idle";
1101
+ finished: "finished";
1102
+ }>>;
1103
+ }, z.core.$strip>>;
1104
+ }, z.core.$strip>;
1105
+ /**
1106
+ * Location attribute config schema
1107
+ */
1108
+ declare const locationConfigSchema: z.ZodObject<{
1109
+ disabled: z.ZodOptional<z.ZodBoolean>;
1110
+ placeholder: z.ZodOptional<z.ZodString>;
1111
+ description: z.ZodOptional<z.ZodString>;
1112
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1113
+ icon: z.ZodOptional<z.ZodString>;
1114
+ order: z.ZodOptional<z.ZodNumber>;
1115
+ hidden: z.ZodOptional<z.ZodBoolean>;
1116
+ archived: z.ZodOptional<z.ZodBoolean>;
1117
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1118
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1119
+ granularity: z.ZodEnum<{
1120
+ full: "full";
1121
+ address: "address";
1122
+ city: "city";
1123
+ state: "state";
1124
+ country: "country";
1125
+ coordinates: "coordinates";
1126
+ }>;
1127
+ enableAutocomplete: z.ZodOptional<z.ZodBoolean>;
1128
+ enableMap: z.ZodOptional<z.ZodBoolean>;
1129
+ defaultCountry: z.ZodOptional<z.ZodString>;
1130
+ allowedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
1131
+ displayFormat: z.ZodOptional<z.ZodEnum<{
1132
+ single_line: "single_line";
1133
+ multi_line: "multi_line";
1134
+ compact: "compact";
1135
+ }>>;
1136
+ }, z.core.$strip>;
1137
+ /**
1138
+ * Select attribute config schema
1139
+ */
1140
+ declare const selectConfigSchema: z.ZodObject<{
1141
+ disabled: z.ZodOptional<z.ZodBoolean>;
1142
+ placeholder: z.ZodOptional<z.ZodString>;
1143
+ description: z.ZodOptional<z.ZodString>;
1144
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1145
+ icon: z.ZodOptional<z.ZodString>;
1146
+ order: z.ZodOptional<z.ZodNumber>;
1147
+ hidden: z.ZodOptional<z.ZodBoolean>;
1148
+ archived: z.ZodOptional<z.ZodBoolean>;
1149
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1150
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1151
+ options: z.ZodArray<z.ZodObject<{
1152
+ id: z.ZodString;
1153
+ label: z.ZodString;
1154
+ value: z.ZodString;
1155
+ color: z.ZodOptional<z.ZodString>;
1156
+ icon: z.ZodOptional<z.ZodString>;
1157
+ description: z.ZodOptional<z.ZodString>;
1158
+ group: z.ZodOptional<z.ZodEnum<{
1159
+ in_progress: "in_progress";
1160
+ idle: "idle";
1161
+ finished: "finished";
1162
+ }>>;
1163
+ }, z.core.$strip>>;
1164
+ }, z.core.$strip>;
1165
+ /**
1166
+ * Multiselect attribute config schema
1167
+ */
1168
+ declare const multiselectConfigSchema: z.ZodObject<{
1169
+ disabled: z.ZodOptional<z.ZodBoolean>;
1170
+ placeholder: z.ZodOptional<z.ZodString>;
1171
+ description: z.ZodOptional<z.ZodString>;
1172
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1173
+ icon: z.ZodOptional<z.ZodString>;
1174
+ order: z.ZodOptional<z.ZodNumber>;
1175
+ hidden: z.ZodOptional<z.ZodBoolean>;
1176
+ archived: z.ZodOptional<z.ZodBoolean>;
1177
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1178
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1179
+ options: z.ZodArray<z.ZodObject<{
1180
+ id: z.ZodString;
1181
+ label: z.ZodString;
1182
+ value: z.ZodString;
1183
+ color: z.ZodOptional<z.ZodString>;
1184
+ icon: z.ZodOptional<z.ZodString>;
1185
+ description: z.ZodOptional<z.ZodString>;
1186
+ group: z.ZodOptional<z.ZodEnum<{
1187
+ in_progress: "in_progress";
1188
+ idle: "idle";
1189
+ finished: "finished";
1190
+ }>>;
1191
+ }, z.core.$strip>>;
1192
+ }, z.core.$strip>;
1193
+ /**
1194
+ * File attribute config schema
1195
+ */
1196
+ declare const fileConfigSchema: z.ZodObject<{
1197
+ disabled: z.ZodOptional<z.ZodBoolean>;
1198
+ placeholder: z.ZodOptional<z.ZodString>;
1199
+ description: z.ZodOptional<z.ZodString>;
1200
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1201
+ icon: z.ZodOptional<z.ZodString>;
1202
+ order: z.ZodOptional<z.ZodNumber>;
1203
+ hidden: z.ZodOptional<z.ZodBoolean>;
1204
+ archived: z.ZodOptional<z.ZodBoolean>;
1205
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1206
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1207
+ maxFiles: z.ZodOptional<z.ZodNumber>;
1208
+ maxSize: z.ZodOptional<z.ZodNumber>;
1209
+ allowedTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1210
+ multiple: z.ZodOptional<z.ZodBoolean>;
1211
+ }, z.core.$strip>;
1212
+ /**
1213
+ * User attribute config schema
1214
+ */
1215
+ declare const userConfigSchema: z.ZodObject<{
1216
+ disabled: z.ZodOptional<z.ZodBoolean>;
1217
+ placeholder: z.ZodOptional<z.ZodString>;
1218
+ description: z.ZodOptional<z.ZodString>;
1219
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1220
+ icon: z.ZodOptional<z.ZodString>;
1221
+ order: z.ZodOptional<z.ZodNumber>;
1222
+ hidden: z.ZodOptional<z.ZodBoolean>;
1223
+ archived: z.ZodOptional<z.ZodBoolean>;
1224
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1225
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1226
+ allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
1227
+ multiple: z.ZodOptional<z.ZodBoolean>;
1228
+ }, z.core.$strip>;
1229
+ /**
1230
+ * Relation attribute config schema
1231
+ */
1232
+ declare const relationConfigSchema: z.ZodObject<{
1233
+ disabled: z.ZodOptional<z.ZodBoolean>;
1234
+ placeholder: z.ZodOptional<z.ZodString>;
1235
+ description: z.ZodOptional<z.ZodString>;
1236
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1237
+ icon: z.ZodOptional<z.ZodString>;
1238
+ order: z.ZodOptional<z.ZodNumber>;
1239
+ hidden: z.ZodOptional<z.ZodBoolean>;
1240
+ archived: z.ZodOptional<z.ZodBoolean>;
1241
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1242
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1243
+ targets: z.ZodArray<z.ZodObject<{
1244
+ object: z.ZodString;
1245
+ displayTemplate: z.ZodOptional<z.ZodString>;
1246
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1247
+ }, z.core.$strip>>;
1248
+ cardinality: z.ZodEnum<{
1249
+ one: "one";
1250
+ many: "many";
1251
+ }>;
1252
+ minItems: z.ZodOptional<z.ZodNumber>;
1253
+ maxItems: z.ZodOptional<z.ZodNumber>;
1254
+ }, z.core.$strip>;
1255
+ /**
1256
+ * Rating attribute config schema
1257
+ */
1258
+ declare const ratingConfigSchema: z.ZodObject<{
1259
+ disabled: z.ZodOptional<z.ZodBoolean>;
1260
+ placeholder: z.ZodOptional<z.ZodString>;
1261
+ description: z.ZodOptional<z.ZodString>;
1262
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1263
+ icon: z.ZodOptional<z.ZodString>;
1264
+ order: z.ZodOptional<z.ZodNumber>;
1265
+ hidden: z.ZodOptional<z.ZodBoolean>;
1266
+ archived: z.ZodOptional<z.ZodBoolean>;
1267
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1268
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1269
+ max: z.ZodOptional<z.ZodNumber>;
1270
+ iconType: z.ZodOptional<z.ZodEnum<{
1271
+ number: "number";
1272
+ heart: "heart";
1273
+ star: "star";
1274
+ thumbs: "thumbs";
1275
+ }>>;
1276
+ }, z.core.$strip>;
1277
+ /**
1278
+ * Formula attribute config schema
1279
+ */
1280
+ declare const formulaConfigSchema: z.ZodObject<{
1281
+ disabled: z.ZodOptional<z.ZodBoolean>;
1282
+ placeholder: z.ZodOptional<z.ZodString>;
1283
+ description: z.ZodOptional<z.ZodString>;
1284
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1285
+ icon: z.ZodOptional<z.ZodString>;
1286
+ order: z.ZodOptional<z.ZodNumber>;
1287
+ hidden: z.ZodOptional<z.ZodBoolean>;
1288
+ archived: z.ZodOptional<z.ZodBoolean>;
1289
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1290
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1291
+ expression: z.ZodString;
1292
+ returnType: z.ZodEnum<{
1293
+ number: "number";
1294
+ boolean: "boolean";
1295
+ text: "text";
1296
+ date: "date";
1297
+ }>;
1298
+ decimals: z.ZodOptional<z.ZodNumber>;
1299
+ allowRelations: z.ZodOptional<z.ZodBoolean>;
1300
+ }, z.core.$strip>;
1301
+ /**
1302
+ * Rollup attribute config schema
1303
+ */
1304
+ declare const rollupConfigSchema: z.ZodObject<{
1305
+ disabled: z.ZodOptional<z.ZodBoolean>;
1306
+ placeholder: z.ZodOptional<z.ZodString>;
1307
+ description: z.ZodOptional<z.ZodString>;
1308
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1309
+ icon: z.ZodOptional<z.ZodString>;
1310
+ order: z.ZodOptional<z.ZodNumber>;
1311
+ hidden: z.ZodOptional<z.ZodBoolean>;
1312
+ archived: z.ZodOptional<z.ZodBoolean>;
1313
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1314
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1315
+ relationAttribute: z.ZodOptional<z.ZodString>;
1316
+ relationPath: z.ZodOptional<z.ZodString>;
1317
+ targetAttribute: z.ZodString;
1318
+ function: z.ZodEnum<{
1319
+ sum: "sum";
1320
+ avg: "avg";
1321
+ earliest: "earliest";
1322
+ latest: "latest";
1323
+ count: "count";
1324
+ countValues: "countValues";
1325
+ countUniqueValues: "countUniqueValues";
1326
+ countEmpty: "countEmpty";
1327
+ percentEmpty: "percentEmpty";
1328
+ percentNotEmpty: "percentNotEmpty";
1329
+ original: "original";
1330
+ }>;
1331
+ decimals: z.ZodOptional<z.ZodNumber>;
1332
+ targetAttributeType: z.ZodOptional<z.ZodString>;
1333
+ targetAttributeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
1334
+ id: z.ZodString;
1335
+ label: z.ZodString;
1336
+ value: z.ZodString;
1337
+ color: z.ZodOptional<z.ZodString>;
1338
+ icon: z.ZodOptional<z.ZodString>;
1339
+ description: z.ZodOptional<z.ZodString>;
1340
+ group: z.ZodOptional<z.ZodEnum<{
1341
+ in_progress: "in_progress";
1342
+ idle: "idle";
1343
+ finished: "finished";
1344
+ }>>;
1345
+ }, z.core.$strip>>>;
1346
+ }, z.core.$strip>;
1347
+ /**
1348
+ * Document attribute config schema
1349
+ */
1350
+ declare const documentConfigSchema: z.ZodObject<{
1351
+ disabled: z.ZodOptional<z.ZodBoolean>;
1352
+ placeholder: z.ZodOptional<z.ZodString>;
1353
+ description: z.ZodOptional<z.ZodString>;
1354
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1355
+ icon: z.ZodOptional<z.ZodString>;
1356
+ order: z.ZodOptional<z.ZodNumber>;
1357
+ hidden: z.ZodOptional<z.ZodBoolean>;
1358
+ archived: z.ZodOptional<z.ZodBoolean>;
1359
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1360
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1361
+ templateId: z.ZodOptional<z.ZodString>;
1362
+ allowedTemplates: z.ZodOptional<z.ZodArray<z.ZodString>>;
1363
+ multiple: z.ZodOptional<z.ZodBoolean>;
1364
+ maxDocuments: z.ZodOptional<z.ZodNumber>;
1365
+ autoProcess: z.ZodOptional<z.ZodBoolean>;
1366
+ }, z.core.$strip>;
1367
+ /**
1368
+ * Map of attribute type to config schema
1369
+ */
1370
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
1371
+ /**
1372
+ * Get the config schema for a specific attribute type
1373
+ */
1374
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
1375
+ /**
1376
+ * Validate attribute config for a specific type
1377
+ * Returns the validated config with only allowed properties
1378
+ */
1379
+ declare function validateAttributeConfig(type: AttributeType, config: Record<string, unknown>): {
1380
+ success: true;
1381
+ data: Record<string, unknown>;
1382
+ } | {
1383
+ success: false;
1384
+ errors: string[];
1385
+ };
1386
+ /**
1387
+ * Validate and strip unknown properties from attribute config
1388
+ * This ensures only allowed properties are stored in the database
1389
+ */
1390
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
1391
+ /**
1392
+ * Safely parse attribute config, returning undefined for invalid configs
1393
+ */
1394
+ declare function safeParseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown> | undefined;
1395
+ /**
1396
+ * Create a Zod schema for a text attribute
1397
+ */
1398
+ declare function createTextValidator(attr: TextAttribute, messages?: ValidationMessages): z.ZodString;
1399
+ /**
1400
+ * Create a Zod schema for a number attribute
1401
+ */
1402
+ declare function createNumberValidator(attr: NumberAttribute, messages?: ValidationMessages): z.ZodNumber;
1403
+ /**
1404
+ * Create a Zod schema for a checkbox attribute
1405
+ */
1406
+ declare function createCheckboxValidator(_attr: CheckboxAttribute, _messages?: ValidationMessages): z.ZodBoolean;
1407
+ /**
1408
+ * Create a Zod schema for a date attribute
1409
+ */
1410
+ declare function createDateValidator(attr: DateAttribute, messages?: ValidationMessages): z.ZodTypeAny;
1411
+ /**
1412
+ * Create a Zod schema for a phone attribute
1413
+ */
1414
+ declare function createPhoneValidator(attr: PhoneAttribute, messages?: ValidationMessages): z.ZodType<{
1415
+ countryCode: string;
1416
+ phoneNumber: string;
1417
+ }>;
1418
+ /**
1419
+ * Create a Zod schema for a currency attribute
1420
+ */
1421
+ declare function createCurrencyValidator(attr: CurrencyAttribute, messages?: ValidationMessages): z.ZodType<{
1422
+ code: string;
1423
+ value: number;
1424
+ }>;
1425
+ /**
1426
+ * Create a Zod schema for a status attribute
1427
+ */
1428
+ declare function createStatusValidator(attr: StatusAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
1429
+ /**
1430
+ * Create a Zod schema for a select attribute
1431
+ */
1432
+ declare function createSelectValidator(attr: SelectAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
1433
+ /**
1434
+ * Create a Zod schema for a multiselect attribute
1435
+ */
1436
+ declare function createMultiselectValidator(attr: MultiselectAttribute, messages?: ValidationMessages): z.ZodArray<z.ZodEnum<Readonly<Record<string, string>>>>;
1437
+ /**
1438
+ * Create a Zod schema for a location attribute
1439
+ */
1440
+ type LocationShape = {
1441
+ address?: string;
1442
+ address2?: string;
1443
+ city?: string;
1444
+ state?: string;
1445
+ postalCode?: string;
1446
+ country?: string;
1447
+ latitude?: number;
1448
+ longitude?: number;
1449
+ };
1450
+ declare function createLocationValidator(attr: LocationAttribute, messages?: ValidationMessages): z.ZodType<LocationShape>;
1451
+ /**
1452
+ * Create a Zod schema for a file attribute
1453
+ * Supports both single file (UUID) and multiple files (array of UUIDs)
1454
+ */
1455
+ declare function createFileValidator(attr: FileAttribute, messages?: ValidationMessages): z.ZodTypeAny;
1456
+ /**
1457
+ * Create a Zod schema for a user attribute
1458
+ * Supports both single user (UUID) and multiple users (array of UUIDs)
1459
+ */
1460
+ declare function createUserValidator(attr: UserAttribute, messages?: ValidationMessages): z.ZodTypeAny;
1461
+ /**
1462
+ * Create a Zod schema for a single relation attribute (cardinality: "one")
1463
+ */
1464
+ declare function createSingleRelationValidator(attr: SingleRelationAttribute, messages?: ValidationMessages): z.ZodUnion<[z.ZodUUID, z.ZodNull]>;
1465
+ /**
1466
+ * Create a Zod schema for a multi relation attribute (cardinality: "many")
1467
+ */
1468
+ declare function createMultiRelationValidator(attr: MultiRelationAttribute, messages?: ValidationMessages): z.ZodArray<z.ZodUUID>;
1469
+ /**
1470
+ * Create a Zod schema for a relation attribute
1471
+ * Dispatches to single or multi validator based on cardinality
1472
+ */
1473
+ declare function createRelationValidator(attr: RelationAttribute, messages?: ValidationMessages): z.ZodUnion<[z.ZodUUID, z.ZodNull]> | z.ZodArray<z.ZodUUID>;
1474
+ /**
1475
+ * Create a Zod schema for a rating attribute
1476
+ */
1477
+ declare function createRatingValidator(attr: RatingAttribute, messages?: ValidationMessages): z.ZodNumber;
1478
+ /**
1479
+ * Create a Zod schema for a formula attribute.
1480
+ * Formula attributes are read-only (computed at runtime).
1481
+ * They accept any value during validation but are ignored during record creation/update.
1482
+ */
1483
+ declare function createFormulaValidator(_attr: FormulaAttribute, _messages?: ValidationMessages): z.ZodUnknown;
1484
+ /**
1485
+ * Create a Zod schema for a rollup attribute.
1486
+ * Rollup attributes are read-only (computed from related records).
1487
+ * They accept any value during validation but are ignored during record creation/update.
1488
+ */
1489
+ declare function createRollupValidator(_attr: RollupAttribute, _messages?: ValidationMessages): z.ZodUnknown;
1490
+ /**
1491
+ * Create a Zod schema for a textarea attribute.
1492
+ * Validates that the value is a string.
1493
+ */
1494
+ declare function createTextAreaValidator(_attr: TextAreaAttribute, _messages?: ValidationMessages): z.ZodString;
1495
+ /**
1496
+ * Create a Zod schema for a richtext attribute.
1497
+ * Validates semantic markdown content as a string.
1498
+ *
1499
+ * @example Valid richtext content (semantic markdown)
1500
+ * ```typescript
1501
+ * `# Heading
1502
+ *
1503
+ * Some paragraph text.
1504
+ *
1505
+ * :::callout{variant="info"}
1506
+ * This is a callout block
1507
+ * :::
1508
+ * `
1509
+ * ```
1510
+ */
1511
+ declare function createRichtextValidator(attr: RichtextAttribute, messages?: ValidationMessages): z.ZodTypeAny;
1512
+ /**
1513
+ * Create a Zod schema for any attribute type.
1514
+ * Returns a strict validator that does NOT handle optional fields.
1515
+ * Use createFormAttributeValidator for form validation with optional support.
1516
+ *
1517
+ * @param attr - The attribute to create a validator for
1518
+ * @param messages - Custom validation messages for i18n support
1519
+ */
1520
+ declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
1521
+ /**
1522
+ * Create a Zod schema for form validation.
1523
+ * - Normalizes empty values (empty strings, empty objects) to null for optional fields
1524
+ * - Accepts custom messages for i18n support
1525
+ *
1526
+ * Use this in UI forms where optional fields may have null/undefined values.
1527
+ *
1528
+ * @param attr - The attribute to create a validator for
1529
+ * @param messages - Custom validation messages for i18n support
1530
+ */
1531
+ declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
1532
+ /**
1533
+ * Create a Zod schema for an entire object
1534
+ *
1535
+ * Uses passthrough mode to allow computed fields (formula, rollup) that may be
1536
+ * present in record data but are not part of the mutable schema.
1537
+ */
1538
+ declare function createObjectValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
1539
+ /**
1540
+ * Validation result
1541
+ */
1542
+ interface ValidationResult {
1543
+ success: boolean;
1544
+ data?: Record<string, unknown>;
1545
+ errors?: Array<{
1546
+ path: string[];
1547
+ message: string;
1548
+ }>;
1549
+ }
1550
+ /**
1551
+ * Validate data against an attribute schema
1552
+ */
1553
+ declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
1554
+ /**
1555
+ * Validate data against an object schema
1556
+ */
1557
+ declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
1558
+ /**
1559
+ * Validate and throw if invalid
1560
+ */
1561
+ declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
1562
+ /**
1563
+ * Create a Zod schema for draft validation.
1564
+ * All attributes become optional, but provided values are still validated.
1565
+ *
1566
+ * Uses passthrough mode to allow computed fields (formula, rollup) that may be
1567
+ * present in record data but are not part of the mutable schema.
1568
+ */
1569
+ declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
1570
+ /**
1571
+ * Validate data in draft mode.
1572
+ * - All attributes are treated as optional (no required validation)
1573
+ * - Provided values are still validated for format/type correctness
1574
+ *
1575
+ * Use this when creating records that may be incomplete (drafts).
1576
+ *
1577
+ * @example
1578
+ * ```typescript
1579
+ * const result = validateDraft(PRODUCT, { name: "Draft" });
1580
+ * // → success even if "price" is required but missing
1581
+ *
1582
+ * const result2 = validateDraft(PRODUCT, { price: -10 });
1583
+ * // → fails because price must be >= 0 (format validation still applies)
1584
+ * ```
1585
+ */
1586
+ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
1587
+ /**
1588
+ * Validate draft data and throw if format validation fails.
1589
+ */
1590
+ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
1591
+ /**
1592
+ * Get the list of required attributes that are missing values.
1593
+ *
1594
+ * @example
1595
+ * ```typescript
1596
+ * const missing = getMissingRequiredAttributes(PRODUCT, { name: "Test" });
1597
+ * // → [priceAttribute, statusAttribute] if price and status are required but missing
1598
+ * ```
1599
+ */
1600
+ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
1601
+ /**
1602
+ * Check if a record is complete (all required attributes have valid values).
1603
+ *
1604
+ * @returns `true` if all required values are present and valid, `false` otherwise
1605
+ */
1606
+ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
1607
+ /**
1608
+ * Compute the completion status of a record based on its data.
1609
+ *
1610
+ * - `"complete"`: All required values are present and valid
1611
+ * - `"draft"`: One or more required values are missing or invalid
1612
+ *
1613
+ * This function is used to dynamically determine the status when
1614
+ * creating or updating records.
1615
+ *
1616
+ * @example
1617
+ * ```typescript
1618
+ * const status = computeRecordStatus(PRODUCT, {
1619
+ * name: "Nike Air Max",
1620
+ * price: 129.99,
1621
+ * status: "active"
1622
+ * });
1623
+ * // → "complete"
1624
+ *
1625
+ * const status2 = computeRecordStatus(PRODUCT, { name: "Draft Product" });
1626
+ * // → "draft" (missing required fields)
1627
+ * ```
1628
+ */
1629
+ declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
1630
+
1631
+ export { type DateFormat as $, type Attribute as A, type FormulaReturnType as B, type CheckboxPropertyDefinition as C, type DateAttribute as D, type RollupAttribute as E, type FeatureGate as F, type RollupFunction as G, type AttributeType as H, type ObjectDefinition as I, type FlagValueType as J, type FeatureFlagDefinition as K, type LocationPropertyDefinition as L, type MultiselectPropertyDefinition as M, type NumberPropertyDefinition as N, type Option as O, type PropertyDefinition as P, type FlagLevel as Q, type RatingPropertyDefinition as R, type StatusPropertyDefinition as S, type TextPropertyDefinition as T, type UserAttribute as U, type FeatureFlagsRepository as V, type StaticFlagDefault as W, type ResolvedFlag as X, type AttributeGroup as Y, type BaseAttribute as Z, type NumberUnit as _, type DocumentAttribute as a, createRelationValidator as a$, type DateValue as a0, type Phone as a1, type Currency as a2, type Location as a3, type LocationGranularity as a4, RELATION_TARGET_ANY as a5, type RelationAttribute as a6, isUniversalRelation as a7, type FlagOverride as a8, type FeatureFlagsConfig as a9, multiselectConfigSchema as aA, fileConfigSchema as aB, userConfigSchema as aC, relationConfigSchema as aD, ratingConfigSchema as aE, formulaConfigSchema as aF, rollupConfigSchema as aG, documentConfigSchema as aH, attributeConfigSchemas as aI, getAttributeConfigSchema as aJ, validateAttributeConfig as aK, parseAttributeConfig as aL, safeParseAttributeConfig as aM, createTextValidator as aN, createNumberValidator as aO, createCheckboxValidator as aP, createDateValidator as aQ, createPhoneValidator as aR, createCurrencyValidator as aS, createStatusValidator as aT, createSelectValidator as aU, createMultiselectValidator as aV, createLocationValidator as aW, createFileValidator as aX, createUserValidator as aY, createSingleRelationValidator as aZ, createMultiRelationValidator as a_, RESERVED_ATTRIBUTE_NAMES as aa, SYSTEM_FIELD_NAMES as ab, type ReservedAttributeName as ac, type SystemFieldName as ad, type Timestamps as ae, type SharingMode as af, type ObjectAttribute as ag, type CompletionStatus as ah, type ObjectRecord as ai, type PropertyType as aj, FORBIDDEN_PROPERTY_TYPES as ak, type ForbiddenPropertyType as al, formatZodErrors as am, type ValidationMessages as an, DEFAULT_VALIDATION_MESSAGES as ao, textConfigSchema as ap, textareaConfigSchema as aq, richtextConfigSchema as ar, numberConfigSchema as as, checkboxConfigSchema as at, dateConfigSchema as au, phoneConfigSchema as av, currencyConfigSchema as aw, statusConfigSchema as ax, locationConfigSchema as ay, selectConfigSchema as az, type TextareaPropertyDefinition as b, createRatingValidator as b0, createFormulaValidator as b1, createRollupValidator as b2, createTextAreaValidator as b3, createRichtextValidator as b4, createAttributeValidator as b5, createFormAttributeValidator as b6, createObjectValidator as b7, type ValidationResult as b8, validateAttribute as b9, validateObject as ba, validateObjectOrThrow as bb, createDraftValidator as bc, validateDraft as bd, validateDraftOrThrow as be, getMissingRequiredAttributes as bf, isRecordComplete as bg, computeRecordStatus as bh, type DatePropertyDefinition as c, type PhonePropertyDefinition as d, type CurrencyPropertyDefinition as e, type StatusGroup as f, type SelectPropertyDefinition as g, type PropertySchema as h, type TextAttribute as i, type TextAreaAttribute as j, type RichtextAttribute as k, type RichtextFeature as l, type NumberAttribute as m, type CheckboxAttribute as n, type PhoneAttribute as o, type CurrencyAttribute as p, type StatusAttribute as q, type SelectAttribute as r, type MultiselectAttribute as s, type LocationAttribute as t, type FileAttribute as u, type SingleRelationAttribute as v, type MultiRelationAttribute as w, type RelationTarget as x, type RatingAttribute as y, type FormulaAttribute as z };