UNPKG

epps

Version:

Enhances Pinia stores with advanced features such as persistence, encryption, and store extension. Simplifies state management and ensures data security for Vue.js and Nuxt applications.

27 lines (26 loc) 938 B
import Crypt from "../services/Crypt"; import Persister from "../services/Persister"; import type { AllowedKeyPath } from "../types/storage"; import type { PiniaPlugin, PiniaPluginContext, StateTree } from "pinia"; import type { PersistedStore } from "../types/store"; export interface EppsConstructorProps { dbName: string; dbKeyPath?: AllowedKeyPath; cryptKey?: string; cryptIv?: string; } export declare class Epps { private _db; private _crypt?; private _watchedStore; get db(): Persister; get crypt(): Crypt | undefined; constructor(db: Persister, crypt?: Crypt); plugin(context: PiniaPluginContext): void; rewriteResetStore({ store }: PiniaPluginContext, initState: StateTree): void; } export declare function createPlugin(dbName: string, cryptIv?: string, cryptKey?: string): PiniaPlugin; declare module 'pinia' { interface PiniaCustomProperties extends PersistedStore { } }