Comparing version 0.2.2 to 0.3.0
@@ -24,2 +24,8 @@ var api = require('./api'); | ||
break; | ||
case 'POST': | ||
req = request.doPost; | ||
break; | ||
case 'DELETE': | ||
req = request.doDelete; | ||
break; | ||
} | ||
@@ -26,0 +32,0 @@ |
@@ -5,11 +5,41 @@ var request = require('superagent'); | ||
return new Promise(function (resolve, reject) { | ||
request.get(url).end(function (err, res) { | ||
if (err) reject(err); | ||
resolve(res.body); | ||
}); | ||
}) | ||
} | ||
request | ||
.get(url) | ||
.query(args) | ||
.end(function (err, res) { | ||
if (err) reject(err); | ||
resolve(res.body); | ||
}); | ||
}); | ||
}; | ||
var doPost = function(url, args) { | ||
return new Promise(function (resolve, reject) { | ||
request | ||
.post(url) | ||
.type('form') | ||
.send(args) | ||
.end(function (err, res) { | ||
if (err) reject(err); | ||
resolve(res.body); | ||
}); | ||
}); | ||
}; | ||
var doDelete = function(url, args) { | ||
return new Promise(function (resolve, reject) { | ||
request | ||
.delete(url) | ||
.query(args) | ||
.end(function (err, res) { | ||
if (err) reject(err); | ||
resolve(res.body); | ||
}); | ||
}); | ||
}; | ||
module.exports = { | ||
doGet: doGet | ||
doGet: doGet, | ||
doPost: doPost, | ||
doDelete: doDelete | ||
}; |
{ | ||
"name": "crex", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Creative Exchange SDK for Javascript", | ||
@@ -8,4 +8,8 @@ "author": "Mateusz Luczak <mateusz.luczak@outlook.com>", | ||
"main": "dist/crex.js", | ||
"module": "dist/crex.es.js", | ||
"jsnext:main": "dist/crex.es.js", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"build": "npm run build:module && npm run build:browser", | ||
"build:module": "rollup -c", | ||
"build:browser": "rollup -c rollup.config.browser.js", | ||
"test": "mocha test/**" | ||
@@ -12,0 +16,0 @@ }, |
@@ -0,1 +1,2 @@ | ||
var fs = require('fs'); | ||
var commonjs = require('rollup-plugin-commonjs'); | ||
@@ -5,6 +6,14 @@ var resolve = require('rollup-plugin-node-resolve'); | ||
var pkg = JSON.parse(fs.readFileSync( 'package.json', 'utf-8')); | ||
var banner = fs.readFileSync('banner.txt', 'utf-8') | ||
.replace( '${version}', pkg.version); | ||
module.exports = { | ||
entry: 'lib/index.js', | ||
dest: 'dist/crex-sdk.min.js', | ||
format: 'iife', | ||
targets: [ | ||
{ dest: 'dist/crex.js', format: 'cjs' }, | ||
{ dest: 'dist/crex.es.js', format: 'es' } | ||
], | ||
banner: banner, | ||
moduleName: 'CrEx', | ||
@@ -14,10 +23,5 @@ plugins: [ | ||
jsnext: true, | ||
main: true, | ||
browser: true | ||
}), | ||
commonjs({ | ||
sourceMap: false | ||
}), | ||
uglify() | ||
main: true | ||
}) | ||
] | ||
}; |
@@ -23,2 +23,18 @@ var chai = require('chai'); | ||
}); | ||
describe('#getPackageStatus', function() { | ||
it('should return list of packages', function() { | ||
return expect(crex.exportGetPackageStatus({ | ||
'id': 'ae814a08-c438-429b-ab7a-fbd95dbe6998' | ||
})).to.eventually.be.a('array'); | ||
}); | ||
}); | ||
describe('#deletePackage', function() { | ||
it('should remove package', function() { | ||
return expect(crex.exportRemovePackage({ | ||
'id': 'ae814a08-c438-429b-ab7a-fbd95dbe6998' | ||
})).to.eventually.be.a('object'); | ||
}); | ||
}); | ||
}); |
@@ -23,2 +23,34 @@ var chai = require('chai'); | ||
}); | ||
describe('#getPackageStatus', function() { | ||
it('should return list of packages', function() { | ||
return expect(crex.importGetPackageStatus({ | ||
'id': '3c190d0a-91c3-4aa2-beaa-f17b5dbdd913' | ||
})).to.eventually.be.a('array'); | ||
}); | ||
}); | ||
describe('#inspectPackage', function() { | ||
it('should return status', function() { | ||
return expect(crex.importInspectPackage({ | ||
'id': '3c190d0a-91c3-4aa2-beaa-f17b5dbdd913' | ||
})).to.eventually.be.a('object'); | ||
}); | ||
}); | ||
describe('#installPackage', function() { | ||
it('should return status', function() { | ||
return expect(crex.importInstallPackage({ | ||
'id': '3c190d0a-91c3-4aa2-beaa-f17b5dbdd913' | ||
})).to.eventually.be.a('object'); | ||
}); | ||
}); | ||
describe('#deletePackage', function() { | ||
it('should remove package', function() { | ||
return expect(crex.importRemovePackage({ | ||
'id': '3c190d0a-91c3-4aa2-beaa-f17b5dbdd913' | ||
})).to.eventually.be.a('object'); | ||
}); | ||
}); | ||
}); |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
16
315
27632
3
1