orchid-orm-schema-to-zod 1.0.74 → 1.0.76
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.d.ts +163 -219
- package/dist/index.js +311 -445
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +310 -443
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,239 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ArrayColumn, ArrayColumnValue, BigIntColumn, BigSerialColumn, CitextColumn, Column, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, DateColumn, DecimalColumn, DoublePrecisionColumn, EnumColumn, IntegerColumn, JSONColumn, MoneyColumn, RealColumn, SerialColumn, SmallIntColumn, SmallSerialColumn, StringColumn, StringData, TextColumn, TimestampColumn, TimestampTZColumn, VarCharColumn } from "pqb/internal";
|
|
2
|
+
import { ZodArray, ZodBoolean, ZodDate, ZodEnum, ZodNever, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodString, ZodType, ZodTypeAny, ZodUnion, ZodUnknown, core } from "zod/v4";
|
|
4
3
|
declare class ZodJSONColumn<ZodSchema extends ZodTypeAny> extends JSONColumn<ZodSchema['_output'], ZodSchemaConfig, ZodSchema> {
|
|
5
|
-
|
|
4
|
+
constructor(schema: ZodSchema);
|
|
6
5
|
}
|
|
7
6
|
interface ArrayMethods<Value> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
interface ZodArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ZodSchemaConfig, Item, ZodArray<Item['inputSchema']>, ZodArray<Item['outputSchema']>, ZodArray<Item['querySchema']>>, ArrayMethods<number> {
|
|
7
|
+
min<T>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
8
|
+
max<T>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
9
|
+
length<T>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
10
|
+
nonEmpty<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
14
11
|
}
|
|
12
|
+
interface ZodArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ZodSchemaConfig, Item, ZodArray<Item['inputSchema']>, ZodArray<Item['outputSchema']>, ZodArray<Item['querySchema']>>, ArrayMethods<number> {}
|
|
15
13
|
declare class ZodArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ZodSchemaConfig, Item, ZodArray<Item['inputSchema']>, ZodArray<Item['outputSchema']>, ZodArray<Item['querySchema']>> {
|
|
16
|
-
|
|
14
|
+
constructor(item: Item);
|
|
17
15
|
}
|
|
18
16
|
interface NumberMethods {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
interface SmallIntColumnZod extends SmallIntColumn<ZodSchemaConfig>, NumberMethods {
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
interface
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
interface
|
|
43
|
-
}
|
|
44
|
-
declare class RealColumnZod extends RealColumn<ZodSchemaConfig> {
|
|
45
|
-
}
|
|
46
|
-
interface SmallSerialColumnZod extends SmallSerialColumn<ZodSchemaConfig>, NumberMethods {
|
|
47
|
-
}
|
|
48
|
-
declare class SmallSerialColumnZod extends SmallSerialColumn<ZodSchemaConfig> {
|
|
49
|
-
}
|
|
50
|
-
interface SerialColumnZod extends SerialColumn<ZodSchemaConfig>, NumberMethods {
|
|
51
|
-
}
|
|
52
|
-
declare class SerialColumnZod extends SerialColumn<ZodSchemaConfig> {
|
|
53
|
-
}
|
|
17
|
+
lt<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
18
|
+
lte<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
19
|
+
max<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
20
|
+
gt<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
21
|
+
gte<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
22
|
+
min<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
23
|
+
positive<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
24
|
+
nonNegative<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
25
|
+
negative<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
26
|
+
nonPositive<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
27
|
+
step<T>(this: T, value: number, params?: Column.Error.StringOrMessage): T;
|
|
28
|
+
int<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
29
|
+
finite<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
30
|
+
safe<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
31
|
+
}
|
|
32
|
+
interface SmallIntColumnZod extends SmallIntColumn<ZodSchemaConfig>, NumberMethods {}
|
|
33
|
+
declare class SmallIntColumnZod extends SmallIntColumn<ZodSchemaConfig> {}
|
|
34
|
+
interface IntegerColumnZod extends IntegerColumn<ZodSchemaConfig>, NumberMethods {}
|
|
35
|
+
declare class IntegerColumnZod extends IntegerColumn<ZodSchemaConfig> {}
|
|
36
|
+
interface RealColumnZod extends RealColumn<ZodSchemaConfig>, NumberMethods {}
|
|
37
|
+
declare class RealColumnZod extends RealColumn<ZodSchemaConfig> {}
|
|
38
|
+
interface SmallSerialColumnZod extends SmallSerialColumn<ZodSchemaConfig>, NumberMethods {}
|
|
39
|
+
declare class SmallSerialColumnZod extends SmallSerialColumn<ZodSchemaConfig> {}
|
|
40
|
+
interface SerialColumnZod extends SerialColumn<ZodSchemaConfig>, NumberMethods {}
|
|
41
|
+
declare class SerialColumnZod extends SerialColumn<ZodSchemaConfig> {}
|
|
54
42
|
interface StringMethods extends ArrayMethods<number> {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
interface BigIntColumnZod extends BigIntColumn<ZodSchemaConfig>, StringMethods {
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
interface
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
interface
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
interface
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
interface
|
|
90
|
-
}
|
|
91
|
-
declare class MoneyColumnZod extends MoneyColumn<ZodSchemaConfig> {
|
|
92
|
-
}
|
|
93
|
-
interface VarCharColumnZod extends VarCharColumn<ZodSchemaConfig>, StringMethods {
|
|
94
|
-
}
|
|
95
|
-
declare class VarCharColumnZod extends VarCharColumn<ZodSchemaConfig> {
|
|
96
|
-
}
|
|
97
|
-
interface TextColumnZod extends TextColumn<ZodSchemaConfig>, StringMethods {
|
|
98
|
-
}
|
|
99
|
-
declare class TextColumnZod extends TextColumn<ZodSchemaConfig> {
|
|
100
|
-
}
|
|
101
|
-
interface StringColumnZod extends StringColumn<ZodSchemaConfig>, StringMethods {
|
|
102
|
-
}
|
|
103
|
-
declare class StringColumnZod extends StringColumn<ZodSchemaConfig> {
|
|
104
|
-
}
|
|
105
|
-
interface CitextColumnZod extends CitextColumn<ZodSchemaConfig>, StringMethods {
|
|
106
|
-
}
|
|
107
|
-
declare class CitextColumnZod extends CitextColumn<ZodSchemaConfig> {
|
|
108
|
-
}
|
|
43
|
+
email<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
44
|
+
url<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
45
|
+
emoji<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
46
|
+
uuid<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
47
|
+
cuid<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
48
|
+
cuid2<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
49
|
+
ulid<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
50
|
+
regex<T>(this: T, value: RegExp, params?: Column.Error.StringOrMessage): T;
|
|
51
|
+
includes<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
52
|
+
startsWith<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
53
|
+
endsWith<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
54
|
+
datetime<T>(this: T, params?: StringData['datetime'] & Exclude<Column.Error.StringOrMessage, string>): T;
|
|
55
|
+
ipv4<T>(this: T, params?: Exclude<Column.Error.StringOrMessage, string>): T;
|
|
56
|
+
ipv6<T>(this: T, params?: Exclude<Column.Error.StringOrMessage, string>): T;
|
|
57
|
+
trim<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
58
|
+
toLowerCase<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
59
|
+
toUpperCase<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
60
|
+
}
|
|
61
|
+
interface BigIntColumnZod extends BigIntColumn<ZodSchemaConfig>, StringMethods {}
|
|
62
|
+
declare class BigIntColumnZod extends BigIntColumn<ZodSchemaConfig> {}
|
|
63
|
+
interface DecimalColumnZod extends DecimalColumn<ZodSchemaConfig>, StringMethods {}
|
|
64
|
+
declare class DecimalColumnZod extends DecimalColumn<ZodSchemaConfig> {}
|
|
65
|
+
interface DoublePrecisionColumnZod extends DoublePrecisionColumn<ZodSchemaConfig>, StringMethods {}
|
|
66
|
+
declare class DoublePrecisionColumnZod extends DoublePrecisionColumn<ZodSchemaConfig> {}
|
|
67
|
+
interface BigSerialColumnZod extends BigSerialColumn<ZodSchemaConfig>, StringMethods {}
|
|
68
|
+
declare class BigSerialColumnZod extends BigSerialColumn<ZodSchemaConfig> {}
|
|
69
|
+
interface MoneyColumnZod extends MoneyColumn<ZodSchemaConfig>, NumberMethods {}
|
|
70
|
+
declare class MoneyColumnZod extends MoneyColumn<ZodSchemaConfig> {}
|
|
71
|
+
interface VarCharColumnZod extends VarCharColumn<ZodSchemaConfig>, StringMethods {}
|
|
72
|
+
declare class VarCharColumnZod extends VarCharColumn<ZodSchemaConfig> {}
|
|
73
|
+
interface TextColumnZod extends TextColumn<ZodSchemaConfig>, StringMethods {}
|
|
74
|
+
declare class TextColumnZod extends TextColumn<ZodSchemaConfig> {}
|
|
75
|
+
interface StringColumnZod extends StringColumn<ZodSchemaConfig>, StringMethods {}
|
|
76
|
+
declare class StringColumnZod extends StringColumn<ZodSchemaConfig> {}
|
|
77
|
+
interface CitextColumnZod extends CitextColumn<ZodSchemaConfig>, StringMethods {}
|
|
78
|
+
declare class CitextColumnZod extends CitextColumn<ZodSchemaConfig> {}
|
|
109
79
|
interface DateMethods {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
interface DateColumnZod extends DateColumn<ZodSchemaConfig>, DateMethods {
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
interface
|
|
118
|
-
}
|
|
119
|
-
declare class TimestampNoTzColumnZod extends TimestampColumn<ZodSchemaConfig> {
|
|
120
|
-
}
|
|
121
|
-
interface TimestampColumnZod extends TimestampTZColumn<ZodSchemaConfig>, DateMethods {
|
|
122
|
-
}
|
|
123
|
-
declare class TimestampColumnZod extends TimestampTZColumn<ZodSchemaConfig> {
|
|
124
|
-
}
|
|
80
|
+
min<T>(this: T, value: Date, params?: Column.Error.StringOrMessage): T;
|
|
81
|
+
max<T>(this: T, value: Date, params?: Column.Error.StringOrMessage): T;
|
|
82
|
+
}
|
|
83
|
+
interface DateColumnZod extends DateColumn<ZodSchemaConfig>, DateMethods {}
|
|
84
|
+
declare class DateColumnZod extends DateColumn<ZodSchemaConfig> {}
|
|
85
|
+
interface TimestampNoTzColumnZod extends TimestampColumn<ZodSchemaConfig>, DateMethods {}
|
|
86
|
+
declare class TimestampNoTzColumnZod extends TimestampColumn<ZodSchemaConfig> {}
|
|
87
|
+
interface TimestampColumnZod extends TimestampTZColumn<ZodSchemaConfig>, DateMethods {}
|
|
88
|
+
declare class TimestampColumnZod extends TimestampTZColumn<ZodSchemaConfig> {}
|
|
125
89
|
type PointSchemaZod = ZodObject<{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
90
|
+
srid: ZodOptional<ZodNumber>;
|
|
91
|
+
lon: ZodNumber;
|
|
92
|
+
lat: ZodNumber;
|
|
129
93
|
}>;
|
|
130
94
|
interface BareZodType {
|
|
131
|
-
|
|
95
|
+
_output: unknown;
|
|
132
96
|
}
|
|
133
97
|
interface ZodSchemaConfig {
|
|
98
|
+
type: ZodTypeAny;
|
|
99
|
+
parse<T extends Column.Pick.ForParse, OutputSchema extends ZodTypeAny, Output = OutputSchema['_output']>(this: T, _schema: OutputSchema, fn: (input: T['type']) => Output): Column.Modifiers.Parse<T, OutputSchema, Output>;
|
|
100
|
+
parseNull<T extends Column.Pick.ForParseNull, NullSchema extends ZodTypeAny, NullType = NullSchema['_output']>(this: T, _schema: NullSchema, fn: () => NullType): Column.Modifiers.ParseNull<T, NullSchema, NullType>;
|
|
101
|
+
encode<T extends {
|
|
102
|
+
type: unknown;
|
|
103
|
+
}, InputSchema extends ZodTypeAny, Input = InputSchema['_output']>(this: T, _schema: InputSchema, fn: (input: Input) => unknown): Column.Modifiers.Encode<T, InputSchema, Input>;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated use narrowType instead
|
|
106
|
+
*/
|
|
107
|
+
asType<T, Types extends Column.AsTypeArg<ZodTypeAny>, TypeSchema extends ZodTypeAny = (Types extends {
|
|
134
108
|
type: ZodTypeAny;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*/
|
|
143
|
-
asType<T, Types extends Column.AsTypeArg<ZodTypeAny>, TypeSchema extends ZodTypeAny = Types extends {
|
|
144
|
-
type: ZodTypeAny;
|
|
145
|
-
} ? Types['type'] : never, Type = TypeSchema['_output']>(this: T, types: Types): {
|
|
146
|
-
[K in keyof T]: K extends 'type' ? Type : K extends 'inputType' ? Types['input'] extends ZodTypeAny ? Types['input']['_output'] : Type : K extends 'inputSchema' ? Types['input'] extends ZodTypeAny ? Types['input'] : TypeSchema : K extends 'outputType' ? Types['output'] extends ZodTypeAny ? Types['output']['_output'] : Type : K extends 'outputSchema' ? Types['output'] extends ZodTypeAny ? Types['output'] : TypeSchema : K extends 'queryType' ? Types['query'] extends ZodTypeAny ? Types['query']['_output'] : Type : K extends 'querySchema' ? Types['query'] extends ZodTypeAny ? Types['query'] : TypeSchema : T[K];
|
|
109
|
+
} ? Types['type'] : never), Type = TypeSchema['_output']>(this: T, types: Types): { [K in keyof T]: K extends 'type' ? Type : K extends 'inputType' ? Types['input'] extends ZodTypeAny ? Types['input']['_output'] : Type : K extends 'inputSchema' ? Types['input'] extends ZodTypeAny ? Types['input'] : TypeSchema : K extends 'outputType' ? Types['output'] extends ZodTypeAny ? Types['output']['_output'] : Type : K extends 'outputSchema' ? Types['output'] extends ZodTypeAny ? Types['output'] : TypeSchema : K extends 'queryType' ? Types['query'] extends ZodTypeAny ? Types['query']['_output'] : Type : K extends 'querySchema' ? Types['query'] extends ZodTypeAny ? Types['query'] : TypeSchema : T[K] };
|
|
110
|
+
narrowType<T extends Column.InputOutputQueryTypesWithSchemas, Type extends {
|
|
111
|
+
_output: T['inputType'] extends never ? T['outputType'] & T['queryType'] : T['inputType'] & T['outputType'] & T['queryType'];
|
|
112
|
+
}>(this: T, type: Type): { [K in keyof T]: K extends 'inputType' ? T['inputType'] extends never ? never : Type['_output'] : K extends 'outputType' | 'queryType' ? Type['_output'] : K extends 'inputSchema' ? T['inputType'] extends never ? ZodNever : Type : K extends 'outputSchema' | 'querySchema' ? Type : T[K] };
|
|
113
|
+
narrowAllTypes<T extends Column.InputOutputQueryTypesWithSchemas, Types extends {
|
|
114
|
+
input?: {
|
|
115
|
+
_output: T['inputType'];
|
|
147
116
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}>(this: T, type: Type): {
|
|
151
|
-
[K in keyof T]: K extends 'inputType' ? T['inputType'] extends never ? never : Type['_output'] : K extends 'outputType' | 'queryType' ? Type['_output'] : K extends 'inputSchema' ? T['inputType'] extends never ? ZodNever : Type : K extends 'outputSchema' | 'querySchema' ? Type : T[K];
|
|
117
|
+
output?: {
|
|
118
|
+
_output: T['outputType'];
|
|
152
119
|
};
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
_output: T['inputType'];
|
|
156
|
-
};
|
|
157
|
-
output?: {
|
|
158
|
-
_output: T['outputType'];
|
|
159
|
-
};
|
|
160
|
-
query?: {
|
|
161
|
-
_output: T['queryType'];
|
|
162
|
-
};
|
|
163
|
-
}>(this: T, types: Types): {
|
|
164
|
-
[K in keyof T]: K extends 'inputType' ? Types['input'] extends BareZodType ? Types['input']['_output'] : T['inputType'] : K extends 'inputSchema' ? Types['input'] extends BareZodType ? Types['input'] : T['inputSchema'] : K extends 'outputType' ? Types['output'] extends BareZodType ? Types['output']['_output'] : T['outputType'] : K extends 'outputSchema' ? Types['output'] extends BareZodType ? Types['output'] : T['outputSchema'] : K extends 'queryType' ? Types['query'] extends BareZodType ? Types['query']['_output'] : T['queryType'] : K extends 'querySchema' ? Types['query'] extends BareZodType ? Types['query'] : T['querySchema'] : T[K];
|
|
120
|
+
query?: {
|
|
121
|
+
_output: T['queryType'];
|
|
165
122
|
};
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
geographyPointSchema(): PointSchemaZod;
|
|
123
|
+
}>(this: T, types: Types): { [K in keyof T]: K extends 'inputType' ? Types['input'] extends BareZodType ? Types['input']['_output'] : T['inputType'] : K extends 'inputSchema' ? Types['input'] extends BareZodType ? Types['input'] : T['inputSchema'] : K extends 'outputType' ? Types['output'] extends BareZodType ? Types['output']['_output'] : T['outputType'] : K extends 'outputSchema' ? Types['output'] extends BareZodType ? Types['output'] : T['outputSchema'] : K extends 'queryType' ? Types['query'] extends BareZodType ? Types['query']['_output'] : T['queryType'] : K extends 'querySchema' ? Types['query'] extends BareZodType ? Types['query'] : T['querySchema'] : T[K] };
|
|
124
|
+
dateAsNumber<T extends Column<ZodSchemaConfig>>(this: T): Column.Modifiers.Parse<T, ZodNumber, number>;
|
|
125
|
+
dateAsDate<T extends Column<ZodSchemaConfig>>(this: T): Column.Modifiers.Parse<T, ZodDate, Date>;
|
|
126
|
+
enum<T extends readonly string[]>(dataType: string, type: T): EnumColumn<ZodSchemaConfig, ZodEnum<{ [K in T[number]]: K }>, T>;
|
|
127
|
+
array<Item extends ArrayColumnValue>(item: Item): ZodArrayColumn<Item>;
|
|
128
|
+
nullable<T extends Column.Pick.ForNullable>(this: T): Column.Modifiers.Nullable<T, ZodNullable<T['inputSchema']>, T['nullSchema'] extends ZodTypeAny ? ZodUnion<[T['outputSchema'], T['nullSchema']]> : ZodNullable<T['outputSchema']>, ZodNullable<T['querySchema']>>;
|
|
129
|
+
json<ZodSchema extends ZodTypeAny = ZodUnknown>(schema?: ZodSchema): ZodJSONColumn<ZodSchema>;
|
|
130
|
+
boolean(): ZodBoolean;
|
|
131
|
+
buffer(): ZodType<Buffer>;
|
|
132
|
+
unknown(): ZodUnknown;
|
|
133
|
+
never(): ZodNever;
|
|
134
|
+
stringSchema(): ZodString;
|
|
135
|
+
stringMin(max: number): ZodString;
|
|
136
|
+
stringMax(max: number): ZodString;
|
|
137
|
+
stringMinMax(min: number, max: number): ZodString;
|
|
138
|
+
number(): ZodNumber;
|
|
139
|
+
int(): ZodNumber;
|
|
140
|
+
stringNumberDate(): ZodDate;
|
|
141
|
+
timeInterval(): ZodObject<{
|
|
142
|
+
years: ZodOptional<ZodNumber>;
|
|
143
|
+
months: ZodOptional<ZodNumber>;
|
|
144
|
+
days: ZodOptional<ZodNumber>;
|
|
145
|
+
hours: ZodOptional<ZodNumber>;
|
|
146
|
+
minutes: ZodOptional<ZodNumber>;
|
|
147
|
+
seconds: ZodOptional<ZodNumber>;
|
|
148
|
+
}>;
|
|
149
|
+
bit(max: number): ZodString;
|
|
150
|
+
uuid(): ZodString;
|
|
151
|
+
inputSchema<T extends ColumnSchemaGetterTableClass>(this: T): MapSchema<T, 'inputSchema'>;
|
|
152
|
+
outputSchema<T extends ColumnSchemaGetterTableClass>(this: T): MapSchema<T, 'outputSchema'>;
|
|
153
|
+
querySchema<T extends ColumnSchemaGetterTableClass>(this: T): QuerySchema<T>;
|
|
154
|
+
createSchema<T extends ColumnSchemaGetterTableClass>(this: T): CreateSchema<T>;
|
|
155
|
+
updateSchema<T extends ColumnSchemaGetterTableClass>(this: T): UpdateSchema<T>;
|
|
156
|
+
pkeySchema<T extends ColumnSchemaGetterTableClass>(this: T): PkeySchema<T>;
|
|
157
|
+
error<T>(this: T, error: Column.Error.Messages): T;
|
|
158
|
+
smallint(): SmallIntColumnZod;
|
|
159
|
+
integer(): IntegerColumnZod;
|
|
160
|
+
real(): RealColumnZod;
|
|
161
|
+
smallSerial(): SmallSerialColumnZod;
|
|
162
|
+
serial(): SerialColumnZod;
|
|
163
|
+
bigint(): BigIntColumnZod;
|
|
164
|
+
decimal(precision?: number, scale?: number): DecimalColumnZod;
|
|
165
|
+
doublePrecision(): DoublePrecisionColumnZod;
|
|
166
|
+
bigSerial(): BigSerialColumnZod;
|
|
167
|
+
money(): MoneyColumnZod;
|
|
168
|
+
varchar(limit?: number): VarCharColumnZod;
|
|
169
|
+
text(): TextColumnZod;
|
|
170
|
+
string(limit?: number): StringColumnZod;
|
|
171
|
+
citext(): CitextColumnZod;
|
|
172
|
+
date(): DateColumnZod;
|
|
173
|
+
timestampNoTZ(precision?: number): TimestampNoTzColumnZod;
|
|
174
|
+
timestamp(precision?: number): TimestampColumnZod;
|
|
175
|
+
geographyPointSchema(): PointSchemaZod;
|
|
220
176
|
}
|
|
221
177
|
declare const zodSchemaConfig: ZodSchemaConfig;
|
|
222
|
-
type MapSchema<T extends ColumnSchemaGetterTableClass, Key extends 'inputSchema' | 'outputSchema' | 'querySchema'> = ZodObject<{
|
|
223
|
-
|
|
224
|
-
}, core.$strict>;
|
|
225
|
-
type
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
type CreateSchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{
|
|
229
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ColumnSchemaGetterColumns<T>[K]['data']['isNullable'] extends true ? ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']> : undefined extends ColumnSchemaGetterColumns<T>[K]['data']['default'] ? ColumnSchemaGetterColumns<T>[K]['inputSchema'] : ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']>;
|
|
230
|
-
}, core.$strict>;
|
|
231
|
-
type UpdateSchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{
|
|
232
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']>;
|
|
233
|
-
}, core.$strict>;
|
|
234
|
-
type PkeySchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{
|
|
235
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? K : never]: ColumnSchemaGetterColumns<T>[K]['inputSchema'];
|
|
236
|
-
}, core.$strict>;
|
|
237
|
-
|
|
238
|
-
export { zodSchemaConfig };
|
|
239
|
-
export type { BareZodType, ZodSchemaConfig };
|
|
178
|
+
type MapSchema<T extends ColumnSchemaGetterTableClass, Key extends 'inputSchema' | 'outputSchema' | 'querySchema'> = ZodObject<{ [K in keyof ColumnSchemaGetterColumns<T>]: ColumnSchemaGetterColumns<T>[K][Key] }, core.$strict>;
|
|
179
|
+
type QuerySchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{ [K in keyof ColumnSchemaGetterColumns<T>]: ZodOptional<ColumnSchemaGetterColumns<T>[K]['querySchema']> }, core.$strict>;
|
|
180
|
+
type CreateSchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ColumnSchemaGetterColumns<T>[K]['data']['isNullable'] extends true ? ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']> : undefined extends ColumnSchemaGetterColumns<T>[K]['data']['default'] ? ColumnSchemaGetterColumns<T>[K]['inputSchema'] : ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']> }, core.$strict>;
|
|
181
|
+
type UpdateSchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ZodOptional<ColumnSchemaGetterColumns<T>[K]['inputSchema']> }, core.$strict>;
|
|
182
|
+
type PkeySchema<T extends ColumnSchemaGetterTableClass> = ZodObject<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? K : never]: ColumnSchemaGetterColumns<T>[K]['inputSchema'] }, core.$strict>;
|
|
183
|
+
export { BareZodType, ZodSchemaConfig, zodSchemaConfig };
|