drizzle-typebox 1.0.0-beta.6-7aaf14b → 1.0.0-beta.6-da87e04
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 +10 -0
- package/column.d.mts +10 -0
- package/column.d.ts +10 -0
- package/column.types.d.cts +27 -0
- package/column.types.d.mts +27 -0
- package/column.types.d.ts +27 -0
- package/constants.d.cts +20 -0
- package/constants.d.mts +20 -0
- package/constants.d.ts +20 -0
- package/index.cjs +402 -356
- package/index.cjs.map +1 -1
- package/index.d.cts +6 -122
- package/index.d.mts +6 -122
- package/index.d.ts +6 -122
- package/index.mjs +394 -350
- package/index.mjs.map +1 -1
- package/package.json +3 -2
- package/schema.d.cts +18 -0
- package/schema.d.mts +18 -0
- package/schema.d.ts +18 -0
- package/schema.types.d.cts +24 -0
- package/schema.types.d.mts +24 -0
- package/schema.types.d.ts +24 -0
- package/schema.types.internal.d.cts +22 -0
- package/schema.types.internal.d.mts +22 -0
- package/schema.types.internal.d.ts +22 -0
- package/utils.d.cts +39 -0
- package/utils.d.mts +39 -0
- package/utils.d.ts +39 -0
package/column.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
|
+
import type { BufferSchema, JsonSchema } from "./utils.cjs";
|
|
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
|
+
export declare const jsonSchema: JsonSchema;
|
|
6
|
+
export declare const bufferSchema: BufferSchema;
|
|
7
|
+
export declare function mapEnumValues(values: string[]): {
|
|
8
|
+
[k: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function columnToSchema(column: Column, t: typeof typebox): TSchema;
|
package/column.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
|
+
import type { BufferSchema, JsonSchema } from "./utils.mjs";
|
|
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
|
+
export declare const jsonSchema: JsonSchema;
|
|
6
|
+
export declare const bufferSchema: BufferSchema;
|
|
7
|
+
export declare function mapEnumValues(values: string[]): {
|
|
8
|
+
[k: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function columnToSchema(column: Column, t: typeof typebox): TSchema;
|
package/column.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TSchema, Type as typebox } from '@sinclair/typebox';
|
|
2
|
+
import { type Column } from 'drizzle-orm';
|
|
3
|
+
import type { BufferSchema, JsonSchema } from './utils.js';
|
|
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
|
+
export declare const jsonSchema: JsonSchema;
|
|
6
|
+
export declare const bufferSchema: BufferSchema;
|
|
7
|
+
export declare function mapEnumValues(values: string[]): {
|
|
8
|
+
[k: string]: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function columnToSchema(column: Column, t: typeof typebox): TSchema;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as t from '@sinclair/typebox';
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema, unsignedBigintStringModeSchema } from "./column.cjs";
|
|
4
|
+
import type { BufferSchema, JsonSchema } from "./utils.cjs";
|
|
5
|
+
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
6
|
+
[K in TEnumValues[number]]: K;
|
|
7
|
+
};
|
|
8
|
+
export interface GenericSchema<T> extends t.TSchema {
|
|
9
|
+
static: T;
|
|
10
|
+
}
|
|
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 'uint64' ? typeof unsignedBigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
23
|
+
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
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>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as t from '@sinclair/typebox';
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema, unsignedBigintStringModeSchema } from "./column.mjs";
|
|
4
|
+
import type { BufferSchema, JsonSchema } from "./utils.mjs";
|
|
5
|
+
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
6
|
+
[K in TEnumValues[number]]: K;
|
|
7
|
+
};
|
|
8
|
+
export interface GenericSchema<T> extends t.TSchema {
|
|
9
|
+
static: T;
|
|
10
|
+
}
|
|
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 'uint64' ? typeof unsignedBigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
23
|
+
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
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>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as t from '@sinclair/typebox';
|
|
2
|
+
import type { Assume, Column, ColumnTypeData, ExtractColumnTypeData } from 'drizzle-orm';
|
|
3
|
+
import type { bigintStringModeSchema, unsignedBigintStringModeSchema } from './column.js';
|
|
4
|
+
import type { BufferSchema, JsonSchema } from './utils.js';
|
|
5
|
+
export type EnumValuesToEnum<TEnumValues extends [string, ...string[]]> = {
|
|
6
|
+
[K in TEnumValues[number]]: K;
|
|
7
|
+
};
|
|
8
|
+
export interface GenericSchema<T> extends t.TSchema {
|
|
9
|
+
static: T;
|
|
10
|
+
}
|
|
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 'uint64' ? typeof unsignedBigintStringModeSchema : TType['constraint'] extends 'enum' ? t.TEnum<{
|
|
21
|
+
[K in Assume<TColumn['_']['enumValues'], string[]>[number]]: K;
|
|
22
|
+
}> : t.TString : t.TAny;
|
|
23
|
+
type HandleSelectColumn<TSchema extends t.TSchema, TColumn extends Column> = TColumn['_']['notNull'] extends true ? TSchema : t.Union<[TSchema, t.TNull]>;
|
|
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>;
|
|
27
|
+
export {};
|
package/constants.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CONSTANTS: {
|
|
2
|
+
INT8_MIN: number;
|
|
3
|
+
INT8_MAX: number;
|
|
4
|
+
INT8_UNSIGNED_MAX: number;
|
|
5
|
+
INT16_MIN: number;
|
|
6
|
+
INT16_MAX: number;
|
|
7
|
+
INT16_UNSIGNED_MAX: number;
|
|
8
|
+
INT24_MIN: number;
|
|
9
|
+
INT24_MAX: number;
|
|
10
|
+
INT24_UNSIGNED_MAX: number;
|
|
11
|
+
INT32_MIN: number;
|
|
12
|
+
INT32_MAX: number;
|
|
13
|
+
INT32_UNSIGNED_MAX: number;
|
|
14
|
+
INT48_MIN: number;
|
|
15
|
+
INT48_MAX: number;
|
|
16
|
+
INT48_UNSIGNED_MAX: number;
|
|
17
|
+
INT64_MIN: bigint;
|
|
18
|
+
INT64_MAX: bigint;
|
|
19
|
+
INT64_UNSIGNED_MAX: bigint;
|
|
20
|
+
};
|
package/constants.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CONSTANTS: {
|
|
2
|
+
INT8_MIN: number;
|
|
3
|
+
INT8_MAX: number;
|
|
4
|
+
INT8_UNSIGNED_MAX: number;
|
|
5
|
+
INT16_MIN: number;
|
|
6
|
+
INT16_MAX: number;
|
|
7
|
+
INT16_UNSIGNED_MAX: number;
|
|
8
|
+
INT24_MIN: number;
|
|
9
|
+
INT24_MAX: number;
|
|
10
|
+
INT24_UNSIGNED_MAX: number;
|
|
11
|
+
INT32_MIN: number;
|
|
12
|
+
INT32_MAX: number;
|
|
13
|
+
INT32_UNSIGNED_MAX: number;
|
|
14
|
+
INT48_MIN: number;
|
|
15
|
+
INT48_MAX: number;
|
|
16
|
+
INT48_UNSIGNED_MAX: number;
|
|
17
|
+
INT64_MIN: bigint;
|
|
18
|
+
INT64_MAX: bigint;
|
|
19
|
+
INT64_UNSIGNED_MAX: bigint;
|
|
20
|
+
};
|
package/constants.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CONSTANTS: {
|
|
2
|
+
INT8_MIN: number;
|
|
3
|
+
INT8_MAX: number;
|
|
4
|
+
INT8_UNSIGNED_MAX: number;
|
|
5
|
+
INT16_MIN: number;
|
|
6
|
+
INT16_MAX: number;
|
|
7
|
+
INT16_UNSIGNED_MAX: number;
|
|
8
|
+
INT24_MIN: number;
|
|
9
|
+
INT24_MAX: number;
|
|
10
|
+
INT24_UNSIGNED_MAX: number;
|
|
11
|
+
INT32_MIN: number;
|
|
12
|
+
INT32_MAX: number;
|
|
13
|
+
INT32_UNSIGNED_MAX: number;
|
|
14
|
+
INT48_MIN: number;
|
|
15
|
+
INT48_MAX: number;
|
|
16
|
+
INT48_UNSIGNED_MAX: number;
|
|
17
|
+
INT64_MIN: bigint;
|
|
18
|
+
INT64_MAX: bigint;
|
|
19
|
+
INT64_UNSIGNED_MAX: bigint;
|
|
20
|
+
};
|