| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/dev.wowchat.co_01012026/node_modules/drizzle-orm/xata-http/ |
Upload File : |
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 { XataHttpSession } from "./session.js";
class XataHttpDriver {
constructor(client, dialect, options = {}) {
this.client = client;
this.dialect = dialect;
this.options = options;
this.initMappers();
}
static [entityKind] = "XataDriver";
createSession(schema) {
return new XataHttpSession(this.client, this.dialect, schema, {
logger: this.options.logger
});
}
initMappers() {
}
}
class XataHttpDatabase extends PgDatabase {
static [entityKind] = "XataHttpDatabase";
}
function drizzle(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 driver = new XataHttpDriver(client, dialect, { logger });
const session = driver.createSession(schema);
const db = new XataHttpDatabase(
dialect,
session,
schema
);
db.$client = client;
return db;
}
export {
XataHttpDatabase,
XataHttpDriver,
drizzle
};
//# sourceMappingURL=driver.js.map