@stndrds/schema 1.0.0-alpha.256 → 1.0.0-alpha.258

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 (63) hide show
  1. package/dist/{attributes-Jji7TfFG.d.mts → attributes-Cmkc7UgJ.d.mts} +14 -367
  2. package/dist/{attributes-C-iyjLqJ.d.ts → attributes-_6tvjbyl.d.ts} +14 -367
  3. package/dist/{chunk-RHNSWKMJ.js → chunk-44EVNHSR.js} +5 -8
  4. package/dist/{chunk-VKJVBXHS.mjs → chunk-7VSOCVN7.mjs} +5 -8
  5. package/dist/{chunk-NSM2JPC3.js → chunk-L4U5QEQL.js} +4 -17
  6. package/dist/{chunk-AAXJJNY6.mjs → chunk-UXCJ3NI4.mjs} +4 -17
  7. package/dist/helpers-BO10yqih.d.mts +316 -0
  8. package/dist/helpers-BTC6TsKH.d.ts +316 -0
  9. package/dist/index.d.mts +137 -57
  10. package/dist/index.d.ts +137 -57
  11. package/dist/index.js +104 -180
  12. package/dist/index.mjs +20 -91
  13. package/dist/{types-D7VH7GrO.d.ts → types-B_UZK_6m.d.ts} +1 -1
  14. package/dist/{types-DgpsvFnh.d.mts → types-CVswgCx9.d.mts} +1 -1
  15. package/dist/validation/all.d.mts +3 -3
  16. package/dist/validation/all.d.ts +3 -3
  17. package/dist/validation/all.js +11 -12
  18. package/dist/validation/all.mjs +4 -5
  19. package/dist/validation/complex/currency.d.mts +2 -2
  20. package/dist/validation/complex/currency.d.ts +2 -2
  21. package/dist/validation/complex/location.d.mts +2 -2
  22. package/dist/validation/complex/location.d.ts +2 -2
  23. package/dist/validation/complex/phone.d.mts +2 -2
  24. package/dist/validation/complex/phone.d.ts +2 -2
  25. package/dist/validation/complex/relation.d.mts +2 -2
  26. package/dist/validation/complex/relation.d.ts +2 -2
  27. package/dist/validation/complex/richtext.d.mts +2 -2
  28. package/dist/validation/complex/richtext.d.ts +2 -2
  29. package/dist/validation/complex/select.d.mts +2 -2
  30. package/dist/validation/complex/select.d.ts +2 -2
  31. package/dist/validation/complex/user.d.mts +2 -2
  32. package/dist/validation/complex/user.d.ts +2 -2
  33. package/dist/validation/computed/formula.d.mts +2 -2
  34. package/dist/validation/computed/formula.d.ts +2 -2
  35. package/dist/validation/computed/rollup.d.mts +2 -2
  36. package/dist/validation/computed/rollup.d.ts +2 -2
  37. package/dist/validation/config/index.d.mts +1 -1
  38. package/dist/validation/config/index.d.ts +1 -1
  39. package/dist/validation/config/index.js +4 -4
  40. package/dist/validation/config/index.mjs +1 -1
  41. package/dist/validation/core/index.d.mts +3 -3
  42. package/dist/validation/core/index.d.ts +3 -3
  43. package/dist/validation/object/index.d.mts +4 -3
  44. package/dist/validation/object/index.d.ts +4 -3
  45. package/dist/validation/object/index.js +15 -16
  46. package/dist/validation/object/index.mjs +3 -4
  47. package/dist/validation/primitives/checkbox.d.mts +2 -2
  48. package/dist/validation/primitives/checkbox.d.ts +2 -2
  49. package/dist/validation/primitives/date.d.mts +2 -2
  50. package/dist/validation/primitives/date.d.ts +2 -2
  51. package/dist/validation/primitives/number.d.mts +2 -2
  52. package/dist/validation/primitives/number.d.ts +2 -2
  53. package/dist/validation/primitives/text.d.mts +2 -2
  54. package/dist/validation/primitives/text.d.ts +2 -2
  55. package/package.json +2 -7
  56. package/dist/chunk-CI6EGLL6.mjs +0 -18
  57. package/dist/chunk-Q5DIOYUE.js +0 -20
  58. package/dist/helpers-CMryP45K.d.mts +0 -75
  59. package/dist/helpers-Chppkv0E.d.ts +0 -75
  60. package/dist/validation/complex/file.d.mts +0 -13
  61. package/dist/validation/complex/file.d.ts +0 -13
  62. package/dist/validation/complex/file.js +0 -11
  63. package/dist/validation/complex/file.mjs +0 -2
@@ -1,9 +1,10 @@
1
- export { e as createAttributeValidator, c as createFormAttributeValidator, g as getMissingRequiredAttributes, i as isRecordComplete, r as rejectUnknownAttributesOrThrow, f as validateAttribute, v as validateDraft, a as validateDraftOrThrow, b as validateObject, d as validateObjectOrThrow } from '../../helpers-CMryP45K.mjs';
1
+ import { O as ObjectDefinition } from '../../helpers-BO10yqih.mjs';
2
+ export { e as createAttributeValidator, c as createFormAttributeValidator, g as getMissingRequiredAttributes, i as isRecordComplete, r as rejectUnknownAttributesOrThrow, f as validateAttribute, v as validateDraft, a as validateDraftOrThrow, b as validateObject, d as validateObjectOrThrow } from '../../helpers-BO10yqih.mjs';
2
3
  import { z } from 'zod';
3
- import { O as ObjectDefinition } from '../../attributes-Jji7TfFG.mjs';
4
- import '../../types-DgpsvFnh.mjs';
4
+ import '../../attributes-Cmkc7UgJ.mjs';
5
5
  import '@stndrds/constants';
6
6
  import '../../utils.mjs';
7
+ import '../../types-CVswgCx9.mjs';
7
8
 
8
9
  /**
9
10
  * Create a Zod schema for an entire object
@@ -1,9 +1,10 @@
1
- export { e as createAttributeValidator, c as createFormAttributeValidator, g as getMissingRequiredAttributes, i as isRecordComplete, r as rejectUnknownAttributesOrThrow, f as validateAttribute, v as validateDraft, a as validateDraftOrThrow, b as validateObject, d as validateObjectOrThrow } from '../../helpers-Chppkv0E.js';
1
+ import { O as ObjectDefinition } from '../../helpers-BTC6TsKH.js';
2
+ export { e as createAttributeValidator, c as createFormAttributeValidator, g as getMissingRequiredAttributes, i as isRecordComplete, r as rejectUnknownAttributesOrThrow, f as validateAttribute, v as validateDraft, a as validateDraftOrThrow, b as validateObject, d as validateObjectOrThrow } from '../../helpers-BTC6TsKH.js';
2
3
  import { z } from 'zod';
3
- import { O as ObjectDefinition } from '../../attributes-C-iyjLqJ.js';
4
- import '../../types-D7VH7GrO.js';
4
+ import '../../attributes-_6tvjbyl.js';
5
5
  import '@stndrds/constants';
6
6
  import '../../utils.js';
7
+ import '../../types-B_UZK_6m.js';
7
8
 
8
9
  /**
9
10
  * Create a Zod schema for an entire object
@@ -1,69 +1,68 @@
1
1
  'use strict';
2
2
 
3
- var chunkRHNSWKMJ_js = require('../../chunk-RHNSWKMJ.js');
4
- require('../../chunk-5WATIVCA.js');
3
+ var chunk44EVNHSR_js = require('../../chunk-44EVNHSR.js');
5
4
  require('../../chunk-SI34M4IC.js');
6
5
  require('../../chunk-YIP5FJ5H.js');
7
6
  require('../../chunk-QAF3HNKQ.js');
8
- require('../../chunk-EW5XR2X3.js');
9
7
  require('../../chunk-QWKLQRBX.js');
10
8
  require('../../chunk-KNGWHQLR.js');
11
9
  require('../../chunk-HTSTPTNZ.js');
12
10
  require('../../chunk-V2UA2D4E.js');
11
+ require('../../chunk-5WATIVCA.js');
13
12
  require('../../chunk-ACKMC6FL.js');
14
- require('../../chunk-Q5DIOYUE.js');
15
13
  require('../../chunk-E6JUYGJX.js');
16
14
  require('../../chunk-EBGRZUIH.js');
17
15
  require('../../chunk-EEH4XQ7W.js');
16
+ require('../../chunk-EW5XR2X3.js');
18
17
  require('../../chunk-YKWSHBT5.js');
19
18
 
20
19
 
21
20
 
22
21
  Object.defineProperty(exports, "createAttributeValidator", {
23
22
  enumerable: true,
24
- get: function () { return chunkRHNSWKMJ_js.createAttributeValidator; }
23
+ get: function () { return chunk44EVNHSR_js.createAttributeValidator; }
25
24
  });
26
25
  Object.defineProperty(exports, "createDraftValidator", {
27
26
  enumerable: true,
28
- get: function () { return chunkRHNSWKMJ_js.createDraftValidator; }
27
+ get: function () { return chunk44EVNHSR_js.createDraftValidator; }
29
28
  });
30
29
  Object.defineProperty(exports, "createFormAttributeValidator", {
31
30
  enumerable: true,
32
- get: function () { return chunkRHNSWKMJ_js.createFormAttributeValidator; }
31
+ get: function () { return chunk44EVNHSR_js.createFormAttributeValidator; }
33
32
  });
34
33
  Object.defineProperty(exports, "createObjectValidator", {
35
34
  enumerable: true,
36
- get: function () { return chunkRHNSWKMJ_js.createObjectValidator; }
35
+ get: function () { return chunk44EVNHSR_js.createObjectValidator; }
37
36
  });
38
37
  Object.defineProperty(exports, "getMissingRequiredAttributes", {
39
38
  enumerable: true,
40
- get: function () { return chunkRHNSWKMJ_js.getMissingRequiredAttributes; }
39
+ get: function () { return chunk44EVNHSR_js.getMissingRequiredAttributes; }
41
40
  });
42
41
  Object.defineProperty(exports, "isRecordComplete", {
43
42
  enumerable: true,
44
- get: function () { return chunkRHNSWKMJ_js.isRecordComplete; }
43
+ get: function () { return chunk44EVNHSR_js.isRecordComplete; }
45
44
  });
46
45
  Object.defineProperty(exports, "rejectUnknownAttributesOrThrow", {
47
46
  enumerable: true,
48
- get: function () { return chunkRHNSWKMJ_js.rejectUnknownAttributesOrThrow; }
47
+ get: function () { return chunk44EVNHSR_js.rejectUnknownAttributesOrThrow; }
49
48
  });
50
49
  Object.defineProperty(exports, "validateAttribute", {
51
50
  enumerable: true,
52
- get: function () { return chunkRHNSWKMJ_js.validateAttribute; }
51
+ get: function () { return chunk44EVNHSR_js.validateAttribute; }
53
52
  });
54
53
  Object.defineProperty(exports, "validateDraft", {
55
54
  enumerable: true,
56
- get: function () { return chunkRHNSWKMJ_js.validateDraft; }
55
+ get: function () { return chunk44EVNHSR_js.validateDraft; }
57
56
  });
58
57
  Object.defineProperty(exports, "validateDraftOrThrow", {
59
58
  enumerable: true,
60
- get: function () { return chunkRHNSWKMJ_js.validateDraftOrThrow; }
59
+ get: function () { return chunk44EVNHSR_js.validateDraftOrThrow; }
61
60
  });
62
61
  Object.defineProperty(exports, "validateObject", {
63
62
  enumerable: true,
64
- get: function () { return chunkRHNSWKMJ_js.validateObject; }
63
+ get: function () { return chunk44EVNHSR_js.validateObject; }
65
64
  });
66
65
  Object.defineProperty(exports, "validateObjectOrThrow", {
67
66
  enumerable: true,
68
- get: function () { return chunkRHNSWKMJ_js.validateObjectOrThrow; }
67
+ get: function () { return chunk44EVNHSR_js.validateObjectOrThrow; }
69
68
  });
@@ -1,16 +1,15 @@
1
- export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../../chunk-VKJVBXHS.mjs';
2
- import '../../chunk-OSSGN43B.mjs';
1
+ export { createAttributeValidator, createDraftValidator, createFormAttributeValidator, createObjectValidator, getMissingRequiredAttributes, isRecordComplete, rejectUnknownAttributesOrThrow, validateAttribute, validateDraft, validateDraftOrThrow, validateObject, validateObjectOrThrow } from '../../chunk-7VSOCVN7.mjs';
3
2
  import '../../chunk-Q44QKLN4.mjs';
4
3
  import '../../chunk-UANQJ2GH.mjs';
5
4
  import '../../chunk-U36ZIBEM.mjs';
6
- import '../../chunk-QVLQPW3O.mjs';
7
5
  import '../../chunk-ZDQ5AP26.mjs';
8
6
  import '../../chunk-LV3FEUKU.mjs';
9
7
  import '../../chunk-UXAHLSWC.mjs';
10
8
  import '../../chunk-NS63SPNN.mjs';
9
+ import '../../chunk-OSSGN43B.mjs';
11
10
  import '../../chunk-AYVHMVKQ.mjs';
12
- import '../../chunk-CI6EGLL6.mjs';
13
11
  import '../../chunk-YUFTHPOE.mjs';
14
12
  import '../../chunk-JUKLL5RJ.mjs';
15
13
  import '../../chunk-GO6LQADH.mjs';
14
+ import '../../chunk-QVLQPW3O.mjs';
16
15
  import '../../chunk-HRQEZUAA.mjs';
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { g as CheckboxAttribute } from '../../attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages } from '../../types-DgpsvFnh.mjs';
2
+ import { f as CheckboxAttribute } from '../../attributes-Cmkc7UgJ.mjs';
3
+ import { V as ValidationMessages } from '../../types-CVswgCx9.mjs';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { g as CheckboxAttribute } from '../../attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages } from '../../types-D7VH7GrO.js';
2
+ import { f as CheckboxAttribute } from '../../attributes-_6tvjbyl.js';
3
+ import { V as ValidationMessages } from '../../types-B_UZK_6m.js';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { D as DateAttribute } from '../../attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages } from '../../types-DgpsvFnh.mjs';
2
+ import { D as DateAttribute } from '../../attributes-Cmkc7UgJ.mjs';
3
+ import { V as ValidationMessages } from '../../types-CVswgCx9.mjs';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { D as DateAttribute } from '../../attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages } from '../../types-D7VH7GrO.js';
2
+ import { D as DateAttribute } from '../../attributes-_6tvjbyl.js';
3
+ import { V as ValidationMessages } from '../../types-B_UZK_6m.js';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { N as NumberAttribute } from '../../attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages } from '../../types-DgpsvFnh.mjs';
2
+ import { N as NumberAttribute } from '../../attributes-Cmkc7UgJ.mjs';
3
+ import { V as ValidationMessages } from '../../types-CVswgCx9.mjs';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { N as NumberAttribute } from '../../attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages } from '../../types-D7VH7GrO.js';
2
+ import { N as NumberAttribute } from '../../attributes-_6tvjbyl.js';
3
+ import { V as ValidationMessages } from '../../types-B_UZK_6m.js';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { T as TextAttribute } from '../../attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages } from '../../types-DgpsvFnh.mjs';
2
+ import { T as TextAttribute } from '../../attributes-Cmkc7UgJ.mjs';
3
+ import { V as ValidationMessages } from '../../types-CVswgCx9.mjs';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.mjs';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { T as TextAttribute } from '../../attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages } from '../../types-D7VH7GrO.js';
2
+ import { T as TextAttribute } from '../../attributes-_6tvjbyl.js';
3
+ import { V as ValidationMessages } from '../../types-B_UZK_6m.js';
4
4
  import '@stndrds/constants';
5
5
  import '../../utils.js';
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stndrds/schema",
3
- "version": "1.0.0-alpha.256",
3
+ "version": "1.0.0-alpha.258",
4
4
  "description": "Standard schema definitions and utilities",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -77,11 +77,6 @@
77
77
  "import": "./dist/validation/complex/select.mjs",
78
78
  "require": "./dist/validation/complex/select.js"
79
79
  },
80
- "./validators/file": {
81
- "types": "./dist/validation/complex/file.d.ts",
82
- "import": "./dist/validation/complex/file.mjs",
83
- "require": "./dist/validation/complex/file.js"
84
- },
85
80
  "./validators/user": {
86
81
  "types": "./dist/validation/complex/user.d.ts",
87
82
  "import": "./dist/validation/complex/user.mjs",
@@ -120,7 +115,7 @@
120
115
  "@standard-schema/spec": "^1.1.0",
121
116
  "libphonenumber-js": "^1.12.31",
122
117
  "zod": "^4.2.1",
123
- "@stndrds/constants": "1.0.0-alpha.256"
118
+ "@stndrds/constants": "1.0.0-alpha.258"
124
119
  },
125
120
  "devDependencies": {
126
121
  "@types/node": "^25.0.3",
@@ -1,18 +0,0 @@
1
- import { DEFAULT_VALIDATION_MESSAGES } from './chunk-HRQEZUAA.mjs';
2
- import { z } from 'zod';
3
-
4
- function createFileValidator(attr, messages = DEFAULT_VALIDATION_MESSAGES) {
5
- const uuidSchema = z.guid({
6
- message: messages.invalidId(attr)
7
- });
8
- if (attr.multiple) {
9
- let arraySchema = z.array(uuidSchema);
10
- if (attr.maxFiles) {
11
- arraySchema = arraySchema.max(attr.maxFiles, messages.maxItems(attr, attr.maxFiles));
12
- }
13
- return arraySchema;
14
- }
15
- return uuidSchema;
16
- }
17
-
18
- export { createFileValidator };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkYKWSHBT5_js = require('./chunk-YKWSHBT5.js');
4
- var zod = require('zod');
5
-
6
- function createFileValidator(attr, messages = chunkYKWSHBT5_js.DEFAULT_VALIDATION_MESSAGES) {
7
- const uuidSchema = zod.z.guid({
8
- message: messages.invalidId(attr)
9
- });
10
- if (attr.multiple) {
11
- let arraySchema = zod.z.array(uuidSchema);
12
- if (attr.maxFiles) {
13
- arraySchema = arraySchema.max(attr.maxFiles, messages.maxItems(attr, attr.maxFiles));
14
- }
15
- return arraySchema;
16
- }
17
- return uuidSchema;
18
- }
19
-
20
- exports.createFileValidator = createFileValidator;
@@ -1,75 +0,0 @@
1
- import { z } from 'zod';
2
- import { A as Attribute, O as ObjectDefinition } from './attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-DgpsvFnh.mjs';
4
-
5
- /**
6
- * Create a Zod schema for any attribute type.
7
- * Returns a strict validator that does NOT handle optional fields.
8
- * Use createFormAttributeValidator for form validation with optional support.
9
- *
10
- * @param attr - The attribute to create a validator for
11
- * @param messages - Custom validation messages for i18n support
12
- */
13
- declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
14
- /**
15
- * Create a Zod schema for form validation.
16
- * - Normalizes empty values (empty strings, empty objects) to null for optional fields
17
- * - Accepts custom messages for i18n support
18
- *
19
- * Use this in UI forms where optional fields may have null/undefined values.
20
- *
21
- * @param attr - The attribute to create a validator for
22
- * @param messages - Custom validation messages for i18n support
23
- */
24
- declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
25
-
26
- /**
27
- * Validate data against an attribute schema
28
- */
29
- declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
30
- /**
31
- * Validate data against an object schema
32
- */
33
- declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
34
- /**
35
- * Validate and throw if invalid.
36
- *
37
- * Throws `ValidationError` (code `SCHEMA_VALIDATION_FAILED`) on failure so HTTP
38
- * adapters can map it to 400. Generic `Error` would bubble up to a 500.
39
- */
40
- declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
41
- /**
42
- * Validate data in draft mode.
43
- * - All attributes are treated as optional (no required validation)
44
- * - Provided values are still validated for format/type correctness
45
- */
46
- declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
47
- /**
48
- * Validate draft data and throw if format validation fails.
49
- *
50
- * Same contract as `validateObjectOrThrow` but skips `required()` checks.
51
- * Throws `ValidationError` so HTTP adapters map it to 400.
52
- */
53
- declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
54
- /**
55
- * Throw a `ValidationError` when `data` contains keys that do not correspond
56
- * to any attribute declared on `objectDef`.
57
- *
58
- * Call this on **client-supplied input** before Zod validation so the error
59
- * message clearly names every offending key. Do NOT call on merged data that
60
- * includes existing record values — older records may legitimately carry stale
61
- * keys that predate this guard (see issue #658).
62
- *
63
- * Maps to HTTP 400 via `SchemaExceptionFilter` (code SCHEMA_VALIDATION_FAILED).
64
- */
65
- declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
66
- /**
67
- * Get the list of required attributes that are missing values.
68
- */
69
- declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
70
- /**
71
- * Check if a record is complete (all required attributes have valid values).
72
- */
73
- declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
74
-
75
- export { validateDraftOrThrow as a, validateObject as b, createFormAttributeValidator as c, validateObjectOrThrow as d, createAttributeValidator as e, validateAttribute as f, getMissingRequiredAttributes as g, isRecordComplete as i, rejectUnknownAttributesOrThrow as r, validateDraft as v };
@@ -1,75 +0,0 @@
1
- import { z } from 'zod';
2
- import { A as Attribute, O as ObjectDefinition } from './attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages, a as ValidationResult } from './types-D7VH7GrO.js';
4
-
5
- /**
6
- * Create a Zod schema for any attribute type.
7
- * Returns a strict validator that does NOT handle optional fields.
8
- * Use createFormAttributeValidator for form validation with optional support.
9
- *
10
- * @param attr - The attribute to create a validator for
11
- * @param messages - Custom validation messages for i18n support
12
- */
13
- declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
14
- /**
15
- * Create a Zod schema for form validation.
16
- * - Normalizes empty values (empty strings, empty objects) to null for optional fields
17
- * - Accepts custom messages for i18n support
18
- *
19
- * Use this in UI forms where optional fields may have null/undefined values.
20
- *
21
- * @param attr - The attribute to create a validator for
22
- * @param messages - Custom validation messages for i18n support
23
- */
24
- declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z.ZodTypeAny;
25
-
26
- /**
27
- * Validate data against an attribute schema
28
- */
29
- declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
30
- /**
31
- * Validate data against an object schema
32
- */
33
- declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
34
- /**
35
- * Validate and throw if invalid.
36
- *
37
- * Throws `ValidationError` (code `SCHEMA_VALIDATION_FAILED`) on failure so HTTP
38
- * adapters can map it to 400. Generic `Error` would bubble up to a 500.
39
- */
40
- declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
41
- /**
42
- * Validate data in draft mode.
43
- * - All attributes are treated as optional (no required validation)
44
- * - Provided values are still validated for format/type correctness
45
- */
46
- declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
47
- /**
48
- * Validate draft data and throw if format validation fails.
49
- *
50
- * Same contract as `validateObjectOrThrow` but skips `required()` checks.
51
- * Throws `ValidationError` so HTTP adapters map it to 400.
52
- */
53
- declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
54
- /**
55
- * Throw a `ValidationError` when `data` contains keys that do not correspond
56
- * to any attribute declared on `objectDef`.
57
- *
58
- * Call this on **client-supplied input** before Zod validation so the error
59
- * message clearly names every offending key. Do NOT call on merged data that
60
- * includes existing record values — older records may legitimately carry stale
61
- * keys that predate this guard (see issue #658).
62
- *
63
- * Maps to HTTP 400 via `SchemaExceptionFilter` (code SCHEMA_VALIDATION_FAILED).
64
- */
65
- declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
66
- /**
67
- * Get the list of required attributes that are missing values.
68
- */
69
- declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
70
- /**
71
- * Check if a record is complete (all required attributes have valid values).
72
- */
73
- declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
74
-
75
- export { validateDraftOrThrow as a, validateObject as b, createFormAttributeValidator as c, validateObjectOrThrow as d, createAttributeValidator as e, validateAttribute as f, getMissingRequiredAttributes as g, isRecordComplete as i, rejectUnknownAttributesOrThrow as r, validateDraft as v };
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- import { F as FileAttribute } from '../../attributes-Jji7TfFG.mjs';
3
- import { V as ValidationMessages } from '../../types-DgpsvFnh.mjs';
4
- import '@stndrds/constants';
5
- import '../../utils.mjs';
6
-
7
- /**
8
- * Create a Zod schema for a file attribute
9
- * Supports both single file (UUID) and multiple files (array of UUIDs)
10
- */
11
- declare function createFileValidator(attr: FileAttribute, messages?: ValidationMessages): z.ZodTypeAny;
12
-
13
- export { createFileValidator };
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- import { F as FileAttribute } from '../../attributes-C-iyjLqJ.js';
3
- import { V as ValidationMessages } from '../../types-D7VH7GrO.js';
4
- import '@stndrds/constants';
5
- import '../../utils.js';
6
-
7
- /**
8
- * Create a Zod schema for a file attribute
9
- * Supports both single file (UUID) and multiple files (array of UUIDs)
10
- */
11
- declare function createFileValidator(attr: FileAttribute, messages?: ValidationMessages): z.ZodTypeAny;
12
-
13
- export { createFileValidator };
@@ -1,11 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkQ5DIOYUE_js = require('../../chunk-Q5DIOYUE.js');
4
- require('../../chunk-YKWSHBT5.js');
5
-
6
-
7
-
8
- Object.defineProperty(exports, "createFileValidator", {
9
- enumerable: true,
10
- get: function () { return chunkQ5DIOYUE_js.createFileValidator; }
11
- });
@@ -1,2 +0,0 @@
1
- export { createFileValidator } from '../../chunk-CI6EGLL6.mjs';
2
- import '../../chunk-HRQEZUAA.mjs';