@stndrds/schema 0.1.0-alpha.56 → 0.1.0-alpha.58

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.
@@ -1,6 +1,7 @@
1
- import { ColorId, IconName, CountryIso3, CurrencyCode, MimeType } from '@stndrds/constants';
1
+ import { a0 as Timestamps, A as Attribute, o as AttributeType, I as Location, J as LocationGranularity, S as StatusAttribute, e as SelectAttribute, M as MultiselectAttribute, G as Phone, H as Currency, k as FormulaAttribute, m as RollupAttribute, a3 as CompletionStatus, a1 as SharingMode, a4 as ObjectRecord, p as ObjectDefinition, t as FeatureFlagsRepository, aT as ValidationResult, Q as RelationAttribute, l as FormulaReturnType } from './validators-miARInAq.js';
2
+ import { IconName, MimeType, ColorId, CountryIso3 } from '@stndrds/constants';
3
+ import { Uuid, TenantId, UserId } from './utils.js';
2
4
  import { JWTPayload } from 'jose';
3
- import { z } from 'zod';
4
5
 
5
6
  /**
6
7
  * OCR Adapter Interface for extracting text from documents.
@@ -579,554 +580,6 @@ interface CreateAIMessageInput {
579
580
  attachmentIds?: string[];
580
581
  }
581
582
 
582
- /**
583
- * Brand symbol for nominal typing.
584
- * This ensures type-safety by making IDs non-interchangeable.
585
- */
586
- declare const __brand: unique symbol;
587
- /**
588
- * Creates a branded type from a base type.
589
- * Branded types are structurally identical but nominally different.
590
- */
591
- type Brand<T, B> = T & {
592
- readonly [__brand]: B;
593
- };
594
- /**
595
- * UUID string type for all identifiers
596
- */
597
- type Uuid = string;
598
- /**
599
- * Tenant identifier for multi-tenant isolation.
600
- * Branded type to prevent accidental mixing with other string IDs.
601
- *
602
- * @example
603
- * ```typescript
604
- * const tenantId: TenantId = asTenantId('tenant-123');
605
- * const userId: UserId = asUserId('user-456');
606
- *
607
- * // Type error: cannot assign UserId to TenantId
608
- * const wrong: TenantId = userId;
609
- * ```
610
- */
611
- type TenantId = Brand<string, "TenantId">;
612
- /**
613
- * User identifier for audit trails and permissions.
614
- * Branded type to prevent accidental mixing with other string IDs.
615
- */
616
- type UserId = Brand<string, "UserId">;
617
- /**
618
- * Convert a string to a TenantId.
619
- * Use this when receiving tenant IDs from external sources (JWT, headers).
620
- *
621
- * @param id - The string to convert
622
- * @returns A branded TenantId
623
- *
624
- * @example
625
- * ```typescript
626
- * const tenantId = asTenantId(request.headers['x-tenant-id']);
627
- * ```
628
- */
629
- declare function asTenantId(id: string): TenantId;
630
- /**
631
- * Convert a string to a UserId.
632
- * Use this when receiving user IDs from external sources (JWT, auth).
633
- *
634
- * @param id - The string to convert
635
- * @returns A branded UserId
636
- *
637
- * @example
638
- * ```typescript
639
- * const userId = asUserId(jwtPayload.sub);
640
- * ```
641
- */
642
- declare function asUserId(id: string): UserId;
643
- /**
644
- * Generate a unique UUID v4
645
- * Uses crypto.randomUUID() when available (Node.js 19+, modern browsers)
646
- * Falls back to a manual implementation for older environments
647
- *
648
- * @returns A UUID v4 string
649
- *
650
- * @example
651
- * ```typescript
652
- * const id = generateId();
653
- * // "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
654
- * ```
655
- */
656
- declare function generateId(): Uuid;
657
- /**
658
- * Generate a prefixed ID for better debugging and readability
659
- *
660
- * @param prefix - Prefix for the ID (e.g., "obj", "attr", "rec")
661
- * @returns A prefixed UUID string
662
- *
663
- * @example
664
- * ```typescript
665
- * const objectId = generatePrefixedId("obj");
666
- * // "obj_a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
667
- *
668
- * const attrId = generatePrefixedId("attr");
669
- * // "attr_a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
670
- * ```
671
- */
672
- declare function generatePrefixedId(prefix: string): Uuid;
673
- /**
674
- * Convert a string to a valid kebab-case slug.
675
- * Removes accents, special chars, and normalizes spaces.
676
- *
677
- * @param input - The string to slugify
678
- * @returns A kebab-case slug matching pattern ^[a-z][a-z0-9-]*$
679
- *
680
- * @example
681
- * ```typescript
682
- * slugify("Contrat de Vente");
683
- * // "contrat-de-vente"
684
- *
685
- * slugify("Éléphant café");
686
- * // "elephant-cafe"
687
- *
688
- * slugify(" Multiple Spaces ");
689
- * // "multiple-spaces"
690
- * ```
691
- */
692
- declare function slugify(input: string): string;
693
- /**
694
- * Generate a unique template name from a label.
695
- * Format: {slugified-label}-{8-char-suffix}
696
- * Matches DB constraint: ^[a-z][a-z0-9_-]*$
697
- *
698
- * @param label - The label to generate a name from
699
- * @returns A unique kebab-case name
700
- *
701
- * @example
702
- * ```typescript
703
- * generateTemplateName("Contrat de Vente");
704
- * // "contrat-de-vente-a1b2c3d4"
705
- *
706
- * generateTemplateName("");
707
- * // "template-a1b2c3d4"
708
- * ```
709
- */
710
- declare function generateTemplateName(label: string): string;
711
-
712
- type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
713
- /**
714
- * Status group categorization
715
- */
716
- type StatusGroup = "idle" | "in_progress" | "finished";
717
- /**
718
- * Unified option type for select-like fields
719
- */
720
- interface Option {
721
- id: string;
722
- label: string;
723
- value: string;
724
- color?: ColorId;
725
- icon?: IconName;
726
- description?: string;
727
- group?: StatusGroup;
728
- }
729
- /**
730
- * Attribute grouping for UI organization
731
- */
732
- interface AttributeGroup {
733
- id: string;
734
- label: string;
735
- description?: string;
736
- attributeIds: string[];
737
- collapsible?: boolean;
738
- collapsed?: boolean;
739
- order?: number;
740
- }
741
- interface BaseAttribute<DefaultValueType = unknown> {
742
- id: Uuid;
743
- name: string;
744
- label: string;
745
- type: AttributeType;
746
- required: boolean;
747
- disabled?: boolean;
748
- placeholder?: string;
749
- description?: string;
750
- defaultValue?: DefaultValueType;
751
- icon?: IconName;
752
- order?: number;
753
- hidden?: boolean;
754
- archived?: boolean;
755
- deprecated?: boolean;
756
- system?: boolean;
757
- metadata?: Record<string, unknown>;
758
- }
759
- interface TextAttribute extends BaseAttribute<string> {
760
- type: "text";
761
- minLength?: number;
762
- maxLength?: number;
763
- pattern?: string;
764
- }
765
- type NumberUnit = "integer" | "decimal" | "percentage";
766
- interface NumberAttribute extends BaseAttribute<number> {
767
- type: "number";
768
- min?: number;
769
- max?: number;
770
- unit?: NumberUnit;
771
- decimals?: number;
772
- }
773
- interface CheckboxAttribute extends BaseAttribute<boolean> {
774
- type: "checkbox";
775
- }
776
- type DateFormat = "short" | "long" | "full" | "relative";
777
- type DateValue = string | "today";
778
- interface DateAttribute extends BaseAttribute<string> {
779
- type: "date";
780
- dateFormat?: DateFormat;
781
- minDate?: DateValue;
782
- maxDate?: DateValue;
783
- }
784
- interface Phone {
785
- countryCode: CountryIso3;
786
- phoneNumber: string;
787
- }
788
- interface PhoneAttribute extends BaseAttribute<Phone> {
789
- type: "phone";
790
- defaultCountryCode?: CountryIso3;
791
- }
792
- interface Currency {
793
- code: CurrencyCode;
794
- value: number;
795
- }
796
- interface CurrencyAttribute extends BaseAttribute<Currency> {
797
- type: "currency";
798
- defaultCurrency?: CurrencyCode;
799
- allowedCurrencies?: CurrencyCode[];
800
- }
801
- /**
802
- * StatusAttribute - For workflow states with semantic grouping (idle/in_progress/finished)
803
- * Use this for: Task status, Order status, Project phases, Process states
804
- * Use SelectAttribute for: Categories, Types, simple choices without workflow
805
- */
806
- interface StatusAttribute extends BaseAttribute<string> {
807
- type: "status";
808
- options: Option[];
809
- }
810
- interface Location {
811
- address?: string;
812
- address2?: string;
813
- city?: string;
814
- state?: string;
815
- postalCode?: string;
816
- country?: CountryIso3;
817
- latitude?: number;
818
- longitude?: number;
819
- }
820
- type LocationGranularity = "full" | "address" | "city" | "state" | "country" | "coordinates";
821
- interface LocationAttribute extends BaseAttribute<Location> {
822
- type: "location";
823
- granularity: LocationGranularity;
824
- enableAutocomplete?: boolean;
825
- enableMap?: boolean;
826
- defaultCountry?: CountryIso3;
827
- allowedCountries?: CountryIso3[];
828
- displayFormat?: "single_line" | "multi_line" | "compact";
829
- }
830
- /**
831
- * SelectAttribute - For simple single-choice selection
832
- * Use this for: Categories, Document types, Departments, Priorities
833
- * Options can be grouped (e.g., countries by continent) but no workflow logic
834
- */
835
- interface SelectAttribute extends BaseAttribute<string> {
836
- type: "select";
837
- options: Option[];
838
- }
839
- interface MultiselectAttribute extends BaseAttribute<string[]> {
840
- type: "multiselect";
841
- options: Option[];
842
- }
843
- interface FileAttribute extends BaseAttribute<string> {
844
- type: "file";
845
- maxFiles?: number;
846
- maxSize?: number;
847
- allowedTypes?: MimeType[] | readonly MimeType[];
848
- multiple?: boolean;
849
- }
850
- interface UserAttribute extends BaseAttribute<string> {
851
- type: "user";
852
- allowedRoles?: string[];
853
- multiple?: boolean;
854
- }
855
- /**
856
- * Wildcard marker for universal relations (can link to any object)
857
- * Use with `.toAny()` builder method
858
- */
859
- declare const RELATION_TARGET_ANY: "*";
860
- /**
861
- * Target object for a relation - defines which objects can be linked
862
- */
863
- interface RelationTarget {
864
- /** Object name (e.g., "companies", "contacts") or "*" for any object */
865
- object: string;
866
- /**
867
- * Display template for the label using mustache-like syntax
868
- * @example "{name}" or "{firstName} {lastName} — {email}"
869
- */
870
- displayTemplate?: string;
871
- /**
872
- * Optional filter to restrict available records
873
- * @example { status: "active" }
874
- */
875
- filter?: Record<string, unknown>;
876
- }
877
- /**
878
- * Base properties shared by both single and multi relation attributes
879
- *
880
- * Note: Deletion behavior is always "restrict" - if a record is referenced
881
- * by other records, it cannot be deleted until those references are removed.
882
- * This is enforced by RecordService.deleteRecord() which throws
883
- * RecordReferencedError when attempting to delete a referenced record.
884
- */
885
- interface RelationAttributeBase extends Omit<BaseAttribute<unknown>, "defaultValue"> {
886
- type: "relation";
887
- /** Target objects that can be linked */
888
- targets: RelationTarget[];
889
- }
890
- /**
891
- * Single relation attribute (one-to-one or many-to-one)
892
- * Stores a single record ID or null
893
- */
894
- interface SingleRelationAttribute extends RelationAttributeBase {
895
- cardinality: "one";
896
- defaultValue?: string | null;
897
- }
898
- /**
899
- * Multi relation attribute (one-to-many or many-to-many)
900
- * Stores an array of record IDs
901
- */
902
- interface MultiRelationAttribute extends RelationAttributeBase {
903
- cardinality: "many";
904
- defaultValue?: string[];
905
- /** Minimum number of relations required */
906
- minItems?: number;
907
- /** Maximum number of relations allowed */
908
- maxItems?: number;
909
- }
910
- /**
911
- * RelationAttribute links to other objects/records
912
- * Discriminated union by cardinality for type-safe value handling
913
- *
914
- * @example Single relation (many-to-one)
915
- * ```typescript
916
- * relation({ name: "company", label: "Company" })
917
- * .to("companies")
918
- * .required()
919
- * // → Value: "rec-uuid-123" | null
920
- * ```
921
- *
922
- * @example Multi relation (many-to-many)
923
- * ```typescript
924
- * relation({ name: "contacts", label: "Contacts" })
925
- * .to("contacts", { displayTemplate: "{firstName} {lastName}" })
926
- * .many()
927
- * .maxItems(5)
928
- * // → Value: ["rec-1", "rec-2", ...]
929
- * ```
930
- *
931
- * @example Polymorphic relation (multiple target objects)
932
- * ```typescript
933
- * relation({ name: "linked", label: "Linked Items" })
934
- * .to("companies")
935
- * .to("contacts")
936
- * .to("deals")
937
- * .many()
938
- * // → Can link to records from any of these objects
939
- * ```
940
- */
941
- type RelationAttribute = SingleRelationAttribute | MultiRelationAttribute;
942
- /**
943
- * Check if a relation attribute is universal (can link to any object)
944
- * Universal relations have `targets: [{ object: "*" }]`
945
- */
946
- declare function isUniversalRelation(attr: RelationAttribute): boolean;
947
- interface TextAreaAttribute extends BaseAttribute<string> {
948
- type: "textarea";
949
- }
950
- /**
951
- * Available features for richtext editor
952
- */
953
- type RichtextFeature = "headings" | "bold" | "italic" | "lists" | "links" | "images" | "codeBlocks" | "tables";
954
- /**
955
- * RichtextAttribute - Rich text content using semantic markdown
956
- *
957
- * Stores content as semantic markdown string (with directives like :::callout).
958
- * Parsed at runtime to Tiptap JSON for editing.
959
- * Use this for: Notes, articles, descriptions, long-form content.
960
- *
961
- * @example
962
- * ```typescript
963
- * richtext({ name: "content", label: "Content" })
964
- * .features(["headings", "bold", "italic", "lists", "links"])
965
- * .required()
966
- * ```
967
- */
968
- interface RichtextAttribute extends BaseAttribute<string> {
969
- type: "richtext";
970
- /** Enabled features. If undefined, all features are enabled. */
971
- features?: RichtextFeature[];
972
- }
973
- interface RatingAttribute extends BaseAttribute<number> {
974
- type: "rating";
975
- max?: number;
976
- iconType?: "star" | "heart" | "thumbs" | "number";
977
- }
978
- /**
979
- * Return type for formula expressions
980
- */
981
- type FormulaReturnType = "text" | "number" | "boolean" | "date";
982
- /**
983
- * FormulaAttribute - Computed value based on other attributes
984
- *
985
- * Formulas are calculated at read-time and are always read-only.
986
- * Users cannot directly edit formula values.
987
- *
988
- * @example Simple calculation
989
- * ```typescript
990
- * formula({ name: "total", label: "Total" })
991
- * .expression("price * quantity")
992
- * .returns("number")
993
- * .decimals(2)
994
- * ```
995
- *
996
- * @example With functions
997
- * ```typescript
998
- * formula({ name: "fullName", label: "Full Name" })
999
- * .expression("CONCAT(firstName, ' ', lastName)")
1000
- * .returns("text")
1001
- * ```
1002
- */
1003
- interface FormulaAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
1004
- type: "formula";
1005
- /** Expression to evaluate (e.g., "price * quantity") */
1006
- expression: string;
1007
- /** Expected return type for formatting */
1008
- returnType: FormulaReturnType;
1009
- /** Decimal places for number results */
1010
- decimals?: number;
1011
- /** Whether to allow relation references in the expression (e.g., "company.name") */
1012
- allowRelations?: boolean;
1013
- /** Formula is always not required (read-only) */
1014
- required: false;
1015
- }
1016
- /**
1017
- * Aggregation functions for rollup attributes
1018
- *
1019
- * Categories:
1020
- * - Numeric (sum, avg): Only for number, currency, rating types
1021
- * - Date (earliest, latest): Only for date type
1022
- * - Count (count, countValues, countUniqueValues, countEmpty): Universal
1023
- * - Percent (percentEmpty, percentNotEmpty): Universal
1024
- * - Lookup (original): Returns all values as array, rendered as target type
1025
- */
1026
- type RollupFunction = "sum" | "avg" | "earliest" | "latest" | "count" | "countValues" | "countUniqueValues" | "countEmpty" | "percentEmpty" | "percentNotEmpty" | "original";
1027
- /**
1028
- * RollupAttribute - Aggregates values from related records
1029
- *
1030
- * Rollups are calculated and stored (denormalized) for performance.
1031
- * They are automatically recalculated when related records change.
1032
- * Users cannot directly edit rollup values.
1033
- *
1034
- * @example Sum of related amounts
1035
- * ```typescript
1036
- * rollup({ name: "totalOrders", label: "Total Orders" })
1037
- * .from("orders") // relation attribute name
1038
- * .aggregate("amount") // target attribute to sum
1039
- * .using("sum")
1040
- * .decimals(2)
1041
- * ```
1042
- *
1043
- * @example Count of related records
1044
- * ```typescript
1045
- * rollup({ name: "orderCount", label: "Number of Orders" })
1046
- * .from("orders")
1047
- * .using("count")
1048
- * ```
1049
- */
1050
- interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "required"> {
1051
- type: "rollup";
1052
- /** Name of the relation attribute on this object */
1053
- relationAttribute: string;
1054
- /**
1055
- * Dot notation path for multi-level traversal (Phase 4+)
1056
- * @example "orders.items" - traverse through orders to items
1057
- */
1058
- relationPath?: string;
1059
- /** Attribute name on the target object to aggregate */
1060
- targetAttribute: string;
1061
- /** Aggregation function to apply */
1062
- function: RollupFunction;
1063
- /** Decimal places for numeric results */
1064
- decimals?: number;
1065
- /** Rollup is always not required (read-only) */
1066
- required: false;
1067
- /**
1068
- * Cached type of the target attribute for display purposes
1069
- * Used when function="original" to render values as the target type
1070
- */
1071
- targetAttributeType?: AttributeType;
1072
- /**
1073
- * Cached options from target attribute (for select/status/multiselect display)
1074
- * Required when function="original" and target is a select-like type
1075
- */
1076
- targetAttributeOptions?: Option[];
1077
- }
1078
- /**
1079
- * DocumentAttribute - References one or multiple documents with templates.
1080
- *
1081
- * Unlike FileAttribute which stores raw file references, DocumentAttribute
1082
- * provides structured document handling with templates, multi-file support,
1083
- * and automatic processing (OCR, signature, identity verification).
1084
- *
1085
- * @example Single document with template choice
1086
- * ```typescript
1087
- * document({ name: "identityDocument", label: "Pièce d'identité" })
1088
- * .templates(["french_id_card", "passport"])
1089
- * .autoProcess()
1090
- * .required()
1091
- * ```
1092
- *
1093
- * @example Multiple documents with fixed template
1094
- * ```typescript
1095
- * document({ name: "contracts", label: "Contrats" })
1096
- * .template("signable_contract")
1097
- * .multiple()
1098
- * .maxDocuments(10)
1099
- * ```
1100
- */
1101
- interface DocumentAttribute extends BaseAttribute<string | string[]> {
1102
- type: "document";
1103
- /**
1104
- * Single template ID (strict mode).
1105
- * If set, only documents using this template can be attached.
1106
- */
1107
- templateId?: string;
1108
- /**
1109
- * Multiple allowed template IDs.
1110
- * User can choose which template to use when uploading.
1111
- */
1112
- allowedTemplates?: string[];
1113
- /**
1114
- * Allow multiple documents.
1115
- * If true, value is string[] (document IDs).
1116
- * If false/undefined, value is string (single document ID).
1117
- */
1118
- multiple?: boolean;
1119
- /**
1120
- * Maximum number of documents when multiple: true.
1121
- */
1122
- maxDocuments?: number;
1123
- /**
1124
- * Automatically trigger processing (OCR, verification) on upload.
1125
- */
1126
- autoProcess?: boolean;
1127
- }
1128
- type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
1129
-
1130
583
  /**
1131
584
  * Type of resource that can be audited
1132
585
  */
@@ -1386,186 +839,6 @@ interface PendingDocumentRequest {
1386
839
  /** File size in bytes (when completed) */
1387
840
  size?: number;
1388
841
  }
1389
- /**
1390
- * Check if a template source is PDF type
1391
- */
1392
- declare function isPdfTemplateSource(source: TemplateSource): source is Extract<TemplateSource, {
1393
- type: "pdf";
1394
- }>;
1395
- /**
1396
- * Check if a template source is DOCX type
1397
- */
1398
- declare function isDocxTemplateSource(source: TemplateSource): source is Extract<TemplateSource, {
1399
- type: "docx";
1400
- }>;
1401
-
1402
- /**
1403
- * Timestamps for tracking creation and updates
1404
- */
1405
- interface Timestamps {
1406
- createdAt: Date;
1407
- updatedAt: Date;
1408
- }
1409
- /**
1410
- * Sharing mode for multi-tenant object access.
1411
- *
1412
- * - `private`: Object is only visible to its owner tenant (default)
1413
- * - `shared`: Object is readable by all tenants, but only writable by the owner tenant
1414
- *
1415
- * Records inherit the sharing mode of their parent object.
1416
- */
1417
- type SharingMode = "private" | "shared";
1418
- /**
1419
- * Object definition - Represents a database table/entity
1420
- */
1421
- interface ObjectDefinition {
1422
- id?: Uuid;
1423
- name: string;
1424
- label: string;
1425
- pluralLabel?: string;
1426
- description?: string;
1427
- icon?: IconName;
1428
- /**
1429
- * Template expression used to compute the object's display label.
1430
- * Supports variable interpolation and pipes for formatting.
1431
- *
1432
- * @example
1433
- * ```typescript
1434
- * // Simple attribute reference
1435
- * labelExpression: "{{ name }}"
1436
- *
1437
- * // Multiple attributes
1438
- * labelExpression: "{{ firstName }} {{ lastName }}"
1439
- *
1440
- * // With pipes for formatting
1441
- * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
1442
- * ```
1443
- *
1444
- * Available pipes: UPPER, LOWER, capitalize, trim
1445
- */
1446
- labelExpression: string;
1447
- attributes: Attribute[];
1448
- system?: boolean;
1449
- /**
1450
- * Sharing mode for multi-tenant access.
1451
- * - `private`: Only visible to the owner tenant (default)
1452
- * - `shared`: Readable by all tenants, writable only by the owner
1453
- *
1454
- * Records inherit the sharing mode of their parent object.
1455
- * @default "private"
1456
- */
1457
- sharingMode?: SharingMode;
1458
- metadata?: Record<string, unknown>;
1459
- }
1460
- /**
1461
- * Links an attribute to an object
1462
- */
1463
- interface ObjectAttribute {
1464
- objectId: Uuid;
1465
- attributeId: Uuid;
1466
- order?: number;
1467
- required?: boolean;
1468
- }
1469
- /**
1470
- * Completion status of a record based on data completeness.
1471
- *
1472
- * - `draft`: Record is missing one or more required attribute values.
1473
- * Can be saved but is considered incomplete.
1474
- * - `complete`: All required attribute values are present and valid.
1475
- * Record is ready for use.
1476
- *
1477
- * This is different from workflow status (e.g., "pending", "approved").
1478
- * Completion status is computed dynamically based on the object schema.
1479
- */
1480
- type CompletionStatus = "draft" | "complete";
1481
- /**
1482
- * Record - Instance of an Object (a row in the database)
1483
- */
1484
- interface ObjectRecord extends Timestamps {
1485
- id: Uuid;
1486
- objectId: Uuid;
1487
- /**
1488
- * Display label computed from the object's labelExpression.
1489
- * Computed dynamically based on record values.
1490
- *
1491
- * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
1492
- */
1493
- label: string;
1494
- /**
1495
- * Completion status of the record.
1496
- * - `draft`: Missing required values, record is incomplete
1497
- * - `complete`: All required values present and valid
1498
- *
1499
- * Computed dynamically based on the object's schema.
1500
- */
1501
- completionStatus: CompletionStatus;
1502
- values: Record<string, unknown>;
1503
- /**
1504
- * Custom metadata for the record.
1505
- * Use this for UI/UX state, feature flags, or any application-specific data.
1506
- * Unlike system fields (id, createdAt, updatedAt), metadata can be updated.
1507
- */
1508
- metadata?: Record<string, unknown>;
1509
- /**
1510
- * Soft delete timestamp.
1511
- * If set, the record is considered deleted but can be restored.
1512
- * Queries exclude soft-deleted records by default.
1513
- */
1514
- deletedAt?: Date | null;
1515
- /**
1516
- * User ID who created this record.
1517
- * Automatically set by RecordService when userId is configured.
1518
- * Optional for backward compatibility with existing records.
1519
- */
1520
- createdBy?: string;
1521
- /**
1522
- * User ID who last updated this record.
1523
- * Automatically set by RecordService when userId is configured.
1524
- * Optional for backward compatibility with existing records.
1525
- */
1526
- lastUpdatedBy?: string;
1527
- }
1528
- /**
1529
- * System-managed field names on ObjectRecord.
1530
- * These are stored as SQL columns (not in JSONB `values`).
1531
- *
1532
- * Use this in adapters to determine if a filter/sort attribute is a table column
1533
- * vs. a JSONB value field.
1534
- *
1535
- * @example
1536
- * ```typescript
1537
- * if (SYSTEM_FIELD_NAMES.includes(filter.attribute)) {
1538
- * // Filter on SQL column (e.g., WHERE created_at > ...)
1539
- * } else {
1540
- * // Filter on JSONB field (e.g., WHERE values->>'name' = ...)
1541
- * }
1542
- * ```
1543
- */
1544
- declare const SYSTEM_FIELD_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy"];
1545
- /**
1546
- * Type for system field names
1547
- */
1548
- type SystemFieldName = (typeof SYSTEM_FIELD_NAMES)[number];
1549
- /**
1550
- * Reserved attribute names that cannot be used for custom attributes.
1551
- * These names conflict with ObjectRecord properties.
1552
- *
1553
- * Includes:
1554
- * - System fields (id, createdAt, updatedAt, createdBy, lastUpdatedBy)
1555
- * - Other ObjectRecord properties (objectId, label, completionStatus, values, metadata, deletedAt)
1556
- *
1557
- * @example
1558
- * ```typescript
1559
- * if (RESERVED_ATTRIBUTE_NAMES.includes(attributeName)) {
1560
- * throw new Error(`"${attributeName}" is a reserved name`);
1561
- * }
1562
- * ```
1563
- */
1564
- declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt", "createdBy", "lastUpdatedBy", "objectId", "label", "completionStatus", "values", "metadata", "deletedAt"];
1565
- /**
1566
- * Type for reserved attribute names
1567
- */
1568
- type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
1569
842
 
1570
843
  /**
1571
844
  * DocumentTemplate defines the structure and processing rules for a document type.
@@ -2077,19 +1350,6 @@ interface AdvancedFilterState {
2077
1350
  /** List of filter groups */
2078
1351
  groups: FilterGroup[];
2079
1352
  }
2080
- /**
2081
- * Type guard to check if a filter state is advanced
2082
- */
2083
- declare function isAdvancedFilterState(state: FilterState | AdvancedFilterState): state is AdvancedFilterState;
2084
- /**
2085
- * Convert simple filter state to advanced filter state
2086
- */
2087
- declare function toAdvancedFilterState(state: FilterState): AdvancedFilterState;
2088
- /**
2089
- * Convert advanced filter state to simple filter state (flattens groups)
2090
- * Note: This loses group structure - use with caution
2091
- */
2092
- declare function toSimpleFilterState(state: AdvancedFilterState): FilterState;
2093
1353
  /** Sort direction */
2094
1354
  type SortDirection = "asc" | "desc";
2095
1355
  /** A single sort rule */
@@ -3048,10 +2308,6 @@ declare function getContextValue(context: WorkflowExecutionContext, path: string
3048
2308
  * ```
3049
2309
  */
3050
2310
  declare function setContextValue(context: WorkflowExecutionContext, path: string, value: unknown): void;
3051
- /**
3052
- * Merge form data into slot record
3053
- */
3054
- declare function mergeFormToSlot(context: WorkflowExecutionContext, nodeId: string, slotId: string): void;
3055
2311
 
3056
2312
  /**
3057
2313
  * All supported comparison operators for condition rules
@@ -3148,14 +2404,6 @@ declare function or(...rules: Array<ConditionRule | ConditionGroup>): ConditionG
3148
2404
  * Create an "in" condition (value in array)
3149
2405
  */
3150
2406
  declare function inValues(field: string, values: unknown[]): ConditionRule;
3151
- /**
3152
- * Create an isEmpty condition
3153
- */
3154
- declare function isEmpty(field: string): ConditionRule;
3155
- /**
3156
- * Create an isNotEmpty condition
3157
- */
3158
- declare function isNotEmpty(field: string): ConditionRule;
3159
2407
 
3160
2408
  /**
3161
2409
  * Base properties shared by all workflow nodes
@@ -3769,6 +3017,10 @@ declare function canResumeInstance(instance: WorkflowInstance): boolean;
3769
3017
  */
3770
3018
  declare function createStartTransition(startNodeId: string, startedBy: string): WorkflowTransition;
3771
3019
 
3020
+ /**
3021
+ * Type of view - determines the config structure
3022
+ */
3023
+ type ViewType = "detail" | "list" | "calendar" | "timeline" | "gallery";
3772
3024
  /**
3773
3025
  * Inline attribute group configuration
3774
3026
  * Groups multiple attributes into a single composite field with dropdown editing
@@ -3827,8 +3079,6 @@ interface BaseTab {
3827
3079
  label: string;
3828
3080
  icon?: IconName;
3829
3081
  order?: number;
3830
- /** If true, tab is defined by developer (protected) */
3831
- system?: boolean;
3832
3082
  }
3833
3083
  /**
3834
3084
  * Form tab - displays attributes organized in groups
@@ -3859,14 +3109,6 @@ interface TableTabBase extends BaseTab {
3859
3109
  * Direct table tab - displays records from a relation attribute on the current object
3860
3110
  *
3861
3111
  * @example Project.members → shows Users linked via the "members" relation
3862
- * ```typescript
3863
- * {
3864
- * type: "table",
3865
- * relationMode: "direct",
3866
- * relationAttribute: "members",
3867
- * columns: ["name", "email"]
3868
- * }
3869
- * ```
3870
3112
  */
3871
3113
  interface DirectTableTab extends TableTabBase {
3872
3114
  relationMode: "direct";
@@ -3877,15 +3119,6 @@ interface DirectTableTab extends TableTabBase {
3877
3119
  * Inverse table tab - displays records from another object that have a relation to us
3878
3120
  *
3879
3121
  * @example Contact.company → on Company, shows Contacts that point to this Company
3880
- * ```typescript
3881
- * {
3882
- * type: "table",
3883
- * relationMode: "inverse",
3884
- * sourceObject: "contacts",
3885
- * relationAttribute: "company",
3886
- * columns: ["firstName", "lastName", "email"]
3887
- * }
3888
- * ```
3889
3122
  */
3890
3123
  interface InverseTableTab extends TableTabBase {
3891
3124
  relationMode: "inverse";
@@ -3896,7 +3129,6 @@ interface InverseTableTab extends TableTabBase {
3896
3129
  }
3897
3130
  /**
3898
3131
  * Table tab - displays related records in a table
3899
- * Discriminated union by relationMode for type-safe configuration
3900
3132
  */
3901
3133
  type TableTab = DirectTableTab | InverseTableTab;
3902
3134
  /**
@@ -3919,21 +3151,6 @@ interface ActivityTab extends BaseTab {
3919
3151
  }
3920
3152
  /**
3921
3153
  * Notes tab - displays notes linked to the current record
3922
- *
3923
- * Shows all notes where linked_object_name matches the current object
3924
- * and linked_record_id matches the current record ID.
3925
- * Respects visibility rules (private notes only visible to author).
3926
- *
3927
- * @example
3928
- * ```typescript
3929
- * {
3930
- * type: "notes",
3931
- * id: "notes",
3932
- * name: "notes",
3933
- * label: "Notes",
3934
- * allowCreate: true
3935
- * }
3936
- * ```
3937
3154
  */
3938
3155
  interface NotesTab extends BaseTab {
3939
3156
  type: "notes";
@@ -3944,22 +3161,6 @@ interface NotesTab extends BaseTab {
3944
3161
  }
3945
3162
  /**
3946
3163
  * Flows tab - displays workflow instances linked to the current record
3947
- *
3948
- * Uses record.metadata.createdByWorkflow to find linked instances.
3949
- * Allows launching new instances from published workflows that have
3950
- * a slot matching the current object.
3951
- *
3952
- * @example
3953
- * ```typescript
3954
- * {
3955
- * type: "flows",
3956
- * id: "workflows",
3957
- * name: "workflows",
3958
- * label: "Workflows",
3959
- * allowStart: true,
3960
- * allowCancel: true
3961
- * }
3962
- * ```
3963
3164
  */
3964
3165
  interface FlowsTab extends BaseTab {
3965
3166
  type: "flows";
@@ -3974,25 +3175,6 @@ interface FlowsTab extends BaseTab {
3974
3175
  }
3975
3176
  /**
3976
3177
  * Documents tab - displays all documents attached to the record
3977
- *
3978
- * Shows documents from:
3979
- * - Document attributes defined on the object
3980
- * - System `attachments` attribute (free-form documents)
3981
- *
3982
- * Allows uploading new documents either to a specific attribute or as attachments.
3983
- *
3984
- * @example
3985
- * ```typescript
3986
- * {
3987
- * type: "documents",
3988
- * id: "documents",
3989
- * name: "documents",
3990
- * label: "Documents",
3991
- * allowUpload: true,
3992
- * allowRemove: true,
3993
- * showProcessing: true
3994
- * }
3995
- * ```
3996
3178
  */
3997
3179
  interface DocumentsTab extends BaseTab {
3998
3180
  type: "documents";
@@ -4008,36 +3190,118 @@ interface DocumentsTab extends BaseTab {
4008
3190
  hideAttachments?: boolean;
4009
3191
  }
4010
3192
  /**
4011
- * Union of all tab types
3193
+ * Union of all tab types (for detail views)
3194
+ */
3195
+ type Tab = FormTab | TableTab | CustomTab | ActivityTab | NotesTab | FlowsTab | DocumentsTab;
3196
+ /**
3197
+ * Detail view layout mode
3198
+ * - `page`: Full view with multiple tabs
3199
+ * - `modal`: Simplified view for modals (single FormTab, no tabs UI)
3200
+ */
3201
+ type DetailViewLayout = "page" | "modal";
3202
+ /**
3203
+ * List view layout mode
3204
+ * - `table`: Table/grid layout
3205
+ * - `kanban`: Kanban board layout (grouped by attribute)
3206
+ */
3207
+ type ListViewLayout = "table" | "kanban";
3208
+ /** @deprecated Use DetailViewLayout instead */
3209
+ type ViewLayout = DetailViewLayout;
3210
+ /**
3211
+ * Internal tab within a list view (filter preset)
3212
+ *
3213
+ * @example
3214
+ * ```typescript
3215
+ * const tabs: ViewTab[] = [
3216
+ * { id: "all", label: "All Contacts", default: true },
3217
+ * { id: "active", label: "Active", filters: { status: { eq: "active" } } },
3218
+ * { id: "mine", label: "My Contacts", filters: { assignee: { eq: "me" } } }
3219
+ * ];
3220
+ * ```
3221
+ */
3222
+ interface ViewTab {
3223
+ /** Unique identifier */
3224
+ id: string;
3225
+ /** Display label */
3226
+ label: string;
3227
+ /** Icon */
3228
+ icon?: IconName;
3229
+ /** Filter preset for this tab */
3230
+ filters?: FilterGroup;
3231
+ /** Default tab (shown on load) */
3232
+ default?: boolean;
3233
+ }
3234
+ /**
3235
+ * Configuration for detail views (RecordEditView)
3236
+ */
3237
+ interface DetailViewConfig {
3238
+ /** Layout mode */
3239
+ layout: DetailViewLayout;
3240
+ /** Tabs in this view */
3241
+ tabs: Tab[];
3242
+ }
3243
+ /**
3244
+ * Configuration for list views (RecordsView)
3245
+ */
3246
+ interface ListViewConfig {
3247
+ /** Layout mode */
3248
+ layout: ListViewLayout;
3249
+ /** Attribute names to display as columns */
3250
+ columns: string[];
3251
+ /** Column widths in pixels */
3252
+ columnSizing?: Record<string, number>;
3253
+ /** Default filters applied to the view */
3254
+ defaultFilters?: FilterGroup;
3255
+ /** Default sort rules */
3256
+ defaultSorts?: SortRule[];
3257
+ /** Attribute to group by (for kanban layout) */
3258
+ groupByAttribute?: string;
3259
+ /** Internal tabs (filter presets) */
3260
+ tabs?: ViewTab[];
3261
+ }
3262
+ /**
3263
+ * Configuration for calendar views (future)
3264
+ */
3265
+ interface CalendarViewConfig {
3266
+ /** Date attribute for positioning events */
3267
+ dateAttribute: string;
3268
+ /** End date attribute (for range events) */
3269
+ endDateAttribute?: string;
3270
+ /** Title attribute for event display */
3271
+ titleAttribute: string;
3272
+ /** Color attribute (status/select) */
3273
+ colorAttribute?: string;
3274
+ }
3275
+ /**
3276
+ * Configuration for timeline views (future)
4012
3277
  */
4013
- type Tab = FormTab | TableTab | CustomTab | ActivityTab | NotesTab | FlowsTab | DocumentsTab;
3278
+ interface TimelineViewConfig {
3279
+ /** Date attribute for timeline positioning */
3280
+ dateAttribute: string;
3281
+ /** Group by attribute */
3282
+ groupByAttribute?: string;
3283
+ }
4014
3284
  /**
4015
- * View layout mode
4016
- * - `page`: Full view with multiple tabs (form, table, activity, notes, custom)
4017
- * - `modal`: Simplified view for modals, single FormTab without tabs UI
3285
+ * Configuration for gallery views (future)
4018
3286
  */
4019
- type ViewLayout = "page" | "modal";
3287
+ interface GalleryViewConfig {
3288
+ /** Image attribute to display */
3289
+ imageAttribute: string;
3290
+ /** Title attribute */
3291
+ titleAttribute?: string;
3292
+ /** Columns per row */
3293
+ columnsPerRow?: number;
3294
+ }
4020
3295
  /**
4021
- * View definition - organizes object attributes into tabs/pages
4022
- *
4023
- * @example
4024
- * ```typescript
4025
- * const companyView: ViewDefinition = {
4026
- * name: "detail",
4027
- * label: "Company Detail",
4028
- * object: "companies",
4029
- * layout: "page",
4030
- * tabs: [
4031
- * { type: "form", name: "general", label: "Info", groups: [...] },
4032
- * { type: "table", relationMode: "inverse", sourceObject: "contacts", relationAttribute: "company", columns: [...] }
4033
- * ],
4034
- * default: true,
4035
- * system: true
4036
- * };
4037
- * ```
3296
+ * Union of all view configs
4038
3297
  */
4039
- interface ViewDefinition {
4040
- id?: Uuid;
3298
+ type ViewConfig = DetailViewConfig | ListViewConfig | CalendarViewConfig | TimelineViewConfig | GalleryViewConfig;
3299
+ /**
3300
+ * Base view properties shared by all view types
3301
+ */
3302
+ interface BaseViewDefinition {
3303
+ /** Unique identifier (UUID, assigned by database) */
3304
+ id?: string;
4041
3305
  /** Technical name (kebab-case) */
4042
3306
  name: string;
4043
3307
  /** Display label */
@@ -4048,22 +3312,100 @@ interface ViewDefinition {
4048
3312
  icon?: IconName;
4049
3313
  /** Object this view belongs to (object name) */
4050
3314
  object: string;
4051
- /**
4052
- * Layout mode for the view
4053
- * - `page`: Full view with multiple tabs
4054
- * - `modal`: Simplified view for modals (single FormTab, no tabs UI)
4055
- * @default "page"
4056
- */
4057
- layout?: ViewLayout;
4058
- /** Tabs in this view */
4059
- tabs: Tab[];
4060
- /** Default view for this object (per layout) */
3315
+ /** Default view for this object+type combination */
4061
3316
  default?: boolean;
4062
- /** System view (defined by developer, protected) */
4063
- system?: boolean;
4064
3317
  /** Extensible metadata */
4065
3318
  metadata?: Record<string, unknown>;
4066
3319
  }
3320
+ /**
3321
+ * Detail view definition
3322
+ */
3323
+ interface DetailViewDefinition extends BaseViewDefinition {
3324
+ type: "detail";
3325
+ config: DetailViewConfig;
3326
+ }
3327
+ /**
3328
+ * List view definition
3329
+ */
3330
+ interface ListViewDefinition extends BaseViewDefinition {
3331
+ type: "list";
3332
+ config: ListViewConfig;
3333
+ }
3334
+ /**
3335
+ * Calendar view definition (future)
3336
+ */
3337
+ interface CalendarViewDefinition extends BaseViewDefinition {
3338
+ type: "calendar";
3339
+ config: CalendarViewConfig;
3340
+ }
3341
+ /**
3342
+ * Timeline view definition (future)
3343
+ */
3344
+ interface TimelineViewDefinition extends BaseViewDefinition {
3345
+ type: "timeline";
3346
+ config: TimelineViewConfig;
3347
+ }
3348
+ /**
3349
+ * Gallery view definition (future)
3350
+ */
3351
+ interface GalleryViewDefinition extends BaseViewDefinition {
3352
+ type: "gallery";
3353
+ config: GalleryViewConfig;
3354
+ }
3355
+ /**
3356
+ * Unified view definition - discriminated union by type
3357
+ */
3358
+ type ViewDefinition = DetailViewDefinition | ListViewDefinition | CalendarViewDefinition | TimelineViewDefinition | GalleryViewDefinition;
3359
+ /**
3360
+ * Configuration overrides for user customizations
3361
+ * Only stores the delta from the source view
3362
+ */
3363
+ interface ConfigOverrides {
3364
+ tabs?: ViewTab[];
3365
+ hiddenTabIds?: string[];
3366
+ detailTabs?: Tab[];
3367
+ hiddenDetailTabIds?: string[];
3368
+ }
3369
+ /**
3370
+ * User customization overlay for a view
3371
+ * Stored per user, merged at runtime with the source view
3372
+ */
3373
+ interface ViewOverlay {
3374
+ /** Unique identifier */
3375
+ id: string;
3376
+ /** View ID this overlay applies to (UUID or virtual ID) */
3377
+ viewId: string;
3378
+ /** User ID who owns this overlay */
3379
+ userId: string;
3380
+ /** Configuration overrides (delta only) */
3381
+ configOverrides: ConfigOverrides;
3382
+ /** User's default view for this object (stored in overlay) */
3383
+ isUserDefault?: boolean;
3384
+ /** Created timestamp */
3385
+ createdAt: Date;
3386
+ /** Updated timestamp */
3387
+ updatedAt: Date;
3388
+ }
3389
+ /**
3390
+ * Check if a view is a detail view
3391
+ */
3392
+ declare function isDetailView(view: ViewDefinition): view is DetailViewDefinition;
3393
+ /**
3394
+ * Check if a view is a list view
3395
+ */
3396
+ declare function isListView(view: ViewDefinition): view is ListViewDefinition;
3397
+ /**
3398
+ * Check if a view is a calendar view
3399
+ */
3400
+ declare function isCalendarView(view: ViewDefinition): view is CalendarViewDefinition;
3401
+ /**
3402
+ * Check if a view is a timeline view
3403
+ */
3404
+ declare function isTimelineView(view: ViewDefinition): view is TimelineViewDefinition;
3405
+ /**
3406
+ * Check if a view is a gallery view
3407
+ */
3408
+ declare function isGalleryView(view: ViewDefinition): view is GalleryViewDefinition;
4067
3409
  /**
4068
3410
  * Check if a tab is a form tab
4069
3411
  */
@@ -4543,22 +3885,24 @@ interface FileListOptions extends ListOptions {
4543
3885
  visibility?: FileVisibility;
4544
3886
  }
4545
3887
  /**
4546
- * View as stored in database
3888
+ * Unified view as stored in database
3889
+ * Supports all view types (detail, list, calendar, etc.) via polymorphic config
4547
3890
  */
4548
3891
  interface DBView extends Timestamps {
4549
3892
  id: Uuid;
4550
3893
  tenantId: TenantId;
4551
3894
  objectId?: Uuid;
4552
3895
  objectName: string;
3896
+ /** View type discriminant */
3897
+ type: ViewType;
4553
3898
  name: string;
4554
3899
  label: string;
4555
3900
  description?: string;
4556
3901
  icon?: IconName;
4557
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
4558
- layout?: ViewLayout;
4559
- tabs: Tab[];
3902
+ /** Polymorphic configuration (DetailViewConfig, ListViewConfig, etc.) */
3903
+ config: ViewConfig;
3904
+ /** Default view for this object+type combination */
4560
3905
  default: boolean;
4561
- system: boolean;
4562
3906
  metadata?: Record<string, unknown>;
4563
3907
  }
4564
3908
  /**
@@ -4568,44 +3912,74 @@ interface DBView extends Timestamps {
4568
3912
  interface CreateDBView {
4569
3913
  objectId?: Uuid;
4570
3914
  objectName: string;
3915
+ type: ViewType;
4571
3916
  name: string;
4572
3917
  label: string;
4573
3918
  description?: string;
4574
3919
  icon?: IconName;
4575
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
4576
- layout?: ViewLayout;
4577
- tabs: Tab[];
3920
+ config: ViewConfig;
4578
3921
  default?: boolean;
4579
- system?: boolean;
4580
3922
  metadata?: Record<string, unknown>;
4581
3923
  }
3924
+ /**
3925
+ * Data for updating a view.
3926
+ */
4582
3927
  interface UpdateDBView {
4583
3928
  label?: string;
4584
3929
  description?: string;
4585
3930
  icon?: IconName;
4586
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
4587
- layout?: ViewLayout;
4588
- tabs?: Tab[];
3931
+ config?: ViewConfig;
4589
3932
  default?: boolean;
4590
3933
  metadata?: Record<string, unknown>;
4591
3934
  }
4592
3935
  /**
4593
- * Data for upserting a view.
3936
+ * Data for upserting a view (used by registry seeding).
4594
3937
  * Tenant ID is automatically set from the execution context.
4595
3938
  */
4596
3939
  interface UpsertDBView {
4597
3940
  objectName: string;
3941
+ type: ViewType;
4598
3942
  name: string;
4599
3943
  label: string;
4600
3944
  description?: string;
4601
3945
  icon?: IconName;
4602
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
4603
- layout?: ViewLayout;
4604
- tabs: Tab[];
3946
+ config: ViewConfig;
4605
3947
  default?: boolean;
4606
- system?: boolean;
4607
3948
  metadata?: Record<string, unknown>;
4608
3949
  }
3950
+ /**
3951
+ * View overlay as stored in database
3952
+ * Stores user-specific customizations (delta only)
3953
+ */
3954
+ interface DBViewOverlay extends Timestamps {
3955
+ id: Uuid;
3956
+ tenantId: TenantId;
3957
+ /** View ID this overlay applies to (UUID or virtual ID like "fallback:contacts:list") */
3958
+ viewId: string;
3959
+ /** User ID who owns this overlay */
3960
+ userId: string;
3961
+ /** Configuration overrides (delta only) */
3962
+ configOverrides: ConfigOverrides;
3963
+ /** User's default view for this object */
3964
+ isUserDefault?: boolean;
3965
+ }
3966
+ /**
3967
+ * Data for creating a view overlay.
3968
+ * Tenant ID is automatically set from the execution context.
3969
+ */
3970
+ interface CreateDBViewOverlay {
3971
+ viewId: string;
3972
+ userId: string;
3973
+ configOverrides: ConfigOverrides;
3974
+ isUserDefault?: boolean;
3975
+ }
3976
+ /**
3977
+ * Data for updating a view overlay.
3978
+ */
3979
+ interface UpdateDBViewOverlay {
3980
+ configOverrides?: ConfigOverrides;
3981
+ isUserDefault?: boolean;
3982
+ }
4609
3983
  /**
4610
3984
  * Workflow definition as stored in database.
4611
3985
  * Uses snake_case to match database column names.
@@ -5185,19 +4559,24 @@ declare class NativeObjectRegistryClass {
5185
4559
  declare const registry: NativeObjectRegistryClass;
5186
4560
 
5187
4561
  /**
5188
- * Registry for native view definitions
4562
+ * Registry for developer-defined view definitions
4563
+ *
4564
+ * Views registered here are defined by developers and synced to the database
4565
+ * at application startup. They serve as "source" views that users can customize
4566
+ * via overlays.
5189
4567
  *
5190
- * Views registered here are considered "system" views, defined by the developer.
5191
- * They are protected from modification by end-users and synced to the database
5192
- * at application startup.
4568
+ * Seeding behavior:
4569
+ * - INSERT if view doesn't exist in DB
4570
+ * - SKIP if view already exists (no overwrite)
4571
+ * - To force update: delete the view in DB, then restart app
5193
4572
  *
5194
4573
  * @example
5195
4574
  * ```typescript
5196
- * import { view, group, viewRegistry } from "@stndrds/schema";
4575
+ * import { detailView, group, viewRegistry } from "@stndrds/schema";
5197
4576
  *
5198
- * const COMPANY_DETAIL = view("detail", "Detail")
4577
+ * const COMPANY_DETAIL = detailView("detail", "Detail")
5199
4578
  * .for("companies")
5200
- * .system()
4579
+ * .default()
5201
4580
  * .tab("general", "Info")
5202
4581
  * .form(group("main", "Main").fields("name", "status"))
5203
4582
  * .build();
@@ -5208,11 +4587,11 @@ declare const registry: NativeObjectRegistryClass;
5208
4587
  declare class ViewRegistry {
5209
4588
  private views;
5210
4589
  private byObject;
4590
+ private byObjectAndType;
5211
4591
  /**
5212
- * Register a native view
4592
+ * Register a view
5213
4593
  * @param viewOrViews - Single view or array of views
5214
- * @throws Error if view is not marked as system
5215
- * @throws Error if view with same name already exists for the object
4594
+ * @throws Error if view with same name and type already exists for the object
5216
4595
  */
5217
4596
  register(viewOrViews: ViewDefinition | ViewDefinition[]): this;
5218
4597
  private registerSingle;
@@ -5221,13 +4600,17 @@ declare class ViewRegistry {
5221
4600
  */
5222
4601
  getByObjectName(objectName: string): ViewDefinition[];
5223
4602
  /**
5224
- * Get a specific view by object and view name
4603
+ * Get views for an object filtered by type
5225
4604
  */
5226
- get(objectName: string, viewName: string): ViewDefinition | undefined;
4605
+ getByObjectNameAndType(objectName: string, type: ViewType): ViewDefinition[];
4606
+ /**
4607
+ * Get a specific view by object, name, and type
4608
+ */
4609
+ get(objectName: string, viewName: string, type?: ViewType): ViewDefinition | undefined;
5227
4610
  /**
5228
4611
  * Get a view or throw if not found
5229
4612
  */
5230
- getOrThrow(objectName: string, viewName: string): ViewDefinition;
4613
+ getOrThrow(objectName: string, viewName: string, type?: ViewType): ViewDefinition;
5231
4614
  /**
5232
4615
  * Get all registered views
5233
4616
  */
@@ -5235,7 +4618,7 @@ declare class ViewRegistry {
5235
4618
  /**
5236
4619
  * Check if a view exists
5237
4620
  */
5238
- has(objectName: string, viewName: string): boolean;
4621
+ has(objectName: string, viewName: string, type?: ViewType): boolean;
5239
4622
  /**
5240
4623
  * Check if any views exist for an object
5241
4624
  */
@@ -5249,9 +4632,9 @@ declare class ViewRegistry {
5249
4632
  */
5250
4633
  listObjectNames(): string[];
5251
4634
  /**
5252
- * Get default view for an object (if any)
4635
+ * Get default view for an object and type
5253
4636
  */
5254
- getDefault(objectName: string): ViewDefinition | undefined;
4637
+ getDefault(objectName: string, type: ViewType): ViewDefinition | undefined;
5255
4638
  /**
5256
4639
  * Clear all registered views (for testing)
5257
4640
  */
@@ -5267,741 +4650,10 @@ declare class ViewRegistry {
5267
4650
  private makeKey;
5268
4651
  }
5269
4652
  /**
5270
- * Global registry for native views
4653
+ * Global registry for developer-defined views
5271
4654
  */
5272
4655
  declare const viewRegistry: ViewRegistry;
5273
4656
 
5274
- /**
5275
- * Validation messages for Zod validators.
5276
- * All functions receive the full Attribute to access label, type, etc.
5277
- * Can be customized for i18n support.
5278
- */
5279
- interface ValidationMessages {
5280
- required: (attr: Attribute) => string;
5281
- invalidType: (attr: Attribute, expected: string) => string;
5282
- minLength: (attr: Attribute, min: number) => string;
5283
- maxLength: (attr: Attribute, max: number) => string;
5284
- invalidPattern: (attr: Attribute) => string;
5285
- minValue: (attr: Attribute, min: number) => string;
5286
- maxValue: (attr: Attribute, max: number) => string;
5287
- mustBeInteger: (attr: Attribute) => string;
5288
- invalidDate: (attr: Attribute) => string;
5289
- invalidOption: (attr: Attribute, options: string[]) => string;
5290
- invalidId: (attr: Attribute) => string;
5291
- minItems: (attr: Attribute, min: number) => string;
5292
- maxItems: (attr: Attribute, max: number) => string;
5293
- invalidRichtext: (attr: Attribute) => string;
5294
- invalidPhone: (attr: Attribute) => string;
5295
- invalidCurrency: (attr: Attribute) => string;
5296
- invalidLocation: (attr: Attribute) => string;
5297
- }
5298
- declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
5299
- /**
5300
- * Text attribute config schema
5301
- */
5302
- declare const textConfigSchema: z.ZodObject<{
5303
- disabled: z.ZodOptional<z.ZodBoolean>;
5304
- placeholder: z.ZodOptional<z.ZodString>;
5305
- description: z.ZodOptional<z.ZodString>;
5306
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5307
- icon: z.ZodOptional<z.ZodString>;
5308
- order: z.ZodOptional<z.ZodNumber>;
5309
- hidden: z.ZodOptional<z.ZodBoolean>;
5310
- archived: z.ZodOptional<z.ZodBoolean>;
5311
- deprecated: z.ZodOptional<z.ZodBoolean>;
5312
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5313
- minLength: z.ZodOptional<z.ZodNumber>;
5314
- maxLength: z.ZodOptional<z.ZodNumber>;
5315
- pattern: z.ZodOptional<z.ZodString>;
5316
- }, z.core.$strip>;
5317
- /**
5318
- * Textarea attribute config schema
5319
- */
5320
- declare const textareaConfigSchema: z.ZodObject<{
5321
- disabled: z.ZodOptional<z.ZodBoolean>;
5322
- placeholder: z.ZodOptional<z.ZodString>;
5323
- description: z.ZodOptional<z.ZodString>;
5324
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5325
- icon: z.ZodOptional<z.ZodString>;
5326
- order: z.ZodOptional<z.ZodNumber>;
5327
- hidden: z.ZodOptional<z.ZodBoolean>;
5328
- archived: z.ZodOptional<z.ZodBoolean>;
5329
- deprecated: z.ZodOptional<z.ZodBoolean>;
5330
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5331
- }, z.core.$strip>;
5332
- /**
5333
- * Richtext attribute config schema
5334
- */
5335
- declare const richtextConfigSchema: z.ZodObject<{
5336
- disabled: z.ZodOptional<z.ZodBoolean>;
5337
- placeholder: z.ZodOptional<z.ZodString>;
5338
- description: z.ZodOptional<z.ZodString>;
5339
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5340
- icon: z.ZodOptional<z.ZodString>;
5341
- order: z.ZodOptional<z.ZodNumber>;
5342
- hidden: z.ZodOptional<z.ZodBoolean>;
5343
- archived: z.ZodOptional<z.ZodBoolean>;
5344
- deprecated: z.ZodOptional<z.ZodBoolean>;
5345
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5346
- features: z.ZodOptional<z.ZodArray<z.ZodEnum<{
5347
- headings: "headings";
5348
- bold: "bold";
5349
- italic: "italic";
5350
- lists: "lists";
5351
- links: "links";
5352
- images: "images";
5353
- codeBlocks: "codeBlocks";
5354
- tables: "tables";
5355
- }>>>;
5356
- }, z.core.$strip>;
5357
- /**
5358
- * Number attribute config schema
5359
- */
5360
- declare const numberConfigSchema: z.ZodObject<{
5361
- disabled: z.ZodOptional<z.ZodBoolean>;
5362
- placeholder: z.ZodOptional<z.ZodString>;
5363
- description: z.ZodOptional<z.ZodString>;
5364
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5365
- icon: z.ZodOptional<z.ZodString>;
5366
- order: z.ZodOptional<z.ZodNumber>;
5367
- hidden: z.ZodOptional<z.ZodBoolean>;
5368
- archived: z.ZodOptional<z.ZodBoolean>;
5369
- deprecated: z.ZodOptional<z.ZodBoolean>;
5370
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5371
- min: z.ZodOptional<z.ZodNumber>;
5372
- max: z.ZodOptional<z.ZodNumber>;
5373
- unit: z.ZodOptional<z.ZodEnum<{
5374
- percentage: "percentage";
5375
- integer: "integer";
5376
- decimal: "decimal";
5377
- }>>;
5378
- decimals: z.ZodOptional<z.ZodNumber>;
5379
- }, z.core.$strip>;
5380
- /**
5381
- * Checkbox attribute config schema
5382
- */
5383
- declare const checkboxConfigSchema: z.ZodObject<{
5384
- disabled: z.ZodOptional<z.ZodBoolean>;
5385
- placeholder: z.ZodOptional<z.ZodString>;
5386
- description: z.ZodOptional<z.ZodString>;
5387
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5388
- icon: z.ZodOptional<z.ZodString>;
5389
- order: z.ZodOptional<z.ZodNumber>;
5390
- hidden: z.ZodOptional<z.ZodBoolean>;
5391
- archived: z.ZodOptional<z.ZodBoolean>;
5392
- deprecated: z.ZodOptional<z.ZodBoolean>;
5393
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5394
- }, z.core.$strip>;
5395
- /**
5396
- * Date attribute config schema
5397
- */
5398
- declare const dateConfigSchema: z.ZodObject<{
5399
- disabled: z.ZodOptional<z.ZodBoolean>;
5400
- placeholder: z.ZodOptional<z.ZodString>;
5401
- description: z.ZodOptional<z.ZodString>;
5402
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5403
- icon: z.ZodOptional<z.ZodString>;
5404
- order: z.ZodOptional<z.ZodNumber>;
5405
- hidden: z.ZodOptional<z.ZodBoolean>;
5406
- archived: z.ZodOptional<z.ZodBoolean>;
5407
- deprecated: z.ZodOptional<z.ZodBoolean>;
5408
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5409
- dateFormat: z.ZodOptional<z.ZodEnum<{
5410
- short: "short";
5411
- long: "long";
5412
- full: "full";
5413
- relative: "relative";
5414
- }>>;
5415
- minDate: z.ZodOptional<z.ZodString>;
5416
- maxDate: z.ZodOptional<z.ZodString>;
5417
- }, z.core.$strip>;
5418
- /**
5419
- * Phone attribute config schema
5420
- */
5421
- declare const phoneConfigSchema: z.ZodObject<{
5422
- disabled: z.ZodOptional<z.ZodBoolean>;
5423
- placeholder: z.ZodOptional<z.ZodString>;
5424
- description: z.ZodOptional<z.ZodString>;
5425
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5426
- icon: z.ZodOptional<z.ZodString>;
5427
- order: z.ZodOptional<z.ZodNumber>;
5428
- hidden: z.ZodOptional<z.ZodBoolean>;
5429
- archived: z.ZodOptional<z.ZodBoolean>;
5430
- deprecated: z.ZodOptional<z.ZodBoolean>;
5431
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5432
- defaultCountryCode: z.ZodOptional<z.ZodString>;
5433
- }, z.core.$strip>;
5434
- /**
5435
- * Currency attribute config schema
5436
- */
5437
- declare const currencyConfigSchema: z.ZodObject<{
5438
- disabled: z.ZodOptional<z.ZodBoolean>;
5439
- placeholder: z.ZodOptional<z.ZodString>;
5440
- description: z.ZodOptional<z.ZodString>;
5441
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5442
- icon: z.ZodOptional<z.ZodString>;
5443
- order: z.ZodOptional<z.ZodNumber>;
5444
- hidden: z.ZodOptional<z.ZodBoolean>;
5445
- archived: z.ZodOptional<z.ZodBoolean>;
5446
- deprecated: z.ZodOptional<z.ZodBoolean>;
5447
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5448
- defaultCurrency: z.ZodOptional<z.ZodString>;
5449
- allowedCurrencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
5450
- }, z.core.$strip>;
5451
- /**
5452
- * Status attribute config schema
5453
- */
5454
- declare const statusConfigSchema: z.ZodObject<{
5455
- disabled: z.ZodOptional<z.ZodBoolean>;
5456
- placeholder: z.ZodOptional<z.ZodString>;
5457
- description: z.ZodOptional<z.ZodString>;
5458
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5459
- icon: z.ZodOptional<z.ZodString>;
5460
- order: z.ZodOptional<z.ZodNumber>;
5461
- hidden: z.ZodOptional<z.ZodBoolean>;
5462
- archived: z.ZodOptional<z.ZodBoolean>;
5463
- deprecated: z.ZodOptional<z.ZodBoolean>;
5464
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5465
- options: z.ZodArray<z.ZodObject<{
5466
- id: z.ZodString;
5467
- label: z.ZodString;
5468
- value: z.ZodString;
5469
- color: z.ZodOptional<z.ZodString>;
5470
- icon: z.ZodOptional<z.ZodString>;
5471
- description: z.ZodOptional<z.ZodString>;
5472
- group: z.ZodOptional<z.ZodEnum<{
5473
- in_progress: "in_progress";
5474
- idle: "idle";
5475
- finished: "finished";
5476
- }>>;
5477
- }, z.core.$strip>>;
5478
- }, z.core.$strip>;
5479
- /**
5480
- * Location attribute config schema
5481
- */
5482
- declare const locationConfigSchema: z.ZodObject<{
5483
- disabled: z.ZodOptional<z.ZodBoolean>;
5484
- placeholder: z.ZodOptional<z.ZodString>;
5485
- description: z.ZodOptional<z.ZodString>;
5486
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5487
- icon: z.ZodOptional<z.ZodString>;
5488
- order: z.ZodOptional<z.ZodNumber>;
5489
- hidden: z.ZodOptional<z.ZodBoolean>;
5490
- archived: z.ZodOptional<z.ZodBoolean>;
5491
- deprecated: z.ZodOptional<z.ZodBoolean>;
5492
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5493
- granularity: z.ZodEnum<{
5494
- full: "full";
5495
- address: "address";
5496
- city: "city";
5497
- state: "state";
5498
- country: "country";
5499
- coordinates: "coordinates";
5500
- }>;
5501
- enableAutocomplete: z.ZodOptional<z.ZodBoolean>;
5502
- enableMap: z.ZodOptional<z.ZodBoolean>;
5503
- defaultCountry: z.ZodOptional<z.ZodString>;
5504
- allowedCountries: z.ZodOptional<z.ZodArray<z.ZodString>>;
5505
- displayFormat: z.ZodOptional<z.ZodEnum<{
5506
- single_line: "single_line";
5507
- multi_line: "multi_line";
5508
- compact: "compact";
5509
- }>>;
5510
- }, z.core.$strip>;
5511
- /**
5512
- * Select attribute config schema
5513
- */
5514
- declare const selectConfigSchema: z.ZodObject<{
5515
- disabled: z.ZodOptional<z.ZodBoolean>;
5516
- placeholder: z.ZodOptional<z.ZodString>;
5517
- description: z.ZodOptional<z.ZodString>;
5518
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5519
- icon: z.ZodOptional<z.ZodString>;
5520
- order: z.ZodOptional<z.ZodNumber>;
5521
- hidden: z.ZodOptional<z.ZodBoolean>;
5522
- archived: z.ZodOptional<z.ZodBoolean>;
5523
- deprecated: z.ZodOptional<z.ZodBoolean>;
5524
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5525
- options: z.ZodArray<z.ZodObject<{
5526
- id: z.ZodString;
5527
- label: z.ZodString;
5528
- value: z.ZodString;
5529
- color: z.ZodOptional<z.ZodString>;
5530
- icon: z.ZodOptional<z.ZodString>;
5531
- description: z.ZodOptional<z.ZodString>;
5532
- group: z.ZodOptional<z.ZodEnum<{
5533
- in_progress: "in_progress";
5534
- idle: "idle";
5535
- finished: "finished";
5536
- }>>;
5537
- }, z.core.$strip>>;
5538
- }, z.core.$strip>;
5539
- /**
5540
- * Multiselect attribute config schema
5541
- */
5542
- declare const multiselectConfigSchema: z.ZodObject<{
5543
- disabled: z.ZodOptional<z.ZodBoolean>;
5544
- placeholder: z.ZodOptional<z.ZodString>;
5545
- description: z.ZodOptional<z.ZodString>;
5546
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5547
- icon: z.ZodOptional<z.ZodString>;
5548
- order: z.ZodOptional<z.ZodNumber>;
5549
- hidden: z.ZodOptional<z.ZodBoolean>;
5550
- archived: z.ZodOptional<z.ZodBoolean>;
5551
- deprecated: z.ZodOptional<z.ZodBoolean>;
5552
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5553
- options: z.ZodArray<z.ZodObject<{
5554
- id: z.ZodString;
5555
- label: z.ZodString;
5556
- value: z.ZodString;
5557
- color: z.ZodOptional<z.ZodString>;
5558
- icon: z.ZodOptional<z.ZodString>;
5559
- description: z.ZodOptional<z.ZodString>;
5560
- group: z.ZodOptional<z.ZodEnum<{
5561
- in_progress: "in_progress";
5562
- idle: "idle";
5563
- finished: "finished";
5564
- }>>;
5565
- }, z.core.$strip>>;
5566
- }, z.core.$strip>;
5567
- /**
5568
- * File attribute config schema
5569
- */
5570
- declare const fileConfigSchema: z.ZodObject<{
5571
- disabled: z.ZodOptional<z.ZodBoolean>;
5572
- placeholder: z.ZodOptional<z.ZodString>;
5573
- description: z.ZodOptional<z.ZodString>;
5574
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5575
- icon: z.ZodOptional<z.ZodString>;
5576
- order: z.ZodOptional<z.ZodNumber>;
5577
- hidden: z.ZodOptional<z.ZodBoolean>;
5578
- archived: z.ZodOptional<z.ZodBoolean>;
5579
- deprecated: z.ZodOptional<z.ZodBoolean>;
5580
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5581
- maxFiles: z.ZodOptional<z.ZodNumber>;
5582
- maxSize: z.ZodOptional<z.ZodNumber>;
5583
- allowedTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5584
- multiple: z.ZodOptional<z.ZodBoolean>;
5585
- }, z.core.$strip>;
5586
- /**
5587
- * User attribute config schema
5588
- */
5589
- declare const userConfigSchema: z.ZodObject<{
5590
- disabled: z.ZodOptional<z.ZodBoolean>;
5591
- placeholder: z.ZodOptional<z.ZodString>;
5592
- description: z.ZodOptional<z.ZodString>;
5593
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5594
- icon: z.ZodOptional<z.ZodString>;
5595
- order: z.ZodOptional<z.ZodNumber>;
5596
- hidden: z.ZodOptional<z.ZodBoolean>;
5597
- archived: z.ZodOptional<z.ZodBoolean>;
5598
- deprecated: z.ZodOptional<z.ZodBoolean>;
5599
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5600
- allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString>>;
5601
- multiple: z.ZodOptional<z.ZodBoolean>;
5602
- }, z.core.$strip>;
5603
- /**
5604
- * Relation attribute config schema
5605
- */
5606
- declare const relationConfigSchema: z.ZodObject<{
5607
- disabled: z.ZodOptional<z.ZodBoolean>;
5608
- placeholder: z.ZodOptional<z.ZodString>;
5609
- description: z.ZodOptional<z.ZodString>;
5610
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5611
- icon: z.ZodOptional<z.ZodString>;
5612
- order: z.ZodOptional<z.ZodNumber>;
5613
- hidden: z.ZodOptional<z.ZodBoolean>;
5614
- archived: z.ZodOptional<z.ZodBoolean>;
5615
- deprecated: z.ZodOptional<z.ZodBoolean>;
5616
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5617
- targets: z.ZodArray<z.ZodObject<{
5618
- object: z.ZodString;
5619
- displayTemplate: z.ZodOptional<z.ZodString>;
5620
- filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5621
- }, z.core.$strip>>;
5622
- cardinality: z.ZodEnum<{
5623
- one: "one";
5624
- many: "many";
5625
- }>;
5626
- minItems: z.ZodOptional<z.ZodNumber>;
5627
- maxItems: z.ZodOptional<z.ZodNumber>;
5628
- }, z.core.$strip>;
5629
- /**
5630
- * Rating attribute config schema
5631
- */
5632
- declare const ratingConfigSchema: z.ZodObject<{
5633
- disabled: z.ZodOptional<z.ZodBoolean>;
5634
- placeholder: z.ZodOptional<z.ZodString>;
5635
- description: z.ZodOptional<z.ZodString>;
5636
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5637
- icon: z.ZodOptional<z.ZodString>;
5638
- order: z.ZodOptional<z.ZodNumber>;
5639
- hidden: z.ZodOptional<z.ZodBoolean>;
5640
- archived: z.ZodOptional<z.ZodBoolean>;
5641
- deprecated: z.ZodOptional<z.ZodBoolean>;
5642
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5643
- max: z.ZodOptional<z.ZodNumber>;
5644
- iconType: z.ZodOptional<z.ZodEnum<{
5645
- number: "number";
5646
- heart: "heart";
5647
- star: "star";
5648
- thumbs: "thumbs";
5649
- }>>;
5650
- }, z.core.$strip>;
5651
- /**
5652
- * Formula attribute config schema
5653
- */
5654
- declare const formulaConfigSchema: z.ZodObject<{
5655
- disabled: z.ZodOptional<z.ZodBoolean>;
5656
- placeholder: z.ZodOptional<z.ZodString>;
5657
- description: z.ZodOptional<z.ZodString>;
5658
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5659
- icon: z.ZodOptional<z.ZodString>;
5660
- order: z.ZodOptional<z.ZodNumber>;
5661
- hidden: z.ZodOptional<z.ZodBoolean>;
5662
- archived: z.ZodOptional<z.ZodBoolean>;
5663
- deprecated: z.ZodOptional<z.ZodBoolean>;
5664
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5665
- expression: z.ZodString;
5666
- returnType: z.ZodEnum<{
5667
- number: "number";
5668
- boolean: "boolean";
5669
- text: "text";
5670
- date: "date";
5671
- }>;
5672
- decimals: z.ZodOptional<z.ZodNumber>;
5673
- allowRelations: z.ZodOptional<z.ZodBoolean>;
5674
- }, z.core.$strip>;
5675
- /**
5676
- * Rollup attribute config schema
5677
- */
5678
- declare const rollupConfigSchema: z.ZodObject<{
5679
- disabled: z.ZodOptional<z.ZodBoolean>;
5680
- placeholder: z.ZodOptional<z.ZodString>;
5681
- description: z.ZodOptional<z.ZodString>;
5682
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5683
- icon: z.ZodOptional<z.ZodString>;
5684
- order: z.ZodOptional<z.ZodNumber>;
5685
- hidden: z.ZodOptional<z.ZodBoolean>;
5686
- archived: z.ZodOptional<z.ZodBoolean>;
5687
- deprecated: z.ZodOptional<z.ZodBoolean>;
5688
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5689
- relationAttribute: z.ZodOptional<z.ZodString>;
5690
- relationPath: z.ZodOptional<z.ZodString>;
5691
- targetAttribute: z.ZodString;
5692
- function: z.ZodEnum<{
5693
- sum: "sum";
5694
- avg: "avg";
5695
- earliest: "earliest";
5696
- latest: "latest";
5697
- count: "count";
5698
- countValues: "countValues";
5699
- countUniqueValues: "countUniqueValues";
5700
- countEmpty: "countEmpty";
5701
- percentEmpty: "percentEmpty";
5702
- percentNotEmpty: "percentNotEmpty";
5703
- original: "original";
5704
- }>;
5705
- decimals: z.ZodOptional<z.ZodNumber>;
5706
- targetAttributeType: z.ZodOptional<z.ZodString>;
5707
- targetAttributeOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
5708
- id: z.ZodString;
5709
- label: z.ZodString;
5710
- value: z.ZodString;
5711
- color: z.ZodOptional<z.ZodString>;
5712
- icon: z.ZodOptional<z.ZodString>;
5713
- description: z.ZodOptional<z.ZodString>;
5714
- group: z.ZodOptional<z.ZodEnum<{
5715
- in_progress: "in_progress";
5716
- idle: "idle";
5717
- finished: "finished";
5718
- }>>;
5719
- }, z.core.$strip>>>;
5720
- }, z.core.$strip>;
5721
- /**
5722
- * Document attribute config schema
5723
- */
5724
- declare const documentConfigSchema: z.ZodObject<{
5725
- disabled: z.ZodOptional<z.ZodBoolean>;
5726
- placeholder: z.ZodOptional<z.ZodString>;
5727
- description: z.ZodOptional<z.ZodString>;
5728
- defaultValue: z.ZodOptional<z.ZodUnknown>;
5729
- icon: z.ZodOptional<z.ZodString>;
5730
- order: z.ZodOptional<z.ZodNumber>;
5731
- hidden: z.ZodOptional<z.ZodBoolean>;
5732
- archived: z.ZodOptional<z.ZodBoolean>;
5733
- deprecated: z.ZodOptional<z.ZodBoolean>;
5734
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5735
- templateId: z.ZodOptional<z.ZodString>;
5736
- allowedTemplates: z.ZodOptional<z.ZodArray<z.ZodString>>;
5737
- multiple: z.ZodOptional<z.ZodBoolean>;
5738
- maxDocuments: z.ZodOptional<z.ZodNumber>;
5739
- autoProcess: z.ZodOptional<z.ZodBoolean>;
5740
- }, z.core.$strip>;
5741
- /**
5742
- * Map of attribute type to config schema
5743
- */
5744
- declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
5745
- /**
5746
- * Get the config schema for a specific attribute type
5747
- */
5748
- declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
5749
- /**
5750
- * Validate attribute config for a specific type
5751
- * Returns the validated config with only allowed properties
5752
- */
5753
- declare function validateAttributeConfig(type: AttributeType, config: Record<string, unknown>): {
5754
- success: true;
5755
- data: Record<string, unknown>;
5756
- } | {
5757
- success: false;
5758
- errors: string[];
5759
- };
5760
- /**
5761
- * Validate and strip unknown properties from attribute config
5762
- * This ensures only allowed properties are stored in the database
5763
- */
5764
- declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
5765
- /**
5766
- * Safely parse attribute config, returning undefined for invalid configs
5767
- */
5768
- declare function safeParseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown> | undefined;
5769
- /**
5770
- * Create a Zod schema for a text attribute
5771
- */
5772
- declare function createTextValidator(attr: TextAttribute, messages?: ValidationMessages): z.ZodString;
5773
- /**
5774
- * Create a Zod schema for a number attribute
5775
- */
5776
- declare function createNumberValidator(attr: NumberAttribute, messages?: ValidationMessages): z.ZodNumber;
5777
- /**
5778
- * Create a Zod schema for a checkbox attribute
5779
- */
5780
- declare function createCheckboxValidator(_attr: CheckboxAttribute, _messages?: ValidationMessages): z.ZodBoolean;
5781
- /**
5782
- * Create a Zod schema for a date attribute
5783
- */
5784
- declare function createDateValidator(attr: DateAttribute, messages?: ValidationMessages): z.ZodTypeAny;
5785
- /**
5786
- * Create a Zod schema for a phone attribute
5787
- */
5788
- declare function createPhoneValidator(attr: PhoneAttribute, messages?: ValidationMessages): z.ZodType<{
5789
- countryCode: string;
5790
- phoneNumber: string;
5791
- }>;
5792
- /**
5793
- * Create a Zod schema for a currency attribute
5794
- */
5795
- declare function createCurrencyValidator(attr: CurrencyAttribute, messages?: ValidationMessages): z.ZodType<{
5796
- code: string;
5797
- value: number;
5798
- }>;
5799
- /**
5800
- * Create a Zod schema for a status attribute
5801
- */
5802
- declare function createStatusValidator(attr: StatusAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
5803
- /**
5804
- * Create a Zod schema for a select attribute
5805
- */
5806
- declare function createSelectValidator(attr: SelectAttribute, messages?: ValidationMessages): z.ZodEnum<Readonly<Record<string, string>>>;
5807
- /**
5808
- * Create a Zod schema for a multiselect attribute
5809
- */
5810
- declare function createMultiselectValidator(attr: MultiselectAttribute, messages?: ValidationMessages): z.ZodArray<z.ZodEnum<Readonly<Record<string, string>>>>;
5811
- /**
5812
- * Create a Zod schema for a location attribute
5813
- */
5814
- type LocationShape = {
5815
- address?: string;
5816
- address2?: string;
5817
- city?: string;
5818
- state?: string;
5819
- postalCode?: string;
5820
- country?: string;
5821
- latitude?: number;
5822
- longitude?: number;
5823
- };
5824
- declare function createLocationValidator(attr: LocationAttribute, messages?: ValidationMessages): z.ZodType<LocationShape>;
5825
- /**
5826
- * Create a Zod schema for a file attribute
5827
- * Supports both single file (UUID) and multiple files (array of UUIDs)
5828
- */
5829
- declare function createFileValidator(attr: FileAttribute, messages?: ValidationMessages): z.ZodTypeAny;
5830
- /**
5831
- * Create a Zod schema for a user attribute
5832
- * Supports both single user (UUID) and multiple users (array of UUIDs)
5833
- */
5834
- declare function createUserValidator(attr: UserAttribute, messages?: ValidationMessages): z.ZodTypeAny;
5835
- /**
5836
- * Create a Zod schema for a single relation attribute (cardinality: "one")
5837
- */
5838
- declare function createSingleRelationValidator(attr: SingleRelationAttribute, messages?: ValidationMessages): z.ZodUnion<[z.ZodUUID, z.ZodNull]>;
5839
- /**
5840
- * Create a Zod schema for a multi relation attribute (cardinality: "many")
5841
- */
5842
- declare function createMultiRelationValidator(attr: MultiRelationAttribute, messages?: ValidationMessages): z.ZodArray<z.ZodUUID>;
5843
- /**
5844
- * Create a Zod schema for a relation attribute
5845
- * Dispatches to single or multi validator based on cardinality
5846
- */
5847
- declare function createRelationValidator(attr: RelationAttribute, messages?: ValidationMessages): z.ZodUnion<[z.ZodUUID, z.ZodNull]> | z.ZodArray<z.ZodUUID>;
5848
- /**
5849
- * Create a Zod schema for a rating attribute
5850
- */
5851
- declare function createRatingValidator(attr: RatingAttribute, messages?: ValidationMessages): z.ZodNumber;
5852
- /**
5853
- * Create a Zod schema for a formula attribute.
5854
- * Formula attributes are read-only (computed at runtime).
5855
- * They accept any value during validation but are ignored during record creation/update.
5856
- */
5857
- declare function createFormulaValidator(_attr: FormulaAttribute, _messages?: ValidationMessages): z.ZodUnknown;
5858
- /**
5859
- * Create a Zod schema for a rollup attribute.
5860
- * Rollup attributes are read-only (computed from related records).
5861
- * They accept any value during validation but are ignored during record creation/update.
5862
- */
5863
- declare function createRollupValidator(_attr: RollupAttribute, _messages?: ValidationMessages): z.ZodUnknown;
5864
- /**
5865
- * Create a Zod schema for a textarea attribute.
5866
- * Validates that the value is a string.
5867
- */
5868
- declare function createTextAreaValidator(_attr: TextAreaAttribute, _messages?: ValidationMessages): z.ZodString;
5869
- /**
5870
- * Create a Zod schema for a richtext attribute.
5871
- * Validates semantic markdown content as a string.
5872
- *
5873
- * @example Valid richtext content (semantic markdown)
5874
- * ```typescript
5875
- * `# Heading
5876
- *
5877
- * Some paragraph text.
5878
- *
5879
- * :::callout{variant="info"}
5880
- * This is a callout block
5881
- * :::
5882
- * `
5883
- * ```
5884
- */
5885
- declare function createRichtextValidator(attr: RichtextAttribute, messages?: ValidationMessages): z.ZodTypeAny;
5886
- /**
5887
- * Create a Zod schema for any attribute type.
5888
- * Returns a strict validator that does NOT handle optional fields.
5889
- * Use createFormAttributeValidator for form validation with optional support.
5890
- *
5891
- * @param attr - The attribute to create a validator for
5892
- * @param messages - Custom validation messages for i18n support
5893
- */
5894
- declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
5895
- /**
5896
- * Create a Zod schema for form validation.
5897
- * - Normalizes empty values (empty strings, empty objects) to null for optional fields
5898
- * - Accepts custom messages for i18n support
5899
- *
5900
- * Use this in UI forms where optional fields may have null/undefined values.
5901
- *
5902
- * @param attr - The attribute to create a validator for
5903
- * @param messages - Custom validation messages for i18n support
5904
- */
5905
- declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
5906
- /**
5907
- * Create a Zod schema for an entire object
5908
- *
5909
- * Uses passthrough mode to allow computed fields (formula, rollup) that may be
5910
- * present in record data but are not part of the mutable schema.
5911
- */
5912
- declare function createObjectValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
5913
- /**
5914
- * Validation result
5915
- */
5916
- interface ValidationResult {
5917
- success: boolean;
5918
- data?: Record<string, unknown>;
5919
- errors?: Array<{
5920
- path: string[];
5921
- message: string;
5922
- }>;
5923
- }
5924
- /**
5925
- * Validate data against an attribute schema
5926
- */
5927
- declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
5928
- /**
5929
- * Validate data against an object schema
5930
- */
5931
- declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
5932
- /**
5933
- * Validate and throw if invalid
5934
- */
5935
- declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
5936
- /**
5937
- * Create a Zod schema for draft validation.
5938
- * All attributes become optional, but provided values are still validated.
5939
- *
5940
- * Uses passthrough mode to allow computed fields (formula, rollup) that may be
5941
- * present in record data but are not part of the mutable schema.
5942
- */
5943
- declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
5944
- /**
5945
- * Validate data in draft mode.
5946
- * - All attributes are treated as optional (no required validation)
5947
- * - Provided values are still validated for format/type correctness
5948
- *
5949
- * Use this when creating records that may be incomplete (drafts).
5950
- *
5951
- * @example
5952
- * ```typescript
5953
- * const result = validateDraft(PRODUCT, { name: "Draft" });
5954
- * // → success even if "price" is required but missing
5955
- *
5956
- * const result2 = validateDraft(PRODUCT, { price: -10 });
5957
- * // → fails because price must be >= 0 (format validation still applies)
5958
- * ```
5959
- */
5960
- declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
5961
- /**
5962
- * Validate draft data and throw if format validation fails.
5963
- */
5964
- declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
5965
- /**
5966
- * Get the list of required attributes that are missing values.
5967
- *
5968
- * @example
5969
- * ```typescript
5970
- * const missing = getMissingRequiredAttributes(PRODUCT, { name: "Test" });
5971
- * // → [priceAttribute, statusAttribute] if price and status are required but missing
5972
- * ```
5973
- */
5974
- declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
5975
- /**
5976
- * Check if a record is complete (all required attributes have valid values).
5977
- *
5978
- * @returns `true` if all required values are present and valid, `false` otherwise
5979
- */
5980
- declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
5981
- /**
5982
- * Compute the completion status of a record based on its data.
5983
- *
5984
- * - `"complete"`: All required values are present and valid
5985
- * - `"draft"`: One or more required values are missing or invalid
5986
- *
5987
- * This function is used to dynamically determine the status when
5988
- * creating or updating records.
5989
- *
5990
- * @example
5991
- * ```typescript
5992
- * const status = computeRecordStatus(PRODUCT, {
5993
- * name: "Nike Air Max",
5994
- * price: 129.99,
5995
- * status: "active"
5996
- * });
5997
- * // → "complete"
5998
- *
5999
- * const status2 = computeRecordStatus(PRODUCT, { name: "Draft Product" });
6000
- * // → "draft" (missing required fields)
6001
- * ```
6002
- */
6003
- declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
6004
-
6005
4657
  /**
6006
4658
  * Cache Adapter - Agnostic caching interface for @stndrds/schema
6007
4659
  *
@@ -6261,19 +4913,164 @@ declare const cacheTtl: {
6261
4913
  */
6262
4914
  declare const defaultTtl: Partial<Record<CacheKeyType, number>>;
6263
4915
  /**
6264
- * No-operation cache adapter that does nothing.
6265
- * Use this to disable caching entirely.
4916
+ * No-operation cache adapter that does nothing.
4917
+ * Use this to disable caching entirely.
4918
+ *
4919
+ * For a full-featured implementation, use @stndrds/cache-adapters.
4920
+ */
4921
+ declare class NoopCacheAdapter implements CacheAdapter {
4922
+ get<T>(): Promise<T | null>;
4923
+ set(): Promise<void>;
4924
+ delete(): Promise<void>;
4925
+ deletePattern(): Promise<void>;
4926
+ has(): Promise<boolean>;
4927
+ clear(): Promise<void>;
4928
+ getOrSet<T>(_key: string, fetcher: () => Promise<T>): Promise<T>;
4929
+ }
4930
+
4931
+ /**
4932
+ * Repository for unified views table.
4933
+ * Supports all view types (detail, list, calendar, etc.) via polymorphic config.
4934
+ *
4935
+ * All operations are automatically scoped to the current tenant
4936
+ * from the execution context (via AsyncLocalStorage).
4937
+ */
4938
+ interface ViewsRepository {
4939
+ /**
4940
+ * Find view by ID.
4941
+ * Automatically filtered by current tenant context.
4942
+ */
4943
+ findById(id: Uuid): Promise<DBView | null>;
4944
+ /**
4945
+ * Find view by name for an object.
4946
+ * Automatically filtered by current tenant context.
4947
+ */
4948
+ findByName(objectName: string, viewName: string): Promise<DBView | null>;
4949
+ /**
4950
+ * Find view by name and type for an object.
4951
+ * Automatically filtered by current tenant context.
4952
+ */
4953
+ findByNameAndType(objectName: string, viewName: string, type: ViewType): Promise<DBView | null>;
4954
+ /**
4955
+ * Find all views for an object.
4956
+ * Optionally filter by type.
4957
+ * Automatically filtered by current tenant context.
4958
+ */
4959
+ findByObjectName(objectName: string, type?: ViewType): Promise<DBView[]>;
4960
+ /**
4961
+ * Find all views for current tenant.
4962
+ * Optionally filter by type.
4963
+ * Automatically filtered by current tenant context.
4964
+ */
4965
+ findAllForTenant(type?: ViewType): Promise<DBView[]>;
4966
+ /**
4967
+ * Find default view for an object and type.
4968
+ * Returns the view marked as default, or null if none.
4969
+ */
4970
+ findDefault(objectName: string, type: ViewType): Promise<DBView | null>;
4971
+ /**
4972
+ * Create view.
4973
+ * Tenant ID is automatically set from context.
4974
+ */
4975
+ create(data: CreateDBView): Promise<DBView>;
4976
+ /**
4977
+ * Update view.
4978
+ * Automatically filtered by current tenant context.
4979
+ */
4980
+ update(id: Uuid, data: Partial<UpdateDBView>): Promise<DBView>;
4981
+ /**
4982
+ * Delete view.
4983
+ * Automatically filtered by current tenant context.
4984
+ */
4985
+ delete(id: Uuid): Promise<void>;
4986
+ /**
4987
+ * Delete views not in the list (for sync cleanup).
4988
+ * Automatically filtered by current tenant context.
4989
+ * @returns Number of deleted views
4990
+ */
4991
+ deleteNotIn(objectName: string, type: ViewType, keepViewNames: string[]): Promise<number>;
4992
+ /**
4993
+ * Upsert view (create or update based on objectName + name + type).
4994
+ * Used by registry seeding - skips if view already exists.
4995
+ * Tenant ID is automatically set from context.
4996
+ */
4997
+ upsert(data: UpsertDBView): Promise<DBView>;
4998
+ /**
4999
+ * Check if a view exists by name and type.
5000
+ * Used by registry seeding to skip existing views.
5001
+ */
5002
+ exists(objectName: string, viewName: string, type: ViewType): Promise<boolean>;
5003
+ }
5004
+ /**
5005
+ * Repository for view overlays (user customizations).
5006
+ * Stores delta/overrides per user, merged at runtime with source view.
6266
5007
  *
6267
- * For a full-featured implementation, use @stndrds/cache-adapters.
5008
+ * All operations are automatically scoped to the current tenant
5009
+ * from the execution context (via AsyncLocalStorage).
6268
5010
  */
6269
- declare class NoopCacheAdapter implements CacheAdapter {
6270
- get<T>(): Promise<T | null>;
6271
- set(): Promise<void>;
6272
- delete(): Promise<void>;
6273
- deletePattern(): Promise<void>;
6274
- has(): Promise<boolean>;
6275
- clear(): Promise<void>;
6276
- getOrSet<T>(_key: string, fetcher: () => Promise<T>): Promise<T>;
5011
+ interface ViewOverlaysRepository {
5012
+ /**
5013
+ * Find overlay by ID.
5014
+ * Automatically filtered by current tenant context.
5015
+ */
5016
+ findById(id: Uuid): Promise<DBViewOverlay | null>;
5017
+ /**
5018
+ * Find overlay for a view and user.
5019
+ * ViewId can be a UUID or a virtual fallback ID.
5020
+ */
5021
+ findByViewAndUser(viewId: string, userId: string): Promise<DBViewOverlay | null>;
5022
+ /**
5023
+ * Find all overlays for a user.
5024
+ */
5025
+ findByUser(userId: string): Promise<DBViewOverlay[]>;
5026
+ /**
5027
+ * Find all overlays for a view (all users).
5028
+ */
5029
+ findByView(viewId: string): Promise<DBViewOverlay[]>;
5030
+ /**
5031
+ * Find user's default view overlay for an object.
5032
+ * Returns the overlay where isUserDefault is true.
5033
+ */
5034
+ findUserDefault(userId: string, objectName: string, type: ViewType): Promise<DBViewOverlay | null>;
5035
+ /**
5036
+ * Create overlay.
5037
+ * Tenant ID is automatically set from context.
5038
+ */
5039
+ create(data: CreateDBViewOverlay): Promise<DBViewOverlay>;
5040
+ /**
5041
+ * Update overlay.
5042
+ * Automatically filtered by current tenant context.
5043
+ */
5044
+ update(id: Uuid, data: Partial<UpdateDBViewOverlay>): Promise<DBViewOverlay>;
5045
+ /**
5046
+ * Delete overlay.
5047
+ * Automatically filtered by current tenant context.
5048
+ */
5049
+ delete(id: Uuid): Promise<void>;
5050
+ /**
5051
+ * Delete overlay by view and user.
5052
+ * Used for "reset to default" functionality.
5053
+ */
5054
+ deleteByViewAndUser(viewId: string, userId: string): Promise<void>;
5055
+ /**
5056
+ * Delete all overlays for a view.
5057
+ * Called when a view is deleted (cascade).
5058
+ */
5059
+ deleteByView(viewId: string): Promise<number>;
5060
+ /**
5061
+ * Migrate overlays from one viewId to another.
5062
+ * Used when a fallback view becomes a real view.
5063
+ * @returns Number of migrated overlays
5064
+ */
5065
+ migrateViewId(fromViewId: string, toViewId: string): Promise<number>;
5066
+ /**
5067
+ * Upsert overlay (create or update based on viewId + userId).
5068
+ */
5069
+ upsert(data: CreateDBViewOverlay): Promise<DBViewOverlay>;
5070
+ /**
5071
+ * Clear user default for an object (before setting a new one).
5072
+ */
5073
+ clearUserDefault(userId: string, objectName: string, type: ViewType): Promise<void>;
6277
5074
  }
6278
5075
 
6279
5076
  /**
@@ -6482,70 +5279,6 @@ interface ObjectRecordsRepository {
6482
5279
  */
6483
5280
  findByRelation(objectId: Uuid, relationAttribute: string, targetId: Uuid): Promise<ObjectRecord[]>;
6484
5281
  }
6485
- /**
6486
- * Repository for views table.
6487
- *
6488
- * All operations are automatically scoped to the current tenant
6489
- * from the execution context (via AsyncLocalStorage).
6490
- */
6491
- interface ViewsRepository {
6492
- /**
6493
- * Find view by ID.
6494
- * Automatically filtered by current tenant context.
6495
- */
6496
- findById(id: Uuid): Promise<DBView | null>;
6497
- /**
6498
- * Find view by name for an object.
6499
- * Automatically filtered by current tenant context.
6500
- */
6501
- findByName(objectName: string, viewName: string): Promise<DBView | null>;
6502
- /**
6503
- * Find all views for an object.
6504
- * Automatically filtered by current tenant context.
6505
- */
6506
- findByObjectName(objectName: string): Promise<DBView[]>;
6507
- /**
6508
- * Find all views for current tenant.
6509
- * Automatically filtered by current tenant context.
6510
- */
6511
- findAllForTenant(): Promise<DBView[]>;
6512
- /**
6513
- * Find system view by name (for sync).
6514
- * System views are shared across tenants.
6515
- */
6516
- findSystemByName(objectName: string, viewName: string): Promise<DBView | null>;
6517
- /**
6518
- * Find all system views for an object.
6519
- * System views are shared across tenants.
6520
- */
6521
- findSystemByObjectName(objectName: string): Promise<DBView[]>;
6522
- /**
6523
- * Create view.
6524
- * Tenant ID is automatically set from context.
6525
- */
6526
- create(data: CreateDBView): Promise<DBView>;
6527
- /**
6528
- * Update view.
6529
- * Automatically filtered by current tenant context.
6530
- */
6531
- update(id: Uuid, data: Partial<UpdateDBView>): Promise<DBView>;
6532
- /**
6533
- * Delete view.
6534
- * Automatically filtered by current tenant context.
6535
- */
6536
- delete(id: Uuid): Promise<void>;
6537
- /**
6538
- * Delete views not in the list (for sync cleanup).
6539
- * Automatically filtered by current tenant context.
6540
- * @returns Number of deleted views
6541
- */
6542
- deleteNotIn(objectName: string, keepViewNames: string[]): Promise<number>;
6543
- /**
6544
- * Upsert view (create or update based on objectName + name).
6545
- * Tenant ID is automatically set from context.
6546
- */
6547
- upsert(data: UpsertDBView): Promise<DBView>;
6548
- }
6549
5282
 
6550
5283
  /**
6551
5284
  * Repository for user_profiles table.
@@ -7189,6 +5922,7 @@ interface DatabaseAdapter {
7189
5922
  objects: ObjectsRepository;
7190
5923
  attributes: AttributesRepository;
7191
5924
  views: ViewsRepository;
5925
+ viewOverlays: ViewOverlaysRepository;
7192
5926
  workflows?: WorkflowsRepository;
7193
5927
  workflowInstances?: WorkflowInstancesRepository;
7194
5928
  workflowInvitations?: WorkflowInvitationsRepository;
@@ -7208,6 +5942,7 @@ interface DatabaseAdapter {
7208
5942
  documentSlots?: DocumentSlotsRepository;
7209
5943
  documentJobs?: DocumentJobsRepository;
7210
5944
  documentGenerationTemplates?: DocumentGenerationTemplatesRepository;
5945
+ featureFlags?: FeatureFlagsRepository;
7211
5946
  transaction<T>(callback: (adapter: DatabaseAdapter) => Promise<T>): Promise<T>;
7212
5947
  }
7213
5948
 
@@ -8356,7 +7091,8 @@ declare class ObjectSchemaService extends BaseService {
8356
7091
  addAttributeToObject(objectId: string, attribute: AddAttributeInput): Promise<Attribute>;
8357
7092
  /**
8358
7093
  * Update an attribute.
8359
- * Can only update custom attributes (system=false).
7094
+ * Custom attributes can be fully updated.
7095
+ * System attributes can only have presentation properties modified (label, description, placeholder, icon).
8360
7096
  * Automatically uses tenant context from AsyncLocalStorage.
8361
7097
  *
8362
7098
  * @param attributeId - Attribute UUID
@@ -10100,6 +8836,131 @@ declare class TenantContextError extends Error {
10100
8836
  constructor(message?: string);
10101
8837
  }
10102
8838
 
8839
+ /**
8840
+ * Feature Flags Context Module
8841
+ *
8842
+ * Provides synchronous access to resolved feature flags using AsyncLocalStorage.
8843
+ * Flags are resolved once at request start and cached for the entire request.
8844
+ *
8845
+ * @example
8846
+ * ```typescript
8847
+ * // In NestJS interceptor (after tenant context)
8848
+ * runWithFeatureFlags(resolvedFlags, () => {
8849
+ * // All code here has synchronous access to flags
8850
+ * if (isFeatureEnabled("ai-features")) {
8851
+ * // Feature-gated code
8852
+ * }
8853
+ * });
8854
+ *
8855
+ * // Anywhere in code (sync!)
8856
+ * const hasAI = isFeatureEnabled("ai-features");
8857
+ * const tier = getFeatureValue("tier", "free");
8858
+ * ```
8859
+ */
8860
+ /**
8861
+ * Immutable feature flags context stored in AsyncLocalStorage.
8862
+ *
8863
+ * This context contains all resolved flag values for the current request
8864
+ * and is frozen to prevent modification after creation.
8865
+ */
8866
+ interface FeatureFlagsContext {
8867
+ /** Resolved flags map (flagName → value) */
8868
+ readonly flags: ReadonlyMap<string, unknown>;
8869
+ }
8870
+ /**
8871
+ * Error thrown when code tries to access feature flags without a context.
8872
+ */
8873
+ declare class FeatureFlagsContextError extends Error {
8874
+ constructor(message?: string);
8875
+ }
8876
+ /**
8877
+ * Check if a boolean flag is enabled.
8878
+ *
8879
+ * @param flagName - The name of the flag to check
8880
+ * @returns true if the flag value is exactly `true`, false otherwise
8881
+ * @throws {FeatureFlagsContextError} If no context is set
8882
+ *
8883
+ * @example
8884
+ * ```typescript
8885
+ * if (isFeatureEnabled("architect-mode")) {
8886
+ * // Show architect mode toggle
8887
+ * }
8888
+ * ```
8889
+ */
8890
+ declare function isFeatureEnabled(flagName: string): boolean;
8891
+ /**
8892
+ * Get the value of a flag with type safety.
8893
+ *
8894
+ * @param flagName - The name of the flag
8895
+ * @param defaultValue - Value to return if flag is not set
8896
+ * @returns The flag value or the default value
8897
+ * @throws {FeatureFlagsContextError} If no context is set
8898
+ *
8899
+ * @example
8900
+ * ```typescript
8901
+ * const tier = getFeatureValue("tier", "free");
8902
+ * if (tier === "enterprise") {
8903
+ * // Show enterprise features
8904
+ * }
8905
+ * ```
8906
+ */
8907
+ declare function getFeatureValue<T>(flagName: string, defaultValue: T): T;
8908
+ /**
8909
+ * Get all resolved flags.
8910
+ *
8911
+ * @returns ReadonlyMap of all flag names to their resolved values
8912
+ * @throws {FeatureFlagsContextError} If no context is set
8913
+ */
8914
+ declare function getFeatureFlags(): ReadonlyMap<string, unknown>;
8915
+ /**
8916
+ * Try to get the value of a flag without throwing.
8917
+ *
8918
+ * Use this for optional feature flag checks where you want to
8919
+ * gracefully handle the absence of a context.
8920
+ *
8921
+ * @param flagName - The name of the flag
8922
+ * @returns The flag value or undefined if no context or flag not found
8923
+ *
8924
+ * @example
8925
+ * ```typescript
8926
+ * // Optional enhancement - doesn't fail if no context
8927
+ * const tier = tryGetFeatureValue<string>("tier");
8928
+ * if (tier === "enterprise") {
8929
+ * // Enhance with enterprise features
8930
+ * }
8931
+ * ```
8932
+ */
8933
+ declare function tryGetFeatureValue<T>(flagName: string): T | undefined;
8934
+ /**
8935
+ * Check if a feature flags context is currently set.
8936
+ *
8937
+ * @returns true if a context is set, false otherwise
8938
+ *
8939
+ * @example
8940
+ * ```typescript
8941
+ * if (hasFeatureFlagsContext()) {
8942
+ * // Safe to call isFeatureEnabled()
8943
+ * }
8944
+ * ```
8945
+ */
8946
+ declare function hasFeatureFlagsContext(): boolean;
8947
+ /**
8948
+ * Execute a synchronous function within a feature flags context.
8949
+ */
8950
+ declare function runWithFeatureFlags<T>(flags: Map<string, unknown>, fn: () => T): T;
8951
+ /**
8952
+ * Execute an async function within a feature flags context.
8953
+ */
8954
+ declare function runWithFeatureFlags<T>(flags: Map<string, unknown>, fn: () => Promise<T>): Promise<T>;
8955
+ /**
8956
+ * Convenience helper for NestJS interceptor.
8957
+ *
8958
+ * @param resolvedFlags - Map of resolved flag values
8959
+ * @param fn - The async function to execute
8960
+ * @returns A promise that resolves to the function's return value
8961
+ */
8962
+ declare function withFeatureFlags<T>(resolvedFlags: Map<string, unknown>, fn: () => Promise<T>): Promise<T>;
8963
+
10103
8964
  /**
10104
8965
  * Schema Context Module
10105
8966
  *
@@ -10972,6 +9833,7 @@ interface MockStores {
10972
9833
  files: Map<Uuid, File>;
10973
9834
  objectRecords: Map<Uuid, InternalObjectRecord>;
10974
9835
  views: Map<Uuid, DBView>;
9836
+ viewOverlays: Map<Uuid, DBViewOverlay>;
10975
9837
  roles: Map<Uuid, Role>;
10976
9838
  permissions: Map<Uuid, Permission>;
10977
9839
  userRoles: Map<Uuid, UserRoleAssignment>;
@@ -12257,7 +11119,7 @@ declare class WorkflowInvitationService extends BaseService {
12257
11119
  }
12258
11120
 
12259
11121
  /**
12260
- * Result of checking if a field is read-only
11122
+ * Result of checking if a field is read-only (internal use only)
12261
11123
  */
12262
11124
  interface FieldReadOnlyResult {
12263
11125
  /** Whether the field is read-only */
@@ -12998,17 +11860,16 @@ declare class GlobalSearchService extends BaseService {
12998
11860
  }
12999
11861
 
13000
11862
  /**
13001
- * Input for creating a custom view
11863
+ * Input for creating a view (Architect Mode)
13002
11864
  */
13003
11865
  interface CreateViewInput {
11866
+ objectName: string;
11867
+ type: ViewType;
13004
11868
  name: string;
13005
11869
  label: string;
13006
- objectName: string;
13007
11870
  description?: string;
13008
11871
  icon?: IconName;
13009
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
13010
- layout?: ViewLayout;
13011
- tabs?: Tab[];
11872
+ config: ViewConfig;
13012
11873
  default?: boolean;
13013
11874
  metadata?: Record<string, unknown>;
13014
11875
  }
@@ -13019,74 +11880,125 @@ interface UpdateViewInput {
13019
11880
  label?: string;
13020
11881
  description?: string;
13021
11882
  icon?: IconName;
13022
- /** Layout mode: "page" (full tabs) or "modal" (single form) */
13023
- layout?: ViewLayout;
13024
- tabs?: Tab[];
11883
+ config?: ViewConfig;
13025
11884
  default?: boolean;
13026
11885
  metadata?: Record<string, unknown>;
13027
11886
  }
13028
11887
  /**
13029
- * Service for managing views.
13030
- * Handles fusion of native views (from registry) and custom views (from database).
13031
- * Automatically uses tenant context from AsyncLocalStorage.
11888
+ * Options for getting views
11889
+ */
11890
+ interface GetViewsOptions {
11891
+ /** Filter by view type */
11892
+ type?: ViewType;
11893
+ /** User ID for overlay merging */
11894
+ userId?: string;
11895
+ }
11896
+ /**
11897
+ * Options for getting a single view
11898
+ */
11899
+ interface GetViewOptions {
11900
+ /** Filter by view type (for disambiguation) */
11901
+ type?: ViewType;
11902
+ /** User ID for overlay merging */
11903
+ userId?: string;
11904
+ /** Filter by layout (only for detail views: "page" or "modal") */
11905
+ layout?: "page" | "modal";
11906
+ }
11907
+ /**
11908
+ * Service for managing unified views with overlay customizations.
13032
11909
  *
13033
- * Supports optional caching via CacheAdapter for improved performance.
13034
- * Cache is automatically invalidated when views are modified.
11910
+ * Architecture:
11911
+ * - Views (sources) are created by architects or auto-generated on first access
11912
+ * - Overlays store user-specific customizations (delta only)
11913
+ * - Default views are lazily created and persisted on first access
11914
+ *
11915
+ * Lazy Creation Pattern:
11916
+ * - No views are created on object creation
11917
+ * - First navigation auto-creates a default view in DB
11918
+ * - Architect Mode modifies real views in DB
11919
+ * - User customizations create overlays (not views)
13035
11920
  */
13036
11921
  declare class ViewService extends BaseService {
13037
- private nativeViews;
13038
- constructor(adapter: DatabaseAdapter, nativeViews: typeof viewRegistry);
13039
- /**
13040
- * Invalidate cached views for an object.
13041
- * Called automatically after view mutations.
13042
- */
11922
+ constructor(adapter: DatabaseAdapter);
13043
11923
  private invalidateViewCache;
13044
11924
  /**
13045
- * Get all views for an object (native + custom).
13046
- * Automatically uses tenant context from AsyncLocalStorage.
11925
+ * Get all views for the current tenant.
11926
+ * Optionally filter by view type.
13047
11927
  *
13048
- * Results are cached if a CacheAdapter is configured.
11928
+ * @param type - Optional view type filter
11929
+ * @returns All views for the tenant
11930
+ */
11931
+ getAllViews(type?: ViewType): Promise<ViewDefinition[]>;
11932
+ /**
11933
+ * Get a specific view by its ID.
11934
+ * Returns null if not found.
13049
11935
  *
13050
- * @param objectName - Object name
13051
- * @returns All views for the object
11936
+ * @param viewId - View ID (UUID)
11937
+ * @returns View definition or null
13052
11938
  */
13053
- getViewsForObject(objectName: string): Promise<ViewDefinition[]>;
11939
+ getViewById(viewId: string): Promise<ViewDefinition | null>;
13054
11940
  /**
13055
- * Internal method to fetch views for an object (no caching)
11941
+ * Get all views for an object from the database.
11942
+ * Optionally filter by type and merge with user overlays.
11943
+ *
11944
+ * @param objectName - Object name
11945
+ * @param options - Filter and overlay options
11946
+ * @returns Views from database
13056
11947
  */
13057
- private fetchViewsForObject;
11948
+ getViews(objectName: string, options?: GetViewsOptions): Promise<ViewDefinition[]>;
13058
11949
  /**
13059
11950
  * Get a specific view by name.
13060
- * Automatically uses tenant context from AsyncLocalStorage.
11951
+ * Returns null if not found (use getDefaultView for fallback behavior).
13061
11952
  *
13062
11953
  * @param objectName - Object name
13063
11954
  * @param viewName - View name
13064
- * @returns View definition or null
11955
+ * @param options - Type filter and overlay options
11956
+ * @returns View or null
13065
11957
  */
13066
- getView(objectName: string, viewName: string): Promise<ViewDefinition | null>;
11958
+ getView(objectName: string, viewName: string, options?: GetViewOptions): Promise<ViewDefinition | null>;
13067
11959
  /**
13068
- * Get the default view for an object
11960
+ * Get the default view for an object and type.
11961
+ * If no view exists in DB, auto-creates and persists a default view.
13069
11962
  *
13070
11963
  * Priority:
13071
- * 1. Custom view marked as default (for the specified layout)
13072
- * 2. Native view marked as default (for the specified layout)
13073
- * 3. First available view (for the specified layout)
11964
+ * 1. User's preferred view (from overlay with isUserDefault=true)
11965
+ * 2. View marked as default in DB (with matching layout if specified)
11966
+ * 3. First available view (with matching layout if specified)
11967
+ * 4. Auto-created default view (persisted to DB)
13074
11968
  *
13075
11969
  * @param objectName - Object name
13076
- * @param layout - Optional layout filter ("page" or "modal")
13077
- * @returns Default view or null
11970
+ * @param type - View type
11971
+ * @param objectDefinition - Object definition (for default generation)
11972
+ * @param options - Optional filters (userId, layout for detail views)
11973
+ * @returns View definition (existing or auto-created)
13078
11974
  */
13079
- getDefaultView(objectName: string, layout?: ViewLayout): Promise<ViewDefinition | null>;
11975
+ getDefaultView(objectName: string, type: ViewType, objectDefinition: ObjectDefinition, options?: {
11976
+ userId?: string;
11977
+ layout?: "page" | "modal";
11978
+ }): Promise<ViewDefinition>;
13080
11979
  /**
13081
- * Create a custom view.
13082
- * Automatically uses tenant context from AsyncLocalStorage.
11980
+ * Ensure a default view exists in DB for the given object and type.
11981
+ * If no view exists, generates and persists one.
11982
+ * Idempotent — safe to call concurrently (uses upsert).
11983
+ */
11984
+ private ensureDefaultView;
11985
+ /**
11986
+ * Generate default view config for an object.
11987
+ * Used by ensureDefaultView() and resetViewToDefault().
11988
+ */
11989
+ generateDefaultViewConfig(objectName: string, type: ViewType, objectDefinition: ObjectDefinition, layout?: "page" | "modal"): ViewDefinition;
11990
+ private generateDefaultDetailConfig;
11991
+ private generateDefaultListConfig;
11992
+ private getDefaultFieldSpan;
11993
+ /**
11994
+ * Create a new view (Architect Mode).
13083
11995
  *
13084
11996
  * @param input - View definition
13085
11997
  * @returns Created view
13086
11998
  */
13087
11999
  createView(input: CreateViewInput): Promise<ViewDefinition>;
13088
12000
  /**
13089
- * Update a custom view
12001
+ * Update an existing view.
13090
12002
  *
13091
12003
  * @param viewId - View ID
13092
12004
  * @param input - Update data
@@ -13094,29 +12006,76 @@ declare class ViewService extends BaseService {
13094
12006
  */
13095
12007
  updateView(viewId: string, input: UpdateViewInput): Promise<ViewDefinition>;
13096
12008
  /**
13097
- * Delete a custom view
12009
+ * Delete a view.
12010
+ * Overlays are automatically deleted (cascade).
13098
12011
  *
13099
12012
  * @param viewId - View ID
13100
12013
  */
13101
12014
  deleteView(viewId: string): Promise<void>;
13102
12015
  /**
13103
- * Set a view as default for its object and layout.
13104
- * Only unsets other defaults for the same layout.
13105
- * Automatically uses tenant context from AsyncLocalStorage.
12016
+ * Set a view as default for its object and type.
13106
12017
  *
13107
12018
  * @param viewId - View ID
13108
12019
  * @returns Updated view
13109
12020
  */
13110
12021
  setDefaultView(viewId: string): Promise<ViewDefinition>;
13111
12022
  /**
13112
- * Validate view name format (kebab-case)
12023
+ * Reset a view to its default (auto-generated) state.
12024
+ * Regenerates the view config based on the object definition.
12025
+ *
12026
+ * @param viewId - View ID
12027
+ * @param objectDefinition - Object definition for regeneration
12028
+ * @returns Updated view
12029
+ */
12030
+ resetViewToDefault(viewId: string, objectDefinition: ObjectDefinition): Promise<ViewDefinition>;
12031
+ /**
12032
+ * Reset user customizations for a view.
12033
+ * Deletes the overlay, returning to source/fallback view.
12034
+ *
12035
+ * @param viewId - View ID (can be UUID or fallback ID)
12036
+ * @param userId - User ID
13113
12037
  */
13114
- private validateViewName;
12038
+ resetUserCustomizations(viewId: string, userId: string): Promise<void>;
13115
12039
  /**
13116
- * Validate modal layout constraints.
13117
- * Modal views must have exactly one form tab.
12040
+ * Set a view as the user's default for an object and type.
12041
+ *
12042
+ * @param viewId - View ID (can be UUID or fallback ID)
12043
+ * @param userId - User ID
12044
+ * @param objectName - Object name
12045
+ * @param type - View type
12046
+ */
12047
+ setUserDefaultView(viewId: string, userId: string, objectName: string, type: ViewType): Promise<void>;
12048
+ /**
12049
+ * Check if a user has customized a view.
12050
+ *
12051
+ * @param viewId - View ID
12052
+ * @param userId - User ID
12053
+ * @returns True if overlay exists
12054
+ */
12055
+ hasUserCustomizations(viewId: string, userId: string): Promise<boolean>;
12056
+ /**
12057
+ * Apply an overlay to a view definition.
12058
+ * Implements merge semantics defined in the plan.
12059
+ *
12060
+ * @param view - Source view definition
12061
+ * @param overlay - User overlay
12062
+ * @returns Merged view definition
12063
+ */
12064
+ applyOverlay(view: ViewDefinition, overlay: DBViewOverlay): ViewDefinition;
12065
+ private applyListViewOverlay;
12066
+ private applyDetailViewOverlay;
12067
+ /**
12068
+ * Merge source tabs with overlay tabs.
12069
+ * - Source tabs are visible to all
12070
+ * - Overlay tabs are appended (user-private)
12071
+ * - hiddenTabIds allows hiding source tabs
12072
+ */
12073
+ private mergeViewTabs;
12074
+ /**
12075
+ * Merge detail tabs (form, activity, etc.)
13118
12076
  */
13119
- private validateModalLayout;
12077
+ private mergeDetailTabs;
12078
+ private validateViewName;
13120
12079
  /**
13121
12080
  * Convert database view to ViewDefinition
13122
12081
  */
@@ -13130,7 +12089,7 @@ interface ViewSyncResult {
13130
12089
  success: boolean;
13131
12090
  viewsSynced: number;
13132
12091
  viewsCreated: number;
13133
- viewsUpdated: number;
12092
+ viewsSkipped: number;
13134
12093
  viewsDeleted: number;
13135
12094
  errors: Array<{
13136
12095
  viewName: string;
@@ -13151,62 +12110,83 @@ interface ViewSyncOptions {
13151
12110
  dryRun?: boolean;
13152
12111
  verbose?: boolean;
13153
12112
  logger?: ViewSyncLogger;
12113
+ /**
12114
+ * Delete views in DB that are not in registry.
12115
+ * @default false
12116
+ */
12117
+ deleteOrphans?: boolean;
13154
12118
  }
13155
12119
  /**
13156
- * Sync native views from registry to database
12120
+ * Seed registry views to database
13157
12121
  *
13158
12122
  * This function:
13159
- * 1. Reads all registered native views from the registry
13160
- * 2. Upserts them into the database (views table)
13161
- * 3. Marks them as system=true for protection
13162
- * 4. Removes views that were deleted from code
12123
+ * 1. Reads all registered views from the registry
12124
+ * 2. Creates them in the database if they don't exist (INSERT if not exists)
12125
+ * 3. Skips views that already exist (no overwrite)
12126
+ * 4. Optionally removes orphan views (views in DB not in registry)
12127
+ *
12128
+ * Seeding behavior:
12129
+ * - INSERT if view doesn't exist in DB
12130
+ * - SKIP if view already exists (no overwrite)
12131
+ * - To force update: delete the view in DB, then restart app
13163
12132
  *
13164
12133
  * @param adapter - Database adapter implementing DatabaseAdapter interface
13165
- * @param nativeViewRegistry - Registry containing native views
13166
- * @param options - Sync options (dryRun, verbose, tenantId)
12134
+ * @param registry - Registry containing view definitions
12135
+ * @param options - Sync options (dryRun, verbose, deleteOrphans)
13167
12136
  * @returns Sync result with statistics
13168
12137
  *
13169
12138
  * @example
13170
12139
  * ```typescript
13171
- * import { syncNativeViews, viewRegistry } from "@stndrds/schema";
12140
+ * import { seedRegistryViews, viewRegistry } from "@stndrds/schema";
13172
12141
  * import { drizzleAdapter } from "./db/adapter";
13173
12142
  *
13174
- * const result = await syncNativeViews(drizzleAdapter, viewRegistry, {
12143
+ * const result = await seedRegistryViews(drizzleAdapter, viewRegistry, {
13175
12144
  * verbose: true,
13176
- * tenantId: "default"
13177
12145
  * });
13178
12146
  *
13179
12147
  * if (result.success) {
13180
- * console.log(`✓ Synced ${result.viewsSynced} views`);
12148
+ * console.log(`✓ Seeded ${result.viewsCreated} views`);
13181
12149
  * }
13182
12150
  * ```
13183
12151
  */
13184
- declare function syncNativeViews(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry, options?: ViewSyncOptions): Promise<ViewSyncResult>;
12152
+ declare function seedRegistryViews(adapter: DatabaseAdapter, registry: typeof viewRegistry, options?: ViewSyncOptions): Promise<ViewSyncResult>;
12153
+ /**
12154
+ * @deprecated Use seedRegistryViews instead
12155
+ */
12156
+ declare const syncNativeViews: typeof seedRegistryViews;
13185
12157
  /**
13186
- * Verify that all native views are synced to database
12158
+ * Verify that all registry views are seeded to database
13187
12159
  *
13188
12160
  * @param adapter - Database adapter
13189
- * @param nativeViewRegistry - Registry containing native views
13190
- * @returns true if all views are synced, false otherwise
12161
+ * @param registry - Registry containing view definitions
12162
+ * @returns true if all views are seeded, false otherwise
13191
12163
  *
13192
12164
  * @example
13193
12165
  * ```typescript
13194
- * const isSynced = await verifyNativeViewsSync(adapter, viewRegistry);
13195
- * if (!isSynced) {
13196
- * console.warn("Native views not synced, running sync...");
13197
- * await syncNativeViews(adapter, viewRegistry);
12166
+ * const isSeeded = await verifyRegistryViewsSeeded(adapter, viewRegistry);
12167
+ * if (!isSeeded) {
12168
+ * console.warn("Registry views not seeded, running seed...");
12169
+ * await seedRegistryViews(adapter, viewRegistry);
13198
12170
  * }
13199
12171
  * ```
13200
12172
  */
13201
- declare function verifyNativeViewsSync(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<boolean>;
12173
+ declare function verifyRegistryViewsSeeded(adapter: DatabaseAdapter, registry: typeof viewRegistry): Promise<boolean>;
12174
+ /**
12175
+ * @deprecated Use verifyRegistryViewsSeeded instead
12176
+ */
12177
+ declare const verifyNativeViewsSync: typeof verifyRegistryViewsSeeded;
13202
12178
  /**
13203
- * Get sync preview without modifying database
12179
+ * Get seed preview without modifying database
13204
12180
  *
13205
12181
  * @param adapter - Database adapter
13206
- * @param nativeViewRegistry - Registry containing native views
13207
- * @returns Sync result (dry run)
12182
+ * @param registry - Registry containing view definitions
12183
+ * @returns Seed result (dry run)
12184
+ */
12185
+ declare function getViewSeedPreview(adapter: DatabaseAdapter, registry: typeof viewRegistry): Promise<ViewSyncResult>;
12186
+ /**
12187
+ * @deprecated Use getViewSeedPreview instead
13208
12188
  */
13209
- declare function getViewSyncPreview(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<ViewSyncResult>;
12189
+ declare const getViewSyncPreview: typeof getViewSeedPreview;
13210
12190
 
13211
12191
  /**
13212
12192
  * Result of sync operation
@@ -13344,4 +12324,4 @@ interface FullSyncOptions extends SyncOptions, ViewSyncOptions {
13344
12324
  */
13345
12325
  declare function syncAll(adapter: DatabaseAdapter, objectRegistry: typeof registry, nativeViewRegistry: typeof viewRegistry, options?: FullSyncOptions): Promise<FullSyncResult>;
13346
12326
 
13347
- export { type OcrAdapter as $, type Attribute as A, type SortRule as B, type CheckboxAttribute as C, type DateAttribute as D, type DirectTableTab as E, type FileAttribute as F, type Group as G, type WorkflowConfig as H, type InferAttributeValue as I, type SlotMode as J, type ConditionGroup as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectAction as O, type PhoneAttribute as P, type ConditionRule as Q, type RichtextAttribute as R, type SystemResource as S, type TextAttribute as T, type UserAttribute as U, type ViewLayout as V, type WorkflowTheme as W, type WorkflowNode as X, type WorkflowDefinition as Y, type FlowRow as Z, type DocumentTemplate as _, type DocumentAttribute as a, type AuditActorType as a$, type OcrInput as a0, type OcrOptions as a1, type OcrResult as a2, type OcrPage as a3, type OcrTextBlock as a4, type BoundingBox as a5, type SignatureAdapter as a6, type CreateSignatureInput as a7, type SignerRequest as a8, type SignaturePosition as a9, type AIBatchQuestionAnswer as aA, type AITodoStatus as aB, type AITodoItem as aC, type AITodoList as aD, type AIMessageAttachment as aE, type AIConversation as aF, type AIMessage as aG, type AIToolCallRecord as aH, type AIUserMemory as aI, type AIUsageMetrics as aJ, type AIProviderMetrics as aK, type CreateAIMessageInput as aL, type StatusGroup as aM, type AttributeGroup as aN, type BaseAttribute as aO, type NumberUnit as aP, type DateFormat as aQ, type DateValue as aR, type Phone as aS, type Currency as aT, type Location as aU, type LocationGranularity as aV, RELATION_TARGET_ANY as aW, type RelationAttribute as aX, isUniversalRelation as aY, type AuditResourceType as aZ, type AuditAction as a_, type SignatureRequestResult as aa, type SignatureStatusResult as ab, type SignerStatus as ac, type SignatureStatus as ad, type IdentityVerificationAdapter as ae, type VerifyInput as af, type VerificationResult as ag, type DocumentData as ah, type VerificationCheck as ai, type AIMessageRole as aj, type AIThinkingLevel as ak, type AIToolCallStatus as al, type AIToolCall as am, type AIChatMessagePartType as an, type TextPartData as ao, type ToolPartData as ap, type ThinkingPartData as aq, type ReasoningPartData as ar, type AIChatMessagePart as as, type AIChatMessage as at, type AIQuestionType as au, type AIQuestionOption as av, type AIQuestion as aw, type AIQuestionAnswer as ax, type AIBatchQuestionOption as ay, type AIBatchQuestion as az, type SystemAction as b, type NoValueOperator as b$, type AuditChange as b0, type AuditLogEntry as b1, type CreateAuditLogInput as b2, type AuditListOptions as b3, type AuditServiceOptions as b4, type VariableMapping as b5, type PdfTemplateField as b6, type TemplateSource as b7, type DocumentGenerationTemplate as b8, type CreateDocumentGenerationTemplate as b9, type FileVisibility as bA, type File as bB, type CreateFile as bC, type UpdateFile as bD, type TextFilterOperator as bE, type NumberFilterOperator as bF, type CheckboxFilterOperator as bG, type DateFilterOperator as bH, type SelectFilterOperator as bI, type MultiselectFilterOperator as bJ, type RelationFilterOperator as bK, type FilterOperator as bL, type RelativeDateValue as bM, type CurrencyFilterValue as bN, type PhoneFilterValue as bO, type FilterValue as bP, type FilterRule as bQ, type ExtendedFilterRule as bR, type FilterCombinator as bS, type FilterGroup as bT, type AdvancedFilterState as bU, isAdvancedFilterState as bV, toAdvancedFilterState as bW, toSimpleFilterState as bX, type SortDirection as bY, type QueryState as bZ, OPERATORS_BY_TYPE as b_, type UpdateDocumentGenerationTemplate as ba, type PendingDocumentRequest as bb, isPdfTemplateSource as bc, isDocxTemplateSource as bd, type DocumentSlotDefinition as be, type DocumentAutoProcessing as bf, type ExtractionMapping as bg, type ExtractionField as bh, type Document as bi, type DocumentStatus as bj, type DocumentSlot as bk, type SlotStatus as bl, type ProcessingJob as bm, type ProcessingJobType as bn, type ProcessingJobStatus as bo, type CreateDocument as bp, type UpdateDocument as bq, type CreateDocumentTemplate as br, type UpdateDocumentTemplate as bs, type CreateDocumentSlot as bt, type UpdateDocumentSlot as bu, type CreateProcessingJob as bv, type UpdateProcessingJob as bw, type DocumentListOptions as bx, type DocumentTemplateListOptions as by, type StorageProvider as bz, type TextAreaAttribute as c, type UserRole as c$, NO_VALUE_OPERATORS as c0, isNoValueOperator as c1, type FlowSlot as c2, type FlowRowField as c3, type FlowPage as c4, type FlowRelation as c5, type FlowStatus as c6, type FlowDefinition as c7, isFlowDefinition as c8, isFlowPublished as c9, type ExtractAttributes as cA, type TypedObjectRecord as cB, type ExtractObjectRecord as cC, type ExtractObjectRecordWithCustom as cD, RESERVED_ATTRIBUTE_NAMES as cE, SYSTEM_FIELD_NAMES as cF, type ReservedAttributeName as cG, type SystemFieldName as cH, type Timestamps as cI, type SharingMode as cJ, type ObjectAttribute as cK, type CompletionStatus as cL, type ObjectRecord as cM, type PermissionScope as cN, type Role as cO, type Permission as cP, type UserRoleAssignment as cQ, type EffectivePermissions as cR, type ObjectPermissions as cS, type SystemPermissions as cT, type CreateRoleInput as cU, type UpdateRoleInput as cV, type CreatePermissionInput as cW, type AssignRoleInput as cX, type PolicyContext as cY, type RecordPolicy as cZ, PolicyViolationError as c_, isSystemFlow as ca, type GeocodingSuggestion as cb, type GeocodingAutocompleteParams as cc, type ReverseGeocodingParams as cd, type GeocodingParams as ce, type GeocodingAdapter as cf, NoopGeocodingAdapter as cg, type AttributeSchema as ch, type InferRecordFromSchema as ci, type InferRecordWithRequirements as cj, type TypedAttribute as ck, type AttributeMap as cl, type AddAttribute as cm, type InferRecord as cn, type InferRecordInput as co, type InferRecordUpdate as cp, type CustomAttributeValue as cq, type WithCustomAttributes as cr, type RecordMetadata as cs, type SystemFields as ct, type ExtractRecord as cu, type ExtractRecordStrict as cv, type ExtractRecordInput as cw, type ExtractRecordInputStrict as cx, type ExtractRecordUpdate as cy, type ExtractRecordUpdateStrict as cz, type RichtextFeature as d, type CreateInvitationInput as d$, type UserStatus as d0, type UserProfile as d1, type CreateUserProfile as d2, type UpdateUserProfile as d3, type InviteUserInput as d4, type TabType as d5, type FormTab as d6, type CustomTab as d7, type ActivityTab as d8, type NotesTab as d9, isStartNode as dA, type ConditionOperator as dB, and as dC, eq as dD, inValues as dE, isConditionGroup as dF, isConditionRule as dG, isEmpty as dH, isNotEmpty as dI, neq as dJ, or as dK, type CanvasViewport as dL, type NodePosition as dM, type WorkflowLayout as dN, type WorkflowSlot as dO, type WorkflowStatus as dP, isSystemWorkflow as dQ, isWorkflowDefinition as dR, isWorkflowPublished as dS, type PendingAction as dT, type WorkflowError as dU, type WorkflowInstance as dV, type WorkflowTransition as dW, canResumeInstance as dX, createStartTransition as dY, isInstanceTerminal as dZ, isInstanceWaiting as d_, type FlowsTab as da, type DocumentsTab as db, isFormTab as dc, isTableTab as dd, isDirectTableTab as de, isInverseTableTab as df, isCustomTab as dg, isActivityTab as dh, isNotesTab as di, isFlowsTab as dj, isDocumentsTab as dk, type ConditionNode as dl, type DocumentNode as dm, type EndNode as dn, type FormFieldRef as dp, type FormNode as dq, type StartNode as dr, type WorkflowNodeType as ds, getNodeOutputs as dt, isAdvancedFormNode as du, isConditionNode as dv, isDocumentNode as dw, isEndNode as dx, isFormNode as dy, isSimpleFormNode as dz, type CurrencyAttribute as e, attributeConfigSchemas as e$, type CreateInvitationResult as e0, type InvitationStatus as e1, type WorkflowInvitation as e2, isInvitationAccepted as e3, isInvitationExpired as e4, isInvitationValid as e5, type CreateGrantInput as e6, type WorkflowAccessGrant as e7, canAccessNode as e8, isGrantExpired as e9, generateId as eA, generatePrefixedId as eB, slugify as eC, generateTemplateName as eD, registry as eE, viewRegistry as eF, type ValidationMessages as eG, DEFAULT_VALIDATION_MESSAGES as eH, textConfigSchema as eI, textareaConfigSchema as eJ, richtextConfigSchema as eK, numberConfigSchema as eL, checkboxConfigSchema as eM, dateConfigSchema as eN, phoneConfigSchema as eO, currencyConfigSchema as eP, statusConfigSchema as eQ, locationConfigSchema as eR, selectConfigSchema as eS, multiselectConfigSchema as eT, fileConfigSchema as eU, userConfigSchema as eV, relationConfigSchema as eW, ratingConfigSchema as eX, formulaConfigSchema as eY, rollupConfigSchema as eZ, documentConfigSchema as e_, isGrantRevoked as ea, isGrantValid as eb, isTokenRevoked as ec, type GeneratedDocument as ed, type WorkflowExecutionContext as ee, createEmptyContext as ef, getContextValue as eg, mergeFormToSlot as eh, setContextValue as ei, type FormContextResponse as ej, type FormFieldContext as ek, type FormFieldRow as el, type FormNodeInfo as em, type ReadOnlyReason as en, type WorkflowAccessMode as eo, type ThemeColors as ep, type ThemeLogo as eq, type ThemeTypography as er, DEFAULT_THEME as es, generateCssVariables as et, mergeWithDefaults as eu, type Uuid as ev, type TenantId as ew, type UserId as ex, asTenantId as ey, asUserId as ez, type Option as f, QueryMultipleResultsError as f$, getAttributeConfigSchema as f0, validateAttributeConfig as f1, parseAttributeConfig as f2, safeParseAttributeConfig as f3, createTextValidator as f4, createNumberValidator as f5, createCheckboxValidator as f6, createDateValidator as f7, createPhoneValidator as f8, createCurrencyValidator as f9, computeRecordStatus as fA, type DatabaseAdapter as fB, WorkflowJwtService as fC, type JwtVerificationResult as fD, type MagicLinkPayload as fE, type WorkflowAccessPayload as fF, type WorkflowJwtConfig as fG, type WorkflowJwtPayload as fH, type CacheKeyType as fI, hashOptions as fJ, type CacheAdapter as fK, type CacheOptions as fL, cacheKeys as fM, cacheTtl as fN, defaultTtl as fO, NoopCacheAdapter as fP, type FetchResult as fQ, type FormattedRecord as fR, type GroupedFetchResult as fS, type InsertOptions as fT, type QueryBuilderState as fU, type RegistryMap as fV, type RegistryObjectNames as fW, type ShortcutOperator as fX, createDefaultState as fY, formatRecord as fZ, formatRecords as f_, createStatusValidator as fa, createSelectValidator as fb, createMultiselectValidator as fc, createLocationValidator as fd, createFileValidator as fe, createUserValidator as ff, createSingleRelationValidator as fg, createMultiRelationValidator as fh, createRelationValidator as fi, createRatingValidator as fj, createFormulaValidator as fk, createRollupValidator as fl, createTextAreaValidator as fm, createRichtextValidator as fn, createAttributeValidator as fo, createFormAttributeValidator as fp, createObjectValidator as fq, type ValidationResult as fr, validateAttribute as fs, validateObject as ft, validateObjectOrThrow as fu, createDraftValidator as fv, validateDraft as fw, validateDraftOrThrow as fx, getMissingRequiredAttributes as fy, isRecordComplete as fz, type StatusAttribute as g, parsePath as g$, QueryNoResultError as g0, SHORTCUT_TO_FILTER_OPERATOR as g1, createQueryBuilder as g2, QueryBuilder as g3, type QueryBuilderOptions as g4, type EvaluationResult as g5, type EvaluationTrace as g6, evaluateCondition as g7, evaluate as g8, evaluateWithTrace as g9, error as gA, ExecutorRegistry as gB, success as gC, wait as gD, ConditionExecutor as gE, DocumentExecutor as gF, EndExecutor as gG, FormExecutor as gH, StartExecutor as gI, evaluateFormula as gJ, evaluateFormulaAttribute as gK, evaluateFormulaAttributeWithRelations as gL, evaluateFormulaWithRelations as gM, evaluateFormulaWithResult as gN, extractFormulaVariables as gO, extractRelationNames as gP, extractRelationReferences as gQ, flattenRelationsForEval as gR, formatFormulaResult as gS, hasRelationReferences as gT, validateFormulaExpression as gU, type FormulaResult as gV, getPathDepth as gW, getRelationPath as gX, getTargetAttributeName as gY, InvalidPathError as gZ, MaxDepthExceededError as g_, TenantContextError as ga, addSchemaToContext as gb, getSchemaByNameFromContext as gc, getSchemaContext as gd, getSchemaFromContext as ge, hasSchemaContext as gf, runWithMergedSchemaContext as gg, runWithSchemaContext as gh, type SchemaContext as gi, getContext as gj, getTenantId as gk, getUserId as gl, hasContext as gm, runWithContext as gn, withTenantContext as go, type TenantContext as gp, createDefaultExecutorRegistry as gq, getDefaultExecutorRegistry as gr, type ExecutorCompleteResult as gs, type ExecutorContext as gt, type ExecutorErrorResult as gu, type ExecutorResult as gv, type ExecutorSuccessResult as gw, type ExecutorWaitResult as gx, type NodeExecutor as gy, complete as gz, type SelectAttribute as h, type RelationOptionsResponse as h$, pathHasManyCardinality as h0, validatePath as h1, type PathCardinality as h2, type PathSegment as h3, type PathSegmentType as h4, type SchemaResolver as h5, resolveMultiplePaths as h6, resolveSingleValue as h7, traversePath as h8, type TraversalOptions as h9, type DocumentsRepository as hA, type DocumentSlotsRepository as hB, type DocumentJobsRepository as hC, type DocumentGenerationTemplateListOptions as hD, type DocumentGenerationTemplatesRepository as hE, type AIConversationsRepository as hF, type AIUserMemoryRepository as hG, type AIUsageMetricsRepository as hH, BaseService as hI, BaseRepository as hJ, type SchemaContextAware as hK, SchemaContextAwareRepository as hL, type CreateCustomObjectInput as hM, type AddAttributeInput as hN, type UpdateObjectInput as hO, type ObjectSchemaServiceOptions as hP, ObjectSchemaService as hQ, type RecordServiceOptions as hR, RecordService as hS, type RecordQueryServiceOptions as hT, type QueryOptions as hU, type SearchQueryOptions as hV, type QueryResult as hW, RecordQueryService as hX, type RelationValidationResult as hY, type RelationValidationError as hZ, type RelationOption as h_, type TraversalResult as ha, type AttributeChange as hb, type HookContext as hc, type HookDefinition as hd, type HookHandler as he, type HookType as hf, NoopHookRegistry as hg, type HookRegistry as hh, createMockAdapter as hi, type MockStores as hj, defaultPolicyRegistry as hk, PolicyRegistry as hl, notesPolicy as hm, type ObjectsRepository as hn, type AttributesRepository as ho, type ObjectRecordsRepository as hp, type ViewsRepository as hq, type UserProfilesRepository as hr, type FilesRepository as hs, type AuditRepository as ht, type PermissionsRepository as hu, type WorkflowsRepository as hv, type WorkflowInstancesRepository as hw, type WorkflowInvitationsRepository as hx, type WorkflowAccessGrantsRepository as hy, type DocumentTemplatesRepository as hz, type SingleRelationAttribute as i, UserProfileService as i$, type GetRelationOptionsParams as i0, type RelationServiceOptions as i1, type ResolveIdsBatchRequest as i2, type ResolveIdsBatchResponse as i3, RelationService as i4, RecordResolverService as i5, type ResolvedRelations as i6, type FormulaResolverServiceOptions as i7, FormulaResolverService as i8, type RollupResult as i9, GrantNotFoundError as iA, GrantExpiredError as iB, GrantRevokedError as iC, TokenRevokedError as iD, type GrantServiceConfig as iE, type CreateGrantResult as iF, WorkflowAccessGrantService as iG, type StartWorkflowInput as iH, type ResumeWorkflowInput as iI, type WorkflowInstanceServiceOptions as iJ, WorkflowInstanceService as iK, type InvitationServiceConfig as iL, InvitationNotFoundError as iM, InvitationExpiredError as iN, InvitationAlreadyAcceptedError as iO, InvitationRevokedError as iP, WorkflowInvitationService as iQ, type FieldReadOnlyResult as iR, WorkflowRelationService as iS, type CreateWorkflowInput as iT, type UpdateWorkflowInput as iU, type WorkflowServiceOptions as iV, WorkflowService as iW, type UserValidationResult as iX, type UserValidationError as iY, UserService as iZ, type UserProfileServiceOptions as i_, type RollupServiceOptions as ia, RollupService as ib, type RollupSchedulerOptions as ic, RollupScheduler as id, applyDefaultValues as ie, checkPermission as ig, getPolicy as ih, buildPolicyContext as ii, checkRecordAccess as ij, checkRecordModifyOrThrow as ik, checkRecordDeleteOrThrow as il, checkSharedObjectWriteAccess as im, computeLabel as io, type LabelResolver as ip, enrichWithFormulas as iq, enrichRecordsWithFormulas as ir, createContextForCreate as is, createContextForUpdate as it, createContextForDelete as iu, createContextForRestore as iv, recalculateParentRollups as iw, type RollupCascadeContext as ix, type DocumentProcessingHookOptions as iy, DocumentProcessingHook as iz, type MultiRelationAttribute as j, type GlobalSearchResultItem as j$, AuditService as j0, buildAuditChanges as j1, DocumentGenerationTemplateNotFoundError as j2, DocumentGenerationNotConfiguredError as j3, DocumentGenerationService as j4, type DocumentProcessingConfig as j5, DocumentProcessingService as j6, type RenderDocumentInput as j7, type DocumentRendererOptions as j8, type RenderDocumentResult as j9, syncNativeObjects as jA, verifyNativeObjectsSync as jB, getSyncPreview as jC, type FullSyncResult as jD, type FullSyncOptions as jE, syncAll as jF, DEFAULT_LABEL_FALLBACK as jG, renderLabelExpression as jH, isLabelExpression as jI, extractAttributeNames as jJ, enrichValuesForDisplay as jK, enrichValuesWithSelectLabels as jL, extractRelationIds as jM, type RelationLabelResolver as jN, computeLabelWithRelations as jO, type DBObject as jP, type CreateDBObject as jQ, type UpdateDBObject as jR, type UpsertDBObject as jS, type DBAttribute as jT, type CreateDBAttribute as jU, type UpdateDBAttribute as jV, type UpsertDBAttribute as jW, type CreateObjectRecord as jX, type ListOptions as jY, type SearchOptions as jZ, type GlobalSearchOptions as j_, DocumentRenderError as ja, StorageDownloadNotSupportedError as jb, DocumentRendererService as jc, DocumentTemplateService as jd, type RecordDocumentsResult as je, type CreateRecordDocumentInput as jf, type CreateRecordDocumentResult as jg, type DocumentServiceOptions as jh, DocumentService as ji, type FileServiceOptions as jj, FileService as jk, GeocodingService as jl, GlobalSearchService as jm, type PermissionServiceOptions as jn, PermissionService as jo, type CreateViewInput as jp, type UpdateViewInput as jq, ViewService as jr, type FileContent as js, type StorageUploadInput as jt, type StorageUploadResult as ju, type SignedUrlOptions as jv, type StorageAdapter as jw, type UploadFileInput as jx, type SyncResult as jy, type SyncOptions as jz, type RelationTarget as k, type FileListOptions as k0, type DBView as k1, type CreateDBView as k2, type UpdateDBView as k3, type UpsertDBView as k4, type DBWorkflow as k5, type CreateDBWorkflow as k6, type UpdateDBWorkflow as k7, type DBWorkflowInstance as k8, type CreateDBWorkflowInstance as k9, type UpdateDBWorkflowInstance as ka, type DBWorkflowInvitation as kb, type CreateDBWorkflowInvitation as kc, type UpdateDBWorkflowInvitation as kd, type DBWorkflowAccessGrant as ke, type CreateDBWorkflowAccessGrant as kf, type UpdateDBWorkflowAccessGrant as kg, type OperationResult as kh, type ViewSyncResult as ki, type ViewSyncLogger as kj, type ViewSyncOptions as kk, syncNativeViews as kl, verifyNativeViewsSync as km, getViewSyncPreview as kn, type RatingAttribute as l, type FormulaAttribute as m, type FormulaReturnType as n, type RollupAttribute as o, type RollupFunction as p, type AttributeType as q, type ObjectDefinition as r, type Field as s, type AttributeGroupField as t, type TableTab as u, type InverseTableTab as v, type ViewDefinition as w, type InstanceStatus as x, type Tab as y, type FilterState as z };
12327
+ export { type TextPartData as $, type AttributeGroupField as A, type BoundingBox as B, type ConditionGroup as C, type DetailViewLayout as D, type SignatureRequestResult as E, type Field as F, type Group as G, type SignatureStatusResult as H, type InferAttributeValue as I, type SignerStatus as J, type SignatureStatus as K, type ListViewDefinition as L, type IdentityVerificationAdapter as M, type VerifyInput as N, type ObjectAction as O, type VerificationResult as P, type DocumentData as Q, type VerificationCheck as R, type SystemResource as S, type TableTab as T, type AIMessageRole as U, type ViewType as V, type WorkflowTheme as W, type AIThinkingLevel as X, type AIToolCallStatus as Y, type AIToolCall as Z, type AIChatMessagePartType as _, type SystemAction as a, type UpdateFile as a$, type ToolPartData as a0, type ThinkingPartData as a1, type ReasoningPartData as a2, type AIChatMessagePart as a3, type AIChatMessage as a4, type AIQuestionType as a5, type AIQuestionOption as a6, type AIQuestion as a7, type AIQuestionAnswer as a8, type AIBatchQuestionOption as a9, type UpdateDocumentGenerationTemplate as aA, type PendingDocumentRequest as aB, type DocumentSlotDefinition as aC, type DocumentAutoProcessing as aD, type ExtractionMapping as aE, type ExtractionField as aF, type Document as aG, type DocumentStatus as aH, type DocumentSlot as aI, type SlotStatus as aJ, type ProcessingJob as aK, type ProcessingJobType as aL, type ProcessingJobStatus as aM, type CreateDocument as aN, type UpdateDocument as aO, type CreateDocumentTemplate as aP, type UpdateDocumentTemplate as aQ, type CreateDocumentSlot as aR, type UpdateDocumentSlot as aS, type CreateProcessingJob as aT, type UpdateProcessingJob as aU, type DocumentListOptions as aV, type DocumentTemplateListOptions as aW, type StorageProvider as aX, type FileVisibility as aY, type File as aZ, type CreateFile as a_, type AIBatchQuestion as aa, type AIBatchQuestionAnswer as ab, type AITodoStatus as ac, type AITodoItem as ad, type AITodoList as ae, type AIMessageAttachment as af, type AIConversation as ag, type AIMessage as ah, type AIToolCallRecord as ai, type AIUserMemory as aj, type AIUsageMetrics as ak, type AIProviderMetrics as al, type CreateAIMessageInput as am, type AuditResourceType as an, type AuditAction as ao, type AuditActorType as ap, type AuditChange as aq, type AuditLogEntry as ar, type CreateAuditLogInput as as, type AuditListOptions as at, type AuditServiceOptions as au, type VariableMapping as av, type PdfTemplateField as aw, type TemplateSource as ax, type DocumentGenerationTemplate as ay, type CreateDocumentGenerationTemplate as az, type InverseTableTab as b, type Permission as b$, type TextFilterOperator as b0, type NumberFilterOperator as b1, type CheckboxFilterOperator as b2, type DateFilterOperator as b3, type SelectFilterOperator as b4, type MultiselectFilterOperator as b5, type RelationFilterOperator as b6, type FilterOperator as b7, type RelativeDateValue as b8, type CurrencyFilterValue as b9, type GeocodingAdapter as bA, NoopGeocodingAdapter as bB, type AttributeSchema as bC, type InferRecordFromSchema as bD, type InferRecordWithRequirements as bE, type TypedAttribute as bF, type AttributeMap as bG, type AddAttribute as bH, type InferRecord as bI, type InferRecordInput as bJ, type InferRecordUpdate as bK, type CustomAttributeValue as bL, type WithCustomAttributes as bM, type RecordMetadata as bN, type SystemFields as bO, type ExtractRecord as bP, type ExtractRecordStrict as bQ, type ExtractRecordInput as bR, type ExtractRecordInputStrict as bS, type ExtractRecordUpdate as bT, type ExtractRecordUpdateStrict as bU, type ExtractAttributes as bV, type TypedObjectRecord as bW, type ExtractObjectRecord as bX, type ExtractObjectRecordWithCustom as bY, type PermissionScope as bZ, type Role as b_, type PhoneFilterValue as ba, type FilterValue as bb, type FilterRule as bc, type ExtendedFilterRule as bd, type FilterCombinator as be, type FilterGroup as bf, type AdvancedFilterState as bg, type SortDirection as bh, type QueryState as bi, OPERATORS_BY_TYPE as bj, type NoValueOperator as bk, NO_VALUE_OPERATORS as bl, isNoValueOperator as bm, type FlowSlot as bn, type FlowRowField as bo, type FlowPage as bp, type FlowRelation as bq, type FlowStatus as br, type FlowDefinition as bs, isFlowDefinition as bt, isFlowPublished as bu, isSystemFlow as bv, type GeocodingSuggestion as bw, type GeocodingAutocompleteParams as bx, type ReverseGeocodingParams as by, type GeocodingParams as bz, type DetailViewDefinition as c, isEndNode as c$, type UserRoleAssignment as c0, type EffectivePermissions as c1, type ObjectPermissions as c2, type SystemPermissions as c3, type CreateRoleInput as c4, type UpdateRoleInput as c5, type CreatePermissionInput as c6, type AssignRoleInput as c7, type PolicyContext as c8, type RecordPolicy as c9, type ConfigOverrides as cA, type ViewOverlay as cB, isDetailView as cC, isListView as cD, isCalendarView as cE, isTimelineView as cF, isGalleryView as cG, isFormTab as cH, isTableTab as cI, isDirectTableTab as cJ, isInverseTableTab as cK, isCustomTab as cL, isActivityTab as cM, isNotesTab as cN, isFlowsTab as cO, isDocumentsTab as cP, type ConditionNode as cQ, type DocumentNode as cR, type EndNode as cS, type FormFieldRef as cT, type FormNode as cU, type StartNode as cV, type WorkflowNodeType as cW, getNodeOutputs as cX, isAdvancedFormNode as cY, isConditionNode as cZ, isDocumentNode as c_, PolicyViolationError as ca, type UserRole as cb, type UserStatus as cc, type UserProfile as cd, type CreateUserProfile as ce, type UpdateUserProfile as cf, type InviteUserInput as cg, type TabType as ch, type FormTab as ci, type CustomTab as cj, type ActivityTab as ck, type NotesTab as cl, type FlowsTab as cm, type DocumentsTab as cn, type ListViewLayout as co, type ViewLayout as cp, type ViewTab as cq, type DetailViewConfig as cr, type ListViewConfig as cs, type CalendarViewConfig as ct, type TimelineViewConfig as cu, type GalleryViewConfig as cv, type ViewConfig as cw, type CalendarViewDefinition as cx, type TimelineViewDefinition as cy, type GalleryViewDefinition as cz, type InstanceStatus as d, WorkflowJwtService as d$, isFormNode as d0, isSimpleFormNode as d1, isStartNode as d2, type ConditionOperator as d3, and as d4, eq as d5, inValues as d6, isConditionGroup as d7, isConditionRule as d8, neq as d9, type WorkflowAccessGrant as dA, canAccessNode as dB, isGrantExpired as dC, isGrantRevoked as dD, isGrantValid as dE, isTokenRevoked as dF, type GeneratedDocument as dG, type WorkflowExecutionContext as dH, createEmptyContext as dI, getContextValue as dJ, setContextValue as dK, type FormContextResponse as dL, type FormFieldContext as dM, type FormFieldRow as dN, type FormNodeInfo as dO, type ReadOnlyReason as dP, type WorkflowAccessMode as dQ, type ThemeColors as dR, type ThemeLogo as dS, type ThemeTypography as dT, DEFAULT_THEME as dU, generateCssVariables as dV, mergeWithDefaults as dW, registry as dX, viewRegistry as dY, type ViewOverlaysRepository as dZ, type DatabaseAdapter as d_, or as da, type CanvasViewport as db, type NodePosition as dc, type WorkflowLayout as dd, type WorkflowSlot as de, type WorkflowStatus as df, isSystemWorkflow as dg, isWorkflowDefinition as dh, isWorkflowPublished as di, type PendingAction as dj, type WorkflowError as dk, type WorkflowInstance as dl, type WorkflowTransition as dm, canResumeInstance as dn, createStartTransition as dp, isInstanceTerminal as dq, isInstanceWaiting as dr, type CreateInvitationInput as ds, type CreateInvitationResult as dt, type InvitationStatus as du, type WorkflowInvitation as dv, isInvitationAccepted as dw, isInvitationExpired as dx, isInvitationValid as dy, type CreateGrantInput as dz, type Tab as e, type ExecutorContext as e$, type JwtVerificationResult as e0, type MagicLinkPayload as e1, type WorkflowAccessPayload as e2, type WorkflowJwtConfig as e3, type WorkflowJwtPayload as e4, type CacheKeyType as e5, hashOptions as e6, type CacheAdapter as e7, type CacheOptions as e8, cacheKeys as e9, FeatureFlagsContextError as eA, getFeatureFlags as eB, getFeatureValue as eC, hasFeatureFlagsContext as eD, isFeatureEnabled as eE, runWithFeatureFlags as eF, tryGetFeatureValue as eG, withFeatureFlags as eH, type FeatureFlagsContext as eI, addSchemaToContext as eJ, getSchemaByNameFromContext as eK, getSchemaContext as eL, getSchemaFromContext as eM, hasSchemaContext as eN, runWithMergedSchemaContext as eO, runWithSchemaContext as eP, type SchemaContext as eQ, getContext as eR, getTenantId as eS, getUserId as eT, hasContext as eU, runWithContext as eV, withTenantContext as eW, type TenantContext as eX, createDefaultExecutorRegistry as eY, getDefaultExecutorRegistry as eZ, type ExecutorCompleteResult as e_, cacheTtl as ea, defaultTtl as eb, NoopCacheAdapter as ec, type FetchResult as ed, type FormattedRecord as ee, type GroupedFetchResult as ef, type InsertOptions as eg, type QueryBuilderState as eh, type RegistryMap as ei, type RegistryObjectNames as ej, type ShortcutOperator as ek, createDefaultState as el, formatRecord as em, formatRecords as en, QueryMultipleResultsError as eo, QueryNoResultError as ep, SHORTCUT_TO_FILTER_OPERATOR as eq, createQueryBuilder as er, QueryBuilder as es, type QueryBuilderOptions as et, type EvaluationResult as eu, type EvaluationTrace as ev, evaluateCondition as ew, evaluate as ex, evaluateWithTrace as ey, TenantContextError as ez, type FilterState as f, type DocumentGenerationTemplatesRepository as f$, type ExecutorErrorResult as f0, type ExecutorResult as f1, type ExecutorSuccessResult as f2, type ExecutorWaitResult as f3, type NodeExecutor as f4, complete as f5, error as f6, ExecutorRegistry as f7, success as f8, wait as f9, type PathCardinality as fA, type PathSegment as fB, type PathSegmentType as fC, type SchemaResolver as fD, resolveMultiplePaths as fE, resolveSingleValue as fF, traversePath as fG, type TraversalOptions as fH, type TraversalResult as fI, type AttributeChange as fJ, type HookContext as fK, type HookDefinition as fL, type HookHandler as fM, type HookType as fN, NoopHookRegistry as fO, type HookRegistry as fP, createMockAdapter as fQ, type MockStores as fR, defaultPolicyRegistry as fS, PolicyRegistry as fT, notesPolicy as fU, type AIConversationsRepository as fV, type AIUsageMetricsRepository as fW, type AIUserMemoryRepository as fX, type AttributesRepository as fY, type AuditRepository as fZ, type DocumentGenerationTemplateListOptions as f_, ConditionExecutor as fa, DocumentExecutor as fb, EndExecutor as fc, FormExecutor as fd, StartExecutor as fe, evaluateFormula as ff, evaluateFormulaAttribute as fg, evaluateFormulaAttributeWithRelations as fh, evaluateFormulaWithRelations as fi, evaluateFormulaWithResult as fj, extractFormulaVariables as fk, extractRelationNames as fl, extractRelationReferences as fm, flattenRelationsForEval as fn, formatFormulaResult as fo, hasRelationReferences as fp, validateFormulaExpression as fq, type FormulaResult as fr, getPathDepth as fs, getRelationPath as ft, getTargetAttributeName as fu, InvalidPathError as fv, MaxDepthExceededError as fw, parsePath as fx, pathHasManyCardinality as fy, validatePath as fz, type SortRule as g, createContextForRestore as g$, type DocumentJobsRepository as g0, type DocumentSlotsRepository as g1, type DocumentsRepository as g2, type DocumentTemplatesRepository as g3, type FilesRepository as g4, type ObjectRecordsRepository as g5, type ObjectsRepository as g6, type PermissionsRepository as g7, type UserProfilesRepository as g8, type ViewsRepository as g9, type ResolveIdsBatchRequest as gA, type ResolveIdsBatchResponse as gB, RelationService as gC, RecordResolverService as gD, type ResolvedRelations as gE, type FormulaResolverServiceOptions as gF, FormulaResolverService as gG, type RollupResult as gH, type RollupServiceOptions as gI, RollupService as gJ, type RollupSchedulerOptions as gK, RollupScheduler as gL, applyDefaultValues as gM, checkPermission as gN, getPolicy as gO, buildPolicyContext as gP, checkRecordAccess as gQ, checkRecordModifyOrThrow as gR, checkRecordDeleteOrThrow as gS, checkSharedObjectWriteAccess as gT, computeLabel as gU, type LabelResolver as gV, enrichWithFormulas as gW, enrichRecordsWithFormulas as gX, createContextForCreate as gY, createContextForUpdate as gZ, createContextForDelete as g_, type WorkflowAccessGrantsRepository as ga, type WorkflowInstancesRepository as gb, type WorkflowInvitationsRepository as gc, type WorkflowsRepository as gd, BaseService as ge, BaseRepository as gf, type SchemaContextAware as gg, SchemaContextAwareRepository as gh, type CreateCustomObjectInput as gi, type AddAttributeInput as gj, type UpdateObjectInput as gk, type ObjectSchemaServiceOptions as gl, ObjectSchemaService as gm, type RecordServiceOptions as gn, RecordService as go, type RecordQueryServiceOptions as gp, type QueryOptions as gq, type SearchQueryOptions as gr, type QueryResult as gs, RecordQueryService as gt, type RelationValidationResult as gu, type RelationValidationError as gv, type RelationOption as gw, type RelationOptionsResponse as gx, type GetRelationOptionsParams as gy, type RelationServiceOptions as gz, type DirectTableTab as h, type StorageUploadResult as h$, recalculateParentRollups as h0, type RollupCascadeContext as h1, type DocumentProcessingHookOptions as h2, DocumentProcessingHook as h3, GrantNotFoundError as h4, GrantExpiredError as h5, GrantRevokedError as h6, TokenRevokedError as h7, type GrantServiceConfig as h8, type CreateGrantResult as h9, type DocumentProcessingConfig as hA, DocumentProcessingService as hB, type RenderDocumentInput as hC, type DocumentRendererOptions as hD, type RenderDocumentResult as hE, DocumentRenderError as hF, StorageDownloadNotSupportedError as hG, DocumentRendererService as hH, DocumentTemplateService as hI, type RecordDocumentsResult as hJ, type CreateRecordDocumentInput as hK, type CreateRecordDocumentResult as hL, type DocumentServiceOptions as hM, DocumentService as hN, type FileServiceOptions as hO, FileService as hP, GeocodingService as hQ, GlobalSearchService as hR, type PermissionServiceOptions as hS, PermissionService as hT, type CreateViewInput as hU, type UpdateViewInput as hV, type GetViewsOptions as hW, type GetViewOptions as hX, ViewService as hY, type FileContent as hZ, type StorageUploadInput as h_, WorkflowAccessGrantService as ha, type StartWorkflowInput as hb, type ResumeWorkflowInput as hc, type WorkflowInstanceServiceOptions as hd, WorkflowInstanceService as he, type InvitationServiceConfig as hf, InvitationNotFoundError as hg, InvitationExpiredError as hh, InvitationAlreadyAcceptedError as hi, InvitationRevokedError as hj, WorkflowInvitationService as hk, WorkflowRelationService as hl, type CreateWorkflowInput as hm, type UpdateWorkflowInput as hn, type WorkflowServiceOptions as ho, WorkflowService as hp, type UserValidationResult as hq, type UserValidationError as hr, UserService as hs, type UserProfileServiceOptions as ht, UserProfileService as hu, AuditService as hv, buildAuditChanges as hw, DocumentGenerationTemplateNotFoundError as hx, DocumentGenerationNotConfiguredError as hy, DocumentGenerationService as hz, type WorkflowConfig as i, getViewSeedPreview as i$, type SignedUrlOptions as i0, type StorageAdapter as i1, type UploadFileInput as i2, type SyncResult as i3, type SyncOptions as i4, syncNativeObjects as i5, verifyNativeObjectsSync as i6, getSyncPreview as i7, type FullSyncResult as i8, type FullSyncOptions as i9, type DBView as iA, type CreateDBView as iB, type UpdateDBView as iC, type UpsertDBView as iD, type DBViewOverlay as iE, type CreateDBViewOverlay as iF, type UpdateDBViewOverlay as iG, type DBWorkflow as iH, type CreateDBWorkflow as iI, type UpdateDBWorkflow as iJ, type DBWorkflowInstance as iK, type CreateDBWorkflowInstance as iL, type UpdateDBWorkflowInstance as iM, type DBWorkflowInvitation as iN, type CreateDBWorkflowInvitation as iO, type UpdateDBWorkflowInvitation as iP, type DBWorkflowAccessGrant as iQ, type CreateDBWorkflowAccessGrant as iR, type UpdateDBWorkflowAccessGrant as iS, type OperationResult as iT, type ViewSyncResult as iU, type ViewSyncLogger as iV, type ViewSyncOptions as iW, seedRegistryViews as iX, syncNativeViews as iY, verifyRegistryViewsSeeded as iZ, verifyNativeViewsSync as i_, syncAll as ia, DEFAULT_LABEL_FALLBACK as ib, renderLabelExpression as ic, isLabelExpression as id, extractAttributeNames as ie, enrichValuesForDisplay as ig, enrichValuesWithSelectLabels as ih, extractRelationIds as ii, type RelationLabelResolver as ij, computeLabelWithRelations as ik, type DBObject as il, type CreateDBObject as im, type UpdateDBObject as io, type UpsertDBObject as ip, type DBAttribute as iq, type CreateDBAttribute as ir, type UpdateDBAttribute as is, type UpsertDBAttribute as it, type CreateObjectRecord as iu, type ListOptions as iv, type SearchOptions as iw, type GlobalSearchOptions as ix, type GlobalSearchResultItem as iy, type FileListOptions as iz, type SlotMode as j, getViewSyncPreview as j0, type ConditionRule as k, type WorkflowNode as l, type WorkflowDefinition as m, type FlowRow as n, type ViewDefinition as o, type DocumentTemplate as p, type OcrAdapter as q, type OcrInput as r, type OcrOptions as s, type OcrResult as t, type OcrPage as u, type OcrTextBlock as v, type SignatureAdapter as w, type CreateSignatureInput as x, type SignerRequest as y, type SignaturePosition as z };