@dzeio/schema 0.0.1 → 0.0.2
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/Schema.d.mts +12 -1
- package/dist/Schema.d.ts +12 -1
- package/dist/Schema.js +3 -0
- package/dist/Schema.mjs +3 -0
- package/package.json +3 -2
package/dist/Schema.d.mts
CHANGED
|
@@ -43,6 +43,7 @@ declare abstract class SchemaItem<Type = any> implements StandardSchemaV1<Type>
|
|
|
43
43
|
attr(...attributes: Array<string>): this;
|
|
44
44
|
setInvalidError(err: string): this;
|
|
45
45
|
clone(): this;
|
|
46
|
+
nullable(): SchemaNullable<this>;
|
|
46
47
|
/**
|
|
47
48
|
* schemas implementing unwrap can return their child component (mostly the value)
|
|
48
49
|
*
|
|
@@ -83,6 +84,16 @@ type ValidationResult<T> = {
|
|
|
83
84
|
errors: Array<ValidationError>
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
type ValidationResultOld<T> = {
|
|
88
|
+
object: T
|
|
89
|
+
valid: true
|
|
90
|
+
error?: undefined
|
|
91
|
+
} | {
|
|
92
|
+
valid: false
|
|
93
|
+
object?: (T extends object ? Partial<T> : T) | undefined
|
|
94
|
+
error: Array<ValidationError>
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
interface SchemaJSON {
|
|
87
98
|
i: string
|
|
88
99
|
a?: Array<string> | undefined
|
|
@@ -329,4 +340,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
329
340
|
}
|
|
330
341
|
declare const s: typeof Schema;
|
|
331
342
|
|
|
332
|
-
export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
|
|
343
|
+
export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
|
package/dist/Schema.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ declare abstract class SchemaItem<Type = any> implements StandardSchemaV1<Type>
|
|
|
43
43
|
attr(...attributes: Array<string>): this;
|
|
44
44
|
setInvalidError(err: string): this;
|
|
45
45
|
clone(): this;
|
|
46
|
+
nullable(): SchemaNullable<this>;
|
|
46
47
|
/**
|
|
47
48
|
* schemas implementing unwrap can return their child component (mostly the value)
|
|
48
49
|
*
|
|
@@ -83,6 +84,16 @@ type ValidationResult<T> = {
|
|
|
83
84
|
errors: Array<ValidationError>
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
type ValidationResultOld<T> = {
|
|
88
|
+
object: T
|
|
89
|
+
valid: true
|
|
90
|
+
error?: undefined
|
|
91
|
+
} | {
|
|
92
|
+
valid: false
|
|
93
|
+
object?: (T extends object ? Partial<T> : T) | undefined
|
|
94
|
+
error: Array<ValidationError>
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
interface SchemaJSON {
|
|
87
98
|
i: string
|
|
88
99
|
a?: Array<string> | undefined
|
|
@@ -329,4 +340,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
329
340
|
}
|
|
330
341
|
declare const s: typeof Schema;
|
|
331
342
|
|
|
332
|
-
export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
|
|
343
|
+
export { type Infer, type Model, type ModelInfer$1 as ModelInfer, SchemaArray, SchemaBoolean, SchemaDate, SchemaEnum, type SchemaInfer, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNullable, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUnion, Types, type ValidationError, type ValidationResult, type ValidationResultOld, Schema as default, parceable, parseForm, parseFormData, parseQuery, s };
|
package/dist/Schema.js
CHANGED
package/dist/Schema.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzeio/schema",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dzeio/object-util": "^1.8.3"
|
|
6
6
|
},
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"test": "bun test",
|
|
39
39
|
"lint": "eslint",
|
|
40
|
-
"build": "rm -rf dist && tsup ./src/Schema.ts --format cjs,esm --dts --clean"
|
|
40
|
+
"build": "rm -rf dist && tsup ./src/Schema.ts --format cjs,esm --dts --clean",
|
|
41
|
+
"prepublishOnly": "rm -rf dist && tsup ./src/Schema.ts --format cjs,esm --dts --clean"
|
|
41
42
|
}
|
|
42
43
|
}
|