aws-sdk 2.93.0 → 2.97.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.
Files changed (46) hide show
  1. package/.changes/2.94.0.json +32 -0
  2. package/.changes/2.95.0.json +17 -0
  3. package/.changes/2.96.0.json +12 -0
  4. package/.changes/2.97.0.json +22 -0
  5. package/CHANGELOG.md +24 -1
  6. package/README.md +1 -1
  7. package/apis/clouddirectory-2016-05-10.min.json +51 -32
  8. package/apis/codedeploy-2014-10-06.min.json +82 -29
  9. package/apis/cognito-idp-2016-04-18.min.json +477 -185
  10. package/apis/config-2014-11-12.min.json +43 -5
  11. package/apis/ec2-2016-11-15.min.json +1 -0
  12. package/apis/ec2-2016-11-15.waiters2.json +5 -0
  13. package/apis/elasticbeanstalk-2010-12-01.min.json +69 -63
  14. package/apis/elasticloadbalancingv2-2015-12-01.waiters2.json +36 -0
  15. package/apis/email-2010-12-01.examples.json +2 -0
  16. package/apis/email-2010-12-01.min.json +54 -45
  17. package/apis/email-2010-12-01.paginators.json +2 -2
  18. package/apis/pinpoint-2016-12-01.min.json +287 -142
  19. package/clients/clouddirectory.d.ts +20 -0
  20. package/clients/cloudsearchdomain.d.ts +2 -1
  21. package/clients/codebuild.d.ts +2 -2
  22. package/clients/codedeploy.d.ts +62 -8
  23. package/clients/cognitoidentityserviceprovider.d.ts +376 -12
  24. package/clients/configservice.d.ts +54 -6
  25. package/clients/ec2.d.ts +12 -8
  26. package/clients/elasticbeanstalk.d.ts +27 -10
  27. package/clients/elbv2.d.ts +16 -0
  28. package/clients/glacier.d.ts +2 -1
  29. package/clients/lambda.d.ts +2 -1
  30. package/clients/lexruntime.d.ts +2 -1
  31. package/clients/pinpoint.d.ts +154 -15
  32. package/clients/polly.d.ts +2 -1
  33. package/clients/rds.d.ts +68 -68
  34. package/clients/s3.d.ts +2 -1
  35. package/clients/ses.d.ts +25 -15
  36. package/dist/aws-sdk-core-react-native.js +868 -574
  37. package/dist/aws-sdk-react-native.js +887 -586
  38. package/dist/aws-sdk.js +798 -333
  39. package/dist/aws-sdk.min.js +43 -43
  40. package/lib/core.js +1 -1
  41. package/lib/credentials/credential_provider_chain.d.ts +4 -0
  42. package/lib/protocol/rest_json.js +8 -0
  43. package/lib/services/s3.js +8 -1
  44. package/lib/util.js +14 -1
  45. package/package.json +1 -1
  46. package/scripts/lib/ts-generator.js +51 -2
package/lib/core.js CHANGED
@@ -17,7 +17,7 @@ AWS.util.update(AWS, {
17
17
  /**
18
18
  * @constant
19
19
  */
20
- VERSION: '2.93.0',
20
+ VERSION: '2.97.0',
21
21
 
22
22
  /**
23
23
  * @api private
@@ -9,6 +9,10 @@ export class CredentialProviderChain extends Credentials {
9
9
  * Resolves the provider chain by searching for the first set of credentials in providers.
10
10
  */
11
11
  resolve(callback:(err: AWSError, credentials: Credentials) => void): CredentialProviderChain;
12
+ /**
13
+ * Return a Promise on resolve() function
14
+ */
15
+ resolvePromise(): Promise<Credentials>;
12
16
  /**
13
17
  * Returns a list of credentials objects or functions that return credentials objects. If the provider is a function, the function will be executed lazily when the provider needs to be checked for valid credentials. By default, this object will be set to the defaultProviders.
14
18
  */
@@ -16,11 +16,19 @@ function populateBody(req) {
16
16
 
17
17
  if (payloadShape.type === 'structure') {
18
18
  req.httpRequest.body = builder.build(params, payloadShape);
19
+ applyContentTypeHeader(req);
19
20
  } else { // non-JSON payload
20
21
  req.httpRequest.body = params;
21
22
  }
22
23
  } else {
23
24
  req.httpRequest.body = builder.build(req.params, input);
25
+ applyContentTypeHeader(req);
26
+ }
27
+ }
28
+
29
+ function applyContentTypeHeader(req) {
30
+ if (!req.httpRequest.headers['Content-Type']) {
31
+ req.httpRequest.headers['Content-Type'] = 'application/json';
24
32
  }
25
33
  }
26
34
 
@@ -772,7 +772,14 @@ AWS.util.update(AWS.S3.prototype, {
772
772
  var expires = params.Expires || 900;
773
773
  delete params.Expires; // we can't validate this
774
774
  var request = this.makeRequest(operation, params);
775
- return request.presign(expires, callback);
775
+
776
+ if (callback) {
777
+ AWS.util.defer(function() {
778
+ request.presign(expires, callback);
779
+ });
780
+ } else {
781
+ return request.presign(expires, callback);
782
+ }
776
783
  },
777
784
 
778
785
 
package/lib/util.js CHANGED
@@ -871,7 +871,7 @@ var util = {
871
871
  }, errCallback);
872
872
  };
873
873
 
874
- process.nextTick(sendRequest);
874
+ AWS.util.defer(sendRequest);
875
875
  },
876
876
 
877
877
  /**
@@ -895,6 +895,19 @@ var util = {
895
895
  }
896
896
  },
897
897
 
898
+ /**
899
+ * @api private
900
+ */
901
+ defer: function defer(callback) {
902
+ if (typeof process === 'object' && typeof process.nextTick === 'function') {
903
+ process.nextTick(callback);
904
+ } else if (typeof setImmediate === 'function') {
905
+ setImmediate(callback);
906
+ } else {
907
+ setTimeout(callback, 0);
908
+ }
909
+ },
910
+
898
911
  /**
899
912
  * @api private
900
913
  */
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.93.0",
4
+ "version": "2.97.0",
5
5
  "author": {
6
6
  "name": "Amazon Web Services",
7
7
  "email": "",
@@ -16,6 +16,7 @@ function TSGenerator(options) {
16
16
  this.metadata = null;
17
17
  this.typings = {};
18
18
  this.fillApiModelFileNames(this._apiRootDir);
19
+ this.streamTypes = {};
19
20
  }
20
21
 
21
22
  /**
@@ -244,6 +245,37 @@ TSGenerator.prototype.generateSafeShapeName = function generateSafeShapeName(nam
244
245
  return name;
245
246
  };
246
247
 
248
+ TSGenerator.prototype.extractTypesDependOnStream = function extractTypesDependOnStream(shapeKey, modelShape) {
249
+ var streamTypeList = [];
250
+ if (typeof modelShape !== "object" || Object.keys(modelShape).length === 0) {
251
+ return [];
252
+ }
253
+ if (modelShape.streaming) {
254
+ streamTypeList.push(shapeKey);
255
+ return streamTypeList;
256
+ }
257
+ for (var subModelKey in modelShape) {
258
+ var subModel = modelShape[subModelKey];
259
+ var subStreamTypeList = this.extractTypesDependOnStream(subModelKey, subModel);
260
+ if (Object.keys(subStreamTypeList).length !== 0) {
261
+ for (var streamType of subStreamTypeList) {
262
+ streamTypeList.push(streamType);
263
+ }
264
+ }
265
+ }
266
+ return streamTypeList;
267
+ }
268
+
269
+ TSGenerator.prototype.addReadableType = function addReadableType(shapeKey) {
270
+ var code = '';
271
+ if (this.streamTypes[shapeKey]) {
272
+ code += '|Readable';
273
+ } else if (shapeKey[0] === '_' && this.streamTypes[shapeKey.slice(1)]) {
274
+ code += '|Readable';
275
+ }
276
+ return code;
277
+ }
278
+
247
279
  /**
248
280
  * Generates a type or interface based on the shape.
249
281
  */
@@ -300,8 +332,10 @@ TSGenerator.prototype.generateTypingsFromShape = function generateTypingsFromSha
300
332
  code += tabs(tabCount) + 'export type ' + shapeKey + ' = Date;\n';
301
333
  } else if (type === 'boolean') {
302
334
  code += tabs(tabCount) + 'export type ' + shapeKey + ' = boolean;\n';
303
- } else if (type === 'blob' || type === 'binary') {
304
- code += tabs(tabCount) + 'export type ' + shapeKey + ' = Buffer|Uint8Array|Blob|string;\n';
335
+ } else if (type === 'blob' || type === 'binary') {
336
+ code += tabs(tabCount) + 'export type ' + shapeKey + ' = Buffer|Uint8Array|Blob|string'
337
+ + self.addReadableType(shapeKey)
338
+ +';\n';
305
339
  }
306
340
  return code;
307
341
  };
@@ -520,6 +554,14 @@ TSGenerator.prototype.processServiceModel = function processServiceModel(service
520
554
  // iterate over each shape
521
555
  var shapeKeys = Object.keys(modelShapes);
522
556
  code += 'declare namespace ' + className + ' {\n';
557
+ // preprocess shapes to fetch out needed dependency. e.g. "streaming": true
558
+ shapeKeys.forEach(function (shapeKey) {
559
+ var modelShape = modelShapes[shapeKey];
560
+ var streamTypeList = self.extractTypesDependOnStream(shapeKey, modelShape);
561
+ for (var streamType of streamTypeList) {
562
+ self.streamTypes[streamType] = true;
563
+ }
564
+ });
523
565
  shapeKeys.forEach(function (shapeKey) {
524
566
  var modelShape = modelShapes[shapeKey];
525
567
  // ignore exceptions
@@ -528,6 +570,13 @@ TSGenerator.prototype.processServiceModel = function processServiceModel(service
528
570
  }
529
571
  code += self.generateTypingsFromShape(shapeKey, modelShape, 1, customClassNames);
530
572
  });
573
+ //add extra dependencies like 'streaming'
574
+ if (Object.keys(self.streamTypes).length !== 0) {
575
+ var insertPos = code.indexOf('interface Blob {}');
576
+ code = code.slice(0, insertPos) + 'import {Readable} from \'stream\';\n' + code.slice(insertPos);
577
+ }
578
+
579
+ this.streamTypes = {};
531
580
 
532
581
  code += this.generateDocString('A string in YYYY-MM-DD format that represents the latest possible API version that can be used in this service. Specify \'latest\' to use the latest possible version.', 1);
533
582
  code += this.tabs(1) + 'export type apiVersion = "' + this.getServiceApiVersions(serviceIdentifier).join('"|"') + '"|"latest"|string;\n';