@stndrds/schema 1.0.0-alpha.277 → 1.0.0-alpha.279

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 (73) hide show
  1. package/dist/{all-D-E8v5yo.d.mts → all-Bk8cRKsu.d.mts} +20 -3
  2. package/dist/{all-D5SkjRst.d.ts → all-C_tC90ZM.d.ts} +20 -3
  3. package/dist/{attributes-lBLiOIY3.d.mts → attributes--M1ifW8_.d.mts} +1 -1
  4. package/dist/{attributes-_b3Db8vT.d.ts → attributes-D8eHv5Kf.d.ts} +1 -1
  5. package/dist/{chunk-XQEDMB6B.mjs → chunk-5PLJHYSL.mjs} +24 -4
  6. package/dist/{chunk-KKR6I3YV.js → chunk-DEHBEFGO.js} +3 -3
  7. package/dist/{chunk-VVYIFBFQ.mjs → chunk-PQEOIDXD.mjs} +1 -1
  8. package/dist/{chunk-F32XOFSP.js → chunk-QMAVKX3Y.js} +55 -34
  9. package/dist/{chunk-PSCSTHUB.mjs → chunk-QUZ3PN36.mjs} +11 -14
  10. package/dist/{chunk-K4UER3DU.mjs → chunk-V2WJFUZW.mjs} +14 -2
  11. package/dist/{chunk-RYAQOR7M.js → chunk-ZBWTAKZO.js} +14 -2
  12. package/dist/{chunk-FMLZHHWB.js → chunk-ZEPGMHCK.js} +14 -16
  13. package/dist/exceptions.d.mts +14 -4
  14. package/dist/exceptions.d.ts +14 -4
  15. package/dist/exceptions.js +39 -39
  16. package/dist/exceptions.mjs +1 -1
  17. package/dist/{helpers-C1VVEAOO.d.mts → helpers-BiABdSxK.d.mts} +3 -3
  18. package/dist/{helpers-vQ6kp8ET.d.ts → helpers-DyoPqiSz.d.ts} +3 -3
  19. package/dist/index-C3P5Dnwt.d.mts +790 -0
  20. package/dist/index-SpFpkWVC.d.ts +790 -0
  21. package/dist/index.d.mts +2228 -393
  22. package/dist/index.d.ts +2228 -393
  23. package/dist/index.js +565 -324
  24. package/dist/index.mjs +358 -138
  25. package/dist/{migrations-DcuJZ8qO.d.ts → migrations-B1kkIhIX.d.ts} +1 -1
  26. package/dist/{migrations-BXd2ZGfM.d.mts → migrations-BNlQVzDC.d.mts} +1 -1
  27. package/dist/{objects-A1ED9af-.d.ts → objects-DgFojgwH.d.ts} +19 -3
  28. package/dist/{objects-BCaBw2ef.d.mts → objects-DmMqHn3L.d.mts} +19 -3
  29. package/dist/{types-DNz3ITS-.d.mts → types-DHqXzkgW.d.mts} +1 -1
  30. package/dist/{types-DqLi1tx1.d.ts → types-DYYFto8d.d.ts} +1 -1
  31. package/dist/validation/all.d.mts +7 -7
  32. package/dist/validation/all.d.ts +7 -7
  33. package/dist/validation/all.js +29 -29
  34. package/dist/validation/all.mjs +4 -4
  35. package/dist/validation/complex/currency.d.mts +2 -2
  36. package/dist/validation/complex/currency.d.ts +2 -2
  37. package/dist/validation/complex/location.d.mts +2 -2
  38. package/dist/validation/complex/location.d.ts +2 -2
  39. package/dist/validation/complex/phone.d.mts +2 -2
  40. package/dist/validation/complex/phone.d.ts +2 -2
  41. package/dist/validation/complex/relation.d.mts +2 -2
  42. package/dist/validation/complex/relation.d.ts +2 -2
  43. package/dist/validation/complex/richtext.d.mts +2 -2
  44. package/dist/validation/complex/richtext.d.ts +2 -2
  45. package/dist/validation/complex/select.d.mts +2 -2
  46. package/dist/validation/complex/select.d.ts +2 -2
  47. package/dist/validation/complex/user.d.mts +2 -2
  48. package/dist/validation/complex/user.d.ts +2 -2
  49. package/dist/validation/computed/formula.d.mts +2 -2
  50. package/dist/validation/computed/formula.d.ts +2 -2
  51. package/dist/validation/computed/rollup.d.mts +2 -2
  52. package/dist/validation/computed/rollup.d.ts +2 -2
  53. package/dist/validation/config/index.d.mts +4 -4
  54. package/dist/validation/config/index.d.ts +4 -4
  55. package/dist/validation/config/index.js +11 -11
  56. package/dist/validation/config/index.mjs +2 -2
  57. package/dist/validation/core/index.d.mts +3 -3
  58. package/dist/validation/core/index.d.ts +3 -3
  59. package/dist/validation/object/index.d.mts +5 -5
  60. package/dist/validation/object/index.d.ts +5 -5
  61. package/dist/validation/object/index.js +14 -14
  62. package/dist/validation/object/index.mjs +2 -2
  63. package/dist/validation/primitives/checkbox.d.mts +2 -2
  64. package/dist/validation/primitives/checkbox.d.ts +2 -2
  65. package/dist/validation/primitives/date.d.mts +2 -2
  66. package/dist/validation/primitives/date.d.ts +2 -2
  67. package/dist/validation/primitives/number.d.mts +2 -2
  68. package/dist/validation/primitives/number.d.ts +2 -2
  69. package/dist/validation/primitives/text.d.mts +2 -2
  70. package/dist/validation/primitives/text.d.ts +2 -2
  71. package/package.json +2 -2
  72. package/dist/index-AJeEKoy6.d.ts +0 -2203
  73. package/dist/index-ApHE8c1J.d.mts +0 -2203
@@ -0,0 +1,790 @@
1
+ import { z } from 'zod';
2
+ import { A as Attribute, f as AttributeType, e as RollupAttribute } from './attributes--M1ifW8_.mjs';
3
+ import { IconName } from '@stndrds/constants';
4
+ import { L as ListViewTabVisibility } from './objects-DmMqHn3L.mjs';
5
+
6
+ /** Operators for text-based attributes */
7
+ type TextFilterOperator = "is" | "is_not" | "contains" | "not_contains" | "starts_with" | "ends_with" | "is_empty" | "is_not_empty";
8
+ /** Operators for number-based attributes */
9
+ type NumberFilterOperator = "is" | "is_not" | "less_than" | "greater_than" | "less_or_equal" | "greater_or_equal" | "is_empty" | "is_not_empty";
10
+ /** Operators for checkbox — `is` with a boolean rule value (a checkbox always has a value) */
11
+ type CheckboxFilterOperator = "is";
12
+ /** Operators for date-based attributes (ordering shares the numeric vocabulary) */
13
+ type DateFilterOperator = "is" | "is_not" | "less_than" | "greater_than" | "less_or_equal" | "greater_or_equal" | "is_within" | "on_day_month" | "is_empty" | "is_not_empty";
14
+ /** Operators for select-based attributes (supports single or multi-value filtering) */
15
+ type SelectFilterOperator = "is" | "is_not" | "any_of" | "none_of" | "is_empty" | "is_not_empty";
16
+ /** Operators for multiselect-based attributes — set membership only */
17
+ type MultiselectFilterOperator = "any_of" | "none_of" | "is_empty" | "is_not_empty";
18
+ /**
19
+ * Operators for relation-based attributes (covers single, multi-value, and
20
+ * reference-shaped filtering — user, relation, document share the same
21
+ * edge-backed operator set). Membership is `any_of`/`none_of` only.
22
+ */
23
+ type RelationFilterOperator = "is" | "is_not" | "any_of" | "none_of" | "is_empty" | "is_not_empty";
24
+ /**
25
+ * All possible filter operators — the canonical set of 16.
26
+ * Short input codes (`lt`, `gte`, `eq`, `in`, …) are accepted at entry only
27
+ * and normalized via SYNONYM_ALIASES; they are never stored and never typed.
28
+ */
29
+ type FilterOperator = TextFilterOperator | NumberFilterOperator | CheckboxFilterOperator | DateFilterOperator | SelectFilterOperator | MultiselectFilterOperator | RelationFilterOperator;
30
+ /** Relative date value for "is_within" operator */
31
+ interface RelativeDateValue {
32
+ amount: number;
33
+ unit: "days" | "weeks" | "months" | "years";
34
+ direction: "past" | "future";
35
+ }
36
+ /** Currency filter value with amount and optional currency codes
37
+ * - code: undefined or [] = any currency
38
+ * - code: string[] = filter by specific currencies
39
+ */
40
+ interface CurrencyFilterValue {
41
+ value: number | null;
42
+ code?: string[];
43
+ }
44
+ /** Phone filter value with number and optional country code */
45
+ interface PhoneFilterValue {
46
+ phoneNumber: string | null;
47
+ countryCode?: string;
48
+ }
49
+ /**
50
+ * A filter value resolved at query time from the execution context.
51
+ * Stored verbatim in a view's filter; replaced with a concrete value by the
52
+ * runtime before reaching any query layer. Discriminated by the `dynamic` key —
53
+ * no static FilterValue carries it.
54
+ */
55
+ type DynamicValue = {
56
+ dynamic: "actor";
57
+ ref: "current";
58
+ } | {
59
+ dynamic: "date";
60
+ anchor: "today";
61
+ } | {
62
+ dynamic: "date";
63
+ anchor: "now";
64
+ };
65
+ /**
66
+ * The value `on_day_month` ("is on") takes: a calendar day without a year.
67
+ *
68
+ * Postgres matches it with `LIKE '%-MM-DD'` and Meili with `CONTAINS "-MM-DD"`,
69
+ * both reading these two members off the stored value, and the filter UI renders
70
+ * a dedicated input producing exactly this shape. It was the one operator whose
71
+ * value had no member in the union below, so the same shape had to be cast in
72
+ * at every site that used it (#2469).
73
+ */
74
+ interface DayMonthValue {
75
+ month: number;
76
+ day: number;
77
+ }
78
+ /** Filter value can be various types depending on the attribute */
79
+ type FilterValue = string | number | boolean | string[] | RelativeDateValue | CurrencyFilterValue | PhoneFilterValue | DayMonthValue | DynamicValue | null;
80
+ /** Existence quantifier for qualified edge rules. Maps to SQL EXISTS / NOT EXISTS. */
81
+ type EdgeQuantifier = "any" | "none";
82
+ /** A single filter rule */
83
+ interface FilterRule {
84
+ /** Root attribute name (scalar attribute, or a reference attribute when `property` is set). */
85
+ attribute: string;
86
+ /**
87
+ * If set, this rule filters on a qualified edge property.
88
+ * Requires `attribute` to be a reference attribute (today: `relation` or `document`) that has `.qualifyWith()`.
89
+ * The `operator` must be valid for the property's type, not the root attribute's type.
90
+ */
91
+ property?: string;
92
+ /**
93
+ * Existence quantifier for qualified edge rules ("at least one" vs "none").
94
+ * Only valid when `property` is set. Maps to SQL EXISTS / NOT EXISTS.
95
+ * Defaults to the operator-derived polarity when omitted.
96
+ */
97
+ quantifier?: EdgeQuantifier;
98
+ /** Filter operator */
99
+ operator: FilterOperator;
100
+ /** Filter value (null for operators like is_empty) */
101
+ value: FilterValue;
102
+ }
103
+ /**
104
+ * Extended filter rule with optional attribute definition.
105
+ * When provided, enables smarter type-aware filtering (e.g., array operators for multiselect).
106
+ */
107
+ interface ExtendedFilterRule extends FilterRule {
108
+ /** Full attribute definition for type-aware filtering */
109
+ attributeDef?: Attribute;
110
+ }
111
+ /** Combinator for filter rules */
112
+ type FilterCombinator = "and" | "or";
113
+ /** Complete filter state (simple mode) */
114
+ interface FilterState {
115
+ /** How to combine rules */
116
+ combinator: FilterCombinator;
117
+ /** List of filter rules */
118
+ rules: FilterRule[];
119
+ }
120
+ /**
121
+ * A filter group containing rules (used in advanced mode)
122
+ * Groups can be nested up to 2 levels deep
123
+ */
124
+ interface FilterGroup {
125
+ /** Unique identifier for this group */
126
+ id: string;
127
+ /** How to combine rules within this group */
128
+ combinator: FilterCombinator;
129
+ /** List of filter rules in this group */
130
+ rules: FilterRule[];
131
+ }
132
+ /**
133
+ * Advanced filter state with nested groups
134
+ * Structure: AdvancedFilterState -> FilterGroup[] -> FilterRule[]
135
+ * Maximum 2 levels of nesting
136
+ */
137
+ interface AdvancedFilterState {
138
+ /** How to combine groups at the top level */
139
+ combinator: FilterCombinator;
140
+ /** List of filter groups */
141
+ groups: FilterGroup[];
142
+ }
143
+ /** Sort direction */
144
+ type SortDirection = "asc" | "desc";
145
+ /** A single sort rule */
146
+ interface SortRule {
147
+ /** Attribute name to sort by */
148
+ attribute: string;
149
+ /** Sort direction */
150
+ direction: SortDirection;
151
+ }
152
+ /** Complete query state with search, filters, sorts, and pagination */
153
+ interface QueryState {
154
+ /** Full-text search query */
155
+ search?: string;
156
+ /** Filter configuration (simple mode) */
157
+ filters?: FilterState;
158
+ /** Advanced filter configuration (grouped mode) */
159
+ advancedFilters?: AdvancedFilterState;
160
+ /** Sort configuration (multiple sorts supported) */
161
+ sorts?: SortRule[];
162
+ /** Pagination */
163
+ limit?: number;
164
+ offset?: number;
165
+ }
166
+ /** Mapping of attribute types to their valid operators (rollup excluded — use getRollupFilterOperators()) */
167
+ declare const OPERATORS_BY_TYPE: Record<Exclude<AttributeType, "rollup">, readonly FilterOperator[]>;
168
+ /** Check if an operator requires a value */
169
+ type NoValueOperator = "is_empty" | "is_not_empty";
170
+ /** Operators that don't require a value */
171
+ declare const NO_VALUE_OPERATORS: readonly NoValueOperator[];
172
+ /**
173
+ * Check if an operator requires a value
174
+ */
175
+ declare function isNoValueOperator(operator: FilterOperator): operator is NoValueOperator;
176
+ /**
177
+ * Get the filter operators for a rollup attribute based on its aggregation function and target type.
178
+ *
179
+ * - earliest / latest → date operators
180
+ * - original → operators matching targetAttributeType (falls back to numeric if unknown)
181
+ * - all other functions → numeric operators (sum, avg, count, percent, etc.)
182
+ */
183
+ declare function getRollupFilterOperators(attr: RollupAttribute): readonly FilterOperator[];
184
+
185
+ /**
186
+ * Type of view - determines the config structure
187
+ */
188
+ type ViewType = "detail" | "list";
189
+ /**
190
+ * Creation behavior when clicking the "+" button
191
+ * - `redirect`: Create the record then navigate to its detail page
192
+ * - `inline`: Insert an empty row in the table (no navigation)
193
+ * - `peek`: Create a draft immediately and open it in the record stack side panel
194
+ */
195
+ type CreateMode = "redirect" | "inline" | "peek";
196
+ /**
197
+ * Inline attribute group configuration
198
+ * Groups multiple attributes into a single composite field with dropdown editing
199
+ */
200
+ interface AttributeGroupField {
201
+ /** Unique identifier for the group */
202
+ id: string;
203
+ /** Display label for the composite field */
204
+ label: string;
205
+ /** Description shown in the dropdown */
206
+ description?: string;
207
+ /** Attribute names to include in this group */
208
+ attributes: string[];
209
+ /**
210
+ * Template for the display value
211
+ * Uses {attributeName} syntax for interpolation
212
+ * @example "{billing_street}, {billing_city} {billing_postal_code}"
213
+ */
214
+ displayTemplate?: string;
215
+ }
216
+ /**
217
+ * Field definition within a form group
218
+ * Can be either a single attribute or an inline attribute group
219
+ */
220
+ interface Field {
221
+ /** Attribute name to display (for single attribute fields) */
222
+ attribute?: string;
223
+ /** Inline attribute group (groups multiple attributes into one composite field) */
224
+ attributeGroup?: AttributeGroupField;
225
+ /** Grid span (1-12 columns) */
226
+ span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
227
+ /** Override label for this view (only for single attribute fields) */
228
+ label?: string;
229
+ /** Force read-only display */
230
+ readOnly?: boolean;
231
+ }
232
+ /**
233
+ * Base properties shared by all group types
234
+ */
235
+ interface BaseGroup {
236
+ id: string;
237
+ label: string;
238
+ description?: string;
239
+ collapsible?: boolean;
240
+ collapsed?: boolean;
241
+ order?: number;
242
+ }
243
+ /**
244
+ * Group of fields for organizing forms (default group type)
245
+ */
246
+ interface FieldGroup extends BaseGroup {
247
+ /** Discriminant */
248
+ type: "fields";
249
+ fields: Field[];
250
+ }
251
+ /**
252
+ * Group that displays related records for a relation attribute
253
+ */
254
+ interface RelationGroup extends BaseGroup {
255
+ type: "relation";
256
+ /** Relation attribute name on the source object */
257
+ attribute: string;
258
+ /** Columns to display (auto-detected from target object if empty) */
259
+ columns?: string[];
260
+ /** Read-only mode */
261
+ readOnly?: boolean;
262
+ /** Allow creating new related records */
263
+ allowCreate?: boolean;
264
+ }
265
+ /**
266
+ * Discriminated union of all group types
267
+ */
268
+ type Group = FieldGroup | RelationGroup;
269
+ type TabType = "form" | "table" | "custom" | "activity" | "richtext" | "documents" | "forms" | "emails" | "meetings";
270
+ /**
271
+ * Base properties shared by all tab types
272
+ */
273
+ interface BaseTab {
274
+ id: string;
275
+ name: string;
276
+ label: string;
277
+ icon?: IconName;
278
+ order?: number;
279
+ }
280
+ /**
281
+ * Form layout density
282
+ */
283
+ type FormDensity = "compact" | "comfortable" | "spacious";
284
+ /**
285
+ * Form tab - displays attributes organized in groups
286
+ */
287
+ interface FormTab extends BaseTab {
288
+ type: "form";
289
+ groups: Group[];
290
+ /** Number of grid columns (1, 2, or 3). Default: 2 */
291
+ formColumns?: 1 | 2 | 3;
292
+ /** Layout density. Default: "comfortable" */
293
+ density?: FormDensity;
294
+ }
295
+ /**
296
+ * Direct relation on the current object
297
+ *
298
+ * @example Contact.companies → shows Companies linked via the "companies" relation
299
+ */
300
+ interface RelationSource {
301
+ type: "relation";
302
+ /** Relation attribute name on the current object */
303
+ attribute: string;
304
+ }
305
+ /**
306
+ * Inverse lookup — records from another object that point to us
307
+ *
308
+ * @example On Company, show Contacts where Contact.company = this Company
309
+ */
310
+ interface InverseSource {
311
+ type: "inverse";
312
+ /** Object name that has the relation to us */
313
+ object: string;
314
+ /** Relation attribute name on the source object that points to us */
315
+ attribute: string;
316
+ }
317
+ /**
318
+ * Where table data comes from — either a direct relation or an inverse lookup
319
+ */
320
+ type TableSource = RelationSource | InverseSource;
321
+ /**
322
+ * Table tab - displays related records in a table
323
+ *
324
+ * The `source` field determines where data comes from.
325
+ *
326
+ * @example Direct: source = { type: "relation", attribute: "members" }
327
+ * @example Inverse: source = { type: "inverse", object: "contacts", attribute: "company" }
328
+ */
329
+ interface TableTab extends BaseTab {
330
+ type: "table";
331
+ /** Where the data comes from */
332
+ source: TableSource;
333
+ /** Columns to display (attribute names from the resolved target object) */
334
+ columns: string[];
335
+ /** Allow creating new records */
336
+ allowCreate?: boolean;
337
+ /** Creation behavior when allowCreate is true. Default: "redirect" */
338
+ createMode?: CreateMode;
339
+ /** Allow inline editing */
340
+ allowEdit?: boolean;
341
+ /** Allow deleting records */
342
+ allowDelete?: boolean;
343
+ /** Default filters applied to the table */
344
+ filters?: FilterState;
345
+ /** Default sort rules */
346
+ sorts?: SortRule[];
347
+ }
348
+ /**
349
+ * Custom tab - renders a developer-defined component
350
+ */
351
+ interface CustomTab extends BaseTab {
352
+ type: "custom";
353
+ /** Component identifier to render */
354
+ component: string;
355
+ /** Props to pass to the component */
356
+ props?: Record<string, unknown>;
357
+ }
358
+ /**
359
+ * Activity tab - displays activity feed for the current record
360
+ */
361
+ interface ActivityTab extends BaseTab {
362
+ type: "activity";
363
+ limit?: number;
364
+ }
365
+ /**
366
+ * Richtext tab - displays a block editor for a richtext attribute
367
+ */
368
+ interface RichtextTab extends BaseTab {
369
+ type: "richtext";
370
+ /** Richtext attribute to display in the BlockEditor */
371
+ attribute: string;
372
+ /** Optional text attribute for an editable title input above the editor */
373
+ titleAttribute?: string;
374
+ }
375
+ /**
376
+ * Documents tab - displays all documents attached to the record
377
+ */
378
+ interface DocumentsTab extends BaseTab {
379
+ type: "documents";
380
+ allowUpload?: boolean;
381
+ allowRemove?: boolean;
382
+ hideAttachments?: boolean;
383
+ }
384
+ /**
385
+ * Forms tab - displays available forms for creating related records
386
+ */
387
+ interface FormsTab extends BaseTab {
388
+ type: "forms";
389
+ /** Object name to filter forms by slot (derived from record context, but can be overridden) */
390
+ objectName?: string;
391
+ }
392
+ /**
393
+ * Emails tab - displays emails associated with the record at query time via the
394
+ * values of configured email-bearing text attributes. Config-only: no schema change.
395
+ */
396
+ interface EmailsTab extends BaseTab {
397
+ type: "emails";
398
+ /** Names of text attributes whose values hold email addresses to match on. */
399
+ emailAttributeIds: string[];
400
+ }
401
+ /**
402
+ * Meetings tab - displays calendar meetings associated with the record at query
403
+ * time via the values of configured email-bearing text attributes. Config-only:
404
+ * no schema change. Carries the same configuration as {@link EmailsTab} because
405
+ * both answer "which attributes hold this record's addresses".
406
+ */
407
+ interface MeetingsTab extends BaseTab {
408
+ type: "meetings";
409
+ /** Names of text attributes whose values hold email addresses to match on. */
410
+ emailAttributeIds: string[];
411
+ }
412
+ /**
413
+ * Union of all tab types (for detail views)
414
+ */
415
+ type Tab = FormTab | TableTab | CustomTab | ActivityTab | RichtextTab | DocumentsTab | FormsTab | EmailsTab | MeetingsTab;
416
+ /**
417
+ * List view layout mode
418
+ * - `table`: Table/grid layout
419
+ * - `kanban`: Kanban board layout (grouped by attribute)
420
+ */
421
+ type ListViewLayout = "table" | "kanban";
422
+ /**
423
+ * Tab within a list view — each tab carries its own full display configuration.
424
+ *
425
+ * @example
426
+ * ```typescript
427
+ * const tabs: ListViewTab[] = [
428
+ * { id: "all", label: "All Contacts", default: true, visibility: "workspace", layout: "table", columns: ["name", "email", "status"] },
429
+ * { id: "active", label: "Active", visibility: "workspace", layout: "table", columns: ["name", "email"], filters: activeFilter },
430
+ * { id: "pipeline", label: "Pipeline", visibility: "workspace", layout: "kanban", columns: ["name", "amount"], groupByAttribute: "stage" },
431
+ * ];
432
+ * ```
433
+ */
434
+ interface ListViewTab {
435
+ /** Unique identifier */
436
+ id: string;
437
+ /** Display label */
438
+ label: string;
439
+ /** Icon */
440
+ icon?: IconName;
441
+ /** Default tab (shown on load) */
442
+ default?: boolean;
443
+ /**
444
+ * Record scope this tab reads. `all` (the default) imposes no scope, so the
445
+ * tab shows every workspace record plus the viewer's own private ones;
446
+ * `workspace` and `private` narrow it to exactly one.
447
+ */
448
+ visibility: ListViewTabVisibility;
449
+ /** Layout mode */
450
+ layout: ListViewLayout;
451
+ /** Attribute names to display as columns */
452
+ columns: string[];
453
+ /** Column widths in pixels */
454
+ columnSizing?: Record<string, number>;
455
+ /** Filters applied to this tab */
456
+ filters?: FilterGroup;
457
+ /** Sort rules for this tab */
458
+ sorts?: SortRule[];
459
+ /** Attribute to group by (required when layout is "kanban") */
460
+ groupByAttribute?: string;
461
+ /** When true, the tab is read-only: no cell editing, no create, no delete */
462
+ readOnly?: boolean;
463
+ /** Creation behavior when clicking "+". Default: "redirect" */
464
+ createMode?: CreateMode;
465
+ /** User attribute to display on kanban cards (bottom-left) */
466
+ cardUserAttribute?: string;
467
+ /** Date attribute to display on kanban cards (bottom-right) */
468
+ cardDateAttribute?: string;
469
+ /** Order of kanban columns (by option value) - for kanban layout only */
470
+ kanbanColumnOrder?: string[];
471
+ /** Visibility of kanban columns (by option value) - for kanban layout only */
472
+ kanbanColumnVisibility?: Record<string, boolean>;
473
+ /** Pinned kanban columns (by option value) - for kanban layout only */
474
+ kanbanPinnedColumns?: string[];
475
+ }
476
+ /**
477
+ * Configuration for the side panel displayed alongside tab content.
478
+ * When present, a right-side panel shows the configured attributes as flat fields.
479
+ */
480
+ interface SidePanelConfig {
481
+ /** Attribute names to display as flat fields in the panel */
482
+ attributes: string[];
483
+ /** Width in pixels. @default 320 */
484
+ width?: number;
485
+ }
486
+ /**
487
+ * Configuration for detail views (RecordEditView)
488
+ */
489
+ interface DetailViewConfig {
490
+ /** Tabs in this view */
491
+ tabs: Tab[];
492
+ /** Optional side panel with flat attribute fields */
493
+ sidePanel?: SidePanelConfig;
494
+ }
495
+ /**
496
+ * Configuration for list views (RecordsView)
497
+ *
498
+ * Each tab carries its own full config (layout, columns, filters, sorts, groupBy).
499
+ * The view only holds shared base filters applied to ALL tabs.
500
+ */
501
+ interface ListViewConfig {
502
+ /** Base filters applied to ALL tabs (scoping, tenant, etc.) */
503
+ defaultFilters?: FilterGroup;
504
+ /** Tabs — at least one required. Each carries its own full config. */
505
+ tabs: ListViewTab[];
506
+ }
507
+ /**
508
+ * Union of all view configs
509
+ */
510
+ type ViewConfig = DetailViewConfig | ListViewConfig;
511
+ /**
512
+ * Base view properties shared by all view types
513
+ */
514
+ interface BaseViewDefinition {
515
+ /** Unique identifier (UUID, assigned by database) */
516
+ id?: string;
517
+ /** Technical name (kebab-case) */
518
+ name: string;
519
+ /** Display label */
520
+ label: string;
521
+ /** Description */
522
+ description?: string;
523
+ /** Icon */
524
+ icon?: IconName;
525
+ /** Object this view belongs to (object name) */
526
+ object: string;
527
+ /** Default view for this object+type combination */
528
+ default?: boolean;
529
+ /** Extensible metadata */
530
+ metadata?: Record<string, unknown>;
531
+ }
532
+ /**
533
+ * Detail view definition
534
+ */
535
+ interface DetailViewDefinition extends BaseViewDefinition {
536
+ type: "detail";
537
+ config: DetailViewConfig;
538
+ }
539
+ /**
540
+ * List view definition
541
+ */
542
+ interface ListViewDefinition extends BaseViewDefinition {
543
+ type: "list";
544
+ config: ListViewConfig;
545
+ }
546
+ /**
547
+ * Unified view definition - discriminated union by type
548
+ */
549
+ type ViewDefinition = DetailViewDefinition | ListViewDefinition;
550
+ /**
551
+ * Configuration overrides for user customizations
552
+ * Only stores the delta from the source view
553
+ */
554
+ interface ConfigOverrides {
555
+ tabs?: ListViewTab[];
556
+ hiddenTabIds?: string[];
557
+ detailTabs?: Tab[];
558
+ hiddenDetailTabIds?: string[];
559
+ }
560
+ /**
561
+ * User customization overlay for a view
562
+ * Stored per user, merged at runtime with the source view
563
+ */
564
+ interface ViewOverlay {
565
+ /** Unique identifier */
566
+ id: string;
567
+ /** View ID this overlay applies to (UUID or virtual ID) */
568
+ viewId: string;
569
+ /** User ID who owns this overlay */
570
+ userId: string;
571
+ /** Configuration overrides (delta only) */
572
+ configOverrides: ConfigOverrides;
573
+ /** User's default view for this object (stored in overlay) */
574
+ isUserDefault?: boolean;
575
+ /** Created timestamp */
576
+ createdAt: Date;
577
+ /** Updated timestamp */
578
+ updatedAt: Date;
579
+ }
580
+ /**
581
+ * Check if a view is a detail view
582
+ */
583
+ declare function isDetailView(view: ViewDefinition): view is DetailViewDefinition;
584
+ /**
585
+ * Check if a view is a list view
586
+ */
587
+ declare function isListView(view: ViewDefinition): view is ListViewDefinition;
588
+ /**
589
+ * Check if a group is a field group (default type)
590
+ */
591
+ declare function isFieldGroup(group: Group): group is FieldGroup;
592
+ /**
593
+ * Check if a group is a relation group
594
+ */
595
+ declare function isRelationGroup(group: Group): group is RelationGroup;
596
+
597
+ interface AddAttributeInput {
598
+ name: string;
599
+ label: string;
600
+ type: AttributeType;
601
+ required?: boolean;
602
+ unique?: boolean;
603
+ description?: string;
604
+ placeholder?: string;
605
+ icon?: IconName;
606
+ defaultValue?: unknown;
607
+ metadata?: Record<string, unknown>;
608
+ [key: string]: unknown;
609
+ }
610
+ interface CreateCustomObjectInput {
611
+ name: string;
612
+ label: string;
613
+ pluralLabel?: string;
614
+ labelExpression: string;
615
+ embeddingExpression?: string;
616
+ description?: string;
617
+ icon?: IconName;
618
+ attributes?: (Attribute | {
619
+ build: () => Attribute;
620
+ })[];
621
+ metadata?: Record<string, unknown>;
622
+ }
623
+ interface UpdateObjectInput {
624
+ label?: string;
625
+ pluralLabel?: string;
626
+ description?: string;
627
+ icon?: IconName;
628
+ labelExpression?: string;
629
+ embeddingExpression?: string;
630
+ metadata?: Record<string, unknown>;
631
+ }
632
+ interface CreateViewInput {
633
+ objectName: string;
634
+ type: ViewType;
635
+ name: string;
636
+ label: string;
637
+ description?: string;
638
+ icon?: IconName;
639
+ config: ViewConfig;
640
+ default?: boolean;
641
+ metadata?: Record<string, unknown>;
642
+ }
643
+ interface UpdateViewInput {
644
+ label?: string;
645
+ description?: string;
646
+ icon?: IconName;
647
+ config?: ViewConfig;
648
+ default?: boolean;
649
+ metadata?: Record<string, unknown>;
650
+ }
651
+ interface RelationOption {
652
+ id: string;
653
+ objectId: string;
654
+ objectName: string;
655
+ objectLabel: string;
656
+ objectIcon?: string;
657
+ label: string;
658
+ }
659
+ interface RelationOptionsResponse {
660
+ options: RelationOption[];
661
+ hasMore: boolean;
662
+ total: number;
663
+ nextOffset?: number;
664
+ }
665
+
666
+ declare const statusGroupSchema: z.ZodEnum<{
667
+ idle: "idle";
668
+ in_progress: "in_progress";
669
+ finished: "finished";
670
+ }>;
671
+ declare const selectOptionWriteSchema: z.ZodObject<{
672
+ value: z.ZodString;
673
+ label: z.ZodString;
674
+ description: z.ZodOptional<z.ZodString>;
675
+ inverse: z.ZodOptional<z.ZodString>;
676
+ archived: z.ZodOptional<z.ZodBoolean>;
677
+ color: z.ZodEnum<{
678
+ gray: "gray";
679
+ slate: "slate";
680
+ blue: "blue";
681
+ sky: "sky";
682
+ indigo: "indigo";
683
+ green: "green";
684
+ emerald: "emerald";
685
+ teal: "teal";
686
+ red: "red";
687
+ rose: "rose";
688
+ yellow: "yellow";
689
+ amber: "amber";
690
+ orange: "orange";
691
+ purple: "purple";
692
+ violet: "violet";
693
+ fuchsia: "fuchsia";
694
+ pink: "pink";
695
+ cyan: "cyan";
696
+ lime: "lime";
697
+ }>;
698
+ }, z.core.$strict>;
699
+ declare const multiselectOptionWriteSchema: z.ZodObject<{
700
+ value: z.ZodString;
701
+ label: z.ZodString;
702
+ description: z.ZodOptional<z.ZodString>;
703
+ inverse: z.ZodOptional<z.ZodString>;
704
+ archived: z.ZodOptional<z.ZodBoolean>;
705
+ color: z.ZodEnum<{
706
+ gray: "gray";
707
+ slate: "slate";
708
+ blue: "blue";
709
+ sky: "sky";
710
+ indigo: "indigo";
711
+ green: "green";
712
+ emerald: "emerald";
713
+ teal: "teal";
714
+ red: "red";
715
+ rose: "rose";
716
+ yellow: "yellow";
717
+ amber: "amber";
718
+ orange: "orange";
719
+ purple: "purple";
720
+ violet: "violet";
721
+ fuchsia: "fuchsia";
722
+ pink: "pink";
723
+ cyan: "cyan";
724
+ lime: "lime";
725
+ }>;
726
+ }, z.core.$strict>;
727
+ declare const statusOptionWriteSchema: z.ZodObject<{
728
+ value: z.ZodString;
729
+ label: z.ZodString;
730
+ description: z.ZodOptional<z.ZodString>;
731
+ inverse: z.ZodOptional<z.ZodString>;
732
+ archived: z.ZodOptional<z.ZodBoolean>;
733
+ color: z.ZodEnum<{
734
+ gray: "gray";
735
+ slate: "slate";
736
+ blue: "blue";
737
+ sky: "sky";
738
+ indigo: "indigo";
739
+ green: "green";
740
+ emerald: "emerald";
741
+ teal: "teal";
742
+ red: "red";
743
+ rose: "rose";
744
+ yellow: "yellow";
745
+ amber: "amber";
746
+ orange: "orange";
747
+ purple: "purple";
748
+ violet: "violet";
749
+ fuchsia: "fuchsia";
750
+ pink: "pink";
751
+ cyan: "cyan";
752
+ lime: "lime";
753
+ }>;
754
+ group: z.ZodEnum<{
755
+ idle: "idle";
756
+ in_progress: "in_progress";
757
+ finished: "finished";
758
+ }>;
759
+ }, z.core.$strict>;
760
+ /**
761
+ * Map of attribute type to config schema
762
+ */
763
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
764
+ /**
765
+ * Get the config schema for a specific attribute type
766
+ */
767
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
768
+ /**
769
+ * Validate and strip unknown properties from attribute config
770
+ * This ensures only allowed properties are stored in the database
771
+ */
772
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
773
+ /**
774
+ * Strict parser for newly created attribute definitions.
775
+ *
776
+ * Top-level config remains strip-compatible with the historical config
777
+ * contract, while newly written icons and select-like option objects are
778
+ * validated strictly.
779
+ */
780
+ declare function parseAttributeConfigForCreate(type: AttributeType, input: unknown): Record<string, unknown>;
781
+ /**
782
+ * Patch-aware parser for persisted attributes.
783
+ *
784
+ * An explicit options patch owns and strictly validates the complete new
785
+ * list. Omission means the stored legacy list is preserved without
786
+ * reconstruction, including options that predate required colours/groups.
787
+ */
788
+ declare function parseAttributeConfigForUpdate(stored: Attribute, patch: Partial<AddAttributeInput>): Record<string, unknown>;
789
+
790
+ export { type RichtextTab as $, type AttributeGroupField as A, type FilterCombinator as B, type ConfigOverrides as C, type DetailViewConfig as D, type EmailsTab as E, type FilterState as F, type Group as G, type FilterGroup as H, type FormDensity as I, type FormTab as J, type FormsTab as K, type ListViewConfig as L, type MeetingsTab as M, type InverseSource as N, type ListViewLayout as O, NO_VALUE_OPERATORS as P, type NoValueOperator as Q, type RelationGroup as R, type SortRule as S, type TableTab as T, OPERATORS_BY_TYPE as U, type ViewType as V, type PhoneFilterValue as W, type QueryState as X, type RelationOption as Y, type RelationOptionsResponse as Z, type RelationSource as _, type ViewConfig as a, type SortDirection as a0, type TabType as a1, type TableSource as a2, type UpdateObjectInput as a3, type UpdateViewInput as a4, type ViewOverlay as a5, getRollupFilterOperators as a6, isDetailView as a7, isFieldGroup as a8, isListView as a9, isNoValueOperator as aa, isRelationGroup as ab, multiselectOptionWriteSchema as ac, parseAttributeConfig as ad, parseAttributeConfigForCreate as ae, parseAttributeConfigForUpdate as af, selectOptionWriteSchema as ag, statusGroupSchema as ah, statusOptionWriteSchema as ai, attributeConfigSchemas as aj, getAttributeConfigSchema as ak, type FilterOperator as b, type DetailViewDefinition as c, type SidePanelConfig as d, type Field as e, type FieldGroup as f, type CreateMode as g, type Tab as h, type ListViewDefinition as i, type ViewDefinition as j, type ListViewTab as k, type FilterValue as l, type FilterRule as m, type DynamicValue as n, type RelativeDateValue as o, type ActivityTab as p, type AddAttributeInput as q, type AdvancedFilterState as r, type CreateCustomObjectInput as s, type CreateViewInput as t, type CurrencyFilterValue as u, type CustomTab as v, type DayMonthValue as w, type DocumentsTab as x, type EdgeQuantifier as y, type ExtendedFilterRule as z };