AK-21/Graphite-Industrial-Intelligence
0
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 table_exports = {};20__export(table_exports, {21 InlineForeignKeys: () => InlineForeignKeys,22 SQLiteTable: () => SQLiteTable,23 sqliteTable: () => sqliteTable,24 sqliteTableCreator: () => sqliteTableCreator25});26module.exports = __toCommonJS(table_exports);27var import_entity = require("../entity.cjs");28var import_table = require("../table.cjs");29var import_all = require("./columns/all.cjs");30const InlineForeignKeys = Symbol.for("drizzle:SQLiteInlineForeignKeys");31class SQLiteTable extends import_table.Table {32 static [import_entity.entityKind] = "SQLiteTable";33 /** @internal */34 static Symbol = Object.assign({}, import_table.Table.Symbol, {35 InlineForeignKeys36 });37 /** @internal */38 [import_table.Table.Symbol.Columns];39 /** @internal */40 [InlineForeignKeys] = [];41 /** @internal */42 [import_table.Table.Symbol.ExtraConfigBuilder] = void 0;43}44function sqliteTableBase(name, columns, extraConfig, schema, baseName = name) {45 const rawTable = new SQLiteTable(name, schema, baseName);46 const parsedColumns = typeof columns === "function" ? columns((0, import_all.getSQLiteColumnBuilders)()) : columns;47 const builtColumns = Object.fromEntries(48 Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {49 const colBuilder = colBuilderBase;50 colBuilder.setName(name2);51 const column = colBuilder.build(rawTable);52 rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));53 return [name2, column];54 })55 );56 const table = Object.assign(rawTable, builtColumns);57 table[import_table.Table.Symbol.Columns] = builtColumns;58 table[import_table.Table.Symbol.ExtraConfigColumns] = builtColumns;59 if (extraConfig) {60 table[SQLiteTable.Symbol.ExtraConfigBuilder] = extraConfig;61 }62 return table;63}64const sqliteTable = (name, columns, extraConfig) => {65 return sqliteTableBase(name, columns, extraConfig);66};67function sqliteTableCreator(customizeTableName) {68 return (name, columns, extraConfig) => {69 return sqliteTableBase(customizeTableName(name), columns, extraConfig, void 0, name);70 };71}72// Annotate the CommonJS export names for ESM import in node:730 && (module.exports = {74 InlineForeignKeys,75 SQLiteTable,76 sqliteTable,77 sqliteTableCreator78});79//# sourceMappingURL=table.cjs.map