@stndrds/schema 0.1.0-alpha.14

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 (128) hide show
  1. package/dist/chunk-3ABIOLKO.mjs +4624 -0
  2. package/dist/chunk-3IRX2BDY.mjs +3970 -0
  3. package/dist/chunk-4OTLPWSP.mjs +4448 -0
  4. package/dist/chunk-54ODQBUN.mjs +3867 -0
  5. package/dist/chunk-6HIA3FR2.mjs +4230 -0
  6. package/dist/chunk-6P3XHNLD.mjs +4171 -0
  7. package/dist/chunk-7LJECNAS.mjs +4167 -0
  8. package/dist/chunk-A2WNLUKV.mjs +4475 -0
  9. package/dist/chunk-AA3234RM.mjs +4475 -0
  10. package/dist/chunk-ADNXDLLD.mjs +3136 -0
  11. package/dist/chunk-B4DCDQUI.mjs +4695 -0
  12. package/dist/chunk-B4PSXY6I.mjs +4527 -0
  13. package/dist/chunk-BJHJBZCM.mjs +4228 -0
  14. package/dist/chunk-C3ZWTO6G.mjs +4474 -0
  15. package/dist/chunk-CLOGNKDD.mjs +4040 -0
  16. package/dist/chunk-EW4V63PA.mjs +3053 -0
  17. package/dist/chunk-FR2LCO6R.mjs +2485 -0
  18. package/dist/chunk-GJSF2RKL.mjs +2786 -0
  19. package/dist/chunk-GO5NPP2X.mjs +4726 -0
  20. package/dist/chunk-H3ZYJUDS.mjs +3050 -0
  21. package/dist/chunk-IDDLSFSK.mjs +4230 -0
  22. package/dist/chunk-JRADUJQ7.mjs +4726 -0
  23. package/dist/chunk-NEDR6N7R.mjs +3118 -0
  24. package/dist/chunk-NESPRMDF.mjs +2482 -0
  25. package/dist/chunk-NWFGRJBW.mjs +4612 -0
  26. package/dist/chunk-NXJ57GSN.mjs +2918 -0
  27. package/dist/chunk-O4C5FCTS.mjs +3961 -0
  28. package/dist/chunk-O4PRB27Q.mjs +2513 -0
  29. package/dist/chunk-OJDFNUCR.mjs +4463 -0
  30. package/dist/chunk-OSEKVBHC.mjs +4627 -0
  31. package/dist/chunk-QX4U6U6K.mjs +2484 -0
  32. package/dist/chunk-RMDQ6LKV.mjs +3046 -0
  33. package/dist/chunk-SBXKDATH.mjs +2673 -0
  34. package/dist/chunk-SKMP3AP3.mjs +2918 -0
  35. package/dist/chunk-STMS7WZD.mjs +2623 -0
  36. package/dist/chunk-T3T6PTFG.mjs +3057 -0
  37. package/dist/chunk-TPW72RAH.mjs +4624 -0
  38. package/dist/chunk-TUQEGNGV.mjs +2534 -0
  39. package/dist/chunk-TVKFS3YN.mjs +2449 -0
  40. package/dist/chunk-TZTH3BHG.mjs +3110 -0
  41. package/dist/chunk-W6MU3XPG.mjs +4612 -0
  42. package/dist/chunk-WL7Z3YFR.mjs +4603 -0
  43. package/dist/chunk-XNVVYHH3.mjs +4602 -0
  44. package/dist/chunk-XTA3WY64.mjs +2918 -0
  45. package/dist/chunk-YV7DEZFZ.mjs +2528 -0
  46. package/dist/chunk-ZLJPJND6.mjs +4474 -0
  47. package/dist/chunk-ZNZXTCEX.mjs +4234 -0
  48. package/dist/index.d.mts +1222 -0
  49. package/dist/index.d.ts +1222 -0
  50. package/dist/index.js +5320 -0
  51. package/dist/index.mjs +635 -0
  52. package/dist/runtime-2iKarXtl.d.mts +1924 -0
  53. package/dist/runtime-2iKarXtl.d.ts +1924 -0
  54. package/dist/runtime-4l2ddHZ7.d.mts +2242 -0
  55. package/dist/runtime-4l2ddHZ7.d.ts +2243 -0
  56. package/dist/runtime-8hKS6zAv.d.mts +2226 -0
  57. package/dist/runtime-8hKS6zAv.d.ts +2226 -0
  58. package/dist/runtime-B6yjtoR3.d.mts +4142 -0
  59. package/dist/runtime-B6yjtoR3.d.ts +4142 -0
  60. package/dist/runtime-BGCShrZB.d.mts +2001 -0
  61. package/dist/runtime-BGCShrZB.d.ts +2001 -0
  62. package/dist/runtime-BRW4NGAk.d.mts +1668 -0
  63. package/dist/runtime-BRW4NGAk.d.ts +1668 -0
  64. package/dist/runtime-BnfBr314.d.mts +1683 -0
  65. package/dist/runtime-BnfBr314.d.ts +1683 -0
  66. package/dist/runtime-BrqhiJUF.d.mts +4151 -0
  67. package/dist/runtime-BrqhiJUF.d.ts +4151 -0
  68. package/dist/runtime-Bvj8c-BE.d.mts +4277 -0
  69. package/dist/runtime-Bvj8c-BE.d.ts +4277 -0
  70. package/dist/runtime-C03qT4qU.d.mts +4267 -0
  71. package/dist/runtime-C03qT4qU.d.ts +4267 -0
  72. package/dist/runtime-CaCZ7mSf.d.mts +2974 -0
  73. package/dist/runtime-CaCZ7mSf.d.ts +2974 -0
  74. package/dist/runtime-CaIzNX0Z.d.mts +4091 -0
  75. package/dist/runtime-CaIzNX0Z.d.ts +4091 -0
  76. package/dist/runtime-ChPTgmLP.d.mts +4320 -0
  77. package/dist/runtime-ChPTgmLP.d.ts +4320 -0
  78. package/dist/runtime-CnImZ1Vv.d.mts +4267 -0
  79. package/dist/runtime-CnImZ1Vv.d.ts +4267 -0
  80. package/dist/runtime-Cp-B26Nj.d.mts +2890 -0
  81. package/dist/runtime-Cp-B26Nj.d.ts +2890 -0
  82. package/dist/runtime-Cq8jfk3c.d.mts +4277 -0
  83. package/dist/runtime-Cq8jfk3c.d.ts +4277 -0
  84. package/dist/runtime-CqDFXhhP.d.mts +1685 -0
  85. package/dist/runtime-CqDFXhhP.d.ts +1685 -0
  86. package/dist/runtime-CqtpZLdL.d.mts +4280 -0
  87. package/dist/runtime-CqtpZLdL.d.ts +4280 -0
  88. package/dist/runtime-D-4DblaZ.d.mts +4147 -0
  89. package/dist/runtime-D-4DblaZ.d.ts +4147 -0
  90. package/dist/runtime-D59sSqNl.d.mts +4146 -0
  91. package/dist/runtime-D59sSqNl.d.ts +4146 -0
  92. package/dist/runtime-DEfPk3wT.d.mts +1840 -0
  93. package/dist/runtime-DEfPk3wT.d.ts +1840 -0
  94. package/dist/runtime-DGV-7vES.d.mts +1685 -0
  95. package/dist/runtime-DGV-7vES.d.ts +1685 -0
  96. package/dist/runtime-DNacghqc.d.mts +3971 -0
  97. package/dist/runtime-DNacghqc.d.ts +3971 -0
  98. package/dist/runtime-DPLsUHYK.d.mts +3977 -0
  99. package/dist/runtime-DPLsUHYK.d.ts +3977 -0
  100. package/dist/runtime-DTxCw60F.d.mts +2973 -0
  101. package/dist/runtime-DTxCw60F.d.ts +2973 -0
  102. package/dist/runtime-DUXJ-zNS.d.mts +2788 -0
  103. package/dist/runtime-DUXJ-zNS.d.ts +2788 -0
  104. package/dist/runtime-DbljInhV.d.mts +2237 -0
  105. package/dist/runtime-DbljInhV.d.ts +2237 -0
  106. package/dist/runtime-DcH3y6Yu.d.mts +4272 -0
  107. package/dist/runtime-DcH3y6Yu.d.ts +4272 -0
  108. package/dist/runtime-DdBFz85g.d.mts +4229 -0
  109. package/dist/runtime-DdBFz85g.d.ts +4229 -0
  110. package/dist/runtime-DjMWhjkm.d.mts +4321 -0
  111. package/dist/runtime-DjMWhjkm.d.ts +4321 -0
  112. package/dist/runtime-Djz3fOBE.d.mts +2078 -0
  113. package/dist/runtime-Djz3fOBE.d.ts +2078 -0
  114. package/dist/runtime-Dli8g3Aq.d.mts +2082 -0
  115. package/dist/runtime-Dli8g3Aq.d.ts +2082 -0
  116. package/dist/runtime-a8J378im.d.mts +4123 -0
  117. package/dist/runtime-a8J378im.d.ts +4123 -0
  118. package/dist/runtime-dp3rb3Lf.d.mts +2968 -0
  119. package/dist/runtime-dp3rb3Lf.d.ts +2968 -0
  120. package/dist/runtime-iWXlSN_H.d.mts +1683 -0
  121. package/dist/runtime-iWXlSN_H.d.ts +1683 -0
  122. package/dist/runtime-yMql0npY.d.mts +4321 -0
  123. package/dist/runtime-yMql0npY.d.ts +4321 -0
  124. package/dist/runtime.d.mts +3 -0
  125. package/dist/runtime.d.ts +3 -0
  126. package/dist/runtime.js +3626 -0
  127. package/dist/runtime.mjs +48 -0
  128. package/package.json +58 -0
@@ -0,0 +1,4147 @@
1
+ import { ColorId, IconName, CountryIso3, CurrencyCode, MimeType } from '@stndrds/constants';
2
+ import { z } from 'zod';
3
+
4
+ /**
5
+ * UUID string type for all identifiers
6
+ */
7
+ type Uuid = string;
8
+ /**
9
+ * Tenant identifier for multi-tenant isolation
10
+ * Phase 1: Type defined but not yet used in interfaces
11
+ * Phase 2+: Will be added to ObjectRecord and services for SaaS mode
12
+ */
13
+ type TenantId = string;
14
+ /**
15
+ * Generate a unique UUID v4
16
+ * Uses crypto.randomUUID() when available (Node.js 19+, modern browsers)
17
+ * Falls back to a manual implementation for older environments
18
+ *
19
+ * @returns A UUID v4 string
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const id = generateId();
24
+ * // "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
25
+ * ```
26
+ */
27
+ declare function generateId(): Uuid;
28
+ /**
29
+ * Generate a prefixed ID for better debugging and readability
30
+ *
31
+ * @param prefix - Prefix for the ID (e.g., "obj", "attr", "rec")
32
+ * @returns A prefixed UUID string
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const objectId = generatePrefixedId("obj");
37
+ * // "obj_a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
38
+ *
39
+ * const attrId = generatePrefixedId("attr");
40
+ * // "attr_a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
41
+ * ```
42
+ */
43
+ declare function generatePrefixedId(prefix: string): Uuid;
44
+
45
+ type AttributeType = "text" | "textarea" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "timestamp" | "select" | "multiselect" | "file" | "user" | "relation" | "rating";
46
+ /**
47
+ * Status group categorization
48
+ */
49
+ type StatusGroup = "idle" | "in_progress" | "finished";
50
+ /**
51
+ * Unified option type for select-like fields
52
+ */
53
+ interface Option {
54
+ id: string;
55
+ label: string;
56
+ value: string;
57
+ color?: ColorId;
58
+ icon?: IconName;
59
+ description?: string;
60
+ group?: StatusGroup;
61
+ }
62
+ /**
63
+ * Attribute grouping for UI organization
64
+ */
65
+ interface AttributeGroup {
66
+ id: string;
67
+ label: string;
68
+ description?: string;
69
+ attributeIds: string[];
70
+ collapsible?: boolean;
71
+ collapsed?: boolean;
72
+ order?: number;
73
+ }
74
+ interface BaseAttribute<DefaultValueType = unknown> {
75
+ id: Uuid;
76
+ name: string;
77
+ label: string;
78
+ type: AttributeType;
79
+ required: boolean;
80
+ disabled?: boolean;
81
+ placeholder?: string;
82
+ description?: string;
83
+ defaultValue?: DefaultValueType;
84
+ icon?: IconName;
85
+ order?: number;
86
+ hidden?: boolean;
87
+ archived?: boolean;
88
+ deprecated?: boolean;
89
+ system?: boolean;
90
+ metadata?: Record<string, unknown>;
91
+ }
92
+ interface TextAttribute extends BaseAttribute<string> {
93
+ type: "text";
94
+ minLength?: number;
95
+ maxLength?: number;
96
+ pattern?: string;
97
+ }
98
+ type NumberUnit = "integer" | "decimal" | "percentage";
99
+ interface NumberAttribute extends BaseAttribute<number> {
100
+ type: "number";
101
+ min?: number;
102
+ max?: number;
103
+ unit?: NumberUnit;
104
+ decimals?: number;
105
+ }
106
+ interface CheckboxAttribute extends BaseAttribute<boolean> {
107
+ type: "checkbox";
108
+ }
109
+ type DateFormat = "short" | "long" | "full" | "relative";
110
+ type DateValue = string | "today";
111
+ interface DateAttribute extends BaseAttribute<string> {
112
+ type: "date";
113
+ dateFormat?: DateFormat;
114
+ minDate?: DateValue;
115
+ maxDate?: DateValue;
116
+ }
117
+ interface Phone {
118
+ countryCode: CountryIso3;
119
+ phoneNumber: string;
120
+ }
121
+ interface PhoneAttribute extends BaseAttribute<Phone> {
122
+ type: "phone";
123
+ defaultCountryCode?: CountryIso3;
124
+ }
125
+ interface Currency {
126
+ code: CurrencyCode;
127
+ value: number;
128
+ }
129
+ interface CurrencyAttribute extends BaseAttribute<Currency> {
130
+ type: "currency";
131
+ defaultCurrency?: CurrencyCode;
132
+ allowedCurrencies?: CurrencyCode[];
133
+ }
134
+ /**
135
+ * StatusAttribute - For workflow states with semantic grouping (idle/in_progress/finished)
136
+ * Use this for: Task status, Order status, Project phases, Process states
137
+ * Use SelectAttribute for: Categories, Types, simple choices without workflow
138
+ */
139
+ interface StatusAttribute extends BaseAttribute<string> {
140
+ type: "status";
141
+ options: Option[];
142
+ }
143
+ interface Location {
144
+ address?: string;
145
+ address2?: string;
146
+ city?: string;
147
+ state?: string;
148
+ postalCode?: string;
149
+ country?: CountryIso3;
150
+ latitude?: number;
151
+ longitude?: number;
152
+ }
153
+ type LocationGranularity = "full" | "address" | "city" | "state" | "country" | "coordinates";
154
+ interface LocationAttribute extends BaseAttribute<Location> {
155
+ type: "location";
156
+ granularity: LocationGranularity;
157
+ enableAutocomplete?: boolean;
158
+ enableMap?: boolean;
159
+ defaultCountry?: CountryIso3;
160
+ allowedCountries?: CountryIso3[];
161
+ displayFormat?: "single_line" | "multi_line" | "compact";
162
+ }
163
+ interface TimestampAttribute extends BaseAttribute<number> {
164
+ type: "timestamp";
165
+ autoUpdate?: boolean;
166
+ }
167
+ /**
168
+ * SelectAttribute - For simple single-choice selection
169
+ * Use this for: Categories, Document types, Departments, Priorities
170
+ * Options can be grouped (e.g., countries by continent) but no workflow logic
171
+ */
172
+ interface SelectAttribute extends BaseAttribute<string> {
173
+ type: "select";
174
+ options: Option[];
175
+ }
176
+ interface MultiselectAttribute extends BaseAttribute<string[]> {
177
+ type: "multiselect";
178
+ options: Option[];
179
+ }
180
+ type DocumentType = "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
181
+ type DocumentFace = "front" | "back" | "single";
182
+ interface DocumentTypeConfig {
183
+ type: DocumentType;
184
+ label: string;
185
+ faces: DocumentFace[];
186
+ attributeMapping?: {
187
+ attributeId: string;
188
+ extractedKey: string;
189
+ face?: DocumentFace;
190
+ required?: boolean;
191
+ }[];
192
+ }
193
+ interface FileVerificationConfig {
194
+ enabled: boolean;
195
+ documentTypes: DocumentTypeConfig[];
196
+ autoExtract?: boolean;
197
+ autoValidate?: boolean;
198
+ }
199
+ interface FileAttribute extends BaseAttribute<string> {
200
+ type: "file";
201
+ maxFiles?: number;
202
+ maxSize?: number;
203
+ allowedTypes?: MimeType[] | readonly MimeType[];
204
+ verification?: FileVerificationConfig;
205
+ }
206
+ interface UserAttribute extends BaseAttribute<string> {
207
+ type: "user";
208
+ allowedRoles?: string[];
209
+ }
210
+ /**
211
+ * Target object for a relation - defines which objects can be linked
212
+ */
213
+ interface RelationTarget {
214
+ /** Object name (e.g., "companies", "contacts") */
215
+ object: string;
216
+ /**
217
+ * Display template for the label using mustache-like syntax
218
+ * @example "{name}" or "{firstName} {lastName} — {email}"
219
+ */
220
+ displayTemplate?: string;
221
+ /**
222
+ * Optional filter to restrict available records
223
+ * @example { status: "active" }
224
+ */
225
+ filter?: Record<string, unknown>;
226
+ }
227
+ /**
228
+ * Strategy when a target record is deleted
229
+ * - "restrict": Prevent deletion if relations exist (default)
230
+ * - "cascade": Delete this record too
231
+ * - "set_null": Set the relation value to null
232
+ */
233
+ type RelationOnDelete = "restrict" | "cascade" | "set_null";
234
+ /**
235
+ * Base properties shared by both single and multi relation attributes
236
+ */
237
+ interface RelationAttributeBase extends Omit<BaseAttribute<unknown>, "defaultValue"> {
238
+ type: "relation";
239
+ /** Target objects that can be linked */
240
+ targets: RelationTarget[];
241
+ /** Deletion strategy when target record is deleted */
242
+ onDelete?: RelationOnDelete;
243
+ }
244
+ /**
245
+ * Single relation attribute (one-to-one or many-to-one)
246
+ * Stores a single record ID or null
247
+ */
248
+ interface SingleRelationAttribute extends RelationAttributeBase {
249
+ cardinality: "one";
250
+ defaultValue?: string | null;
251
+ }
252
+ /**
253
+ * Multi relation attribute (one-to-many or many-to-many)
254
+ * Stores an array of record IDs
255
+ */
256
+ interface MultiRelationAttribute extends RelationAttributeBase {
257
+ cardinality: "many";
258
+ defaultValue?: string[];
259
+ /** Minimum number of relations required */
260
+ minItems?: number;
261
+ /** Maximum number of relations allowed */
262
+ maxItems?: number;
263
+ }
264
+ /**
265
+ * RelationAttribute links to other objects/records
266
+ * Discriminated union by cardinality for type-safe value handling
267
+ *
268
+ * @example Single relation (many-to-one)
269
+ * ```typescript
270
+ * relation({ name: "company", label: "Company" })
271
+ * .to("companies")
272
+ * .required()
273
+ * // → Value: "rec-uuid-123" | null
274
+ * ```
275
+ *
276
+ * @example Multi relation (many-to-many)
277
+ * ```typescript
278
+ * relation({ name: "contacts", label: "Contacts" })
279
+ * .to("contacts", { displayTemplate: "{firstName} {lastName}" })
280
+ * .many()
281
+ * .maxItems(5)
282
+ * // → Value: ["rec-1", "rec-2", ...]
283
+ * ```
284
+ *
285
+ * @example Polymorphic relation (multiple target objects)
286
+ * ```typescript
287
+ * relation({ name: "linked", label: "Linked Items" })
288
+ * .to("companies")
289
+ * .to("contacts")
290
+ * .to("deals")
291
+ * .many()
292
+ * // → Can link to records from any of these objects
293
+ * ```
294
+ */
295
+ type RelationAttribute = SingleRelationAttribute | MultiRelationAttribute;
296
+ interface TextAreaAttribute extends BaseAttribute<string> {
297
+ type: "textarea";
298
+ }
299
+ interface RatingAttribute extends BaseAttribute<number> {
300
+ type: "rating";
301
+ max?: number;
302
+ iconType?: "star" | "heart" | "thumbs" | "number";
303
+ }
304
+ type Attribute = TextAttribute | TextAreaAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | TimestampAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute;
305
+
306
+ /**
307
+ * Timestamps for tracking creation and updates
308
+ */
309
+ interface Timestamps {
310
+ createdAt: Date;
311
+ updatedAt: Date;
312
+ }
313
+ /**
314
+ * Object definition - Represents a database table/entity
315
+ */
316
+ interface ObjectDefinition {
317
+ id?: Uuid;
318
+ name: string;
319
+ label: string;
320
+ description?: string;
321
+ icon?: IconName;
322
+ /**
323
+ * Template expression used to compute the object's display label.
324
+ * Supports variable interpolation and pipes for formatting.
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * // Simple attribute reference
329
+ * labelExpression: "{{ name }}"
330
+ *
331
+ * // Multiple attributes
332
+ * labelExpression: "{{ firstName }} {{ lastName }}"
333
+ *
334
+ * // With pipes for formatting
335
+ * labelExpression: "{{ code | UPPER }} - {{ name | capitalize }}"
336
+ * ```
337
+ *
338
+ * Available pipes: UPPER, LOWER, capitalize, trim
339
+ */
340
+ labelExpression: string;
341
+ attributes: Attribute[];
342
+ system?: boolean;
343
+ metadata?: Record<string, unknown>;
344
+ }
345
+ /**
346
+ * Links an attribute to an object
347
+ */
348
+ interface ObjectAttribute {
349
+ objectId: Uuid;
350
+ attributeId: Uuid;
351
+ order?: number;
352
+ required?: boolean;
353
+ }
354
+ /**
355
+ * Completion status of a record based on data completeness.
356
+ *
357
+ * - `draft`: Record is missing one or more required attribute values.
358
+ * Can be saved but is considered incomplete.
359
+ * - `complete`: All required attribute values are present and valid.
360
+ * Record is ready for use.
361
+ *
362
+ * This is different from workflow status (e.g., "pending", "approved").
363
+ * Completion status is computed dynamically based on the object schema.
364
+ */
365
+ type CompletionStatus = "draft" | "complete";
366
+ /**
367
+ * Record - Instance of an Object (a row in the database)
368
+ */
369
+ interface ObjectRecord extends Timestamps {
370
+ id: Uuid;
371
+ objectId: Uuid;
372
+ /**
373
+ * Display label computed from the object's labelExpression.
374
+ * Computed dynamically based on record values.
375
+ *
376
+ * @example "John Doe" (from "{{ firstName }} {{ lastName }}")
377
+ */
378
+ label: string;
379
+ /**
380
+ * Completion status of the record.
381
+ * - `draft`: Missing required values, record is incomplete
382
+ * - `complete`: All required values present and valid
383
+ *
384
+ * Computed dynamically based on the object's schema.
385
+ */
386
+ completionStatus: CompletionStatus;
387
+ values: Record<string, unknown>;
388
+ }
389
+
390
+ /**
391
+ * Storage provider type
392
+ */
393
+ type StorageProvider = "s3" | "gcs" | "azure" | "local" | "cloudflare-r2" | string;
394
+ /**
395
+ * File visibility level
396
+ */
397
+ type FileVisibility = "public" | "private" | "restricted";
398
+ /**
399
+ * File - Represents uploaded file metadata and storage info
400
+ *
401
+ * ARCHITECTURE:
402
+ * - Fixed table (no custom attributes)
403
+ * - Manages file storage, permissions, and metadata
404
+ * - uploadedBy links to user_profiles table
405
+ * - Supports soft delete via deletedAt
406
+ *
407
+ * @example
408
+ * ```typescript
409
+ * const file: File = {
410
+ * id: "file-123",
411
+ * tenantId: "tenant-456",
412
+ * name: "contract-2025.pdf",
413
+ * originalName: "Contract Acme Corp 2025.pdf",
414
+ * mimeType: "application/pdf",
415
+ * size: 2458624,
416
+ * storageProvider: "s3",
417
+ * storagePath: "tenants/456/files/2025/11/contract-2025.pdf",
418
+ * storageBucket: "my-app-files",
419
+ * url: "https://cdn.example.com/files/file-123",
420
+ * uploadedBy: "profile-789",
421
+ * folderPath: "/contracts/2025",
422
+ * tags: ["contract", "legal"],
423
+ * visibility: "restricted",
424
+ * allowedUsers: ["profile-789", "profile-456"],
425
+ * createdAt: new Date(),
426
+ * updatedAt: new Date(),
427
+ * };
428
+ * ```
429
+ */
430
+ interface File extends Timestamps {
431
+ id: Uuid;
432
+ tenantId: Uuid;
433
+ /**
434
+ * File name (sanitized for storage)
435
+ */
436
+ name: string;
437
+ /**
438
+ * Original file name (as uploaded by user)
439
+ */
440
+ originalName: string;
441
+ /**
442
+ * MIME type (e.g., "application/pdf", "image/jpeg")
443
+ */
444
+ mimeType: MimeType | string;
445
+ /**
446
+ * File size in bytes
447
+ */
448
+ size: number;
449
+ /**
450
+ * Storage provider (s3, gcs, azure, local, etc.)
451
+ */
452
+ storageProvider: StorageProvider;
453
+ /**
454
+ * Path in the storage bucket
455
+ */
456
+ storagePath: string;
457
+ /**
458
+ * Storage bucket name (if applicable)
459
+ */
460
+ storageBucket?: string;
461
+ /**
462
+ * Public or signed URL to access the file
463
+ */
464
+ url: string;
465
+ /**
466
+ * User who uploaded the file (FK to user_profiles)
467
+ */
468
+ uploadedBy: Uuid;
469
+ /**
470
+ * Folder path for organization (e.g., "/contracts/2025")
471
+ */
472
+ folderPath?: string;
473
+ /**
474
+ * Tags for search and categorization
475
+ */
476
+ tags?: string[];
477
+ /**
478
+ * File visibility level
479
+ * - public: Anyone with the URL can access
480
+ * - private: Only uploadedBy can access
481
+ * - restricted: Only specific users (allowedUsers) can access
482
+ */
483
+ visibility: FileVisibility;
484
+ /**
485
+ * List of user IDs authorized to access this file (if visibility = "restricted")
486
+ */
487
+ allowedUsers?: Uuid[];
488
+ /**
489
+ * Soft delete timestamp (null = not deleted)
490
+ */
491
+ deletedAt?: Date;
492
+ }
493
+ /**
494
+ * Data required to create a new file record
495
+ */
496
+ interface CreateFile {
497
+ tenantId: Uuid;
498
+ name: string;
499
+ originalName: string;
500
+ mimeType: MimeType | string;
501
+ size: number;
502
+ storageProvider: StorageProvider;
503
+ storagePath: string;
504
+ storageBucket?: string;
505
+ url: string;
506
+ uploadedBy: Uuid;
507
+ folderPath?: string;
508
+ tags?: string[];
509
+ visibility?: FileVisibility;
510
+ allowedUsers?: Uuid[];
511
+ }
512
+ /**
513
+ * Data for updating an existing file record
514
+ */
515
+ interface UpdateFile {
516
+ name?: string;
517
+ folderPath?: string;
518
+ tags?: string[];
519
+ visibility?: FileVisibility;
520
+ allowedUsers?: Uuid[];
521
+ }
522
+
523
+ /**
524
+ * Autocomplete suggestion from geocoding service
525
+ */
526
+ interface GeocodingSuggestion {
527
+ /** Unique identifier from the provider */
528
+ id: string;
529
+ /** Human-readable label for display */
530
+ label: string;
531
+ /** Structured location data */
532
+ location: Location;
533
+ /** Optional match score/confidence (0-1) */
534
+ score?: number;
535
+ /** Optional additional metadata from the provider */
536
+ metadata?: Record<string, unknown>;
537
+ }
538
+ /**
539
+ * Parameters for autocomplete search
540
+ */
541
+ interface GeocodingAutocompleteParams {
542
+ /** Search query */
543
+ query: string;
544
+ /** Restrict results to specific countries */
545
+ countries?: CountryIso3[];
546
+ /** Preferred language for results (ISO 639-1) */
547
+ language?: string;
548
+ /** Maximum number of results */
549
+ limit?: number;
550
+ /** Bias results toward a specific location */
551
+ biasLocation?: {
552
+ latitude: number;
553
+ longitude: number;
554
+ };
555
+ /** Session token for billing optimization (some providers) */
556
+ sessionToken?: string;
557
+ /**
558
+ * Level of address detail expected
559
+ * Adapters can use this to filter/optimize results
560
+ * - "full": Full address with street, city, postal code, etc.
561
+ * - "address": Street address without postal code
562
+ * - "city": City level only
563
+ * - "state": State/region level only
564
+ * - "country": Country level only
565
+ * - "coordinates": Only coordinates (lat/lng)
566
+ */
567
+ granularity?: LocationGranularity;
568
+ }
569
+ /**
570
+ * Parameters for reverse geocoding
571
+ */
572
+ interface ReverseGeocodingParams {
573
+ /** Latitude */
574
+ latitude: number;
575
+ /** Longitude */
576
+ longitude: number;
577
+ /** Preferred language for results */
578
+ language?: string;
579
+ }
580
+ /**
581
+ * Parameters for geocoding a structured address
582
+ */
583
+ interface GeocodingParams {
584
+ /** Structured address components */
585
+ address: Partial<Location>;
586
+ /** Preferred language for results */
587
+ language?: string;
588
+ }
589
+ /**
590
+ * Abstract geocoding adapter interface
591
+ * Implement this interface for different geocoding providers
592
+ *
593
+ * @example Google Maps implementation
594
+ * ```typescript
595
+ * class GoogleMapsGeocodingAdapter implements GeocodingAdapter {
596
+ * async autocomplete(params) {
597
+ * const response = await fetch(
598
+ * `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${params.query}&key=${this.apiKey}`
599
+ * );
600
+ * // Transform response to GeocodingSuggestion[]
601
+ * }
602
+ * }
603
+ * ```
604
+ *
605
+ * @example Mapbox implementation
606
+ * ```typescript
607
+ * class MapboxGeocodingAdapter implements GeocodingAdapter {
608
+ * async autocomplete(params) {
609
+ * const response = await fetch(
610
+ * `https://api.mapbox.com/geocoding/v5/mapbox.places/${params.query}.json?access_token=${this.token}`
611
+ * );
612
+ * // Transform response to GeocodingSuggestion[]
613
+ * }
614
+ * }
615
+ * ```
616
+ */
617
+ interface GeocodingAdapter {
618
+ /**
619
+ * Autocomplete address search
620
+ * Returns suggestions as the user types
621
+ */
622
+ autocomplete(params: GeocodingAutocompleteParams): Promise<GeocodingSuggestion[]>;
623
+ /**
624
+ * Reverse geocode coordinates to an address
625
+ * Optional - some providers may not support this
626
+ */
627
+ reverse?(params: ReverseGeocodingParams): Promise<GeocodingSuggestion | null>;
628
+ /**
629
+ * Geocode a structured address to coordinates
630
+ * Optional - some providers may not support this
631
+ */
632
+ geocode?(params: GeocodingParams): Promise<GeocodingSuggestion | null>;
633
+ }
634
+ /**
635
+ * No-op geocoding adapter
636
+ * Returns empty results when no geocoding provider is configured
637
+ */
638
+ declare class NoopGeocodingAdapter implements GeocodingAdapter {
639
+ autocomplete(): Promise<GeocodingSuggestion[]>;
640
+ reverse(): Promise<null>;
641
+ geocode(): Promise<null>;
642
+ }
643
+
644
+ /**
645
+ * User role in the application
646
+ * Can be extended with custom roles as needed
647
+ */
648
+ type UserRole = "admin" | "member" | "guest" | string;
649
+ /**
650
+ * User status for account management
651
+ */
652
+ type UserStatus = "active" | "pending" | "inactive" | "suspended";
653
+ /**
654
+ * User Profile - Represents application user data (authorization)
655
+ *
656
+ * ARCHITECTURE:
657
+ * - authId links to external auth provider (Supabase, Clerk, Auth0, etc.)
658
+ * - email is denormalized from auth provider for performance
659
+ * - Auth provider handles authentication (passwords, sessions, OAuth)
660
+ * - This type handles authorization (roles, permissions, tenant membership)
661
+ *
662
+ * @example
663
+ * ```typescript
664
+ * const profile: UserProfile = {
665
+ * id: "profile-123",
666
+ * tenantId: "tenant-456",
667
+ * authId: "supabase-auth-uuid-789",
668
+ * email: "john@example.com",
669
+ * firstName: "John",
670
+ * lastName: "Doe",
671
+ * role: "admin",
672
+ * status: "active",
673
+ * createdAt: new Date(),
674
+ * updatedAt: new Date(),
675
+ * };
676
+ * ```
677
+ */
678
+ interface UserProfile extends Timestamps {
679
+ id: Uuid;
680
+ tenantId: Uuid;
681
+ /**
682
+ * Link to external auth provider (Supabase auth.users.id, Clerk user ID, etc.)
683
+ * This is the bridge between authentication (provider) and authorization (your app)
684
+ */
685
+ authId: string;
686
+ /**
687
+ * Email address (denormalized from auth provider)
688
+ * Allows efficient querying and filtering without hitting auth provider API
689
+ */
690
+ email: string;
691
+ /**
692
+ * User's first name
693
+ */
694
+ firstName?: string;
695
+ /**
696
+ * User's last name
697
+ */
698
+ lastName?: string;
699
+ /**
700
+ * Avatar/profile picture URL
701
+ */
702
+ avatarUrl?: string;
703
+ /**
704
+ * User role for authorization
705
+ * Common values: "admin", "member", "guest"
706
+ * Can be extended with custom roles
707
+ */
708
+ role: UserRole;
709
+ /**
710
+ * Account status
711
+ * - active: Normal user, full access
712
+ * - pending: Awaiting activation/approval
713
+ * - inactive: Deactivated account
714
+ * - suspended: Temporarily blocked
715
+ */
716
+ status: UserStatus;
717
+ /**
718
+ * Last login timestamp (updated on each successful auth)
719
+ */
720
+ lastLoginAt?: Date;
721
+ }
722
+ /**
723
+ * Data required to create a new user profile
724
+ */
725
+ interface CreateUserProfile {
726
+ tenantId: Uuid;
727
+ authId: string;
728
+ email: string;
729
+ firstName?: string;
730
+ lastName?: string;
731
+ avatarUrl?: string;
732
+ role?: UserRole;
733
+ status?: UserStatus;
734
+ }
735
+ /**
736
+ * Data for updating an existing user profile
737
+ */
738
+ interface UpdateUserProfile {
739
+ firstName?: string;
740
+ lastName?: string;
741
+ avatarUrl?: string;
742
+ role?: UserRole;
743
+ status?: UserStatus;
744
+ lastLoginAt?: Date;
745
+ }
746
+
747
+ /**
748
+ * Inline attribute group configuration
749
+ * Groups multiple attributes into a single composite field with dropdown editing
750
+ */
751
+ interface AttributeGroupField {
752
+ /** Unique identifier for the group */
753
+ id: string;
754
+ /** Display label for the composite field */
755
+ label: string;
756
+ /** Description shown in the dropdown */
757
+ description?: string;
758
+ /** Attribute names to include in this group */
759
+ attributes: string[];
760
+ /**
761
+ * Template for the display value
762
+ * Uses {attributeName} syntax for interpolation
763
+ * @example "{billing_street}, {billing_city} {billing_postal_code}"
764
+ */
765
+ displayTemplate?: string;
766
+ }
767
+ /**
768
+ * Field definition within a form group
769
+ * Can be either a single attribute or an inline attribute group
770
+ */
771
+ interface Field {
772
+ /** Attribute name to display (for single attribute fields) */
773
+ attribute?: string;
774
+ /** Inline attribute group (groups multiple attributes into one composite field) */
775
+ attributeGroup?: AttributeGroupField;
776
+ /** Grid span (1-12 columns) */
777
+ span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
778
+ /** Override label for this view (only for single attribute fields) */
779
+ label?: string;
780
+ /** Force read-only display */
781
+ readOnly?: boolean;
782
+ }
783
+ /**
784
+ * Group of fields for organizing forms
785
+ */
786
+ interface Group {
787
+ id: string;
788
+ label: string;
789
+ description?: string;
790
+ fields: Field[];
791
+ collapsible?: boolean;
792
+ collapsed?: boolean;
793
+ order?: number;
794
+ }
795
+ type TabType = "form" | "table" | "custom";
796
+ /**
797
+ * Base properties shared by all tab types
798
+ */
799
+ interface BaseTab {
800
+ id: string;
801
+ name: string;
802
+ label: string;
803
+ icon?: IconName;
804
+ order?: number;
805
+ /** If true, tab is defined by developer (protected) */
806
+ system?: boolean;
807
+ }
808
+ /**
809
+ * Form tab - displays attributes organized in groups
810
+ */
811
+ interface FormTab extends BaseTab {
812
+ type: "form";
813
+ groups: Group[];
814
+ }
815
+ /**
816
+ * Table tab - displays records from a relation attribute
817
+ */
818
+ interface TableTab extends BaseTab {
819
+ type: "table";
820
+ /** Name of the relation attribute */
821
+ relation: string;
822
+ /** Columns to display (attribute names from target object) */
823
+ columns: string[];
824
+ /** Allow creating new records */
825
+ allowCreate?: boolean;
826
+ /** Allow inline editing */
827
+ allowEdit?: boolean;
828
+ /** Allow deleting records */
829
+ allowDelete?: boolean;
830
+ /** Default filters */
831
+ filters?: Record<string, unknown>;
832
+ /** Default sort */
833
+ sort?: {
834
+ field: string;
835
+ order: "asc" | "desc";
836
+ };
837
+ }
838
+ /**
839
+ * Custom tab - renders a developer-defined component
840
+ */
841
+ interface CustomTab extends BaseTab {
842
+ type: "custom";
843
+ /** Component identifier to render */
844
+ component: string;
845
+ /** Props to pass to the component */
846
+ props?: Record<string, unknown>;
847
+ }
848
+ /**
849
+ * Union of all tab types
850
+ */
851
+ type Tab = FormTab | TableTab | CustomTab;
852
+ /**
853
+ * View definition - organizes object attributes into tabs/pages
854
+ *
855
+ * @example
856
+ * ```typescript
857
+ * const companyView: ViewDefinition = {
858
+ * name: "detail",
859
+ * label: "Company Detail",
860
+ * object: "companies",
861
+ * tabs: [
862
+ * { type: "form", name: "general", label: "Info", groups: [...] },
863
+ * { type: "table", name: "contacts", label: "Contacts", relation: "contacts", columns: [...] }
864
+ * ],
865
+ * default: true,
866
+ * system: true
867
+ * };
868
+ * ```
869
+ */
870
+ interface ViewDefinition {
871
+ id?: Uuid;
872
+ /** Technical name (kebab-case) */
873
+ name: string;
874
+ /** Display label */
875
+ label: string;
876
+ /** Description */
877
+ description?: string;
878
+ /** Icon */
879
+ icon?: IconName;
880
+ /** Object this view belongs to (object name) */
881
+ object: string;
882
+ /** Tabs in this view */
883
+ tabs: Tab[];
884
+ /** Default view for this object */
885
+ default?: boolean;
886
+ /** System view (defined by developer, protected) */
887
+ system?: boolean;
888
+ /** Extensible metadata */
889
+ metadata?: Record<string, unknown>;
890
+ }
891
+ /**
892
+ * Check if a tab is a form tab
893
+ */
894
+ declare function isFormTab(tab: Tab): tab is FormTab;
895
+ /**
896
+ * Check if a tab is a table tab
897
+ */
898
+ declare function isTableTab(tab: Tab): tab is TableTab;
899
+ /**
900
+ * Check if a tab is a custom tab
901
+ */
902
+ declare function isCustomTab(tab: Tab): tab is CustomTab;
903
+
904
+ /**
905
+ * Registry for native objects defined in code
906
+ * Native objects are system objects that cannot be deleted/modified by clients
907
+ * They are defined by developers and synced to the database at startup
908
+ */
909
+ declare class NativeObjectRegistryClass {
910
+ private objects;
911
+ /**
912
+ * Register one or more native objects
913
+ * Auto-builds if ObjectBuilder is passed instead of ObjectDefinition
914
+ * @param objects - Single object/builder or array of objects/builders to register
915
+ * @returns this (for chaining)
916
+ * @throws Error if object is invalid or already registered
917
+ *
918
+ * @example
919
+ * ```typescript
920
+ * // No .build() needed - registry auto-builds!
921
+ * const PRODUCT = object({ id: "obj-product", name: "products", label: "Product" })
922
+ * .system()
923
+ * .attribute(text({ id: "attr-name", name: "name", label: "Name" }));
924
+ *
925
+ * registry.register(PRODUCT); // ← Auto-builds here
926
+ *
927
+ * // Can still explicitly .build() if you want
928
+ * registry.register(PRODUCT.build());
929
+ *
930
+ * // Register multiple
931
+ * registry.register([PRODUCT, ORDER, CUSTOMER]);
932
+ * ```
933
+ */
934
+ register(objects: ObjectDefinition | ObjectDefinition[] | {
935
+ build: () => ObjectDefinition;
936
+ } | Array<{
937
+ build: () => ObjectDefinition;
938
+ }>): this;
939
+ /**
940
+ * Validate and register a single object
941
+ * @internal
942
+ */
943
+ private validateAndRegister;
944
+ /**
945
+ * Get a native object by its name
946
+ * @param name - The object name
947
+ * @returns The object definition or undefined if not found
948
+ *
949
+ * @example
950
+ * ```typescript
951
+ * const product = registry.getByName("products");
952
+ * if (product) {
953
+ * console.log(product.label); // "Product"
954
+ * }
955
+ * ```
956
+ */
957
+ getByName(name: string): ObjectDefinition | undefined;
958
+ /**
959
+ * Get a native object or throw if not found
960
+ * @param name - The object name
961
+ * @returns The object definition
962
+ * @throws Error if not found
963
+ */
964
+ getByNameOrThrow(name: string): ObjectDefinition;
965
+ /**
966
+ * Get all registered native objects
967
+ * @returns Array of all registered object definitions
968
+ */
969
+ getAll(): ObjectDefinition[];
970
+ /**
971
+ * Get all registered native object names
972
+ * @returns Array of object names
973
+ */
974
+ listNames(): string[];
975
+ /**
976
+ * Check if a native object is registered
977
+ * @param name - The object name
978
+ * @returns true if registered, false otherwise
979
+ */
980
+ has(name: string): boolean;
981
+ /**
982
+ * Get the number of registered objects
983
+ */
984
+ get size(): number;
985
+ /**
986
+ * Clear all registered objects (useful for testing)
987
+ * @internal
988
+ */
989
+ clear(): void;
990
+ /**
991
+ * Get registry summary for debugging
992
+ */
993
+ summary(): string;
994
+ /**
995
+ * Log registry summary to console
996
+ */
997
+ debug(): void;
998
+ }
999
+ /**
1000
+ * Singleton instance of the registry
1001
+ * Use this to register and retrieve native objects
1002
+ *
1003
+ * @example
1004
+ * ```typescript
1005
+ * import { registry } from "@stndrds/schema";
1006
+ *
1007
+ * // Register objects
1008
+ * registry.register([PRODUCT, ORDER, CUSTOMER]);
1009
+ *
1010
+ * // Get object by name
1011
+ * const product = registry.getByName("products");
1012
+ *
1013
+ * // List all
1014
+ * console.log(registry.listNames()); // ["products", "orders", ...]
1015
+ *
1016
+ * // Debug
1017
+ * registry.debug();
1018
+ * ```
1019
+ */
1020
+ declare const registry: NativeObjectRegistryClass;
1021
+
1022
+ /**
1023
+ * Registry for native view definitions
1024
+ *
1025
+ * Views registered here are considered "system" views, defined by the developer.
1026
+ * They are protected from modification by end-users and synced to the database
1027
+ * at application startup.
1028
+ *
1029
+ * @example
1030
+ * ```typescript
1031
+ * import { view, group, viewRegistry } from "@stndrds/schema";
1032
+ *
1033
+ * const COMPANY_DETAIL = view("detail", "Detail")
1034
+ * .for("companies")
1035
+ * .system()
1036
+ * .tab("general", "Info")
1037
+ * .form(group("main", "Main").fields("name", "status"))
1038
+ * .build();
1039
+ *
1040
+ * viewRegistry.register(COMPANY_DETAIL);
1041
+ * ```
1042
+ */
1043
+ declare class ViewRegistry {
1044
+ private views;
1045
+ private byObject;
1046
+ /**
1047
+ * Register a native view
1048
+ * @param viewOrViews - Single view or array of views
1049
+ * @throws Error if view is not marked as system
1050
+ * @throws Error if view with same name already exists for the object
1051
+ */
1052
+ register(viewOrViews: ViewDefinition | ViewDefinition[]): this;
1053
+ private registerSingle;
1054
+ /**
1055
+ * Get all views for an object
1056
+ */
1057
+ getByObjectName(objectName: string): ViewDefinition[];
1058
+ /**
1059
+ * Get a specific view by object and view name
1060
+ */
1061
+ get(objectName: string, viewName: string): ViewDefinition | undefined;
1062
+ /**
1063
+ * Get a view or throw if not found
1064
+ */
1065
+ getOrThrow(objectName: string, viewName: string): ViewDefinition;
1066
+ /**
1067
+ * Get all registered views
1068
+ */
1069
+ getAll(): ViewDefinition[];
1070
+ /**
1071
+ * Check if a view exists
1072
+ */
1073
+ has(objectName: string, viewName: string): boolean;
1074
+ /**
1075
+ * Check if any views exist for an object
1076
+ */
1077
+ hasObject(objectName: string): boolean;
1078
+ /**
1079
+ * Get number of registered views
1080
+ */
1081
+ get size(): number;
1082
+ /**
1083
+ * List all object names that have views
1084
+ */
1085
+ listObjectNames(): string[];
1086
+ /**
1087
+ * Get default view for an object (if any)
1088
+ */
1089
+ getDefault(objectName: string): ViewDefinition | undefined;
1090
+ /**
1091
+ * Clear all registered views (for testing)
1092
+ */
1093
+ clear(): void;
1094
+ /**
1095
+ * Generate summary string for debugging
1096
+ */
1097
+ summary(): string;
1098
+ /**
1099
+ * Log summary to console
1100
+ */
1101
+ debug(): void;
1102
+ private makeKey;
1103
+ }
1104
+ /**
1105
+ * Global registry for native views
1106
+ */
1107
+ declare const viewRegistry: ViewRegistry;
1108
+
1109
+ /**
1110
+ * Text attribute config schema
1111
+ */
1112
+ declare const textConfigSchema: z.ZodObject<{
1113
+ disabled: z.ZodOptional<z.ZodBoolean>;
1114
+ placeholder: z.ZodOptional<z.ZodString>;
1115
+ description: z.ZodOptional<z.ZodString>;
1116
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1117
+ icon: z.ZodOptional<z.ZodString>;
1118
+ order: z.ZodOptional<z.ZodNumber>;
1119
+ hidden: z.ZodOptional<z.ZodBoolean>;
1120
+ archived: z.ZodOptional<z.ZodBoolean>;
1121
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1122
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1123
+ } & {
1124
+ minLength: z.ZodOptional<z.ZodNumber>;
1125
+ maxLength: z.ZodOptional<z.ZodNumber>;
1126
+ pattern: z.ZodOptional<z.ZodString>;
1127
+ }, "strip", z.ZodTypeAny, {
1128
+ defaultValue?: unknown;
1129
+ disabled?: boolean | undefined;
1130
+ placeholder?: string | undefined;
1131
+ description?: string | undefined;
1132
+ icon?: string | undefined;
1133
+ order?: number | undefined;
1134
+ hidden?: boolean | undefined;
1135
+ archived?: boolean | undefined;
1136
+ deprecated?: boolean | undefined;
1137
+ metadata?: Record<string, unknown> | undefined;
1138
+ minLength?: number | undefined;
1139
+ maxLength?: number | undefined;
1140
+ pattern?: string | undefined;
1141
+ }, {
1142
+ defaultValue?: unknown;
1143
+ disabled?: boolean | undefined;
1144
+ placeholder?: string | undefined;
1145
+ description?: string | undefined;
1146
+ icon?: string | undefined;
1147
+ order?: number | undefined;
1148
+ hidden?: boolean | undefined;
1149
+ archived?: boolean | undefined;
1150
+ deprecated?: boolean | undefined;
1151
+ metadata?: Record<string, unknown> | undefined;
1152
+ minLength?: number | undefined;
1153
+ maxLength?: number | undefined;
1154
+ pattern?: string | undefined;
1155
+ }>;
1156
+ /**
1157
+ * Textarea attribute config schema
1158
+ */
1159
+ declare const textareaConfigSchema: z.ZodObject<{
1160
+ disabled: z.ZodOptional<z.ZodBoolean>;
1161
+ placeholder: z.ZodOptional<z.ZodString>;
1162
+ description: z.ZodOptional<z.ZodString>;
1163
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1164
+ icon: z.ZodOptional<z.ZodString>;
1165
+ order: z.ZodOptional<z.ZodNumber>;
1166
+ hidden: z.ZodOptional<z.ZodBoolean>;
1167
+ archived: z.ZodOptional<z.ZodBoolean>;
1168
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1169
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1170
+ }, "strip", z.ZodTypeAny, {
1171
+ defaultValue?: unknown;
1172
+ disabled?: boolean | undefined;
1173
+ placeholder?: string | undefined;
1174
+ description?: string | undefined;
1175
+ icon?: string | undefined;
1176
+ order?: number | undefined;
1177
+ hidden?: boolean | undefined;
1178
+ archived?: boolean | undefined;
1179
+ deprecated?: boolean | undefined;
1180
+ metadata?: Record<string, unknown> | undefined;
1181
+ }, {
1182
+ defaultValue?: unknown;
1183
+ disabled?: boolean | undefined;
1184
+ placeholder?: string | undefined;
1185
+ description?: string | undefined;
1186
+ icon?: string | undefined;
1187
+ order?: number | undefined;
1188
+ hidden?: boolean | undefined;
1189
+ archived?: boolean | undefined;
1190
+ deprecated?: boolean | undefined;
1191
+ metadata?: Record<string, unknown> | undefined;
1192
+ }>;
1193
+ /**
1194
+ * Number attribute config schema
1195
+ */
1196
+ declare const numberConfigSchema: z.ZodObject<{
1197
+ disabled: z.ZodOptional<z.ZodBoolean>;
1198
+ placeholder: z.ZodOptional<z.ZodString>;
1199
+ description: z.ZodOptional<z.ZodString>;
1200
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1201
+ icon: z.ZodOptional<z.ZodString>;
1202
+ order: z.ZodOptional<z.ZodNumber>;
1203
+ hidden: z.ZodOptional<z.ZodBoolean>;
1204
+ archived: z.ZodOptional<z.ZodBoolean>;
1205
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1206
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1207
+ } & {
1208
+ min: z.ZodOptional<z.ZodNumber>;
1209
+ max: z.ZodOptional<z.ZodNumber>;
1210
+ unit: z.ZodOptional<z.ZodEnum<["integer", "decimal", "percentage"]>>;
1211
+ decimals: z.ZodOptional<z.ZodNumber>;
1212
+ }, "strip", z.ZodTypeAny, {
1213
+ defaultValue?: unknown;
1214
+ disabled?: boolean | undefined;
1215
+ placeholder?: string | undefined;
1216
+ description?: string | undefined;
1217
+ icon?: string | undefined;
1218
+ order?: number | undefined;
1219
+ hidden?: boolean | undefined;
1220
+ archived?: boolean | undefined;
1221
+ deprecated?: boolean | undefined;
1222
+ metadata?: Record<string, unknown> | undefined;
1223
+ min?: number | undefined;
1224
+ max?: number | undefined;
1225
+ unit?: "percentage" | "integer" | "decimal" | undefined;
1226
+ decimals?: number | undefined;
1227
+ }, {
1228
+ defaultValue?: unknown;
1229
+ disabled?: boolean | undefined;
1230
+ placeholder?: string | undefined;
1231
+ description?: string | undefined;
1232
+ icon?: string | undefined;
1233
+ order?: number | undefined;
1234
+ hidden?: boolean | undefined;
1235
+ archived?: boolean | undefined;
1236
+ deprecated?: boolean | undefined;
1237
+ metadata?: Record<string, unknown> | undefined;
1238
+ min?: number | undefined;
1239
+ max?: number | undefined;
1240
+ unit?: "percentage" | "integer" | "decimal" | undefined;
1241
+ decimals?: number | undefined;
1242
+ }>;
1243
+ /**
1244
+ * Checkbox attribute config schema
1245
+ */
1246
+ declare const checkboxConfigSchema: z.ZodObject<{
1247
+ disabled: z.ZodOptional<z.ZodBoolean>;
1248
+ placeholder: z.ZodOptional<z.ZodString>;
1249
+ description: z.ZodOptional<z.ZodString>;
1250
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1251
+ icon: z.ZodOptional<z.ZodString>;
1252
+ order: z.ZodOptional<z.ZodNumber>;
1253
+ hidden: z.ZodOptional<z.ZodBoolean>;
1254
+ archived: z.ZodOptional<z.ZodBoolean>;
1255
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1256
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1257
+ }, "strip", z.ZodTypeAny, {
1258
+ defaultValue?: unknown;
1259
+ disabled?: boolean | undefined;
1260
+ placeholder?: string | undefined;
1261
+ description?: string | undefined;
1262
+ icon?: string | undefined;
1263
+ order?: number | undefined;
1264
+ hidden?: boolean | undefined;
1265
+ archived?: boolean | undefined;
1266
+ deprecated?: boolean | undefined;
1267
+ metadata?: Record<string, unknown> | undefined;
1268
+ }, {
1269
+ defaultValue?: unknown;
1270
+ disabled?: boolean | undefined;
1271
+ placeholder?: string | undefined;
1272
+ description?: string | undefined;
1273
+ icon?: string | undefined;
1274
+ order?: number | undefined;
1275
+ hidden?: boolean | undefined;
1276
+ archived?: boolean | undefined;
1277
+ deprecated?: boolean | undefined;
1278
+ metadata?: Record<string, unknown> | undefined;
1279
+ }>;
1280
+ /**
1281
+ * Date attribute config schema
1282
+ */
1283
+ declare const dateConfigSchema: z.ZodObject<{
1284
+ disabled: z.ZodOptional<z.ZodBoolean>;
1285
+ placeholder: z.ZodOptional<z.ZodString>;
1286
+ description: z.ZodOptional<z.ZodString>;
1287
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1288
+ icon: z.ZodOptional<z.ZodString>;
1289
+ order: z.ZodOptional<z.ZodNumber>;
1290
+ hidden: z.ZodOptional<z.ZodBoolean>;
1291
+ archived: z.ZodOptional<z.ZodBoolean>;
1292
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1293
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1294
+ } & {
1295
+ dateFormat: z.ZodOptional<z.ZodEnum<["short", "long", "full", "relative"]>>;
1296
+ minDate: z.ZodOptional<z.ZodString>;
1297
+ maxDate: z.ZodOptional<z.ZodString>;
1298
+ }, "strip", z.ZodTypeAny, {
1299
+ defaultValue?: unknown;
1300
+ disabled?: boolean | undefined;
1301
+ placeholder?: string | undefined;
1302
+ description?: string | undefined;
1303
+ icon?: string | undefined;
1304
+ order?: number | undefined;
1305
+ hidden?: boolean | undefined;
1306
+ archived?: boolean | undefined;
1307
+ deprecated?: boolean | undefined;
1308
+ metadata?: Record<string, unknown> | undefined;
1309
+ dateFormat?: "short" | "long" | "full" | "relative" | undefined;
1310
+ minDate?: string | undefined;
1311
+ maxDate?: string | undefined;
1312
+ }, {
1313
+ defaultValue?: unknown;
1314
+ disabled?: boolean | undefined;
1315
+ placeholder?: string | undefined;
1316
+ description?: string | undefined;
1317
+ icon?: string | undefined;
1318
+ order?: number | undefined;
1319
+ hidden?: boolean | undefined;
1320
+ archived?: boolean | undefined;
1321
+ deprecated?: boolean | undefined;
1322
+ metadata?: Record<string, unknown> | undefined;
1323
+ dateFormat?: "short" | "long" | "full" | "relative" | undefined;
1324
+ minDate?: string | undefined;
1325
+ maxDate?: string | undefined;
1326
+ }>;
1327
+ /**
1328
+ * Phone attribute config schema
1329
+ */
1330
+ declare const phoneConfigSchema: z.ZodObject<{
1331
+ disabled: z.ZodOptional<z.ZodBoolean>;
1332
+ placeholder: z.ZodOptional<z.ZodString>;
1333
+ description: z.ZodOptional<z.ZodString>;
1334
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1335
+ icon: z.ZodOptional<z.ZodString>;
1336
+ order: z.ZodOptional<z.ZodNumber>;
1337
+ hidden: z.ZodOptional<z.ZodBoolean>;
1338
+ archived: z.ZodOptional<z.ZodBoolean>;
1339
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1340
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1341
+ } & {
1342
+ defaultCountryCode: z.ZodOptional<z.ZodString>;
1343
+ }, "strip", z.ZodTypeAny, {
1344
+ defaultValue?: unknown;
1345
+ disabled?: boolean | undefined;
1346
+ placeholder?: string | undefined;
1347
+ description?: string | undefined;
1348
+ icon?: string | undefined;
1349
+ order?: number | undefined;
1350
+ hidden?: boolean | undefined;
1351
+ archived?: boolean | undefined;
1352
+ deprecated?: boolean | undefined;
1353
+ metadata?: Record<string, unknown> | undefined;
1354
+ defaultCountryCode?: string | undefined;
1355
+ }, {
1356
+ defaultValue?: unknown;
1357
+ disabled?: boolean | undefined;
1358
+ placeholder?: string | undefined;
1359
+ description?: string | undefined;
1360
+ icon?: string | undefined;
1361
+ order?: number | undefined;
1362
+ hidden?: boolean | undefined;
1363
+ archived?: boolean | undefined;
1364
+ deprecated?: boolean | undefined;
1365
+ metadata?: Record<string, unknown> | undefined;
1366
+ defaultCountryCode?: string | undefined;
1367
+ }>;
1368
+ /**
1369
+ * Currency attribute config schema
1370
+ */
1371
+ declare const currencyConfigSchema: z.ZodObject<{
1372
+ disabled: z.ZodOptional<z.ZodBoolean>;
1373
+ placeholder: z.ZodOptional<z.ZodString>;
1374
+ description: z.ZodOptional<z.ZodString>;
1375
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1376
+ icon: z.ZodOptional<z.ZodString>;
1377
+ order: z.ZodOptional<z.ZodNumber>;
1378
+ hidden: z.ZodOptional<z.ZodBoolean>;
1379
+ archived: z.ZodOptional<z.ZodBoolean>;
1380
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1381
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1382
+ } & {
1383
+ defaultCurrency: z.ZodOptional<z.ZodString>;
1384
+ allowedCurrencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1385
+ }, "strip", z.ZodTypeAny, {
1386
+ defaultValue?: unknown;
1387
+ disabled?: boolean | undefined;
1388
+ placeholder?: string | undefined;
1389
+ description?: string | undefined;
1390
+ icon?: string | undefined;
1391
+ order?: number | undefined;
1392
+ hidden?: boolean | undefined;
1393
+ archived?: boolean | undefined;
1394
+ deprecated?: boolean | undefined;
1395
+ metadata?: Record<string, unknown> | undefined;
1396
+ defaultCurrency?: string | undefined;
1397
+ allowedCurrencies?: string[] | undefined;
1398
+ }, {
1399
+ defaultValue?: unknown;
1400
+ disabled?: boolean | undefined;
1401
+ placeholder?: string | undefined;
1402
+ description?: string | undefined;
1403
+ icon?: string | undefined;
1404
+ order?: number | undefined;
1405
+ hidden?: boolean | undefined;
1406
+ archived?: boolean | undefined;
1407
+ deprecated?: boolean | undefined;
1408
+ metadata?: Record<string, unknown> | undefined;
1409
+ defaultCurrency?: string | undefined;
1410
+ allowedCurrencies?: string[] | undefined;
1411
+ }>;
1412
+ /**
1413
+ * Status attribute config schema
1414
+ */
1415
+ declare const statusConfigSchema: z.ZodObject<{
1416
+ disabled: z.ZodOptional<z.ZodBoolean>;
1417
+ placeholder: z.ZodOptional<z.ZodString>;
1418
+ description: z.ZodOptional<z.ZodString>;
1419
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1420
+ icon: z.ZodOptional<z.ZodString>;
1421
+ order: z.ZodOptional<z.ZodNumber>;
1422
+ hidden: z.ZodOptional<z.ZodBoolean>;
1423
+ archived: z.ZodOptional<z.ZodBoolean>;
1424
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1425
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1426
+ } & {
1427
+ options: z.ZodArray<z.ZodObject<{
1428
+ id: z.ZodString;
1429
+ label: z.ZodString;
1430
+ value: z.ZodString;
1431
+ color: z.ZodOptional<z.ZodString>;
1432
+ icon: z.ZodOptional<z.ZodString>;
1433
+ description: z.ZodOptional<z.ZodString>;
1434
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1435
+ }, "strip", z.ZodTypeAny, {
1436
+ label: string;
1437
+ id: string;
1438
+ value: string;
1439
+ description?: string | undefined;
1440
+ icon?: string | undefined;
1441
+ color?: string | undefined;
1442
+ group?: "idle" | "in_progress" | "finished" | undefined;
1443
+ }, {
1444
+ label: string;
1445
+ id: string;
1446
+ value: string;
1447
+ description?: string | undefined;
1448
+ icon?: string | undefined;
1449
+ color?: string | undefined;
1450
+ group?: "idle" | "in_progress" | "finished" | undefined;
1451
+ }>, "many">;
1452
+ }, "strip", z.ZodTypeAny, {
1453
+ options: {
1454
+ label: string;
1455
+ id: string;
1456
+ value: string;
1457
+ description?: string | undefined;
1458
+ icon?: string | undefined;
1459
+ color?: string | undefined;
1460
+ group?: "idle" | "in_progress" | "finished" | undefined;
1461
+ }[];
1462
+ defaultValue?: unknown;
1463
+ disabled?: boolean | undefined;
1464
+ placeholder?: string | undefined;
1465
+ description?: string | undefined;
1466
+ icon?: string | undefined;
1467
+ order?: number | undefined;
1468
+ hidden?: boolean | undefined;
1469
+ archived?: boolean | undefined;
1470
+ deprecated?: boolean | undefined;
1471
+ metadata?: Record<string, unknown> | undefined;
1472
+ }, {
1473
+ options: {
1474
+ label: string;
1475
+ id: string;
1476
+ value: string;
1477
+ description?: string | undefined;
1478
+ icon?: string | undefined;
1479
+ color?: string | undefined;
1480
+ group?: "idle" | "in_progress" | "finished" | undefined;
1481
+ }[];
1482
+ defaultValue?: unknown;
1483
+ disabled?: boolean | undefined;
1484
+ placeholder?: string | undefined;
1485
+ description?: string | undefined;
1486
+ icon?: string | undefined;
1487
+ order?: number | undefined;
1488
+ hidden?: boolean | undefined;
1489
+ archived?: boolean | undefined;
1490
+ deprecated?: boolean | undefined;
1491
+ metadata?: Record<string, unknown> | undefined;
1492
+ }>;
1493
+ /**
1494
+ * Location attribute config schema
1495
+ */
1496
+ declare const locationConfigSchema: z.ZodObject<{
1497
+ disabled: z.ZodOptional<z.ZodBoolean>;
1498
+ placeholder: z.ZodOptional<z.ZodString>;
1499
+ description: z.ZodOptional<z.ZodString>;
1500
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1501
+ icon: z.ZodOptional<z.ZodString>;
1502
+ order: z.ZodOptional<z.ZodNumber>;
1503
+ hidden: z.ZodOptional<z.ZodBoolean>;
1504
+ archived: z.ZodOptional<z.ZodBoolean>;
1505
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1506
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1507
+ } & {
1508
+ granularity: z.ZodEnum<["full", "address", "city", "state", "country", "coordinates"]>;
1509
+ enableAutocomplete: z.ZodOptional<z.ZodBoolean>;
1510
+ enableMap: z.ZodOptional<z.ZodBoolean>;
1511
+ defaultCountry: z.ZodOptional<z.ZodString>;
1512
+ allowedCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1513
+ displayFormat: z.ZodOptional<z.ZodEnum<["single_line", "multi_line", "compact"]>>;
1514
+ }, "strip", z.ZodTypeAny, {
1515
+ granularity: "full" | "address" | "city" | "state" | "country" | "coordinates";
1516
+ defaultValue?: unknown;
1517
+ disabled?: boolean | undefined;
1518
+ placeholder?: string | undefined;
1519
+ description?: string | undefined;
1520
+ icon?: string | undefined;
1521
+ order?: number | undefined;
1522
+ hidden?: boolean | undefined;
1523
+ archived?: boolean | undefined;
1524
+ deprecated?: boolean | undefined;
1525
+ metadata?: Record<string, unknown> | undefined;
1526
+ enableAutocomplete?: boolean | undefined;
1527
+ enableMap?: boolean | undefined;
1528
+ defaultCountry?: string | undefined;
1529
+ allowedCountries?: string[] | undefined;
1530
+ displayFormat?: "single_line" | "multi_line" | "compact" | undefined;
1531
+ }, {
1532
+ granularity: "full" | "address" | "city" | "state" | "country" | "coordinates";
1533
+ defaultValue?: unknown;
1534
+ disabled?: boolean | undefined;
1535
+ placeholder?: string | undefined;
1536
+ description?: string | undefined;
1537
+ icon?: string | undefined;
1538
+ order?: number | undefined;
1539
+ hidden?: boolean | undefined;
1540
+ archived?: boolean | undefined;
1541
+ deprecated?: boolean | undefined;
1542
+ metadata?: Record<string, unknown> | undefined;
1543
+ enableAutocomplete?: boolean | undefined;
1544
+ enableMap?: boolean | undefined;
1545
+ defaultCountry?: string | undefined;
1546
+ allowedCountries?: string[] | undefined;
1547
+ displayFormat?: "single_line" | "multi_line" | "compact" | undefined;
1548
+ }>;
1549
+ /**
1550
+ * Timestamp attribute config schema
1551
+ */
1552
+ declare const timestampConfigSchema: z.ZodObject<{
1553
+ disabled: z.ZodOptional<z.ZodBoolean>;
1554
+ placeholder: z.ZodOptional<z.ZodString>;
1555
+ description: z.ZodOptional<z.ZodString>;
1556
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1557
+ icon: z.ZodOptional<z.ZodString>;
1558
+ order: z.ZodOptional<z.ZodNumber>;
1559
+ hidden: z.ZodOptional<z.ZodBoolean>;
1560
+ archived: z.ZodOptional<z.ZodBoolean>;
1561
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1562
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1563
+ } & {
1564
+ autoUpdate: z.ZodOptional<z.ZodBoolean>;
1565
+ }, "strip", z.ZodTypeAny, {
1566
+ defaultValue?: unknown;
1567
+ disabled?: boolean | undefined;
1568
+ placeholder?: string | undefined;
1569
+ description?: string | undefined;
1570
+ icon?: string | undefined;
1571
+ order?: number | undefined;
1572
+ hidden?: boolean | undefined;
1573
+ archived?: boolean | undefined;
1574
+ deprecated?: boolean | undefined;
1575
+ metadata?: Record<string, unknown> | undefined;
1576
+ autoUpdate?: boolean | undefined;
1577
+ }, {
1578
+ defaultValue?: unknown;
1579
+ disabled?: boolean | undefined;
1580
+ placeholder?: string | undefined;
1581
+ description?: string | undefined;
1582
+ icon?: string | undefined;
1583
+ order?: number | undefined;
1584
+ hidden?: boolean | undefined;
1585
+ archived?: boolean | undefined;
1586
+ deprecated?: boolean | undefined;
1587
+ metadata?: Record<string, unknown> | undefined;
1588
+ autoUpdate?: boolean | undefined;
1589
+ }>;
1590
+ /**
1591
+ * Select attribute config schema
1592
+ */
1593
+ declare const selectConfigSchema: z.ZodObject<{
1594
+ disabled: z.ZodOptional<z.ZodBoolean>;
1595
+ placeholder: z.ZodOptional<z.ZodString>;
1596
+ description: z.ZodOptional<z.ZodString>;
1597
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1598
+ icon: z.ZodOptional<z.ZodString>;
1599
+ order: z.ZodOptional<z.ZodNumber>;
1600
+ hidden: z.ZodOptional<z.ZodBoolean>;
1601
+ archived: z.ZodOptional<z.ZodBoolean>;
1602
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1603
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1604
+ } & {
1605
+ options: z.ZodArray<z.ZodObject<{
1606
+ id: z.ZodString;
1607
+ label: z.ZodString;
1608
+ value: z.ZodString;
1609
+ color: z.ZodOptional<z.ZodString>;
1610
+ icon: z.ZodOptional<z.ZodString>;
1611
+ description: z.ZodOptional<z.ZodString>;
1612
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1613
+ }, "strip", z.ZodTypeAny, {
1614
+ label: string;
1615
+ id: string;
1616
+ value: string;
1617
+ description?: string | undefined;
1618
+ icon?: string | undefined;
1619
+ color?: string | undefined;
1620
+ group?: "idle" | "in_progress" | "finished" | undefined;
1621
+ }, {
1622
+ label: string;
1623
+ id: string;
1624
+ value: string;
1625
+ description?: string | undefined;
1626
+ icon?: string | undefined;
1627
+ color?: string | undefined;
1628
+ group?: "idle" | "in_progress" | "finished" | undefined;
1629
+ }>, "many">;
1630
+ }, "strip", z.ZodTypeAny, {
1631
+ options: {
1632
+ label: string;
1633
+ id: string;
1634
+ value: string;
1635
+ description?: string | undefined;
1636
+ icon?: string | undefined;
1637
+ color?: string | undefined;
1638
+ group?: "idle" | "in_progress" | "finished" | undefined;
1639
+ }[];
1640
+ defaultValue?: unknown;
1641
+ disabled?: boolean | undefined;
1642
+ placeholder?: string | undefined;
1643
+ description?: string | undefined;
1644
+ icon?: string | undefined;
1645
+ order?: number | undefined;
1646
+ hidden?: boolean | undefined;
1647
+ archived?: boolean | undefined;
1648
+ deprecated?: boolean | undefined;
1649
+ metadata?: Record<string, unknown> | undefined;
1650
+ }, {
1651
+ options: {
1652
+ label: string;
1653
+ id: string;
1654
+ value: string;
1655
+ description?: string | undefined;
1656
+ icon?: string | undefined;
1657
+ color?: string | undefined;
1658
+ group?: "idle" | "in_progress" | "finished" | undefined;
1659
+ }[];
1660
+ defaultValue?: unknown;
1661
+ disabled?: boolean | undefined;
1662
+ placeholder?: string | undefined;
1663
+ description?: string | undefined;
1664
+ icon?: string | undefined;
1665
+ order?: number | undefined;
1666
+ hidden?: boolean | undefined;
1667
+ archived?: boolean | undefined;
1668
+ deprecated?: boolean | undefined;
1669
+ metadata?: Record<string, unknown> | undefined;
1670
+ }>;
1671
+ /**
1672
+ * Multiselect attribute config schema
1673
+ */
1674
+ declare const multiselectConfigSchema: z.ZodObject<{
1675
+ disabled: z.ZodOptional<z.ZodBoolean>;
1676
+ placeholder: z.ZodOptional<z.ZodString>;
1677
+ description: z.ZodOptional<z.ZodString>;
1678
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1679
+ icon: z.ZodOptional<z.ZodString>;
1680
+ order: z.ZodOptional<z.ZodNumber>;
1681
+ hidden: z.ZodOptional<z.ZodBoolean>;
1682
+ archived: z.ZodOptional<z.ZodBoolean>;
1683
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1684
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1685
+ } & {
1686
+ options: z.ZodArray<z.ZodObject<{
1687
+ id: z.ZodString;
1688
+ label: z.ZodString;
1689
+ value: z.ZodString;
1690
+ color: z.ZodOptional<z.ZodString>;
1691
+ icon: z.ZodOptional<z.ZodString>;
1692
+ description: z.ZodOptional<z.ZodString>;
1693
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1694
+ }, "strip", z.ZodTypeAny, {
1695
+ label: string;
1696
+ id: string;
1697
+ value: string;
1698
+ description?: string | undefined;
1699
+ icon?: string | undefined;
1700
+ color?: string | undefined;
1701
+ group?: "idle" | "in_progress" | "finished" | undefined;
1702
+ }, {
1703
+ label: string;
1704
+ id: string;
1705
+ value: string;
1706
+ description?: string | undefined;
1707
+ icon?: string | undefined;
1708
+ color?: string | undefined;
1709
+ group?: "idle" | "in_progress" | "finished" | undefined;
1710
+ }>, "many">;
1711
+ }, "strip", z.ZodTypeAny, {
1712
+ options: {
1713
+ label: string;
1714
+ id: string;
1715
+ value: string;
1716
+ description?: string | undefined;
1717
+ icon?: string | undefined;
1718
+ color?: string | undefined;
1719
+ group?: "idle" | "in_progress" | "finished" | undefined;
1720
+ }[];
1721
+ defaultValue?: unknown;
1722
+ disabled?: boolean | undefined;
1723
+ placeholder?: string | undefined;
1724
+ description?: string | undefined;
1725
+ icon?: string | undefined;
1726
+ order?: number | undefined;
1727
+ hidden?: boolean | undefined;
1728
+ archived?: boolean | undefined;
1729
+ deprecated?: boolean | undefined;
1730
+ metadata?: Record<string, unknown> | undefined;
1731
+ }, {
1732
+ options: {
1733
+ label: string;
1734
+ id: string;
1735
+ value: string;
1736
+ description?: string | undefined;
1737
+ icon?: string | undefined;
1738
+ color?: string | undefined;
1739
+ group?: "idle" | "in_progress" | "finished" | undefined;
1740
+ }[];
1741
+ defaultValue?: unknown;
1742
+ disabled?: boolean | undefined;
1743
+ placeholder?: string | undefined;
1744
+ description?: string | undefined;
1745
+ icon?: string | undefined;
1746
+ order?: number | undefined;
1747
+ hidden?: boolean | undefined;
1748
+ archived?: boolean | undefined;
1749
+ deprecated?: boolean | undefined;
1750
+ metadata?: Record<string, unknown> | undefined;
1751
+ }>;
1752
+ /**
1753
+ * File attribute config schema
1754
+ */
1755
+ declare const fileConfigSchema: z.ZodObject<{
1756
+ disabled: z.ZodOptional<z.ZodBoolean>;
1757
+ placeholder: z.ZodOptional<z.ZodString>;
1758
+ description: z.ZodOptional<z.ZodString>;
1759
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1760
+ icon: z.ZodOptional<z.ZodString>;
1761
+ order: z.ZodOptional<z.ZodNumber>;
1762
+ hidden: z.ZodOptional<z.ZodBoolean>;
1763
+ archived: z.ZodOptional<z.ZodBoolean>;
1764
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1765
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1766
+ } & {
1767
+ maxFiles: z.ZodOptional<z.ZodNumber>;
1768
+ maxSize: z.ZodOptional<z.ZodNumber>;
1769
+ allowedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1770
+ verification: z.ZodOptional<z.ZodObject<{
1771
+ enabled: z.ZodBoolean;
1772
+ documentTypes: z.ZodArray<z.ZodObject<{
1773
+ type: z.ZodEnum<["id_card", "passport", "incorporation_certificate", "driver_license", "birth_certificate", "residence_permit", "bank_statement", "proof_of_address", "custom"]>;
1774
+ label: z.ZodString;
1775
+ faces: z.ZodArray<z.ZodEnum<["front", "back", "single"]>, "many">;
1776
+ attributeMapping: z.ZodOptional<z.ZodArray<z.ZodObject<{
1777
+ attributeId: z.ZodString;
1778
+ extractedKey: z.ZodString;
1779
+ face: z.ZodOptional<z.ZodEnum<["front", "back", "single"]>>;
1780
+ required: z.ZodOptional<z.ZodBoolean>;
1781
+ }, "strip", z.ZodTypeAny, {
1782
+ attributeId: string;
1783
+ extractedKey: string;
1784
+ required?: boolean | undefined;
1785
+ face?: "front" | "back" | "single" | undefined;
1786
+ }, {
1787
+ attributeId: string;
1788
+ extractedKey: string;
1789
+ required?: boolean | undefined;
1790
+ face?: "front" | "back" | "single" | undefined;
1791
+ }>, "many">>;
1792
+ }, "strip", z.ZodTypeAny, {
1793
+ label: string;
1794
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1795
+ faces: ("front" | "back" | "single")[];
1796
+ attributeMapping?: {
1797
+ attributeId: string;
1798
+ extractedKey: string;
1799
+ required?: boolean | undefined;
1800
+ face?: "front" | "back" | "single" | undefined;
1801
+ }[] | undefined;
1802
+ }, {
1803
+ label: string;
1804
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1805
+ faces: ("front" | "back" | "single")[];
1806
+ attributeMapping?: {
1807
+ attributeId: string;
1808
+ extractedKey: string;
1809
+ required?: boolean | undefined;
1810
+ face?: "front" | "back" | "single" | undefined;
1811
+ }[] | undefined;
1812
+ }>, "many">;
1813
+ autoExtract: z.ZodOptional<z.ZodBoolean>;
1814
+ autoValidate: z.ZodOptional<z.ZodBoolean>;
1815
+ }, "strip", z.ZodTypeAny, {
1816
+ enabled: boolean;
1817
+ documentTypes: {
1818
+ label: string;
1819
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1820
+ faces: ("front" | "back" | "single")[];
1821
+ attributeMapping?: {
1822
+ attributeId: string;
1823
+ extractedKey: string;
1824
+ required?: boolean | undefined;
1825
+ face?: "front" | "back" | "single" | undefined;
1826
+ }[] | undefined;
1827
+ }[];
1828
+ autoExtract?: boolean | undefined;
1829
+ autoValidate?: boolean | undefined;
1830
+ }, {
1831
+ enabled: boolean;
1832
+ documentTypes: {
1833
+ label: string;
1834
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1835
+ faces: ("front" | "back" | "single")[];
1836
+ attributeMapping?: {
1837
+ attributeId: string;
1838
+ extractedKey: string;
1839
+ required?: boolean | undefined;
1840
+ face?: "front" | "back" | "single" | undefined;
1841
+ }[] | undefined;
1842
+ }[];
1843
+ autoExtract?: boolean | undefined;
1844
+ autoValidate?: boolean | undefined;
1845
+ }>>;
1846
+ }, "strip", z.ZodTypeAny, {
1847
+ defaultValue?: unknown;
1848
+ disabled?: boolean | undefined;
1849
+ placeholder?: string | undefined;
1850
+ description?: string | undefined;
1851
+ icon?: string | undefined;
1852
+ order?: number | undefined;
1853
+ hidden?: boolean | undefined;
1854
+ archived?: boolean | undefined;
1855
+ deprecated?: boolean | undefined;
1856
+ metadata?: Record<string, unknown> | undefined;
1857
+ maxFiles?: number | undefined;
1858
+ maxSize?: number | undefined;
1859
+ allowedTypes?: string[] | undefined;
1860
+ verification?: {
1861
+ enabled: boolean;
1862
+ documentTypes: {
1863
+ label: string;
1864
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1865
+ faces: ("front" | "back" | "single")[];
1866
+ attributeMapping?: {
1867
+ attributeId: string;
1868
+ extractedKey: string;
1869
+ required?: boolean | undefined;
1870
+ face?: "front" | "back" | "single" | undefined;
1871
+ }[] | undefined;
1872
+ }[];
1873
+ autoExtract?: boolean | undefined;
1874
+ autoValidate?: boolean | undefined;
1875
+ } | undefined;
1876
+ }, {
1877
+ defaultValue?: unknown;
1878
+ disabled?: boolean | undefined;
1879
+ placeholder?: string | undefined;
1880
+ description?: string | undefined;
1881
+ icon?: string | undefined;
1882
+ order?: number | undefined;
1883
+ hidden?: boolean | undefined;
1884
+ archived?: boolean | undefined;
1885
+ deprecated?: boolean | undefined;
1886
+ metadata?: Record<string, unknown> | undefined;
1887
+ maxFiles?: number | undefined;
1888
+ maxSize?: number | undefined;
1889
+ allowedTypes?: string[] | undefined;
1890
+ verification?: {
1891
+ enabled: boolean;
1892
+ documentTypes: {
1893
+ label: string;
1894
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1895
+ faces: ("front" | "back" | "single")[];
1896
+ attributeMapping?: {
1897
+ attributeId: string;
1898
+ extractedKey: string;
1899
+ required?: boolean | undefined;
1900
+ face?: "front" | "back" | "single" | undefined;
1901
+ }[] | undefined;
1902
+ }[];
1903
+ autoExtract?: boolean | undefined;
1904
+ autoValidate?: boolean | undefined;
1905
+ } | undefined;
1906
+ }>;
1907
+ /**
1908
+ * User attribute config schema
1909
+ */
1910
+ declare const userConfigSchema: z.ZodObject<{
1911
+ disabled: z.ZodOptional<z.ZodBoolean>;
1912
+ placeholder: z.ZodOptional<z.ZodString>;
1913
+ description: z.ZodOptional<z.ZodString>;
1914
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1915
+ icon: z.ZodOptional<z.ZodString>;
1916
+ order: z.ZodOptional<z.ZodNumber>;
1917
+ hidden: z.ZodOptional<z.ZodBoolean>;
1918
+ archived: z.ZodOptional<z.ZodBoolean>;
1919
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1920
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1921
+ } & {
1922
+ allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1923
+ }, "strip", z.ZodTypeAny, {
1924
+ defaultValue?: unknown;
1925
+ disabled?: boolean | undefined;
1926
+ placeholder?: string | undefined;
1927
+ description?: string | undefined;
1928
+ icon?: string | undefined;
1929
+ order?: number | undefined;
1930
+ hidden?: boolean | undefined;
1931
+ archived?: boolean | undefined;
1932
+ deprecated?: boolean | undefined;
1933
+ metadata?: Record<string, unknown> | undefined;
1934
+ allowedRoles?: string[] | undefined;
1935
+ }, {
1936
+ defaultValue?: unknown;
1937
+ disabled?: boolean | undefined;
1938
+ placeholder?: string | undefined;
1939
+ description?: string | undefined;
1940
+ icon?: string | undefined;
1941
+ order?: number | undefined;
1942
+ hidden?: boolean | undefined;
1943
+ archived?: boolean | undefined;
1944
+ deprecated?: boolean | undefined;
1945
+ metadata?: Record<string, unknown> | undefined;
1946
+ allowedRoles?: string[] | undefined;
1947
+ }>;
1948
+ /**
1949
+ * Relation attribute config schema
1950
+ */
1951
+ declare const relationConfigSchema: z.ZodObject<{
1952
+ disabled: z.ZodOptional<z.ZodBoolean>;
1953
+ placeholder: z.ZodOptional<z.ZodString>;
1954
+ description: z.ZodOptional<z.ZodString>;
1955
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1956
+ icon: z.ZodOptional<z.ZodString>;
1957
+ order: z.ZodOptional<z.ZodNumber>;
1958
+ hidden: z.ZodOptional<z.ZodBoolean>;
1959
+ archived: z.ZodOptional<z.ZodBoolean>;
1960
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1961
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1962
+ } & {
1963
+ targets: z.ZodArray<z.ZodObject<{
1964
+ object: z.ZodString;
1965
+ displayTemplate: z.ZodOptional<z.ZodString>;
1966
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1967
+ }, "strip", z.ZodTypeAny, {
1968
+ object: string;
1969
+ filter?: Record<string, unknown> | undefined;
1970
+ displayTemplate?: string | undefined;
1971
+ }, {
1972
+ object: string;
1973
+ filter?: Record<string, unknown> | undefined;
1974
+ displayTemplate?: string | undefined;
1975
+ }>, "many">;
1976
+ onDelete: z.ZodOptional<z.ZodEnum<["restrict", "cascade", "set_null"]>>;
1977
+ cardinality: z.ZodEnum<["one", "many"]>;
1978
+ minItems: z.ZodOptional<z.ZodNumber>;
1979
+ maxItems: z.ZodOptional<z.ZodNumber>;
1980
+ }, "strip", z.ZodTypeAny, {
1981
+ cardinality: "one" | "many";
1982
+ targets: {
1983
+ object: string;
1984
+ filter?: Record<string, unknown> | undefined;
1985
+ displayTemplate?: string | undefined;
1986
+ }[];
1987
+ defaultValue?: unknown;
1988
+ disabled?: boolean | undefined;
1989
+ placeholder?: string | undefined;
1990
+ description?: string | undefined;
1991
+ icon?: string | undefined;
1992
+ order?: number | undefined;
1993
+ hidden?: boolean | undefined;
1994
+ archived?: boolean | undefined;
1995
+ deprecated?: boolean | undefined;
1996
+ metadata?: Record<string, unknown> | undefined;
1997
+ onDelete?: "restrict" | "cascade" | "set_null" | undefined;
1998
+ minItems?: number | undefined;
1999
+ maxItems?: number | undefined;
2000
+ }, {
2001
+ cardinality: "one" | "many";
2002
+ targets: {
2003
+ object: string;
2004
+ filter?: Record<string, unknown> | undefined;
2005
+ displayTemplate?: string | undefined;
2006
+ }[];
2007
+ defaultValue?: unknown;
2008
+ disabled?: boolean | undefined;
2009
+ placeholder?: string | undefined;
2010
+ description?: string | undefined;
2011
+ icon?: string | undefined;
2012
+ order?: number | undefined;
2013
+ hidden?: boolean | undefined;
2014
+ archived?: boolean | undefined;
2015
+ deprecated?: boolean | undefined;
2016
+ metadata?: Record<string, unknown> | undefined;
2017
+ onDelete?: "restrict" | "cascade" | "set_null" | undefined;
2018
+ minItems?: number | undefined;
2019
+ maxItems?: number | undefined;
2020
+ }>;
2021
+ /**
2022
+ * Rating attribute config schema
2023
+ */
2024
+ declare const ratingConfigSchema: z.ZodObject<{
2025
+ disabled: z.ZodOptional<z.ZodBoolean>;
2026
+ placeholder: z.ZodOptional<z.ZodString>;
2027
+ description: z.ZodOptional<z.ZodString>;
2028
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
2029
+ icon: z.ZodOptional<z.ZodString>;
2030
+ order: z.ZodOptional<z.ZodNumber>;
2031
+ hidden: z.ZodOptional<z.ZodBoolean>;
2032
+ archived: z.ZodOptional<z.ZodBoolean>;
2033
+ deprecated: z.ZodOptional<z.ZodBoolean>;
2034
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2035
+ } & {
2036
+ max: z.ZodOptional<z.ZodNumber>;
2037
+ iconType: z.ZodOptional<z.ZodEnum<["star", "heart", "thumbs", "number"]>>;
2038
+ }, "strip", z.ZodTypeAny, {
2039
+ defaultValue?: unknown;
2040
+ disabled?: boolean | undefined;
2041
+ placeholder?: string | undefined;
2042
+ description?: string | undefined;
2043
+ icon?: string | undefined;
2044
+ order?: number | undefined;
2045
+ hidden?: boolean | undefined;
2046
+ archived?: boolean | undefined;
2047
+ deprecated?: boolean | undefined;
2048
+ metadata?: Record<string, unknown> | undefined;
2049
+ max?: number | undefined;
2050
+ iconType?: "number" | "heart" | "star" | "thumbs" | undefined;
2051
+ }, {
2052
+ defaultValue?: unknown;
2053
+ disabled?: boolean | undefined;
2054
+ placeholder?: string | undefined;
2055
+ description?: string | undefined;
2056
+ icon?: string | undefined;
2057
+ order?: number | undefined;
2058
+ hidden?: boolean | undefined;
2059
+ archived?: boolean | undefined;
2060
+ deprecated?: boolean | undefined;
2061
+ metadata?: Record<string, unknown> | undefined;
2062
+ max?: number | undefined;
2063
+ iconType?: "number" | "heart" | "star" | "thumbs" | undefined;
2064
+ }>;
2065
+ /**
2066
+ * Map of attribute type to config schema
2067
+ */
2068
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
2069
+ /**
2070
+ * Get the config schema for a specific attribute type
2071
+ */
2072
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
2073
+ /**
2074
+ * Validate attribute config for a specific type
2075
+ * Returns the validated config with only allowed properties
2076
+ */
2077
+ declare function validateAttributeConfig(type: AttributeType, config: Record<string, unknown>): {
2078
+ success: true;
2079
+ data: Record<string, unknown>;
2080
+ } | {
2081
+ success: false;
2082
+ errors: string[];
2083
+ };
2084
+ /**
2085
+ * Validate and strip unknown properties from attribute config
2086
+ * This ensures only allowed properties are stored in the database
2087
+ */
2088
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
2089
+ /**
2090
+ * Safely parse attribute config, returning undefined for invalid configs
2091
+ */
2092
+ declare function safeParseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown> | undefined;
2093
+ /**
2094
+ * Create a Zod schema for a text attribute
2095
+ */
2096
+ declare function createTextValidator(attr: TextAttribute): z.ZodString;
2097
+ /**
2098
+ * Create a Zod schema for a number attribute
2099
+ */
2100
+ declare function createNumberValidator(attr: NumberAttribute): z.ZodNumber;
2101
+ /**
2102
+ * Create a Zod schema for a checkbox attribute
2103
+ * Uses coerce to handle string values ("true"/"false") from forms
2104
+ */
2105
+ declare function createCheckboxValidator(_attr: CheckboxAttribute): z.ZodBoolean;
2106
+ /**
2107
+ * Create a Zod schema for a date attribute
2108
+ */
2109
+ declare function createDateValidator(attr: DateAttribute): z.ZodString;
2110
+ /**
2111
+ * Create a Zod schema for a phone attribute
2112
+ */
2113
+ declare function createPhoneValidator(_attr: PhoneAttribute): z.ZodType<{
2114
+ countryCode: string;
2115
+ phoneNumber: string;
2116
+ }>;
2117
+ /**
2118
+ * Create a Zod schema for a currency attribute
2119
+ */
2120
+ declare function createCurrencyValidator(_attr: CurrencyAttribute): z.ZodType<{
2121
+ code: string;
2122
+ value: number;
2123
+ }>;
2124
+ /**
2125
+ * Create a Zod schema for a status attribute
2126
+ */
2127
+ declare function createStatusValidator(attr: StatusAttribute): z.ZodEnum<[string, ...string[]]>;
2128
+ /**
2129
+ * Create a Zod schema for a select attribute
2130
+ */
2131
+ declare function createSelectValidator(attr: SelectAttribute): z.ZodEnum<[string, ...string[]]>;
2132
+ /**
2133
+ * Create a Zod schema for a multiselect attribute
2134
+ */
2135
+ declare function createMultiselectValidator(attr: MultiselectAttribute): z.ZodArray<z.ZodEnum<[string, ...string[]]>>;
2136
+ /**
2137
+ * Create a Zod schema for a location attribute
2138
+ */
2139
+ type LocationShape = {
2140
+ address?: string;
2141
+ address2?: string;
2142
+ city?: string;
2143
+ state?: string;
2144
+ postalCode?: string;
2145
+ country?: string;
2146
+ latitude?: number;
2147
+ longitude?: number;
2148
+ };
2149
+ declare function createLocationValidator(_attr: LocationAttribute): z.ZodType<LocationShape>;
2150
+ /**
2151
+ * Create a Zod schema for a timestamp attribute
2152
+ */
2153
+ declare function createTimestampValidator(_attr: TimestampAttribute): z.ZodNumber;
2154
+ /**
2155
+ * Create a Zod schema for a file attribute
2156
+ */
2157
+ declare function createFileValidator(_attr: FileAttribute): z.ZodString;
2158
+ /**
2159
+ * Create a Zod schema for a user attribute
2160
+ */
2161
+ declare function createUserValidator(_attr: UserAttribute): z.ZodString;
2162
+ /**
2163
+ * Create a Zod schema for a single relation attribute (cardinality: "one")
2164
+ */
2165
+ declare function createSingleRelationValidator(attr: SingleRelationAttribute): z.ZodUnion<[z.ZodString, z.ZodNull]>;
2166
+ /**
2167
+ * Create a Zod schema for a multi relation attribute (cardinality: "many")
2168
+ */
2169
+ declare function createMultiRelationValidator(attr: MultiRelationAttribute): z.ZodArray<z.ZodString>;
2170
+ /**
2171
+ * Create a Zod schema for a relation attribute
2172
+ * Dispatches to single or multi validator based on cardinality
2173
+ */
2174
+ declare function createRelationValidator(attr: RelationAttribute): z.ZodUnion<[z.ZodString, z.ZodNull]> | z.ZodArray<z.ZodString>;
2175
+ /**
2176
+ * Create a Zod schema for a rating attribute
2177
+ */
2178
+ declare function createRatingValidator(attr: RatingAttribute): z.ZodNumber;
2179
+ /**
2180
+ * Create a Zod schema for any attribute type
2181
+ */
2182
+ declare function createAttributeValidator(attr: Attribute): z.ZodTypeAny;
2183
+ /**
2184
+ * Create a Zod schema for an entire object
2185
+ */
2186
+ declare function createObjectValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
2187
+ /**
2188
+ * Validation result
2189
+ */
2190
+ interface ValidationResult {
2191
+ success: boolean;
2192
+ data?: Record<string, unknown>;
2193
+ errors?: Array<{
2194
+ path: string[];
2195
+ message: string;
2196
+ }>;
2197
+ }
2198
+ /**
2199
+ * Validate data against an attribute schema
2200
+ */
2201
+ declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
2202
+ /**
2203
+ * Validate data against an object schema
2204
+ */
2205
+ declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
2206
+ /**
2207
+ * Validate and throw if invalid
2208
+ */
2209
+ declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
2210
+ /**
2211
+ * Create a Zod schema for draft validation.
2212
+ * All attributes become optional, but provided values are still validated.
2213
+ */
2214
+ declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
2215
+ /**
2216
+ * Validate data in draft mode.
2217
+ * - All attributes are treated as optional (no required validation)
2218
+ * - Provided values are still validated for format/type correctness
2219
+ *
2220
+ * Use this when creating records that may be incomplete (drafts).
2221
+ *
2222
+ * @example
2223
+ * ```typescript
2224
+ * const result = validateDraft(PRODUCT, { name: "Draft" });
2225
+ * // → success even if "price" is required but missing
2226
+ *
2227
+ * const result2 = validateDraft(PRODUCT, { price: -10 });
2228
+ * // → fails because price must be >= 0 (format validation still applies)
2229
+ * ```
2230
+ */
2231
+ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
2232
+ /**
2233
+ * Validate draft data and throw if format validation fails.
2234
+ */
2235
+ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
2236
+ /**
2237
+ * Get the list of required attributes that are missing values.
2238
+ *
2239
+ * @example
2240
+ * ```typescript
2241
+ * const missing = getMissingRequiredAttributes(PRODUCT, { name: "Test" });
2242
+ * // → [priceAttribute, statusAttribute] if price and status are required but missing
2243
+ * ```
2244
+ */
2245
+ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
2246
+ /**
2247
+ * Check if a record is complete (all required attributes have valid values).
2248
+ *
2249
+ * @returns `true` if all required values are present and valid, `false` otherwise
2250
+ */
2251
+ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
2252
+ /**
2253
+ * Compute the completion status of a record based on its data.
2254
+ *
2255
+ * - `"complete"`: All required values are present and valid
2256
+ * - `"draft"`: One or more required values are missing or invalid
2257
+ *
2258
+ * This function is used to dynamically determine the status when
2259
+ * creating or updating records.
2260
+ *
2261
+ * @example
2262
+ * ```typescript
2263
+ * const status = computeRecordStatus(PRODUCT, {
2264
+ * name: "Nike Air Max",
2265
+ * price: 129.99,
2266
+ * status: "active"
2267
+ * });
2268
+ * // → "complete"
2269
+ *
2270
+ * const status2 = computeRecordStatus(PRODUCT, { name: "Draft Product" });
2271
+ * // → "draft" (missing required fields)
2272
+ * ```
2273
+ */
2274
+ declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
2275
+
2276
+ /**
2277
+ * Object as stored in database (metadata)
2278
+ */
2279
+ interface DBObject extends Timestamps {
2280
+ id: Uuid;
2281
+ tenantId: TenantId;
2282
+ name: string;
2283
+ label: string;
2284
+ description?: string;
2285
+ icon?: IconName;
2286
+ labelExpression: string;
2287
+ system: boolean;
2288
+ metadata?: Record<string, unknown>;
2289
+ }
2290
+ interface CreateDBObject {
2291
+ tenantId: TenantId;
2292
+ name: string;
2293
+ label: string;
2294
+ description?: string;
2295
+ icon?: IconName;
2296
+ labelExpression: string;
2297
+ system?: boolean;
2298
+ metadata?: Record<string, unknown>;
2299
+ }
2300
+ interface UpdateDBObject {
2301
+ label?: string;
2302
+ description?: string;
2303
+ icon?: IconName;
2304
+ labelExpression?: string;
2305
+ metadata?: Record<string, unknown>;
2306
+ }
2307
+ interface UpsertDBObject extends CreateDBObject {
2308
+ system: boolean;
2309
+ }
2310
+ /**
2311
+ * Attribute as stored in database (metadata)
2312
+ */
2313
+ interface DBAttribute extends Timestamps {
2314
+ id: Uuid;
2315
+ objectId: Uuid;
2316
+ name: string;
2317
+ label: string;
2318
+ type: AttributeType;
2319
+ description?: string;
2320
+ icon?: IconName;
2321
+ system: boolean;
2322
+ required: boolean;
2323
+ unique: boolean;
2324
+ order: number;
2325
+ hidden?: boolean;
2326
+ archived?: boolean;
2327
+ deprecated?: boolean;
2328
+ defaultValue?: unknown;
2329
+ config: Record<string, unknown>;
2330
+ }
2331
+ interface CreateDBAttribute {
2332
+ objectId: Uuid;
2333
+ name: string;
2334
+ label: string;
2335
+ type: AttributeType;
2336
+ description?: string;
2337
+ icon?: IconName;
2338
+ system?: boolean;
2339
+ required?: boolean;
2340
+ unique?: boolean;
2341
+ order?: number;
2342
+ hidden?: boolean;
2343
+ archived?: boolean;
2344
+ deprecated?: boolean;
2345
+ defaultValue?: unknown;
2346
+ config?: Record<string, unknown>;
2347
+ }
2348
+ interface UpdateDBAttribute {
2349
+ label?: string;
2350
+ description?: string;
2351
+ icon?: IconName;
2352
+ required?: boolean;
2353
+ order?: number;
2354
+ hidden?: boolean;
2355
+ archived?: boolean;
2356
+ deprecated?: boolean;
2357
+ defaultValue?: unknown;
2358
+ config?: Record<string, unknown>;
2359
+ }
2360
+ interface UpsertDBAttribute extends CreateDBAttribute {
2361
+ objectId: Uuid;
2362
+ name: string;
2363
+ }
2364
+
2365
+ /**
2366
+ * Object record creation data
2367
+ */
2368
+ interface CreateObjectRecord {
2369
+ tenantId: TenantId;
2370
+ objectId: Uuid;
2371
+ data: Record<string, unknown>;
2372
+ /**
2373
+ * Computed display label from labelExpression.
2374
+ * Stored for performance - avoids recomputation on every read.
2375
+ */
2376
+ label: string;
2377
+ /**
2378
+ * Completion status of the record.
2379
+ * - `draft`: Record is incomplete (missing required values)
2380
+ * - `complete`: All required values are present and valid
2381
+ */
2382
+ completionStatus: "draft" | "complete";
2383
+ }
2384
+ /**
2385
+ * Generic list options for pagination and sorting
2386
+ */
2387
+ interface ListOptions {
2388
+ limit?: number;
2389
+ offset?: number;
2390
+ orderBy?: string;
2391
+ orderDirection?: "asc" | "desc";
2392
+ }
2393
+ /**
2394
+ * Search options for full-text search
2395
+ */
2396
+ interface SearchOptions extends ListOptions {
2397
+ filters?: Record<string, unknown>;
2398
+ highlight?: boolean;
2399
+ }
2400
+ /**
2401
+ * Global search options
2402
+ */
2403
+ interface GlobalSearchOptions extends ListOptions {
2404
+ /**
2405
+ * Limit results to specific object names
2406
+ */
2407
+ objectNames?: string[];
2408
+ /**
2409
+ * Whether to include object metadata in results
2410
+ */
2411
+ includeObjectInfo?: boolean;
2412
+ }
2413
+ /**
2414
+ * Global search result item
2415
+ */
2416
+ interface GlobalSearchResultItem {
2417
+ objectId: string;
2418
+ objectName: string;
2419
+ objectLabel: string;
2420
+ /** Computed label from labelExpression */
2421
+ label: string;
2422
+ recordId: string;
2423
+ values: Record<string, unknown>;
2424
+ completionStatus: "draft" | "complete";
2425
+ createdAt: Date;
2426
+ updatedAt: Date;
2427
+ }
2428
+ /**
2429
+ * File-specific list options
2430
+ */
2431
+ interface FileListOptions extends ListOptions {
2432
+ folderPath?: string;
2433
+ mimeType?: string;
2434
+ uploadedBy?: Uuid;
2435
+ includeDeleted?: boolean;
2436
+ }
2437
+ /**
2438
+ * View as stored in database
2439
+ */
2440
+ interface DBView extends Timestamps {
2441
+ id: Uuid;
2442
+ tenantId: TenantId;
2443
+ objectId?: Uuid;
2444
+ objectName: string;
2445
+ name: string;
2446
+ label: string;
2447
+ description?: string;
2448
+ icon?: IconName;
2449
+ tabs: Tab[];
2450
+ default: boolean;
2451
+ system: boolean;
2452
+ metadata?: Record<string, unknown>;
2453
+ }
2454
+ interface CreateDBView {
2455
+ tenantId: TenantId;
2456
+ objectId?: Uuid;
2457
+ objectName: string;
2458
+ name: string;
2459
+ label: string;
2460
+ description?: string;
2461
+ icon?: IconName;
2462
+ tabs: Tab[];
2463
+ default?: boolean;
2464
+ system?: boolean;
2465
+ metadata?: Record<string, unknown>;
2466
+ }
2467
+ interface UpdateDBView {
2468
+ label?: string;
2469
+ description?: string;
2470
+ icon?: IconName;
2471
+ tabs?: Tab[];
2472
+ default?: boolean;
2473
+ metadata?: Record<string, unknown>;
2474
+ }
2475
+ interface UpsertDBView {
2476
+ tenantId: TenantId;
2477
+ objectName: string;
2478
+ name: string;
2479
+ label: string;
2480
+ description?: string;
2481
+ icon?: IconName;
2482
+ tabs: Tab[];
2483
+ default?: boolean;
2484
+ system?: boolean;
2485
+ metadata?: Record<string, unknown>;
2486
+ }
2487
+ /**
2488
+ * Result of an operation
2489
+ */
2490
+ interface OperationResult<T = unknown> {
2491
+ success: boolean;
2492
+ data?: T;
2493
+ error?: {
2494
+ code: string;
2495
+ message: string;
2496
+ details?: Record<string, unknown>;
2497
+ };
2498
+ }
2499
+
2500
+ /**
2501
+ * Repository for objects table (metadata)
2502
+ */
2503
+ interface ObjectsRepository {
2504
+ /**
2505
+ * Find object by ID
2506
+ */
2507
+ findById(id: Uuid): Promise<DBObject | null>;
2508
+ /**
2509
+ * Find object by name and tenant
2510
+ */
2511
+ findByName(tenantId: TenantId, name: string): Promise<DBObject | null>;
2512
+ /**
2513
+ * Find system/native object by name (system=true, for sync)
2514
+ */
2515
+ findSystemByName(name: string): Promise<DBObject | null>;
2516
+ /**
2517
+ * Create object
2518
+ */
2519
+ create(data: CreateDBObject): Promise<DBObject>;
2520
+ /**
2521
+ * Update object
2522
+ */
2523
+ update(id: Uuid, data: Partial<UpdateDBObject>): Promise<DBObject>;
2524
+ /**
2525
+ * Delete object
2526
+ */
2527
+ delete(id: Uuid): Promise<void>;
2528
+ /**
2529
+ * List all objects for a tenant
2530
+ */
2531
+ list(tenantId: TenantId): Promise<DBObject[]>;
2532
+ /**
2533
+ * Upsert object (create or update based on nativeObjectId)
2534
+ */
2535
+ upsert(data: UpsertDBObject): Promise<DBObject>;
2536
+ }
2537
+ /**
2538
+ * Repository for attributes table (metadata)
2539
+ */
2540
+ interface AttributesRepository {
2541
+ /**
2542
+ * Find attribute by ID
2543
+ */
2544
+ findById(id: Uuid): Promise<DBAttribute | null>;
2545
+ /**
2546
+ * Find attributes by object ID
2547
+ */
2548
+ findByObjectId(objectId: Uuid): Promise<DBAttribute[]>;
2549
+ /**
2550
+ * Create attribute
2551
+ */
2552
+ create(data: CreateDBAttribute): Promise<DBAttribute>;
2553
+ /**
2554
+ * Update attribute
2555
+ */
2556
+ update(id: Uuid, data: Partial<UpdateDBAttribute>): Promise<DBAttribute>;
2557
+ /**
2558
+ * Delete attribute
2559
+ */
2560
+ delete(id: Uuid): Promise<void>;
2561
+ /**
2562
+ * Delete multiple attributes by names (for sync cleanup)
2563
+ */
2564
+ deleteByNames(objectId: Uuid, excludeNames: string[]): Promise<number>;
2565
+ /**
2566
+ * Upsert attribute (create or update based on objectId + name)
2567
+ */
2568
+ upsert(data: UpsertDBAttribute): Promise<DBAttribute>;
2569
+ }
2570
+ /**
2571
+ * Repository for user_profiles table
2572
+ */
2573
+ interface UserProfilesRepository {
2574
+ /**
2575
+ * Find user profile by ID
2576
+ */
2577
+ findById(id: Uuid): Promise<UserProfile | null>;
2578
+ /**
2579
+ * Find user profile by auth ID (external auth provider)
2580
+ */
2581
+ findByAuthId(authId: string): Promise<UserProfile | null>;
2582
+ /**
2583
+ * Find user profile by email
2584
+ */
2585
+ findByEmail(tenantId: TenantId, email: string): Promise<UserProfile | null>;
2586
+ /**
2587
+ * Create user profile
2588
+ */
2589
+ create(data: CreateUserProfile): Promise<UserProfile>;
2590
+ /**
2591
+ * Update user profile
2592
+ */
2593
+ update(id: Uuid, data: UpdateUserProfile): Promise<UserProfile>;
2594
+ /**
2595
+ * Delete user profile
2596
+ */
2597
+ delete(id: Uuid): Promise<void>;
2598
+ /**
2599
+ * List all user profiles for a tenant
2600
+ */
2601
+ list(tenantId: TenantId, options?: ListOptions): Promise<UserProfile[]>;
2602
+ /**
2603
+ * Update last login timestamp
2604
+ */
2605
+ updateLastLogin(id: Uuid): Promise<void>;
2606
+ }
2607
+ /**
2608
+ * Repository for files table
2609
+ */
2610
+ interface FilesRepository {
2611
+ /**
2612
+ * Find file by ID
2613
+ */
2614
+ findById(id: Uuid): Promise<File | null>;
2615
+ /**
2616
+ * Create file
2617
+ */
2618
+ create(data: CreateFile): Promise<File>;
2619
+ /**
2620
+ * Update file
2621
+ */
2622
+ update(id: Uuid, data: UpdateFile): Promise<File>;
2623
+ /**
2624
+ * Delete file (soft delete)
2625
+ */
2626
+ delete(id: Uuid): Promise<void>;
2627
+ /**
2628
+ * Hard delete file (permanent)
2629
+ */
2630
+ hardDelete(id: Uuid): Promise<void>;
2631
+ /**
2632
+ * List files for a tenant
2633
+ */
2634
+ list(tenantId: TenantId, options?: FileListOptions): Promise<File[]>;
2635
+ /**
2636
+ * Find files by folder path
2637
+ */
2638
+ findByFolder(tenantId: TenantId, folderPath: string): Promise<File[]>;
2639
+ /**
2640
+ * Find files by uploader
2641
+ */
2642
+ findByUploader(uploadedBy: Uuid): Promise<File[]>;
2643
+ }
2644
+ /**
2645
+ * Repository for object_records table (unified JSONB)
2646
+ */
2647
+ interface ObjectRecordsRepository {
2648
+ /**
2649
+ * Find record by ID
2650
+ */
2651
+ findById(id: Uuid): Promise<ObjectRecord | null>;
2652
+ /**
2653
+ * Create record
2654
+ */
2655
+ create(data: CreateObjectRecord): Promise<ObjectRecord>;
2656
+ /**
2657
+ * Update record
2658
+ */
2659
+ update(id: Uuid, data: Partial<Record<string, unknown>>): Promise<ObjectRecord>;
2660
+ /**
2661
+ * Delete record
2662
+ */
2663
+ delete(id: Uuid): Promise<void>;
2664
+ /**
2665
+ * List records for an object
2666
+ */
2667
+ list(tenantId: TenantId, objectId: Uuid, options?: ListOptions): Promise<{
2668
+ records: ObjectRecord[];
2669
+ total: number;
2670
+ }>;
2671
+ /**
2672
+ * Search records using PostgreSQL full-text search
2673
+ */
2674
+ search(tenantId: TenantId, objectId: Uuid, query: string, options?: SearchOptions): Promise<{
2675
+ records: ObjectRecord[];
2676
+ total: number;
2677
+ }>;
2678
+ /**
2679
+ * Global search across all object records for a tenant
2680
+ * Searches in all objects or a subset specified by objectNames
2681
+ */
2682
+ globalSearch(tenantId: TenantId, query: string, options?: GlobalSearchOptions): Promise<{
2683
+ results: GlobalSearchResultItem[];
2684
+ total: number;
2685
+ }>;
2686
+ }
2687
+ /**
2688
+ * Repository for views table
2689
+ */
2690
+ interface ViewsRepository {
2691
+ /**
2692
+ * Find view by ID
2693
+ */
2694
+ findById(id: Uuid): Promise<DBView | null>;
2695
+ /**
2696
+ * Find view by name for an object and tenant
2697
+ */
2698
+ findByName(tenantId: TenantId, objectName: string, viewName: string): Promise<DBView | null>;
2699
+ /**
2700
+ * Find all views for an object and tenant
2701
+ */
2702
+ findByObjectName(tenantId: TenantId, objectName: string): Promise<DBView[]>;
2703
+ /**
2704
+ * Find all views for a tenant
2705
+ */
2706
+ findAllForTenant(tenantId: TenantId): Promise<DBView[]>;
2707
+ /**
2708
+ * Find system view by name (for sync)
2709
+ */
2710
+ findSystemByName(objectName: string, viewName: string): Promise<DBView | null>;
2711
+ /**
2712
+ * Find all system views for an object
2713
+ */
2714
+ findSystemByObjectName(objectName: string): Promise<DBView[]>;
2715
+ /**
2716
+ * Create view
2717
+ */
2718
+ create(data: CreateDBView): Promise<DBView>;
2719
+ /**
2720
+ * Update view
2721
+ */
2722
+ update(id: Uuid, data: Partial<UpdateDBView>): Promise<DBView>;
2723
+ /**
2724
+ * Delete view
2725
+ */
2726
+ delete(id: Uuid): Promise<void>;
2727
+ /**
2728
+ * Delete views not in the list (for sync cleanup)
2729
+ * @returns Number of deleted views
2730
+ */
2731
+ deleteNotIn(objectName: string, keepViewNames: string[]): Promise<number>;
2732
+ /**
2733
+ * Upsert view (create or update based on objectName + name)
2734
+ */
2735
+ upsert(data: UpsertDBView): Promise<DBView>;
2736
+ }
2737
+
2738
+ /**
2739
+ * Generic database adapter interface
2740
+ * Any ORM (Drizzle, Prisma, Kysely, TypeORM) can implement this interface
2741
+ * to work with @stndrds/schema runtime services
2742
+ *
2743
+ * @example
2744
+ * ```typescript
2745
+ * // Drizzle implementation
2746
+ * import { createDrizzleAdapter } from "./adapters/drizzle";
2747
+ * import { db } from "./db";
2748
+ *
2749
+ * const adapter = createDrizzleAdapter(db);
2750
+ *
2751
+ * // Prisma implementation
2752
+ * import { createPrismaAdapter } from "./adapters/prisma";
2753
+ * import { prisma } from "./db";
2754
+ *
2755
+ * const adapter = createPrismaAdapter(prisma);
2756
+ * ```
2757
+ */
2758
+ interface DatabaseAdapter {
2759
+ objects: ObjectsRepository;
2760
+ attributes: AttributesRepository;
2761
+ views: ViewsRepository;
2762
+ userProfiles: UserProfilesRepository;
2763
+ files: FilesRepository;
2764
+ objectRecords: ObjectRecordsRepository;
2765
+ transaction<T>(callback: (adapter: DatabaseAdapter) => Promise<T>): Promise<T>;
2766
+ }
2767
+
2768
+ /**
2769
+ * Types of hooks supported by the system
2770
+ */
2771
+ type HookType = "beforeCreate" | "afterCreate" | "beforeUpdate" | "afterUpdate" | "beforeDelete" | "afterDelete";
2772
+ /**
2773
+ * Change information for a specific attribute
2774
+ */
2775
+ interface AttributeChange<T = unknown> {
2776
+ oldValue: T | undefined;
2777
+ newValue: T | undefined;
2778
+ changed: boolean;
2779
+ }
2780
+ /**
2781
+ * Context passed to hooks - abstract, no framework dependencies
2782
+ *
2783
+ * This interface is designed to be extended by framework-specific implementations
2784
+ * (e.g., TriggerContext in schema-nestjs adds NestJS services)
2785
+ */
2786
+ interface HookContext<T = unknown> {
2787
+ objectId: string;
2788
+ objectName: string;
2789
+ recordId: string;
2790
+ tenantId: string;
2791
+ record: ObjectRecord;
2792
+ oldValues: Record<string, unknown>;
2793
+ newValues: Record<string, unknown>;
2794
+ changedAttributes: string[];
2795
+ /**
2796
+ * Get change information for a specific attribute
2797
+ * @param attributeName - The name of the attribute to check
2798
+ * @returns Change information including old value, new value, and whether it changed
2799
+ */
2800
+ getChange<V = T>(attributeName: string): AttributeChange<V>;
2801
+ metadata: Record<string, unknown>;
2802
+ timestamp: Date;
2803
+ }
2804
+ /**
2805
+ * Generic hook handler function
2806
+ */
2807
+ type HookHandler = (ctx: HookContext) => Promise<void> | void;
2808
+ /**
2809
+ * Definition of a hook for registration
2810
+ */
2811
+ interface HookDefinition {
2812
+ type: HookType;
2813
+ objectName: string;
2814
+ /** Attribute name to watch, or '*' for all attributes */
2815
+ attributeName?: string | "*";
2816
+ /** Execution priority (lower = earlier), default 0 */
2817
+ priority?: number;
2818
+ handler: HookHandler;
2819
+ }
2820
+
2821
+ /**
2822
+ * Abstract interface for hook registry
2823
+ *
2824
+ * This interface is implemented by TriggerRegistry in schema-nestjs
2825
+ * to provide NestJS-specific functionality like dependency injection
2826
+ * and automatic discovery of trigger classes.
2827
+ */
2828
+ interface HookRegistry {
2829
+ /**
2830
+ * Execute all hooks of a given type for an object
2831
+ *
2832
+ * @param type - The type of hook to execute (beforeUpdate, afterUpdate, etc.)
2833
+ * @param objectName - The name of the object being modified
2834
+ * @param ctx - The hook context containing record data and changes
2835
+ */
2836
+ execute(type: HookType, objectName: string, ctx: HookContext): Promise<void>;
2837
+ /**
2838
+ * Register a hook manually (optional)
2839
+ * Not all implementations need to support this (e.g., decorator-based discovery)
2840
+ */
2841
+ register?(hook: HookDefinition): void;
2842
+ }
2843
+ /**
2844
+ * No-op implementation of HookRegistry
2845
+ *
2846
+ * Used as default when no registry is provided to RecordService.
2847
+ * This allows the schema package to work independently without triggers.
2848
+ */
2849
+ declare class NoopHookRegistry implements HookRegistry {
2850
+ execute(): Promise<void>;
2851
+ }
2852
+
2853
+ interface InternalObjectRecord extends ObjectRecord {
2854
+ tenantId: TenantId;
2855
+ }
2856
+ interface MockStores {
2857
+ objects: Map<Uuid, DBObject>;
2858
+ attributes: Map<Uuid, DBAttribute>;
2859
+ userProfiles: Map<Uuid, UserProfile>;
2860
+ files: Map<Uuid, File>;
2861
+ objectRecords: Map<Uuid, InternalObjectRecord>;
2862
+ views: Map<Uuid, DBView>;
2863
+ }
2864
+ /**
2865
+ * Create an in-memory mock adapter for testing and development
2866
+ *
2867
+ * This adapter stores all data in memory and is perfect for:
2868
+ * - Unit tests
2869
+ * - Integration tests
2870
+ * - Local development without a database
2871
+ * - Understanding the adapter interface
2872
+ *
2873
+ * @returns A DatabaseAdapter implementation using in-memory storage
2874
+ *
2875
+ * @example
2876
+ * ```typescript
2877
+ * import { createMockAdapter, RecordService } from "@stndrds/schema";
2878
+ *
2879
+ * // Create adapter
2880
+ * const adapter = createMockAdapter();
2881
+ *
2882
+ * // Use with services
2883
+ * const recordService = new RecordService(adapter, "tenant-123");
2884
+ *
2885
+ * // Create a record
2886
+ * const product = await recordService.createRecord("obj-product", {
2887
+ * name: "Nike Air Max",
2888
+ * price: 129.99
2889
+ * });
2890
+ *
2891
+ * // List records
2892
+ * const { records, total } = await recordService.listRecords("obj-product");
2893
+ * ```
2894
+ */
2895
+ declare function createMockAdapter(): DatabaseAdapter & {
2896
+ _stores: MockStores;
2897
+ reset(): void;
2898
+ };
2899
+
2900
+ /**
2901
+ * Service for managing files
2902
+ * Handles file metadata CRUD, permissions, and soft delete
2903
+ */
2904
+ declare class FileService {
2905
+ private adapter;
2906
+ private tenantId;
2907
+ constructor(adapter: DatabaseAdapter, tenantId: string);
2908
+ /**
2909
+ * Create a new file record (after upload to storage)
2910
+ *
2911
+ * @param data - File metadata
2912
+ * @returns Created file record
2913
+ *
2914
+ * @example
2915
+ * ```typescript
2916
+ * const service = new FileService(adapter, "tenant-123");
2917
+ *
2918
+ * // After uploading to S3
2919
+ * const file = await service.createFile({
2920
+ * tenantId: "tenant-123",
2921
+ * name: "contract-2025.pdf",
2922
+ * originalName: "Contract Acme Corp 2025.pdf",
2923
+ * mimeType: "application/pdf",
2924
+ * size: 2458624,
2925
+ * storageProvider: "s3",
2926
+ * storagePath: "tenants/123/files/2025/contract.pdf",
2927
+ * storageBucket: "my-app-files",
2928
+ * url: "https://cdn.example.com/files/file-123",
2929
+ * uploadedBy: "profile-456",
2930
+ * visibility: "private"
2931
+ * });
2932
+ * ```
2933
+ */
2934
+ createFile(data: CreateFile): Promise<File>;
2935
+ /**
2936
+ * Get file by ID
2937
+ */
2938
+ getFile(fileId: string): Promise<File | null>;
2939
+ /**
2940
+ * Get file by ID or throw
2941
+ */
2942
+ getFileOrThrow(fileId: string): Promise<File>;
2943
+ /**
2944
+ * Update file metadata
2945
+ *
2946
+ * @param fileId - File UUID
2947
+ * @param data - Data to update
2948
+ * @returns Updated file
2949
+ */
2950
+ updateFile(fileId: string, data: UpdateFile): Promise<File>;
2951
+ /**
2952
+ * Delete file (soft delete)
2953
+ *
2954
+ * @param fileId - File UUID
2955
+ * @param options - Delete options
2956
+ */
2957
+ deleteFile(fileId: string, options?: {
2958
+ hard?: boolean;
2959
+ checkOwnership?: boolean;
2960
+ userId?: string;
2961
+ }): Promise<void>;
2962
+ /**
2963
+ * List files for the tenant
2964
+ */
2965
+ listFiles(options?: FileListOptions): Promise<File[]>;
2966
+ /**
2967
+ * List files by folder
2968
+ */
2969
+ listFilesByFolder(folderPath: string): Promise<File[]>;
2970
+ /**
2971
+ * List files uploaded by a specific user
2972
+ */
2973
+ listFilesByUploader(uploadedBy: string): Promise<File[]>;
2974
+ /**
2975
+ * Change file visibility
2976
+ *
2977
+ * @param fileId - File UUID
2978
+ * @param visibility - New visibility level
2979
+ * @param allowedUsers - Users allowed to access (if restricted)
2980
+ */
2981
+ changeVisibility(fileId: string, visibility: "public" | "private" | "restricted", allowedUsers?: string[]): Promise<File>;
2982
+ /**
2983
+ * Grant access to a file for specific users
2984
+ *
2985
+ * @param fileId - File UUID
2986
+ * @param userIds - User IDs to grant access
2987
+ */
2988
+ grantAccess(fileId: string, userIds: string[]): Promise<File>;
2989
+ /**
2990
+ * Revoke access to a file for specific users
2991
+ *
2992
+ * @param fileId - File UUID
2993
+ * @param userIds - User IDs to revoke access
2994
+ */
2995
+ revokeAccess(fileId: string, userIds: string[]): Promise<File>;
2996
+ /**
2997
+ * Check if user has access to a file
2998
+ *
2999
+ * @param fileId - File UUID
3000
+ * @param userId - User ID to check
3001
+ * @returns true if user can access the file
3002
+ */
3003
+ canAccess(fileId: string, userId: string): Promise<boolean>;
3004
+ /**
3005
+ * Move file to different folder
3006
+ */
3007
+ moveToFolder(fileId: string, newFolderPath: string): Promise<File>;
3008
+ /**
3009
+ * Add tags to file
3010
+ */
3011
+ addTags(fileId: string, tags: string[]): Promise<File>;
3012
+ /**
3013
+ * Remove tags from file
3014
+ */
3015
+ removeTags(fileId: string, tags: string[]): Promise<File>;
3016
+ }
3017
+
3018
+ /**
3019
+ * Geocoding service for address autocomplete and geocoding operations
3020
+ *
3021
+ * @example
3022
+ * ```typescript
3023
+ * import { GeocodingService } from "@stndrds/schema";
3024
+ * import { GoogleMapsAdapter } from "./adapters/google-maps";
3025
+ *
3026
+ * const geocoding = new GeocodingService(new GoogleMapsAdapter({ apiKey: "..." }));
3027
+ *
3028
+ * const suggestions = await geocoding.autocomplete({
3029
+ * query: "40 Quai des Belges",
3030
+ * countries: ["FRA"],
3031
+ * limit: 5,
3032
+ * });
3033
+ * ```
3034
+ */
3035
+ declare class GeocodingService {
3036
+ private readonly adapter;
3037
+ constructor(adapter: GeocodingAdapter);
3038
+ /**
3039
+ * Search for address suggestions as the user types
3040
+ */
3041
+ autocomplete(params: GeocodingAutocompleteParams): Promise<GeocodingSuggestion[]>;
3042
+ /**
3043
+ * Reverse geocode coordinates to an address
3044
+ */
3045
+ reverse(params: ReverseGeocodingParams): Promise<GeocodingSuggestion | null>;
3046
+ /**
3047
+ * Geocode a structured address to coordinates
3048
+ */
3049
+ geocode(params: GeocodingParams): Promise<GeocodingSuggestion | null>;
3050
+ }
3051
+
3052
+ /**
3053
+ * Service for global search across all object records
3054
+ * Allows searching across all objects or a subset of objects for a tenant
3055
+ *
3056
+ * @example
3057
+ * ```typescript
3058
+ * const service = new GlobalSearchService(adapter, "tenant-123");
3059
+ *
3060
+ * // Search across all objects
3061
+ * const { results, total } = await service.search("nike");
3062
+ *
3063
+ * // Search only in specific objects
3064
+ * const { results, total } = await service.search("nike", {
3065
+ * objectNames: ["products", "orders"],
3066
+ * limit: 20
3067
+ * });
3068
+ * ```
3069
+ */
3070
+ declare class GlobalSearchService {
3071
+ private adapter;
3072
+ private tenantId;
3073
+ constructor(adapter: DatabaseAdapter, tenantId: string);
3074
+ /**
3075
+ * Search across all object records for the tenant
3076
+ *
3077
+ * @param query - Search query string
3078
+ * @param options - Search options (pagination, object filters)
3079
+ * @returns Matching records with object metadata and total count
3080
+ *
3081
+ * @example
3082
+ * ```typescript
3083
+ * // Basic search
3084
+ * const { results, total } = await service.search("nike air");
3085
+ *
3086
+ * // With pagination
3087
+ * const { results, total } = await service.search("nike", {
3088
+ * limit: 10,
3089
+ * offset: 20
3090
+ * });
3091
+ *
3092
+ * // Filter by object types
3093
+ * const { results, total } = await service.search("nike", {
3094
+ * objectNames: ["products", "orders"]
3095
+ * });
3096
+ * ```
3097
+ */
3098
+ search(query: string, options?: GlobalSearchOptions): Promise<{
3099
+ results: GlobalSearchResultItem[];
3100
+ total: number;
3101
+ }>;
3102
+ /**
3103
+ * Search and group results by object type
3104
+ *
3105
+ * @param query - Search query string
3106
+ * @param options - Search options
3107
+ * @returns Results grouped by object name
3108
+ */
3109
+ searchGrouped(query: string, options?: Omit<GlobalSearchOptions, "limit" | "offset">): Promise<{
3110
+ groups: Array<{
3111
+ objectName: string;
3112
+ objectLabel: string;
3113
+ results: GlobalSearchResultItem[];
3114
+ count: number;
3115
+ }>;
3116
+ total: number;
3117
+ }>;
3118
+ }
3119
+
3120
+ /**
3121
+ * Input for creating a custom object
3122
+ */
3123
+ interface CreateCustomObjectInput {
3124
+ name: string;
3125
+ label: string;
3126
+ /**
3127
+ * Template expression for computing record display labels.
3128
+ * Example: "{{ name }}" or "{{ firstName }} {{ lastName }}"
3129
+ */
3130
+ labelExpression: string;
3131
+ description?: string;
3132
+ icon?: IconName;
3133
+ attributes?: (Attribute | {
3134
+ build: () => Attribute;
3135
+ })[];
3136
+ metadata?: Record<string, unknown>;
3137
+ }
3138
+ /**
3139
+ * Input for adding an attribute to an object
3140
+ */
3141
+ interface AddAttributeInput {
3142
+ name: string;
3143
+ label: string;
3144
+ type: AttributeType;
3145
+ required?: boolean;
3146
+ unique?: boolean;
3147
+ description?: string;
3148
+ placeholder?: string;
3149
+ icon?: IconName;
3150
+ defaultValue?: unknown;
3151
+ metadata?: Record<string, unknown>;
3152
+ [key: string]: unknown;
3153
+ }
3154
+ /**
3155
+ * Service for managing object schemas
3156
+ * Handles fusion of native objects (from registry) and custom objects (from database)
3157
+ */
3158
+ declare class ObjectSchemaService {
3159
+ private adapter;
3160
+ private nativeRegistry;
3161
+ constructor(adapter: DatabaseAdapter, nativeRegistry: typeof registry);
3162
+ /**
3163
+ * Create a new custom object
3164
+ * Validates name format and ensures system=false
3165
+ *
3166
+ * @param definition - Object definition (attributes can be raw definitions or builders)
3167
+ * @param tenantId - Tenant ID owning the object
3168
+ * @returns Created ObjectDefinition
3169
+ */
3170
+ createCustomObject(definition: CreateCustomObjectInput, tenantId: string): Promise<ObjectDefinition>;
3171
+ /**
3172
+ * Add a custom attribute to an existing object
3173
+ * Can be used on both custom and native objects
3174
+ * Attributes added via API are always custom (system=false)
3175
+ *
3176
+ * @param objectId - Object UUID from database
3177
+ * @param attribute - Attribute definition
3178
+ * @param tenantId - Tenant ID (required for relation validation)
3179
+ * @returns Created Attribute
3180
+ */
3181
+ addAttributeToObject(objectId: string, attribute: AddAttributeInput, tenantId?: string): Promise<Attribute>;
3182
+ /**
3183
+ * Update an attribute
3184
+ * Can only update custom attributes (system=false)
3185
+ *
3186
+ * @param attributeId - Attribute UUID
3187
+ * @param updates - Partial attribute updates
3188
+ * @param tenantId - Tenant ID (required for relation validation)
3189
+ * @returns Updated Attribute
3190
+ */
3191
+ updateAttribute(attributeId: string, updates: Partial<AddAttributeInput>, tenantId?: string): Promise<Attribute>;
3192
+ /**
3193
+ * Delete an attribute
3194
+ * Can only delete custom attributes (system=false)
3195
+ *
3196
+ * @param attributeId - Attribute UUID
3197
+ */
3198
+ deleteAttribute(attributeId: string): Promise<void>;
3199
+ /**
3200
+ * List attributes for an object
3201
+ *
3202
+ * @param objectId - Object UUID
3203
+ * @param options - Filter options
3204
+ * @returns List of attributes
3205
+ */
3206
+ listAttributes(objectId: string, options?: {
3207
+ systemOnly?: boolean;
3208
+ customOnly?: boolean;
3209
+ }): Promise<Attribute[]>;
3210
+ /**
3211
+ * Validate attribute name format (variable identifier)
3212
+ * @internal
3213
+ */
3214
+ private validateAttributeName;
3215
+ /**
3216
+ * Get complete object schema (system + custom attributes)
3217
+ * If object is native, merges registry definition with DB custom attributes
3218
+ * If object is custom, returns DB definition only
3219
+ *
3220
+ * @param objectId - Object UUID from database
3221
+ * @returns Complete ObjectDefinition with all attributes
3222
+ *
3223
+ * @example
3224
+ * ```typescript
3225
+ * const service = new ObjectSchemaService(adapter, registry);
3226
+ * const productSchema = await service.getObjectSchema("obj-123");
3227
+ *
3228
+ * console.log(productSchema.attributes); // System + custom attributes
3229
+ * ```
3230
+ */
3231
+ getObjectSchema(objectId: string): Promise<ObjectDefinition>;
3232
+ /**
3233
+ * Get object schema by name (for system/native objects)
3234
+ * @deprecated Use getObjectSchemaByNameForTenant for custom objects support
3235
+ */
3236
+ getObjectSchemaByName(name: string): Promise<ObjectDefinition>;
3237
+ /**
3238
+ * Get object schema by name for a tenant (supports both native and custom objects)
3239
+ */
3240
+ getObjectSchemaByNameForTenant(name: string, tenantId: string): Promise<ObjectDefinition>;
3241
+ /**
3242
+ * List all object schemas for a tenant
3243
+ */
3244
+ listObjectSchemas(tenantId: string): Promise<ObjectDefinition[]>;
3245
+ /**
3246
+ * Merge native object from registry with custom attributes from DB
3247
+ * @internal
3248
+ */
3249
+ private mergeNativeObject;
3250
+ /**
3251
+ * Convert DB object + attributes to ObjectDefinition
3252
+ * @internal
3253
+ */
3254
+ private convertDBObjectToDefinition;
3255
+ /**
3256
+ * Validate attribute input and return parsed config
3257
+ * Validates: name format, config schema, relation targets
3258
+ * @internal
3259
+ */
3260
+ private validateAttributeInput;
3261
+ /**
3262
+ * Build and validate attribute config from input
3263
+ * Uses Zod schema to validate and strip unknown properties
3264
+ * @internal
3265
+ */
3266
+ private buildAttributeConfig;
3267
+ /**
3268
+ * Validate that relation target objects exist
3269
+ * @internal
3270
+ */
3271
+ private validateRelationTargets;
3272
+ /**
3273
+ * Convert DB attribute to Attribute type
3274
+ * @internal
3275
+ */
3276
+ private convertDBAttributeToAttribute;
3277
+ }
3278
+
3279
+ /**
3280
+ * Options for RecordService constructor
3281
+ */
3282
+ interface RecordServiceOptions {
3283
+ /**
3284
+ * Hook registry for executing triggers before/after operations.
3285
+ * If not provided, a no-op registry is used (no hooks executed).
3286
+ */
3287
+ hookRegistry?: HookRegistry;
3288
+ }
3289
+ /**
3290
+ * Service for managing object records (CRUD operations)
3291
+ * Handles validation, dispatch to correct table, and data consistency
3292
+ *
3293
+ * Supports optional hook system for triggers on attribute changes.
3294
+ */
3295
+ declare class RecordService {
3296
+ private adapter;
3297
+ private tenantId;
3298
+ private schemaService;
3299
+ private relationService;
3300
+ private hookRegistry;
3301
+ constructor(adapter: DatabaseAdapter, tenantId: string, options?: RecordServiceOptions);
3302
+ /**
3303
+ * Compute display label from schema expression
3304
+ * @internal
3305
+ */
3306
+ private computeLabel;
3307
+ /**
3308
+ * Create a new record with validation
3309
+ *
3310
+ * Triggers beforeCreate and afterCreate hooks if a HookRegistry is configured.
3311
+ *
3312
+ * @param objectId - Object UUID
3313
+ * @param data - Record data (attribute values)
3314
+ * @param options - Creation options
3315
+ * @returns Created record with computed completionStatus
3316
+ *
3317
+ * @example
3318
+ * ```typescript
3319
+ * const service = new RecordService(adapter, "tenant-123");
3320
+ *
3321
+ * // Create a complete record (strict validation)
3322
+ * const product = await service.createRecord("obj-product", {
3323
+ * name: "Nike Air Max",
3324
+ * price: 129.99,
3325
+ * status: "active"
3326
+ * });
3327
+ * // → product.completionStatus = "complete"
3328
+ *
3329
+ * // Create a draft record (allows missing required fields)
3330
+ * const draft = await service.createRecord("obj-product", {
3331
+ * name: "Draft Product"
3332
+ * }, { allowDraft: true });
3333
+ * // → draft.completionStatus = "draft"
3334
+ * ```
3335
+ */
3336
+ createRecord(objectId: string, data: Record<string, unknown>, options?: {
3337
+ /**
3338
+ * Allow creating records with missing required fields.
3339
+ * Format validation still applies to provided values.
3340
+ * @default false
3341
+ */
3342
+ allowDraft?: boolean;
3343
+ /**
3344
+ * Skip all validation (format + relations).
3345
+ * @default true
3346
+ */
3347
+ validate?: boolean;
3348
+ /**
3349
+ * Skip relation validation only.
3350
+ * Useful for bulk imports where relations are validated separately.
3351
+ * @default false
3352
+ */
3353
+ skipRelationValidation?: boolean;
3354
+ skipSystemCheck?: boolean;
3355
+ /**
3356
+ * Skip hook execution.
3357
+ * @default false
3358
+ */
3359
+ skipHooks?: boolean;
3360
+ /**
3361
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3362
+ */
3363
+ hookMetadata?: Record<string, unknown>;
3364
+ }): Promise<ObjectRecord>;
3365
+ /**
3366
+ * Get a record by ID
3367
+ *
3368
+ * @param recordId - Record UUID
3369
+ * @param options - Query options
3370
+ * @returns Record or null if not found
3371
+ */
3372
+ getRecord(recordId: string, options?: {
3373
+ includeSchema?: boolean;
3374
+ }): Promise<ObjectRecord | null>;
3375
+ /**
3376
+ * Get a record by ID or throw if not found
3377
+ */
3378
+ getRecordOrThrow(recordId: string): Promise<ObjectRecord>;
3379
+ /**
3380
+ * Update a record with validation
3381
+ *
3382
+ * The completion status is automatically recalculated after each update.
3383
+ * A draft record becomes complete when all required fields are filled.
3384
+ *
3385
+ * Triggers beforeUpdate and afterUpdate hooks if a HookRegistry is configured.
3386
+ *
3387
+ * @param recordId - Record UUID
3388
+ * @param data - Partial data to update
3389
+ * @param options - Update options
3390
+ * @returns Updated record with recalculated completionStatus
3391
+ *
3392
+ * @example
3393
+ * ```typescript
3394
+ * // Update a draft record to make it complete
3395
+ * const updated = await service.updateRecord(draftId, {
3396
+ * price: 99.99,
3397
+ * status: "active"
3398
+ * });
3399
+ * // → updated.completionStatus = "complete" if all required fields now present
3400
+ * ```
3401
+ */
3402
+ updateRecord(recordId: string, data: Partial<Record<string, unknown>>, options?: {
3403
+ /**
3404
+ * Skip validation entirely (format + relations).
3405
+ * @default true
3406
+ */
3407
+ validate?: boolean;
3408
+ /**
3409
+ * Allow partial updates without strict validation.
3410
+ * Format validation still applies to provided values.
3411
+ * @default false
3412
+ */
3413
+ partial?: boolean;
3414
+ /**
3415
+ * Skip relation validation only.
3416
+ * @default false
3417
+ */
3418
+ skipRelationValidation?: boolean;
3419
+ /**
3420
+ * Skip hook execution.
3421
+ * @default false
3422
+ */
3423
+ skipHooks?: boolean;
3424
+ /**
3425
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3426
+ */
3427
+ hookMetadata?: Record<string, unknown>;
3428
+ }): Promise<ObjectRecord>;
3429
+ /**
3430
+ * Build hook context for update operations
3431
+ * @internal
3432
+ */
3433
+ private buildHookContext;
3434
+ /**
3435
+ * Build hook context for create operations (no existing record)
3436
+ * @internal
3437
+ */
3438
+ private buildCreateHookContext;
3439
+ /**
3440
+ * Build hook context for delete operations
3441
+ * @internal
3442
+ */
3443
+ private buildDeleteHookContext;
3444
+ /**
3445
+ * Delete a record
3446
+ *
3447
+ * Triggers beforeDelete and afterDelete hooks if a HookRegistry is configured.
3448
+ *
3449
+ * @param recordId - Record UUID
3450
+ * @param options - Delete options
3451
+ */
3452
+ deleteRecord(recordId: string, options?: {
3453
+ checkSystem?: boolean;
3454
+ /**
3455
+ * Skip hook execution.
3456
+ * @default false
3457
+ */
3458
+ skipHooks?: boolean;
3459
+ /**
3460
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3461
+ */
3462
+ hookMetadata?: Record<string, unknown>;
3463
+ }): Promise<void>;
3464
+ /**
3465
+ * List records for an object with pagination
3466
+ *
3467
+ * @param objectId - Object UUID
3468
+ * @param options - List options
3469
+ * @returns Records and total count
3470
+ */
3471
+ listRecords(objectId: string, options?: {
3472
+ limit?: number;
3473
+ offset?: number;
3474
+ orderBy?: string;
3475
+ orderDirection?: "asc" | "desc";
3476
+ }): Promise<{
3477
+ records: ObjectRecord[];
3478
+ total: number;
3479
+ }>;
3480
+ /**
3481
+ * Search records using full-text search
3482
+ *
3483
+ * @param objectId - Object UUID
3484
+ * @param query - Search query
3485
+ * @param options - Search options
3486
+ * @returns Matching records and total count
3487
+ */
3488
+ searchRecords(objectId: string, query: string, options?: {
3489
+ limit?: number;
3490
+ offset?: number;
3491
+ filters?: Record<string, unknown>;
3492
+ }): Promise<{
3493
+ records: ObjectRecord[];
3494
+ total: number;
3495
+ }>;
3496
+ /**
3497
+ * Validate data against object schema without saving
3498
+ *
3499
+ * @param objectId - Object UUID
3500
+ * @param data - Data to validate
3501
+ * @returns Validation result
3502
+ */
3503
+ validateData(objectId: string, data: Record<string, unknown>): Promise<ValidationResult>;
3504
+ /**
3505
+ * Compute the completion status for given data without saving.
3506
+ * Useful for UI to show draft/complete status before submitting.
3507
+ *
3508
+ * @param objectId - Object UUID
3509
+ * @param data - Data to check
3510
+ * @returns Computed completion status
3511
+ */
3512
+ computeStatus(objectId: string, data: Record<string, unknown>): Promise<CompletionStatus>;
3513
+ /**
3514
+ * Refresh the completion status of an existing record.
3515
+ * Useful when schema changes and you need to recompute statuses.
3516
+ *
3517
+ * @param recordId - Record UUID
3518
+ * @returns Updated completion status
3519
+ */
3520
+ refreshRecordStatus(recordId: string): Promise<CompletionStatus>;
3521
+ }
3522
+
3523
+ /**
3524
+ * Result of relation validation
3525
+ */
3526
+ interface RelationValidationResult {
3527
+ valid: boolean;
3528
+ errors: RelationValidationError[];
3529
+ }
3530
+ /**
3531
+ * Individual relation validation error
3532
+ */
3533
+ interface RelationValidationError {
3534
+ /** Attribute name */
3535
+ attribute: string;
3536
+ /** Error message */
3537
+ message: string;
3538
+ /** Invalid record IDs */
3539
+ invalidIds?: string[];
3540
+ }
3541
+ /**
3542
+ * Resolved relation option
3543
+ */
3544
+ interface RelationOption {
3545
+ /** Record ID */
3546
+ id: string;
3547
+ /** Object ID */
3548
+ objectId: string;
3549
+ /** Object name (technical name) */
3550
+ objectName: string;
3551
+ /** Object label (display name) */
3552
+ objectLabel: string;
3553
+ /** Object icon */
3554
+ objectIcon?: string;
3555
+ /** Display label (computed from labelExpression) */
3556
+ label: string;
3557
+ /** Additional record data */
3558
+ data?: Record<string, unknown>;
3559
+ }
3560
+ /**
3561
+ * Response for relation options
3562
+ */
3563
+ interface RelationOptionsResponse {
3564
+ options: RelationOption[];
3565
+ hasMore: boolean;
3566
+ total: number;
3567
+ }
3568
+ /**
3569
+ * Parameters for fetching relation options
3570
+ */
3571
+ interface GetRelationOptionsParams {
3572
+ /** Search query */
3573
+ query?: string;
3574
+ /** Page number (1-based) */
3575
+ page?: number;
3576
+ /** Page size */
3577
+ pageSize?: number;
3578
+ /** Filter by specific target object */
3579
+ targetObject?: string;
3580
+ }
3581
+ /**
3582
+ * Service for validating relation attributes
3583
+ * Ensures referenced records exist and belong to valid target objects
3584
+ */
3585
+ declare class RelationService {
3586
+ private adapter;
3587
+ private schemaService;
3588
+ constructor(adapter: DatabaseAdapter, nativeRegistry: typeof registry);
3589
+ /**
3590
+ * Validate all relation attributes in the data
3591
+ *
3592
+ * @param schema - Object schema containing attribute definitions
3593
+ * @param data - Record data to validate
3594
+ * @returns Validation result with errors if any
3595
+ *
3596
+ * @example
3597
+ * ```typescript
3598
+ * const result = await relationService.validateRelations(schema, {
3599
+ * company: "rec-123",
3600
+ * contacts: ["rec-456", "rec-789"]
3601
+ * });
3602
+ *
3603
+ * if (!result.valid) {
3604
+ * console.log(result.errors);
3605
+ * // [{ attribute: "company", message: "Record not found", invalidIds: ["rec-123"] }]
3606
+ * }
3607
+ * ```
3608
+ */
3609
+ validateRelations(schema: ObjectDefinition, data: Record<string, unknown>): Promise<RelationValidationResult>;
3610
+ /**
3611
+ * Validate a single relation attribute value
3612
+ */
3613
+ private validateRelationAttribute;
3614
+ /**
3615
+ * Extract IDs from relation value based on cardinality
3616
+ */
3617
+ private extractIds;
3618
+ /**
3619
+ * Get valid object IDs from relation targets
3620
+ */
3621
+ private getValidObjectIds;
3622
+ /**
3623
+ * Validate relations and throw if invalid
3624
+ */
3625
+ validateRelationsOrThrow(schema: ObjectDefinition, data: Record<string, unknown>): Promise<void>;
3626
+ /**
3627
+ * Get available options for a relation attribute
3628
+ * Searches across all target objects defined in the relation
3629
+ *
3630
+ * @param attribute - Relation attribute definition
3631
+ * @param tenantId - Tenant ID for multi-tenant isolation
3632
+ * @param params - Query parameters
3633
+ *
3634
+ * @example
3635
+ * ```typescript
3636
+ * const options = await relationService.getOptions(attribute, "tenant-1", {
3637
+ * query: "nike",
3638
+ * page: 1,
3639
+ * pageSize: 20
3640
+ * });
3641
+ * ```
3642
+ */
3643
+ getOptions(attribute: RelationAttribute, tenantId: string, params?: GetRelationOptionsParams): Promise<RelationOptionsResponse>;
3644
+ /**
3645
+ * Resolve record IDs to their display labels
3646
+ * Useful for displaying current values in the UI
3647
+ *
3648
+ * @param ids - Record IDs to resolve
3649
+ * @param tenantId - Tenant ID for multi-tenant isolation
3650
+ *
3651
+ * @example
3652
+ * ```typescript
3653
+ * const resolved = await relationService.resolveIds(["rec-1", "rec-2"], "tenant-1");
3654
+ * // [{ id: "rec-1", label: "Nike Air Max", objectName: "products", ... }]
3655
+ * ```
3656
+ */
3657
+ resolveIds(ids: string[], tenantId: string): Promise<RelationOption[]>;
3658
+ /**
3659
+ * Find a relation attribute by ID
3660
+ */
3661
+ findAttributeById(attributeId: string): Promise<RelationAttribute | null>;
3662
+ }
3663
+
3664
+ /**
3665
+ * Service for managing user profiles
3666
+ * Handles user profile CRUD, auth provider sync, and role management
3667
+ */
3668
+ declare class UserProfileService {
3669
+ private adapter;
3670
+ private tenantId;
3671
+ constructor(adapter: DatabaseAdapter, tenantId: string);
3672
+ /**
3673
+ * Create a new user profile (typically after first auth)
3674
+ *
3675
+ * @param data - User profile creation data
3676
+ * @returns Created user profile
3677
+ *
3678
+ * @example
3679
+ * ```typescript
3680
+ * const service = new UserProfileService(adapter, "tenant-123");
3681
+ *
3682
+ * // After Supabase auth
3683
+ * const profile = await service.createProfile({
3684
+ * tenantId: "tenant-123",
3685
+ * authId: authUser.id,
3686
+ * email: authUser.email,
3687
+ * firstName: authUser.user_metadata.first_name,
3688
+ * lastName: authUser.user_metadata.last_name,
3689
+ * role: "member",
3690
+ * status: "active"
3691
+ * });
3692
+ * ```
3693
+ */
3694
+ createProfile(data: CreateUserProfile): Promise<UserProfile>;
3695
+ /**
3696
+ * Get user profile by ID
3697
+ */
3698
+ getProfile(profileId: string): Promise<UserProfile | null>;
3699
+ /**
3700
+ * Get user profile by ID or throw
3701
+ */
3702
+ getProfileOrThrow(profileId: string): Promise<UserProfile>;
3703
+ /**
3704
+ * Get user profile by auth provider ID
3705
+ *
3706
+ * @param authId - Auth provider user ID (Supabase, Clerk, etc.)
3707
+ * @returns User profile or null
3708
+ */
3709
+ getProfileByAuthId(authId: string): Promise<UserProfile | null>;
3710
+ /**
3711
+ * Get or create user profile (idempotent operation)
3712
+ * Useful for auth callbacks - ensures profile exists
3713
+ *
3714
+ * @param authId - Auth provider user ID
3715
+ * @param data - Profile data to create if doesn't exist
3716
+ * @returns Existing or newly created profile
3717
+ *
3718
+ * @example
3719
+ * ```typescript
3720
+ * // In Supabase auth callback
3721
+ * const profile = await service.getOrCreateProfile(
3722
+ * authUser.id,
3723
+ * {
3724
+ * tenantId: "tenant-123",
3725
+ * authId: authUser.id,
3726
+ * email: authUser.email,
3727
+ * role: "member",
3728
+ * status: "active"
3729
+ * }
3730
+ * );
3731
+ * ```
3732
+ */
3733
+ getOrCreateProfile(authId: string, data: CreateUserProfile): Promise<UserProfile>;
3734
+ /**
3735
+ * Update user profile
3736
+ */
3737
+ updateProfile(profileId: string, data: UpdateUserProfile): Promise<UserProfile>;
3738
+ /**
3739
+ * Delete user profile
3740
+ *
3741
+ * @param profileId - Profile UUID
3742
+ * @param options - Delete options
3743
+ */
3744
+ deleteProfile(profileId: string, options?: {
3745
+ checkAdmin?: boolean;
3746
+ }): Promise<void>;
3747
+ /**
3748
+ * List all user profiles for the tenant
3749
+ */
3750
+ listProfiles(options?: ListOptions): Promise<UserProfile[]>;
3751
+ /**
3752
+ * Update last login timestamp
3753
+ *
3754
+ * @param profileId - Profile UUID
3755
+ *
3756
+ * @example
3757
+ * ```typescript
3758
+ * // After successful auth
3759
+ * await service.updateLastLogin(profile.id);
3760
+ * ```
3761
+ */
3762
+ updateLastLogin(profileId: string): Promise<void>;
3763
+ /**
3764
+ * Change user role
3765
+ *
3766
+ * @param profileId - Profile UUID
3767
+ * @param newRole - New role
3768
+ */
3769
+ changeRole(profileId: string, newRole: string): Promise<UserProfile>;
3770
+ /**
3771
+ * Change user status
3772
+ *
3773
+ * @param profileId - Profile UUID
3774
+ * @param newStatus - New status
3775
+ */
3776
+ changeStatus(profileId: string, newStatus: "active" | "pending" | "inactive" | "suspended"): Promise<UserProfile>;
3777
+ /**
3778
+ * Get user by email
3779
+ */
3780
+ getProfileByEmail(email: string): Promise<UserProfile | null>;
3781
+ /**
3782
+ * Check if user has role
3783
+ */
3784
+ hasRole(profileId: string, role: string): Promise<boolean>;
3785
+ /**
3786
+ * Check if user is admin
3787
+ */
3788
+ isAdmin(profileId: string): Promise<boolean>;
3789
+ }
3790
+
3791
+ /**
3792
+ * Input for creating a custom view
3793
+ */
3794
+ interface CreateViewInput {
3795
+ name: string;
3796
+ label: string;
3797
+ objectName: string;
3798
+ description?: string;
3799
+ icon?: IconName;
3800
+ tabs: Tab[];
3801
+ default?: boolean;
3802
+ metadata?: Record<string, unknown>;
3803
+ }
3804
+ /**
3805
+ * Input for updating a view
3806
+ */
3807
+ interface UpdateViewInput {
3808
+ label?: string;
3809
+ description?: string;
3810
+ icon?: IconName;
3811
+ tabs?: Tab[];
3812
+ default?: boolean;
3813
+ metadata?: Record<string, unknown>;
3814
+ }
3815
+ /**
3816
+ * Service for managing views
3817
+ * Handles fusion of native views (from registry) and custom views (from database)
3818
+ */
3819
+ declare class ViewService {
3820
+ private adapter;
3821
+ private nativeViews;
3822
+ constructor(adapter: DatabaseAdapter, nativeViews: typeof viewRegistry);
3823
+ /**
3824
+ * Get all views for an object (native + custom)
3825
+ *
3826
+ * @param objectName - Object name
3827
+ * @param tenantId - Tenant ID
3828
+ * @returns All views for the object
3829
+ */
3830
+ getViewsForObject(objectName: string, tenantId: string): Promise<ViewDefinition[]>;
3831
+ /**
3832
+ * Get a specific view by name
3833
+ *
3834
+ * @param objectName - Object name
3835
+ * @param viewName - View name
3836
+ * @param tenantId - Tenant ID
3837
+ * @returns View definition or null
3838
+ */
3839
+ getView(objectName: string, viewName: string, tenantId: string): Promise<ViewDefinition | null>;
3840
+ /**
3841
+ * Get the default view for an object
3842
+ *
3843
+ * Priority:
3844
+ * 1. Custom view marked as default
3845
+ * 2. Native view marked as default
3846
+ * 3. First available view
3847
+ *
3848
+ * @param objectName - Object name
3849
+ * @param tenantId - Tenant ID
3850
+ * @returns Default view or null
3851
+ */
3852
+ getDefaultView(objectName: string, tenantId: string): Promise<ViewDefinition | null>;
3853
+ /**
3854
+ * Create a custom view
3855
+ *
3856
+ * @param input - View definition
3857
+ * @param tenantId - Tenant ID
3858
+ * @returns Created view
3859
+ */
3860
+ createView(input: CreateViewInput, tenantId: string): Promise<ViewDefinition>;
3861
+ /**
3862
+ * Update a custom view
3863
+ *
3864
+ * @param viewId - View ID
3865
+ * @param input - Update data
3866
+ * @returns Updated view
3867
+ */
3868
+ updateView(viewId: string, input: UpdateViewInput): Promise<ViewDefinition>;
3869
+ /**
3870
+ * Delete a custom view
3871
+ *
3872
+ * @param viewId - View ID
3873
+ */
3874
+ deleteView(viewId: string): Promise<void>;
3875
+ /**
3876
+ * Set a view as default for its object
3877
+ *
3878
+ * @param viewId - View ID
3879
+ * @param tenantId - Tenant ID
3880
+ * @returns Updated view
3881
+ */
3882
+ setDefaultView(viewId: string, tenantId: string): Promise<ViewDefinition>;
3883
+ /**
3884
+ * Validate view name format (kebab-case)
3885
+ */
3886
+ private validateViewName;
3887
+ /**
3888
+ * Convert database view to ViewDefinition
3889
+ */
3890
+ private convertDBViewToDefinition;
3891
+ }
3892
+
3893
+ /**
3894
+ * Result of view sync operation
3895
+ */
3896
+ interface ViewSyncResult {
3897
+ success: boolean;
3898
+ viewsSynced: number;
3899
+ viewsCreated: number;
3900
+ viewsUpdated: number;
3901
+ viewsDeleted: number;
3902
+ errors: Array<{
3903
+ viewName: string;
3904
+ objectName: string;
3905
+ error: string;
3906
+ }>;
3907
+ }
3908
+ /**
3909
+ * Options for view sync
3910
+ */
3911
+ interface ViewSyncOptions {
3912
+ dryRun?: boolean;
3913
+ verbose?: boolean;
3914
+ tenantId?: string;
3915
+ }
3916
+ /**
3917
+ * Sync native views from registry to database
3918
+ *
3919
+ * This function:
3920
+ * 1. Reads all registered native views from the registry
3921
+ * 2. Upserts them into the database (views table)
3922
+ * 3. Marks them as system=true for protection
3923
+ * 4. Removes views that were deleted from code
3924
+ *
3925
+ * @param adapter - Database adapter implementing DatabaseAdapter interface
3926
+ * @param nativeViewRegistry - Registry containing native views
3927
+ * @param options - Sync options (dryRun, verbose, tenantId)
3928
+ * @returns Sync result with statistics
3929
+ *
3930
+ * @example
3931
+ * ```typescript
3932
+ * import { syncNativeViews, viewRegistry } from "@stndrds/schema";
3933
+ * import { drizzleAdapter } from "./db/adapter";
3934
+ *
3935
+ * const result = await syncNativeViews(drizzleAdapter, viewRegistry, {
3936
+ * verbose: true,
3937
+ * tenantId: "default"
3938
+ * });
3939
+ *
3940
+ * if (result.success) {
3941
+ * console.log(`✓ Synced ${result.viewsSynced} views`);
3942
+ * }
3943
+ * ```
3944
+ */
3945
+ declare function syncNativeViews(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry, options?: ViewSyncOptions): Promise<ViewSyncResult>;
3946
+ /**
3947
+ * Verify that all native views are synced to database
3948
+ *
3949
+ * @param adapter - Database adapter
3950
+ * @param nativeViewRegistry - Registry containing native views
3951
+ * @returns true if all views are synced, false otherwise
3952
+ *
3953
+ * @example
3954
+ * ```typescript
3955
+ * const isSynced = await verifyNativeViewsSync(adapter, viewRegistry);
3956
+ * if (!isSynced) {
3957
+ * console.warn("Native views not synced, running sync...");
3958
+ * await syncNativeViews(adapter, viewRegistry);
3959
+ * }
3960
+ * ```
3961
+ */
3962
+ declare function verifyNativeViewsSync(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<boolean>;
3963
+ /**
3964
+ * Get sync preview without modifying database
3965
+ *
3966
+ * @param adapter - Database adapter
3967
+ * @param nativeViewRegistry - Registry containing native views
3968
+ * @returns Sync result (dry run)
3969
+ */
3970
+ declare function getViewSyncPreview(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<ViewSyncResult>;
3971
+
3972
+ /**
3973
+ * Result of sync operation
3974
+ */
3975
+ interface SyncResult {
3976
+ success: boolean;
3977
+ objectsSynced: number;
3978
+ attributesSynced: number;
3979
+ objectsCreated: number;
3980
+ objectsUpdated: number;
3981
+ attributesCreated: number;
3982
+ attributesUpdated: number;
3983
+ attributesDeleted: number;
3984
+ errors: Array<{
3985
+ objectName: string;
3986
+ error: string;
3987
+ }>;
3988
+ }
3989
+ /**
3990
+ * Sync options
3991
+ */
3992
+ interface SyncOptions {
3993
+ dryRun?: boolean;
3994
+ verbose?: boolean;
3995
+ tenantId?: string;
3996
+ }
3997
+ /**
3998
+ * Sync native objects from registry to database
3999
+ *
4000
+ * This function:
4001
+ * 1. Reads all registered native objects from the registry
4002
+ * 2. Upserts them into the database (objects + attributes tables)
4003
+ * 3. Marks them as system=true for protection
4004
+ * 4. Removes attributes that were deleted from code
4005
+ *
4006
+ * @param adapter - Database adapter implementing DatabaseAdapter interface
4007
+ * @param nativeRegistry - Registry containing native objects
4008
+ * @param options - Sync options (dryRun, verbose, tenantId)
4009
+ * @returns Sync result with statistics
4010
+ *
4011
+ * @example
4012
+ * ```typescript
4013
+ * import { syncNativeObjects } from "@stndrds/schema/runtime";
4014
+ * import { registry } from "./objects/native";
4015
+ * import { drizzleAdapter } from "./db/adapter";
4016
+ *
4017
+ * const result = await syncNativeObjects(drizzleAdapter, registry, {
4018
+ * verbose: true,
4019
+ * tenantId: "default"
4020
+ * });
4021
+ *
4022
+ * if (result.success) {
4023
+ * console.log(`✓ Synced ${result.objectsSynced} objects`);
4024
+ * } else {
4025
+ * console.error("Sync errors:", result.errors);
4026
+ * }
4027
+ * ```
4028
+ */
4029
+ declare function syncNativeObjects(adapter: DatabaseAdapter, nativeRegistry: typeof registry, options?: SyncOptions): Promise<SyncResult>;
4030
+ /**
4031
+ * Verify that all native objects are synced to database
4032
+ *
4033
+ * @param adapter - Database adapter
4034
+ * @param nativeRegistry - Registry containing native objects
4035
+ * @returns true if all objects are synced, false otherwise
4036
+ *
4037
+ * @example
4038
+ * ```typescript
4039
+ * const isSynced = await verifyNativeObjectsSync(adapter, registry);
4040
+ * if (!isSynced) {
4041
+ * console.warn("Native objects not synced, running sync...");
4042
+ * await syncNativeObjects(adapter, registry);
4043
+ * }
4044
+ * ```
4045
+ */
4046
+ declare function verifyNativeObjectsSync(adapter: DatabaseAdapter, nativeRegistry: typeof registry): Promise<boolean>;
4047
+ /**
4048
+ * Get sync statistics without modifying database
4049
+ *
4050
+ * @param adapter - Database adapter
4051
+ * @param nativeRegistry - Registry containing native objects
4052
+ * @returns Sync result (dry run)
4053
+ */
4054
+ declare function getSyncPreview(adapter: DatabaseAdapter, nativeRegistry: typeof registry): Promise<SyncResult>;
4055
+ /**
4056
+ * Result of full sync operation (objects + views)
4057
+ */
4058
+ interface FullSyncResult {
4059
+ success: boolean;
4060
+ objects: SyncResult;
4061
+ views: ViewSyncResult;
4062
+ }
4063
+ /**
4064
+ * Options for full sync
4065
+ */
4066
+ interface FullSyncOptions extends SyncOptions, ViewSyncOptions {
4067
+ }
4068
+ /**
4069
+ * Sync all native objects and views from registries to database
4070
+ *
4071
+ * This is a convenience function that:
4072
+ * 1. Syncs native objects first (views may depend on objects)
4073
+ * 2. Syncs native views
4074
+ *
4075
+ * @param adapter - Database adapter
4076
+ * @param objectRegistry - Registry containing native objects
4077
+ * @param nativeViewRegistry - Registry containing native views
4078
+ * @param options - Sync options
4079
+ * @returns Combined sync result
4080
+ *
4081
+ * @example
4082
+ * ```typescript
4083
+ * import { syncAll, registry, viewRegistry } from "@stndrds/schema";
4084
+ * import { adapter } from "./db";
4085
+ *
4086
+ * const result = await syncAll(adapter, registry, viewRegistry, {
4087
+ * verbose: true,
4088
+ * tenantId: "default"
4089
+ * });
4090
+ *
4091
+ * if (result.success) {
4092
+ * console.log(`✓ Synced ${result.objects.objectsSynced} objects, ${result.views.viewsSynced} views`);
4093
+ * }
4094
+ * ```
4095
+ */
4096
+ declare function syncAll(adapter: DatabaseAdapter, objectRegistry: typeof registry, nativeViewRegistry: typeof viewRegistry, options?: FullSyncOptions): Promise<FullSyncResult>;
4097
+
4098
+ /**
4099
+ * Default fallback value when expression resolves to empty string
4100
+ */
4101
+ declare const DEFAULT_LABEL_FALLBACK = "(Untitled)";
4102
+ /**
4103
+ * Render a label expression template with values
4104
+ *
4105
+ * Supports:
4106
+ * - Variable interpolation: `{{ fieldName }}`
4107
+ * - Dot notation: `{{ user.firstName }}`
4108
+ * - Pipes: `{{ name | UPPER }}`, `{{ name | capitalize | trim }}`
4109
+ *
4110
+ * @param template - The label expression template (e.g., "{{ firstName }} {{ lastName }}")
4111
+ * @param values - Record values to interpolate
4112
+ * @param fallback - Fallback value if result is empty (default: "(Untitled)")
4113
+ * @returns The rendered label string
4114
+ *
4115
+ * @example
4116
+ * ```typescript
4117
+ * const label = renderLabelExpression(
4118
+ * "{{ firstName }} {{ lastName | UPPER }}",
4119
+ * { firstName: "John", lastName: "Doe" }
4120
+ * );
4121
+ * // → "John DOE"
4122
+ *
4123
+ * // With missing values
4124
+ * const label = renderLabelExpression(
4125
+ * "{{ name }}",
4126
+ * { }
4127
+ * );
4128
+ * // → "(Untitled)"
4129
+ * ```
4130
+ */
4131
+ declare function renderLabelExpression(template: string, values: Record<string, unknown>, fallback?: string): string;
4132
+ /**
4133
+ * Check if a string is a valid label expression template
4134
+ * A valid template contains at least one {{ variable }} block with a non-empty variable
4135
+ */
4136
+ declare function isLabelExpression(value: string): boolean;
4137
+ /**
4138
+ * Extract attribute names referenced in a label expression
4139
+ * Useful for validation or dependency tracking
4140
+ *
4141
+ * @example
4142
+ * extractAttributeNames("{{ firstName }} {{ lastName | UPPER }}")
4143
+ * // → ["firstName", "lastName"]
4144
+ */
4145
+ declare function extractAttributeNames(template: string): string[];
4146
+
4147
+ export { NoopGeocodingAdapter as $, type Attribute as A, type BaseAttribute as B, type Currency as C, type DateAttribute as D, type RelationAttribute as E, type FileAttribute as F, type Group as G, type StorageProvider as H, type FileVisibility as I, type File as J, type CreateFile as K, type Location as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type UpdateFile as Q, type RelationOnDelete as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, type ViewDefinition as V, type GeocodingSuggestion as W, type GeocodingAutocompleteParams as X, type ReverseGeocodingParams as Y, type GeocodingParams as Z, type GeocodingAdapter as _, type SelectAttribute as a, validateAttribute as a$, type Timestamps as a0, type ObjectAttribute as a1, type CompletionStatus as a2, type ObjectRecord as a3, type UserRole as a4, type UserStatus as a5, type UserProfile as a6, type CreateUserProfile as a7, type UpdateUserProfile as a8, type TabType as a9, relationConfigSchema as aA, ratingConfigSchema as aB, attributeConfigSchemas as aC, getAttributeConfigSchema as aD, validateAttributeConfig as aE, parseAttributeConfig as aF, safeParseAttributeConfig as aG, createTextValidator as aH, createNumberValidator as aI, createCheckboxValidator as aJ, createDateValidator as aK, createPhoneValidator as aL, createCurrencyValidator as aM, createStatusValidator as aN, createSelectValidator as aO, createMultiselectValidator as aP, createLocationValidator as aQ, createTimestampValidator as aR, createFileValidator as aS, createUserValidator as aT, createSingleRelationValidator as aU, createMultiRelationValidator as aV, createRelationValidator as aW, createRatingValidator as aX, createAttributeValidator as aY, createObjectValidator as aZ, type ValidationResult as a_, type FormTab as aa, type TableTab as ab, type CustomTab as ac, isFormTab as ad, isTableTab as ae, isCustomTab as af, type Uuid as ag, type TenantId as ah, generateId as ai, generatePrefixedId as aj, registry as ak, viewRegistry as al, textConfigSchema as am, textareaConfigSchema as an, numberConfigSchema as ao, checkboxConfigSchema as ap, dateConfigSchema as aq, phoneConfigSchema as ar, currencyConfigSchema as as, statusConfigSchema as at, locationConfigSchema as au, timestampConfigSchema as av, selectConfigSchema as aw, multiselectConfigSchema as ax, fileConfigSchema as ay, userConfigSchema as az, type TextAreaAttribute as b, type SearchOptions as b$, validateObject as b0, validateObjectOrThrow as b1, createDraftValidator as b2, validateDraft as b3, validateDraftOrThrow as b4, getMissingRequiredAttributes as b5, isRecordComplete as b6, computeRecordStatus as b7, type DatabaseAdapter as b8, type AttributeChange as b9, RelationService as bA, UserProfileService as bB, type CreateViewInput as bC, type UpdateViewInput as bD, ViewService as bE, type SyncResult as bF, type SyncOptions as bG, syncNativeObjects as bH, verifyNativeObjectsSync as bI, getSyncPreview as bJ, type FullSyncResult as bK, type FullSyncOptions as bL, syncAll as bM, DEFAULT_LABEL_FALLBACK as bN, renderLabelExpression as bO, isLabelExpression as bP, extractAttributeNames as bQ, type DBObject as bR, type CreateDBObject as bS, type UpdateDBObject as bT, type UpsertDBObject as bU, type DBAttribute as bV, type CreateDBAttribute as bW, type UpdateDBAttribute as bX, type UpsertDBAttribute as bY, type CreateObjectRecord as bZ, type ListOptions as b_, type HookContext as ba, type HookDefinition as bb, type HookHandler as bc, type HookType as bd, NoopHookRegistry as be, type HookRegistry as bf, createMockAdapter as bg, type ObjectsRepository as bh, type AttributesRepository as bi, type UserProfilesRepository as bj, type FilesRepository as bk, type ObjectRecordsRepository as bl, type ViewsRepository as bm, FileService as bn, GeocodingService as bo, GlobalSearchService as bp, type CreateCustomObjectInput as bq, type AddAttributeInput as br, ObjectSchemaService as bs, type RecordServiceOptions as bt, RecordService as bu, type RelationValidationResult as bv, type RelationValidationError as bw, type RelationOption as bx, type RelationOptionsResponse as by, type GetRelationOptionsParams as bz, type CheckboxAttribute as c, type GlobalSearchOptions as c0, type GlobalSearchResultItem as c1, type FileListOptions as c2, type DBView as c3, type CreateDBView as c4, type UpdateDBView as c5, type UpsertDBView as c6, type OperationResult as c7, type ViewSyncResult as c8, type ViewSyncOptions as c9, syncNativeViews as ca, verifyNativeViewsSync as cb, getViewSyncPreview as cc, type PhoneAttribute as d, type CurrencyAttribute as e, type LocationAttribute as f, type TimestampAttribute as g, type SingleRelationAttribute as h, type MultiRelationAttribute as i, type RelationTarget as j, type RatingAttribute as k, type ObjectDefinition as l, type Field as m, type AttributeGroupField as n, type Tab as o, type AttributeType as p, type StatusGroup as q, type AttributeGroup as r, type NumberUnit as s, type DateFormat as t, type DateValue as u, type LocationGranularity as v, type DocumentType as w, type DocumentFace as x, type DocumentTypeConfig as y, type FileVerificationConfig as z };