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

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.4 to 0.3.5

tests/test_project2/public/foo.jq

37

lib/sync.js

@@ -69,18 +69,9 @@ 'use strict';

var writeRemoteQuery = function(diff){
var defered = Q.defer();
vfs.writeRemoteQuery(diff.query)
return vfs.writeRemoteQuery(diff.query)
.then(function(compileError){
if(compileError) {
var lineNumber = compileError.location['line-number'];
var line = vfs.getLocalQuery(diff.query).split('\n')[lineNumber - 1];
console.error('Compilation error in ' + diff.query);
console.error(lineNumber + ' |' + line.red);
console.error(compileError.message.red);
defered.reject();
} else {
defered.resolve();
throw compileError;
}
logDiff(diff);
});
return defered.promise;
};

@@ -166,2 +157,4 @@

});
} else {
throw new Error('Invalid overwrite value: ' + overwrite);
}

@@ -188,4 +181,3 @@ } else {

this.sync = function(overwrite, deleteOrphaned, simulate, ignore, isOriginRemote){
var defered = Q.defer();
Q.all([
return Q.all([
vfs.getLocalQueries(),

@@ -197,11 +189,4 @@ vfs.getRemoteQueries()

var remoteQueries = filterQueries(queries[1], ignore);
sync(localQueries, remoteQueries, overwrite, deleteOrphaned, simulate, isOriginRemote).then(function(){
defered.resolve();
}).catch(function(error) {
defered.reject(error);
});
}).catch(function(error){
defered.reject(error);
return sync(localQueries, remoteQueries, overwrite, deleteOrphaned, simulate, isOriginRemote);
});
return defered.promise;
};

@@ -219,13 +204,7 @@

this.truncate = function(simulate, ignore){
var defered = Q.defer();
vfs.getRemoteQueries().then(function(queries){
return vfs.getRemoteQueries().then(function(queries){
var remoteQueries = filterQueries(queries, ignore);
sync({}, remoteQueries, Options.OVERWRITE_ALWAYS, true, simulate, false).then(function(){
defered.resolve();
}).catch(function(error) {
defered.reject(error);
});
return sync({}, remoteQueries, Options.OVERWRITE_ALWAYS, true, simulate, false);
});
return defered.promise;
};
};

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

localProjectPath = localProjectPath ? normalizeLocalProjectPath(localProjectPath) : '';
this.getLocalQuery = function(path){

@@ -38,4 +38,3 @@ return fs.readFileSync(path, 'utf-8');

ffs.mkdirRecursiveSync(localProjectPath + 'private', 511);
var defered = Q.defer();
Q.all([
return Q.all([
ffs.readdirRecursive(localProjectPath + 'modules', true, 'modules'),

@@ -53,12 +52,8 @@ ffs.readdirRecursive(localProjectPath + 'public', true, 'public'),

});
defered.resolve(queries);
}).catch(function(error){
defered.reject(error);
return queries;
});
return defered.promise;
};
this.getRemoteQueries = function(){
var defered = Q.defer();
Q.all([
return Q.all([
//Modules need to be listed/uploaded first,

@@ -97,7 +92,4 @@ //so compilation errors on main queries can make sense.

});
defered.resolve(queries);
}).catch(function(error){
defered.reject(error);
return queries;
});
return defered.promise;
};

@@ -166,3 +158,2 @@

this.writeLocalQuery = function(query){
var defered = Q.defer();
var callback = function(response){

@@ -172,18 +163,15 @@ var source = response.body;

ffs.mkdirRecursiveSync(dir, 511);
ffs.writeFile(query, source, { encoding: 'utf-8' }).then(function(){
defered.resolve();
})
.otherwise(function(error){ defered.reject(error); });
ffs.writeFileSync(query, source, { encoding: 'utf-8' });
};
if(isModule(query)) {
$28.Modules(projectName).getModule({ modulePath: modulePath(query), token: projectToken })
.then(callback)
.catch(function(error){ defered.reject(error); });
return $28.Modules(projectName)
.getModule({ modulePath: modulePath(query), token: projectToken })
.then(callback);
} else {
$28.Queries(projectName).getQuery({ queryPath: query, token: projectToken })
.then(callback)
.catch(function(error){ defered.reject(error); });
return $28.Queries(projectName)
.getQuery({ queryPath: query, token: projectToken })
.then(callback);
}
return defered.promise;
};
};

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

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

@@ -49,3 +49,4 @@ "jsoniq",

"grunt-shell": "~0.7.0",
"bats": "git+https://github.com/sstephenson/bats.git#master"
"bats": "git+https://github.com/sstephenson/bats.git#master",
"lodash": "~2.4.1"
},

@@ -52,0 +53,0 @@ "optionalDependencies": {},

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

var EventEmitter = require('events').EventEmitter;
var _ = require('lodash');
var $28 = new (require('../lib/28.js').$28)('https://portal.28.io/api');

@@ -76,2 +76,52 @@

}
},
'Upload (1)': {
topic: function(session){
var promise = new EventEmitter();
var projectName = 'vows-project';
var projectToken = session.project_tokens['project_' + projectName];
if(!projectToken) {
throw new Error('project not found ' + projectName);
}
var projectPath = 'tests/test_project';
var overwrite = 0, deleteOrphaned = true, simulate = false;
$28
.upload(projectName, projectToken, projectPath, overwrite, deleteOrphaned, simulate, [])
.then(function(success){
promise.emit('success', success);
})
.catch(function(error){
promise.emit('error', error);
});
return promise;
},
'Upload should succeed': function(error, success){
assert.equal(success, undefined);
assert.equal(_.isObject(error), true);
}
},
'Upload (2)': {
topic: function(session){
var promise = new EventEmitter();
var projectName = 'vows-project';
var projectToken = session.project_tokens['project_' + projectName];
if(!projectToken) {
throw new Error('project not found ' + projectName);
}
var projectPath = 'tests/test_project2';
var overwrite = 0, deleteOrphaned = true, simulate = false;
$28
.upload(projectName, projectToken, projectPath, overwrite, deleteOrphaned, simulate, [])
.then(function(success){
promise.emit('success', success);
})
.catch(function(error){
promise.emit('error', error);
});
return promise;
},
'Upload should succeed': function(error, success){
assert.equal(error, undefined);
assert.equal(success !== undefined, true);
}
}

@@ -78,0 +128,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