{"version":3,"file":"index.js","sources":["../../src/MockStorage.ts","../../src/SimplePromiseQueue.ts","../../src/utils.ts","../../src/index.ts"],"sourcesContent":["/**\n * Created by championswimmer on 22/07/17.\n */\nlet MockStorage: typeof Storage | undefined\n\n// @ts-ignore\nif (process.env.MODULE_FORMAT !== 'umd') {\n MockStorage = class implements Storage {\n [index: number]: string;\n [key: string]: any;\n\n public get length(): number {\n return Object.keys(this).length\n }\n\n public key(index: number): string | any {\n return Object.keys(this)[index]\n }\n\n public setItem(key: string, data: any): void {\n this[key] = data.toString()\n }\n public getItem(key: string): string {\n return this[key]\n }\n public removeItem(key: string): void {\n delete this[key]\n }\n public clear(): void {\n for (let key of Object.keys(this)) {\n delete this[key]\n }\n }\n }\n}\n\nexport { MockStorage }\n","// tslint:disable: variable-name\nexport default class SimplePromiseQueue {\n private readonly _queue: Array> = []\n private _flushing = false\n\n public enqueue(promise: Promise) {\n this._queue.push(promise)\n if (!this._flushing) { return this.flushQueue() }\n return Promise.resolve()\n }\n\n private flushQueue() {\n this._flushing = true\n\n const chain = (): Promise | void => {\n const nextTask = this._queue.shift()\n if (nextTask) {\n return nextTask.then(chain)\n } else {\n this._flushing = false\n }\n }\n return Promise.resolve(chain())\n }\n}\n","import deepmerge from 'deepmerge'\n\nexport type MergeOptionType = 'replaceArrays' | 'concatArrays'\n\nconst options: {[k in MergeOptionType]: deepmerge.Options} = {\n replaceArrays: {\n arrayMerge: (destinationArray, sourceArray, options) => sourceArray\n },\n concatArrays: {\n arrayMerge: (target, source, options) => target.concat(...source)\n }\n}\n\nconst defaultMergeOptions: deepmerge.Options = {\n // replacing arrays\n \n}\n\nexport function merge(into: Partial, from: Partial, mergeOption: MergeOptionType): I & F & {} {\n return deepmerge(into, from, options[mergeOption])\n}\n","/**\n * Created by championswimmer on 18/07/17.\n */\nimport { Mutation, MutationPayload, Payload, Plugin, Store } from 'vuex'\nimport { AsyncStorage } from './AsyncStorage'\nimport { MockStorage } from './MockStorage'\nimport { PersistOptions } from './PersistOptions'\nimport SimplePromiseQueue from './SimplePromiseQueue'\nimport { merge, MergeOptionType } from './utils'\n\nlet FlattedJSON = JSON\n\n/**\n * A class that implements the vuex persistence.\n * @type S type of the 'state' inside the store (default: any)\n */\nexport class VuexPersistence implements PersistOptions {\n public asyncStorage: boolean\n public storage: Storage | AsyncStorage | undefined\n public restoreState: (key: string, storage?: AsyncStorage | Storage) => Promise | S\n public saveState: (key: string, state: {}, storage?: AsyncStorage | Storage) => Promise | void\n public reducer: (state: S) => Partial\n public key: string\n public filter: (mutation: Payload) => boolean\n public modules: string[]\n public strictMode: boolean\n public supportCircular: boolean\n public mergeOption: MergeOptionType\n\n /**\n * The plugin function that can be used inside a vuex store.\n */\n public plugin: Plugin\n /**\n * A mutation that can be used to restore state\n * Helpful if we are running in strict mode\n */\n public RESTORE_MUTATION: Mutation\n public subscribed: boolean\n\n // tslint:disable-next-line:variable-name\n private _mutex = new SimplePromiseQueue()\n\n /**\n * Create a {@link VuexPersistence} object.\n * Use the plugin function of this class as a\n * Vuex plugin.\n * @param {PersistOptions} options\n */\n public constructor(options?: PersistOptions) {\n if (typeof options === 'undefined') options = {} as PersistOptions\n this.key = ((options.key != null) ? options.key : 'vuex')\n\n this.subscribed = false\n this.supportCircular = options.supportCircular || false\n if (this.supportCircular) {\n FlattedJSON = require('flatted')\n }\n this.mergeOption = options.mergeOption || 'replaceArrays'\n\n let localStorageLitmus = true\n\n try {\n window.localStorage.getItem('')\n } catch (err) {\n localStorageLitmus = false\n }\n\n /**\n * 1. First, prefer storage sent in optinos\n * 2. Otherwise, use window.localStorage if available\n * 3. Finally, try to use MockStorage\n * 4. None of above? Well we gotta fail.\n */\n if (options.storage) { this.storage = options.storage }\n else if (localStorageLitmus) { this.storage = window.localStorage }\n else if (MockStorage) { this.storage = new MockStorage() }\n else { throw new Error(\"Neither 'window' is defined, nor 'MockStorage' is available\") }\n\n /**\n * How this works is -\n * 1. If there is options.reducer function, we use that, if not;\n * 2. We check options.modules;\n * 1. If there is no options.modules array, we use entire state in reducer\n * 2. Otherwise, we create a reducer that merges all those state modules that are\n * defined in the options.modules[] array\n * @type {((state: S) => {}) | ((state: S) => S) | ((state: any) => {})}\n */\n this.reducer = (\n (options.reducer != null)\n ? options.reducer\n : (\n (options.modules == null)\n ? ((state: S) => state)\n : (\n (state: any) =>\n (options!.modules as string[]).reduce((a, i) =>\n merge(a, { [i]: state[i] }, this.mergeOption), {/* start empty accumulator*/ })\n )\n )\n )\n\n this.filter = options.filter || ((mutation) => true)\n\n this.strictMode = options.strictMode || false\n\n this.RESTORE_MUTATION = function RESTORE_MUTATION(state: S, savedState: any) {\n const mergedState = merge(state, savedState || {}, this.mergeOption)\n for (const propertyName of Object.keys(mergedState as {})) {\n (this as any)._vm.$set(state, propertyName, (mergedState as any)[propertyName])\n }\n }\n\n this.asyncStorage = options.asyncStorage || false\n\n if (this.asyncStorage) {\n\n /**\n * Async {@link #VuexPersistence.restoreState} implementation\n * @type {((key: string, storage?: Storage) =>\n * (Promise | S)) | ((key: string, storage: AsyncStorage) => Promise)}\n */\n this.restoreState = (\n (options.restoreState != null)\n ? options.restoreState\n : ((key: string, storage: AsyncStorage) =>\n (storage).getItem(key)\n .then((value) =>\n typeof value === 'string' // If string, parse, or else, just return\n ? (\n this.supportCircular\n ? FlattedJSON.parse(value || '{}')\n : JSON.parse(value || '{}')\n )\n : (value || {})\n )\n )\n )\n\n /**\n * Async {@link #VuexPersistence.saveState} implementation\n * @type {((key: string, state: {}, storage?: Storage) =>\n * (Promise | void)) | ((key: string, state: {}, storage?: Storage) => Promise)}\n */\n this.saveState = (\n (options.saveState != null)\n ? options.saveState\n : ((key: string, state: {}, storage: AsyncStorage) =>\n (storage).setItem(\n key, // Second argument is state _object_ if asyc storage, stringified otherwise\n // do not stringify the state if the storage type is async\n (this.asyncStorage\n ? merge({}, state || {}, this.mergeOption)\n : (\n this.supportCircular\n ? FlattedJSON.stringify(state) as any\n : JSON.stringify(state) as any\n )\n )\n )\n )\n )\n\n /**\n * Async version of plugin\n * @param {Store} store\n */\n this.plugin = (store: Store) => {\n /**\n * For async stores, we're capturing the Promise returned\n * by the `restoreState()` function in a `restored` property\n * on the store itself. This would allow app developers to\n * determine when and if the store's state has indeed been\n * refreshed. This approach was suggested by GitHub user @hotdogee.\n * See https://github.com/championswimmer/vuex-persist/pull/118#issuecomment-500914963\n * @since 2.1.0\n */\n (store as any).restored = ((this.restoreState(this.key, this.storage)) as Promise).then((savedState) => {\n /**\n * If in strict mode, do only via mutation\n */\n if (this.strictMode) {\n store.commit('RESTORE_MUTATION', savedState)\n } else {\n store.replaceState(merge(store.state, savedState || {}, this.mergeOption) as S)\n }\n this.subscriber(store)((mutation: MutationPayload, state: S) => {\n if (this.filter(mutation)) {\n this._mutex.enqueue(\n this.saveState(this.key, this.reducer(state), this.storage) as Promise\n )\n }\n })\n this.subscribed = true\n })\n }\n } else {\n\n /**\n * Sync {@link #VuexPersistence.restoreState} implementation\n * @type {((key: string, storage?: Storage) =>\n * (Promise | S)) | ((key: string, storage: Storage) => (any | string | {}))}\n */\n this.restoreState = (\n (options.restoreState != null)\n ? options.restoreState\n : ((key: string, storage: Storage) => {\n const value = (storage).getItem(key)\n if (typeof value === 'string') {// If string, parse, or else, just return\n return (\n this.supportCircular\n ? FlattedJSON.parse(value || '{}')\n : JSON.parse(value || '{}')\n )\n } else {\n return (value || {})\n }\n })\n )\n\n /**\n * Sync {@link #VuexPersistence.saveState} implementation\n * @type {((key: string, state: {}, storage?: Storage) =>\n * (Promise | void)) | ((key: string, state: {}, storage?: Storage) => Promise)}\n */\n this.saveState = (\n (options.saveState != null)\n ? options.saveState\n : ((key: string, state: {}, storage: Storage) =>\n (storage).setItem(\n key, // Second argument is state _object_ if localforage, stringified otherwise\n (\n this.supportCircular\n ? FlattedJSON.stringify(state) as any\n : JSON.stringify(state) as any\n )\n )\n )\n )\n\n /**\n * Sync version of plugin\n * @param {Store} store\n */\n this.plugin = (store: Store) => {\n const savedState = this.restoreState(this.key, this.storage) as S\n\n if (this.strictMode) {\n store.commit('RESTORE_MUTATION', savedState)\n } else {\n store.replaceState(merge(store.state, savedState || {}, this.mergeOption) as S)\n }\n\n this.subscriber(store)((mutation: MutationPayload, state: S) => {\n if (this.filter(mutation)) {\n this.saveState(this.key, this.reducer(state), this.storage)\n }\n })\n\n this.subscribed = true\n }\n }\n }\n\n /**\n * Creates a subscriber on the store. automatically is used\n * when this is used a vuex plugin. Not for manual usage.\n * @param store\n */\n private subscriber = (store: Store) =>\n (handler: (mutation: MutationPayload, state: S) => any) => store.subscribe(handler)\n}\n\nexport {\n MockStorage, AsyncStorage, PersistOptions\n}\n\nexport default VuexPersistence\n"],"names":[],"mappings":";;AAAA;;;AAGA,IAAI,WAAuC,CAAA;;AAG3C,AAAyC;IACvC,WAAW,GAAG;QAIZ,IAAW,MAAM;YACf,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAA;SAChC;QAEM,GAAG,CAAC,KAAa;YACtB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAA;SAChC;QAEM,OAAO,CAAC,GAAW,EAAE,IAAS;YACnC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;SAC5B;QACM,OAAO,CAAC,GAAW;YACxB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;SACjB;QACM,UAAU,CAAC,GAAW;YAC3B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;SACjB;QACM,KAAK;YACV,KAAK,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;aACjB;SACF;KACF,CAAA;CACF;;AClCD;AACA,MAAqB,kBAAkB;IAAvC;QACmB,WAAM,GAAyB,EAAE,CAAA;QAC1C,cAAS,GAAG,KAAK,CAAA;KAqB1B;IAnBQ,OAAO,CAAC,OAAsB;QAC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