@stndrds/schema 1.0.0-alpha.263 → 1.0.0-alpha.265

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 (59) hide show
  1. package/dist/{attributes-_6tvjbyl.d.ts → attributes-_b3Db8vT.d.ts} +1 -23
  2. package/dist/{attributes-Cmkc7UgJ.d.mts → attributes-lBLiOIY3.d.mts} +1 -23
  3. package/dist/chunk-NGGU6BSN.mjs +216 -0
  4. package/dist/chunk-NI3HCSYH.js +229 -0
  5. package/dist/{chunk-54WDPQ6R.mjs → chunk-QIWADKYA.mjs} +12 -216
  6. package/dist/{chunk-TS3PJOMZ.js → chunk-ZBQEMIAV.js} +11 -227
  7. package/dist/exceptions.d.mts +458 -0
  8. package/dist/exceptions.d.ts +458 -0
  9. package/dist/exceptions.js +154 -0
  10. package/dist/exceptions.mjs +1 -0
  11. package/dist/{helpers-BTC6TsKH.d.ts → helpers-eyrnPJEF.d.ts} +4 -39
  12. package/dist/{helpers-BO10yqih.d.mts → helpers-uKLet0kF.d.mts} +4 -39
  13. package/dist/index.d.mts +150 -476
  14. package/dist/index.d.ts +150 -476
  15. package/dist/index.js +238 -139
  16. package/dist/index.mjs +131 -35
  17. package/dist/migrations-BXd2ZGfM.d.mts +39 -0
  18. package/dist/migrations-DcuJZ8qO.d.ts +39 -0
  19. package/dist/{types-CVswgCx9.d.mts → types-DNz3ITS-.d.mts} +1 -1
  20. package/dist/{types-B_UZK_6m.d.ts → types-DqLi1tx1.d.ts} +1 -1
  21. package/dist/validation/all.d.mts +4 -3
  22. package/dist/validation/all.d.ts +4 -3
  23. package/dist/validation/all.js +10 -9
  24. package/dist/validation/all.mjs +4 -3
  25. package/dist/validation/complex/currency.d.mts +2 -2
  26. package/dist/validation/complex/currency.d.ts +2 -2
  27. package/dist/validation/complex/location.d.mts +2 -2
  28. package/dist/validation/complex/location.d.ts +2 -2
  29. package/dist/validation/complex/phone.d.mts +2 -2
  30. package/dist/validation/complex/phone.d.ts +2 -2
  31. package/dist/validation/complex/relation.d.mts +2 -2
  32. package/dist/validation/complex/relation.d.ts +2 -2
  33. package/dist/validation/complex/richtext.d.mts +2 -2
  34. package/dist/validation/complex/richtext.d.ts +2 -2
  35. package/dist/validation/complex/select.d.mts +2 -2
  36. package/dist/validation/complex/select.d.ts +2 -2
  37. package/dist/validation/complex/user.d.mts +2 -2
  38. package/dist/validation/complex/user.d.ts +2 -2
  39. package/dist/validation/computed/formula.d.mts +2 -2
  40. package/dist/validation/computed/formula.d.ts +2 -2
  41. package/dist/validation/computed/rollup.d.mts +2 -2
  42. package/dist/validation/computed/rollup.d.ts +2 -2
  43. package/dist/validation/config/index.d.mts +1 -1
  44. package/dist/validation/config/index.d.ts +1 -1
  45. package/dist/validation/core/index.d.mts +3 -3
  46. package/dist/validation/core/index.d.ts +3 -3
  47. package/dist/validation/object/index.d.mts +5 -4
  48. package/dist/validation/object/index.d.ts +5 -4
  49. package/dist/validation/object/index.js +16 -15
  50. package/dist/validation/object/index.mjs +4 -3
  51. package/dist/validation/primitives/checkbox.d.mts +2 -2
  52. package/dist/validation/primitives/checkbox.d.ts +2 -2
  53. package/dist/validation/primitives/date.d.mts +2 -2
  54. package/dist/validation/primitives/date.d.ts +2 -2
  55. package/dist/validation/primitives/number.d.mts +2 -2
  56. package/dist/validation/primitives/number.d.ts +2 -2
  57. package/dist/validation/primitives/text.d.mts +2 -2
  58. package/dist/validation/primitives/text.d.ts +2 -2
  59. package/package.json +7 -2
@@ -0,0 +1,458 @@
1
+ import { S as SchemaOperation } from './migrations-DcuJZ8qO.js';
2
+ import './attributes-_b3Db8vT.js';
3
+ import '@stndrds/constants';
4
+ import './utils.js';
5
+
6
+ /**
7
+ * Error codes for schema exceptions
8
+ */
9
+ declare const SchemaErrorCode: {
10
+ readonly UNKNOWN: "SCHEMA_UNKNOWN_ERROR";
11
+ readonly OBJECT_NOT_FOUND: "SCHEMA_OBJECT_NOT_FOUND";
12
+ readonly ATTRIBUTE_NOT_FOUND: "SCHEMA_ATTRIBUTE_NOT_FOUND";
13
+ readonly RECORD_NOT_FOUND: "SCHEMA_RECORD_NOT_FOUND";
14
+ readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
15
+ readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
16
+ readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
17
+ readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
18
+ readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
19
+ readonly PROTECTED_OBJECT: "SCHEMA_PROTECTED_OBJECT";
20
+ readonly PROTECTED_ATTRIBUTE: "SCHEMA_PROTECTED_ATTRIBUTE";
21
+ readonly PROTECTED_VIEW: "SCHEMA_PROTECTED_VIEW";
22
+ readonly PROTECTED_ROLE: "SCHEMA_PROTECTED_ROLE";
23
+ readonly FORBIDDEN: "SCHEMA_FORBIDDEN";
24
+ readonly ACCESS_DENIED: "SCHEMA_ACCESS_DENIED";
25
+ readonly CONNECTOR_AUTH_FAILED: "SCHEMA_CONNECTOR_AUTH_FAILED";
26
+ readonly CONNECTOR_INVALID_STATE: "SCHEMA_CONNECTOR_INVALID_STATE";
27
+ readonly SYNC_FAILED: "SCHEMA_SYNC_FAILED";
28
+ readonly SYNC_CONFLICT: "SCHEMA_SYNC_CONFLICT";
29
+ readonly SYNC_CASCADE: "SCHEMA_SYNC_CASCADE";
30
+ readonly ORPHAN_SYSTEM_ATTRIBUTE: "SCHEMA_ORPHAN_SYSTEM_ATTRIBUTE";
31
+ readonly SYSTEM_ENTITY_IMMUTABLE: "SCHEMA_SYSTEM_ENTITY_IMMUTABLE";
32
+ readonly DESTRUCTIVE_NOT_ALLOWED: "SCHEMA_DESTRUCTIVE_NOT_ALLOWED";
33
+ readonly MIGRATION_TIMEOUT: "SCHEMA_MIGRATION_TIMEOUT";
34
+ readonly CHANGE_TYPE_NOT_SUPPORTED: "SCHEMA_CHANGE_TYPE_NOT_SUPPORTED";
35
+ readonly DUPLICATE: "SCHEMA_DUPLICATE";
36
+ readonly DUPLICATE_OBJECT: "SCHEMA_DUPLICATE_OBJECT";
37
+ readonly DUPLICATE_ATTRIBUTE: "SCHEMA_DUPLICATE_ATTRIBUTE";
38
+ readonly CONFLICT: "SCHEMA_CONFLICT";
39
+ readonly STORAGE_UPLOAD_FAILED: "SCHEMA_STORAGE_UPLOAD_FAILED";
40
+ readonly STORAGE_DOWNLOAD_FAILED: "SCHEMA_STORAGE_DOWNLOAD_FAILED";
41
+ readonly STORAGE_DELETE_FAILED: "SCHEMA_STORAGE_DELETE_FAILED";
42
+ readonly STORAGE_URL_FAILED: "SCHEMA_STORAGE_URL_FAILED";
43
+ readonly REPOSITORY_CREATE_FAILED: "SCHEMA_REPOSITORY_CREATE_FAILED";
44
+ readonly REPOSITORY_UPDATE_FAILED: "SCHEMA_REPOSITORY_UPDATE_FAILED";
45
+ readonly REPOSITORY_DELETE_FAILED: "SCHEMA_REPOSITORY_DELETE_FAILED";
46
+ readonly REPOSITORY_QUERY_FAILED: "SCHEMA_REPOSITORY_QUERY_FAILED";
47
+ readonly NOT_IMPLEMENTED: "SCHEMA_NOT_IMPLEMENTED";
48
+ readonly TIMEOUT: "SCHEMA_TIMEOUT";
49
+ readonly RECORD_REFERENCED: "SCHEMA_RECORD_REFERENCED";
50
+ readonly ATTRIBUTE_IN_USE: "SCHEMA_ATTRIBUTE_IN_USE";
51
+ readonly OBJECT_REFERENCED: "SCHEMA_OBJECT_REFERENCED";
52
+ readonly CONFIGURATION_REQUIRED: "CONFIGURATION_REQUIRED";
53
+ readonly SEARCH_ADAPTER_REQUIRED: "SEARCH_ADAPTER_REQUIRED";
54
+ readonly SEARCH_BACKEND_FAILED: "SEARCH_BACKEND_FAILED";
55
+ readonly INVARIANT_VIOLATION: "INVARIANT_VIOLATION";
56
+ readonly TENANT_CONTEXT_MISSING: "TENANT_CONTEXT_MISSING";
57
+ readonly FEATURE_FLAGS_CONTEXT: "FEATURE_FLAGS_CONTEXT";
58
+ readonly AGENT_UNKNOWN: "AGENT_UNKNOWN";
59
+ readonly AGENT_DEPTH_EXCEEDED: "AGENT_DEPTH_EXCEEDED";
60
+ readonly AGENT_COST_LIMIT_EXCEEDED: "AGENT_COST_LIMIT_EXCEEDED";
61
+ readonly AGENT_TREE_COST_LIMIT_EXCEEDED: "AGENT_TREE_COST_LIMIT_EXCEEDED";
62
+ readonly AGENT_SESSION_NOT_FOUND: "AGENT_SESSION_NOT_FOUND";
63
+ readonly AGENT_DEFINITION_NOT_FOUND: "AGENT_DEFINITION_NOT_FOUND";
64
+ readonly AGENT_RUN_CONFIG: "AGENT_RUN_CONFIG";
65
+ readonly AGENT_STREAMING: "AGENT_STREAMING";
66
+ readonly AGENT_MISSING_ACTOR: "AGENT_MISSING_ACTOR";
67
+ readonly AGENT_INVALID_STATE: "AGENT_INVALID_STATE";
68
+ readonly AGENT_COMPACTION_IMPOSSIBLE: "AGENT_COMPACTION_IMPOSSIBLE";
69
+ readonly AGENT_COMPACTION_TIMEOUT: "AGENT_COMPACTION_TIMEOUT";
70
+ readonly AGENT_LEASE_HELD: "AGENT_LEASE_HELD";
71
+ readonly AGENT_MISSION_CONFLICT: "AGENT_MISSION_CONFLICT";
72
+ readonly AGENT_MISSION_INCOMPLETE: "AGENT_MISSION_INCOMPLETE";
73
+ readonly AI_UNKNOWN: "AI_UNKNOWN";
74
+ readonly AI_USAGE_LIMIT_EXCEEDED: "AI_USAGE_LIMIT_EXCEEDED";
75
+ readonly AI_INVALID_USAGE: "AI_INVALID_USAGE";
76
+ readonly AI_INVALID_MODEL: "AI_INVALID_MODEL";
77
+ readonly AI_REPOSITORY_ERROR: "AI_REPOSITORY_ERROR";
78
+ readonly AI_GENERATION_FAILED: "AI_GENERATION_FAILED";
79
+ readonly DOCUMENT_MIME_NOT_ACCEPTED: "DOCUMENT_MIME_NOT_ACCEPTED";
80
+ readonly DOCUMENT_MULTIPLE_NOT_ALLOWED: "DOCUMENT_MULTIPLE_NOT_ALLOWED";
81
+ readonly DOCUMENT_NOT_FOUND_FOR_OPERATION: "DOCUMENT_NOT_FOUND_FOR_OPERATION";
82
+ readonly DOCUMENT_STORAGE_FAILED: "DOCUMENT_STORAGE_FAILED";
83
+ readonly DOCUMENT_SIZE_EXCEEDED: "DOCUMENT_SIZE_EXCEEDED";
84
+ readonly DOCUMENT_OCR_FAILED: "DOCUMENT_OCR_FAILED";
85
+ readonly DOCUMENT_FILE_TOO_LARGE: "DOCUMENT_FILE_TOO_LARGE";
86
+ readonly DOCUMENT_FILE_NOT_FOUND: "DOCUMENT_FILE_NOT_FOUND";
87
+ readonly DOCUMENT_RECORD_NOT_FOUND: "DOCUMENT_RECORD_NOT_FOUND";
88
+ readonly DOCUMENT_RECORD_OBJECT_MISMATCH: "DOCUMENT_RECORD_OBJECT_MISMATCH";
89
+ readonly DOCUMENT_FOLDER_SERVICE_UNAVAILABLE: "DOCUMENT_FOLDER_SERVICE_UNAVAILABLE";
90
+ readonly DOCUMENT_FOLDER_PATH_NOT_FOUND: "DOCUMENT_FOLDER_PATH_NOT_FOUND";
91
+ readonly EMAIL_IMAGE_PROXY_INVALID_TOKEN: "EMAIL_IMAGE_PROXY_INVALID_TOKEN";
92
+ readonly EMAIL_IMAGE_PROXY_EXPIRED_TOKEN: "EMAIL_IMAGE_PROXY_EXPIRED_TOKEN";
93
+ readonly EMAIL_IMAGE_PROXY_TOO_LARGE: "EMAIL_IMAGE_PROXY_TOO_LARGE";
94
+ readonly EMAIL_IMAGE_PROXY_UNSUPPORTED_CONTENT_TYPE: "EMAIL_IMAGE_PROXY_UNSUPPORTED_CONTENT_TYPE";
95
+ readonly EMAIL_IMAGE_PROXY_UNSAFE_URL: "EMAIL_IMAGE_PROXY_UNSAFE_URL";
96
+ readonly EMAIL_IMAGE_PROXY_UPSTREAM_FAILED: "EMAIL_IMAGE_PROXY_UPSTREAM_FAILED";
97
+ readonly EMAIL_PROVIDER_API_FAILED: "EMAIL_PROVIDER_API_FAILED";
98
+ readonly EMAIL_BATCH_ITEM_FAILED: "EMAIL_BATCH_ITEM_FAILED";
99
+ readonly REFLEX_INVALID_TRANSITION: "REFLEX_INVALID_TRANSITION";
100
+ readonly REFLEX_INVALID_TOKEN: "REFLEX_INVALID_TOKEN";
101
+ readonly REFLEX_CAPABILITY_DENIED: "REFLEX_CAPABILITY_DENIED";
102
+ readonly REFLEX_GATEWAY_UNAVAILABLE: "REFLEX_GATEWAY_UNAVAILABLE";
103
+ readonly REFLEX_BUNDLE_FAILED: "REFLEX_BUNDLE_FAILED";
104
+ readonly REFLEX_EGRESS_DENIED: "REFLEX_EGRESS_DENIED";
105
+ readonly REFLEX_PROTOCOL_VIOLATION: "REFLEX_PROTOCOL_VIOLATION";
106
+ readonly REFLEX_RUN_FAILED: "REFLEX_RUN_FAILED";
107
+ readonly REFLEX_RUN_TIMEOUT: "REFLEX_RUN_TIMEOUT";
108
+ };
109
+ type SchemaErrorCode = (typeof SchemaErrorCode)[keyof typeof SchemaErrorCode];
110
+ /**
111
+ * Base error class for all schema-related errors
112
+ */
113
+ declare class SchemaError extends Error {
114
+ readonly code: SchemaErrorCode;
115
+ readonly details?: Record<string, unknown>;
116
+ constructor(message: string, code?: SchemaErrorCode, details?: Record<string, unknown>);
117
+ toJSON(): {
118
+ name: string;
119
+ code: SchemaErrorCode;
120
+ message: string;
121
+ details: Record<string, unknown> | undefined;
122
+ };
123
+ }
124
+ /**
125
+ * Base class for "not found" errors
126
+ */
127
+ declare class NotFoundError extends SchemaError {
128
+ readonly resourceType: string;
129
+ readonly resourceId: string;
130
+ constructor(resourceType: string, resourceId: string, code?: SchemaErrorCode, message?: string);
131
+ }
132
+ /**
133
+ * Object not found error
134
+ */
135
+ declare class ObjectNotFoundError extends NotFoundError {
136
+ constructor(objectId: string);
137
+ }
138
+ /**
139
+ * Attribute not found error
140
+ */
141
+ declare class AttributeNotFoundError extends NotFoundError {
142
+ constructor(attributeId: string);
143
+ }
144
+ /**
145
+ * Record not found error
146
+ */
147
+ declare class RecordNotFoundError extends NotFoundError {
148
+ constructor(recordId: string);
149
+ }
150
+ /**
151
+ * Validation error with field-level details
152
+ */
153
+ interface ValidationErrorDetail {
154
+ path: string[];
155
+ message: string;
156
+ code?: string;
157
+ }
158
+ /**
159
+ * Validation error thrown when data fails schema validation
160
+ */
161
+ declare class ValidationError extends SchemaError {
162
+ readonly errors: ValidationErrorDetail[];
163
+ constructor(message: string, errors: ValidationErrorDetail[]);
164
+ /**
165
+ * Create a validation error from Zod-style errors
166
+ */
167
+ static fromZodErrors(errors: Array<{
168
+ path: (string | number)[];
169
+ message: string;
170
+ }>): ValidationError;
171
+ }
172
+ /**
173
+ * Error thrown when attempting to modify a protected (system) resource
174
+ */
175
+ declare class ProtectedResourceError extends SchemaError {
176
+ readonly resourceType: "object" | "attribute" | "view";
177
+ readonly resourceName: string;
178
+ readonly operation: "delete" | "modify";
179
+ constructor(resourceType: "object" | "attribute" | "view", resourceName: string, operation: "delete" | "modify");
180
+ }
181
+ /**
182
+ * Error thrown during native object synchronization
183
+ */
184
+ declare class SyncError extends SchemaError {
185
+ readonly objectName: string;
186
+ readonly cause?: Error;
187
+ constructor(objectName: string, message: string, cause?: Error);
188
+ }
189
+ /**
190
+ * Thrown when code tries to mutate a system entity at runtime.
191
+ * System entities are declared in code and immutable at runtime.
192
+ * HTTP status: 403 Forbidden.
193
+ */
194
+ declare class SystemEntityImmutableError extends SchemaError {
195
+ readonly entityType: string;
196
+ readonly entityName: string;
197
+ constructor(entityType: string, entityName: string);
198
+ }
199
+ interface SyncConflictParams {
200
+ objectName: string;
201
+ attributeName?: string;
202
+ reason: string;
203
+ }
204
+ /**
205
+ * Thrown at boot when an auto-promote cannot proceed due to incompatible types
206
+ * or constraints. The dev must resolve manually (relax constraints, migrate
207
+ * values, or rename).
208
+ */
209
+ declare class SyncConflictError extends SchemaError {
210
+ readonly objectName: string;
211
+ readonly attributeName?: string;
212
+ readonly reason: string;
213
+ constructor(params: SyncConflictParams);
214
+ }
215
+ /**
216
+ * Thrown at boot when an object is being demoted but still has system attributes
217
+ * declared in code. The dev forgot to remove those attributes too, or kept the
218
+ * object inconsistently.
219
+ */
220
+ declare class SyncCascadeError extends SchemaError {
221
+ readonly objectName: string;
222
+ readonly conflictingAttributes: string[];
223
+ constructor(objectName: string, conflictingAttributes: string[]);
224
+ }
225
+ /**
226
+ * Thrown at boot when an attribute is system:true but its object parent is
227
+ * system:false. This invariant should never be violated — if seen, it's a bug
228
+ * in the boot reconciliation logic or in a manual DB mutation.
229
+ */
230
+ declare class OrphanSystemAttributeError extends SchemaError {
231
+ readonly objectName: string;
232
+ readonly attributeName: string;
233
+ constructor(objectName: string, attributeName: string);
234
+ }
235
+ /**
236
+ * Thrown at boot when destructive operations (remove_attribute, remove_object)
237
+ * are detected without the explicit STANDARDS_ALLOW_DESTRUCTIVE_SYNC=1 env var.
238
+ * HTTP status: 500 (boot fail, should never surface to HTTP).
239
+ *
240
+ * NOTE — Wiring status (L2 — 2026-05-17): defined but not thrown by the
241
+ * current sync.ts. Sync uses STANDARDS_ALLOW_DESTRUCTIVE_SYNC env var to gate
242
+ * destructive ops; without the flag, attributes/objects are demoted to runtime
243
+ * (L1 default, data preserved), not deleted. This error class is reserved for
244
+ * L3a CLI which will throw it when CI detects unauthorized destructive deployments.
245
+ */
246
+ declare class DestructiveSyncNotAllowedError extends SchemaError {
247
+ readonly operations: SchemaOperation[];
248
+ constructor(operations: SchemaOperation[]);
249
+ }
250
+ /**
251
+ * Thrown at boot when applying a migration in batches exceeds the maximum
252
+ * allowed duration (default 5 min, configurable via STANDARDS_MIGRATION_MAX_DURATION_MS).
253
+ * HTTP status: 500 (boot fail).
254
+ */
255
+ declare class MigrationTimeoutError extends SchemaError {
256
+ readonly objectName: string;
257
+ readonly migrated: number;
258
+ readonly total: number;
259
+ readonly maxDurationMs: number;
260
+ constructor(objectName: string, migrated: number, total: number, maxDurationMs: number);
261
+ }
262
+ /**
263
+ * Thrown when the runtime admin API is called to change an attribute's type.
264
+ * Type changes must be declared in code via `.migration(N, m => m.changeType(...))`.
265
+ * HTTP status: 400 Bad Request.
266
+ */
267
+ declare class ChangeTypeNotSupportedError extends SchemaError {
268
+ readonly objectName: string;
269
+ readonly attributeName: string;
270
+ constructor(objectName: string, attributeName: string);
271
+ }
272
+ /**
273
+ * Error thrown when attempting to create a duplicate resource.
274
+ *
275
+ * `resourceType` is free-form: pass `"object"`/`"attribute"` for schema
276
+ * resources (a specific code is selected automatically), or any domain label
277
+ * (`"tool"`, `"background job handler"`, …) for runtime registries, which fall
278
+ * back to the generic `DUPLICATE` code. The default message is
279
+ * `'<ResourceType> "<name>" already exists'`; pass a custom message when the
280
+ * domain reads better with different wording (e.g. "already registered for
281
+ * type X").
282
+ */
283
+ declare class DuplicateError extends SchemaError {
284
+ readonly resourceType: string;
285
+ readonly resourceName: string;
286
+ constructor(resourceType: string, resourceName: string, message?: string);
287
+ }
288
+ /**
289
+ * Check if an error is a SchemaError
290
+ */
291
+ declare function isSchemaError(error: unknown): error is SchemaError;
292
+ /**
293
+ * Check if an error is a NotFoundError
294
+ */
295
+ declare function isNotFoundError(error: unknown): error is NotFoundError;
296
+ /**
297
+ * Check if an error is a ValidationError
298
+ */
299
+ declare function isValidationError(error: unknown): error is ValidationError;
300
+ /**
301
+ * Check if an error is a ProtectedResourceError
302
+ */
303
+ declare function isProtectedResourceError(error: unknown): error is ProtectedResourceError;
304
+ /**
305
+ * Error thrown when a user lacks permission to perform an action
306
+ */
307
+ declare class ForbiddenError extends SchemaError {
308
+ readonly objectName: string;
309
+ readonly action: string;
310
+ readonly userId?: string;
311
+ constructor(objectName: string, action: string, userId?: string);
312
+ }
313
+ /**
314
+ * Error thrown when trying to modify a protected role
315
+ */
316
+ declare class ProtectedRoleError extends SchemaError {
317
+ readonly roleName: string;
318
+ readonly operation: "delete" | "modify";
319
+ constructor(roleName: string, operation: "delete" | "modify");
320
+ }
321
+ /**
322
+ * Role not found error
323
+ */
324
+ declare class RoleNotFoundError extends NotFoundError {
325
+ constructor(roleId: string);
326
+ }
327
+ /**
328
+ * Thrown when a record has been modified by another request between read and write.
329
+ * Clients should retry the operation with fresh data.
330
+ * Maps to HTTP 409 Conflict.
331
+ */
332
+ declare class ConcurrentModificationError extends SchemaError {
333
+ constructor(recordId: string);
334
+ }
335
+ /**
336
+ * Storage operation type for error context
337
+ */
338
+ type StorageOperation = "upload" | "download" | "delete" | "signedUrl";
339
+ /**
340
+ * Error thrown when a storage operation fails
341
+ */
342
+ declare class StorageError extends SchemaError {
343
+ readonly operation: StorageOperation;
344
+ readonly path?: string;
345
+ readonly cause?: string;
346
+ constructor(operation: StorageOperation, message: string, path?: string, cause?: string);
347
+ }
348
+ /**
349
+ * Error thrown when access to a resource is denied (e.g., tenant path mismatch)
350
+ */
351
+ declare class AccessDeniedError extends SchemaError {
352
+ readonly resource: string;
353
+ readonly reason?: string;
354
+ constructor(resource: string, reason?: string);
355
+ }
356
+ /**
357
+ * Repository operation type for error context
358
+ */
359
+ type RepositoryOperation = "create" | "update" | "delete" | "query";
360
+ /**
361
+ * Error thrown when a repository operation fails
362
+ */
363
+ declare class RepositoryError extends SchemaError {
364
+ readonly operation: RepositoryOperation;
365
+ readonly entity: string;
366
+ readonly cause?: string;
367
+ constructor(operation: RepositoryOperation, entity: string, message: string, cause?: string);
368
+ }
369
+ /**
370
+ * Error thrown when a search read call fails at the transport level — e.g. the
371
+ * Meili client received a non-JSON body (`JSON.parse` SyntaxError) or a network
372
+ * failure. Translates an otherwise un-fingerprintable bare exception into a
373
+ * typed error with a stable `code` and a user-safe message. The original
374
+ * failure text is preserved in `cause`/`details`, never in the message.
375
+ */
376
+ declare class SearchBackendError extends SchemaError {
377
+ readonly scope: string;
378
+ readonly cause?: string;
379
+ constructor(scope: string, cause?: string);
380
+ }
381
+ /**
382
+ * Error thrown when a feature or method is not yet implemented
383
+ */
384
+ declare class NotImplementedError extends SchemaError {
385
+ readonly feature: string;
386
+ readonly milestone?: string;
387
+ constructor(feature: string, milestone?: string);
388
+ }
389
+ /**
390
+ * Memory entry not found error
391
+ */
392
+ declare class MemoryNotFoundError extends NotFoundError {
393
+ constructor(memoryId: string);
394
+ }
395
+ /**
396
+ * Reference information for a record that is blocking deletion.
397
+ */
398
+ interface RecordReference {
399
+ /** Technical name of the object (e.g., "contacts") */
400
+ objectName: string;
401
+ /** Display label of the object (e.g., "Contacts") */
402
+ objectLabel: string;
403
+ /** Number of records referencing the target */
404
+ count: number;
405
+ }
406
+ /**
407
+ * Thrown when attempting to delete a record that is referenced by other records.
408
+ *
409
+ * This implements the "Restrict" behavior: deletion is blocked and the user
410
+ * must first remove or update the referencing records.
411
+ */
412
+ declare class RecordReferencedError extends SchemaError {
413
+ readonly recordId: string;
414
+ readonly references: RecordReference[];
415
+ constructor(recordId: string, references: RecordReference[]);
416
+ }
417
+ /**
418
+ * Usage context where an attribute is being used.
419
+ */
420
+ type AttributeUsage = "labelExpression" | "embeddingExpression" | "view" | "filter";
421
+ /**
422
+ * Thrown when attempting to delete an attribute that is in use.
423
+ *
424
+ * Attributes cannot be deleted if they are referenced in:
425
+ * - The object's labelExpression template
426
+ * - A saved view's column configuration
427
+ * - A saved filter condition
428
+ */
429
+ declare class AttributeInUseError extends SchemaError {
430
+ readonly attributeName: string;
431
+ readonly usage: AttributeUsage;
432
+ constructor(attributeName: string, usage: AttributeUsage);
433
+ }
434
+ /**
435
+ * Thrown when attempting to delete an object that is a relation target.
436
+ *
437
+ * Objects cannot be deleted if other objects have relation attributes
438
+ * pointing to them as a target.
439
+ */
440
+ declare class ObjectReferencedError extends SchemaError {
441
+ readonly objectName: string;
442
+ readonly referencingObjects: string[];
443
+ constructor(objectName: string, referencingObjects: string[]);
444
+ }
445
+ /**
446
+ * Check if an error is a RecordReferencedError
447
+ */
448
+ declare function isRecordReferencedError(error: unknown): error is RecordReferencedError;
449
+ /**
450
+ * Check if an error is an AttributeInUseError
451
+ */
452
+ declare function isAttributeInUseError(error: unknown): error is AttributeInUseError;
453
+ /**
454
+ * Check if an error is an ObjectReferencedError
455
+ */
456
+ declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
457
+
458
+ export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, type AttributeUsage, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, type RecordReference, RecordReferencedError, RepositoryError, type RepositoryOperation, RoleNotFoundError, SchemaError, SchemaErrorCode, SearchBackendError, StorageError, type StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, type ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
@@ -0,0 +1,154 @@
1
+ 'use strict';
2
+
3
+ var chunkZBQEMIAV_js = require('./chunk-ZBQEMIAV.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "AccessDeniedError", {
8
+ enumerable: true,
9
+ get: function () { return chunkZBQEMIAV_js.AccessDeniedError; }
10
+ });
11
+ Object.defineProperty(exports, "AttributeInUseError", {
12
+ enumerable: true,
13
+ get: function () { return chunkZBQEMIAV_js.AttributeInUseError; }
14
+ });
15
+ Object.defineProperty(exports, "AttributeNotFoundError", {
16
+ enumerable: true,
17
+ get: function () { return chunkZBQEMIAV_js.AttributeNotFoundError; }
18
+ });
19
+ Object.defineProperty(exports, "ChangeTypeNotSupportedError", {
20
+ enumerable: true,
21
+ get: function () { return chunkZBQEMIAV_js.ChangeTypeNotSupportedError; }
22
+ });
23
+ Object.defineProperty(exports, "ConcurrentModificationError", {
24
+ enumerable: true,
25
+ get: function () { return chunkZBQEMIAV_js.ConcurrentModificationError; }
26
+ });
27
+ Object.defineProperty(exports, "DestructiveSyncNotAllowedError", {
28
+ enumerable: true,
29
+ get: function () { return chunkZBQEMIAV_js.DestructiveSyncNotAllowedError; }
30
+ });
31
+ Object.defineProperty(exports, "DuplicateError", {
32
+ enumerable: true,
33
+ get: function () { return chunkZBQEMIAV_js.DuplicateError; }
34
+ });
35
+ Object.defineProperty(exports, "ForbiddenError", {
36
+ enumerable: true,
37
+ get: function () { return chunkZBQEMIAV_js.ForbiddenError; }
38
+ });
39
+ Object.defineProperty(exports, "MemoryNotFoundError", {
40
+ enumerable: true,
41
+ get: function () { return chunkZBQEMIAV_js.MemoryNotFoundError; }
42
+ });
43
+ Object.defineProperty(exports, "MigrationTimeoutError", {
44
+ enumerable: true,
45
+ get: function () { return chunkZBQEMIAV_js.MigrationTimeoutError; }
46
+ });
47
+ Object.defineProperty(exports, "NotFoundError", {
48
+ enumerable: true,
49
+ get: function () { return chunkZBQEMIAV_js.NotFoundError; }
50
+ });
51
+ Object.defineProperty(exports, "NotImplementedError", {
52
+ enumerable: true,
53
+ get: function () { return chunkZBQEMIAV_js.NotImplementedError; }
54
+ });
55
+ Object.defineProperty(exports, "ObjectNotFoundError", {
56
+ enumerable: true,
57
+ get: function () { return chunkZBQEMIAV_js.ObjectNotFoundError; }
58
+ });
59
+ Object.defineProperty(exports, "ObjectReferencedError", {
60
+ enumerable: true,
61
+ get: function () { return chunkZBQEMIAV_js.ObjectReferencedError; }
62
+ });
63
+ Object.defineProperty(exports, "OrphanSystemAttributeError", {
64
+ enumerable: true,
65
+ get: function () { return chunkZBQEMIAV_js.OrphanSystemAttributeError; }
66
+ });
67
+ Object.defineProperty(exports, "ProtectedResourceError", {
68
+ enumerable: true,
69
+ get: function () { return chunkZBQEMIAV_js.ProtectedResourceError; }
70
+ });
71
+ Object.defineProperty(exports, "ProtectedRoleError", {
72
+ enumerable: true,
73
+ get: function () { return chunkZBQEMIAV_js.ProtectedRoleError; }
74
+ });
75
+ Object.defineProperty(exports, "RecordNotFoundError", {
76
+ enumerable: true,
77
+ get: function () { return chunkZBQEMIAV_js.RecordNotFoundError; }
78
+ });
79
+ Object.defineProperty(exports, "RecordReferencedError", {
80
+ enumerable: true,
81
+ get: function () { return chunkZBQEMIAV_js.RecordReferencedError; }
82
+ });
83
+ Object.defineProperty(exports, "RepositoryError", {
84
+ enumerable: true,
85
+ get: function () { return chunkZBQEMIAV_js.RepositoryError; }
86
+ });
87
+ Object.defineProperty(exports, "RoleNotFoundError", {
88
+ enumerable: true,
89
+ get: function () { return chunkZBQEMIAV_js.RoleNotFoundError; }
90
+ });
91
+ Object.defineProperty(exports, "SchemaError", {
92
+ enumerable: true,
93
+ get: function () { return chunkZBQEMIAV_js.SchemaError; }
94
+ });
95
+ Object.defineProperty(exports, "SchemaErrorCode", {
96
+ enumerable: true,
97
+ get: function () { return chunkZBQEMIAV_js.SchemaErrorCode; }
98
+ });
99
+ Object.defineProperty(exports, "SearchBackendError", {
100
+ enumerable: true,
101
+ get: function () { return chunkZBQEMIAV_js.SearchBackendError; }
102
+ });
103
+ Object.defineProperty(exports, "StorageError", {
104
+ enumerable: true,
105
+ get: function () { return chunkZBQEMIAV_js.StorageError; }
106
+ });
107
+ Object.defineProperty(exports, "SyncCascadeError", {
108
+ enumerable: true,
109
+ get: function () { return chunkZBQEMIAV_js.SyncCascadeError; }
110
+ });
111
+ Object.defineProperty(exports, "SyncConflictError", {
112
+ enumerable: true,
113
+ get: function () { return chunkZBQEMIAV_js.SyncConflictError; }
114
+ });
115
+ Object.defineProperty(exports, "SyncError", {
116
+ enumerable: true,
117
+ get: function () { return chunkZBQEMIAV_js.SyncError; }
118
+ });
119
+ Object.defineProperty(exports, "SystemEntityImmutableError", {
120
+ enumerable: true,
121
+ get: function () { return chunkZBQEMIAV_js.SystemEntityImmutableError; }
122
+ });
123
+ Object.defineProperty(exports, "ValidationError", {
124
+ enumerable: true,
125
+ get: function () { return chunkZBQEMIAV_js.ValidationError; }
126
+ });
127
+ Object.defineProperty(exports, "isAttributeInUseError", {
128
+ enumerable: true,
129
+ get: function () { return chunkZBQEMIAV_js.isAttributeInUseError; }
130
+ });
131
+ Object.defineProperty(exports, "isNotFoundError", {
132
+ enumerable: true,
133
+ get: function () { return chunkZBQEMIAV_js.isNotFoundError; }
134
+ });
135
+ Object.defineProperty(exports, "isObjectReferencedError", {
136
+ enumerable: true,
137
+ get: function () { return chunkZBQEMIAV_js.isObjectReferencedError; }
138
+ });
139
+ Object.defineProperty(exports, "isProtectedResourceError", {
140
+ enumerable: true,
141
+ get: function () { return chunkZBQEMIAV_js.isProtectedResourceError; }
142
+ });
143
+ Object.defineProperty(exports, "isRecordReferencedError", {
144
+ enumerable: true,
145
+ get: function () { return chunkZBQEMIAV_js.isRecordReferencedError; }
146
+ });
147
+ Object.defineProperty(exports, "isSchemaError", {
148
+ enumerable: true,
149
+ get: function () { return chunkZBQEMIAV_js.isSchemaError; }
150
+ });
151
+ Object.defineProperty(exports, "isValidationError", {
152
+ enumerable: true,
153
+ get: function () { return chunkZBQEMIAV_js.isValidationError; }
154
+ });
@@ -0,0 +1 @@
1
+ export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError } from './chunk-QIWADKYA.mjs';
@@ -1,8 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { A as Attribute, g as AttributeType, h as ComputedAttributeState } from './attributes-_6tvjbyl.js';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-B_UZK_6m.js';
2
+ import { A as Attribute, h as ComputedAttributeState } from './attributes-_b3Db8vT.js';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-DqLi1tx1.js';
4
4
  import { IconName } from '@stndrds/constants';
5
5
  import { Uuid } from './utils.js';
6
+ import { M as MigrationDefinition } from './migrations-DcuJZ8qO.js';
6
7
 
7
8
  interface DocumentLayout {
8
9
  /** Named sub-folders auto-created at the top of the record's drive when first used via attach --variant. */
@@ -32,42 +33,6 @@ interface PresetNode {
32
33
  /** Max depth allowed for preset.structure to keep instantiation predictable. */
33
34
  declare const MAX_PRESET_DEPTH = 5;
34
35
 
35
- type BuiltInTransform = "toString" | "toNumber" | "toDate" | "toBoolean" | "toISOString";
36
- type SchemaOperation = {
37
- type: "add_attribute";
38
- attribute: Attribute;
39
- } | {
40
- type: "remove_attribute";
41
- name: string;
42
- backup_config: Attribute;
43
- } | {
44
- type: "rename_attribute";
45
- from: string;
46
- to: string;
47
- } | {
48
- type: "change_type";
49
- name: string;
50
- from: AttributeType;
51
- to: AttributeType;
52
- transform?: BuiltInTransform;
53
- } | {
54
- type: "update_config";
55
- name: string;
56
- from: Partial<Record<string, unknown>>;
57
- to: Partial<Record<string, unknown>>;
58
- } | {
59
- type: "remove_object";
60
- backup: Record<string, unknown>;
61
- } | {
62
- type: "rename_object";
63
- from: string;
64
- to: string;
65
- };
66
- interface MigrationDefinition {
67
- version: number;
68
- operations: SchemaOperation[];
69
- }
70
-
71
36
  /**
72
37
  * Timestamps for tracking creation and updates
73
38
  */
@@ -313,4 +278,4 @@ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data:
313
278
  */
314
279
  declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
315
280
 
316
- export { type BuiltInTransform as B, type DocumentLayout as D, type FolderPreset as F, type MigrationDefinition as M, type ObjectDefinition as O, type PresetNode as P, RESERVED_ATTRIBUTE_NAMES as R, type SchemaOperation as S, type Timestamps as T, validateDraftOrThrow as a, validateObject as b, createFormAttributeValidator as c, validateObjectOrThrow as d, createAttributeValidator as e, validateAttribute as f, getMissingRequiredAttributes as g, type DocumentLayoutVariant as h, isRecordComplete as i, MAX_PRESET_DEPTH as j, type ObjectAttribute as k, type ObjectRecord as l, RESERVED_OBJECT_NAMES as m, type ReservedAttributeName as n, type ReservedObjectName as o, SYSTEM_FIELD_NAMES as p, type SystemFieldName as q, rejectUnknownAttributesOrThrow as r, validateDraft as v };
281
+ export { type DocumentLayout as D, type FolderPreset as F, MAX_PRESET_DEPTH as M, type ObjectDefinition as O, type PresetNode as P, RESERVED_ATTRIBUTE_NAMES as R, SYSTEM_FIELD_NAMES as S, type Timestamps as T, validateDraftOrThrow as a, validateObject as b, createFormAttributeValidator as c, validateObjectOrThrow as d, createAttributeValidator as e, validateAttribute as f, getMissingRequiredAttributes as g, type DocumentLayoutVariant as h, isRecordComplete as i, type ObjectAttribute as j, type ObjectRecord as k, RESERVED_OBJECT_NAMES as l, type ReservedAttributeName as m, type ReservedObjectName as n, type SystemFieldName as o, rejectUnknownAttributesOrThrow as r, validateDraft as v };