@basictech/schema 0.5.0 → 0.7.0-beta.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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js +708 -66
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +706 -56
- package/dist/index.mjs.map +1 -1
- package/generated-validator.d.ts +5 -0
- package/generated-validator.js +4 -0
- package/index.test.ts +670 -0
- package/index.ts +129 -63
- package/package.json +11 -7
- package/scripts/generate-validator.js +160 -0
- package/vitest.config.ts +8 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/schema@0.
|
|
3
|
+
> @basictech/schema@0.5.0 build
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: ./index.ts
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
14
|
+
[32mCJS[39m [1mdist/index.js [22m[32m13.75 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m26.36 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 9ms
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m11.93 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m26.28 KB[39m
|
|
19
|
+
[32mESM[39m ⚡️ Build success in 9ms
|
|
20
20
|
[34mDTS[39m Build start
|
|
21
|
-
[32mDTS[39m ⚡️ Build success in
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
23
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
21
|
+
[32mDTS[39m ⚡️ Build success in 1166ms
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m7.04 KB[39m
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m7.04 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ErrorObject as ErrorObject$1 } from 'ajv';
|
|
2
|
+
|
|
1
3
|
declare function generateEmptySchema(project_id?: string, version?: number): {
|
|
2
4
|
project_id: string;
|
|
3
5
|
version: number;
|
|
@@ -39,7 +41,7 @@ declare function compareSchemas(oldSchema: any, newSchema: any): {
|
|
|
39
41
|
*/
|
|
40
42
|
declare function validateSchema(schema: Schema): {
|
|
41
43
|
valid: boolean;
|
|
42
|
-
errors: ErrorObject[];
|
|
44
|
+
errors: ErrorObject$1[];
|
|
43
45
|
};
|
|
44
46
|
type ErrorObject = {
|
|
45
47
|
keyword?: string;
|
|
@@ -79,7 +81,28 @@ type SchemaChange = {
|
|
|
79
81
|
};
|
|
80
82
|
declare function validateUpdateSchema(oldSchema: any, newSchema: any): {
|
|
81
83
|
valid: boolean;
|
|
82
|
-
errors: ErrorObject[];
|
|
84
|
+
errors: ErrorObject$1<string, Record<string, any>, unknown>[];
|
|
85
|
+
message: string;
|
|
86
|
+
changes?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
valid: boolean;
|
|
89
|
+
errors: {
|
|
90
|
+
change: {
|
|
91
|
+
type: string;
|
|
92
|
+
property: string;
|
|
93
|
+
old: any;
|
|
94
|
+
new: any;
|
|
95
|
+
};
|
|
96
|
+
message: string;
|
|
97
|
+
}[];
|
|
98
|
+
message: string;
|
|
99
|
+
changes?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
valid: boolean;
|
|
102
|
+
errors: {
|
|
103
|
+
change: SchemaChange;
|
|
104
|
+
message: string;
|
|
105
|
+
}[];
|
|
83
106
|
message: string;
|
|
84
107
|
changes?: undefined;
|
|
85
108
|
} | {
|
|
@@ -115,7 +138,7 @@ declare function getJsonSchema(): {
|
|
|
115
138
|
type: string;
|
|
116
139
|
};
|
|
117
140
|
patternProperties: {
|
|
118
|
-
"^[a-zA-Z0-9_]
|
|
141
|
+
"^(?!id$|ID$|Id$|iD$)[a-zA-Z0-9][a-zA-Z0-9_]*$": {
|
|
119
142
|
type: string;
|
|
120
143
|
propertyNames: {
|
|
121
144
|
pattern: string;
|
|
@@ -168,7 +191,7 @@ declare function getJsonSchema(): {
|
|
|
168
191
|
type: string;
|
|
169
192
|
};
|
|
170
193
|
patternProperties: {
|
|
171
|
-
"^[a-zA-Z0-9_]
|
|
194
|
+
"^(?!id$|ID$|Id$|iD$)[a-zA-Z0-9][a-zA-Z0-9_]*$": {
|
|
172
195
|
type: string;
|
|
173
196
|
properties: {
|
|
174
197
|
type: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ErrorObject as ErrorObject$1 } from 'ajv';
|
|
2
|
+
|
|
1
3
|
declare function generateEmptySchema(project_id?: string, version?: number): {
|
|
2
4
|
project_id: string;
|
|
3
5
|
version: number;
|
|
@@ -39,7 +41,7 @@ declare function compareSchemas(oldSchema: any, newSchema: any): {
|
|
|
39
41
|
*/
|
|
40
42
|
declare function validateSchema(schema: Schema): {
|
|
41
43
|
valid: boolean;
|
|
42
|
-
errors: ErrorObject[];
|
|
44
|
+
errors: ErrorObject$1[];
|
|
43
45
|
};
|
|
44
46
|
type ErrorObject = {
|
|
45
47
|
keyword?: string;
|
|
@@ -79,7 +81,28 @@ type SchemaChange = {
|
|
|
79
81
|
};
|
|
80
82
|
declare function validateUpdateSchema(oldSchema: any, newSchema: any): {
|
|
81
83
|
valid: boolean;
|
|
82
|
-
errors: ErrorObject[];
|
|
84
|
+
errors: ErrorObject$1<string, Record<string, any>, unknown>[];
|
|
85
|
+
message: string;
|
|
86
|
+
changes?: undefined;
|
|
87
|
+
} | {
|
|
88
|
+
valid: boolean;
|
|
89
|
+
errors: {
|
|
90
|
+
change: {
|
|
91
|
+
type: string;
|
|
92
|
+
property: string;
|
|
93
|
+
old: any;
|
|
94
|
+
new: any;
|
|
95
|
+
};
|
|
96
|
+
message: string;
|
|
97
|
+
}[];
|
|
98
|
+
message: string;
|
|
99
|
+
changes?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
valid: boolean;
|
|
102
|
+
errors: {
|
|
103
|
+
change: SchemaChange;
|
|
104
|
+
message: string;
|
|
105
|
+
}[];
|
|
83
106
|
message: string;
|
|
84
107
|
changes?: undefined;
|
|
85
108
|
} | {
|
|
@@ -115,7 +138,7 @@ declare function getJsonSchema(): {
|
|
|
115
138
|
type: string;
|
|
116
139
|
};
|
|
117
140
|
patternProperties: {
|
|
118
|
-
"^[a-zA-Z0-9_]
|
|
141
|
+
"^(?!id$|ID$|Id$|iD$)[a-zA-Z0-9][a-zA-Z0-9_]*$": {
|
|
119
142
|
type: string;
|
|
120
143
|
propertyNames: {
|
|
121
144
|
pattern: string;
|
|
@@ -168,7 +191,7 @@ declare function getJsonSchema(): {
|
|
|
168
191
|
type: string;
|
|
169
192
|
};
|
|
170
193
|
patternProperties: {
|
|
171
|
-
"^[a-zA-Z0-9_]
|
|
194
|
+
"^(?!id$|ID$|Id$|iD$)[a-zA-Z0-9][a-zA-Z0-9_]*$": {
|
|
172
195
|
type: string;
|
|
173
196
|
properties: {
|
|
174
197
|
type: {
|