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

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 (47) hide show
  1. package/dist/all--B2_3ksI.d.ts +465 -0
  2. package/dist/all-D5zeUllO.d.mts +465 -0
  3. package/dist/chunk-63WWFZFY.js +1262 -0
  4. package/dist/{chunk-ZBQEMIAV.js → chunk-FDIAOFHS.js} +11 -8
  5. package/dist/chunk-ITGE3PBX.mjs +1215 -0
  6. package/dist/{chunk-UXCJ3NI4.mjs → chunk-KDHDC7E6.mjs} +150 -9
  7. package/dist/{chunk-U36ZIBEM.mjs → chunk-O73ROMWQ.mjs} +15 -6
  8. package/dist/{chunk-QIWADKYA.mjs → chunk-POULKEJM.mjs} +11 -9
  9. package/dist/{chunk-EBGRZUIH.js → chunk-Q4SZAMJT.js} +5 -0
  10. package/dist/{chunk-NGGU6BSN.mjs → chunk-QMLO7V5E.mjs} +6 -6
  11. package/dist/{chunk-L4U5QEQL.js → chunk-QN2N3IJZ.js} +158 -8
  12. package/dist/{chunk-JUKLL5RJ.mjs → chunk-R5LAJCBU.mjs} +5 -2
  13. package/dist/{chunk-NI3HCSYH.js → chunk-V6Q7HCA7.js} +11 -11
  14. package/dist/{chunk-QAF3HNKQ.js → chunk-ZPFOKBIN.js} +16 -5
  15. package/dist/exceptions.d.mts +21 -8
  16. package/dist/exceptions.d.ts +21 -8
  17. package/dist/exceptions.js +42 -38
  18. package/dist/exceptions.mjs +1 -1
  19. package/dist/helpers-C1VVEAOO.d.mts +76 -0
  20. package/dist/helpers-vQ6kp8ET.d.ts +76 -0
  21. package/dist/index-Bq1KrQkR.d.ts +2413 -0
  22. package/dist/index-DtxtOBYT.d.mts +2413 -0
  23. package/dist/index.d.mts +1516 -2212
  24. package/dist/index.d.ts +1516 -2212
  25. package/dist/index.js +1294 -1038
  26. package/dist/index.mjs +911 -905
  27. package/dist/{helpers-eyrnPJEF.d.ts → objects-A1ED9af-.d.ts} +32 -77
  28. package/dist/{helpers-uKLet0kF.d.mts → objects-BCaBw2ef.d.mts} +32 -77
  29. package/dist/validation/all.d.mts +4 -2
  30. package/dist/validation/all.d.ts +4 -2
  31. package/dist/validation/all.js +88 -16
  32. package/dist/validation/all.mjs +9 -9
  33. package/dist/validation/complex/phone.js +2 -2
  34. package/dist/validation/complex/phone.mjs +1 -1
  35. package/dist/validation/config/index.d.mts +5 -18
  36. package/dist/validation/config/index.d.ts +5 -18
  37. package/dist/validation/config/index.js +34 -4
  38. package/dist/validation/config/index.mjs +7 -1
  39. package/dist/validation/object/index.d.mts +2 -2
  40. package/dist/validation/object/index.d.ts +2 -2
  41. package/dist/validation/object/index.js +19 -19
  42. package/dist/validation/object/index.mjs +7 -7
  43. package/dist/validation/primitives/text.js +2 -2
  44. package/dist/validation/primitives/text.mjs +1 -1
  45. package/package.json +2 -2
  46. package/dist/chunk-PGERPYDR.js +0 -2
  47. package/dist/chunk-SP3PNHYF.mjs +0 -1
@@ -3,6 +3,17 @@
3
3
  var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
4
4
  var zod = require('zod');
5
5
 
6
+ // src/lib/text-format.ts
7
+ var TEXT_FORMAT_PATTERNS = {
8
+ email: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
9
+ url: "^https?:\\/\\/[\\w\\-]+(\\.[\\w\\-]+)+[/#?]?.*$",
10
+ slug: "^[a-z0-9]+(?:-[a-z0-9]+)*$"
11
+ };
12
+ function resolveTextPattern(attr) {
13
+ if (attr.pattern) return attr.pattern;
14
+ return attr.format ? TEXT_FORMAT_PATTERNS[attr.format] : void 0;
15
+ }
16
+
6
17
  // src/lib/lru-cache.ts
7
18
  var LRUCache = class {
8
19
  constructor(capacity) {
@@ -66,13 +77,13 @@ function createTextValidator(attr, messages = chunkYKWSHBT5_js.DEFAULT_VALIDATIO
66
77
  if (attr.maxLength !== void 0) {
67
78
  schema = schema.max(attr.maxLength, messages.maxLength(attr, attr.maxLength));
68
79
  }
69
- if (attr.pattern) {
70
- schema = schema.regex(
71
- getCachedRegex(textRegexCache, attr.pattern),
72
- messages.invalidPattern(attr)
73
- );
80
+ const pattern = resolveTextPattern(attr);
81
+ if (pattern) {
82
+ schema = schema.regex(getCachedRegex(textRegexCache, pattern), messages.invalidPattern(attr));
74
83
  }
75
84
  return schema;
76
85
  }
77
86
 
87
+ exports.TEXT_FORMAT_PATTERNS = TEXT_FORMAT_PATTERNS;
78
88
  exports.createTextValidator = createTextValidator;
89
+ exports.resolveTextPattern = resolveTextPattern;
@@ -13,6 +13,7 @@ declare const SchemaErrorCode: {
13
13
  readonly RECORD_NOT_FOUND: "SCHEMA_RECORD_NOT_FOUND";
14
14
  readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
15
15
  readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
16
+ readonly SCHEMA_PLAN_NOT_FOUND: "SCHEMA_PLAN_NOT_FOUND";
16
17
  readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
17
18
  readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
18
19
  readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
@@ -147,6 +148,14 @@ declare class AttributeNotFoundError extends NotFoundError {
147
148
  declare class RecordNotFoundError extends NotFoundError {
148
149
  constructor(recordId: string);
149
150
  }
151
+ /**
152
+ * Schema plan not found error — raised when a `planId` sent by an approver
153
+ * (who never receives the plan payload itself, only its id) does not match
154
+ * any stored plan.
155
+ */
156
+ declare class SchemaPlanNotFoundError extends NotFoundError {
157
+ constructor(planId: string);
158
+ }
150
159
  /**
151
160
  * Validation error with field-level details
152
161
  */
@@ -233,15 +242,19 @@ declare class OrphanSystemAttributeError extends SchemaError {
233
242
  constructor(objectName: string, attributeName: string);
234
243
  }
235
244
  /**
236
- * Thrown at boot when destructive operations (remove_attribute, remove_object)
237
- * are detected without the explicit STANDARDS_ALLOW_DESTRUCTIVE_SYNC=1 env var.
245
+ * Thrown when a destructive operation is detected without the explicit
246
+ * STANDARDS_ALLOW_DESTRUCTIVE_SYNC=1 opt-in.
238
247
  * HTTP status: 500 (boot fail, should never surface to HTTP).
239
248
  *
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.
249
+ * Which operations the opt-in governs is decided in one place
250
+ * `requiresDestructiveSyncOptIn` in the runtime's sync classifier. Today that
251
+ * is object removal only: attribute removal is unconditional at boot, because a
252
+ * system attribute is code-controlled and its disappearance from the builder is
253
+ * an unambiguous drop.
254
+ *
255
+ * NOTE — Wiring status: defined but not thrown by the current sync.ts, which
256
+ * demotes instead. Reserved for the `standards diff` CLI gate, which will throw
257
+ * it when CI detects an unauthorized destructive deployment.
245
258
  */
246
259
  declare class DestructiveSyncNotAllowedError extends SchemaError {
247
260
  readonly operations: SchemaOperation[];
@@ -455,4 +468,4 @@ declare function isAttributeInUseError(error: unknown): error is AttributeInUseE
455
468
  */
456
469
  declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
457
470
 
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 };
471
+ 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, SchemaPlanNotFoundError, SearchBackendError, StorageError, type StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, type ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
@@ -13,6 +13,7 @@ declare const SchemaErrorCode: {
13
13
  readonly RECORD_NOT_FOUND: "SCHEMA_RECORD_NOT_FOUND";
14
14
  readonly ROLE_NOT_FOUND: "SCHEMA_ROLE_NOT_FOUND";
15
15
  readonly MEMORY_NOT_FOUND: "SCHEMA_MEMORY_NOT_FOUND";
16
+ readonly SCHEMA_PLAN_NOT_FOUND: "SCHEMA_PLAN_NOT_FOUND";
16
17
  readonly VALIDATION_FAILED: "SCHEMA_VALIDATION_FAILED";
17
18
  readonly INVALID_ATTRIBUTE_NAME: "SCHEMA_INVALID_ATTRIBUTE_NAME";
18
19
  readonly INVALID_OBJECT_NAME: "SCHEMA_INVALID_OBJECT_NAME";
@@ -147,6 +148,14 @@ declare class AttributeNotFoundError extends NotFoundError {
147
148
  declare class RecordNotFoundError extends NotFoundError {
148
149
  constructor(recordId: string);
149
150
  }
151
+ /**
152
+ * Schema plan not found error — raised when a `planId` sent by an approver
153
+ * (who never receives the plan payload itself, only its id) does not match
154
+ * any stored plan.
155
+ */
156
+ declare class SchemaPlanNotFoundError extends NotFoundError {
157
+ constructor(planId: string);
158
+ }
150
159
  /**
151
160
  * Validation error with field-level details
152
161
  */
@@ -233,15 +242,19 @@ declare class OrphanSystemAttributeError extends SchemaError {
233
242
  constructor(objectName: string, attributeName: string);
234
243
  }
235
244
  /**
236
- * Thrown at boot when destructive operations (remove_attribute, remove_object)
237
- * are detected without the explicit STANDARDS_ALLOW_DESTRUCTIVE_SYNC=1 env var.
245
+ * Thrown when a destructive operation is detected without the explicit
246
+ * STANDARDS_ALLOW_DESTRUCTIVE_SYNC=1 opt-in.
238
247
  * HTTP status: 500 (boot fail, should never surface to HTTP).
239
248
  *
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.
249
+ * Which operations the opt-in governs is decided in one place
250
+ * `requiresDestructiveSyncOptIn` in the runtime's sync classifier. Today that
251
+ * is object removal only: attribute removal is unconditional at boot, because a
252
+ * system attribute is code-controlled and its disappearance from the builder is
253
+ * an unambiguous drop.
254
+ *
255
+ * NOTE — Wiring status: defined but not thrown by the current sync.ts, which
256
+ * demotes instead. Reserved for the `standards diff` CLI gate, which will throw
257
+ * it when CI detects an unauthorized destructive deployment.
245
258
  */
246
259
  declare class DestructiveSyncNotAllowedError extends SchemaError {
247
260
  readonly operations: SchemaOperation[];
@@ -455,4 +468,4 @@ declare function isAttributeInUseError(error: unknown): error is AttributeInUseE
455
468
  */
456
469
  declare function isObjectReferencedError(error: unknown): error is ObjectReferencedError;
457
470
 
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 };
471
+ 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, SchemaPlanNotFoundError, SearchBackendError, StorageError, type StorageOperation, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, type ValidationErrorDetail, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError };
@@ -1,154 +1,158 @@
1
1
  'use strict';
2
2
 
3
- var chunkZBQEMIAV_js = require('./chunk-ZBQEMIAV.js');
3
+ var chunkFDIAOFHS_js = require('./chunk-FDIAOFHS.js');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "AccessDeniedError", {
8
8
  enumerable: true,
9
- get: function () { return chunkZBQEMIAV_js.AccessDeniedError; }
9
+ get: function () { return chunkFDIAOFHS_js.AccessDeniedError; }
10
10
  });
11
11
  Object.defineProperty(exports, "AttributeInUseError", {
12
12
  enumerable: true,
13
- get: function () { return chunkZBQEMIAV_js.AttributeInUseError; }
13
+ get: function () { return chunkFDIAOFHS_js.AttributeInUseError; }
14
14
  });
15
15
  Object.defineProperty(exports, "AttributeNotFoundError", {
16
16
  enumerable: true,
17
- get: function () { return chunkZBQEMIAV_js.AttributeNotFoundError; }
17
+ get: function () { return chunkFDIAOFHS_js.AttributeNotFoundError; }
18
18
  });
19
19
  Object.defineProperty(exports, "ChangeTypeNotSupportedError", {
20
20
  enumerable: true,
21
- get: function () { return chunkZBQEMIAV_js.ChangeTypeNotSupportedError; }
21
+ get: function () { return chunkFDIAOFHS_js.ChangeTypeNotSupportedError; }
22
22
  });
23
23
  Object.defineProperty(exports, "ConcurrentModificationError", {
24
24
  enumerable: true,
25
- get: function () { return chunkZBQEMIAV_js.ConcurrentModificationError; }
25
+ get: function () { return chunkFDIAOFHS_js.ConcurrentModificationError; }
26
26
  });
27
27
  Object.defineProperty(exports, "DestructiveSyncNotAllowedError", {
28
28
  enumerable: true,
29
- get: function () { return chunkZBQEMIAV_js.DestructiveSyncNotAllowedError; }
29
+ get: function () { return chunkFDIAOFHS_js.DestructiveSyncNotAllowedError; }
30
30
  });
31
31
  Object.defineProperty(exports, "DuplicateError", {
32
32
  enumerable: true,
33
- get: function () { return chunkZBQEMIAV_js.DuplicateError; }
33
+ get: function () { return chunkFDIAOFHS_js.DuplicateError; }
34
34
  });
35
35
  Object.defineProperty(exports, "ForbiddenError", {
36
36
  enumerable: true,
37
- get: function () { return chunkZBQEMIAV_js.ForbiddenError; }
37
+ get: function () { return chunkFDIAOFHS_js.ForbiddenError; }
38
38
  });
39
39
  Object.defineProperty(exports, "MemoryNotFoundError", {
40
40
  enumerable: true,
41
- get: function () { return chunkZBQEMIAV_js.MemoryNotFoundError; }
41
+ get: function () { return chunkFDIAOFHS_js.MemoryNotFoundError; }
42
42
  });
43
43
  Object.defineProperty(exports, "MigrationTimeoutError", {
44
44
  enumerable: true,
45
- get: function () { return chunkZBQEMIAV_js.MigrationTimeoutError; }
45
+ get: function () { return chunkFDIAOFHS_js.MigrationTimeoutError; }
46
46
  });
47
47
  Object.defineProperty(exports, "NotFoundError", {
48
48
  enumerable: true,
49
- get: function () { return chunkZBQEMIAV_js.NotFoundError; }
49
+ get: function () { return chunkFDIAOFHS_js.NotFoundError; }
50
50
  });
51
51
  Object.defineProperty(exports, "NotImplementedError", {
52
52
  enumerable: true,
53
- get: function () { return chunkZBQEMIAV_js.NotImplementedError; }
53
+ get: function () { return chunkFDIAOFHS_js.NotImplementedError; }
54
54
  });
55
55
  Object.defineProperty(exports, "ObjectNotFoundError", {
56
56
  enumerable: true,
57
- get: function () { return chunkZBQEMIAV_js.ObjectNotFoundError; }
57
+ get: function () { return chunkFDIAOFHS_js.ObjectNotFoundError; }
58
58
  });
59
59
  Object.defineProperty(exports, "ObjectReferencedError", {
60
60
  enumerable: true,
61
- get: function () { return chunkZBQEMIAV_js.ObjectReferencedError; }
61
+ get: function () { return chunkFDIAOFHS_js.ObjectReferencedError; }
62
62
  });
63
63
  Object.defineProperty(exports, "OrphanSystemAttributeError", {
64
64
  enumerable: true,
65
- get: function () { return chunkZBQEMIAV_js.OrphanSystemAttributeError; }
65
+ get: function () { return chunkFDIAOFHS_js.OrphanSystemAttributeError; }
66
66
  });
67
67
  Object.defineProperty(exports, "ProtectedResourceError", {
68
68
  enumerable: true,
69
- get: function () { return chunkZBQEMIAV_js.ProtectedResourceError; }
69
+ get: function () { return chunkFDIAOFHS_js.ProtectedResourceError; }
70
70
  });
71
71
  Object.defineProperty(exports, "ProtectedRoleError", {
72
72
  enumerable: true,
73
- get: function () { return chunkZBQEMIAV_js.ProtectedRoleError; }
73
+ get: function () { return chunkFDIAOFHS_js.ProtectedRoleError; }
74
74
  });
75
75
  Object.defineProperty(exports, "RecordNotFoundError", {
76
76
  enumerable: true,
77
- get: function () { return chunkZBQEMIAV_js.RecordNotFoundError; }
77
+ get: function () { return chunkFDIAOFHS_js.RecordNotFoundError; }
78
78
  });
79
79
  Object.defineProperty(exports, "RecordReferencedError", {
80
80
  enumerable: true,
81
- get: function () { return chunkZBQEMIAV_js.RecordReferencedError; }
81
+ get: function () { return chunkFDIAOFHS_js.RecordReferencedError; }
82
82
  });
83
83
  Object.defineProperty(exports, "RepositoryError", {
84
84
  enumerable: true,
85
- get: function () { return chunkZBQEMIAV_js.RepositoryError; }
85
+ get: function () { return chunkFDIAOFHS_js.RepositoryError; }
86
86
  });
87
87
  Object.defineProperty(exports, "RoleNotFoundError", {
88
88
  enumerable: true,
89
- get: function () { return chunkZBQEMIAV_js.RoleNotFoundError; }
89
+ get: function () { return chunkFDIAOFHS_js.RoleNotFoundError; }
90
90
  });
91
91
  Object.defineProperty(exports, "SchemaError", {
92
92
  enumerable: true,
93
- get: function () { return chunkZBQEMIAV_js.SchemaError; }
93
+ get: function () { return chunkFDIAOFHS_js.SchemaError; }
94
94
  });
95
95
  Object.defineProperty(exports, "SchemaErrorCode", {
96
96
  enumerable: true,
97
- get: function () { return chunkZBQEMIAV_js.SchemaErrorCode; }
97
+ get: function () { return chunkFDIAOFHS_js.SchemaErrorCode; }
98
+ });
99
+ Object.defineProperty(exports, "SchemaPlanNotFoundError", {
100
+ enumerable: true,
101
+ get: function () { return chunkFDIAOFHS_js.SchemaPlanNotFoundError; }
98
102
  });
99
103
  Object.defineProperty(exports, "SearchBackendError", {
100
104
  enumerable: true,
101
- get: function () { return chunkZBQEMIAV_js.SearchBackendError; }
105
+ get: function () { return chunkFDIAOFHS_js.SearchBackendError; }
102
106
  });
103
107
  Object.defineProperty(exports, "StorageError", {
104
108
  enumerable: true,
105
- get: function () { return chunkZBQEMIAV_js.StorageError; }
109
+ get: function () { return chunkFDIAOFHS_js.StorageError; }
106
110
  });
107
111
  Object.defineProperty(exports, "SyncCascadeError", {
108
112
  enumerable: true,
109
- get: function () { return chunkZBQEMIAV_js.SyncCascadeError; }
113
+ get: function () { return chunkFDIAOFHS_js.SyncCascadeError; }
110
114
  });
111
115
  Object.defineProperty(exports, "SyncConflictError", {
112
116
  enumerable: true,
113
- get: function () { return chunkZBQEMIAV_js.SyncConflictError; }
117
+ get: function () { return chunkFDIAOFHS_js.SyncConflictError; }
114
118
  });
115
119
  Object.defineProperty(exports, "SyncError", {
116
120
  enumerable: true,
117
- get: function () { return chunkZBQEMIAV_js.SyncError; }
121
+ get: function () { return chunkFDIAOFHS_js.SyncError; }
118
122
  });
119
123
  Object.defineProperty(exports, "SystemEntityImmutableError", {
120
124
  enumerable: true,
121
- get: function () { return chunkZBQEMIAV_js.SystemEntityImmutableError; }
125
+ get: function () { return chunkFDIAOFHS_js.SystemEntityImmutableError; }
122
126
  });
123
127
  Object.defineProperty(exports, "ValidationError", {
124
128
  enumerable: true,
125
- get: function () { return chunkZBQEMIAV_js.ValidationError; }
129
+ get: function () { return chunkFDIAOFHS_js.ValidationError; }
126
130
  });
127
131
  Object.defineProperty(exports, "isAttributeInUseError", {
128
132
  enumerable: true,
129
- get: function () { return chunkZBQEMIAV_js.isAttributeInUseError; }
133
+ get: function () { return chunkFDIAOFHS_js.isAttributeInUseError; }
130
134
  });
131
135
  Object.defineProperty(exports, "isNotFoundError", {
132
136
  enumerable: true,
133
- get: function () { return chunkZBQEMIAV_js.isNotFoundError; }
137
+ get: function () { return chunkFDIAOFHS_js.isNotFoundError; }
134
138
  });
135
139
  Object.defineProperty(exports, "isObjectReferencedError", {
136
140
  enumerable: true,
137
- get: function () { return chunkZBQEMIAV_js.isObjectReferencedError; }
141
+ get: function () { return chunkFDIAOFHS_js.isObjectReferencedError; }
138
142
  });
139
143
  Object.defineProperty(exports, "isProtectedResourceError", {
140
144
  enumerable: true,
141
- get: function () { return chunkZBQEMIAV_js.isProtectedResourceError; }
145
+ get: function () { return chunkFDIAOFHS_js.isProtectedResourceError; }
142
146
  });
143
147
  Object.defineProperty(exports, "isRecordReferencedError", {
144
148
  enumerable: true,
145
- get: function () { return chunkZBQEMIAV_js.isRecordReferencedError; }
149
+ get: function () { return chunkFDIAOFHS_js.isRecordReferencedError; }
146
150
  });
147
151
  Object.defineProperty(exports, "isSchemaError", {
148
152
  enumerable: true,
149
- get: function () { return chunkZBQEMIAV_js.isSchemaError; }
153
+ get: function () { return chunkFDIAOFHS_js.isSchemaError; }
150
154
  });
151
155
  Object.defineProperty(exports, "isValidationError", {
152
156
  enumerable: true,
153
- get: function () { return chunkZBQEMIAV_js.isValidationError; }
157
+ get: function () { return chunkFDIAOFHS_js.isValidationError; }
154
158
  });
@@ -1 +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
+ export { AccessDeniedError, AttributeInUseError, AttributeNotFoundError, ChangeTypeNotSupportedError, ConcurrentModificationError, DestructiveSyncNotAllowedError, DuplicateError, ForbiddenError, MemoryNotFoundError, MigrationTimeoutError, NotFoundError, NotImplementedError, ObjectNotFoundError, ObjectReferencedError, OrphanSystemAttributeError, ProtectedResourceError, ProtectedRoleError, RecordNotFoundError, RecordReferencedError, RepositoryError, RoleNotFoundError, SchemaError, SchemaErrorCode, SchemaPlanNotFoundError, SearchBackendError, StorageError, SyncCascadeError, SyncConflictError, SyncError, SystemEntityImmutableError, ValidationError, isAttributeInUseError, isNotFoundError, isObjectReferencedError, isProtectedResourceError, isRecordReferencedError, isSchemaError, isValidationError } from './chunk-POULKEJM.mjs';
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { A as Attribute } from './attributes-lBLiOIY3.mjs';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-DNz3ITS-.mjs';
4
+ import { O as ObjectDefinition } from './objects-BCaBw2ef.mjs';
5
+
6
+ /**
7
+ * Create a Zod schema for any attribute type.
8
+ * Returns a strict validator that does NOT handle optional fields.
9
+ * Use createFormAttributeValidator for form validation with optional support.
10
+ *
11
+ * @param attr - The attribute to create a validator for
12
+ * @param messages - Custom validation messages for i18n support
13
+ */
14
+ declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
15
+ /**
16
+ * Create a Zod schema for form validation.
17
+ * - Normalizes empty values (empty strings, empty objects) to null for optional fields
18
+ * - Accepts custom messages for i18n support
19
+ *
20
+ * Use this in UI forms where optional fields may have null/undefined values.
21
+ *
22
+ * @param attr - The attribute to create a validator for
23
+ * @param messages - Custom validation messages for i18n support
24
+ */
25
+ declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
26
+
27
+ /**
28
+ * Validate data against an attribute schema
29
+ */
30
+ declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
31
+ /**
32
+ * Validate data against an object schema
33
+ */
34
+ declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
35
+ /**
36
+ * Validate and throw if invalid.
37
+ *
38
+ * Throws `ValidationError` (code `SCHEMA_VALIDATION_FAILED`) on failure so HTTP
39
+ * adapters can map it to 400. Generic `Error` would bubble up to a 500.
40
+ */
41
+ declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
42
+ /**
43
+ * Validate data in draft mode.
44
+ * - All attributes are treated as optional (no required validation)
45
+ * - Provided values are still validated for format/type correctness
46
+ */
47
+ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
48
+ /**
49
+ * Validate draft data and throw if format validation fails.
50
+ *
51
+ * Same contract as `validateObjectOrThrow` but skips `required()` checks.
52
+ * Throws `ValidationError` so HTTP adapters map it to 400.
53
+ */
54
+ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
55
+ /**
56
+ * Throw a `ValidationError` when `data` contains keys that do not correspond
57
+ * to any attribute declared on `objectDef`.
58
+ *
59
+ * Call this on **client-supplied input** before Zod validation so the error
60
+ * message clearly names every offending key. Do NOT call on merged data that
61
+ * includes existing record values — older records may legitimately carry stale
62
+ * keys that predate this guard (see issue #658).
63
+ *
64
+ * Maps to HTTP 400 via `SchemaExceptionFilter` (code SCHEMA_VALIDATION_FAILED).
65
+ */
66
+ declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
67
+ /**
68
+ * Get the list of required attributes that are missing values.
69
+ */
70
+ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
71
+ /**
72
+ * Check if a record is complete (all required attributes have valid values).
73
+ */
74
+ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
75
+
76
+ export { createFormAttributeValidator as a, validateDraft as b, createAttributeValidator as c, validateDraftOrThrow as d, validateObject as e, validateObjectOrThrow as f, getMissingRequiredAttributes as g, isRecordComplete as i, rejectUnknownAttributesOrThrow as r, validateAttribute as v };
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod';
2
+ import { A as Attribute } from './attributes-_b3Db8vT.js';
3
+ import { V as ValidationMessages, a as ValidationResult } from './types-DqLi1tx1.js';
4
+ import { O as ObjectDefinition } from './objects-A1ED9af-.js';
5
+
6
+ /**
7
+ * Create a Zod schema for any attribute type.
8
+ * Returns a strict validator that does NOT handle optional fields.
9
+ * Use createFormAttributeValidator for form validation with optional support.
10
+ *
11
+ * @param attr - The attribute to create a validator for
12
+ * @param messages - Custom validation messages for i18n support
13
+ */
14
+ declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
15
+ /**
16
+ * Create a Zod schema for form validation.
17
+ * - Normalizes empty values (empty strings, empty objects) to null for optional fields
18
+ * - Accepts custom messages for i18n support
19
+ *
20
+ * Use this in UI forms where optional fields may have null/undefined values.
21
+ *
22
+ * @param attr - The attribute to create a validator for
23
+ * @param messages - Custom validation messages for i18n support
24
+ */
25
+ declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
26
+
27
+ /**
28
+ * Validate data against an attribute schema
29
+ */
30
+ declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
31
+ /**
32
+ * Validate data against an object schema
33
+ */
34
+ declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
35
+ /**
36
+ * Validate and throw if invalid.
37
+ *
38
+ * Throws `ValidationError` (code `SCHEMA_VALIDATION_FAILED`) on failure so HTTP
39
+ * adapters can map it to 400. Generic `Error` would bubble up to a 500.
40
+ */
41
+ declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
42
+ /**
43
+ * Validate data in draft mode.
44
+ * - All attributes are treated as optional (no required validation)
45
+ * - Provided values are still validated for format/type correctness
46
+ */
47
+ declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
48
+ /**
49
+ * Validate draft data and throw if format validation fails.
50
+ *
51
+ * Same contract as `validateObjectOrThrow` but skips `required()` checks.
52
+ * Throws `ValidationError` so HTTP adapters map it to 400.
53
+ */
54
+ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
55
+ /**
56
+ * Throw a `ValidationError` when `data` contains keys that do not correspond
57
+ * to any attribute declared on `objectDef`.
58
+ *
59
+ * Call this on **client-supplied input** before Zod validation so the error
60
+ * message clearly names every offending key. Do NOT call on merged data that
61
+ * includes existing record values — older records may legitimately carry stale
62
+ * keys that predate this guard (see issue #658).
63
+ *
64
+ * Maps to HTTP 400 via `SchemaExceptionFilter` (code SCHEMA_VALIDATION_FAILED).
65
+ */
66
+ declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
67
+ /**
68
+ * Get the list of required attributes that are missing values.
69
+ */
70
+ declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
71
+ /**
72
+ * Check if a record is complete (all required attributes have valid values).
73
+ */
74
+ declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
75
+
76
+ export { createFormAttributeValidator as a, validateDraft as b, createAttributeValidator as c, validateDraftOrThrow as d, validateObject as e, validateObjectOrThrow as f, getMissingRequiredAttributes as g, isRecordComplete as i, rejectUnknownAttributesOrThrow as r, validateAttribute as v };