Files
discord-decomp/_bundle/EntityDao.js
T
2026-11-01 12:12:55 +02:00

120 lines
3.2 KiB
JavaScript

// Metro module 1918 (f1919).
import { Table, TableTransaction } from "./TableTransaction";
import { ConflictOptions } from "./Module1914";
class EntityDao {
constructor(a0, a1, a2, r8 = true) {
this.originalPrefix = a0;
this.table = new Table([a0], a1, a2, r8);
}
get prefix() {
return this.table.prefix;
}
withoutLogging() {
const originalPrefix = this.originalPrefix;
const tableId = this.table.tableId;
const database = this.table.database;
const r17 = {
__proto__: EntityDao.prototype
};
r17.originalPrefix = originalPrefix;
r17.table = new Table([originalPrefix], tableId, database, false);
return r17;
}
get(a0) {
return this.table.get([a0]);
}
getMany(a0) {
return this.table.getMany([], a0);
}
getRange(a0, a1, a2) {
return this.table.getRange([a0], [a1], a2);
}
getKvEntries() {
return this.table.getKvEntries();
}
getMapEntries() {
return this.table.getMapEntries();
}
getIds() {
return this.table.getChildIds([]);
}
getParentId(a0) {
return this.table.getParentId([null, a0]);
}
put(c13327_0, r8 = ConflictOptions.Replace) {
const Replace = r8;
return this.transaction((a0) => a0.put(c13327_0, Replace), `${this.prefix} put`);
}
putAll(c13328_0, r8 = ConflictOptions.Replace) {
const Replace2 = r8;
return this.transaction((a0) => a0.putAll(c13328_0, Replace2), `${this.prefix} putAll`);
}
replaceAll(c13329_0) {
return this.transaction((a0) => a0.replaceAll(c13329_0), `${this.prefix} replaceAll`);
}
delete(c13330_0) {
return this.transaction((a0) => a0.delete(c13330_0), `${this.prefix} delete`);
}
transaction(c13331_0, a1) {
return this.table.transaction((a0) => {
const r10 = {
__proto__: EntityDaoTransaction.prototype
};
r10.transaction = a0;
return c13331_0(r10);
}, a1);
}
upgradeTransaction(a0) {
const transaction2 = this.table.upgradeTransaction(a0);
const r11 = {
__proto__: EntityDaoTransaction.prototype
};
r11.transaction = transaction2;
return r11;
}
getManySyncUnsafe(a0) {
return this.table.getManySyncUnsafe([], a0);
}
getMapEntriesSyncUnsafe() {
return this.table.getMapEntriesSyncUnsafe();
}
static cell(a0, a1) {
return {
key: [a0.id],
data: a0,
generation: a1
};
}
}
class EntityDaoTransaction {
constructor(a0) {
this.transaction = a0;
}
static fromDatabaseTransaction(a0, a1, a2) {
const tableTransaction = new TableTransaction(a0, a1, a2);
const r20 = {
__proto__: EntityDaoTransaction.prototype
};
r20.transaction = tableTransaction;
return r20;
}
put(a0, r4 = ConflictOptions.Replace) {
return this.transaction.put(EntityDao.cell(a0, null), r4);
}
putAll(a0, r4 = ConflictOptions.Replace) {
return this.transaction.putAll(a0.map((item) => EntityDao.cell(item, null)), r4);
}
replaceAll(a0) {
this.delete();
this.putAll(a0);
}
delete(a0) {
return arguments.length === 0 ? this.transaction.delete([]) : this.transaction.delete([a0]);
}
deleteAllExcept(a0) {
this.transaction.deleteAllExcept([], a0);
}
}
export { EntityDao };
export { EntityDaoTransaction };