import { DataStoreEngine, type DataStoreData, type DataStoreEngineDSOptions, type SerializableVal } from "@sv443-network/coreutils"; /** Options for the {@linkcode GMStorageEngine} class */ export type GMStorageEngineOptions = { /** * Specifies the necessary options for storing data. * - ⚠️ Only specify this if you are using this instance standalone! The parent DataStore will set this automatically. */ dataStoreOptions?: DataStoreEngineDSOptions; }; /** * Storage engine for the {@linkcode DataStore} class that uses GreaseMonkey's `GM.getValue` and `GM.setValue` functions. * * - ⚠️ Requires the grants `GM.getValue`, `GM.setValue`, `GM.deleteValue`, and `GM.listValues` in your userscript metadata. * - ⚠️ Don't reuse engine instances, always create a new one for each {@linkcode DataStore} instance. */ export declare class GMStorageEngine extends DataStoreEngine { protected options: GMStorageEngineOptions; /** * Creates an instance of `GMStorageEngine`. * * - ⚠️ Requires the grants `GM.getValue`, `GM.setValue`, `GM.deleteValue`, and `GM.listValues` in your userscript metadata. * - ⚠️ Don't reuse engine instances, always create a new one for each {@linkcode DataStore} instance. */ constructor(options?: GMStorageEngineOptions); /** Fetches a value from persistent storage */ getValue(name: string, defaultValue: TValue): Promise; /** Sets a value in persistent storage */ setValue(name: string, value: TValue): Promise; /** Deletes a value from persistent storage */ deleteValue(name: string): Promise; /** Deletes all values from GM storage. Use with caution! */ deleteStorage(): Promise; }