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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/chunk-4SW4V3YU.mjs +8854 -0
  2. package/dist/chunk-7GSIXU67.mjs +8820 -0
  3. package/dist/chunk-BKOV4XVX.mjs +8816 -0
  4. package/dist/chunk-BQUYTOB3.mjs +8815 -0
  5. package/dist/chunk-BSAR4UKK.mjs +8851 -0
  6. package/dist/chunk-DPOXIK3M.mjs +8816 -0
  7. package/dist/chunk-DU2HLOQH.mjs +8813 -0
  8. package/dist/chunk-I4TTNDN7.mjs +8910 -0
  9. package/dist/chunk-JD2MVLTW.mjs +8814 -0
  10. package/dist/chunk-KDHA2N7D.mjs +8927 -0
  11. package/dist/chunk-MX4X4UEN.mjs +8854 -0
  12. package/dist/chunk-OJWVSONX.mjs +8900 -0
  13. package/dist/chunk-PMYSW54L.mjs +8855 -0
  14. package/dist/chunk-SD2UXOSF.mjs +8814 -0
  15. package/dist/chunk-Y5KIRAND.mjs +8916 -0
  16. package/dist/chunk-YLVZT3H4.mjs +8793 -0
  17. package/dist/chunk-ZU5SR355.mjs +8862 -0
  18. package/dist/index.d.mts +119 -6
  19. package/dist/index.d.ts +119 -6
  20. package/dist/index.js +1215 -11
  21. package/dist/index.mjs +83 -2
  22. package/dist/runtime-09fOm3VO.d.mts +6383 -0
  23. package/dist/runtime-09fOm3VO.d.ts +6383 -0
  24. package/dist/runtime-BMHqETm7.d.mts +6450 -0
  25. package/dist/runtime-BMHqETm7.d.ts +6450 -0
  26. package/dist/runtime-BpsaNQPs.d.mts +6397 -0
  27. package/dist/runtime-BpsaNQPs.d.ts +6397 -0
  28. package/dist/runtime-CHAkwiwa.d.mts +6450 -0
  29. package/dist/runtime-CHAkwiwa.d.ts +6450 -0
  30. package/dist/runtime-CPggQqoW.d.mts +6428 -0
  31. package/dist/runtime-CPggQqoW.d.ts +6428 -0
  32. package/dist/runtime-CfVfZtoq.d.mts +6437 -0
  33. package/dist/runtime-CfVfZtoq.d.ts +6437 -0
  34. package/dist/runtime-DSMMZRLE.d.mts +6430 -0
  35. package/dist/runtime-DSMMZRLE.d.ts +6430 -0
  36. package/dist/runtime-xtAfMn_f.d.mts +6436 -0
  37. package/dist/runtime-xtAfMn_f.d.ts +6436 -0
  38. package/dist/runtime.d.mts +1 -1
  39. package/dist/runtime.d.ts +1 -1
  40. package/dist/runtime.js +1075 -9
  41. package/dist/runtime.mjs +53 -1
  42. package/package.json +3 -2
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-BpsaNQPs.mjs';
2
+ export { bb as ActivityTab, d6 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cQ as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cW as AuditRepository, _ as AuditResourceType, cZ as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d5 as CreateCustomObjectInput, dX as CreateDBAttribute, e9 as CreateDBFlow, dT as CreateDBObject, e5 as CreateDBView, a9 as CreateFile, d0 as CreateFlowInput, d_ as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dw as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dW as DBAttribute, e8 as DBFlow, dS as DBObject, e4 as DBView, dN 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, dz as FileContent, e3 as FileListOptions, c$ as FileService, c_ as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cS 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, d2 as FlowService, aC as FlowSlot, aF as FlowStatus, cV as FlowsRepository, b8 as FormTab, cp as FormulaResult, dL as FullSyncOptions, dK as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d3 as GeocodingService, aJ as GeocodingSuggestion, di as GetRelationOptionsParams, e1 as GlobalSearchOptions, e2 as GlobalSearchResultItem, d4 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, d$ 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, cT as ObjectRecordsRepository, d9 as ObjectSchemaService, d8 as ObjectSchemaServiceOptions, cP as ObjectsRepository, eb as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, db as PermissionService, da as PermissionServiceOptions, cX as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dd as RecordService, dc as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dg as RelationOption, dh as RelationOptionsResponse, dl as RelationResolverService, dj as RelationService, df as RelationValidationError, de as RelationValidationResult, aj as RelativeDateValue, dk as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, dm as RollupResult, dq as RollupScheduler, dp as RollupSchedulerOptions, dn as RollupService, cB as SchemaResolver, e0 as SearchOptions, af as SelectFilterOperator, dC as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dD as StorageAdapter, a6 as StorageProvider, dA as StorageUploadInput, dB as StorageUploadResult, dG as SyncOptions, dF 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, dY as UpdateDBAttribute, ea as UpdateDBFlow, dU as UpdateDBObject, e6 as UpdateDBView, aa as UpdateFile, d1 as UpdateFlowInput, d7 as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dx as UpdateViewInput, dE as UploadFileInput, dZ as UpsertDBAttribute, dV as UpsertDBObject, e7 as UpsertDBView, b4 as UserProfile, ds as UserProfileService, dr as UserProfileServiceOptions, cR as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dv as UserService, b3 as UserStatus, du as UserValidationError, dt as UserValidationResult, bg as Uuid, c2 as ValidationResult, dy as ViewService, ed as ViewSyncOptions, ec as ViewSyncResult, cU as ViewsRepository, bE as attributeConfigSchemas, cY 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, cO as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, 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, dR as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dQ 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, dJ as getSyncPreview, cs as getTargetAttributeName, eg as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dP 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, bk as registry, bA as relationConfigSchema, dO as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dM as syncAll, dH as syncNativeObjects, ee 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, dI as verifyNativeObjectsSync, ef as verifyNativeViewsSync, bl as viewRegistry } from './runtime-BpsaNQPs.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,122 @@ 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
+ * Display the rollup value using the target attribute's type formatter
1030
+ * instead of the default rollup-specific formatting
1031
+ */
1032
+ showAsOriginal(): this;
1033
+ /**
1034
+ * Set multi-level path for traversing nested relations (Phase 4+)
1035
+ * @param path - Dot notation path (e.g., "orders.items")
1036
+ */
1037
+ path(relationPath: string): this;
1038
+ required(): any;
1039
+ optional(): any;
1040
+ }
1041
+ /**
1042
+ * Create a rollup attribute builder
1043
+ *
1044
+ * @example Sum of related amounts
1045
+ * ```typescript
1046
+ * rollup({ name: "totalOrders", label: "Total Orders" })
1047
+ * .from("orders") // relation attribute name
1048
+ * .aggregate("amount") // target attribute to sum
1049
+ * .using("sum")
1050
+ * .decimals(2)
1051
+ * ```
1052
+ *
1053
+ * @example Count of related records
1054
+ * ```typescript
1055
+ * rollup({ name: "orderCount", label: "Number of Orders" })
1056
+ * .from("orders")
1057
+ * .aggregate("id") // any attribute works for count
1058
+ * .using("count")
1059
+ * ```
1060
+ */
1061
+ declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
949
1062
  /**
950
1063
  * Union of all attribute builder types
951
1064
  */
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>;
1065
+ 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
1066
  /**
954
1067
  * Extract the attribute name from a builder
955
1068
  */
@@ -1672,4 +1785,4 @@ declare function view(name: string, label: string): ViewBuilder;
1672
1785
  */
1673
1786
  declare function group(id: string, label: string): GroupBuilder;
1674
1787
 
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 };
1788
+ 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-BpsaNQPs.js';
2
+ export { bb as ActivityTab, d6 as AddAttributeInput, ar as AdvancedFilterState, b1 as AssignRoleInput, cH as AttributeChange, B as AttributeGroup, y as AttributeType, cQ as AttributesRepository, $ as AuditAction, a0 as AuditActorType, a1 as AuditChange, a4 as AuditListOptions, a2 as AuditLogEntry, cW as AuditRepository, _ as AuditResourceType, cZ as AuditService, a5 as AuditServiceOptions, E as BaseAttribute, ad as CheckboxFilterOperator, aR as CompletionStatus, a3 as CreateAuditLogInput, d5 as CreateCustomObjectInput, dX as CreateDBAttribute, e9 as CreateDBFlow, dT as CreateDBObject, e5 as CreateDBView, a9 as CreateFile, d0 as CreateFlowInput, d_ as CreateObjectRecord, b0 as CreatePermissionInput, a_ as CreateRoleInput, b5 as CreateUserProfile, dw as CreateViewInput, ak as CurrencyFilterValue, ba as CustomTab, dW as DBAttribute, e8 as DBFlow, dS as DBObject, e4 as DBView, dN 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, dz as FileContent, e3 as FileListOptions, c$ as FileService, c_ as FileServiceOptions, Y as FileVerificationConfig, a7 as FileVisibility, cS 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, d2 as FlowService, aC as FlowSlot, aF as FlowStatus, cV as FlowsRepository, b8 as FormTab, cp as FormulaResult, dL as FullSyncOptions, dK as FullSyncResult, aN as GeocodingAdapter, aK as GeocodingAutocompleteParams, aM as GeocodingParams, d3 as GeocodingService, aJ as GeocodingSuggestion, di as GetRelationOptionsParams, e1 as GlobalSearchOptions, e2 as GlobalSearchResultItem, d4 as GlobalSearchService, cI as HookContext, cJ as HookDefinition, cK as HookHandler, cN as HookRegistry, cL as HookType, ct as InvalidPathError, d$ 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, cT as ObjectRecordsRepository, d9 as ObjectSchemaService, d8 as ObjectSchemaServiceOptions, cP as ObjectsRepository, eb as OperationResult, cy as PathCardinality, cz as PathSegment, cA as PathSegmentType, aV as Permission, aT as PermissionScope, db as PermissionService, da as PermissionServiceOptions, cX as PermissionsRepository, al as PhoneFilterValue, ax as QueryState, dd as RecordService, dc as RecordServiceOptions, Z as RelationAttribute, ah as RelationFilterOperator, dg as RelationOption, dh as RelationOptionsResponse, dl as RelationResolverService, dj as RelationService, df as RelationValidationError, de as RelationValidationResult, aj as RelativeDateValue, dk as ResolvedRelations, aL as ReverseGeocodingParams, aU as Role, dm as RollupResult, dq as RollupScheduler, dp as RollupSchedulerOptions, dn as RollupService, cB as SchemaResolver, e0 as SearchOptions, af as SelectFilterOperator, dC as SignedUrlOptions, av as SortDirection, aw as SortRule, z as StatusGroup, dD as StorageAdapter, a6 as StorageProvider, dA as StorageUploadInput, dB as StorageUploadResult, dG as SyncOptions, dF 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, dY as UpdateDBAttribute, ea as UpdateDBFlow, dU as UpdateDBObject, e6 as UpdateDBView, aa as UpdateFile, d1 as UpdateFlowInput, d7 as UpdateObjectInput, a$ as UpdateRoleInput, b6 as UpdateUserProfile, dx as UpdateViewInput, dE as UploadFileInput, dZ as UpsertDBAttribute, dV as UpsertDBObject, e7 as UpsertDBView, b4 as UserProfile, ds as UserProfileService, dr as UserProfileServiceOptions, cR as UserProfilesRepository, b2 as UserRole, aW as UserRoleAssignment, dv as UserService, b3 as UserStatus, du as UserValidationError, dt as UserValidationResult, bg as Uuid, c2 as ValidationResult, dy as ViewService, ed as ViewSyncOptions, ec as ViewSyncResult, cU as ViewsRepository, bE as attributeConfigSchemas, cY 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, cO as createMockAdapter, bX as createMultiRelationValidator, bR as createMultiselectValidator, bK as createNumberValidator, c1 as createObjectValidator, bN as createPhoneValidator, bZ as createRatingValidator, bY as createRelationValidator, 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, dR as enrichValuesWithSelectLabels, cd as evaluateFormula, ce as evaluateFormulaAttribute, cf as evaluateFormulaAttributeWithRelations, cg as evaluateFormulaWithRelations, ch as evaluateFormulaWithResult, dQ 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, dJ as getSyncPreview, cs as getTargetAttributeName, eg as getViewSyncPreview, cn as hasRelationReferences, bf as isActivityTab, as as isAdvancedFilterState, be as isCustomTab, aG as isFlowDefinition, aH as isFlowPublished, bc as isFormTab, dP 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, bk as registry, bA as relationConfigSchema, dO as renderLabelExpression, cC as resolveMultiplePaths, cD as resolveSingleValue, bD as rollupConfigSchema, bI as safeParseAttributeConfig, bw as selectConfigSchema, bt as statusConfigSchema, dM as syncAll, dH as syncNativeObjects, ee 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, dI as verifyNativeObjectsSync, ef as verifyNativeViewsSync, bl as viewRegistry } from './runtime-BpsaNQPs.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,122 @@ 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
+ * Display the rollup value using the target attribute's type formatter
1030
+ * instead of the default rollup-specific formatting
1031
+ */
1032
+ showAsOriginal(): this;
1033
+ /**
1034
+ * Set multi-level path for traversing nested relations (Phase 4+)
1035
+ * @param path - Dot notation path (e.g., "orders.items")
1036
+ */
1037
+ path(relationPath: string): this;
1038
+ required(): any;
1039
+ optional(): any;
1040
+ }
1041
+ /**
1042
+ * Create a rollup attribute builder
1043
+ *
1044
+ * @example Sum of related amounts
1045
+ * ```typescript
1046
+ * rollup({ name: "totalOrders", label: "Total Orders" })
1047
+ * .from("orders") // relation attribute name
1048
+ * .aggregate("amount") // target attribute to sum
1049
+ * .using("sum")
1050
+ * .decimals(2)
1051
+ * ```
1052
+ *
1053
+ * @example Count of related records
1054
+ * ```typescript
1055
+ * rollup({ name: "orderCount", label: "Number of Orders" })
1056
+ * .from("orders")
1057
+ * .aggregate("id") // any attribute works for count
1058
+ * .using("count")
1059
+ * ```
1060
+ */
1061
+ declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>): RollupAttributeBuilder<TName>;
949
1062
  /**
950
1063
  * Union of all attribute builder types
951
1064
  */
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>;
1065
+ 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
1066
  /**
954
1067
  * Extract the attribute name from a builder
955
1068
  */
@@ -1672,4 +1785,4 @@ declare function view(name: string, label: string): ViewBuilder;
1672
1785
  */
1673
1786
  declare function group(id: string, label: string): GroupBuilder;
1674
1787
 
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 };
1788
+ 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 };