diff --git a/dist/index.cjs.js b/dist/index.cjs.js index 4da77c5a..70b79a49 100644 --- a/dist/index.cjs.js +++ b/dist/index.cjs.js @@ -17,6 +17,7 @@ var pathToProp = _interopDefault(require('path-to-prop')); var compareAnything = require('compare-anything'); var findAndReplaceAnything = require('find-and-replace-anything'); var filter = _interopDefault(require('filter-anything')); +var firebase$2 = _interopDefault(require('firebase/compat')); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -2986,7 +2987,7 @@ function pluginActions (firestoreConfig) { .set(initialDocPrepared) .then(function () { if (state._conf.logging) { - var message = 'Initial doc succesfully inserted'; + var message = 'Initial doc successfully inserted'; console.log("%c [vuex-easy-firestore] " + message + "; for Firestore PATH: " + getters.firestorePathComplete + " [" + state._conf.firestorePath + "]", 'color: SeaGreen'); } resolve(true); @@ -3926,7 +3927,7 @@ function pluginActions (firestoreConfig) { return storeUpdateFn(ids); }, _stopPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -3935,7 +3936,7 @@ function pluginActions (firestoreConfig) { }, 300); }, _startPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -3944,6 +3945,7 @@ function pluginActions (firestoreConfig) { }; } +var FieldValue = firebase$2.firestore.FieldValue; /** * A function returning the getters object * @@ -4062,11 +4064,11 @@ function pluginGetters (firebase) { id = getters.docModeId; cleanedPath = path; } - cleanedPatchData[cleanedPath] = firebase.firestore.FieldValue.delete(); + cleanedPatchData[cleanedPath] = FieldValue.delete(); cleanedPatchData.id = id; return _a = {}, _a[id] = cleanedPatchData, _a; }; }, - prepareForInsert: function (state, getters, rootState, rootGetters) { return function (items) { + prepareForInsert: function (state, getters) { return function (items) { if (items === void 0) { items = []; } // add fillable and guard defaults return items.reduce(function (carry, item) { diff --git a/dist/index.esm.js b/dist/index.esm.js index cfd7fcc5..c668d034 100644 --- a/dist/index.esm.js +++ b/dist/index.esm.js @@ -10,6 +10,7 @@ import pathToProp from 'path-to-prop'; import { compareObjectProps } from 'compare-anything'; import { findAndReplace, findAndReplaceIf } from 'find-and-replace-anything'; import filter from 'filter-anything'; +import firebase$2 from 'firebase/compat'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. @@ -2979,7 +2980,7 @@ function pluginActions (firestoreConfig) { .set(initialDocPrepared) .then(function () { if (state._conf.logging) { - var message = 'Initial doc succesfully inserted'; + var message = 'Initial doc successfully inserted'; console.log("%c [vuex-easy-firestore] " + message + "; for Firestore PATH: " + getters.firestorePathComplete + " [" + state._conf.firestorePath + "]", 'color: SeaGreen'); } resolve(true); @@ -3919,7 +3920,7 @@ function pluginActions (firestoreConfig) { return storeUpdateFn(ids); }, _stopPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -3928,7 +3929,7 @@ function pluginActions (firestoreConfig) { }, 300); }, _startPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -3937,6 +3938,7 @@ function pluginActions (firestoreConfig) { }; } +var FieldValue = firebase$2.firestore.FieldValue; /** * A function returning the getters object * @@ -4055,11 +4057,11 @@ function pluginGetters (firebase) { id = getters.docModeId; cleanedPath = path; } - cleanedPatchData[cleanedPath] = firebase.firestore.FieldValue.delete(); + cleanedPatchData[cleanedPath] = FieldValue.delete(); cleanedPatchData.id = id; return _a = {}, _a[id] = cleanedPatchData, _a; }; }, - prepareForInsert: function (state, getters, rootState, rootGetters) { return function (items) { + prepareForInsert: function (state, getters) { return function (items) { if (items === void 0) { items = []; } // add fillable and guard defaults return items.reduce(function (carry, item) { diff --git a/src/module/actions.ts b/src/module/actions.ts index 345266f1..d0dc9172 100644 --- a/src/module/actions.ts +++ b/src/module/actions.ts @@ -180,7 +180,7 @@ export default function (firestoreConfig: FirestoreConfig): AnyObject { .set(initialDocPrepared) .then(() => { if (state._conf.logging) { - const message = 'Initial doc succesfully inserted' + const message = 'Initial doc successfully inserted' console.log( `%c [vuex-easy-firestore] ${message}; for Firestore PATH: ${getters.firestorePathComplete} [${state._conf.firestorePath}]`, 'color: SeaGreen' @@ -1150,7 +1150,7 @@ export default function (firestoreConfig: FirestoreConfig): AnyObject { } return storeUpdateFn(ids) }, - _stopPatching ({ state, commit }) { + _stopPatching ({ state }) { if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout) } @@ -1158,7 +1158,7 @@ export default function (firestoreConfig: FirestoreConfig): AnyObject { state._sync.patching = false }, 300) }, - _startPatching ({ state, commit }) { + _startPatching ({ state }) { if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout) } diff --git a/src/module/getters.ts b/src/module/getters.ts index 3e2e0024..93192485 100644 --- a/src/module/getters.ts +++ b/src/module/getters.ts @@ -7,6 +7,8 @@ import { getPathVarMatches } from '../utils/apiHelpers' import setDefaultValues from '../utils/setDefaultValues' import { AnyObject } from '../declarations' import error from './errors' +import firebase from 'firebase/compat' +import FieldValue = firebase.firestore.FieldValue; export type IPluginGetters = { firestorePathComplete: (state: any, getters?: any, rootState?: any, rootGetters?: any) => string @@ -145,11 +147,13 @@ export default function (firebase: any): AnyObject { id = getters.docModeId cleanedPath = path } - cleanedPatchData[cleanedPath] = firebase.firestore.FieldValue.delete() + + cleanedPatchData[cleanedPath] = FieldValue.delete() cleanedPatchData.id = id + return { [id]: cleanedPatchData } }, - prepareForInsert: (state, getters, rootState, rootGetters) => (items = []) => { + prepareForInsert: (state, getters) => (items = []) => { // add fillable and guard defaults return items.reduce((carry, item) => { // set default fields diff --git a/test/helpers/index.cjs.js b/test/helpers/index.cjs.js index 9fc53183..2a7bd6f4 100644 --- a/test/helpers/index.cjs.js +++ b/test/helpers/index.cjs.js @@ -18,6 +18,7 @@ var pathToProp = _interopDefault(require('path-to-prop')); var compareAnything = require('compare-anything'); var findAndReplaceAnything = require('find-and-replace-anything'); var filter = _interopDefault(require('filter-anything')); +var firebase$2 = _interopDefault(require('firebase/compat')); function initialState() { return { @@ -3505,7 +3506,7 @@ function pluginActions (firestoreConfig) { .set(initialDocPrepared) .then(function () { if (state._conf.logging) { - var message = 'Initial doc succesfully inserted'; + var message = 'Initial doc successfully inserted'; console.log("%c [vuex-easy-firestore] " + message + "; for Firestore PATH: " + getters.firestorePathComplete + " [" + state._conf.firestorePath + "]", 'color: SeaGreen'); } resolve(true); @@ -4445,7 +4446,7 @@ function pluginActions (firestoreConfig) { return storeUpdateFn(ids); }, _stopPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -4454,7 +4455,7 @@ function pluginActions (firestoreConfig) { }, 300); }, _startPatching: function (_a) { - var state = _a.state, commit = _a.commit; + var state = _a.state; if (state._sync.stopPatchingTimeout) { clearTimeout(state._sync.stopPatchingTimeout); } @@ -4463,6 +4464,7 @@ function pluginActions (firestoreConfig) { }; } +var FieldValue = firebase$2.firestore.FieldValue; /** * A function returning the getters object * @@ -4581,11 +4583,11 @@ function pluginGetters (firebase) { id = getters.docModeId; cleanedPath = path; } - cleanedPatchData[cleanedPath] = firebase.firestore.FieldValue.delete(); + cleanedPatchData[cleanedPath] = FieldValue.delete(); cleanedPatchData.id = id; return _a = {}, _a[id] = cleanedPatchData, _a; }; }, - prepareForInsert: function (state, getters, rootState, rootGetters) { return function (items) { + prepareForInsert: function (state, getters) { return function (items) { if (items === void 0) { items = []; } // add fillable and guard defaults return items.reduce(function (carry, item) {