orchid-orm-schema-to-zod 0.2.19 → 0.2.20
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-test:ci.log +56 -56
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +1 -1
- package/package.json +4 -3
- package/tsconfig.json +1 -1
package/.turbo/turbo-test:ci.log
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
> orchid-orm-schema-to-zod@0.2.
|
|
2
|
+
> orchid-orm-schema-to-zod@0.2.19 test:ci /home/romeo/dev/my/orchid-orm/packages/schema-to-zod
|
|
3
3
|
> jest --coverage --coverageReporters json-summary
|
|
4
4
|
|
|
5
|
-
PASS src/index.test.ts (
|
|
5
|
+
PASS src/index.test.ts (5.062 s)
|
|
6
6
|
table to zod
|
|
7
|
-
✓ should convert a table to a zod validation schema (
|
|
7
|
+
✓ should convert a table to a zod validation schema (73 ms)
|
|
8
8
|
instance to zod
|
|
9
9
|
✓ should convert object with shape to a zod validation schema (2 ms)
|
|
10
10
|
schema to zod
|
|
@@ -15,32 +15,32 @@ PASS src/index.test.ts (7.849 s)
|
|
|
15
15
|
✓ should transform column value to a type (1 ms)
|
|
16
16
|
✓ should transform json value to a type (1 ms)
|
|
17
17
|
refine
|
|
18
|
-
✓ should add a refine check for column type (
|
|
19
|
-
✓ should add a refine check for json type (
|
|
18
|
+
✓ should add a refine check for column type (3 ms)
|
|
19
|
+
✓ should add a refine check for json type (1 ms)
|
|
20
20
|
superRefine
|
|
21
21
|
✓ should add a superRefine check for column type (1 ms)
|
|
22
22
|
✓ should add a superRefine check for json type (1 ms)
|
|
23
23
|
validationDefault
|
|
24
|
-
✓ should set default value for column (
|
|
24
|
+
✓ should set default value for column (1 ms)
|
|
25
25
|
✓ should set default value for json type (1 ms)
|
|
26
26
|
nullable
|
|
27
|
-
✓ should parse nullable
|
|
27
|
+
✓ should parse nullable (1 ms)
|
|
28
28
|
smallint
|
|
29
|
-
✓ should convert to number (
|
|
29
|
+
✓ should convert to number (12 ms)
|
|
30
30
|
integer
|
|
31
|
-
✓ should convert to number (
|
|
31
|
+
✓ should convert to number (26 ms)
|
|
32
32
|
real
|
|
33
|
-
✓ should convert to number (
|
|
33
|
+
✓ should convert to number (9 ms)
|
|
34
34
|
smallSerial
|
|
35
|
-
✓ should convert to number (
|
|
35
|
+
✓ should convert to number (7 ms)
|
|
36
36
|
serial
|
|
37
|
-
✓ should convert to number (
|
|
37
|
+
✓ should convert to number (8 ms)
|
|
38
38
|
money
|
|
39
|
-
✓ should convert to number (
|
|
39
|
+
✓ should convert to number (7 ms)
|
|
40
40
|
bigint
|
|
41
41
|
✓ should validate bigint and parse to a string (1 ms)
|
|
42
42
|
numeric
|
|
43
|
-
✓ should validate bigint and parse to a string (
|
|
43
|
+
✓ should validate bigint and parse to a string (23 ms)
|
|
44
44
|
decimal
|
|
45
45
|
✓ should validate bigint and parse to a string (1 ms)
|
|
46
46
|
doublePrecision
|
|
@@ -48,40 +48,40 @@ PASS src/index.test.ts (7.849 s)
|
|
|
48
48
|
bigSerial
|
|
49
49
|
✓ should validate bigint and parse to a string (1 ms)
|
|
50
50
|
varchar
|
|
51
|
-
✓ should convert to string (
|
|
51
|
+
✓ should convert to string (7 ms)
|
|
52
52
|
✓ should convert to string with limit (1 ms)
|
|
53
53
|
char
|
|
54
|
-
✓ should convert to string (
|
|
54
|
+
✓ should convert to string (6 ms)
|
|
55
55
|
✓ should convert to string with limit (2 ms)
|
|
56
56
|
text
|
|
57
|
-
✓ should convert to string (
|
|
57
|
+
✓ should convert to string (6 ms)
|
|
58
58
|
string
|
|
59
|
-
✓ should convert to string (
|
|
59
|
+
✓ should convert to string (8 ms)
|
|
60
60
|
bytea
|
|
61
|
-
✓ should check Buffer (
|
|
61
|
+
✓ should check Buffer (2 ms)
|
|
62
62
|
date
|
|
63
|
-
✓ should parse from string to a Date (
|
|
64
|
-
✓ should parse from Date to a Date (
|
|
63
|
+
✓ should parse from string to a Date (1 ms)
|
|
64
|
+
✓ should parse from Date to a Date (21 ms)
|
|
65
65
|
timestamp
|
|
66
66
|
✓ should parse from string to a Date (1 ms)
|
|
67
|
-
✓ should parse from Date to a Date (
|
|
67
|
+
✓ should parse from Date to a Date (1 ms)
|
|
68
68
|
timestampWithTimeZone
|
|
69
|
-
✓ should parse from string to a Date
|
|
70
|
-
✓ should parse from Date to a Date (
|
|
69
|
+
✓ should parse from string to a Date
|
|
70
|
+
✓ should parse from Date to a Date (1 ms)
|
|
71
71
|
time
|
|
72
|
-
✓ should validate and parse to a string (
|
|
72
|
+
✓ should validate and parse to a string (1 ms)
|
|
73
73
|
timeWithTimeZone
|
|
74
74
|
✓ should validate and parse to a string (1 ms)
|
|
75
75
|
interval
|
|
76
|
-
✓ should validate and parse time interval (
|
|
76
|
+
✓ should validate and parse time interval (1 ms)
|
|
77
77
|
boolean
|
|
78
|
-
✓ should validate and parse a boolean (
|
|
78
|
+
✓ should validate and parse a boolean (1 ms)
|
|
79
79
|
enum
|
|
80
|
-
✓ should validate and parse enum (
|
|
80
|
+
✓ should validate and parse enum (1 ms)
|
|
81
81
|
point
|
|
82
82
|
✓ should parse to a string without validation (1 ms)
|
|
83
83
|
line
|
|
84
|
-
✓ should parse to a string without validation
|
|
84
|
+
✓ should parse to a string without validation (1 ms)
|
|
85
85
|
lseg
|
|
86
86
|
✓ should parse to a string without validation
|
|
87
87
|
box
|
|
@@ -95,19 +95,19 @@ PASS src/index.test.ts (7.849 s)
|
|
|
95
95
|
cidr
|
|
96
96
|
✓ should parse to a string without validation (1 ms)
|
|
97
97
|
inet
|
|
98
|
-
✓ should parse to a string without validation
|
|
98
|
+
✓ should parse to a string without validation
|
|
99
99
|
macaddr
|
|
100
|
-
✓ should parse to a string without validation
|
|
100
|
+
✓ should parse to a string without validation
|
|
101
101
|
macaddr8
|
|
102
102
|
✓ should parse to a string without validation (1 ms)
|
|
103
103
|
bit
|
|
104
|
-
✓ should validate a string to contain only 1 or 0 and parse to a string (
|
|
104
|
+
✓ should validate a string to contain only 1 or 0 and parse to a string (1 ms)
|
|
105
105
|
bitVarying
|
|
106
|
-
✓ should validate a string to contain only 1 or 0 and parse to a string (
|
|
106
|
+
✓ should validate a string to contain only 1 or 0 and parse to a string (5 ms)
|
|
107
107
|
tsvector
|
|
108
|
-
✓ should parse to a string without validation
|
|
108
|
+
✓ should parse to a string without validation
|
|
109
109
|
tsquery
|
|
110
|
-
✓ should parse to a string without validation
|
|
110
|
+
✓ should parse to a string without validation
|
|
111
111
|
xml
|
|
112
112
|
✓ should parse to a string without validation (1 ms)
|
|
113
113
|
jsonText
|
|
@@ -115,7 +115,7 @@ PASS src/index.test.ts (7.849 s)
|
|
|
115
115
|
uuid
|
|
116
116
|
✓ should validate uuid and parse to a string (1 ms)
|
|
117
117
|
array
|
|
118
|
-
✓ should validate and parse array (
|
|
118
|
+
✓ should validate and parse array (5 ms)
|
|
119
119
|
json
|
|
120
120
|
any
|
|
121
121
|
✓ should parse to any (1 ms)
|
|
@@ -124,69 +124,69 @@ PASS src/index.test.ts (7.849 s)
|
|
|
124
124
|
boolean
|
|
125
125
|
✓ should parse boolean (1 ms)
|
|
126
126
|
date
|
|
127
|
-
✓ should parse a Date (
|
|
127
|
+
✓ should parse a Date (19 ms)
|
|
128
128
|
nan
|
|
129
129
|
✓ should parse a NaN (1 ms)
|
|
130
130
|
never
|
|
131
131
|
✓ should parse a never (1 ms)
|
|
132
132
|
null
|
|
133
|
-
✓ should parse a null (
|
|
133
|
+
✓ should parse a null (1 ms)
|
|
134
134
|
number
|
|
135
|
-
✓ should parse a number (
|
|
135
|
+
✓ should parse a number (8 ms)
|
|
136
136
|
string
|
|
137
|
-
✓ should parse a string (
|
|
137
|
+
✓ should parse a string (6 ms)
|
|
138
138
|
undefined
|
|
139
|
-
✓ should parse a undefined (
|
|
139
|
+
✓ should parse a undefined (1 ms)
|
|
140
140
|
unknown
|
|
141
141
|
✓ should parse unknown
|
|
142
142
|
void
|
|
143
143
|
✓ should parse void (1 ms)
|
|
144
144
|
array
|
|
145
|
-
✓ should validate and parse array (
|
|
145
|
+
✓ should validate and parse array (4 ms)
|
|
146
146
|
enum
|
|
147
147
|
✓ should parse enum (1 ms)
|
|
148
148
|
instanceOf
|
|
149
149
|
✓ should parse instance of (1 ms)
|
|
150
150
|
literal
|
|
151
|
-
✓ should parse literal (
|
|
151
|
+
✓ should parse literal (1 ms)
|
|
152
152
|
map
|
|
153
153
|
✓ should parse map (2 ms)
|
|
154
154
|
set
|
|
155
|
-
✓ should parse set (
|
|
155
|
+
✓ should parse set (4 ms)
|
|
156
156
|
nativeEnum
|
|
157
|
-
✓ should parse native enum (
|
|
157
|
+
✓ should parse native enum (1 ms)
|
|
158
158
|
tuple
|
|
159
159
|
✓ should parse tuple (2 ms)
|
|
160
160
|
✓ should parse rest elements (1 ms)
|
|
161
161
|
nullable
|
|
162
|
-
✓ should parse nullable
|
|
162
|
+
✓ should parse nullable
|
|
163
163
|
nullish
|
|
164
|
-
✓ should parse nullish
|
|
164
|
+
✓ should parse nullish
|
|
165
165
|
optional
|
|
166
|
-
✓ should parse optional
|
|
166
|
+
✓ should parse optional (1 ms)
|
|
167
167
|
object
|
|
168
168
|
✓ should parse object (1 ms)
|
|
169
|
-
✓ should parse object with passing through unknown keys (
|
|
170
|
-
✓ should parse object with strict unknown keys (
|
|
171
|
-
✓ should parse object with catch all option (
|
|
169
|
+
✓ should parse object with passing through unknown keys (1 ms)
|
|
170
|
+
✓ should parse object with strict unknown keys (16 ms)
|
|
171
|
+
✓ should parse object with catch all option (1 ms)
|
|
172
172
|
record
|
|
173
|
-
✓ should parse record (
|
|
173
|
+
✓ should parse record (2 ms)
|
|
174
174
|
intersection
|
|
175
|
-
✓ should parse intersection (
|
|
175
|
+
✓ should parse intersection (2 ms)
|
|
176
176
|
union
|
|
177
177
|
✓ should parse union (2 ms)
|
|
178
178
|
discriminatedUnion
|
|
179
179
|
✓ should parse discriminated union (2 ms)
|
|
180
180
|
lazy
|
|
181
|
-
✓ should parse lazy type (
|
|
181
|
+
✓ should parse lazy type (9 ms)
|
|
182
182
|
as
|
|
183
183
|
✓ should convert one type to the same schema as another type (1 ms)
|
|
184
184
|
virtual
|
|
185
185
|
✓ should skip virtual column in instanceToZod (1 ms)
|
|
186
|
-
✓ should return ZodNever from columnToZod
|
|
186
|
+
✓ should return ZodNever from columnToZod (1 ms)
|
|
187
187
|
|
|
188
188
|
Test Suites: 1 passed, 1 total
|
|
189
189
|
Tests: 97 passed, 97 total
|
|
190
190
|
Snapshots: 0 total
|
|
191
|
-
Time:
|
|
191
|
+
Time: 5.314 s
|
|
192
192
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ declare type InstanceToZod<T extends {
|
|
|
53
53
|
declare const instanceToZod: <T extends {
|
|
54
54
|
shape: ColumnsShape;
|
|
55
55
|
}>({ shape, }: T) => InstanceToZod<T>;
|
|
56
|
-
declare const columnToZod: <T extends ColumnType<unknown, pqb.
|
|
56
|
+
declare const columnToZod: <T extends ColumnType<unknown, pqb.BaseOperators, unknown>>(column: T) => SchemaToZod<T, T["dataType"]>;
|
|
57
57
|
declare const interval: z.ZodObject<{
|
|
58
58
|
years: z.ZodOptional<z.ZodNumber>;
|
|
59
59
|
months: z.ZodOptional<z.ZodNumber>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchid-orm-schema-to-zod",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.20",
|
|
4
4
|
"description": "Orchid-ORM columns schema to Zod converter",
|
|
5
5
|
"homepage": "https://orchid-orm.netlify.app/guide/columns-validation-methods.html",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"author": "Roman Kushyn",
|
|
40
40
|
"license": "ISC",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"pqb": "0.9.
|
|
42
|
+
"pqb": "0.9.14",
|
|
43
43
|
"zod": "^3.19.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"typescript": "^4.7.4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
-
"test": "jest",
|
|
59
|
+
"test": "jest --watch --verbose false",
|
|
60
|
+
"check": "jest",
|
|
60
61
|
"test:ci": "jest --coverage --coverageReporters json-summary",
|
|
61
62
|
"build": "rimraf ./dist/ && rollup -c --rollup.config"
|
|
62
63
|
}
|