ibm-cos-sdk
Advanced tools
Comparing version 1.4.3 to 1.4.4
# CHANGELOG | ||
# 1.4.4 | ||
## Content | ||
### Defect Fixes | ||
* AWS Patches aligned to version v2.406.0 of the AWS NodeJS SDK | ||
# 1.4.3 | ||
@@ -5,0 +11,0 @@ ## Content |
@@ -108,3 +108,3 @@ var fs = require('fs'); | ||
code += tab + 'get: function get() {\n'; | ||
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n' | ||
code += tab + tab + 'var model = require(\'../apis/' + versionInfo.api + '.json\');\n'; | ||
if (versionInfo.hasOwnProperty('paginators')) { | ||
@@ -129,3 +129,3 @@ code += tab + tab + 'model.paginators = require(\'../apis/' + versionInfo.paginators + '.json\').pagination;\n'; | ||
service: serviceName, | ||
} | ||
}; | ||
}; | ||
@@ -139,3 +139,3 @@ | ||
return tab; | ||
} | ||
}; | ||
@@ -219,2 +219,2 @@ ClientCreator.prototype.generateDefinePropertySource = function generateDefinePropertySource(objName, serviceName, className) { | ||
module.exports = ClientCreator; | ||
module.exports = ClientCreator; |
@@ -6,2 +6,2 @@ var ClientCreator = require('./client-creator'); | ||
cc.writeClientServices(); | ||
console.log('Finished updating services.'); | ||
console.log('Finished updating services.'); |
@@ -162,2 +162,2 @@ var fs = require('fs'); | ||
module.exports = ServiceCollector; | ||
module.exports = ServiceCollector; |
@@ -24,2 +24,2 @@ var util = require('./util'); | ||
}; | ||
} | ||
} |
@@ -14,2 +14,2 @@ require('./browser_loader'); | ||
*/ | ||
require('../clients/browser_default'); | ||
require('../clients/browser_default'); |
@@ -20,3 +20,3 @@ /** | ||
*/ | ||
VERSION: '1.4.3', | ||
VERSION: '1.4.4', | ||
@@ -23,0 +23,0 @@ /** |
@@ -57,2 +57,3 @@ var AWS = require('../core'); | ||
} | ||
this.resolveCallbacks = []; | ||
}, | ||
@@ -98,34 +99,41 @@ | ||
resolve: function resolve(callback) { | ||
if (this.providers.length === 0) { | ||
var self = this; | ||
if (self.providers.length === 0) { | ||
callback(new Error('No providers')); | ||
return this; | ||
return self; | ||
} | ||
var index = 0; | ||
var providers = this.providers.slice(0); | ||
if (self.resolveCallbacks.push(callback) === 1) { | ||
var index = 0; | ||
var providers = self.providers.slice(0); | ||
function resolveNext(err, creds) { | ||
if ((!err && creds) || index === providers.length) { | ||
callback(err, creds); | ||
return; | ||
} | ||
function resolveNext(err, creds) { | ||
if ((!err && creds) || index === providers.length) { | ||
AWS.util.arrayEach(self.resolveCallbacks, function (callback) { | ||
callback(err, creds); | ||
}); | ||
self.resolveCallbacks.length = 0; | ||
return; | ||
} | ||
var provider = providers[index++]; | ||
if (typeof provider === 'function') { | ||
creds = provider.call(); | ||
} else { | ||
creds = provider; | ||
var provider = providers[index++]; | ||
if (typeof provider === 'function') { | ||
creds = provider.call(); | ||
} else { | ||
creds = provider; | ||
} | ||
if (creds.get) { | ||
creds.get(function (getErr) { | ||
resolveNext(getErr, getErr ? null : creds); | ||
}); | ||
} else { | ||
resolveNext(null, creds); | ||
} | ||
} | ||
if (creds.get) { | ||
creds.get(function(getErr) { | ||
resolveNext(getErr, getErr ? null : creds); | ||
}); | ||
} else { | ||
resolveNext(null, creds); | ||
} | ||
resolveNext(); | ||
} | ||
resolveNext(); | ||
return this; | ||
return self; | ||
} | ||
@@ -132,0 +140,0 @@ }); |
@@ -17,6 +17,6 @@ var querystring = require('querystring'); | ||
if (!token.accessToken) { | ||
throw new Error('Token constructor must have an access token provided.') | ||
throw new Error('Token constructor must have an access token provided.'); | ||
} | ||
this.tokenType = token.tokenType || 'Bearer' | ||
this.tokenType = token.tokenType || 'Bearer'; | ||
this.accessToken = token.accessToken; | ||
@@ -38,3 +38,3 @@ this.refreshToken = token.refreshToken; | ||
return (!this.expiration || (Date.now() > +this.expiration - gracePeriod)); | ||
} | ||
}; | ||
@@ -61,9 +61,9 @@ /** | ||
function TokenManager() { | ||
var config = {} | ||
var authCallback | ||
var config = {}; | ||
var authCallback; | ||
if (typeof arguments[0] === 'object') { | ||
config = arguments[0] | ||
config = arguments[0]; | ||
} else if (typeof arguments[0] === 'function') { | ||
authCallback = arguments[0] | ||
authCallback = arguments[0]; | ||
} | ||
@@ -76,3 +76,3 @@ | ||
'cache-control': 'no-cache' | ||
} | ||
}; | ||
@@ -87,3 +87,3 @@ // Default config | ||
authCallback: authCallback | ||
} | ||
}; | ||
@@ -93,3 +93,3 @@ // Check that we have some sort of authentication mechanism | ||
throw new Error('An authentication mechanism must be provided to the IAM token manager. This could be ' + | ||
'either an API Key, a valid API token, or a custom authentication callback.') | ||
'either an API Key, a valid API token, or a custom authentication callback.'); | ||
} | ||
@@ -99,7 +99,7 @@ | ||
if (typeof config.ibmAuthEndpoint !== 'undefined' && !config.ibmAuthEndpoint) { | ||
throw new Error('Endpoint must not be null or empty string.') | ||
throw new Error('Endpoint must not be null or empty string.'); | ||
} | ||
// Merge passed in config with default config | ||
Object.assign(this.config, config) | ||
Object.assign(this.config, config); | ||
} | ||
@@ -114,3 +114,3 @@ | ||
return this.token; | ||
} | ||
}; | ||
@@ -149,4 +149,5 @@ function generateTokenRefreshRequest(config, callbacks, body) { | ||
var token = JSON.parse(response); | ||
var newToken; | ||
try { | ||
var newToken = this.createToken({ | ||
newToken = this.createToken({ | ||
tokenType: token.token_type && token.token_type.toLowerCase(), | ||
@@ -253,7 +254,7 @@ accessToken: token.access_token || token.uaa_token, | ||
TokenManager.prototype.refreshToken = function(options, forceRenew, callback) { | ||
if (typeof callback == 'undefined') { | ||
if (typeof forceRenew == 'function') { | ||
if (typeof callback === 'undefined') { | ||
if (typeof forceRenew === 'function') { | ||
callback = forceRenew; | ||
forceRenew = undefined; | ||
} else if (typeof forceRenew == 'undefined' && typeof options == 'function') { | ||
} else if (typeof forceRenew === 'undefined' && typeof options === 'function') { | ||
callback = options; | ||
@@ -280,3 +281,3 @@ options = undefined; | ||
this._callbacks.forEach(function(cb) { | ||
cb(err) | ||
cb(err); | ||
}); | ||
@@ -305,4 +306,5 @@ if (sdkPromise !== undefined) { | ||
var grantType; | ||
if (config.refreshToken) { | ||
var grantType = 'refresh_token'; | ||
grantType = 'refresh_token'; | ||
} else if (!config.apiKeyId && config.ltpacookie) { | ||
@@ -325,3 +327,3 @@ grantType = 'grant_type=urn:ibm:params:oauth:grant-type:identity-cookie'; | ||
var query = querystring.stringify(config.query); | ||
config.url = (config.url.indexOf('?') === -1 ? '?' : '&') + query | ||
config.url = (config.url.indexOf('?') === -1 ? '?' : '&') + query; | ||
} | ||
@@ -411,2 +413,2 @@ | ||
module.exports = TokenManager; | ||
module.exports = TokenManager; |
@@ -116,3 +116,3 @@ var AWS = require('./core'); | ||
this.validateMember(shape.key, param, | ||
context + '[key=\'' + param + '\']') | ||
context + '[key=\'' + param + '\']'); | ||
this.validateMember(shape.value, params[param], | ||
@@ -161,5 +161,4 @@ context + '[\'' + param + '\']'); | ||
if (!(new RegExp(shape['pattern'])).test(value)) { | ||
this.fail('PatternMatchError', 'Provided value "' + value + '" ' | ||
+ 'does not match regex pattern /' + shape['pattern'] + '/ for ' | ||
+ context); | ||
this.fail('PatternMatchError', 'Provided value "' + value + '" ' + | ||
'does not match regex pattern /' + shape['pattern'] + '/ for ' + context); | ||
} | ||
@@ -172,4 +171,4 @@ } | ||
if (shape['min'] !== undefined && value < shape['min']) { | ||
this.fail('MinRangeError', 'Expected ' + descriptor + ' >= ' | ||
+ shape['min'] + ', but found ' + value + ' for ' + context); | ||
this.fail('MinRangeError', 'Expected ' + descriptor + ' >= ' + | ||
shape['min'] + ', but found ' + value + ' for ' + context); | ||
} | ||
@@ -179,4 +178,4 @@ } | ||
if (shape['max'] !== undefined && value > shape['max']) { | ||
this.fail('MaxRangeError', 'Expected ' + descriptor + ' <= ' | ||
+ shape['max'] + ', but found ' + value + ' for ' + context); | ||
this.fail('MaxRangeError', 'Expected ' + descriptor + ' <= ' + | ||
shape['max'] + ', but found ' + value + ' for ' + context); | ||
} | ||
@@ -190,4 +189,4 @@ } | ||
if (shape['enum'].indexOf(value) === -1) { | ||
this.fail('EnumError', 'Found string value of ' + value + ', but ' | ||
+ 'expected ' + shape['enum'].join('|') + ' for ' + context); | ||
this.fail('EnumError', 'Found string value of ' + value + | ||
', but ' + 'expected ' + shape['enum'].join('|') + ' for ' + context); | ||
} | ||
@@ -194,0 +193,0 @@ } |
@@ -568,2 +568,2 @@ var AWS = require('./core'); | ||
module.exports = AWS.Service; | ||
module.exports = AWS.Service; |
@@ -177,6 +177,2 @@ var AWS = require('../core'); | ||
var signatureVersion = service.getSignatureVersion(req); | ||
// Only validate buckets when using sigv4 | ||
if (signatureVersion !== 'v4') { | ||
return; | ||
} | ||
var bucket = req.params && req.params.Bucket; | ||
@@ -186,26 +182,2 @@ var key = req.params && req.params.Key; | ||
if (bucket && slashIndex >= 0) { | ||
if (typeof key === 'string') { | ||
req.params = AWS.util.copy(req.params); | ||
// Need to include trailing slash to match sigv2 behavior | ||
var prefix = bucket.substr(slashIndex + 1) || ''; | ||
req.params.Key = prefix + '/' + key; | ||
req.params.Bucket = bucket.substr(0, slashIndex); | ||
} else { | ||
var msg = 'Bucket names cannot contain forward slashes. Bucket: ' + bucket; | ||
throw AWS.util.error(new Error(), | ||
{ code: 'InvalidBucket', message: msg }); | ||
} | ||
} | ||
}, | ||
/** | ||
* @api private | ||
*/ | ||
validateBucketName: function validateBucketName(req) { | ||
var service = req.service; | ||
var signatureVersion = service.getSignatureVersion(req); | ||
var bucket = req.params && req.params.Bucket; | ||
var key = req.params && req.params.Key; | ||
var slashIndex = bucket && bucket.indexOf('/'); | ||
if (bucket && slashIndex >= 0) { | ||
if (typeof key === 'string' && slashIndex > 0) { | ||
@@ -785,2 +757,12 @@ req.params = AWS.util.copy(req.params); | ||
* callback. | ||
* @note Not all operation parameters are supported when using pre-signed | ||
* URLs. Certain parameters, such as `SSECustomerKey`, `ACL`, `Expires`, | ||
* `ContentLength`, or `Tagging` must be provided as headers when sending a | ||
* request. If you are using pre-signed URLs to upload from a browser and | ||
* need to use these fields, see {createPresignedPost}. | ||
* @note The default signer allows altering the request by adding corresponding | ||
* headers to set some parameters (e.g. Range) and these added parameters | ||
* won't be signed. You must use signatureVersion v4 to to include these | ||
* parameters in the signed portion of the URL and enforce exact matching | ||
* between headers and signed params in the URL. | ||
* @param operation [String] the name of the operation to call | ||
@@ -787,0 +769,0 @@ * @param params [map] parameters to pass to the operation. See the given |
@@ -40,2 +40,2 @@ var AWS = require('../core'); | ||
require('./presign'); | ||
require('./iam') | ||
require('./iam'); |
{ | ||
"name": "ibm-cos-sdk", | ||
"description": "IBM SDK for JavaScript", | ||
"version": "1.4.3", | ||
"version": "1.4.4", | ||
"author": { | ||
@@ -15,3 +15,3 @@ "name": "IBM", | ||
"browserify": "^16.2.3", | ||
"chai": "^4.2.0", | ||
"chai": "^3.0", | ||
"coffee-script": "^1.12.7", | ||
@@ -33,2 +33,3 @@ "coveralls": "^3.0.2", | ||
"jmespath": "0.15.0", | ||
"lodash": "^4.17.11", | ||
"url": "0.10.3", | ||
@@ -72,17 +73,20 @@ "uuid": "^3.3.2", | ||
"scripts": { | ||
"test": "npm -s run-script lint && npm -s run-script unit && npm -s run-script buildertest && npm -s run-script browsertest && ([ -f configuration ] && npm -s run-script integration || true)", | ||
"unit": "istanbul `[ $COVERAGE ] && echo 'cover _mocha' || echo 'test mocha'` -- test test/json test/model test/protocol test/query test/services test/signers test/xml test/s3", | ||
"unit-s3": "istanbul `[ $COVERAGE ] && echo 'cover _mocha' || echo 'test mocha'` -- test/s3 --reporter json", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha -- test test/json test/dynamodb test/cloudfront test/model test/protocol test/query test/services test/signers test/xml", | ||
"test": "node ./scripts/composite-test.js", | ||
"unit": "mocha -- test test/json test/model test/protocol test/query test/services test/signers test/xml test/s3", | ||
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --reporter=lcovonly -- test test/json test/model test/protocol test/query test/services test/signers test/xml test/s3 test/publisher test/event-stream", | ||
"browsertest": "rake browser:test && karma start", | ||
"buildertest": "mocha --compilers coffee:coffee-script -s 1000 -t 10000 dist-tools/test", | ||
"integration": "cucumber.js", | ||
"integration-s3": "cucumber.js --format json features/s3", | ||
"lint": "eslint lib dist-tools/*.js", | ||
"lint": "eslint lib test dist-tools/*.js", | ||
"console": "./scripts/console", | ||
"testfiles": "istanbul `[ $COVERAGE ] && echo 'cover _mocha' || echo 'test mocha'`", | ||
"tstest": "tsc -p ./ts", | ||
"tstest": "npm -s run-script build-typings && tsc -p ./ts", | ||
"build-typings": "node ./scripts/typings-generator.js", | ||
"add-change": "node ./scripts/changelog/add-change.js", | ||
"cos-test": "mocha --recursive --reporter spec cos/test/**/*.coffee" | ||
"region-check": "node ./scripts/region-checker/index.js", | ||
"translate-api-test": "mocha scripts/lib/translate-api.spec.js", | ||
"typings-generator-test": "mocha scripts/lib/prune-shapes.spec.js", | ||
"helper-test": "mocha scripts/lib/test-helper.spec.js", | ||
"csm-functional-test": "mocha test/publisher/functional_test" | ||
} | ||
} |
1491640
122
8
34923
+ Addedlodash@^4.17.11
+ Addedlodash@4.17.21(transitive)