New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@magnetarjs/core

Package Overview
Dependencies
Maintainers
1
Versions
153
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.2.8 to 0.2.11

19

dist/index.cjs.js

@@ -370,3 +370,5 @@ 'use strict';

// set up and/or reset te writeLock for write actions
const writeLock = _docId ? writeLockMap.get(`${collectionPath}/${_docId}`) : writeLockMap.get(collectionPath);
const writeLock = _docId
? writeLockMap.get(`${collectionPath}/${_docId}`)
: writeLockMap.get(collectionPath);
if (actionName !== 'fetch') {

@@ -400,3 +402,3 @@ // we need to create a promise we'll resolve later to prevent any incoming docs from being written to the local state during this time

const collectionWriteMaps = getCollectionWriteLocks(collectionPath, writeLockMap);
yield Promise.allSettled(collectionWriteMaps.map(w => w.promise));
yield Promise.allSettled(collectionWriteMaps.map((w) => w.promise));
}

@@ -611,3 +613,5 @@ }

// we need to await any writeLock _before_ opening the stream to prevent grabbing outdated data
const writeLock = docId ? writeLockMap.get(`${collectionPath}/${docId}`) : writeLockMap.get(collectionPath);
const writeLock = docId
? writeLockMap.get(`${collectionPath}/${docId}`)
: writeLockMap.get(collectionPath);
if (isWhat.isPromise(writeLock.promise))

@@ -618,3 +622,3 @@ yield writeLock.promise;

const collectionWriteLocks = getCollectionWriteLocks(collectionPath, writeLockMap);
yield Promise.allSettled(collectionWriteLocks.map(w => w.promise));
yield Promise.allSettled(collectionWriteLocks.map((w) => w.promise));
}

@@ -668,3 +672,8 @@ // get all the config needed to perform this action

// grab from lastIncoming map
const [__payload, __meta] = lastIncomingModifiedDocs.get(identifier);
const lastIncoming = lastIncomingModifiedDocs.get(identifier);
if (!lastIncoming) {
// do nothing if there is no last incoming. This means more than 1 call might have piled up and
return;
}
const [__payload, __meta] = lastIncoming;
// delete from lastIncoming map

@@ -671,0 +680,0 @@ lastIncomingModifiedDocs.delete(identifier);

@@ -366,3 +366,5 @@ import { merge, mergeAndConcat } from 'merge-anything';

// set up and/or reset te writeLock for write actions
const writeLock = _docId ? writeLockMap.get(`${collectionPath}/${_docId}`) : writeLockMap.get(collectionPath);
const writeLock = _docId
? writeLockMap.get(`${collectionPath}/${_docId}`)
: writeLockMap.get(collectionPath);
if (actionName !== 'fetch') {

@@ -396,3 +398,3 @@ // we need to create a promise we'll resolve later to prevent any incoming docs from being written to the local state during this time

const collectionWriteMaps = getCollectionWriteLocks(collectionPath, writeLockMap);
yield Promise.allSettled(collectionWriteMaps.map(w => w.promise));
yield Promise.allSettled(collectionWriteMaps.map((w) => w.promise));
}

@@ -607,3 +609,5 @@ }

// we need to await any writeLock _before_ opening the stream to prevent grabbing outdated data
const writeLock = docId ? writeLockMap.get(`${collectionPath}/${docId}`) : writeLockMap.get(collectionPath);
const writeLock = docId
? writeLockMap.get(`${collectionPath}/${docId}`)
: writeLockMap.get(collectionPath);
if (isPromise(writeLock.promise))

@@ -614,3 +618,3 @@ yield writeLock.promise;

const collectionWriteLocks = getCollectionWriteLocks(collectionPath, writeLockMap);
yield Promise.allSettled(collectionWriteLocks.map(w => w.promise));
yield Promise.allSettled(collectionWriteLocks.map((w) => w.promise));
}

@@ -664,3 +668,8 @@ // get all the config needed to perform this action

// grab from lastIncoming map
const [__payload, __meta] = lastIncomingModifiedDocs.get(identifier);
const lastIncoming = lastIncomingModifiedDocs.get(identifier);
if (!lastIncoming) {
// do nothing if there is no last incoming. This means more than 1 call might have piled up and
return;
}
const [__payload, __meta] = lastIncoming;
// delete from lastIncoming map

@@ -667,0 +676,0 @@ lastIncomingModifiedDocs.delete(identifier);

{
"name": "@magnetarjs/core",
"version": "0.2.8",
"version": "0.2.11",
"sideEffects": false,

@@ -25,3 +25,3 @@ "description": "Magnetar core library.",

"devDependencies": {
"@magnetarjs/test-utils": "^0.1.8",
"@magnetarjs/test-utils": "^0.1.10",
"ava": "^3.15.0"

@@ -70,3 +70,3 @@ },

},
"gitHead": "b83b88837ec3265481b2b6d3e623b4bba663a858"
"gitHead": "5fdfb38fb075d71b57b46915f99716eea5de4af3"
}

@@ -5,4 +5,4 @@ export function isEven (number: number): boolean { return number % 2 === 0 } // prettier-ignore

export function countCharacter (target: string, regExp: RegExp): number {
export function countCharacter(target: string, regExp: RegExp): number {
return (target.match(regExp) || []).length
}

@@ -122,3 +122,3 @@ import { O } from 'ts-toolbelt'

}
// grab the stream related functions

@@ -125,0 +125,0 @@ function cacheStream(closeStreamFn: () => void, streamingPromise: Promise<void> | null): void {

@@ -64,3 +64,5 @@ /* eslint-disable no-inner-declarations */

// set up and/or reset te writeLock for write actions
const writeLock = _docId ? writeLockMap.get(`${collectionPath}/${_docId}`)! : writeLockMap.get(collectionPath)!
const writeLock = _docId
? writeLockMap.get(`${collectionPath}/${_docId}`)!
: writeLockMap.get(collectionPath)!
if (actionName !== 'fetch') {

@@ -86,3 +88,3 @@ // we need to create a promise we'll resolve later to prevent any incoming docs from being written to the local state during this time

}
// eslint-disable-next-line no-async-promise-executor

@@ -96,3 +98,3 @@ const actionPromise = new Promise<any>(async (resolve, reject) => {

const collectionWriteMaps = getCollectionWriteLocks(collectionPath, writeLockMap)
await Promise.allSettled(collectionWriteMaps.map(w => w.promise))
await Promise.allSettled(collectionWriteMaps.map((w) => w.promise))
}

@@ -185,3 +187,3 @@ }

})
// handle reverting. stopExecution might have been modified by `handleAction`

@@ -188,0 +190,0 @@ if (stopExecution === 'revert') {

@@ -33,3 +33,5 @@ import { O } from 'ts-toolbelt'

// we need to await any writeLock _before_ opening the stream to prevent grabbing outdated data
const writeLock = docId ? writeLockMap.get(`${collectionPath}/${docId}`)! : writeLockMap.get(collectionPath)!
const writeLock = docId
? writeLockMap.get(`${collectionPath}/${docId}`)!
: writeLockMap.get(collectionPath)!
if (isPromise(writeLock.promise)) await writeLock.promise

@@ -39,3 +41,3 @@ if (!docId) {

const collectionWriteLocks = getCollectionWriteLocks(collectionPath, writeLockMap)
await Promise.allSettled(collectionWriteLocks.map(w => w.promise))
await Promise.allSettled(collectionWriteLocks.map((w) => w.promise))
}

@@ -94,6 +96,6 @@

const identifier = `${collectionPath}/${_meta.id}`
// add to lastIncoming map
lastIncomingModifiedDocs.set(identifier, [_payload, _meta])
// check if there's a WriteLock for the document

@@ -104,9 +106,15 @@ const _writeLock = writeLockMap.get(identifier)

}
// grab from lastIncoming map
const [__payload, __meta] = lastIncomingModifiedDocs.get(identifier) as [any, any]
const lastIncoming = lastIncomingModifiedDocs.get(identifier)
if (!lastIncoming) {
// do nothing if there is no last incoming. This means more than 1 call might have piled up and
return
}
const [__payload, __meta] = lastIncoming
// delete from lastIncoming map
lastIncomingModifiedDocs.delete(identifier)
// executer other plugin `doOnStream` functions

@@ -113,0 +121,0 @@ return executeOnFns(doOnStreamFns.modified, __payload, [__meta])

import { O } from 'ts-toolbelt'
import { ActionName } from './actions'
import { FetchResponse, StreamResponse, DoOnStream, DoOnFetch, PluginModuleConfig, SyncBatch } from './plugins'
import {
FetchResponse,
StreamResponse,
DoOnStream,
DoOnFetch,
PluginModuleConfig,
SyncBatch,
} from './plugins'

@@ -53,3 +60,11 @@ // events

type EventPayloadPropResult = {
result: void | string | FetchResponse | DoOnFetch | StreamResponse | DoOnStream | SyncBatch | [string, SyncBatch]
result:
| void
| string
| FetchResponse
| DoOnFetch
| StreamResponse
| DoOnStream
| SyncBatch
| [string, SyncBatch]
}

@@ -56,0 +71,0 @@

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