aws-sdk 2.948.0 → 2.949.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/lib/core.d.ts CHANGED
@@ -25,3 +25,4 @@ export {Response} from './response';
25
25
  export {Service} from './service';
26
26
  export {AWSError} from './error';
27
27
  export {IniLoader} from './shared-ini/ini-loader';
28
+ export {DocumentType} from './model';
package/lib/core.js CHANGED
@@ -20,7 +20,7 @@ AWS.util.update(AWS, {
20
20
  /**
21
21
  * @constant
22
22
  */
23
- VERSION: '2.948.0',
23
+ VERSION: '2.949.0',
24
24
 
25
25
  /**
26
26
  * @api private
@@ -18,6 +18,9 @@ function translate(value, shape) {
18
18
  }
19
19
 
20
20
  function translateStructure(structure, shape) {
21
+ if (shape.isDocument) {
22
+ return structure;
23
+ }
21
24
  var struct = {};
22
25
  util.each(structure, function(name, value) {
23
26
  var memberShape = shape.members[name];
@@ -19,6 +19,7 @@ function translate(value, shape) {
19
19
 
20
20
  function translateStructure(structure, shape) {
21
21
  if (structure == null) return undefined;
22
+ if (shape.isDocument) return structure;
22
23
 
23
24
  var struct = {};
24
25
  var shapeMembers = shape.members;
@@ -0,0 +1,4 @@
1
+ export type DocumentType = Scalar | Structure | List;
2
+ type Scalar = string | number | boolean | null;
3
+ type Structure = { [member: string]: DocumentType };
4
+ interface List extends Array<DocumentType> {}
@@ -166,6 +166,7 @@ function StructureShape(shape, options) {
166
166
  property(this, 'memberNames', []);
167
167
  property(this, 'required', []);
168
168
  property(this, 'isRequired', function() { return false; });
169
+ property(this, 'isDocument', Boolean(shape.document));
169
170
  }
170
171
 
171
172
  if (shape.members) {
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.948.0",
4
+ "version": "2.949.0",
5
5
  "author": {
6
6
  "name": "Amazon Web Services",
7
7
  "email": "",
@@ -308,6 +308,9 @@ TSGenerator.prototype.generateTypingsFromShape = function generateTypingsFromSha
308
308
  return code += tabs(tabCount) + 'export type ' + shapeKey + ' = EventStream<{' + events.join(',') + '}>;\n';
309
309
  }
310
310
  if (type === 'structure') {
311
+ if (shape.isDocument) {
312
+ return code += tabs(tabCount) + 'export type ' + shapeKey + ' = DocumentType;\n'
313
+ }
311
314
  code += tabs(tabCount) + 'export interface ' + shapeKey + ' {\n';
312
315
  var members = shape.members;
313
316
  // cycle through members
@@ -508,6 +511,16 @@ TSGenerator.prototype.containsEventStreams = function containsEventStreams(model
508
511
  return false;
509
512
  };
510
513
 
514
+ TSGenerator.prototype.containsDocumentType = function containsDocumentType(model) {
515
+ var shapeNames = Object.keys(model.shapes);
516
+ for (var name of shapeNames) {
517
+ if (model.shapes[name].isDocument) {
518
+ return true;
519
+ }
520
+ }
521
+ return false;
522
+ };
523
+
511
524
  /**
512
525
  * Generates the typings for a service based on the serviceIdentifier.
513
526
  */
@@ -552,6 +565,9 @@ TSGenerator.prototype.processServiceModel = function processServiceModel(service
552
565
  if (this.containsEventStreams(model)) {
553
566
  code += 'import {EventStream} from \'../lib/event-stream/event-stream\';\n';
554
567
  }
568
+ if (this.containsDocumentType(model)) {
569
+ code += 'import {DocumentType} from \'../lib/model\';\n';
570
+ }
555
571
  // import custom namespaces
556
572
  if (customNamespaces) {
557
573
  code += customNamespaces.importCode;