Socket
Socket
Sign inDemoInstall

28

Package Overview
Dependencies
Maintainers
1
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

28 - npm Package Compare versions

Comparing version 0.3.9 to 0.4.0

47

lib/sync.js

@@ -76,6 +76,6 @@ 'use strict';

.then(function(compileError){
logDiff(diff);
if(compileError) {
throw compileError;
}
logDiff(diff);
});

@@ -93,4 +93,6 @@ };

var commit = function(simulate, diffs){
var promises = [];
var modulePromises = [];
var queryPromises = [];
diffs.forEach(function(diff){
var container = diff.query.substring(0, 'modules'.length) === 'modules' ? modulePromises : queryPromises;
if(simulate) {

@@ -100,15 +102,32 @@ logDiff(diff, simulate);

if(diff.isOriginRemote) {
promises.push(writeLocalQuery(diff));
container.push(writeLocalQuery(diff));
} else {
promises.push(writeRemoteQuery(diff));
container.push(writeRemoteQuery(diff));
}
} else {
if(diff.isOriginRemote) {
promises.push(deleteLocalQuery(diff));
container.push(deleteLocalQuery(diff));
} else {
promises.push(deleteRemoteQuery(diff));
container.push(deleteRemoteQuery(diff));
}
}
});
return Q.all(promises);
var handler = function(results){
var errors = [];
results.forEach(function (result) {
if (result.state !== 'fulfilled') {
errors.push(result.reason);
}
});
if(errors.length > 0) {
throw errors;
}
return results;
};
return [
function(){ return Q.allSettled(modulePromises).then(handler); },
function(){ return Q.allSettled(queryPromises).then(handler); }
].reduce(Q.when, new Q([]));
};

@@ -141,5 +160,5 @@

var targetLastModified = targetQuery.lastModified;
if(overwrite === Options.OVERWRITE_ALWAYS){
if(overwrite === Options.OVERWRITE_ALWAYS) {
promises.push(addDiff(diff));
} else if(overwrite === Options.OVERWRITE_IF_NEWER){
} else if(overwrite === Options.OVERWRITE_IF_NEWER) {
if((new Date(originLastModified)).getTime() > (new Date(targetLastModified)).getTime()){

@@ -149,3 +168,3 @@ promises.push(addDiff(diff));

} else if(overwrite === Options.OVERWRITE_ASK) {
promises.push(function(diffs){
promises.push(function (diffs) {
var defered = Q.defer();

@@ -155,7 +174,7 @@ read({

default: 'N'
}, function(er, value){
if(er) {
}, function (er, value) {
if (er) {
defered.reject(er);
}
if(value !== undefined && value.toUpperCase() === 'Y') {
if (value !== undefined && value.toUpperCase() === 'Y') {
diffs.push(diff);

@@ -167,2 +186,4 @@ }

});
} else if(overwrite === Options.OVERWRITE_NEVER) {
//Do nothing
} else {

@@ -169,0 +190,0 @@ throw new Error('Invalid overwrite value: ' + overwrite);

@@ -9,3 +9,3 @@ {

"description": "Command line utility to download and upload 28.io queries.",
"version": "0.3.9",
"version": "0.4.0",
"keywords": [

@@ -12,0 +12,0 @@ "jsoniq",

@@ -96,3 +96,3 @@ 'use strict';

},
'Upload should succeed': function(error, success){
'Upload shouldn\'t succeed': function(error, success){
assert.equal(success, undefined);

@@ -99,0 +99,0 @@ assert.equal(_.isObject(error), true);

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