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 primary_keys_exports = {};20__export(primary_keys_exports, {21 PrimaryKey: () => PrimaryKey,22 PrimaryKeyBuilder: () => PrimaryKeyBuilder,23 primaryKey: () => primaryKey24});25module.exports = __toCommonJS(primary_keys_exports);26var import_entity = require("../entity.cjs");27var import_table = require("./table.cjs");28function primaryKey(...config) {29 if (config[0].columns) {30 return new PrimaryKeyBuilder(config[0].columns, config[0].name);31 }32 return new PrimaryKeyBuilder(config);33}34class PrimaryKeyBuilder {35 static [import_entity.entityKind] = "SQLitePrimaryKeyBuilder";36 /** @internal */37 columns;38 /** @internal */39 name;40 constructor(columns, name) {41 this.columns = columns;42 this.name = name;43 }44 /** @internal */45 build(table) {46 return new PrimaryKey(table, this.columns, this.name);47 }48}49class PrimaryKey {50 constructor(table, columns, name) {51 this.table = table;52 this.columns = columns;53 this.name = name;54 }55 static [import_entity.entityKind] = "SQLitePrimaryKey";56 columns;57 name;58 getName() {59 return this.name ?? `${this.table[import_table.SQLiteTable.Symbol.Name]}_${this.columns.map((column) => column.name).join("_")}_pk`;60 }61}62// Annotate the CommonJS export names for ESM import in node:630 && (module.exports = {64 PrimaryKey,65 PrimaryKeyBuilder,66 primaryKey67});68//# sourceMappingURL=primary-keys.cjs.map