@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,4142 @@
1
+ import { ColorId, IconName, CountryIso3, CurrencyCode, MimeType } from '@andyoucreate/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
+ * Field definition within a form group
749
+ */
750
+ interface Field {
751
+ /** Attribute name to display */
752
+ attribute: string;
753
+ /** Grid span (1-12 columns) */
754
+ span?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
755
+ /** Override label for this view */
756
+ label?: string;
757
+ /** Force read-only display */
758
+ readOnly?: boolean;
759
+ }
760
+ /**
761
+ * Display mode for groups
762
+ * - "section": Display as a collapsible section with fields stacked (default)
763
+ * - "inline": Display as a single line with a dropdown for editing
764
+ */
765
+ type GroupDisplayMode = "section" | "inline";
766
+ /**
767
+ * Group of fields for organizing forms
768
+ */
769
+ interface Group {
770
+ id: string;
771
+ label: string;
772
+ description?: string;
773
+ fields: Field[];
774
+ collapsible?: boolean;
775
+ collapsed?: boolean;
776
+ order?: number;
777
+ /**
778
+ * Display mode for the group
779
+ * - "section": Fields displayed in a collapsible section (default)
780
+ * - "inline": Fields displayed as a single composite field with dropdown
781
+ */
782
+ display?: GroupDisplayMode;
783
+ /**
784
+ * Template for the inline display value
785
+ * Uses {attributeName} syntax for interpolation
786
+ * Only used when display is "inline"
787
+ * @example "{billing_street}, {billing_city} {billing_postal_code}"
788
+ */
789
+ displayTemplate?: string;
790
+ }
791
+ type TabType = "form" | "table" | "custom";
792
+ /**
793
+ * Base properties shared by all tab types
794
+ */
795
+ interface BaseTab {
796
+ id: string;
797
+ name: string;
798
+ label: string;
799
+ icon?: IconName;
800
+ order?: number;
801
+ /** If true, tab is defined by developer (protected) */
802
+ system?: boolean;
803
+ }
804
+ /**
805
+ * Form tab - displays attributes organized in groups
806
+ */
807
+ interface FormTab extends BaseTab {
808
+ type: "form";
809
+ groups: Group[];
810
+ }
811
+ /**
812
+ * Table tab - displays records from a relation attribute
813
+ */
814
+ interface TableTab extends BaseTab {
815
+ type: "table";
816
+ /** Name of the relation attribute */
817
+ relation: string;
818
+ /** Columns to display (attribute names from target object) */
819
+ columns: string[];
820
+ /** Allow creating new records */
821
+ allowCreate?: boolean;
822
+ /** Allow inline editing */
823
+ allowEdit?: boolean;
824
+ /** Allow deleting records */
825
+ allowDelete?: boolean;
826
+ /** Default filters */
827
+ filters?: Record<string, unknown>;
828
+ /** Default sort */
829
+ sort?: {
830
+ field: string;
831
+ order: "asc" | "desc";
832
+ };
833
+ }
834
+ /**
835
+ * Custom tab - renders a developer-defined component
836
+ */
837
+ interface CustomTab extends BaseTab {
838
+ type: "custom";
839
+ /** Component identifier to render */
840
+ component: string;
841
+ /** Props to pass to the component */
842
+ props?: Record<string, unknown>;
843
+ }
844
+ /**
845
+ * Union of all tab types
846
+ */
847
+ type Tab = FormTab | TableTab | CustomTab;
848
+ /**
849
+ * View definition - organizes object attributes into tabs/pages
850
+ *
851
+ * @example
852
+ * ```typescript
853
+ * const companyView: ViewDefinition = {
854
+ * name: "detail",
855
+ * label: "Company Detail",
856
+ * object: "companies",
857
+ * tabs: [
858
+ * { type: "form", name: "general", label: "Info", groups: [...] },
859
+ * { type: "table", name: "contacts", label: "Contacts", relation: "contacts", columns: [...] }
860
+ * ],
861
+ * default: true,
862
+ * system: true
863
+ * };
864
+ * ```
865
+ */
866
+ interface ViewDefinition {
867
+ id?: Uuid;
868
+ /** Technical name (kebab-case) */
869
+ name: string;
870
+ /** Display label */
871
+ label: string;
872
+ /** Description */
873
+ description?: string;
874
+ /** Icon */
875
+ icon?: IconName;
876
+ /** Object this view belongs to (object name) */
877
+ object: string;
878
+ /** Tabs in this view */
879
+ tabs: Tab[];
880
+ /** Default view for this object */
881
+ default?: boolean;
882
+ /** System view (defined by developer, protected) */
883
+ system?: boolean;
884
+ /** Extensible metadata */
885
+ metadata?: Record<string, unknown>;
886
+ }
887
+ /**
888
+ * Check if a tab is a form tab
889
+ */
890
+ declare function isFormTab(tab: Tab): tab is FormTab;
891
+ /**
892
+ * Check if a tab is a table tab
893
+ */
894
+ declare function isTableTab(tab: Tab): tab is TableTab;
895
+ /**
896
+ * Check if a tab is a custom tab
897
+ */
898
+ declare function isCustomTab(tab: Tab): tab is CustomTab;
899
+
900
+ /**
901
+ * Registry for native objects defined in code
902
+ * Native objects are system objects that cannot be deleted/modified by clients
903
+ * They are defined by developers and synced to the database at startup
904
+ */
905
+ declare class NativeObjectRegistryClass {
906
+ private objects;
907
+ /**
908
+ * Register one or more native objects
909
+ * Auto-builds if ObjectBuilder is passed instead of ObjectDefinition
910
+ * @param objects - Single object/builder or array of objects/builders to register
911
+ * @returns this (for chaining)
912
+ * @throws Error if object is invalid or already registered
913
+ *
914
+ * @example
915
+ * ```typescript
916
+ * // No .build() needed - registry auto-builds!
917
+ * const PRODUCT = object({ id: "obj-product", name: "products", label: "Product" })
918
+ * .system()
919
+ * .attribute(text({ id: "attr-name", name: "name", label: "Name" }));
920
+ *
921
+ * registry.register(PRODUCT); // ← Auto-builds here
922
+ *
923
+ * // Can still explicitly .build() if you want
924
+ * registry.register(PRODUCT.build());
925
+ *
926
+ * // Register multiple
927
+ * registry.register([PRODUCT, ORDER, CUSTOMER]);
928
+ * ```
929
+ */
930
+ register(objects: ObjectDefinition | ObjectDefinition[] | {
931
+ build: () => ObjectDefinition;
932
+ } | Array<{
933
+ build: () => ObjectDefinition;
934
+ }>): this;
935
+ /**
936
+ * Validate and register a single object
937
+ * @internal
938
+ */
939
+ private validateAndRegister;
940
+ /**
941
+ * Get a native object by its name
942
+ * @param name - The object name
943
+ * @returns The object definition or undefined if not found
944
+ *
945
+ * @example
946
+ * ```typescript
947
+ * const product = registry.getByName("products");
948
+ * if (product) {
949
+ * console.log(product.label); // "Product"
950
+ * }
951
+ * ```
952
+ */
953
+ getByName(name: string): ObjectDefinition | undefined;
954
+ /**
955
+ * Get a native object or throw if not found
956
+ * @param name - The object name
957
+ * @returns The object definition
958
+ * @throws Error if not found
959
+ */
960
+ getByNameOrThrow(name: string): ObjectDefinition;
961
+ /**
962
+ * Get all registered native objects
963
+ * @returns Array of all registered object definitions
964
+ */
965
+ getAll(): ObjectDefinition[];
966
+ /**
967
+ * Get all registered native object names
968
+ * @returns Array of object names
969
+ */
970
+ listNames(): string[];
971
+ /**
972
+ * Check if a native object is registered
973
+ * @param name - The object name
974
+ * @returns true if registered, false otherwise
975
+ */
976
+ has(name: string): boolean;
977
+ /**
978
+ * Get the number of registered objects
979
+ */
980
+ get size(): number;
981
+ /**
982
+ * Clear all registered objects (useful for testing)
983
+ * @internal
984
+ */
985
+ clear(): void;
986
+ /**
987
+ * Get registry summary for debugging
988
+ */
989
+ summary(): string;
990
+ /**
991
+ * Log registry summary to console
992
+ */
993
+ debug(): void;
994
+ }
995
+ /**
996
+ * Singleton instance of the registry
997
+ * Use this to register and retrieve native objects
998
+ *
999
+ * @example
1000
+ * ```typescript
1001
+ * import { registry } from "@andyoucreate/schema";
1002
+ *
1003
+ * // Register objects
1004
+ * registry.register([PRODUCT, ORDER, CUSTOMER]);
1005
+ *
1006
+ * // Get object by name
1007
+ * const product = registry.getByName("products");
1008
+ *
1009
+ * // List all
1010
+ * console.log(registry.listNames()); // ["products", "orders", ...]
1011
+ *
1012
+ * // Debug
1013
+ * registry.debug();
1014
+ * ```
1015
+ */
1016
+ declare const registry: NativeObjectRegistryClass;
1017
+
1018
+ /**
1019
+ * Registry for native view definitions
1020
+ *
1021
+ * Views registered here are considered "system" views, defined by the developer.
1022
+ * They are protected from modification by end-users and synced to the database
1023
+ * at application startup.
1024
+ *
1025
+ * @example
1026
+ * ```typescript
1027
+ * import { view, group, viewRegistry } from "@andyoucreate/schema";
1028
+ *
1029
+ * const COMPANY_DETAIL = view("detail", "Detail")
1030
+ * .for("companies")
1031
+ * .system()
1032
+ * .tab("general", "Info")
1033
+ * .form(group("main", "Main").fields("name", "status"))
1034
+ * .build();
1035
+ *
1036
+ * viewRegistry.register(COMPANY_DETAIL);
1037
+ * ```
1038
+ */
1039
+ declare class ViewRegistry {
1040
+ private views;
1041
+ private byObject;
1042
+ /**
1043
+ * Register a native view
1044
+ * @param viewOrViews - Single view or array of views
1045
+ * @throws Error if view is not marked as system
1046
+ * @throws Error if view with same name already exists for the object
1047
+ */
1048
+ register(viewOrViews: ViewDefinition | ViewDefinition[]): this;
1049
+ private registerSingle;
1050
+ /**
1051
+ * Get all views for an object
1052
+ */
1053
+ getByObjectName(objectName: string): ViewDefinition[];
1054
+ /**
1055
+ * Get a specific view by object and view name
1056
+ */
1057
+ get(objectName: string, viewName: string): ViewDefinition | undefined;
1058
+ /**
1059
+ * Get a view or throw if not found
1060
+ */
1061
+ getOrThrow(objectName: string, viewName: string): ViewDefinition;
1062
+ /**
1063
+ * Get all registered views
1064
+ */
1065
+ getAll(): ViewDefinition[];
1066
+ /**
1067
+ * Check if a view exists
1068
+ */
1069
+ has(objectName: string, viewName: string): boolean;
1070
+ /**
1071
+ * Check if any views exist for an object
1072
+ */
1073
+ hasObject(objectName: string): boolean;
1074
+ /**
1075
+ * Get number of registered views
1076
+ */
1077
+ get size(): number;
1078
+ /**
1079
+ * List all object names that have views
1080
+ */
1081
+ listObjectNames(): string[];
1082
+ /**
1083
+ * Get default view for an object (if any)
1084
+ */
1085
+ getDefault(objectName: string): ViewDefinition | undefined;
1086
+ /**
1087
+ * Clear all registered views (for testing)
1088
+ */
1089
+ clear(): void;
1090
+ /**
1091
+ * Generate summary string for debugging
1092
+ */
1093
+ summary(): string;
1094
+ /**
1095
+ * Log summary to console
1096
+ */
1097
+ debug(): void;
1098
+ private makeKey;
1099
+ }
1100
+ /**
1101
+ * Global registry for native views
1102
+ */
1103
+ declare const viewRegistry: ViewRegistry;
1104
+
1105
+ /**
1106
+ * Text attribute config schema
1107
+ */
1108
+ declare const textConfigSchema: z.ZodObject<{
1109
+ disabled: z.ZodOptional<z.ZodBoolean>;
1110
+ placeholder: z.ZodOptional<z.ZodString>;
1111
+ description: z.ZodOptional<z.ZodString>;
1112
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1113
+ icon: z.ZodOptional<z.ZodString>;
1114
+ order: z.ZodOptional<z.ZodNumber>;
1115
+ hidden: z.ZodOptional<z.ZodBoolean>;
1116
+ archived: z.ZodOptional<z.ZodBoolean>;
1117
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1118
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1119
+ } & {
1120
+ minLength: z.ZodOptional<z.ZodNumber>;
1121
+ maxLength: z.ZodOptional<z.ZodNumber>;
1122
+ pattern: z.ZodOptional<z.ZodString>;
1123
+ }, "strip", z.ZodTypeAny, {
1124
+ defaultValue?: unknown;
1125
+ disabled?: boolean | undefined;
1126
+ placeholder?: string | undefined;
1127
+ description?: string | undefined;
1128
+ icon?: string | undefined;
1129
+ order?: number | undefined;
1130
+ hidden?: boolean | undefined;
1131
+ archived?: boolean | undefined;
1132
+ deprecated?: boolean | undefined;
1133
+ metadata?: Record<string, unknown> | undefined;
1134
+ minLength?: number | undefined;
1135
+ maxLength?: number | undefined;
1136
+ pattern?: string | undefined;
1137
+ }, {
1138
+ defaultValue?: unknown;
1139
+ disabled?: boolean | undefined;
1140
+ placeholder?: string | undefined;
1141
+ description?: string | undefined;
1142
+ icon?: string | undefined;
1143
+ order?: number | undefined;
1144
+ hidden?: boolean | undefined;
1145
+ archived?: boolean | undefined;
1146
+ deprecated?: boolean | undefined;
1147
+ metadata?: Record<string, unknown> | undefined;
1148
+ minLength?: number | undefined;
1149
+ maxLength?: number | undefined;
1150
+ pattern?: string | undefined;
1151
+ }>;
1152
+ /**
1153
+ * Textarea attribute config schema
1154
+ */
1155
+ declare const textareaConfigSchema: z.ZodObject<{
1156
+ disabled: z.ZodOptional<z.ZodBoolean>;
1157
+ placeholder: z.ZodOptional<z.ZodString>;
1158
+ description: z.ZodOptional<z.ZodString>;
1159
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1160
+ icon: z.ZodOptional<z.ZodString>;
1161
+ order: z.ZodOptional<z.ZodNumber>;
1162
+ hidden: z.ZodOptional<z.ZodBoolean>;
1163
+ archived: z.ZodOptional<z.ZodBoolean>;
1164
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1165
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ defaultValue?: unknown;
1168
+ disabled?: boolean | undefined;
1169
+ placeholder?: string | undefined;
1170
+ description?: string | undefined;
1171
+ icon?: string | undefined;
1172
+ order?: number | undefined;
1173
+ hidden?: boolean | undefined;
1174
+ archived?: boolean | undefined;
1175
+ deprecated?: boolean | undefined;
1176
+ metadata?: Record<string, unknown> | undefined;
1177
+ }, {
1178
+ defaultValue?: unknown;
1179
+ disabled?: boolean | undefined;
1180
+ placeholder?: string | undefined;
1181
+ description?: string | undefined;
1182
+ icon?: string | undefined;
1183
+ order?: number | undefined;
1184
+ hidden?: boolean | undefined;
1185
+ archived?: boolean | undefined;
1186
+ deprecated?: boolean | undefined;
1187
+ metadata?: Record<string, unknown> | undefined;
1188
+ }>;
1189
+ /**
1190
+ * Number attribute config schema
1191
+ */
1192
+ declare const numberConfigSchema: z.ZodObject<{
1193
+ disabled: z.ZodOptional<z.ZodBoolean>;
1194
+ placeholder: z.ZodOptional<z.ZodString>;
1195
+ description: z.ZodOptional<z.ZodString>;
1196
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1197
+ icon: z.ZodOptional<z.ZodString>;
1198
+ order: z.ZodOptional<z.ZodNumber>;
1199
+ hidden: z.ZodOptional<z.ZodBoolean>;
1200
+ archived: z.ZodOptional<z.ZodBoolean>;
1201
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1202
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1203
+ } & {
1204
+ min: z.ZodOptional<z.ZodNumber>;
1205
+ max: z.ZodOptional<z.ZodNumber>;
1206
+ unit: z.ZodOptional<z.ZodEnum<["integer", "decimal", "percentage"]>>;
1207
+ decimals: z.ZodOptional<z.ZodNumber>;
1208
+ }, "strip", z.ZodTypeAny, {
1209
+ defaultValue?: unknown;
1210
+ disabled?: boolean | undefined;
1211
+ placeholder?: string | undefined;
1212
+ description?: string | undefined;
1213
+ icon?: string | undefined;
1214
+ order?: number | undefined;
1215
+ hidden?: boolean | undefined;
1216
+ archived?: boolean | undefined;
1217
+ deprecated?: boolean | undefined;
1218
+ metadata?: Record<string, unknown> | undefined;
1219
+ min?: number | undefined;
1220
+ max?: number | undefined;
1221
+ unit?: "percentage" | "integer" | "decimal" | undefined;
1222
+ decimals?: number | undefined;
1223
+ }, {
1224
+ defaultValue?: unknown;
1225
+ disabled?: boolean | undefined;
1226
+ placeholder?: string | undefined;
1227
+ description?: string | undefined;
1228
+ icon?: string | undefined;
1229
+ order?: number | undefined;
1230
+ hidden?: boolean | undefined;
1231
+ archived?: boolean | undefined;
1232
+ deprecated?: boolean | undefined;
1233
+ metadata?: Record<string, unknown> | undefined;
1234
+ min?: number | undefined;
1235
+ max?: number | undefined;
1236
+ unit?: "percentage" | "integer" | "decimal" | undefined;
1237
+ decimals?: number | undefined;
1238
+ }>;
1239
+ /**
1240
+ * Checkbox attribute config schema
1241
+ */
1242
+ declare const checkboxConfigSchema: z.ZodObject<{
1243
+ disabled: z.ZodOptional<z.ZodBoolean>;
1244
+ placeholder: z.ZodOptional<z.ZodString>;
1245
+ description: z.ZodOptional<z.ZodString>;
1246
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1247
+ icon: z.ZodOptional<z.ZodString>;
1248
+ order: z.ZodOptional<z.ZodNumber>;
1249
+ hidden: z.ZodOptional<z.ZodBoolean>;
1250
+ archived: z.ZodOptional<z.ZodBoolean>;
1251
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1252
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1253
+ }, "strip", z.ZodTypeAny, {
1254
+ defaultValue?: unknown;
1255
+ disabled?: boolean | undefined;
1256
+ placeholder?: string | undefined;
1257
+ description?: string | undefined;
1258
+ icon?: string | undefined;
1259
+ order?: number | undefined;
1260
+ hidden?: boolean | undefined;
1261
+ archived?: boolean | undefined;
1262
+ deprecated?: boolean | undefined;
1263
+ metadata?: Record<string, unknown> | undefined;
1264
+ }, {
1265
+ defaultValue?: unknown;
1266
+ disabled?: boolean | undefined;
1267
+ placeholder?: string | undefined;
1268
+ description?: string | undefined;
1269
+ icon?: string | undefined;
1270
+ order?: number | undefined;
1271
+ hidden?: boolean | undefined;
1272
+ archived?: boolean | undefined;
1273
+ deprecated?: boolean | undefined;
1274
+ metadata?: Record<string, unknown> | undefined;
1275
+ }>;
1276
+ /**
1277
+ * Date attribute config schema
1278
+ */
1279
+ declare const dateConfigSchema: z.ZodObject<{
1280
+ disabled: z.ZodOptional<z.ZodBoolean>;
1281
+ placeholder: z.ZodOptional<z.ZodString>;
1282
+ description: z.ZodOptional<z.ZodString>;
1283
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1284
+ icon: z.ZodOptional<z.ZodString>;
1285
+ order: z.ZodOptional<z.ZodNumber>;
1286
+ hidden: z.ZodOptional<z.ZodBoolean>;
1287
+ archived: z.ZodOptional<z.ZodBoolean>;
1288
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1289
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1290
+ } & {
1291
+ dateFormat: z.ZodOptional<z.ZodEnum<["short", "long", "full", "relative"]>>;
1292
+ minDate: z.ZodOptional<z.ZodString>;
1293
+ maxDate: z.ZodOptional<z.ZodString>;
1294
+ }, "strip", z.ZodTypeAny, {
1295
+ defaultValue?: unknown;
1296
+ disabled?: boolean | undefined;
1297
+ placeholder?: string | undefined;
1298
+ description?: string | undefined;
1299
+ icon?: string | undefined;
1300
+ order?: number | undefined;
1301
+ hidden?: boolean | undefined;
1302
+ archived?: boolean | undefined;
1303
+ deprecated?: boolean | undefined;
1304
+ metadata?: Record<string, unknown> | undefined;
1305
+ dateFormat?: "short" | "long" | "full" | "relative" | undefined;
1306
+ minDate?: string | undefined;
1307
+ maxDate?: string | undefined;
1308
+ }, {
1309
+ defaultValue?: unknown;
1310
+ disabled?: boolean | undefined;
1311
+ placeholder?: string | undefined;
1312
+ description?: string | undefined;
1313
+ icon?: string | undefined;
1314
+ order?: number | undefined;
1315
+ hidden?: boolean | undefined;
1316
+ archived?: boolean | undefined;
1317
+ deprecated?: boolean | undefined;
1318
+ metadata?: Record<string, unknown> | undefined;
1319
+ dateFormat?: "short" | "long" | "full" | "relative" | undefined;
1320
+ minDate?: string | undefined;
1321
+ maxDate?: string | undefined;
1322
+ }>;
1323
+ /**
1324
+ * Phone attribute config schema
1325
+ */
1326
+ declare const phoneConfigSchema: z.ZodObject<{
1327
+ disabled: z.ZodOptional<z.ZodBoolean>;
1328
+ placeholder: z.ZodOptional<z.ZodString>;
1329
+ description: z.ZodOptional<z.ZodString>;
1330
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1331
+ icon: z.ZodOptional<z.ZodString>;
1332
+ order: z.ZodOptional<z.ZodNumber>;
1333
+ hidden: z.ZodOptional<z.ZodBoolean>;
1334
+ archived: z.ZodOptional<z.ZodBoolean>;
1335
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1336
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1337
+ } & {
1338
+ defaultCountryCode: z.ZodOptional<z.ZodString>;
1339
+ }, "strip", z.ZodTypeAny, {
1340
+ defaultValue?: unknown;
1341
+ disabled?: boolean | undefined;
1342
+ placeholder?: string | undefined;
1343
+ description?: string | undefined;
1344
+ icon?: string | undefined;
1345
+ order?: number | undefined;
1346
+ hidden?: boolean | undefined;
1347
+ archived?: boolean | undefined;
1348
+ deprecated?: boolean | undefined;
1349
+ metadata?: Record<string, unknown> | undefined;
1350
+ defaultCountryCode?: string | undefined;
1351
+ }, {
1352
+ defaultValue?: unknown;
1353
+ disabled?: boolean | undefined;
1354
+ placeholder?: string | undefined;
1355
+ description?: string | undefined;
1356
+ icon?: string | undefined;
1357
+ order?: number | undefined;
1358
+ hidden?: boolean | undefined;
1359
+ archived?: boolean | undefined;
1360
+ deprecated?: boolean | undefined;
1361
+ metadata?: Record<string, unknown> | undefined;
1362
+ defaultCountryCode?: string | undefined;
1363
+ }>;
1364
+ /**
1365
+ * Currency attribute config schema
1366
+ */
1367
+ declare const currencyConfigSchema: z.ZodObject<{
1368
+ disabled: z.ZodOptional<z.ZodBoolean>;
1369
+ placeholder: z.ZodOptional<z.ZodString>;
1370
+ description: z.ZodOptional<z.ZodString>;
1371
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1372
+ icon: z.ZodOptional<z.ZodString>;
1373
+ order: z.ZodOptional<z.ZodNumber>;
1374
+ hidden: z.ZodOptional<z.ZodBoolean>;
1375
+ archived: z.ZodOptional<z.ZodBoolean>;
1376
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1377
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1378
+ } & {
1379
+ defaultCurrency: z.ZodOptional<z.ZodString>;
1380
+ allowedCurrencies: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1381
+ }, "strip", z.ZodTypeAny, {
1382
+ defaultValue?: unknown;
1383
+ disabled?: boolean | undefined;
1384
+ placeholder?: string | undefined;
1385
+ description?: string | undefined;
1386
+ icon?: string | undefined;
1387
+ order?: number | undefined;
1388
+ hidden?: boolean | undefined;
1389
+ archived?: boolean | undefined;
1390
+ deprecated?: boolean | undefined;
1391
+ metadata?: Record<string, unknown> | undefined;
1392
+ defaultCurrency?: string | undefined;
1393
+ allowedCurrencies?: string[] | undefined;
1394
+ }, {
1395
+ defaultValue?: unknown;
1396
+ disabled?: boolean | undefined;
1397
+ placeholder?: string | undefined;
1398
+ description?: string | undefined;
1399
+ icon?: string | undefined;
1400
+ order?: number | undefined;
1401
+ hidden?: boolean | undefined;
1402
+ archived?: boolean | undefined;
1403
+ deprecated?: boolean | undefined;
1404
+ metadata?: Record<string, unknown> | undefined;
1405
+ defaultCurrency?: string | undefined;
1406
+ allowedCurrencies?: string[] | undefined;
1407
+ }>;
1408
+ /**
1409
+ * Status attribute config schema
1410
+ */
1411
+ declare const statusConfigSchema: z.ZodObject<{
1412
+ disabled: z.ZodOptional<z.ZodBoolean>;
1413
+ placeholder: z.ZodOptional<z.ZodString>;
1414
+ description: z.ZodOptional<z.ZodString>;
1415
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1416
+ icon: z.ZodOptional<z.ZodString>;
1417
+ order: z.ZodOptional<z.ZodNumber>;
1418
+ hidden: z.ZodOptional<z.ZodBoolean>;
1419
+ archived: z.ZodOptional<z.ZodBoolean>;
1420
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1421
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1422
+ } & {
1423
+ options: z.ZodArray<z.ZodObject<{
1424
+ id: z.ZodString;
1425
+ label: z.ZodString;
1426
+ value: z.ZodString;
1427
+ color: z.ZodOptional<z.ZodString>;
1428
+ icon: z.ZodOptional<z.ZodString>;
1429
+ description: z.ZodOptional<z.ZodString>;
1430
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1431
+ }, "strip", z.ZodTypeAny, {
1432
+ label: string;
1433
+ id: string;
1434
+ value: string;
1435
+ description?: string | undefined;
1436
+ icon?: string | undefined;
1437
+ color?: string | undefined;
1438
+ group?: "idle" | "in_progress" | "finished" | undefined;
1439
+ }, {
1440
+ label: string;
1441
+ id: string;
1442
+ value: string;
1443
+ description?: string | undefined;
1444
+ icon?: string | undefined;
1445
+ color?: string | undefined;
1446
+ group?: "idle" | "in_progress" | "finished" | undefined;
1447
+ }>, "many">;
1448
+ }, "strip", z.ZodTypeAny, {
1449
+ options: {
1450
+ label: string;
1451
+ id: string;
1452
+ value: string;
1453
+ description?: string | undefined;
1454
+ icon?: string | undefined;
1455
+ color?: string | undefined;
1456
+ group?: "idle" | "in_progress" | "finished" | undefined;
1457
+ }[];
1458
+ defaultValue?: unknown;
1459
+ disabled?: boolean | undefined;
1460
+ placeholder?: string | undefined;
1461
+ description?: string | undefined;
1462
+ icon?: string | undefined;
1463
+ order?: number | undefined;
1464
+ hidden?: boolean | undefined;
1465
+ archived?: boolean | undefined;
1466
+ deprecated?: boolean | undefined;
1467
+ metadata?: Record<string, unknown> | undefined;
1468
+ }, {
1469
+ options: {
1470
+ label: string;
1471
+ id: string;
1472
+ value: string;
1473
+ description?: string | undefined;
1474
+ icon?: string | undefined;
1475
+ color?: string | undefined;
1476
+ group?: "idle" | "in_progress" | "finished" | undefined;
1477
+ }[];
1478
+ defaultValue?: unknown;
1479
+ disabled?: boolean | undefined;
1480
+ placeholder?: string | undefined;
1481
+ description?: string | undefined;
1482
+ icon?: string | undefined;
1483
+ order?: number | undefined;
1484
+ hidden?: boolean | undefined;
1485
+ archived?: boolean | undefined;
1486
+ deprecated?: boolean | undefined;
1487
+ metadata?: Record<string, unknown> | undefined;
1488
+ }>;
1489
+ /**
1490
+ * Location attribute config schema
1491
+ */
1492
+ declare const locationConfigSchema: z.ZodObject<{
1493
+ disabled: z.ZodOptional<z.ZodBoolean>;
1494
+ placeholder: z.ZodOptional<z.ZodString>;
1495
+ description: z.ZodOptional<z.ZodString>;
1496
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1497
+ icon: z.ZodOptional<z.ZodString>;
1498
+ order: z.ZodOptional<z.ZodNumber>;
1499
+ hidden: z.ZodOptional<z.ZodBoolean>;
1500
+ archived: z.ZodOptional<z.ZodBoolean>;
1501
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1502
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1503
+ } & {
1504
+ granularity: z.ZodEnum<["full", "address", "city", "state", "country", "coordinates"]>;
1505
+ enableAutocomplete: z.ZodOptional<z.ZodBoolean>;
1506
+ enableMap: z.ZodOptional<z.ZodBoolean>;
1507
+ defaultCountry: z.ZodOptional<z.ZodString>;
1508
+ allowedCountries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1509
+ displayFormat: z.ZodOptional<z.ZodEnum<["single_line", "multi_line", "compact"]>>;
1510
+ }, "strip", z.ZodTypeAny, {
1511
+ granularity: "full" | "address" | "city" | "state" | "country" | "coordinates";
1512
+ defaultValue?: unknown;
1513
+ disabled?: boolean | undefined;
1514
+ placeholder?: string | undefined;
1515
+ description?: string | undefined;
1516
+ icon?: string | undefined;
1517
+ order?: number | undefined;
1518
+ hidden?: boolean | undefined;
1519
+ archived?: boolean | undefined;
1520
+ deprecated?: boolean | undefined;
1521
+ metadata?: Record<string, unknown> | undefined;
1522
+ enableAutocomplete?: boolean | undefined;
1523
+ enableMap?: boolean | undefined;
1524
+ defaultCountry?: string | undefined;
1525
+ allowedCountries?: string[] | undefined;
1526
+ displayFormat?: "single_line" | "multi_line" | "compact" | undefined;
1527
+ }, {
1528
+ granularity: "full" | "address" | "city" | "state" | "country" | "coordinates";
1529
+ defaultValue?: unknown;
1530
+ disabled?: boolean | undefined;
1531
+ placeholder?: string | undefined;
1532
+ description?: string | undefined;
1533
+ icon?: string | undefined;
1534
+ order?: number | undefined;
1535
+ hidden?: boolean | undefined;
1536
+ archived?: boolean | undefined;
1537
+ deprecated?: boolean | undefined;
1538
+ metadata?: Record<string, unknown> | undefined;
1539
+ enableAutocomplete?: boolean | undefined;
1540
+ enableMap?: boolean | undefined;
1541
+ defaultCountry?: string | undefined;
1542
+ allowedCountries?: string[] | undefined;
1543
+ displayFormat?: "single_line" | "multi_line" | "compact" | undefined;
1544
+ }>;
1545
+ /**
1546
+ * Timestamp attribute config schema
1547
+ */
1548
+ declare const timestampConfigSchema: z.ZodObject<{
1549
+ disabled: z.ZodOptional<z.ZodBoolean>;
1550
+ placeholder: z.ZodOptional<z.ZodString>;
1551
+ description: z.ZodOptional<z.ZodString>;
1552
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1553
+ icon: z.ZodOptional<z.ZodString>;
1554
+ order: z.ZodOptional<z.ZodNumber>;
1555
+ hidden: z.ZodOptional<z.ZodBoolean>;
1556
+ archived: z.ZodOptional<z.ZodBoolean>;
1557
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1558
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1559
+ } & {
1560
+ autoUpdate: z.ZodOptional<z.ZodBoolean>;
1561
+ }, "strip", z.ZodTypeAny, {
1562
+ defaultValue?: unknown;
1563
+ disabled?: boolean | undefined;
1564
+ placeholder?: string | undefined;
1565
+ description?: string | undefined;
1566
+ icon?: string | undefined;
1567
+ order?: number | undefined;
1568
+ hidden?: boolean | undefined;
1569
+ archived?: boolean | undefined;
1570
+ deprecated?: boolean | undefined;
1571
+ metadata?: Record<string, unknown> | undefined;
1572
+ autoUpdate?: boolean | undefined;
1573
+ }, {
1574
+ defaultValue?: unknown;
1575
+ disabled?: boolean | undefined;
1576
+ placeholder?: string | undefined;
1577
+ description?: string | undefined;
1578
+ icon?: string | undefined;
1579
+ order?: number | undefined;
1580
+ hidden?: boolean | undefined;
1581
+ archived?: boolean | undefined;
1582
+ deprecated?: boolean | undefined;
1583
+ metadata?: Record<string, unknown> | undefined;
1584
+ autoUpdate?: boolean | undefined;
1585
+ }>;
1586
+ /**
1587
+ * Select attribute config schema
1588
+ */
1589
+ declare const selectConfigSchema: z.ZodObject<{
1590
+ disabled: z.ZodOptional<z.ZodBoolean>;
1591
+ placeholder: z.ZodOptional<z.ZodString>;
1592
+ description: z.ZodOptional<z.ZodString>;
1593
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1594
+ icon: z.ZodOptional<z.ZodString>;
1595
+ order: z.ZodOptional<z.ZodNumber>;
1596
+ hidden: z.ZodOptional<z.ZodBoolean>;
1597
+ archived: z.ZodOptional<z.ZodBoolean>;
1598
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1599
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1600
+ } & {
1601
+ options: z.ZodArray<z.ZodObject<{
1602
+ id: z.ZodString;
1603
+ label: z.ZodString;
1604
+ value: z.ZodString;
1605
+ color: z.ZodOptional<z.ZodString>;
1606
+ icon: z.ZodOptional<z.ZodString>;
1607
+ description: z.ZodOptional<z.ZodString>;
1608
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1609
+ }, "strip", z.ZodTypeAny, {
1610
+ label: string;
1611
+ id: string;
1612
+ value: string;
1613
+ description?: string | undefined;
1614
+ icon?: string | undefined;
1615
+ color?: string | undefined;
1616
+ group?: "idle" | "in_progress" | "finished" | undefined;
1617
+ }, {
1618
+ label: string;
1619
+ id: string;
1620
+ value: string;
1621
+ description?: string | undefined;
1622
+ icon?: string | undefined;
1623
+ color?: string | undefined;
1624
+ group?: "idle" | "in_progress" | "finished" | undefined;
1625
+ }>, "many">;
1626
+ }, "strip", z.ZodTypeAny, {
1627
+ options: {
1628
+ label: string;
1629
+ id: string;
1630
+ value: string;
1631
+ description?: string | undefined;
1632
+ icon?: string | undefined;
1633
+ color?: string | undefined;
1634
+ group?: "idle" | "in_progress" | "finished" | undefined;
1635
+ }[];
1636
+ defaultValue?: unknown;
1637
+ disabled?: boolean | undefined;
1638
+ placeholder?: string | undefined;
1639
+ description?: string | undefined;
1640
+ icon?: string | undefined;
1641
+ order?: number | undefined;
1642
+ hidden?: boolean | undefined;
1643
+ archived?: boolean | undefined;
1644
+ deprecated?: boolean | undefined;
1645
+ metadata?: Record<string, unknown> | undefined;
1646
+ }, {
1647
+ options: {
1648
+ label: string;
1649
+ id: string;
1650
+ value: string;
1651
+ description?: string | undefined;
1652
+ icon?: string | undefined;
1653
+ color?: string | undefined;
1654
+ group?: "idle" | "in_progress" | "finished" | undefined;
1655
+ }[];
1656
+ defaultValue?: unknown;
1657
+ disabled?: boolean | undefined;
1658
+ placeholder?: string | undefined;
1659
+ description?: string | undefined;
1660
+ icon?: string | undefined;
1661
+ order?: number | undefined;
1662
+ hidden?: boolean | undefined;
1663
+ archived?: boolean | undefined;
1664
+ deprecated?: boolean | undefined;
1665
+ metadata?: Record<string, unknown> | undefined;
1666
+ }>;
1667
+ /**
1668
+ * Multiselect attribute config schema
1669
+ */
1670
+ declare const multiselectConfigSchema: z.ZodObject<{
1671
+ disabled: z.ZodOptional<z.ZodBoolean>;
1672
+ placeholder: z.ZodOptional<z.ZodString>;
1673
+ description: z.ZodOptional<z.ZodString>;
1674
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1675
+ icon: z.ZodOptional<z.ZodString>;
1676
+ order: z.ZodOptional<z.ZodNumber>;
1677
+ hidden: z.ZodOptional<z.ZodBoolean>;
1678
+ archived: z.ZodOptional<z.ZodBoolean>;
1679
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1680
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1681
+ } & {
1682
+ options: z.ZodArray<z.ZodObject<{
1683
+ id: z.ZodString;
1684
+ label: z.ZodString;
1685
+ value: z.ZodString;
1686
+ color: z.ZodOptional<z.ZodString>;
1687
+ icon: z.ZodOptional<z.ZodString>;
1688
+ description: z.ZodOptional<z.ZodString>;
1689
+ group: z.ZodOptional<z.ZodEnum<["idle", "in_progress", "finished"]>>;
1690
+ }, "strip", z.ZodTypeAny, {
1691
+ label: string;
1692
+ id: string;
1693
+ value: string;
1694
+ description?: string | undefined;
1695
+ icon?: string | undefined;
1696
+ color?: string | undefined;
1697
+ group?: "idle" | "in_progress" | "finished" | undefined;
1698
+ }, {
1699
+ label: string;
1700
+ id: string;
1701
+ value: string;
1702
+ description?: string | undefined;
1703
+ icon?: string | undefined;
1704
+ color?: string | undefined;
1705
+ group?: "idle" | "in_progress" | "finished" | undefined;
1706
+ }>, "many">;
1707
+ }, "strip", z.ZodTypeAny, {
1708
+ options: {
1709
+ label: string;
1710
+ id: string;
1711
+ value: string;
1712
+ description?: string | undefined;
1713
+ icon?: string | undefined;
1714
+ color?: string | undefined;
1715
+ group?: "idle" | "in_progress" | "finished" | undefined;
1716
+ }[];
1717
+ defaultValue?: unknown;
1718
+ disabled?: boolean | undefined;
1719
+ placeholder?: string | undefined;
1720
+ description?: string | undefined;
1721
+ icon?: string | undefined;
1722
+ order?: number | undefined;
1723
+ hidden?: boolean | undefined;
1724
+ archived?: boolean | undefined;
1725
+ deprecated?: boolean | undefined;
1726
+ metadata?: Record<string, unknown> | undefined;
1727
+ }, {
1728
+ options: {
1729
+ label: string;
1730
+ id: string;
1731
+ value: string;
1732
+ description?: string | undefined;
1733
+ icon?: string | undefined;
1734
+ color?: string | undefined;
1735
+ group?: "idle" | "in_progress" | "finished" | undefined;
1736
+ }[];
1737
+ defaultValue?: unknown;
1738
+ disabled?: boolean | undefined;
1739
+ placeholder?: string | undefined;
1740
+ description?: string | undefined;
1741
+ icon?: string | undefined;
1742
+ order?: number | undefined;
1743
+ hidden?: boolean | undefined;
1744
+ archived?: boolean | undefined;
1745
+ deprecated?: boolean | undefined;
1746
+ metadata?: Record<string, unknown> | undefined;
1747
+ }>;
1748
+ /**
1749
+ * File attribute config schema
1750
+ */
1751
+ declare const fileConfigSchema: z.ZodObject<{
1752
+ disabled: z.ZodOptional<z.ZodBoolean>;
1753
+ placeholder: z.ZodOptional<z.ZodString>;
1754
+ description: z.ZodOptional<z.ZodString>;
1755
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1756
+ icon: z.ZodOptional<z.ZodString>;
1757
+ order: z.ZodOptional<z.ZodNumber>;
1758
+ hidden: z.ZodOptional<z.ZodBoolean>;
1759
+ archived: z.ZodOptional<z.ZodBoolean>;
1760
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1761
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1762
+ } & {
1763
+ maxFiles: z.ZodOptional<z.ZodNumber>;
1764
+ maxSize: z.ZodOptional<z.ZodNumber>;
1765
+ allowedTypes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1766
+ verification: z.ZodOptional<z.ZodObject<{
1767
+ enabled: z.ZodBoolean;
1768
+ documentTypes: z.ZodArray<z.ZodObject<{
1769
+ type: z.ZodEnum<["id_card", "passport", "incorporation_certificate", "driver_license", "birth_certificate", "residence_permit", "bank_statement", "proof_of_address", "custom"]>;
1770
+ label: z.ZodString;
1771
+ faces: z.ZodArray<z.ZodEnum<["front", "back", "single"]>, "many">;
1772
+ attributeMapping: z.ZodOptional<z.ZodArray<z.ZodObject<{
1773
+ attributeId: z.ZodString;
1774
+ extractedKey: z.ZodString;
1775
+ face: z.ZodOptional<z.ZodEnum<["front", "back", "single"]>>;
1776
+ required: z.ZodOptional<z.ZodBoolean>;
1777
+ }, "strip", z.ZodTypeAny, {
1778
+ attributeId: string;
1779
+ extractedKey: string;
1780
+ required?: boolean | undefined;
1781
+ face?: "front" | "back" | "single" | undefined;
1782
+ }, {
1783
+ attributeId: string;
1784
+ extractedKey: string;
1785
+ required?: boolean | undefined;
1786
+ face?: "front" | "back" | "single" | undefined;
1787
+ }>, "many">>;
1788
+ }, "strip", z.ZodTypeAny, {
1789
+ label: string;
1790
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1791
+ faces: ("front" | "back" | "single")[];
1792
+ attributeMapping?: {
1793
+ attributeId: string;
1794
+ extractedKey: string;
1795
+ required?: boolean | undefined;
1796
+ face?: "front" | "back" | "single" | undefined;
1797
+ }[] | undefined;
1798
+ }, {
1799
+ label: string;
1800
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1801
+ faces: ("front" | "back" | "single")[];
1802
+ attributeMapping?: {
1803
+ attributeId: string;
1804
+ extractedKey: string;
1805
+ required?: boolean | undefined;
1806
+ face?: "front" | "back" | "single" | undefined;
1807
+ }[] | undefined;
1808
+ }>, "many">;
1809
+ autoExtract: z.ZodOptional<z.ZodBoolean>;
1810
+ autoValidate: z.ZodOptional<z.ZodBoolean>;
1811
+ }, "strip", z.ZodTypeAny, {
1812
+ enabled: boolean;
1813
+ documentTypes: {
1814
+ label: string;
1815
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1816
+ faces: ("front" | "back" | "single")[];
1817
+ attributeMapping?: {
1818
+ attributeId: string;
1819
+ extractedKey: string;
1820
+ required?: boolean | undefined;
1821
+ face?: "front" | "back" | "single" | undefined;
1822
+ }[] | undefined;
1823
+ }[];
1824
+ autoExtract?: boolean | undefined;
1825
+ autoValidate?: boolean | undefined;
1826
+ }, {
1827
+ enabled: boolean;
1828
+ documentTypes: {
1829
+ label: string;
1830
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1831
+ faces: ("front" | "back" | "single")[];
1832
+ attributeMapping?: {
1833
+ attributeId: string;
1834
+ extractedKey: string;
1835
+ required?: boolean | undefined;
1836
+ face?: "front" | "back" | "single" | undefined;
1837
+ }[] | undefined;
1838
+ }[];
1839
+ autoExtract?: boolean | undefined;
1840
+ autoValidate?: boolean | undefined;
1841
+ }>>;
1842
+ }, "strip", z.ZodTypeAny, {
1843
+ defaultValue?: unknown;
1844
+ disabled?: boolean | undefined;
1845
+ placeholder?: string | undefined;
1846
+ description?: string | undefined;
1847
+ icon?: string | undefined;
1848
+ order?: number | undefined;
1849
+ hidden?: boolean | undefined;
1850
+ archived?: boolean | undefined;
1851
+ deprecated?: boolean | undefined;
1852
+ metadata?: Record<string, unknown> | undefined;
1853
+ maxFiles?: number | undefined;
1854
+ maxSize?: number | undefined;
1855
+ allowedTypes?: string[] | undefined;
1856
+ verification?: {
1857
+ enabled: boolean;
1858
+ documentTypes: {
1859
+ label: string;
1860
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1861
+ faces: ("front" | "back" | "single")[];
1862
+ attributeMapping?: {
1863
+ attributeId: string;
1864
+ extractedKey: string;
1865
+ required?: boolean | undefined;
1866
+ face?: "front" | "back" | "single" | undefined;
1867
+ }[] | undefined;
1868
+ }[];
1869
+ autoExtract?: boolean | undefined;
1870
+ autoValidate?: boolean | undefined;
1871
+ } | undefined;
1872
+ }, {
1873
+ defaultValue?: unknown;
1874
+ disabled?: boolean | undefined;
1875
+ placeholder?: string | undefined;
1876
+ description?: string | undefined;
1877
+ icon?: string | undefined;
1878
+ order?: number | undefined;
1879
+ hidden?: boolean | undefined;
1880
+ archived?: boolean | undefined;
1881
+ deprecated?: boolean | undefined;
1882
+ metadata?: Record<string, unknown> | undefined;
1883
+ maxFiles?: number | undefined;
1884
+ maxSize?: number | undefined;
1885
+ allowedTypes?: string[] | undefined;
1886
+ verification?: {
1887
+ enabled: boolean;
1888
+ documentTypes: {
1889
+ label: string;
1890
+ type: "id_card" | "passport" | "incorporation_certificate" | "driver_license" | "birth_certificate" | "residence_permit" | "bank_statement" | "proof_of_address" | "custom";
1891
+ faces: ("front" | "back" | "single")[];
1892
+ attributeMapping?: {
1893
+ attributeId: string;
1894
+ extractedKey: string;
1895
+ required?: boolean | undefined;
1896
+ face?: "front" | "back" | "single" | undefined;
1897
+ }[] | undefined;
1898
+ }[];
1899
+ autoExtract?: boolean | undefined;
1900
+ autoValidate?: boolean | undefined;
1901
+ } | undefined;
1902
+ }>;
1903
+ /**
1904
+ * User attribute config schema
1905
+ */
1906
+ declare const userConfigSchema: z.ZodObject<{
1907
+ disabled: z.ZodOptional<z.ZodBoolean>;
1908
+ placeholder: z.ZodOptional<z.ZodString>;
1909
+ description: z.ZodOptional<z.ZodString>;
1910
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1911
+ icon: z.ZodOptional<z.ZodString>;
1912
+ order: z.ZodOptional<z.ZodNumber>;
1913
+ hidden: z.ZodOptional<z.ZodBoolean>;
1914
+ archived: z.ZodOptional<z.ZodBoolean>;
1915
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1916
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1917
+ } & {
1918
+ allowedRoles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1919
+ }, "strip", z.ZodTypeAny, {
1920
+ defaultValue?: unknown;
1921
+ disabled?: boolean | undefined;
1922
+ placeholder?: string | undefined;
1923
+ description?: string | undefined;
1924
+ icon?: string | undefined;
1925
+ order?: number | undefined;
1926
+ hidden?: boolean | undefined;
1927
+ archived?: boolean | undefined;
1928
+ deprecated?: boolean | undefined;
1929
+ metadata?: Record<string, unknown> | undefined;
1930
+ allowedRoles?: string[] | undefined;
1931
+ }, {
1932
+ defaultValue?: unknown;
1933
+ disabled?: boolean | undefined;
1934
+ placeholder?: string | undefined;
1935
+ description?: string | undefined;
1936
+ icon?: string | undefined;
1937
+ order?: number | undefined;
1938
+ hidden?: boolean | undefined;
1939
+ archived?: boolean | undefined;
1940
+ deprecated?: boolean | undefined;
1941
+ metadata?: Record<string, unknown> | undefined;
1942
+ allowedRoles?: string[] | undefined;
1943
+ }>;
1944
+ /**
1945
+ * Relation attribute config schema
1946
+ */
1947
+ declare const relationConfigSchema: z.ZodObject<{
1948
+ disabled: z.ZodOptional<z.ZodBoolean>;
1949
+ placeholder: z.ZodOptional<z.ZodString>;
1950
+ description: z.ZodOptional<z.ZodString>;
1951
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
1952
+ icon: z.ZodOptional<z.ZodString>;
1953
+ order: z.ZodOptional<z.ZodNumber>;
1954
+ hidden: z.ZodOptional<z.ZodBoolean>;
1955
+ archived: z.ZodOptional<z.ZodBoolean>;
1956
+ deprecated: z.ZodOptional<z.ZodBoolean>;
1957
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1958
+ } & {
1959
+ targets: z.ZodArray<z.ZodObject<{
1960
+ object: z.ZodString;
1961
+ displayTemplate: z.ZodOptional<z.ZodString>;
1962
+ filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1963
+ }, "strip", z.ZodTypeAny, {
1964
+ object: string;
1965
+ filter?: Record<string, unknown> | undefined;
1966
+ displayTemplate?: string | undefined;
1967
+ }, {
1968
+ object: string;
1969
+ filter?: Record<string, unknown> | undefined;
1970
+ displayTemplate?: string | undefined;
1971
+ }>, "many">;
1972
+ onDelete: z.ZodOptional<z.ZodEnum<["restrict", "cascade", "set_null"]>>;
1973
+ cardinality: z.ZodEnum<["one", "many"]>;
1974
+ minItems: z.ZodOptional<z.ZodNumber>;
1975
+ maxItems: z.ZodOptional<z.ZodNumber>;
1976
+ }, "strip", z.ZodTypeAny, {
1977
+ cardinality: "one" | "many";
1978
+ targets: {
1979
+ object: string;
1980
+ filter?: Record<string, unknown> | undefined;
1981
+ displayTemplate?: string | undefined;
1982
+ }[];
1983
+ defaultValue?: unknown;
1984
+ disabled?: boolean | undefined;
1985
+ placeholder?: string | undefined;
1986
+ description?: string | undefined;
1987
+ icon?: string | undefined;
1988
+ order?: number | undefined;
1989
+ hidden?: boolean | undefined;
1990
+ archived?: boolean | undefined;
1991
+ deprecated?: boolean | undefined;
1992
+ metadata?: Record<string, unknown> | undefined;
1993
+ onDelete?: "restrict" | "cascade" | "set_null" | undefined;
1994
+ minItems?: number | undefined;
1995
+ maxItems?: number | undefined;
1996
+ }, {
1997
+ cardinality: "one" | "many";
1998
+ targets: {
1999
+ object: string;
2000
+ filter?: Record<string, unknown> | undefined;
2001
+ displayTemplate?: string | undefined;
2002
+ }[];
2003
+ defaultValue?: unknown;
2004
+ disabled?: boolean | undefined;
2005
+ placeholder?: string | undefined;
2006
+ description?: string | undefined;
2007
+ icon?: string | undefined;
2008
+ order?: number | undefined;
2009
+ hidden?: boolean | undefined;
2010
+ archived?: boolean | undefined;
2011
+ deprecated?: boolean | undefined;
2012
+ metadata?: Record<string, unknown> | undefined;
2013
+ onDelete?: "restrict" | "cascade" | "set_null" | undefined;
2014
+ minItems?: number | undefined;
2015
+ maxItems?: number | undefined;
2016
+ }>;
2017
+ /**
2018
+ * Rating attribute config schema
2019
+ */
2020
+ declare const ratingConfigSchema: z.ZodObject<{
2021
+ disabled: z.ZodOptional<z.ZodBoolean>;
2022
+ placeholder: z.ZodOptional<z.ZodString>;
2023
+ description: z.ZodOptional<z.ZodString>;
2024
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
2025
+ icon: z.ZodOptional<z.ZodString>;
2026
+ order: z.ZodOptional<z.ZodNumber>;
2027
+ hidden: z.ZodOptional<z.ZodBoolean>;
2028
+ archived: z.ZodOptional<z.ZodBoolean>;
2029
+ deprecated: z.ZodOptional<z.ZodBoolean>;
2030
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2031
+ } & {
2032
+ max: z.ZodOptional<z.ZodNumber>;
2033
+ iconType: z.ZodOptional<z.ZodEnum<["star", "heart", "thumbs", "number"]>>;
2034
+ }, "strip", z.ZodTypeAny, {
2035
+ defaultValue?: unknown;
2036
+ disabled?: boolean | undefined;
2037
+ placeholder?: string | undefined;
2038
+ description?: string | undefined;
2039
+ icon?: string | undefined;
2040
+ order?: number | undefined;
2041
+ hidden?: boolean | undefined;
2042
+ archived?: boolean | undefined;
2043
+ deprecated?: boolean | undefined;
2044
+ metadata?: Record<string, unknown> | undefined;
2045
+ max?: number | undefined;
2046
+ iconType?: "number" | "heart" | "star" | "thumbs" | undefined;
2047
+ }, {
2048
+ defaultValue?: unknown;
2049
+ disabled?: boolean | undefined;
2050
+ placeholder?: string | undefined;
2051
+ description?: string | undefined;
2052
+ icon?: string | undefined;
2053
+ order?: number | undefined;
2054
+ hidden?: boolean | undefined;
2055
+ archived?: boolean | undefined;
2056
+ deprecated?: boolean | undefined;
2057
+ metadata?: Record<string, unknown> | undefined;
2058
+ max?: number | undefined;
2059
+ iconType?: "number" | "heart" | "star" | "thumbs" | undefined;
2060
+ }>;
2061
+ /**
2062
+ * Map of attribute type to config schema
2063
+ */
2064
+ declare const attributeConfigSchemas: Record<AttributeType, z.ZodObject<z.ZodRawShape>>;
2065
+ /**
2066
+ * Get the config schema for a specific attribute type
2067
+ */
2068
+ declare function getAttributeConfigSchema(type: AttributeType): z.ZodObject<z.ZodRawShape>;
2069
+ /**
2070
+ * Validate attribute config for a specific type
2071
+ * Returns the validated config with only allowed properties
2072
+ */
2073
+ declare function validateAttributeConfig(type: AttributeType, config: Record<string, unknown>): {
2074
+ success: true;
2075
+ data: Record<string, unknown>;
2076
+ } | {
2077
+ success: false;
2078
+ errors: string[];
2079
+ };
2080
+ /**
2081
+ * Validate and strip unknown properties from attribute config
2082
+ * This ensures only allowed properties are stored in the database
2083
+ */
2084
+ declare function parseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown>;
2085
+ /**
2086
+ * Safely parse attribute config, returning undefined for invalid configs
2087
+ */
2088
+ declare function safeParseAttributeConfig(type: AttributeType, config: Record<string, unknown>): Record<string, unknown> | undefined;
2089
+ /**
2090
+ * Create a Zod schema for a text attribute
2091
+ */
2092
+ declare function createTextValidator(attr: TextAttribute): z.ZodString;
2093
+ /**
2094
+ * Create a Zod schema for a number attribute
2095
+ */
2096
+ declare function createNumberValidator(attr: NumberAttribute): z.ZodNumber;
2097
+ /**
2098
+ * Create a Zod schema for a checkbox attribute
2099
+ */
2100
+ declare function createCheckboxValidator(_attr: CheckboxAttribute): z.ZodBoolean;
2101
+ /**
2102
+ * Create a Zod schema for a date attribute
2103
+ */
2104
+ declare function createDateValidator(attr: DateAttribute): z.ZodString;
2105
+ /**
2106
+ * Create a Zod schema for a phone attribute
2107
+ */
2108
+ declare function createPhoneValidator(_attr: PhoneAttribute): z.ZodType<{
2109
+ countryCode: string;
2110
+ phoneNumber: string;
2111
+ }>;
2112
+ /**
2113
+ * Create a Zod schema for a currency attribute
2114
+ */
2115
+ declare function createCurrencyValidator(_attr: CurrencyAttribute): z.ZodType<{
2116
+ code: string;
2117
+ value: number;
2118
+ }>;
2119
+ /**
2120
+ * Create a Zod schema for a status attribute
2121
+ */
2122
+ declare function createStatusValidator(attr: StatusAttribute): z.ZodEnum<[string, ...string[]]>;
2123
+ /**
2124
+ * Create a Zod schema for a select attribute
2125
+ */
2126
+ declare function createSelectValidator(attr: SelectAttribute): z.ZodEnum<[string, ...string[]]>;
2127
+ /**
2128
+ * Create a Zod schema for a multiselect attribute
2129
+ */
2130
+ declare function createMultiselectValidator(attr: MultiselectAttribute): z.ZodArray<z.ZodEnum<[string, ...string[]]>>;
2131
+ /**
2132
+ * Create a Zod schema for a location attribute
2133
+ */
2134
+ type LocationShape = {
2135
+ address?: string;
2136
+ address2?: string;
2137
+ city?: string;
2138
+ state?: string;
2139
+ postalCode?: string;
2140
+ country?: string;
2141
+ latitude?: number;
2142
+ longitude?: number;
2143
+ };
2144
+ declare function createLocationValidator(_attr: LocationAttribute): z.ZodType<LocationShape>;
2145
+ /**
2146
+ * Create a Zod schema for a timestamp attribute
2147
+ */
2148
+ declare function createTimestampValidator(_attr: TimestampAttribute): z.ZodNumber;
2149
+ /**
2150
+ * Create a Zod schema for a file attribute
2151
+ */
2152
+ declare function createFileValidator(_attr: FileAttribute): z.ZodString;
2153
+ /**
2154
+ * Create a Zod schema for a user attribute
2155
+ */
2156
+ declare function createUserValidator(_attr: UserAttribute): z.ZodString;
2157
+ /**
2158
+ * Create a Zod schema for a single relation attribute (cardinality: "one")
2159
+ */
2160
+ declare function createSingleRelationValidator(attr: SingleRelationAttribute): z.ZodUnion<[z.ZodString, z.ZodNull]>;
2161
+ /**
2162
+ * Create a Zod schema for a multi relation attribute (cardinality: "many")
2163
+ */
2164
+ declare function createMultiRelationValidator(attr: MultiRelationAttribute): z.ZodArray<z.ZodString>;
2165
+ /**
2166
+ * Create a Zod schema for a relation attribute
2167
+ * Dispatches to single or multi validator based on cardinality
2168
+ */
2169
+ declare function createRelationValidator(attr: RelationAttribute): z.ZodUnion<[z.ZodString, z.ZodNull]> | z.ZodArray<z.ZodString>;
2170
+ /**
2171
+ * Create a Zod schema for a rating attribute
2172
+ */
2173
+ declare function createRatingValidator(attr: RatingAttribute): z.ZodNumber;
2174
+ /**
2175
+ * Create a Zod schema for any attribute type
2176
+ */
2177
+ declare function createAttributeValidator(attr: Attribute): z.ZodTypeAny;
2178
+ /**
2179
+ * Create a Zod schema for an entire object
2180
+ */
2181
+ declare function createObjectValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
2182
+ /**
2183
+ * Validation result
2184
+ */
2185
+ interface ValidationResult {
2186
+ success: boolean;
2187
+ data?: Record<string, unknown>;
2188
+ errors?: Array<{
2189
+ path: string[];
2190
+ message: string;
2191
+ }>;
2192
+ }
2193
+ /**
2194
+ * Validate data against an attribute schema
2195
+ */
2196
+ declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
2197
+ /**
2198
+ * Validate data against an object schema
2199
+ */
2200
+ declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
2201
+ /**
2202
+ * Validate and throw if invalid
2203
+ */
2204
+ declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
2205
+ /**
2206
+ * Create a Zod schema for draft validation.
2207
+ * All attributes become optional, but provided values are still validated.
2208
+ */
2209
+ declare function createDraftValidator(objectDef: ObjectDefinition): z.ZodType<Record<string, unknown>>;
2210
+ /**
2211
+ * Validate data in draft mode.
2212
+ * - All attributes are treated as optional (no required validation)
2213
+ * - Provided values are still validated for format/type correctness
2214
+ *
2215
+ * Use this when creating records that may be incomplete (drafts).
2216
+ *
2217
+ * @example
2218
+ * ```typescript
2219
+ * const result = validateDraft(PRODUCT, { name: "Draft" });
2220
+ * // → success even if "price" is required but missing
2221
+ *
2222
+ * const result2 = validateDraft(PRODUCT, { price: -10 });
2223
+ * // → fails because price must be >= 0 (format validation still applies)
2224
+ * ```
2225
+ */
2226
+ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
2227
+ /**
2228
+ * Validate draft data and throw if format validation fails.
2229
+ */
2230
+ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
2231
+ /**
2232
+ * Get the list of required attributes that are missing values.
2233
+ *
2234
+ * @example
2235
+ * ```typescript
2236
+ * const missing = getMissingRequiredAttributes(PRODUCT, { name: "Test" });
2237
+ * // → [priceAttribute, statusAttribute] if price and status are required but missing
2238
+ * ```
2239
+ */
2240
+ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
2241
+ /**
2242
+ * Check if a record is complete (all required attributes have valid values).
2243
+ *
2244
+ * @returns `true` if all required values are present and valid, `false` otherwise
2245
+ */
2246
+ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
2247
+ /**
2248
+ * Compute the completion status of a record based on its data.
2249
+ *
2250
+ * - `"complete"`: All required values are present and valid
2251
+ * - `"draft"`: One or more required values are missing or invalid
2252
+ *
2253
+ * This function is used to dynamically determine the status when
2254
+ * creating or updating records.
2255
+ *
2256
+ * @example
2257
+ * ```typescript
2258
+ * const status = computeRecordStatus(PRODUCT, {
2259
+ * name: "Nike Air Max",
2260
+ * price: 129.99,
2261
+ * status: "active"
2262
+ * });
2263
+ * // → "complete"
2264
+ *
2265
+ * const status2 = computeRecordStatus(PRODUCT, { name: "Draft Product" });
2266
+ * // → "draft" (missing required fields)
2267
+ * ```
2268
+ */
2269
+ declare function computeRecordStatus(objectDef: ObjectDefinition, data: Record<string, unknown>): CompletionStatus;
2270
+
2271
+ /**
2272
+ * Object as stored in database (metadata)
2273
+ */
2274
+ interface DBObject extends Timestamps {
2275
+ id: Uuid;
2276
+ tenantId: TenantId;
2277
+ name: string;
2278
+ label: string;
2279
+ description?: string;
2280
+ icon?: IconName;
2281
+ labelExpression: string;
2282
+ system: boolean;
2283
+ metadata?: Record<string, unknown>;
2284
+ }
2285
+ interface CreateDBObject {
2286
+ tenantId: TenantId;
2287
+ name: string;
2288
+ label: string;
2289
+ description?: string;
2290
+ icon?: IconName;
2291
+ labelExpression: string;
2292
+ system?: boolean;
2293
+ metadata?: Record<string, unknown>;
2294
+ }
2295
+ interface UpdateDBObject {
2296
+ label?: string;
2297
+ description?: string;
2298
+ icon?: IconName;
2299
+ labelExpression?: string;
2300
+ metadata?: Record<string, unknown>;
2301
+ }
2302
+ interface UpsertDBObject extends CreateDBObject {
2303
+ system: boolean;
2304
+ }
2305
+ /**
2306
+ * Attribute as stored in database (metadata)
2307
+ */
2308
+ interface DBAttribute extends Timestamps {
2309
+ id: Uuid;
2310
+ objectId: Uuid;
2311
+ name: string;
2312
+ label: string;
2313
+ type: AttributeType;
2314
+ description?: string;
2315
+ icon?: IconName;
2316
+ system: boolean;
2317
+ required: boolean;
2318
+ unique: boolean;
2319
+ order: number;
2320
+ hidden?: boolean;
2321
+ archived?: boolean;
2322
+ deprecated?: boolean;
2323
+ defaultValue?: unknown;
2324
+ config: Record<string, unknown>;
2325
+ }
2326
+ interface CreateDBAttribute {
2327
+ objectId: Uuid;
2328
+ name: string;
2329
+ label: string;
2330
+ type: AttributeType;
2331
+ description?: string;
2332
+ icon?: IconName;
2333
+ system?: boolean;
2334
+ required?: boolean;
2335
+ unique?: boolean;
2336
+ order?: number;
2337
+ hidden?: boolean;
2338
+ archived?: boolean;
2339
+ deprecated?: boolean;
2340
+ defaultValue?: unknown;
2341
+ config?: Record<string, unknown>;
2342
+ }
2343
+ interface UpdateDBAttribute {
2344
+ label?: string;
2345
+ description?: string;
2346
+ icon?: IconName;
2347
+ required?: boolean;
2348
+ order?: number;
2349
+ hidden?: boolean;
2350
+ archived?: boolean;
2351
+ deprecated?: boolean;
2352
+ defaultValue?: unknown;
2353
+ config?: Record<string, unknown>;
2354
+ }
2355
+ interface UpsertDBAttribute extends CreateDBAttribute {
2356
+ objectId: Uuid;
2357
+ name: string;
2358
+ }
2359
+
2360
+ /**
2361
+ * Object record creation data
2362
+ */
2363
+ interface CreateObjectRecord {
2364
+ tenantId: TenantId;
2365
+ objectId: Uuid;
2366
+ data: Record<string, unknown>;
2367
+ /**
2368
+ * Computed display label from labelExpression.
2369
+ * Stored for performance - avoids recomputation on every read.
2370
+ */
2371
+ label: string;
2372
+ /**
2373
+ * Completion status of the record.
2374
+ * - `draft`: Record is incomplete (missing required values)
2375
+ * - `complete`: All required values are present and valid
2376
+ */
2377
+ completionStatus: "draft" | "complete";
2378
+ }
2379
+ /**
2380
+ * Generic list options for pagination and sorting
2381
+ */
2382
+ interface ListOptions {
2383
+ limit?: number;
2384
+ offset?: number;
2385
+ orderBy?: string;
2386
+ orderDirection?: "asc" | "desc";
2387
+ }
2388
+ /**
2389
+ * Search options for full-text search
2390
+ */
2391
+ interface SearchOptions extends ListOptions {
2392
+ filters?: Record<string, unknown>;
2393
+ highlight?: boolean;
2394
+ }
2395
+ /**
2396
+ * Global search options
2397
+ */
2398
+ interface GlobalSearchOptions extends ListOptions {
2399
+ /**
2400
+ * Limit results to specific object names
2401
+ */
2402
+ objectNames?: string[];
2403
+ /**
2404
+ * Whether to include object metadata in results
2405
+ */
2406
+ includeObjectInfo?: boolean;
2407
+ }
2408
+ /**
2409
+ * Global search result item
2410
+ */
2411
+ interface GlobalSearchResultItem {
2412
+ objectId: string;
2413
+ objectName: string;
2414
+ objectLabel: string;
2415
+ /** Computed label from labelExpression */
2416
+ label: string;
2417
+ recordId: string;
2418
+ values: Record<string, unknown>;
2419
+ completionStatus: "draft" | "complete";
2420
+ createdAt: Date;
2421
+ updatedAt: Date;
2422
+ }
2423
+ /**
2424
+ * File-specific list options
2425
+ */
2426
+ interface FileListOptions extends ListOptions {
2427
+ folderPath?: string;
2428
+ mimeType?: string;
2429
+ uploadedBy?: Uuid;
2430
+ includeDeleted?: boolean;
2431
+ }
2432
+ /**
2433
+ * View as stored in database
2434
+ */
2435
+ interface DBView extends Timestamps {
2436
+ id: Uuid;
2437
+ tenantId: TenantId;
2438
+ objectId?: Uuid;
2439
+ objectName: string;
2440
+ name: string;
2441
+ label: string;
2442
+ description?: string;
2443
+ icon?: IconName;
2444
+ tabs: Tab[];
2445
+ default: boolean;
2446
+ system: boolean;
2447
+ metadata?: Record<string, unknown>;
2448
+ }
2449
+ interface CreateDBView {
2450
+ tenantId: TenantId;
2451
+ objectId?: Uuid;
2452
+ objectName: string;
2453
+ name: string;
2454
+ label: string;
2455
+ description?: string;
2456
+ icon?: IconName;
2457
+ tabs: Tab[];
2458
+ default?: boolean;
2459
+ system?: boolean;
2460
+ metadata?: Record<string, unknown>;
2461
+ }
2462
+ interface UpdateDBView {
2463
+ label?: string;
2464
+ description?: string;
2465
+ icon?: IconName;
2466
+ tabs?: Tab[];
2467
+ default?: boolean;
2468
+ metadata?: Record<string, unknown>;
2469
+ }
2470
+ interface UpsertDBView {
2471
+ tenantId: TenantId;
2472
+ objectName: string;
2473
+ name: string;
2474
+ label: string;
2475
+ description?: string;
2476
+ icon?: IconName;
2477
+ tabs: Tab[];
2478
+ default?: boolean;
2479
+ system?: boolean;
2480
+ metadata?: Record<string, unknown>;
2481
+ }
2482
+ /**
2483
+ * Result of an operation
2484
+ */
2485
+ interface OperationResult<T = unknown> {
2486
+ success: boolean;
2487
+ data?: T;
2488
+ error?: {
2489
+ code: string;
2490
+ message: string;
2491
+ details?: Record<string, unknown>;
2492
+ };
2493
+ }
2494
+
2495
+ /**
2496
+ * Repository for objects table (metadata)
2497
+ */
2498
+ interface ObjectsRepository {
2499
+ /**
2500
+ * Find object by ID
2501
+ */
2502
+ findById(id: Uuid): Promise<DBObject | null>;
2503
+ /**
2504
+ * Find object by name and tenant
2505
+ */
2506
+ findByName(tenantId: TenantId, name: string): Promise<DBObject | null>;
2507
+ /**
2508
+ * Find system/native object by name (system=true, for sync)
2509
+ */
2510
+ findSystemByName(name: string): Promise<DBObject | null>;
2511
+ /**
2512
+ * Create object
2513
+ */
2514
+ create(data: CreateDBObject): Promise<DBObject>;
2515
+ /**
2516
+ * Update object
2517
+ */
2518
+ update(id: Uuid, data: Partial<UpdateDBObject>): Promise<DBObject>;
2519
+ /**
2520
+ * Delete object
2521
+ */
2522
+ delete(id: Uuid): Promise<void>;
2523
+ /**
2524
+ * List all objects for a tenant
2525
+ */
2526
+ list(tenantId: TenantId): Promise<DBObject[]>;
2527
+ /**
2528
+ * Upsert object (create or update based on nativeObjectId)
2529
+ */
2530
+ upsert(data: UpsertDBObject): Promise<DBObject>;
2531
+ }
2532
+ /**
2533
+ * Repository for attributes table (metadata)
2534
+ */
2535
+ interface AttributesRepository {
2536
+ /**
2537
+ * Find attribute by ID
2538
+ */
2539
+ findById(id: Uuid): Promise<DBAttribute | null>;
2540
+ /**
2541
+ * Find attributes by object ID
2542
+ */
2543
+ findByObjectId(objectId: Uuid): Promise<DBAttribute[]>;
2544
+ /**
2545
+ * Create attribute
2546
+ */
2547
+ create(data: CreateDBAttribute): Promise<DBAttribute>;
2548
+ /**
2549
+ * Update attribute
2550
+ */
2551
+ update(id: Uuid, data: Partial<UpdateDBAttribute>): Promise<DBAttribute>;
2552
+ /**
2553
+ * Delete attribute
2554
+ */
2555
+ delete(id: Uuid): Promise<void>;
2556
+ /**
2557
+ * Delete multiple attributes by names (for sync cleanup)
2558
+ */
2559
+ deleteByNames(objectId: Uuid, excludeNames: string[]): Promise<number>;
2560
+ /**
2561
+ * Upsert attribute (create or update based on objectId + name)
2562
+ */
2563
+ upsert(data: UpsertDBAttribute): Promise<DBAttribute>;
2564
+ }
2565
+ /**
2566
+ * Repository for user_profiles table
2567
+ */
2568
+ interface UserProfilesRepository {
2569
+ /**
2570
+ * Find user profile by ID
2571
+ */
2572
+ findById(id: Uuid): Promise<UserProfile | null>;
2573
+ /**
2574
+ * Find user profile by auth ID (external auth provider)
2575
+ */
2576
+ findByAuthId(authId: string): Promise<UserProfile | null>;
2577
+ /**
2578
+ * Find user profile by email
2579
+ */
2580
+ findByEmail(tenantId: TenantId, email: string): Promise<UserProfile | null>;
2581
+ /**
2582
+ * Create user profile
2583
+ */
2584
+ create(data: CreateUserProfile): Promise<UserProfile>;
2585
+ /**
2586
+ * Update user profile
2587
+ */
2588
+ update(id: Uuid, data: UpdateUserProfile): Promise<UserProfile>;
2589
+ /**
2590
+ * Delete user profile
2591
+ */
2592
+ delete(id: Uuid): Promise<void>;
2593
+ /**
2594
+ * List all user profiles for a tenant
2595
+ */
2596
+ list(tenantId: TenantId, options?: ListOptions): Promise<UserProfile[]>;
2597
+ /**
2598
+ * Update last login timestamp
2599
+ */
2600
+ updateLastLogin(id: Uuid): Promise<void>;
2601
+ }
2602
+ /**
2603
+ * Repository for files table
2604
+ */
2605
+ interface FilesRepository {
2606
+ /**
2607
+ * Find file by ID
2608
+ */
2609
+ findById(id: Uuid): Promise<File | null>;
2610
+ /**
2611
+ * Create file
2612
+ */
2613
+ create(data: CreateFile): Promise<File>;
2614
+ /**
2615
+ * Update file
2616
+ */
2617
+ update(id: Uuid, data: UpdateFile): Promise<File>;
2618
+ /**
2619
+ * Delete file (soft delete)
2620
+ */
2621
+ delete(id: Uuid): Promise<void>;
2622
+ /**
2623
+ * Hard delete file (permanent)
2624
+ */
2625
+ hardDelete(id: Uuid): Promise<void>;
2626
+ /**
2627
+ * List files for a tenant
2628
+ */
2629
+ list(tenantId: TenantId, options?: FileListOptions): Promise<File[]>;
2630
+ /**
2631
+ * Find files by folder path
2632
+ */
2633
+ findByFolder(tenantId: TenantId, folderPath: string): Promise<File[]>;
2634
+ /**
2635
+ * Find files by uploader
2636
+ */
2637
+ findByUploader(uploadedBy: Uuid): Promise<File[]>;
2638
+ }
2639
+ /**
2640
+ * Repository for object_records table (unified JSONB)
2641
+ */
2642
+ interface ObjectRecordsRepository {
2643
+ /**
2644
+ * Find record by ID
2645
+ */
2646
+ findById(id: Uuid): Promise<ObjectRecord | null>;
2647
+ /**
2648
+ * Create record
2649
+ */
2650
+ create(data: CreateObjectRecord): Promise<ObjectRecord>;
2651
+ /**
2652
+ * Update record
2653
+ */
2654
+ update(id: Uuid, data: Partial<Record<string, unknown>>): Promise<ObjectRecord>;
2655
+ /**
2656
+ * Delete record
2657
+ */
2658
+ delete(id: Uuid): Promise<void>;
2659
+ /**
2660
+ * List records for an object
2661
+ */
2662
+ list(tenantId: TenantId, objectId: Uuid, options?: ListOptions): Promise<{
2663
+ records: ObjectRecord[];
2664
+ total: number;
2665
+ }>;
2666
+ /**
2667
+ * Search records using PostgreSQL full-text search
2668
+ */
2669
+ search(tenantId: TenantId, objectId: Uuid, query: string, options?: SearchOptions): Promise<{
2670
+ records: ObjectRecord[];
2671
+ total: number;
2672
+ }>;
2673
+ /**
2674
+ * Global search across all object records for a tenant
2675
+ * Searches in all objects or a subset specified by objectNames
2676
+ */
2677
+ globalSearch(tenantId: TenantId, query: string, options?: GlobalSearchOptions): Promise<{
2678
+ results: GlobalSearchResultItem[];
2679
+ total: number;
2680
+ }>;
2681
+ }
2682
+ /**
2683
+ * Repository for views table
2684
+ */
2685
+ interface ViewsRepository {
2686
+ /**
2687
+ * Find view by ID
2688
+ */
2689
+ findById(id: Uuid): Promise<DBView | null>;
2690
+ /**
2691
+ * Find view by name for an object and tenant
2692
+ */
2693
+ findByName(tenantId: TenantId, objectName: string, viewName: string): Promise<DBView | null>;
2694
+ /**
2695
+ * Find all views for an object and tenant
2696
+ */
2697
+ findByObjectName(tenantId: TenantId, objectName: string): Promise<DBView[]>;
2698
+ /**
2699
+ * Find all views for a tenant
2700
+ */
2701
+ findAllForTenant(tenantId: TenantId): Promise<DBView[]>;
2702
+ /**
2703
+ * Find system view by name (for sync)
2704
+ */
2705
+ findSystemByName(objectName: string, viewName: string): Promise<DBView | null>;
2706
+ /**
2707
+ * Find all system views for an object
2708
+ */
2709
+ findSystemByObjectName(objectName: string): Promise<DBView[]>;
2710
+ /**
2711
+ * Create view
2712
+ */
2713
+ create(data: CreateDBView): Promise<DBView>;
2714
+ /**
2715
+ * Update view
2716
+ */
2717
+ update(id: Uuid, data: Partial<UpdateDBView>): Promise<DBView>;
2718
+ /**
2719
+ * Delete view
2720
+ */
2721
+ delete(id: Uuid): Promise<void>;
2722
+ /**
2723
+ * Delete views not in the list (for sync cleanup)
2724
+ * @returns Number of deleted views
2725
+ */
2726
+ deleteNotIn(objectName: string, keepViewNames: string[]): Promise<number>;
2727
+ /**
2728
+ * Upsert view (create or update based on objectName + name)
2729
+ */
2730
+ upsert(data: UpsertDBView): Promise<DBView>;
2731
+ }
2732
+
2733
+ /**
2734
+ * Generic database adapter interface
2735
+ * Any ORM (Drizzle, Prisma, Kysely, TypeORM) can implement this interface
2736
+ * to work with @andyoucreate/schema runtime services
2737
+ *
2738
+ * @example
2739
+ * ```typescript
2740
+ * // Drizzle implementation
2741
+ * import { createDrizzleAdapter } from "./adapters/drizzle";
2742
+ * import { db } from "./db";
2743
+ *
2744
+ * const adapter = createDrizzleAdapter(db);
2745
+ *
2746
+ * // Prisma implementation
2747
+ * import { createPrismaAdapter } from "./adapters/prisma";
2748
+ * import { prisma } from "./db";
2749
+ *
2750
+ * const adapter = createPrismaAdapter(prisma);
2751
+ * ```
2752
+ */
2753
+ interface DatabaseAdapter {
2754
+ objects: ObjectsRepository;
2755
+ attributes: AttributesRepository;
2756
+ views: ViewsRepository;
2757
+ userProfiles: UserProfilesRepository;
2758
+ files: FilesRepository;
2759
+ objectRecords: ObjectRecordsRepository;
2760
+ transaction<T>(callback: (adapter: DatabaseAdapter) => Promise<T>): Promise<T>;
2761
+ }
2762
+
2763
+ /**
2764
+ * Types of hooks supported by the system
2765
+ */
2766
+ type HookType = "beforeCreate" | "afterCreate" | "beforeUpdate" | "afterUpdate" | "beforeDelete" | "afterDelete";
2767
+ /**
2768
+ * Change information for a specific attribute
2769
+ */
2770
+ interface AttributeChange<T = unknown> {
2771
+ oldValue: T | undefined;
2772
+ newValue: T | undefined;
2773
+ changed: boolean;
2774
+ }
2775
+ /**
2776
+ * Context passed to hooks - abstract, no framework dependencies
2777
+ *
2778
+ * This interface is designed to be extended by framework-specific implementations
2779
+ * (e.g., TriggerContext in schema-nestjs adds NestJS services)
2780
+ */
2781
+ interface HookContext<T = unknown> {
2782
+ objectId: string;
2783
+ objectName: string;
2784
+ recordId: string;
2785
+ tenantId: string;
2786
+ record: ObjectRecord;
2787
+ oldValues: Record<string, unknown>;
2788
+ newValues: Record<string, unknown>;
2789
+ changedAttributes: string[];
2790
+ /**
2791
+ * Get change information for a specific attribute
2792
+ * @param attributeName - The name of the attribute to check
2793
+ * @returns Change information including old value, new value, and whether it changed
2794
+ */
2795
+ getChange<V = T>(attributeName: string): AttributeChange<V>;
2796
+ metadata: Record<string, unknown>;
2797
+ timestamp: Date;
2798
+ }
2799
+ /**
2800
+ * Generic hook handler function
2801
+ */
2802
+ type HookHandler = (ctx: HookContext) => Promise<void> | void;
2803
+ /**
2804
+ * Definition of a hook for registration
2805
+ */
2806
+ interface HookDefinition {
2807
+ type: HookType;
2808
+ objectName: string;
2809
+ /** Attribute name to watch, or '*' for all attributes */
2810
+ attributeName?: string | "*";
2811
+ /** Execution priority (lower = earlier), default 0 */
2812
+ priority?: number;
2813
+ handler: HookHandler;
2814
+ }
2815
+
2816
+ /**
2817
+ * Abstract interface for hook registry
2818
+ *
2819
+ * This interface is implemented by TriggerRegistry in schema-nestjs
2820
+ * to provide NestJS-specific functionality like dependency injection
2821
+ * and automatic discovery of trigger classes.
2822
+ */
2823
+ interface HookRegistry {
2824
+ /**
2825
+ * Execute all hooks of a given type for an object
2826
+ *
2827
+ * @param type - The type of hook to execute (beforeUpdate, afterUpdate, etc.)
2828
+ * @param objectName - The name of the object being modified
2829
+ * @param ctx - The hook context containing record data and changes
2830
+ */
2831
+ execute(type: HookType, objectName: string, ctx: HookContext): Promise<void>;
2832
+ /**
2833
+ * Register a hook manually (optional)
2834
+ * Not all implementations need to support this (e.g., decorator-based discovery)
2835
+ */
2836
+ register?(hook: HookDefinition): void;
2837
+ }
2838
+ /**
2839
+ * No-op implementation of HookRegistry
2840
+ *
2841
+ * Used as default when no registry is provided to RecordService.
2842
+ * This allows the schema package to work independently without triggers.
2843
+ */
2844
+ declare class NoopHookRegistry implements HookRegistry {
2845
+ execute(): Promise<void>;
2846
+ }
2847
+
2848
+ interface InternalObjectRecord extends ObjectRecord {
2849
+ tenantId: TenantId;
2850
+ }
2851
+ interface MockStores {
2852
+ objects: Map<Uuid, DBObject>;
2853
+ attributes: Map<Uuid, DBAttribute>;
2854
+ userProfiles: Map<Uuid, UserProfile>;
2855
+ files: Map<Uuid, File>;
2856
+ objectRecords: Map<Uuid, InternalObjectRecord>;
2857
+ views: Map<Uuid, DBView>;
2858
+ }
2859
+ /**
2860
+ * Create an in-memory mock adapter for testing and development
2861
+ *
2862
+ * This adapter stores all data in memory and is perfect for:
2863
+ * - Unit tests
2864
+ * - Integration tests
2865
+ * - Local development without a database
2866
+ * - Understanding the adapter interface
2867
+ *
2868
+ * @returns A DatabaseAdapter implementation using in-memory storage
2869
+ *
2870
+ * @example
2871
+ * ```typescript
2872
+ * import { createMockAdapter, RecordService } from "@andyoucreate/schema";
2873
+ *
2874
+ * // Create adapter
2875
+ * const adapter = createMockAdapter();
2876
+ *
2877
+ * // Use with services
2878
+ * const recordService = new RecordService(adapter, "tenant-123");
2879
+ *
2880
+ * // Create a record
2881
+ * const product = await recordService.createRecord("obj-product", {
2882
+ * name: "Nike Air Max",
2883
+ * price: 129.99
2884
+ * });
2885
+ *
2886
+ * // List records
2887
+ * const { records, total } = await recordService.listRecords("obj-product");
2888
+ * ```
2889
+ */
2890
+ declare function createMockAdapter(): DatabaseAdapter & {
2891
+ _stores: MockStores;
2892
+ reset(): void;
2893
+ };
2894
+
2895
+ /**
2896
+ * Service for managing files
2897
+ * Handles file metadata CRUD, permissions, and soft delete
2898
+ */
2899
+ declare class FileService {
2900
+ private adapter;
2901
+ private tenantId;
2902
+ constructor(adapter: DatabaseAdapter, tenantId: string);
2903
+ /**
2904
+ * Create a new file record (after upload to storage)
2905
+ *
2906
+ * @param data - File metadata
2907
+ * @returns Created file record
2908
+ *
2909
+ * @example
2910
+ * ```typescript
2911
+ * const service = new FileService(adapter, "tenant-123");
2912
+ *
2913
+ * // After uploading to S3
2914
+ * const file = await service.createFile({
2915
+ * tenantId: "tenant-123",
2916
+ * name: "contract-2025.pdf",
2917
+ * originalName: "Contract Acme Corp 2025.pdf",
2918
+ * mimeType: "application/pdf",
2919
+ * size: 2458624,
2920
+ * storageProvider: "s3",
2921
+ * storagePath: "tenants/123/files/2025/contract.pdf",
2922
+ * storageBucket: "my-app-files",
2923
+ * url: "https://cdn.example.com/files/file-123",
2924
+ * uploadedBy: "profile-456",
2925
+ * visibility: "private"
2926
+ * });
2927
+ * ```
2928
+ */
2929
+ createFile(data: CreateFile): Promise<File>;
2930
+ /**
2931
+ * Get file by ID
2932
+ */
2933
+ getFile(fileId: string): Promise<File | null>;
2934
+ /**
2935
+ * Get file by ID or throw
2936
+ */
2937
+ getFileOrThrow(fileId: string): Promise<File>;
2938
+ /**
2939
+ * Update file metadata
2940
+ *
2941
+ * @param fileId - File UUID
2942
+ * @param data - Data to update
2943
+ * @returns Updated file
2944
+ */
2945
+ updateFile(fileId: string, data: UpdateFile): Promise<File>;
2946
+ /**
2947
+ * Delete file (soft delete)
2948
+ *
2949
+ * @param fileId - File UUID
2950
+ * @param options - Delete options
2951
+ */
2952
+ deleteFile(fileId: string, options?: {
2953
+ hard?: boolean;
2954
+ checkOwnership?: boolean;
2955
+ userId?: string;
2956
+ }): Promise<void>;
2957
+ /**
2958
+ * List files for the tenant
2959
+ */
2960
+ listFiles(options?: FileListOptions): Promise<File[]>;
2961
+ /**
2962
+ * List files by folder
2963
+ */
2964
+ listFilesByFolder(folderPath: string): Promise<File[]>;
2965
+ /**
2966
+ * List files uploaded by a specific user
2967
+ */
2968
+ listFilesByUploader(uploadedBy: string): Promise<File[]>;
2969
+ /**
2970
+ * Change file visibility
2971
+ *
2972
+ * @param fileId - File UUID
2973
+ * @param visibility - New visibility level
2974
+ * @param allowedUsers - Users allowed to access (if restricted)
2975
+ */
2976
+ changeVisibility(fileId: string, visibility: "public" | "private" | "restricted", allowedUsers?: string[]): Promise<File>;
2977
+ /**
2978
+ * Grant access to a file for specific users
2979
+ *
2980
+ * @param fileId - File UUID
2981
+ * @param userIds - User IDs to grant access
2982
+ */
2983
+ grantAccess(fileId: string, userIds: string[]): Promise<File>;
2984
+ /**
2985
+ * Revoke access to a file for specific users
2986
+ *
2987
+ * @param fileId - File UUID
2988
+ * @param userIds - User IDs to revoke access
2989
+ */
2990
+ revokeAccess(fileId: string, userIds: string[]): Promise<File>;
2991
+ /**
2992
+ * Check if user has access to a file
2993
+ *
2994
+ * @param fileId - File UUID
2995
+ * @param userId - User ID to check
2996
+ * @returns true if user can access the file
2997
+ */
2998
+ canAccess(fileId: string, userId: string): Promise<boolean>;
2999
+ /**
3000
+ * Move file to different folder
3001
+ */
3002
+ moveToFolder(fileId: string, newFolderPath: string): Promise<File>;
3003
+ /**
3004
+ * Add tags to file
3005
+ */
3006
+ addTags(fileId: string, tags: string[]): Promise<File>;
3007
+ /**
3008
+ * Remove tags from file
3009
+ */
3010
+ removeTags(fileId: string, tags: string[]): Promise<File>;
3011
+ }
3012
+
3013
+ /**
3014
+ * Geocoding service for address autocomplete and geocoding operations
3015
+ *
3016
+ * @example
3017
+ * ```typescript
3018
+ * import { GeocodingService } from "@andyoucreate/schema";
3019
+ * import { GoogleMapsAdapter } from "./adapters/google-maps";
3020
+ *
3021
+ * const geocoding = new GeocodingService(new GoogleMapsAdapter({ apiKey: "..." }));
3022
+ *
3023
+ * const suggestions = await geocoding.autocomplete({
3024
+ * query: "40 Quai des Belges",
3025
+ * countries: ["FRA"],
3026
+ * limit: 5,
3027
+ * });
3028
+ * ```
3029
+ */
3030
+ declare class GeocodingService {
3031
+ private readonly adapter;
3032
+ constructor(adapter: GeocodingAdapter);
3033
+ /**
3034
+ * Search for address suggestions as the user types
3035
+ */
3036
+ autocomplete(params: GeocodingAutocompleteParams): Promise<GeocodingSuggestion[]>;
3037
+ /**
3038
+ * Reverse geocode coordinates to an address
3039
+ */
3040
+ reverse(params: ReverseGeocodingParams): Promise<GeocodingSuggestion | null>;
3041
+ /**
3042
+ * Geocode a structured address to coordinates
3043
+ */
3044
+ geocode(params: GeocodingParams): Promise<GeocodingSuggestion | null>;
3045
+ }
3046
+
3047
+ /**
3048
+ * Service for global search across all object records
3049
+ * Allows searching across all objects or a subset of objects for a tenant
3050
+ *
3051
+ * @example
3052
+ * ```typescript
3053
+ * const service = new GlobalSearchService(adapter, "tenant-123");
3054
+ *
3055
+ * // Search across all objects
3056
+ * const { results, total } = await service.search("nike");
3057
+ *
3058
+ * // Search only in specific objects
3059
+ * const { results, total } = await service.search("nike", {
3060
+ * objectNames: ["products", "orders"],
3061
+ * limit: 20
3062
+ * });
3063
+ * ```
3064
+ */
3065
+ declare class GlobalSearchService {
3066
+ private adapter;
3067
+ private tenantId;
3068
+ constructor(adapter: DatabaseAdapter, tenantId: string);
3069
+ /**
3070
+ * Search across all object records for the tenant
3071
+ *
3072
+ * @param query - Search query string
3073
+ * @param options - Search options (pagination, object filters)
3074
+ * @returns Matching records with object metadata and total count
3075
+ *
3076
+ * @example
3077
+ * ```typescript
3078
+ * // Basic search
3079
+ * const { results, total } = await service.search("nike air");
3080
+ *
3081
+ * // With pagination
3082
+ * const { results, total } = await service.search("nike", {
3083
+ * limit: 10,
3084
+ * offset: 20
3085
+ * });
3086
+ *
3087
+ * // Filter by object types
3088
+ * const { results, total } = await service.search("nike", {
3089
+ * objectNames: ["products", "orders"]
3090
+ * });
3091
+ * ```
3092
+ */
3093
+ search(query: string, options?: GlobalSearchOptions): Promise<{
3094
+ results: GlobalSearchResultItem[];
3095
+ total: number;
3096
+ }>;
3097
+ /**
3098
+ * Search and group results by object type
3099
+ *
3100
+ * @param query - Search query string
3101
+ * @param options - Search options
3102
+ * @returns Results grouped by object name
3103
+ */
3104
+ searchGrouped(query: string, options?: Omit<GlobalSearchOptions, "limit" | "offset">): Promise<{
3105
+ groups: Array<{
3106
+ objectName: string;
3107
+ objectLabel: string;
3108
+ results: GlobalSearchResultItem[];
3109
+ count: number;
3110
+ }>;
3111
+ total: number;
3112
+ }>;
3113
+ }
3114
+
3115
+ /**
3116
+ * Input for creating a custom object
3117
+ */
3118
+ interface CreateCustomObjectInput {
3119
+ name: string;
3120
+ label: string;
3121
+ /**
3122
+ * Template expression for computing record display labels.
3123
+ * Example: "{{ name }}" or "{{ firstName }} {{ lastName }}"
3124
+ */
3125
+ labelExpression: string;
3126
+ description?: string;
3127
+ icon?: IconName;
3128
+ attributes?: (Attribute | {
3129
+ build: () => Attribute;
3130
+ })[];
3131
+ metadata?: Record<string, unknown>;
3132
+ }
3133
+ /**
3134
+ * Input for adding an attribute to an object
3135
+ */
3136
+ interface AddAttributeInput {
3137
+ name: string;
3138
+ label: string;
3139
+ type: AttributeType;
3140
+ required?: boolean;
3141
+ unique?: boolean;
3142
+ description?: string;
3143
+ placeholder?: string;
3144
+ icon?: IconName;
3145
+ defaultValue?: unknown;
3146
+ metadata?: Record<string, unknown>;
3147
+ [key: string]: unknown;
3148
+ }
3149
+ /**
3150
+ * Service for managing object schemas
3151
+ * Handles fusion of native objects (from registry) and custom objects (from database)
3152
+ */
3153
+ declare class ObjectSchemaService {
3154
+ private adapter;
3155
+ private nativeRegistry;
3156
+ constructor(adapter: DatabaseAdapter, nativeRegistry: typeof registry);
3157
+ /**
3158
+ * Create a new custom object
3159
+ * Validates name format and ensures system=false
3160
+ *
3161
+ * @param definition - Object definition (attributes can be raw definitions or builders)
3162
+ * @param tenantId - Tenant ID owning the object
3163
+ * @returns Created ObjectDefinition
3164
+ */
3165
+ createCustomObject(definition: CreateCustomObjectInput, tenantId: string): Promise<ObjectDefinition>;
3166
+ /**
3167
+ * Add a custom attribute to an existing object
3168
+ * Can be used on both custom and native objects
3169
+ * Attributes added via API are always custom (system=false)
3170
+ *
3171
+ * @param objectId - Object UUID from database
3172
+ * @param attribute - Attribute definition
3173
+ * @param tenantId - Tenant ID (required for relation validation)
3174
+ * @returns Created Attribute
3175
+ */
3176
+ addAttributeToObject(objectId: string, attribute: AddAttributeInput, tenantId?: string): Promise<Attribute>;
3177
+ /**
3178
+ * Update an attribute
3179
+ * Can only update custom attributes (system=false)
3180
+ *
3181
+ * @param attributeId - Attribute UUID
3182
+ * @param updates - Partial attribute updates
3183
+ * @param tenantId - Tenant ID (required for relation validation)
3184
+ * @returns Updated Attribute
3185
+ */
3186
+ updateAttribute(attributeId: string, updates: Partial<AddAttributeInput>, tenantId?: string): Promise<Attribute>;
3187
+ /**
3188
+ * Delete an attribute
3189
+ * Can only delete custom attributes (system=false)
3190
+ *
3191
+ * @param attributeId - Attribute UUID
3192
+ */
3193
+ deleteAttribute(attributeId: string): Promise<void>;
3194
+ /**
3195
+ * List attributes for an object
3196
+ *
3197
+ * @param objectId - Object UUID
3198
+ * @param options - Filter options
3199
+ * @returns List of attributes
3200
+ */
3201
+ listAttributes(objectId: string, options?: {
3202
+ systemOnly?: boolean;
3203
+ customOnly?: boolean;
3204
+ }): Promise<Attribute[]>;
3205
+ /**
3206
+ * Validate attribute name format (variable identifier)
3207
+ * @internal
3208
+ */
3209
+ private validateAttributeName;
3210
+ /**
3211
+ * Get complete object schema (system + custom attributes)
3212
+ * If object is native, merges registry definition with DB custom attributes
3213
+ * If object is custom, returns DB definition only
3214
+ *
3215
+ * @param objectId - Object UUID from database
3216
+ * @returns Complete ObjectDefinition with all attributes
3217
+ *
3218
+ * @example
3219
+ * ```typescript
3220
+ * const service = new ObjectSchemaService(adapter, registry);
3221
+ * const productSchema = await service.getObjectSchema("obj-123");
3222
+ *
3223
+ * console.log(productSchema.attributes); // System + custom attributes
3224
+ * ```
3225
+ */
3226
+ getObjectSchema(objectId: string): Promise<ObjectDefinition>;
3227
+ /**
3228
+ * Get object schema by name (for system/native objects)
3229
+ * @deprecated Use getObjectSchemaByNameForTenant for custom objects support
3230
+ */
3231
+ getObjectSchemaByName(name: string): Promise<ObjectDefinition>;
3232
+ /**
3233
+ * Get object schema by name for a tenant (supports both native and custom objects)
3234
+ */
3235
+ getObjectSchemaByNameForTenant(name: string, tenantId: string): Promise<ObjectDefinition>;
3236
+ /**
3237
+ * List all object schemas for a tenant
3238
+ */
3239
+ listObjectSchemas(tenantId: string): Promise<ObjectDefinition[]>;
3240
+ /**
3241
+ * Merge native object from registry with custom attributes from DB
3242
+ * @internal
3243
+ */
3244
+ private mergeNativeObject;
3245
+ /**
3246
+ * Convert DB object + attributes to ObjectDefinition
3247
+ * @internal
3248
+ */
3249
+ private convertDBObjectToDefinition;
3250
+ /**
3251
+ * Validate attribute input and return parsed config
3252
+ * Validates: name format, config schema, relation targets
3253
+ * @internal
3254
+ */
3255
+ private validateAttributeInput;
3256
+ /**
3257
+ * Build and validate attribute config from input
3258
+ * Uses Zod schema to validate and strip unknown properties
3259
+ * @internal
3260
+ */
3261
+ private buildAttributeConfig;
3262
+ /**
3263
+ * Validate that relation target objects exist
3264
+ * @internal
3265
+ */
3266
+ private validateRelationTargets;
3267
+ /**
3268
+ * Convert DB attribute to Attribute type
3269
+ * @internal
3270
+ */
3271
+ private convertDBAttributeToAttribute;
3272
+ }
3273
+
3274
+ /**
3275
+ * Options for RecordService constructor
3276
+ */
3277
+ interface RecordServiceOptions {
3278
+ /**
3279
+ * Hook registry for executing triggers before/after operations.
3280
+ * If not provided, a no-op registry is used (no hooks executed).
3281
+ */
3282
+ hookRegistry?: HookRegistry;
3283
+ }
3284
+ /**
3285
+ * Service for managing object records (CRUD operations)
3286
+ * Handles validation, dispatch to correct table, and data consistency
3287
+ *
3288
+ * Supports optional hook system for triggers on attribute changes.
3289
+ */
3290
+ declare class RecordService {
3291
+ private adapter;
3292
+ private tenantId;
3293
+ private schemaService;
3294
+ private relationService;
3295
+ private hookRegistry;
3296
+ constructor(adapter: DatabaseAdapter, tenantId: string, options?: RecordServiceOptions);
3297
+ /**
3298
+ * Compute display label from schema expression
3299
+ * @internal
3300
+ */
3301
+ private computeLabel;
3302
+ /**
3303
+ * Create a new record with validation
3304
+ *
3305
+ * Triggers beforeCreate and afterCreate hooks if a HookRegistry is configured.
3306
+ *
3307
+ * @param objectId - Object UUID
3308
+ * @param data - Record data (attribute values)
3309
+ * @param options - Creation options
3310
+ * @returns Created record with computed completionStatus
3311
+ *
3312
+ * @example
3313
+ * ```typescript
3314
+ * const service = new RecordService(adapter, "tenant-123");
3315
+ *
3316
+ * // Create a complete record (strict validation)
3317
+ * const product = await service.createRecord("obj-product", {
3318
+ * name: "Nike Air Max",
3319
+ * price: 129.99,
3320
+ * status: "active"
3321
+ * });
3322
+ * // → product.completionStatus = "complete"
3323
+ *
3324
+ * // Create a draft record (allows missing required fields)
3325
+ * const draft = await service.createRecord("obj-product", {
3326
+ * name: "Draft Product"
3327
+ * }, { allowDraft: true });
3328
+ * // → draft.completionStatus = "draft"
3329
+ * ```
3330
+ */
3331
+ createRecord(objectId: string, data: Record<string, unknown>, options?: {
3332
+ /**
3333
+ * Allow creating records with missing required fields.
3334
+ * Format validation still applies to provided values.
3335
+ * @default false
3336
+ */
3337
+ allowDraft?: boolean;
3338
+ /**
3339
+ * Skip all validation (format + relations).
3340
+ * @default true
3341
+ */
3342
+ validate?: boolean;
3343
+ /**
3344
+ * Skip relation validation only.
3345
+ * Useful for bulk imports where relations are validated separately.
3346
+ * @default false
3347
+ */
3348
+ skipRelationValidation?: boolean;
3349
+ skipSystemCheck?: boolean;
3350
+ /**
3351
+ * Skip hook execution.
3352
+ * @default false
3353
+ */
3354
+ skipHooks?: boolean;
3355
+ /**
3356
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3357
+ */
3358
+ hookMetadata?: Record<string, unknown>;
3359
+ }): Promise<ObjectRecord>;
3360
+ /**
3361
+ * Get a record by ID
3362
+ *
3363
+ * @param recordId - Record UUID
3364
+ * @param options - Query options
3365
+ * @returns Record or null if not found
3366
+ */
3367
+ getRecord(recordId: string, options?: {
3368
+ includeSchema?: boolean;
3369
+ }): Promise<ObjectRecord | null>;
3370
+ /**
3371
+ * Get a record by ID or throw if not found
3372
+ */
3373
+ getRecordOrThrow(recordId: string): Promise<ObjectRecord>;
3374
+ /**
3375
+ * Update a record with validation
3376
+ *
3377
+ * The completion status is automatically recalculated after each update.
3378
+ * A draft record becomes complete when all required fields are filled.
3379
+ *
3380
+ * Triggers beforeUpdate and afterUpdate hooks if a HookRegistry is configured.
3381
+ *
3382
+ * @param recordId - Record UUID
3383
+ * @param data - Partial data to update
3384
+ * @param options - Update options
3385
+ * @returns Updated record with recalculated completionStatus
3386
+ *
3387
+ * @example
3388
+ * ```typescript
3389
+ * // Update a draft record to make it complete
3390
+ * const updated = await service.updateRecord(draftId, {
3391
+ * price: 99.99,
3392
+ * status: "active"
3393
+ * });
3394
+ * // → updated.completionStatus = "complete" if all required fields now present
3395
+ * ```
3396
+ */
3397
+ updateRecord(recordId: string, data: Partial<Record<string, unknown>>, options?: {
3398
+ /**
3399
+ * Skip validation entirely (format + relations).
3400
+ * @default true
3401
+ */
3402
+ validate?: boolean;
3403
+ /**
3404
+ * Allow partial updates without strict validation.
3405
+ * Format validation still applies to provided values.
3406
+ * @default false
3407
+ */
3408
+ partial?: boolean;
3409
+ /**
3410
+ * Skip relation validation only.
3411
+ * @default false
3412
+ */
3413
+ skipRelationValidation?: boolean;
3414
+ /**
3415
+ * Skip hook execution.
3416
+ * @default false
3417
+ */
3418
+ skipHooks?: boolean;
3419
+ /**
3420
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3421
+ */
3422
+ hookMetadata?: Record<string, unknown>;
3423
+ }): Promise<ObjectRecord>;
3424
+ /**
3425
+ * Build hook context for update operations
3426
+ * @internal
3427
+ */
3428
+ private buildHookContext;
3429
+ /**
3430
+ * Build hook context for create operations (no existing record)
3431
+ * @internal
3432
+ */
3433
+ private buildCreateHookContext;
3434
+ /**
3435
+ * Build hook context for delete operations
3436
+ * @internal
3437
+ */
3438
+ private buildDeleteHookContext;
3439
+ /**
3440
+ * Delete a record
3441
+ *
3442
+ * Triggers beforeDelete and afterDelete hooks if a HookRegistry is configured.
3443
+ *
3444
+ * @param recordId - Record UUID
3445
+ * @param options - Delete options
3446
+ */
3447
+ deleteRecord(recordId: string, options?: {
3448
+ checkSystem?: boolean;
3449
+ /**
3450
+ * Skip hook execution.
3451
+ * @default false
3452
+ */
3453
+ skipHooks?: boolean;
3454
+ /**
3455
+ * Additional metadata to pass to hooks (e.g., userId, requestId).
3456
+ */
3457
+ hookMetadata?: Record<string, unknown>;
3458
+ }): Promise<void>;
3459
+ /**
3460
+ * List records for an object with pagination
3461
+ *
3462
+ * @param objectId - Object UUID
3463
+ * @param options - List options
3464
+ * @returns Records and total count
3465
+ */
3466
+ listRecords(objectId: string, options?: {
3467
+ limit?: number;
3468
+ offset?: number;
3469
+ orderBy?: string;
3470
+ orderDirection?: "asc" | "desc";
3471
+ }): Promise<{
3472
+ records: ObjectRecord[];
3473
+ total: number;
3474
+ }>;
3475
+ /**
3476
+ * Search records using full-text search
3477
+ *
3478
+ * @param objectId - Object UUID
3479
+ * @param query - Search query
3480
+ * @param options - Search options
3481
+ * @returns Matching records and total count
3482
+ */
3483
+ searchRecords(objectId: string, query: string, options?: {
3484
+ limit?: number;
3485
+ offset?: number;
3486
+ filters?: Record<string, unknown>;
3487
+ }): Promise<{
3488
+ records: ObjectRecord[];
3489
+ total: number;
3490
+ }>;
3491
+ /**
3492
+ * Validate data against object schema without saving
3493
+ *
3494
+ * @param objectId - Object UUID
3495
+ * @param data - Data to validate
3496
+ * @returns Validation result
3497
+ */
3498
+ validateData(objectId: string, data: Record<string, unknown>): Promise<ValidationResult>;
3499
+ /**
3500
+ * Compute the completion status for given data without saving.
3501
+ * Useful for UI to show draft/complete status before submitting.
3502
+ *
3503
+ * @param objectId - Object UUID
3504
+ * @param data - Data to check
3505
+ * @returns Computed completion status
3506
+ */
3507
+ computeStatus(objectId: string, data: Record<string, unknown>): Promise<CompletionStatus>;
3508
+ /**
3509
+ * Refresh the completion status of an existing record.
3510
+ * Useful when schema changes and you need to recompute statuses.
3511
+ *
3512
+ * @param recordId - Record UUID
3513
+ * @returns Updated completion status
3514
+ */
3515
+ refreshRecordStatus(recordId: string): Promise<CompletionStatus>;
3516
+ }
3517
+
3518
+ /**
3519
+ * Result of relation validation
3520
+ */
3521
+ interface RelationValidationResult {
3522
+ valid: boolean;
3523
+ errors: RelationValidationError[];
3524
+ }
3525
+ /**
3526
+ * Individual relation validation error
3527
+ */
3528
+ interface RelationValidationError {
3529
+ /** Attribute name */
3530
+ attribute: string;
3531
+ /** Error message */
3532
+ message: string;
3533
+ /** Invalid record IDs */
3534
+ invalidIds?: string[];
3535
+ }
3536
+ /**
3537
+ * Resolved relation option
3538
+ */
3539
+ interface RelationOption {
3540
+ /** Record ID */
3541
+ id: string;
3542
+ /** Object ID */
3543
+ objectId: string;
3544
+ /** Object name (technical name) */
3545
+ objectName: string;
3546
+ /** Object label (display name) */
3547
+ objectLabel: string;
3548
+ /** Object icon */
3549
+ objectIcon?: string;
3550
+ /** Display label (computed from labelExpression) */
3551
+ label: string;
3552
+ /** Additional record data */
3553
+ data?: Record<string, unknown>;
3554
+ }
3555
+ /**
3556
+ * Response for relation options
3557
+ */
3558
+ interface RelationOptionsResponse {
3559
+ options: RelationOption[];
3560
+ hasMore: boolean;
3561
+ total: number;
3562
+ }
3563
+ /**
3564
+ * Parameters for fetching relation options
3565
+ */
3566
+ interface GetRelationOptionsParams {
3567
+ /** Search query */
3568
+ query?: string;
3569
+ /** Page number (1-based) */
3570
+ page?: number;
3571
+ /** Page size */
3572
+ pageSize?: number;
3573
+ /** Filter by specific target object */
3574
+ targetObject?: string;
3575
+ }
3576
+ /**
3577
+ * Service for validating relation attributes
3578
+ * Ensures referenced records exist and belong to valid target objects
3579
+ */
3580
+ declare class RelationService {
3581
+ private adapter;
3582
+ private schemaService;
3583
+ constructor(adapter: DatabaseAdapter, nativeRegistry: typeof registry);
3584
+ /**
3585
+ * Validate all relation attributes in the data
3586
+ *
3587
+ * @param schema - Object schema containing attribute definitions
3588
+ * @param data - Record data to validate
3589
+ * @returns Validation result with errors if any
3590
+ *
3591
+ * @example
3592
+ * ```typescript
3593
+ * const result = await relationService.validateRelations(schema, {
3594
+ * company: "rec-123",
3595
+ * contacts: ["rec-456", "rec-789"]
3596
+ * });
3597
+ *
3598
+ * if (!result.valid) {
3599
+ * console.log(result.errors);
3600
+ * // [{ attribute: "company", message: "Record not found", invalidIds: ["rec-123"] }]
3601
+ * }
3602
+ * ```
3603
+ */
3604
+ validateRelations(schema: ObjectDefinition, data: Record<string, unknown>): Promise<RelationValidationResult>;
3605
+ /**
3606
+ * Validate a single relation attribute value
3607
+ */
3608
+ private validateRelationAttribute;
3609
+ /**
3610
+ * Extract IDs from relation value based on cardinality
3611
+ */
3612
+ private extractIds;
3613
+ /**
3614
+ * Get valid object IDs from relation targets
3615
+ */
3616
+ private getValidObjectIds;
3617
+ /**
3618
+ * Validate relations and throw if invalid
3619
+ */
3620
+ validateRelationsOrThrow(schema: ObjectDefinition, data: Record<string, unknown>): Promise<void>;
3621
+ /**
3622
+ * Get available options for a relation attribute
3623
+ * Searches across all target objects defined in the relation
3624
+ *
3625
+ * @param attribute - Relation attribute definition
3626
+ * @param tenantId - Tenant ID for multi-tenant isolation
3627
+ * @param params - Query parameters
3628
+ *
3629
+ * @example
3630
+ * ```typescript
3631
+ * const options = await relationService.getOptions(attribute, "tenant-1", {
3632
+ * query: "nike",
3633
+ * page: 1,
3634
+ * pageSize: 20
3635
+ * });
3636
+ * ```
3637
+ */
3638
+ getOptions(attribute: RelationAttribute, tenantId: string, params?: GetRelationOptionsParams): Promise<RelationOptionsResponse>;
3639
+ /**
3640
+ * Resolve record IDs to their display labels
3641
+ * Useful for displaying current values in the UI
3642
+ *
3643
+ * @param ids - Record IDs to resolve
3644
+ * @param tenantId - Tenant ID for multi-tenant isolation
3645
+ *
3646
+ * @example
3647
+ * ```typescript
3648
+ * const resolved = await relationService.resolveIds(["rec-1", "rec-2"], "tenant-1");
3649
+ * // [{ id: "rec-1", label: "Nike Air Max", objectName: "products", ... }]
3650
+ * ```
3651
+ */
3652
+ resolveIds(ids: string[], tenantId: string): Promise<RelationOption[]>;
3653
+ /**
3654
+ * Find a relation attribute by ID
3655
+ */
3656
+ findAttributeById(attributeId: string): Promise<RelationAttribute | null>;
3657
+ }
3658
+
3659
+ /**
3660
+ * Service for managing user profiles
3661
+ * Handles user profile CRUD, auth provider sync, and role management
3662
+ */
3663
+ declare class UserProfileService {
3664
+ private adapter;
3665
+ private tenantId;
3666
+ constructor(adapter: DatabaseAdapter, tenantId: string);
3667
+ /**
3668
+ * Create a new user profile (typically after first auth)
3669
+ *
3670
+ * @param data - User profile creation data
3671
+ * @returns Created user profile
3672
+ *
3673
+ * @example
3674
+ * ```typescript
3675
+ * const service = new UserProfileService(adapter, "tenant-123");
3676
+ *
3677
+ * // After Supabase auth
3678
+ * const profile = await service.createProfile({
3679
+ * tenantId: "tenant-123",
3680
+ * authId: authUser.id,
3681
+ * email: authUser.email,
3682
+ * firstName: authUser.user_metadata.first_name,
3683
+ * lastName: authUser.user_metadata.last_name,
3684
+ * role: "member",
3685
+ * status: "active"
3686
+ * });
3687
+ * ```
3688
+ */
3689
+ createProfile(data: CreateUserProfile): Promise<UserProfile>;
3690
+ /**
3691
+ * Get user profile by ID
3692
+ */
3693
+ getProfile(profileId: string): Promise<UserProfile | null>;
3694
+ /**
3695
+ * Get user profile by ID or throw
3696
+ */
3697
+ getProfileOrThrow(profileId: string): Promise<UserProfile>;
3698
+ /**
3699
+ * Get user profile by auth provider ID
3700
+ *
3701
+ * @param authId - Auth provider user ID (Supabase, Clerk, etc.)
3702
+ * @returns User profile or null
3703
+ */
3704
+ getProfileByAuthId(authId: string): Promise<UserProfile | null>;
3705
+ /**
3706
+ * Get or create user profile (idempotent operation)
3707
+ * Useful for auth callbacks - ensures profile exists
3708
+ *
3709
+ * @param authId - Auth provider user ID
3710
+ * @param data - Profile data to create if doesn't exist
3711
+ * @returns Existing or newly created profile
3712
+ *
3713
+ * @example
3714
+ * ```typescript
3715
+ * // In Supabase auth callback
3716
+ * const profile = await service.getOrCreateProfile(
3717
+ * authUser.id,
3718
+ * {
3719
+ * tenantId: "tenant-123",
3720
+ * authId: authUser.id,
3721
+ * email: authUser.email,
3722
+ * role: "member",
3723
+ * status: "active"
3724
+ * }
3725
+ * );
3726
+ * ```
3727
+ */
3728
+ getOrCreateProfile(authId: string, data: CreateUserProfile): Promise<UserProfile>;
3729
+ /**
3730
+ * Update user profile
3731
+ */
3732
+ updateProfile(profileId: string, data: UpdateUserProfile): Promise<UserProfile>;
3733
+ /**
3734
+ * Delete user profile
3735
+ *
3736
+ * @param profileId - Profile UUID
3737
+ * @param options - Delete options
3738
+ */
3739
+ deleteProfile(profileId: string, options?: {
3740
+ checkAdmin?: boolean;
3741
+ }): Promise<void>;
3742
+ /**
3743
+ * List all user profiles for the tenant
3744
+ */
3745
+ listProfiles(options?: ListOptions): Promise<UserProfile[]>;
3746
+ /**
3747
+ * Update last login timestamp
3748
+ *
3749
+ * @param profileId - Profile UUID
3750
+ *
3751
+ * @example
3752
+ * ```typescript
3753
+ * // After successful auth
3754
+ * await service.updateLastLogin(profile.id);
3755
+ * ```
3756
+ */
3757
+ updateLastLogin(profileId: string): Promise<void>;
3758
+ /**
3759
+ * Change user role
3760
+ *
3761
+ * @param profileId - Profile UUID
3762
+ * @param newRole - New role
3763
+ */
3764
+ changeRole(profileId: string, newRole: string): Promise<UserProfile>;
3765
+ /**
3766
+ * Change user status
3767
+ *
3768
+ * @param profileId - Profile UUID
3769
+ * @param newStatus - New status
3770
+ */
3771
+ changeStatus(profileId: string, newStatus: "active" | "pending" | "inactive" | "suspended"): Promise<UserProfile>;
3772
+ /**
3773
+ * Get user by email
3774
+ */
3775
+ getProfileByEmail(email: string): Promise<UserProfile | null>;
3776
+ /**
3777
+ * Check if user has role
3778
+ */
3779
+ hasRole(profileId: string, role: string): Promise<boolean>;
3780
+ /**
3781
+ * Check if user is admin
3782
+ */
3783
+ isAdmin(profileId: string): Promise<boolean>;
3784
+ }
3785
+
3786
+ /**
3787
+ * Input for creating a custom view
3788
+ */
3789
+ interface CreateViewInput {
3790
+ name: string;
3791
+ label: string;
3792
+ objectName: string;
3793
+ description?: string;
3794
+ icon?: IconName;
3795
+ tabs: Tab[];
3796
+ default?: boolean;
3797
+ metadata?: Record<string, unknown>;
3798
+ }
3799
+ /**
3800
+ * Input for updating a view
3801
+ */
3802
+ interface UpdateViewInput {
3803
+ label?: string;
3804
+ description?: string;
3805
+ icon?: IconName;
3806
+ tabs?: Tab[];
3807
+ default?: boolean;
3808
+ metadata?: Record<string, unknown>;
3809
+ }
3810
+ /**
3811
+ * Service for managing views
3812
+ * Handles fusion of native views (from registry) and custom views (from database)
3813
+ */
3814
+ declare class ViewService {
3815
+ private adapter;
3816
+ private nativeViews;
3817
+ constructor(adapter: DatabaseAdapter, nativeViews: typeof viewRegistry);
3818
+ /**
3819
+ * Get all views for an object (native + custom)
3820
+ *
3821
+ * @param objectName - Object name
3822
+ * @param tenantId - Tenant ID
3823
+ * @returns All views for the object
3824
+ */
3825
+ getViewsForObject(objectName: string, tenantId: string): Promise<ViewDefinition[]>;
3826
+ /**
3827
+ * Get a specific view by name
3828
+ *
3829
+ * @param objectName - Object name
3830
+ * @param viewName - View name
3831
+ * @param tenantId - Tenant ID
3832
+ * @returns View definition or null
3833
+ */
3834
+ getView(objectName: string, viewName: string, tenantId: string): Promise<ViewDefinition | null>;
3835
+ /**
3836
+ * Get the default view for an object
3837
+ *
3838
+ * Priority:
3839
+ * 1. Custom view marked as default
3840
+ * 2. Native view marked as default
3841
+ * 3. First available view
3842
+ *
3843
+ * @param objectName - Object name
3844
+ * @param tenantId - Tenant ID
3845
+ * @returns Default view or null
3846
+ */
3847
+ getDefaultView(objectName: string, tenantId: string): Promise<ViewDefinition | null>;
3848
+ /**
3849
+ * Create a custom view
3850
+ *
3851
+ * @param input - View definition
3852
+ * @param tenantId - Tenant ID
3853
+ * @returns Created view
3854
+ */
3855
+ createView(input: CreateViewInput, tenantId: string): Promise<ViewDefinition>;
3856
+ /**
3857
+ * Update a custom view
3858
+ *
3859
+ * @param viewId - View ID
3860
+ * @param input - Update data
3861
+ * @returns Updated view
3862
+ */
3863
+ updateView(viewId: string, input: UpdateViewInput): Promise<ViewDefinition>;
3864
+ /**
3865
+ * Delete a custom view
3866
+ *
3867
+ * @param viewId - View ID
3868
+ */
3869
+ deleteView(viewId: string): Promise<void>;
3870
+ /**
3871
+ * Set a view as default for its object
3872
+ *
3873
+ * @param viewId - View ID
3874
+ * @param tenantId - Tenant ID
3875
+ * @returns Updated view
3876
+ */
3877
+ setDefaultView(viewId: string, tenantId: string): Promise<ViewDefinition>;
3878
+ /**
3879
+ * Validate view name format (kebab-case)
3880
+ */
3881
+ private validateViewName;
3882
+ /**
3883
+ * Convert database view to ViewDefinition
3884
+ */
3885
+ private convertDBViewToDefinition;
3886
+ }
3887
+
3888
+ /**
3889
+ * Result of view sync operation
3890
+ */
3891
+ interface ViewSyncResult {
3892
+ success: boolean;
3893
+ viewsSynced: number;
3894
+ viewsCreated: number;
3895
+ viewsUpdated: number;
3896
+ viewsDeleted: number;
3897
+ errors: Array<{
3898
+ viewName: string;
3899
+ objectName: string;
3900
+ error: string;
3901
+ }>;
3902
+ }
3903
+ /**
3904
+ * Options for view sync
3905
+ */
3906
+ interface ViewSyncOptions {
3907
+ dryRun?: boolean;
3908
+ verbose?: boolean;
3909
+ tenantId?: string;
3910
+ }
3911
+ /**
3912
+ * Sync native views from registry to database
3913
+ *
3914
+ * This function:
3915
+ * 1. Reads all registered native views from the registry
3916
+ * 2. Upserts them into the database (views table)
3917
+ * 3. Marks them as system=true for protection
3918
+ * 4. Removes views that were deleted from code
3919
+ *
3920
+ * @param adapter - Database adapter implementing DatabaseAdapter interface
3921
+ * @param nativeViewRegistry - Registry containing native views
3922
+ * @param options - Sync options (dryRun, verbose, tenantId)
3923
+ * @returns Sync result with statistics
3924
+ *
3925
+ * @example
3926
+ * ```typescript
3927
+ * import { syncNativeViews, viewRegistry } from "@andyoucreate/schema";
3928
+ * import { drizzleAdapter } from "./db/adapter";
3929
+ *
3930
+ * const result = await syncNativeViews(drizzleAdapter, viewRegistry, {
3931
+ * verbose: true,
3932
+ * tenantId: "default"
3933
+ * });
3934
+ *
3935
+ * if (result.success) {
3936
+ * console.log(`✓ Synced ${result.viewsSynced} views`);
3937
+ * }
3938
+ * ```
3939
+ */
3940
+ declare function syncNativeViews(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry, options?: ViewSyncOptions): Promise<ViewSyncResult>;
3941
+ /**
3942
+ * Verify that all native views are synced to database
3943
+ *
3944
+ * @param adapter - Database adapter
3945
+ * @param nativeViewRegistry - Registry containing native views
3946
+ * @returns true if all views are synced, false otherwise
3947
+ *
3948
+ * @example
3949
+ * ```typescript
3950
+ * const isSynced = await verifyNativeViewsSync(adapter, viewRegistry);
3951
+ * if (!isSynced) {
3952
+ * console.warn("Native views not synced, running sync...");
3953
+ * await syncNativeViews(adapter, viewRegistry);
3954
+ * }
3955
+ * ```
3956
+ */
3957
+ declare function verifyNativeViewsSync(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<boolean>;
3958
+ /**
3959
+ * Get sync preview without modifying database
3960
+ *
3961
+ * @param adapter - Database adapter
3962
+ * @param nativeViewRegistry - Registry containing native views
3963
+ * @returns Sync result (dry run)
3964
+ */
3965
+ declare function getViewSyncPreview(adapter: DatabaseAdapter, nativeViewRegistry: typeof viewRegistry): Promise<ViewSyncResult>;
3966
+
3967
+ /**
3968
+ * Result of sync operation
3969
+ */
3970
+ interface SyncResult {
3971
+ success: boolean;
3972
+ objectsSynced: number;
3973
+ attributesSynced: number;
3974
+ objectsCreated: number;
3975
+ objectsUpdated: number;
3976
+ attributesCreated: number;
3977
+ attributesUpdated: number;
3978
+ attributesDeleted: number;
3979
+ errors: Array<{
3980
+ objectName: string;
3981
+ error: string;
3982
+ }>;
3983
+ }
3984
+ /**
3985
+ * Sync options
3986
+ */
3987
+ interface SyncOptions {
3988
+ dryRun?: boolean;
3989
+ verbose?: boolean;
3990
+ tenantId?: string;
3991
+ }
3992
+ /**
3993
+ * Sync native objects from registry to database
3994
+ *
3995
+ * This function:
3996
+ * 1. Reads all registered native objects from the registry
3997
+ * 2. Upserts them into the database (objects + attributes tables)
3998
+ * 3. Marks them as system=true for protection
3999
+ * 4. Removes attributes that were deleted from code
4000
+ *
4001
+ * @param adapter - Database adapter implementing DatabaseAdapter interface
4002
+ * @param nativeRegistry - Registry containing native objects
4003
+ * @param options - Sync options (dryRun, verbose, tenantId)
4004
+ * @returns Sync result with statistics
4005
+ *
4006
+ * @example
4007
+ * ```typescript
4008
+ * import { syncNativeObjects } from "@andyoucreate/schema/runtime";
4009
+ * import { registry } from "./objects/native";
4010
+ * import { drizzleAdapter } from "./db/adapter";
4011
+ *
4012
+ * const result = await syncNativeObjects(drizzleAdapter, registry, {
4013
+ * verbose: true,
4014
+ * tenantId: "default"
4015
+ * });
4016
+ *
4017
+ * if (result.success) {
4018
+ * console.log(`✓ Synced ${result.objectsSynced} objects`);
4019
+ * } else {
4020
+ * console.error("Sync errors:", result.errors);
4021
+ * }
4022
+ * ```
4023
+ */
4024
+ declare function syncNativeObjects(adapter: DatabaseAdapter, nativeRegistry: typeof registry, options?: SyncOptions): Promise<SyncResult>;
4025
+ /**
4026
+ * Verify that all native objects are synced to database
4027
+ *
4028
+ * @param adapter - Database adapter
4029
+ * @param nativeRegistry - Registry containing native objects
4030
+ * @returns true if all objects are synced, false otherwise
4031
+ *
4032
+ * @example
4033
+ * ```typescript
4034
+ * const isSynced = await verifyNativeObjectsSync(adapter, registry);
4035
+ * if (!isSynced) {
4036
+ * console.warn("Native objects not synced, running sync...");
4037
+ * await syncNativeObjects(adapter, registry);
4038
+ * }
4039
+ * ```
4040
+ */
4041
+ declare function verifyNativeObjectsSync(adapter: DatabaseAdapter, nativeRegistry: typeof registry): Promise<boolean>;
4042
+ /**
4043
+ * Get sync statistics without modifying database
4044
+ *
4045
+ * @param adapter - Database adapter
4046
+ * @param nativeRegistry - Registry containing native objects
4047
+ * @returns Sync result (dry run)
4048
+ */
4049
+ declare function getSyncPreview(adapter: DatabaseAdapter, nativeRegistry: typeof registry): Promise<SyncResult>;
4050
+ /**
4051
+ * Result of full sync operation (objects + views)
4052
+ */
4053
+ interface FullSyncResult {
4054
+ success: boolean;
4055
+ objects: SyncResult;
4056
+ views: ViewSyncResult;
4057
+ }
4058
+ /**
4059
+ * Options for full sync
4060
+ */
4061
+ interface FullSyncOptions extends SyncOptions, ViewSyncOptions {
4062
+ }
4063
+ /**
4064
+ * Sync all native objects and views from registries to database
4065
+ *
4066
+ * This is a convenience function that:
4067
+ * 1. Syncs native objects first (views may depend on objects)
4068
+ * 2. Syncs native views
4069
+ *
4070
+ * @param adapter - Database adapter
4071
+ * @param objectRegistry - Registry containing native objects
4072
+ * @param nativeViewRegistry - Registry containing native views
4073
+ * @param options - Sync options
4074
+ * @returns Combined sync result
4075
+ *
4076
+ * @example
4077
+ * ```typescript
4078
+ * import { syncAll, registry, viewRegistry } from "@andyoucreate/schema";
4079
+ * import { adapter } from "./db";
4080
+ *
4081
+ * const result = await syncAll(adapter, registry, viewRegistry, {
4082
+ * verbose: true,
4083
+ * tenantId: "default"
4084
+ * });
4085
+ *
4086
+ * if (result.success) {
4087
+ * console.log(`✓ Synced ${result.objects.objectsSynced} objects, ${result.views.viewsSynced} views`);
4088
+ * }
4089
+ * ```
4090
+ */
4091
+ declare function syncAll(adapter: DatabaseAdapter, objectRegistry: typeof registry, nativeViewRegistry: typeof viewRegistry, options?: FullSyncOptions): Promise<FullSyncResult>;
4092
+
4093
+ /**
4094
+ * Default fallback value when expression resolves to empty string
4095
+ */
4096
+ declare const DEFAULT_LABEL_FALLBACK = "(Untitled)";
4097
+ /**
4098
+ * Render a label expression template with values
4099
+ *
4100
+ * Supports:
4101
+ * - Variable interpolation: `{{ fieldName }}`
4102
+ * - Dot notation: `{{ user.firstName }}`
4103
+ * - Pipes: `{{ name | UPPER }}`, `{{ name | capitalize | trim }}`
4104
+ *
4105
+ * @param template - The label expression template (e.g., "{{ firstName }} {{ lastName }}")
4106
+ * @param values - Record values to interpolate
4107
+ * @param fallback - Fallback value if result is empty (default: "(Untitled)")
4108
+ * @returns The rendered label string
4109
+ *
4110
+ * @example
4111
+ * ```typescript
4112
+ * const label = renderLabelExpression(
4113
+ * "{{ firstName }} {{ lastName | UPPER }}",
4114
+ * { firstName: "John", lastName: "Doe" }
4115
+ * );
4116
+ * // → "John DOE"
4117
+ *
4118
+ * // With missing values
4119
+ * const label = renderLabelExpression(
4120
+ * "{{ name }}",
4121
+ * { }
4122
+ * );
4123
+ * // → "(Untitled)"
4124
+ * ```
4125
+ */
4126
+ declare function renderLabelExpression(template: string, values: Record<string, unknown>, fallback?: string): string;
4127
+ /**
4128
+ * Check if a string is a valid label expression template
4129
+ * A valid template contains at least one {{ variable }} block with a non-empty variable
4130
+ */
4131
+ declare function isLabelExpression(value: string): boolean;
4132
+ /**
4133
+ * Extract attribute names referenced in a label expression
4134
+ * Useful for validation or dependency tracking
4135
+ *
4136
+ * @example
4137
+ * extractAttributeNames("{{ firstName }} {{ lastName | UPPER }}")
4138
+ * // → ["firstName", "lastName"]
4139
+ */
4140
+ declare function extractAttributeNames(template: string): string[];
4141
+
4142
+ export { type Timestamps as $, type Attribute as A, type BaseAttribute as B, type Currency as C, type DateAttribute as D, type StorageProvider as E, type FileAttribute as F, type Group as G, type FileVisibility as H, type File as I, type CreateFile as J, type UpdateFile as K, type Location as L, type MultiselectAttribute as M, type NumberAttribute as N, type Option as O, type Phone as P, type GeocodingSuggestion as Q, type RelationOnDelete as R, type StatusAttribute as S, type TextAttribute as T, type UserAttribute as U, type ViewDefinition as V, type GeocodingAutocompleteParams as W, type ReverseGeocodingParams as X, type GeocodingParams as Y, type GeocodingAdapter as Z, NoopGeocodingAdapter as _, type SelectAttribute as a, validateAttribute as a$, type ObjectAttribute as a0, type CompletionStatus as a1, type ObjectRecord as a2, type UserRole as a3, type UserStatus as a4, type UserProfile as a5, type CreateUserProfile as a6, type UpdateUserProfile as a7, type GroupDisplayMode 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 Tab as n, type AttributeType as o, type StatusGroup as p, type AttributeGroup as q, type NumberUnit as r, type DateFormat as s, type DateValue as t, type LocationGranularity as u, type DocumentType as v, type DocumentFace as w, type DocumentTypeConfig as x, type FileVerificationConfig as y, type RelationAttribute as z };