Comparing version 1.17.0 to 1.17.1
@@ -7,2 +7,3 @@ var fs = require('fs'); | ||
var bundleHelpers = require('./bundle-helpers'); | ||
var AWS = require('../lib/aws'); | ||
@@ -14,3 +15,3 @@ var sanitizeRegex = /[^a-zA-Z0-9,-]/g; | ||
_.each(names, function (name) { | ||
var match = name.match(/^(.+?)(?:-(.+?)(?:\.js)?)?$/); | ||
var match = name.match(/^(.+?)(?:-(.+?))?$/); | ||
var service = match[1], version = match[2]; | ||
@@ -23,4 +24,28 @@ if (!map[service]) map[service] = []; | ||
function mapFromServices() { | ||
var map = {}; | ||
AWS.util.each(AWS, function(name, ServiceClass) { | ||
if (ServiceClass.serviceIdentifier) { | ||
map[ServiceClass.serviceIdentifier] = ServiceClass; | ||
} | ||
}); | ||
return map; | ||
} | ||
function allServicesMap() { | ||
var map = {}; | ||
AWS.util.each(AWS, function(name, ServiceClass) { | ||
if (ServiceClass.serviceIdentifier) { | ||
var apis = ServiceClass.apiVersions.filter(function (v) { | ||
return v.indexOf('*') < 0; | ||
}).map(function (v) { return new ServiceClass({apiVersion: v})}); | ||
map[ServiceClass.serviceIdentifier] = apis; | ||
} | ||
}); | ||
return map; | ||
} | ||
function parseServiceMap(services, callback) { | ||
if (!services) services = bundleHelpers.defaultServices; | ||
if (services === 'all') return callback(null, allServicesMap()); | ||
if (services.match(sanitizeRegex)) { | ||
@@ -31,32 +56,29 @@ return callback(new Error('Incorrectly formatted service names')); | ||
var dir = path.join(bundleHelpers.root, 'services', 'api'); | ||
fs.readdir(dir, function (err, files) { | ||
var diskMap = mapFromNames(files); | ||
if (services.length === 1 && services[0] === 'all') { | ||
return callback(null, diskMap); // all services | ||
} | ||
var serviceMap = mapFromServices(); | ||
var givenMap = mapFromNames(services); | ||
var invalidModules = []; | ||
var outMap = {}; | ||
var givenMap = mapFromNames(services); | ||
var invalidModules = []; | ||
_.each(givenMap, function (versions, service) { | ||
if (!diskMap[service]) { // no such service | ||
invalidModules.push(service); | ||
} else if (versions.length === 0) { // take latest | ||
givenMap[service] = [diskMap[service][diskMap[service].length - 1]]; | ||
} else { // validate all versions | ||
_.each(versions, function (version) { | ||
if (diskMap[service].indexOf(version) < 0) { | ||
invalidModules.push(service + '-' + version); | ||
} | ||
}); | ||
} | ||
}); | ||
if (invalidModules.length > 0) { | ||
callback(new Error('Missing modules: ' + invalidModules.join(', '))); | ||
} else { | ||
callback(null, givenMap); | ||
_.each(givenMap, function (versions, service) { | ||
if (!serviceMap[service]) { // no such service | ||
invalidModules.push(service); | ||
} else if (versions.length === 0) { // take latest | ||
outMap[service] = [new serviceMap[service]()]; | ||
} else { // validate all versions | ||
outMap[service] = []; | ||
_.each(versions, function (version) { | ||
try { | ||
outMap[service].push(new serviceMap[service]({apiVersion: version})); | ||
} catch (e) { | ||
invalidModules.push(service + '-' + version); | ||
} | ||
}); | ||
} | ||
}); | ||
if (invalidModules.length > 0) { | ||
callback(new Error('Missing modules: ' + invalidModules.join(', '))); | ||
} else { | ||
callback(null, outMap); | ||
} | ||
} | ||
@@ -70,7 +92,8 @@ | ||
_.each(serviceMap, function (versions, service) { | ||
_.each(versions, function (version) { | ||
_.each(serviceMap, function (versions, svcName) { | ||
_.each(versions, function (svc) { | ||
var line = util.format( | ||
'%s(require("./services/%s"), "%s", require("./services/api/%s-%s"));', | ||
'AWS.Service.defineServiceApi', service, version, service, version); | ||
'%s(require("./services/%s"), "%s", %s);', | ||
'AWS.Service.defineServiceApi', svcName, svc.api.apiVersion, | ||
JSON.stringify(svc.api)); | ||
contents.push(line); | ||
@@ -77,0 +100,0 @@ }); |
@@ -10,3 +10,3 @@ # @title Examples in the Browser | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc4.min.js"></script> | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc5.min.js"></script> | ||
<script type="text/javascript"> | ||
@@ -13,0 +13,0 @@ // See the Configuring section to configure credentials in the SDK |
@@ -11,6 +11,6 @@ # @title AWS SDK for JavaScript in the Browser | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc4.min.js"></script> | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc5.min.js"></script> | ||
You can also download this package by clicking the following link: | ||
[aws-sdk-2.0.0-rc4.min.js](https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc4.min.js) | ||
[aws-sdk-2.0.0-rc5.min.js](https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc5.min.js) | ||
@@ -17,0 +17,0 @@ Once the SDK is loaded in your page, the module will be available from |
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
VERSION: '1.17.0', | ||
VERSION: '1.17.1', | ||
@@ -19,0 +19,0 @@ /** |
@@ -14,3 +14,3 @@ var AWS = require('../core'); | ||
constructor: function XMLBuilder(rules, options) { | ||
constructor: function JSONBuilder(rules, options) { | ||
this.rules = rules; | ||
@@ -30,3 +30,3 @@ this.timestampFormat = options.timestampFormat; | ||
AWS.util.each.call(this, value, function (memberName, memberValue) { | ||
var memberRules = rules[memberName] || {}; | ||
var memberRules = rules.members[memberName] || {}; | ||
struct[memberName] = this.translate(memberRules, memberValue); | ||
@@ -61,2 +61,6 @@ }); | ||
} else if (rules.type == 'integer') { | ||
return parseInt(value, 10); | ||
} else if (rules.type == 'float') { | ||
return parseFloat(value); | ||
} else { | ||
@@ -63,0 +67,0 @@ |
@@ -96,3 +96,3 @@ var AWS = require('./core'); | ||
case 'float': | ||
return this.validateType(context, value, ['number']); | ||
return this.validateNumber(context, value); | ||
case 'boolean': | ||
@@ -142,2 +142,10 @@ return this.validateType(context, value, ['boolean']); | ||
validateNumber: function validateNumber(context, value) { | ||
if (typeof value === 'string') { | ||
var castedValue = parseFloat(value); | ||
if (castedValue.toString() === value) value = castedValue; | ||
} | ||
return this.validateType(context, value, ['number']); | ||
}, | ||
validatePayload: function validatePayload(context, value) { | ||
@@ -144,0 +152,0 @@ if (typeof value === 'string') return; |
var AWS = require('./core'); | ||
var Translator = require('./api/translator'); | ||
var inherit = AWS.util.inherit; | ||
@@ -439,10 +440,25 @@ | ||
function setApi(api) { | ||
/* jshint camelcase:false */ | ||
if (api.type && api.api_version) { | ||
svc.prototype.api = new Translator(api, {documentation: false}); | ||
} else { | ||
svc.prototype.api = api; | ||
} | ||
} | ||
if (typeof version === 'string') { | ||
var apiFile = superclass.serviceIdentifier + '-' + version; | ||
try { | ||
svc.prototype.api = apiConfig || require('./services/api/' + apiFile); | ||
} catch (err) { | ||
throw AWS.util.error(err, { | ||
message: 'Could not find API configuration ' + apiFile | ||
}); | ||
if (apiConfig) { | ||
setApi(apiConfig); | ||
} else { | ||
var file = superclass.serviceIdentifier + '-' + version; | ||
var path = __dirname + '/../apis/' + file + '.json'; | ||
try { | ||
var fs = require('fs'); | ||
setApi(JSON.parse(fs.readFileSync(path))); | ||
} catch (err) { | ||
throw AWS.util.error(err, { | ||
message: 'Could not find API configuration ' + file | ||
}); | ||
} | ||
} | ||
@@ -454,3 +470,3 @@ if (!superclass.services.hasOwnProperty(version)) { | ||
} else { | ||
svc.prototype.api = version; | ||
setApi(version); | ||
} | ||
@@ -457,0 +473,0 @@ |
{ | ||
"name": "aws-sdk", | ||
"description": "AWS SDK for JavaScript", | ||
"version": "1.17.0", | ||
"version": "1.17.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name":"Amazon Web Services", |
@@ -15,3 +15,3 @@ # AWS SDK for JavaScript [![Version](https://badge.fury.io/js/aws-sdk.png)](http://badge.fury.io/js/aws-sdk) [![Build Status](https://travis-ci.org/aws/aws-sdk-js.png?branch=master)](https://travis-ci.org/aws/aws-sdk-js) | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc4.min.js"></script> | ||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc5.min.js"></script> | ||
@@ -18,0 +18,0 @@ ### In Node.js |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
15015818
368
296036
7