@stndrds/schema 0.1.0-alpha.18 → 0.1.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, F as FileAttribute, U as UserAttribute, k as SingleRelationAttribute, l as MultiRelationAttribute, R as RelationTarget, m as RatingAttribute, n as FlowDefinition, o as FlowPage, p as FlowRow, q as ObjectDefinition, r as Field, s as AttributeGroupField, G as Group, V as ViewDefinition, t as Tab } from './runtime-Dw2exb5q.mjs';
2
- export { b7 as ActivityTab, cw as AddAttributeInput, an as AdvancedFilterState, aZ as AssignRoleInput, c5 as AttributeChange, w as AttributeGroup, u as AttributeType, ce as AttributesRepository, X as AuditAction, Y as AuditActorType, Z as AuditChange, a0 as AuditListOptions, _ as AuditLogEntry, ck as AuditRepository, W as AuditResourceType, cn as AuditService, a1 as AuditServiceOptions, B as BaseAttribute, a9 as CheckboxFilterOperator, aN as CompletionStatus, $ as CreateAuditLogInput, cv as CreateCustomObjectInput, de as CreateDBAttribute, dt as CreateDBFlow, da as CreateDBObject, dp as CreateDBView, a5 as CreateFile, cq as CreateFlowInput, dh as CreateObjectRecord, aY as CreatePermissionInput, aW as CreateRoleInput, b1 as CreateUserProfile, cP as CreateViewInput, ag as CurrencyFilterValue, b6 as CustomTab, dd as DBAttribute, ds as DBFlow, d9 as DBObject, dn as DBView, d4 as DEFAULT_LABEL_FALLBACK, c4 as DatabaseAdapter, aa as DateFilterOperator, y as DateFormat, z as DateValue, I as DocumentFace, H as DocumentType, J as DocumentTypeConfig, aT as EffectivePermissions, a4 as File, cS as FileContent, dm as FileListOptions, cp as FileService, co as FileServiceOptions, K as FileVerificationConfig, a3 as FileVisibility, cg as FilesRepository, ak as FilterCombinator, am as FilterGroup, ae as FilterOperator, aj as FilterRule, al as FilterState, ai as FilterValue, aA as FlowRelation, az as FlowRowField, cs as FlowService, ay as FlowSlot, aB as FlowStatus, cj as FlowsRepository, b4 as FormTab, d2 as FullSyncOptions, d1 as FullSyncResult, aJ as GeocodingAdapter, aG as GeocodingAutocompleteParams, aI as GeocodingParams, ct as GeocodingService, aF as GeocodingSuggestion, cI as GetRelationOptionsParams, dk as GlobalSearchOptions, dl as GlobalSearchResultItem, cu as GlobalSearchService, c6 as HookContext, c7 as HookDefinition, c8 as HookHandler, cb as HookRegistry, c9 as HookType, di as ListOptions, E as LocationGranularity, ac as MultiselectFilterOperator, aw as NO_VALUE_OPERATORS, av as NoValueOperator, aK as NoopGeocodingAdapter, ca as NoopHookRegistry, a8 as NumberFilterOperator, x as NumberUnit, au as OPERATORS_BY_TYPE, aM as ObjectAttribute, aU as ObjectPermissions, aO as ObjectRecord, ch as ObjectRecordsRepository, cz as ObjectSchemaService, cy as ObjectSchemaServiceOptions, cd as ObjectsRepository, dv as OperationResult, aR as Permission, aP as PermissionScope, cB as PermissionService, cA as PermissionServiceOptions, cl as PermissionsRepository, ah as PhoneFilterValue, at as QueryState, cD as RecordService, cC as RecordServiceOptions, Q as RelationAttribute, ad as RelationFilterOperator, cG as RelationOption, cH as RelationOptionsResponse, cJ as RelationService, cF as RelationValidationError, cE as RelationValidationResult, af as RelativeDateValue, aH as ReverseGeocodingParams, aQ as Role, dj as SearchOptions, ab as SelectFilterOperator, cV as SignedUrlOptions, ar as SortDirection, as as SortRule, v as StatusGroup, cW as StorageAdapter, a2 as StorageProvider, cT as StorageUploadInput, cU as StorageUploadResult, cZ as SyncOptions, cY as SyncResult, aV as SystemPermissions, b3 as TabType, b5 as TableTab, bd as TenantId, a7 as TextFilterOperator, aL as Timestamps, df as UpdateDBAttribute, du as UpdateDBFlow, db as UpdateDBObject, dq as UpdateDBView, a6 as UpdateFile, cr as UpdateFlowInput, cx as UpdateObjectInput, aX as UpdateRoleInput, b2 as UpdateUserProfile, cQ as UpdateViewInput, cX as UploadFileInput, dg as UpsertDBAttribute, dc as UpsertDBObject, dr as UpsertDBView, b0 as UserProfile, cL as UserProfileService, cK as UserProfileServiceOptions, cf as UserProfilesRepository, a_ as UserRole, aS as UserRoleAssignment, cO as UserService, a$ as UserStatus, cN as UserValidationError, cM as UserValidationResult, bc as Uuid, bW as ValidationResult, cR as ViewService, dx as ViewSyncOptions, dw as ViewSyncResult, ci as ViewsRepository, by as attributeConfigSchemas, cm as buildAuditChanges, bl as checkboxConfigSchema, c3 as computeRecordStatus, bU as createAttributeValidator, bF as createCheckboxValidator, bI as createCurrencyValidator, bG as createDateValidator, b_ as createDraftValidator, bO as createFileValidator, bM as createLocationValidator, cc as createMockAdapter, bR as createMultiRelationValidator, bL as createMultiselectValidator, bE as createNumberValidator, bV as createObjectValidator, bH as createPhoneValidator, bT as createRatingValidator, bS as createRelationValidator, bK as createSelectValidator, bQ as createSingleRelationValidator, bJ as createStatusValidator, bD as createTextValidator, bN as createTimestampValidator, bP as createUserValidator, bo as currencyConfigSchema, bm as dateConfigSchema, d8 as enrichValuesWithSelectLabels, d7 as extractAttributeNames, bu as fileConfigSchema, be as generateId, bf as generatePrefixedId, bz as getAttributeConfigSchema, c1 as getMissingRequiredAttributes, d0 as getSyncPreview, dA as getViewSyncPreview, bb as isActivityTab, ao as isAdvancedFilterState, ba as isCustomTab, aC as isFlowDefinition, aD as isFlowPublished, b8 as isFormTab, d6 as isLabelExpression, ax as isNoValueOperator, c2 as isRecordComplete, aE as isSystemFlow, b9 as isTableTab, bq as locationConfigSchema, bt as multiselectConfigSchema, bk as numberConfigSchema, bB as parseAttributeConfig, bn as phoneConfigSchema, bx as ratingConfigSchema, bg as registry, bw as relationConfigSchema, d5 as renderLabelExpression, bC as safeParseAttributeConfig, bs as selectConfigSchema, bp as statusConfigSchema, d3 as syncAll, c_ as syncNativeObjects, dy as syncNativeViews, bi as textConfigSchema, bj as textareaConfigSchema, br as timestampConfigSchema, ap as toAdvancedFilterState, aq as toSimpleFilterState, bv as userConfigSchema, bX as validateAttribute, bA as validateAttributeConfig, b$ as validateDraft, c0 as validateDraftOrThrow, bY as validateObject, bZ as validateObjectOrThrow, c$ as verifyNativeObjectsSync, dz as verifyNativeViewsSync, bh as viewRegistry } from './runtime-Dw2exb5q.mjs';
1
+ import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, F as FormulaAttribute, R as RollupAttribute, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, k as FileAttribute, U as UserAttribute, l as SingleRelationAttribute, m as MultiRelationAttribute, n as RelationTarget, o as RatingAttribute, p as FormulaReturnType, q as RollupFunction, r as FlowDefinition, s as FlowPage, t as FlowRow, u as ObjectDefinition, v as Field, w as AttributeGroupField, G as Group, V as ViewDefinition, x as Tab } from './runtime-DSMMZRLE.mjs';
2
+ export { bb as ActivityTab, d9 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cT as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cZ as AuditRepository, _ as AuditResourceType, d0 as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d8 as CreateCustomObjectInput, d_ as CreateDBAttribute, ec as CreateDBFlow, dW as CreateDBObject, e8 as CreateDBView, a9 as CreateFile, d3 as CreateFlowInput, e1 as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dz as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dZ as DBAttribute, eb as DBFlow, dV as DBObject, e7 as DBView, dQ as DEFAULT_LABEL_FALLBACK, cc as DatabaseAdapter, ae as DateFilterOperator, I as DateFormat, J as DateValue, W as DocumentFace, Q as DocumentType, X as DocumentTypeConfig, aX as EffectivePermissions, a8 as File, dC as FileContent, e6 as FileListOptions, d2 as FileService, d1 as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cV as FilesRepository, ao as FilterCombinator, aq as FilterGroup, ai as FilterOperator, an as FilterRule, ap as FilterState, am as FilterValue, aE as FlowRelation, aD as FlowRowField, d5 as FlowService, aC as FlowSlot, aF as FlowStatus, cY as FlowsRepository, b8 as FormTab, cp as FormulaResult, dO as FullSyncOptions, dN as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d6 as GeocodingService, aJ as GeocodingSuggestion, dl as GetRelationOptionsParams, e4 as GlobalSearchOptions, e5 as GlobalSearchResultItem, d7 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, e2 as ListOptions, K as LocationGranularity, cu as MaxDepthExceededError, ag as MultiselectFilterOperator, aA as NO_VALUE_OPERATORS, az as NoValueOperator, aO as NoopGeocodingAdapter, cM as NoopHookRegistry, ac as NumberFilterOperator, H as NumberUnit, ay as OPERATORS_BY_TYPE, aQ as ObjectAttribute, aY as ObjectPermissions, aS as ObjectRecord, cW as ObjectRecordsRepository, dc as ObjectSchemaService, db as ObjectSchemaServiceOptions, cS as ObjectsRepository, ee as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, de as PermissionService, dd as PermissionServiceOptions, c_ as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dg as RecordService, df as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dj as RelationOption, dk as RelationOptionsResponse, dp as RelationResolverService, dm as RelationService, di as RelationValidationError, dh as RelationValidationResult, aj as RelativeDateValue, dn as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, cQ as RollupHooksConfig, dq as RollupResult, dt as RollupScheduler, ds as RollupSchedulerOptions, dr as RollupService, cB as SchemaResolver, e3 as SearchOptions, af as SelectFilterOperator, dF as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dG as StorageAdapter, a6 as StorageProvider, dD as StorageUploadInput, dE as StorageUploadResult, dJ as SyncOptions, dI as SyncResult, aZ as SystemPermissions, b7 as TabType, b9 as TableTab, bh as TenantId, ab as TextFilterOperator, aP as Timestamps, cF as TraversalOptions, cG as TraversalResult, d$ as UpdateDBAttribute, ed as UpdateDBFlow, dX as UpdateDBObject, e9 as UpdateDBView, aa as UpdateFile, d4 as UpdateFlowInput, da as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dA as UpdateViewInput, dH as UploadFileInput, e0 as UpsertDBAttribute, dY as UpsertDBObject, ea as UpsertDBView, b4 as UserProfile, dv as UserProfileService, du as UserProfileServiceOptions, cU as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dy as UserService, b3 as UserStatus, dx as UserValidationError, dw as UserValidationResult, bg as Uuid, c2 as ValidationResult, dB as ViewService, eg as ViewSyncOptions, ef as ViewSyncResult, cX as ViewsRepository, bE as attributeConfigSchemas, c$ as buildAuditChanges, bp as checkboxConfigSchema, cb as computeRecordStatus, c0 as createAttributeValidator, bL as createCheckboxValidator, bO as createCurrencyValidator, bM as createDateValidator, c6 as createDraftValidator, bU as createFileValidator, b_ as createFormulaValidator, bS as createLocationValidator, cR as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, cO as createRollupHooks, b$ as createRollupValidator, bQ as createSelectValidator, bW as createSingleRelationValidator, bP as createStatusValidator, bJ as createTextValidator, bT as createTimestampValidator, bV as createUserValidator, bs as currencyConfigSchema, bq as dateConfigSchema, dU as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dT as extractAttributeNames, ci as extractFormulaVariables, cj as extractRelationNames, ck as extractRelationReferences, by as fileConfigSchema, cl as flattenRelationsForEval, cm as formatFormulaResult, bC as formulaConfigSchema, bi as generateId, bj as generatePrefixedId, bF as getAttributeConfigSchema, c9 as getMissingRequiredAttributes, cq as getPathDepth, cr as getRelationPath, dM as getSyncPreview, cs as getTargetAttributeName, ej as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dS as isLabelExpression, aB as isNoValueOperator, ca as isRecordComplete, aI as isSystemFlow, bd as isTableTab, bu as locationConfigSchema, bx as multiselectConfigSchema, bo as numberConfigSchema, bH as parseAttributeConfig, cv as parsePath, cw as pathHasManyCardinality, br as phoneConfigSchema, bB as ratingConfigSchema, cP as registerAllRollupHooks, bk as registry, bA as relationConfigSchema, dR as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dP as syncAll, dK as syncNativeObjects, eh as syncNativeViews, bm as textConfigSchema, bn as textareaConfigSchema, bv as timestampConfigSchema, at as toAdvancedFilterState, au as toSimpleFilterState, cE as traversePath, bz as userConfigSchema, c3 as validateAttribute, bG as validateAttributeConfig, c7 as validateDraft, c8 as validateDraftOrThrow, co as validateFormulaExpression, c4 as validateObject, c5 as validateObjectOrThrow, cx as validatePath, dL as verifyNativeObjectsSync, ei as verifyNativeViewsSync, bl as viewRegistry } from './runtime-DSMMZRLE.mjs';
3
3
  import { IconName, CountryIso3, CurrencyCode, MimeType, ColorId } from '@stndrds/constants';
4
4
  import 'zod';
5
5
 
@@ -214,8 +214,9 @@ type InferRecordUpdate<TMap extends AttributeMap> = Partial<InferRecordFromSchem
214
214
  /**
215
215
  * Base type for custom attribute values added via UI
216
216
  * Supports all possible attribute value types
217
+ * Formula and Rollup attributes don't have defaultValue, so we exclude them
217
218
  */
218
- type CustomAttributeValue = Attribute["defaultValue"] | undefined;
219
+ type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribute>["defaultValue"] | undefined;
219
220
  /**
220
221
  * Adds support for custom attributes (added via UI) to a record type
221
222
  * Preserves autocompletion for known attributes while allowing additional properties
@@ -609,7 +610,7 @@ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
609
610
  description(value: string): this;
610
611
  icon(value: IconName): this;
611
612
  order(value: number): this;
612
- defaultValue(value: TAttr["defaultValue"]): this;
613
+ defaultValue(value: "defaultValue" extends keyof TAttr ? TAttr["defaultValue"] : never): this;
613
614
  metadata(value: Record<string, unknown>): this;
614
615
  build(): TAttr;
615
616
  }
@@ -946,10 +947,117 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
946
947
  optional(): RatingAttributeBuilder<TName, false>;
947
948
  }
948
949
  declare function rating<TName extends string>(config: TypedBuilderConfig<TName>): RatingAttributeBuilder<TName, false>;
950
+ /**
951
+ * Builder for formula attributes (computed values)
952
+ *
953
+ * Formula attributes are always read-only and cannot be required.
954
+ */
955
+ declare class FormulaAttributeBuilder<TName extends string> extends BaseAttributeBuilder<FormulaAttribute> {
956
+ readonly _types: {
957
+ name: TName;
958
+ attribute: FormulaAttribute;
959
+ required: false;
960
+ };
961
+ constructor(name: TName, label: string);
962
+ /**
963
+ * Set the formula expression
964
+ * @param expr - Expression to evaluate (e.g., "price * quantity")
965
+ */
966
+ expression(expr: string): this;
967
+ /**
968
+ * Set the expected return type for formatting
969
+ * @param type - Return type: "text", "number", "boolean", or "date"
970
+ */
971
+ returns(type: FormulaReturnType): this;
972
+ /**
973
+ * Set decimal places for number results
974
+ */
975
+ decimals(value: number): this;
976
+ required(): any;
977
+ optional(): any;
978
+ }
979
+ /**
980
+ * Create a formula attribute builder
981
+ *
982
+ * @example Simple calculation
983
+ * ```typescript
984
+ * formula({ name: "total", label: "Total" })
985
+ * .expression("price * quantity")
986
+ * .returns("number")
987
+ * .decimals(2)
988
+ * ```
989
+ *
990
+ * @example With functions
991
+ * ```typescript
992
+ * formula({ name: "fullName", label: "Full Name" })
993
+ * .expression("CONCAT(firstName, ' ', lastName)")
994
+ * .returns("text")
995
+ * ```
996
+ */
997
+ declare function formula<TName extends string>(config: TypedBuilderConfig<TName>): FormulaAttributeBuilder<TName>;
998
+ /**
999
+ * Builder for rollup attributes (aggregations from related records)
1000
+ *
1001
+ * Rollup attributes are always read-only and cannot be required.
1002
+ */
1003
+ declare class RollupAttributeBuilder<TName extends string> extends BaseAttributeBuilder<RollupAttribute> {
1004
+ readonly _types: {
1005
+ name: TName;
1006
+ attribute: RollupAttribute;
1007
+ required: false;
1008
+ };
1009
+ constructor(name: TName, label: string);
1010
+ /**
1011
+ * Set the relation attribute to aggregate from
1012
+ * @param relationName - Name of the relation attribute on this object
1013
+ */
1014
+ from(relationName: string): this;
1015
+ /**
1016
+ * Set the target attribute to aggregate
1017
+ * @param attrName - Name of the attribute on the related object
1018
+ */
1019
+ aggregate(attrName: string): this;
1020
+ /**
1021
+ * Set the aggregation function
1022
+ */
1023
+ using(fn: RollupFunction): this;
1024
+ /**
1025
+ * Set decimal places for numeric results
1026
+ */
1027
+ decimals(value: number): this;
1028
+ /**
1029
+ * Set multi-level path for traversing nested relations (Phase 4+)
1030
+ * @param path - Dot notation path (e.g., "orders.items")
1031
+ */
1032
+ path(relationPath: string): this;
1033
+ required(): any;
1034
+ optional(): any;
1035
+ }
1036
+ /**
1037
+ * Create a rollup attribute builder
1038
+ *
1039
+ * @example Sum of related amounts
1040
+ * ```typescript
1041
+ * rollup({ name: "totalOrders", label: "Total Orders" })
1042
+ * .from("orders") // relation attribute name
1043
+ * .aggregate("amount") // target attribute to sum
1044
+ * .using("sum")
1045
+ * .decimals(2)
1046
+ * ```
1047
+ *
1048
+ * @example Count of related records
1049
+ * ```typescript
1050
+ * rollup({ name: "orderCount", label: "Number of Orders" })
1051
+ * .from("orders")
1052
+ * .aggregate("id") // any attribute works for count
1053
+ * .using("count")
1054
+ * ```
1055
+ */
1056
+ declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
949
1057
  /**
950
1058
  * Union of all attribute builder types
951
1059
  */
952
- type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean>;
1060
+ type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean> | FormulaAttributeBuilder<string> | RollupAttributeBuilder<string>;
953
1061
  /**
954
1062
  * Extract the attribute name from a builder
955
1063
  */
@@ -1672,4 +1780,4 @@ declare function view(name: string, label: string): ViewBuilder;
1672
1780
  */
1673
1781
  declare function group(id: string, label: string): GroupBuilder;
1674
1782
 
1675
- export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, select, status, text, textarea, timestamp, user, view };
1783
+ export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, FormulaAttribute, FormulaReturnType, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, formula, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, rollup, select, status, text, textarea, timestamp, user, view };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, F as FileAttribute, U as UserAttribute, k as SingleRelationAttribute, l as MultiRelationAttribute, R as RelationTarget, m as RatingAttribute, n as FlowDefinition, o as FlowPage, p as FlowRow, q as ObjectDefinition, r as Field, s as AttributeGroupField, G as Group, V as ViewDefinition, t as Tab } from './runtime-Dw2exb5q.js';
2
- export { b7 as ActivityTab, cw as AddAttributeInput, an as AdvancedFilterState, aZ as AssignRoleInput, c5 as AttributeChange, w as AttributeGroup, u as AttributeType, ce as AttributesRepository, X as AuditAction, Y as AuditActorType, Z as AuditChange, a0 as AuditListOptions, _ as AuditLogEntry, ck as AuditRepository, W as AuditResourceType, cn as AuditService, a1 as AuditServiceOptions, B as BaseAttribute, a9 as CheckboxFilterOperator, aN as CompletionStatus, $ as CreateAuditLogInput, cv as CreateCustomObjectInput, de as CreateDBAttribute, dt as CreateDBFlow, da as CreateDBObject, dp as CreateDBView, a5 as CreateFile, cq as CreateFlowInput, dh as CreateObjectRecord, aY as CreatePermissionInput, aW as CreateRoleInput, b1 as CreateUserProfile, cP as CreateViewInput, ag as CurrencyFilterValue, b6 as CustomTab, dd as DBAttribute, ds as DBFlow, d9 as DBObject, dn as DBView, d4 as DEFAULT_LABEL_FALLBACK, c4 as DatabaseAdapter, aa as DateFilterOperator, y as DateFormat, z as DateValue, I as DocumentFace, H as DocumentType, J as DocumentTypeConfig, aT as EffectivePermissions, a4 as File, cS as FileContent, dm as FileListOptions, cp as FileService, co as FileServiceOptions, K as FileVerificationConfig, a3 as FileVisibility, cg as FilesRepository, ak as FilterCombinator, am as FilterGroup, ae as FilterOperator, aj as FilterRule, al as FilterState, ai as FilterValue, aA as FlowRelation, az as FlowRowField, cs as FlowService, ay as FlowSlot, aB as FlowStatus, cj as FlowsRepository, b4 as FormTab, d2 as FullSyncOptions, d1 as FullSyncResult, aJ as GeocodingAdapter, aG as GeocodingAutocompleteParams, aI as GeocodingParams, ct as GeocodingService, aF as GeocodingSuggestion, cI as GetRelationOptionsParams, dk as GlobalSearchOptions, dl as GlobalSearchResultItem, cu as GlobalSearchService, c6 as HookContext, c7 as HookDefinition, c8 as HookHandler, cb as HookRegistry, c9 as HookType, di as ListOptions, E as LocationGranularity, ac as MultiselectFilterOperator, aw as NO_VALUE_OPERATORS, av as NoValueOperator, aK as NoopGeocodingAdapter, ca as NoopHookRegistry, a8 as NumberFilterOperator, x as NumberUnit, au as OPERATORS_BY_TYPE, aM as ObjectAttribute, aU as ObjectPermissions, aO as ObjectRecord, ch as ObjectRecordsRepository, cz as ObjectSchemaService, cy as ObjectSchemaServiceOptions, cd as ObjectsRepository, dv as OperationResult, aR as Permission, aP as PermissionScope, cB as PermissionService, cA as PermissionServiceOptions, cl as PermissionsRepository, ah as PhoneFilterValue, at as QueryState, cD as RecordService, cC as RecordServiceOptions, Q as RelationAttribute, ad as RelationFilterOperator, cG as RelationOption, cH as RelationOptionsResponse, cJ as RelationService, cF as RelationValidationError, cE as RelationValidationResult, af as RelativeDateValue, aH as ReverseGeocodingParams, aQ as Role, dj as SearchOptions, ab as SelectFilterOperator, cV as SignedUrlOptions, ar as SortDirection, as as SortRule, v as StatusGroup, cW as StorageAdapter, a2 as StorageProvider, cT as StorageUploadInput, cU as StorageUploadResult, cZ as SyncOptions, cY as SyncResult, aV as SystemPermissions, b3 as TabType, b5 as TableTab, bd as TenantId, a7 as TextFilterOperator, aL as Timestamps, df as UpdateDBAttribute, du as UpdateDBFlow, db as UpdateDBObject, dq as UpdateDBView, a6 as UpdateFile, cr as UpdateFlowInput, cx as UpdateObjectInput, aX as UpdateRoleInput, b2 as UpdateUserProfile, cQ as UpdateViewInput, cX as UploadFileInput, dg as UpsertDBAttribute, dc as UpsertDBObject, dr as UpsertDBView, b0 as UserProfile, cL as UserProfileService, cK as UserProfileServiceOptions, cf as UserProfilesRepository, a_ as UserRole, aS as UserRoleAssignment, cO as UserService, a$ as UserStatus, cN as UserValidationError, cM as UserValidationResult, bc as Uuid, bW as ValidationResult, cR as ViewService, dx as ViewSyncOptions, dw as ViewSyncResult, ci as ViewsRepository, by as attributeConfigSchemas, cm as buildAuditChanges, bl as checkboxConfigSchema, c3 as computeRecordStatus, bU as createAttributeValidator, bF as createCheckboxValidator, bI as createCurrencyValidator, bG as createDateValidator, b_ as createDraftValidator, bO as createFileValidator, bM as createLocationValidator, cc as createMockAdapter, bR as createMultiRelationValidator, bL as createMultiselectValidator, bE as createNumberValidator, bV as createObjectValidator, bH as createPhoneValidator, bT as createRatingValidator, bS as createRelationValidator, bK as createSelectValidator, bQ as createSingleRelationValidator, bJ as createStatusValidator, bD as createTextValidator, bN as createTimestampValidator, bP as createUserValidator, bo as currencyConfigSchema, bm as dateConfigSchema, d8 as enrichValuesWithSelectLabels, d7 as extractAttributeNames, bu as fileConfigSchema, be as generateId, bf as generatePrefixedId, bz as getAttributeConfigSchema, c1 as getMissingRequiredAttributes, d0 as getSyncPreview, dA as getViewSyncPreview, bb as isActivityTab, ao as isAdvancedFilterState, ba as isCustomTab, aC as isFlowDefinition, aD as isFlowPublished, b8 as isFormTab, d6 as isLabelExpression, ax as isNoValueOperator, c2 as isRecordComplete, aE as isSystemFlow, b9 as isTableTab, bq as locationConfigSchema, bt as multiselectConfigSchema, bk as numberConfigSchema, bB as parseAttributeConfig, bn as phoneConfigSchema, bx as ratingConfigSchema, bg as registry, bw as relationConfigSchema, d5 as renderLabelExpression, bC as safeParseAttributeConfig, bs as selectConfigSchema, bp as statusConfigSchema, d3 as syncAll, c_ as syncNativeObjects, dy as syncNativeViews, bi as textConfigSchema, bj as textareaConfigSchema, br as timestampConfigSchema, ap as toAdvancedFilterState, aq as toSimpleFilterState, bv as userConfigSchema, bX as validateAttribute, bA as validateAttributeConfig, b$ as validateDraft, c0 as validateDraftOrThrow, bY as validateObject, bZ as validateObjectOrThrow, c$ as verifyNativeObjectsSync, dz as verifyNativeViewsSync, bh as viewRegistry } from './runtime-Dw2exb5q.js';
1
+ import { A as Attribute, S as StatusAttribute, a as SelectAttribute, M as MultiselectAttribute, P as Phone, C as Currency, L as Location, F as FormulaAttribute, R as RollupAttribute, b as SystemResource, c as SystemAction, O as ObjectAction, T as TextAttribute, d as TextAreaAttribute, N as NumberAttribute, e as CheckboxAttribute, D as DateAttribute, f as PhoneAttribute, g as CurrencyAttribute, h as Option, i as LocationAttribute, j as TimestampAttribute, k as FileAttribute, U as UserAttribute, l as SingleRelationAttribute, m as MultiRelationAttribute, n as RelationTarget, o as RatingAttribute, p as FormulaReturnType, q as RollupFunction, r as FlowDefinition, s as FlowPage, t as FlowRow, u as ObjectDefinition, v as Field, w as AttributeGroupField, G as Group, V as ViewDefinition, x as Tab } from './runtime-DSMMZRLE.js';
2
+ export { bb as ActivityTab, d9 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cT as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cZ as AuditRepository, _ as AuditResourceType, d0 as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d8 as CreateCustomObjectInput, d_ as CreateDBAttribute, ec as CreateDBFlow, dW as CreateDBObject, e8 as CreateDBView, a9 as CreateFile, d3 as CreateFlowInput, e1 as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dz as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dZ as DBAttribute, eb as DBFlow, dV as DBObject, e7 as DBView, dQ as DEFAULT_LABEL_FALLBACK, cc as DatabaseAdapter, ae as DateFilterOperator, I as DateFormat, J as DateValue, W as DocumentFace, Q as DocumentType, X as DocumentTypeConfig, aX as EffectivePermissions, a8 as File, dC as FileContent, e6 as FileListOptions, d2 as FileService, d1 as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cV as FilesRepository, ao as FilterCombinator, aq as FilterGroup, ai as FilterOperator, an as FilterRule, ap as FilterState, am as FilterValue, aE as FlowRelation, aD as FlowRowField, d5 as FlowService, aC as FlowSlot, aF as FlowStatus, cY as FlowsRepository, b8 as FormTab, cp as FormulaResult, dO as FullSyncOptions, dN as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d6 as GeocodingService, aJ as GeocodingSuggestion, dl as GetRelationOptionsParams, e4 as GlobalSearchOptions, e5 as GlobalSearchResultItem, d7 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, e2 as ListOptions, K as LocationGranularity, cu as MaxDepthExceededError, ag as MultiselectFilterOperator, aA as NO_VALUE_OPERATORS, az as NoValueOperator, aO as NoopGeocodingAdapter, cM as NoopHookRegistry, ac as NumberFilterOperator, H as NumberUnit, ay as OPERATORS_BY_TYPE, aQ as ObjectAttribute, aY as ObjectPermissions, aS as ObjectRecord, cW as ObjectRecordsRepository, dc as ObjectSchemaService, db as ObjectSchemaServiceOptions, cS as ObjectsRepository, ee as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, de as PermissionService, dd as PermissionServiceOptions, c_ as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dg as RecordService, df as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dj as RelationOption, dk as RelationOptionsResponse, dp as RelationResolverService, dm as RelationService, di as RelationValidationError, dh as RelationValidationResult, aj as RelativeDateValue, dn as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, cQ as RollupHooksConfig, dq as RollupResult, dt as RollupScheduler, ds as RollupSchedulerOptions, dr as RollupService, cB as SchemaResolver, e3 as SearchOptions, af as SelectFilterOperator, dF as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dG as StorageAdapter, a6 as StorageProvider, dD as StorageUploadInput, dE as StorageUploadResult, dJ as SyncOptions, dI as SyncResult, aZ as SystemPermissions, b7 as TabType, b9 as TableTab, bh as TenantId, ab as TextFilterOperator, aP as Timestamps, cF as TraversalOptions, cG as TraversalResult, d$ as UpdateDBAttribute, ed as UpdateDBFlow, dX as UpdateDBObject, e9 as UpdateDBView, aa as UpdateFile, d4 as UpdateFlowInput, da as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dA as UpdateViewInput, dH as UploadFileInput, e0 as UpsertDBAttribute, dY as UpsertDBObject, ea as UpsertDBView, b4 as UserProfile, dv as UserProfileService, du as UserProfileServiceOptions, cU as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dy as UserService, b3 as UserStatus, dx as UserValidationError, dw as UserValidationResult, bg as Uuid, c2 as ValidationResult, dB as ViewService, eg as ViewSyncOptions, ef as ViewSyncResult, cX as ViewsRepository, bE as attributeConfigSchemas, c$ as buildAuditChanges, bp as checkboxConfigSchema, cb as computeRecordStatus, c0 as createAttributeValidator, bL as createCheckboxValidator, bO as createCurrencyValidator, bM as createDateValidator, c6 as createDraftValidator, bU as createFileValidator, b_ as createFormulaValidator, bS as createLocationValidator, cR as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, cO as createRollupHooks, b$ as createRollupValidator, bQ as createSelectValidator, bW as createSingleRelationValidator, bP as createStatusValidator, bJ as createTextValidator, bT as createTimestampValidator, bV as createUserValidator, bs as currencyConfigSchema, bq as dateConfigSchema, dU as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dT as extractAttributeNames, ci as extractFormulaVariables, cj as extractRelationNames, ck as extractRelationReferences, by as fileConfigSchema, cl as flattenRelationsForEval, cm as formatFormulaResult, bC as formulaConfigSchema, bi as generateId, bj as generatePrefixedId, bF as getAttributeConfigSchema, c9 as getMissingRequiredAttributes, cq as getPathDepth, cr as getRelationPath, dM as getSyncPreview, cs as getTargetAttributeName, ej as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dS as isLabelExpression, aB as isNoValueOperator, ca as isRecordComplete, aI as isSystemFlow, bd as isTableTab, bu as locationConfigSchema, bx as multiselectConfigSchema, bo as numberConfigSchema, bH as parseAttributeConfig, cv as parsePath, cw as pathHasManyCardinality, br as phoneConfigSchema, bB as ratingConfigSchema, cP as registerAllRollupHooks, bk as registry, bA as relationConfigSchema, dR as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dP as syncAll, dK as syncNativeObjects, eh as syncNativeViews, bm as textConfigSchema, bn as textareaConfigSchema, bv as timestampConfigSchema, at as toAdvancedFilterState, au as toSimpleFilterState, cE as traversePath, bz as userConfigSchema, c3 as validateAttribute, bG as validateAttributeConfig, c7 as validateDraft, c8 as validateDraftOrThrow, co as validateFormulaExpression, c4 as validateObject, c5 as validateObjectOrThrow, cx as validatePath, dL as verifyNativeObjectsSync, ei as verifyNativeViewsSync, bl as viewRegistry } from './runtime-DSMMZRLE.js';
3
3
  import { IconName, CountryIso3, CurrencyCode, MimeType, ColorId } from '@stndrds/constants';
4
4
  import 'zod';
5
5
 
@@ -214,8 +214,9 @@ type InferRecordUpdate<TMap extends AttributeMap> = Partial<InferRecordFromSchem
214
214
  /**
215
215
  * Base type for custom attribute values added via UI
216
216
  * Supports all possible attribute value types
217
+ * Formula and Rollup attributes don't have defaultValue, so we exclude them
217
218
  */
218
- type CustomAttributeValue = Attribute["defaultValue"] | undefined;
219
+ type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribute>["defaultValue"] | undefined;
219
220
  /**
220
221
  * Adds support for custom attributes (added via UI) to a record type
221
222
  * Preserves autocompletion for known attributes while allowing additional properties
@@ -609,7 +610,7 @@ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
609
610
  description(value: string): this;
610
611
  icon(value: IconName): this;
611
612
  order(value: number): this;
612
- defaultValue(value: TAttr["defaultValue"]): this;
613
+ defaultValue(value: "defaultValue" extends keyof TAttr ? TAttr["defaultValue"] : never): this;
613
614
  metadata(value: Record<string, unknown>): this;
614
615
  build(): TAttr;
615
616
  }
@@ -946,10 +947,117 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
946
947
  optional(): RatingAttributeBuilder<TName, false>;
947
948
  }
948
949
  declare function rating<TName extends string>(config: TypedBuilderConfig<TName>): RatingAttributeBuilder<TName, false>;
950
+ /**
951
+ * Builder for formula attributes (computed values)
952
+ *
953
+ * Formula attributes are always read-only and cannot be required.
954
+ */
955
+ declare class FormulaAttributeBuilder<TName extends string> extends BaseAttributeBuilder<FormulaAttribute> {
956
+ readonly _types: {
957
+ name: TName;
958
+ attribute: FormulaAttribute;
959
+ required: false;
960
+ };
961
+ constructor(name: TName, label: string);
962
+ /**
963
+ * Set the formula expression
964
+ * @param expr - Expression to evaluate (e.g., "price * quantity")
965
+ */
966
+ expression(expr: string): this;
967
+ /**
968
+ * Set the expected return type for formatting
969
+ * @param type - Return type: "text", "number", "boolean", or "date"
970
+ */
971
+ returns(type: FormulaReturnType): this;
972
+ /**
973
+ * Set decimal places for number results
974
+ */
975
+ decimals(value: number): this;
976
+ required(): any;
977
+ optional(): any;
978
+ }
979
+ /**
980
+ * Create a formula attribute builder
981
+ *
982
+ * @example Simple calculation
983
+ * ```typescript
984
+ * formula({ name: "total", label: "Total" })
985
+ * .expression("price * quantity")
986
+ * .returns("number")
987
+ * .decimals(2)
988
+ * ```
989
+ *
990
+ * @example With functions
991
+ * ```typescript
992
+ * formula({ name: "fullName", label: "Full Name" })
993
+ * .expression("CONCAT(firstName, ' ', lastName)")
994
+ * .returns("text")
995
+ * ```
996
+ */
997
+ declare function formula<TName extends string>(config: TypedBuilderConfig<TName>): FormulaAttributeBuilder<TName>;
998
+ /**
999
+ * Builder for rollup attributes (aggregations from related records)
1000
+ *
1001
+ * Rollup attributes are always read-only and cannot be required.
1002
+ */
1003
+ declare class RollupAttributeBuilder<TName extends string> extends BaseAttributeBuilder<RollupAttribute> {
1004
+ readonly _types: {
1005
+ name: TName;
1006
+ attribute: RollupAttribute;
1007
+ required: false;
1008
+ };
1009
+ constructor(name: TName, label: string);
1010
+ /**
1011
+ * Set the relation attribute to aggregate from
1012
+ * @param relationName - Name of the relation attribute on this object
1013
+ */
1014
+ from(relationName: string): this;
1015
+ /**
1016
+ * Set the target attribute to aggregate
1017
+ * @param attrName - Name of the attribute on the related object
1018
+ */
1019
+ aggregate(attrName: string): this;
1020
+ /**
1021
+ * Set the aggregation function
1022
+ */
1023
+ using(fn: RollupFunction): this;
1024
+ /**
1025
+ * Set decimal places for numeric results
1026
+ */
1027
+ decimals(value: number): this;
1028
+ /**
1029
+ * Set multi-level path for traversing nested relations (Phase 4+)
1030
+ * @param path - Dot notation path (e.g., "orders.items")
1031
+ */
1032
+ path(relationPath: string): this;
1033
+ required(): any;
1034
+ optional(): any;
1035
+ }
1036
+ /**
1037
+ * Create a rollup attribute builder
1038
+ *
1039
+ * @example Sum of related amounts
1040
+ * ```typescript
1041
+ * rollup({ name: "totalOrders", label: "Total Orders" })
1042
+ * .from("orders") // relation attribute name
1043
+ * .aggregate("amount") // target attribute to sum
1044
+ * .using("sum")
1045
+ * .decimals(2)
1046
+ * ```
1047
+ *
1048
+ * @example Count of related records
1049
+ * ```typescript
1050
+ * rollup({ name: "orderCount", label: "Number of Orders" })
1051
+ * .from("orders")
1052
+ * .aggregate("id") // any attribute works for count
1053
+ * .using("count")
1054
+ * ```
1055
+ */
1056
+ declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
949
1057
  /**
950
1058
  * Union of all attribute builder types
951
1059
  */
952
- type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean>;
1060
+ type AnyAttributeBuilder = TextAttributeBuilder<string, boolean> | TextAreaAttributeBuilder<string, boolean> | NumberAttributeBuilder<string, boolean> | CheckboxAttributeBuilder<string, boolean> | DateAttributeBuilder<string, boolean> | PhoneAttributeBuilder<string, boolean> | CurrencyAttributeBuilder<string, boolean> | StatusAttributeBuilder<string, readonly Option[], boolean> | SelectAttributeBuilder<string, readonly Option[], boolean> | MultiselectAttributeBuilder<string, readonly Option[], boolean> | LocationAttributeBuilder<string, boolean> | TimestampAttributeBuilder<string, boolean> | FileAttributeBuilder<string, boolean> | UserAttributeBuilder<string, boolean> | SingleRelationAttributeBuilder<string, boolean> | MultiRelationAttributeBuilder<string, boolean> | RatingAttributeBuilder<string, boolean> | FormulaAttributeBuilder<string> | RollupAttributeBuilder<string>;
953
1061
  /**
954
1062
  * Extract the attribute name from a builder
955
1063
  */
@@ -1672,4 +1780,4 @@ declare function view(name: string, label: string): ViewBuilder;
1672
1780
  */
1673
1781
  declare function group(id: string, label: string): GroupBuilder;
1674
1782
 
1675
- export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, select, status, text, textarea, timestamp, user, view };
1783
+ export { ALL_SYSTEM_RESOURCES, type AddAttribute$1 as AddAttribute, type AnyAttributeBuilder, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, type AttributeUsage, type BuilderConfig, CheckboxAttribute, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, Field, FileAttribute, FileNotFoundError, FlowBuilder, FlowDefinition, FlowPage, FlowPageBuilder, FlowRow, FlowRowBuilder, ForbiddenError, FormulaAttribute, FormulaReturnType, Group, GroupBuilder, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, Location, LocationAttribute, MultiRelationAttribute, MultiselectAttribute, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectAction, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, ObjectReferencedError, Option, Phone, PhoneAttribute, ProtectedResourceError, ProtectedRoleError, RatingAttribute, RecordNotFoundError, type RecordReference, RecordReferencedError, RelationTarget, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, SchemaError, SchemaErrorCode, SelectAttribute, SingleRelationAttribute, StatusAttribute, SyncError, SystemAction, SystemResource, Tab, TabBuilder, TableTabConfig, TextAreaAttribute, TextAttribute, TimestampAttribute, type TypedAttribute, type TypedBuilderConfig, UserAttribute, UserProfileNotFoundError, ValidationError, type ValidationErrorDetail, ViewBuilder, ViewDefinition, type WithCustomAttributes, checkbox, currency, date, file, flow, formatAttributeValue, formula, group, isDefaultRole, isForbiddenError, isNotFoundError, isProtectedResourceError, isSchemaError, isValidationError, location, multiselect, number, object, phone, rating, relation, rollup, select, status, text, textarea, timestamp, user, view };