aws-sdk 2.1541.0 → 2.1543.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/xml2js.js CHANGED
@@ -4574,7 +4574,7 @@ module.exports =
4574
4574
  // Generated by CoffeeScript 1.12.7
4575
4575
  (function() {
4576
4576
  "use strict";
4577
- var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
4577
+ var bom, defaults, defineProperty, events, isEmpty, processItem, processors, sax, setImmediate,
4578
4578
  bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
4579
4579
  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
4580
4580
  hasProp = {}.hasOwnProperty;
@@ -4604,6 +4604,16 @@ module.exports =
4604
4604
  return item;
4605
4605
  };
4606
4606
 
4607
+ defineProperty = function(obj, key, value) {
4608
+ var descriptor;
4609
+ descriptor = Object.create(null);
4610
+ descriptor.value = value;
4611
+ descriptor.writable = true;
4612
+ descriptor.enumerable = true;
4613
+ descriptor.configurable = true;
4614
+ return Object.defineProperty(obj, key, descriptor);
4615
+ };
4616
+
4607
4617
  exports.Parser = (function(superClass) {
4608
4618
  extend(Parser, superClass);
4609
4619
 
@@ -4667,13 +4677,13 @@ module.exports =
4667
4677
  Parser.prototype.assignOrPush = function(obj, key, newValue) {
4668
4678
  if (!(key in obj)) {
4669
4679
  if (!this.options.explicitArray) {
4670
- return obj[key] = newValue;
4680
+ return defineProperty(obj, key, newValue);
4671
4681
  } else {
4672
- return obj[key] = [newValue];
4682
+ return defineProperty(obj, key, [newValue]);
4673
4683
  }
4674
4684
  } else {
4675
4685
  if (!(obj[key] instanceof Array)) {
4676
- obj[key] = [obj[key]];
4686
+ defineProperty(obj, key, [obj[key]]);
4677
4687
  }
4678
4688
  return obj[key].push(newValue);
4679
4689
  }
@@ -4714,21 +4724,21 @@ module.exports =
4714
4724
  this.saxParser.onopentag = (function(_this) {
4715
4725
  return function(node) {
4716
4726
  var key, newValue, obj, processedKey, ref;
4717
- obj = Object.create(null);
4727
+ obj = {};
4718
4728
  obj[charkey] = "";
4719
4729
  if (!_this.options.ignoreAttrs) {
4720
4730
  ref = node.attributes;
4721
4731
  for (key in ref) {
4722
4732
  if (!hasProp.call(ref, key)) continue;
4723
4733
  if (!(attrkey in obj) && !_this.options.mergeAttrs) {
4724
- obj[attrkey] = Object.create(null);
4734
+ obj[attrkey] = {};
4725
4735
  }
4726
4736
  newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
4727
4737
  processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
4728
4738
  if (_this.options.mergeAttrs) {
4729
4739
  _this.assignOrPush(obj, processedKey, newValue);
4730
4740
  } else {
4731
- obj[attrkey][processedKey] = newValue;
4741
+ defineProperty(obj[attrkey], processedKey, newValue);
4732
4742
  }
4733
4743
  }
4734
4744
  }
@@ -4799,7 +4809,7 @@ module.exports =
4799
4809
  }
4800
4810
  if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
4801
4811
  if (!_this.options.preserveChildrenOrder) {
4802
- node = Object.create(null);
4812
+ node = {};
4803
4813
  if (_this.options.attrkey in obj) {
4804
4814
  node[_this.options.attrkey] = obj[_this.options.attrkey];
4805
4815
  delete obj[_this.options.attrkey];
@@ -4814,10 +4824,10 @@ module.exports =
4814
4824
  obj = node;
4815
4825
  } else if (s) {
4816
4826
  s[_this.options.childkey] = s[_this.options.childkey] || [];
4817
- objClone = Object.create(null);
4827
+ objClone = {};
4818
4828
  for (key in obj) {
4819
4829
  if (!hasProp.call(obj, key)) continue;
4820
- objClone[key] = obj[key];
4830
+ defineProperty(objClone, key, obj[key]);
4821
4831
  }
4822
4832
  s[_this.options.childkey].push(objClone);
4823
4833
  delete obj["#name"];
@@ -4831,8 +4841,8 @@ module.exports =
4831
4841
  } else {
4832
4842
  if (_this.options.explicitRoot) {
4833
4843
  old = obj;
4834
- obj = Object.create(null);
4835
- obj[nodeName] = old;
4844
+ obj = {};
4845
+ defineProperty(obj, nodeName, old);
4836
4846
  }
4837
4847
  _this.resultObject = obj;
4838
4848
  _this.saxParser.ended = true;
package/lib/core.js CHANGED
@@ -20,7 +20,7 @@ AWS.util.update(AWS, {
20
20
  /**
21
21
  * @constant
22
22
  */
23
- VERSION: '2.1541.0',
23
+ VERSION: '2.1543.0',
24
24
 
25
25
  /**
26
26
  * @api private
@@ -119,6 +119,7 @@ AWS.util.update(AWS.S3.prototype, {
119
119
  * @api private
120
120
  */
121
121
  setupRequestListeners: function setupRequestListeners(request) {
122
+ request.addListener('validateResponse', this.setExpiresString);
122
123
  var prependListener = true;
123
124
  request.addListener('validate', this.validateScheme);
124
125
  request.addListener('validate', this.validateBucketName, prependListener);
@@ -1284,6 +1285,30 @@ AWS.util.update(AWS.S3.prototype, {
1284
1285
  var uploader = new AWS.S3.ManagedUpload(options);
1285
1286
  if (typeof callback === 'function') uploader.send(callback);
1286
1287
  return uploader;
1288
+ },
1289
+
1290
+ /**
1291
+ * @api private
1292
+ */
1293
+ setExpiresString: function setExpiresString(response) {
1294
+ // Check if response contains Expires value, and populate ExpiresString.
1295
+ if (response && response.httpResponse && response.httpResponse.headers) {
1296
+ if ('expires' in response.httpResponse.headers) {
1297
+ response.httpResponse.headers.expiresstring = response.httpResponse.headers.expires;
1298
+ }
1299
+ }
1300
+
1301
+ // Check if value in Expires is not a Date using parseTimestamp.
1302
+ try {
1303
+ if (response && response.httpResponse && response.httpResponse.headers) {
1304
+ if ('expires' in response.httpResponse.headers) {
1305
+ AWS.util.date.parseTimestamp(response.httpResponse.headers.expires);
1306
+ }
1307
+ }
1308
+ } catch (e) {
1309
+ console.log('AWS SDK', '(warning)', e);
1310
+ delete response.httpResponse.headers.expires;
1311
+ }
1287
1312
  }
1288
1313
  });
1289
1314
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aws-sdk",
3
3
  "description": "AWS SDK for JavaScript",
4
- "version": "2.1541.0",
4
+ "version": "2.1543.0",
5
5
  "author": {
6
6
  "name": "Amazon Web Services",
7
7
  "email": "",
@@ -50,7 +50,7 @@
50
50
  "url": "0.10.3",
51
51
  "util": "^0.12.4",
52
52
  "uuid": "8.0.0",
53
- "xml2js": "0.5.0"
53
+ "xml2js": "0.6.2"
54
54
  },
55
55
  "main": "lib/aws.js",
56
56
  "browser": {
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Sets model overrides for S3 ExpiresString.
3
+ */
4
+ module.exports = function setS3ExpiresString(model) {
5
+ if (model.metadata.serviceId === 'S3') {
6
+ var newShapes = {};
7
+ for (var shapeId in model.shapes) {
8
+ newShapes[shapeId] = model.shapes[shapeId];
9
+ if (shapeId === 'Expires') {
10
+ // preserve timestamp type for Expires.
11
+ newShapes[shapeId] = {};
12
+ newShapes[shapeId].type = 'timestamp';
13
+
14
+ // add ExpiresString
15
+ newShapes['ExpiresString'] = {
16
+ type: 'string'
17
+ };
18
+ }
19
+ }
20
+ model.shapes = newShapes;
21
+
22
+ for (var operationKey in model.operations) {
23
+ var op = model.operations[operationKey];
24
+ if (!op.output || !op.output.shape) {
25
+ continue;
26
+ }
27
+ var output = model.shapes[op.output.shape];
28
+ if (!output || !output.members) {
29
+ continue;
30
+ }
31
+ if ('Expires' in output.members) {
32
+ var newMembers = {};
33
+ for (var memberKey in output.members) {
34
+ newMembers[memberKey] = output.members[memberKey];
35
+ if (memberKey === 'Expires') {
36
+ newMembers['ExpiresString'] = Object.assign({}, newMembers[memberKey], {
37
+ 'shape': 'ExpiresString',
38
+ 'location': 'header',
39
+ 'locationName': 'ExpiresString'
40
+ });
41
+
42
+ newMembers[memberKey].deprecated = true;
43
+ newMembers[memberKey].documentation = 'Deprecated in favor of ExpiresString.';
44
+ }
45
+ }
46
+ output.members = newMembers;
47
+ }
48
+ }
49
+
50
+ return true;
51
+ }
52
+ return false;
53
+ };
@@ -40,17 +40,17 @@ var allowlist = {
40
40
  '/services/s3.js': [
41
41
  87,
42
42
  88,
43
- 260,
44
- 262,
45
- 275,
46
- 281,
47
- 641,
48
- 643,
49
- 762,
50
- 773,
43
+ 261,
44
+ 263,
45
+ 276,
46
+ 282,
47
+ 642,
48
+ 644,
49
+ 763,
51
50
  774,
52
51
  775,
53
- 780
52
+ 776,
53
+ 781
54
54
  ],
55
55
  '/token/sso_token_provider.js': [
56
56
  60
@@ -3,6 +3,7 @@
3
3
  var fs = require('fs');
4
4
  var Translator = require('./lib/translator');
5
5
  var removeEventStreamOperations = require('./lib/remove-event-stream-ops').removeEventStreamOperations;
6
+ var setS3ExpiresString = require('./lib/set-s3-expires-string');
6
7
  var util = require('util');
7
8
  var path = require('path');
8
9
 
@@ -24,7 +25,7 @@ function ApiTranslator(basePath) {
24
25
  ApiTranslator.prototype.minimizeFile = function minimizeFile(filepath) {
25
26
  var opath = filepath.replace(/\.normal\.json$/, '.min.json');
26
27
  var data = JSON.parse(fs.readFileSync(path.join(this._apisPath, filepath)).toString());
27
- var didModify = removeEventStreamOperations(data);
28
+ var didModify = removeEventStreamOperations(data) || setS3ExpiresString(data);
28
29
  if (didModify) {
29
30
  // original model modified, replace existing normal.json so docs/ts definitions are accurate
30
31
  fs.writeFileSync(path.join(this._apisPath, filepath), JSON.stringify(data, null, ' '));