CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
driver-core.cjs71 linesDownload Raw Back to libsql
1"use strict";2var __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7  for (var name in all)8    __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11  if (from && typeof from === "object" || typeof from === "function") {12    for (let key of __getOwnPropNames(from))13      if (!__hasOwnProp.call(to, key) && key !== except)14        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15  }16  return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var driver_core_exports = {};20__export(driver_core_exports, {21  LibSQLDatabase: () => LibSQLDatabase,22  construct: () => construct23});24module.exports = __toCommonJS(driver_core_exports);25var import_entity = require("../entity.cjs");26var import_logger = require("../logger.cjs");27var import_relations = require("../relations.cjs");28var import_db = require("../sqlite-core/db.cjs");29var import_dialect = require("../sqlite-core/dialect.cjs");30var import_session = require("./session.cjs");31class LibSQLDatabase extends import_db.BaseSQLiteDatabase {32  static [import_entity.entityKind] = "LibSQLDatabase";33  async batch(batch) {34    return this.session.batch(batch);35  }36}37function construct(client, config = {}) {38  const dialect = new import_dialect.SQLiteAsyncDialect({ casing: config.casing });39  let logger;40  if (config.logger === true) {41    logger = new import_logger.DefaultLogger();42  } else if (config.logger !== false) {43    logger = config.logger;44  }45  let schema;46  if (config.schema) {47    const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(48      config.schema,49      import_relations.createTableRelationsHelpers50    );51    schema = {52      fullSchema: config.schema,53      schema: tablesConfig.tables,54      tableNamesMap: tablesConfig.tableNamesMap55    };56  }57  const session = new import_session.LibSQLSession(client, dialect, schema, { logger, cache: config.cache }, void 0);58  const db = new LibSQLDatabase("async", dialect, session, schema);59  db.$client = client;60  db.$cache = config.cache;61  if (db.$cache) {62    db.$cache["invalidate"] = config.cache?.onMutate;63  }64  return db;65}66// Annotate the CommonJS export names for ESM import in node:670 && (module.exports = {68  LibSQLDatabase,69  construct70});71//# sourceMappingURL=driver-core.cjs.map