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

fh-wfm-mongoose-store

Package Overview
Dependencies
Maintainers
5
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fh-wfm-mongoose-store - npm Package Compare versions

Comparing version 0.4.5 to 1.0.0-pre.1

58

lib/listen.js

@@ -6,41 +6,2 @@ 'use strict';

/**
*
* Creating a new object to be saved as a mongoose document
*
* @param objectToCreate
*/
function create(objectToCreate) {
var self = this;
// needs a custom function because the created id is different
// than the one in the request() topic
var uid = objectToCreate.id;
self.create(objectToCreate).then(function(createdObject) {
self.mediator.publish([self.topics.getTopic('create', 'done'), uid].join(':'), createdObject);
}).catch(function(err) {
self.mediator.publish([self.topics.getTopic('create', 'error'), uid].join(':'), err);
});
}
/**
*
* Updating an existing object saved as a mongoose document
*
* @param objectToUpdate
*/
function update(objectToUpdate) {
var self = this;
//The object being updated may not have had an id parameter set yet
//when syncing. So the localuid is used as a query instead
var uid = objectToUpdate.id || objectToUpdate._localuid;
self.update(objectToUpdate).then(function(updatedObject) {
self.mediator.publish([self.topics.getTopic('update', 'done'), uid].join(':'), updatedObject);
}).catch(function(err) {
self.mediator.publish([self.topics.getTopic('update', 'error'), uid].join(':'), err);
});
}
module.exports = function decorate(Class) {

@@ -74,6 +35,6 @@

read: self.read,
update: update,
update: self.update,
remove: self.remove,
list: self.list,
create: create
create: self.create
});

@@ -92,3 +53,2 @@

this.topics = new Topics(mediator);
this.mediator = mediator;
this.topics

@@ -103,16 +63,4 @@ .prefix('wfm' + topicPrefix)

filter = filter || {};
var _self = this;
//(Optional) Different filters may require topic UIDs.
//This can avoid the scenario where list done topics are publised with the
//wrong results
var topicUid = filter.topicUid;
filter = _.omit(filter, 'topicUid');
crudlFunctions.list(filter).then(function(filteredList) {
_self.mediator.publish(self.topics.getTopic('list', 'done', topicUid), filteredList);
}).catch(function(err) {
_self.mediator.publish(self.topics.getTopic('list', 'error', topicUid), err);
});
return crudlFunctions.list(filter);
});

@@ -119,0 +67,0 @@

4

package.json
{
"name": "fh-wfm-mongoose-store",
"version": "0.4.5",
"version": "1.0.0-pre.1",
"description": "Direct mongoose storage",

@@ -32,3 +32,3 @@ "main": "./lib/index.js",

"bluebird": "3.5.0",
"fh-wfm-mediator": "0.3.3",
"fh-wfm-mediator": "1.0.0-pre.1",
"lodash": "4.17.4",

@@ -35,0 +35,0 @@ "moment": "^2.18.1",

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