@gunubin/vorm-core 0.2.0 → 0.3.0
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/index.cjs +0 -25
- package/dist/index.d.cts +1 -5
- package/dist/index.d.ts +1 -5
- package/dist/index.js +0 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,7 +23,6 @@ __export(index_exports, {
|
|
|
23
23
|
VOValidationError: () => VOValidationError,
|
|
24
24
|
createRule: () => createRule,
|
|
25
25
|
safeValidateAndCreate: () => safeValidateAndCreate,
|
|
26
|
-
toStandardSchema: () => toStandardSchema,
|
|
27
26
|
validateAndCreate: () => validateAndCreate,
|
|
28
27
|
vo: () => vo
|
|
29
28
|
});
|
|
@@ -87,35 +86,11 @@ function safeValidateAndCreate(value, rules) {
|
|
|
87
86
|
}
|
|
88
87
|
return { success: true, data: value };
|
|
89
88
|
}
|
|
90
|
-
|
|
91
|
-
// src/standard-schema.ts
|
|
92
|
-
function toStandardSchema(voDef) {
|
|
93
|
-
return {
|
|
94
|
-
"~standard": {
|
|
95
|
-
version: 1,
|
|
96
|
-
vendor: "vorm",
|
|
97
|
-
validate(value) {
|
|
98
|
-
const issues = [];
|
|
99
|
-
for (const rule of voDef.rules) {
|
|
100
|
-
if (!rule.validate(value)) {
|
|
101
|
-
issues.push({ message: rule.code });
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (issues.length > 0) {
|
|
105
|
-
return { issues };
|
|
106
|
-
}
|
|
107
|
-
return { value };
|
|
108
|
-
},
|
|
109
|
-
types: void 0
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
114
90
|
0 && (module.exports = {
|
|
115
91
|
VOValidationError,
|
|
116
92
|
createRule,
|
|
117
93
|
safeValidateAndCreate,
|
|
118
|
-
toStandardSchema,
|
|
119
94
|
validateAndCreate,
|
|
120
95
|
vo
|
|
121
96
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -80,9 +80,5 @@ declare namespace StandardSchemaV1 {
|
|
|
80
80
|
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
81
81
|
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Wraps a VODefinition as a Standard Schema v1 compliant object.
|
|
85
|
-
*/
|
|
86
|
-
declare function toStandardSchema<TInput, TBrand extends string, TCodes extends string>(voDef: VODefinition<TInput, TBrand, TCodes>): StandardSchemaV1<TInput, Brand<TInput, TBrand>>;
|
|
87
83
|
|
|
88
|
-
export { type Brand, type CreateResult, type Infer, StandardSchemaV1, type VODefinition, type VOLike, VOValidationError, type ValidationRule, createRule, safeValidateAndCreate,
|
|
84
|
+
export { type Brand, type CreateResult, type Infer, StandardSchemaV1, type VODefinition, type VOLike, VOValidationError, type ValidationRule, createRule, safeValidateAndCreate, validateAndCreate, vo };
|
package/dist/index.d.ts
CHANGED
|
@@ -80,9 +80,5 @@ declare namespace StandardSchemaV1 {
|
|
|
80
80
|
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
81
81
|
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
82
82
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Wraps a VODefinition as a Standard Schema v1 compliant object.
|
|
85
|
-
*/
|
|
86
|
-
declare function toStandardSchema<TInput, TBrand extends string, TCodes extends string>(voDef: VODefinition<TInput, TBrand, TCodes>): StandardSchemaV1<TInput, Brand<TInput, TBrand>>;
|
|
87
83
|
|
|
88
|
-
export { type Brand, type CreateResult, type Infer, StandardSchemaV1, type VODefinition, type VOLike, VOValidationError, type ValidationRule, createRule, safeValidateAndCreate,
|
|
84
|
+
export { type Brand, type CreateResult, type Infer, StandardSchemaV1, type VODefinition, type VOLike, VOValidationError, type ValidationRule, createRule, safeValidateAndCreate, validateAndCreate, vo };
|
package/dist/index.js
CHANGED
|
@@ -56,34 +56,10 @@ function safeValidateAndCreate(value, rules) {
|
|
|
56
56
|
}
|
|
57
57
|
return { success: true, data: value };
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
// src/standard-schema.ts
|
|
61
|
-
function toStandardSchema(voDef) {
|
|
62
|
-
return {
|
|
63
|
-
"~standard": {
|
|
64
|
-
version: 1,
|
|
65
|
-
vendor: "vorm",
|
|
66
|
-
validate(value) {
|
|
67
|
-
const issues = [];
|
|
68
|
-
for (const rule of voDef.rules) {
|
|
69
|
-
if (!rule.validate(value)) {
|
|
70
|
-
issues.push({ message: rule.code });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (issues.length > 0) {
|
|
74
|
-
return { issues };
|
|
75
|
-
}
|
|
76
|
-
return { value };
|
|
77
|
-
},
|
|
78
|
-
types: void 0
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
59
|
export {
|
|
83
60
|
VOValidationError,
|
|
84
61
|
createRule,
|
|
85
62
|
safeValidateAndCreate,
|
|
86
|
-
toStandardSchema,
|
|
87
63
|
validateAndCreate,
|
|
88
64
|
vo
|
|
89
65
|
};
|