Socket
Socket
Sign inDemoInstall

mws-sdk-promises

Package Overview
Dependencies
52
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.20 to 0.9.21

6

CHANGES.md
Changes:
=======
2017/10/17 ver. 0.9.21
merged with #17 by [dominhhai](https://github.com/dominhhai)
add request option
=======
2017/10/13 ver. 0.9.20

@@ -4,0 +10,0 @@ fixed #16 by [mattbarton](https://github.com/mattbarton)

31

lib/mws.js
'use strict';
var qs = require("querystring");
var qs = require('querystring');
var crypto = require('crypto');

@@ -31,2 +31,3 @@ var xml2js = require('xml2js');

this.authToken = options.authToken;
this.reqOpts = options.requestOpts || {};
}

@@ -47,9 +48,9 @@

if (this.secretAccessKey == null || this.accessKeyId == null || this.merchantId == null) {
throw "accessKeyId, secretAccessKey, and merchantId must be set";
throw 'accessKeyId, secretAccessKey, and merchantId must be set';
}
var requestOpts = {
var requestOpts = Object.assign({}, this.reqOpts, {
method: 'POST',
uri: 'https://' + this.host + api.path
};
});

@@ -71,7 +72,7 @@ // Check if we're dealing with a file (such as a feed) upload

query['Version'] = api.version;
query["Timestamp"] = new Date().toISOString();
query["AWSAccessKeyId"] = this.accessKeyId;
query['Timestamp'] = new Date().toISOString();
query['AWSAccessKeyId'] = this.accessKeyId;
if (this.authToken) {
query["MWSAuthToken"] = this.authToken;
query['MWSAuthToken'] = this.authToken;
}

@@ -102,3 +103,3 @@

if (err != null) {
reject(new Error(err.Code + ": " + err.Message));
reject(new Error(err.Code + ': ' + err.Message));
} else {

@@ -126,4 +127,4 @@ resolve(result);

// Configure the query signature method/version
query["SignatureMethod"] = "HmacSHA256";
query["SignatureVersion"] = "2";
query['SignatureMethod'] = 'HmacSHA256';
query['SignatureVersion'] = '2';

@@ -136,5 +137,5 @@ // Copy query keys, sort them, then copy over the values

var stringToSign = ["POST", this.host, path, qs.stringify(sorted)].join("\n");
var stringToSign = ['POST', this.host, path, qs.stringify(sorted)].join('\n');
query['Signature'] = crypto.createHmac("sha256", this.secretAccessKey).update(stringToSign, 'utf8').digest("base64");
query['Signature'] = crypto.createHmac('sha256', this.secretAccessKey).update(stringToSign, 'utf8').digest('base64');

@@ -230,6 +231,6 @@ return query;

var i = 0;
if (typeof value == "string" || typeof value == "number") {
if (typeof value == 'string' || typeof value == 'number') {
setListValue(p.name + '.1', value);
}
if (typeof value == "object") {
if (typeof value == 'object') {
if (Array.isArray(value)) {

@@ -292,3 +293,3 @@ for (i = value.length - 1; i >= 0; i--) {

}
if (missing.length > 0) reject(new Error("ERROR: Missing required parameter(s): " + missing.join(',') + "!"));
if (missing.length > 0) reject(new Error('ERROR: Missing required parameter(s): ' + missing.join(',') + '!'));
else resolve(q);

@@ -295,0 +296,0 @@ });

@@ -12,3 +12,3 @@ {

"homepage": "http://_",
"version": "0.9.20",
"version": "0.9.21",
"author": {

@@ -15,0 +15,0 @@ "name": "Eibbor Srenduas",

@@ -12,5 +12,5 @@ mws-sdk-promises

- Promises to provide generic async support.
- I've add some new requests from updated Amazone API.
- I fix it with better set params ability... so it now looks niceier!!!

@@ -22,3 +22,3 @@

it can be seamlesly used in ES2015/2016 way using [babel.js](https://babeljs.io/).
with new javascript code features like `yield` or `async` `wait` to put some sugar on your code.
with new javascript code features like `yield` or `async` `wait` to put some sugar on your code.

@@ -38,3 +38,8 @@ Examples

// Optional Auth Token when using delegated Developer access.
authToken: 'amzn.mws...'
authToken: 'amzn.mws...',
// request options (https://github.com/request/request#requestoptions-callback)
requestOpts: {
proxy: 'http://PROXY_HOST:PROXY_PORT',
encoding: null
}
}

@@ -45,3 +50,3 @@ ),

now you can use it
now you can use it

@@ -48,0 +53,0 @@ ```javascript

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc