drizzle-zod 0.8.3-e8ab855 → 0.8.3-fd8bfcc
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/column.d.cts +4 -4
- package/column.d.mts +4 -4
- package/column.d.ts +4 -4
- package/column.types.d.cts +18 -18
- package/column.types.d.mts +18 -18
- package/column.types.d.ts +18 -18
- package/index.cjs +214 -168
- package/index.cjs.map +1 -1
- package/index.mjs +215 -168
- package/index.mjs.map +1 -1
- package/package.json +2 -2
- package/schema.d.cts +2 -2
- package/schema.d.mts +2 -2
- package/schema.d.ts +2 -2
- package/schema.types.d.cts +10 -8
- package/schema.types.d.mts +10 -8
- package/schema.types.d.ts +10 -8
- package/schema.types.internal.d.cts +3 -2
- package/schema.types.internal.d.mts +3 -2
- package/schema.types.internal.d.ts +3 -2
- package/utils.d.cts +6 -7
- package/utils.d.mts +6 -7
- package/utils.d.ts +6 -7
package/column.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Column } from 'drizzle-orm';
|
|
2
2
|
import { z as zod } from 'zod/v4';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FactoryOptions } from "./schema.types.cjs";
|
|
4
4
|
import type { Json } from "./utils.cjs";
|
|
5
|
-
export declare const literalSchema:
|
|
5
|
+
export declare const literalSchema: any;
|
|
6
6
|
export declare const jsonSchema: zod.ZodType<Json>;
|
|
7
7
|
export declare const bufferSchema: zod.ZodType<Buffer>;
|
|
8
|
-
export declare function columnToSchema(column: Column, factory:
|
|
8
|
+
export declare function columnToSchema(column: Column, factory: FactoryOptions | undefined): zod.ZodType;
|
package/column.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Column } from 'drizzle-orm';
|
|
2
2
|
import { z as zod } from 'zod/v4';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FactoryOptions } from "./schema.types.mjs";
|
|
4
4
|
import type { Json } from "./utils.mjs";
|
|
5
|
-
export declare const literalSchema:
|
|
5
|
+
export declare const literalSchema: any;
|
|
6
6
|
export declare const jsonSchema: zod.ZodType<Json>;
|
|
7
7
|
export declare const bufferSchema: zod.ZodType<Buffer>;
|
|
8
|
-
export declare function columnToSchema(column: Column, factory:
|
|
8
|
+
export declare function columnToSchema(column: Column, factory: FactoryOptions | undefined): zod.ZodType;
|
package/column.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Column } from 'drizzle-orm';
|
|
2
2
|
import { z as zod } from 'zod/v4';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FactoryOptions } from './schema.types.js';
|
|
4
4
|
import type { Json } from './utils.js';
|
|
5
|
-
export declare const literalSchema:
|
|
5
|
+
export declare const literalSchema: any;
|
|
6
6
|
export declare const jsonSchema: zod.ZodType<Json>;
|
|
7
7
|
export declare const bufferSchema: zod.ZodType<Buffer>;
|
|
8
|
-
export declare function columnToSchema(column: Column, factory:
|
|
8
|
+
export declare function columnToSchema(column: Column, factory: FactoryOptions | undefined): zod.ZodType;
|
package/column.types.d.cts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
1
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
2
2
|
import type { z } from 'zod/v4';
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
in:
|
|
16
|
-
}> :
|
|
17
|
-
type
|
|
18
|
-
type
|
|
3
|
+
import type { CoerceOptions } from "./schema.types.cjs";
|
|
4
|
+
import type { Json } from "./utils.cjs";
|
|
5
|
+
export type GetZodType<TColumn extends Column<any>, TCoerce extends CoerceOptions, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>, TCanCoerce extends boolean = CanCoerce<TCoerce, ColumnTypeDataToCoerceKey<TType>>> = TType['type'] extends 'array' ? TType['constraint'] extends 'geometry' | 'point' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'line' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'vector' | 'halfvector' ? z.ZodArray<z.ZodNumber> : TType['constraint'] extends 'basecolumn' ? z.ZodArray<GetZodType<Assume<TColumn['_'], {
|
|
6
|
+
baseColumn: Column<any>;
|
|
7
|
+
}>['baseColumn'], TCoerce>> : z.ZodArray<z.ZodAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? CanCoerce<TCoerce, 'date'> extends true ? z.coerce.ZodCoercedDate : z.ZodDate : TType['constraint'] extends 'buffer' ? z.ZodType<Buffer> : TType['constraint'] extends 'point' | 'geometry' ? z.ZodObject<{
|
|
8
|
+
x: z.ZodNumber;
|
|
9
|
+
y: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip> : TType['constraint'] extends 'line' ? z.ZodObject<{
|
|
11
|
+
a: z.ZodNumber;
|
|
12
|
+
b: z.ZodNumber;
|
|
13
|
+
c: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip> : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? z.ZodType<TColumn['_']['data'], z.core.$strip> : z.ZodType<Json> : z.ZodObject<{}, z.core.$loose> : TType['type'] extends 'custom' ? z.ZodType : TType['type'] extends 'number' ? TCanCoerce extends true ? z.coerce.ZodCoercedNumber : (TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? z.ZodInt : z.ZodNumber) : TType['type'] extends 'bigint' ? TCanCoerce extends true ? z.coerce.ZodCoercedBigInt : z.ZodBigInt : TType['type'] extends 'boolean' ? TCanCoerce extends true ? z.coerce.ZodCoercedBoolean : z.ZodBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'uuid' ? z.ZodUUID : TCanCoerce extends true ? z.coerce.ZodCoercedString : TType['constraint'] extends 'enum' ? z.ZodEnum<{
|
|
15
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
16
|
+
}> : z.ZodString : z.ZodType;
|
|
17
|
+
type ColumnTypeDataToCoerceKey<TType extends ColumnTypeData> = TType['type'] extends 'bigint' | 'boolean' | 'number' | 'string' ? TType['type'] : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? TType['constraint'] : 'none' : 'none';
|
|
18
|
+
type CanCoerce<TCoerce extends CoerceOptions, TTo extends 'bigint' | 'boolean' | 'date' | 'number' | 'string' | 'none'> = TCoerce extends true ? true : TCoerce extends Record<string, any> ? TCoerce[TTo] extends true ? true : false : false;
|
|
19
19
|
type HandleSelectColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : z.ZodNullable<TSchema>;
|
|
20
20
|
type HandleInsertColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? z.ZodOptional<TSchema> : TSchema : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
21
21
|
type HandleUpdateColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? z.ZodOptional<TSchema> : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
22
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends
|
|
22
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends CoerceOptions> = TType extends 'select' ? HandleSelectColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetZodType<TColumn, TCoerce>, TColumn> : GetZodType<TColumn, TCoerce>;
|
|
23
23
|
export {};
|
package/column.types.d.mts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
1
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
2
2
|
import type { z } from 'zod/v4';
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
in:
|
|
16
|
-
}> :
|
|
17
|
-
type
|
|
18
|
-
type
|
|
3
|
+
import type { CoerceOptions } from "./schema.types.mjs";
|
|
4
|
+
import type { Json } from "./utils.mjs";
|
|
5
|
+
export type GetZodType<TColumn extends Column<any>, TCoerce extends CoerceOptions, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>, TCanCoerce extends boolean = CanCoerce<TCoerce, ColumnTypeDataToCoerceKey<TType>>> = TType['type'] extends 'array' ? TType['constraint'] extends 'geometry' | 'point' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'line' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'vector' | 'halfvector' ? z.ZodArray<z.ZodNumber> : TType['constraint'] extends 'basecolumn' ? z.ZodArray<GetZodType<Assume<TColumn['_'], {
|
|
6
|
+
baseColumn: Column<any>;
|
|
7
|
+
}>['baseColumn'], TCoerce>> : z.ZodArray<z.ZodAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? CanCoerce<TCoerce, 'date'> extends true ? z.coerce.ZodCoercedDate : z.ZodDate : TType['constraint'] extends 'buffer' ? z.ZodType<Buffer> : TType['constraint'] extends 'point' | 'geometry' ? z.ZodObject<{
|
|
8
|
+
x: z.ZodNumber;
|
|
9
|
+
y: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip> : TType['constraint'] extends 'line' ? z.ZodObject<{
|
|
11
|
+
a: z.ZodNumber;
|
|
12
|
+
b: z.ZodNumber;
|
|
13
|
+
c: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip> : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? z.ZodType<TColumn['_']['data'], z.core.$strip> : z.ZodType<Json> : z.ZodObject<{}, z.core.$loose> : TType['type'] extends 'custom' ? z.ZodType : TType['type'] extends 'number' ? TCanCoerce extends true ? z.coerce.ZodCoercedNumber : (TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? z.ZodInt : z.ZodNumber) : TType['type'] extends 'bigint' ? TCanCoerce extends true ? z.coerce.ZodCoercedBigInt : z.ZodBigInt : TType['type'] extends 'boolean' ? TCanCoerce extends true ? z.coerce.ZodCoercedBoolean : z.ZodBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'uuid' ? z.ZodUUID : TCanCoerce extends true ? z.coerce.ZodCoercedString : TType['constraint'] extends 'enum' ? z.ZodEnum<{
|
|
15
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
16
|
+
}> : z.ZodString : z.ZodType;
|
|
17
|
+
type ColumnTypeDataToCoerceKey<TType extends ColumnTypeData> = TType['type'] extends 'bigint' | 'boolean' | 'number' | 'string' ? TType['type'] : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? TType['constraint'] : 'none' : 'none';
|
|
18
|
+
type CanCoerce<TCoerce extends CoerceOptions, TTo extends 'bigint' | 'boolean' | 'date' | 'number' | 'string' | 'none'> = TCoerce extends true ? true : TCoerce extends Record<string, any> ? TCoerce[TTo] extends true ? true : false : false;
|
|
19
19
|
type HandleSelectColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : z.ZodNullable<TSchema>;
|
|
20
20
|
type HandleInsertColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? z.ZodOptional<TSchema> : TSchema : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
21
21
|
type HandleUpdateColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? z.ZodOptional<TSchema> : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
22
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends
|
|
22
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends CoerceOptions> = TType extends 'select' ? HandleSelectColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetZodType<TColumn, TCoerce>, TColumn> : GetZodType<TColumn, TCoerce>;
|
|
23
23
|
export {};
|
package/column.types.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
1
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
2
2
|
import type { z } from 'zod/v4';
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
in:
|
|
16
|
-
}> :
|
|
17
|
-
type
|
|
18
|
-
type
|
|
3
|
+
import type { CoerceOptions } from './schema.types.js';
|
|
4
|
+
import type { Json } from './utils.js';
|
|
5
|
+
export type GetZodType<TColumn extends Column<any>, TCoerce extends CoerceOptions, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>, TCanCoerce extends boolean = CanCoerce<TCoerce, ColumnTypeDataToCoerceKey<TType>>> = TType['type'] extends 'array' ? TType['constraint'] extends 'geometry' | 'point' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'line' ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : TType['constraint'] extends 'vector' | 'halfvector' ? z.ZodArray<z.ZodNumber> : TType['constraint'] extends 'basecolumn' ? z.ZodArray<GetZodType<Assume<TColumn['_'], {
|
|
6
|
+
baseColumn: Column<any>;
|
|
7
|
+
}>['baseColumn'], TCoerce>> : z.ZodArray<z.ZodAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? CanCoerce<TCoerce, 'date'> extends true ? z.coerce.ZodCoercedDate : z.ZodDate : TType['constraint'] extends 'buffer' ? z.ZodType<Buffer> : TType['constraint'] extends 'point' | 'geometry' ? z.ZodObject<{
|
|
8
|
+
x: z.ZodNumber;
|
|
9
|
+
y: z.ZodNumber;
|
|
10
|
+
}, z.core.$strip> : TType['constraint'] extends 'line' ? z.ZodObject<{
|
|
11
|
+
a: z.ZodNumber;
|
|
12
|
+
b: z.ZodNumber;
|
|
13
|
+
c: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip> : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? z.ZodType<TColumn['_']['data'], z.core.$strip> : z.ZodType<Json> : z.ZodObject<{}, z.core.$loose> : TType['type'] extends 'custom' ? z.ZodType : TType['type'] extends 'number' ? TCanCoerce extends true ? z.coerce.ZodCoercedNumber : (TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? z.ZodInt : z.ZodNumber) : TType['type'] extends 'bigint' ? TCanCoerce extends true ? z.coerce.ZodCoercedBigInt : z.ZodBigInt : TType['type'] extends 'boolean' ? TCanCoerce extends true ? z.coerce.ZodCoercedBoolean : z.ZodBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'uuid' ? z.ZodUUID : TCanCoerce extends true ? z.coerce.ZodCoercedString : TType['constraint'] extends 'enum' ? z.ZodEnum<{
|
|
15
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
16
|
+
}> : z.ZodString : z.ZodType;
|
|
17
|
+
type ColumnTypeDataToCoerceKey<TType extends ColumnTypeData> = TType['type'] extends 'bigint' | 'boolean' | 'number' | 'string' ? TType['type'] : TType['type'] extends 'object' ? TType['constraint'] extends 'date' ? TType['constraint'] : 'none' : 'none';
|
|
18
|
+
type CanCoerce<TCoerce extends CoerceOptions, TTo extends 'bigint' | 'boolean' | 'date' | 'number' | 'string' | 'none'> = TCoerce extends true ? true : TCoerce extends Record<string, any> ? TCoerce[TTo] extends true ? true : false : false;
|
|
19
19
|
type HandleSelectColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : z.ZodNullable<TSchema>;
|
|
20
20
|
type HandleInsertColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? z.ZodOptional<TSchema> : TSchema : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
21
21
|
type HandleUpdateColumn<TSchema extends z.ZodType, TColumn extends Column> = TColumn['_']['notNull'] extends true ? z.ZodOptional<TSchema> : z.ZodOptional<z.ZodNullable<TSchema>>;
|
|
22
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends
|
|
22
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column, TCoerce extends CoerceOptions> = TType extends 'select' ? HandleSelectColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetZodType<TColumn, TCoerce>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetZodType<TColumn, TCoerce>, TColumn> : GetZodType<TColumn, TCoerce>;
|
|
23
23
|
export {};
|