Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
44
node_modules/drizzle-orm/README.md
generated
vendored
Normal file
44
node_modules/drizzle-orm/README.md
generated
vendored
Normal 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
144
node_modules/drizzle-orm/alias.cjs
generated
vendored
Normal 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
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
31
node_modules/drizzle-orm/alias.d.cts
generated
vendored
Normal 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 | View>(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
31
node_modules/drizzle-orm/alias.d.ts
generated
vendored
Normal 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 | View>(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
113
node_modules/drizzle-orm/alias.js
generated
vendored
Normal 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
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
119
node_modules/drizzle-orm/aws-data-api/common/index.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/common/index.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/common/index.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
9
node_modules/drizzle-orm/aws-data-api/common/index.d.cts
generated
vendored
Normal file
9
node_modules/drizzle-orm/aws-data-api/common/index.d.cts
generated
vendored
Normal 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;
|
||||
};
|
||||
9
node_modules/drizzle-orm/aws-data-api/common/index.d.ts
generated
vendored
Normal file
9
node_modules/drizzle-orm/aws-data-api/common/index.d.ts
generated
vendored
Normal 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
93
node_modules/drizzle-orm/aws-data-api/common/index.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/common/index.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/common/index.js.map
generated
vendored
Normal file
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
122
node_modules/drizzle-orm/aws-data-api/pg/driver.cjs
generated
vendored
Normal 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 || params[0].constructor.name !== "Object") {
|
||||
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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/driver.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/driver.cjs.map
generated
vendored
Normal file
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
48
node_modules/drizzle-orm/aws-data-api/pg/driver.d.cts
generated
vendored
Normal 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
48
node_modules/drizzle-orm/aws-data-api/pg/driver.d.ts
generated
vendored
Normal 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
99
node_modules/drizzle-orm/aws-data-api/pg/driver.js
generated
vendored
Normal 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 || params[0].constructor.name !== "Object") {
|
||||
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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/driver.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/driver.js.map
generated
vendored
Normal file
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
25
node_modules/drizzle-orm/aws-data-api/pg/index.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/index.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/index.cjs.map
generated
vendored
Normal 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
2
node_modules/drizzle-orm/aws-data-api/pg/index.d.cts
generated
vendored
Normal 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
2
node_modules/drizzle-orm/aws-data-api/pg/index.d.ts
generated
vendored
Normal 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
3
node_modules/drizzle-orm/aws-data-api/pg/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./driver.js";
|
||||
export * from "./session.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/index.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/index.js.map
generated
vendored
Normal 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
33
node_modules/drizzle-orm/aws-data-api/pg/migrator.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/migrator.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/migrator.cjs.map
generated
vendored
Normal 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":[]}
|
||||
3
node_modules/drizzle-orm/aws-data-api/pg/migrator.d.cts
generated
vendored
Normal file
3
node_modules/drizzle-orm/aws-data-api/pg/migrator.d.cts
generated
vendored
Normal 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>;
|
||||
3
node_modules/drizzle-orm/aws-data-api/pg/migrator.d.ts
generated
vendored
Normal file
3
node_modules/drizzle-orm/aws-data-api/pg/migrator.d.ts
generated
vendored
Normal 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
9
node_modules/drizzle-orm/aws-data-api/pg/migrator.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/migrator.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/migrator.js.map
generated
vendored
Normal 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
207
node_modules/drizzle-orm/aws-data-api/pg/session.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/session.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/session.cjs.map
generated
vendored
Normal file
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
60
node_modules/drizzle-orm/aws-data-api/pg/session.d.cts
generated
vendored
Normal 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
60
node_modules/drizzle-orm/aws-data-api/pg/session.d.ts
generated
vendored
Normal 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
190
node_modules/drizzle-orm/aws-data-api/pg/session.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/aws-data-api/pg/session.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/aws-data-api/pg/session.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/drizzle-orm/batch.cjs
generated
vendored
Normal file
17
node_modules/drizzle-orm/batch.cjs
generated
vendored
Normal 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
1
node_modules/drizzle-orm/batch.cjs.map
generated
vendored
Normal 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
6
node_modules/drizzle-orm/batch.d.cts
generated
vendored
Normal 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
6
node_modules/drizzle-orm/batch.d.ts
generated
vendored
Normal 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
1
node_modules/drizzle-orm/batch.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
//# sourceMappingURL=batch.js.map
|
||||
1
node_modules/drizzle-orm/batch.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/batch.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
||||
101
node_modules/drizzle-orm/better-sqlite3/driver.cjs
generated
vendored
Normal file
101
node_modules/drizzle-orm/better-sqlite3/driver.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/better-sqlite3/driver.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/driver.cjs.map
generated
vendored
Normal file
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
29
node_modules/drizzle-orm/better-sqlite3/driver.d.cts
generated
vendored
Normal 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
29
node_modules/drizzle-orm/better-sqlite3/driver.d.ts
generated
vendored
Normal 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
69
node_modules/drizzle-orm/better-sqlite3/driver.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/better-sqlite3/driver.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/driver.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
node_modules/drizzle-orm/better-sqlite3/index.cjs
generated
vendored
Normal file
25
node_modules/drizzle-orm/better-sqlite3/index.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/better-sqlite3/index.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/index.cjs.map
generated
vendored
Normal 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
2
node_modules/drizzle-orm/better-sqlite3/index.d.cts
generated
vendored
Normal 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
2
node_modules/drizzle-orm/better-sqlite3/index.d.ts
generated
vendored
Normal 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
3
node_modules/drizzle-orm/better-sqlite3/index.js
generated
vendored
Normal 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
1
node_modules/drizzle-orm/better-sqlite3/index.js.map
generated
vendored
Normal 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
33
node_modules/drizzle-orm/better-sqlite3/migrator.cjs
generated
vendored
Normal 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/better-sqlite3/migrator.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/migrator.cjs.map
generated
vendored
Normal 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":[]}
|
||||
3
node_modules/drizzle-orm/better-sqlite3/migrator.d.cts
generated
vendored
Normal file
3
node_modules/drizzle-orm/better-sqlite3/migrator.d.cts
generated
vendored
Normal 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;
|
||||
3
node_modules/drizzle-orm/better-sqlite3/migrator.d.ts
generated
vendored
Normal file
3
node_modules/drizzle-orm/better-sqlite3/migrator.d.ts
generated
vendored
Normal 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
9
node_modules/drizzle-orm/better-sqlite3/migrator.js
generated
vendored
Normal 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/better-sqlite3/migrator.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/migrator.js.map
generated
vendored
Normal 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
135
node_modules/drizzle-orm/better-sqlite3/session.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/better-sqlite3/session.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/session.cjs.map
generated
vendored
Normal file
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
47
node_modules/drizzle-orm/better-sqlite3/session.d.cts
generated
vendored
Normal 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
47
node_modules/drizzle-orm/better-sqlite3/session.d.ts
generated
vendored
Normal 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
112
node_modules/drizzle-orm/better-sqlite3/session.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/better-sqlite3/session.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/better-sqlite3/session.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
96
node_modules/drizzle-orm/bun-sql/driver.cjs
generated
vendored
Normal file
96
node_modules/drizzle-orm/bun-sql/driver.cjs
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"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, {
|
||||
BunSQLDatabase: () => BunSQLDatabase,
|
||||
drizzle: () => drizzle
|
||||
});
|
||||
module.exports = __toCommonJS(driver_exports);
|
||||
var import_bun = require("bun");
|
||||
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_relations = require("../relations.cjs");
|
||||
var import_utils = require("../utils.cjs");
|
||||
var import_session = require("./session.cjs");
|
||||
class BunSQLDatabase extends import_db.PgDatabase {
|
||||
static [import_entity.entityKind] = "BunSQLDatabase";
|
||||
}
|
||||
function construct(client, config = {}) {
|
||||
const dialect = new import_dialect.PgDialect({ 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.BunSQLSession(client, dialect, schema, { logger });
|
||||
const db = new BunSQLDatabase(dialect, session, schema);
|
||||
db.$client = client;
|
||||
return db;
|
||||
}
|
||||
function drizzle(...params) {
|
||||
if (typeof params[0] === "string") {
|
||||
const instance = new import_bun.SQL(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" && connection.url !== void 0) {
|
||||
const { url, ...config } = connection;
|
||||
const instance2 = new import_bun.SQL({ url, ...config });
|
||||
return construct(instance2, drizzleConfig);
|
||||
}
|
||||
const instance = new import_bun.SQL(connection);
|
||||
return construct(instance, drizzleConfig);
|
||||
}
|
||||
return construct(params[0], params[1]);
|
||||
}
|
||||
((drizzle2) => {
|
||||
function mock(config) {
|
||||
return construct({
|
||||
options: {
|
||||
parsers: {},
|
||||
serializers: {}
|
||||
}
|
||||
}, config);
|
||||
}
|
||||
drizzle2.mock = mock;
|
||||
})(drizzle || (drizzle = {}));
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BunSQLDatabase,
|
||||
drizzle
|
||||
});
|
||||
//# sourceMappingURL=driver.cjs.map
|
||||
1
node_modules/drizzle-orm/bun-sql/driver.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/driver.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
30
node_modules/drizzle-orm/bun-sql/driver.d.cts
generated
vendored
Normal file
30
node_modules/drizzle-orm/bun-sql/driver.d.cts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { SQLOptions } from 'bun';
|
||||
import { SQL } from 'bun';
|
||||
import { entityKind } from "../entity.cjs";
|
||||
import { PgDatabase } from "../pg-core/db.cjs";
|
||||
import { type DrizzleConfig } from "../utils.cjs";
|
||||
import type { BunSQLQueryResultHKT } from "./session.cjs";
|
||||
export declare class BunSQLDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<BunSQLQueryResultHKT, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
}
|
||||
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends SQL = SQL>(...params: [
|
||||
TClient | string
|
||||
] | [
|
||||
TClient | string,
|
||||
DrizzleConfig<TSchema>
|
||||
] | [
|
||||
(DrizzleConfig<TSchema> & ({
|
||||
connection: string | ({
|
||||
url?: string;
|
||||
} & SQLOptions);
|
||||
} | {
|
||||
client: TClient;
|
||||
}))
|
||||
]): BunSQLDatabase<TSchema> & {
|
||||
$client: TClient;
|
||||
};
|
||||
export declare namespace drizzle {
|
||||
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BunSQLDatabase<TSchema> & {
|
||||
$client: '$client is not available on drizzle.mock()';
|
||||
};
|
||||
}
|
||||
30
node_modules/drizzle-orm/bun-sql/driver.d.ts
generated
vendored
Normal file
30
node_modules/drizzle-orm/bun-sql/driver.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { SQLOptions } from 'bun';
|
||||
import { SQL } from 'bun';
|
||||
import { entityKind } from "../entity.js";
|
||||
import { PgDatabase } from "../pg-core/db.js";
|
||||
import { type DrizzleConfig } from "../utils.js";
|
||||
import type { BunSQLQueryResultHKT } from "./session.js";
|
||||
export declare class BunSQLDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends PgDatabase<BunSQLQueryResultHKT, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
}
|
||||
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends SQL = SQL>(...params: [
|
||||
TClient | string
|
||||
] | [
|
||||
TClient | string,
|
||||
DrizzleConfig<TSchema>
|
||||
] | [
|
||||
(DrizzleConfig<TSchema> & ({
|
||||
connection: string | ({
|
||||
url?: string;
|
||||
} & SQLOptions);
|
||||
} | {
|
||||
client: TClient;
|
||||
}))
|
||||
]): BunSQLDatabase<TSchema> & {
|
||||
$client: TClient;
|
||||
};
|
||||
export declare namespace drizzle {
|
||||
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): BunSQLDatabase<TSchema> & {
|
||||
$client: '$client is not available on drizzle.mock()';
|
||||
};
|
||||
}
|
||||
74
node_modules/drizzle-orm/bun-sql/driver.js
generated
vendored
Normal file
74
node_modules/drizzle-orm/bun-sql/driver.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import { SQL } from "bun";
|
||||
import { entityKind } from "../entity.js";
|
||||
import { DefaultLogger } from "../logger.js";
|
||||
import { PgDatabase } from "../pg-core/db.js";
|
||||
import { PgDialect } from "../pg-core/dialect.js";
|
||||
import {
|
||||
createTableRelationsHelpers,
|
||||
extractTablesRelationalConfig
|
||||
} from "../relations.js";
|
||||
import { isConfig } from "../utils.js";
|
||||
import { BunSQLSession } from "./session.js";
|
||||
class BunSQLDatabase extends PgDatabase {
|
||||
static [entityKind] = "BunSQLDatabase";
|
||||
}
|
||||
function construct(client, config = {}) {
|
||||
const dialect = new PgDialect({ 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 BunSQLSession(client, dialect, schema, { logger });
|
||||
const db = new BunSQLDatabase(dialect, session, schema);
|
||||
db.$client = client;
|
||||
return db;
|
||||
}
|
||||
function drizzle(...params) {
|
||||
if (typeof params[0] === "string") {
|
||||
const instance = new SQL(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" && connection.url !== void 0) {
|
||||
const { url, ...config } = connection;
|
||||
const instance2 = new SQL({ url, ...config });
|
||||
return construct(instance2, drizzleConfig);
|
||||
}
|
||||
const instance = new SQL(connection);
|
||||
return construct(instance, drizzleConfig);
|
||||
}
|
||||
return construct(params[0], params[1]);
|
||||
}
|
||||
((drizzle2) => {
|
||||
function mock(config) {
|
||||
return construct({
|
||||
options: {
|
||||
parsers: {},
|
||||
serializers: {}
|
||||
}
|
||||
}, config);
|
||||
}
|
||||
drizzle2.mock = mock;
|
||||
})(drizzle || (drizzle = {}));
|
||||
export {
|
||||
BunSQLDatabase,
|
||||
drizzle
|
||||
};
|
||||
//# sourceMappingURL=driver.js.map
|
||||
1
node_modules/drizzle-orm/bun-sql/driver.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/driver.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
node_modules/drizzle-orm/bun-sql/index.cjs
generated
vendored
Normal file
25
node_modules/drizzle-orm/bun-sql/index.cjs
generated
vendored
Normal 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_sql_exports = {};
|
||||
module.exports = __toCommonJS(bun_sql_exports);
|
||||
__reExport(bun_sql_exports, require("./driver.cjs"), module.exports);
|
||||
__reExport(bun_sql_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-sql/index.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/index.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/bun-sql/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,wBAAd;AACA,4BAAc,yBADd;","names":[]}
|
||||
2
node_modules/drizzle-orm/bun-sql/index.d.cts
generated
vendored
Normal file
2
node_modules/drizzle-orm/bun-sql/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./driver.cjs";
|
||||
export * from "./session.cjs";
|
||||
2
node_modules/drizzle-orm/bun-sql/index.d.ts
generated
vendored
Normal file
2
node_modules/drizzle-orm/bun-sql/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./driver.js";
|
||||
export * from "./session.js";
|
||||
3
node_modules/drizzle-orm/bun-sql/index.js
generated
vendored
Normal file
3
node_modules/drizzle-orm/bun-sql/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./driver.js";
|
||||
export * from "./session.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/drizzle-orm/bun-sql/index.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/bun-sql/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
||||
33
node_modules/drizzle-orm/bun-sql/migrator.cjs
generated
vendored
Normal file
33
node_modules/drizzle-orm/bun-sql/migrator.cjs
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/bun-sql/migrator.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/migrator.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/bun-sql/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BunSQLDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BunSQLDatabase<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":[]}
|
||||
3
node_modules/drizzle-orm/bun-sql/migrator.d.cts
generated
vendored
Normal file
3
node_modules/drizzle-orm/bun-sql/migrator.d.cts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { MigrationConfig } from "../migrator.cjs";
|
||||
import type { BunSQLDatabase } from "./driver.cjs";
|
||||
export declare function migrate<TSchema extends Record<string, unknown>>(db: BunSQLDatabase<TSchema>, config: MigrationConfig): Promise<void>;
|
||||
3
node_modules/drizzle-orm/bun-sql/migrator.d.ts
generated
vendored
Normal file
3
node_modules/drizzle-orm/bun-sql/migrator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { MigrationConfig } from "../migrator.js";
|
||||
import type { BunSQLDatabase } from "./driver.js";
|
||||
export declare function migrate<TSchema extends Record<string, unknown>>(db: BunSQLDatabase<TSchema>, config: MigrationConfig): Promise<void>;
|
||||
9
node_modules/drizzle-orm/bun-sql/migrator.js
generated
vendored
Normal file
9
node_modules/drizzle-orm/bun-sql/migrator.js
generated
vendored
Normal 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
|
||||
1
node_modules/drizzle-orm/bun-sql/migrator.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/migrator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/bun-sql/migrator.ts"],"sourcesContent":["import type { MigrationConfig } from '~/migrator.ts';\nimport { readMigrationFiles } from '~/migrator.ts';\nimport type { BunSQLDatabase } from './driver.ts';\n\nexport async function migrate<TSchema extends Record<string, unknown>>(\n\tdb: BunSQLDatabase<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":[]}
|
||||
162
node_modules/drizzle-orm/bun-sql/session.cjs
generated
vendored
Normal file
162
node_modules/drizzle-orm/bun-sql/session.cjs
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"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, {
|
||||
BunSQLPreparedQuery: () => BunSQLPreparedQuery,
|
||||
BunSQLSession: () => BunSQLSession,
|
||||
BunSQLTransaction: () => BunSQLTransaction
|
||||
});
|
||||
module.exports = __toCommonJS(session_exports);
|
||||
var import_entity = require("../entity.cjs");
|
||||
var import_logger = require("../logger.cjs");
|
||||
var import_pg_core = require("../pg-core/index.cjs");
|
||||
var import_session = require("../pg-core/session.cjs");
|
||||
var import_sql = require("../sql/sql.cjs");
|
||||
var import_tracing = require("../tracing.cjs");
|
||||
var import_utils = require("../utils.cjs");
|
||||
class BunSQLPreparedQuery extends import_session.PgPreparedQuery {
|
||||
constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper) {
|
||||
super({ sql: queryString, params });
|
||||
this.client = client;
|
||||
this.queryString = queryString;
|
||||
this.params = params;
|
||||
this.logger = logger;
|
||||
this.fields = fields;
|
||||
this._isResponseInArrayMode = _isResponseInArrayMode;
|
||||
this.customResultMapper = customResultMapper;
|
||||
}
|
||||
static [import_entity.entityKind] = "BunSQLPreparedQuery";
|
||||
async execute(placeholderValues = {}) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.execute", async (span) => {
|
||||
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
|
||||
if (!fields && !customResultMapper) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
return client.unsafe(query, params);
|
||||
});
|
||||
}
|
||||
const rows = await import_tracing.tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.unsafe(query, params).values();
|
||||
});
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.mapResponse", () => {
|
||||
return customResultMapper ? customResultMapper(rows) : rows.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
|
||||
});
|
||||
});
|
||||
}
|
||||
all(placeholderValues = {}) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.execute", async (span) => {
|
||||
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return this.client.unsafe(this.queryString, params);
|
||||
});
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
isResponseInArrayMode() {
|
||||
return this._isResponseInArrayMode;
|
||||
}
|
||||
}
|
||||
class BunSQLSession extends import_session.PgSession {
|
||||
constructor(client, dialect, schema, options = {}) {
|
||||
super(dialect);
|
||||
this.client = client;
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.logger = options.logger ?? new import_logger.NoopLogger();
|
||||
}
|
||||
static [import_entity.entityKind] = "BunSQLSession";
|
||||
logger;
|
||||
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper) {
|
||||
return new BunSQLPreparedQuery(
|
||||
this.client,
|
||||
query.sql,
|
||||
query.params,
|
||||
this.logger,
|
||||
fields,
|
||||
isResponseInArrayMode,
|
||||
customResultMapper
|
||||
);
|
||||
}
|
||||
query(query, params) {
|
||||
this.logger.logQuery(query, params);
|
||||
return this.client.unsafe(query, params).values();
|
||||
}
|
||||
queryObjects(query, params) {
|
||||
return this.client.unsafe(query, params);
|
||||
}
|
||||
transaction(transaction, config) {
|
||||
return this.client.begin(async (client) => {
|
||||
const session = new BunSQLSession(
|
||||
client,
|
||||
this.dialect,
|
||||
this.schema,
|
||||
this.options
|
||||
);
|
||||
const tx = new BunSQLTransaction(this.dialect, session, this.schema);
|
||||
if (config) {
|
||||
await tx.setTransaction(config);
|
||||
}
|
||||
return transaction(tx);
|
||||
});
|
||||
}
|
||||
}
|
||||
class BunSQLTransaction extends import_pg_core.PgTransaction {
|
||||
constructor(dialect, session, schema, nestedIndex = 0) {
|
||||
super(dialect, session, schema, nestedIndex);
|
||||
this.session = session;
|
||||
}
|
||||
static [import_entity.entityKind] = "BunSQLTransaction";
|
||||
transaction(transaction) {
|
||||
return this.session.client.savepoint((client) => {
|
||||
const session = new BunSQLSession(
|
||||
client,
|
||||
this.dialect,
|
||||
this.schema,
|
||||
this.session.options
|
||||
);
|
||||
const tx = new BunSQLTransaction(this.dialect, session, this.schema);
|
||||
return transaction(tx);
|
||||
});
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
BunSQLPreparedQuery,
|
||||
BunSQLSession,
|
||||
BunSQLTransaction
|
||||
});
|
||||
//# sourceMappingURL=session.cjs.map
|
||||
1
node_modules/drizzle-orm/bun-sql/session.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/session.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
50
node_modules/drizzle-orm/bun-sql/session.d.cts
generated
vendored
Normal file
50
node_modules/drizzle-orm/bun-sql/session.d.cts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { SavepointSQL, SQL, TransactionSQL } from 'bun';
|
||||
import { entityKind } from "../entity.cjs";
|
||||
import type { Logger } from "../logger.cjs";
|
||||
import type { PgDialect } from "../pg-core/dialect.cjs";
|
||||
import { PgTransaction } from "../pg-core/index.cjs";
|
||||
import type { SelectedFieldsOrdered } from "../pg-core/query-builders/select.types.cjs";
|
||||
import type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from "../pg-core/session.cjs";
|
||||
import { PgPreparedQuery, PgSession } from "../pg-core/session.cjs";
|
||||
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
|
||||
import { type Query } from "../sql/sql.cjs";
|
||||
import { type Assume } from "../utils.cjs";
|
||||
export declare class BunSQLPreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {
|
||||
private client;
|
||||
private queryString;
|
||||
private params;
|
||||
private logger;
|
||||
private fields;
|
||||
private _isResponseInArrayMode;
|
||||
private customResultMapper?;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: SQL, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | 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']>;
|
||||
}
|
||||
export interface BunSQLSessionOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class BunSQLSession<TSQL extends SQL, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<BunSQLQueryResultHKT, TFullSchema, TSchema> {
|
||||
client: TSQL;
|
||||
private schema;
|
||||
static readonly [entityKind]: string;
|
||||
logger: Logger;
|
||||
constructor(client: TSQL, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined,
|
||||
/** @internal */
|
||||
options?: BunSQLSessionOptions);
|
||||
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute']): PgPreparedQuery<T>;
|
||||
query(query: string, params: unknown[]): Promise<any>;
|
||||
queryObjects(query: string, params: unknown[]): Promise<any>;
|
||||
transaction<T>(transaction: (tx: BunSQLTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
||||
}
|
||||
export declare class BunSQLTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<BunSQLQueryResultHKT, TFullSchema, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
constructor(dialect: PgDialect,
|
||||
/** @internal */
|
||||
session: BunSQLSession<TransactionSQL | SavepointSQL, TFullSchema, TSchema>, schema: RelationalSchemaConfig<TSchema> | undefined, nestedIndex?: number);
|
||||
transaction<T>(transaction: (tx: BunSQLTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
}
|
||||
export interface BunSQLQueryResultHKT extends PgQueryResultHKT {
|
||||
type: Assume<this['row'], Record<string, any>[]>;
|
||||
}
|
||||
50
node_modules/drizzle-orm/bun-sql/session.d.ts
generated
vendored
Normal file
50
node_modules/drizzle-orm/bun-sql/session.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { SavepointSQL, SQL, TransactionSQL } from 'bun';
|
||||
import { entityKind } from "../entity.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
import type { PgDialect } from "../pg-core/dialect.js";
|
||||
import { PgTransaction } from "../pg-core/index.js";
|
||||
import type { SelectedFieldsOrdered } from "../pg-core/query-builders/select.types.js";
|
||||
import type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from "../pg-core/session.js";
|
||||
import { PgPreparedQuery, PgSession } from "../pg-core/session.js";
|
||||
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
|
||||
import { type Query } from "../sql/sql.js";
|
||||
import { type Assume } from "../utils.js";
|
||||
export declare class BunSQLPreparedQuery<T extends PreparedQueryConfig> extends PgPreparedQuery<T> {
|
||||
private client;
|
||||
private queryString;
|
||||
private params;
|
||||
private logger;
|
||||
private fields;
|
||||
private _isResponseInArrayMode;
|
||||
private customResultMapper?;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: SQL, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | 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']>;
|
||||
}
|
||||
export interface BunSQLSessionOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class BunSQLSession<TSQL extends SQL, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<BunSQLQueryResultHKT, TFullSchema, TSchema> {
|
||||
client: TSQL;
|
||||
private schema;
|
||||
static readonly [entityKind]: string;
|
||||
logger: Logger;
|
||||
constructor(client: TSQL, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined,
|
||||
/** @internal */
|
||||
options?: BunSQLSessionOptions);
|
||||
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute']): PgPreparedQuery<T>;
|
||||
query(query: string, params: unknown[]): Promise<any>;
|
||||
queryObjects(query: string, params: unknown[]): Promise<any>;
|
||||
transaction<T>(transaction: (tx: BunSQLTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
||||
}
|
||||
export declare class BunSQLTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<BunSQLQueryResultHKT, TFullSchema, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
constructor(dialect: PgDialect,
|
||||
/** @internal */
|
||||
session: BunSQLSession<TransactionSQL | SavepointSQL, TFullSchema, TSchema>, schema: RelationalSchemaConfig<TSchema> | undefined, nestedIndex?: number);
|
||||
transaction<T>(transaction: (tx: BunSQLTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
}
|
||||
export interface BunSQLQueryResultHKT extends PgQueryResultHKT {
|
||||
type: Assume<this['row'], Record<string, any>[]>;
|
||||
}
|
||||
136
node_modules/drizzle-orm/bun-sql/session.js
generated
vendored
Normal file
136
node_modules/drizzle-orm/bun-sql/session.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
import { entityKind } from "../entity.js";
|
||||
import { NoopLogger } from "../logger.js";
|
||||
import { PgTransaction } from "../pg-core/index.js";
|
||||
import { PgPreparedQuery, PgSession } from "../pg-core/session.js";
|
||||
import { fillPlaceholders } from "../sql/sql.js";
|
||||
import { tracer } from "../tracing.js";
|
||||
import { mapResultRow } from "../utils.js";
|
||||
class BunSQLPreparedQuery extends PgPreparedQuery {
|
||||
constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper) {
|
||||
super({ sql: queryString, params });
|
||||
this.client = client;
|
||||
this.queryString = queryString;
|
||||
this.params = params;
|
||||
this.logger = logger;
|
||||
this.fields = fields;
|
||||
this._isResponseInArrayMode = _isResponseInArrayMode;
|
||||
this.customResultMapper = customResultMapper;
|
||||
}
|
||||
static [entityKind] = "BunSQLPreparedQuery";
|
||||
async execute(placeholderValues = {}) {
|
||||
return tracer.startActiveSpan("drizzle.execute", async (span) => {
|
||||
const params = fillPlaceholders(this.params, placeholderValues);
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
|
||||
if (!fields && !customResultMapper) {
|
||||
return tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
return client.unsafe(query, params);
|
||||
});
|
||||
}
|
||||
const rows = await tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.unsafe(query, params).values();
|
||||
});
|
||||
return tracer.startActiveSpan("drizzle.mapResponse", () => {
|
||||
return customResultMapper ? customResultMapper(rows) : rows.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
||||
});
|
||||
});
|
||||
}
|
||||
all(placeholderValues = {}) {
|
||||
return tracer.startActiveSpan("drizzle.execute", async (span) => {
|
||||
const params = fillPlaceholders(this.params, placeholderValues);
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
return tracer.startActiveSpan("drizzle.driver.execute", () => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return this.client.unsafe(this.queryString, params);
|
||||
});
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
isResponseInArrayMode() {
|
||||
return this._isResponseInArrayMode;
|
||||
}
|
||||
}
|
||||
class BunSQLSession extends PgSession {
|
||||
constructor(client, dialect, schema, options = {}) {
|
||||
super(dialect);
|
||||
this.client = client;
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.logger = options.logger ?? new NoopLogger();
|
||||
}
|
||||
static [entityKind] = "BunSQLSession";
|
||||
logger;
|
||||
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper) {
|
||||
return new BunSQLPreparedQuery(
|
||||
this.client,
|
||||
query.sql,
|
||||
query.params,
|
||||
this.logger,
|
||||
fields,
|
||||
isResponseInArrayMode,
|
||||
customResultMapper
|
||||
);
|
||||
}
|
||||
query(query, params) {
|
||||
this.logger.logQuery(query, params);
|
||||
return this.client.unsafe(query, params).values();
|
||||
}
|
||||
queryObjects(query, params) {
|
||||
return this.client.unsafe(query, params);
|
||||
}
|
||||
transaction(transaction, config) {
|
||||
return this.client.begin(async (client) => {
|
||||
const session = new BunSQLSession(
|
||||
client,
|
||||
this.dialect,
|
||||
this.schema,
|
||||
this.options
|
||||
);
|
||||
const tx = new BunSQLTransaction(this.dialect, session, this.schema);
|
||||
if (config) {
|
||||
await tx.setTransaction(config);
|
||||
}
|
||||
return transaction(tx);
|
||||
});
|
||||
}
|
||||
}
|
||||
class BunSQLTransaction extends PgTransaction {
|
||||
constructor(dialect, session, schema, nestedIndex = 0) {
|
||||
super(dialect, session, schema, nestedIndex);
|
||||
this.session = session;
|
||||
}
|
||||
static [entityKind] = "BunSQLTransaction";
|
||||
transaction(transaction) {
|
||||
return this.session.client.savepoint((client) => {
|
||||
const session = new BunSQLSession(
|
||||
client,
|
||||
this.dialect,
|
||||
this.schema,
|
||||
this.session.options
|
||||
);
|
||||
const tx = new BunSQLTransaction(this.dialect, session, this.schema);
|
||||
return transaction(tx);
|
||||
});
|
||||
}
|
||||
}
|
||||
export {
|
||||
BunSQLPreparedQuery,
|
||||
BunSQLSession,
|
||||
BunSQLTransaction
|
||||
};
|
||||
//# sourceMappingURL=session.js.map
|
||||
1
node_modules/drizzle-orm/bun-sql/session.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/bun-sql/session.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
92
node_modules/drizzle-orm/bun-sqlite/driver.cjs
generated
vendored
Normal file
92
node_modules/drizzle-orm/bun-sqlite/driver.cjs
generated
vendored
Normal 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
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
50
node_modules/drizzle-orm/bun-sqlite/driver.d.cts
generated
vendored
Normal 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
50
node_modules/drizzle-orm/bun-sqlite/driver.d.ts
generated
vendored
Normal 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
70
node_modules/drizzle-orm/bun-sqlite/driver.js
generated
vendored
Normal 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
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
25
node_modules/drizzle-orm/bun-sqlite/index.cjs
generated
vendored
Normal 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
1
node_modules/drizzle-orm/bun-sqlite/index.cjs.map
generated
vendored
Normal 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
2
node_modules/drizzle-orm/bun-sqlite/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./driver.cjs";
|
||||
export * from "./session.cjs";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user