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

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-C-bhC0k5.d.ts +673 -0
  2. package/dist/attributes-DB76JqXm.d.mts +673 -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-5XMwJOlV.d.ts → index-Bt-0XNSh.d.ts} +14 -1499
  46. package/dist/{validators-BCw4Sn01.d.mts → index-C9tOwUbK.d.mts} +14 -1499
  47. package/dist/index.d.mts +1267 -976
  48. package/dist/index.d.ts +1267 -976
  49. package/dist/index.js +1293 -1001
  50. package/dist/index.mjs +529 -785
  51. package/dist/types-B7nS2D1A.d.ts +39 -0
  52. package/dist/types-CjXbGsy8.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.ts 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-5XMwJOlV.js';
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-5XMwJOlV.js';
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-Bt-0XNSh.js';
2
+ export { a7 as ActivityTab, a8 as AdvancedFilterState, a9 as BufferedRecord, aa as BuiltInTransform, ab as CalendarViewConfig, ac as CalendarViewDefinition, ad as CanvasViewport, ae as CheckboxFilterOperator, af as ConditionNode, ag as ConditionOperator, ah as CurrencyFilterValue, ai as CustomTab, aj as DEFAULT_RETENTION_POLICY, ak as DEFAULT_THEME, al as DateFilterOperator, am as DisplayRecord, an as DocumentsTab, ao as EndNode, ap as ExtendedFilterRule, aq as FilterCombinator, ar as FilterGroup, as as FilterOperator, at as FilterRule, au as FilterValue, av as FlowDefinition, aw as FlowPage, ax as FlowRelation, ay as FlowRow, az as FlowRowField, aA as FlowRowType, aB as FlowSlot, aC as FlowStatus, aD as FlowsTab, aE as FormDensity, aF as FormFieldRef, aG as FormTab, aH as GalleryViewConfig, aI as GalleryViewDefinition, aJ as GeneratedDocument, aK as InverseSource, aL as ListViewLayout, aM as MigrationError, aN as MigrationPreview, aO as MultiselectFilterOperator, aP as NO_VALUE_OPERATORS, aQ as NoValueOperator, aR as NodePosition, aS as NumberFilterOperator, aT as OPERATORS_BY_TYPE, aU as ObjectAttribute, aV as PhoneFilterValue, aW as QueryState, aX as RESERVED_ATTRIBUTE_NAMES, aY as RecordPatch, aZ as RelationBuffer, a_ as RelationFilterOperator, a$ as RelationQualifierPatch, b0 as RelationSource, b1 as RelativeDateValue, b2 as ReservedAttributeName, b3 as RetentionPolicy, b4 as RichtextTab, b5 as SYSTEM_FIELD_NAMES, b6 as SchemaOperation, b7 as SchemaTransform, b8 as SelectFilterOperator, b9 as SortDirection, ba as StartNode, bb as SystemFieldName, bc as TabType, bd as TableSource, be as TextFilterOperator, bf as ThemeColors, bg as ThemeLogo, bh as ThemeTypography, bi as TimelineViewConfig, bj as TimelineViewDefinition, bk as TransformSource, bl as ViewOperation, bm as ViewOverlay, bn as ViewTransform, bo as WorkflowError, bp as WorkflowInstance, bq as and, br as canResumeInstance, c as computeRecordStatus, a as createAttributeValidator, b as createDraftValidator, bs as createEmptyContext, d as createFormAttributeValidator, e as createObjectValidator, bt as createStartTransition, bu as eq, bv as generateCssVariables, bw as getContextValue, g as getMissingRequiredAttributes, bx as getRollupFilterOperators, by as inValues, bz as isActivityTab, bA as isAdvancedFormNode, bB as isCalendarView, bC as isConditionGroup, bD as isConditionNode, bE as isConditionRule, bF as isCustomTab, bG as isDetailView, bH as isDocumentsTab, bI as isEndNode, bJ as isFieldGroup, bK as isFlowDefinition, bL as isFlowFieldsRow, bM as isFlowPublished, bN as isFlowRelationListRow, bO as isFlowsTab, bP as isFormNode, bQ as isFormTab, bR as isGalleryView, bS as isInstanceTerminal, bT as isInstanceWaiting, bU as isInverseSourceTab, bV as isLayoutRow, bW as isListView, bX as isNoValueOperator, i as isRecordComplete, bY as isRelationGroup, bZ as isRelationSourceTab, b_ as isRichtextTab, b$ as isSimpleFormNode, c0 as isStartNode, c1 as isSystemFlow, c2 as isSystemWorkflow, c3 as isTableTab, c4 as isTimelineView, c5 as isWorkflowDefinition, c6 as isWorkflowPublished, c7 as mergeWithDefaults, c8 as neq, c9 as or, ca as setContextValue, v as validateAttribute, f as validateDraft, h as validateDraftOrThrow, j as validateObject, k as validateObjectOrThrow } from './index-Bt-0XNSh.js';
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-C-bhC0k5.js';
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-C-bhC0k5.js';
3
5
  import { MimeType, IconName, CountryIso3, CurrencyCode, ColorId } from '@stndrds/constants';
4
6
  import { Uuid, TenantId } from './utils.js';
5
7
  export { UserId, asTenantId, asUserId, deepEqual, generateId, generatePrefixedId, generateTemplateName, indexBy, slugify } from './utils.js';
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-B7nS2D1A.js';
12
+ export { DEFAULT_VALIDATION_MESSAGES, createRegexCache, formatZodErrors, getCachedRegex } from './validation/core/index.js';
13
+ export { createTextAreaValidator, createTextValidator } from './validation/primitives/text.js';
14
+ export { createNumberValidator } from './validation/primitives/number.js';
15
+ export { createCheckboxValidator } from './validation/primitives/checkbox.js';
16
+ export { createDateValidator } from './validation/primitives/date.js';
17
+ export { createRatingValidator } from './validation/primitives/rating.js';
18
+ export { createPhoneValidator } from './validation/complex/phone.js';
19
+ export { createCurrencyValidator } from './validation/complex/currency.js';
20
+ export { createLocationValidator } from './validation/complex/location.js';
21
+ export { createRichtextValidator } from './validation/complex/richtext.js';
22
+ export { createMultiselectValidator, createSelectValidator, createStatusValidator } from './validation/complex/select.js';
23
+ export { createFileValidator } from './validation/complex/file.js';
24
+ export { createUserValidator } from './validation/complex/user.js';
25
+ export { createMultiRelationValidator, createRelationValidator, createSingleRelationValidator } from './validation/complex/relation.js';
26
+ export { createFormulaValidator } from './validation/computed/formula.js';
27
+ export { createRollupValidator } from './validation/computed/rollup.js';
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.js';
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,109 +918,34 @@ 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>;
903
- /**
904
- * Assignment source schema (discriminated union)
905
- */
906
- declare const AssignmentSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
907
- type: z.ZodLiteral<"expression">;
908
- template: z.ZodString;
909
- }, z.core.$strip>, z.ZodObject<{
910
- type: z.ZodLiteral<"slot-ref">;
911
- slotId: z.ZodString;
912
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
913
- }, z.core.$strip>, z.ZodObject<{
914
- type: z.ZodLiteral<"static">;
915
- value: z.ZodUnknown;
916
- }, z.core.$strip>], "type">;
917
- /**
918
- * Assignment mapping schema
919
- */
920
- declare const AssignmentMappingSchema: z.ZodObject<{
921
- targetAttribute: z.ZodString;
922
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
923
- type: z.ZodLiteral<"expression">;
924
- template: z.ZodString;
925
- }, z.core.$strip>, z.ZodObject<{
926
- type: z.ZodLiteral<"slot-ref">;
927
- slotId: z.ZodString;
928
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
929
- }, z.core.$strip>, z.ZodObject<{
930
- type: z.ZodLiteral<"static">;
931
- value: z.ZodUnknown;
932
- }, z.core.$strip>], "type">;
933
- }, z.core.$strip>;
934
- /**
935
- * Assign node schema
936
- */
937
- declare const AssignNodeSchema: z.ZodObject<{
938
- type: z.ZodLiteral<"assign">;
939
- id: z.ZodString;
940
- label: z.ZodString;
941
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
942
- targetSlotId: z.ZodString;
943
- assignments: z.ZodArray<z.ZodObject<{
944
- targetAttribute: z.ZodString;
945
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
946
- type: z.ZodLiteral<"expression">;
947
- template: z.ZodString;
948
- }, z.core.$strip>, z.ZodObject<{
949
- type: z.ZodLiteral<"slot-ref">;
950
- slotId: z.ZodString;
951
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
952
- }, z.core.$strip>, z.ZodObject<{
953
- type: z.ZodLiteral<"static">;
954
- value: z.ZodUnknown;
955
- }, z.core.$strip>], "type">;
956
- }, z.core.$strip>>;
957
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
958
- }, z.core.$strip>;
959
- /**
960
- * AI node schema — generic agent runner
961
- */
962
- declare const AINodeSchema: z.ZodObject<{
963
- type: z.ZodLiteral<"ai">;
964
- id: z.ZodString;
965
- label: z.ZodString;
966
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
967
- mode: z.ZodEnum<{
968
- sync: "sync";
969
- async: "async";
970
- }>;
971
- definitionId: z.ZodOptional<z.ZodString>;
972
- systemPrompt: z.ZodOptional<z.ZodString>;
973
- model: z.ZodOptional<z.ZodString>;
974
- tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
975
- maxIterations: z.ZodOptional<z.ZodNumber>;
976
- instructions: z.ZodOptional<z.ZodString>;
977
- inputSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
978
- targetSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
979
- timeoutMs: z.ZodOptional<z.ZodNumber>;
980
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
981
- }, z.core.$strip>;
982
949
  /**
983
950
  * End node schema
984
951
  */
@@ -1046,69 +1013,33 @@ declare const WorkflowNodeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1046
1013
  type: z.ZodLiteral<"condition">;
1047
1014
  id: z.ZodString;
1048
1015
  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[];
1016
+ condition: z.ZodObject<{
1017
+ operator: z.ZodEnum<{
1018
+ and: "and";
1019
+ or: "or";
1058
1020
  }>;
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[];
1068
- }>;
1069
- }, unknown>>;
1021
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1022
+ field: z.ZodString;
1023
+ operator: z.ZodEnum<{
1024
+ contains: "contains";
1025
+ eq: "eq";
1026
+ neq: "neq";
1027
+ lt: "lt";
1028
+ gt: "gt";
1029
+ lte: "lte";
1030
+ gte: "gte";
1031
+ startsWith: "startsWith";
1032
+ endsWith: "endsWith";
1033
+ isEmpty: "isEmpty";
1034
+ isNotEmpty: "isNotEmpty";
1035
+ in: "in";
1036
+ notIn: "notIn";
1037
+ }>;
1038
+ value: z.ZodUnknown;
1039
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
1040
+ }, z.core.$strip>;
1070
1041
  onTrue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1071
1042
  onFalse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1072
- }, z.core.$strip>, z.ZodObject<{
1073
- type: z.ZodLiteral<"assign">;
1074
- id: z.ZodString;
1075
- label: z.ZodString;
1076
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1077
- targetSlotId: z.ZodString;
1078
- assignments: z.ZodArray<z.ZodObject<{
1079
- targetAttribute: z.ZodString;
1080
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1081
- type: z.ZodLiteral<"expression">;
1082
- template: z.ZodString;
1083
- }, z.core.$strip>, z.ZodObject<{
1084
- type: z.ZodLiteral<"slot-ref">;
1085
- slotId: z.ZodString;
1086
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1087
- }, z.core.$strip>, z.ZodObject<{
1088
- type: z.ZodLiteral<"static">;
1089
- value: z.ZodUnknown;
1090
- }, z.core.$strip>], "type">;
1091
- }, z.core.$strip>>;
1092
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1093
- }, z.core.$strip>, z.ZodObject<{
1094
- type: z.ZodLiteral<"ai">;
1095
- id: z.ZodString;
1096
- label: z.ZodString;
1097
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1098
- mode: z.ZodEnum<{
1099
- sync: "sync";
1100
- async: "async";
1101
- }>;
1102
- definitionId: z.ZodOptional<z.ZodString>;
1103
- systemPrompt: z.ZodOptional<z.ZodString>;
1104
- model: z.ZodOptional<z.ZodString>;
1105
- tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1106
- maxIterations: z.ZodOptional<z.ZodNumber>;
1107
- instructions: z.ZodOptional<z.ZodString>;
1108
- inputSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1109
- targetSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1110
- timeoutMs: z.ZodOptional<z.ZodNumber>;
1111
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1112
1043
  }, z.core.$strip>, z.ZodObject<{
1113
1044
  type: z.ZodLiteral<"end">;
1114
1045
  id: z.ZodString;
@@ -1158,9 +1089,9 @@ declare const ShareStatusSchema: z.ZodEnum<{
1158
1089
  * Workflow share schema (simplified from WorkflowParticipation)
1159
1090
  */
1160
1091
  declare const WorkflowShareSchema: z.ZodObject<{
1161
- id: z.ZodString;
1162
- instanceId: z.ZodString;
1163
- email: z.ZodString;
1092
+ id: z.ZodUUID;
1093
+ instanceId: z.ZodUUID;
1094
+ email: z.ZodEmail;
1164
1095
  name: z.ZodOptional<z.ZodString>;
1165
1096
  phone: z.ZodOptional<z.ZodString>;
1166
1097
  authMethod: z.ZodEnum<{
@@ -1186,8 +1117,8 @@ declare const WorkflowShareSchema: z.ZodObject<{
1186
1117
  * Create share input schema
1187
1118
  */
1188
1119
  declare const CreateShareInputSchema: z.ZodObject<{
1189
- instanceId: z.ZodString;
1190
- email: z.ZodString;
1120
+ instanceId: z.ZodUUID;
1121
+ email: z.ZodEmail;
1191
1122
  name: z.ZodOptional<z.ZodString>;
1192
1123
  phone: z.ZodOptional<z.ZodString>;
1193
1124
  authMethod: z.ZodEnum<{
@@ -1242,7 +1173,7 @@ declare const ThemeColorsSchema: z.ZodObject<{
1242
1173
  * Theme logo schema
1243
1174
  */
1244
1175
  declare const ThemeLogoSchema: z.ZodObject<{
1245
- url: z.ZodString;
1176
+ url: z.ZodURL;
1246
1177
  alt: z.ZodOptional<z.ZodString>;
1247
1178
  maxHeight: z.ZodOptional<z.ZodNumber>;
1248
1179
  }, z.core.$strip>;
@@ -1251,7 +1182,7 @@ declare const ThemeLogoSchema: z.ZodObject<{
1251
1182
  */
1252
1183
  declare const WorkflowThemeSchema: z.ZodObject<{
1253
1184
  logo: z.ZodOptional<z.ZodObject<{
1254
- url: z.ZodString;
1185
+ url: z.ZodURL;
1255
1186
  alt: z.ZodOptional<z.ZodString>;
1256
1187
  maxHeight: z.ZodOptional<z.ZodNumber>;
1257
1188
  }, z.core.$strip>>;
@@ -1371,69 +1302,33 @@ declare const WorkflowDefinitionSchema: z.ZodObject<{
1371
1302
  type: z.ZodLiteral<"condition">;
1372
1303
  id: z.ZodString;
1373
1304
  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[];
1305
+ condition: z.ZodObject<{
1306
+ operator: z.ZodEnum<{
1307
+ and: "and";
1308
+ or: "or";
1393
1309
  }>;
1394
- }, unknown>>;
1310
+ rules: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1311
+ field: z.ZodString;
1312
+ operator: z.ZodEnum<{
1313
+ contains: "contains";
1314
+ eq: "eq";
1315
+ neq: "neq";
1316
+ lt: "lt";
1317
+ gt: "gt";
1318
+ lte: "lte";
1319
+ gte: "gte";
1320
+ startsWith: "startsWith";
1321
+ endsWith: "endsWith";
1322
+ isEmpty: "isEmpty";
1323
+ isNotEmpty: "isNotEmpty";
1324
+ in: "in";
1325
+ notIn: "notIn";
1326
+ }>;
1327
+ value: z.ZodUnknown;
1328
+ }, z.core.$strip>, z.ZodObject</*elided*/ any, z.core.$strip>]>>;
1329
+ }, z.core.$strip>;
1395
1330
  onTrue: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1396
1331
  onFalse: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1397
- }, z.core.$strip>, z.ZodObject<{
1398
- type: z.ZodLiteral<"assign">;
1399
- id: z.ZodString;
1400
- label: z.ZodString;
1401
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1402
- targetSlotId: z.ZodString;
1403
- assignments: z.ZodArray<z.ZodObject<{
1404
- targetAttribute: z.ZodString;
1405
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1406
- type: z.ZodLiteral<"expression">;
1407
- template: z.ZodString;
1408
- }, z.core.$strip>, z.ZodObject<{
1409
- type: z.ZodLiteral<"slot-ref">;
1410
- slotId: z.ZodString;
1411
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1412
- }, z.core.$strip>, z.ZodObject<{
1413
- type: z.ZodLiteral<"static">;
1414
- value: z.ZodUnknown;
1415
- }, z.core.$strip>], "type">;
1416
- }, z.core.$strip>>;
1417
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1418
- }, z.core.$strip>, z.ZodObject<{
1419
- type: z.ZodLiteral<"ai">;
1420
- id: z.ZodString;
1421
- label: z.ZodString;
1422
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1423
- mode: z.ZodEnum<{
1424
- sync: "sync";
1425
- async: "async";
1426
- }>;
1427
- definitionId: z.ZodOptional<z.ZodString>;
1428
- systemPrompt: z.ZodOptional<z.ZodString>;
1429
- model: z.ZodOptional<z.ZodString>;
1430
- tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
1431
- maxIterations: z.ZodOptional<z.ZodNumber>;
1432
- instructions: z.ZodOptional<z.ZodString>;
1433
- inputSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1434
- targetSlotIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
1435
- timeoutMs: z.ZodOptional<z.ZodNumber>;
1436
- next: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1437
1332
  }, z.core.$strip>, z.ZodObject<{
1438
1333
  type: z.ZodLiteral<"end">;
1439
1334
  id: z.ZodString;
@@ -1454,7 +1349,7 @@ declare const WorkflowDefinitionSchema: z.ZodObject<{
1454
1349
  }, z.core.$strip>>;
1455
1350
  theme: z.ZodOptional<z.ZodObject<{
1456
1351
  logo: z.ZodOptional<z.ZodObject<{
1457
- url: z.ZodString;
1352
+ url: z.ZodURL;
1458
1353
  alt: z.ZodOptional<z.ZodString>;
1459
1354
  maxHeight: z.ZodOptional<z.ZodNumber>;
1460
1355
  }, z.core.$strip>>;
@@ -2060,313 +1955,11 @@ interface BoundingBox {
2060
1955
  width: number;
2061
1956
  height: number;
2062
1957
  }
2063
- /**
2064
- * Signature Adapter Interface for electronic signatures.
2065
- *
2066
- * Implementations:
2067
- * - YousignAdapter (adapter-nestjs/adapters/signature/)
2068
- * - DocusignAdapter (adapter-nestjs/adapters/signature/)
2069
- *
2070
- * @example
2071
- * ```typescript
2072
- * class YousignAdapter implements SignatureAdapter {
2073
- * readonly name = "yousign";
2074
- *
2075
- * async createSignatureRequest(input): Promise<SignatureRequestResult> {
2076
- * // Create signature request via Yousign API
2077
- * }
2078
- * }
2079
- * ```
2080
- */
2081
- interface SignatureAdapter {
2082
- /** Provider name for identification */
2083
- readonly name: string;
2084
- /** Create a new signature request */
2085
- createSignatureRequest(input: CreateSignatureInput): Promise<SignatureRequestResult>;
2086
- /** Get current status of a signature request */
2087
- getStatus(externalId: string): Promise<SignatureStatusResult>;
2088
- /** Cancel a pending signature request */
2089
- cancel(externalId: string): Promise<void>;
2090
- /** Download the signed document */
2091
- downloadSignedDocument(externalId: string): Promise<Buffer>;
2092
- }
2093
- interface CreateSignatureInput {
2094
- /** Document content as Buffer */
2095
- documentBuffer: Buffer;
2096
- /** Document filename */
2097
- documentName: string;
2098
- /** List of signers */
2099
- signers: SignerRequest[];
2100
- /** Expiration date for the signature request */
2101
- expiresAt?: Date;
2102
- /** Webhook URL for status updates */
2103
- webhookUrl?: string;
2104
- /** Custom metadata to attach */
2105
- metadata?: Record<string, string>;
2106
- }
2107
- interface SignerRequest {
2108
- /** Signer's email address */
2109
- email: string;
2110
- /** Signer's first name */
2111
- firstName: string;
2112
- /** Signer's last name */
2113
- lastName: string;
2114
- /** Phone number for SMS verification */
2115
- phone?: string;
2116
- /** Signature position on the document */
2117
- signaturePosition?: SignaturePosition;
2118
- /** Order in which to sign (1-based) */
2119
- order?: number;
2120
- }
2121
- interface SignaturePosition {
2122
- /** Page number (1-based) */
2123
- page: number;
2124
- /** X coordinate (from left) */
2125
- x: number;
2126
- /** Y coordinate (from top) */
2127
- y: number;
2128
- /** Signature box width */
2129
- width: number;
2130
- /** Signature box height */
2131
- height: number;
2132
- }
2133
- interface SignatureRequestResult {
2134
- /** External ID from the provider */
2135
- externalId: string;
2136
- /** URL for signers to access */
2137
- signatureUrl: string;
2138
- /** Per-signer URLs if different */
2139
- signerUrls?: Record<string, string>;
2140
- /** Current status */
2141
- status: SignatureStatus;
2142
- }
2143
- interface SignatureStatusResult {
2144
- /** External ID */
2145
- externalId: string;
2146
- /** Current status */
2147
- status: SignatureStatus;
2148
- /** Per-signer status */
2149
- signers?: SignerStatus[];
2150
- /** Signed document available for download */
2151
- signedDocumentAvailable?: boolean;
2152
- /** Completion timestamp */
2153
- completedAt?: Date;
2154
- /** Reason for decline (if status is "declined") */
2155
- declineReason?: string;
2156
- }
2157
- interface SignerStatus {
2158
- email: string;
2159
- status: "pending" | "signed" | "declined";
2160
- signedAt?: Date;
2161
- }
2162
- type SignatureStatus = "pending" | "signed" | "declined" | "expired" | "cancelled";
2163
- /**
2164
- * Identity Verification Adapter Interface for KYC document verification.
2165
- *
2166
- * Implementations:
2167
- * - OnfidoAdapter (adapter-nestjs/adapters/identity/)
2168
- * - VeriffAdapter (adapter-nestjs/adapters/identity/)
2169
- *
2170
- * @example
2171
- * ```typescript
2172
- * class OnfidoAdapter implements IdentityVerificationAdapter {
2173
- * readonly name = "onfido";
2174
- * readonly supportedDocumentTypes = ["passport", "national_id", "driving_license"];
2175
- *
2176
- * async verify(input): Promise<VerificationResult> {
2177
- * // Verify document via Onfido API
2178
- * }
2179
- * }
2180
- * ```
2181
- */
2182
- interface IdentityVerificationAdapter {
2183
- /** Provider name for identification */
2184
- readonly name: string;
2185
- /** Supported document types */
2186
- readonly supportedDocumentTypes: readonly string[];
2187
- /** Verify an identity document */
2188
- verify(input: VerifyInput): Promise<VerificationResult>;
2189
- }
2190
- interface VerifyInput {
2191
- /** Front side of the document */
2192
- frontBuffer: Buffer;
2193
- /** Back side of the document (optional for some document types) */
2194
- backBuffer?: Buffer;
2195
- /** Document type (e.g., "passport", "national_id") */
2196
- documentType: string;
2197
- /** Country code (ISO 3166-1 alpha-3) */
2198
- countryCode?: string;
2199
- }
2200
- interface VerificationResult {
2201
- /** Overall verification passed */
2202
- verified: boolean;
2203
- /** Confidence score (0-1) */
2204
- confidence: number;
2205
- /** Extracted document data */
2206
- documentData?: DocumentData;
2207
- /** Individual verification checks */
2208
- checks: VerificationCheck[];
2209
- /** Provider-specific raw response */
2210
- rawResponse?: Record<string, unknown>;
2211
- }
2212
- interface DocumentData {
2213
- /** First name */
2214
- firstName?: string;
2215
- /** Last name */
2216
- lastName?: string;
2217
- /** Full name if not split */
2218
- fullName?: string;
2219
- /** Date of birth (ISO 8601) */
2220
- dateOfBirth?: string;
2221
- /** Document number */
2222
- documentNumber?: string;
2223
- /** Expiry date (ISO 8601) */
2224
- expiryDate?: string;
2225
- /** Issue date (ISO 8601) */
2226
- issueDate?: string;
2227
- /** Nationality (ISO 3166-1 alpha-3) */
2228
- nationality?: string;
2229
- /** Gender */
2230
- gender?: "M" | "F" | "X";
2231
- /** Address if present on document */
2232
- address?: string;
2233
- /** MRZ data if available */
2234
- mrz?: string;
2235
- }
2236
- interface VerificationCheck {
2237
- /** Check name (e.g., "document_authenticity", "face_match") */
2238
- name: string;
2239
- /** Check result */
2240
- status: "passed" | "failed" | "warning" | "not_applicable";
2241
- /** Human-readable message */
2242
- message?: string;
2243
- /** Detailed sub-checks */
2244
- details?: Record<string, unknown>;
2245
- }
2246
-
2247
- /**
2248
- * Type of mentionable entity
2249
- */
2250
- type MentionEntityType = "user" | "record" | (string & {});
2251
- /**
2252
- * A mention reference stored with a message
2253
- */
2254
- interface MentionReference {
2255
- /** Unique ID for this mention instance */
2256
- id: string;
2257
- /** Entity type (user, record, or custom) */
2258
- type: MentionEntityType;
2259
- /** Entity ID (user ID or record ID) */
2260
- entityId: string;
2261
- /** Display label at time of mention (cached for display even if entity is deleted) */
2262
- label: string;
2263
- /** Object name for records, undefined for users */
2264
- objectName?: string;
2265
- /** Start position in the message text */
2266
- startIndex: number;
2267
- /** End position in the message text */
2268
- endIndex: number;
2269
- }
2270
- /**
2271
- * Context data for a mentioned entity (sent to AI)
2272
- */
2273
- interface MentionedEntityContext {
2274
- /** Entity type */
2275
- type: MentionEntityType;
2276
- /** Entity ID */
2277
- entityId: string;
2278
- /** Display label */
2279
- label: string;
2280
- /** Object name for records */
2281
- objectName?: string;
2282
- /** Additional context data (record values, user details, etc.) */
2283
- data?: Record<string, unknown>;
2284
- }
2285
- /**
2286
- * Full mention context for AI
2287
- */
2288
- interface MentionedContext {
2289
- /** All mentioned entities with their context data */
2290
- entities: MentionedEntityContext[];
2291
- /** Summary text for AI system prompt */
2292
- summary: string;
2293
- }
2294
-
2295
- /**
2296
- * AI Agent Types
2297
- *
2298
- * Shared types for AI Agent chat functionality.
2299
- * Used by @stndrds/react hooks and UI components.
2300
- */
2301
- /**
2302
- * File attachment for AI chat messages
2303
- */
2304
- interface ChatFileAttachment {
2305
- /** File ID (from files table) */
2306
- id: string;
2307
- /** File name */
2308
- name: string;
2309
- /** File size in bytes */
2310
- size: number;
2311
- /** MIME type */
2312
- mimeType: string;
2313
- /** URL for display/download */
2314
- url?: string;
2315
- }
2316
- /**
2317
- * Content part types for ordered message rendering.
2318
- * Parts are stored in chronological order as they arrive from the stream.
2319
- */
2320
- type AgentContentPart = {
2321
- type: "text";
2322
- id: string;
2323
- text: string;
2324
- } | {
2325
- type: "attachment";
2326
- id: string;
2327
- files: ChatFileAttachment[];
2328
- } | {
2329
- type: "thinking";
2330
- id: string;
2331
- isStreaming: boolean;
2332
- startTime?: number;
2333
- } | {
2334
- type: "reasoning";
2335
- id: string;
2336
- content: string;
2337
- isStreaming?: boolean;
2338
- startTime?: number;
2339
- } | {
2340
- type: "tool";
2341
- id: string;
2342
- name: string;
2343
- input?: Record<string, unknown>;
2344
- output?: unknown;
2345
- error?: string;
2346
- status: "running" | "success" | "error";
2347
- };
2348
- /**
2349
- * Agent message with ordered content parts.
2350
- * All content (text, tools, thinking) is stored as parts in stream order.
2351
- */
2352
- interface AgentMessage {
2353
- id: string;
2354
- role: "user" | "assistant";
2355
- /** Ordered content parts (text, tools, thinking) */
2356
- parts: AgentContentPart[];
2357
- isStreaming?: boolean;
2358
- /** Error message if the message failed */
2359
- error?: string;
2360
- }
2361
1958
 
2362
1959
  /**
2363
1960
  * Message role in a conversation
2364
1961
  */
2365
1962
  type AIMessageRole = "user" | "assistant";
2366
- /**
2367
- * Level of "thinking" or reasoning depth
2368
- */
2369
- type AIThinkingLevel = "none" | "light" | "deep" | "maximum";
2370
1963
  /**
2371
1964
  * An AI model available for selection by the user.
2372
1965
  * Configured on the backend and exposed via GET /agent/models.
@@ -2583,69 +2176,6 @@ interface AITodoList {
2583
2176
  progress: number;
2584
2177
  isComplete: boolean;
2585
2178
  }
2586
- /**
2587
- * Resolved attachment metadata (populated when fetching messages)
2588
- */
2589
- interface AIMessageAttachment {
2590
- id: string;
2591
- name: string;
2592
- size: number;
2593
- mimeType: string;
2594
- url: string;
2595
- }
2596
- /**
2597
- * AI Conversation record
2598
- */
2599
- interface AIConversation {
2600
- id: string;
2601
- tenantId: string;
2602
- userId: string;
2603
- title: string | null;
2604
- messageCount: number;
2605
- totalTokens: number;
2606
- totalCost: number;
2607
- sandboxId: string | null;
2608
- createdAt: Date;
2609
- updatedAt: Date;
2610
- deletedAt: Date | null;
2611
- }
2612
- /**
2613
- * AI Message record
2614
- */
2615
- interface AIMessage {
2616
- id: string;
2617
- conversationId: string;
2618
- role: AIMessageRole;
2619
- content: string;
2620
- thinkingLevel: AIThinkingLevel | null;
2621
- thinkingSummary: string | null;
2622
- toolCalls: AIToolCallRecord[] | null;
2623
- inputTokens: number | null;
2624
- outputTokens: number | null;
2625
- cost: number | null;
2626
- provider: string | null;
2627
- model: string | null;
2628
- /** File attachment IDs (references files table) */
2629
- attachmentIds: string[] | null;
2630
- /** Resolved attachments (populated when fetching messages) */
2631
- attachments?: AIMessageAttachment[];
2632
- /** Mentions in this message */
2633
- mentions: MentionReference[] | null;
2634
- createdAt: Date;
2635
- }
2636
- /**
2637
- * Tool call record stored in JSONB
2638
- */
2639
- interface AIToolCallRecord {
2640
- /** Tool call ID (from AI SDK) for matching call with result */
2641
- id?: string;
2642
- name: string;
2643
- args: unknown;
2644
- result?: unknown;
2645
- error?: string;
2646
- /** Reasoning/thinking that occurred before this tool call */
2647
- reasoningBefore?: string;
2648
- }
2649
2179
  /**
2650
2180
  * AI Usage Metrics record
2651
2181
  */
@@ -2667,26 +2197,6 @@ interface AIProviderMetrics {
2667
2197
  tokens: number;
2668
2198
  cost: number;
2669
2199
  }
2670
- /**
2671
- * Input for creating an AI message
2672
- */
2673
- interface CreateAIMessageInput {
2674
- conversationId: string;
2675
- role: AIMessageRole;
2676
- content: string;
2677
- thinkingLevel?: AIThinkingLevel;
2678
- thinkingSummary?: string;
2679
- toolCalls?: AIToolCallRecord[];
2680
- inputTokens?: number;
2681
- outputTokens?: number;
2682
- cost?: number;
2683
- provider?: string;
2684
- model?: string;
2685
- /** File attachment IDs (references files table) */
2686
- attachmentIds?: string[];
2687
- /** Mentions in this message (users, records, etc.) */
2688
- mentions?: MentionReference[];
2689
- }
2690
2200
  /**
2691
2201
  * Memory type for categorization
2692
2202
  *
@@ -2728,6 +2238,328 @@ interface AICompactionSummary {
2728
2238
  compactedAt: Date;
2729
2239
  }
2730
2240
 
2241
+ /**
2242
+ * Scope of a permission rule.
2243
+ * - `object`: Controls access to an entire object type (business data)
2244
+ * - `system`: Controls access to platform resources (people, workspace)
2245
+ */
2246
+ type PermissionScope = "object" | "system";
2247
+ /**
2248
+ * Actions that can be performed on a resource.
2249
+ */
2250
+ type Action = "read" | "create" | "update" | "delete";
2251
+ /**
2252
+ * System resources that can be managed.
2253
+ * - `people`: User profiles, invitations, roles and permissions
2254
+ * - `workspace`: Object definitions, attributes, tenant settings, audit logs
2255
+ * - `architect`: Architect settings, templates, and configurations
2256
+ */
2257
+ type SystemResource = "people" | "workspace" | "architect";
2258
+ /**
2259
+ * Preset access levels for simplified permission configuration.
2260
+ * - `full`: All CRUD actions
2261
+ * - `read-only`: Only read action
2262
+ * - `none`: No actions
2263
+ * - `custom`: Manual selection of individual actions
2264
+ */
2265
+ type AccessLevel = "full" | "read-only" | "none" | "custom";
2266
+ declare const ALL_ACTIONS: Action[];
2267
+ /**
2268
+ * Derive an AccessLevel from a list of actions.
2269
+ */
2270
+ declare function actionsToAccessLevel(actions: Action[]): AccessLevel;
2271
+ /**
2272
+ * Convert an AccessLevel preset to its corresponding actions.
2273
+ */
2274
+ declare function accessLevelToActions(level: Exclude<AccessLevel, "custom">): Action[];
2275
+ /**
2276
+ * Role definition - Groups permissions together.
2277
+ *
2278
+ * Roles are tenant-scoped and can be system-defined (immutable) or custom.
2279
+ *
2280
+ * @example
2281
+ * ```typescript
2282
+ * const ownerRole: Role = {
2283
+ * id: "role-123",
2284
+ * tenantId: "tenant-456",
2285
+ * name: "owner",
2286
+ * label: "Owner",
2287
+ * description: "Full access to all platform features and data",
2288
+ * system: true,
2289
+ * createdAt: new Date(),
2290
+ * updatedAt: new Date(),
2291
+ * };
2292
+ * ```
2293
+ */
2294
+ interface Role extends Timestamps {
2295
+ id: Uuid;
2296
+ tenantId: Uuid;
2297
+ /**
2298
+ * Technical name (unique per tenant, used in code).
2299
+ * Examples: "owner", "member", "sales_manager"
2300
+ */
2301
+ name: string;
2302
+ /**
2303
+ * Display name shown in UI.
2304
+ */
2305
+ label: string;
2306
+ /**
2307
+ * Optional description of the role's purpose.
2308
+ */
2309
+ description?: string;
2310
+ /**
2311
+ * If true, this role cannot be modified or deleted.
2312
+ * Used for built-in roles like "owner".
2313
+ */
2314
+ system: boolean;
2315
+ }
2316
+ /**
2317
+ * Permission definition - Grants specific actions on a target.
2318
+ *
2319
+ * A permission belongs to a role and defines what actions are allowed
2320
+ * on a specific target (object or system resource).
2321
+ *
2322
+ * @example
2323
+ * ```typescript
2324
+ * // Allow read and update on companies object
2325
+ * const permission: Permission = {
2326
+ * id: "perm-123",
2327
+ * roleId: "role-456",
2328
+ * scope: "object",
2329
+ * target: "companies",
2330
+ * actions: ["read", "update"],
2331
+ * createdAt: new Date(),
2332
+ * };
2333
+ *
2334
+ * // Wildcard permission for all objects
2335
+ * const wildcardPerm: Permission = {
2336
+ * id: "perm-789",
2337
+ * roleId: "role-456",
2338
+ * scope: "object",
2339
+ * target: "*",
2340
+ * actions: ["read", "create", "update", "delete"],
2341
+ * createdAt: new Date(),
2342
+ * };
2343
+ * ```
2344
+ */
2345
+ interface Permission {
2346
+ id: Uuid;
2347
+ roleId: Uuid;
2348
+ /**
2349
+ * Scope of this permission.
2350
+ */
2351
+ scope: PermissionScope;
2352
+ /**
2353
+ * Target of the permission.
2354
+ * - For `object` scope: object name (e.g., "companies") or "*" for all
2355
+ * - For `system` scope: system resource (e.g., "people", "workspace") or "*" for all
2356
+ */
2357
+ target: string;
2358
+ /**
2359
+ * Actions allowed on the target.
2360
+ */
2361
+ actions: Action[];
2362
+ createdAt: Date;
2363
+ }
2364
+ /**
2365
+ * Links a user profile to a role within a tenant.
2366
+ *
2367
+ * A user can have multiple roles, and their permissions are additive (union).
2368
+ *
2369
+ * Note: `userProfileId` references UserProfile.id from the user_profiles table,
2370
+ * NOT the auth provider ID (authId). This keeps permissions tied to the
2371
+ * application's user management, not the authentication layer.
2372
+ */
2373
+ interface UserRoleAssignment {
2374
+ id: Uuid;
2375
+ /**
2376
+ * User profile ID (UserProfile.id from user_profiles table).
2377
+ * This links to the application's user management system,
2378
+ * not the auth provider's user ID.
2379
+ */
2380
+ userProfileId: Uuid;
2381
+ roleId: Uuid;
2382
+ tenantId: Uuid;
2383
+ /**
2384
+ * When the role was assigned.
2385
+ */
2386
+ assignedAt: Date;
2387
+ /**
2388
+ * User profile ID of who assigned this role (for audit trail).
2389
+ */
2390
+ assignedBy?: Uuid;
2391
+ }
2392
+ /**
2393
+ * Computed permissions for a user.
2394
+ *
2395
+ * This is the merged result of all roles assigned to a user.
2396
+ * Returned by the API for permission checks.
2397
+ */
2398
+ interface EffectivePermissions {
2399
+ /**
2400
+ * Object-level permissions.
2401
+ * Key is the object name, value is array of allowed actions.
2402
+ * Special key "*" means permission applies to all objects.
2403
+ */
2404
+ objectPermissions: Record<string, Action[]>;
2405
+ /**
2406
+ * System-level permissions.
2407
+ * Key is the system resource (people, workspace), value is array of allowed actions.
2408
+ * Special key "*" means permission applies to all system resources.
2409
+ */
2410
+ systemPermissions: Record<string, Action[]>;
2411
+ }
2412
+ /**
2413
+ * Permissions for a specific object.
2414
+ * Convenience type for frontend use.
2415
+ */
2416
+ interface ObjectPermissions {
2417
+ canRead: boolean;
2418
+ canCreate: boolean;
2419
+ canUpdate: boolean;
2420
+ canDelete: boolean;
2421
+ }
2422
+ /**
2423
+ * Permissions for a specific system resource.
2424
+ * Convenience type for frontend use.
2425
+ */
2426
+ interface SystemPermissions {
2427
+ canRead: boolean;
2428
+ canCreate: boolean;
2429
+ canUpdate: boolean;
2430
+ canDelete: boolean;
2431
+ }
2432
+ /**
2433
+ * Input for creating a new role.
2434
+ * TenantId is automatically set from TenantContext.
2435
+ */
2436
+ interface CreateRoleInput {
2437
+ name: string;
2438
+ label: string;
2439
+ description?: string;
2440
+ }
2441
+ /**
2442
+ * Input for updating an existing role.
2443
+ */
2444
+ interface UpdateRoleInput {
2445
+ label?: string;
2446
+ description?: string;
2447
+ }
2448
+ /**
2449
+ * Input for creating a permission.
2450
+ */
2451
+ interface CreatePermissionInput {
2452
+ scope: PermissionScope;
2453
+ target: string;
2454
+ /**
2455
+ * Actions allowed on the target.
2456
+ */
2457
+ actions: Action[];
2458
+ }
2459
+ /**
2460
+ * Input for assigning a role to a user.
2461
+ */
2462
+ interface AssignRoleInput {
2463
+ /**
2464
+ * User profile ID (UserProfile.id).
2465
+ */
2466
+ userProfileId: Uuid;
2467
+ roleId: Uuid;
2468
+ tenantId: Uuid;
2469
+ assignedBy?: Uuid;
2470
+ }
2471
+
2472
+ /**
2473
+ * A permission attached to an API key.
2474
+ * Same format as RBAC permissions — reuses PermissionScope, Action, and target.
2475
+ */
2476
+ interface ApiKeyPermission {
2477
+ scope: PermissionScope;
2478
+ target: string;
2479
+ actions: Action[];
2480
+ }
2481
+ interface ApiKey {
2482
+ id: string;
2483
+ tenantId: string;
2484
+ userProfileId: string | null;
2485
+ name: string;
2486
+ prefix: string;
2487
+ permissions: ApiKeyPermission[];
2488
+ expiresAt: string | null;
2489
+ lastUsedAt: string | null;
2490
+ revokedAt: string | null;
2491
+ createdAt: string;
2492
+ createdBy: string;
2493
+ }
2494
+ /** Returned only at creation time — the only time the plaintext secret is available. */
2495
+ interface ApiKeyWithSecret extends ApiKey {
2496
+ secret: string;
2497
+ }
2498
+ /**
2499
+ * Returned by validateKey — provides everything downstream needs.
2500
+ * Permissions are already intersected with user RBAC for personal keys.
2501
+ */
2502
+ interface ApiKeyAuthContext {
2503
+ tenantId: string;
2504
+ userId: string | null;
2505
+ keyId: string;
2506
+ permissions: ApiKeyPermission[];
2507
+ }
2508
+ interface CreateApiKeyInput {
2509
+ name: string;
2510
+ permissions: ApiKeyPermission[];
2511
+ expiresAt?: string;
2512
+ userProfileId?: string;
2513
+ }
2514
+
2515
+ /**
2516
+ * Type of mentionable entity
2517
+ */
2518
+ type MentionEntityType = "user" | "record" | (string & {});
2519
+ /**
2520
+ * A mention reference stored with a message
2521
+ */
2522
+ interface MentionReference {
2523
+ /** Unique ID for this mention instance */
2524
+ id: string;
2525
+ /** Entity type (user, record, or custom) */
2526
+ type: MentionEntityType;
2527
+ /** Entity ID (user ID or record ID) */
2528
+ entityId: string;
2529
+ /** Display label at time of mention (cached for display even if entity is deleted) */
2530
+ label: string;
2531
+ /** Object name for records, undefined for users */
2532
+ objectName?: string;
2533
+ /** Start position in the message text */
2534
+ startIndex: number;
2535
+ /** End position in the message text */
2536
+ endIndex: number;
2537
+ }
2538
+ /**
2539
+ * Context data for a mentioned entity (sent to AI)
2540
+ */
2541
+ interface MentionedEntityContext {
2542
+ /** Entity type */
2543
+ type: MentionEntityType;
2544
+ /** Entity ID */
2545
+ entityId: string;
2546
+ /** Display label */
2547
+ label: string;
2548
+ /** Object name for records */
2549
+ objectName?: string;
2550
+ /** Additional context data (record values, user details, etc.) */
2551
+ data?: Record<string, unknown>;
2552
+ }
2553
+ /**
2554
+ * Full mention context for AI
2555
+ */
2556
+ interface MentionedContext {
2557
+ /** All mentioned entities with their context data */
2558
+ entities: MentionedEntityContext[];
2559
+ /** Summary text for AI system prompt */
2560
+ summary: string;
2561
+ }
2562
+
2731
2563
  /**
2732
2564
  * Attribute Property Protection
2733
2565
  *
@@ -2875,7 +2707,11 @@ interface AuditServiceOptions {
2875
2707
  }
2876
2708
 
2877
2709
  type AgentRunStatus = "pending" | "running" | "completed" | "failed" | "cancelled" | "paused";
2878
- type AgentTriggerType = "record.created" | "record.updated" | "record.deleted";
2710
+ type AgentSessionStatus = "active" | "idle" | "completed" | "failed" | "cancelled" | "waiting_human" | "timeout" | "expired";
2711
+ type AgentSessionMode = "interactive" | "autonomous";
2712
+ type QuestionStatus = "pending" | "answered" | "timeout" | "cancelled";
2713
+ type TriggerEventType = "record.created" | "record.updated" | "record.deleted" | "record.field_changed" | "workflow.completed" | "agent.completed" | "webhook" | "schedule";
2714
+ type AgentTriggerType = Extract<TriggerEventType, "record.created" | "record.updated" | "record.deleted">;
2879
2715
  type ProviderName = "anthropic" | "openai" | "google" | "mistral";
2880
2716
  interface ModelDefinition {
2881
2717
  provider: ProviderName;
@@ -2893,18 +2729,62 @@ interface AgentExecutionConfig {
2893
2729
  timeoutMs: number;
2894
2730
  costLimitUsd?: number;
2895
2731
  }
2896
- interface AgentInlineConfig {
2732
+ /**
2733
+ * Shared base config used by AgentDefinition, inline runs, and AgentSession.
2734
+ */
2735
+ interface AgentConfig {
2897
2736
  systemPrompt: string;
2898
2737
  model: ModelDefinition;
2899
2738
  tools?: string[];
2900
2739
  maxIterations?: number;
2901
2740
  timeoutMs?: number;
2741
+ canDelegate: boolean;
2742
+ maxDepth: number;
2743
+ maxTreeCostUsd?: number;
2744
+ canAskHuman?: boolean;
2745
+ critic?: CriticConfig;
2746
+ }
2747
+ interface CriticConfig {
2748
+ enabled: boolean;
2749
+ model?: ModelDefinition;
2750
+ systemPrompt?: string;
2751
+ maxRetries?: number;
2902
2752
  }
2903
- interface AgentTrigger {
2753
+ interface RecordAgentTrigger {
2904
2754
  type: AgentTriggerType;
2905
2755
  objectId: string;
2906
2756
  filter?: Record<string, unknown>;
2907
2757
  }
2758
+ interface WorkflowCompletedAgentTrigger {
2759
+ type: "workflow.completed";
2760
+ workflowId?: string;
2761
+ workflowName?: string;
2762
+ filter?: Record<string, unknown>;
2763
+ }
2764
+ type AgentTrigger = RecordAgentTrigger | WorkflowCompletedAgentTrigger;
2765
+ /**
2766
+ * Standalone trigger definition (replaces embedded AgentTrigger[]).
2767
+ * Triggers are now first-class entities with their own lifecycle.
2768
+ */
2769
+ interface AgentTriggerDefinition {
2770
+ id: string;
2771
+ tenantId: string;
2772
+ definitionId: string;
2773
+ name?: string;
2774
+ eventType: TriggerEventType;
2775
+ objectId?: string;
2776
+ fieldPath?: string;
2777
+ workflowDefinitionId?: string;
2778
+ sourceAgentId?: string;
2779
+ webhookPath?: string;
2780
+ cronExpression?: string;
2781
+ timezone?: string;
2782
+ filter?: Record<string, unknown>;
2783
+ inputBuilder?: string;
2784
+ enabled: boolean;
2785
+ createdAt: Date;
2786
+ updatedAt: Date;
2787
+ }
2908
2788
  interface AgentSchedule {
2909
2789
  cron: string;
2910
2790
  timezone?: string;
@@ -2912,10 +2792,35 @@ interface AgentSchedule {
2912
2792
  input?: Record<string, unknown>;
2913
2793
  inputBuilder?: string;
2914
2794
  }
2795
+ type AgentAttachmentCategory = "context" | "input-template" | "output-template" | "template";
2796
+ interface AgentAttachment {
2797
+ id: string;
2798
+ definitionId: string;
2799
+ tenantId: string;
2800
+ category: AgentAttachmentCategory;
2801
+ filename: string;
2802
+ mimeType: string;
2803
+ sizeBytes: number;
2804
+ storageKey: string;
2805
+ createdAt: Date;
2806
+ }
2807
+ interface AgentMessageAttachment {
2808
+ id: string;
2809
+ name: string;
2810
+ mimeType: string;
2811
+ size: number;
2812
+ url?: string;
2813
+ }
2814
+ interface TimeoutPolicy {
2815
+ timeoutMs: number;
2816
+ action: "cancel" | "auto_decide" | "escalate";
2817
+ fallbackValue?: unknown;
2818
+ }
2915
2819
  interface AgentDefinition {
2916
2820
  id: string;
2917
2821
  tenantId: string;
2918
2822
  name: string;
2823
+ icon?: string;
2919
2824
  description?: string;
2920
2825
  systemPrompt: string;
2921
2826
  model: ModelDefinition;
@@ -2927,13 +2832,20 @@ interface AgentDefinition {
2927
2832
  createdBy: string;
2928
2833
  createdAt: Date;
2929
2834
  updatedAt: Date;
2835
+ deletedAt?: Date;
2836
+ canDelegate?: boolean;
2837
+ maxDepth?: number;
2838
+ maxTreeCostUsd?: number;
2839
+ critic?: CriticConfig;
2840
+ autoDecide?: boolean;
2841
+ attachments?: AgentAttachment[];
2930
2842
  }
2931
2843
  interface AgentRun {
2932
2844
  id: string;
2933
2845
  definitionId?: string;
2934
2846
  parentRunId?: string;
2935
2847
  depth: number;
2936
- inlineConfig?: AgentInlineConfig;
2848
+ inlineConfig?: AgentConfig;
2937
2849
  tenantId: string;
2938
2850
  createdBy?: string;
2939
2851
  status: AgentRunStatus;
@@ -2949,22 +2861,129 @@ interface AgentRun {
2949
2861
  startedAt?: Date;
2950
2862
  completedAt?: Date;
2951
2863
  createdAt: Date;
2864
+ sessionId?: string;
2865
+ rootRunId?: string;
2866
+ triggerId?: string;
2867
+ treeCostUsd?: number;
2868
+ effectiveSystemPrompt?: string;
2869
+ }
2870
+ interface AgentSession {
2871
+ id: string;
2872
+ tenantId: string;
2873
+ mode: AgentSessionMode;
2874
+ status: AgentSessionStatus;
2875
+ definitionId?: string;
2876
+ inlineConfig?: AgentConfig;
2877
+ parentSessionId?: string;
2878
+ rootSessionId: string;
2879
+ depth: number;
2880
+ missionPrompt?: string;
2881
+ treeCostUsd: number;
2882
+ name?: string;
2883
+ metadata?: Record<string, unknown>;
2884
+ createdBy?: string;
2885
+ createdAt: Date;
2886
+ updatedAt: Date;
2887
+ completedAt?: Date;
2888
+ expiresAt?: Date;
2889
+ }
2890
+ /**
2891
+ * Persisted message in an agent session.
2892
+ * Unified type for both interactive and autonomous sessions.
2893
+ */
2894
+ interface AgentSessionMessage {
2895
+ id: string;
2896
+ sessionId: string;
2897
+ tenantId?: string;
2898
+ runId?: string;
2899
+ role: "user" | "assistant" | "system" | "tool";
2900
+ content: string;
2901
+ attachments?: AgentMessageAttachment[];
2902
+ mentions?: MentionReference[];
2903
+ toolCalls?: AgentToolCall[];
2904
+ model?: ModelDefinition;
2905
+ reasoning?: string;
2906
+ tokenUsage?: {
2907
+ input: number;
2908
+ output: number;
2909
+ };
2910
+ createdAt: Date;
2911
+ }
2912
+ interface AgentToolCall {
2913
+ id: string;
2914
+ name: string;
2915
+ arguments: Record<string, unknown>;
2916
+ result?: unknown;
2917
+ error?: string;
2918
+ durationMs?: number;
2952
2919
  }
2953
- interface AgentRunContextEntry {
2920
+ interface AgentContextEntry {
2954
2921
  id: string;
2955
2922
  rootRunId: string;
2956
2923
  runId: string;
2957
- depth: number;
2958
- content: string;
2924
+ namespace: string;
2925
+ key: string;
2926
+ value: unknown;
2927
+ createdAt: Date;
2928
+ updatedAt: Date;
2929
+ }
2930
+ interface AgentQuestion {
2931
+ id: string;
2932
+ runId: string;
2933
+ sessionId?: string;
2934
+ tenantId: string;
2935
+ question: string;
2936
+ options?: string[];
2937
+ metadata?: Record<string, unknown>;
2938
+ status: QuestionStatus;
2939
+ response?: QuestionResponse;
2940
+ timeoutPolicy?: TimeoutPolicy;
2959
2941
  createdAt: Date;
2942
+ answeredAt?: Date;
2943
+ expiresAt?: Date;
2944
+ }
2945
+ interface QuestionResponse {
2946
+ answer: unknown;
2947
+ answeredBy?: string;
2948
+ source: "user" | "auto_decide" | "timeout";
2960
2949
  }
2961
- interface AgentEvent {
2950
+ interface RecordAgentEvent {
2962
2951
  type: AgentTriggerType;
2963
2952
  objectId: string;
2964
2953
  recordId: string;
2965
2954
  tenantId: string;
2966
2955
  data?: Record<string, unknown>;
2967
2956
  }
2957
+ interface WorkflowCompletedAgentEvent {
2958
+ type: "workflow.completed";
2959
+ tenantId: string;
2960
+ workflowId: string;
2961
+ workflowName: string;
2962
+ workflowDescription?: string;
2963
+ workflowInstanceId: string;
2964
+ startedBy: string;
2965
+ createdRecordIds: string[];
2966
+ targetRecordIds: string[];
2967
+ slotRecordIds: Record<string, string>;
2968
+ data: {
2969
+ workflowId: string;
2970
+ workflowName: string;
2971
+ workflowDescription?: string;
2972
+ workflowInstanceId: string;
2973
+ startedBy: string;
2974
+ createdRecordIds: string[];
2975
+ targetRecordIds: string[];
2976
+ slotRecordIds: Record<string, string>;
2977
+ context: Record<string, unknown>;
2978
+ slots: Record<string, Record<string, unknown>>;
2979
+ forms: Record<string, Record<string, unknown>>;
2980
+ documents: Record<string, unknown>;
2981
+ variables: Record<string, unknown>;
2982
+ conditionResults: Record<string, boolean>;
2983
+ relationBuffers: Record<string, unknown>;
2984
+ };
2985
+ }
2986
+ type AgentEvent = RecordAgentEvent | WorkflowCompletedAgentEvent;
2968
2987
  interface AgentDashboard {
2969
2988
  activeRuns: number;
2970
2989
  pendingRuns: number;
@@ -3034,8 +3053,14 @@ interface Document extends Timestamps {
3034
3053
  /** Display title */
3035
3054
  title: string;
3036
3055
  description?: string;
3056
+ /** Primary business classification for the document */
3057
+ documentType?: string;
3037
3058
  /** Tags for categorization and search */
3038
3059
  tags: string[];
3060
+ /** Business date carried by the document (issue date, invoice date, etc.) */
3061
+ documentDate?: Date | null;
3062
+ /** Date until which the document is considered valid */
3063
+ validUntil?: Date | null;
3039
3064
  /** Hash of all slot file contents for deduplication */
3040
3065
  contentHash?: string;
3041
3066
  /** PostgreSQL tsvector for full-text search */
@@ -3055,21 +3080,20 @@ interface Document extends Timestamps {
3055
3080
  * - `processing`: One or more jobs running
3056
3081
  * - `completed`: All jobs completed successfully
3057
3082
  * - `failed`: At least one job failed
3058
- * - `signed`: Signature workflow completed
3059
3083
  */
3060
- type DocumentStatus = "draft" | "pending" | "processing" | "completed" | "failed" | "signed";
3084
+ type DocumentStatus = "draft" | "pending" | "processing" | "completed" | "failed";
3061
3085
  /**
3062
3086
  * DocumentSlot represents a single file within a document.
3063
3087
  *
3064
- * Each slot corresponds to a slot definition in the template,
3088
+ * Each slot corresponds to a named file position within the document,
3065
3089
  * or is marked as "additional" for extra files.
3066
3090
  */
3067
3091
  interface DocumentSlot extends Timestamps {
3068
3092
  id: Uuid;
3069
3093
  documentId: Uuid;
3070
- /** Slot name from template definition */
3094
+ /** Logical slot name within the document */
3071
3095
  slotName: string;
3072
- /** True if this is an additional file beyond template slots */
3096
+ /** True if this is an extra file beyond the document's standard slots */
3073
3097
  isAdditional: boolean;
3074
3098
  /** Reference to the uploaded file */
3075
3099
  fileId: Uuid;
@@ -3087,7 +3111,7 @@ type SlotStatus = "uploaded" | "processing" | "completed" | "failed";
3087
3111
  /**
3088
3112
  * ProcessingJob tracks an async processing task for a document.
3089
3113
  *
3090
- * Jobs are created for OCR, identity verification, or signature requests.
3114
+ * Jobs are created for OCR and agent-compatible document enrichment tasks.
3091
3115
  * They can be document-level or slot-level.
3092
3116
  */
3093
3117
  interface ProcessingJob extends Timestamps {
@@ -3112,22 +3136,26 @@ interface ProcessingJob extends Timestamps {
3112
3136
  startedAt?: Date | null;
3113
3137
  /** When processing completed */
3114
3138
  completedAt?: Date | null;
3115
- /** Expiration time (for signature requests) */
3116
- expiresAt?: Date | null;
3117
3139
  /** User who initiated the job */
3118
3140
  createdBy?: Uuid;
3119
3141
  }
3120
- type ProcessingJobType = "ocr" | "identity_verification" | "signature";
3142
+ type ProcessingJobType = "ocr";
3121
3143
  type ProcessingJobStatus = "pending" | "processing" | "completed" | "failed" | "cancelled";
3122
3144
  interface CreateDocument {
3123
3145
  title: string;
3124
3146
  description?: string;
3147
+ documentType?: string;
3125
3148
  tags?: string[];
3149
+ documentDate?: Date;
3150
+ validUntil?: Date;
3126
3151
  }
3127
3152
  interface UpdateDocument {
3128
3153
  title?: string;
3129
3154
  description?: string;
3155
+ documentType?: string | null;
3130
3156
  tags?: string[];
3157
+ documentDate?: Date | null;
3158
+ validUntil?: Date | null;
3131
3159
  status?: DocumentStatus;
3132
3160
  }
3133
3161
  interface CreateDocumentSlot {
@@ -3147,7 +3175,6 @@ interface CreateProcessingJob {
3147
3175
  type: ProcessingJobType;
3148
3176
  provider: string;
3149
3177
  input?: Record<string, unknown>;
3150
- expiresAt?: Date;
3151
3178
  }
3152
3179
  interface UpdateProcessingJob {
3153
3180
  status?: ProcessingJobStatus;
@@ -3160,7 +3187,10 @@ interface DocumentListOptions {
3160
3187
  limit?: number;
3161
3188
  offset?: number;
3162
3189
  status?: DocumentStatus;
3190
+ documentType?: string;
3163
3191
  tags?: string[];
3192
+ validUntilBefore?: Date;
3193
+ validUntilAfter?: Date;
3164
3194
  }
3165
3195
 
3166
3196
  /**
@@ -3507,7 +3537,7 @@ type CustomAttributeValue = Exclude<Attribute, FormulaAttribute | RollupAttribut
3507
3537
  * Adds support for custom attributes (added via UI) to a record type
3508
3538
  * Preserves autocompletion for known attributes while allowing additional properties
3509
3539
  */
3510
- type WithCustomAttributes<T> = T & {
3540
+ type WithCustomAttributes$1<T> = T & {
3511
3541
  [key: string]: CustomAttributeValue;
3512
3542
  };
3513
3543
  /**
@@ -3576,7 +3606,7 @@ type ExtractRecord<TBuilder> = TBuilder extends {
3576
3606
  _types: {
3577
3607
  record: infer R;
3578
3608
  };
3579
- } ? WithCustomAttributes<R> & RecordMetadata : never;
3609
+ } ? WithCustomAttributes$1<R> & RecordMetadata : never;
3580
3610
  /**
3581
3611
  * Extract the record type without custom attributes (strict mode)
3582
3612
  * Use this when you only want the defined attributes
@@ -3596,7 +3626,7 @@ type ExtractRecordInput<TBuilder> = TBuilder extends {
3596
3626
  _types: {
3597
3627
  input: infer R;
3598
3628
  };
3599
- } ? Omit<WithCustomAttributes<R>, SystemFields> : never;
3629
+ } ? Omit<WithCustomAttributes$1<R>, SystemFields> : never;
3600
3630
  /**
3601
3631
  * Extract the input type without custom attributes (strict mode)
3602
3632
  * Omits system fields (id, createdAt, updatedAt) as they are managed automatically.
@@ -3615,7 +3645,7 @@ type ExtractRecordUpdate<TBuilder> = TBuilder extends {
3615
3645
  _types: {
3616
3646
  update: infer R;
3617
3647
  };
3618
- } ? Omit<WithCustomAttributes<R>, SystemFields> : never;
3648
+ } ? Omit<WithCustomAttributes$1<R>, SystemFields> : never;
3619
3649
  /**
3620
3650
  * Extract the update type without custom attributes (strict mode)
3621
3651
  * Omits system fields (id, createdAt, updatedAt) as they are managed automatically.
@@ -3683,240 +3713,9 @@ type ExtractObjectRecord<TBuilder> = TBuilder extends {
3683
3713
  */
3684
3714
  type ExtractObjectRecordWithCustom<TBuilder> = TBuilder extends {
3685
3715
  _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.
3899
- */
3900
- interface CreatePermissionInput {
3901
- scope: PermissionScope;
3902
- target: string;
3903
- /**
3904
- * Actions allowed on the target.
3905
- */
3906
- actions: Action[];
3907
- }
3908
- /**
3909
- * Input for assigning a role to a user.
3910
- */
3911
- interface AssignRoleInput {
3912
- /**
3913
- * User profile ID (UserProfile.id).
3914
- */
3915
- userProfileId: Uuid;
3916
- roleId: Uuid;
3917
- tenantId: Uuid;
3918
- assignedBy?: Uuid;
3919
- }
3716
+ record: infer R;
3717
+ };
3718
+ } ? TypedObjectRecord<R extends Record<string, unknown> ? WithCustomAttributes$1<R> : Record<string, CustomAttributeValue>> : never;
3920
3719
 
3921
3720
  /**
3922
3721
  * Context passed to policy methods
@@ -4482,6 +4281,51 @@ declare function parseRawPhoneInput(rawInput: string, countryIso3: CountryIso3):
4482
4281
  */
4483
4282
  declare function applyRelationProps(label: string, props: Record<string, unknown> | undefined, propertyDefs: Attribute[] | undefined): string;
4484
4283
 
4284
+ /**
4285
+ * Valid simple pipe names (no arguments)
4286
+ */
4287
+ declare const SIMPLE_PIPES: readonly ["UPPER", "LOWER", "capitalize", "trim"];
4288
+ /**
4289
+ * Valid pipe names that take arguments
4290
+ */
4291
+ declare const PIPES_WITH_ARGS: readonly ["prefix", "suffix", "wrap", "default"];
4292
+ /**
4293
+ * All valid pipe names
4294
+ */
4295
+ declare const ALL_PIPES: readonly ["UPPER", "LOWER", "capitalize", "trim", "prefix", "suffix", "wrap", "default"];
4296
+ type SimplePipe = (typeof SIMPLE_PIPES)[number];
4297
+ type PipeWithArgs = (typeof PIPES_WITH_ARGS)[number];
4298
+ type LabelPipe = (typeof ALL_PIPES)[number];
4299
+ /**
4300
+ * Zod schema for validating labelExpression templates.
4301
+ *
4302
+ * Validates the syntax of label expression templates used throughout the system.
4303
+ * Uses the existing `isLabelExpression` function for basic validation, then
4304
+ * performs additional checks for pipe validity.
4305
+ *
4306
+ * @example Valid expressions:
4307
+ * ```typescript
4308
+ * "{{ name }}"
4309
+ * "{{ firstName }} {{ lastName }}"
4310
+ * "{{ name | UPPER }}"
4311
+ * "{{ role | prefix:\", \" }}"
4312
+ * "{{ firstName || name }}"
4313
+ * "{{ user.firstName }}"
4314
+ * ```
4315
+ */
4316
+ declare const labelExpressionSchema: z.ZodString;
4317
+ type LabelExpression = z.infer<typeof labelExpressionSchema>;
4318
+ /**
4319
+ * Validate a labelExpression and return detailed result
4320
+ *
4321
+ * @param expression - The labelExpression to validate
4322
+ * @returns Validation result with success status and extracted info
4323
+ */
4324
+ declare function validateLabelExpression(expression: string): {
4325
+ success: boolean;
4326
+ error?: string;
4327
+ attributes?: string[];
4328
+ };
4485
4329
  /**
4486
4330
  * Default fallback value when expression resolves to empty string
4487
4331
  */
@@ -4606,6 +4450,7 @@ declare const SchemaErrorCode: {
4606
4450
  readonly USER_PROFILE_NOT_FOUND: "SCHEMA_USER_PROFILE_NOT_FOUND";
4607
4451
  readonly FILE_NOT_FOUND: "SCHEMA_FILE_NOT_FOUND";
4608
4452
  readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
4453
+ readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
4609
4454
  readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
4610
4455
  readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
4611
4456
  readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
@@ -4614,11 +4459,21 @@ declare const SchemaErrorCode: {
4614
4459
  readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
4615
4460
  readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
4616
4461
  readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
4462
+ readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
4617
4463
  readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
4618
4464
  readonly NOT_SYSTEM_OBJECT: "SCHEMA_NOT_SYSTEM_OBJECT";
4619
4465
  readonly DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT";
4620
4466
  readonly DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE";
4621
4467
  readonly CONFLICT: "SCHEMA_CONFLICT";
4468
+ readonly STORAGE_UPLOAD_FAILED: "SCHEMA_STORAGE_UPLOAD_FAILED";
4469
+ readonly STORAGE_DOWNLOAD_FAILED: "SCHEMA_STORAGE_DOWNLOAD_FAILED";
4470
+ readonly STORAGE_DELETE_FAILED: "SCHEMA_STORAGE_DELETE_FAILED";
4471
+ readonly STORAGE_URL_FAILED: "SCHEMA_STORAGE_URL_FAILED";
4472
+ readonly REPOSITORY_CREATE_FAILED: "SCHEMA_REPOSITORY_CREATE_FAILED";
4473
+ readonly REPOSITORY_UPDATE_FAILED: "SCHEMA_REPOSITORY_UPDATE_FAILED";
4474
+ readonly REPOSITORY_DELETE_FAILED: "SCHEMA_REPOSITORY_DELETE_FAILED";
4475
+ readonly REPOSITORY_QUERY_FAILED: "SCHEMA_REPOSITORY_QUERY_FAILED";
4476
+ readonly NOT_IMPLEMENTED: "SCHEMA_NOT_IMPLEMENTED";
4622
4477
  };
4623
4478
  type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
4624
4479
  /**
@@ -4778,6 +4633,70 @@ declare function isForbiddenError(error: unknown): error is ForbiddenError;
4778
4633
  declare class ConcurrentModificationError extends SchemaError {
4779
4634
  constructor(recordId: string);
4780
4635
  }
4636
+ /**
4637
+ * Storage operation type for error context
4638
+ */
4639
+ type StorageOperation = "upload" | "download" | "delete" | "signedUrl";
4640
+ /**
4641
+ * Error thrown when a storage operation fails
4642
+ */
4643
+ declare class StorageError extends SchemaError {
4644
+ readonly operation: StorageOperation;
4645
+ readonly path?: string;
4646
+ readonly cause?: string;
4647
+ constructor(operation: StorageOperation, message: string, path?: string, cause?: string);
4648
+ }
4649
+ /**
4650
+ * Check if an error is a StorageError
4651
+ */
4652
+ declare function isStorageError(error: unknown): error is StorageError;
4653
+ /**
4654
+ * Error thrown when access to a resource is denied (e.g., tenant path mismatch)
4655
+ */
4656
+ declare class AccessDeniedError extends SchemaError {
4657
+ readonly resource: string;
4658
+ readonly reason?: string;
4659
+ constructor(resource: string, reason?: string);
4660
+ }
4661
+ /**
4662
+ * Check if an error is an AccessDeniedError
4663
+ */
4664
+ declare function isAccessDeniedError(error: unknown): error is AccessDeniedError;
4665
+ /**
4666
+ * Repository operation type for error context
4667
+ */
4668
+ type RepositoryOperation = "create" | "update" | "delete" | "query";
4669
+ /**
4670
+ * Error thrown when a repository operation fails
4671
+ */
4672
+ declare class RepositoryError extends SchemaError {
4673
+ readonly operation: RepositoryOperation;
4674
+ readonly entity: string;
4675
+ readonly cause?: string;
4676
+ constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
4677
+ }
4678
+ /**
4679
+ * Check if an error is a RepositoryError
4680
+ */
4681
+ declare function isRepositoryError(error: unknown): error is RepositoryError;
4682
+ /**
4683
+ * Error thrown when a feature or method is not yet implemented
4684
+ */
4685
+ declare class NotImplementedError extends SchemaError {
4686
+ readonly feature: string;
4687
+ readonly milestone?: string;
4688
+ constructor(feature: string, milestone?: string);
4689
+ }
4690
+ /**
4691
+ * Check if an error is a NotImplementedError
4692
+ */
4693
+ declare function isNotImplementedError(error: unknown): error is NotImplementedError;
4694
+ /**
4695
+ * Memory entry not found error
4696
+ */
4697
+ declare class MemoryNotFoundError extends NotFoundError {
4698
+ constructor(memoryId: string);
4699
+ }
4781
4700
 
4782
4701
  /**
4783
4702
  * Builder config with literal name type preservation
@@ -4788,11 +4707,54 @@ interface TypedBuilderConfig<TName extends string> extends BuilderConfig {
4788
4707
  /**
4789
4708
  * Base attribute builder
4790
4709
  * Type tracking is done via the `_types` phantom property
4710
+ *
4711
+ * Implements Standard Schema v1 interface via the `~standard` property.
4712
+ * @see https://standardschema.dev/
4791
4713
  */
4792
- declare abstract class BaseAttributeBuilder<TAttr extends Attribute> {
4714
+ declare abstract class BaseAttributeBuilder<TAttr extends Attribute> implements StandardSchemaV1<unknown, unknown> {
4793
4715
  protected attr: Partial<TAttr>;
4716
+ /**
4717
+ * Standard Schema v1 interface implementation.
4718
+ *
4719
+ * This property enables interoperability with libraries that support
4720
+ * Standard Schema (React Hook Form, tRPC, etc.).
4721
+ *
4722
+ * @see https://standardschema.dev/
4723
+ */
4724
+ get "~standard"(): StandardSchemaV1.Props<unknown, unknown>;
4794
4725
  constructor(type: TAttr["type"], name: string, label: string);
4795
4726
  protected setRequired(value: boolean): void;
4727
+ /**
4728
+ * Type-safe method to return this builder with a different TRequired phantom type.
4729
+ *
4730
+ * This method centralizes the type assertion needed when transitioning between
4731
+ * required states. The assertion is safe because:
4732
+ * 1. The runtime representation is unchanged (same instance)
4733
+ * 2. Only the phantom _types.required property differs
4734
+ * 3. The class structure and all methods remain identical
4735
+ *
4736
+ * Using a single protected method for this pattern:
4737
+ * - Reduces scattered unsafe casts throughout the codebase
4738
+ * - Documents the safety reasoning in one place
4739
+ * - Makes the type transition explicit and auditable
4740
+ *
4741
+ * @internal
4742
+ */
4743
+ protected asRequiredState<TBuilder>(this: BaseAttributeBuilder<TAttr>): TBuilder;
4744
+ /**
4745
+ * Type-safe method to return this builder with different phantom type parameters.
4746
+ *
4747
+ * Used by builders with additional type parameters (like TOptions in Status/Select/Multiselect)
4748
+ * when those parameters need to change while preserving the builder instance.
4749
+ *
4750
+ * The assertion is safe because:
4751
+ * 1. The runtime representation is unchanged (same instance)
4752
+ * 2. Only phantom type parameters differ
4753
+ * 3. The class structure and all methods remain identical
4754
+ *
4755
+ * @internal
4756
+ */
4757
+ protected asPhantomState<TBuilder>(this: BaseAttributeBuilder<TAttr>): TBuilder;
4796
4758
  system(): this;
4797
4759
  disabled(): this;
4798
4760
  hidden(): this;
@@ -4835,6 +4797,25 @@ declare class TextAttributeBuilder<TName extends string, TRequired extends boole
4835
4797
  attribute: TextAttribute;
4836
4798
  required: TRequired;
4837
4799
  };
4800
+ /**
4801
+ * Drizzle-style static type inference property.
4802
+ * Provides direct access to inferred types without utility type imports.
4803
+ *
4804
+ * @example
4805
+ * ```typescript
4806
+ * const nameAttr = text({ name: "name", label: "Name" }).required();
4807
+ *
4808
+ * // Zero-import type inference! ✨
4809
+ * type NameValue = typeof nameAttr.$infer.value; // string
4810
+ * type NameDef = typeof nameAttr.$infer.definition; // TextAttribute
4811
+ * ```
4812
+ */
4813
+ readonly $infer: {
4814
+ /** The runtime value type for this attribute */
4815
+ value: string;
4816
+ /** The full attribute definition type */
4817
+ definition: TextAttribute;
4818
+ };
4838
4819
  constructor(name: TName, label: string);
4839
4820
  minLength(value: number): this;
4840
4821
  maxLength(value: number): this;
@@ -4864,6 +4845,16 @@ declare class TextAreaAttributeBuilder<TName extends string, TRequired extends b
4864
4845
  attribute: TextAreaAttribute;
4865
4846
  required: TRequired;
4866
4847
  };
4848
+ /**
4849
+ * Drizzle-style static type inference property.
4850
+ * @see TextAttributeBuilder.$infer for documentation
4851
+ */
4852
+ readonly $infer: {
4853
+ /** The runtime value type for this attribute */
4854
+ value: string;
4855
+ /** The full attribute definition type */
4856
+ definition: TextAreaAttribute;
4857
+ };
4867
4858
  constructor(name: TName, label: string);
4868
4859
  required(): TextAreaAttributeBuilder<TName, true>;
4869
4860
  optional(): TextAreaAttributeBuilder<TName, false>;
@@ -4878,6 +4869,16 @@ declare class RichtextAttributeBuilder<TName extends string, TRequired extends b
4878
4869
  attribute: RichtextAttribute;
4879
4870
  required: TRequired;
4880
4871
  };
4872
+ /**
4873
+ * Drizzle-style static type inference property.
4874
+ * @see TextAttributeBuilder.$infer for documentation
4875
+ */
4876
+ readonly $infer: {
4877
+ /** The runtime value type for this attribute (semantic markdown string) */
4878
+ value: string;
4879
+ /** The full attribute definition type */
4880
+ definition: RichtextAttribute;
4881
+ };
4881
4882
  constructor(name: TName, label: string);
4882
4883
  /**
4883
4884
  * Set enabled features for the richtext editor
@@ -4925,6 +4926,16 @@ declare class NumberAttributeBuilder<TName extends string, TRequired extends boo
4925
4926
  attribute: NumberAttribute;
4926
4927
  required: TRequired;
4927
4928
  };
4929
+ /**
4930
+ * Drizzle-style static type inference property.
4931
+ * @see TextAttributeBuilder.$infer for documentation
4932
+ */
4933
+ readonly $infer: {
4934
+ /** The runtime value type for this attribute */
4935
+ value: number;
4936
+ /** The full attribute definition type */
4937
+ definition: NumberAttribute;
4938
+ };
4928
4939
  constructor(name: TName, label: string);
4929
4940
  min(value: number): this;
4930
4941
  max(value: number): this;
@@ -4941,6 +4952,16 @@ declare class CheckboxAttributeBuilder<TName extends string, TRequired extends b
4941
4952
  attribute: CheckboxAttribute;
4942
4953
  required: TRequired;
4943
4954
  };
4955
+ /**
4956
+ * Drizzle-style static type inference property.
4957
+ * @see TextAttributeBuilder.$infer for documentation
4958
+ */
4959
+ readonly $infer: {
4960
+ /** The runtime value type for this attribute */
4961
+ value: boolean;
4962
+ /** The full attribute definition type */
4963
+ definition: CheckboxAttribute;
4964
+ };
4944
4965
  constructor(name: TName, label: string);
4945
4966
  required(): CheckboxAttributeBuilder<TName, true>;
4946
4967
  optional(): CheckboxAttributeBuilder<TName, false>;
@@ -4952,6 +4973,16 @@ declare class DateAttributeBuilder<TName extends string, TRequired extends boole
4952
4973
  attribute: DateAttribute;
4953
4974
  required: TRequired;
4954
4975
  };
4976
+ /**
4977
+ * Drizzle-style static type inference property.
4978
+ * @see TextAttributeBuilder.$infer for documentation
4979
+ */
4980
+ readonly $infer: {
4981
+ /** The runtime value type for this attribute (ISO string or Date) */
4982
+ value: string | Date;
4983
+ /** The full attribute definition type */
4984
+ definition: DateAttribute;
4985
+ };
4955
4986
  constructor(name: TName, label: string);
4956
4987
  format(value: DateAttribute["dateFormat"]): this;
4957
4988
  minDate(value: DateAttribute["minDate"]): this;
@@ -4966,6 +4997,16 @@ declare class PhoneAttributeBuilder<TName extends string, TRequired extends bool
4966
4997
  attribute: PhoneAttribute;
4967
4998
  required: TRequired;
4968
4999
  };
5000
+ /**
5001
+ * Drizzle-style static type inference property.
5002
+ * @see TextAttributeBuilder.$infer for documentation
5003
+ */
5004
+ readonly $infer: {
5005
+ /** The runtime value type for this attribute */
5006
+ value: Phone;
5007
+ /** The full attribute definition type */
5008
+ definition: PhoneAttribute;
5009
+ };
4969
5010
  constructor(name: TName, label: string);
4970
5011
  defaultCountry(value: CountryIso3): this;
4971
5012
  required(): PhoneAttributeBuilder<TName, true>;
@@ -4978,6 +5019,16 @@ declare class CurrencyAttributeBuilder<TName extends string, TRequired extends b
4978
5019
  attribute: CurrencyAttribute;
4979
5020
  required: TRequired;
4980
5021
  };
5022
+ /**
5023
+ * Drizzle-style static type inference property.
5024
+ * @see TextAttributeBuilder.$infer for documentation
5025
+ */
5026
+ readonly $infer: {
5027
+ /** The runtime value type for this attribute */
5028
+ value: Currency;
5029
+ /** The full attribute definition type */
5030
+ definition: CurrencyAttribute;
5031
+ };
4981
5032
  constructor(name: TName, label: string);
4982
5033
  defaultCurrency(value: CurrencyCode): this;
4983
5034
  allowedCurrencies(value: CurrencyCode[]): this;
@@ -4993,6 +5044,18 @@ declare class StatusAttributeBuilder<TName extends string, TOptions extends read
4993
5044
  };
4994
5045
  required: TRequired;
4995
5046
  };
5047
+ /**
5048
+ * Drizzle-style static type inference property.
5049
+ * @see TextAttributeBuilder.$infer for documentation
5050
+ */
5051
+ readonly $infer: {
5052
+ /** The runtime value type for this attribute (union of option values) */
5053
+ value: TOptions[number]["value"];
5054
+ /** The full attribute definition type */
5055
+ definition: StatusAttribute & {
5056
+ options: TOptions;
5057
+ };
5058
+ };
4996
5059
  constructor(name: TName, label: string);
4997
5060
  /**
4998
5061
  * Set all options at once (preserves literal types for values)
@@ -5011,6 +5074,18 @@ declare class SelectAttributeBuilder<TName extends string, TOptions extends read
5011
5074
  };
5012
5075
  required: TRequired;
5013
5076
  };
5077
+ /**
5078
+ * Drizzle-style static type inference property.
5079
+ * @see TextAttributeBuilder.$infer for documentation
5080
+ */
5081
+ readonly $infer: {
5082
+ /** The runtime value type for this attribute (union of option values) */
5083
+ value: TOptions[number]["value"];
5084
+ /** The full attribute definition type */
5085
+ definition: SelectAttribute & {
5086
+ options: TOptions;
5087
+ };
5088
+ };
5014
5089
  constructor(name: TName, label: string);
5015
5090
  /**
5016
5091
  * Set all options at once (preserves literal types for values)
@@ -5029,6 +5104,18 @@ declare class MultiselectAttributeBuilder<TName extends string, TOptions extends
5029
5104
  };
5030
5105
  required: TRequired;
5031
5106
  };
5107
+ /**
5108
+ * Drizzle-style static type inference property.
5109
+ * @see TextAttributeBuilder.$infer for documentation
5110
+ */
5111
+ readonly $infer: {
5112
+ /** The runtime value type for this attribute (array of option values) */
5113
+ value: TOptions[number]["value"][];
5114
+ /** The full attribute definition type */
5115
+ definition: MultiselectAttribute & {
5116
+ options: TOptions;
5117
+ };
5118
+ };
5032
5119
  constructor(name: TName, label: string);
5033
5120
  /**
5034
5121
  * Set all options at once (preserves literal types for values)
@@ -5045,6 +5132,16 @@ declare class LocationAttributeBuilder<TName extends string, TRequired extends b
5045
5132
  attribute: LocationAttribute;
5046
5133
  required: TRequired;
5047
5134
  };
5135
+ /**
5136
+ * Drizzle-style static type inference property.
5137
+ * @see TextAttributeBuilder.$infer for documentation
5138
+ */
5139
+ readonly $infer: {
5140
+ /** The runtime value type for this attribute */
5141
+ value: Location;
5142
+ /** The full attribute definition type */
5143
+ definition: LocationAttribute;
5144
+ };
5048
5145
  constructor(name: TName, label: string);
5049
5146
  granularity(value: LocationAttribute["granularity"]): this;
5050
5147
  enableAutocomplete(): this;
@@ -5062,6 +5159,16 @@ declare class FileAttributeBuilder<TName extends string, TRequired extends boole
5062
5159
  attribute: FileAttribute;
5063
5160
  required: TRequired;
5064
5161
  };
5162
+ /**
5163
+ * Drizzle-style static type inference property.
5164
+ * @see TextAttributeBuilder.$infer for documentation
5165
+ */
5166
+ readonly $infer: {
5167
+ /** The runtime value type for this attribute (file ID) */
5168
+ value: string;
5169
+ /** The full attribute definition type */
5170
+ definition: FileAttribute;
5171
+ };
5065
5172
  constructor(name: TName, label: string);
5066
5173
  maxFiles(value: number): this;
5067
5174
  maxSize(bytes: number): this;
@@ -5080,6 +5187,16 @@ declare class UserAttributeBuilder<TName extends string, TRequired extends boole
5080
5187
  attribute: UserAttribute;
5081
5188
  required: TRequired;
5082
5189
  };
5190
+ /**
5191
+ * Drizzle-style static type inference property.
5192
+ * @see TextAttributeBuilder.$infer for documentation
5193
+ */
5194
+ readonly $infer: {
5195
+ /** The runtime value type for this attribute (user ID) */
5196
+ value: string;
5197
+ /** The full attribute definition type */
5198
+ definition: UserAttribute;
5199
+ };
5083
5200
  constructor(name: TName, label: string);
5084
5201
  allowedRoles(roles: string[]): this;
5085
5202
  /**
@@ -5157,6 +5274,16 @@ declare class SingleRelationAttributeBuilder<TName extends string, TRequired ext
5157
5274
  attribute: SingleRelationAttribute;
5158
5275
  required: TRequired;
5159
5276
  };
5277
+ /**
5278
+ * Drizzle-style static type inference property.
5279
+ * @see TextAttributeBuilder.$infer for documentation
5280
+ */
5281
+ readonly $infer: {
5282
+ /** The runtime value type for this attribute (record ID) */
5283
+ value: string;
5284
+ /** The full attribute definition type */
5285
+ definition: SingleRelationAttribute;
5286
+ };
5160
5287
  constructor(name: TName, label: string);
5161
5288
  /**
5162
5289
  * Convert to a multi-relation (cardinality: "many")
@@ -5174,6 +5301,16 @@ declare class MultiRelationAttributeBuilder<TName extends string, TRequired exte
5174
5301
  attribute: MultiRelationAttribute;
5175
5302
  required: TRequired;
5176
5303
  };
5304
+ /**
5305
+ * Drizzle-style static type inference property.
5306
+ * @see TextAttributeBuilder.$infer for documentation
5307
+ */
5308
+ readonly $infer: {
5309
+ /** The runtime value type for this attribute (array of record IDs) */
5310
+ value: string[];
5311
+ /** The full attribute definition type */
5312
+ definition: MultiRelationAttribute;
5313
+ };
5177
5314
  constructor(name: TName, label: string, initOptions?: RelationBuilderInitOptions);
5178
5315
  /**
5179
5316
  * Set minimum number of relations required
@@ -5221,6 +5358,16 @@ declare class RatingAttributeBuilder<TName extends string, TRequired extends boo
5221
5358
  attribute: RatingAttribute;
5222
5359
  required: TRequired;
5223
5360
  };
5361
+ /**
5362
+ * Drizzle-style static type inference property.
5363
+ * @see TextAttributeBuilder.$infer for documentation
5364
+ */
5365
+ readonly $infer: {
5366
+ /** The runtime value type for this attribute */
5367
+ value: number;
5368
+ /** The full attribute definition type */
5369
+ definition: RatingAttribute;
5370
+ };
5224
5371
  constructor(name: TName, label: string);
5225
5372
  max(value: number): this;
5226
5373
  iconType(value: RatingAttribute["iconType"]): this;
@@ -5239,6 +5386,16 @@ declare class FormulaAttributeBuilder<TName extends string> extends BaseAttribut
5239
5386
  attribute: FormulaAttribute;
5240
5387
  required: false;
5241
5388
  };
5389
+ /**
5390
+ * Drizzle-style static type inference property.
5391
+ * @see TextAttributeBuilder.$infer for documentation
5392
+ */
5393
+ readonly $infer: {
5394
+ /** The runtime value type for this attribute (computed, type depends on returnType) */
5395
+ value: unknown;
5396
+ /** The full attribute definition type */
5397
+ definition: FormulaAttribute;
5398
+ };
5242
5399
  constructor(name: TName, label: string);
5243
5400
  /**
5244
5401
  * Set the formula expression
@@ -5287,6 +5444,16 @@ declare class RollupAttributeBuilder<TName extends string> extends BaseAttribute
5287
5444
  attribute: RollupAttribute;
5288
5445
  required: false;
5289
5446
  };
5447
+ /**
5448
+ * Drizzle-style static type inference property.
5449
+ * @see TextAttributeBuilder.$infer for documentation
5450
+ */
5451
+ readonly $infer: {
5452
+ /** The runtime value type for this attribute (aggregated, type depends on function) */
5453
+ value: unknown;
5454
+ /** The full attribute definition type */
5455
+ definition: RollupAttribute;
5456
+ };
5290
5457
  constructor(name: TName, label: string);
5291
5458
  /**
5292
5459
  * Set the relation attribute to aggregate from
@@ -5364,14 +5531,13 @@ declare function rollup<TName extends string>(config: TypedBuilderConfig<TName>)
5364
5531
  * Builder for document attributes.
5365
5532
  *
5366
5533
  * Documents are structured wrappers around files that support:
5367
- * - Multi-file templates (e.g., ID card recto/verso)
5368
- * - Automatic processing (OCR, signature, identity verification)
5369
- * - Template constraints
5534
+ * - Multiple files for a single logical document
5535
+ * - Agent-compatible processing (for example OCR)
5536
+ * - Field-level constraints
5370
5537
  *
5371
- * @example Single document with template choice
5538
+ * @example Single document
5372
5539
  * ```typescript
5373
5540
  * document({ name: "identityDocument", label: "Pièce d'identité" })
5374
- * .templates(["french_id_card", "passport"])
5375
5541
  * .autoProcess()
5376
5542
  * .required()
5377
5543
  * ```
@@ -5389,6 +5555,16 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
5389
5555
  attribute: DocumentAttribute;
5390
5556
  required: TRequired;
5391
5557
  };
5558
+ /**
5559
+ * Drizzle-style static type inference property.
5560
+ * @see TextAttributeBuilder.$infer for documentation
5561
+ */
5562
+ readonly $infer: {
5563
+ /** The runtime value type for this attribute (document ID or array of IDs) */
5564
+ value: string | string[];
5565
+ /** The full attribute definition type */
5566
+ definition: DocumentAttribute;
5567
+ };
5392
5568
  constructor(name: TName, label: string);
5393
5569
  /**
5394
5570
  * Allow multiple documents.
@@ -5400,8 +5576,7 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
5400
5576
  */
5401
5577
  maxDocuments(count: number): this;
5402
5578
  /**
5403
- * Automatically trigger processing on upload.
5404
- * Processing is defined by the template's autoProcessing config.
5579
+ * Automatically trigger agent-compatible processing on upload.
5405
5580
  */
5406
5581
  autoProcess(): this;
5407
5582
  /**
@@ -5419,7 +5594,6 @@ declare class DocumentAttributeBuilder<TName extends string, TRequired extends b
5419
5594
  * @example
5420
5595
  * ```typescript
5421
5596
  * document({ name: "identityDocument", label: "Pièce d'identité" })
5422
- * .templates(["french_id_card", "passport"])
5423
5597
  * .autoProcess()
5424
5598
  * .required()
5425
5599
  * ```
@@ -5545,12 +5719,18 @@ type WithRequiredAttr<TRecord extends Record<string, unknown>, TName extends str
5545
5719
  type WithOptionalAttr<TRecord extends Record<string, unknown>, TName extends string, TValue> = Flatten<Omit<TRecord, TName> & {
5546
5720
  [K in TName]?: TValue;
5547
5721
  }>;
5722
+ /**
5723
+ * Add support for custom attributes (added via UI) to a record type
5724
+ */
5725
+ type WithCustomAttributes<T> = T & {
5726
+ [key: string]: CustomAttributeValue;
5727
+ };
5548
5728
  /**
5549
5729
  * Add an attribute to the accumulated record type
5550
5730
  */
5551
5731
  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
5732
  /**
5553
- * Fluent builder for creating ObjectDefinition with full type inference
5733
+ * Fluent builder for creating ObjectDefinition with full type inference.
5554
5734
  *
5555
5735
  * The generic parameter TRecord accumulates attribute types as you chain
5556
5736
  * .attribute() calls, enabling full autocompletion on the inferred record type.
@@ -5558,6 +5738,9 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5558
5738
  * IMPORTANT: Every object MUST define a `labelExpression` to specify how records
5559
5739
  * are displayed. Use `.labelExpression("{{ name }}")` to define the display template.
5560
5740
  *
5741
+ * Implements Standard Schema v1 interface via the `~standard` property.
5742
+ * @see https://standardschema.dev/
5743
+ *
5561
5744
  * @example
5562
5745
  * ```typescript
5563
5746
  * import { object, text, number, status } from "@stndrds/schema";
@@ -5565,7 +5748,7 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5565
5748
  *
5566
5749
  * const PRODUCT = object({ name: "products", label: "Product" })
5567
5750
  * .system()
5568
- * .attribute(text({ name: "name", label: "Name" }).required()) // This becomes the title
5751
+ * .attribute(text({ name: "name", label: "Name" }).required())
5569
5752
  * .attribute(number({ name: "price", label: "Price" }).decimal(2))
5570
5753
  * .attribute(
5571
5754
  * status({ name: "status", label: "Status" })
@@ -5579,9 +5762,12 @@ type AddAttribute<TRecord extends Record<string, unknown>, TName extends string,
5579
5762
  * // Full autocompletion! ✨
5580
5763
  * type ProductRecord = ExtractRecord<typeof PRODUCT>;
5581
5764
  * // → { name: string; price?: number; status: string }
5765
+ *
5766
+ * // Standard Schema integration
5767
+ * const result = PRODUCT["~standard"].validate({ name: "Test", status: "active" });
5582
5768
  * ```
5583
5769
  */
5584
- declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
5770
+ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> implements StandardSchemaV1<unknown, Record<string, unknown>> {
5585
5771
  private obj;
5586
5772
  private _labelExpression?;
5587
5773
  private _pluralLabel?;
@@ -5597,6 +5783,41 @@ declare class ObjectBuilder<TRecord extends Record<string, unknown> = {}> {
5597
5783
  [K in keyof TRecord]?: TRecord[K];
5598
5784
  };
5599
5785
  };
5786
+ /**
5787
+ * Drizzle-style static type inference property.
5788
+ * Provides direct access to inferred types without utility type imports.
5789
+ *
5790
+ * @example
5791
+ * ```typescript
5792
+ * const PRODUCT = object({ name: "products", label: "Product" })
5793
+ * .attribute(text({ name: "name", label: "Name" }).required())
5794
+ * .attribute(number({ name: "price", label: "Price" }));
5795
+ *
5796
+ * // Zero-import type inference! ✨
5797
+ * type ProductRecord = typeof PRODUCT.$infer.record;
5798
+ * type ProductCreate = typeof PRODUCT.$infer.create;
5799
+ * type ProductUpdate = typeof PRODUCT.$infer.update;
5800
+ * ```
5801
+ */
5802
+ readonly $infer: {
5803
+ /** Full record type with custom attributes and metadata (same as ExtractRecord) */
5804
+ record: WithCustomAttributes<TRecord> & RecordMetadata;
5805
+ /** Input type for creating records, omits system fields (same as ExtractRecordInput) */
5806
+ create: Omit<WithCustomAttributes<TRecord>, SystemFields>;
5807
+ /** Partial type for updating records, omits system fields (same as ExtractRecordUpdate) */
5808
+ update: Omit<WithCustomAttributes<{
5809
+ [K in keyof TRecord]?: TRecord[K];
5810
+ }>, SystemFields>;
5811
+ };
5812
+ /**
5813
+ * Standard Schema v1 interface implementation.
5814
+ *
5815
+ * This property enables interoperability with libraries that support
5816
+ * Standard Schema (React Hook Form, tRPC, etc.).
5817
+ *
5818
+ * @see https://standardschema.dev/
5819
+ */
5820
+ get "~standard"(): StandardSchemaV1.Props<unknown, Record<string, unknown>>;
5600
5821
  constructor(config: BuilderConfig);
5601
5822
  /**
5602
5823
  * Set object description
@@ -6216,6 +6437,28 @@ declare class TabBuilder {
6216
6437
  declare class DetailViewBuilder {
6217
6438
  private data;
6218
6439
  private _version;
6440
+ /**
6441
+ * Drizzle-style static type inference property.
6442
+ * Provides direct access to inferred types without utility type imports.
6443
+ *
6444
+ * @example
6445
+ * ```typescript
6446
+ * const COMPANY_VIEW = detailView("detail", "Company Detail")
6447
+ * .for("companies")
6448
+ * .tab("general", "Info").form(group("main", "Main").fields("name"))
6449
+ * .build();
6450
+ *
6451
+ * // Zero-import type inference! ✨
6452
+ * type ViewConfig = typeof COMPANY_VIEW.$infer.config;
6453
+ * type ViewDef = typeof COMPANY_VIEW.$infer.definition;
6454
+ * ```
6455
+ */
6456
+ readonly $infer: {
6457
+ /** The view configuration type */
6458
+ config: DetailViewConfig;
6459
+ /** The full view definition type */
6460
+ definition: DetailViewDefinition;
6461
+ };
6219
6462
  constructor(name: string, label: string);
6220
6463
  /**
6221
6464
  * Set view description
@@ -6377,6 +6620,28 @@ interface ListViewTabData {
6377
6620
  declare class ListViewBuilder {
6378
6621
  private data;
6379
6622
  private _version;
6623
+ /**
6624
+ * Drizzle-style static type inference property.
6625
+ * Provides direct access to inferred types without utility type imports.
6626
+ *
6627
+ * @example
6628
+ * ```typescript
6629
+ * const CONTACTS_LIST = listView("default", "All Contacts")
6630
+ * .for("contacts")
6631
+ * .tab("all", "All").columns("name", "email").default()
6632
+ * .build();
6633
+ *
6634
+ * // Zero-import type inference! ✨
6635
+ * type ViewConfig = typeof CONTACTS_LIST.$infer.config;
6636
+ * type ViewDef = typeof CONTACTS_LIST.$infer.definition;
6637
+ * ```
6638
+ */
6639
+ readonly $infer: {
6640
+ /** The view configuration type */
6641
+ config: ListViewConfig;
6642
+ /** The full view definition type */
6643
+ definition: ListViewDefinition;
6644
+ };
6380
6645
  constructor(name: string, label: string);
6381
6646
  /**
6382
6647
  * Set view description
@@ -6798,82 +7063,6 @@ declare class WorkflowConditionBuilder {
6798
7063
  onFalse: (nodeId: string) => WorkflowBuilder;
6799
7064
  };
6800
7065
  }
6801
- /**
6802
- * Builder for creating assign nodes (set values on a target slot)
6803
- */
6804
- declare class WorkflowAssignBuilder {
6805
- private workflowBuilder;
6806
- private nodeId;
6807
- private label;
6808
- private nodeDescription?;
6809
- private targetSlotId;
6810
- private assignments;
6811
- /** @internal */
6812
- constructor(workflowBuilder: WorkflowBuilder, nodeId: string, label: string, targetSlotId: string);
6813
- /**
6814
- * Set an attribute using an expression template.
6815
- * Uses mustache syntax: `{{ slotId.attribute }}`.
6816
- */
6817
- expression(targetAttribute: string, template: string): this;
6818
- /**
6819
- * Link a relation attribute to a slot's record.
6820
- * Optionally include qualified relation properties.
6821
- */
6822
- slotRef(targetAttribute: string, slotId: string, properties?: Record<string, unknown>): this;
6823
- /**
6824
- * Set a static value on an attribute
6825
- */
6826
- setValue(targetAttribute: string, value: unknown): this;
6827
- /**
6828
- * Set the description for this assign node
6829
- */
6830
- describe(description: string): this;
6831
- /**
6832
- * Set the next node and complete the assign definition
6833
- */
6834
- next(nodeId: string): WorkflowBuilder;
6835
- }
6836
- /**
6837
- * Builder for creating AI agent nodes.
6838
- */
6839
- declare class WorkflowAIBuilder {
6840
- private workflowBuilder;
6841
- private nodeId;
6842
- private label;
6843
- private nodeDescription?;
6844
- private nodeTimeoutMs?;
6845
- private agentConfig;
6846
- /** @internal */
6847
- constructor(workflowBuilder: WorkflowBuilder, nodeId: string, label: string);
6848
- describe(description: string): this;
6849
- timeout(ms: number): this;
6850
- /**
6851
- * Configure the agent for this node.
6852
- *
6853
- * @param definitionIdOrConfig - Either an existing agent definition ID (string),
6854
- * or an inline agent config object.
6855
- * @param options - Additional options merged on top (only used when first arg is a string)
6856
- */
6857
- agent(definitionIdOrConfig: string | {
6858
- mode: "sync" | "async";
6859
- systemPrompt?: string;
6860
- model?: string;
6861
- tools?: string[];
6862
- maxIterations?: number;
6863
- instructions?: string;
6864
- inputSlotIds?: string[];
6865
- targetSlotIds?: string[];
6866
- }, options?: {
6867
- mode?: "sync" | "async";
6868
- instructions?: string;
6869
- inputSlotIds?: string[];
6870
- targetSlotIds?: string[];
6871
- }): this;
6872
- /**
6873
- * Set the next node and complete the AI node definition
6874
- */
6875
- next(nodeId: string): WorkflowBuilder;
6876
- }
6877
7066
  /**
6878
7067
  * Builder for creating end nodes
6879
7068
  */
@@ -6953,6 +7142,29 @@ declare class WorkflowBuilder {
6953
7142
  private data;
6954
7143
  private startNodeId;
6955
7144
  private nodeCount;
7145
+ /**
7146
+ * Drizzle-style static type inference property.
7147
+ * Provides direct access to inferred types without utility type imports.
7148
+ *
7149
+ * @example
7150
+ * ```typescript
7151
+ * const ONBOARDING = workflow("client-onboarding", "Onboarding")
7152
+ * .slot("client", "contacts", { label: "Client", mode: "create" })
7153
+ * .start("entry").next("form")
7154
+ * // ... nodes
7155
+ * .build();
7156
+ *
7157
+ * // Zero-import type inference! ✨
7158
+ * type Slots = typeof ONBOARDING.$infer.slots;
7159
+ * type WorkflowDef = typeof ONBOARDING.$infer.definition;
7160
+ * ```
7161
+ */
7162
+ readonly $infer: {
7163
+ /** The workflow slots type */
7164
+ slots: WorkflowSlot[];
7165
+ /** The full workflow definition type */
7166
+ definition: WorkflowDefinition;
7167
+ };
6956
7168
  constructor(name: string, label: string);
6957
7169
  /**
6958
7170
  * Set workflow description
@@ -7007,12 +7219,6 @@ declare class WorkflowBuilder {
7007
7219
  * Define a condition node
7008
7220
  */
7009
7221
  condition(id: string, label: string): WorkflowConditionBuilder;
7010
- /**
7011
- * Define an assign node (set values on a target slot)
7012
- */
7013
- assign(id: string, label: string, targetSlotId: string): WorkflowAssignBuilder;
7014
- /** Define an AI agent node (sync or async, inline or referenced from a definition) */
7015
- ai(id: string, label: string): WorkflowAIBuilder;
7016
7222
  /**
7017
7223
  * Define an end node
7018
7224
  */
@@ -7052,6 +7258,47 @@ declare class WorkflowBuilder {
7052
7258
  */
7053
7259
  declare function workflow(name: string, label: string): WorkflowBuilder;
7054
7260
 
7261
+ /**
7262
+ * Standard Schema v1 integration for @stndrds/schema
7263
+ *
7264
+ * Standard Schema is a TypeScript interface designed by the Zod/Valibot/ArkType
7265
+ * creators to enable interoperability between validation libraries.
7266
+ *
7267
+ * @see https://standardschema.dev/
7268
+ */
7269
+
7270
+ /**
7271
+ * Standard Schema vendor identifier
7272
+ */
7273
+ declare const STANDARD_SCHEMA_VENDOR = "@stndrds/schema";
7274
+
7275
+ /**
7276
+ * Standard Schema issue type
7277
+ */
7278
+ type StandardSchemaIssue = StandardSchemaV1.Issue;
7279
+ /**
7280
+ * Standard Schema result type
7281
+ */
7282
+ type StandardSchemaResult<T> = StandardSchemaV1.Result<T>;
7283
+ /**
7284
+ * Standard Schema props type (the ~standard property value)
7285
+ */
7286
+ type StandardSchemaProps<Input, Output> = StandardSchemaV1.Props<Input, Output>;
7287
+ /**
7288
+ * Create Standard Schema ~standard props from a Zod schema.
7289
+ *
7290
+ * Since Zod v4 already implements Standard Schema natively, we delegate
7291
+ * validation to Zod and wrap the result with our vendor identifier.
7292
+ *
7293
+ * @param zodSchema - The Zod schema to wrap
7294
+ * @returns Standard Schema v1 props
7295
+ */
7296
+ declare function createStandardSchemaProps<T>(zodSchema: z$1.ZodType<T>): StandardSchemaV1.Props<unknown, T>;
7297
+ /**
7298
+ * Type guard to check if an object implements Standard Schema v1
7299
+ */
7300
+ declare function isStandardSchema<T>(obj: unknown): obj is StandardSchemaV1<unknown, T>;
7301
+
7055
7302
  /**
7056
7303
  * Flag Builder Module
7057
7304
  *
@@ -7851,4 +8098,48 @@ declare function resetViewToDefault(currentView: ViewDefinition, object: ObjectD
7851
8098
  */
7852
8099
  declare function isViewCustomized(view: ViewDefinition, object: ObjectDefinition): boolean;
7853
8100
 
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 };
8101
+ /**
8102
+ * Convert an ObjectDefinition to JSON Schema.
8103
+ *
8104
+ * This enables runtime form generation from schema definitions.
8105
+ * The generated JSON Schema is compatible with libraries like:
8106
+ * - react-jsonschema-form
8107
+ * - ajv
8108
+ * - json-schema-form
8109
+ *
8110
+ * @param objectDef - The ObjectDefinition to convert
8111
+ * @returns A JSON Schema object representing the ObjectDefinition
8112
+ *
8113
+ * @example
8114
+ * ```typescript
8115
+ * const PRODUCT = object({ name: "products", label: "Product" })
8116
+ * .labelExpression("{{ name }}")
8117
+ * .attribute(text({ name: "name", label: "Name" }).required())
8118
+ * .attribute(number({ name: "price", label: "Price" }).min(0))
8119
+ * .build();
8120
+ *
8121
+ * const jsonSchema = objectToJSONSchema(PRODUCT);
8122
+ * // => {
8123
+ * // type: "object",
8124
+ * // title: "Product",
8125
+ * // properties: {
8126
+ * // name: { type: "string", title: "Name" },
8127
+ * // price: { type: "number", title: "Price", minimum: 0 }
8128
+ * // },
8129
+ * // required: ["name"]
8130
+ * // }
8131
+ * ```
8132
+ */
8133
+ declare function objectToJSONSchema(objectDef: ObjectDefinition): JSONSchema7;
8134
+ /**
8135
+ * Convert an ObjectDefinition's Zod validator to JSON Schema using z.toJSONSchema().
8136
+ *
8137
+ * This is an alternative approach that uses Zod's native JSON Schema generation.
8138
+ * Use this when you need exact parity with Zod validation behavior.
8139
+ *
8140
+ * @param objectDef - The ObjectDefinition to convert
8141
+ * @returns A JSON Schema generated by Zod
8142
+ */
8143
+ declare function objectValidatorToJSONSchema(objectDef: ObjectDefinition): JSONSchema7;
8144
+
8145
+ export { type AIAvailableModel, type AIBatchQuestion, type AIBatchQuestionAnswer, type AIBatchQuestionOption, type AIChatMessage, type AIChatMessagePart, type AIChatMessagePartType, type AICompactionSummary, type AIMemoryEntry, type AIMemoryType, type AIMessageRole, type AIProviderMetrics, type AIQuestion, type AIQuestionAnswer, type AIQuestionOption, type AIQuestionType, type AITodoItem, type AITodoList, type AITodoStatus, type AIToolCall, type AIToolCallStatus, type AIUsageMetrics, ALL_ACTIONS, ALL_PIPES, ALL_SYSTEM_RESOURCES, AccessDeniedError, type AccessLevel, type Action, ActivityTabConfig, type AddAttribute$1 as AddAttribute, type AgentAttachment, type AgentAttachmentCategory, type AgentConfig, type AgentContextEntry, type AgentDashboard, type AgentDefinition, type AgentEvent, type AgentExecutionConfig, type AgentMessageAttachment, type AgentQuestion, type AgentRun, 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, type AssignRoleInput, 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, CheckboxAttribute, CompletionStatus, ConcurrentModificationError, ConditionGroup, ConditionGroupSchema, ConditionNodeSchema, ConditionOperatorSchema, ConditionRule, ConditionRuleSchema, ConfigOverrides, 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 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 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 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 RecordAgentEvent, type RecordAgentTrigger, 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 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, ViewBuilder, ViewConfig, ViewDefinition, ViewType, ViewportSchema, type WithCustomAttributes$1 as WithCustomAttributes, type WorkflowAccessGrant, type WorkflowAccessMode, WorkflowBuilder, type WorkflowCompletedAgentEvent, type WorkflowCompletedAgentTrigger, 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 };