@standards/schema 1.0.0-alpha.384 → 1.0.0-alpha.386
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.
- package/dist/{all-C9OPP-r1.d.ts → all-4D2kFfWM.d.mts} +1115 -1116
- package/dist/{all-CYmW48oj.d.mts → all-DmTOfJJI.d.ts} +1115 -1116
- package/dist/api/index.d.mts +2890 -2890
- package/dist/api/index.d.ts +2890 -2890
- package/dist/api/index.js +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/attribute-validators-COsyRG9V.mjs +11 -0
- package/dist/attribute-validators-CUqsP1j_.js +11 -0
- package/dist/{attributes-D35Lcoui.d.ts → attributes-BcA_reJZ.d.ts} +58 -59
- package/dist/{attributes-CZD_B0mZ.d.mts → attributes-eqr1vdPP.d.mts} +58 -59
- package/dist/checkbox-C9aJ-6gq.d.ts +10 -0
- package/dist/checkbox-DfXrFM2z.d.mts +10 -0
- package/dist/config-C1CDWJf8.mjs +2 -0
- package/dist/config-eqfYa9Bh.js +2 -0
- package/dist/{core-397tQy5q.js → core-DAxRlJ5i.js} +1 -1
- package/dist/{core-BLHhNykL.mjs → core-rKI7Q9_U.mjs} +1 -1
- package/dist/{date-CQdP6Dxe.d.ts → date-BzggmHjS.d.mts} +5 -6
- package/dist/{date-B9051Wxe.d.mts → date-CdaoV9_L.d.ts} +5 -6
- package/dist/{exceptions-DoP6VK0v.d.mts → exceptions-CgzBcQIl.d.mts} +69 -70
- package/dist/{exceptions-DoP6VK0v.d.ts → exceptions-CgzBcQIl.d.ts} +69 -70
- package/dist/exceptions.d.mts +1 -1
- package/dist/exceptions.d.ts +1 -1
- package/dist/{index-E9rSexij.d.ts → index-BSYjSdhW.d.mts} +17 -18
- package/dist/{index-CgEVJG3l.d.ts → index-BmQgUhtq.d.mts} +2770 -2769
- package/dist/{index-BLXzRQr9.d.ts → index-CCH94vyR.d.ts} +6 -7
- package/dist/{index-D0L0GHU0.d.mts → index-D1iR2xuc.d.ts} +17 -18
- package/dist/{index-BS-60koN.d.mts → index-DjWbCMUZ.d.ts} +2770 -2769
- package/dist/{index-CH-Vc-pK.d.ts → index-e1Oh8ngS.d.ts} +73 -74
- package/dist/{index-B3wdnfLl.d.mts → index-jDwfdudj.d.mts} +73 -74
- package/dist/{index-CSDAHifu.d.mts → index-zJz3LbXr.d.mts} +6 -7
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/number-B3u9vPtb.d.ts +10 -0
- package/dist/number-Br56q0hL.d.mts +10 -0
- package/dist/object-5-wnsH0o.js +4 -0
- package/dist/object-BF5y6bgs.mjs +4 -0
- package/dist/{objects-CH22DJOx.d.ts → objects-CLxyZh-U.d.ts} +54 -55
- package/dist/{objects-DhKrQEo4.d.mts → objects-DxEMaC2Z.d.mts} +54 -55
- package/dist/phone-BGJea5sr.mjs +2 -0
- package/dist/phone-DHXyNkVY.js +2 -0
- package/dist/record-aggregates-Cj3p3_ce.js +2 -0
- package/dist/{record-aggregates-CzG86pUS.mjs → record-aggregates-DQXrIuGE.mjs} +1 -1
- package/dist/record-operation-7-DRRONb.mjs +2 -0
- package/dist/record-operation-BcbgQ-0b.js +2 -0
- package/dist/rolldown-runtime-DETHMehu.js +2 -0
- package/dist/text-BaxaZ5Vv.mjs +2 -0
- package/dist/text-Bvk4ila8.d.ts +10 -0
- package/dist/text-C5NnfCJg.d.mts +10 -0
- package/dist/text-DVrTGjjX.js +2 -0
- package/dist/{utils-gY3d9Dwp.js → utils-B-gGq3FS.js} +1 -1
- package/dist/{utils-C_J_p_tL.d.ts → utils-B2bq4zLb.d.ts} +15 -16
- package/dist/{utils-CkcPS_M9.d.mts → utils-CRx-eR8T.d.mts} +15 -16
- package/dist/{utils-fXIvFFl6.mjs → utils-DaejNWxh.mjs} +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/dist/validation/all.d.mts +4 -4
- package/dist/validation/all.d.ts +4 -4
- package/dist/validation/all.js +1 -1
- package/dist/validation/all.mjs +1 -1
- package/dist/validation/complex/currency.d.mts +4 -4
- package/dist/validation/complex/currency.d.ts +4 -4
- package/dist/validation/complex/currency.js +1 -1
- package/dist/validation/complex/currency.mjs +1 -1
- package/dist/validation/complex/location.d.mts +4 -4
- package/dist/validation/complex/location.d.ts +4 -4
- package/dist/validation/complex/location.js +1 -1
- package/dist/validation/complex/location.mjs +1 -1
- package/dist/validation/complex/phone.d.mts +4 -4
- package/dist/validation/complex/phone.d.ts +4 -4
- package/dist/validation/complex/phone.js +1 -1
- package/dist/validation/complex/phone.mjs +1 -1
- package/dist/validation/complex/relation.d.mts +6 -6
- package/dist/validation/complex/relation.d.ts +6 -6
- package/dist/validation/complex/relation.js +1 -1
- package/dist/validation/complex/relation.mjs +1 -1
- package/dist/validation/complex/richtext.d.mts +4 -4
- package/dist/validation/complex/richtext.d.ts +4 -4
- package/dist/validation/complex/richtext.js +1 -1
- package/dist/validation/complex/richtext.mjs +1 -1
- package/dist/validation/complex/select.d.mts +6 -6
- package/dist/validation/complex/select.d.ts +6 -6
- package/dist/validation/complex/select.js +1 -1
- package/dist/validation/complex/select.mjs +1 -1
- package/dist/validation/complex/user.d.mts +4 -4
- package/dist/validation/complex/user.d.ts +4 -4
- package/dist/validation/complex/user.js +1 -1
- package/dist/validation/complex/user.mjs +1 -1
- package/dist/validation/computed/formula.d.mts +4 -4
- package/dist/validation/computed/formula.d.ts +4 -4
- package/dist/validation/computed/formula.js +1 -1
- package/dist/validation/computed/formula.mjs +1 -1
- package/dist/validation/computed/rollup.d.mts +4 -4
- package/dist/validation/computed/rollup.d.ts +4 -4
- package/dist/validation/computed/rollup.js +1 -1
- package/dist/validation/computed/rollup.mjs +1 -1
- package/dist/validation/config/index.d.mts +1 -1
- package/dist/validation/config/index.d.ts +1 -1
- package/dist/validation/config/index.js +1 -1
- package/dist/validation/config/index.mjs +1 -1
- package/dist/validation/core/index.d.mts +1 -1
- package/dist/validation/core/index.d.ts +1 -1
- package/dist/validation/core/index.js +1 -1
- package/dist/validation/core/index.mjs +1 -1
- package/dist/validation/object/index.d.mts +1 -1
- package/dist/validation/object/index.d.ts +1 -1
- package/dist/validation/object/index.js +1 -1
- package/dist/validation/object/index.mjs +1 -1
- package/dist/validation/primitives/checkbox.d.mts +1 -1
- package/dist/validation/primitives/checkbox.d.ts +1 -1
- package/dist/validation/primitives/checkbox.js +1 -1
- package/dist/validation/primitives/checkbox.mjs +1 -1
- package/dist/validation/primitives/date.d.mts +1 -1
- package/dist/validation/primitives/date.d.ts +1 -1
- package/dist/validation/primitives/date.js +1 -1
- package/dist/validation/primitives/date.mjs +1 -1
- package/dist/validation/primitives/number.d.mts +1 -1
- package/dist/validation/primitives/number.d.ts +1 -1
- package/dist/validation/primitives/number.js +1 -1
- package/dist/validation/primitives/number.mjs +1 -1
- package/dist/validation/primitives/text.d.mts +1 -1
- package/dist/validation/primitives/text.d.ts +1 -1
- package/dist/validation/primitives/text.js +1 -1
- package/dist/validation/primitives/text.mjs +1 -1
- package/dist/view-config.schema-Dl5GkAzl.mjs +2 -0
- package/dist/view-config.schema-DwZVS0Gn.js +2 -0
- package/dist/zod-locale-D_QkXhnp.d.mts +2 -0
- package/dist/zod-locale-D_QkXhnp.d.ts +2 -0
- package/dist/zod-locale.d.mts +2 -0
- package/dist/zod-locale.d.ts +2 -0
- package/dist/zod-locale.js +2 -0
- package/dist/zod-locale.mjs +2 -0
- package/package.json +17 -3
- package/dist/attribute-validators-DRqhAt2t.mjs +0 -11
- package/dist/attribute-validators-WAoJbap5.js +0 -11
- package/dist/checkbox-CQRDh5tF.d.ts +0 -11
- package/dist/checkbox-D00iEidf.d.mts +0 -11
- package/dist/config-BIxnbUN8.mjs +0 -2
- package/dist/config-DdjlHdPg.js +0 -2
- package/dist/number-BwCSeK20.d.ts +0 -11
- package/dist/number-CisXUosg.d.mts +0 -11
- package/dist/object-DcgxLvip.js +0 -4
- package/dist/object-Dzl7sfq8.mjs +0 -4
- package/dist/phone-BB-tzcSr.js +0 -2
- package/dist/phone-Bca_xiOX.mjs +0 -2
- package/dist/record-aggregates-DwpIJ2Dv.js +0 -2
- package/dist/record-operation-B7t5aXW3.js +0 -2
- package/dist/record-operation-DueJTyDh.mjs +0 -2
- package/dist/text-A9AJ1wUO.js +0 -2
- package/dist/text-C8Lb-NFo.mjs +0 -2
- package/dist/text-SkYUYEnE.d.ts +0 -11
- package/dist/text-Z1_WL8cd.d.mts +0 -11
- package/dist/view-config.schema-BqO1hmWR.mjs +0 -2
- package/dist/view-config.schema-DVoE_g3g.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Attribute } from "./attributes-BcA_reJZ.js";
|
|
3
3
|
import { z as z$1 } from "zod";
|
|
4
4
|
//#region src/validation/core/types.d.ts
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ import { z as z$1 } from "zod";
|
|
|
7
7
|
* All functions receive the full Attribute to access label, type, etc.
|
|
8
8
|
* Can be customized for i18n support.
|
|
9
9
|
*/
|
|
10
|
-
interface ValidationMessages {
|
|
10
|
+
export interface ValidationMessages {
|
|
11
11
|
required: (attr: Attribute) => string;
|
|
12
12
|
invalidType: (attr: Attribute, expected: string) => string;
|
|
13
13
|
minLength: (attr: Attribute, min: number) => string;
|
|
@@ -28,7 +28,7 @@ interface ValidationMessages {
|
|
|
28
28
|
/**
|
|
29
29
|
* Validation result
|
|
30
30
|
*/
|
|
31
|
-
interface ValidationResult {
|
|
31
|
+
export interface ValidationResult {
|
|
32
32
|
success: boolean;
|
|
33
33
|
data?: Record<string, unknown>;
|
|
34
34
|
errors?: Array<{
|
|
@@ -38,16 +38,15 @@ interface ValidationResult {
|
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
40
|
//#region src/validation/core/messages.d.ts
|
|
41
|
-
declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
|
|
41
|
+
export declare const DEFAULT_VALIDATION_MESSAGES: ValidationMessages;
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/validation/core/errors.d.ts
|
|
44
44
|
/**
|
|
45
45
|
* Format Zod validation errors into a consistent structure.
|
|
46
46
|
* This eliminates code duplication across multiple validation functions.
|
|
47
47
|
*/
|
|
48
|
-
declare function formatZodErrors(error: z$1.ZodError): Array<{
|
|
48
|
+
export declare function formatZodErrors(error: z$1.ZodError): Array<{
|
|
49
49
|
path: string[];
|
|
50
50
|
message: string;
|
|
51
51
|
}>;
|
|
52
|
-
//#endregion
|
|
53
|
-
export { ValidationResult as i, DEFAULT_VALIDATION_MESSAGES as n, ValidationMessages as r, formatZodErrors as t };
|
|
52
|
+
//#endregion
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import { ObjectDefinition } from "./objects-CLxyZh-U.js";
|
|
3
|
+
import { Attribute } from "./attributes-BcA_reJZ.js";
|
|
4
|
+
import { ValidationMessages, ValidationResult } from "./index-CCH94vyR.js";
|
|
5
|
+
import * as z$2 from "zod";
|
|
6
6
|
//#region src/validation/object/attribute-factory.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Create a Zod schema for any attribute type.
|
|
@@ -12,7 +12,7 @@ import { z as z$1 } from "zod";
|
|
|
12
12
|
* @param attr - The attribute to create a validator for
|
|
13
13
|
* @param messages - Custom validation messages for i18n support
|
|
14
14
|
*/
|
|
15
|
-
declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$
|
|
15
|
+
export declare function createAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$2.ZodTypeAny;
|
|
16
16
|
/**
|
|
17
17
|
* Create a Zod schema for form validation.
|
|
18
18
|
* - Normalizes empty values (empty strings, empty objects) to null for optional fields
|
|
@@ -23,7 +23,7 @@ declare function createAttributeValidator(attr: Attribute, messages?: Validation
|
|
|
23
23
|
* @param attr - The attribute to create a validator for
|
|
24
24
|
* @param messages - Custom validation messages for i18n support
|
|
25
25
|
*/
|
|
26
|
-
declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$
|
|
26
|
+
export declare function createFormAttributeValidator(attr: Attribute, messages?: ValidationMessages): z$2.ZodTypeAny;
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/validation/object/object-validator.d.ts
|
|
29
29
|
/**
|
|
@@ -35,7 +35,7 @@ declare function createFormAttributeValidator(attr: Attribute, messages?: Valida
|
|
|
35
35
|
* Result is cached per ObjectDefinition instance — safe because ObjectDefinitions
|
|
36
36
|
* are stable after module load and never mutated at runtime.
|
|
37
37
|
*/
|
|
38
|
-
declare function createObjectValidator(objectDef: ObjectDefinition): z$
|
|
38
|
+
export declare function createObjectValidator(objectDef: ObjectDefinition): z$2.ZodType<Record<string, unknown>>;
|
|
39
39
|
/**
|
|
40
40
|
* Create a Zod schema for draft validation.
|
|
41
41
|
* All attributes become optional, but provided values are still validated.
|
|
@@ -46,37 +46,37 @@ declare function createObjectValidator(objectDef: ObjectDefinition): z$1.ZodType
|
|
|
46
46
|
* Result is cached per ObjectDefinition instance — safe because ObjectDefinitions
|
|
47
47
|
* are stable after module load and never mutated at runtime.
|
|
48
48
|
*/
|
|
49
|
-
declare function createDraftValidator(objectDef: ObjectDefinition): z$
|
|
49
|
+
export declare function createDraftValidator(objectDef: ObjectDefinition): z$2.ZodType<Record<string, unknown>>;
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/validation/object/helpers.d.ts
|
|
52
52
|
/**
|
|
53
53
|
* Validate data against an attribute schema
|
|
54
54
|
*/
|
|
55
|
-
declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
|
|
55
|
+
export declare function validateAttribute(attr: Attribute, value: unknown): ValidationResult;
|
|
56
56
|
/**
|
|
57
57
|
* Validate data against an object schema
|
|
58
58
|
*/
|
|
59
|
-
declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
|
|
59
|
+
export declare function validateObject(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
|
|
60
60
|
/**
|
|
61
61
|
* Validate and throw if invalid.
|
|
62
62
|
*
|
|
63
63
|
* Throws `ValidationError` (code `SCHEMA_VALIDATION_FAILED`) on failure so HTTP
|
|
64
64
|
* adapters can map it to 400. Generic `Error` would bubble up to a 500.
|
|
65
65
|
*/
|
|
66
|
-
declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
|
|
66
|
+
export declare function validateObjectOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
|
|
67
67
|
/**
|
|
68
68
|
* Validate data in draft mode.
|
|
69
69
|
* - All attributes are treated as optional (no required validation)
|
|
70
70
|
* - Provided values are still validated for format/type correctness
|
|
71
71
|
*/
|
|
72
|
-
declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
|
|
72
|
+
export declare function validateDraft(objectDef: ObjectDefinition, data: Record<string, unknown>): ValidationResult;
|
|
73
73
|
/**
|
|
74
74
|
* Validate draft data and throw if format validation fails.
|
|
75
75
|
*
|
|
76
76
|
* Same contract as `validateObjectOrThrow` but skips `required()` checks.
|
|
77
77
|
* Throws `ValidationError` so HTTP adapters map it to 400.
|
|
78
78
|
*/
|
|
79
|
-
declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
|
|
79
|
+
export declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): Record<string, unknown>;
|
|
80
80
|
/**
|
|
81
81
|
* Throw a `ValidationError` when `data` contains keys that do not correspond
|
|
82
82
|
* to any attribute declared on `objectDef`.
|
|
@@ -88,14 +88,13 @@ declare function validateDraftOrThrow(objectDef: ObjectDefinition, data: Record<
|
|
|
88
88
|
*
|
|
89
89
|
* Maps to HTTP 400 via `SchemaExceptionFilter` (code SCHEMA_VALIDATION_FAILED).
|
|
90
90
|
*/
|
|
91
|
-
declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
|
|
91
|
+
export declare function rejectUnknownAttributesOrThrow(objectDef: ObjectDefinition, data: Record<string, unknown>): void;
|
|
92
92
|
/**
|
|
93
93
|
* Get the list of required attributes that are missing values.
|
|
94
94
|
*/
|
|
95
|
-
declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
|
|
95
|
+
export declare function getMissingRequiredAttributes(objectDef: ObjectDefinition, data: Record<string, unknown>): Attribute[];
|
|
96
96
|
/**
|
|
97
97
|
* Check if a record is complete (all required attributes have valid values).
|
|
98
98
|
*/
|
|
99
|
-
declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
|
|
100
|
-
//#endregion
|
|
101
|
-
export { validateDraft as a, validateObjectOrThrow as c, createAttributeValidator as d, createFormAttributeValidator as f, validateAttribute as i, createDraftValidator as l, isRecordComplete as n, validateDraftOrThrow as o, rejectUnknownAttributesOrThrow as r, validateObject as s, getMissingRequiredAttributes as t, createObjectValidator as u };
|
|
99
|
+
export declare function isRecordComplete(objectDef: ObjectDefinition, data: Record<string, unknown>): boolean;
|
|
100
|
+
//#endregion
|