Initial commit

This commit is contained in:
Ammaar Reshi
2025-01-04 14:06:53 +00:00
parent 7082408604
commit d6025af146
23760 changed files with 3299690 additions and 0 deletions

44
node_modules/drizzle-orm/sqlite-core/columns/all.cjs generated vendored Normal file
View File

@ -0,0 +1,44 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var all_exports = {};
__export(all_exports, {
getSQLiteColumnBuilders: () => getSQLiteColumnBuilders
});
module.exports = __toCommonJS(all_exports);
var import_blob = require("./blob.cjs");
var import_custom = require("./custom.cjs");
var import_integer = require("./integer.cjs");
var import_numeric = require("./numeric.cjs");
var import_real = require("./real.cjs");
var import_text = require("./text.cjs");
function getSQLiteColumnBuilders() {
return {
blob: import_blob.blob,
customType: import_custom.customType,
integer: import_integer.integer,
numeric: import_numeric.numeric,
real: import_real.real,
text: import_text.text
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getSQLiteColumnBuilders
});
//# sourceMappingURL=all.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/all.ts"],"sourcesContent":["import { blob } from './blob.ts';\nimport { customType } from './custom.ts';\nimport { integer } from './integer.ts';\nimport { numeric } from './numeric.ts';\nimport { real } from './real.ts';\nimport { text } from './text.ts';\n\nexport function getSQLiteColumnBuilders() {\n\treturn {\n\t\tblob,\n\t\tcustomType,\n\t\tinteger,\n\t\tnumeric,\n\t\treal,\n\t\ttext,\n\t};\n}\n\nexport type SQLiteColumnBuilders = ReturnType<typeof getSQLiteColumnBuilders>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,oBAA2B;AAC3B,qBAAwB;AACxB,qBAAwB;AACxB,kBAAqB;AACrB,kBAAqB;AAEd,SAAS,0BAA0B;AACzC,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}

15
node_modules/drizzle-orm/sqlite-core/columns/all.d.cts generated vendored Normal file
View File

@ -0,0 +1,15 @@
import { blob } from "./blob.cjs";
import { customType } from "./custom.cjs";
import { integer } from "./integer.cjs";
import { numeric } from "./numeric.cjs";
import { real } from "./real.cjs";
import { text } from "./text.cjs";
export declare function getSQLiteColumnBuilders(): {
blob: typeof blob;
customType: typeof customType;
integer: typeof integer;
numeric: typeof numeric;
real: typeof real;
text: typeof text;
};
export type SQLiteColumnBuilders = ReturnType<typeof getSQLiteColumnBuilders>;

15
node_modules/drizzle-orm/sqlite-core/columns/all.d.ts generated vendored Normal file
View File

@ -0,0 +1,15 @@
import { blob } from "./blob.js";
import { customType } from "./custom.js";
import { integer } from "./integer.js";
import { numeric } from "./numeric.js";
import { real } from "./real.js";
import { text } from "./text.js";
export declare function getSQLiteColumnBuilders(): {
blob: typeof blob;
customType: typeof customType;
integer: typeof integer;
numeric: typeof numeric;
real: typeof real;
text: typeof text;
};
export type SQLiteColumnBuilders = ReturnType<typeof getSQLiteColumnBuilders>;

20
node_modules/drizzle-orm/sqlite-core/columns/all.js generated vendored Normal file
View File

@ -0,0 +1,20 @@
import { blob } from "./blob.js";
import { customType } from "./custom.js";
import { integer } from "./integer.js";
import { numeric } from "./numeric.js";
import { real } from "./real.js";
import { text } from "./text.js";
function getSQLiteColumnBuilders() {
return {
blob,
customType,
integer,
numeric,
real,
text
};
}
export {
getSQLiteColumnBuilders
};
//# sourceMappingURL=all.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/all.ts"],"sourcesContent":["import { blob } from './blob.ts';\nimport { customType } from './custom.ts';\nimport { integer } from './integer.ts';\nimport { numeric } from './numeric.ts';\nimport { real } from './real.ts';\nimport { text } from './text.ts';\n\nexport function getSQLiteColumnBuilders() {\n\treturn {\n\t\tblob,\n\t\tcustomType,\n\t\tinteger,\n\t\tnumeric,\n\t\treal,\n\t\ttext,\n\t};\n}\n\nexport type SQLiteColumnBuilders = ReturnType<typeof getSQLiteColumnBuilders>;\n"],"mappings":"AAAA,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,YAAY;AAEd,SAAS,0BAA0B;AACzC,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}

130
node_modules/drizzle-orm/sqlite-core/columns/blob.cjs generated vendored Normal file
View File

@ -0,0 +1,130 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var blob_exports = {};
__export(blob_exports, {
SQLiteBigInt: () => SQLiteBigInt,
SQLiteBigIntBuilder: () => SQLiteBigIntBuilder,
SQLiteBlobBuffer: () => SQLiteBlobBuffer,
SQLiteBlobBufferBuilder: () => SQLiteBlobBufferBuilder,
SQLiteBlobJson: () => SQLiteBlobJson,
SQLiteBlobJsonBuilder: () => SQLiteBlobJsonBuilder,
blob: () => blob
});
module.exports = __toCommonJS(blob_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SQLiteBigIntBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteBigIntBuilder";
constructor(name) {
super(name, "bigint", "SQLiteBigInt");
}
/** @internal */
build(table) {
return new SQLiteBigInt(table, this.config);
}
}
class SQLiteBigInt extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteBigInt";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (Buffer.isBuffer(value)) {
return BigInt(value.toString());
}
if (value instanceof ArrayBuffer) {
const decoder = new TextDecoder();
return BigInt(decoder.decode(value));
}
return BigInt(String.fromCodePoint(...value));
}
mapToDriverValue(value) {
return Buffer.from(value.toString());
}
}
class SQLiteBlobJsonBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteBlobJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteBlobJson");
}
/** @internal */
build(table) {
return new SQLiteBlobJson(
table,
this.config
);
}
}
class SQLiteBlobJson extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteBlobJson";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (Buffer.isBuffer(value)) {
return JSON.parse(value.toString());
}
if (value instanceof ArrayBuffer) {
const decoder = new TextDecoder();
return JSON.parse(decoder.decode(value));
}
return JSON.parse(String.fromCodePoint(...value));
}
mapToDriverValue(value) {
return Buffer.from(JSON.stringify(value));
}
}
class SQLiteBlobBufferBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteBlobBufferBuilder";
constructor(name) {
super(name, "buffer", "SQLiteBlobBuffer");
}
/** @internal */
build(table) {
return new SQLiteBlobBuffer(table, this.config);
}
}
class SQLiteBlobBuffer extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteBlobBuffer";
getSQLType() {
return "blob";
}
}
function blob(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config?.mode === "json") {
return new SQLiteBlobJsonBuilder(name);
}
if (config?.mode === "bigint") {
return new SQLiteBigIntBuilder(name);
}
return new SQLiteBlobBufferBuilder(name);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteBigInt,
SQLiteBigIntBuilder,
SQLiteBlobBuffer,
SQLiteBlobBufferBuilder,
SQLiteBlobJson,
SQLiteBlobJsonBuilder,
blob
});
//# sourceMappingURL=blob.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,71 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { type Equal } from "../../utils.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
type BlobMode = 'buffer' | 'json' | 'bigint';
export type SQLiteBigIntBuilderInitial<TName extends string> = SQLiteBigIntBuilder<{
name: TName;
dataType: 'bigint';
columnType: 'SQLiteBigInt';
data: bigint;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBigInt<T extends ColumnBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): bigint;
mapToDriverValue(value: bigint): Buffer;
}
export type SQLiteBlobJsonBuilderInitial<TName extends string> = SQLiteBlobJsonBuilder<{
name: TName;
dataType: 'json';
columnType: 'SQLiteBlobJson';
data: unknown;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBlobJsonBuilder<T extends ColumnBuilderBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBlobJson<T extends ColumnBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): T['data'];
mapToDriverValue(value: T['data']): Buffer;
}
export type SQLiteBlobBufferBuilderInitial<TName extends string> = SQLiteBlobBufferBuilder<{
name: TName;
dataType: 'buffer';
columnType: 'SQLiteBlobBuffer';
data: Buffer;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBlobBufferBuilder<T extends ColumnBuilderBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBlobBuffer<T extends ColumnBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export interface BlobConfig<TMode extends BlobMode = BlobMode> {
mode: TMode;
}
/**
* It's recommended to use `text('...', { mode: 'json' })` instead of `blob` in JSON mode, because it supports JSON functions:
* >All JSON functions currently throw an error if any of their arguments are BLOBs because BLOBs are reserved for a future enhancement in which BLOBs will store the binary encoding for JSON.
*
* https://www.sqlite.org/json1.html
*/
export declare function blob(): SQLiteBlobJsonBuilderInitial<''>;
export declare function blob<TMode extends BlobMode = BlobMode>(config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<''> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<''> : SQLiteBlobJsonBuilderInitial<''>;
export declare function blob<TName extends string, TMode extends BlobMode = BlobMode>(name: TName, config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<TName> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<TName> : SQLiteBlobJsonBuilderInitial<TName>;
export {};

71
node_modules/drizzle-orm/sqlite-core/columns/blob.d.ts generated vendored Normal file
View File

@ -0,0 +1,71 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { type Equal } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
type BlobMode = 'buffer' | 'json' | 'bigint';
export type SQLiteBigIntBuilderInitial<TName extends string> = SQLiteBigIntBuilder<{
name: TName;
dataType: 'bigint';
columnType: 'SQLiteBigInt';
data: bigint;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBigInt<T extends ColumnBaseConfig<'bigint', 'SQLiteBigInt'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): bigint;
mapToDriverValue(value: bigint): Buffer;
}
export type SQLiteBlobJsonBuilderInitial<TName extends string> = SQLiteBlobJsonBuilder<{
name: TName;
dataType: 'json';
columnType: 'SQLiteBlobJson';
data: unknown;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBlobJsonBuilder<T extends ColumnBuilderBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBlobJson<T extends ColumnBaseConfig<'json', 'SQLiteBlobJson'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: Buffer | Uint8Array | ArrayBuffer): T['data'];
mapToDriverValue(value: T['data']): Buffer;
}
export type SQLiteBlobBufferBuilderInitial<TName extends string> = SQLiteBlobBufferBuilder<{
name: TName;
dataType: 'buffer';
columnType: 'SQLiteBlobBuffer';
data: Buffer;
driverParam: Buffer;
enumValues: undefined;
}>;
export declare class SQLiteBlobBufferBuilder<T extends ColumnBuilderBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteBlobBuffer<T extends ColumnBaseConfig<'buffer', 'SQLiteBlobBuffer'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export interface BlobConfig<TMode extends BlobMode = BlobMode> {
mode: TMode;
}
/**
* It's recommended to use `text('...', { mode: 'json' })` instead of `blob` in JSON mode, because it supports JSON functions:
* >All JSON functions currently throw an error if any of their arguments are BLOBs because BLOBs are reserved for a future enhancement in which BLOBs will store the binary encoding for JSON.
*
* https://www.sqlite.org/json1.html
*/
export declare function blob(): SQLiteBlobJsonBuilderInitial<''>;
export declare function blob<TMode extends BlobMode = BlobMode>(config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<''> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<''> : SQLiteBlobJsonBuilderInitial<''>;
export declare function blob<TName extends string, TMode extends BlobMode = BlobMode>(name: TName, config?: BlobConfig<TMode>): Equal<TMode, 'bigint'> extends true ? SQLiteBigIntBuilderInitial<TName> : Equal<TMode, 'buffer'> extends true ? SQLiteBlobBufferBuilderInitial<TName> : SQLiteBlobJsonBuilderInitial<TName>;
export {};

100
node_modules/drizzle-orm/sqlite-core/columns/blob.js generated vendored Normal file
View File

@ -0,0 +1,100 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteBigIntBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBigIntBuilder";
constructor(name) {
super(name, "bigint", "SQLiteBigInt");
}
/** @internal */
build(table) {
return new SQLiteBigInt(table, this.config);
}
}
class SQLiteBigInt extends SQLiteColumn {
static [entityKind] = "SQLiteBigInt";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (Buffer.isBuffer(value)) {
return BigInt(value.toString());
}
if (value instanceof ArrayBuffer) {
const decoder = new TextDecoder();
return BigInt(decoder.decode(value));
}
return BigInt(String.fromCodePoint(...value));
}
mapToDriverValue(value) {
return Buffer.from(value.toString());
}
}
class SQLiteBlobJsonBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBlobJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteBlobJson");
}
/** @internal */
build(table) {
return new SQLiteBlobJson(
table,
this.config
);
}
}
class SQLiteBlobJson extends SQLiteColumn {
static [entityKind] = "SQLiteBlobJson";
getSQLType() {
return "blob";
}
mapFromDriverValue(value) {
if (Buffer.isBuffer(value)) {
return JSON.parse(value.toString());
}
if (value instanceof ArrayBuffer) {
const decoder = new TextDecoder();
return JSON.parse(decoder.decode(value));
}
return JSON.parse(String.fromCodePoint(...value));
}
mapToDriverValue(value) {
return Buffer.from(JSON.stringify(value));
}
}
class SQLiteBlobBufferBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBlobBufferBuilder";
constructor(name) {
super(name, "buffer", "SQLiteBlobBuffer");
}
/** @internal */
build(table) {
return new SQLiteBlobBuffer(table, this.config);
}
}
class SQLiteBlobBuffer extends SQLiteColumn {
static [entityKind] = "SQLiteBlobBuffer";
getSQLType() {
return "blob";
}
}
function blob(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config?.mode === "json") {
return new SQLiteBlobJsonBuilder(name);
}
if (config?.mode === "bigint") {
return new SQLiteBigIntBuilder(name);
}
return new SQLiteBlobBufferBuilder(name);
}
export {
SQLiteBigInt,
SQLiteBigIntBuilder,
SQLiteBlobBuffer,
SQLiteBlobBufferBuilder,
SQLiteBlobJson,
SQLiteBlobJsonBuilder,
blob
};
//# sourceMappingURL=blob.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,84 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var common_exports = {};
__export(common_exports, {
SQLiteColumn: () => SQLiteColumn,
SQLiteColumnBuilder: () => SQLiteColumnBuilder
});
module.exports = __toCommonJS(common_exports);
var import_column_builder = require("../../column-builder.cjs");
var import_column = require("../../column.cjs");
var import_entity = require("../../entity.cjs");
var import_foreign_keys = require("../foreign-keys.cjs");
var import_unique_constraint = require("../unique-constraint.cjs");
class SQLiteColumnBuilder extends import_column_builder.ColumnBuilder {
static [import_entity.entityKind] = "SQLiteColumnBuilder";
foreignKeyConfigs = [];
references(ref, actions = {}) {
this.foreignKeyConfigs.push({ ref, actions });
return this;
}
unique(name) {
this.config.isUnique = true;
this.config.uniqueName = name;
return this;
}
generatedAlwaysAs(as, config) {
this.config.generated = {
as,
type: "always",
mode: config?.mode ?? "virtual"
};
return this;
}
/** @internal */
buildForeignKeys(column, table) {
return this.foreignKeyConfigs.map(({ ref, actions }) => {
return ((ref2, actions2) => {
const builder = new import_foreign_keys.ForeignKeyBuilder(() => {
const foreignColumn = ref2();
return { columns: [column], foreignColumns: [foreignColumn] };
});
if (actions2.onUpdate) {
builder.onUpdate(actions2.onUpdate);
}
if (actions2.onDelete) {
builder.onDelete(actions2.onDelete);
}
return builder.build(table);
})(ref, actions);
});
}
}
class SQLiteColumn extends import_column.Column {
constructor(table, config) {
if (!config.uniqueName) {
config.uniqueName = (0, import_unique_constraint.uniqueKeyName)(table, [config.name]);
}
super(table, config);
this.table = table;
}
static [import_entity.entityKind] = "SQLiteColumn";
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteColumn,
SQLiteColumnBuilder
});
//# sourceMappingURL=common.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,42 @@
import type { ColumnBuilderBase, ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnBuilderRuntimeConfig, ColumnDataType, HasGenerated } from "../../column-builder.cjs";
import { ColumnBuilder } from "../../column-builder.cjs";
import { Column } from "../../column.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { SQL } from "../../sql/sql.cjs";
import type { UpdateDeleteAction } from "../foreign-keys.cjs";
import type { SQLiteTable } from "../table.cjs";
import type { Update } from "../../utils.cjs";
export interface ReferenceConfig {
ref: () => SQLiteColumn;
actions: {
onUpdate?: UpdateDeleteAction;
onDelete?: UpdateDeleteAction;
};
}
export interface SQLiteColumnBuilderBase<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> extends ColumnBuilderBase<T, TTypeConfig & {
dialect: 'sqlite';
}> {
}
export interface SQLiteGeneratedColumnConfig {
mode?: 'virtual' | 'stored';
}
export declare abstract class SQLiteColumnBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TTypeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = object> extends ColumnBuilder<T, TRuntimeConfig, TTypeConfig & {
dialect: 'sqlite';
}, TExtraConfig> implements SQLiteColumnBuilderBase<T, TTypeConfig> {
static readonly [entityKind]: string;
private foreignKeyConfigs;
references(ref: ReferenceConfig['ref'], actions?: ReferenceConfig['actions']): this;
unique(name?: string): this;
generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: SQLiteGeneratedColumnConfig): HasGenerated<this, {
type: 'always';
}>;
}
export declare abstract class SQLiteColumn<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = {}, TTypeConfig extends object = {}> extends Column<T, TRuntimeConfig, TTypeConfig & {
dialect: 'sqlite';
}> {
readonly table: SQLiteTable;
static readonly [entityKind]: string;
constructor(table: SQLiteTable, config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>);
}
export type AnySQLiteColumn<TPartial extends Partial<ColumnBaseConfig<ColumnDataType, string>> = {}> = SQLiteColumn<Required<Update<ColumnBaseConfig<ColumnDataType, string>, TPartial>>>;

View File

@ -0,0 +1,42 @@
import type { ColumnBuilderBase, ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnBuilderRuntimeConfig, ColumnDataType, HasGenerated } from "../../column-builder.js";
import { ColumnBuilder } from "../../column-builder.js";
import { Column } from "../../column.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { SQL } from "../../sql/sql.js";
import type { UpdateDeleteAction } from "../foreign-keys.js";
import type { SQLiteTable } from "../table.js";
import type { Update } from "../../utils.js";
export interface ReferenceConfig {
ref: () => SQLiteColumn;
actions: {
onUpdate?: UpdateDeleteAction;
onDelete?: UpdateDeleteAction;
};
}
export interface SQLiteColumnBuilderBase<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> extends ColumnBuilderBase<T, TTypeConfig & {
dialect: 'sqlite';
}> {
}
export interface SQLiteGeneratedColumnConfig {
mode?: 'virtual' | 'stored';
}
export declare abstract class SQLiteColumnBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TTypeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = object> extends ColumnBuilder<T, TRuntimeConfig, TTypeConfig & {
dialect: 'sqlite';
}, TExtraConfig> implements SQLiteColumnBuilderBase<T, TTypeConfig> {
static readonly [entityKind]: string;
private foreignKeyConfigs;
references(ref: ReferenceConfig['ref'], actions?: ReferenceConfig['actions']): this;
unique(name?: string): this;
generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: SQLiteGeneratedColumnConfig): HasGenerated<this, {
type: 'always';
}>;
}
export declare abstract class SQLiteColumn<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = {}, TTypeConfig extends object = {}> extends Column<T, TRuntimeConfig, TTypeConfig & {
dialect: 'sqlite';
}> {
readonly table: SQLiteTable;
static readonly [entityKind]: string;
constructor(table: SQLiteTable, config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>);
}
export type AnySQLiteColumn<TPartial extends Partial<ColumnBaseConfig<ColumnDataType, string>> = {}> = SQLiteColumn<Required<Update<ColumnBaseConfig<ColumnDataType, string>, TPartial>>>;

59
node_modules/drizzle-orm/sqlite-core/columns/common.js generated vendored Normal file
View File

@ -0,0 +1,59 @@
import { ColumnBuilder } from "../../column-builder.js";
import { Column } from "../../column.js";
import { entityKind } from "../../entity.js";
import { ForeignKeyBuilder } from "../foreign-keys.js";
import { uniqueKeyName } from "../unique-constraint.js";
class SQLiteColumnBuilder extends ColumnBuilder {
static [entityKind] = "SQLiteColumnBuilder";
foreignKeyConfigs = [];
references(ref, actions = {}) {
this.foreignKeyConfigs.push({ ref, actions });
return this;
}
unique(name) {
this.config.isUnique = true;
this.config.uniqueName = name;
return this;
}
generatedAlwaysAs(as, config) {
this.config.generated = {
as,
type: "always",
mode: config?.mode ?? "virtual"
};
return this;
}
/** @internal */
buildForeignKeys(column, table) {
return this.foreignKeyConfigs.map(({ ref, actions }) => {
return ((ref2, actions2) => {
const builder = new ForeignKeyBuilder(() => {
const foreignColumn = ref2();
return { columns: [column], foreignColumns: [foreignColumn] };
});
if (actions2.onUpdate) {
builder.onUpdate(actions2.onUpdate);
}
if (actions2.onDelete) {
builder.onDelete(actions2.onDelete);
}
return builder.build(table);
})(ref, actions);
});
}
}
class SQLiteColumn extends Column {
constructor(table, config) {
if (!config.uniqueName) {
config.uniqueName = uniqueKeyName(table, [config.name]);
}
super(table, config);
this.table = table;
}
static [entityKind] = "SQLiteColumn";
}
export {
SQLiteColumn,
SQLiteColumnBuilder
};
//# sourceMappingURL=common.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,81 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var custom_exports = {};
__export(custom_exports, {
SQLiteCustomColumn: () => SQLiteCustomColumn,
SQLiteCustomColumnBuilder: () => SQLiteCustomColumnBuilder,
customType: () => customType
});
module.exports = __toCommonJS(custom_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SQLiteCustomColumnBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteCustomColumnBuilder";
constructor(name, fieldConfig, customTypeParams) {
super(name, "custom", "SQLiteCustomColumn");
this.config.fieldConfig = fieldConfig;
this.config.customTypeParams = customTypeParams;
}
/** @internal */
build(table) {
return new SQLiteCustomColumn(
table,
this.config
);
}
}
class SQLiteCustomColumn extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteCustomColumn";
sqlName;
mapTo;
mapFrom;
constructor(table, config) {
super(table, config);
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
this.mapTo = config.customTypeParams.toDriver;
this.mapFrom = config.customTypeParams.fromDriver;
}
getSQLType() {
return this.sqlName;
}
mapFromDriverValue(value) {
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
}
mapToDriverValue(value) {
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
}
}
function customType(customTypeParams) {
return (a, b) => {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SQLiteCustomColumnBuilder(
name,
config,
customTypeParams
);
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteCustomColumn,
SQLiteCustomColumnBuilder,
customType
});
//# sourceMappingURL=custom.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,155 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { SQL } from "../../sql/sql.cjs";
import type { AnySQLiteTable } from "../table.cjs";
import { type Equal } from "../../utils.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> = {
name: TName;
dataType: 'custom';
columnType: 'SQLiteCustomColumn';
data: T['data'];
driverParam: T['driverData'];
enumValues: undefined;
} & (T['notNull'] extends true ? {
notNull: true;
} : {}) & (T['default'] extends true ? {
hasDefault: true;
} : {});
export interface SQLiteCustomColumnInnerConfig {
customTypeValues: CustomTypeValues;
}
export declare class SQLiteCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'SQLiteCustomColumn'>> extends SQLiteColumnBuilder<T, {
fieldConfig: CustomTypeValues['config'];
customTypeParams: CustomTypeParams<any>;
}, {
sqliteColumnBuilderBrand: 'SQLiteCustomColumnBuilderBrand';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], fieldConfig: CustomTypeValues['config'], customTypeParams: CustomTypeParams<any>);
}
export declare class SQLiteCustomColumn<T extends ColumnBaseConfig<'custom', 'SQLiteCustomColumn'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
private sqlName;
private mapTo?;
private mapFrom?;
constructor(table: AnySQLiteTable<{
name: T['tableName'];
}>, config: SQLiteCustomColumnBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: T['driverParam']): T['data'];
mapToDriverValue(value: T['data']): T['driverParam'];
}
export type CustomTypeValues = {
/**
* Required type for custom column, that will infer proper type model
*
* Examples:
*
* If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`
*
* If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`
*/
data: unknown;
/**
* Type helper, that represents what type database driver is accepting for specific database data type
*/
driverData?: unknown;
/**
* What config type should be used for {@link CustomTypeParams} `dataType` generation
*/
config?: Record<string, any>;
/**
* Whether the config argument should be required or not
* @default false
*/
configRequired?: boolean;
/**
* If your custom data type should be notNull by default you can use `notNull: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
notNull?: boolean;
/**
* If your custom data type has default you can use `default: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
default?: boolean;
};
export interface CustomTypeParams<T extends CustomTypeValues> {
/**
* Database data type string representation, that is used for migrations
* @example
* ```
* `jsonb`, `text`
* ```
*
* If database data type needs additional params you can use them from `config` param
* @example
* ```
* `varchar(256)`, `numeric(2,3)`
* ```
*
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
*
* @example
* Usage example
* ```
* dataType() {
* return 'boolean';
* },
* ```
* Or
* ```
* dataType(config) {
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
* }
* ```
*/
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
/**
* Optional mapping function, between user input and driver
* @example
* For example, when using jsonb we need to map JS/TS object to string before writing to database
* ```
* toDriver(value: TData): string {
* return JSON.stringify(value);
* }
* ```
*/
toDriver?: (value: T['data']) => T['driverData'] | SQL;
/**
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
* @example
* For example, when using timestamp we need to map string Date representation to JS Date
* ```
* fromDriver(value: string): Date {
* return new Date(value);
* },
* ```
*/
fromDriver?: (value: T['driverData']) => T['data'];
}
/**
* Custom sqlite database data type generator
*/
export declare function customType<T extends CustomTypeValues = CustomTypeValues>(customTypeParams: CustomTypeParams<T>): Equal<T['configRequired'], true> extends true ? {
<TConfig extends Record<string, any> & T['config']>(fieldConfig: TConfig): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig: T['config']): SQLiteCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
} : {
(): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TConfig extends Record<string, any> & T['config']>(fieldConfig?: TConfig): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig?: T['config']): SQLiteCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
};

View File

@ -0,0 +1,155 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { SQL } from "../../sql/sql.js";
import type { AnySQLiteTable } from "../table.js";
import { type Equal } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> = {
name: TName;
dataType: 'custom';
columnType: 'SQLiteCustomColumn';
data: T['data'];
driverParam: T['driverData'];
enumValues: undefined;
} & (T['notNull'] extends true ? {
notNull: true;
} : {}) & (T['default'] extends true ? {
hasDefault: true;
} : {});
export interface SQLiteCustomColumnInnerConfig {
customTypeValues: CustomTypeValues;
}
export declare class SQLiteCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'SQLiteCustomColumn'>> extends SQLiteColumnBuilder<T, {
fieldConfig: CustomTypeValues['config'];
customTypeParams: CustomTypeParams<any>;
}, {
sqliteColumnBuilderBrand: 'SQLiteCustomColumnBuilderBrand';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], fieldConfig: CustomTypeValues['config'], customTypeParams: CustomTypeParams<any>);
}
export declare class SQLiteCustomColumn<T extends ColumnBaseConfig<'custom', 'SQLiteCustomColumn'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
private sqlName;
private mapTo?;
private mapFrom?;
constructor(table: AnySQLiteTable<{
name: T['tableName'];
}>, config: SQLiteCustomColumnBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: T['driverParam']): T['data'];
mapToDriverValue(value: T['data']): T['driverParam'];
}
export type CustomTypeValues = {
/**
* Required type for custom column, that will infer proper type model
*
* Examples:
*
* If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`
*
* If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`
*/
data: unknown;
/**
* Type helper, that represents what type database driver is accepting for specific database data type
*/
driverData?: unknown;
/**
* What config type should be used for {@link CustomTypeParams} `dataType` generation
*/
config?: Record<string, any>;
/**
* Whether the config argument should be required or not
* @default false
*/
configRequired?: boolean;
/**
* If your custom data type should be notNull by default you can use `notNull: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
notNull?: boolean;
/**
* If your custom data type has default you can use `default: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
default?: boolean;
};
export interface CustomTypeParams<T extends CustomTypeValues> {
/**
* Database data type string representation, that is used for migrations
* @example
* ```
* `jsonb`, `text`
* ```
*
* If database data type needs additional params you can use them from `config` param
* @example
* ```
* `varchar(256)`, `numeric(2,3)`
* ```
*
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
*
* @example
* Usage example
* ```
* dataType() {
* return 'boolean';
* },
* ```
* Or
* ```
* dataType(config) {
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
* }
* ```
*/
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
/**
* Optional mapping function, between user input and driver
* @example
* For example, when using jsonb we need to map JS/TS object to string before writing to database
* ```
* toDriver(value: TData): string {
* return JSON.stringify(value);
* }
* ```
*/
toDriver?: (value: T['data']) => T['driverData'] | SQL;
/**
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
* @example
* For example, when using timestamp we need to map string Date representation to JS Date
* ```
* fromDriver(value: string): Date {
* return new Date(value);
* },
* ```
*/
fromDriver?: (value: T['driverData']) => T['data'];
}
/**
* Custom sqlite database data type generator
*/
export declare function customType<T extends CustomTypeValues = CustomTypeValues>(customTypeParams: CustomTypeParams<T>): Equal<T['configRequired'], true> extends true ? {
<TConfig extends Record<string, any> & T['config']>(fieldConfig: TConfig): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig: T['config']): SQLiteCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
} : {
(): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TConfig extends Record<string, any> & T['config']>(fieldConfig?: TConfig): SQLiteCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig?: T['config']): SQLiteCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
};

55
node_modules/drizzle-orm/sqlite-core/columns/custom.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteCustomColumnBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteCustomColumnBuilder";
constructor(name, fieldConfig, customTypeParams) {
super(name, "custom", "SQLiteCustomColumn");
this.config.fieldConfig = fieldConfig;
this.config.customTypeParams = customTypeParams;
}
/** @internal */
build(table) {
return new SQLiteCustomColumn(
table,
this.config
);
}
}
class SQLiteCustomColumn extends SQLiteColumn {
static [entityKind] = "SQLiteCustomColumn";
sqlName;
mapTo;
mapFrom;
constructor(table, config) {
super(table, config);
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
this.mapTo = config.customTypeParams.toDriver;
this.mapFrom = config.customTypeParams.fromDriver;
}
getSQLType() {
return this.sqlName;
}
mapFromDriverValue(value) {
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
}
mapToDriverValue(value) {
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
}
}
function customType(customTypeParams) {
return (a, b) => {
const { name, config } = getColumnNameAndConfig(a, b);
return new SQLiteCustomColumnBuilder(
name,
config,
customTypeParams
);
};
}
export {
SQLiteCustomColumn,
SQLiteCustomColumnBuilder,
customType
};
//# sourceMappingURL=custom.js.map

File diff suppressed because one or more lines are too long

35
node_modules/drizzle-orm/sqlite-core/columns/index.cjs generated vendored Normal file
View File

@ -0,0 +1,35 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var columns_exports = {};
module.exports = __toCommonJS(columns_exports);
__reExport(columns_exports, require("./blob.cjs"), module.exports);
__reExport(columns_exports, require("./common.cjs"), module.exports);
__reExport(columns_exports, require("./custom.cjs"), module.exports);
__reExport(columns_exports, require("./integer.cjs"), module.exports);
__reExport(columns_exports, require("./numeric.cjs"), module.exports);
__reExport(columns_exports, require("./real.cjs"), module.exports);
__reExport(columns_exports, require("./text.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./blob.cjs"),
...require("./common.cjs"),
...require("./custom.cjs"),
...require("./integer.cjs"),
...require("./numeric.cjs"),
...require("./real.cjs"),
...require("./text.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/index.ts"],"sourcesContent":["export * from './blob.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './integer.ts';\nexport * from './numeric.ts';\nexport * from './real.ts';\nexport * from './text.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,sBAAd;AACA,4BAAc,wBADd;AAEA,4BAAc,wBAFd;AAGA,4BAAc,yBAHd;AAIA,4BAAc,yBAJd;AAKA,4BAAc,sBALd;AAMA,4BAAc,sBANd;","names":[]}

View File

@ -0,0 +1,7 @@
export * from "./blob.cjs";
export * from "./common.cjs";
export * from "./custom.cjs";
export * from "./integer.cjs";
export * from "./numeric.cjs";
export * from "./real.cjs";
export * from "./text.cjs";

View File

@ -0,0 +1,7 @@
export * from "./blob.js";
export * from "./common.js";
export * from "./custom.js";
export * from "./integer.js";
export * from "./numeric.js";
export * from "./real.js";
export * from "./text.js";

View File

@ -0,0 +1,8 @@
export * from "./blob.js";
export * from "./common.js";
export * from "./custom.js";
export * from "./integer.js";
export * from "./numeric.js";
export * from "./real.js";
export * from "./text.js";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/index.ts"],"sourcesContent":["export * from './blob.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './integer.ts';\nexport * from './numeric.ts';\nexport * from './real.ts';\nexport * from './text.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}

View File

@ -0,0 +1,158 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var integer_exports = {};
__export(integer_exports, {
SQLiteBaseInteger: () => SQLiteBaseInteger,
SQLiteBaseIntegerBuilder: () => SQLiteBaseIntegerBuilder,
SQLiteBoolean: () => SQLiteBoolean,
SQLiteBooleanBuilder: () => SQLiteBooleanBuilder,
SQLiteInteger: () => SQLiteInteger,
SQLiteIntegerBuilder: () => SQLiteIntegerBuilder,
SQLiteTimestamp: () => SQLiteTimestamp,
SQLiteTimestampBuilder: () => SQLiteTimestampBuilder,
int: () => int,
integer: () => integer
});
module.exports = __toCommonJS(integer_exports);
var import_entity = require("../../entity.cjs");
var import_sql = require("../../sql/sql.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SQLiteBaseIntegerBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteBaseIntegerBuilder";
constructor(name, dataType, columnType) {
super(name, dataType, columnType);
this.config.autoIncrement = false;
}
primaryKey(config) {
if (config?.autoIncrement) {
this.config.autoIncrement = true;
}
this.config.hasDefault = true;
return super.primaryKey();
}
}
class SQLiteBaseInteger extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteBaseInteger";
autoIncrement = this.config.autoIncrement;
getSQLType() {
return "integer";
}
}
class SQLiteIntegerBuilder extends SQLiteBaseIntegerBuilder {
static [import_entity.entityKind] = "SQLiteIntegerBuilder";
constructor(name) {
super(name, "number", "SQLiteInteger");
}
build(table) {
return new SQLiteInteger(
table,
this.config
);
}
}
class SQLiteInteger extends SQLiteBaseInteger {
static [import_entity.entityKind] = "SQLiteInteger";
}
class SQLiteTimestampBuilder extends SQLiteBaseIntegerBuilder {
static [import_entity.entityKind] = "SQLiteTimestampBuilder";
constructor(name, mode) {
super(name, "date", "SQLiteTimestamp");
this.config.mode = mode;
}
/**
* @deprecated Use `default()` with your own expression instead.
*
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
*/
defaultNow() {
return this.default(import_sql.sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
}
build(table) {
return new SQLiteTimestamp(
table,
this.config
);
}
}
class SQLiteTimestamp extends SQLiteBaseInteger {
static [import_entity.entityKind] = "SQLiteTimestamp";
mode = this.config.mode;
mapFromDriverValue(value) {
if (this.config.mode === "timestamp") {
return new Date(value * 1e3);
}
return new Date(value);
}
mapToDriverValue(value) {
const unix = value.getTime();
if (this.config.mode === "timestamp") {
return Math.floor(unix / 1e3);
}
return unix;
}
}
class SQLiteBooleanBuilder extends SQLiteBaseIntegerBuilder {
static [import_entity.entityKind] = "SQLiteBooleanBuilder";
constructor(name, mode) {
super(name, "boolean", "SQLiteBoolean");
this.config.mode = mode;
}
build(table) {
return new SQLiteBoolean(
table,
this.config
);
}
}
class SQLiteBoolean extends SQLiteBaseInteger {
static [import_entity.entityKind] = "SQLiteBoolean";
mode = this.config.mode;
mapFromDriverValue(value) {
return Number(value) === 1;
}
mapToDriverValue(value) {
return value ? 1 : 0;
}
}
function integer(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config?.mode === "timestamp" || config?.mode === "timestamp_ms") {
return new SQLiteTimestampBuilder(name, config.mode);
}
if (config?.mode === "boolean") {
return new SQLiteBooleanBuilder(name, config.mode);
}
return new SQLiteIntegerBuilder(name);
}
const int = integer;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteBaseInteger,
SQLiteBaseIntegerBuilder,
SQLiteBoolean,
SQLiteBooleanBuilder,
SQLiteInteger,
SQLiteIntegerBuilder,
SQLiteTimestamp,
SQLiteTimestampBuilder,
int,
integer
});
//# sourceMappingURL=integer.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,108 @@
import type { ColumnBuilderBaseConfig, ColumnDataType, HasDefault, IsPrimaryKey, MakeColumnConfig, NotNull } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { OnConflict } from "../utils.cjs";
import { type Equal, type Or } from "../../utils.cjs";
import type { AnySQLiteTable } from "../table.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export interface PrimaryKeyConfig {
autoIncrement?: boolean;
onConflict?: OnConflict;
}
export declare abstract class SQLiteBaseIntegerBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumnBuilder<T, TRuntimeConfig & {
autoIncrement: boolean;
}, {}, {
primaryKeyHasDefault: true;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']);
primaryKey(config?: PrimaryKeyConfig): IsPrimaryKey<HasDefault<NotNull<this>>>;
}
export declare abstract class SQLiteBaseInteger<T extends ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumn<T, TRuntimeConfig & {
autoIncrement: boolean;
}> {
static readonly [entityKind]: string;
readonly autoIncrement: boolean;
getSQLType(): string;
}
export type SQLiteIntegerBuilderInitial<TName extends string> = SQLiteIntegerBuilder<{
name: TName;
dataType: 'number';
columnType: 'SQLiteInteger';
data: number;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteIntegerBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseIntegerBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteInteger<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteInteger<T extends ColumnBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseInteger<T> {
static readonly [entityKind]: string;
}
export type SQLiteTimestampBuilderInitial<TName extends string> = SQLiteTimestampBuilder<{
name: TName;
dataType: 'date';
columnType: 'SQLiteTimestamp';
data: Date;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteTimestampBuilder<T extends ColumnBuilderBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'timestamp' | 'timestamp_ms');
/**
* @deprecated Use `default()` with your own expression instead.
*
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
*/
defaultNow(): HasDefault<this>;
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteTimestamp<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteTimestamp<T extends ColumnBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseInteger<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
readonly mode: 'timestamp' | 'timestamp_ms';
mapFromDriverValue(value: number): Date;
mapToDriverValue(value: Date): number;
}
export type SQLiteBooleanBuilderInitial<TName extends string> = SQLiteBooleanBuilder<{
name: TName;
dataType: 'boolean';
columnType: 'SQLiteBoolean';
data: boolean;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'boolean');
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteBoolean<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteBoolean<T extends ColumnBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseInteger<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
readonly mode: 'boolean';
mapFromDriverValue(value: number): boolean;
mapToDriverValue(value: boolean): number;
}
export interface IntegerConfig<TMode extends 'number' | 'timestamp' | 'timestamp_ms' | 'boolean' = 'number' | 'timestamp' | 'timestamp_ms' | 'boolean'> {
mode: TMode;
}
export declare function integer(): SQLiteIntegerBuilderInitial<''>;
export declare function integer<TMode extends IntegerConfig['mode']>(config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<''> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<''> : SQLiteIntegerBuilderInitial<''>;
export declare function integer<TName extends string, TMode extends IntegerConfig['mode']>(name: TName, config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<TName> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<TName> : SQLiteIntegerBuilderInitial<TName>;
export declare const int: typeof integer;

View File

@ -0,0 +1,108 @@
import type { ColumnBuilderBaseConfig, ColumnDataType, HasDefault, IsPrimaryKey, MakeColumnConfig, NotNull } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { OnConflict } from "../utils.js";
import { type Equal, type Or } from "../../utils.js";
import type { AnySQLiteTable } from "../table.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
export interface PrimaryKeyConfig {
autoIncrement?: boolean;
onConflict?: OnConflict;
}
export declare abstract class SQLiteBaseIntegerBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumnBuilder<T, TRuntimeConfig & {
autoIncrement: boolean;
}, {}, {
primaryKeyHasDefault: true;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']);
primaryKey(config?: PrimaryKeyConfig): IsPrimaryKey<HasDefault<NotNull<this>>>;
}
export declare abstract class SQLiteBaseInteger<T extends ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SQLiteColumn<T, TRuntimeConfig & {
autoIncrement: boolean;
}> {
static readonly [entityKind]: string;
readonly autoIncrement: boolean;
getSQLType(): string;
}
export type SQLiteIntegerBuilderInitial<TName extends string> = SQLiteIntegerBuilder<{
name: TName;
dataType: 'number';
columnType: 'SQLiteInteger';
data: number;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteIntegerBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseIntegerBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteInteger<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteInteger<T extends ColumnBaseConfig<'number', 'SQLiteInteger'>> extends SQLiteBaseInteger<T> {
static readonly [entityKind]: string;
}
export type SQLiteTimestampBuilderInitial<TName extends string> = SQLiteTimestampBuilder<{
name: TName;
dataType: 'date';
columnType: 'SQLiteTimestamp';
data: Date;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteTimestampBuilder<T extends ColumnBuilderBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'timestamp' | 'timestamp_ms');
/**
* @deprecated Use `default()` with your own expression instead.
*
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
*/
defaultNow(): HasDefault<this>;
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteTimestamp<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteTimestamp<T extends ColumnBaseConfig<'date', 'SQLiteTimestamp'>> extends SQLiteBaseInteger<T, {
mode: 'timestamp' | 'timestamp_ms';
}> {
static readonly [entityKind]: string;
readonly mode: 'timestamp' | 'timestamp_ms';
mapFromDriverValue(value: number): Date;
mapToDriverValue(value: Date): number;
}
export type SQLiteBooleanBuilderInitial<TName extends string> = SQLiteBooleanBuilder<{
name: TName;
dataType: 'boolean';
columnType: 'SQLiteBoolean';
data: boolean;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseIntegerBuilder<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], mode: 'boolean');
build<TTableName extends string>(table: AnySQLiteTable<{
name: TTableName;
}>): SQLiteBoolean<MakeColumnConfig<T, TTableName>>;
}
export declare class SQLiteBoolean<T extends ColumnBaseConfig<'boolean', 'SQLiteBoolean'>> extends SQLiteBaseInteger<T, {
mode: 'boolean';
}> {
static readonly [entityKind]: string;
readonly mode: 'boolean';
mapFromDriverValue(value: number): boolean;
mapToDriverValue(value: boolean): number;
}
export interface IntegerConfig<TMode extends 'number' | 'timestamp' | 'timestamp_ms' | 'boolean' = 'number' | 'timestamp' | 'timestamp_ms' | 'boolean'> {
mode: TMode;
}
export declare function integer(): SQLiteIntegerBuilderInitial<''>;
export declare function integer<TMode extends IntegerConfig['mode']>(config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<''> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<''> : SQLiteIntegerBuilderInitial<''>;
export declare function integer<TName extends string, TMode extends IntegerConfig['mode']>(name: TName, config?: IntegerConfig<TMode>): Or<Equal<TMode, 'timestamp'>, Equal<TMode, 'timestamp_ms'>> extends true ? SQLiteTimestampBuilderInitial<TName> : Equal<TMode, 'boolean'> extends true ? SQLiteBooleanBuilderInitial<TName> : SQLiteIntegerBuilderInitial<TName>;
export declare const int: typeof integer;

125
node_modules/drizzle-orm/sqlite-core/columns/integer.js generated vendored Normal file
View File

@ -0,0 +1,125 @@
import { entityKind } from "../../entity.js";
import { sql } from "../../sql/sql.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteBaseIntegerBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteBaseIntegerBuilder";
constructor(name, dataType, columnType) {
super(name, dataType, columnType);
this.config.autoIncrement = false;
}
primaryKey(config) {
if (config?.autoIncrement) {
this.config.autoIncrement = true;
}
this.config.hasDefault = true;
return super.primaryKey();
}
}
class SQLiteBaseInteger extends SQLiteColumn {
static [entityKind] = "SQLiteBaseInteger";
autoIncrement = this.config.autoIncrement;
getSQLType() {
return "integer";
}
}
class SQLiteIntegerBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteIntegerBuilder";
constructor(name) {
super(name, "number", "SQLiteInteger");
}
build(table) {
return new SQLiteInteger(
table,
this.config
);
}
}
class SQLiteInteger extends SQLiteBaseInteger {
static [entityKind] = "SQLiteInteger";
}
class SQLiteTimestampBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteTimestampBuilder";
constructor(name, mode) {
super(name, "date", "SQLiteTimestamp");
this.config.mode = mode;
}
/**
* @deprecated Use `default()` with your own expression instead.
*
* Adds `DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer))` to the column, which is the current epoch timestamp in milliseconds.
*/
defaultNow() {
return this.default(sql`(cast((julianday('now') - 2440587.5)*86400000 as integer))`);
}
build(table) {
return new SQLiteTimestamp(
table,
this.config
);
}
}
class SQLiteTimestamp extends SQLiteBaseInteger {
static [entityKind] = "SQLiteTimestamp";
mode = this.config.mode;
mapFromDriverValue(value) {
if (this.config.mode === "timestamp") {
return new Date(value * 1e3);
}
return new Date(value);
}
mapToDriverValue(value) {
const unix = value.getTime();
if (this.config.mode === "timestamp") {
return Math.floor(unix / 1e3);
}
return unix;
}
}
class SQLiteBooleanBuilder extends SQLiteBaseIntegerBuilder {
static [entityKind] = "SQLiteBooleanBuilder";
constructor(name, mode) {
super(name, "boolean", "SQLiteBoolean");
this.config.mode = mode;
}
build(table) {
return new SQLiteBoolean(
table,
this.config
);
}
}
class SQLiteBoolean extends SQLiteBaseInteger {
static [entityKind] = "SQLiteBoolean";
mode = this.config.mode;
mapFromDriverValue(value) {
return Number(value) === 1;
}
mapToDriverValue(value) {
return value ? 1 : 0;
}
}
function integer(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config?.mode === "timestamp" || config?.mode === "timestamp_ms") {
return new SQLiteTimestampBuilder(name, config.mode);
}
if (config?.mode === "boolean") {
return new SQLiteBooleanBuilder(name, config.mode);
}
return new SQLiteIntegerBuilder(name);
}
const int = integer;
export {
SQLiteBaseInteger,
SQLiteBaseIntegerBuilder,
SQLiteBoolean,
SQLiteBooleanBuilder,
SQLiteInteger,
SQLiteIntegerBuilder,
SQLiteTimestamp,
SQLiteTimestampBuilder,
int,
integer
};
//# sourceMappingURL=integer.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,56 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var numeric_exports = {};
__export(numeric_exports, {
SQLiteNumeric: () => SQLiteNumeric,
SQLiteNumericBuilder: () => SQLiteNumericBuilder,
numeric: () => numeric
});
module.exports = __toCommonJS(numeric_exports);
var import_entity = require("../../entity.cjs");
var import_common = require("./common.cjs");
class SQLiteNumericBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteNumericBuilder";
constructor(name) {
super(name, "string", "SQLiteNumeric");
}
/** @internal */
build(table) {
return new SQLiteNumeric(
table,
this.config
);
}
}
class SQLiteNumeric extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteNumeric";
getSQLType() {
return "numeric";
}
}
function numeric(name) {
return new SQLiteNumericBuilder(name ?? "");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteNumeric,
SQLiteNumericBuilder,
numeric
});
//# sourceMappingURL=numeric.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SQLiteNumeric';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteNumericBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'SQLiteNumeric');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteNumeric<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteNumeric<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteNumeric';\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function numeric(): SQLiteNumericBuilderInitial<''>;\nexport function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;\nexport function numeric(name?: string) {\n\treturn new SQLiteNumericBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,oBAAkD;AAW3C,MAAM,6BACJ,kCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,eAAe;AAAA,EACtC;AAAA;AAAA,EAGS,MACR,OACiD;AACjD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,sBAA6E,2BAAgB;AAAA,EACzG,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,qBAAqB,QAAQ,EAAE;AAC3C;","names":[]}

View File

@ -0,0 +1,22 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{
name: TName;
dataType: 'string';
columnType: 'SQLiteNumeric';
data: string;
driverParam: string;
enumValues: undefined;
}>;
export declare class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export declare function numeric(): SQLiteNumericBuilderInitial<''>;
export declare function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;

View File

@ -0,0 +1,22 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
export type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{
name: TName;
dataType: 'string';
columnType: 'SQLiteNumeric';
data: string;
driverParam: string;
enumValues: undefined;
}>;
export declare class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export declare function numeric(): SQLiteNumericBuilderInitial<''>;
export declare function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;

View File

@ -0,0 +1,30 @@
import { entityKind } from "../../entity.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteNumericBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteNumericBuilder";
constructor(name) {
super(name, "string", "SQLiteNumeric");
}
/** @internal */
build(table) {
return new SQLiteNumeric(
table,
this.config
);
}
}
class SQLiteNumeric extends SQLiteColumn {
static [entityKind] = "SQLiteNumeric";
getSQLType() {
return "numeric";
}
}
function numeric(name) {
return new SQLiteNumericBuilder(name ?? "");
}
export {
SQLiteNumeric,
SQLiteNumericBuilder,
numeric
};
//# sourceMappingURL=numeric.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/numeric.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '~/sqlite-core/table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteNumericBuilderInitial<TName extends string> = SQLiteNumericBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SQLiteNumeric';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteNumericBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteNumeric'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteNumericBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'SQLiteNumeric');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteNumeric<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteNumeric<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SQLiteNumeric<T extends ColumnBaseConfig<'string', 'SQLiteNumeric'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteNumeric';\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function numeric(): SQLiteNumericBuilderInitial<''>;\nexport function numeric<TName extends string>(name: TName): SQLiteNumericBuilderInitial<TName>;\nexport function numeric(name?: string) {\n\treturn new SQLiteNumericBuilder(name ?? '');\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,cAAc,2BAA2B;AAW3C,MAAM,6BACJ,oBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,eAAe;AAAA,EACtC;AAAA;AAAA,EAGS,MACR,OACiD;AACjD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,sBAA6E,aAAgB;AAAA,EACzG,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,qBAAqB,QAAQ,EAAE;AAC3C;","names":[]}

53
node_modules/drizzle-orm/sqlite-core/columns/real.cjs generated vendored Normal file
View File

@ -0,0 +1,53 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var real_exports = {};
__export(real_exports, {
SQLiteReal: () => SQLiteReal,
SQLiteRealBuilder: () => SQLiteRealBuilder,
real: () => real
});
module.exports = __toCommonJS(real_exports);
var import_entity = require("../../entity.cjs");
var import_common = require("./common.cjs");
class SQLiteRealBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteRealBuilder";
constructor(name) {
super(name, "number", "SQLiteReal");
}
/** @internal */
build(table) {
return new SQLiteReal(table, this.config);
}
}
class SQLiteReal extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteReal";
getSQLType() {
return "real";
}
}
function real(name) {
return new SQLiteRealBuilder(name ?? "");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteReal,
SQLiteRealBuilder,
real
});
//# sourceMappingURL=real.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/real.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '../table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteRealBuilderInitial<TName extends string> = SQLiteRealBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SQLiteReal';\n\tdata: number;\n\tdriverParam: number;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteRealBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteReal'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteRealBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'number', 'SQLiteReal');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteReal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteReal<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);\n\t}\n}\n\nexport class SQLiteReal<T extends ColumnBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteReal';\n\n\tgetSQLType(): string {\n\t\treturn 'real';\n\t}\n}\n\nexport function real(): SQLiteRealBuilderInitial<''>;\nexport function real<TName extends string>(name: TName): SQLiteRealBuilderInitial<TName>;\nexport function real(name?: string) {\n\treturn new SQLiteRealBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,oBAAkD;AAW3C,MAAM,0BACJ,kCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,YAAY;AAAA,EACnC;AAAA;AAAA,EAGS,MACR,OAC8C;AAC9C,WAAO,IAAI,WAA4C,OAAO,KAAK,MAA8C;AAAA,EAClH;AACD;AAEO,MAAM,mBAAuE,2BAAgB;AAAA,EACnG,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,KAAK,MAAe;AACnC,SAAO,IAAI,kBAAkB,QAAQ,EAAE;AACxC;","names":[]}

View File

@ -0,0 +1,22 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export type SQLiteRealBuilderInitial<TName extends string> = SQLiteRealBuilder<{
name: TName;
dataType: 'number';
columnType: 'SQLiteReal';
data: number;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteRealBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteReal<T extends ColumnBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export declare function real(): SQLiteRealBuilderInitial<''>;
export declare function real<TName extends string>(name: TName): SQLiteRealBuilderInitial<TName>;

22
node_modules/drizzle-orm/sqlite-core/columns/real.d.ts generated vendored Normal file
View File

@ -0,0 +1,22 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
export type SQLiteRealBuilderInitial<TName extends string> = SQLiteRealBuilder<{
name: TName;
dataType: 'number';
columnType: 'SQLiteReal';
data: number;
driverParam: number;
enumValues: undefined;
}>;
export declare class SQLiteRealBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteReal<T extends ColumnBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
}
export declare function real(): SQLiteRealBuilderInitial<''>;
export declare function real<TName extends string>(name: TName): SQLiteRealBuilderInitial<TName>;

27
node_modules/drizzle-orm/sqlite-core/columns/real.js generated vendored Normal file
View File

@ -0,0 +1,27 @@
import { entityKind } from "../../entity.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteRealBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteRealBuilder";
constructor(name) {
super(name, "number", "SQLiteReal");
}
/** @internal */
build(table) {
return new SQLiteReal(table, this.config);
}
}
class SQLiteReal extends SQLiteColumn {
static [entityKind] = "SQLiteReal";
getSQLType() {
return "real";
}
}
function real(name) {
return new SQLiteRealBuilder(name ?? "");
}
export {
SQLiteReal,
SQLiteRealBuilder,
real
};
//# sourceMappingURL=real.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sqlite-core/columns/real.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySQLiteTable } from '../table.ts';\nimport { SQLiteColumn, SQLiteColumnBuilder } from './common.ts';\n\nexport type SQLiteRealBuilderInitial<TName extends string> = SQLiteRealBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SQLiteReal';\n\tdata: number;\n\tdriverParam: number;\n\tenumValues: undefined;\n}>;\n\nexport class SQLiteRealBuilder<T extends ColumnBuilderBaseConfig<'number', 'SQLiteReal'>>\n\textends SQLiteColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SQLiteRealBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'number', 'SQLiteReal');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySQLiteTable<{ name: TTableName }>,\n\t): SQLiteReal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SQLiteReal<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);\n\t}\n}\n\nexport class SQLiteReal<T extends ColumnBaseConfig<'number', 'SQLiteReal'>> extends SQLiteColumn<T> {\n\tstatic override readonly [entityKind]: string = 'SQLiteReal';\n\n\tgetSQLType(): string {\n\t\treturn 'real';\n\t}\n}\n\nexport function real(): SQLiteRealBuilderInitial<''>;\nexport function real<TName extends string>(name: TName): SQLiteRealBuilderInitial<TName>;\nexport function real(name?: string) {\n\treturn new SQLiteRealBuilder(name ?? '');\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,cAAc,2BAA2B;AAW3C,MAAM,0BACJ,oBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,YAAY;AAAA,EACnC;AAAA;AAAA,EAGS,MACR,OAC8C;AAC9C,WAAO,IAAI,WAA4C,OAAO,KAAK,MAA8C;AAAA,EAClH;AACD;AAEO,MAAM,mBAAuE,aAAgB;AAAA,EACnG,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,KAAK,MAAe;AACnC,SAAO,IAAI,kBAAkB,QAAQ,EAAE;AACxC;","names":[]}

97
node_modules/drizzle-orm/sqlite-core/columns/text.cjs generated vendored Normal file
View File

@ -0,0 +1,97 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var text_exports = {};
__export(text_exports, {
SQLiteText: () => SQLiteText,
SQLiteTextBuilder: () => SQLiteTextBuilder,
SQLiteTextJson: () => SQLiteTextJson,
SQLiteTextJsonBuilder: () => SQLiteTextJsonBuilder,
text: () => text
});
module.exports = __toCommonJS(text_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SQLiteTextBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteTextBuilder";
constructor(name, config) {
super(name, "string", "SQLiteText");
this.config.enumValues = config.enum;
this.config.length = config.length;
}
/** @internal */
build(table) {
return new SQLiteText(
table,
this.config
);
}
}
class SQLiteText extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteText";
enumValues = this.config.enumValues;
length = this.config.length;
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `text${this.config.length ? `(${this.config.length})` : ""}`;
}
}
class SQLiteTextJsonBuilder extends import_common.SQLiteColumnBuilder {
static [import_entity.entityKind] = "SQLiteTextJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteTextJson");
}
/** @internal */
build(table) {
return new SQLiteTextJson(
table,
this.config
);
}
}
class SQLiteTextJson extends import_common.SQLiteColumn {
static [import_entity.entityKind] = "SQLiteTextJson";
getSQLType() {
return "text";
}
mapFromDriverValue(value) {
return JSON.parse(value);
}
mapToDriverValue(value) {
return JSON.stringify(value);
}
}
function text(a, b = {}) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config.mode === "json") {
return new SQLiteTextJsonBuilder(name);
}
return new SQLiteTextBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SQLiteText,
SQLiteTextBuilder,
SQLiteTextJson,
SQLiteTextJsonBuilder,
text
});
//# sourceMappingURL=text.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,72 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { AnySQLiteTable } from "../table.cjs";
import { type Equal, type Writable } from "../../utils.cjs";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.cjs";
export type SQLiteTextBuilderInitial<TName extends string, TEnum extends [string, ...string[]], TLength extends number | undefined> = SQLiteTextBuilder<{
name: TName;
dataType: 'string';
columnType: 'SQLiteText';
data: TEnum[number];
driverParam: string;
enumValues: TEnum;
length: TLength;
}>;
export declare class SQLiteTextBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteText'> & {
length?: number | undefined;
}> extends SQLiteColumnBuilder<T, {
length: T['length'];
enumValues: T['enumValues'];
}, {
length: T['length'];
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SQLiteTextConfig<'text', T['enumValues'], T['length']>);
}
export declare class SQLiteText<T extends ColumnBaseConfig<'string', 'SQLiteText'> & {
length?: number | undefined;
}> extends SQLiteColumn<T, {
length: T['length'];
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
readonly enumValues: T["enumValues"];
readonly length: T['length'];
constructor(table: AnySQLiteTable<{
name: T['tableName'];
}>, config: SQLiteTextBuilder<T>['config']);
getSQLType(): string;
}
export type SQLiteTextJsonBuilderInitial<TName extends string> = SQLiteTextJsonBuilder<{
name: TName;
dataType: 'json';
columnType: 'SQLiteTextJson';
data: unknown;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SQLiteTextJsonBuilder<T extends ColumnBuilderBaseConfig<'json', 'SQLiteTextJson'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteTextJson<T extends ColumnBaseConfig<'json', 'SQLiteTextJson'>> extends SQLiteColumn<T, {
length: number | undefined;
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: string): T['data'];
mapToDriverValue(value: T['data']): string;
}
export type SQLiteTextConfig<TMode extends 'text' | 'json' = 'text' | 'json', TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined, TLength extends number | undefined = number | undefined> = TMode extends 'text' ? {
mode?: TMode;
length?: TLength;
enum?: TEnum;
} : {
mode?: TMode;
};
export declare function text(): SQLiteTextBuilderInitial<'', [string, ...string[]], undefined>;
export declare function text<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined, TMode extends 'text' | 'json' = 'text' | 'json'>(config?: SQLiteTextConfig<TMode, T | Writable<T>, L>): Equal<TMode, 'json'> extends true ? SQLiteTextJsonBuilderInitial<''> : SQLiteTextBuilderInitial<'', Writable<T>, L>;
export declare function text<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined, TMode extends 'text' | 'json' = 'text' | 'json'>(name: TName, config?: SQLiteTextConfig<TMode, T | Writable<T>, L>): Equal<TMode, 'json'> extends true ? SQLiteTextJsonBuilderInitial<TName> : SQLiteTextBuilderInitial<TName, Writable<T>, L>;

72
node_modules/drizzle-orm/sqlite-core/columns/text.d.ts generated vendored Normal file
View File

@ -0,0 +1,72 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { AnySQLiteTable } from "../table.js";
import { type Equal, type Writable } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
export type SQLiteTextBuilderInitial<TName extends string, TEnum extends [string, ...string[]], TLength extends number | undefined> = SQLiteTextBuilder<{
name: TName;
dataType: 'string';
columnType: 'SQLiteText';
data: TEnum[number];
driverParam: string;
enumValues: TEnum;
length: TLength;
}>;
export declare class SQLiteTextBuilder<T extends ColumnBuilderBaseConfig<'string', 'SQLiteText'> & {
length?: number | undefined;
}> extends SQLiteColumnBuilder<T, {
length: T['length'];
enumValues: T['enumValues'];
}, {
length: T['length'];
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SQLiteTextConfig<'text', T['enumValues'], T['length']>);
}
export declare class SQLiteText<T extends ColumnBaseConfig<'string', 'SQLiteText'> & {
length?: number | undefined;
}> extends SQLiteColumn<T, {
length: T['length'];
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
readonly enumValues: T["enumValues"];
readonly length: T['length'];
constructor(table: AnySQLiteTable<{
name: T['tableName'];
}>, config: SQLiteTextBuilder<T>['config']);
getSQLType(): string;
}
export type SQLiteTextJsonBuilderInitial<TName extends string> = SQLiteTextJsonBuilder<{
name: TName;
dataType: 'json';
columnType: 'SQLiteTextJson';
data: unknown;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SQLiteTextJsonBuilder<T extends ColumnBuilderBaseConfig<'json', 'SQLiteTextJson'>> extends SQLiteColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SQLiteTextJson<T extends ColumnBaseConfig<'json', 'SQLiteTextJson'>> extends SQLiteColumn<T, {
length: number | undefined;
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: string): T['data'];
mapToDriverValue(value: T['data']): string;
}
export type SQLiteTextConfig<TMode extends 'text' | 'json' = 'text' | 'json', TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined, TLength extends number | undefined = number | undefined> = TMode extends 'text' ? {
mode?: TMode;
length?: TLength;
enum?: TEnum;
} : {
mode?: TMode;
};
export declare function text(): SQLiteTextBuilderInitial<'', [string, ...string[]], undefined>;
export declare function text<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined, TMode extends 'text' | 'json' = 'text' | 'json'>(config?: SQLiteTextConfig<TMode, T | Writable<T>, L>): Equal<TMode, 'json'> extends true ? SQLiteTextJsonBuilderInitial<''> : SQLiteTextBuilderInitial<'', Writable<T>, L>;
export declare function text<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined, TMode extends 'text' | 'json' = 'text' | 'json'>(name: TName, config?: SQLiteTextConfig<TMode, T | Writable<T>, L>): Equal<TMode, 'json'> extends true ? SQLiteTextJsonBuilderInitial<TName> : SQLiteTextBuilderInitial<TName, Writable<T>, L>;

69
node_modules/drizzle-orm/sqlite-core/columns/text.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SQLiteColumn, SQLiteColumnBuilder } from "./common.js";
class SQLiteTextBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteTextBuilder";
constructor(name, config) {
super(name, "string", "SQLiteText");
this.config.enumValues = config.enum;
this.config.length = config.length;
}
/** @internal */
build(table) {
return new SQLiteText(
table,
this.config
);
}
}
class SQLiteText extends SQLiteColumn {
static [entityKind] = "SQLiteText";
enumValues = this.config.enumValues;
length = this.config.length;
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `text${this.config.length ? `(${this.config.length})` : ""}`;
}
}
class SQLiteTextJsonBuilder extends SQLiteColumnBuilder {
static [entityKind] = "SQLiteTextJsonBuilder";
constructor(name) {
super(name, "json", "SQLiteTextJson");
}
/** @internal */
build(table) {
return new SQLiteTextJson(
table,
this.config
);
}
}
class SQLiteTextJson extends SQLiteColumn {
static [entityKind] = "SQLiteTextJson";
getSQLType() {
return "text";
}
mapFromDriverValue(value) {
return JSON.parse(value);
}
mapToDriverValue(value) {
return JSON.stringify(value);
}
}
function text(a, b = {}) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config.mode === "json") {
return new SQLiteTextJsonBuilder(name);
}
return new SQLiteTextBuilder(name, config);
}
export {
SQLiteText,
SQLiteTextBuilder,
SQLiteTextJson,
SQLiteTextJsonBuilder,
text
};
//# sourceMappingURL=text.js.map

File diff suppressed because one or more lines are too long