Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
var fRequest = state._sync.fetched[identifier];
// We're already done fetching everything:
if (fRequest.done) {
if (state._conf.logging)
console.log('[vuex-easy-firestore] done fetching');
return resolve({ done: true });
}
// attach fetch filters
var fRef = state._sync.fetched[identifier].ref;
if (fRequest.nextFetchRef) {
// get next ref if saved in state
fRef = state._sync.fetched[identifier].nextFetchRef;
}
// add doc limit
var limit = (isWhat.isNumber(pathVariables.limit))
? pathVariables.limit
: state._conf.fetch.docLimit;
if (limit > 0)
fRef = fRef.limit(limit);
// Stop if all records already fetched
if (fRequest.retrievedFetchRefs.includes(fRef)) {
console.log('[vuex-easy-firestore] Already retrieved this part.');
return resolve();
}
// make fetch request
fRef.get().then(function (querySnapshot) {
var docs = querySnapshot.docs;
if (docs.length === 0) {
state._sync.fetched[identifier].done = true;
querySnapshot.done = true;
return resolve(querySnapshot);
function helpers(originVal, newVal) {
if (isWhat.isArray(originVal) && isArrayHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
if (isWhat.isNumber(originVal) && isIncrementHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
return newVal; // always return newVal as fallback!!
}
newVal = merge({ extensions: [helpers] }, ref[key], patches[key]);
}
}
const fRequest = state._sync.fetched[identifier]
// We're already done fetching everything:
if (fRequest.done) {
if (state._conf.logging) console.log('[vuex-easy-firestore] done fetching')
return resolve({done: true})
}
// attach fetch filters
let fRef = state._sync.fetched[identifier].ref
if (fRequest.nextFetchRef) {
// get next ref if saved in state
fRef = state._sync.fetched[identifier].nextFetchRef
}
// add doc limit
let limit = (isNumber(pathVariables.limit))
? pathVariables.limit
: state._conf.fetch.docLimit
if (limit > 0) fRef = fRef.limit(limit)
// Stop if all records already fetched
if (fRequest.retrievedFetchRefs.includes(fRef)) {
console.log('[vuex-easy-firestore] Already retrieved this part.')
return resolve()
}
// make fetch request
fRef.get().then(querySnapshot => {
const docs = querySnapshot.docs
if (docs.length === 0) {
state._sync.fetched[identifier].done = true
querySnapshot.done = true
return resolve(querySnapshot)
}
}
var fRequest = state._sync.fetched[identifier];
// We're already done fetching everything:
if (fRequest.done) {
if (state._conf.logging)
console.log('[vuex-easy-firestore] done fetching');
return resolve({ done: true });
}
// attach fetch filters
var fRef = state._sync.fetched[identifier].ref;
if (fRequest.nextFetchRef) {
// get next ref if saved in state
fRef = state._sync.fetched[identifier].nextFetchRef;
}
// add doc limit
var limit = (isNumber(pathVariables.limit))
? pathVariables.limit
: state._conf.fetch.docLimit;
if (limit > 0)
fRef = fRef.limit(limit);
// Stop if all records already fetched
if (fRequest.retrievedFetchRefs.includes(fRef)) {
console.log('[vuex-easy-firestore] Already retrieved this part.');
return resolve();
}
// make fetch request
fRef.get().then(function (querySnapshot) {
var docs = querySnapshot.docs;
if (docs.length === 0) {
state._sync.fetched[identifier].done = true;
querySnapshot.done = true;
return resolve(querySnapshot);
}
var fRequest = state._sync.fetched[identifier];
// We're already done fetching everything:
if (fRequest.done) {
if (state._conf.logging)
console.log('[vuex-easy-firestore] done fetching');
return resolve({ done: true });
}
// attach fetch filters
var fRef = state._sync.fetched[identifier].ref;
if (fRequest.nextFetchRef) {
// get next ref if saved in state
fRef = state._sync.fetched[identifier].nextFetchRef;
}
// add doc limit
var limit = (isWhat.isNumber(pathVariables.limit))
? pathVariables.limit
: state._conf.fetch.docLimit;
if (limit > 0)
fRef = fRef.limit(limit);
// Stop if all records already fetched
if (fRequest.retrievedFetchRefs.includes(fRef)) {
console.log('[vuex-easy-firestore] Already retrieved this part.');
return resolve();
}
// make fetch request
fRef.get().then(function (querySnapshot) {
var docs = querySnapshot.docs;
if (docs.length === 0) {
state._sync.fetched[identifier].done = true;
querySnapshot.done = true;
return resolve(querySnapshot);
function helpers(originVal, newVal) {
if (isWhat.isArray(originVal) && isArrayHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
if (isWhat.isNumber(originVal) && isIncrementHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
return newVal; // always return newVal as fallback!!
}
newVal = merge({ extensions: [helpers] }, ref[key], patches[key]);
function helpers(originVal, newVal) {
if (isArray(originVal) && isArrayHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
if (isNumber(originVal) && isIncrementHelper(newVal)) {
newVal = newVal.executeOn(originVal);
}
return newVal; // always return newVal as fallback!!
}
newVal = merge({ extensions: [helpers] }, ref[key], patches[key]);
numberProps.forEach(function (prop) {
var _prop = config.fetch[prop];
if (!isWhat.isNumber(_prop))
errors.push("`" + prop + "` should be a Number, but is not.");
});
var functionProps = ['insertHook', 'patchHook', 'deleteHook', 'insertBatchHook', 'patchBatchHook', 'deleteBatchHook', 'addedHook', 'modifiedHook', 'removedHook'];
numberProps.forEach(function (prop) {
var _prop = config.fetch[prop];
if (!isNumber(_prop))
errors.push("`" + prop + "` should be a Number, but is not.");
});
var functionProps = ['insertHook', 'patchHook', 'deleteHook', 'insertBatchHook', 'patchBatchHook', 'deleteBatchHook', 'addedHook', 'modifiedHook', 'removedHook'];
numberProps.forEach(function (prop) {
var _prop = config.fetch[prop];
if (!isWhat.isNumber(_prop))
errors.push("`" + prop + "` should be a Number, but is not.");
});
var functionProps = ['insertHook', 'patchHook', 'deleteHook', 'insertBatchHook', 'patchBatchHook', 'deleteBatchHook', 'addedHook', 'modifiedHook', 'removedHook'];