orchid-orm-valibot 0.3.125 → 0.3.127
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 +188 -242
- package/dist/index.js +319 -429
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +318 -427
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,270 +1,216 @@
|
|
|
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 { ArraySchema, BaseSchema, BaseValidation, BooleanSchema, DateSchema, InstanceSchema, NeverSchema, NullableSchema, NumberSchema, ObjectSchema, OptionalSchema, Output, PicklistSchema, StringSchema, UnionSchema, UnknownSchema } from "valibot";
|
|
4
3
|
declare class ValibotJSONColumn<Schema extends BaseSchema> extends JSONColumn<Output<Schema>, ValibotSchemaConfig, Schema> {
|
|
5
|
-
|
|
4
|
+
constructor(schema: Schema);
|
|
6
5
|
}
|
|
7
6
|
interface ArrayMethods<Value> {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
interface ValibotArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ValibotSchemaConfig, Item, ArraySchema<Item['inputSchema']>, ArraySchema<Item['outputSchema']>, ArraySchema<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 ValibotArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ValibotSchemaConfig, Item, ArraySchema<Item['inputSchema']>, ArraySchema<Item['outputSchema']>, ArraySchema<Item['querySchema']>>, ArrayMethods<number> {}
|
|
15
13
|
declare class ValibotArrayColumn<Item extends ArrayColumnValue> extends ArrayColumn<ValibotSchemaConfig, Item, ArraySchema<Item['inputSchema']>, ArraySchema<Item['outputSchema']>, ArraySchema<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
|
-
|
|
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;
|
|
33
31
|
}
|
|
34
32
|
type GtValidation<TInput extends string | number | bigint | boolean | Date, TRequirement extends TInput> = BaseValidation<TInput> & {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
/**
|
|
34
|
+
* The validation type.
|
|
35
|
+
*/
|
|
36
|
+
type: 'gt';
|
|
37
|
+
/**
|
|
38
|
+
* The maximum value.
|
|
39
|
+
*/
|
|
40
|
+
requirement: TRequirement;
|
|
43
41
|
};
|
|
44
42
|
declare function gt<TInput extends string | number | bigint | Date, TRequirement extends TInput>(requirement: TRequirement, message?: string): GtValidation<TInput, TRequirement>;
|
|
45
43
|
type LtValidation<TInput extends string | number | bigint | boolean | Date, TRequirement extends TInput> = BaseValidation<TInput> & {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The validation type.
|
|
46
|
+
*/
|
|
47
|
+
type: 'lt';
|
|
48
|
+
/**
|
|
49
|
+
* The maximum value.
|
|
50
|
+
*/
|
|
51
|
+
requirement: TRequirement;
|
|
54
52
|
};
|
|
55
53
|
declare function lt<TInput extends string | number | bigint | Date, TRequirement extends TInput>(requirement: TRequirement, message?: string): LtValidation<TInput, TRequirement>;
|
|
56
54
|
type StepValidation<TInput extends number, TRequirement extends TInput> = BaseValidation<TInput> & {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The validation type.
|
|
57
|
+
*/
|
|
58
|
+
type: 'step';
|
|
59
|
+
/**
|
|
60
|
+
* The maximum value.
|
|
61
|
+
*/
|
|
62
|
+
requirement: TRequirement;
|
|
65
63
|
};
|
|
66
64
|
declare function step<TInput extends number, TRequirement extends TInput>(requirement: TRequirement, message?: string): StepValidation<TInput, TRequirement>;
|
|
67
|
-
interface SmallIntColumnValibot extends SmallIntColumn<ValibotSchemaConfig>, NumberMethods {
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
interface
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
interface
|
|
76
|
-
}
|
|
77
|
-
declare class RealColumnValibot extends RealColumn<ValibotSchemaConfig> {
|
|
78
|
-
}
|
|
79
|
-
interface SmallSerialColumnValibot extends SmallSerialColumn<ValibotSchemaConfig>, NumberMethods {
|
|
80
|
-
}
|
|
81
|
-
declare class SmallSerialColumnValibot extends SmallSerialColumn<ValibotSchemaConfig> {
|
|
82
|
-
}
|
|
83
|
-
interface SerialColumnValibot extends SerialColumn<ValibotSchemaConfig>, NumberMethods {
|
|
84
|
-
}
|
|
85
|
-
declare class SerialColumnValibot extends SerialColumn<ValibotSchemaConfig> {
|
|
86
|
-
}
|
|
65
|
+
interface SmallIntColumnValibot extends SmallIntColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
66
|
+
declare class SmallIntColumnValibot extends SmallIntColumn<ValibotSchemaConfig> {}
|
|
67
|
+
interface IntegerColumnValibot extends IntegerColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
68
|
+
declare class IntegerColumnValibot extends IntegerColumn<ValibotSchemaConfig> {}
|
|
69
|
+
interface RealColumnValibot extends RealColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
70
|
+
declare class RealColumnValibot extends RealColumn<ValibotSchemaConfig> {}
|
|
71
|
+
interface SmallSerialColumnValibot extends SmallSerialColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
72
|
+
declare class SmallSerialColumnValibot extends SmallSerialColumn<ValibotSchemaConfig> {}
|
|
73
|
+
interface SerialColumnValibot extends SerialColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
74
|
+
declare class SerialColumnValibot extends SerialColumn<ValibotSchemaConfig> {}
|
|
87
75
|
interface StringMethods extends ArrayMethods<number> {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
interface BigIntColumnValibot extends BigIntColumn<ValibotSchemaConfig>, StringMethods {
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
interface
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
interface
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
interface
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
interface
|
|
122
|
-
}
|
|
123
|
-
declare class MoneyColumnValibot extends MoneyColumn<ValibotSchemaConfig> {
|
|
124
|
-
}
|
|
125
|
-
interface VarCharColumnValibot extends VarCharColumn<ValibotSchemaConfig>, StringMethods {
|
|
126
|
-
}
|
|
127
|
-
declare class VarCharColumnValibot extends VarCharColumn<ValibotSchemaConfig> {
|
|
128
|
-
}
|
|
129
|
-
interface TextColumnValibot extends TextColumn<ValibotSchemaConfig>, StringMethods {
|
|
130
|
-
}
|
|
131
|
-
declare class TextColumnValibot extends TextColumn<ValibotSchemaConfig> {
|
|
132
|
-
}
|
|
133
|
-
interface StringColumnValibot extends StringColumn<ValibotSchemaConfig>, StringMethods {
|
|
134
|
-
}
|
|
135
|
-
declare class StringColumnValibot extends StringColumn<ValibotSchemaConfig> {
|
|
136
|
-
}
|
|
137
|
-
interface CitextColumnValibot extends CitextColumn<ValibotSchemaConfig>, StringMethods {
|
|
138
|
-
}
|
|
139
|
-
declare class CitextColumnValibot extends CitextColumn<ValibotSchemaConfig> {
|
|
140
|
-
}
|
|
76
|
+
email<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
77
|
+
url<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
78
|
+
emoji<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
79
|
+
uuid<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
80
|
+
cuid2<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
81
|
+
ulid<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
82
|
+
regex<T>(this: T, value: RegExp, params?: Column.Error.StringOrMessage): T;
|
|
83
|
+
includes<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
84
|
+
startsWith<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
85
|
+
endsWith<T, Value extends string>(this: T, value: Value, params?: Column.Error.StringOrMessage): T;
|
|
86
|
+
datetime<T>(this: T, params?: StringData['datetime'] & Exclude<Column.Error.StringOrMessage, string>): T;
|
|
87
|
+
ipv4<T>(this: T, params?: Exclude<Column.Error.StringOrMessage, string>): T;
|
|
88
|
+
ipv6<T>(this: T, params?: Exclude<Column.Error.StringOrMessage, string>): T;
|
|
89
|
+
trim<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
90
|
+
toLowerCase<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
91
|
+
toUpperCase<T>(this: T, params?: Column.Error.StringOrMessage): T;
|
|
92
|
+
}
|
|
93
|
+
interface BigIntColumnValibot extends BigIntColumn<ValibotSchemaConfig>, StringMethods {}
|
|
94
|
+
declare class BigIntColumnValibot extends BigIntColumn<ValibotSchemaConfig> {}
|
|
95
|
+
interface DecimalColumnValibot extends DecimalColumn<ValibotSchemaConfig>, StringMethods {}
|
|
96
|
+
declare class DecimalColumnValibot extends DecimalColumn<ValibotSchemaConfig> {}
|
|
97
|
+
interface DoublePrecisionColumnValibot extends DoublePrecisionColumn<ValibotSchemaConfig>, StringMethods {}
|
|
98
|
+
declare class DoublePrecisionColumnValibot extends DoublePrecisionColumn<ValibotSchemaConfig> {}
|
|
99
|
+
interface BigSerialColumnValibot extends BigSerialColumn<ValibotSchemaConfig>, StringMethods {}
|
|
100
|
+
declare class BigSerialColumnValibot extends BigSerialColumn<ValibotSchemaConfig> {}
|
|
101
|
+
interface MoneyColumnValibot extends MoneyColumn<ValibotSchemaConfig>, NumberMethods {}
|
|
102
|
+
declare class MoneyColumnValibot extends MoneyColumn<ValibotSchemaConfig> {}
|
|
103
|
+
interface VarCharColumnValibot extends VarCharColumn<ValibotSchemaConfig>, StringMethods {}
|
|
104
|
+
declare class VarCharColumnValibot extends VarCharColumn<ValibotSchemaConfig> {}
|
|
105
|
+
interface TextColumnValibot extends TextColumn<ValibotSchemaConfig>, StringMethods {}
|
|
106
|
+
declare class TextColumnValibot extends TextColumn<ValibotSchemaConfig> {}
|
|
107
|
+
interface StringColumnValibot extends StringColumn<ValibotSchemaConfig>, StringMethods {}
|
|
108
|
+
declare class StringColumnValibot extends StringColumn<ValibotSchemaConfig> {}
|
|
109
|
+
interface CitextColumnValibot extends CitextColumn<ValibotSchemaConfig>, StringMethods {}
|
|
110
|
+
declare class CitextColumnValibot extends CitextColumn<ValibotSchemaConfig> {}
|
|
141
111
|
interface DateMethods {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
interface DateColumnValibot extends DateColumn<ValibotSchemaConfig>, DateMethods {
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
interface
|
|
150
|
-
}
|
|
151
|
-
declare class TimestampNoTzColumnValibot extends TimestampColumn<ValibotSchemaConfig> {
|
|
152
|
-
}
|
|
153
|
-
interface TimestampColumnValibot extends TimestampTZColumn<ValibotSchemaConfig>, DateMethods {
|
|
154
|
-
}
|
|
155
|
-
declare class TimestampColumnValibot extends TimestampTZColumn<ValibotSchemaConfig> {
|
|
156
|
-
}
|
|
112
|
+
min<T>(this: T, value: Date, params?: Column.Error.StringOrMessage): T;
|
|
113
|
+
max<T>(this: T, value: Date, params?: Column.Error.StringOrMessage): T;
|
|
114
|
+
}
|
|
115
|
+
interface DateColumnValibot extends DateColumn<ValibotSchemaConfig>, DateMethods {}
|
|
116
|
+
declare class DateColumnValibot extends DateColumn<ValibotSchemaConfig> {}
|
|
117
|
+
interface TimestampNoTzColumnValibot extends TimestampColumn<ValibotSchemaConfig>, DateMethods {}
|
|
118
|
+
declare class TimestampNoTzColumnValibot extends TimestampColumn<ValibotSchemaConfig> {}
|
|
119
|
+
interface TimestampColumnValibot extends TimestampTZColumn<ValibotSchemaConfig>, DateMethods {}
|
|
120
|
+
declare class TimestampColumnValibot extends TimestampTZColumn<ValibotSchemaConfig> {}
|
|
157
121
|
type PointSchemaValibot = ObjectSchema<{
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
122
|
+
srid: OptionalSchema<NumberSchema>;
|
|
123
|
+
lon: NumberSchema;
|
|
124
|
+
lat: NumberSchema;
|
|
161
125
|
}>;
|
|
162
126
|
interface ValibotSchemaConfig {
|
|
127
|
+
type: BaseSchema;
|
|
128
|
+
parse<T extends Column.Pick.ForParse, OutputSchema extends BaseSchema, Out = Output<OutputSchema>>(this: T, _schema: OutputSchema, fn: (input: T['type']) => Out): Column.Modifiers.Parse<T, OutputSchema, Out>;
|
|
129
|
+
parseNull<T extends Column.Pick.ForParseNull, NullSchema extends BaseSchema, NullType = Output<NullSchema>>(this: T, _schema: NullSchema, fn: () => NullType): Column.Modifiers.ParseNull<T, NullSchema, NullType>;
|
|
130
|
+
encode<T extends {
|
|
131
|
+
type: unknown;
|
|
132
|
+
}, InputSchema extends BaseSchema, In = Output<InputSchema>>(this: T, _schema: InputSchema, fn: (input: In) => unknown): Column.Modifiers.Encode<T, InputSchema, In>;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated use narrowType instead
|
|
135
|
+
*/
|
|
136
|
+
asType<T, Types extends Column.AsTypeArg<BaseSchema>, TypeSchema extends BaseSchema = (Types extends {
|
|
163
137
|
type: BaseSchema;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*/
|
|
172
|
-
asType<T, Types extends Column.AsTypeArg<BaseSchema>, TypeSchema extends BaseSchema = Types extends {
|
|
173
|
-
type: BaseSchema;
|
|
174
|
-
} ? Types['type'] : never, Type = Output<TypeSchema>>(this: T, types: Types): {
|
|
175
|
-
[K in keyof T]: K extends 'type' ? Type : K extends 'inputType' ? Types['input'] extends BaseSchema ? Output<Types['input']> : Type : K extends 'inputSchema' ? Types['input'] extends BaseSchema ? Types['input'] : TypeSchema : K extends 'outputType' ? Types['output'] extends BaseSchema ? Output<Types['output']> : Type : K extends 'outputSchema' ? Types['output'] extends BaseSchema ? Types['output'] : TypeSchema : K extends 'queryType' ? Types['query'] extends BaseSchema ? Output<Types['query']> : Type : K extends 'querySchema' ? Types['query'] extends BaseSchema ? Types['query'] : TypeSchema : T[K];
|
|
138
|
+
} ? Types['type'] : never), Type = Output<TypeSchema>>(this: T, types: Types): { [K in keyof T]: K extends 'type' ? Type : K extends 'inputType' ? Types['input'] extends BaseSchema ? Output<Types['input']> : Type : K extends 'inputSchema' ? Types['input'] extends BaseSchema ? Types['input'] : TypeSchema : K extends 'outputType' ? Types['output'] extends BaseSchema ? Output<Types['output']> : Type : K extends 'outputSchema' ? Types['output'] extends BaseSchema ? Types['output'] : TypeSchema : K extends 'queryType' ? Types['query'] extends BaseSchema ? Output<Types['query']> : Type : K extends 'querySchema' ? Types['query'] extends BaseSchema ? Types['query'] : TypeSchema : T[K] };
|
|
139
|
+
narrowType<T extends Column.InputOutputQueryTypesWithSchemas, Type extends BaseSchema<any, T['inputType'] extends never ? T['outputType'] & T['queryType'] : T['inputType'] & T['outputType'] & T['queryType']>>(this: T, types: Type): { [K in keyof T]: K extends 'inputType' ? T['inputType'] extends never ? never : Output<Type> : K extends 'outputType' | 'queryType' ? Output<Type> : K extends 'inputSchema' ? T['inputType'] extends never ? NeverSchema : Type : K extends 'outputSchema' | 'querySchema' ? Type : T[K] };
|
|
140
|
+
narrowAllTypes<T extends Column.InputOutputQueryTypesWithSchemas, Types extends {
|
|
141
|
+
input?: {
|
|
142
|
+
_types?: {
|
|
143
|
+
output: T['inputType'];
|
|
144
|
+
};
|
|
176
145
|
};
|
|
177
|
-
|
|
178
|
-
|
|
146
|
+
output?: {
|
|
147
|
+
_types?: {
|
|
148
|
+
output: T['outputType'];
|
|
149
|
+
};
|
|
179
150
|
};
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
output?: {
|
|
187
|
-
_types?: {
|
|
188
|
-
output: T['outputType'];
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
query?: {
|
|
192
|
-
_types?: {
|
|
193
|
-
output: T['queryType'];
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
}>(this: T, types: Types): {
|
|
197
|
-
[K in keyof T]: K extends 'inputType' ? Types['input'] extends BaseSchema ? Output<Types['input']> : T['inputType'] : K extends 'inputSchema' ? Types['input'] extends BaseSchema ? Types['input'] : T['inputSchema'] : K extends 'outputType' ? Types['output'] extends BaseSchema ? Output<Types['output']> : T['outputType'] : K extends 'outputSchema' ? Types['output'] extends BaseSchema ? Types['output'] : T['outputSchema'] : K extends 'queryType' ? Types['query'] extends BaseSchema ? Output<Types['query']> : T['querySchema'] : K extends 'querySchema' ? Types['query'] extends BaseSchema ? Types['query'] : T['querySchema'] : T[K];
|
|
151
|
+
query?: {
|
|
152
|
+
_types?: {
|
|
153
|
+
output: T['queryType'];
|
|
154
|
+
};
|
|
198
155
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
156
|
+
}>(this: T, types: Types): { [K in keyof T]: K extends 'inputType' ? Types['input'] extends BaseSchema ? Output<Types['input']> : T['inputType'] : K extends 'inputSchema' ? Types['input'] extends BaseSchema ? Types['input'] : T['inputSchema'] : K extends 'outputType' ? Types['output'] extends BaseSchema ? Output<Types['output']> : T['outputType'] : K extends 'outputSchema' ? Types['output'] extends BaseSchema ? Types['output'] : T['outputSchema'] : K extends 'queryType' ? Types['query'] extends BaseSchema ? Output<Types['query']> : T['querySchema'] : K extends 'querySchema' ? Types['query'] extends BaseSchema ? Types['query'] : T['querySchema'] : T[K] };
|
|
157
|
+
dateAsNumber<T extends Column<ValibotSchemaConfig>>(this: T): Column.Modifiers.Parse<T, NumberSchema, number>;
|
|
158
|
+
dateAsDate<T extends Column<ValibotSchemaConfig>>(this: T): Column.Modifiers.Parse<T, DateSchema, Date>;
|
|
159
|
+
enum<T extends readonly string[]>(dataType: string, type: T): EnumColumn<ValibotSchemaConfig, PicklistSchema<T>, T>;
|
|
160
|
+
array<Item extends ArrayColumnValue>(item: Item): ValibotArrayColumn<Item>;
|
|
161
|
+
nullable<T extends Column.Pick.ForNullable>(this: T): Column.Modifiers.Nullable<T, NullableSchema<T['inputSchema']>, T['nullSchema'] extends BaseSchema ? UnionSchema<[T['outputSchema'], T['nullSchema']]> : NullableSchema<T['outputSchema']>, NullableSchema<T['querySchema']>>;
|
|
162
|
+
json<Schema extends BaseSchema = UnknownSchema>(schema?: Schema): ValibotJSONColumn<Schema>;
|
|
163
|
+
boolean(): BooleanSchema;
|
|
164
|
+
buffer(): InstanceSchema<typeof Buffer>;
|
|
165
|
+
unknown(): UnknownSchema;
|
|
166
|
+
never(): NeverSchema;
|
|
167
|
+
stringSchema(): StringSchema;
|
|
168
|
+
stringMin(max: number): StringSchema;
|
|
169
|
+
stringMax(max: number): StringSchema;
|
|
170
|
+
stringMinMax(min: number, max: number): StringSchema;
|
|
171
|
+
number(): NumberSchema;
|
|
172
|
+
int(): NumberSchema;
|
|
173
|
+
stringNumberDate(): DateSchema;
|
|
174
|
+
timeInterval(): ObjectSchema<{
|
|
175
|
+
years: OptionalSchema<NumberSchema>;
|
|
176
|
+
months: OptionalSchema<NumberSchema>;
|
|
177
|
+
days: OptionalSchema<NumberSchema>;
|
|
178
|
+
hours: OptionalSchema<NumberSchema>;
|
|
179
|
+
minutes: OptionalSchema<NumberSchema>;
|
|
180
|
+
seconds: OptionalSchema<NumberSchema>;
|
|
181
|
+
}>;
|
|
182
|
+
bit(max: number): StringSchema;
|
|
183
|
+
uuid(): StringSchema;
|
|
184
|
+
inputSchema<T extends ColumnSchemaGetterTableClass>(this: T): MapSchema<T, 'inputSchema'>;
|
|
185
|
+
outputSchema<T extends ColumnSchemaGetterTableClass>(this: T): MapSchema<T, 'outputSchema'>;
|
|
186
|
+
querySchema<T extends ColumnSchemaGetterTableClass>(this: T): QuerySchema<T>;
|
|
187
|
+
createSchema<T extends ColumnSchemaGetterTableClass>(this: T): CreateSchema<T>;
|
|
188
|
+
updateSchema<T extends ColumnSchemaGetterTableClass>(this: T): UpdateSchema<T>;
|
|
189
|
+
pkeySchema<T extends ColumnSchemaGetterTableClass>(this: T): PkeySchema<T>;
|
|
190
|
+
error<T>(this: T, message: string): T;
|
|
191
|
+
smallint(): SmallIntColumnValibot;
|
|
192
|
+
integer(): IntegerColumnValibot;
|
|
193
|
+
real(): RealColumnValibot;
|
|
194
|
+
smallSerial(): SmallSerialColumnValibot;
|
|
195
|
+
serial(): SerialColumnValibot;
|
|
196
|
+
bigint(): BigIntColumnValibot;
|
|
197
|
+
decimal(precision?: number, scale?: number): DecimalColumnValibot;
|
|
198
|
+
doublePrecision(): DoublePrecisionColumnValibot;
|
|
199
|
+
bigSerial(): BigSerialColumnValibot;
|
|
200
|
+
money(): MoneyColumnValibot;
|
|
201
|
+
varchar(limit?: number): VarCharColumnValibot;
|
|
202
|
+
text(): TextColumnValibot;
|
|
203
|
+
string(limit?: number): StringColumnValibot;
|
|
204
|
+
citext(): CitextColumnValibot;
|
|
205
|
+
date(): DateColumnValibot;
|
|
206
|
+
timestampNoTZ(precision?: number): TimestampNoTzColumnValibot;
|
|
207
|
+
timestamp(precision?: number): TimestampColumnValibot;
|
|
208
|
+
geographyPointSchema(): PointSchemaValibot;
|
|
251
209
|
}
|
|
252
210
|
declare const valibotSchemaConfig: ValibotSchemaConfig;
|
|
253
|
-
type MapSchema<T extends ColumnSchemaGetterTableClass, Key extends 'inputSchema' | 'outputSchema' | 'querySchema'> = ObjectSchema<{
|
|
254
|
-
|
|
255
|
-
}>;
|
|
256
|
-
type
|
|
257
|
-
|
|
258
|
-
}
|
|
259
|
-
type CreateSchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{
|
|
260
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ColumnSchemaGetterColumns<T>[K]['data']['isNullable'] extends true ? OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']> : undefined extends ColumnSchemaGetterColumns<T>[K]['data']['default'] ? ColumnSchemaGetterColumns<T>[K]['inputSchema'] : OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']>;
|
|
261
|
-
}>;
|
|
262
|
-
type UpdateSchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{
|
|
263
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']>;
|
|
264
|
-
}>;
|
|
265
|
-
type PkeySchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{
|
|
266
|
-
[K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? K : never]: ColumnSchemaGetterColumns<T>[K]['inputSchema'];
|
|
267
|
-
}>;
|
|
268
|
-
|
|
269
|
-
export { gt, lt, step, valibotSchemaConfig };
|
|
270
|
-
export type { GtValidation, LtValidation, StepValidation, ValibotSchemaConfig };
|
|
211
|
+
type MapSchema<T extends ColumnSchemaGetterTableClass, Key extends 'inputSchema' | 'outputSchema' | 'querySchema'> = ObjectSchema<{ [K in keyof ColumnSchemaGetterColumns<T>]: ColumnSchemaGetterColumns<T>[K][Key] }>;
|
|
212
|
+
type QuerySchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{ [K in keyof ColumnSchemaGetterColumns<T>]: OptionalSchema<ColumnSchemaGetterColumns<T>[K]['querySchema']> }>;
|
|
213
|
+
type CreateSchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: ColumnSchemaGetterColumns<T>[K]['data']['isNullable'] extends true ? OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']> : undefined extends ColumnSchemaGetterColumns<T>[K]['data']['default'] ? ColumnSchemaGetterColumns<T>[K]['inputSchema'] : OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']> }>;
|
|
214
|
+
type UpdateSchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? never : K]: OptionalSchema<ColumnSchemaGetterColumns<T>[K]['inputSchema']> }>;
|
|
215
|
+
type PkeySchema<T extends ColumnSchemaGetterTableClass> = ObjectSchema<{ [K in keyof ColumnSchemaGetterColumns<T> as ColumnSchemaGetterColumns<T>[K]['data']['primaryKey'] extends string ? K : never]: ColumnSchemaGetterColumns<T>[K]['inputSchema'] }>;
|
|
216
|
+
export { GtValidation, LtValidation, StepValidation, ValibotSchemaConfig, gt, lt, step, valibotSchemaConfig };
|