Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,2 @@ | ||
var browserify = require('browserify'); | ||
var gulp = require('gulp'); | ||
@@ -6,3 +7,4 @@ var istanbul = require('gulp-istanbul'); | ||
var path = require('path'); | ||
var runSequence = require('run-sequence'); | ||
var through = require('through'); | ||
var vinylSourceStream = require('vinyl-source-stream'); | ||
var wicked = require('wicked'); | ||
@@ -15,2 +17,32 @@ | ||
var replace = function(regex, replacement) { | ||
return function() { | ||
var data = ''; | ||
function write(buf) { | ||
data += buf; | ||
} | ||
function end() { | ||
this.queue(data.replace(regex, replacement)); | ||
this.queue(null); | ||
} | ||
return through(write, end); | ||
}; | ||
}; | ||
gulp.task('browser', function() { | ||
return browserify({ | ||
entries: [index], | ||
standalone: 'asana' | ||
}) | ||
.transform( | ||
replace(/require\('request'\)/g, 'require(\'browser-request\')')) | ||
.bundle() | ||
.pipe(vinylSourceStream('asana.js')) | ||
.pipe(gulp.dest('dist')); | ||
}); | ||
gulp.task('default', ['test']); | ||
gulp.task('docs', function(callback) { | ||
@@ -27,18 +59,29 @@ wicked(null, null, callback); | ||
gulp.task('spec', function(callback) { | ||
gulp.src([lib, index]) | ||
.pipe(istanbul()) | ||
gulp.src(lib) | ||
.pipe(istanbul({ | ||
includeUntested: true | ||
})) | ||
.on('finish', function() { | ||
gulp.src(tests) | ||
.pipe(mocha({ | ||
reporter: 'nyan' | ||
reporter: process.env.TRAVIS ? 'spec' : 'nyan' | ||
})) | ||
.pipe(istanbul.writeReports({ | ||
reporters: ['lcovonly'] | ||
reporters: ['text', 'text-summary'] | ||
})) | ||
.on('end', callback); | ||
.on('end', function() { | ||
var errOrNull = null; | ||
var coverage = istanbul.summarizeCoverage(); | ||
var incomplete = Object.keys(coverage).filter(function(key) { | ||
return coverage[key].pct !== 100; | ||
}); | ||
if (incomplete.length > 0) { | ||
errOrNull = new Error( | ||
'Incomplete coverage for ' + incomplete.join(', ')); | ||
} | ||
callback(errOrNull); | ||
}); | ||
}); | ||
}); | ||
gulp.task('test', function(callback) { | ||
runSequence('lint', 'spec', callback); | ||
}); | ||
gulp.task('test', ['browser', 'lint', 'spec']); |
var errors = require('./errors'); | ||
var Promise = require('bluebird'); | ||
var BPromise = require('bluebird'); | ||
var request = require('request'); | ||
@@ -51,7 +51,7 @@ | ||
* @param {Object} params The params for request | ||
* @return {Promise} The response for the request | ||
* @return {BPromise} The response for the request | ||
*/ | ||
Dispatcher.prototype.dispatch = function(params) { | ||
params[this.authKey] = this.authValue; | ||
return new Promise(function(resolve, reject) { | ||
return new BPromise(function(resolve, reject) { | ||
request(params, function(err, res, payload) { | ||
@@ -73,3 +73,3 @@ if (err) { | ||
* @param {Object} [query] The query params | ||
* @return {Promise} The response for the request | ||
* @return {BPromise} The response for the request | ||
*/ | ||
@@ -92,3 +92,3 @@ Dispatcher.prototype.get = function(path, query) { | ||
* @param {Object} data The data to be sent | ||
* @return {Promise} The response for the request | ||
* @return {BPromise} The response for the request | ||
*/ | ||
@@ -110,3 +110,3 @@ Dispatcher.prototype.post = function(path, data) { | ||
* @param {Object} data The data to be sent | ||
* @return {Promise} The response for the request | ||
* @return {BPromise} The response for the request | ||
*/ | ||
@@ -127,3 +127,3 @@ Dispatcher.prototype.put = function(path, data) { | ||
* @param {String} path The path of the API | ||
* @return {Promise} The response for the request | ||
* @return {BPromise} The response for the request | ||
*/ | ||
@@ -130,0 +130,0 @@ Dispatcher.prototype.delete = function(path) { |
@@ -75,34 +75,2 @@ var util = require('util'); | ||
/** | ||
* Update a task | ||
* @param {Number} taskId The task id | ||
* @param {Object} data The data to be sent to the workspace | ||
* @return {Promise} The result of the API call | ||
*/ | ||
Tasks.prototype.update = function(taskId, data) { | ||
var path = util.format('/tasks/%d', taskId); | ||
return this.dispatcher.put(path, data); | ||
}; | ||
/** | ||
* Deletes a task | ||
* @param {Number} taskId The task id | ||
* @return {Promise} The result of the API call | ||
*/ | ||
Tasks.prototype.delete = function(taskId) { | ||
var path = util.format('/tasks/%d', taskId); | ||
return this.dispatcher.delete(path); | ||
}; | ||
/** | ||
* Dispatches a POST request to /tasks/:taskId/addFollowers with to add | ||
* followers to the task. | ||
* @param {Number} taskId The task id | ||
* @param {Object} data The data containing the list of followers | ||
*/ | ||
Tasks.prototype.addFollowers = function(taskId, data) { | ||
var path = util.format('/tasks/%d/addFollowers', taskId); | ||
return this.dispatcher.post(path, data); | ||
}; | ||
/** | ||
* Dispatches a POST request to /tasks/:taskId/removeFollowers with to remove | ||
@@ -109,0 +77,0 @@ * followers from the task. |
@@ -32,2 +32,13 @@ var util = require('util'); | ||
/** | ||
* Dispatches a GET request to /workspaces/:workspaceId/typeahead to run a | ||
* typeahead search in the specified workspace | ||
* @type {Number} workspaceId The workspace id | ||
* @type {Object} data The data to be sent to the workspace | ||
*/ | ||
Workspaces.prototype.typeahead = function(workspaceId, data) { | ||
var path = util.format('/workspaces/%d/typeahead', workspaceId); | ||
return this.dispatcher.get(path, data); | ||
}; | ||
module.exports = Workspaces; |
{ | ||
"name": "asana", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A node.js client for the Asana API", | ||
@@ -25,18 +25,20 @@ "main": "index.js", | ||
"dependencies": { | ||
"bluebird": "^2.1.3", | ||
"request": "^2.36.0" | ||
"bluebird": "^2.3.0", | ||
"request": "^2.45.0" | ||
}, | ||
"devDependencies": { | ||
"browser-request": "^0.3.2", | ||
"browserify": "^6.3.2", | ||
"gulp": "^3.8.5", | ||
"gulp-istanbul": "^0.2.0", | ||
"gulp-istanbul": "^0.3.1", | ||
"gulp-jshint": "^1.6.4", | ||
"gulp-mocha": "^0.5.1", | ||
"gulp-mocha": "^1.1.1", | ||
"install": "^0.1.7", | ||
"jshint-stylish": "^0.4.0", | ||
"npm": "^1.4.20", | ||
"jshint-stylish": "^1.0.0", | ||
"rewire": "^2.0.1", | ||
"run-sequence": "^0.3.6", | ||
"sinon": "^1.10.2", | ||
"through": "^2.3.6", | ||
"vinyl-source-stream": "^1.0.0", | ||
"wicked": "^0.3.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Asana [![Build Status][travis-image]][travis-url] | ||
# Asana [![Build Status][travis-image]][travis-url] [![NPM Version][npm-image]][npm-url] | ||
@@ -85,4 +85,7 @@ A node.js client for the 1.0 version of the Asana API. | ||
[travis-url]: http://travis-ci.org/Asana/node-asana | ||
[travis-image]: http://img.shields.io/travis/Asana/node-asana.svg?style=flat | ||
[travis-image]: http://img.shields.io/travis/Asana/node-asana.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.org/package/asana | ||
[npm-image]: http://img.shields.io/npm/v/asana.svg?style=flat-square | ||
[bluebird]: https://github.com/petkaantonov/bluebird | ||
@@ -89,0 +92,0 @@ [co]: https://github.com/visionmedia/co |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302753
37
7469
96
13
9
7
Updatedbluebird@^2.3.0
Updatedrequest@^2.45.0