| Latest version | 1.0.0 |
|---|---|
| Minimum Core | 13 |
| Compatible Core | 13 |
| Last updated | 1 year ago |
| Created | 1 year ago |
| Authors |
|
| Languages |
English |
| Systems | All systems |
| Project source | Project URL |
| Read-me | Readme URL |
Library module to allow the use of compendiums as generic data storage
If no pack is provied all data will be stored within world.data-storage pack.
/**
* Store provided data as a document within a compendium
* Name, thumb, tags, type, and desc are index fields
* Data is the payload to be stored as a document
* Index will also be stored as part of the document as a separate field for recovery purposes in-case the META/Index document is deleted
* @param {object} [options]
* @param {string} [options.name] Name
* @param {string} [options.thumb] Thumbnail image
* @param {Array[string]} [options.tags] Array of tags
* @param {string} [options.type] Data type
* @param {string} [options.desc] Data description
* @param {object} [options.data] Data to be stored
* @param {object} [options.pack] The pack the data is to be stored in
* @returns
*/
async DataStorage.store(options = {})
Examples:
await DataStorage.store({name: "TEST", data: { text: "Hello World!" }, tags: ["test"]});
await DataStorage.store({name: "TMFX Graph", type: "graph", data: {nodes: ["node_1", "node_2"], mockup: true }, tags: ["tmfx", "graph"]});
/** * Retrieves entries matching the criteria * @param {object} options * @param {string} [options.uuid] UUID of the underlying Entry document * @param {string} [options.name] Entry name * @param {string|Array[string]} [options.types] Entry type/s * @param {Array[string]} [options.tags] Tags * @param {string} [options.query] Search query consisting of: * Space separated terms e.g. "red car" * Types e.g. "@tmfx-node" * Tags e.g. "#light #source" * Negative match e.g. "-red -#light" * Combination of all of the above e.g. "car -red @node #player" * @param {boolean} [options.matchAnyTag] Should any or all tags be present within an entry for a match * @param {boolean} [options.load] If 'true' all entries will have their documents loaded before being returned * @param {boolean} [options.data] If 'true' array of all matched data will be returned instead of entries * @param {Array[Entry]} [options.entries] If provided the search will be carried out on this array * @returns {Array[Entry]|Array[object]} */ async DataStorage.retrieve({ uuid, name, types, query, tags, matchAnyTag = true, load = false, data = false, entries } = {})
Examples:
await DataStorage.retrieve({name: 'tree'});
await DataStorage.retrieve({tags: ['tmfx', 'filter'], data: true});
await DataStorage.retrieve({query: 'red #light'});
A simple data browser is provided which can be accessed via the module settings or DataStorage.browser()
To install this package, open your Foundry Setup screen and navigate to your Module tab and click the Install Module button.
From there, you can either search for the package unique name: data-storage or copy its manifest URL:
And paste it to the input box at the bottom of your window.

You can install this package directly to your Forge account.