Initial commit

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

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

@ -0,0 +1,119 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var common_exports = {};
__export(common_exports, {
getValueFromDataApi: () => getValueFromDataApi,
toValueParam: () => toValueParam,
typingsToAwsTypeHint: () => typingsToAwsTypeHint
});
module.exports = __toCommonJS(common_exports);
var import_client_rds_data = require("@aws-sdk/client-rds-data");
function getValueFromDataApi(field) {
if (field.stringValue !== void 0) {
return field.stringValue;
} else if (field.booleanValue !== void 0) {
return field.booleanValue;
} else if (field.doubleValue !== void 0) {
return field.doubleValue;
} else if (field.isNull !== void 0) {
return null;
} else if (field.longValue !== void 0) {
return field.longValue;
} else if (field.blobValue !== void 0) {
return field.blobValue;
} else if (field.arrayValue !== void 0) {
if (field.arrayValue.stringValues !== void 0) {
return field.arrayValue.stringValues;
}
if (field.arrayValue.longValues !== void 0) {
return field.arrayValue.longValues;
}
if (field.arrayValue.doubleValues !== void 0) {
return field.arrayValue.doubleValues;
}
if (field.arrayValue.booleanValues !== void 0) {
return field.arrayValue.booleanValues;
}
if (field.arrayValue.arrayValues !== void 0) {
return field.arrayValue.arrayValues;
}
throw new Error("Unknown array type");
} else {
throw new Error("Unknown type");
}
}
function typingsToAwsTypeHint(typings) {
if (typings === "date") {
return import_client_rds_data.TypeHint.DATE;
} else if (typings === "decimal") {
return import_client_rds_data.TypeHint.DECIMAL;
} else if (typings === "json") {
return import_client_rds_data.TypeHint.JSON;
} else if (typings === "time") {
return import_client_rds_data.TypeHint.TIME;
} else if (typings === "timestamp") {
return import_client_rds_data.TypeHint.TIMESTAMP;
} else if (typings === "uuid") {
return import_client_rds_data.TypeHint.UUID;
} else {
return void 0;
}
}
function toValueParam(value, typings) {
const response = {
value: {},
typeHint: typingsToAwsTypeHint(typings)
};
if (value === null) {
response.value = { isNull: true };
} else if (typeof value === "string") {
switch (response.typeHint) {
case import_client_rds_data.TypeHint.DATE: {
response.value = { stringValue: value.split("T")[0] };
break;
}
case import_client_rds_data.TypeHint.TIMESTAMP: {
response.value = { stringValue: value.replace("T", " ").replace("Z", "") };
break;
}
default: {
response.value = { stringValue: value };
break;
}
}
} else if (typeof value === "number" && Number.isInteger(value)) {
response.value = { longValue: value };
} else if (typeof value === "number" && !Number.isInteger(value)) {
response.value = { doubleValue: value };
} else if (typeof value === "boolean") {
response.value = { booleanValue: value };
} else if (value instanceof Date) {
response.value = { stringValue: value.toISOString().replace("T", " ").replace("Z", "") };
} else {
throw new Error(`Unknown type for ${value}`);
}
return response;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getValueFromDataApi,
toValueParam,
typingsToAwsTypeHint
});
//# sourceMappingURL=index.cjs.map

File diff suppressed because one or more lines are too long

View File

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

View File

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

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

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

File diff suppressed because one or more lines are too long

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

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

File diff suppressed because one or more lines are too long

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

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

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

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

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

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

File diff suppressed because one or more lines are too long

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

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

View File

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

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

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

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

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

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

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

View File

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

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

@ -0,0 +1,33 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var migrator_exports = {};
__export(migrator_exports, {
migrate: () => migrate
});
module.exports = __toCommonJS(migrator_exports);
var import_migrator = require("../../migrator.cjs");
async function migrate(db, config) {
const migrations = (0, import_migrator.readMigrationFiles)(config);
await db.dialect.migrate(migrations, db.session, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
migrate
});
//# sourceMappingURL=migrator.cjs.map

View File

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

View File

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

View File

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

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

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

View File

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

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

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

File diff suppressed because one or more lines are too long

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

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

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

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

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

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

File diff suppressed because one or more lines are too long