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/README.md generated vendored Normal file
View File

@ -0,0 +1,44 @@
<div align="center">
<img src="./misc/readme/logo-github-sq-dark.svg#gh-dark-mode-only" />
<img src="./misc/readme/logo-github-sq-light.svg#gh-light-mode-only" />
</div>
<br/>
<div align="center">
<h3>Headless ORM for NodeJS, TypeScript and JavaScript 🚀</h3>
<a href="https://orm.drizzle.team">Website</a>
<a href="https://orm.drizzle.team/docs/overview">Documentation</a>
<a href="https://x.com/drizzleorm">Twitter</a>
<a href="https://driz.link/discord">Discord</a>
</div>
<br/>
<br/>
### What's Drizzle?
Drizzle is a modern TypeScript ORM developers [wanna use in their next project](https://stateofdb.com/tools/drizzle).
It is [lightweight](https://bundlephobia.com/package/drizzle-orm) at only ~7.4kb minified+gzipped, and it's tree shakeable with exactly 0 dependencies.
**Drizzle supports every PostgreSQL, MySQL and SQLite database**, including serverless ones like [Turso](https://orm.drizzle.team/docs/get-started-sqlite#turso), [Neon](https://orm.drizzle.team/docs/get-started-postgresql#neon), [Xata](xata.io), [PlanetScale](https://orm.drizzle.team/docs/get-started-mysql#planetscale), [Cloudflare D1](https://orm.drizzle.team/docs/get-started-sqlite#cloudflare-d1), [FlyIO LiteFS](https://fly.io/docs/litefs/), [Vercel Postgres](https://orm.drizzle.team/docs/get-started-postgresql#vercel-postgres), [Supabase](https://orm.drizzle.team/docs/get-started-postgresql#supabase) and [AWS Data API](https://orm.drizzle.team/docs/get-started-postgresql#aws-data-api). No bells and whistles, no Rust binaries, no serverless adapters, everything just works out of the box.
**Drizzle is serverless-ready by design**. It works in every major JavaScript runtime like NodeJS, Bun, Deno, Cloudflare Workers, Supabase functions, any Edge runtime, and even in browsers.
With Drizzle you can be [**fast out of the box**](https://orm.drizzle.team/benchmarks) and save time and costs while never introducing any data proxies into your infrastructure.
While you can use Drizzle as a JavaScript library, it shines with TypeScript. It lets you [**declare SQL schemas**](https://orm.drizzle.team/docs/sql-schema-declaration) and build both [**relational**](https://orm.drizzle.team/docs/rqb) and [**SQL-like queries**](https://orm.drizzle.team/docs/select), while keeping the balance between type-safety and extensibility for toolmakers to build on top.
### Ecosystem
While Drizzle ORM remains a thin typed layer on top of SQL, we made a set of tools for people to have best possible developer experience.
Drizzle comes with a powerful [**Drizzle Kit**](https://orm.drizzle.team/kit-docs/overview) CLI companion for you to have hassle-free migrations. It can generate SQL migration files for you or apply schema changes directly to the database.
We also have [**Drizzle Studio**](https://orm.drizzle.team/drizzle-studio/overview) for you to effortlessly browse and manipulate data in your database of choice.
### Documentation
Check out the full documentation on [the website](https://orm.drizzle.team/docs/overview).
### Our sponsors ❤️
<p align="center">
<a href="https://drizzle.team" target="_blank">
<img src='https://api.drizzle.team/v2/sponsors/svg'/>
</a>
</p>

144
node_modules/drizzle-orm/alias.cjs generated vendored Normal file
View File

@ -0,0 +1,144 @@
"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 alias_exports = {};
__export(alias_exports, {
ColumnAliasProxyHandler: () => ColumnAliasProxyHandler,
RelationTableAliasProxyHandler: () => RelationTableAliasProxyHandler,
TableAliasProxyHandler: () => TableAliasProxyHandler,
aliasedRelation: () => aliasedRelation,
aliasedTable: () => aliasedTable,
aliasedTableColumn: () => aliasedTableColumn,
mapColumnsInAliasedSQLToAlias: () => mapColumnsInAliasedSQLToAlias,
mapColumnsInSQLToAlias: () => mapColumnsInSQLToAlias
});
module.exports = __toCommonJS(alias_exports);
var import_column = require("./column.cjs");
var import_entity = require("./entity.cjs");
var import_sql = require("./sql/sql.cjs");
var import_table = require("./table.cjs");
var import_view_common = require("./view-common.cjs");
class ColumnAliasProxyHandler {
constructor(table) {
this.table = table;
}
static [import_entity.entityKind] = "ColumnAliasProxyHandler";
get(columnObj, prop) {
if (prop === "table") {
return this.table;
}
return columnObj[prop];
}
}
class TableAliasProxyHandler {
constructor(alias, replaceOriginalName) {
this.alias = alias;
this.replaceOriginalName = replaceOriginalName;
}
static [import_entity.entityKind] = "TableAliasProxyHandler";
get(target, prop) {
if (prop === import_table.Table.Symbol.IsAlias) {
return true;
}
if (prop === import_table.Table.Symbol.Name) {
return this.alias;
}
if (this.replaceOriginalName && prop === import_table.Table.Symbol.OriginalName) {
return this.alias;
}
if (prop === import_view_common.ViewBaseConfig) {
return {
...target[import_view_common.ViewBaseConfig],
name: this.alias,
isAlias: true
};
}
if (prop === import_table.Table.Symbol.Columns) {
const columns = target[import_table.Table.Symbol.Columns];
if (!columns) {
return columns;
}
const proxiedColumns = {};
Object.keys(columns).map((key) => {
proxiedColumns[key] = new Proxy(
columns[key],
new ColumnAliasProxyHandler(new Proxy(target, this))
);
});
return proxiedColumns;
}
const value = target[prop];
if ((0, import_entity.is)(value, import_column.Column)) {
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
}
return value;
}
}
class RelationTableAliasProxyHandler {
constructor(alias) {
this.alias = alias;
}
static [import_entity.entityKind] = "RelationTableAliasProxyHandler";
get(target, prop) {
if (prop === "sourceTable") {
return aliasedTable(target.sourceTable, this.alias);
}
return target[prop];
}
}
function aliasedTable(table, tableAlias) {
return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
}
function aliasedRelation(relation, tableAlias) {
return new Proxy(relation, new RelationTableAliasProxyHandler(tableAlias));
}
function aliasedTableColumn(column, tableAlias) {
return new Proxy(
column,
new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false)))
);
}
function mapColumnsInAliasedSQLToAlias(query, alias) {
return new import_sql.SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
}
function mapColumnsInSQLToAlias(query, alias) {
return import_sql.sql.join(query.queryChunks.map((c) => {
if ((0, import_entity.is)(c, import_column.Column)) {
return aliasedTableColumn(c, alias);
}
if ((0, import_entity.is)(c, import_sql.SQL)) {
return mapColumnsInSQLToAlias(c, alias);
}
if ((0, import_entity.is)(c, import_sql.SQL.Aliased)) {
return mapColumnsInAliasedSQLToAlias(c, alias);
}
return c;
}));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ColumnAliasProxyHandler,
RelationTableAliasProxyHandler,
TableAliasProxyHandler,
aliasedRelation,
aliasedTable,
aliasedTableColumn,
mapColumnsInAliasedSQLToAlias,
mapColumnsInSQLToAlias
});
//# sourceMappingURL=alias.cjs.map

1
node_modules/drizzle-orm/alias.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

31
node_modules/drizzle-orm/alias.d.cts generated vendored Normal file
View File

@ -0,0 +1,31 @@
import type { AnyColumn } from "./column.cjs";
import { Column } from "./column.cjs";
import { entityKind } from "./entity.cjs";
import type { Relation } from "./relations.cjs";
import type { View } from "./sql/sql.cjs";
import { SQL } from "./sql/sql.cjs";
import { Table } from "./table.cjs";
export declare class ColumnAliasProxyHandler<TColumn extends Column> implements ProxyHandler<TColumn> {
private table;
static readonly [entityKind]: string;
constructor(table: Table | View);
get(columnObj: TColumn, prop: string | symbol): any;
}
export declare class TableAliasProxyHandler<T extends Table | View> implements ProxyHandler<T> {
private alias;
private replaceOriginalName;
static readonly [entityKind]: string;
constructor(alias: string, replaceOriginalName: boolean);
get(target: T, prop: string | symbol): any;
}
export declare class RelationTableAliasProxyHandler<T extends Relation> implements ProxyHandler<T> {
private alias;
static readonly [entityKind]: string;
constructor(alias: string);
get(target: T, prop: string | symbol): any;
}
export declare function aliasedTable<T extends Table>(table: T, tableAlias: string): T;
export declare function aliasedRelation<T extends Relation>(relation: T, tableAlias: string): T;
export declare function aliasedTableColumn<T extends AnyColumn>(column: T, tableAlias: string): T;
export declare function mapColumnsInAliasedSQLToAlias(query: SQL.Aliased, alias: string): SQL.Aliased;
export declare function mapColumnsInSQLToAlias(query: SQL, alias: string): SQL;

31
node_modules/drizzle-orm/alias.d.ts generated vendored Normal file
View File

@ -0,0 +1,31 @@
import type { AnyColumn } from "./column.js";
import { Column } from "./column.js";
import { entityKind } from "./entity.js";
import type { Relation } from "./relations.js";
import type { View } from "./sql/sql.js";
import { SQL } from "./sql/sql.js";
import { Table } from "./table.js";
export declare class ColumnAliasProxyHandler<TColumn extends Column> implements ProxyHandler<TColumn> {
private table;
static readonly [entityKind]: string;
constructor(table: Table | View);
get(columnObj: TColumn, prop: string | symbol): any;
}
export declare class TableAliasProxyHandler<T extends Table | View> implements ProxyHandler<T> {
private alias;
private replaceOriginalName;
static readonly [entityKind]: string;
constructor(alias: string, replaceOriginalName: boolean);
get(target: T, prop: string | symbol): any;
}
export declare class RelationTableAliasProxyHandler<T extends Relation> implements ProxyHandler<T> {
private alias;
static readonly [entityKind]: string;
constructor(alias: string);
get(target: T, prop: string | symbol): any;
}
export declare function aliasedTable<T extends Table>(table: T, tableAlias: string): T;
export declare function aliasedRelation<T extends Relation>(relation: T, tableAlias: string): T;
export declare function aliasedTableColumn<T extends AnyColumn>(column: T, tableAlias: string): T;
export declare function mapColumnsInAliasedSQLToAlias(query: SQL.Aliased, alias: string): SQL.Aliased;
export declare function mapColumnsInSQLToAlias(query: SQL, alias: string): SQL;

113
node_modules/drizzle-orm/alias.js generated vendored Normal file
View File

@ -0,0 +1,113 @@
import { Column } from "./column.js";
import { entityKind, is } from "./entity.js";
import { SQL, sql } from "./sql/sql.js";
import { Table } from "./table.js";
import { ViewBaseConfig } from "./view-common.js";
class ColumnAliasProxyHandler {
constructor(table) {
this.table = table;
}
static [entityKind] = "ColumnAliasProxyHandler";
get(columnObj, prop) {
if (prop === "table") {
return this.table;
}
return columnObj[prop];
}
}
class TableAliasProxyHandler {
constructor(alias, replaceOriginalName) {
this.alias = alias;
this.replaceOriginalName = replaceOriginalName;
}
static [entityKind] = "TableAliasProxyHandler";
get(target, prop) {
if (prop === Table.Symbol.IsAlias) {
return true;
}
if (prop === Table.Symbol.Name) {
return this.alias;
}
if (this.replaceOriginalName && prop === Table.Symbol.OriginalName) {
return this.alias;
}
if (prop === ViewBaseConfig) {
return {
...target[ViewBaseConfig],
name: this.alias,
isAlias: true
};
}
if (prop === Table.Symbol.Columns) {
const columns = target[Table.Symbol.Columns];
if (!columns) {
return columns;
}
const proxiedColumns = {};
Object.keys(columns).map((key) => {
proxiedColumns[key] = new Proxy(
columns[key],
new ColumnAliasProxyHandler(new Proxy(target, this))
);
});
return proxiedColumns;
}
const value = target[prop];
if (is(value, Column)) {
return new Proxy(value, new ColumnAliasProxyHandler(new Proxy(target, this)));
}
return value;
}
}
class RelationTableAliasProxyHandler {
constructor(alias) {
this.alias = alias;
}
static [entityKind] = "RelationTableAliasProxyHandler";
get(target, prop) {
if (prop === "sourceTable") {
return aliasedTable(target.sourceTable, this.alias);
}
return target[prop];
}
}
function aliasedTable(table, tableAlias) {
return new Proxy(table, new TableAliasProxyHandler(tableAlias, false));
}
function aliasedRelation(relation, tableAlias) {
return new Proxy(relation, new RelationTableAliasProxyHandler(tableAlias));
}
function aliasedTableColumn(column, tableAlias) {
return new Proxy(
column,
new ColumnAliasProxyHandler(new Proxy(column.table, new TableAliasProxyHandler(tableAlias, false)))
);
}
function mapColumnsInAliasedSQLToAlias(query, alias) {
return new SQL.Aliased(mapColumnsInSQLToAlias(query.sql, alias), query.fieldAlias);
}
function mapColumnsInSQLToAlias(query, alias) {
return sql.join(query.queryChunks.map((c) => {
if (is(c, Column)) {
return aliasedTableColumn(c, alias);
}
if (is(c, SQL)) {
return mapColumnsInSQLToAlias(c, alias);
}
if (is(c, SQL.Aliased)) {
return mapColumnsInAliasedSQLToAlias(c, alias);
}
return c;
}));
}
export {
ColumnAliasProxyHandler,
RelationTableAliasProxyHandler,
TableAliasProxyHandler,
aliasedRelation,
aliasedTable,
aliasedTableColumn,
mapColumnsInAliasedSQLToAlias,
mapColumnsInSQLToAlias
};
//# sourceMappingURL=alias.js.map

1
node_modules/drizzle-orm/alias.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

119
node_modules/drizzle-orm/aws-data-api/common/index.cjs generated vendored Normal file
View File

@ -0,0 +1,119 @@
"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, {
getValueFromDataApi: () => getValueFromDataApi,
toValueParam: () => toValueParam,
typingsToAwsTypeHint: () => typingsToAwsTypeHint
});
module.exports = __toCommonJS(common_exports);
var import_client_rds_data = require("@aws-sdk/client-rds-data");
function getValueFromDataApi(field) {
if (field.stringValue !== void 0) {
return field.stringValue;
} else if (field.booleanValue !== void 0) {
return field.booleanValue;
} else if (field.doubleValue !== void 0) {
return field.doubleValue;
} else if (field.isNull !== void 0) {
return null;
} else if (field.longValue !== void 0) {
return field.longValue;
} else if (field.blobValue !== void 0) {
return field.blobValue;
} else if (field.arrayValue !== void 0) {
if (field.arrayValue.stringValues !== void 0) {
return field.arrayValue.stringValues;
}
if (field.arrayValue.longValues !== void 0) {
return field.arrayValue.longValues;
}
if (field.arrayValue.doubleValues !== void 0) {
return field.arrayValue.doubleValues;
}
if (field.arrayValue.booleanValues !== void 0) {
return field.arrayValue.booleanValues;
}
if (field.arrayValue.arrayValues !== void 0) {
return field.arrayValue.arrayValues;
}
throw new Error("Unknown array type");
} else {
throw new Error("Unknown type");
}
}
function typingsToAwsTypeHint(typings) {
if (typings === "date") {
return import_client_rds_data.TypeHint.DATE;
} else if (typings === "decimal") {
return import_client_rds_data.TypeHint.DECIMAL;
} else if (typings === "json") {
return import_client_rds_data.TypeHint.JSON;
} else if (typings === "time") {
return import_client_rds_data.TypeHint.TIME;
} else if (typings === "timestamp") {
return import_client_rds_data.TypeHint.TIMESTAMP;
} else if (typings === "uuid") {
return import_client_rds_data.TypeHint.UUID;
} else {
return void 0;
}
}
function toValueParam(value, typings) {
const response = {
value: {},
typeHint: typingsToAwsTypeHint(typings)
};
if (value === null) {
response.value = { isNull: true };
} else if (typeof value === "string") {
switch (response.typeHint) {
case import_client_rds_data.TypeHint.DATE: {
response.value = { stringValue: value.split("T")[0] };
break;
}
case import_client_rds_data.TypeHint.TIMESTAMP: {
response.value = { stringValue: value.replace("T", " ").replace("Z", "") };
break;
}
default: {
response.value = { stringValue: value };
break;
}
}
} else if (typeof value === "number" && Number.isInteger(value)) {
response.value = { longValue: value };
} else if (typeof value === "number" && !Number.isInteger(value)) {
response.value = { doubleValue: value };
} else if (typeof value === "boolean") {
response.value = { booleanValue: value };
} else if (value instanceof Date) {
response.value = { stringValue: value.toISOString().replace("T", " ").replace("Z", "") };
} else {
throw new Error(`Unknown type for ${value}`);
}
return response;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getValueFromDataApi,
toValueParam,
typingsToAwsTypeHint
});
//# sourceMappingURL=index.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
import type { Field } from '@aws-sdk/client-rds-data';
import { TypeHint } from '@aws-sdk/client-rds-data';
import type { QueryTypingsValue } from "../../sql/sql.cjs";
export declare function getValueFromDataApi(field: Field): string | number | boolean | string[] | number[] | Uint8Array | boolean[] | import("@aws-sdk/client-rds-data").ArrayValue[] | null;
export declare function typingsToAwsTypeHint(typings?: QueryTypingsValue): TypeHint | undefined;
export declare function toValueParam(value: any, typings?: QueryTypingsValue): {
value: Field;
typeHint?: TypeHint;
};

View File

@ -0,0 +1,9 @@
import type { Field } from '@aws-sdk/client-rds-data';
import { TypeHint } from '@aws-sdk/client-rds-data';
import type { QueryTypingsValue } from "../../sql/sql.js";
export declare function getValueFromDataApi(field: Field): string | number | boolean | string[] | number[] | Uint8Array | boolean[] | import("@aws-sdk/client-rds-data").ArrayValue[] | null;
export declare function typingsToAwsTypeHint(typings?: QueryTypingsValue): TypeHint | undefined;
export declare function toValueParam(value: any, typings?: QueryTypingsValue): {
value: Field;
typeHint?: TypeHint;
};

93
node_modules/drizzle-orm/aws-data-api/common/index.js generated vendored Normal file
View File

@ -0,0 +1,93 @@
import { TypeHint } from "@aws-sdk/client-rds-data";
function getValueFromDataApi(field) {
if (field.stringValue !== void 0) {
return field.stringValue;
} else if (field.booleanValue !== void 0) {
return field.booleanValue;
} else if (field.doubleValue !== void 0) {
return field.doubleValue;
} else if (field.isNull !== void 0) {
return null;
} else if (field.longValue !== void 0) {
return field.longValue;
} else if (field.blobValue !== void 0) {
return field.blobValue;
} else if (field.arrayValue !== void 0) {
if (field.arrayValue.stringValues !== void 0) {
return field.arrayValue.stringValues;
}
if (field.arrayValue.longValues !== void 0) {
return field.arrayValue.longValues;
}
if (field.arrayValue.doubleValues !== void 0) {
return field.arrayValue.doubleValues;
}
if (field.arrayValue.booleanValues !== void 0) {
return field.arrayValue.booleanValues;
}
if (field.arrayValue.arrayValues !== void 0) {
return field.arrayValue.arrayValues;
}
throw new Error("Unknown array type");
} else {
throw new Error("Unknown type");
}
}
function typingsToAwsTypeHint(typings) {
if (typings === "date") {
return TypeHint.DATE;
} else if (typings === "decimal") {
return TypeHint.DECIMAL;
} else if (typings === "json") {
return TypeHint.JSON;
} else if (typings === "time") {
return TypeHint.TIME;
} else if (typings === "timestamp") {
return TypeHint.TIMESTAMP;
} else if (typings === "uuid") {
return TypeHint.UUID;
} else {
return void 0;
}
}
function toValueParam(value, typings) {
const response = {
value: {},
typeHint: typingsToAwsTypeHint(typings)
};
if (value === null) {
response.value = { isNull: true };
} else if (typeof value === "string") {
switch (response.typeHint) {
case TypeHint.DATE: {
response.value = { stringValue: value.split("T")[0] };
break;
}
case TypeHint.TIMESTAMP: {
response.value = { stringValue: value.replace("T", " ").replace("Z", "") };
break;
}
default: {
response.value = { stringValue: value };
break;
}
}
} else if (typeof value === "number" && Number.isInteger(value)) {
response.value = { longValue: value };
} else if (typeof value === "number" && !Number.isInteger(value)) {
response.value = { doubleValue: value };
} else if (typeof value === "boolean") {
response.value = { booleanValue: value };
} else if (value instanceof Date) {
response.value = { stringValue: value.toISOString().replace("T", " ").replace("Z", "") };
} else {
throw new Error(`Unknown type for ${value}`);
}
return response;
}
export {
getValueFromDataApi,
toValueParam,
typingsToAwsTypeHint
};
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

122
node_modules/drizzle-orm/aws-data-api/pg/driver.cjs generated vendored Normal file
View File

@ -0,0 +1,122 @@
"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 driver_exports = {};
__export(driver_exports, {
AwsDataApiPgDatabase: () => AwsDataApiPgDatabase,
AwsPgDialect: () => AwsPgDialect,
drizzle: () => drizzle
});
module.exports = __toCommonJS(driver_exports);
var import_client_rds_data = require("@aws-sdk/client-rds-data");
var import_entity = require("../../entity.cjs");
var import_logger = require("../../logger.cjs");
var import_db = require("../../pg-core/db.cjs");
var import_dialect = require("../../pg-core/dialect.cjs");
var import_pg_core = require("../../pg-core/index.cjs");
var import_relations = require("../../relations.cjs");
var import_sql = require("../../sql/sql.cjs");
var import_table = require("../../table.cjs");
var import_session = require("./session.cjs");
class AwsDataApiPgDatabase extends import_db.PgDatabase {
static [import_entity.entityKind] = "AwsDataApiPgDatabase";
execute(query) {
return super.execute(query);
}
}
class AwsPgDialect extends import_dialect.PgDialect {
static [import_entity.entityKind] = "AwsPgDialect";
escapeParam(num) {
return `:${num + 1}`;
}
buildInsertQuery({ table, values, onConflict, returning, select, withList }) {
const columns = table[import_table.Table.Symbol.Columns];
if (!select) {
for (const value of values) {
for (const fieldName of Object.keys(columns)) {
const colValue = value[fieldName];
if ((0, import_entity.is)(colValue, import_sql.Param) && colValue.value !== void 0 && (0, import_entity.is)(colValue.encoder, import_pg_core.PgArray) && Array.isArray(colValue.value)) {
value[fieldName] = import_sql.sql`cast(${colValue} as ${import_sql.sql.raw(colValue.encoder.getSQLType())})`;
}
}
}
}
return super.buildInsertQuery({ table, values, onConflict, returning, withList });
}
buildUpdateSet(table, set) {
const columns = table[import_table.Table.Symbol.Columns];
for (const [colName, colValue] of Object.entries(set)) {
const currentColumn = columns[colName];
if (currentColumn && (0, import_entity.is)(colValue, import_sql.Param) && colValue.value !== void 0 && (0, import_entity.is)(colValue.encoder, import_pg_core.PgArray) && Array.isArray(colValue.value)) {
set[colName] = import_sql.sql`cast(${colValue} as ${import_sql.sql.raw(colValue.encoder.getSQLType())})`;
}
}
return super.buildUpdateSet(table, set);
}
}
function construct(client, config) {
const dialect = new AwsPgDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new import_logger.DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(
config.schema,
import_relations.createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new import_session.AwsDataApiSession(client, dialect, schema, { ...config, logger }, void 0);
const db = new AwsDataApiPgDatabase(dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] instanceof import_client_rds_data.RDSDataClient) {
return construct(params[0], params[1]);
}
if (params[0].client) {
const { client, ...drizzleConfig2 } = params[0];
return construct(client, drizzleConfig2);
}
const { connection, ...drizzleConfig } = params[0];
const { resourceArn, database, secretArn, ...rdsConfig } = connection;
const instance = new import_client_rds_data.RDSDataClient(rdsConfig);
return construct(instance, { resourceArn, database, secretArn, ...drizzleConfig });
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AwsDataApiPgDatabase,
AwsPgDialect,
drizzle
});
//# sourceMappingURL=driver.cjs.map

File diff suppressed because one or more lines are too long

48
node_modules/drizzle-orm/aws-data-api/pg/driver.d.cts generated vendored Normal file
View File

@ -0,0 +1,48 @@
import { RDSDataClient, type RDSDataClientConfig } from '@aws-sdk/client-rds-data';
import { entityKind } from "../../entity.cjs";
import type { Logger } from "../../logger.cjs";
import { PgDatabase } from "../../pg-core/db.cjs";
import { PgDialect } from "../../pg-core/dialect.cjs";
import type { PgInsertConfig, PgTable, TableConfig } from "../../pg-core/index.cjs";
import type { PgRaw } from "../../pg-core/query-builders/raw.cjs";
import { type SQL, type SQLWrapper } from "../../sql/sql.cjs";
import type { DrizzleConfig, UpdateSet } from "../../utils.cjs";
import type { AwsDataApiClient, AwsDataApiPgQueryResult, AwsDataApiPgQueryResultHKT } from "./session.cjs";
export interface PgDriverOptions {
logger?: Logger;
database: string;
resourceArn: string;
secretArn: string;
}
export interface DrizzleAwsDataApiPgConfig<TSchema extends Record<string, unknown> = Record<string, never>> extends DrizzleConfig<TSchema> {
database: string;
resourceArn: string;
secretArn: string;
}
export declare class AwsDataApiPgDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<AwsDataApiPgQueryResultHKT, TSchema> {
static readonly [entityKind]: string;
execute<TRow extends Record<string, unknown> = Record<string, unknown>>(query: SQLWrapper | string): PgRaw<AwsDataApiPgQueryResult<TRow>>;
}
export declare class AwsPgDialect extends PgDialect {
static readonly [entityKind]: string;
escapeParam(num: number): string;
buildInsertQuery({ table, values, onConflict, returning, select, withList }: PgInsertConfig<PgTable<TableConfig>>): SQL<unknown>;
buildUpdateSet(table: PgTable<TableConfig>, set: UpdateSet): SQL<unknown>;
}
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends AwsDataApiClient = RDSDataClient>(...params: [
TClient,
DrizzleAwsDataApiPgConfig<TSchema>
] | [
((DrizzleConfig<TSchema> & {
connection: RDSDataClientConfig & Omit<DrizzleAwsDataApiPgConfig, keyof DrizzleConfig>;
}) | (DrizzleAwsDataApiPgConfig<TSchema> & {
client: TClient;
}))
]): AwsDataApiPgDatabase<TSchema> & {
$client: TClient;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config: DrizzleAwsDataApiPgConfig<TSchema>): AwsDataApiPgDatabase<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}

48
node_modules/drizzle-orm/aws-data-api/pg/driver.d.ts generated vendored Normal file
View File

@ -0,0 +1,48 @@
import { RDSDataClient, type RDSDataClientConfig } from '@aws-sdk/client-rds-data';
import { entityKind } from "../../entity.js";
import type { Logger } from "../../logger.js";
import { PgDatabase } from "../../pg-core/db.js";
import { PgDialect } from "../../pg-core/dialect.js";
import type { PgInsertConfig, PgTable, TableConfig } from "../../pg-core/index.js";
import type { PgRaw } from "../../pg-core/query-builders/raw.js";
import { type SQL, type SQLWrapper } from "../../sql/sql.js";
import type { DrizzleConfig, UpdateSet } from "../../utils.js";
import type { AwsDataApiClient, AwsDataApiPgQueryResult, AwsDataApiPgQueryResultHKT } from "./session.js";
export interface PgDriverOptions {
logger?: Logger;
database: string;
resourceArn: string;
secretArn: string;
}
export interface DrizzleAwsDataApiPgConfig<TSchema extends Record<string, unknown> = Record<string, never>> extends DrizzleConfig<TSchema> {
database: string;
resourceArn: string;
secretArn: string;
}
export declare class AwsDataApiPgDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<AwsDataApiPgQueryResultHKT, TSchema> {
static readonly [entityKind]: string;
execute<TRow extends Record<string, unknown> = Record<string, unknown>>(query: SQLWrapper | string): PgRaw<AwsDataApiPgQueryResult<TRow>>;
}
export declare class AwsPgDialect extends PgDialect {
static readonly [entityKind]: string;
escapeParam(num: number): string;
buildInsertQuery({ table, values, onConflict, returning, select, withList }: PgInsertConfig<PgTable<TableConfig>>): SQL<unknown>;
buildUpdateSet(table: PgTable<TableConfig>, set: UpdateSet): SQL<unknown>;
}
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends AwsDataApiClient = RDSDataClient>(...params: [
TClient,
DrizzleAwsDataApiPgConfig<TSchema>
] | [
((DrizzleConfig<TSchema> & {
connection: RDSDataClientConfig & Omit<DrizzleAwsDataApiPgConfig, keyof DrizzleConfig>;
}) | (DrizzleAwsDataApiPgConfig<TSchema> & {
client: TClient;
}))
]): AwsDataApiPgDatabase<TSchema> & {
$client: TClient;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config: DrizzleAwsDataApiPgConfig<TSchema>): AwsDataApiPgDatabase<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}

99
node_modules/drizzle-orm/aws-data-api/pg/driver.js generated vendored Normal file
View File

@ -0,0 +1,99 @@
import { RDSDataClient } from "@aws-sdk/client-rds-data";
import { entityKind, is } from "../../entity.js";
import { DefaultLogger } from "../../logger.js";
import { PgDatabase } from "../../pg-core/db.js";
import { PgDialect } from "../../pg-core/dialect.js";
import { PgArray } from "../../pg-core/index.js";
import {
createTableRelationsHelpers,
extractTablesRelationalConfig
} from "../../relations.js";
import { Param, sql } from "../../sql/sql.js";
import { Table } from "../../table.js";
import { AwsDataApiSession } from "./session.js";
class AwsDataApiPgDatabase extends PgDatabase {
static [entityKind] = "AwsDataApiPgDatabase";
execute(query) {
return super.execute(query);
}
}
class AwsPgDialect extends PgDialect {
static [entityKind] = "AwsPgDialect";
escapeParam(num) {
return `:${num + 1}`;
}
buildInsertQuery({ table, values, onConflict, returning, select, withList }) {
const columns = table[Table.Symbol.Columns];
if (!select) {
for (const value of values) {
for (const fieldName of Object.keys(columns)) {
const colValue = value[fieldName];
if (is(colValue, Param) && colValue.value !== void 0 && is(colValue.encoder, PgArray) && Array.isArray(colValue.value)) {
value[fieldName] = sql`cast(${colValue} as ${sql.raw(colValue.encoder.getSQLType())})`;
}
}
}
}
return super.buildInsertQuery({ table, values, onConflict, returning, withList });
}
buildUpdateSet(table, set) {
const columns = table[Table.Symbol.Columns];
for (const [colName, colValue] of Object.entries(set)) {
const currentColumn = columns[colName];
if (currentColumn && is(colValue, Param) && colValue.value !== void 0 && is(colValue.encoder, PgArray) && Array.isArray(colValue.value)) {
set[colName] = sql`cast(${colValue} as ${sql.raw(colValue.encoder.getSQLType())})`;
}
}
return super.buildUpdateSet(table, set);
}
}
function construct(client, config) {
const dialect = new AwsPgDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = extractTablesRelationalConfig(
config.schema,
createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new AwsDataApiSession(client, dialect, schema, { ...config, logger }, void 0);
const db = new AwsDataApiPgDatabase(dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] instanceof RDSDataClient) {
return construct(params[0], params[1]);
}
if (params[0].client) {
const { client, ...drizzleConfig2 } = params[0];
return construct(client, drizzleConfig2);
}
const { connection, ...drizzleConfig } = params[0];
const { resourceArn, database, secretArn, ...rdsConfig } = connection;
const instance = new RDSDataClient(rdsConfig);
return construct(instance, { resourceArn, database, secretArn, ...drizzleConfig });
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
export {
AwsDataApiPgDatabase,
AwsPgDialect,
drizzle
};
//# sourceMappingURL=driver.js.map

File diff suppressed because one or more lines are too long

25
node_modules/drizzle-orm/aws-data-api/pg/index.cjs generated vendored Normal file
View File

@ -0,0 +1,25 @@
"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 pg_exports = {};
module.exports = __toCommonJS(pg_exports);
__reExport(pg_exports, require("./driver.cjs"), module.exports);
__reExport(pg_exports, require("./session.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./driver.cjs"),
...require("./session.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/aws-data-api/pg/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAc,wBAAd;AACA,uBAAc,yBADd;","names":[]}

2
node_modules/drizzle-orm/aws-data-api/pg/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.cjs";
export * from "./session.cjs";

2
node_modules/drizzle-orm/aws-data-api/pg/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.js";
export * from "./session.js";

3
node_modules/drizzle-orm/aws-data-api/pg/index.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "./driver.js";
export * from "./session.js";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/aws-data-api/pg/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}

33
node_modules/drizzle-orm/aws-data-api/pg/migrator.cjs generated vendored Normal file
View File

@ -0,0 +1,33 @@
"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 migrator_exports = {};
__export(migrator_exports, {
migrate: () => migrate
});
module.exports = __toCommonJS(migrator_exports);
var import_migrator = require("../../migrator.cjs");
async function migrate(db, config) {
const migrations = (0, import_migrator.readMigrationFiles)(config);
await db.dialect.migrate(migrations, db.session, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
migrate
});
//# sourceMappingURL=migrator.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/aws-data-api/pg/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { AwsDataApiPgDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: AwsDataApiPgDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAGnC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAC5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}

View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../../migrator.cjs";
import type { AwsDataApiPgDatabase } from "./driver.cjs";
export declare function migrate<TSchema extends Record<string, unknown>>(db: AwsDataApiPgDatabase<TSchema>, config: MigrationConfig): Promise<void>;

View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../../migrator.js";
import type { AwsDataApiPgDatabase } from "./driver.js";
export declare function migrate<TSchema extends Record<string, unknown>>(db: AwsDataApiPgDatabase<TSchema>, config: MigrationConfig): Promise<void>;

9
node_modules/drizzle-orm/aws-data-api/pg/migrator.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
import { readMigrationFiles } from "../../migrator.js";
async function migrate(db, config) {
const migrations = readMigrationFiles(config);
await db.dialect.migrate(migrations, db.session, config);
}
export {
migrate
};
//# sourceMappingURL=migrator.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/aws-data-api/pg/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { AwsDataApiPgDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: AwsDataApiPgDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tawait db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAGnC,eAAsB,QACrB,IACA,QACC;AACD,QAAM,aAAa,mBAAmB,MAAM;AAC5C,QAAM,GAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AACxD;","names":[]}

207
node_modules/drizzle-orm/aws-data-api/pg/session.cjs generated vendored Normal file
View File

@ -0,0 +1,207 @@
"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 session_exports = {};
__export(session_exports, {
AwsDataApiPreparedQuery: () => AwsDataApiPreparedQuery,
AwsDataApiSession: () => AwsDataApiSession,
AwsDataApiTransaction: () => AwsDataApiTransaction
});
module.exports = __toCommonJS(session_exports);
var import_client_rds_data = require("@aws-sdk/client-rds-data");
var import_entity = require("../../entity.cjs");
var import_pg_core = require("../../pg-core/index.cjs");
var import_sql = require("../../sql/sql.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("../common/index.cjs");
class AwsDataApiPreparedQuery extends import_pg_core.PgPreparedQuery {
constructor(client, queryString, params, typings, options, fields, transactionId, _isResponseInArrayMode, customResultMapper) {
super({ sql: queryString, params });
this.client = client;
this.params = params;
this.typings = typings;
this.options = options;
this.fields = fields;
this.transactionId = transactionId;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
this.rawQuery = new import_client_rds_data.ExecuteStatementCommand({
sql: queryString,
parameters: [],
secretArn: options.secretArn,
resourceArn: options.resourceArn,
database: options.database,
transactionId,
includeResultMetadata: !fields && !customResultMapper
});
}
static [import_entity.entityKind] = "AwsDataApiPreparedQuery";
rawQuery;
async execute(placeholderValues = {}) {
const { fields, joinsNotNullableMap, customResultMapper } = this;
const result = await this.values(placeholderValues);
if (!fields && !customResultMapper) {
const { columnMetadata, rows } = result;
if (!columnMetadata) {
return result;
}
const mappedRows = rows.map((sourceRow) => {
const row = {};
for (const [index, value] of sourceRow.entries()) {
const metadata = columnMetadata[index];
if (!metadata) {
throw new Error(
`Unexpected state: no column metadata found for index ${index}. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`
);
}
if (!metadata.name) {
throw new Error(
`Unexpected state: no column name for index ${index} found in the column metadata. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`
);
}
row[metadata.name] = value;
}
return row;
});
return Object.assign(result, { rows: mappedRows });
}
return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
}
async all(placeholderValues) {
const result = await this.execute(placeholderValues);
if (!this.fields && !this.customResultMapper) {
return result.rows;
}
return result;
}
async values(placeholderValues = {}) {
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues ?? {});
this.rawQuery.input.parameters = params.map((param, index) => ({
name: `${index + 1}`,
...(0, import_common.toValueParam)(param, this.typings[index])
}));
this.options.logger?.logQuery(this.rawQuery.input.sql, this.rawQuery.input.parameters);
const result = await this.client.send(this.rawQuery);
const rows = result.records?.map((row) => {
return row.map((field) => (0, import_common.getValueFromDataApi)(field));
}) ?? [];
return {
...result,
rows
};
}
/** @internal */
mapResultRows(records, columnMetadata) {
return records.map((record) => {
const row = {};
for (const [index, field] of record.entries()) {
const { name } = columnMetadata[index];
row[name ?? index] = (0, import_common.getValueFromDataApi)(field);
}
return row;
});
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
class AwsDataApiSession extends import_pg_core.PgSession {
constructor(client, dialect, schema, options, transactionId) {
super(dialect);
this.client = client;
this.schema = schema;
this.options = options;
this.transactionId = transactionId;
this.rawQuery = {
secretArn: options.secretArn,
resourceArn: options.resourceArn,
database: options.database
};
}
static [import_entity.entityKind] = "AwsDataApiSession";
/** @internal */
rawQuery;
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper, transactionId) {
return new AwsDataApiPreparedQuery(
this.client,
query.sql,
query.params,
query.typings ?? [],
this.options,
fields,
transactionId ?? this.transactionId,
isResponseInArrayMode,
customResultMapper
);
}
execute(query) {
return this.prepareQuery(
this.dialect.sqlToQuery(query),
void 0,
void 0,
false,
void 0,
this.transactionId
).execute();
}
async transaction(transaction, config) {
const { transactionId } = await this.client.send(new import_client_rds_data.BeginTransactionCommand(this.rawQuery));
const session = new AwsDataApiSession(this.client, this.dialect, this.schema, this.options, transactionId);
const tx = new AwsDataApiTransaction(this.dialect, session, this.schema);
if (config) {
await tx.setTransaction(config);
}
try {
const result = await transaction(tx);
await this.client.send(new import_client_rds_data.CommitTransactionCommand({ ...this.rawQuery, transactionId }));
return result;
} catch (e) {
await this.client.send(new import_client_rds_data.RollbackTransactionCommand({ ...this.rawQuery, transactionId }));
throw e;
}
}
}
class AwsDataApiTransaction extends import_pg_core.PgTransaction {
static [import_entity.entityKind] = "AwsDataApiTransaction";
async transaction(transaction) {
const savepointName = `sp${this.nestedIndex + 1}`;
const tx = new AwsDataApiTransaction(
this.dialect,
this.session,
this.schema,
this.nestedIndex + 1
);
await this.session.execute(import_sql.sql.raw(`savepoint ${savepointName}`));
try {
const result = await transaction(tx);
await this.session.execute(import_sql.sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (e) {
await this.session.execute(import_sql.sql.raw(`rollback to savepoint ${savepointName}`));
throw e;
}
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
AwsDataApiPreparedQuery,
AwsDataApiSession,
AwsDataApiTransaction
});
//# sourceMappingURL=session.cjs.map

File diff suppressed because one or more lines are too long

60
node_modules/drizzle-orm/aws-data-api/pg/session.d.cts generated vendored Normal file
View File

@ -0,0 +1,60 @@
import type { ExecuteStatementCommandOutput, RDSDataClient } from '@aws-sdk/client-rds-data';
import { entityKind } from "../../entity.cjs";
import type { Logger } from "../../logger.cjs";
import { type PgDialect, PgPreparedQuery, type PgQueryResultHKT, PgSession, PgTransaction, type PgTransactionConfig, type PreparedQueryConfig } from "../../pg-core/index.cjs";
import type { SelectedFieldsOrdered } from "../../pg-core/query-builders/select.types.cjs";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../../relations.cjs";
import { type QueryTypingsValue, type QueryWithTypings, type SQL } from "../../sql/sql.cjs";
export type AwsDataApiClient = RDSDataClient;
export declare class AwsDataApiPreparedQuery<T extends PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
}> extends PgPreparedQuery<T> {
private client;
private params;
private typings;
private options;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
private rawQuery;
constructor(client: AwsDataApiClient, queryString: string, params: unknown[], typings: QueryTypingsValue[], options: AwsDataApiSessionOptions, fields: SelectedFieldsOrdered | undefined,
/** @internal */
transactionId: string | undefined, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined);
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
values(placeholderValues?: Record<string, unknown>): Promise<T['values']>;
}
export interface AwsDataApiSessionOptions {
logger?: Logger;
database: string;
resourceArn: string;
secretArn: string;
}
export declare class AwsDataApiSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
private schema;
private options;
static readonly [entityKind]: string;
constructor(
/** @internal */
client: AwsDataApiClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: AwsDataApiSessionOptions,
/** @internal */
transactionId: string | undefined);
prepareQuery<T extends PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
} = PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
}>(query: QueryWithTypings, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute'], transactionId?: string): AwsDataApiPreparedQuery<T>;
execute<T>(query: SQL): Promise<T>;
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
}
export declare class AwsDataApiTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
}
export type AwsDataApiPgQueryResult<T> = ExecuteStatementCommandOutput & {
rows: T[];
};
export interface AwsDataApiPgQueryResultHKT extends PgQueryResultHKT {
type: AwsDataApiPgQueryResult<any>;
}

60
node_modules/drizzle-orm/aws-data-api/pg/session.d.ts generated vendored Normal file
View File

@ -0,0 +1,60 @@
import type { ExecuteStatementCommandOutput, RDSDataClient } from '@aws-sdk/client-rds-data';
import { entityKind } from "../../entity.js";
import type { Logger } from "../../logger.js";
import { type PgDialect, PgPreparedQuery, type PgQueryResultHKT, PgSession, PgTransaction, type PgTransactionConfig, type PreparedQueryConfig } from "../../pg-core/index.js";
import type { SelectedFieldsOrdered } from "../../pg-core/query-builders/select.types.js";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../../relations.js";
import { type QueryTypingsValue, type QueryWithTypings, type SQL } from "../../sql/sql.js";
export type AwsDataApiClient = RDSDataClient;
export declare class AwsDataApiPreparedQuery<T extends PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
}> extends PgPreparedQuery<T> {
private client;
private params;
private typings;
private options;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
private rawQuery;
constructor(client: AwsDataApiClient, queryString: string, params: unknown[], typings: QueryTypingsValue[], options: AwsDataApiSessionOptions, fields: SelectedFieldsOrdered | undefined,
/** @internal */
transactionId: string | undefined, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined);
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
values(placeholderValues?: Record<string, unknown>): Promise<T['values']>;
}
export interface AwsDataApiSessionOptions {
logger?: Logger;
database: string;
resourceArn: string;
secretArn: string;
}
export declare class AwsDataApiSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
private schema;
private options;
static readonly [entityKind]: string;
constructor(
/** @internal */
client: AwsDataApiClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: AwsDataApiSessionOptions,
/** @internal */
transactionId: string | undefined);
prepareQuery<T extends PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
} = PreparedQueryConfig & {
values: AwsDataApiPgQueryResult<unknown[]>;
}>(query: QueryWithTypings, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute'], transactionId?: string): AwsDataApiPreparedQuery<T>;
execute<T>(query: SQL): Promise<T>;
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
}
export declare class AwsDataApiTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
}
export type AwsDataApiPgQueryResult<T> = ExecuteStatementCommandOutput & {
rows: T[];
};
export interface AwsDataApiPgQueryResultHKT extends PgQueryResultHKT {
type: AwsDataApiPgQueryResult<any>;
}

190
node_modules/drizzle-orm/aws-data-api/pg/session.js generated vendored Normal file
View File

@ -0,0 +1,190 @@
import {
BeginTransactionCommand,
CommitTransactionCommand,
ExecuteStatementCommand,
RollbackTransactionCommand
} from "@aws-sdk/client-rds-data";
import { entityKind } from "../../entity.js";
import {
PgPreparedQuery,
PgSession,
PgTransaction
} from "../../pg-core/index.js";
import { fillPlaceholders, sql } from "../../sql/sql.js";
import { mapResultRow } from "../../utils.js";
import { getValueFromDataApi, toValueParam } from "../common/index.js";
class AwsDataApiPreparedQuery extends PgPreparedQuery {
constructor(client, queryString, params, typings, options, fields, transactionId, _isResponseInArrayMode, customResultMapper) {
super({ sql: queryString, params });
this.client = client;
this.params = params;
this.typings = typings;
this.options = options;
this.fields = fields;
this.transactionId = transactionId;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
this.rawQuery = new ExecuteStatementCommand({
sql: queryString,
parameters: [],
secretArn: options.secretArn,
resourceArn: options.resourceArn,
database: options.database,
transactionId,
includeResultMetadata: !fields && !customResultMapper
});
}
static [entityKind] = "AwsDataApiPreparedQuery";
rawQuery;
async execute(placeholderValues = {}) {
const { fields, joinsNotNullableMap, customResultMapper } = this;
const result = await this.values(placeholderValues);
if (!fields && !customResultMapper) {
const { columnMetadata, rows } = result;
if (!columnMetadata) {
return result;
}
const mappedRows = rows.map((sourceRow) => {
const row = {};
for (const [index, value] of sourceRow.entries()) {
const metadata = columnMetadata[index];
if (!metadata) {
throw new Error(
`Unexpected state: no column metadata found for index ${index}. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`
);
}
if (!metadata.name) {
throw new Error(
`Unexpected state: no column name for index ${index} found in the column metadata. Please report this issue on GitHub: https://github.com/drizzle-team/drizzle-orm/issues/new/choose`
);
}
row[metadata.name] = value;
}
return row;
});
return Object.assign(result, { rows: mappedRows });
}
return customResultMapper ? customResultMapper(result.rows) : result.rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
}
async all(placeholderValues) {
const result = await this.execute(placeholderValues);
if (!this.fields && !this.customResultMapper) {
return result.rows;
}
return result;
}
async values(placeholderValues = {}) {
const params = fillPlaceholders(this.params, placeholderValues ?? {});
this.rawQuery.input.parameters = params.map((param, index) => ({
name: `${index + 1}`,
...toValueParam(param, this.typings[index])
}));
this.options.logger?.logQuery(this.rawQuery.input.sql, this.rawQuery.input.parameters);
const result = await this.client.send(this.rawQuery);
const rows = result.records?.map((row) => {
return row.map((field) => getValueFromDataApi(field));
}) ?? [];
return {
...result,
rows
};
}
/** @internal */
mapResultRows(records, columnMetadata) {
return records.map((record) => {
const row = {};
for (const [index, field] of record.entries()) {
const { name } = columnMetadata[index];
row[name ?? index] = getValueFromDataApi(field);
}
return row;
});
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
class AwsDataApiSession extends PgSession {
constructor(client, dialect, schema, options, transactionId) {
super(dialect);
this.client = client;
this.schema = schema;
this.options = options;
this.transactionId = transactionId;
this.rawQuery = {
secretArn: options.secretArn,
resourceArn: options.resourceArn,
database: options.database
};
}
static [entityKind] = "AwsDataApiSession";
/** @internal */
rawQuery;
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper, transactionId) {
return new AwsDataApiPreparedQuery(
this.client,
query.sql,
query.params,
query.typings ?? [],
this.options,
fields,
transactionId ?? this.transactionId,
isResponseInArrayMode,
customResultMapper
);
}
execute(query) {
return this.prepareQuery(
this.dialect.sqlToQuery(query),
void 0,
void 0,
false,
void 0,
this.transactionId
).execute();
}
async transaction(transaction, config) {
const { transactionId } = await this.client.send(new BeginTransactionCommand(this.rawQuery));
const session = new AwsDataApiSession(this.client, this.dialect, this.schema, this.options, transactionId);
const tx = new AwsDataApiTransaction(this.dialect, session, this.schema);
if (config) {
await tx.setTransaction(config);
}
try {
const result = await transaction(tx);
await this.client.send(new CommitTransactionCommand({ ...this.rawQuery, transactionId }));
return result;
} catch (e) {
await this.client.send(new RollbackTransactionCommand({ ...this.rawQuery, transactionId }));
throw e;
}
}
}
class AwsDataApiTransaction extends PgTransaction {
static [entityKind] = "AwsDataApiTransaction";
async transaction(transaction) {
const savepointName = `sp${this.nestedIndex + 1}`;
const tx = new AwsDataApiTransaction(
this.dialect,
this.session,
this.schema,
this.nestedIndex + 1
);
await this.session.execute(sql.raw(`savepoint ${savepointName}`));
try {
const result = await transaction(tx);
await this.session.execute(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (e) {
await this.session.execute(sql.raw(`rollback to savepoint ${savepointName}`));
throw e;
}
}
}
export {
AwsDataApiPreparedQuery,
AwsDataApiSession,
AwsDataApiTransaction
};
//# sourceMappingURL=session.js.map

File diff suppressed because one or more lines are too long

17
node_modules/drizzle-orm/batch.cjs generated vendored Normal file
View File

@ -0,0 +1,17 @@
"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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var batch_exports = {};
module.exports = __toCommonJS(batch_exports);
//# sourceMappingURL=batch.cjs.map

1
node_modules/drizzle-orm/batch.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/batch.ts"],"sourcesContent":["import type { Dialect } from './column-builder.ts';\nimport type { RunnableQuery } from './runnable-query.ts';\n\nexport type BatchItem<TDialect extends Dialect = Dialect> = RunnableQuery<any, TDialect>;\n\nexport type BatchResponse<T extends BatchItem[] | readonly BatchItem[]> = {\n\t[K in keyof T]: T[K]['_']['result'];\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}

6
node_modules/drizzle-orm/batch.d.cts generated vendored Normal file
View File

@ -0,0 +1,6 @@
import type { Dialect } from "./column-builder.cjs";
import type { RunnableQuery } from "./runnable-query.cjs";
export type BatchItem<TDialect extends Dialect = Dialect> = RunnableQuery<any, TDialect>;
export type BatchResponse<T extends BatchItem[] | readonly BatchItem[]> = {
[K in keyof T]: T[K]['_']['result'];
};

6
node_modules/drizzle-orm/batch.d.ts generated vendored Normal file
View File

@ -0,0 +1,6 @@
import type { Dialect } from "./column-builder.js";
import type { RunnableQuery } from "./runnable-query.js";
export type BatchItem<TDialect extends Dialect = Dialect> = RunnableQuery<any, TDialect>;
export type BatchResponse<T extends BatchItem[] | readonly BatchItem[]> = {
[K in keyof T]: T[K]['_']['result'];
};

1
node_modules/drizzle-orm/batch.js generated vendored Normal file
View File

@ -0,0 +1 @@
//# sourceMappingURL=batch.js.map

1
node_modules/drizzle-orm/batch.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}

101
node_modules/drizzle-orm/better-sqlite3/driver.cjs generated vendored Normal file
View File

@ -0,0 +1,101 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var driver_exports = {};
__export(driver_exports, {
BetterSQLite3Database: () => BetterSQLite3Database,
drizzle: () => drizzle
});
module.exports = __toCommonJS(driver_exports);
var import_better_sqlite3 = __toESM(require("better-sqlite3"), 1);
var import_entity = require("../entity.cjs");
var import_logger = require("../logger.cjs");
var import_relations = require("../relations.cjs");
var import_db = require("../sqlite-core/db.cjs");
var import_dialect = require("../sqlite-core/dialect.cjs");
var import_utils = require("../utils.cjs");
var import_session = require("./session.cjs");
class BetterSQLite3Database extends import_db.BaseSQLiteDatabase {
static [import_entity.entityKind] = "BetterSQLite3Database";
}
function construct(client, config = {}) {
const dialect = new import_dialect.SQLiteSyncDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new import_logger.DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(
config.schema,
import_relations.createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new import_session.BetterSQLiteSession(client, dialect, schema, { logger });
const db = new BetterSQLite3Database("sync", dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] === void 0 || typeof params[0] === "string") {
const instance = params[0] === void 0 ? new import_better_sqlite3.default() : new import_better_sqlite3.default(params[0]);
return construct(instance, params[1]);
}
if ((0, import_utils.isConfig)(params[0])) {
const { connection, client, ...drizzleConfig } = params[0];
if (client)
return construct(client, drizzleConfig);
if (typeof connection === "object") {
const { source, ...options } = connection;
const instance2 = new import_better_sqlite3.default(source, options);
return construct(instance2, drizzleConfig);
}
const instance = new import_better_sqlite3.default(connection);
return construct(instance, drizzleConfig);
}
return construct(params[0], params[1]);
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BetterSQLite3Database,
drizzle
});
//# sourceMappingURL=driver.cjs.map

File diff suppressed because one or more lines are too long

29
node_modules/drizzle-orm/better-sqlite3/driver.d.cts generated vendored Normal file
View File

@ -0,0 +1,29 @@
import { type Database, type Options, type RunResult } from 'better-sqlite3';
import { entityKind } from "../entity.cjs";
import { BaseSQLiteDatabase } from "../sqlite-core/db.cjs";
import { type DrizzleConfig } from "../utils.cjs";
export type DrizzleBetterSQLite3DatabaseConfig = ({
source?: string | Buffer;
} & Options) | string | undefined;
export declare class BetterSQLite3Database<TSchema extends Record<string, unknown> = Record<string, never>> extends BaseSQLiteDatabase<'sync', RunResult, TSchema> {
static readonly [entityKind]: string;
}
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(...params: [] | [
Database | string
] | [
Database | string,
DrizzleConfig<TSchema>
] | [
(DrizzleConfig<TSchema> & ({
connection?: DrizzleBetterSQLite3DatabaseConfig;
} | {
client: Database;
}))
]): BetterSQLite3Database<TSchema> & {
$client: Database;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BetterSQLite3Database<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}

29
node_modules/drizzle-orm/better-sqlite3/driver.d.ts generated vendored Normal file
View File

@ -0,0 +1,29 @@
import { type Database, type Options, type RunResult } from 'better-sqlite3';
import { entityKind } from "../entity.js";
import { BaseSQLiteDatabase } from "../sqlite-core/db.js";
import { type DrizzleConfig } from "../utils.js";
export type DrizzleBetterSQLite3DatabaseConfig = ({
source?: string | Buffer;
} & Options) | string | undefined;
export declare class BetterSQLite3Database<TSchema extends Record<string, unknown> = Record<string, never>> extends BaseSQLiteDatabase<'sync', RunResult, TSchema> {
static readonly [entityKind]: string;
}
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(...params: [] | [
Database | string
] | [
Database | string,
DrizzleConfig<TSchema>
] | [
(DrizzleConfig<TSchema> & ({
connection?: DrizzleBetterSQLite3DatabaseConfig;
} | {
client: Database;
}))
]): BetterSQLite3Database<TSchema> & {
$client: Database;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BetterSQLite3Database<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}

69
node_modules/drizzle-orm/better-sqlite3/driver.js generated vendored Normal file
View File

@ -0,0 +1,69 @@
import Client from "better-sqlite3";
import { entityKind } from "../entity.js";
import { DefaultLogger } from "../logger.js";
import {
createTableRelationsHelpers,
extractTablesRelationalConfig
} from "../relations.js";
import { BaseSQLiteDatabase } from "../sqlite-core/db.js";
import { SQLiteSyncDialect } from "../sqlite-core/dialect.js";
import { isConfig } from "../utils.js";
import { BetterSQLiteSession } from "./session.js";
class BetterSQLite3Database extends BaseSQLiteDatabase {
static [entityKind] = "BetterSQLite3Database";
}
function construct(client, config = {}) {
const dialect = new SQLiteSyncDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = extractTablesRelationalConfig(
config.schema,
createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new BetterSQLiteSession(client, dialect, schema, { logger });
const db = new BetterSQLite3Database("sync", dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] === void 0 || typeof params[0] === "string") {
const instance = params[0] === void 0 ? new Client() : new Client(params[0]);
return construct(instance, params[1]);
}
if (isConfig(params[0])) {
const { connection, client, ...drizzleConfig } = params[0];
if (client)
return construct(client, drizzleConfig);
if (typeof connection === "object") {
const { source, ...options } = connection;
const instance2 = new Client(source, options);
return construct(instance2, drizzleConfig);
}
const instance = new Client(connection);
return construct(instance, drizzleConfig);
}
return construct(params[0], params[1]);
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
export {
BetterSQLite3Database,
drizzle
};
//# sourceMappingURL=driver.js.map

File diff suppressed because one or more lines are too long

25
node_modules/drizzle-orm/better-sqlite3/index.cjs generated vendored Normal file
View File

@ -0,0 +1,25 @@
"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 better_sqlite3_exports = {};
module.exports = __toCommonJS(better_sqlite3_exports);
__reExport(better_sqlite3_exports, require("./driver.cjs"), module.exports);
__reExport(better_sqlite3_exports, require("./session.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./driver.cjs"),
...require("./session.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/better-sqlite3/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,mCAAc,wBAAd;AACA,mCAAc,yBADd;","names":[]}

2
node_modules/drizzle-orm/better-sqlite3/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.cjs";
export * from "./session.cjs";

2
node_modules/drizzle-orm/better-sqlite3/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.js";
export * from "./session.js";

3
node_modules/drizzle-orm/better-sqlite3/index.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "./driver.js";
export * from "./session.js";
//# sourceMappingURL=index.js.map

1
node_modules/drizzle-orm/better-sqlite3/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/better-sqlite3/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}

33
node_modules/drizzle-orm/better-sqlite3/migrator.cjs generated vendored Normal file
View File

@ -0,0 +1,33 @@
"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 migrator_exports = {};
__export(migrator_exports, {
migrate: () => migrate
});
module.exports = __toCommonJS(migrator_exports);
var import_migrator = require("../migrator.cjs");
function migrate(db, config) {
const migrations = (0, import_migrator.readMigrationFiles)(config);
db.dialect.migrate(migrations, db.session, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
migrate
});
//# sourceMappingURL=migrator.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/better-sqlite3/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BetterSQLite3Database } from './driver.ts';\n\nexport function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BetterSQLite3Database<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tdb.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAG5B,SAAS,QACf,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAC5C,KAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AAClD;","names":[]}

View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../migrator.cjs";
import type { BetterSQLite3Database } from "./driver.cjs";
export declare function migrate<TSchema extends Record<string, unknown>>(db: BetterSQLite3Database<TSchema>, config: MigrationConfig): void;

View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../migrator.js";
import type { BetterSQLite3Database } from "./driver.js";
export declare function migrate<TSchema extends Record<string, unknown>>(db: BetterSQLite3Database<TSchema>, config: MigrationConfig): void;

9
node_modules/drizzle-orm/better-sqlite3/migrator.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
import { readMigrationFiles } from "../migrator.js";
function migrate(db, config) {
const migrations = readMigrationFiles(config);
db.dialect.migrate(migrations, db.session, config);
}
export {
migrate
};
//# sourceMappingURL=migrator.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/better-sqlite3/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BetterSQLite3Database } from './driver.ts';\n\nexport function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BetterSQLite3Database<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tdb.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAG5B,SAAS,QACf,IACA,QACC;AACD,QAAM,aAAa,mBAAmB,MAAM;AAC5C,KAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AAClD;","names":[]}

135
node_modules/drizzle-orm/better-sqlite3/session.cjs generated vendored Normal file
View File

@ -0,0 +1,135 @@
"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 session_exports = {};
__export(session_exports, {
BetterSQLiteSession: () => BetterSQLiteSession,
BetterSQLiteTransaction: () => BetterSQLiteTransaction,
PreparedQuery: () => PreparedQuery
});
module.exports = __toCommonJS(session_exports);
var import_entity = require("../entity.cjs");
var import_logger = require("../logger.cjs");
var import_sql = require("../sql/sql.cjs");
var import_sqlite_core = require("../sqlite-core/index.cjs");
var import_session = require("../sqlite-core/session.cjs");
var import_utils = require("../utils.cjs");
class BetterSQLiteSession extends import_session.SQLiteSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.logger = options.logger ?? new import_logger.NoopLogger();
}
static [import_entity.entityKind] = "BetterSQLiteSession";
logger;
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
const stmt = this.client.prepare(query.sql);
return new PreparedQuery(
stmt,
query,
this.logger,
fields,
executeMethod,
isResponseInArrayMode,
customResultMapper
);
}
transaction(transaction, config = {}) {
const tx = new BetterSQLiteTransaction("sync", this.dialect, this, this.schema);
const nativeTx = this.client.transaction(transaction);
return nativeTx[config.behavior ?? "deferred"](tx);
}
}
class BetterSQLiteTransaction extends import_sqlite_core.SQLiteTransaction {
static [import_entity.entityKind] = "BetterSQLiteTransaction";
transaction(transaction) {
const savepointName = `sp${this.nestedIndex}`;
const tx = new BetterSQLiteTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
this.session.run(import_sql.sql.raw(`savepoint ${savepointName}`));
try {
const result = transaction(tx);
this.session.run(import_sql.sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
this.session.run(import_sql.sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
}
class PreparedQuery extends import_session.SQLitePreparedQuery {
constructor(stmt, query, logger, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
super("sync", executeMethod, query);
this.stmt = stmt;
this.logger = logger;
this.fields = fields;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
}
static [import_entity.entityKind] = "BetterSQLitePreparedQuery";
run(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.run(...params);
}
all(placeholderValues) {
const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = (0, import_sql.fillPlaceholders)(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return stmt.all(...params);
}
const rows = this.values(placeholderValues);
if (customResultMapper) {
return customResultMapper(rows);
}
return rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
}
get(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
const { fields, stmt, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return stmt.get(...params);
}
const row = stmt.raw().get(...params);
if (!row) {
return void 0;
}
if (customResultMapper) {
return customResultMapper([row]);
}
return (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap);
}
values(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.raw().all(...params);
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BetterSQLiteSession,
BetterSQLiteTransaction,
PreparedQuery
});
//# sourceMappingURL=session.cjs.map

File diff suppressed because one or more lines are too long

47
node_modules/drizzle-orm/better-sqlite3/session.d.cts generated vendored Normal file
View File

@ -0,0 +1,47 @@
import type { Database, RunResult, Statement } from 'better-sqlite3';
import { entityKind } from "../entity.cjs";
import type { Logger } from "../logger.cjs";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
import { type Query } from "../sql/sql.cjs";
import type { SQLiteSyncDialect } from "../sqlite-core/dialect.cjs";
import { SQLiteTransaction } from "../sqlite-core/index.cjs";
import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.cjs";
import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteExecuteMethod, SQLitePreparedQuery as PreparedQueryBase, SQLiteSession, type SQLiteTransactionConfig } from "../sqlite-core/session.cjs";
export interface BetterSQLiteSessionOptions {
logger?: Logger;
}
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>;
export declare class BetterSQLiteSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'sync', RunResult, TFullSchema, TSchema> {
private client;
private schema;
static readonly [entityKind]: string;
private logger;
constructor(client: Database, dialect: SQLiteSyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: BetterSQLiteSessionOptions);
prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery<T>;
transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T;
}
export declare class BetterSQLiteTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'sync', RunResult, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T): T;
}
export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
type: 'sync';
run: RunResult;
all: T['all'];
get: T['get'];
values: T['values'];
execute: T['execute'];
}> {
private stmt;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
constructor(stmt: Statement, query: Query, logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
run(placeholderValues?: Record<string, unknown>): RunResult;
all(placeholderValues?: Record<string, unknown>): T['all'];
get(placeholderValues?: Record<string, unknown>): T['get'];
values(placeholderValues?: Record<string, unknown>): T['values'];
}
export {};

47
node_modules/drizzle-orm/better-sqlite3/session.d.ts generated vendored Normal file
View File

@ -0,0 +1,47 @@
import type { Database, RunResult, Statement } from 'better-sqlite3';
import { entityKind } from "../entity.js";
import type { Logger } from "../logger.js";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
import { type Query } from "../sql/sql.js";
import type { SQLiteSyncDialect } from "../sqlite-core/dialect.js";
import { SQLiteTransaction } from "../sqlite-core/index.js";
import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.js";
import { type PreparedQueryConfig as PreparedQueryConfigBase, type SQLiteExecuteMethod, SQLitePreparedQuery as PreparedQueryBase, SQLiteSession, type SQLiteTransactionConfig } from "../sqlite-core/session.js";
export interface BetterSQLiteSessionOptions {
logger?: Logger;
}
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>;
export declare class BetterSQLiteSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'sync', RunResult, TFullSchema, TSchema> {
private client;
private schema;
static readonly [entityKind]: string;
private logger;
constructor(client: Database, dialect: SQLiteSyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: BetterSQLiteSessionOptions);
prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery<T>;
transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T;
}
export declare class BetterSQLiteTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'sync', RunResult, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: BetterSQLiteTransaction<TFullSchema, TSchema>) => T): T;
}
export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
type: 'sync';
run: RunResult;
all: T['all'];
get: T['get'];
values: T['values'];
execute: T['execute'];
}> {
private stmt;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
constructor(stmt: Statement, query: Query, logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
run(placeholderValues?: Record<string, unknown>): RunResult;
all(placeholderValues?: Record<string, unknown>): T['all'];
get(placeholderValues?: Record<string, unknown>): T['get'];
values(placeholderValues?: Record<string, unknown>): T['values'];
}
export {};

112
node_modules/drizzle-orm/better-sqlite3/session.js generated vendored Normal file
View File

@ -0,0 +1,112 @@
import { entityKind } from "../entity.js";
import { NoopLogger } from "../logger.js";
import { fillPlaceholders, sql } from "../sql/sql.js";
import { SQLiteTransaction } from "../sqlite-core/index.js";
import {
SQLitePreparedQuery as PreparedQueryBase,
SQLiteSession
} from "../sqlite-core/session.js";
import { mapResultRow } from "../utils.js";
class BetterSQLiteSession extends SQLiteSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.logger = options.logger ?? new NoopLogger();
}
static [entityKind] = "BetterSQLiteSession";
logger;
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
const stmt = this.client.prepare(query.sql);
return new PreparedQuery(
stmt,
query,
this.logger,
fields,
executeMethod,
isResponseInArrayMode,
customResultMapper
);
}
transaction(transaction, config = {}) {
const tx = new BetterSQLiteTransaction("sync", this.dialect, this, this.schema);
const nativeTx = this.client.transaction(transaction);
return nativeTx[config.behavior ?? "deferred"](tx);
}
}
class BetterSQLiteTransaction extends SQLiteTransaction {
static [entityKind] = "BetterSQLiteTransaction";
transaction(transaction) {
const savepointName = `sp${this.nestedIndex}`;
const tx = new BetterSQLiteTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
this.session.run(sql.raw(`savepoint ${savepointName}`));
try {
const result = transaction(tx);
this.session.run(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
}
class PreparedQuery extends PreparedQueryBase {
constructor(stmt, query, logger, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
super("sync", executeMethod, query);
this.stmt = stmt;
this.logger = logger;
this.fields = fields;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
}
static [entityKind] = "BetterSQLitePreparedQuery";
run(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.run(...params);
}
all(placeholderValues) {
const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return stmt.all(...params);
}
const rows = this.values(placeholderValues);
if (customResultMapper) {
return customResultMapper(rows);
}
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
}
get(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
const { fields, stmt, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return stmt.get(...params);
}
const row = stmt.raw().get(...params);
if (!row) {
return void 0;
}
if (customResultMapper) {
return customResultMapper([row]);
}
return mapResultRow(fields, row, joinsNotNullableMap);
}
values(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.raw().all(...params);
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
export {
BetterSQLiteSession,
BetterSQLiteTransaction,
PreparedQuery
};
//# sourceMappingURL=session.js.map

File diff suppressed because one or more lines are too long

92
node_modules/drizzle-orm/bun-sqlite/driver.cjs generated vendored Normal file
View File

@ -0,0 +1,92 @@
"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 driver_exports = {};
__export(driver_exports, {
BunSQLiteDatabase: () => BunSQLiteDatabase,
drizzle: () => drizzle
});
module.exports = __toCommonJS(driver_exports);
var import_bun_sqlite = require("bun:sqlite");
var import_entity = require("../entity.cjs");
var import_logger = require("../logger.cjs");
var import_relations = require("../relations.cjs");
var import_db = require("../sqlite-core/db.cjs");
var import_dialect = require("../sqlite-core/dialect.cjs");
var import_utils = require("../utils.cjs");
var import_session = require("./session.cjs");
class BunSQLiteDatabase extends import_db.BaseSQLiteDatabase {
static [import_entity.entityKind] = "BunSQLiteDatabase";
}
function construct(client, config = {}) {
const dialect = new import_dialect.SQLiteSyncDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new import_logger.DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(
config.schema,
import_relations.createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new import_session.SQLiteBunSession(client, dialect, schema, { logger });
const db = new BunSQLiteDatabase("sync", dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] === void 0 || typeof params[0] === "string") {
const instance = params[0] === void 0 ? new import_bun_sqlite.Database() : new import_bun_sqlite.Database(params[0]);
return construct(instance, params[1]);
}
if ((0, import_utils.isConfig)(params[0])) {
const { connection, client, ...drizzleConfig } = params[0];
if (client)
return construct(client, drizzleConfig);
if (typeof connection === "object") {
const { source, ...opts } = connection;
const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
const instance2 = new import_bun_sqlite.Database(source, options);
return construct(instance2, drizzleConfig);
}
const instance = new import_bun_sqlite.Database(connection);
return construct(instance, drizzleConfig);
}
return construct(params[0], params[1]);
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BunSQLiteDatabase,
drizzle
});
//# sourceMappingURL=driver.cjs.map

1
node_modules/drizzle-orm/bun-sqlite/driver.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

50
node_modules/drizzle-orm/bun-sqlite/driver.d.cts generated vendored Normal file
View File

@ -0,0 +1,50 @@
import { Database } from 'bun:sqlite';
import { entityKind } from "../entity.cjs";
import { BaseSQLiteDatabase } from "../sqlite-core/db.cjs";
import { type DrizzleConfig } from "../utils.cjs";
export declare class BunSQLiteDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends BaseSQLiteDatabase<'sync', void, TSchema> {
static readonly [entityKind]: string;
}
type DrizzleBunSqliteDatabaseOptions = {
/**
* Open the database as read-only (no write operations, no create).
*
* Equivalent to {@link constants.SQLITE_OPEN_READONLY}
*/
readonly?: boolean;
/**
* Allow creating a new database
*
* Equivalent to {@link constants.SQLITE_OPEN_CREATE}
*/
create?: boolean;
/**
* Open the database as read-write
*
* Equivalent to {@link constants.SQLITE_OPEN_READWRITE}
*/
readwrite?: boolean;
};
export type DrizzleBunSqliteDatabaseConfig = ({
source?: string;
} & DrizzleBunSqliteDatabaseOptions) | string | undefined;
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends Database = Database>(...params: [] | [
TClient | string
] | [
TClient | string,
DrizzleConfig<TSchema>
] | [
(DrizzleConfig<TSchema> & ({
connection?: DrizzleBunSqliteDatabaseConfig;
} | {
client: TClient;
}))
]): BunSQLiteDatabase<TSchema> & {
$client: TClient;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BunSQLiteDatabase<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}
export {};

50
node_modules/drizzle-orm/bun-sqlite/driver.d.ts generated vendored Normal file
View File

@ -0,0 +1,50 @@
import { Database } from 'bun:sqlite';
import { entityKind } from "../entity.js";
import { BaseSQLiteDatabase } from "../sqlite-core/db.js";
import { type DrizzleConfig } from "../utils.js";
export declare class BunSQLiteDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends BaseSQLiteDatabase<'sync', void, TSchema> {
static readonly [entityKind]: string;
}
type DrizzleBunSqliteDatabaseOptions = {
/**
* Open the database as read-only (no write operations, no create).
*
* Equivalent to {@link constants.SQLITE_OPEN_READONLY}
*/
readonly?: boolean;
/**
* Allow creating a new database
*
* Equivalent to {@link constants.SQLITE_OPEN_CREATE}
*/
create?: boolean;
/**
* Open the database as read-write
*
* Equivalent to {@link constants.SQLITE_OPEN_READWRITE}
*/
readwrite?: boolean;
};
export type DrizzleBunSqliteDatabaseConfig = ({
source?: string;
} & DrizzleBunSqliteDatabaseOptions) | string | undefined;
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends Database = Database>(...params: [] | [
TClient | string
] | [
TClient | string,
DrizzleConfig<TSchema>
] | [
(DrizzleConfig<TSchema> & ({
connection?: DrizzleBunSqliteDatabaseConfig;
} | {
client: TClient;
}))
]): BunSQLiteDatabase<TSchema> & {
$client: TClient;
};
export declare namespace drizzle {
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BunSQLiteDatabase<TSchema> & {
$client: '$client is not available on drizzle.mock()';
};
}
export {};

70
node_modules/drizzle-orm/bun-sqlite/driver.js generated vendored Normal file
View File

@ -0,0 +1,70 @@
import { Database } from "bun:sqlite";
import { entityKind } from "../entity.js";
import { DefaultLogger } from "../logger.js";
import {
createTableRelationsHelpers,
extractTablesRelationalConfig
} from "../relations.js";
import { BaseSQLiteDatabase } from "../sqlite-core/db.js";
import { SQLiteSyncDialect } from "../sqlite-core/dialect.js";
import { isConfig } from "../utils.js";
import { SQLiteBunSession } from "./session.js";
class BunSQLiteDatabase extends BaseSQLiteDatabase {
static [entityKind] = "BunSQLiteDatabase";
}
function construct(client, config = {}) {
const dialect = new SQLiteSyncDialect({ casing: config.casing });
let logger;
if (config.logger === true) {
logger = new DefaultLogger();
} else if (config.logger !== false) {
logger = config.logger;
}
let schema;
if (config.schema) {
const tablesConfig = extractTablesRelationalConfig(
config.schema,
createTableRelationsHelpers
);
schema = {
fullSchema: config.schema,
schema: tablesConfig.tables,
tableNamesMap: tablesConfig.tableNamesMap
};
}
const session = new SQLiteBunSession(client, dialect, schema, { logger });
const db = new BunSQLiteDatabase("sync", dialect, session, schema);
db.$client = client;
return db;
}
function drizzle(...params) {
if (params[0] === void 0 || typeof params[0] === "string") {
const instance = params[0] === void 0 ? new Database() : new Database(params[0]);
return construct(instance, params[1]);
}
if (isConfig(params[0])) {
const { connection, client, ...drizzleConfig } = params[0];
if (client)
return construct(client, drizzleConfig);
if (typeof connection === "object") {
const { source, ...opts } = connection;
const options = Object.values(opts).filter((v) => v !== void 0).length ? opts : void 0;
const instance2 = new Database(source, options);
return construct(instance2, drizzleConfig);
}
const instance = new Database(connection);
return construct(instance, drizzleConfig);
}
return construct(params[0], params[1]);
}
((drizzle2) => {
function mock(config) {
return construct({}, config);
}
drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
export {
BunSQLiteDatabase,
drizzle
};
//# sourceMappingURL=driver.js.map

1
node_modules/drizzle-orm/bun-sqlite/driver.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

25
node_modules/drizzle-orm/bun-sqlite/index.cjs generated vendored Normal file
View File

@ -0,0 +1,25 @@
"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 bun_sqlite_exports = {};
module.exports = __toCommonJS(bun_sqlite_exports);
__reExport(bun_sqlite_exports, require("./driver.cjs"), module.exports);
__reExport(bun_sqlite_exports, require("./session.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./driver.cjs"),
...require("./session.cjs")
});
//# sourceMappingURL=index.cjs.map

1
node_modules/drizzle-orm/bun-sqlite/index.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/bun-sqlite/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,wBAAd;AACA,+BAAc,yBADd;","names":[]}

2
node_modules/drizzle-orm/bun-sqlite/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.cjs";
export * from "./session.cjs";

2
node_modules/drizzle-orm/bun-sqlite/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./driver.js";
export * from "./session.js";

3
node_modules/drizzle-orm/bun-sqlite/index.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "./driver.js";
export * from "./session.js";
//# sourceMappingURL=index.js.map

1
node_modules/drizzle-orm/bun-sqlite/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/bun-sqlite/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}

33
node_modules/drizzle-orm/bun-sqlite/migrator.cjs generated vendored Normal file
View File

@ -0,0 +1,33 @@
"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 migrator_exports = {};
__export(migrator_exports, {
migrate: () => migrate
});
module.exports = __toCommonJS(migrator_exports);
var import_migrator = require("../migrator.cjs");
function migrate(db, config) {
const migrations = (0, import_migrator.readMigrationFiles)(config);
db.dialect.migrate(migrations, db.session, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
migrate
});
//# sourceMappingURL=migrator.cjs.map

1
node_modules/drizzle-orm/bun-sqlite/migrator.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/bun-sqlite/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BunSQLiteDatabase } from './driver.ts';\n\nexport function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BunSQLiteDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tdb.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAmC;AAG5B,SAAS,QACf,IACA,QACC;AACD,QAAM,iBAAa,oCAAmB,MAAM;AAC5C,KAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AAClD;","names":[]}

3
node_modules/drizzle-orm/bun-sqlite/migrator.d.cts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../migrator.cjs";
import type { BunSQLiteDatabase } from "./driver.cjs";
export declare function migrate<TSchema extends Record<string, unknown>>(db: BunSQLiteDatabase<TSchema>, config: MigrationConfig): void;

3
node_modules/drizzle-orm/bun-sqlite/migrator.d.ts generated vendored Normal file
View File

@ -0,0 +1,3 @@
import type { MigrationConfig } from "../migrator.js";
import type { BunSQLiteDatabase } from "./driver.js";
export declare function migrate<TSchema extends Record<string, unknown>>(db: BunSQLiteDatabase<TSchema>, config: MigrationConfig): void;

9
node_modules/drizzle-orm/bun-sqlite/migrator.js generated vendored Normal file
View File

@ -0,0 +1,9 @@
import { readMigrationFiles } from "../migrator.js";
function migrate(db, config) {
const migrations = readMigrationFiles(config);
db.dialect.migrate(migrations, db.session, config);
}
export {
migrate
};
//# sourceMappingURL=migrator.js.map

1
node_modules/drizzle-orm/bun-sqlite/migrator.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/bun-sqlite/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BunSQLiteDatabase } from './driver.ts';\n\nexport function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BunSQLiteDatabase<TSchema>,\n\tconfig: MigrationConfig,\n) {\n\tconst migrations = readMigrationFiles(config);\n\tdb.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAG5B,SAAS,QACf,IACA,QACC;AACD,QAAM,aAAa,mBAAmB,MAAM;AAC5C,KAAG,QAAQ,QAAQ,YAAY,GAAG,SAAS,MAAM;AAClD;","names":[]}

142
node_modules/drizzle-orm/bun-sqlite/session.cjs generated vendored Normal file
View File

@ -0,0 +1,142 @@
"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 session_exports = {};
__export(session_exports, {
PreparedQuery: () => PreparedQuery,
SQLiteBunSession: () => SQLiteBunSession,
SQLiteBunTransaction: () => SQLiteBunTransaction
});
module.exports = __toCommonJS(session_exports);
var import_entity = require("../entity.cjs");
var import_logger = require("../logger.cjs");
var import_sql = require("../sql/sql.cjs");
var import_sqlite_core = require("../sqlite-core/index.cjs");
var import_session = require("../sqlite-core/session.cjs");
var import_utils = require("../utils.cjs");
class SQLiteBunSession extends import_session.SQLiteSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.logger = options.logger ?? new import_logger.NoopLogger();
}
static [import_entity.entityKind] = "SQLiteBunSession";
logger;
exec(query) {
this.client.exec(query);
}
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
const stmt = this.client.prepare(query.sql);
return new PreparedQuery(
stmt,
query,
this.logger,
fields,
executeMethod,
isResponseInArrayMode,
customResultMapper
);
}
transaction(transaction, config = {}) {
const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.schema);
let result;
const nativeTx = this.client.transaction(() => {
result = transaction(tx);
});
nativeTx[config.behavior ?? "deferred"]();
return result;
}
}
class SQLiteBunTransaction extends import_sqlite_core.SQLiteTransaction {
static [import_entity.entityKind] = "SQLiteBunTransaction";
transaction(transaction) {
const savepointName = `sp${this.nestedIndex}`;
const tx = new SQLiteBunTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
this.session.run(import_sql.sql.raw(`savepoint ${savepointName}`));
try {
const result = transaction(tx);
this.session.run(import_sql.sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
this.session.run(import_sql.sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
}
class PreparedQuery extends import_session.SQLitePreparedQuery {
constructor(stmt, query, logger, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
super("sync", executeMethod, query);
this.stmt = stmt;
this.logger = logger;
this.fields = fields;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
}
static [import_entity.entityKind] = "SQLiteBunPreparedQuery";
run(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.run(...params);
}
all(placeholderValues) {
const { fields, query, logger, joinsNotNullableMap, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = (0, import_sql.fillPlaceholders)(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return stmt.all(...params);
}
const rows = this.values(placeholderValues);
if (customResultMapper) {
return customResultMapper(rows);
}
return rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
}
get(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
const row = this.stmt.values(...params)[0];
if (!row) {
return void 0;
}
const { fields, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return row;
}
if (customResultMapper) {
return customResultMapper([row]);
}
return (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap);
}
values(placeholderValues) {
const params = (0, import_sql.fillPlaceholders)(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.values(...params);
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PreparedQuery,
SQLiteBunSession,
SQLiteBunTransaction
});
//# sourceMappingURL=session.cjs.map

1
node_modules/drizzle-orm/bun-sqlite/session.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

50
node_modules/drizzle-orm/bun-sqlite/session.d.cts generated vendored Normal file
View File

@ -0,0 +1,50 @@
import type { Database, Statement as BunStatement } from 'bun:sqlite';
import { entityKind } from "../entity.cjs";
import type { Logger } from "../logger.cjs";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
import { type Query } from "../sql/sql.cjs";
import type { SQLiteSyncDialect } from "../sqlite-core/dialect.cjs";
import { SQLiteTransaction } from "../sqlite-core/index.cjs";
import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.cjs";
import type { PreparedQueryConfig as PreparedQueryConfigBase, SQLiteExecuteMethod, SQLiteTransactionConfig } from "../sqlite-core/session.cjs";
import { SQLitePreparedQuery as PreparedQueryBase, SQLiteSession } from "../sqlite-core/session.cjs";
export interface SQLiteBunSessionOptions {
logger?: Logger;
}
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>;
type Statement = BunStatement<any>;
export declare class SQLiteBunSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'sync', void, TFullSchema, TSchema> {
private client;
private schema;
static readonly [entityKind]: string;
private logger;
constructor(client: Database, dialect: SQLiteSyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: SQLiteBunSessionOptions);
exec(query: string): void;
prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery<T>;
transaction<T>(transaction: (tx: SQLiteBunTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T;
}
export declare class SQLiteBunTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'sync', void, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: SQLiteBunTransaction<TFullSchema, TSchema>) => T): T;
}
export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
type: 'sync';
run: void;
all: T['all'];
get: T['get'];
values: T['values'];
execute: T['execute'];
}> {
private stmt;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
constructor(stmt: Statement, query: Query, logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
run(placeholderValues?: Record<string, unknown>): void;
all(placeholderValues?: Record<string, unknown>): T['all'];
get(placeholderValues?: Record<string, unknown>): T['get'];
values(placeholderValues?: Record<string, unknown>): T['values'];
}
export {};

50
node_modules/drizzle-orm/bun-sqlite/session.d.ts generated vendored Normal file
View File

@ -0,0 +1,50 @@
import type { Database, Statement as BunStatement } from 'bun:sqlite';
import { entityKind } from "../entity.js";
import type { Logger } from "../logger.js";
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
import { type Query } from "../sql/sql.js";
import type { SQLiteSyncDialect } from "../sqlite-core/dialect.js";
import { SQLiteTransaction } from "../sqlite-core/index.js";
import type { SelectedFieldsOrdered } from "../sqlite-core/query-builders/select.types.js";
import type { PreparedQueryConfig as PreparedQueryConfigBase, SQLiteExecuteMethod, SQLiteTransactionConfig } from "../sqlite-core/session.js";
import { SQLitePreparedQuery as PreparedQueryBase, SQLiteSession } from "../sqlite-core/session.js";
export interface SQLiteBunSessionOptions {
logger?: Logger;
}
type PreparedQueryConfig = Omit<PreparedQueryConfigBase, 'statement' | 'run'>;
type Statement = BunStatement<any>;
export declare class SQLiteBunSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteSession<'sync', void, TFullSchema, TSchema> {
private client;
private schema;
static readonly [entityKind]: string;
private logger;
constructor(client: Database, dialect: SQLiteSyncDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: SQLiteBunSessionOptions);
exec(query: string): void;
prepareQuery<T extends Omit<PreparedQueryConfig, 'run'>>(query: Query, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => unknown): PreparedQuery<T>;
transaction<T>(transaction: (tx: SQLiteBunTransaction<TFullSchema, TSchema>) => T, config?: SQLiteTransactionConfig): T;
}
export declare class SQLiteBunTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends SQLiteTransaction<'sync', void, TFullSchema, TSchema> {
static readonly [entityKind]: string;
transaction<T>(transaction: (tx: SQLiteBunTransaction<TFullSchema, TSchema>) => T): T;
}
export declare class PreparedQuery<T extends PreparedQueryConfig = PreparedQueryConfig> extends PreparedQueryBase<{
type: 'sync';
run: void;
all: T['all'];
get: T['get'];
values: T['values'];
execute: T['execute'];
}> {
private stmt;
private logger;
private fields;
private _isResponseInArrayMode;
private customResultMapper?;
static readonly [entityKind]: string;
constructor(stmt: Statement, query: Query, logger: Logger, fields: SelectedFieldsOrdered | undefined, executeMethod: SQLiteExecuteMethod, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => unknown) | undefined);
run(placeholderValues?: Record<string, unknown>): void;
all(placeholderValues?: Record<string, unknown>): T['all'];
get(placeholderValues?: Record<string, unknown>): T['get'];
values(placeholderValues?: Record<string, unknown>): T['values'];
}
export {};

116
node_modules/drizzle-orm/bun-sqlite/session.js generated vendored Normal file
View File

@ -0,0 +1,116 @@
import { entityKind } from "../entity.js";
import { NoopLogger } from "../logger.js";
import { fillPlaceholders, sql } from "../sql/sql.js";
import { SQLiteTransaction } from "../sqlite-core/index.js";
import { SQLitePreparedQuery as PreparedQueryBase, SQLiteSession } from "../sqlite-core/session.js";
import { mapResultRow } from "../utils.js";
class SQLiteBunSession extends SQLiteSession {
constructor(client, dialect, schema, options = {}) {
super(dialect);
this.client = client;
this.schema = schema;
this.logger = options.logger ?? new NoopLogger();
}
static [entityKind] = "SQLiteBunSession";
logger;
exec(query) {
this.client.exec(query);
}
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
const stmt = this.client.prepare(query.sql);
return new PreparedQuery(
stmt,
query,
this.logger,
fields,
executeMethod,
isResponseInArrayMode,
customResultMapper
);
}
transaction(transaction, config = {}) {
const tx = new SQLiteBunTransaction("sync", this.dialect, this, this.schema);
let result;
const nativeTx = this.client.transaction(() => {
result = transaction(tx);
});
nativeTx[config.behavior ?? "deferred"]();
return result;
}
}
class SQLiteBunTransaction extends SQLiteTransaction {
static [entityKind] = "SQLiteBunTransaction";
transaction(transaction) {
const savepointName = `sp${this.nestedIndex}`;
const tx = new SQLiteBunTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
this.session.run(sql.raw(`savepoint ${savepointName}`));
try {
const result = transaction(tx);
this.session.run(sql.raw(`release savepoint ${savepointName}`));
return result;
} catch (err) {
this.session.run(sql.raw(`rollback to savepoint ${savepointName}`));
throw err;
}
}
}
class PreparedQuery extends PreparedQueryBase {
constructor(stmt, query, logger, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
super("sync", executeMethod, query);
this.stmt = stmt;
this.logger = logger;
this.fields = fields;
this._isResponseInArrayMode = _isResponseInArrayMode;
this.customResultMapper = customResultMapper;
}
static [entityKind] = "SQLiteBunPreparedQuery";
run(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.run(...params);
}
all(placeholderValues) {
const { fields, query, logger, joinsNotNullableMap, stmt, customResultMapper } = this;
if (!fields && !customResultMapper) {
const params = fillPlaceholders(query.params, placeholderValues ?? {});
logger.logQuery(query.sql, params);
return stmt.all(...params);
}
const rows = this.values(placeholderValues);
if (customResultMapper) {
return customResultMapper(rows);
}
return rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
}
get(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
const row = this.stmt.values(...params)[0];
if (!row) {
return void 0;
}
const { fields, joinsNotNullableMap, customResultMapper } = this;
if (!fields && !customResultMapper) {
return row;
}
if (customResultMapper) {
return customResultMapper([row]);
}
return mapResultRow(fields, row, joinsNotNullableMap);
}
values(placeholderValues) {
const params = fillPlaceholders(this.query.params, placeholderValues ?? {});
this.logger.logQuery(this.query.sql, params);
return this.stmt.values(...params);
}
/** @internal */
isResponseInArrayMode() {
return this._isResponseInArrayMode;
}
}
export {
PreparedQuery,
SQLiteBunSession,
SQLiteBunTransaction
};
//# sourceMappingURL=session.js.map

1
node_modules/drizzle-orm/bun-sqlite/session.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

85
node_modules/drizzle-orm/casing.cjs generated vendored Normal file
View File

@ -0,0 +1,85 @@
"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 casing_exports = {};
__export(casing_exports, {
CasingCache: () => CasingCache,
toCamelCase: () => toCamelCase,
toSnakeCase: () => toSnakeCase
});
module.exports = __toCommonJS(casing_exports);
var import_entity = require("./entity.cjs");
var import_table = require("./table.cjs");
function toSnakeCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.map((word) => word.toLowerCase()).join("_");
}
function toCamelCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.reduce((acc, word, i) => {
const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
return acc + formattedWord;
}, "");
}
function noopCase(input) {
return input;
}
class CasingCache {
static [import_entity.entityKind] = "CasingCache";
/** @internal */
cache = {};
cachedTables = {};
convert;
constructor(casing) {
this.convert = casing === "snake_case" ? toSnakeCase : casing === "camelCase" ? toCamelCase : noopCase;
}
getColumnCasing(column) {
if (!column.keyAsName)
return column.name;
const schema = column.table[import_table.Table.Symbol.Schema] ?? "public";
const tableName = column.table[import_table.Table.Symbol.OriginalName];
const key = `${schema}.${tableName}.${column.name}`;
if (!this.cache[key]) {
this.cacheTable(column.table);
}
return this.cache[key];
}
cacheTable(table) {
const schema = table[import_table.Table.Symbol.Schema] ?? "public";
const tableName = table[import_table.Table.Symbol.OriginalName];
const tableKey = `${schema}.${tableName}`;
if (!this.cachedTables[tableKey]) {
for (const column of Object.values(table[import_table.Table.Symbol.Columns])) {
const columnKey = `${tableKey}.${column.name}`;
this.cache[columnKey] = this.convert(column.name);
}
this.cachedTables[tableKey] = true;
}
}
clearCache() {
this.cache = {};
this.cachedTables = {};
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CasingCache,
toCamelCase,
toSnakeCase
});
//# sourceMappingURL=casing.cjs.map

1
node_modules/drizzle-orm/casing.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Column } from '~/column.ts';\nimport { entityKind } from './entity.ts';\nimport { Table } from './table.ts';\nimport type { Casing } from './utils.ts';\n\nexport function toSnakeCase(input: string) {\n\tconst words = input\n\t\t.replace(/['\\u2019]/g, '')\n\t\t.match(/[\\da-z]+|[A-Z]+(?![a-z])|[A-Z][\\da-z]+/g) ?? [];\n\n\treturn words.map((word) => word.toLowerCase()).join('_');\n}\n\nexport function toCamelCase(input: string) {\n\tconst words = input\n\t\t.replace(/['\\u2019]/g, '')\n\t\t.match(/[\\da-z]+|[A-Z]+(?![a-z])|[A-Z][\\da-z]+/g) ?? [];\n\n\treturn words.reduce((acc, word, i) => {\n\t\tconst formattedWord = i === 0 ? word.toLowerCase() : `${word[0]!.toUpperCase()}${word.slice(1)}`;\n\t\treturn acc + formattedWord;\n\t}, '');\n}\n\nfunction noopCase(input: string) {\n\treturn input;\n}\n\nexport class CasingCache {\n\tstatic readonly [entityKind]: string = 'CasingCache';\n\n\t/** @internal */\n\tcache: Record<string, string> = {};\n\tprivate cachedTables: Record<string, true> = {};\n\tprivate convert: (input: string) => string;\n\n\tconstructor(casing?: Casing) {\n\t\tthis.convert = casing === 'snake_case'\n\t\t\t? toSnakeCase\n\t\t\t: casing === 'camelCase'\n\t\t\t? toCamelCase\n\t\t\t: noopCase;\n\t}\n\n\tgetColumnCasing(column: Column): string {\n\t\tif (!column.keyAsName) return column.name;\n\n\t\tconst schema = column.table[Table.Symbol.Schema] ?? 'public';\n\t\tconst tableName = column.table[Table.Symbol.OriginalName];\n\t\tconst key = `${schema}.${tableName}.${column.name}`;\n\n\t\tif (!this.cache[key]) {\n\t\t\tthis.cacheTable(column.table);\n\t\t}\n\t\treturn this.cache[key]!;\n\t}\n\n\tprivate cacheTable(table: Table) {\n\t\tconst schema = table[Table.Symbol.Schema] ?? 'public';\n\t\tconst tableName = table[Table.Symbol.OriginalName];\n\t\tconst tableKey = `${schema}.${tableName}`;\n\n\t\tif (!this.cachedTables[tableKey]) {\n\t\t\tfor (const column of Object.values(table[Table.Symbol.Columns])) {\n\t\t\t\tconst columnKey = `${tableKey}.${column.name}`;\n\t\t\t\tthis.cache[columnKey] = this.convert(column.name);\n\t\t\t}\n\t\t\tthis.cachedTables[tableKey] = true;\n\t\t}\n\t}\n\n\tclearCache() {\n\t\tthis.cache = {};\n\t\tthis.cachedTables = {};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA2B;AAC3B,mBAAsB;AAGf,SAAS,YAAY,OAAe;AAC1C,QAAM,QAAQ,MACZ,QAAQ,cAAc,EAAE,EACxB,MAAM,yCAAyC,KAAK,CAAC;AAEvD,SAAO,MAAM,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACxD;AAEO,SAAS,YAAY,OAAe;AAC1C,QAAM,QAAQ,MACZ,QAAQ,cAAc,EAAE,EACxB,MAAM,yCAAyC,KAAK,CAAC;AAEvD,SAAO,MAAM,OAAO,CAAC,KAAK,MAAM,MAAM;AACrC,UAAM,gBAAgB,MAAM,IAAI,KAAK,YAAY,IAAI,GAAG,KAAK,CAAC,EAAG,YAAY,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;AAC9F,WAAO,MAAM;AAAA,EACd,GAAG,EAAE;AACN;AAEA,SAAS,SAAS,OAAe;AAChC,SAAO;AACR;AAEO,MAAM,YAAY;AAAA,EACxB,QAAiB,wBAAU,IAAY;AAAA;AAAA,EAGvC,QAAgC,CAAC;AAAA,EACzB,eAAqC,CAAC;AAAA,EACtC;AAAA,EAER,YAAY,QAAiB;AAC5B,SAAK,UAAU,WAAW,eACvB,cACA,WAAW,cACX,cACA;AAAA,EACJ;AAAA,EAEA,gBAAgB,QAAwB;AACvC,QAAI,CAAC,OAAO;AAAW,aAAO,OAAO;AAErC,UAAM,SAAS,OAAO,MAAM,mBAAM,OAAO,MAAM,KAAK;AACpD,UAAM,YAAY,OAAO,MAAM,mBAAM,OAAO,YAAY;AACxD,UAAM,MAAM,GAAG,MAAM,IAAI,SAAS,IAAI,OAAO,IAAI;AAEjD,QAAI,CAAC,KAAK,MAAM,GAAG,GAAG;AACrB,WAAK,WAAW,OAAO,KAAK;AAAA,IAC7B;AACA,WAAO,KAAK,MAAM,GAAG;AAAA,EACtB;AAAA,EAEQ,WAAW,OAAc;AAChC,UAAM,SAAS,MAAM,mBAAM,OAAO,MAAM,KAAK;AAC7C,UAAM,YAAY,MAAM,mBAAM,OAAO,YAAY;AACjD,UAAM,WAAW,GAAG,MAAM,IAAI,SAAS;AAEvC,QAAI,CAAC,KAAK,aAAa,QAAQ,GAAG;AACjC,iBAAW,UAAU,OAAO,OAAO,MAAM,mBAAM,OAAO,OAAO,CAAC,GAAG;AAChE,cAAM,YAAY,GAAG,QAAQ,IAAI,OAAO,IAAI;AAC5C,aAAK,MAAM,SAAS,IAAI,KAAK,QAAQ,OAAO,IAAI;AAAA,MACjD;AACA,WAAK,aAAa,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD;AAAA,EAEA,aAAa;AACZ,SAAK,QAAQ,CAAC;AACd,SAAK,eAAe,CAAC;AAAA,EACtB;AACD;","names":[]}

14
node_modules/drizzle-orm/casing.d.cts generated vendored Normal file
View File

@ -0,0 +1,14 @@
import type { Column } from "./column.cjs";
import { entityKind } from "./entity.cjs";
import type { Casing } from "./utils.cjs";
export declare function toSnakeCase(input: string): string;
export declare function toCamelCase(input: string): string;
export declare class CasingCache {
static readonly [entityKind]: string;
private cachedTables;
private convert;
constructor(casing?: Casing);
getColumnCasing(column: Column): string;
private cacheTable;
clearCache(): void;
}

14
node_modules/drizzle-orm/casing.d.ts generated vendored Normal file
View File

@ -0,0 +1,14 @@
import type { Column } from "./column.js";
import { entityKind } from "./entity.js";
import type { Casing } from "./utils.js";
export declare function toSnakeCase(input: string): string;
export declare function toCamelCase(input: string): string;
export declare class CasingCache {
static readonly [entityKind]: string;
private cachedTables;
private convert;
constructor(casing?: Casing);
getColumnCasing(column: Column): string;
private cacheTable;
clearCache(): void;
}

59
node_modules/drizzle-orm/casing.js generated vendored Normal file
View File

@ -0,0 +1,59 @@
import { entityKind } from "./entity.js";
import { Table } from "./table.js";
function toSnakeCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.map((word) => word.toLowerCase()).join("_");
}
function toCamelCase(input) {
const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
return words.reduce((acc, word, i) => {
const formattedWord = i === 0 ? word.toLowerCase() : `${word[0].toUpperCase()}${word.slice(1)}`;
return acc + formattedWord;
}, "");
}
function noopCase(input) {
return input;
}
class CasingCache {
static [entityKind] = "CasingCache";
/** @internal */
cache = {};
cachedTables = {};
convert;
constructor(casing) {
this.convert = casing === "snake_case" ? toSnakeCase : casing === "camelCase" ? toCamelCase : noopCase;
}
getColumnCasing(column) {
if (!column.keyAsName)
return column.name;
const schema = column.table[Table.Symbol.Schema] ?? "public";
const tableName = column.table[Table.Symbol.OriginalName];
const key = `${schema}.${tableName}.${column.name}`;
if (!this.cache[key]) {
this.cacheTable(column.table);
}
return this.cache[key];
}
cacheTable(table) {
const schema = table[Table.Symbol.Schema] ?? "public";
const tableName = table[Table.Symbol.OriginalName];
const tableKey = `${schema}.${tableName}`;
if (!this.cachedTables[tableKey]) {
for (const column of Object.values(table[Table.Symbol.Columns])) {
const columnKey = `${tableKey}.${column.name}`;
this.cache[columnKey] = this.convert(column.name);
}
this.cachedTables[tableKey] = true;
}
}
clearCache() {
this.cache = {};
this.cachedTables = {};
}
}
export {
CasingCache,
toCamelCase,
toSnakeCase
};
//# sourceMappingURL=casing.js.map

1
node_modules/drizzle-orm/casing.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/casing.ts"],"sourcesContent":["import type { Column } from '~/column.ts';\nimport { entityKind } from './entity.ts';\nimport { Table } from './table.ts';\nimport type { Casing } from './utils.ts';\n\nexport function toSnakeCase(input: string) {\n\tconst words = input\n\t\t.replace(/['\\u2019]/g, '')\n\t\t.match(/[\\da-z]+|[A-Z]+(?![a-z])|[A-Z][\\da-z]+/g) ?? [];\n\n\treturn words.map((word) => word.toLowerCase()).join('_');\n}\n\nexport function toCamelCase(input: string) {\n\tconst words = input\n\t\t.replace(/['\\u2019]/g, '')\n\t\t.match(/[\\da-z]+|[A-Z]+(?![a-z])|[A-Z][\\da-z]+/g) ?? [];\n\n\treturn words.reduce((acc, word, i) => {\n\t\tconst formattedWord = i === 0 ? word.toLowerCase() : `${word[0]!.toUpperCase()}${word.slice(1)}`;\n\t\treturn acc + formattedWord;\n\t}, '');\n}\n\nfunction noopCase(input: string) {\n\treturn input;\n}\n\nexport class CasingCache {\n\tstatic readonly [entityKind]: string = 'CasingCache';\n\n\t/** @internal */\n\tcache: Record<string, string> = {};\n\tprivate cachedTables: Record<string, true> = {};\n\tprivate convert: (input: string) => string;\n\n\tconstructor(casing?: Casing) {\n\t\tthis.convert = casing === 'snake_case'\n\t\t\t? toSnakeCase\n\t\t\t: casing === 'camelCase'\n\t\t\t? toCamelCase\n\t\t\t: noopCase;\n\t}\n\n\tgetColumnCasing(column: Column): string {\n\t\tif (!column.keyAsName) return column.name;\n\n\t\tconst schema = column.table[Table.Symbol.Schema] ?? 'public';\n\t\tconst tableName = column.table[Table.Symbol.OriginalName];\n\t\tconst key = `${schema}.${tableName}.${column.name}`;\n\n\t\tif (!this.cache[key]) {\n\t\t\tthis.cacheTable(column.table);\n\t\t}\n\t\treturn this.cache[key]!;\n\t}\n\n\tprivate cacheTable(table: Table) {\n\t\tconst schema = table[Table.Symbol.Schema] ?? 'public';\n\t\tconst tableName = table[Table.Symbol.OriginalName];\n\t\tconst tableKey = `${schema}.${tableName}`;\n\n\t\tif (!this.cachedTables[tableKey]) {\n\t\t\tfor (const column of Object.values(table[Table.Symbol.Columns])) {\n\t\t\t\tconst columnKey = `${tableKey}.${column.name}`;\n\t\t\t\tthis.cache[columnKey] = this.convert(column.name);\n\t\t\t}\n\t\t\tthis.cachedTables[tableKey] = true;\n\t\t}\n\t}\n\n\tclearCache() {\n\t\tthis.cache = {};\n\t\tthis.cachedTables = {};\n\t}\n}\n"],"mappings":"AACA,SAAS,kBAAkB;AAC3B,SAAS,aAAa;AAGf,SAAS,YAAY,OAAe;AAC1C,QAAM,QAAQ,MACZ,QAAQ,cAAc,EAAE,EACxB,MAAM,yCAAyC,KAAK,CAAC;AAEvD,SAAO,MAAM,IAAI,CAAC,SAAS,KAAK,YAAY,CAAC,EAAE,KAAK,GAAG;AACxD;AAEO,SAAS,YAAY,OAAe;AAC1C,QAAM,QAAQ,MACZ,QAAQ,cAAc,EAAE,EACxB,MAAM,yCAAyC,KAAK,CAAC;AAEvD,SAAO,MAAM,OAAO,CAAC,KAAK,MAAM,MAAM;AACrC,UAAM,gBAAgB,MAAM,IAAI,KAAK,YAAY,IAAI,GAAG,KAAK,CAAC,EAAG,YAAY,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;AAC9F,WAAO,MAAM;AAAA,EACd,GAAG,EAAE;AACN;AAEA,SAAS,SAAS,OAAe;AAChC,SAAO;AACR;AAEO,MAAM,YAAY;AAAA,EACxB,QAAiB,UAAU,IAAY;AAAA;AAAA,EAGvC,QAAgC,CAAC;AAAA,EACzB,eAAqC,CAAC;AAAA,EACtC;AAAA,EAER,YAAY,QAAiB;AAC5B,SAAK,UAAU,WAAW,eACvB,cACA,WAAW,cACX,cACA;AAAA,EACJ;AAAA,EAEA,gBAAgB,QAAwB;AACvC,QAAI,CAAC,OAAO;AAAW,aAAO,OAAO;AAErC,UAAM,SAAS,OAAO,MAAM,MAAM,OAAO,MAAM,KAAK;AACpD,UAAM,YAAY,OAAO,MAAM,MAAM,OAAO,YAAY;AACxD,UAAM,MAAM,GAAG,MAAM,IAAI,SAAS,IAAI,OAAO,IAAI;AAEjD,QAAI,CAAC,KAAK,MAAM,GAAG,GAAG;AACrB,WAAK,WAAW,OAAO,KAAK;AAAA,IAC7B;AACA,WAAO,KAAK,MAAM,GAAG;AAAA,EACtB;AAAA,EAEQ,WAAW,OAAc;AAChC,UAAM,SAAS,MAAM,MAAM,OAAO,MAAM,KAAK;AAC7C,UAAM,YAAY,MAAM,MAAM,OAAO,YAAY;AACjD,UAAM,WAAW,GAAG,MAAM,IAAI,SAAS;AAEvC,QAAI,CAAC,KAAK,aAAa,QAAQ,GAAG;AACjC,iBAAW,UAAU,OAAO,OAAO,MAAM,MAAM,OAAO,OAAO,CAAC,GAAG;AAChE,cAAM,YAAY,GAAG,QAAQ,IAAI,OAAO,IAAI;AAC5C,aAAK,MAAM,SAAS,IAAI,KAAK,QAAQ,OAAO,IAAI;AAAA,MACjD;AACA,WAAK,aAAa,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD;AAAA,EAEA,aAAa;AACZ,SAAK,QAAQ,CAAC;AACd,SAAK,eAAe,CAAC;AAAA,EACtB;AACD;","names":[]}

131
node_modules/drizzle-orm/column-builder.cjs generated vendored Normal file
View File

@ -0,0 +1,131 @@
"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 column_builder_exports = {};
__export(column_builder_exports, {
ColumnBuilder: () => ColumnBuilder
});
module.exports = __toCommonJS(column_builder_exports);
var import_entity = require("./entity.cjs");
class ColumnBuilder {
static [import_entity.entityKind] = "ColumnBuilder";
config;
constructor(name, dataType, columnType) {
this.config = {
name,
keyAsName: name === "",
notNull: false,
default: void 0,
hasDefault: false,
primaryKey: false,
isUnique: false,
uniqueName: void 0,
uniqueType: void 0,
dataType,
columnType,
generated: void 0
};
}
/**
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
*
* @example
* ```ts
* const users = pgTable('users', {
* id: integer('id').$type<UserId>().primaryKey(),
* details: json('details').$type<UserDetails>().notNull(),
* });
* ```
*/
$type() {
return this;
}
/**
* Adds a `not null` clause to the column definition.
*
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
*/
notNull() {
this.config.notNull = true;
return this;
}
/**
* Adds a `default <value>` clause to the column definition.
*
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
*
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
*/
default(value) {
this.config.default = value;
this.config.hasDefault = true;
return this;
}
/**
* Adds a dynamic default value to the column.
* The function will be called when the row is inserted, and the returned value will be used as the column value.
*
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
*/
$defaultFn(fn) {
this.config.defaultFn = fn;
this.config.hasDefault = true;
return this;
}
/**
* Alias for {@link $defaultFn}.
*/
$default = this.$defaultFn;
/**
* Adds a dynamic update value to the column.
* The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
* If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
*
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
*/
$onUpdateFn(fn) {
this.config.onUpdateFn = fn;
this.config.hasDefault = true;
return this;
}
/**
* Alias for {@link $onUpdateFn}.
*/
$onUpdate = this.$onUpdateFn;
/**
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
*
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
*/
primaryKey() {
this.config.primaryKey = true;
this.config.notNull = true;
return this;
}
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
setName(name) {
if (this.config.name !== "")
return;
this.config.name = name;
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ColumnBuilder
});
//# sourceMappingURL=column-builder.cjs.map

1
node_modules/drizzle-orm/column-builder.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

241
node_modules/drizzle-orm/column-builder.d.cts generated vendored Normal file
View File

@ -0,0 +1,241 @@
import { entityKind } from "./entity.cjs";
import type { Column } from "./column.cjs";
import type { MySqlColumn } from "./mysql-core/index.cjs";
import type { ExtraConfigColumn, PgColumn, PgSequenceOptions } from "./pg-core/index.cjs";
import type { SingleStoreColumn } from "./singlestore-core/index.cjs";
import type { SQL } from "./sql/sql.cjs";
import type { SQLiteColumn } from "./sqlite-core/index.cjs";
import type { Assume, Simplify } from "./utils.cjs";
export type ColumnDataType = 'string' | 'number' | 'boolean' | 'array' | 'json' | 'date' | 'bigint' | 'custom' | 'buffer';
export type Dialect = 'pg' | 'mysql' | 'sqlite' | 'singlestore' | 'common';
export type GeneratedStorageMode = 'virtual' | 'stored';
export type GeneratedType = 'always' | 'byDefault';
export type GeneratedColumnConfig<TDataType> = {
as: TDataType | SQL | (() => SQL);
type?: GeneratedType;
mode?: GeneratedStorageMode;
};
export type GeneratedIdentityConfig = {
sequenceName?: string;
sequenceOptions?: PgSequenceOptions;
type: 'always' | 'byDefault';
};
export interface ColumnBuilderBaseConfig<TDataType extends ColumnDataType, TColumnType extends string> {
name: string;
dataType: TDataType;
columnType: TColumnType;
data: unknown;
driverParam: unknown;
enumValues: string[] | undefined;
}
export type MakeColumnConfig<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TTableName extends string, TData = T extends {
$type: infer U;
} ? U : T['data']> = {
name: T['name'];
tableName: TTableName;
dataType: T['dataType'];
columnType: T['columnType'];
data: TData;
driverParam: T['driverParam'];
notNull: T extends {
notNull: true;
} ? true : false;
hasDefault: T extends {
hasDefault: true;
} ? true : false;
isPrimaryKey: T extends {
isPrimaryKey: true;
} ? true : false;
isAutoincrement: T extends {
isAutoincrement: true;
} ? true : false;
hasRuntimeDefault: T extends {
hasRuntimeDefault: true;
} ? true : false;
enumValues: T['enumValues'];
baseColumn: T extends {
baseBuilder: infer U extends ColumnBuilderBase;
} ? BuildColumn<TTableName, U, 'common'> : never;
identity: T extends {
identity: 'always';
} ? 'always' : T extends {
identity: 'byDefault';
} ? 'byDefault' : undefined;
generated: T extends {
generated: infer G;
} ? unknown extends G ? undefined : G extends undefined ? undefined : G : undefined;
} & {};
export type ColumnBuilderTypeConfig<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> = Simplify<{
brand: 'ColumnBuilder';
name: T['name'];
dataType: T['dataType'];
columnType: T['columnType'];
data: T['data'];
driverParam: T['driverParam'];
notNull: T extends {
notNull: infer U;
} ? U : boolean;
hasDefault: T extends {
hasDefault: infer U;
} ? U : boolean;
enumValues: T['enumValues'];
identity: T extends {
identity: infer U;
} ? U : unknown;
generated: T extends {
generated: infer G;
} ? G extends undefined ? unknown : G : unknown;
} & TTypeConfig>;
export type ColumnBuilderRuntimeConfig<TData, TRuntimeConfig extends object = object> = {
name: string;
keyAsName: boolean;
notNull: boolean;
default: TData | SQL | undefined;
defaultFn: (() => TData | SQL) | undefined;
onUpdateFn: (() => TData | SQL) | undefined;
hasDefault: boolean;
primaryKey: boolean;
isUnique: boolean;
uniqueName: string | undefined;
uniqueType: string | undefined;
dataType: string;
columnType: string;
generated: GeneratedColumnConfig<TData> | undefined;
generatedIdentity: GeneratedIdentityConfig | undefined;
} & TRuntimeConfig;
export interface ColumnBuilderExtraConfig {
primaryKeyHasDefault?: boolean;
}
export type NotNull<T extends ColumnBuilderBase> = T & {
_: {
notNull: true;
};
};
export type HasDefault<T extends ColumnBuilderBase> = T & {
_: {
hasDefault: true;
};
};
export type IsPrimaryKey<T extends ColumnBuilderBase> = T & {
_: {
isPrimaryKey: true;
};
};
export type IsAutoincrement<T extends ColumnBuilderBase> = T & {
_: {
isAutoincrement: true;
};
};
export type HasRuntimeDefault<T extends ColumnBuilderBase> = T & {
_: {
hasRuntimeDefault: true;
};
};
export type $Type<T extends ColumnBuilderBase, TType> = T & {
_: {
$type: TType;
};
};
export type HasGenerated<T extends ColumnBuilderBase, TGenerated extends {} = {}> = T & {
_: {
hasDefault: true;
generated: TGenerated;
};
};
export type IsIdentity<T extends ColumnBuilderBase, TType extends 'always' | 'byDefault'> = T & {
_: {
notNull: true;
hasDefault: true;
identity: TType;
};
};
export interface ColumnBuilderBase<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> {
_: ColumnBuilderTypeConfig<T, TTypeConfig>;
}
export declare abstract class ColumnBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TTypeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> implements ColumnBuilderBase<T, TTypeConfig> {
static readonly [entityKind]: string;
_: ColumnBuilderTypeConfig<T, TTypeConfig>;
protected config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>;
constructor(name: T['name'], dataType: T['dataType'], columnType: T['columnType']);
/**
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
*
* @example
* ```ts
* const users = pgTable('users', {
* id: integer('id').$type<UserId>().primaryKey(),
* details: json('details').$type<UserDetails>().notNull(),
* });
* ```
*/
$type<TType>(): $Type<this, TType>;
/**
* Adds a `not null` clause to the column definition.
*
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
*/
notNull(): NotNull<this>;
/**
* Adds a `default <value>` clause to the column definition.
*
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
*
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
*/
default(value: (this['_'] extends {
$type: infer U;
} ? U : this['_']['data']) | SQL): HasDefault<this>;
/**
* Adds a dynamic default value to the column.
* The function will be called when the row is inserted, and the returned value will be used as the column value.
*
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
*/
$defaultFn(fn: () => (this['_'] extends {
$type: infer U;
} ? U : this['_']['data']) | SQL): HasRuntimeDefault<HasDefault<this>>;
/**
* Alias for {@link $defaultFn}.
*/
$default: (fn: () => (this["_"] extends {
$type: infer U;
} ? U : this["_"]["data"]) | SQL) => HasRuntimeDefault<HasDefault<this>>;
/**
* Adds a dynamic update value to the column.
* The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
* If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
*
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
*/
$onUpdateFn(fn: () => (this['_'] extends {
$type: infer U;
} ? U : this['_']['data']) | SQL): HasDefault<this>;
/**
* Alias for {@link $onUpdateFn}.
*/
$onUpdate: (fn: () => (this["_"] extends {
$type: infer U;
} ? U : this["_"]["data"]) | SQL) => HasDefault<this>;
/**
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
*
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
*/
primaryKey(): TExtraConfig['primaryKeyHasDefault'] extends true ? IsPrimaryKey<HasDefault<NotNull<this>>> : IsPrimaryKey<NotNull<this>>;
abstract generatedAlwaysAs(as: SQL | T['data'] | (() => SQL), config?: Partial<GeneratedColumnConfig<unknown>>): HasGenerated<this, {
type: 'always';
}>;
}
export type BuildColumn<TTableName extends string, TBuilder extends ColumnBuilderBase, TDialect extends Dialect> = TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TBuilder['_'], TTableName>, {}, Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>> : TDialect extends 'mysql' ? MySqlColumn<MakeColumnConfig<TBuilder['_'], TTableName>, {}, Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect' | 'primaryKeyHasDefault' | 'mysqlColumnBuilderBrand'>>> : TDialect extends 'sqlite' ? SQLiteColumn<MakeColumnConfig<TBuilder['_'], TTableName>, {}, Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>> : TDialect extends 'common' ? Column<MakeColumnConfig<TBuilder['_'], TTableName>, {}, Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>> : TDialect extends 'singlestore' ? SingleStoreColumn<MakeColumnConfig<TBuilder['_'], TTableName>, {}, Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect' | 'primaryKeyHasDefault' | 'singlestoreColumnBuilderBrand'>>> : never;
export type BuildIndexColumn<TDialect extends Dialect> = TDialect extends 'pg' ? ExtraConfigColumn : never;
export type BuildColumns<TTableName extends string, TConfigMap extends Record<string, ColumnBuilderBase>, TDialect extends Dialect> = {
[Key in keyof TConfigMap]: BuildColumn<TTableName, {
_: Omit<TConfigMap[Key]['_'], 'name'> & {
name: TConfigMap[Key]['_']['name'] extends '' ? Assume<Key, string> : TConfigMap[Key]['_']['name'];
};
}, TDialect>;
} & {};
export type BuildExtraConfigColumns<_TTableName extends string, TConfigMap extends Record<string, ColumnBuilderBase>, TDialect extends Dialect> = {
[Key in keyof TConfigMap]: BuildIndexColumn<TDialect>;
} & {};
export type ChangeColumnTableName<TColumn extends Column, TAlias extends string, TDialect extends Dialect> = TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TColumn['_'], TAlias>> : TDialect extends 'mysql' ? MySqlColumn<MakeColumnConfig<TColumn['_'], TAlias>> : TDialect extends 'singlestore' ? SingleStoreColumn<MakeColumnConfig<TColumn['_'], TAlias>> : TDialect extends 'sqlite' ? SQLiteColumn<MakeColumnConfig<TColumn['_'], TAlias>> : never;

Some files were not shown because too many files have changed in this diff Show More