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

@startup-booster/move

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startup-booster/move - npm Package Compare versions

Comparing version 0.1.29 to 0.1.30

75

move.js

@@ -41,23 +41,43 @@ const { EventEmitter } = require('events');

socket.on('value', (path, value, index, initEmit) => {
console.log(`value ${path}`, value);
if (!listeners[path]) {
// Got value for a path we're no longer listening to, so unlisten
// This is only needed sometimes due to timing
rpc('unlisten', path);
socket.on('value', (id, subpath, updatedRooms, value, emitIndex) => {
console.log(`value ${id}.${subpath}`, value);
const path = `${id}.${subpath}`;
const generalListeners = Object.keys(listeners).filter(listenerPath =>
path.startsWith(listenerPath),
);
if (!generalListeners.length) {
const unSlashedUpdatedRooms = updatedRooms.map(roomName =>
roomName.startsWith('/') ? roomName.slice(1) : roomName,
);
const listenersToDelete = Object.keys(listeners).filter(
listenerPath => listenerPath in (unSlashedUpdatedRooms || []),
);
listenersToDelete.forEach(listener => {
rpc('unlisten', listener);
});
return;
}
if (move.data.index >= index) {
return;
for (const listener of generalListeners) {
for (const handler of listeners[listener].handlers || []) {
// Use setTimeout to escape the current call stack and avoid error handling
setTimeout(
() => handler(value, listener !== path && path.replace(`${listener}.`, '')),
0,
);
}
}
if (initEmit) {
});
socket.on('collection', (collection, value, index) => {
console.log(`collection ${collection}`, value);
if (!listeners[collection]) {
// Got value for a path we're no longer listening to, so unlisten
// This is only needed sometimes due to timing
rpc('unlisten', collection);
return;
}
delete value['@metadata'];
if (isEqual(listeners[path].snapshot, value)) {
return;
}
move.data.index = index;
for (const listener of listeners[path].handlers || []) {
for (const listener of listeners[collection].handlers || []) {
// Use setTimeout to escape the current call stack and avoid error handling

@@ -119,5 +139,2 @@ setTimeout(() => listener(value), 0);

console.log(`Got ${path}`, value);
const clone = cloneDeep(value);
delete clone['@metadata'];
listeners[path].snapshot = clone;
callback(value);

@@ -129,5 +146,2 @@ });

console.log(`Got ${path}`, value);
const clone = cloneDeep(value);
delete clone['@metadata'];
listeners[path].snapshot = clone;
callback(value);

@@ -183,17 +197,2 @@ });

for (const listenerPath in listeners) {
if (!path.startsWith(listenerPath)) {
continue;
}
let subpath = path.replace(listenerPath, '');
if (subpath.startsWith('.')) {
subpath = subpath.slice(1);
}
if (!value) {
return;
}
const valueClone = JSON.parse(JSON.stringify(value));
delete valueClone['@metadata'];
set(listeners[listenerPath].snapshot, subpath, valueClone);
}
move.data.index = emitIndex;

@@ -234,2 +233,6 @@ },

async deleteField(path) {
return rpc('deleteField', path);
},
close() {

@@ -236,0 +239,0 @@ socket.close();

{
"name": "@startup-booster/move",
"version": "0.1.29",
"version": "0.1.30",
"main": "move.js",

@@ -5,0 +5,0 @@ "license": "MIT",

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