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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/attributes-Btn-GLvC.d.ts +674 -0
  2. package/dist/attributes-CeDp1IMp.d.mts +674 -0
  3. package/dist/chunk-2TEWGEUI.js +212 -0
  4. package/dist/chunk-4RGFTMQR.mjs +8 -0
  5. package/dist/chunk-5TLM4QXO.mjs +8 -0
  6. package/dist/chunk-67PQMHQA.mjs +199 -0
  7. package/dist/chunk-6HHSX6LP.js +64 -0
  8. package/dist/chunk-AHPXNPJC.js +105 -0
  9. package/dist/chunk-BEN6TE7Y.js +11 -0
  10. package/dist/chunk-BH3RPSC5.js +22 -0
  11. package/dist/chunk-BIQ35DLC.mjs +78 -0
  12. package/dist/chunk-CKZHFJQT.js +16 -0
  13. package/dist/chunk-E6XO2STS.js +11 -11
  14. package/dist/chunk-EIWGW2ML.mjs +99 -0
  15. package/dist/chunk-EKG35CSO.mjs +1 -0
  16. package/dist/chunk-IMEPIVTR.js +217 -0
  17. package/dist/chunk-J4ORNCAH.js +10 -0
  18. package/dist/chunk-KC4F3HB7.js +32 -0
  19. package/dist/chunk-LHXE7LLD.js +28 -0
  20. package/dist/chunk-MD6XGXTU.mjs +18 -0
  21. package/dist/chunk-N47XKY4R.js +14 -0
  22. package/dist/chunk-NXXSNUDI.mjs +8 -0
  23. package/dist/chunk-PKG3E5MW.mjs +18 -0
  24. package/dist/chunk-PZT3CIHD.mjs +192 -0
  25. package/dist/chunk-QL3UGPUG.mjs +60 -0
  26. package/dist/chunk-QY65ZSBL.js +16 -0
  27. package/dist/chunk-R6JFUC32.js +2 -0
  28. package/dist/chunk-RDXQ4CYT.mjs +9 -0
  29. package/dist/chunk-S5VJ2FZE.js +12 -0
  30. package/dist/chunk-SVII65W7.mjs +14 -0
  31. package/dist/chunk-U7VN3RUE.mjs +25 -0
  32. package/dist/chunk-VCPYYLCS.js +83 -0
  33. package/dist/chunk-VD3P2A6Q.js +10 -0
  34. package/dist/chunk-VPEV3W34.mjs +10 -0
  35. package/dist/chunk-WGFQMQMV.mjs +14 -0
  36. package/dist/chunk-X6VDDXG7.mjs +12 -0
  37. package/dist/chunk-XAORXFAX.mjs +1 -10
  38. package/dist/chunk-XEOG24K6.mjs +8 -0
  39. package/dist/chunk-XK6XC3V4.js +10 -0
  40. package/dist/chunk-XZ5B5MTG.js +20 -0
  41. package/dist/chunk-YKHC2AW6.js +10 -0
  42. package/dist/chunk-Z2T7ONKU.js +20 -0
  43. package/dist/chunk-ZFL7DXAE.mjs +28 -0
  44. package/dist/chunk-ZM7W2ZCF.mjs +20 -0
  45. package/dist/{validators-BCw4Sn01.d.mts → index-CvXnHxD2.d.mts} +12 -1359
  46. package/dist/{validators-5XMwJOlV.d.ts → index-telccAkt.d.ts} +12 -1359
  47. package/dist/index.d.mts +1281 -461
  48. package/dist/index.d.ts +1281 -461
  49. package/dist/index.js +1400 -831
  50. package/dist/index.mjs +583 -571
  51. package/dist/types-B5Zhhoev.d.ts +39 -0
  52. package/dist/types-C6naks1H.d.mts +39 -0
  53. package/dist/utils.js +38 -20
  54. package/dist/utils.mjs +1 -20
  55. package/dist/validation/all.d.mts +23 -0
  56. package/dist/validation/all.d.ts +23 -0
  57. package/dist/validation/all.js +265 -0
  58. package/dist/validation/all.mjs +20 -0
  59. package/dist/validation/complex/currency.d.mts +15 -0
  60. package/dist/validation/complex/currency.d.ts +15 -0
  61. package/dist/validation/complex/currency.js +12 -0
  62. package/dist/validation/complex/currency.mjs +3 -0
  63. package/dist/validation/complex/file.d.mts +13 -0
  64. package/dist/validation/complex/file.d.ts +13 -0
  65. package/dist/validation/complex/file.js +12 -0
  66. package/dist/validation/complex/file.mjs +3 -0
  67. package/dist/validation/complex/location.d.mts +22 -0
  68. package/dist/validation/complex/location.d.ts +22 -0
  69. package/dist/validation/complex/location.js +12 -0
  70. package/dist/validation/complex/location.mjs +3 -0
  71. package/dist/validation/complex/phone.d.mts +22 -0
  72. package/dist/validation/complex/phone.d.ts +22 -0
  73. package/dist/validation/complex/phone.js +12 -0
  74. package/dist/validation/complex/phone.mjs +3 -0
  75. package/dist/validation/complex/relation.d.mts +25 -0
  76. package/dist/validation/complex/relation.d.ts +25 -0
  77. package/dist/validation/complex/relation.js +20 -0
  78. package/dist/validation/complex/relation.mjs +3 -0
  79. package/dist/validation/complex/richtext.d.mts +13 -0
  80. package/dist/validation/complex/richtext.d.ts +13 -0
  81. package/dist/validation/complex/richtext.js +12 -0
  82. package/dist/validation/complex/richtext.mjs +3 -0
  83. package/dist/validation/complex/select.d.mts +20 -0
  84. package/dist/validation/complex/select.d.ts +20 -0
  85. package/dist/validation/complex/select.js +20 -0
  86. package/dist/validation/complex/select.mjs +3 -0
  87. package/dist/validation/complex/user.d.mts +13 -0
  88. package/dist/validation/complex/user.d.ts +13 -0
  89. package/dist/validation/complex/user.js +12 -0
  90. package/dist/validation/complex/user.mjs +3 -0
  91. package/dist/validation/computed/formula.d.mts +14 -0
  92. package/dist/validation/computed/formula.d.ts +14 -0
  93. package/dist/validation/computed/formula.js +12 -0
  94. package/dist/validation/computed/formula.mjs +3 -0
  95. package/dist/validation/computed/rollup.d.mts +14 -0
  96. package/dist/validation/computed/rollup.d.ts +14 -0
  97. package/dist/validation/computed/rollup.js +12 -0
  98. package/dist/validation/computed/rollup.mjs +3 -0
  99. package/dist/validation/config/index.d.mts +421 -0
  100. package/dist/validation/config/index.d.ts +421 -0
  101. package/dist/validation/config/index.js +103 -0
  102. package/dist/validation/config/index.mjs +2 -0
  103. package/dist/validation/core/index.d.mts +85 -0
  104. package/dist/validation/core/index.d.ts +85 -0
  105. package/dist/validation/core/index.js +27 -0
  106. package/dist/validation/core/index.mjs +2 -0
  107. package/dist/validation/object/index.d.mts +6 -0
  108. package/dist/validation/object/index.d.ts +6 -0
  109. package/dist/validation/object/index.js +71 -0
  110. package/dist/validation/object/index.mjs +18 -0
  111. package/dist/validation/primitives/checkbox.d.mts +12 -0
  112. package/dist/validation/primitives/checkbox.d.ts +12 -0
  113. package/dist/validation/primitives/checkbox.js +12 -0
  114. package/dist/validation/primitives/checkbox.mjs +3 -0
  115. package/dist/validation/primitives/date.d.mts +12 -0
  116. package/dist/validation/primitives/date.d.ts +12 -0
  117. package/dist/validation/primitives/date.js +12 -0
  118. package/dist/validation/primitives/date.mjs +3 -0
  119. package/dist/validation/primitives/number.d.mts +12 -0
  120. package/dist/validation/primitives/number.d.ts +12 -0
  121. package/dist/validation/primitives/number.js +12 -0
  122. package/dist/validation/primitives/number.mjs +3 -0
  123. package/dist/validation/primitives/rating.d.mts +12 -0
  124. package/dist/validation/primitives/rating.d.ts +12 -0
  125. package/dist/validation/primitives/rating.js +12 -0
  126. package/dist/validation/primitives/rating.mjs +3 -0
  127. package/dist/validation/primitives/text.d.mts +17 -0
  128. package/dist/validation/primitives/text.d.ts +17 -0
  129. package/dist/validation/primitives/text.js +16 -0
  130. package/dist/validation/primitives/text.mjs +3 -0
  131. package/dist/validation/validators.d.mts +21 -2
  132. package/dist/validation/validators.d.ts +21 -2
  133. package/dist/validation/validators.js +265 -120
  134. package/dist/validation/validators.mjs +20 -120
  135. package/package.json +108 -5
  136. package/dist/chunk-4362R5F2.mjs +0 -780
  137. package/dist/chunk-7QUI6TSO.js +0 -780
package/dist/index.d.mts CHANGED
@@ -1,9 +1,32 @@
1
- import { S as SortRule, F as FilterState, W as WorkflowNode, a as FormNode, b as WorkflowNodeType, T as Timestamps, A as Attribute, R as RelationFieldConfig, c as FlowHeadingRow, d as FlowSeparatorRow, e as FlowTextRow, f as FlowRelationListRow, g as WorkflowSlot, h as WorkflowTheme, i as RelationBufferMap, j as AttributeType, V as ViewType, k as ViewConfig, C as ConfigOverrides, l as WorkflowStatus, m as WorkflowLayout, n as WorkflowConfig, o as WorkflowDefinition, I as InstanceStatus, p as WorkflowExecutionContext, q as WorkflowTransition, P as PendingAction, L as LocationGranularity, r as Location, s as FormulaAttribute, t as RollupAttribute, u as CompletionStatus, v as StatusAttribute, w as SelectAttribute, M as MultiselectAttribute, x as Phone, y as Currency, O as ObjectRecord, D as DateAttribute, U as UserAttribute, z as DocumentAttribute, B as FeatureGate, E as TextAttribute, G as TextAreaAttribute, H as RichtextAttribute, J as RichtextFeature, N as NumberAttribute, K as CheckboxAttribute, Q as PhoneAttribute, X as CurrencyAttribute, Y as Option, Z as LocationAttribute, _ as FileAttribute, $ as RelationAttribute, a0 as RatingAttribute, a1 as BilateralConfig, a2 as SingleRelationAttribute, a3 as MultiRelationAttribute, a4 as RelationTarget, a5 as FormulaReturnType, a6 as RollupFunction, a7 as MigrationDefinition, a8 as ObjectDefinition, a9 as DetailViewLayout, aa as SidePanelConfig, ab as Field, ac as AttributeGroupField, ad as FieldGroup, ae as RelationGroup, af as Group, ag as TableTab, ah as CreateMode, ai as DetailViewDefinition, aj as Tab, ak as ListViewDefinition, al as SlotMode, am as FlowFieldsRow, an as ConditionGroup, ao as ConditionRule, ap as FlagValueType, aq as FeatureFlagDefinition, ar as FlagLevel, as as FeatureFlagsRepository, at as StaticFlagDefault, au as ResolvedFlag, av as ViewDefinition, aw as ListViewConfig, ax as ListViewTab } from './validators-BCw4Sn01.mjs';
2
- export { ay as AINode, az as ActivityTab, aA as AdvancedFilterState, aB as AssignNode, aC as AssignmentMapping, aD as AssignmentSource, aE as AttributeGroup, aF as BaseAttribute, aG as BufferedRecord, aH as BuiltInTransform, aI as CalendarViewConfig, aJ as CalendarViewDefinition, aK as CanvasViewport, aL as CheckboxFilterOperator, aM as ConditionNode, aN as ConditionOperator, aO as CurrencyFilterValue, aP as CustomTab, aQ as DEFAULT_RETENTION_POLICY, aR as DEFAULT_THEME, aS as DEFAULT_VALIDATION_MESSAGES, aT as DateFilterOperator, aU as DateFormat, aV as DateValue, aW as DetailViewConfig, aX as DisplayRecord, aY as DocumentsTab, aZ as EndNode, a_ as ExtendedFilterRule, a$ as FORBIDDEN_PROPERTY_TYPES, b0 as FeatureFlagsConfig, b1 as FilterCombinator, b2 as FilterGroup, b3 as FilterOperator, b4 as FilterRule, b5 as FilterValue, b6 as FlagOverride, b7 as FlowDefinition, b8 as FlowPage, b9 as FlowRelation, ba as FlowRow, bb as FlowRowField, bc as FlowRowType, bd as FlowSlot, be as FlowStatus, bf as FlowsTab, bg as ForbiddenPropertyType, bh as FormDensity, bi as FormFieldRef, bj as FormTab, bk as GalleryViewConfig, bl as GalleryViewDefinition, bm as GeneratedDocument, bn as InverseSource, bo as ListViewLayout, bp as MigrationError, bq as MigrationPreview, br as MultiselectFilterOperator, bs as NON_SORTABLE_TYPES, bt as NO_VALUE_OPERATORS, bu as NoValueOperator, bv as NodePosition, bw as NumberFilterOperator, bx as NumberUnit, by as OPERATORS_BY_TYPE, bz as ObjectAttribute, bA as OptionPropertyAttribute, bB as PhoneFilterValue, bC as PropertyAttribute, bD as PropertySchema, bE as PropertyType, bF as QueryState, bG as RELATION_TARGET_ANY, bH as RESERVED_ATTRIBUTE_NAMES, bI as RecordPatch, bJ as RelationBuffer, bK as RelationFilterOperator, bL as RelationQualifierPatch, bM as RelationSource, bN as RelativeDateValue, bO as ReservedAttributeName, bP as RetentionPolicy, bQ as RichtextTab, bR as SYSTEM_FIELD_NAMES, bS as SchemaOperation, bT as SchemaTransform, bU as SelectFilterOperator, bV as SortDirection, bW as StartNode, bX as StatusGroup, bY as SystemFieldName, bZ as TabType, b_ as TableSource, b$ as TextFilterOperator, c0 as ThemeColors, c1 as ThemeLogo, c2 as ThemeTypography, c3 as TimelineViewConfig, c4 as TimelineViewDefinition, c5 as TransformSource, c6 as ValidationMessages, c7 as ValidationResult, c8 as ViewOperation, c9 as ViewOverlay, ca as ViewTransform, cb as WorkflowError, cc as WorkflowInstance, cd as and, ce as attributeConfigSchemas, cf as canResumeInstance, cg as checkboxConfigSchema, ch as computeRecordStatus, ci as createAttributeValidator, cj as createCheckboxValidator, ck as createCurrencyValidator, cl as createDateValidator, cm as createDraftValidator, cn as createEmptyContext, co as createFileValidator, cp as createFormAttributeValidator, cq as createFormulaValidator, cr as createLocationValidator, cs as createMultiRelationValidator, ct as createMultiselectValidator, cu as createNumberValidator, cv as createObjectValidator, cw as createPhoneValidator, cx as createRatingValidator, cy as createRelationValidator, cz as createRichtextValidator, cA as createRollupValidator, cB as createSelectValidator, cC as createSingleRelationValidator, cD as createStartTransition, cE as createStatusValidator, cF as createTextAreaValidator, cG as createTextValidator, cH as createUserValidator, cI as currencyConfigSchema, cJ as dateConfigSchema, cK as documentConfigSchema, cL as eq, cM as fileConfigSchema, cN as formatZodErrors, cO as formulaConfigSchema, cP as generateCssVariables, cQ as getAttributeConfigSchema, cR as getContextValue, cS as getMissingRequiredAttributes, cT as getRollupFilterOperators, cU as hasOptions, cV as inValues, cW as inferInverseCardinality, cX as isAINode, cY as isActivityTab, cZ as isAdvancedFormNode, c_ as isAssignNode, c$ as isAttributeSortable, d0 as isBilateralRelation, d1 as isCalendarView, d2 as isConditionGroup, d3 as isConditionNode, d4 as isConditionRule, d5 as isCustomTab, d6 as isDetailView, d7 as isDocumentsTab, d8 as isEndNode, d9 as isFieldGroup, da as isFlowDefinition, db as isFlowFieldsRow, dc as isFlowPublished, dd as isFlowRelationListRow, de as isFlowsTab, df as isFormNode, dg as isFormTab, dh as isGalleryView, di as isInstanceTerminal, dj as isInstanceWaiting, dk as isInverseSourceTab, dl as isLayoutRow, dm as isListView, dn as isNoValueOperator, dp as isRecordComplete, dq as isRelationGroup, dr as isRelationSourceTab, ds as isRichtextTab, dt as isSimpleFormNode, du as isStartNode, dv as isSystemFlow, dw as isSystemWorkflow, dx as isTableTab, dy as isTimelineView, dz as isUniversalRelation, dA as isWorkflowDefinition, dB as isWorkflowPublished, dC as locationConfigSchema, dD as mergeWithDefaults, dE as multiselectConfigSchema, dF as neq, dG as numberConfigSchema, dH as or, dI as parseAttributeConfig, dJ as phoneConfigSchema, dK as ratingConfigSchema, dL as relationConfigSchema, dM as richtextConfigSchema, dN as rollupConfigSchema, dO as safeParseAttributeConfig, dP as selectConfigSchema, dQ as setContextValue, dR as statusConfigSchema, dS as textConfigSchema, dT as textareaConfigSchema, dU as userConfigSchema, dV as validateAttribute, dW as validateAttributeConfig, dX as validateDraft, dY as validateDraftOrThrow, dZ as validateObject, d_ as validateObjectOrThrow } from './validators-BCw4Sn01.mjs';
1
+ import { S as SortRule, F as FilterState, W as WorkflowNode, l as FormNode, m as WorkflowNodeType, T as Timestamps, R as RelationFieldConfig, n as FlowHeadingRow, o as FlowSeparatorRow, p as FlowTextRow, q as FlowRelationListRow, r as WorkflowSlot, s as WorkflowTheme, t as RelationBufferMap, V as ViewType, u as ViewConfig, C as ConfigOverrides, w as WorkflowStatus, x as WorkflowLayout, y as WorkflowConfig, z as WorkflowDefinition, I as InstanceStatus, A as WorkflowExecutionContext, B as WorkflowTransition, P as PendingAction, D as CompletionStatus, O as ObjectRecord, M as MigrationDefinition, E as ObjectDefinition, G as DetailViewConfig, H as DetailViewDefinition, J as DetailViewLayout, K as SidePanelConfig, L as Field, N as AttributeGroupField, Q as FieldGroup, U as RelationGroup, X as Group, Y as TableTab, Z as CreateMode, _ as Tab, $ as ListViewConfig, a0 as ListViewDefinition, a1 as SlotMode, a2 as FlowFieldsRow, a3 as ConditionGroup, a4 as ConditionRule, a5 as ViewDefinition, a6 as ListViewTab } from './index-CvXnHxD2.mjs';
2
+ export { a7 as AINode, a8 as ActivityTab, a9 as AdvancedFilterState, aa as AssignNode, ab as AssignmentMapping, ac as AssignmentSource, ad as BufferedRecord, ae as BuiltInTransform, af as CalendarViewConfig, ag as CalendarViewDefinition, ah as CanvasViewport, ai as CheckboxFilterOperator, aj as ConditionNode, ak as ConditionOperator, al as CurrencyFilterValue, am as CustomTab, an as DEFAULT_RETENTION_POLICY, ao as DEFAULT_THEME, ap as DateFilterOperator, aq as DisplayRecord, ar as DocumentsTab, as as EndNode, at as ExtendedFilterRule, au as FilterCombinator, av as FilterGroup, aw as FilterOperator, ax as FilterRule, ay as FilterValue, az as FlowDefinition, aA as FlowPage, aB as FlowRelation, aC as FlowRow, aD as FlowRowField, aE as FlowRowType, aF as FlowSlot, aG as FlowStatus, aH as FlowsTab, aI as FormDensity, aJ as FormFieldRef, aK as FormTab, aL as GalleryViewConfig, aM as GalleryViewDefinition, aN as GeneratedDocument, aO as InverseSource, aP as ListViewLayout, aQ as MigrationError, aR as MigrationPreview, aS as MultiselectFilterOperator, aT as NO_VALUE_OPERATORS, aU as NoValueOperator, aV as NodePosition, aW as NumberFilterOperator, aX as OPERATORS_BY_TYPE, aY as ObjectAttribute, aZ as PhoneFilterValue, a_ as QueryState, a$ as RESERVED_ATTRIBUTE_NAMES, b0 as RecordPatch, b1 as RelationBuffer, b2 as RelationFilterOperator, b3 as RelationQualifierPatch, b4 as RelationSource, b5 as RelativeDateValue, b6 as ReservedAttributeName, b7 as RetentionPolicy, b8 as RichtextTab, b9 as SYSTEM_FIELD_NAMES, ba as SchemaOperation, bb as SchemaTransform, bc as SelectFilterOperator, bd as SortDirection, be as StartNode, bf as SystemFieldName, bg as TabType, bh as TableSource, bi as TextFilterOperator, bj as ThemeColors, bk as ThemeLogo, bl as ThemeTypography, bm as TimelineViewConfig, bn as TimelineViewDefinition, bo as TransformSource, bp as ViewOperation, bq as ViewOverlay, br as ViewTransform, bs as WorkflowError, bt as WorkflowInstance, bu as and, bv as canResumeInstance, c as computeRecordStatus, a as createAttributeValidator, b as createDraftValidator, bw as createEmptyContext, d as createFormAttributeValidator, e as createObjectValidator, bx as createStartTransition, by as eq, bz as generateCssVariables, bA as getContextValue, g as getMissingRequiredAttributes, bB as getRollupFilterOperators, bC as inValues, bD as isAINode, bE as isActivityTab, bF as isAdvancedFormNode, bG as isAssignNode, bH as isCalendarView, bI as isConditionGroup, bJ as isConditionNode, bK as isConditionRule, bL as isCustomTab, bM as isDetailView, bN as isDocumentsTab, bO as isEndNode, bP as isFieldGroup, bQ as isFlowDefinition, bR as isFlowFieldsRow, bS as isFlowPublished, bT as isFlowRelationListRow, bU as isFlowsTab, bV as isFormNode, bW as isFormTab, bX as isGalleryView, bY as isInstanceTerminal, bZ as isInstanceWaiting, b_ as isInverseSourceTab, b$ as isLayoutRow, c0 as isListView, c1 as isNoValueOperator, i as isRecordComplete, c2 as isRelationGroup, c3 as isRelationSourceTab, c4 as isRichtextTab, c5 as isSimpleFormNode, c6 as isStartNode, c7 as isSystemFlow, c8 as isSystemWorkflow, c9 as isTableTab, ca as isTimelineView, cb as isWorkflowDefinition, cc as isWorkflowPublished, cd as mergeWithDefaults, ce as neq, cf as or, cg as setContextValue, v as validateAttribute, f as validateDraft, h as validateDraftOrThrow, j as validateObject, k as validateObjectOrThrow } from './index-CvXnHxD2.mjs';
3
+ import { A as Attribute, j as AttributeType, k as LocationGranularity, l as Location, e as FormulaAttribute, f as RollupAttribute, d as StatusAttribute, c as SelectAttribute, b as MultiselectAttribute, m as Phone, n as Currency, D as DateAttribute, U as UserAttribute, o as DocumentAttribute, p as FeatureGate, i as TextAttribute, T as TextAreaAttribute, a as RichtextAttribute, q as RichtextFeature, N as NumberAttribute, g as CheckboxAttribute, P as PhoneAttribute, C as CurrencyAttribute, O as Option, L as LocationAttribute, F as FileAttribute, R as RelationAttribute, h as RatingAttribute, B as BilateralConfig, S as SingleRelationAttribute, M as MultiRelationAttribute, r as RelationTarget, s as FormulaReturnType, t as RollupFunction, u as FlagValueType, v as FeatureFlagDefinition, w as FlagLevel, x as FeatureFlagsRepository, y as StaticFlagDefault, z as ResolvedFlag } from './attributes-CeDp1IMp.mjs';
4
+ export { E as AttributeGroup, G as BaseAttribute, H as DateFormat, I as DateValue, J as FORBIDDEN_PROPERTY_TYPES, K as FeatureFlagsConfig, Q as FlagOverride, V as ForbiddenPropertyType, W as NON_SORTABLE_TYPES, X as NumberUnit, Y as OptionPropertyAttribute, Z as PropertyAttribute, _ as PropertySchema, $ as PropertyType, a0 as RELATION_TARGET_ANY, a1 as StatusGroup, a2 as hasOptions, a3 as inferInverseCardinality, a4 as isAttributeSortable, a5 as isBilateralRelation, a6 as isUniversalRelation } from './attributes-CeDp1IMp.mjs';
3
5
  import { MimeType, IconName, CountryIso3, CurrencyCode, ColorId } from '@stndrds/constants';
4
6
  import { Uuid, TenantId } from './utils.mjs';
5
7
  export { UserId, asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify } from './utils.mjs';
6
- import { z } from 'zod';
8
+ import z$1, { z } from 'zod';
9
+ import { StandardSchemaV1 } from '@standard-schema/spec';
10
+ export { StandardSchemaV1 } from '@standard-schema/spec';
11
+ export { V as ValidationMessages, a as ValidationResult } from './types-C6naks1H.mjs';
12
+ export { DEFAULT_VALIDATION_MESSAGES, createRegexCache, formatZodErrors, getCachedRegex } from './validation/core/index.mjs';
13
+ export { createTextAreaValidator, createTextValidator } from './validation/primitives/text.mjs';
14
+ export { createNumberValidator } from './validation/primitives/number.mjs';
15
+ export { createCheckboxValidator } from './validation/primitives/checkbox.mjs';
16
+ export { createDateValidator } from './validation/primitives/date.mjs';
17
+ export { createRatingValidator } from './validation/primitives/rating.mjs';
18
+ export { createPhoneValidator } from './validation/complex/phone.mjs';
19
+ export { createCurrencyValidator } from './validation/complex/currency.mjs';
20
+ export { createLocationValidator } from './validation/complex/location.mjs';
21
+ export { createRichtextValidator } from './validation/complex/richtext.mjs';
22
+ export { createMultiselectValidator, createSelectValidator, createStatusValidator } from './validation/complex/select.mjs';
23
+ export { createFileValidator } from './validation/complex/file.mjs';
24
+ export { createUserValidator } from './validation/complex/user.mjs';
25
+ export { createMultiRelationValidator, createRelationValidator, createSingleRelationValidator } from './validation/complex/relation.mjs';
26
+ export { createFormulaValidator } from './validation/computed/formula.mjs';
27
+ export { createRollupValidator } from './validation/computed/rollup.mjs';
28
+ export { attributeConfigSchemas, checkboxConfigSchema, currencyConfigSchema, dateConfigSchema, documentConfigSchema, fileConfigSchema, formulaConfigSchema, getAttributeConfigSchema, locationConfigSchema, multiselectConfigSchema, numberConfigSchema, parseAttributeConfig, phoneConfigSchema, ratingConfigSchema, relationConfigSchema, richtextConfigSchema, rollupConfigSchema, safeParseAttributeConfig, selectConfigSchema, statusConfigSchema, textConfigSchema, textareaConfigSchema, userConfigSchema, validateAttributeConfig } from './validation/config/index.mjs';
29
+ import { JSONSchema7 } from 'json-schema';
7
30
 
8
31
  /**
9
32
  * Generic list options for pagination and sorting
@@ -229,6 +252,8 @@ interface UpdateFile {
229
252
  allowedUsers?: Uuid[];
230
253
  }
231
254
 
255
+ declare function registerBuiltInNodeTypes(): void;
256
+
232
257
  /**
233
258
  * Status of a workflow invitation
234
259
  */
@@ -740,18 +765,35 @@ declare const ConditionRuleSchema: z.ZodObject<{
740
765
  }, z.core.$strip>;
741
766
  /**
742
767
  * Condition group schema (recursive)
768
+ *
769
+ * Uses Zod v4 getter pattern for recursive types instead of z.lazy().
770
+ * This provides cleaner code, better type inference, and improved performance.
743
771
  */
744
- declare const ConditionGroupSchema: z.ZodType<{
745
- operator: "and" | "or";
746
- rules: Array<{
747
- field: string;
748
- operator: z.infer<typeof ConditionOperatorSchema>;
749
- value: unknown;
750
- } | {
751
- operator: "and" | "or";
752
- rules: unknown[];
772
+ declare const ConditionGroupSchema: z.ZodObject<{
773
+ operator: z.ZodEnum<{
774
+ and: "and";
775
+ or: "or";
753
776
  }>;
754
- }>;
777
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
778
+ field: z.ZodString;
779
+ operator: z.ZodEnum<{
780
+ contains: "contains";
781
+ eq: "eq";
782
+ neq: "neq";
783
+ lt: "lt";
784
+ gt: "gt";
785
+ lte: "lte";
786
+ gte: "gte";
787
+ startsWith: "startsWith";
788
+ endsWith: "endsWith";
789
+ isEmpty: "isEmpty";
790
+ isNotEmpty: "isNotEmpty";
791
+ in: "in";
792
+ notIn: "notIn";
793
+ }>;
794
+ value: z.ZodUnknown;
795
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
796
+ }, z.core.$strip>;
755
797
  /**
756
798
  * Start node schema
757
799
  */
@@ -876,27 +918,31 @@ declare const ConditionNodeSchema: z.ZodObject<{
876
918
  type: z.ZodLiteral<"condition">;
877
919
  id: z.ZodString;
878
920
  label: z.ZodString;
879
- condition: z.ZodType<{
880
- operator: "and" | "or";
881
- rules: Array<{
882
- field: string;
883
- operator: z.infer<typeof ConditionOperatorSchema>;
884
- value: unknown;
885
- } | {
886
- operator: "and" | "or";
887
- rules: unknown[];
921
+ condition: z.ZodObject<{
922
+ operator: z.ZodEnum<{
923
+ and: "and";
924
+ or: "or";
888
925
  }>;
889
- }, unknown, z.core.$ZodTypeInternals<{
890
- operator: "and" | "or";
891
- rules: Array<{
892
- field: string;
893
- operator: z.infer<typeof ConditionOperatorSchema>;
894
- value: unknown;
895
- } | {
896
- operator: "and" | "or";
897
- rules: unknown[];
898
- }>;
899
- }, unknown>>;
926
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
927
+ field: z.ZodString;
928
+ operator: z.ZodEnum<{
929
+ contains: "contains";
930
+ eq: "eq";
931
+ neq: "neq";
932
+ lt: "lt";
933
+ gt: "gt";
934
+ lte: "lte";
935
+ gte: "gte";
936
+ startsWith: "startsWith";
937
+ endsWith: "endsWith";
938
+ isEmpty: "isEmpty";
939
+ isNotEmpty: "isNotEmpty";
940
+ in: "in";
941
+ notIn: "notIn";
942
+ }>;
943
+ value: z.ZodUnknown;
944
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
945
+ }, z.core.$strip>;
900
946
  onTrue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
901
947
  onFalse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
902
948
  }, z.core.$strip>;
@@ -1046,27 +1092,31 @@ declare const WorkflowNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1046
1092
  type: z.ZodLiteral<"condition">;
1047
1093
  id: z.ZodString;
1048
1094
  label: z.ZodString;
1049
- condition: z.ZodType<{
1050
- operator: "and" | "or";
1051
- rules: Array<{
1052
- field: string;
1053
- operator: z.infer<typeof ConditionOperatorSchema>;
1054
- value: unknown;
1055
- } | {
1056
- operator: "and" | "or";
1057
- rules: unknown[];
1058
- }>;
1059
- }, unknown, z.core.$ZodTypeInternals<{
1060
- operator: "and" | "or";
1061
- rules: Array<{
1062
- field: string;
1063
- operator: z.infer<typeof ConditionOperatorSchema>;
1064
- value: unknown;
1065
- } | {
1066
- operator: "and" | "or";
1067
- rules: unknown[];
1095
+ condition: z.ZodObject<{
1096
+ operator: z.ZodEnum<{
1097
+ and: "and";
1098
+ or: "or";
1068
1099
  }>;
1069
- }, unknown>>;
1100
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1101
+ field: z.ZodString;
1102
+ operator: z.ZodEnum<{
1103
+ contains: "contains";
1104
+ eq: "eq";
1105
+ neq: "neq";
1106
+ lt: "lt";
1107
+ gt: "gt";
1108
+ lte: "lte";
1109
+ gte: "gte";
1110
+ startsWith: "startsWith";
1111
+ endsWith: "endsWith";
1112
+ isEmpty: "isEmpty";
1113
+ isNotEmpty: "isNotEmpty";
1114
+ in: "in";
1115
+ notIn: "notIn";
1116
+ }>;
1117
+ value: z.ZodUnknown;
1118
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
1119
+ }, z.core.$strip>;
1070
1120
  onTrue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1071
1121
  onFalse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1072
1122
  }, z.core.$strip>, z.ZodObject<{
@@ -1158,9 +1208,9 @@ declare const ShareStatusSchema: z.ZodEnum<{
1158
1208
  * Workflow share schema (simplified from WorkflowParticipation)
1159
1209
  */
1160
1210
  declare const WorkflowShareSchema: z.ZodObject<{
1161
- id: z.ZodString;
1162
- instanceId: z.ZodString;
1163
- email: z.ZodString;
1211
+ id: z.ZodUUID;
1212
+ instanceId: z.ZodUUID;
1213
+ email: z.ZodEmail;
1164
1214
  name: z.ZodOptional<z.ZodString>;
1165
1215
  phone: z.ZodOptional<z.ZodString>;
1166
1216
  authMethod: z.ZodEnum<{
@@ -1186,8 +1236,8 @@ declare const WorkflowShareSchema: z.ZodObject<{
1186
1236
  * Create share input schema
1187
1237
  */
1188
1238
  declare const CreateShareInputSchema: z.ZodObject<{
1189
- instanceId: z.ZodString;
1190
- email: z.ZodString;
1239
+ instanceId: z.ZodUUID;
1240
+ email: z.ZodEmail;
1191
1241
  name: z.ZodOptional<z.ZodString>;
1192
1242
  phone: z.ZodOptional<z.ZodString>;
1193
1243
  authMethod: z.ZodEnum<{
@@ -1242,7 +1292,7 @@ declare const ThemeColorsSchema: z.ZodObject<{
1242
1292
  * Theme logo schema
1243
1293
  */
1244
1294
  declare const ThemeLogoSchema: z.ZodObject<{
1245
- url: z.ZodString;
1295
+ url: z.ZodURL;
1246
1296
  alt: z.ZodOptional<z.ZodString>;
1247
1297
  maxHeight: z.ZodOptional<z.ZodNumber>;
1248
1298
  }, z.core.$strip>;
@@ -1251,7 +1301,7 @@ declare const ThemeLogoSchema: z.ZodObject<{
1251
1301
  */
1252
1302
  declare const WorkflowThemeSchema: z.ZodObject<{
1253
1303
  logo: z.ZodOptional<z.ZodObject<{
1254
- url: z.ZodString;
1304
+ url: z.ZodURL;
1255
1305
  alt: z.ZodOptional<z.ZodString>;
1256
1306
  maxHeight: z.ZodOptional<z.ZodNumber>;
1257
1307
  }, z.core.$strip>>;
@@ -1371,27 +1421,31 @@ declare const WorkflowDefinitionSchema: z.ZodObject<{
1371
1421
  type: z.ZodLiteral<"condition">;
1372
1422
  id: z.ZodString;
1373
1423
  label: z.ZodString;
1374
- condition: z.ZodType<{
1375
- operator: "and" | "or";
1376
- rules: Array<{
1377
- field: string;
1378
- operator: z.infer<typeof ConditionOperatorSchema>;
1379
- value: unknown;
1380
- } | {
1381
- operator: "and" | "or";
1382
- rules: unknown[];
1383
- }>;
1384
- }, unknown, z.core.$ZodTypeInternals<{
1385
- operator: "and" | "or";
1386
- rules: Array<{
1387
- field: string;
1388
- operator: z.infer<typeof ConditionOperatorSchema>;
1389
- value: unknown;
1390
- } | {
1391
- operator: "and" | "or";
1392
- rules: unknown[];
1424
+ condition: z.ZodObject<{
1425
+ operator: z.ZodEnum<{
1426
+ and: "and";
1427
+ or: "or";
1393
1428
  }>;
1394
- }, unknown>>;
1429
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1430
+ field: z.ZodString;
1431
+ operator: z.ZodEnum<{
1432
+ contains: "contains";
1433
+ eq: "eq";
1434
+ neq: "neq";
1435
+ lt: "lt";
1436
+ gt: "gt";
1437
+ lte: "lte";
1438
+ gte: "gte";
1439
+ startsWith: "startsWith";
1440
+ endsWith: "endsWith";
1441
+ isEmpty: "isEmpty";
1442
+ isNotEmpty: "isNotEmpty";
1443
+ in: "in";
1444
+ notIn: "notIn";
1445
+ }>;
1446
+ value: z.ZodUnknown;
1447
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
1448
+ }, z.core.$strip>;
1395
1449
  onTrue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1396
1450
  onFalse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1397
1451
  }, z.core.$strip>, z.ZodObject<{
@@ -1454,7 +1508,7 @@ declare const WorkflowDefinitionSchema: z.ZodObject<{
1454
1508
  }, z.core.$strip>>;
1455
1509
  theme: z.ZodOptional<z.ZodObject<{
1456
1510
  logo: z.ZodOptional<z.ZodObject<{
1457
- url: z.ZodString;
1511
+ url: z.ZodURL;
1458
1512
  alt: z.ZodOptional<z.ZodString>;
1459
1513
  maxHeight: z.ZodOptional<z.ZodNumber>;
1460
1514
  }, z.core.$strip>>;
@@ -2729,153 +2783,431 @@ interface AICompactionSummary {
2729
2783
  }
2730
2784
 
2731
2785
  /**
2732
- * Attribute Property Protection
2733
- *
2734
- * Defines which properties can be modified based on attribute type (custom vs system).
2735
- *
2736
- * Protection levels:
2737
- * 1. Identity properties: NEVER modifiable (defines attribute structure)
2738
- * 2. Behavior properties: Modifiable for custom attributes, PROTECTED for system attributes
2739
- * 3. Presentation properties: ALWAYS modifiable (display only, no logic impact)
2740
- */
2741
- /**
2742
- * Identity properties - Never modifiable
2743
- * These define the fundamental structure of the attribute.
2744
- */
2745
- declare const IDENTITY_PROPERTIES: readonly ["name", "type"];
2746
- /**
2747
- * Behavior properties - Protected for system attributes
2748
- * These affect business logic and data integrity.
2749
- */
2750
- declare const BEHAVIOR_PROPERTIES: readonly ["required", "disabled", "hidden", "archived", "deprecated", "defaultValue", "config", "order", "unique"];
2751
- /**
2752
- * Presentation properties - Always modifiable
2753
- * These only affect display, not logic.
2754
- */
2755
- declare const PRESENTATION_PROPERTIES: readonly ["label", "description", "placeholder", "icon"];
2756
- type IdentityProperty = (typeof IDENTITY_PROPERTIES)[number];
2757
- type BehaviorProperty = (typeof BEHAVIOR_PROPERTIES)[number];
2758
- type PresentationProperty = (typeof PRESENTATION_PROPERTIES)[number];
2759
- /**
2760
- * Check if a property is an identity property (never modifiable)
2761
- */
2762
- declare function isIdentityProperty(property: string): property is IdentityProperty;
2763
- /**
2764
- * Check if a property is a behavior property (protected for system attributes)
2786
+ * Scope of a permission rule.
2787
+ * - `object`: Controls access to an entire object type (business data)
2788
+ * - `system`: Controls access to platform resources (people, workspace)
2765
2789
  */
2766
- declare function isBehaviorProperty(property: string): property is BehaviorProperty;
2790
+ type PermissionScope = "object" | "system";
2767
2791
  /**
2768
- * Check if a property is a presentation property (always modifiable)
2792
+ * Actions that can be performed on a resource.
2769
2793
  */
2770
- declare function isPresentationProperty(property: string): property is PresentationProperty;
2771
-
2794
+ type Action = "read" | "create" | "update" | "delete";
2772
2795
  /**
2773
- * Type of resource that can be audited
2796
+ * System resources that can be managed.
2797
+ * - `people`: User profiles, invitations, roles and permissions
2798
+ * - `workspace`: Object definitions, attributes, tenant settings, audit logs
2799
+ * - `architect`: Architect settings, templates, and configurations
2774
2800
  */
2775
- type AuditResourceType = "record" | "object" | "attribute" | "user" | "role" | "settings" | "file";
2801
+ type SystemResource = "people" | "workspace" | "architect";
2776
2802
  /**
2777
- * Actions that can be audited
2803
+ * Preset access levels for simplified permission configuration.
2804
+ * - `full`: All CRUD actions
2805
+ * - `read-only`: Only read action
2806
+ * - `none`: No actions
2807
+ * - `custom`: Manual selection of individual actions
2778
2808
  */
2779
- type AuditAction = "record.created" | "record.updated" | "record.deleted" | "record.restored" | "object.created" | "object.updated" | "object.deleted" | "attribute.created" | "attribute.updated" | "attribute.deleted" | "user.created" | "user.invited" | "user.updated" | "user.deleted" | "user.login" | "user.logout" | "role.created" | "role.updated" | "role.deleted" | "role.assigned" | "role.revoked" | "settings.updated" | "file.uploaded" | "file.updated" | "file.deleted";
2809
+ type AccessLevel = "full" | "read-only" | "none" | "custom";
2810
+ declare const ALL_ACTIONS: Action[];
2780
2811
  /**
2781
- * Actor type - who performed the action
2812
+ * Derive an AccessLevel from a list of actions.
2782
2813
  */
2783
- type AuditActorType = "user" | "system";
2814
+ declare function actionsToAccessLevel(actions: Action[]): AccessLevel;
2784
2815
  /**
2785
- * Detail of a change on a field
2816
+ * Convert an AccessLevel preset to its corresponding actions.
2786
2817
  */
2787
- interface AuditChange {
2788
- /** Field name that was changed */
2789
- field: string;
2790
- /** Previous value (undefined for new fields) */
2791
- oldValue: unknown;
2792
- /** New value (undefined for deleted fields) */
2793
- newValue: unknown;
2794
- }
2818
+ declare function accessLevelToActions(level: Exclude<AccessLevel, "custom">): Action[];
2795
2819
  /**
2796
- * Audit log entry - immutable record of an action
2820
+ * Role definition - Groups permissions together.
2821
+ *
2822
+ * Roles are tenant-scoped and can be system-defined (immutable) or custom.
2823
+ *
2824
+ * @example
2825
+ * ```typescript
2826
+ * const ownerRole: Role = {
2827
+ * id: "role-123",
2828
+ * tenantId: "tenant-456",
2829
+ * name: "owner",
2830
+ * label: "Owner",
2831
+ * description: "Full access to all platform features and data",
2832
+ * system: true,
2833
+ * createdAt: new Date(),
2834
+ * updatedAt: new Date(),
2835
+ * };
2836
+ * ```
2797
2837
  */
2798
- interface AuditLogEntry {
2838
+ interface Role extends Timestamps {
2799
2839
  id: Uuid;
2800
2840
  tenantId: Uuid;
2801
- /** User profile ID of the actor (null for system actions) */
2802
- actorId?: string;
2803
- /** Denormalized email for search (in case user is deleted) */
2804
- actorEmail?: string;
2805
- /** Type of actor */
2806
- actorType: AuditActorType;
2807
- action: AuditAction;
2808
- resourceType: AuditResourceType;
2809
- resourceId: Uuid;
2810
- /** Human-readable label (record name, object label, etc.) */
2811
- resourceLabel?: string;
2812
- /** Object technical name (e.g., "companies", "contacts") */
2813
- objectName?: string;
2814
- /** Object UUID */
2815
- objectId?: Uuid;
2816
- changes?: AuditChange[];
2817
- /** Extra context (IP, user-agent, requestId, etc.) */
2818
- metadata?: Record<string, unknown>;
2819
- createdAt: Date;
2820
- }
2821
- /**
2822
- * Input for creating an audit log entry.
2823
- * Tenant ID is automatically set from execution context.
2824
- */
2825
- interface CreateAuditLogInput {
2826
- actorId?: string;
2827
- /** Denormalized actor email for display purposes. */
2828
- actorEmail?: string;
2829
- actorType?: AuditActorType;
2830
- action: AuditAction;
2831
- resourceType: AuditResourceType;
2832
- resourceId: string;
2833
- resourceLabel?: string;
2834
- objectName?: string;
2835
- objectId?: string;
2836
- changes?: AuditChange[];
2837
- metadata?: Record<string, unknown>;
2841
+ /**
2842
+ * Technical name (unique per tenant, used in code).
2843
+ * Examples: "owner", "member", "sales_manager"
2844
+ */
2845
+ name: string;
2846
+ /**
2847
+ * Display name shown in UI.
2848
+ */
2849
+ label: string;
2850
+ /**
2851
+ * Optional description of the role's purpose.
2852
+ */
2853
+ description?: string;
2854
+ /**
2855
+ * If true, this role cannot be modified or deleted.
2856
+ * Used for built-in roles like "owner".
2857
+ */
2858
+ system: boolean;
2838
2859
  }
2839
2860
  /**
2840
- * Options for listing audit logs
2861
+ * Permission definition - Grants specific actions on a target.
2862
+ *
2863
+ * A permission belongs to a role and defines what actions are allowed
2864
+ * on a specific target (object or system resource).
2865
+ *
2866
+ * @example
2867
+ * ```typescript
2868
+ * // Allow read and update on companies object
2869
+ * const permission: Permission = {
2870
+ * id: "perm-123",
2871
+ * roleId: "role-456",
2872
+ * scope: "object",
2873
+ * target: "companies",
2874
+ * actions: ["read", "update"],
2875
+ * createdAt: new Date(),
2876
+ * };
2877
+ *
2878
+ * // Wildcard permission for all objects
2879
+ * const wildcardPerm: Permission = {
2880
+ * id: "perm-789",
2881
+ * roleId: "role-456",
2882
+ * scope: "object",
2883
+ * target: "*",
2884
+ * actions: ["read", "create", "update", "delete"],
2885
+ * createdAt: new Date(),
2886
+ * };
2887
+ * ```
2841
2888
  */
2842
- interface AuditListOptions {
2843
- limit?: number;
2844
- offset?: number;
2845
- action?: AuditAction | AuditAction[];
2846
- resourceType?: AuditResourceType | AuditResourceType[];
2847
- objectName?: string;
2848
- actorId?: string;
2849
- from?: Date;
2850
- to?: Date;
2851
- orderBy?: "createdAt";
2852
- orderDirection?: "asc" | "desc";
2889
+ interface Permission {
2890
+ id: Uuid;
2891
+ roleId: Uuid;
2892
+ /**
2893
+ * Scope of this permission.
2894
+ */
2895
+ scope: PermissionScope;
2896
+ /**
2897
+ * Target of the permission.
2898
+ * - For `object` scope: object name (e.g., "companies") or "*" for all
2899
+ * - For `system` scope: system resource (e.g., "people", "workspace") or "*" for all
2900
+ */
2901
+ target: string;
2902
+ /**
2903
+ * Actions allowed on the target.
2904
+ */
2905
+ actions: Action[];
2906
+ createdAt: Date;
2853
2907
  }
2854
2908
  /**
2855
- * Options for AuditService
2909
+ * Links a user profile to a role within a tenant.
2910
+ *
2911
+ * A user can have multiple roles, and their permissions are additive (union).
2912
+ *
2913
+ * Note: `userProfileId` references UserProfile.id from the user_profiles table,
2914
+ * NOT the auth provider ID (authId). This keeps permissions tied to the
2915
+ * application's user management, not the authentication layer.
2856
2916
  */
2857
- interface AuditServiceOptions {
2917
+ interface UserRoleAssignment {
2918
+ id: Uuid;
2858
2919
  /**
2859
- * If true, audit logging is async (fire-and-forget).
2860
- * Better performance but logs might be lost on crash.
2861
- * @default false
2920
+ * User profile ID (UserProfile.id from user_profiles table).
2921
+ * This links to the application's user management system,
2922
+ * not the auth provider's user ID.
2862
2923
  */
2863
- async?: boolean;
2924
+ userProfileId: Uuid;
2925
+ roleId: Uuid;
2926
+ tenantId: Uuid;
2864
2927
  /**
2865
- * Batch size for async mode.
2866
- * Logs are buffered and flushed when batch is full or after flushIntervalMs.
2867
- * @default 10
2928
+ * When the role was assigned.
2868
2929
  */
2869
- batchSize?: number;
2930
+ assignedAt: Date;
2870
2931
  /**
2871
- * Flush interval in ms for async mode.
2872
- * @default 1000
2932
+ * User profile ID of who assigned this role (for audit trail).
2873
2933
  */
2874
- flushIntervalMs?: number;
2934
+ assignedBy?: Uuid;
2875
2935
  }
2876
-
2936
+ /**
2937
+ * Computed permissions for a user.
2938
+ *
2939
+ * This is the merged result of all roles assigned to a user.
2940
+ * Returned by the API for permission checks.
2941
+ */
2942
+ interface EffectivePermissions {
2943
+ /**
2944
+ * Object-level permissions.
2945
+ * Key is the object name, value is array of allowed actions.
2946
+ * Special key "*" means permission applies to all objects.
2947
+ */
2948
+ objectPermissions: Record<string, Action[]>;
2949
+ /**
2950
+ * System-level permissions.
2951
+ * Key is the system resource (people, workspace), value is array of allowed actions.
2952
+ * Special key "*" means permission applies to all system resources.
2953
+ */
2954
+ systemPermissions: Record<string, Action[]>;
2955
+ }
2956
+ /**
2957
+ * Permissions for a specific object.
2958
+ * Convenience type for frontend use.
2959
+ */
2960
+ interface ObjectPermissions {
2961
+ canRead: boolean;
2962
+ canCreate: boolean;
2963
+ canUpdate: boolean;
2964
+ canDelete: boolean;
2965
+ }
2966
+ /**
2967
+ * Permissions for a specific system resource.
2968
+ * Convenience type for frontend use.
2969
+ */
2970
+ interface SystemPermissions {
2971
+ canRead: boolean;
2972
+ canCreate: boolean;
2973
+ canUpdate: boolean;
2974
+ canDelete: boolean;
2975
+ }
2976
+ /**
2977
+ * Input for creating a new role.
2978
+ * TenantId is automatically set from TenantContext.
2979
+ */
2980
+ interface CreateRoleInput {
2981
+ name: string;
2982
+ label: string;
2983
+ description?: string;
2984
+ }
2985
+ /**
2986
+ * Input for updating an existing role.
2987
+ */
2988
+ interface UpdateRoleInput {
2989
+ label?: string;
2990
+ description?: string;
2991
+ }
2992
+ /**
2993
+ * Input for creating a permission.
2994
+ */
2995
+ interface CreatePermissionInput {
2996
+ scope: PermissionScope;
2997
+ target: string;
2998
+ /**
2999
+ * Actions allowed on the target.
3000
+ */
3001
+ actions: Action[];
3002
+ }
3003
+ /**
3004
+ * Input for assigning a role to a user.
3005
+ */
3006
+ interface AssignRoleInput {
3007
+ /**
3008
+ * User profile ID (UserProfile.id).
3009
+ */
3010
+ userProfileId: Uuid;
3011
+ roleId: Uuid;
3012
+ tenantId: Uuid;
3013
+ assignedBy?: Uuid;
3014
+ }
3015
+
3016
+ /**
3017
+ * A permission attached to an API key.
3018
+ * Same format as RBAC permissions — reuses PermissionScope, Action, and target.
3019
+ */
3020
+ interface ApiKeyPermission {
3021
+ scope: PermissionScope;
3022
+ target: string;
3023
+ actions: Action[];
3024
+ }
3025
+ interface ApiKey {
3026
+ id: string;
3027
+ tenantId: string;
3028
+ userProfileId: string | null;
3029
+ name: string;
3030
+ prefix: string;
3031
+ permissions: ApiKeyPermission[];
3032
+ expiresAt: string | null;
3033
+ lastUsedAt: string | null;
3034
+ revokedAt: string | null;
3035
+ createdAt: string;
3036
+ createdBy: string;
3037
+ }
3038
+ /** Returned only at creation time — the only time the plaintext secret is available. */
3039
+ interface ApiKeyWithSecret extends ApiKey {
3040
+ secret: string;
3041
+ }
3042
+ /**
3043
+ * Returned by validateKey — provides everything downstream needs.
3044
+ * Permissions are already intersected with user RBAC for personal keys.
3045
+ */
3046
+ interface ApiKeyAuthContext {
3047
+ tenantId: string;
3048
+ userId: string | null;
3049
+ keyId: string;
3050
+ permissions: ApiKeyPermission[];
3051
+ }
3052
+ interface CreateApiKeyInput {
3053
+ name: string;
3054
+ permissions: ApiKeyPermission[];
3055
+ expiresAt?: string;
3056
+ userProfileId?: string;
3057
+ }
3058
+
3059
+ /**
3060
+ * Attribute Property Protection
3061
+ *
3062
+ * Defines which properties can be modified based on attribute type (custom vs system).
3063
+ *
3064
+ * Protection levels:
3065
+ * 1. Identity properties: NEVER modifiable (defines attribute structure)
3066
+ * 2. Behavior properties: Modifiable for custom attributes, PROTECTED for system attributes
3067
+ * 3. Presentation properties: ALWAYS modifiable (display only, no logic impact)
3068
+ */
3069
+ /**
3070
+ * Identity properties - Never modifiable
3071
+ * These define the fundamental structure of the attribute.
3072
+ */
3073
+ declare const IDENTITY_PROPERTIES: readonly ["name", "type"];
3074
+ /**
3075
+ * Behavior properties - Protected for system attributes
3076
+ * These affect business logic and data integrity.
3077
+ */
3078
+ declare const BEHAVIOR_PROPERTIES: readonly ["required", "disabled", "hidden", "archived", "deprecated", "defaultValue", "config", "order", "unique"];
3079
+ /**
3080
+ * Presentation properties - Always modifiable
3081
+ * These only affect display, not logic.
3082
+ */
3083
+ declare const PRESENTATION_PROPERTIES: readonly ["label", "description", "placeholder", "icon"];
3084
+ type IdentityProperty = (typeof IDENTITY_PROPERTIES)[number];
3085
+ type BehaviorProperty = (typeof BEHAVIOR_PROPERTIES)[number];
3086
+ type PresentationProperty = (typeof PRESENTATION_PROPERTIES)[number];
3087
+ /**
3088
+ * Check if a property is an identity property (never modifiable)
3089
+ */
3090
+ declare function isIdentityProperty(property: string): property is IdentityProperty;
3091
+ /**
3092
+ * Check if a property is a behavior property (protected for system attributes)
3093
+ */
3094
+ declare function isBehaviorProperty(property: string): property is BehaviorProperty;
3095
+ /**
3096
+ * Check if a property is a presentation property (always modifiable)
3097
+ */
3098
+ declare function isPresentationProperty(property: string): property is PresentationProperty;
3099
+
3100
+ /**
3101
+ * Type of resource that can be audited
3102
+ */
3103
+ type AuditResourceType = "record" | "object" | "attribute" | "user" | "role" | "settings" | "file";
3104
+ /**
3105
+ * Actions that can be audited
3106
+ */
3107
+ type AuditAction = "record.created" | "record.updated" | "record.deleted" | "record.restored" | "object.created" | "object.updated" | "object.deleted" | "attribute.created" | "attribute.updated" | "attribute.deleted" | "user.created" | "user.invited" | "user.updated" | "user.deleted" | "user.login" | "user.logout" | "role.created" | "role.updated" | "role.deleted" | "role.assigned" | "role.revoked" | "settings.updated" | "file.uploaded" | "file.updated" | "file.deleted";
3108
+ /**
3109
+ * Actor type - who performed the action
3110
+ */
3111
+ type AuditActorType = "user" | "system";
3112
+ /**
3113
+ * Detail of a change on a field
3114
+ */
3115
+ interface AuditChange {
3116
+ /** Field name that was changed */
3117
+ field: string;
3118
+ /** Previous value (undefined for new fields) */
3119
+ oldValue: unknown;
3120
+ /** New value (undefined for deleted fields) */
3121
+ newValue: unknown;
3122
+ }
3123
+ /**
3124
+ * Audit log entry - immutable record of an action
3125
+ */
3126
+ interface AuditLogEntry {
3127
+ id: Uuid;
3128
+ tenantId: Uuid;
3129
+ /** User profile ID of the actor (null for system actions) */
3130
+ actorId?: string;
3131
+ /** Denormalized email for search (in case user is deleted) */
3132
+ actorEmail?: string;
3133
+ /** Type of actor */
3134
+ actorType: AuditActorType;
3135
+ action: AuditAction;
3136
+ resourceType: AuditResourceType;
3137
+ resourceId: Uuid;
3138
+ /** Human-readable label (record name, object label, etc.) */
3139
+ resourceLabel?: string;
3140
+ /** Object technical name (e.g., "companies", "contacts") */
3141
+ objectName?: string;
3142
+ /** Object UUID */
3143
+ objectId?: Uuid;
3144
+ changes?: AuditChange[];
3145
+ /** Extra context (IP, user-agent, requestId, etc.) */
3146
+ metadata?: Record<string, unknown>;
3147
+ createdAt: Date;
3148
+ }
3149
+ /**
3150
+ * Input for creating an audit log entry.
3151
+ * Tenant ID is automatically set from execution context.
3152
+ */
3153
+ interface CreateAuditLogInput {
3154
+ actorId?: string;
3155
+ /** Denormalized actor email for display purposes. */
3156
+ actorEmail?: string;
3157
+ actorType?: AuditActorType;
3158
+ action: AuditAction;
3159
+ resourceType: AuditResourceType;
3160
+ resourceId: string;
3161
+ resourceLabel?: string;
3162
+ objectName?: string;
3163
+ objectId?: string;
3164
+ changes?: AuditChange[];
3165
+ metadata?: Record<string, unknown>;
3166
+ }
3167
+ /**
3168
+ * Options for listing audit logs
3169
+ */
3170
+ interface AuditListOptions {
3171
+ limit?: number;
3172
+ offset?: number;
3173
+ action?: AuditAction | AuditAction[];
3174
+ resourceType?: AuditResourceType | AuditResourceType[];
3175
+ objectName?: string;
3176
+ actorId?: string;
3177
+ from?: Date;
3178
+ to?: Date;
3179
+ orderBy?: "createdAt";
3180
+ orderDirection?: "asc" | "desc";
3181
+ }
3182
+ /**
3183
+ * Options for AuditService
3184
+ */
3185
+ interface AuditServiceOptions {
3186
+ /**
3187
+ * If true, audit logging is async (fire-and-forget).
3188
+ * Better performance but logs might be lost on crash.
3189
+ * @default false
3190
+ */
3191
+ async?: boolean;
3192
+ /**
3193
+ * Batch size for async mode.
3194
+ * Logs are buffered and flushed when batch is full or after flushIntervalMs.
3195
+ * @default 10
3196
+ */
3197
+ batchSize?: number;
3198
+ /**
3199
+ * Flush interval in ms for async mode.
3200
+ * @default 1000
3201
+ */
3202
+ flushIntervalMs?: number;
3203
+ }
3204
+
2877
3205
  type AgentRunStatus = "pending" | "running" | "completed" | "failed" | "cancelled" | "paused";
2878
- type AgentTriggerType = "record.created" | "record.updated" | "record.deleted";
3206
+ type AgentSessionStatus = "active" | "completed" | "failed" | "cancelled" | "waiting_human" | "timeout" | "expired";
3207
+ type AgentSessionMode = "interactive" | "autonomous";
3208
+ type QuestionStatus = "pending" | "answered" | "timeout" | "cancelled";
3209
+ type TriggerEventType = "record.created" | "record.updated" | "record.deleted" | "record.field_changed" | "workflow.completed" | "agent.completed" | "webhook" | "schedule";
3210
+ type AgentTriggerType = Extract<TriggerEventType, "record.created" | "record.updated" | "record.deleted">;
2879
3211
  type ProviderName = "anthropic" | "openai" | "google" | "mistral";
2880
3212
  interface ModelDefinition {
2881
3213
  provider: ProviderName;
@@ -2893,18 +3225,58 @@ interface AgentExecutionConfig {
2893
3225
  timeoutMs: number;
2894
3226
  costLimitUsd?: number;
2895
3227
  }
2896
- interface AgentInlineConfig {
3228
+ /**
3229
+ * Shared base config used by AgentDefinition, AgentInlineConfig, and AgentSession.
3230
+ */
3231
+ interface AgentConfig {
2897
3232
  systemPrompt: string;
2898
3233
  model: ModelDefinition;
2899
3234
  tools?: string[];
2900
3235
  maxIterations?: number;
2901
3236
  timeoutMs?: number;
3237
+ canDelegate: boolean;
3238
+ maxDepth: number;
3239
+ maxTreeCostUsd?: number;
3240
+ canAskHuman?: boolean;
3241
+ critic?: CriticConfig;
3242
+ }
3243
+ /** @deprecated Use AgentConfig directly */
3244
+ type AgentInlineConfig = AgentConfig;
3245
+ interface CriticConfig {
3246
+ enabled: boolean;
3247
+ model?: ModelDefinition;
3248
+ systemPrompt?: string;
3249
+ maxRetries?: number;
2902
3250
  }
3251
+ /** @deprecated Use AgentTriggerDefinition for standalone triggers */
2903
3252
  interface AgentTrigger {
2904
3253
  type: AgentTriggerType;
2905
3254
  objectId: string;
2906
3255
  filter?: Record<string, unknown>;
2907
3256
  }
3257
+ /**
3258
+ * Standalone trigger definition (replaces embedded AgentTrigger[]).
3259
+ * Triggers are now first-class entities with their own lifecycle.
3260
+ */
3261
+ interface AgentTriggerDefinition {
3262
+ id: string;
3263
+ tenantId: string;
3264
+ definitionId: string;
3265
+ name?: string;
3266
+ eventType: TriggerEventType;
3267
+ objectId?: string;
3268
+ fieldPath?: string;
3269
+ workflowDefinitionId?: string;
3270
+ sourceAgentId?: string;
3271
+ webhookPath?: string;
3272
+ cronExpression?: string;
3273
+ timezone?: string;
3274
+ filter?: Record<string, unknown>;
3275
+ inputBuilder?: string;
3276
+ enabled: boolean;
3277
+ createdAt: Date;
3278
+ updatedAt: Date;
3279
+ }
2908
3280
  interface AgentSchedule {
2909
3281
  cron: string;
2910
3282
  timezone?: string;
@@ -2912,6 +3284,11 @@ interface AgentSchedule {
2912
3284
  input?: Record<string, unknown>;
2913
3285
  inputBuilder?: string;
2914
3286
  }
3287
+ interface TimeoutPolicy {
3288
+ timeoutMs: number;
3289
+ action: "cancel" | "auto_decide" | "escalate";
3290
+ fallbackValue?: unknown;
3291
+ }
2915
3292
  interface AgentDefinition {
2916
3293
  id: string;
2917
3294
  tenantId: string;
@@ -2922,11 +3299,18 @@ interface AgentDefinition {
2922
3299
  tools?: string[];
2923
3300
  maxIterations?: number;
2924
3301
  schedule?: AgentSchedule;
3302
+ /** @deprecated Use standalone AgentTriggerDefinition */
2925
3303
  triggers?: AgentTrigger[];
2926
3304
  config: AgentExecutionConfig;
2927
3305
  createdBy: string;
2928
3306
  createdAt: Date;
2929
3307
  updatedAt: Date;
3308
+ deletedAt?: Date;
3309
+ canDelegate?: boolean;
3310
+ maxDepth?: number;
3311
+ maxTreeCostUsd?: number;
3312
+ critic?: CriticConfig;
3313
+ autoDecide?: boolean;
2930
3314
  }
2931
3315
  interface AgentRun {
2932
3316
  id: string;
@@ -2945,11 +3329,74 @@ interface AgentRun {
2945
3329
  input: number;
2946
3330
  output: number;
2947
3331
  };
2948
- costUsd?: number;
2949
- startedAt?: Date;
2950
- completedAt?: Date;
3332
+ costUsd?: number;
3333
+ startedAt?: Date;
3334
+ completedAt?: Date;
3335
+ createdAt: Date;
3336
+ sessionId?: string;
3337
+ rootRunId?: string;
3338
+ triggerId?: string;
3339
+ treeCostUsd?: number;
3340
+ effectiveSystemPrompt?: string;
3341
+ conversationId?: string;
3342
+ }
3343
+ interface AgentSession {
3344
+ id: string;
3345
+ tenantId: string;
3346
+ mode: AgentSessionMode;
3347
+ status: AgentSessionStatus;
3348
+ definitionId?: string;
3349
+ inlineConfig?: AgentConfig;
3350
+ parentSessionId?: string;
3351
+ rootSessionId: string;
3352
+ depth: number;
3353
+ missionPrompt?: string;
3354
+ treeCostUsd: number;
3355
+ name?: string;
3356
+ metadata?: Record<string, unknown>;
3357
+ createdBy?: string;
3358
+ createdAt: Date;
3359
+ updatedAt: Date;
3360
+ completedAt?: Date;
3361
+ expiresAt?: Date;
3362
+ }
3363
+ /**
3364
+ * Persisted message in an agent session.
3365
+ * Unified type for both interactive and autonomous sessions.
3366
+ */
3367
+ interface AgentSessionMessage {
3368
+ id: string;
3369
+ sessionId: string;
3370
+ tenantId?: string;
3371
+ runId?: string;
3372
+ role: "user" | "assistant" | "system" | "tool";
3373
+ content: string;
3374
+ toolCalls?: AgentToolCall[];
3375
+ tokenUsage?: {
3376
+ input: number;
3377
+ output: number;
3378
+ };
3379
+ createdAt: Date;
3380
+ }
3381
+ interface AgentToolCall {
3382
+ id: string;
3383
+ name: string;
3384
+ arguments: Record<string, unknown>;
3385
+ result?: unknown;
3386
+ error?: string;
3387
+ durationMs?: number;
3388
+ }
3389
+ interface AgentContextEntry {
3390
+ id: string;
3391
+ rootRunId: string;
3392
+ runId: string;
3393
+ namespace: string;
3394
+ key: string;
3395
+ value: unknown;
2951
3396
  createdAt: Date;
3397
+ updatedAt: Date;
2952
3398
  }
3399
+ /** @deprecated Use AgentContextEntry with namespace/key/value */
2953
3400
  interface AgentRunContextEntry {
2954
3401
  id: string;
2955
3402
  rootRunId: string;
@@ -2958,6 +3405,26 @@ interface AgentRunContextEntry {
2958
3405
  content: string;
2959
3406
  createdAt: Date;
2960
3407
  }
3408
+ interface AgentQuestion {
3409
+ id: string;
3410
+ runId: string;
3411
+ sessionId?: string;
3412
+ tenantId: string;
3413
+ question: string;
3414
+ options?: string[];
3415
+ metadata?: Record<string, unknown>;
3416
+ status: QuestionStatus;
3417
+ response?: QuestionResponse;
3418
+ timeoutPolicy?: TimeoutPolicy;
3419
+ createdAt: Date;
3420
+ answeredAt?: Date;
3421
+ expiresAt?: Date;
3422
+ }
3423
+ interface QuestionResponse {
3424
+ answer: unknown;
3425
+ answeredBy?: string;
3426
+ source: "user" | "auto_decide" | "timeout";
3427
+ }
2961
3428
  interface AgentEvent {
2962
3429
  type: AgentTriggerType;
2963
3430
  objectId: string;
@@ -3507,7 +3974,7 @@ type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribut
3507
3974
  * Adds support for custom attributes (added via UI) to a record type
3508
3975
  * Preserves autocompletion for known attributes while allowing additional properties
3509
3976
  */
3510
- type WithCustomAttributes<T> = T & {
3977
+ type WithCustomAttributes$1<T> = T & {
3511
3978
  [key: string]: CustomAttributeValue;
3512
3979
  };
3513
3980
  /**
@@ -3576,7 +4043,7 @@ type ExtractRecord<TBuilder> = TBuilder extends {
3576
4043
  _types: {
3577
4044
  record: infer R;
3578
4045
  };
3579
- } ? WithCustomAttributes<R> & RecordMetadata : never;
4046
+ } ? WithCustomAttributes$1<R> & RecordMetadata : never;
3580
4047
  /**
3581
4048
  * Extract the record type without custom attributes (strict mode)
3582
4049
  * Use this when you only want the defined attributes
@@ -3596,7 +4063,7 @@ type ExtractRecordInput<TBuilder> = TBuilder extends {
3596
4063
  _types: {
3597
4064
  input: infer R;
3598
4065
  };
3599
- } ? Omit<WithCustomAttributes<R>, SystemFields> : never;
4066
+ } ? Omit<WithCustomAttributes$1<R>, SystemFields> : never;
3600
4067
  /**
3601
4068
  * Extract the input type without custom attributes (strict mode)
3602
4069
  * Omits system fields (id, createdAt, updatedAt) as they are managed automatically.
@@ -3615,7 +4082,7 @@ type ExtractRecordUpdate<TBuilder> = TBuilder extends {
3615
4082
  _types: {
3616
4083
  update: infer R;
3617
4084
  };
3618
- } ? Omit<WithCustomAttributes<R>, SystemFields> : never;
4085
+ } ? Omit<WithCustomAttributes$1<R>, SystemFields> : never;
3619
4086
  /**
3620
4087
  * Extract the update type without custom attributes (strict mode)
3621
4088
  * Omits system fields (id, createdAt, updatedAt) as they are managed automatically.
@@ -3665,258 +4132,27 @@ interface TypedObjectRecord<TValues extends Record<string, unknown>> extends Tim
3665
4132
  * // id: string;
3666
4133
  * // objectId: string;
3667
4134
  * // label: string;
3668
- * // completionStatus: CompletionStatus;
3669
- * // values: { name: string; price?: number };
3670
- * // metadata?: Record<string, unknown>;
3671
- * // ...
3672
- * // }
3673
- * ```
3674
- */
3675
- type ExtractObjectRecord<TBuilder> = TBuilder extends {
3676
- _types: {
3677
- record: infer R;
3678
- };
3679
- } ? TypedObjectRecord<R extends Record<string, unknown> ? R : Record<string, unknown>> : never;
3680
- /**
3681
- * Extract the raw ObjectRecord type with custom attribute support.
3682
- * Same as ExtractObjectRecord but allows additional properties in `values`.
3683
- */
3684
- type ExtractObjectRecordWithCustom<TBuilder> = TBuilder extends {
3685
- _types: {
3686
- record: infer R;
3687
- };
3688
- } ? TypedObjectRecord<R extends Record<string, unknown> ? WithCustomAttributes<R> : Record<string, CustomAttributeValue>> : never;
3689
-
3690
- /**
3691
- * Scope of a permission rule.
3692
- * - `object`: Controls access to an entire object type (business data)
3693
- * - `system`: Controls access to platform resources (people, workspace)
3694
- */
3695
- type PermissionScope = "object" | "system";
3696
- /**
3697
- * Actions that can be performed on a resource.
3698
- */
3699
- type Action = "read" | "create" | "update" | "delete";
3700
- /**
3701
- * System resources that can be managed.
3702
- * - `people`: User profiles, invitations, roles and permissions
3703
- * - `workspace`: Object definitions, attributes, tenant settings, audit logs
3704
- * - `architect`: Architect settings, templates, and configurations
3705
- */
3706
- type SystemResource = "people" | "workspace" | "architect";
3707
- /**
3708
- * Preset access levels for simplified permission configuration.
3709
- * - `full`: All CRUD actions
3710
- * - `read-only`: Only read action
3711
- * - `none`: No actions
3712
- * - `custom`: Manual selection of individual actions
3713
- */
3714
- type AccessLevel = "full" | "read-only" | "none" | "custom";
3715
- declare const ALL_ACTIONS: Action[];
3716
- /**
3717
- * Derive an AccessLevel from a list of actions.
3718
- */
3719
- declare function actionsToAccessLevel(actions: Action[]): AccessLevel;
3720
- /**
3721
- * Convert an AccessLevel preset to its corresponding actions.
3722
- */
3723
- declare function accessLevelToActions(level: Exclude<AccessLevel, "custom">): Action[];
3724
- /**
3725
- * Role definition - Groups permissions together.
3726
- *
3727
- * Roles are tenant-scoped and can be system-defined (immutable) or custom.
3728
- *
3729
- * @example
3730
- * ```typescript
3731
- * const ownerRole: Role = {
3732
- * id: "role-123",
3733
- * tenantId: "tenant-456",
3734
- * name: "owner",
3735
- * label: "Owner",
3736
- * description: "Full access to all platform features and data",
3737
- * system: true,
3738
- * createdAt: new Date(),
3739
- * updatedAt: new Date(),
3740
- * };
3741
- * ```
3742
- */
3743
- interface Role extends Timestamps {
3744
- id: Uuid;
3745
- tenantId: Uuid;
3746
- /**
3747
- * Technical name (unique per tenant, used in code).
3748
- * Examples: "owner", "member", "sales_manager"
3749
- */
3750
- name: string;
3751
- /**
3752
- * Display name shown in UI.
3753
- */
3754
- label: string;
3755
- /**
3756
- * Optional description of the role's purpose.
3757
- */
3758
- description?: string;
3759
- /**
3760
- * If true, this role cannot be modified or deleted.
3761
- * Used for built-in roles like "owner".
3762
- */
3763
- system: boolean;
3764
- }
3765
- /**
3766
- * Permission definition - Grants specific actions on a target.
3767
- *
3768
- * A permission belongs to a role and defines what actions are allowed
3769
- * on a specific target (object or system resource).
3770
- *
3771
- * @example
3772
- * ```typescript
3773
- * // Allow read and update on companies object
3774
- * const permission: Permission = {
3775
- * id: "perm-123",
3776
- * roleId: "role-456",
3777
- * scope: "object",
3778
- * target: "companies",
3779
- * actions: ["read", "update"],
3780
- * createdAt: new Date(),
3781
- * };
3782
- *
3783
- * // Wildcard permission for all objects
3784
- * const wildcardPerm: Permission = {
3785
- * id: "perm-789",
3786
- * roleId: "role-456",
3787
- * scope: "object",
3788
- * target: "*",
3789
- * actions: ["read", "create", "update", "delete"],
3790
- * createdAt: new Date(),
3791
- * };
3792
- * ```
3793
- */
3794
- interface Permission {
3795
- id: Uuid;
3796
- roleId: Uuid;
3797
- /**
3798
- * Scope of this permission.
3799
- */
3800
- scope: PermissionScope;
3801
- /**
3802
- * Target of the permission.
3803
- * - For `object` scope: object name (e.g., "companies") or "*" for all
3804
- * - For `system` scope: system resource (e.g., "people", "workspace") or "*" for all
3805
- */
3806
- target: string;
3807
- /**
3808
- * Actions allowed on the target.
3809
- */
3810
- actions: Action[];
3811
- createdAt: Date;
3812
- }
3813
- /**
3814
- * Links a user profile to a role within a tenant.
3815
- *
3816
- * A user can have multiple roles, and their permissions are additive (union).
3817
- *
3818
- * Note: `userProfileId` references UserProfile.id from the user_profiles table,
3819
- * NOT the auth provider ID (authId). This keeps permissions tied to the
3820
- * application's user management, not the authentication layer.
3821
- */
3822
- interface UserRoleAssignment {
3823
- id: Uuid;
3824
- /**
3825
- * User profile ID (UserProfile.id from user_profiles table).
3826
- * This links to the application's user management system,
3827
- * not the auth provider's user ID.
3828
- */
3829
- userProfileId: Uuid;
3830
- roleId: Uuid;
3831
- tenantId: Uuid;
3832
- /**
3833
- * When the role was assigned.
3834
- */
3835
- assignedAt: Date;
3836
- /**
3837
- * User profile ID of who assigned this role (for audit trail).
3838
- */
3839
- assignedBy?: Uuid;
3840
- }
3841
- /**
3842
- * Computed permissions for a user.
3843
- *
3844
- * This is the merged result of all roles assigned to a user.
3845
- * Returned by the API for permission checks.
3846
- */
3847
- interface EffectivePermissions {
3848
- /**
3849
- * Object-level permissions.
3850
- * Key is the object name, value is array of allowed actions.
3851
- * Special key "*" means permission applies to all objects.
3852
- */
3853
- objectPermissions: Record<string, Action[]>;
3854
- /**
3855
- * System-level permissions.
3856
- * Key is the system resource (people, workspace), value is array of allowed actions.
3857
- * Special key "*" means permission applies to all system resources.
3858
- */
3859
- systemPermissions: Record<string, Action[]>;
3860
- }
3861
- /**
3862
- * Permissions for a specific object.
3863
- * Convenience type for frontend use.
3864
- */
3865
- interface ObjectPermissions {
3866
- canRead: boolean;
3867
- canCreate: boolean;
3868
- canUpdate: boolean;
3869
- canDelete: boolean;
3870
- }
3871
- /**
3872
- * Permissions for a specific system resource.
3873
- * Convenience type for frontend use.
3874
- */
3875
- interface SystemPermissions {
3876
- canRead: boolean;
3877
- canCreate: boolean;
3878
- canUpdate: boolean;
3879
- canDelete: boolean;
3880
- }
3881
- /**
3882
- * Input for creating a new role.
3883
- * TenantId is automatically set from TenantContext.
3884
- */
3885
- interface CreateRoleInput {
3886
- name: string;
3887
- label: string;
3888
- description?: string;
3889
- }
3890
- /**
3891
- * Input for updating an existing role.
3892
- */
3893
- interface UpdateRoleInput {
3894
- label?: string;
3895
- description?: string;
3896
- }
3897
- /**
3898
- * Input for creating a permission.
4135
+ * // completionStatus: CompletionStatus;
4136
+ * // values: { name: string; price?: number };
4137
+ * // metadata?: Record<string, unknown>;
4138
+ * // ...
4139
+ * // }
4140
+ * ```
3899
4141
  */
3900
- interface CreatePermissionInput {
3901
- scope: PermissionScope;
3902
- target: string;
3903
- /**
3904
- * Actions allowed on the target.
3905
- */
3906
- actions: Action[];
3907
- }
4142
+ type ExtractObjectRecord<TBuilder> = TBuilder extends {
4143
+ _types: {
4144
+ record: infer R;
4145
+ };
4146
+ } ? TypedObjectRecord<R extends Record<string, unknown> ? R : Record<string, unknown>> : never;
3908
4147
  /**
3909
- * Input for assigning a role to a user.
4148
+ * Extract the raw ObjectRecord type with custom attribute support.
4149
+ * Same as ExtractObjectRecord but allows additional properties in `values`.
3910
4150
  */
3911
- interface AssignRoleInput {
3912
- /**
3913
- * User profile ID (UserProfile.id).
3914
- */
3915
- userProfileId: Uuid;
3916
- roleId: Uuid;
3917
- tenantId: Uuid;
3918
- assignedBy?: Uuid;
3919
- }
4151
+ type ExtractObjectRecordWithCustom<TBuilder> = TBuilder extends {
4152
+ _types: {
4153
+ record: infer R;
4154
+ };
4155
+ } ? TypedObjectRecord<R extends Record<string, unknown> ? WithCustomAttributes$1<R> : Record<string, CustomAttributeValue>> : never;
3920
4156
 
3921
4157
  /**
3922
4158
  * Context passed to policy methods
@@ -4482,6 +4718,51 @@ declare function parseRawPhoneInput(rawInput: string, countryIso3: CountryIso3):
4482
4718
  */
4483
4719
  declare function applyRelationProps(label: string, props: Record<string, unknown> | undefined, propertyDefs: Attribute[] | undefined): string;
4484
4720
 
4721
+ /**
4722
+ * Valid simple pipe names (no arguments)
4723
+ */
4724
+ declare const SIMPLE_PIPES: readonly ["UPPER", "LOWER", "capitalize", "trim"];
4725
+ /**
4726
+ * Valid pipe names that take arguments
4727
+ */
4728
+ declare const PIPES_WITH_ARGS: readonly ["prefix", "suffix", "wrap", "default"];
4729
+ /**
4730
+ * All valid pipe names
4731
+ */
4732
+ declare const ALL_PIPES: readonly ["UPPER", "LOWER", "capitalize", "trim", "prefix", "suffix", "wrap", "default"];
4733
+ type SimplePipe = (typeof SIMPLE_PIPES)[number];
4734
+ type PipeWithArgs = (typeof PIPES_WITH_ARGS)[number];
4735
+ type LabelPipe = (typeof ALL_PIPES)[number];
4736
+ /**
4737
+ * Zod schema for validating labelExpression templates.
4738
+ *
4739
+ * Validates the syntax of label expression templates used throughout the system.
4740
+ * Uses the existing `isLabelExpression` function for basic validation, then
4741
+ * performs additional checks for pipe validity.
4742
+ *
4743
+ * @example Valid expressions:
4744
+ * ```typescript
4745
+ * "{{ name }}"
4746
+ * "{{ firstName }} {{ lastName }}"
4747
+ * "{{ name | UPPER }}"
4748
+ * "{{ role | prefix:\", \" }}"
4749
+ * "{{ firstName || name }}"
4750
+ * "{{ user.firstName }}"
4751
+ * ```
4752
+ */
4753
+ declare const labelExpressionSchema: z.ZodString;
4754
+ type LabelExpression = z.infer<typeof labelExpressionSchema>;
4755
+ /**
4756
+ * Validate a labelExpression and return detailed result
4757
+ *
4758
+ * @param expression - The labelExpression to validate
4759
+ * @returns Validation result with success status and extracted info
4760
+ */
4761
+ declare function validateLabelExpression(expression: string): {
4762
+ success: boolean;
4763
+ error?: string;
4764
+ attributes?: string[];
4765
+ };
4485
4766
  /**
4486
4767
  * Default fallback value when expression resolves to empty string
4487
4768
  */
@@ -4606,6 +4887,8 @@ declare const SchemaErrorCode: {
4606
4887
  readonly USER_PROFILE_NOT_FOUND: "SCHEMA_USER_PROFILE_NOT_FOUND";
4607
4888
  readonly FILE_NOT_FOUND: "SCHEMA_FILE_NOT_FOUND";
4608
4889
  readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
4890
+ readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
4891
+ readonly CONVERSATION_NOT_FOUND: "SCHEMA_CONVERSATION_NOT_FOUND";
4609
4892
  readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
4610
4893
  readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
4611
4894
  readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
@@ -4614,11 +4897,21 @@ declare const SchemaErrorCode: {
4614
4897
  readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
4615
4898
  readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
4616
4899
  readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
4900
+ readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
4617
4901
  readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
4618
4902
  readonly NOT_SYSTEM_OBJECT: "SCHEMA_NOT_SYSTEM_OBJECT";
4619
4903
  readonly DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT";
4620
4904
  readonly DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE";
4621
4905
  readonly CONFLICT: "SCHEMA_CONFLICT";
4906
+ readonly STORAGE_UPLOAD_FAILED: "SCHEMA_STORAGE_UPLOAD_FAILED";
4907
+ readonly STORAGE_DOWNLOAD_FAILED: "SCHEMA_STORAGE_DOWNLOAD_FAILED";
4908
+ readonly STORAGE_DELETE_FAILED: "SCHEMA_STORAGE_DELETE_FAILED";
4909
+ readonly STORAGE_URL_FAILED: "SCHEMA_STORAGE_URL_FAILED";
4910
+ readonly REPOSITORY_CREATE_FAILED: "SCHEMA_REPOSITORY_CREATE_FAILED";
4911
+ readonly REPOSITORY_UPDATE_FAILED: "SCHEMA_REPOSITORY_UPDATE_FAILED";
4912
+ readonly REPOSITORY_DELETE_FAILED: "SCHEMA_REPOSITORY_DELETE_FAILED";
4913
+ readonly REPOSITORY_QUERY_FAILED: "SCHEMA_REPOSITORY_QUERY_FAILED";
4914
+ readonly NOT_IMPLEMENTED: "SCHEMA_NOT_IMPLEMENTED";
4622
4915
  };
4623
4916
  type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
4624
4917
  /**
@@ -4778,6 +5071,76 @@ declare function isForbiddenError(error: unknown): error is ForbiddenError;
4778
5071
  declare class ConcurrentModificationError extends SchemaError {
4779
5072
  constructor(recordId: string);
4780
5073
  }
5074
+ /**
5075
+ * Storage operation type for error context
5076
+ */
5077
+ type StorageOperation = "upload" | "download" | "delete" | "signedUrl";
5078
+ /**
5079
+ * Error thrown when a storage operation fails
5080
+ */
5081
+ declare class StorageError extends SchemaError {
5082
+ readonly operation: StorageOperation;
5083
+ readonly path?: string;
5084
+ readonly cause?: string;
5085
+ constructor(operation: StorageOperation, message: string, path?: string, cause?: string);
5086
+ }
5087
+ /**
5088
+ * Check if an error is a StorageError
5089
+ */
5090
+ declare function isStorageError(error: unknown): error is StorageError;
5091
+ /**
5092
+ * Error thrown when access to a resource is denied (e.g., tenant path mismatch)
5093
+ */
5094
+ declare class AccessDeniedError extends SchemaError {
5095
+ readonly resource: string;
5096
+ readonly reason?: string;
5097
+ constructor(resource: string, reason?: string);
5098
+ }
5099
+ /**
5100
+ * Check if an error is an AccessDeniedError
5101
+ */
5102
+ declare function isAccessDeniedError(error: unknown): error is AccessDeniedError;
5103
+ /**
5104
+ * Repository operation type for error context
5105
+ */
5106
+ type RepositoryOperation = "create" | "update" | "delete" | "query";
5107
+ /**
5108
+ * Error thrown when a repository operation fails
5109
+ */
5110
+ declare class RepositoryError extends SchemaError {
5111
+ readonly operation: RepositoryOperation;
5112
+ readonly entity: string;
5113
+ readonly cause?: string;
5114
+ constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
5115
+ }
5116
+ /**
5117
+ * Check if an error is a RepositoryError
5118
+ */
5119
+ declare function isRepositoryError(error: unknown): error is RepositoryError;
5120
+ /**
5121
+ * Error thrown when a feature or method is not yet implemented
5122
+ */
5123
+ declare class NotImplementedError extends SchemaError {
5124
+ readonly feature: string;
5125
+ readonly milestone?: string;
5126
+ constructor(feature: string, milestone?: string);
5127
+ }
5128
+ /**
5129
+ * Check if an error is a NotImplementedError
5130
+ */
5131
+ declare function isNotImplementedError(error: unknown): error is NotImplementedError;
5132
+ /**
5133
+ * Memory entry not found error
5134
+ */
5135
+ declare class MemoryNotFoundError extends NotFoundError {
5136
+ constructor(memoryId: string);
5137
+ }
5138
+ /**
5139
+ * Conversation not found error
5140
+ */
5141
+ declare class ConversationNotFoundError extends NotFoundError {
5142
+ constructor(conversationId: string);
5143
+ }
4781
5144
 
4782
5145
  /**
4783
5146
  * Builder config with literal name type preservation
@@ -4788,11 +5151,54 @@ interface TypedBuilderConfig<TName extends string> extends BuilderConfig {
4788
5151
  /**
4789
5152
  * Base attribute builder
4790
5153
  * Type tracking is done via the `_types` phantom property
5154
+ *
5155
+ * Implements Standard Schema v1 interface via the `~standard` property.
5156
+ * @see https://standardschema.dev/
4791
5157
  */
4792
- declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
5158
+ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> implements StandardSchemaV1<unknown, unknown> {
4793
5159
  protected attr: Partial<TAttr>;
5160
+ /**
5161
+ * Standard Schema v1 interface implementation.
5162
+ *
5163
+ * This property enables interoperability with libraries that support
5164
+ * Standard Schema (React Hook Form, tRPC, etc.).
5165
+ *
5166
+ * @see https://standardschema.dev/
5167
+ */
5168
+ get "~standard"(): StandardSchemaV1.Props<unknown, unknown>;
4794
5169
  constructor(type: TAttr["type"], name: string, label: string);
4795
5170
  protected setRequired(value: boolean): void;
5171
+ /**
5172
+ * Type-safe method to return this builder with a different TRequired phantom type.
5173
+ *
5174
+ * This method centralizes the type assertion needed when transitioning between
5175
+ * required states. The assertion is safe because:
5176
+ * 1. The runtime representation is unchanged (same instance)
5177
+ * 2. Only the phantom _types.required property differs
5178
+ * 3. The class structure and all methods remain identical
5179
+ *
5180
+ * Using a single protected method for this pattern:
5181
+ * - Reduces scattered unsafe casts throughout the codebase
5182
+ * - Documents the safety reasoning in one place
5183
+ * - Makes the type transition explicit and auditable
5184
+ *
5185
+ * @internal
5186
+ */
5187
+ protected asRequiredState<TBuilder>(this: BaseAttributeBuilder<TAttr>): TBuilder;
5188
+ /**
5189
+ * Type-safe method to return this builder with different phantom type parameters.
5190
+ *
5191
+ * Used by builders with additional type parameters (like TOptions in Status/Select/Multiselect)
5192
+ * when those parameters need to change while preserving the builder instance.
5193
+ *
5194
+ * The assertion is safe because:
5195
+ * 1. The runtime representation is unchanged (same instance)
5196
+ * 2. Only phantom type parameters differ
5197
+ * 3. The class structure and all methods remain identical
5198
+ *
5199
+ * @internal
5200
+ */
5201
+ protected asPhantomState<TBuilder>(this: BaseAttributeBuilder<TAttr>): TBuilder;
4796
5202
  system(): this;
4797
5203
  disabled(): this;
4798
5204
  hidden(): this;
@@ -4835,6 +5241,25 @@ declare class TextAttributeBuilder<TName extends string, TRequired extends boole
4835
5241
  attribute: TextAttribute;
4836
5242
  required: TRequired;
4837
5243
  };
5244
+ /**
5245
+ * Drizzle-style static type inference property.
5246
+ * Provides direct access to inferred types without utility type imports.
5247
+ *
5248
+ * @example
5249
+ * ```typescript
5250
+ * const nameAttr = text({ name: "name", label: "Name" }).required();
5251
+ *
5252
+ * // Zero-import type inference! ✨
5253
+ * type NameValue = typeof nameAttr.$infer.value; // string
5254
+ * type NameDef = typeof nameAttr.$infer.definition; // TextAttribute
5255
+ * ```
5256
+ */
5257
+ readonly $infer: {
5258
+ /** The runtime value type for this attribute */
5259
+ value: string;
5260
+ /** The full attribute definition type */
5261
+ definition: TextAttribute;
5262
+ };
4838
5263
  constructor(name: TName, label: string);
4839
5264
  minLength(value: number): this;
4840
5265
  maxLength(value: number): this;
@@ -4864,6 +5289,16 @@ declare class TextAreaAttributeBuilder<TName extends string, TRequired extends b
4864
5289
  attribute: TextAreaAttribute;
4865
5290
  required: TRequired;
4866
5291
  };
5292
+ /**
5293
+ * Drizzle-style static type inference property.
5294
+ * @see TextAttributeBuilder.$infer for documentation
5295
+ */
5296
+ readonly $infer: {
5297
+ /** The runtime value type for this attribute */
5298
+ value: string;
5299
+ /** The full attribute definition type */
5300
+ definition: TextAreaAttribute;
5301
+ };
4867
5302
  constructor(name: TName, label: string);
4868
5303
  required(): TextAreaAttributeBuilder<TName, true>;
4869
5304
  optional(): TextAreaAttributeBuilder<TName, false>;
@@ -4878,6 +5313,16 @@ declare class RichtextAttributeBuilder<TName extends string, TRequired extends b
4878
5313
  attribute: RichtextAttribute;
4879
5314
  required: TRequired;
4880
5315
  };
5316
+ /**
5317
+ * Drizzle-style static type inference property.
5318
+ * @see TextAttributeBuilder.$infer for documentation
5319
+ */
5320
+ readonly $infer: {
5321
+ /** The runtime value type for this attribute (semantic markdown string) */
5322
+ value: string;
5323
+ /** The full attribute definition type */
5324
+ definition: RichtextAttribute;
5325
+ };
4881
5326
  constructor(name: TName, label: string);
4882
5327
  /**
4883
5328
  * Set enabled features for the richtext editor
@@ -4925,6 +5370,16 @@ declare class NumberAttributeBuilder<TName extends string, TRequired extends boo
4925
5370
  attribute: NumberAttribute;
4926
5371
  required: TRequired;
4927
5372
  };
5373
+ /**
5374
+ * Drizzle-style static type inference property.
5375
+ * @see TextAttributeBuilder.$infer for documentation
5376
+ */
5377
+ readonly $infer: {
5378
+ /** The runtime value type for this attribute */
5379
+ value: number;
5380
+ /** The full attribute definition type */
5381
+ definition: NumberAttribute;
5382
+ };
4928
5383
  constructor(name: TName, label: string);
4929
5384
  min(value: number): this;
4930
5385
  max(value: number): this;
@@ -4941,6 +5396,16 @@ declare class CheckboxAttributeBuilder<TName extends string, TRequired extends b
4941
5396
  attribute: CheckboxAttribute;
4942
5397
  required: TRequired;
4943
5398
  };
5399
+ /**
5400
+ * Drizzle-style static type inference property.
5401
+ * @see TextAttributeBuilder.$infer for documentation
5402
+ */
5403
+ readonly $infer: {
5404
+ /** The runtime value type for this attribute */
5405
+ value: boolean;
5406
+ /** The full attribute definition type */
5407
+ definition: CheckboxAttribute;
5408
+ };
4944
5409
  constructor(name: TName, label: string);
4945
5410
  required(): CheckboxAttributeBuilder<TName, true>;
4946
5411
  optional(): CheckboxAttributeBuilder<TName, false>;
@@ -4952,6 +5417,16 @@ declare class DateAttributeBuilder<TName extends string, TRequired extends boole
4952
5417
  attribute: DateAttribute;
4953
5418
  required: TRequired;
4954
5419
  };
5420
+ /**
5421
+ * Drizzle-style static type inference property.
5422
+ * @see TextAttributeBuilder.$infer for documentation
5423
+ */
5424
+ readonly $infer: {
5425
+ /** The runtime value type for this attribute (ISO string or Date) */
5426
+ value: string | Date;
5427
+ /** The full attribute definition type */
5428
+ definition: DateAttribute;
5429
+ };
4955
5430
  constructor(name: TName, label: string);
4956
5431
  format(value: DateAttribute["dateFormat"]): this;
4957
5432
  minDate(value: DateAttribute["minDate"]): this;
@@ -4966,6 +5441,16 @@ declare class PhoneAttributeBuilder<TName extends string, TRequired extends bool
4966
5441
  attribute: PhoneAttribute;
4967
5442
  required: TRequired;
4968
5443
  };
5444
+ /**
5445
+ * Drizzle-style static type inference property.
5446
+ * @see TextAttributeBuilder.$infer for documentation
5447
+ */
5448
+ readonly $infer: {
5449
+ /** The runtime value type for this attribute */
5450
+ value: Phone;
5451
+ /** The full attribute definition type */
5452
+ definition: PhoneAttribute;
5453
+ };
4969
5454
  constructor(name: TName, label: string);
4970
5455
  defaultCountry(value: CountryIso3): this;
4971
5456
  required(): PhoneAttributeBuilder<TName, true>;
@@ -4978,6 +5463,16 @@ declare class CurrencyAttributeBuilder<TName extends string, TRequired extends b
4978
5463
  attribute: CurrencyAttribute;
4979
5464
  required: TRequired;
4980
5465
  };
5466
+ /**
5467
+ * Drizzle-style static type inference property.
5468
+ * @see TextAttributeBuilder.$infer for documentation
5469
+ */
5470
+ readonly $infer: {
5471
+ /** The runtime value type for this attribute */
5472
+ value: Currency;
5473
+ /** The full attribute definition type */
5474
+ definition: CurrencyAttribute;
5475
+ };
4981
5476
  constructor(name: TName, label: string);
4982
5477
  defaultCurrency(value: CurrencyCode): this;
4983
5478
  allowedCurrencies(value: CurrencyCode[]): this;
@@ -4993,6 +5488,18 @@ declare class StatusAttributeBuilder<TName extends string, TOptions extends read
4993
5488
  };
4994
5489
  required: TRequired;
4995
5490
  };
5491
+ /**
5492
+ * Drizzle-style static type inference property.
5493
+ * @see TextAttributeBuilder.$infer for documentation
5494
+ */
5495
+ readonly $infer: {
5496
+ /** The runtime value type for this attribute (union of option values) */
5497
+ value: TOptions[number]["value"];
5498
+ /** The full attribute definition type */
5499
+ definition: StatusAttribute & {
5500
+ options: TOptions;
5501
+ };
5502
+ };
4996
5503
  constructor(name: TName, label: string);
4997
5504
  /**
4998
5505
  * Set all options at once (preserves literal types for values)
@@ -5011,6 +5518,18 @@ declare class SelectAttributeBuilder<TName extends string, TOptions extends read
5011
5518
  };
5012
5519
  required: TRequired;
5013
5520
  };
5521
+ /**
5522
+ * Drizzle-style static type inference property.
5523
+ * @see TextAttributeBuilder.$infer for documentation
5524
+ */
5525
+ readonly $infer: {
5526
+ /** The runtime value type for this attribute (union of option values) */
5527
+ value: TOptions[number]["value"];
5528
+ /** The full attribute definition type */
5529
+ definition: SelectAttribute & {
5530
+ options: TOptions;
5531
+ };
5532
+ };
5014
5533
  constructor(name: TName, label: string);
5015
5534
  /**
5016
5535
  * Set all options at once (preserves literal types for values)
@@ -5029,6 +5548,18 @@ declare class MultiselectAttributeBuilder<TName extends string, TOptions extends
5029
5548
  };
5030
5549
  required: TRequired;
5031
5550
  };
5551
+ /**
5552
+ * Drizzle-style static type inference property.
5553
+ * @see TextAttributeBuilder.$infer for documentation
5554
+ */
5555
+ readonly $infer: {
5556
+ /** The runtime value type for this attribute (array of option values) */
5557
+ value: TOptions[number]["value"][];
5558
+ /** The full attribute definition type */
5559
+ definition: MultiselectAttribute & {
5560
+ options: TOptions;
5561
+ };
5562
+ };
5032
5563
  constructor(name: TName, label: string);
5033
5564
  /**
5034
5565
  * Set all options at once (preserves literal types for values)
@@ -5045,6 +5576,16 @@ declare class LocationAttributeBuilder<TName extends string, TRequired extends b
5045
5576
  attribute: LocationAttribute;
5046
5577
  required: TRequired;
5047
5578
  };
5579
+ /**
5580
+ * Drizzle-style static type inference property.
5581
+ * @see TextAttributeBuilder.$infer for documentation
5582
+ */
5583
+ readonly $infer: {
5584
+ /** The runtime value type for this attribute */
5585
+ value: Location;
5586
+ /** The full attribute definition type */
5587
+ definition: LocationAttribute;
5588
+ };
5048
5589
  constructor(name: TName, label: string);
5049
5590
  granularity(value: LocationAttribute["granularity"]): this;
5050
5591
  enableAutocomplete(): this;
@@ -5062,6 +5603,16 @@ declare class FileAttributeBuilder<TName extends string, TRequired extends boole
5062
5603
  attribute: FileAttribute;
5063
5604
  required: TRequired;
5064
5605
  };
5606
+ /**
5607
+ * Drizzle-style static type inference property.
5608
+ * @see TextAttributeBuilder.$infer for documentation
5609
+ */
5610
+ readonly $infer: {
5611
+ /** The runtime value type for this attribute (file ID) */
5612
+ value: string;
5613
+ /** The full attribute definition type */
5614
+ definition: FileAttribute;
5615
+ };
5065
5616
  constructor(name: TName, label: string);
5066
5617
  maxFiles(value: number): this;
5067
5618
  maxSize(bytes: number): this;
@@ -5080,6 +5631,16 @@ declare class UserAttributeBuilder<TName extends string, TRequired extends boole
5080
5631
  attribute: UserAttribute;
5081
5632
  required: TRequired;
5082
5633
  };
5634
+ /**
5635
+ * Drizzle-style static type inference property.
5636
+ * @see TextAttributeBuilder.$infer for documentation
5637
+ */
5638
+ readonly $infer: {
5639
+ /** The runtime value type for this attribute (user ID) */
5640
+ value: string;
5641
+ /** The full attribute definition type */
5642
+ definition: UserAttribute;
5643
+ };
5083
5644
  constructor(name: TName, label: string);
5084
5645
  allowedRoles(roles: string[]): this;
5085
5646
  /**
@@ -5157,6 +5718,16 @@ declare class SingleRelationAttributeBuilder<TName extends string, TRequired ext
5157
5718
  attribute: SingleRelationAttribute;
5158
5719
  required: TRequired;
5159
5720
  };
5721
+ /**
5722
+ * Drizzle-style static type inference property.
5723
+ * @see TextAttributeBuilder.$infer for documentation
5724
+ */
5725
+ readonly $infer: {
5726
+ /** The runtime value type for this attribute (record ID) */
5727
+ value: string;
5728
+ /** The full attribute definition type */
5729
+ definition: SingleRelationAttribute;
5730
+ };
5160
5731
  constructor(name: TName, label: string);
5161
5732
  /**
5162
5733
  * Convert to a multi-relation (cardinality: "many")
@@ -5174,6 +5745,16 @@ declare class MultiRelationAttributeBuilder<TName extends string, TRequired exte
5174
5745
  attribute: MultiRelationAttribute;
5175
5746
  required: TRequired;
5176
5747
  };
5748
+ /**
5749
+ * Drizzle-style static type inference property.
5750
+ * @see TextAttributeBuilder.$infer for documentation
5751
+ */
5752
+ readonly $infer: {
5753
+ /** The runtime value type for this attribute (array of record IDs) */
5754
+ value: string[];
5755
+ /** The full attribute definition type */
5756
+ definition: MultiRelationAttribute;
5757
+ };
5177
5758
  constructor(name: TName, label: string, initOptions?: RelationBuilderInitOptions);
5178
5759
  /**
5179
5760
  * Set minimum number of relations required
@@ -5221,6 +5802,16 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
5221
5802
  attribute: RatingAttribute;
5222
5803
  required: TRequired;
5223
5804
  };
5805
+ /**
5806
+ * Drizzle-style static type inference property.
5807
+ * @see TextAttributeBuilder.$infer for documentation
5808
+ */
5809
+ readonly $infer: {
5810
+ /** The runtime value type for this attribute */
5811
+ value: number;
5812
+ /** The full attribute definition type */
5813
+ definition: RatingAttribute;
5814
+ };
5224
5815
  constructor(name: TName, label: string);
5225
5816
  max(value: number): this;
5226
5817
  iconType(value: RatingAttribute["iconType"]): this;
@@ -5239,6 +5830,16 @@ declare class FormulaAttributeBuilder<TName extends string> extends BaseAttribut
5239
5830
  attribute: FormulaAttribute;
5240
5831
  required: false;
5241
5832
  };
5833
+ /**
5834
+ * Drizzle-style static type inference property.
5835
+ * @see TextAttributeBuilder.$infer for documentation
5836
+ */
5837
+ readonly $infer: {
5838
+ /** The runtime value type for this attribute (computed, type depends on returnType) */
5839
+ value: unknown;
5840
+ /** The full attribute definition type */
5841
+ definition: FormulaAttribute;
5842
+ };
5242
5843
  constructor(name: TName, label: string);
5243
5844
  /**
5244
5845
  * Set the formula expression
@@ -5287,6 +5888,16 @@ declare class RollupAttributeBuilder<TName extends string> extends BaseAttribute
5287
5888
  attribute: RollupAttribute;
5288
5889
  required: false;
5289
5890
  };
5891
+ /**
5892
+ * Drizzle-style static type inference property.
5893
+ * @see TextAttributeBuilder.$infer for documentation
5894
+ */
5895
+ readonly $infer: {
5896
+ /** The runtime value type for this attribute (aggregated, type depends on function) */
5897
+ value: unknown;
5898
+ /** The full attribute definition type */
5899
+ definition: RollupAttribute;
5900
+ };
5290
5901
  constructor(name: TName, label: string);
5291
5902
  /**
5292
5903
  * Set the relation attribute to aggregate from
@@ -5389,6 +6000,16 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
5389
6000
  attribute: DocumentAttribute;
5390
6001
  required: TRequired;
5391
6002
  };
6003
+ /**
6004
+ * Drizzle-style static type inference property.
6005
+ * @see TextAttributeBuilder.$infer for documentation
6006
+ */
6007
+ readonly $infer: {
6008
+ /** The runtime value type for this attribute (document ID or array of IDs) */
6009
+ value: string | string[];
6010
+ /** The full attribute definition type */
6011
+ definition: DocumentAttribute;
6012
+ };
5392
6013
  constructor(name: TName, label: string);
5393
6014
  /**
5394
6015
  * Allow multiple documents.
@@ -5545,12 +6166,18 @@ type WithRequiredAttr<TRecord extends Record<string, unknown>, TName extends str
5545
6166
  type WithOptionalAttr<TRecord extends Record<string, unknown>, TName extends string, TValue> = Flatten<Omit<TRecord, TName> & {
5546
6167
  [K in TName]?: TValue;
5547
6168
  }>;
6169
+ /**
6170
+ * Add support for custom attributes (added via UI) to a record type
6171
+ */
6172
+ type WithCustomAttributes<T> = T & {
6173
+ [key: string]: CustomAttributeValue;
6174
+ };
5548
6175
  /**
5549
6176
  * Add an attribute to the accumulated record type
5550
6177
  */
5551
6178
  type AddAttribute<TRecord extends Record<string, unknown>, TName extends string, TAttr extends Attribute, TRequired extends boolean> = TRequired extends true ? WithRequiredAttr<TRecord, TName, InferAttributeValue<TAttr>> : WithOptionalAttr<TRecord, TName, InferAttributeValue<TAttr>>;
5552
6179
  /**
5553
- * Fluent builder for creating ObjectDefinition with full type inference
6180
+ * Fluent builder for creating ObjectDefinition with full type inference.
5554
6181
  *
5555
6182
  * The generic parameter TRecord accumulates attribute types as you chain
5556
6183
  * .attribute() calls, enabling full autocompletion on the inferred record type.
@@ -5558,6 +6185,9 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5558
6185
  * IMPORTANT: Every object MUST define a `labelExpression` to specify how records
5559
6186
  * are displayed. Use `.labelExpression("{{ name }}")` to define the display template.
5560
6187
  *
6188
+ * Implements Standard Schema v1 interface via the `~standard` property.
6189
+ * @see https://standardschema.dev/
6190
+ *
5561
6191
  * @example
5562
6192
  * ```typescript
5563
6193
  * import { object, text, number, status } from "@stndrds/schema";
@@ -5565,7 +6195,7 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5565
6195
  *
5566
6196
  * const PRODUCT = object({ name: "products", label: "Product" })
5567
6197
  * .system()
5568
- * .attribute(text({ name: "name", label: "Name" }).required()) // This becomes the title
6198
+ * .attribute(text({ name: "name", label: "Name" }).required())
5569
6199
  * .attribute(number({ name: "price", label: "Price" }).decimal(2))
5570
6200
  * .attribute(
5571
6201
  * status({ name: "status", label: "Status" })
@@ -5579,9 +6209,12 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5579
6209
  * // Full autocompletion! ✨
5580
6210
  * type ProductRecord = ExtractRecord<typeof PRODUCT>;
5581
6211
  * // → { name: string; price?: number; status: string }
6212
+ *
6213
+ * // Standard Schema integration
6214
+ * const result = PRODUCT["~standard"].validate({ name: "Test", status: "active" });
5582
6215
  * ```
5583
6216
  */
5584
- declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
6217
+ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> implements StandardSchemaV1<unknown, Record<string, unknown>> {
5585
6218
  private obj;
5586
6219
  private _labelExpression?;
5587
6220
  private _pluralLabel?;
@@ -5597,6 +6230,41 @@ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
5597
6230
  [K in keyof TRecord]?: TRecord[K];
5598
6231
  };
5599
6232
  };
6233
+ /**
6234
+ * Drizzle-style static type inference property.
6235
+ * Provides direct access to inferred types without utility type imports.
6236
+ *
6237
+ * @example
6238
+ * ```typescript
6239
+ * const PRODUCT = object({ name: "products", label: "Product" })
6240
+ * .attribute(text({ name: "name", label: "Name" }).required())
6241
+ * .attribute(number({ name: "price", label: "Price" }));
6242
+ *
6243
+ * // Zero-import type inference! ✨
6244
+ * type ProductRecord = typeof PRODUCT.$infer.record;
6245
+ * type ProductCreate = typeof PRODUCT.$infer.create;
6246
+ * type ProductUpdate = typeof PRODUCT.$infer.update;
6247
+ * ```
6248
+ */
6249
+ readonly $infer: {
6250
+ /** Full record type with custom attributes and metadata (same as ExtractRecord) */
6251
+ record: WithCustomAttributes<TRecord> & RecordMetadata;
6252
+ /** Input type for creating records, omits system fields (same as ExtractRecordInput) */
6253
+ create: Omit<WithCustomAttributes<TRecord>, SystemFields>;
6254
+ /** Partial type for updating records, omits system fields (same as ExtractRecordUpdate) */
6255
+ update: Omit<WithCustomAttributes<{
6256
+ [K in keyof TRecord]?: TRecord[K];
6257
+ }>, SystemFields>;
6258
+ };
6259
+ /**
6260
+ * Standard Schema v1 interface implementation.
6261
+ *
6262
+ * This property enables interoperability with libraries that support
6263
+ * Standard Schema (React Hook Form, tRPC, etc.).
6264
+ *
6265
+ * @see https://standardschema.dev/
6266
+ */
6267
+ get "~standard"(): StandardSchemaV1.Props<unknown, Record<string, unknown>>;
5600
6268
  constructor(config: BuilderConfig);
5601
6269
  /**
5602
6270
  * Set object description
@@ -6216,6 +6884,28 @@ declare class TabBuilder {
6216
6884
  declare class DetailViewBuilder {
6217
6885
  private data;
6218
6886
  private _version;
6887
+ /**
6888
+ * Drizzle-style static type inference property.
6889
+ * Provides direct access to inferred types without utility type imports.
6890
+ *
6891
+ * @example
6892
+ * ```typescript
6893
+ * const COMPANY_VIEW = detailView("detail", "Company Detail")
6894
+ * .for("companies")
6895
+ * .tab("general", "Info").form(group("main", "Main").fields("name"))
6896
+ * .build();
6897
+ *
6898
+ * // Zero-import type inference! ✨
6899
+ * type ViewConfig = typeof COMPANY_VIEW.$infer.config;
6900
+ * type ViewDef = typeof COMPANY_VIEW.$infer.definition;
6901
+ * ```
6902
+ */
6903
+ readonly $infer: {
6904
+ /** The view configuration type */
6905
+ config: DetailViewConfig;
6906
+ /** The full view definition type */
6907
+ definition: DetailViewDefinition;
6908
+ };
6219
6909
  constructor(name: string, label: string);
6220
6910
  /**
6221
6911
  * Set view description
@@ -6377,6 +7067,28 @@ interface ListViewTabData {
6377
7067
  declare class ListViewBuilder {
6378
7068
  private data;
6379
7069
  private _version;
7070
+ /**
7071
+ * Drizzle-style static type inference property.
7072
+ * Provides direct access to inferred types without utility type imports.
7073
+ *
7074
+ * @example
7075
+ * ```typescript
7076
+ * const CONTACTS_LIST = listView("default", "All Contacts")
7077
+ * .for("contacts")
7078
+ * .tab("all", "All").columns("name", "email").default()
7079
+ * .build();
7080
+ *
7081
+ * // Zero-import type inference! ✨
7082
+ * type ViewConfig = typeof CONTACTS_LIST.$infer.config;
7083
+ * type ViewDef = typeof CONTACTS_LIST.$infer.definition;
7084
+ * ```
7085
+ */
7086
+ readonly $infer: {
7087
+ /** The view configuration type */
7088
+ config: ListViewConfig;
7089
+ /** The full view definition type */
7090
+ definition: ListViewDefinition;
7091
+ };
6380
7092
  constructor(name: string, label: string);
6381
7093
  /**
6382
7094
  * Set view description
@@ -6953,6 +7665,29 @@ declare class WorkflowBuilder {
6953
7665
  private data;
6954
7666
  private startNodeId;
6955
7667
  private nodeCount;
7668
+ /**
7669
+ * Drizzle-style static type inference property.
7670
+ * Provides direct access to inferred types without utility type imports.
7671
+ *
7672
+ * @example
7673
+ * ```typescript
7674
+ * const ONBOARDING = workflow("client-onboarding", "Onboarding")
7675
+ * .slot("client", "contacts", { label: "Client", mode: "create" })
7676
+ * .start("entry").next("form")
7677
+ * // ... nodes
7678
+ * .build();
7679
+ *
7680
+ * // Zero-import type inference! ✨
7681
+ * type Slots = typeof ONBOARDING.$infer.slots;
7682
+ * type WorkflowDef = typeof ONBOARDING.$infer.definition;
7683
+ * ```
7684
+ */
7685
+ readonly $infer: {
7686
+ /** The workflow slots type */
7687
+ slots: WorkflowSlot[];
7688
+ /** The full workflow definition type */
7689
+ definition: WorkflowDefinition;
7690
+ };
6956
7691
  constructor(name: string, label: string);
6957
7692
  /**
6958
7693
  * Set workflow description
@@ -7052,6 +7787,47 @@ declare class WorkflowBuilder {
7052
7787
  */
7053
7788
  declare function workflow(name: string, label: string): WorkflowBuilder;
7054
7789
 
7790
+ /**
7791
+ * Standard Schema v1 integration for @stndrds/schema
7792
+ *
7793
+ * Standard Schema is a TypeScript interface designed by the Zod/Valibot/ArkType
7794
+ * creators to enable interoperability between validation libraries.
7795
+ *
7796
+ * @see https://standardschema.dev/
7797
+ */
7798
+
7799
+ /**
7800
+ * Standard Schema vendor identifier
7801
+ */
7802
+ declare const STANDARD_SCHEMA_VENDOR = "@stndrds/schema";
7803
+
7804
+ /**
7805
+ * Standard Schema issue type
7806
+ */
7807
+ type StandardSchemaIssue = StandardSchemaV1.Issue;
7808
+ /**
7809
+ * Standard Schema result type
7810
+ */
7811
+ type StandardSchemaResult<T> = StandardSchemaV1.Result<T>;
7812
+ /**
7813
+ * Standard Schema props type (the ~standard property value)
7814
+ */
7815
+ type StandardSchemaProps<Input, Output> = StandardSchemaV1.Props<Input, Output>;
7816
+ /**
7817
+ * Create Standard Schema ~standard props from a Zod schema.
7818
+ *
7819
+ * Since Zod v4 already implements Standard Schema natively, we delegate
7820
+ * validation to Zod and wrap the result with our vendor identifier.
7821
+ *
7822
+ * @param zodSchema - The Zod schema to wrap
7823
+ * @returns Standard Schema v1 props
7824
+ */
7825
+ declare function createStandardSchemaProps<T>(zodSchema: z$1.ZodType<T>): StandardSchemaV1.Props<unknown, T>;
7826
+ /**
7827
+ * Type guard to check if an object implements Standard Schema v1
7828
+ */
7829
+ declare function isStandardSchema<T>(obj: unknown): obj is StandardSchemaV1<unknown, T>;
7830
+
7055
7831
  /**
7056
7832
  * Flag Builder Module
7057
7833
  *
@@ -7851,4 +8627,48 @@ declare function resetViewToDefault(currentView: ViewDefinition, object: ObjectD
7851
8627
  */
7852
8628
  declare function isViewCustomized(view: ViewDefinition, object: ObjectDefinition): boolean;
7853
8629
 
7854
- export { type AIAvailableModel, type AIBatchQuestion, type AIBatchQuestionAnswer, type AIBatchQuestionOption, type AIChatMessage, type AIChatMessagePart, type AIChatMessagePartType, type AICompactionSummary, type AIConversation, type AIMemoryEntry, type AIMemoryType, type AIMessage, type AIMessageAttachment, type AIMessageRole, AINodeSchema, type AIProviderMetrics, type AIQuestion, type AIQuestionAnswer, type AIQuestionOption, type AIQuestionType, type AIThinkingLevel, type AITodoItem, type AITodoList, type AITodoStatus, type AIToolCall, type AIToolCallRecord, type AIToolCallStatus, type AIUsageMetrics, ALL_ACTIONS, ALL_SYSTEM_RESOURCES, type AccessLevel, type Action, ActivityTabConfig, type AddAttribute$1 as AddAttribute, type AgentContentPart, type AgentDashboard, type AgentDefinition, type AgentEvent, type AgentExecutionConfig, type AgentInlineConfig, type AgentMessage, type AgentRun, type AgentRunContextEntry, type AgentRunStatus, type AgentSchedule, type AgentTrigger, type AgentTriggerType, type AnyAttributeBuilder, AssignNodeSchema, type AssignRoleInput, AssignmentMappingSchema, AssignmentSourceSchema, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, AttributeType, type AttributeUsage, type AuditAction, type AuditActorType, type AuditChange, type AuditListOptions, type AuditLogEntry, type AuditResourceType, type AuditServiceOptions, AuthMethodSchema, BEHAVIOR_PROPERTIES, type BehaviorProperty, BilateralConfig, type BilateralValidationError, type BilateralValidationResult, type BoundingBox, type BuilderConfig, type ChatFileAttachment, CheckboxAttribute, CompletionStatus, ConcurrentModificationError, ConditionGroup, ConditionGroupSchema, ConditionNodeSchema, ConditionOperatorSchema, ConditionRule, ConditionRuleSchema, ConfigOverrides, type CreateAIMessageInput, type CreateAuditLogInput, type CreateDBAttribute, type CreateDBObject, type CreateDBView, type CreateDBViewOverlay, type CreateDBWorkflow, type CreateDBWorkflowAccessGrant, type CreateDBWorkflowInstance, type CreateDBWorkflowInvitation, type CreateDocument, type CreateDocumentSlot, type CreateFile, type CreateGrantInput, type CreateInvitationInput, type CreateInvitationResult, CreateMode, type CreateObjectRecord, type CreatePermissionInput, type CreateProcessingJob, type CreateRoleInput, type CreateSandboxExecution, CreateShareInputSchema, type CreateSignatureInput, type CreateUserProfile, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, type DBAttribute, type DBObject, type DBView, type DBViewOverlay, type DBWorkflow, type DBWorkflowAccessGrant, type DBWorkflowInstance, type DBWorkflowInvitation, DEFAULT_LABEL_FALLBACK, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_FOR_NEW_USERS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DetailViewBuilder, DetailViewDefinition, DetailViewLayout, type Document, DocumentAttribute, type DocumentData, type DocumentListOptions, type DocumentSlot, type DocumentStatus, DocumentsTabConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type EffectivePermissions, EndNodeSchema, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractObjectRecord, type ExtractObjectRecordWithCustom, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, FeatureFlagDefinition, FeatureFlagsRepository, FeatureGate, Field, FieldGroup, type File, FileAttribute, type FileListOptions, FileNotFoundError, type FileVisibility, FilterState, FlagLevel, FlagRegistry, type FlagResolutionContext, FlagService, type FlagServiceOptions, FlagValueType, FlowFieldsRow, FlowHeadingRow, FlowRelationListRow, FlowRowFieldSchema, FlowRowSchema, FlowSeparatorRow, FlowTextRow, FlowsTabConfig, ForbiddenError, type FormContextResponse, type FormFieldContext, FormFieldRefSchema, type FormFieldRow, type FormFieldsRow, FormNode, type FormNodeInfo, FormNodeSchema, FormulaAttribute, FormulaReturnType, type GenerateFallbackViewOptions, type GeocodingAdapter, type GeocodingAutocompleteParams, type GeocodingParams, type GeocodingSuggestion, type GlobalSearchGroupedOptions, type GlobalSearchGroupedResult, type GlobalSearchOptions, type GlobalSearchResultItem, Group, GroupBuilder, type GroupedWorkflowNodes, IDENTITY_PROPERTIES, type IdentityProperty, type IdentityVerificationAdapter, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, InstanceStatus, type InvitationStatus, type InviteUserInput, type ListOptions, ListViewBuilder, ListViewConfig, ListViewDefinition, ListViewTab, ListViewTabConfigBuilder, Location, LocationAttribute, LocationGranularity, type MentionEntityType, type MentionReference, type MentionedContext, type MentionedEntityContext, MigrationDefinition, type ModelDefinition, MultiRelationAttribute, MultiselectAttribute, NodePositionSchema, type NodeTypeDefinition, NoopGeocodingAdapter, NotFoundError, NotSystemObjectError, NumberAttribute, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, type ObjectPermissions, ObjectRecord, ObjectReferencedError, type OcrAdapter, type OcrInput, type OcrOptions, type OcrPage, type OcrResult, type OcrTextBlock, type OperationResult, Option, PRESENTATION_PROPERTIES, PendingAction, type Permission, type PermissionScope, Phone, PhoneAttribute, type PhoneNormalizationResult, type PolicyContext, PolicyViolationError, type PresentationProperty, type ProcessingJob, type ProcessingJobStatus, type ProcessingJobType, type PropertyAttributeBuilder, ProtectedResourceError, ProtectedRoleError, type ProviderName, RatingAttribute, type ReadOnlyReason, type ReasoningPartData, type RecordMetadata, RecordNotFoundError, type RecordPolicy, type RecordReference, RecordReferencedError, RelationAttribute, RelationBufferMap, RelationFieldConfig, RelationGroup, RelationGroupBuilder, RelationTarget, type ResetViewOptions, ResolvedFlag, type ResumeWorkflowApiInput, type RetryPolicy, type ReverseGeocodingParams, RichtextAttribute, RichtextFeature, RichtextTabConfig, type Role, RoleNotFoundError, RollupAttribute, RollupFunction, SYSTEM_ATTRIBUTES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, type SandboxExecution, type SandboxExecutionInput, type SandboxExecutionResult, type SandboxExecutionStatus, type SandboxMode, type SandboxTrigger, SchemaError, SchemaErrorCode, type SearchOptions, SelectAttribute, ShareStatusSchema, SidePanelConfig, type SignatureAdapter, type SignaturePosition, type SignatureRequestResult, type SignatureStatus, type SignatureStatusResult, type SignerRequest, type SignerStatus, SingleRelationAttribute, SlotMode, SlotModeSchema, type SlotStatus, SortRule, StartNodeSchema, type StartWorkflowApiInput, StaticFlagDefault, StatusAttribute, type StorageProvider, SyncError, type SystemAttribute, type SystemAttributeName, type SystemFields, type SystemPermissions, type SystemResource, Tab, TabBuilder, TableTab, TableTabConfig, TenantId, TextAreaAttribute, TextAttribute, type TextPartData, ThemeColorsSchema, ThemeLogoSchema, type ThinkingPartData, Timestamps, type ToolPartData, type TypedAttribute, type TypedBuilderConfig, type TypedObjectRecord, USER_STATUSES, type UpdateDBAttribute, type UpdateDBObject, type UpdateDBView, type UpdateDBViewOverlay, type UpdateDBWorkflow, type UpdateDBWorkflowAccessGrant, type UpdateDBWorkflowInstance, type UpdateDBWorkflowInvitation, type UpdateDocument, type UpdateDocumentSlot, type UpdateFile, type UpdateProcessingJob, type UpdateRoleInput, type UpdateUserProfile, type UpsertDBAttribute, type UpsertDBObject, type UpsertDBView, UserAttribute, type UserProfile, UserProfileNotFoundError, type UserRoleAssignment, type UserStatus, Uuid, type ValidatedConditionGroup, type ValidatedWorkflowDefinition, type ValidatedWorkflowNode, ValidationError, type ValidationErrorDetail, type VerificationCheck, type VerificationResult, type VerifyInput, ViewBuilder, ViewConfig, ViewDefinition, ViewType, ViewportSchema, type WithCustomAttributes, WorkflowAIBuilder, type WorkflowAccessGrant, type WorkflowAccessMode, WorkflowAssignBuilder, WorkflowBuilder, WorkflowConditionBuilder, WorkflowConfig, WorkflowConfigSchema, WorkflowDefinition, WorkflowDefinitionSchema, WorkflowEndBuilder, type WorkflowEvent, type WorkflowEventType, WorkflowExecutionContext, WorkflowFormBuilder, WorkflowFormRowBuilder, type WorkflowGrantRevokedEvent, type WorkflowInstanceCancelledEvent, type WorkflowInstanceCompletedEvent, type WorkflowInstanceFailedEvent, type WorkflowInstanceStartedEvent, type WorkflowInvitation, type WorkflowInvitationAcceptedEvent, type WorkflowInvitationCreatedEvent, type WorkflowInvitationExpiredEvent, WorkflowLayout, WorkflowLayoutSchema, WorkflowNode, type WorkflowNodeCompletedEvent, type WorkflowNodeEnteredEvent, type WorkflowNodeFailedEvent, WorkflowNodeSchema, WorkflowNodeType, WorkflowShareSchema, WorkflowSimpleFormBuilder, WorkflowSlot, WorkflowSlotSchema, WorkflowStartBuilder, WorkflowStatus, WorkflowStatusSchema, WorkflowTheme, WorkflowThemeSchema, WorkflowTransition, type WorkflowZone, ZONE_CONFIG, ZONE_ORDER, accessLevelToActions, actionsToAccessLevel, applyRelationProps, assignNodeZones, booleanFlag, canAccessNode, checkbox, createFlagRegistry, createFlagService, currency, date, detailView, document, extractAttributeNames, file, flagRegistry, formatAttributeValue, formatPhoneForDisplay, formula, generateDefaultDetailView, generateDefaultListView, generateFallbackView, getActiveTab, getErrorMessage, getFormFieldRefs, getNodeOutputs, getNodeSlotIds, getSystemAttributeList, getZoneAllowedTypes, group, groupNodesByZone, hasProperties, isBehaviorProperty, isDefaultRole, isEmpty, isForbiddenError, isFormFieldsRow, isGrantExpired, isGrantRevoked, isGrantValid, isIdentityProperty, isInstanceEvent, isInvitationAccepted, isInvitationExpired, isInvitationOrGrantEvent, isInvitationValid, isLabelExpression, isNodeEvent, isNotEmpty, isNotFoundError, isPresentationProperty, isProtectedResourceError, isSchemaError, isSystemAttribute, isSystemAttributeObject, isTokenRevoked, isValidationError, isViewCustomized, jsonFlag, listView, location, multiselect, nodeTypeRegistry, normalizePhoneNumber, number, numberFlag, object, parseRawPhoneInput, phone, rating, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, richtext, rollup, select, setNodeNext, status, stringFlag, text, textarea, toUndefinedIfEmpty, user, validateNode, validatePhoneNumber, view, viewRegistry, workflow };
8630
+ /**
8631
+ * Convert an ObjectDefinition to JSON Schema.
8632
+ *
8633
+ * This enables runtime form generation from schema definitions.
8634
+ * The generated JSON Schema is compatible with libraries like:
8635
+ * - react-jsonschema-form
8636
+ * - ajv
8637
+ * - json-schema-form
8638
+ *
8639
+ * @param objectDef - The ObjectDefinition to convert
8640
+ * @returns A JSON Schema object representing the ObjectDefinition
8641
+ *
8642
+ * @example
8643
+ * ```typescript
8644
+ * const PRODUCT = object({ name: "products", label: "Product" })
8645
+ * .labelExpression("{{ name }}")
8646
+ * .attribute(text({ name: "name", label: "Name" }).required())
8647
+ * .attribute(number({ name: "price", label: "Price" }).min(0))
8648
+ * .build();
8649
+ *
8650
+ * const jsonSchema = objectToJSONSchema(PRODUCT);
8651
+ * // => {
8652
+ * // type: "object",
8653
+ * // title: "Product",
8654
+ * // properties: {
8655
+ * // name: { type: "string", title: "Name" },
8656
+ * // price: { type: "number", title: "Price", minimum: 0 }
8657
+ * // },
8658
+ * // required: ["name"]
8659
+ * // }
8660
+ * ```
8661
+ */
8662
+ declare function objectToJSONSchema(objectDef: ObjectDefinition): JSONSchema7;
8663
+ /**
8664
+ * Convert an ObjectDefinition's Zod validator to JSON Schema using z.toJSONSchema().
8665
+ *
8666
+ * This is an alternative approach that uses Zod's native JSON Schema generation.
8667
+ * Use this when you need exact parity with Zod validation behavior.
8668
+ *
8669
+ * @param objectDef - The ObjectDefinition to convert
8670
+ * @returns A JSON Schema generated by Zod
8671
+ */
8672
+ declare function objectValidatorToJSONSchema(objectDef: ObjectDefinition): JSONSchema7;
8673
+
8674
+ export { type AIAvailableModel, type AIBatchQuestion, type AIBatchQuestionAnswer, type AIBatchQuestionOption, type AIChatMessage, type AIChatMessagePart, type AIChatMessagePartType, type AICompactionSummary, type AIConversation, type AIMemoryEntry, type AIMemoryType, type AIMessage, type AIMessageAttachment, type AIMessageRole, AINodeSchema, type AIProviderMetrics, type AIQuestion, type AIQuestionAnswer, type AIQuestionOption, type AIQuestionType, type AIThinkingLevel, type AITodoItem, type AITodoList, type AITodoStatus, type AIToolCall, type AIToolCallRecord, type AIToolCallStatus, type AIUsageMetrics, ALL_ACTIONS, ALL_PIPES, ALL_SYSTEM_RESOURCES, AccessDeniedError, type AccessLevel, type Action, ActivityTabConfig, type AddAttribute$1 as AddAttribute, type AgentConfig, type AgentContentPart, type AgentContextEntry, type AgentDashboard, type AgentDefinition, type AgentEvent, type AgentExecutionConfig, type AgentInlineConfig, type AgentMessage, type AgentQuestion, type AgentRun, type AgentRunContextEntry, type AgentRunStatus, type AgentSchedule, type AgentSession, type AgentSessionMessage, type AgentSessionMode, type AgentSessionStatus, type AgentToolCall, type AgentTrigger, type AgentTriggerDefinition, type AgentTriggerType, type AnyAttributeBuilder, type ApiKey, type ApiKeyAuthContext, type ApiKeyPermission, type ApiKeyWithSecret, AssignNodeSchema, type AssignRoleInput, AssignmentMappingSchema, AssignmentSourceSchema, Attribute, AttributeGroupField, AttributeInUseError, type AttributeMap, AttributeNotFoundError, type AttributeSchema, AttributeType, type AttributeUsage, type AuditAction, type AuditActorType, type AuditChange, type AuditListOptions, type AuditLogEntry, type AuditResourceType, type AuditServiceOptions, AuthMethodSchema, BEHAVIOR_PROPERTIES, type BehaviorProperty, BilateralConfig, type BilateralValidationError, type BilateralValidationResult, type BoundingBox, type BuilderConfig, type ChatFileAttachment, CheckboxAttribute, CompletionStatus, ConcurrentModificationError, ConditionGroup, ConditionGroupSchema, ConditionNodeSchema, ConditionOperatorSchema, ConditionRule, ConditionRuleSchema, ConfigOverrides, ConversationNotFoundError, type CreateAIMessageInput, type CreateApiKeyInput, type CreateAuditLogInput, type CreateDBAttribute, type CreateDBObject, type CreateDBView, type CreateDBViewOverlay, type CreateDBWorkflow, type CreateDBWorkflowAccessGrant, type CreateDBWorkflowInstance, type CreateDBWorkflowInvitation, type CreateDocument, type CreateDocumentSlot, type CreateFile, type CreateGrantInput, type CreateInvitationInput, type CreateInvitationResult, CreateMode, type CreateObjectRecord, type CreatePermissionInput, type CreateProcessingJob, type CreateRoleInput, type CreateSandboxExecution, CreateShareInputSchema, type CreateSignatureInput, type CreateUserProfile, type CriticConfig, Currency, CurrencyAttribute, type CustomAttributeValue, CustomTabConfig, type DBAttribute, type DBObject, type DBView, type DBViewOverlay, type DBWorkflow, type DBWorkflowAccessGrant, type DBWorkflowInstance, type DBWorkflowInvitation, DEFAULT_LABEL_FALLBACK, DEFAULT_ROLES, DEFAULT_ROLE_DESCRIPTIONS, DEFAULT_ROLE_FOR_NEW_USERS, DEFAULT_ROLE_LABELS, DEFAULT_ROLE_PERMISSIONS, DateAttribute, type DefaultRoleName, type DefaultRolePermissionConfig, DetailViewBuilder, DetailViewConfig, DetailViewDefinition, DetailViewLayout, type Document, DocumentAttribute, type DocumentData, type DocumentListOptions, type DocumentSlot, type DocumentStatus, DocumentsTabConfig, DuplicateError, EMPTY_VALUE_PLACEHOLDER, type EffectivePermissions, EndNodeSchema, type ExtractAttributeName, type ExtractAttributeRequired, type ExtractAttributes, type ExtractObjectRecord, type ExtractObjectRecordWithCustom, type ExtractRecord, type ExtractRecordInput, type ExtractRecordInputStrict, type ExtractRecordStrict, type ExtractRecordUpdate, type ExtractRecordUpdateStrict, FeatureFlagDefinition, FeatureFlagsRepository, FeatureGate, Field, FieldGroup, type File, FileAttribute, type FileListOptions, FileNotFoundError, type FileVisibility, FilterState, FlagLevel, FlagRegistry, type FlagResolutionContext, FlagService, type FlagServiceOptions, FlagValueType, FlowFieldsRow, FlowHeadingRow, FlowRelationListRow, FlowRowFieldSchema, FlowRowSchema, FlowSeparatorRow, FlowTextRow, FlowsTabConfig, ForbiddenError, type FormContextResponse, type FormFieldContext, FormFieldRefSchema, type FormFieldRow, type FormFieldsRow, FormNode, type FormNodeInfo, FormNodeSchema, FormulaAttribute, FormulaReturnType, type GenerateFallbackViewOptions, type GeocodingAdapter, type GeocodingAutocompleteParams, type GeocodingParams, type GeocodingSuggestion, type GlobalSearchGroupedOptions, type GlobalSearchGroupedResult, type GlobalSearchOptions, type GlobalSearchResultItem, Group, GroupBuilder, type GroupedWorkflowNodes, IDENTITY_PROPERTIES, type IdentityProperty, type IdentityVerificationAdapter, type InferAttributeValue, type InferRecord, type InferRecordFromSchema, type InferRecordInput, type InferRecordUpdate, type InferRecordWithRequirements, InstanceStatus, type InvitationStatus, type InviteUserInput, type LabelExpression, type LabelPipe, type ListOptions, ListViewBuilder, ListViewConfig, ListViewDefinition, ListViewTab, ListViewTabConfigBuilder, Location, LocationAttribute, LocationGranularity, MemoryNotFoundError, type MentionEntityType, type MentionReference, type MentionedContext, type MentionedEntityContext, MigrationDefinition, type ModelDefinition, MultiRelationAttribute, MultiselectAttribute, NodePositionSchema, type NodeTypeDefinition, NoopGeocodingAdapter, NotFoundError, NotImplementedError, NotSystemObjectError, NumberAttribute, ObjectBuilder, ObjectDefinition, ObjectNotFoundError, type ObjectPermissions, ObjectRecord, ObjectReferencedError, type OcrAdapter, type OcrInput, type OcrOptions, type OcrPage, type OcrResult, type OcrTextBlock, type OperationResult, Option, PIPES_WITH_ARGS, PRESENTATION_PROPERTIES, PendingAction, type Permission, type PermissionScope, Phone, PhoneAttribute, type PhoneNormalizationResult, type PipeWithArgs, type PolicyContext, PolicyViolationError, type PresentationProperty, type ProcessingJob, type ProcessingJobStatus, type ProcessingJobType, type PropertyAttributeBuilder, ProtectedResourceError, ProtectedRoleError, type ProviderName, type QuestionResponse, type QuestionStatus, RatingAttribute, type ReadOnlyReason, type ReasoningPartData, type RecordMetadata, RecordNotFoundError, type RecordPolicy, type RecordReference, RecordReferencedError, RelationAttribute, RelationBufferMap, RelationFieldConfig, RelationGroup, RelationGroupBuilder, RelationTarget, RepositoryError, type RepositoryOperation, type ResetViewOptions, ResolvedFlag, type ResumeWorkflowApiInput, type RetryPolicy, type ReverseGeocodingParams, RichtextAttribute, RichtextFeature, RichtextTabConfig, type Role, RoleNotFoundError, RollupAttribute, RollupFunction, SIMPLE_PIPES, STANDARD_SCHEMA_VENDOR, SYSTEM_ATTRIBUTES, SYSTEM_RESOURCES, SYSTEM_RESOURCE_LABELS, type SandboxExecution, type SandboxExecutionInput, type SandboxExecutionResult, type SandboxExecutionStatus, type SandboxMode, type SandboxTrigger, SchemaError, SchemaErrorCode, type SearchOptions, SelectAttribute, ShareStatusSchema, SidePanelConfig, type SignatureAdapter, type SignaturePosition, type SignatureRequestResult, type SignatureStatus, type SignatureStatusResult, type SignerRequest, type SignerStatus, type SimplePipe, SingleRelationAttribute, SlotMode, SlotModeSchema, type SlotStatus, SortRule, type StandardSchemaIssue, type StandardSchemaProps, type StandardSchemaResult, StartNodeSchema, type StartWorkflowApiInput, StaticFlagDefault, StatusAttribute, StorageError, type StorageOperation, type StorageProvider, SyncError, type SystemAttribute, type SystemAttributeName, type SystemFields, type SystemPermissions, type SystemResource, Tab, TabBuilder, TableTab, TableTabConfig, TenantId, TextAreaAttribute, TextAttribute, type TextPartData, ThemeColorsSchema, ThemeLogoSchema, type ThinkingPartData, type TimeoutPolicy, Timestamps, type ToolPartData, type TriggerEventType, type TypedAttribute, type TypedBuilderConfig, type TypedObjectRecord, USER_STATUSES, type UpdateDBAttribute, type UpdateDBObject, type UpdateDBView, type UpdateDBViewOverlay, type UpdateDBWorkflow, type UpdateDBWorkflowAccessGrant, type UpdateDBWorkflowInstance, type UpdateDBWorkflowInvitation, type UpdateDocument, type UpdateDocumentSlot, type UpdateFile, type UpdateProcessingJob, type UpdateRoleInput, type UpdateUserProfile, type UpsertDBAttribute, type UpsertDBObject, type UpsertDBView, UserAttribute, type UserProfile, UserProfileNotFoundError, type UserRoleAssignment, type UserStatus, Uuid, type ValidatedConditionGroup, type ValidatedWorkflowDefinition, type ValidatedWorkflowNode, ValidationError, type ValidationErrorDetail, type VerificationCheck, type VerificationResult, type VerifyInput, ViewBuilder, ViewConfig, ViewDefinition, ViewType, ViewportSchema, type WithCustomAttributes$1 as WithCustomAttributes, WorkflowAIBuilder, type WorkflowAccessGrant, type WorkflowAccessMode, WorkflowAssignBuilder, WorkflowBuilder, WorkflowConditionBuilder, WorkflowConfig, WorkflowConfigSchema, WorkflowDefinition, WorkflowDefinitionSchema, WorkflowEndBuilder, type WorkflowEvent, type WorkflowEventType, WorkflowExecutionContext, WorkflowFormBuilder, WorkflowFormRowBuilder, type WorkflowGrantRevokedEvent, type WorkflowInstanceCancelledEvent, type WorkflowInstanceCompletedEvent, type WorkflowInstanceFailedEvent, type WorkflowInstanceStartedEvent, type WorkflowInvitation, type WorkflowInvitationAcceptedEvent, type WorkflowInvitationCreatedEvent, type WorkflowInvitationExpiredEvent, WorkflowLayout, WorkflowLayoutSchema, WorkflowNode, type WorkflowNodeCompletedEvent, type WorkflowNodeEnteredEvent, type WorkflowNodeFailedEvent, WorkflowNodeSchema, WorkflowNodeType, WorkflowShareSchema, WorkflowSimpleFormBuilder, WorkflowSlot, WorkflowSlotSchema, WorkflowStartBuilder, WorkflowStatus, WorkflowStatusSchema, WorkflowTheme, WorkflowThemeSchema, WorkflowTransition, type WorkflowZone, ZONE_CONFIG, ZONE_ORDER, accessLevelToActions, actionsToAccessLevel, applyRelationProps, assignNodeZones, booleanFlag, canAccessNode, checkbox, createFlagRegistry, createFlagService, createStandardSchemaProps, currency, date, detailView, document, extractAttributeNames, file, flagRegistry, formatAttributeValue, formatPhoneForDisplay, formula, generateDefaultDetailView, generateDefaultListView, generateFallbackView, getActiveTab, getErrorMessage, getFormFieldRefs, getNodeOutputs, getNodeSlotIds, getSystemAttributeList, getZoneAllowedTypes, group, groupNodesByZone, hasProperties, isAccessDeniedError, isBehaviorProperty, isDefaultRole, isEmpty, isForbiddenError, isFormFieldsRow, isGrantExpired, isGrantRevoked, isGrantValid, isIdentityProperty, isInstanceEvent, isInvitationAccepted, isInvitationExpired, isInvitationOrGrantEvent, isInvitationValid, isLabelExpression, isNodeEvent, isNotEmpty, isNotFoundError, isNotImplementedError, isPresentationProperty, isProtectedResourceError, isRepositoryError, isSchemaError, isStandardSchema, isStorageError, isSystemAttribute, isSystemAttributeObject, isTokenRevoked, isValidationError, isViewCustomized, jsonFlag, labelExpressionSchema, listView, location, multiselect, nodeTypeRegistry, normalizePhoneNumber, number, numberFlag, object, objectToJSONSchema, objectValidatorToJSONSchema, parseRawPhoneInput, phone, rating, registerBuiltInNodeTypes, registry, relation, relationGroup, renderLabelExpression, resetViewToDefault, richtext, rollup, select, setNodeNext, status, stringFlag, text, textarea, toUndefinedIfEmpty, user, validateLabelExpression, validateNode, validatePhoneNumber, view, viewRegistry, workflow };