@magnetarjs/core
Advanced tools
Comparing version 0.10.1 to 0.11.0
@@ -250,2 +250,11 @@ "use strict"; | ||
} | ||
function getExistsFromDataStore(globalConfig, collectionPath, docId) { | ||
const localStoreName = globalConfig.localStoreName; | ||
throwIfNolocalStoreName(localStoreName); | ||
const getModuleExists = globalConfig.stores[localStoreName].getModuleExists; | ||
if (!getModuleExists) { | ||
throw new Error("The data store did not provide a getModuleExists function!"); | ||
} | ||
return getModuleExists({ collectionPath, docId }); | ||
} | ||
function getCountFromDataStore(moduleConfig, globalConfig, collectionPath) { | ||
@@ -362,3 +371,4 @@ const localStoreName = globalConfig.localStoreName; | ||
let stopExecution = false; | ||
const doOnFetchFns = modifyReadResponseMap.added; | ||
const doOnAddedFns = modifyReadResponseMap.added; | ||
const doOnFetchFns = []; | ||
const doOnFetchCountFns = []; | ||
@@ -406,2 +416,5 @@ const collectionFetchResult = /* @__PURE__ */ new Map(); | ||
} | ||
if (actionName === "fetch" && docId) { | ||
doOnFetchFns.forEach((fn) => fn(void 0, "error")); | ||
} | ||
throw resultFromPlugin; | ||
@@ -435,3 +448,7 @@ } | ||
for (const docMetaData of docs) { | ||
const docResult = executeOnFns(doOnFetchFns, docMetaData.data, [docMetaData]); | ||
const docResult = executeOnFns( | ||
[...doOnAddedFns, ...doOnFetchFns], | ||
docMetaData.data, | ||
[docMetaData] | ||
); | ||
if (docResult) | ||
@@ -788,3 +805,4 @@ collectionFetchResult.set(docMetaData.id, docResult); | ||
return proxify(moduleInstance, { | ||
data: () => getDataFromDataStore(moduleConfig, globalConfig, collectionPath, docId) | ||
data: () => getDataFromDataStore(moduleConfig, globalConfig, collectionPath, docId), | ||
exists: () => getExistsFromDataStore(globalConfig, collectionPath, docId) | ||
}); | ||
@@ -791,0 +809,0 @@ } |
{ | ||
"name": "@magnetarjs/core", | ||
"version": "0.10.1", | ||
"version": "0.11.0", | ||
"sideEffects": false, | ||
@@ -23,4 +23,4 @@ "description": "Magnetar core library.", | ||
"dependencies": { | ||
"@magnetarjs/types": "0.10.1", | ||
"@magnetarjs/utils": "0.10.1", | ||
"@magnetarjs/types": "0.11.0", | ||
"@magnetarjs/utils": "0.11.0", | ||
"getorset-anything": "^0.0.3", | ||
@@ -31,3 +31,3 @@ "is-what": "^4.1.7", | ||
"devDependencies": { | ||
"@magnetarjs/test-utils": "0.10.1" | ||
"@magnetarjs/test-utils": "0.11.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71610
1790
+ Added@magnetarjs/types@0.11.0(transitive)
+ Added@magnetarjs/utils@0.11.0(transitive)
- Removed@magnetarjs/types@0.10.1(transitive)
- Removed@magnetarjs/utils@0.10.1(transitive)
Updated@magnetarjs/types@0.11.0
Updated@magnetarjs/utils@0.11.0