Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@magnetarjs/core

Package Overview
Dependencies
Maintainers
2
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@magnetarjs/core - npm Package Compare versions

Comparing version 0.11.0 to 0.11.2

55

dist/index.js

@@ -163,9 +163,13 @@ "use strict";

// src/helpers/executeOnFns.ts
function executeOnFns(fns, payload, otherArgs) {
for (const fn of fns) {
if (!payload)
return;
payload = fn(payload, ...otherArgs);
function executeOnFns(params) {
const { modifyReadResultFns, localStoreFns, payload, docMetaData } = params;
let newPayload = payload;
for (const fn of modifyReadResultFns) {
if (newPayload)
newPayload = fn(newPayload, docMetaData);
}
return payload;
for (const fn of localStoreFns) {
newPayload = fn(newPayload, docMetaData);
}
return newPayload;
}

@@ -446,7 +450,8 @@

for (const docMetaData of docs) {
const docResult = executeOnFns(
[...doOnAddedFns, ...doOnFetchFns],
docMetaData.data,
[docMetaData]
);
const docResult = executeOnFns({
modifyReadResultFns: doOnAddedFns,
localStoreFns: doOnFetchFns,
payload: docMetaData.data,
docMetaData
});
if (docResult)

@@ -593,3 +598,3 @@ collectionFetchResult.set(docMetaData.id, docResult);

const streamInfoPerStore = {};
const doOnStreamFns = {
const modifyReadResponseFns = {
added: modifyReadResponseMap.added,

@@ -599,2 +604,7 @@ modified: modifyReadResponseMap.modified,

};
const doOnStreamFns = {
added: [],
modified: [],
removed: []
};
const lastIncomingDocs = /* @__PURE__ */ new Map();

@@ -613,3 +623,8 @@ const mustExecuteOnRead = {

return;
return executeOnFns(doOnStreamFns.added, result.payload, [result.meta]);
return executeOnFns({
modifyReadResultFns: modifyReadResponseFns.added,
localStoreFns: doOnStreamFns.added,
payload: result.payload,
docMetaData: result.meta
});
},

@@ -627,3 +642,8 @@ modified: async (_payload, _meta) => {

return;
return executeOnFns(doOnStreamFns.added, result.payload, [result.meta]);
return executeOnFns({
modifyReadResultFns: modifyReadResponseFns.added,
localStoreFns: doOnStreamFns.added,
payload: result.payload,
docMetaData: result.meta
});
},

@@ -634,3 +654,8 @@ removed: async (_payload, _meta) => {

await writeLockPromise(writeLockMap, docIdentifier);
return executeOnFns(doOnStreamFns.removed, _payload, [_meta]);
return executeOnFns({
modifyReadResultFns: modifyReadResponseFns.removed,
localStoreFns: doOnStreamFns.removed,
payload: _payload,
docMetaData: _meta
});
}

@@ -637,0 +662,0 @@ };

{
"name": "@magnetarjs/core",
"version": "0.11.0",
"version": "0.11.2",
"sideEffects": false,

@@ -23,4 +23,4 @@ "description": "Magnetar core library.",

"dependencies": {
"@magnetarjs/types": "0.11.0",
"@magnetarjs/utils": "0.11.0",
"@magnetarjs/types": "0.11.2",
"@magnetarjs/utils": "0.11.2",
"getorset-anything": "^0.0.3",

@@ -31,3 +31,3 @@ "is-what": "^4.1.7",

"devDependencies": {
"@magnetarjs/test-utils": "0.11.0"
"@magnetarjs/test-utils": "0.11.2"
},

@@ -34,0 +34,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc