PHP 7.4.33
Preview: driver.js Size: 2.00 KB
/var/www/gtechmarathon2026.bitkit.dk/httpdocs/node_modules/drizzle-orm/vercel-postgres/driver.js
import { sql } from "@vercel/postgres";
import { entityKind } from "../entity.js";
import { DefaultLogger } from "../logger.js";
import { PgDatabase } from "../pg-core/db.js";
import { PgDialect } from "../pg-core/index.js";
import {
  createTableRelationsHelpers,
  extractTablesRelationalConfig
} from "../relations.js";
import { isConfig } from "../utils.js";
import { VercelPgSession } from "./session.js";
class VercelPgDriver {
  constructor(client, dialect, options = {}) {
    this.client = client;
    this.dialect = dialect;
    this.options = options;
  }
  static [entityKind] = "VercelPgDriver";
  createSession(schema) {
    return new VercelPgSession(this.client, this.dialect, schema, { logger: this.options.logger });
  }
}
class VercelPgDatabase extends PgDatabase {
  static [entityKind] = "VercelPgDatabase";
}
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 driver = new VercelPgDriver(client, dialect, { logger });
  const session = driver.createSession(schema);
  const db = new VercelPgDatabase(dialect, session, schema);
  db.$client = client;
  return db;
}
function drizzle(...params) {
  if (isConfig(params[0])) {
    const { client, ...drizzleConfig } = params[0];
    return construct(client ?? sql, drizzleConfig);
  }
  return construct(params[0] ?? sql, params[1]);
}
((drizzle2) => {
  function mock(config) {
    return construct({}, config);
  }
  drizzle2.mock = mock;
})(drizzle || (drizzle = {}));
export {
  VercelPgDatabase,
  VercelPgDriver,
  drizzle
};
//# sourceMappingURL=driver.js.map

Directory Contents

Dirs: 0 × Files: 24
Name Size Perms Modified Actions
3.20 KB lrw-r--r-- 2025-07-10 12:54:57
Edit Download
4.83 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.69 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.68 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
2.00 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
4.83 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.22 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
229 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
61 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
59 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
92 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
190 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
1.26 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
693 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
255 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
253 B lrw-r--r-- 2025-07-10 12:55:00
Edit Download
259 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
654 B lrw-r--r-- 2025-07-10 12:54:59
Edit Download
7.09 KB lrw-r--r-- 2025-07-10 12:54:58
Edit Download
11.86 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
3.24 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
3.23 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
5.59 KB lrw-r--r-- 2025-07-10 12:54:59
Edit Download
11.85 KB lrw-r--r-- 2025-07-10 12:55:00
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).