Files
Foundry-VTT-Docker/resources/app/dist/database/backend/compendium-folder.mjs
2025-01-04 00:34:03 +01:00

1 line
937 B
JavaScript

export default function ServerCompendiumFolderMixin(e){return class extends db.Folder{static _compendium=e;static{Object.defineProperty(this,"_db",{get:()=>e._db})}static get collectionName(){return"folders"}static get sublevel(){return this._db.sublevels.folders}get compendium(){return this.constructor._compendium}static metadata=(()=>foundry.utils.mergeObject(super.metadata,{permissions:{create:this.#e.bind(this),update:this.#e.bind(this),delete:this.#e.bind(this)}},{inplace:!1}))();static async getMany(e,t={}){const i=[];for(let o of e)i.push(await this._compendium.getFolder(o,t));return i}static fromSource(e,t={}){return t.pack=this._compendium.collectionName,super.fromSource(e,t)}static#e(e,t,i){if(((game.compendiumConfiguration||{})[t.pack]||{}).locked??"world"!==t.compendium.package.type)throw new Error(`You may not modify the ${t.pack} Compendium which is currently locked.`);return db.packs.get(t.pack).isOwner(e)}}}