drizzle-typebox 0.3.2 → 0.3.3-08e4e66
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 +1 -1
- package/column.d.mts +1 -1
- package/column.d.ts +1 -1
- package/column.types.d.cts +18 -16
- package/column.types.d.mts +18 -16
- package/column.types.d.ts +18 -16
- package/index.cjs +272 -183
- package/index.cjs.map +1 -1
- package/index.mjs +273 -184
- package/index.mjs.map +1 -1
- package/package.json +5 -5
- package/schema.types.d.cts +6 -5
- package/schema.types.d.mts +6 -5
- package/schema.types.d.ts +6 -5
- package/schema.types.internal.d.cts +10 -12
- package/schema.types.internal.d.mts +10 -12
- package/schema.types.internal.d.ts +10 -12
- package/utils.d.cts +13 -7
- package/utils.d.mts +13 -7
- package/utils.d.ts +13 -7
package/column.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
-
import type
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
3
|
import type { BufferSchema, JsonSchema } from "./utils.cjs";
|
|
4
4
|
export declare const literalSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
|
|
5
5
|
export declare const jsonSchema: JsonSchema;
|
package/column.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
-
import type
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
3
|
import type { BufferSchema, JsonSchema } from "./utils.mjs";
|
|
4
4
|
export declare const literalSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
|
|
5
5
|
export declare const jsonSchema: JsonSchema;
|
package/column.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
-
import type
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
3
|
import type { BufferSchema, JsonSchema } from './utils.js';
|
|
4
4
|
export declare const literalSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNumber, import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>;
|
|
5
5
|
export declare const jsonSchema: JsonSchema;
|
package/column.types.d.cts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import type * as t from '@sinclair/typebox';
|
|
2
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
enumValues: [string, ...string[]];
|
|
6
|
-
} ? TColumn['_']['enumValues'] : undefined;
|
|
7
|
-
export type GetBaseColumn<TColumn extends Column> = TColumn['_'] extends {
|
|
8
|
-
baseColumn: Column | never | undefined;
|
|
9
|
-
} ? IsNever<TColumn['_']['baseColumn']> extends false ? TColumn['_']['baseColumn'] : undefined : undefined;
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema } from "./column.cjs";
|
|
4
|
+
import type { BufferSchema, JsonSchema } from "./utils.cjs";
|
|
10
5
|
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
11
6
|
[K in TEnumValues[number]]: K;
|
|
12
7
|
};
|
|
13
8
|
export interface GenericSchema<T> extends t.TSchema {
|
|
14
9
|
static: T;
|
|
15
10
|
}
|
|
16
|
-
export type GetTypeboxType<
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
export type GetTypeboxType<TColumn extends Column, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>> = TType['type'] extends 'array' ? TType['constraint'] extends 'basecolumn' ? t.TArray<GetTypeboxType<Assume<TColumn['_'], {
|
|
12
|
+
baseColumn: Column;
|
|
13
|
+
}>['baseColumn']>> : TType['constraint'] extends 'geometry' | 'point' ? t.TTuple<[t.TNumber, t.TNumber]> : TType['constraint'] extends 'line' ? t.TTuple<[t.TNumber, t.TNumber, t.TNumber]> : TType['constraint'] extends 'vector' | 'halfvector' ? t.TArray<t.TNumber> : TType['constraint'] extends 'int64vector' ? t.TArray<t.TBigInt> : t.TArray<t.TAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'geometry' | 'point' ? t.TObject<{
|
|
14
|
+
x: t.TNumber;
|
|
15
|
+
y: t.TNumber;
|
|
16
|
+
}> : TType['constraint'] extends 'line' ? t.TObject<{
|
|
17
|
+
a: t.TNumber;
|
|
18
|
+
b: t.TNumber;
|
|
19
|
+
c: t.TNumber;
|
|
20
|
+
}> : TType['constraint'] extends 'date' ? t.TDate : TType['constraint'] extends 'buffer' ? BufferSchema : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? GenericSchema<TColumn['_']['data']> : JsonSchema : t.TObject : TType['type'] extends 'custom' ? t.TAny : TType['type'] extends 'number' ? TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? t.TInteger : t.TNumber : TType['type'] extends 'bigint' ? t.TBigInt : TType['type'] extends 'boolean' ? t.TBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'binary' | 'varbinary' ? t.TRegExp : TType['constraint'] extends 'int64' ? typeof bigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
21
23
|
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
22
|
-
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
23
|
-
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
24
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> =
|
|
24
|
+
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? t.TOptional<TSchema> : TSchema : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
25
|
+
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? t.TOptional<TSchema> : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
26
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> = TType extends 'select' ? HandleSelectColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetTypeboxType<TColumn>, TColumn> : GetTypeboxType<TColumn>;
|
|
25
27
|
export {};
|
package/column.types.d.mts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import type * as t from '@sinclair/typebox';
|
|
2
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
enumValues: [string, ...string[]];
|
|
6
|
-
} ? TColumn['_']['enumValues'] : undefined;
|
|
7
|
-
export type GetBaseColumn<TColumn extends Column> = TColumn['_'] extends {
|
|
8
|
-
baseColumn: Column | never | undefined;
|
|
9
|
-
} ? IsNever<TColumn['_']['baseColumn']> extends false ? TColumn['_']['baseColumn'] : undefined : undefined;
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema } from "./column.mjs";
|
|
4
|
+
import type { BufferSchema, JsonSchema } from "./utils.mjs";
|
|
10
5
|
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
11
6
|
[K in TEnumValues[number]]: K;
|
|
12
7
|
};
|
|
13
8
|
export interface GenericSchema<T> extends t.TSchema {
|
|
14
9
|
static: T;
|
|
15
10
|
}
|
|
16
|
-
export type GetTypeboxType<
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
export type GetTypeboxType<TColumn extends Column, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>> = TType['type'] extends 'array' ? TType['constraint'] extends 'basecolumn' ? t.TArray<GetTypeboxType<Assume<TColumn['_'], {
|
|
12
|
+
baseColumn: Column;
|
|
13
|
+
}>['baseColumn']>> : TType['constraint'] extends 'geometry' | 'point' ? t.TTuple<[t.TNumber, t.TNumber]> : TType['constraint'] extends 'line' ? t.TTuple<[t.TNumber, t.TNumber, t.TNumber]> : TType['constraint'] extends 'vector' | 'halfvector' ? t.TArray<t.TNumber> : TType['constraint'] extends 'int64vector' ? t.TArray<t.TBigInt> : t.TArray<t.TAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'geometry' | 'point' ? t.TObject<{
|
|
14
|
+
x: t.TNumber;
|
|
15
|
+
y: t.TNumber;
|
|
16
|
+
}> : TType['constraint'] extends 'line' ? t.TObject<{
|
|
17
|
+
a: t.TNumber;
|
|
18
|
+
b: t.TNumber;
|
|
19
|
+
c: t.TNumber;
|
|
20
|
+
}> : TType['constraint'] extends 'date' ? t.TDate : TType['constraint'] extends 'buffer' ? BufferSchema : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? GenericSchema<TColumn['_']['data']> : JsonSchema : t.TObject : TType['type'] extends 'custom' ? t.TAny : TType['type'] extends 'number' ? TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? t.TInteger : t.TNumber : TType['type'] extends 'bigint' ? t.TBigInt : TType['type'] extends 'boolean' ? t.TBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'binary' | 'varbinary' ? t.TRegExp : TType['constraint'] extends 'int64' ? typeof bigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
21
23
|
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
22
|
-
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
23
|
-
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
24
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> =
|
|
24
|
+
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? t.TOptional<TSchema> : TSchema : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
25
|
+
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? t.TOptional<TSchema> : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
26
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> = TType extends 'select' ? HandleSelectColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetTypeboxType<TColumn>, TColumn> : GetTypeboxType<TColumn>;
|
|
25
27
|
export {};
|
package/column.types.d.ts
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import type * as t from '@sinclair/typebox';
|
|
2
|
-
import type { Assume, Column } from 'drizzle-orm';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
enumValues: [string, ...string[]];
|
|
6
|
-
} ? TColumn['_']['enumValues'] : undefined;
|
|
7
|
-
export type GetBaseColumn<TColumn extends Column> = TColumn['_'] extends {
|
|
8
|
-
baseColumn: Column | never | undefined;
|
|
9
|
-
} ? IsNever<TColumn['_']['baseColumn']> extends false ? TColumn['_']['baseColumn'] : undefined : undefined;
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema } from './column.js';
|
|
4
|
+
import type { BufferSchema, JsonSchema } from './utils.js';
|
|
10
5
|
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
11
6
|
[K in TEnumValues[number]]: K;
|
|
12
7
|
};
|
|
13
8
|
export interface GenericSchema<T> extends t.TSchema {
|
|
14
9
|
static: T;
|
|
15
10
|
}
|
|
16
|
-
export type GetTypeboxType<
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
export type GetTypeboxType<TColumn extends Column, TType extends ColumnTypeData = ExtractColumnTypeData<TColumn['_']['dataType']>> = TType['type'] extends 'array' ? TType['constraint'] extends 'basecolumn' ? t.TArray<GetTypeboxType<Assume<TColumn['_'], {
|
|
12
|
+
baseColumn: Column;
|
|
13
|
+
}>['baseColumn']>> : TType['constraint'] extends 'geometry' | 'point' ? t.TTuple<[t.TNumber, t.TNumber]> : TType['constraint'] extends 'line' ? t.TTuple<[t.TNumber, t.TNumber, t.TNumber]> : TType['constraint'] extends 'vector' | 'halfvector' ? t.TArray<t.TNumber> : TType['constraint'] extends 'int64vector' ? t.TArray<t.TBigInt> : t.TArray<t.TAny> : TType['type'] extends 'object' ? TType['constraint'] extends 'geometry' | 'point' ? t.TObject<{
|
|
14
|
+
x: t.TNumber;
|
|
15
|
+
y: t.TNumber;
|
|
16
|
+
}> : TType['constraint'] extends 'line' ? t.TObject<{
|
|
17
|
+
a: t.TNumber;
|
|
18
|
+
b: t.TNumber;
|
|
19
|
+
c: t.TNumber;
|
|
20
|
+
}> : TType['constraint'] extends 'date' ? t.TDate : TType['constraint'] extends 'buffer' ? BufferSchema : TType['constraint'] extends 'json' ? TColumn['_']['data'] extends Record<string, any> ? GenericSchema<TColumn['_']['data']> : JsonSchema : t.TObject : TType['type'] extends 'custom' ? t.TAny : TType['type'] extends 'number' ? TType['constraint'] extends 'int8' | 'int16' | 'int24' | 'int32' | 'int53' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint53' | 'year' ? t.TInteger : t.TNumber : TType['type'] extends 'bigint' ? t.TBigInt : TType['type'] extends 'boolean' ? t.TBoolean : TType['type'] extends 'string' ? TType['constraint'] extends 'binary' | 'varbinary' ? t.TRegExp : TType['constraint'] extends 'int64' ? typeof bigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
21
23
|
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
22
|
-
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
23
|
-
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> =
|
|
24
|
-
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> =
|
|
24
|
+
type HandleInsertColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TColumn['_']['hasDefault'] extends true ? t.TOptional<TSchema> : TSchema : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
25
|
+
type HandleUpdateColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? t.TOptional<TSchema> : t.TOptional<t.Union<[TSchema, t.TNull]>>;
|
|
26
|
+
export type HandleColumn<TType extends 'select' | 'insert' | 'update', TColumn extends Column> = TType extends 'select' ? HandleSelectColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'insert' ? HandleInsertColumn<GetTypeboxType<TColumn>, TColumn> : TType extends 'update' ? HandleUpdateColumn<GetTypeboxType<TColumn>, TColumn> : GetTypeboxType<TColumn>;
|
|
25
27
|
export {};
|