diff --git a/.prettierignore b/.prettierignore index bc0a76412b054..644973bb5ce6e 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,3 +4,4 @@ CHANGELOG.md **/*.hbs **/*/report.md clients/*/src/endpoint/ruleset.ts +**/*.java \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 323f8bd323d8c..8968e2ea8d46b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,9 @@ { "editor.tabSize": 2, + "[java]": { + "editor.tabSize": 4 + }, + "java.format.enabled": false, "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.rulers": [80, 120], diff --git a/Makefile b/Makefile index c25cafa99c07c..cebd719b647aa 100644 --- a/Makefile +++ b/Makefile @@ -20,11 +20,7 @@ turbo-build: npx turbo run build --api="http://localhost:3000" --team="aws-sdk-js" --token="xyz" node scripts/remote-cache/ stop -# Runs single-client codegen for all clients using Turborepo -turbo-generate-clients: - (cd scripts/remote-cache && yarn) - node scripts/remote-cache/ start& - sleep 3 - npx turbo run generate:client --filter=@aws-sdk/client-* --api="http://localhost:3000" --team="aws-sdk-js" --token="xyz" - node scripts/remote-cache/ stop - \ No newline at end of file +protocols: + yarn generate-clients -g codegen/sdk-codegen/aws-models/rekognitionstreaming.json + git checkout HEAD clients/client-rekognitionstreaming + yarn test:protocols \ No newline at end of file diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberDeserVisitor.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberDeserVisitor.java index 3d7624952aafd..988c1d3d45dcc 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberDeserVisitor.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberDeserVisitor.java @@ -43,6 +43,8 @@ final class JsonMemberDeserVisitor extends DocumentMemberDeserVisitor { Format defaultTimestampFormat) { super(context, dataSource, defaultTimestampFormat); this.memberShape = memberShape; + context.getWriter().addImport("_json", null, "@aws-sdk/smithy-client"); + serdeElision.setEnabledForModel(true); } JsonMemberDeserVisitor(GenerationContext context, diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberSerVisitor.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberSerVisitor.java index 5d79072193677..0b66ebed80661 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberSerVisitor.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonMemberSerVisitor.java @@ -38,6 +38,8 @@ final class JsonMemberSerVisitor extends DocumentMemberSerVisitor { */ JsonMemberSerVisitor(GenerationContext context, String dataSource, Format defaultTimestampFormat) { super(context, dataSource, defaultTimestampFormat); + context.getWriter().addImport("_json", null, "@aws-sdk/smithy-client"); + serdeElision.setEnabledForModel(true); } @Override diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java index c8d8e9457bdb3..36ac41fdf9b91 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonRpcProtocolGenerator.java @@ -164,4 +164,9 @@ private DocumentMemberDeserVisitor getMemberDeserVisitor(GenerationContext conte public void generateProtocolTests(GenerationContext context) { AwsProtocolUtils.generateProtocolTests(this, context); } + + @Override + protected boolean enableSerdeElision() { + return true; + } } diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeDeserVisitor.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeDeserVisitor.java index 90ad773dad383..436b5e23076c2 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeDeserVisitor.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeDeserVisitor.java @@ -41,6 +41,7 @@ import software.amazon.smithy.typescript.codegen.integration.DocumentMemberDeserVisitor; import software.amazon.smithy.typescript.codegen.integration.DocumentShapeDeserVisitor; import software.amazon.smithy.typescript.codegen.integration.ProtocolGenerator.GenerationContext; +import software.amazon.smithy.typescript.codegen.validation.UnaryFunctionCall; import software.amazon.smithy.utils.SmithyInternalApi; /** @@ -59,10 +60,10 @@ final class JsonShapeDeserVisitor extends DocumentShapeDeserVisitor { JsonShapeDeserVisitor(GenerationContext context) { this(context, - // Use the jsonName trait value if present, otherwise use the member name. - (memberShape, memberName) -> memberShape.getTrait(JsonNameTrait.class) - .map(JsonNameTrait::getValue) - .orElse(memberName)); + // Use the jsonName trait value if present, otherwise use the member name. + (memberShape, memberName) -> memberShape.getTrait(JsonNameTrait.class) + .map(JsonNameTrait::getValue) + .orElse(memberName)); } JsonShapeDeserVisitor(GenerationContext context, BiFunction memberNameStrategy) { @@ -82,34 +83,52 @@ protected void deserializeCollection(GenerationContext context, CollectionShape // Filter out null entries if we don't have the sparse trait. String potentialFilter = ""; + if (!shape.hasTrait(SparseTrait.ID) && !artifactType.equals(ArtifactType.SSDK)) { potentialFilter = ".filter((e: any) => e != null)"; } - writer.openBlock("const retVal = (output || [])$L.map((entry: any) => {", "});", potentialFilter, () -> { - // Short circuit null values from serialization. - writer.openBlock("if (entry === null) {", "}", () -> { - // In the SSDK we want to be very strict about not accepting nulls in non-sparse lists. - if (!shape.hasTrait(SparseTrait.ID) && artifactType.equals(ArtifactType.SSDK)) { - writer.write("throw new TypeError('All elements of the non-sparse list $S must be non-null.');", - shape.getId()); - } else { - writer.write("return null as any;"); + final String filterExpression = potentialFilter; + + String returnExpression = target.accept(getMemberVisitor(shape.getMember(), "entry")); + + if (returnExpression.equals("entry")) { + writer.write("const retVal = (output || [])$L", filterExpression); + } else { + writer.openBlock("const retVal = (output || [])$L.map((entry: any) => {", "});", + filterExpression, () -> { + // Short circuit null values from serialization. + if (filterExpression.isEmpty()) { + writer.openBlock("if (entry === null) {", "}", () -> { + // In the SSDK we want to be very strict about not accepting nulls in non-sparse + // lists. + if (!shape.hasTrait(SparseTrait.ID) && artifactType.equals(ArtifactType.SSDK)) { + writer.write( + "throw new TypeError('All elements of the non-sparse list $S must be non-null.');", + shape.getId()); + } else { + writer.write("return null as any;"); + } + }); + } + + // Dispatch to the output value provider for any additional handling. + writer.write("return $L$L;", + target.accept(getMemberVisitor(shape.getMember(), "entry")), + usesExpect(target) ? " as any" : ""); } - }); + ); + } - // Dispatch to the output value provider for any additional handling. - writer.write("return $L$L;", target.accept(getMemberVisitor(shape.getMember(), "entry")), - usesExpect(target) ? " as any" : ""); - }); if (shape.isSetShape() && artifactType.equals(ArtifactType.SSDK)) { writer.addDependency(TypeScriptDependency.SERVER_COMMON); writer.addImport("findDuplicates", "__findDuplicates", "@aws-smithy/server-common"); writer.openBlock("if (__findDuplicates(retVal).length > 0) {", "}", () -> { writer.write("throw new TypeError('All elements of the set $S must be unique.');", - shape.getId()); + shape.getId()); }); } + writer.write("return retVal;"); } @@ -140,6 +159,7 @@ protected void deserializeMap(GenerationContext context, MapShape shape) { if (shape.hasTrait(SparseTrait.ID)) { writer.write("acc[key] = null as any;"); } + writer.write("return acc;"); }); @@ -158,28 +178,74 @@ protected void deserializeStructure(GenerationContext context, StructureShape sh // Prepare the document contents structure. // Use a TreeMap to sort the members. Map members = new TreeMap<>(shape.getAllMembers()); - writer.openBlock("return {", "} as any;", () -> { + writer.openBlock("return take(output, {", "}) as any;", () -> { // Set all the members to undefined to meet type constraints. members.forEach((memberName, memberShape) -> { - String locationName = memberNameStrategy.apply(memberShape, memberName); + String wireName = memberNameStrategy.apply(memberShape, memberName); + boolean hasJsonName = memberShape.hasTrait(JsonNameTrait.class); Shape target = context.getModel().expectShape(memberShape.getTarget()); - String propertyAccess = getFrom("output", locationName); + String propertyAccess = getFrom("output", wireName); + String value = target.accept(getMemberVisitor(memberShape, "_")); - if (usesExpect(target)) { - // Booleans and numbers will call expectBoolean/expectNumber which will handle - // null/undefined properly. - writer.write("$L: $L,", - memberName, - target.accept(getMemberVisitor(memberShape, propertyAccess))); + if (hasJsonName) { + if (usesExpect(target)) { + if (UnaryFunctionCall.check(value)) { + writer.write("$L: [,$L,`$L`],", memberName, UnaryFunctionCall.toRef(value), wireName); + } else { + writer.write("$L: [,$L,`$L`],", memberName, "_ => " + value, wireName); + } + } else { + String valueExpression = target.accept(getMemberVisitor(memberShape, propertyAccess)); + + if (valueExpression.equals(propertyAccess)) { + writer.write("$L: [,,`$L`],", memberName, wireName); + } else { + String functionExpression = value; + boolean isUnaryCall = UnaryFunctionCall.check(functionExpression); + if (isUnaryCall) { + writer.write("$L: [,$L,`$L`],", + memberName, + UnaryFunctionCall.toRef(functionExpression), + wireName + ); + } else { + writer.write("$L: _ => [,$L,`$L`],", + memberName, + functionExpression, + wireName + ); + } + } + } } else { - writer.write( - "$1L: ($2L != null) ? $3L: undefined,", - memberName, - propertyAccess, - // Dispatch to the output value provider for any additional handling. - target.accept(getMemberVisitor(memberShape, propertyAccess)) - ); + if (usesExpect(target)) { + if (UnaryFunctionCall.check(value)) { + writer.write("$L: $L,", memberName, UnaryFunctionCall.toRef(value)); + } else { + writer.write("$L: $L,", memberName, "_ => " + value); + } + } else { + String valueExpression = target.accept(getMemberVisitor(memberShape, propertyAccess)); + + if (valueExpression.equals(propertyAccess)) { + writer.write("$1L: [],", memberName); + } else { + String functionExpression = value; + boolean isUnaryCall = UnaryFunctionCall.check(functionExpression); + if (isUnaryCall) { + writer.write("$1L: $2L,", + memberName, + UnaryFunctionCall.toRef(functionExpression) + ); + } else { + writer.write("$1L: _ => $2L,", + memberName, + functionExpression + ); + } + } + } } }); }); @@ -190,8 +256,10 @@ private boolean usesExpect(Shape shape) { if (shape.hasTrait(MediaTypeTrait.class)) { return !CodegenUtils.isJsonMediaType(shape.expectTrait(MediaTypeTrait.class).getValue()); } + return true; } + return shape.isBooleanShape() || shape instanceof NumberShape; } @@ -207,6 +275,7 @@ protected void deserializeUnion(GenerationContext context, UnionShape shape) { String locationName = memberNameStrategy.apply(memberShape, memberName); String memberValue = target.accept(getMemberVisitor(memberShape, getFrom("output", locationName))); + if (usesExpect(target)) { // Booleans and numbers will call expectBoolean/expectNumber which will handle // null/undefined properly. @@ -230,4 +299,4 @@ protected void deserializeUnion(GenerationContext context, UnionShape shape) { // Or write to the unknown member the element in the output. writer.write("return { $$unknown: Object.entries(output)[0] };"); } -} +} \ No newline at end of file diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeSerVisitor.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeSerVisitor.java index b55504a5cc2a7..a75290dbc935c 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeSerVisitor.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/JsonShapeSerVisitor.java @@ -84,15 +84,21 @@ public void serializeCollection(GenerationContext context, CollectionShape shape potentialFilter = ".filter((e: any) => e != null)"; } - writer.openBlock("return input$L.map(entry => {", "});", potentialFilter, () -> { - // Short circuit null values from serialization. - if (hasSparseTrait) { - writer.write("if (entry === null) { return null as any; }"); - } - - // Dispatch to the input value provider for any additional handling. - writer.write("return $L;", target.accept(getMemberVisitor("entry"))); - }); + String returnedExpression = target.accept(getMemberVisitor("entry")); + + if (returnedExpression.equals("entry")) { + writer.write("return input$L;", potentialFilter); + } else { + writer.openBlock("return input$L.map(entry => {", "});", potentialFilter, () -> { + // Short circuit null values from serialization. + if (hasSparseTrait) { + writer.write("if (entry === null) { return null as any; }"); + } + + // Dispatch to the input value provider for any additional handling. + writer.write("return $L;", target.accept(getMemberVisitor("entry"))); + }); + } } @Override @@ -133,26 +139,43 @@ public void serializeMap(GenerationContext context, MapShape shape) { @Override public void serializeStructure(GenerationContext context, StructureShape shape) { TypeScriptWriter writer = context.getWriter(); + writer.addImport("take", null, "@aws-sdk/smithy-client"); - writer.openBlock("return {", "};", () -> { + writer.openBlock("return take(input, {", "});", () -> { // Use a TreeMap to sort the members. Map members = new TreeMap<>(shape.getAllMembers()); members.forEach((memberName, memberShape) -> { - String locationName = memberNameStrategy.apply(memberShape, memberName); + String wireName = memberNameStrategy.apply(memberShape, memberName); + boolean hasJsonName = memberShape.hasTrait(JsonNameTrait.class); Shape target = context.getModel().expectShape(memberShape.getTarget()); String inputLocation = "input." + memberName; // Handle @timestampFormat on members not just the targeted shape. - String valueProvider = memberShape.hasTrait(TimestampFormatTrait.class) + String valueProvider = "_ => " + (memberShape.hasTrait(TimestampFormatTrait.class) ? AwsProtocolUtils.getInputTimestampValueProvider(context, memberShape, - TIMESTAMP_FORMAT, inputLocation) - : target.accept(getMemberVisitor(inputLocation)); - - if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { - writer.write("'$L': $L ?? generateIdempotencyToken(),", locationName, valueProvider); + TIMESTAMP_FORMAT, "_") + : target.accept(getMemberVisitor("_"))); + + if (hasJsonName) { + if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { + writer.write("'$L': [, _ => _ ?? generateIdempotencyToken(), `$L`],", wireName, memberName); + } else { + if (valueProvider.equals("_ => _")) { + writer.write("$L: [,,`$L`],", wireName, memberName); + } else { + writer.write("$L: [,$L,`$L`],", wireName, valueProvider, memberName); + } + } } else { - writer.write("...($1L != null && { $2S: $3L }),", - inputLocation, locationName, valueProvider); + if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { + writer.write("'$L': _ => _ ?? generateIdempotencyToken(),", memberName); + } else { + if (valueProvider.equals("_ => _")) { + writer.write("$1S: [],", memberName); + } else { + writer.write("$1S: $2L,", memberName, valueProvider); + } + } } }); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java index 5c59b6edd44e3..3b01ad845b473 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/RestJsonProtocolGenerator.java @@ -33,6 +33,7 @@ import software.amazon.smithy.typescript.codegen.integration.DocumentMemberDeserVisitor; import software.amazon.smithy.typescript.codegen.integration.DocumentMemberSerVisitor; import software.amazon.smithy.typescript.codegen.integration.HttpBindingProtocolGenerator; +import software.amazon.smithy.typescript.codegen.validation.UnaryFunctionCall; import software.amazon.smithy.utils.IoUtils; import software.amazon.smithy.utils.SmithyInternalApi; @@ -84,6 +85,7 @@ public void generateSharedComponents(GenerationContext context) { TypeScriptWriter writer = context.getWriter(); writer.addUseImports(getApplicationProtocol().getResponseType()); + writer.addImport("take", null, "@aws-sdk/smithy-client"); writer.write(IoUtils.readUtf8Resource(getClass(), "load-json-error-code-stub.ts")); } @@ -146,29 +148,46 @@ private void serializeDocumentBody(GenerationContext context, List TypeScriptWriter writer = context.getWriter(); SymbolProvider symbolProvider = context.getSymbolProvider(); - writer.openBlock("body = JSON.stringify({", "});", () -> { + writer.openBlock("body = JSON.stringify(take(input, {", "}));", () -> { for (HttpBinding binding : documentBindings) { MemberShape memberShape = binding.getMember(); // The name of the member to get from the input shape. String memberName = symbolProvider.toMemberName(memberShape); String inputLocation = "input." + memberName; // Use the jsonName trait value if present, otherwise use the member name. - String locationName = memberShape.getTrait(JsonNameTrait.class) + String wireName = memberShape.getTrait(JsonNameTrait.class) .map(JsonNameTrait::getValue) .orElseGet(binding::getLocationName); + boolean hasJsonName = memberShape.hasTrait(JsonNameTrait.class); Shape target = context.getModel().expectShape(memberShape.getTarget()); // Handle @timestampFormat on members not just the targeted shape. - String valueProvider = memberShape.hasTrait(TimestampFormatTrait.class) + String valueProvider = "_ => " + (memberShape.hasTrait(TimestampFormatTrait.class) ? AwsProtocolUtils.getInputTimestampValueProvider(context, memberShape, - getDocumentTimestampFormat(), inputLocation) - : target.accept(getMemberSerVisitor(context, inputLocation)); - - if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { - writer.write("'$L': $L ?? generateIdempotencyToken(),", locationName, valueProvider); + getDocumentTimestampFormat(), "_") + : target.accept(getMemberSerVisitor(context, "_"))); + + if (hasJsonName) { + if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { + writer.write("'$L': [,_ => _ ?? generateIdempotencyToken(),$L],", + wireName, memberName); + } else { + if (valueProvider.equals("_ => _")) { + writer.write("$S: [,,`$L`],", wireName, memberName); + } else { + writer.write("$1S: [, $2L, `$3L`],", wireName, valueProvider, memberName); + } + } } else { - writer.write("...($1L != null && { $2S: $3L }),", - inputLocation, locationName, valueProvider); + if (memberShape.hasTrait(IdempotencyTokenTrait.class)) { + writer.write("'$L': _ => _ ?? generateIdempotencyToken(),", wireName); + } else { + if (valueProvider.equals("_ => _")) { + writer.write("$1S: [],", wireName); + } else { + writer.write("$1S: $2L,", wireName, valueProvider); + } + } } } }); @@ -282,21 +301,39 @@ private void deserializeDocumentBody( ) { TypeScriptWriter writer = context.getWriter(); SymbolProvider symbolProvider = context.getSymbolProvider(); + writer.addImport("take", null, "@aws-sdk/smithy-client"); - for (HttpBinding binding : documentBindings) { - Shape target = context.getModel().expectShape(binding.getMember().getTarget()); - // The name of the member to get from the input shape. - String memberName = symbolProvider.toMemberName(binding.getMember()); - // Use the jsonName trait value if present, otherwise use the member name. - String locationName = binding.getMember().getTrait(JsonNameTrait.class) - .map(JsonNameTrait::getValue) - .orElseGet(binding::getLocationName); - writer.openBlock("if (data.$L != null) {", "}", locationName, - () -> { - writer.write("contents.$L = $L;", memberName, - target.accept(getMemberDeserVisitor(context, binding.getMember(), "data." + locationName))); - }); - } + writer.openBlock("const doc = take(data, {", "});", () -> { + for (HttpBinding binding : documentBindings) { + Shape target = context.getModel().expectShape(binding.getMember().getTarget()); + // The name of the member to get from the input shape. + String memberName = symbolProvider.toMemberName(binding.getMember()); + // Use the jsonName trait value if present, otherwise use the member name. + String wireName = binding.getMember().getTrait(JsonNameTrait.class) + .map(JsonNameTrait::getValue) + .orElseGet(binding::getLocationName); + boolean hasJsonName = binding.getMember().hasTrait(JsonNameTrait.class); + + String valueExpression = target.accept( + getMemberDeserVisitor(context, binding.getMember(), "_")); + boolean isUnaryCall = UnaryFunctionCall.check(valueExpression); + if (hasJsonName) { + if (isUnaryCall) { + writer.write("$L: [, $L, `$L`],", + memberName, UnaryFunctionCall.toRef(valueExpression), wireName); + } else { + writer.write("$L: [, _ => $L, `$L`],", memberName, valueExpression, wireName); + } + } else { + if (isUnaryCall) { + writer.write("$L: $L,", wireName, UnaryFunctionCall.toRef(valueExpression)); + } else { + writer.write("$L: _ => $L,", wireName, valueExpression); + } + } + } + }); + writer.write("Object.assign(contents, doc);"); } @Override @@ -360,4 +397,9 @@ public void generateProtocolTests(GenerationContext context) { protected boolean requiresNumericEpochSecondsInPayload() { return true; } + + @Override + protected boolean enableSerdeElision() { + return true; + } } diff --git a/packages/smithy-client/src/default-error-handler.ts b/packages/smithy-client/src/default-error-handler.ts index f2b31832c4efd..cf742aa24ebaa 100644 --- a/packages/smithy-client/src/default-error-handler.ts +++ b/packages/smithy-client/src/default-error-handler.ts @@ -19,6 +19,17 @@ export const throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode throw decorateServiceException(response, parsedBody); }; +/** + * @internal + * + * Creates {@link throwDefaultError} with bound ExceptionCtor. + */ +export const withBaseException = (ExceptionCtor: { new (...args: any): any }): any => { + return ({ output, parsedBody, errorCode }: any) => { + throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); + }; +}; + const deserializeMetadata = (output: HttpResponse): ResponseMetadata => ({ httpStatusCode: output.statusCode, requestId: diff --git a/packages/smithy-client/src/index.ts b/packages/smithy-client/src/index.ts index 0b7db823a4eba..7828236d3647a 100644 --- a/packages/smithy-client/src/index.ts +++ b/packages/smithy-client/src/index.ts @@ -15,5 +15,6 @@ export * from "./object-mapping"; export * from "./parse-utils"; export * from "./resolve-path"; export * from "./ser-utils"; +export * from "./serde-json"; export * from "./split-every"; export type { DocumentType, SdkError, SmithyException } from "@aws-sdk/types"; diff --git a/packages/smithy-client/src/serde-json.spec.ts b/packages/smithy-client/src/serde-json.spec.ts new file mode 100644 index 0000000000000..cca3b35eabd69 --- /dev/null +++ b/packages/smithy-client/src/serde-json.spec.ts @@ -0,0 +1,39 @@ +import { _json } from "./serde-json"; + +describe(_json.name, () => { + it("removes nullish entries", () => { + expect( + _json({ + g: void 0, + a: { + e: void 0, + b: { + c: { + f: void 0, + }, + d: void 0, + }, + }, + }) + ).toEqual({ + a: { + b: { + c: {}, + }, + }, + }); + }); + + it("filters sparse lists", () => { + expect( + _json({ + a: { + b: 5, + c: [, , , 6], + }, + }) + ).toEqual({ + a: { b: 5, c: [6] }, + }); + }); +}); diff --git a/packages/smithy-client/src/serde-json.ts b/packages/smithy-client/src/serde-json.ts new file mode 100644 index 0000000000000..bf5768f405a0f --- /dev/null +++ b/packages/smithy-client/src/serde-json.ts @@ -0,0 +1,28 @@ +/** + * @internal + * + * Maps an object through the default JSON serde behavior. + * This means removing nullish fields and un-sparsifying lists. + * + * @param obj - to be checked. + * @returns same object with default serde behavior applied. + */ +export const _json = (obj: any): any => { + if (obj == null) { + return {}; + } + if (Array.isArray(obj)) { + return obj.filter((_: any) => _ != null); + } + if (typeof obj === 'object') { + const target: any = {}; + for (const key of Object.keys(obj)) { + if (obj[key] == null) { + continue; + } + target[key] = _json(obj[key]); + } + return target; + } + return obj; +} diff --git a/private/aws-echo-service/src/protocols/Aws_restJson1.ts b/private/aws-echo-service/src/protocols/Aws_restJson1.ts index 4feb301fd3adc..a1c91fe9cfce2 100644 --- a/private/aws-echo-service/src/protocols/Aws_restJson1.ts +++ b/private/aws-echo-service/src/protocols/Aws_restJson1.ts @@ -10,9 +10,11 @@ import { expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, - map as __map, resolvedPath as __resolvedPath, - throwDefaultError, + _json, + map, + take, + withBaseException, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -31,9 +33,11 @@ export const se_EchoCommand = async (input: EchoCommandInput, context: __SerdeCo }; let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/echo"; let body: any; - body = JSON.stringify({ - ...(input.string != null && { string: input.string }), - }); + body = JSON.stringify( + take(input, { + string: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -76,9 +80,10 @@ export const de_EchoCommand = async (output: __HttpResponse, context: __SerdeCon $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.string != null) { - contents.string = __expectString(data.string); - } + const doc = take(data, { + string: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -97,10 +102,9 @@ const de_EchoCommandError = async (output: __HttpResponse, context: __SerdeConte throw await de_PalindromeExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } @@ -120,9 +124,10 @@ export const de_LengthCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.length != null) { - contents.length = __expectInt32(data.length); - } + const doc = take(data, { + length: __expectInt32, + }); + Object.assign(contents, doc); return contents; }; @@ -141,25 +146,25 @@ const de_LengthCommandError = async (output: __HttpResponse, context: __SerdeCon throw await de_PalindromeExceptionRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } }; -const map = __map; +const throwDefaultError = withBaseException(__BaseException); /** * deserializeAws_restJson1PalindromeExceptionRes */ const de_PalindromeExceptionRes = async (parsedOutput: any, context: __SerdeContext): Promise => { const contents: any = map({}); const data: any = parsedOutput.body; - if (data.message != null) { - contents.message = __expectString(data.message); - } + const doc = take(data, { + message: __expectString, + }); + Object.assign(contents, doc); const exception = new PalindromeException({ $metadata: deserializeMetadata(parsedOutput), ...contents, diff --git a/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts b/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts index c5447d83d9da1..f78bc5b89ba94 100644 --- a/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts +++ b/private/aws-protocoltests-ec2/src/protocols/Aws_ec2.ts @@ -21,7 +21,7 @@ import { strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, strictParseShort as __strictParseShort, - throwDefaultError, + withBaseException, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -140,7 +140,7 @@ export const se_EmptyInputAndEmptyOutputCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_EmptyInputAndEmptyOutputInput(input, context), + ...se_EmptyInputAndEmptyOutputInput(input /* DEBUG_REMOVE no elision */, context), Action: "EmptyInputAndEmptyOutput", Version: "2020-01-08", }); @@ -183,7 +183,7 @@ export const se_EndpointWithHostLabelOperationCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_HostLabelInput(input, context), + ...se_HostLabelInput(input /* DEBUG_REMOVE no elision */, context), Action: "EndpointWithHostLabelOperation", Version: "2020-01-08", }); @@ -281,7 +281,7 @@ export const se_NestedStructuresCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_NestedStructuresInput(input, context), + ...se_NestedStructuresInput(input /* DEBUG_REMOVE no elision */, context), Action: "NestedStructures", Version: "2020-01-08", }); @@ -317,7 +317,7 @@ export const se_QueryIdempotencyTokenAutoFillCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryIdempotencyTokenAutoFillInput(input, context), + ...se_QueryIdempotencyTokenAutoFillInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryIdempotencyTokenAutoFill", Version: "2020-01-08", }); @@ -336,7 +336,7 @@ export const se_QueryListsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryListsInput(input, context), + ...se_QueryListsInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryLists", Version: "2020-01-08", }); @@ -355,7 +355,7 @@ export const se_QueryTimestampsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryTimestampsInput(input, context), + ...se_QueryTimestampsInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryTimestamps", Version: "2020-01-08", }); @@ -391,7 +391,7 @@ export const se_SimpleInputParamsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_SimpleInputParamsInput(input, context), + ...se_SimpleInputParamsInput(input /* DEBUG_REMOVE no elision */, context), Action: "SimpleInputParams", Version: "2020-01-08", }); @@ -563,12 +563,12 @@ export const de_DatetimeOffsetsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_DatetimeOffsetsOutput(data, context); + contents = de_DatetimeOffsetsOutput(data /* DEBUG_REMOVE no elision */, context); const response: DatetimeOffsetsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -584,10 +584,9 @@ const de_DatetimeOffsetsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -604,12 +603,12 @@ export const de_EmptyInputAndEmptyOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_EmptyInputAndEmptyOutputOutput(data, context); + contents = de_EmptyInputAndEmptyOutputOutput(data /* DEBUG_REMOVE no elision */, context); const response: EmptyInputAndEmptyOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -625,10 +624,9 @@ const de_EmptyInputAndEmptyOutputCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -647,7 +645,7 @@ export const de_EndpointOperationCommand = async ( const response: EndpointOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -663,10 +661,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -685,7 +682,7 @@ export const de_EndpointWithHostLabelOperationCommand = async ( const response: EndpointWithHostLabelOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -701,10 +698,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -721,12 +717,12 @@ export const de_FractionalSecondsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FractionalSecondsOutput(data, context); + contents = de_FractionalSecondsOutput(data /* DEBUG_REMOVE no elision */, context); const response: FractionalSecondsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -742,10 +738,9 @@ const de_FractionalSecondsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -762,12 +757,12 @@ export const de_GreetingWithErrorsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_GreetingWithErrorsOutput(data, context); + contents = de_GreetingWithErrorsOutput(data /* DEBUG_REMOVE no elision */, context); const response: GreetingWithErrorsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -791,10 +786,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); } @@ -814,7 +808,7 @@ export const de_HostWithPathOperationCommand = async ( const response: HostWithPathOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -830,10 +824,9 @@ const de_HostWithPathOperationCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -850,12 +843,12 @@ export const de_IgnoresWrappingXmlNameCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_IgnoresWrappingXmlNameOutput(data, context); + contents = de_IgnoresWrappingXmlNameOutput(data /* DEBUG_REMOVE no elision */, context); const response: IgnoresWrappingXmlNameCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -871,10 +864,9 @@ const de_IgnoresWrappingXmlNameCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -893,7 +885,7 @@ export const de_NestedStructuresCommand = async ( const response: NestedStructuresCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -909,10 +901,9 @@ const de_NestedStructuresCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -929,12 +920,12 @@ export const de_NoInputAndOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_NoInputAndOutputOutput(data, context); + contents = de_NoInputAndOutputOutput(data /* DEBUG_REMOVE no elision */, context); const response: NoInputAndOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -950,10 +941,9 @@ const de_NoInputAndOutputCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -972,7 +962,7 @@ export const de_QueryIdempotencyTokenAutoFillCommand = async ( const response: QueryIdempotencyTokenAutoFillCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -988,10 +978,9 @@ const de_QueryIdempotencyTokenAutoFillCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1010,7 +999,7 @@ export const de_QueryListsCommand = async ( const response: QueryListsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1026,10 +1015,9 @@ const de_QueryListsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1048,7 +1036,7 @@ export const de_QueryTimestampsCommand = async ( const response: QueryTimestampsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1064,10 +1052,9 @@ const de_QueryTimestampsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1084,12 +1071,12 @@ export const de_RecursiveXmlShapesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_RecursiveXmlShapesOutput(data, context); + contents = de_RecursiveXmlShapesOutput(data /* DEBUG_REMOVE no elision */, context); const response: RecursiveXmlShapesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1105,10 +1092,9 @@ const de_RecursiveXmlShapesCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1127,7 +1113,7 @@ export const de_SimpleInputParamsCommand = async ( const response: SimpleInputParamsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1143,10 +1129,9 @@ const de_SimpleInputParamsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1163,12 +1148,12 @@ export const de_SimpleScalarXmlPropertiesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_SimpleScalarXmlPropertiesOutput(data, context); + contents = de_SimpleScalarXmlPropertiesOutput(data /* DEBUG_REMOVE no elision */, context); const response: SimpleScalarXmlPropertiesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1184,10 +1169,9 @@ const de_SimpleScalarXmlPropertiesCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1204,12 +1188,12 @@ export const de_XmlBlobsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlBlobsOutput(data, context); + contents = de_XmlBlobsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlBlobsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1225,10 +1209,9 @@ const de_XmlBlobsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1245,12 +1228,12 @@ export const de_XmlEmptyBlobsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlBlobsOutput(data, context); + contents = de_XmlBlobsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlEmptyBlobsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1266,10 +1249,9 @@ const de_XmlEmptyBlobsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1286,12 +1268,12 @@ export const de_XmlEmptyListsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlListsOutput(data, context); + contents = de_XmlListsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlEmptyListsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1307,10 +1289,9 @@ const de_XmlEmptyListsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1327,12 +1308,12 @@ export const de_XmlEnumsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlEnumsOutput(data, context); + contents = de_XmlEnumsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlEnumsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1348,10 +1329,9 @@ const de_XmlEnumsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1368,12 +1348,12 @@ export const de_XmlIntEnumsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlIntEnumsOutput(data, context); + contents = de_XmlIntEnumsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlIntEnumsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1389,10 +1369,9 @@ const de_XmlIntEnumsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1409,12 +1388,12 @@ export const de_XmlListsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlListsOutput(data, context); + contents = de_XmlListsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlListsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1430,10 +1409,9 @@ const de_XmlListsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1450,12 +1428,12 @@ export const de_XmlNamespacesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlNamespacesOutput(data, context); + contents = de_XmlNamespacesOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlNamespacesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1471,10 +1449,9 @@ const de_XmlNamespacesCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1491,12 +1468,12 @@ export const de_XmlTimestampsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlTimestampsOutput(data, context); + contents = de_XmlTimestampsOutput(data /* DEBUG_REMOVE no elision */, context); const response: XmlTimestampsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1512,10 +1489,9 @@ const de_XmlTimestampsCommandError = async ( }; const errorCode = loadEc2ErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Errors.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1587,7 +1563,7 @@ const se_ListWithXmlName = (input: string[], context: __SerdeContext): any => { const se_NestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { const entries: any = {}; if (input.Nested != null) { - const memberEntries = se_StructArg(input.Nested, context); + const memberEntries = se_StructArg(input.Nested /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `Nested.${key}`; entries[loc] = value; @@ -1602,7 +1578,7 @@ const se_NestedStructuresInput = (input: NestedStructuresInput, context: __Serde const se_NestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { const entries: any = {}; if (input.ListArg != null) { - const memberEntries = se_StringList(input.ListArg, context); + const memberEntries = se_StringList(input.ListArg /* DEBUG_REMOVE no elision */, context); if (input.ListArg?.length === 0) { entries.ListArg = []; } @@ -1637,7 +1613,7 @@ const se_QueryIdempotencyTokenAutoFillInput = ( const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { const entries: any = {}; if (input.ListArg != null) { - const memberEntries = se_StringList(input.ListArg, context); + const memberEntries = se_StringList(input.ListArg /* DEBUG_REMOVE no elision */, context); if (input.ListArg?.length === 0) { entries.ListArg = []; } @@ -1647,7 +1623,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.ComplexListArg != null) { - const memberEntries = se_GreetingList(input.ComplexListArg, context); + const memberEntries = se_GreetingList(input.ComplexListArg /* DEBUG_REMOVE no elision */, context); if (input.ComplexListArg?.length === 0) { entries.ComplexListArg = []; } @@ -1657,7 +1633,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.ListArgWithXmlNameMember != null) { - const memberEntries = se_ListWithXmlName(input.ListArgWithXmlNameMember, context); + const memberEntries = se_ListWithXmlName(input.ListArgWithXmlNameMember /* DEBUG_REMOVE no elision */, context); if (input.ListArgWithXmlNameMember?.length === 0) { entries.ListArgWithXmlNameMember = []; } @@ -1667,7 +1643,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.ListArgWithXmlName != null) { - const memberEntries = se_ListWithXmlName(input.ListArgWithXmlName, context); + const memberEntries = se_ListWithXmlName(input.ListArgWithXmlName /* DEBUG_REMOVE no elision */, context); if (input.ListArgWithXmlName?.length === 0) { entries.Hi = []; } @@ -1677,7 +1653,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.NestedWithList != null) { - const memberEntries = se_NestedStructWithList(input.NestedWithList, context); + const memberEntries = se_NestedStructWithList(input.NestedWithList /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `NestedWithList.${key}`; entries[loc] = value; @@ -1756,7 +1732,7 @@ const se_StructArg = (input: StructArg, context: __SerdeContext): any => { entries["OtherArg"] = input.OtherArg; } if (input.RecursiveArg != null) { - const memberEntries = se_StructArg(input.RecursiveArg, context); + const memberEntries = se_StructArg(input.RecursiveArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `RecursiveArg.${key}`; entries[loc] = value; @@ -1775,7 +1751,7 @@ const se_GreetingList = (input: GreetingStruct[], context: __SerdeContext): any if (entry === null) { continue; } - const memberEntries = se_GreetingStruct(entry, context); + const memberEntries = se_GreetingStruct(entry /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { entries[`Member.${counter}.${key}`] = value; }); @@ -1820,7 +1796,7 @@ const de_ComplexError = (output: any, context: __SerdeContext): ComplexError => contents.TopLevel = __expectString(output["TopLevel"]); } if (output["Nested"] !== undefined) { - contents.Nested = de_ComplexNestedErrorData(output["Nested"], context); + contents.Nested = de_ComplexNestedErrorData(output["Nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -1938,7 +1914,7 @@ const de_NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInpu const de_RecursiveXmlShapesOutput = (output: any, context: __SerdeContext): RecursiveXmlShapesOutput => { const contents: any = {}; if (output["nested"] !== undefined) { - contents.nested = de_RecursiveXmlShapesOutputNested1(output["nested"], context); + contents.nested = de_RecursiveXmlShapesOutputNested1(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -1952,7 +1928,7 @@ const de_RecursiveXmlShapesOutputNested1 = (output: any, context: __SerdeContext contents.foo = __expectString(output["foo"]); } if (output["nested"] !== undefined) { - contents.nested = de_RecursiveXmlShapesOutputNested2(output["nested"], context); + contents.nested = de_RecursiveXmlShapesOutputNested2(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -1966,7 +1942,10 @@ const de_RecursiveXmlShapesOutputNested2 = (output: any, context: __SerdeContext contents.bar = __expectString(output["bar"]); } if (output["recursiveMember"] !== undefined) { - contents.recursiveMember = de_RecursiveXmlShapesOutputNested1(output["recursiveMember"], context); + contents.recursiveMember = de_RecursiveXmlShapesOutputNested1( + output["recursiveMember"] /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2027,7 +2006,7 @@ const de_StructureList = (output: any, context: __SerdeContext): StructureListMe return (output || []) .filter((e: any) => e != null) .map((entry: any) => { - return de_StructureListMember(entry, context); + return de_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -2073,17 +2052,26 @@ const de_XmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput if (output.fooEnumList === "") { contents.fooEnumList = []; } else if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = de_FooEnumList(__getArrayIfSingleItem(output["fooEnumList"]["member"]), context); + contents.fooEnumList = de_FooEnumList( + __getArrayIfSingleItem(output["fooEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.fooEnumSet === "") { contents.fooEnumSet = []; } else if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = de_FooEnumSet(__getArrayIfSingleItem(output["fooEnumSet"]["member"]), context); + contents.fooEnumSet = de_FooEnumSet( + __getArrayIfSingleItem(output["fooEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.fooEnumMap === "") { contents.fooEnumMap = {}; } else if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = de_FooEnumMap(__getArrayIfSingleItem(output["fooEnumMap"]["entry"]), context); + contents.fooEnumMap = de_FooEnumMap( + __getArrayIfSingleItem(output["fooEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2105,17 +2093,26 @@ const de_XmlIntEnumsOutput = (output: any, context: __SerdeContext): XmlIntEnums if (output.intEnumList === "") { contents.intEnumList = []; } else if (output["intEnumList"] !== undefined && output["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(output["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(output["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumSet === "") { contents.intEnumSet = []; } else if (output["intEnumSet"] !== undefined && output["intEnumSet"]["member"] !== undefined) { - contents.intEnumSet = de_IntegerEnumSet(__getArrayIfSingleItem(output["intEnumSet"]["member"]), context); + contents.intEnumSet = de_IntegerEnumSet( + __getArrayIfSingleItem(output["intEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumMap === "") { contents.intEnumMap = {}; } else if (output["intEnumMap"] !== undefined && output["intEnumMap"]["entry"] !== undefined) { - contents.intEnumMap = de_IntegerEnumMap(__getArrayIfSingleItem(output["intEnumMap"]["entry"]), context); + contents.intEnumMap = de_IntegerEnumMap( + __getArrayIfSingleItem(output["intEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2128,66 +2125,96 @@ const de_XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput if (output.stringList === "") { contents.stringList = []; } else if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { - contents.stringList = de_StringList(__getArrayIfSingleItem(output["stringList"]["member"]), context); + contents.stringList = de_StringList( + __getArrayIfSingleItem(output["stringList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.stringSet === "") { contents.stringSet = []; } else if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { - contents.stringSet = de_StringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); + contents.stringSet = de_StringSet( + __getArrayIfSingleItem(output["stringSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.integerList === "") { contents.integerList = []; } else if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { - contents.integerList = de_IntegerList(__getArrayIfSingleItem(output["integerList"]["member"]), context); + contents.integerList = de_IntegerList( + __getArrayIfSingleItem(output["integerList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.booleanList === "") { contents.booleanList = []; } else if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { - contents.booleanList = de_BooleanList(__getArrayIfSingleItem(output["booleanList"]["member"]), context); + contents.booleanList = de_BooleanList( + __getArrayIfSingleItem(output["booleanList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.timestampList === "") { contents.timestampList = []; } else if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { - contents.timestampList = de_TimestampList(__getArrayIfSingleItem(output["timestampList"]["member"]), context); + contents.timestampList = de_TimestampList( + __getArrayIfSingleItem(output["timestampList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.enumList === "") { contents.enumList = []; } else if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { - contents.enumList = de_FooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); + contents.enumList = de_FooEnumList( + __getArrayIfSingleItem(output["enumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumList === "") { contents.intEnumList = []; } else if (output["intEnumList"] !== undefined && output["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(output["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(output["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.nestedStringList === "") { contents.nestedStringList = []; } else if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { contents.nestedStringList = de_NestedStringList( - __getArrayIfSingleItem(output["nestedStringList"]["member"]), + __getArrayIfSingleItem(output["nestedStringList"]["member"]) /* DEBUG_REMOVE no elision */, context ); } if (output.renamed === "") { contents.renamedListMembers = []; } else if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { - contents.renamedListMembers = de_RenamedListMembers(__getArrayIfSingleItem(output["renamed"]["item"]), context); + contents.renamedListMembers = de_RenamedListMembers( + __getArrayIfSingleItem(output["renamed"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.flattenedList === "") { contents.flattenedList = []; } else if (output["flattenedList"] !== undefined) { - contents.flattenedList = de_RenamedListMembers(__getArrayIfSingleItem(output["flattenedList"]), context); + contents.flattenedList = de_RenamedListMembers( + __getArrayIfSingleItem(output["flattenedList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.customName === "") { contents.flattenedList2 = []; } else if (output["customName"] !== undefined) { - contents.flattenedList2 = de_RenamedListMembers(__getArrayIfSingleItem(output["customName"]), context); + contents.flattenedList2 = de_RenamedListMembers( + __getArrayIfSingleItem(output["customName"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.flattenedListWithMemberNamespace === "") { contents.flattenedListWithMemberNamespace = []; } else if (output["flattenedListWithMemberNamespace"] !== undefined) { contents.flattenedListWithMemberNamespace = de_ListWithMemberNamespace( - __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), + __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]) /* DEBUG_REMOVE no elision */, context ); } @@ -2195,14 +2222,17 @@ const de_XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput contents.flattenedListWithNamespace = []; } else if (output["flattenedListWithNamespace"] !== undefined) { contents.flattenedListWithNamespace = de_ListWithNamespace( - __getArrayIfSingleItem(output["flattenedListWithNamespace"]), + __getArrayIfSingleItem(output["flattenedListWithNamespace"]) /* DEBUG_REMOVE no elision */, context ); } if (output.myStructureList === "") { contents.structureList = []; } else if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { - contents.structureList = de_StructureList(__getArrayIfSingleItem(output["myStructureList"]["item"]), context); + contents.structureList = de_StructureList( + __getArrayIfSingleItem(output["myStructureList"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2229,7 +2259,10 @@ const de_XmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespa if (output.values === "") { contents.values = []; } else if (output["values"] !== undefined && output["values"]["member"] !== undefined) { - contents.values = de_XmlNamespacedList(__getArrayIfSingleItem(output["values"]["member"]), context); + contents.values = de_XmlNamespacedList( + __getArrayIfSingleItem(output["values"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2240,7 +2273,7 @@ const de_XmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespa const de_XmlNamespacesOutput = (output: any, context: __SerdeContext): XmlNamespacesOutput => { const contents: any = {}; if (output["nested"] !== undefined) { - contents.nested = de_XmlNamespaceNested(output["nested"], context); + contents.nested = de_XmlNamespaceNested(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2373,7 +2406,7 @@ const de_NestedStringList = (output: any, context: __SerdeContext): string[][] = return (output || []) .filter((e: any) => e != null) .map((entry: any) => { - return de_StringList(__getArrayIfSingleItem(entry["member"]), context); + return de_StringList(__getArrayIfSingleItem(entry["member"]) /* DEBUG_REMOVE no elision */, context); }); }; @@ -2430,6 +2463,7 @@ const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); +const throwDefaultError = withBaseException(__BaseException); const buildHttpRpcRequest = async ( context: __SerdeContext, headers: __HeaderBag, diff --git a/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts b/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts index 163f16368bf2c..f3baf4ac8e889 100644 --- a/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts +++ b/private/aws-protocoltests-json-10/src/protocols/Aws_json1_0.ts @@ -5,6 +5,7 @@ import { isValidHostname as __isValidHostname, } from "@aws-sdk/protocol-http"; import { + _json, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, @@ -16,7 +17,8 @@ import { limitedParseFloat32 as __limitedParseFloat32, parseEpochTimestamp as __parseEpochTimestamp, serializeFloat as __serializeFloat, - throwDefaultError, + take, + withBaseException, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -79,7 +81,7 @@ export const se_EmptyInputAndEmptyOutputCommand = async ( "x-amz-target": "JsonRpc10.EmptyInputAndEmptyOutput", }; let body: any; - body = JSON.stringify(se_EmptyInputAndEmptyOutputInput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -117,7 +119,7 @@ export const se_EndpointWithHostLabelOperationCommand = async ( "x-amz-target": "JsonRpc10.EndpointWithHostLabelOperation", }; let body: any; - body = JSON.stringify(se_EndpointWithHostLabelOperationInput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { resolvedHostname = "foo.{label}." + resolvedHostname; @@ -144,7 +146,7 @@ export const se_GreetingWithErrorsCommand = async ( "x-amz-target": "JsonRpc10.GreetingWithErrors", }; let body: any; - body = JSON.stringify(se_GreetingWithErrorsInput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -175,7 +177,7 @@ export const se_JsonUnionsCommand = async ( "x-amz-target": "JsonRpc10.JsonUnions", }; let body: any; - body = JSON.stringify(se_JsonUnionsInput(input, context)); + body = JSON.stringify(se_JsonUnionsInput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -221,7 +223,7 @@ export const se_SimpleScalarPropertiesCommand = async ( "x-amz-target": "JsonRpc10.SimpleScalarProperties", }; let body: any; - body = JSON.stringify(se_SimpleScalarPropertiesInput(input, context)); + body = JSON.stringify(se_SimpleScalarPropertiesInput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -237,12 +239,12 @@ export const de_EmptyInputAndEmptyOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_EmptyInputAndEmptyOutputOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: EmptyInputAndEmptyOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -258,10 +260,9 @@ const de_EmptyInputAndEmptyOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -280,7 +281,7 @@ export const de_EndpointOperationCommand = async ( const response: EndpointOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -296,10 +297,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -318,7 +318,7 @@ export const de_EndpointWithHostLabelOperationCommand = async ( const response: EndpointWithHostLabelOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -334,10 +334,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -354,12 +353,12 @@ export const de_GreetingWithErrorsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_GreetingWithErrorsOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: GreetingWithErrorsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -386,10 +385,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } @@ -409,7 +407,7 @@ export const de_HostWithPathOperationCommand = async ( const response: HostWithPathOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -425,10 +423,9 @@ const de_HostWithPathOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -445,12 +442,12 @@ export const de_JsonUnionsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_JsonUnionsOutput(data, context); + contents = de_JsonUnionsOutput(data /* DEBUG_REMOVE no elision */, context); const response: JsonUnionsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -466,10 +463,9 @@ const de_JsonUnionsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -488,7 +484,7 @@ export const de_NoInputAndNoOutputCommand = async ( const response: NoInputAndNoOutputCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -504,10 +500,9 @@ const de_NoInputAndNoOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -524,12 +519,12 @@ export const de_NoInputAndOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_NoInputAndOutputOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: NoInputAndOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -545,10 +540,9 @@ const de_NoInputAndOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -565,12 +559,12 @@ export const de_SimpleScalarPropertiesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_SimpleScalarPropertiesOutput(data, context); + contents = de_SimpleScalarPropertiesOutput(data /* DEBUG_REMOVE no elision */, context); const response: SimpleScalarPropertiesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -586,10 +580,9 @@ const de_SimpleScalarPropertiesCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -637,7 +630,7 @@ const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext) * serializeAws_json1_0EmptyInputAndEmptyOutputInput */ const se_EmptyInputAndEmptyOutputInput = (input: EmptyInputAndEmptyOutputInput, context: __SerdeContext): any => { - return {}; + return take(input, {}); }; /** @@ -647,27 +640,27 @@ const se_EndpointWithHostLabelOperationInput = ( input: EndpointWithHostLabelOperationInput, context: __SerdeContext ): any => { - return { - ...(input.label != null && { label: input.label }), - }; + return take(input, { + label: [], + }); }; /** * serializeAws_json1_0GreetingWithErrorsInput */ const se_GreetingWithErrorsInput = (input: GreetingWithErrorsInput, context: __SerdeContext): any => { - return { - ...(input.greeting != null && { greeting: input.greeting }), - }; + return take(input, { + greeting: [], + }); }; /** * serializeAws_json1_0JsonUnionsInput */ const se_JsonUnionsInput = (input: JsonUnionsInput, context: __SerdeContext): any => { - return { - ...(input.contents != null && { contents: se_MyUnion(input.contents, context) }), - }; + return take(input, { + contents: (_) => se_MyUnion(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** @@ -679,11 +672,11 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { booleanValue: (value) => ({ booleanValue: value }), enumValue: (value) => ({ enumValue: value }), intEnumValue: (value) => ({ intEnumValue: value }), - listValue: (value) => ({ listValue: se_StringList(value, context) }), - mapValue: (value) => ({ mapValue: se_StringMap(value, context) }), + listValue: (value) => ({ listValue: _json(value) /* DEBUG_REMOVE yes elision */ }), + mapValue: (value) => ({ mapValue: _json(value) /* DEBUG_REMOVE yes elision */ }), numberValue: (value) => ({ numberValue: value }), stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: se_GreetingStruct(value, context) }), + structureValue: (value) => ({ structureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), _: (name, value) => ({ name: value } as any), }); @@ -693,30 +686,26 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { * serializeAws_json1_0SimpleScalarPropertiesInput */ const se_SimpleScalarPropertiesInput = (input: SimpleScalarPropertiesInput, context: __SerdeContext): any => { - return { - ...(input.doubleValue != null && { doubleValue: __serializeFloat(input.doubleValue) }), - ...(input.floatValue != null && { floatValue: __serializeFloat(input.floatValue) }), - }; + return take(input, { + doubleValue: (_) => __serializeFloat(_), + floatValue: (_) => __serializeFloat(_), + }); }; /** * serializeAws_json1_0GreetingStruct */ const se_GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi != null && { hi: input.hi }), - }; + return take(input, { + hi: [], + }); }; /** * serializeAws_json1_0StringList */ const se_StringList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -736,60 +725,60 @@ const se_StringMap = (input: Record, context: __SerdeContext): a * deserializeAws_json1_0ComplexError */ const de_ComplexError = (output: any, context: __SerdeContext): ComplexError => { - return { - Nested: output.Nested != null ? de_ComplexNestedErrorData(output.Nested, context) : undefined, - TopLevel: __expectString(output.TopLevel), - } as any; + return take(output, { + Nested: (_) => de_ComplexNestedErrorData(_ /* DEBUG_REMOVE no elision */, context), + TopLevel: __expectString, + }) as any; }; /** * deserializeAws_json1_0ComplexNestedErrorData */ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Foo), - } as any; + return take(output, { + Foo: [, __expectString, `Foo`], + }) as any; }; /** * deserializeAws_json1_0EmptyInputAndEmptyOutputOutput */ const de_EmptyInputAndEmptyOutputOutput = (output: any, context: __SerdeContext): EmptyInputAndEmptyOutputOutput => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_0FooError */ const de_FooError = (output: any, context: __SerdeContext): FooError => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_0GreetingWithErrorsOutput */ const de_GreetingWithErrorsOutput = (output: any, context: __SerdeContext): GreetingWithErrorsOutput => { - return { - greeting: __expectString(output.greeting), - } as any; + return take(output, { + greeting: __expectString, + }) as any; }; /** * deserializeAws_json1_0InvalidGreeting */ const de_InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - return { - Message: __expectString(output.Message), - } as any; + return take(output, { + Message: __expectString, + }) as any; }; /** * deserializeAws_json1_0JsonUnionsOutput */ const de_JsonUnionsOutput = (output: any, context: __SerdeContext): JsonUnionsOutput => { - return { - contents: output.contents != null ? de_MyUnion(__expectUnion(output.contents), context) : undefined, - } as any; + return take(output, { + contents: (_) => de_MyUnion(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -812,12 +801,12 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.listValue != null) { return { - listValue: de_StringList(output.listValue, context), + listValue: _json(output.listValue) /* DEBUG_REMOVE yes elision */, }; } if (output.mapValue != null) { return { - mapValue: de_StringMap(output.mapValue, context), + mapValue: _json(output.mapValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectInt32(output.numberValue) !== undefined) { @@ -828,7 +817,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.structureValue != null) { return { - structureValue: de_GreetingStruct(output.structureValue, context), + structureValue: _json(output.structureValue) /* DEBUG_REMOVE yes elision */, }; } if (output.timestampValue != null) { @@ -843,26 +832,26 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { * deserializeAws_json1_0NoInputAndOutputOutput */ const de_NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInputAndOutputOutput => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_0SimpleScalarPropertiesOutput */ const de_SimpleScalarPropertiesOutput = (output: any, context: __SerdeContext): SimpleScalarPropertiesOutput => { - return { - doubleValue: __limitedParseDouble(output.doubleValue), - floatValue: __limitedParseFloat32(output.floatValue), - } as any; + return take(output, { + doubleValue: __limitedParseDouble, + floatValue: __limitedParseFloat32, + }) as any; }; /** * deserializeAws_json1_0GreetingStruct */ const de_GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; + return take(output, { + hi: __expectString, + }) as any; }; /** @@ -872,9 +861,6 @@ const de_StringList = (output: any, context: __SerdeContext): string[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -913,6 +899,7 @@ const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); +const throwDefaultError = withBaseException(__BaseException); const buildHttpRpcRequest = async ( context: __SerdeContext, headers: __HeaderBag, diff --git a/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts b/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts index d14d3f872d15d..7da7f3910896b 100644 --- a/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts +++ b/private/aws-protocoltests-json/src/protocols/Aws_json1_1.ts @@ -5,6 +5,7 @@ import { isValidHostname as __isValidHostname, } from "@aws-sdk/protocol-http"; import { + _json, dateToUtcString as __dateToUtcString, decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, @@ -21,7 +22,8 @@ import { parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, parseRfc7231DateTime as __parseRfc7231DateTime, serializeFloat as __serializeFloat, - throwDefaultError, + take, + withBaseException, } from "@aws-sdk/smithy-client"; import { DocumentType as __DocumentType, @@ -156,7 +158,7 @@ export const se_EndpointWithHostLabelOperationCommand = async ( "x-amz-target": "JsonProtocol.EndpointWithHostLabelOperation", }; let body: any; - body = JSON.stringify(se_HostLabelInput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { resolvedHostname = "foo.{label}." + resolvedHostname; @@ -228,7 +230,7 @@ export const se_JsonEnumsCommand = async ( "x-amz-target": "JsonProtocol.JsonEnums", }; let body: any; - body = JSON.stringify(se_JsonEnumsInputOutput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -244,7 +246,7 @@ export const se_JsonUnionsCommand = async ( "x-amz-target": "JsonProtocol.JsonUnions", }; let body: any; - body = JSON.stringify(se_UnionInputOutput(input, context)); + body = JSON.stringify(se_UnionInputOutput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -260,7 +262,7 @@ export const se_KitchenSinkOperationCommand = async ( "x-amz-target": "JsonProtocol.KitchenSinkOperation", }; let body: any; - body = JSON.stringify(se_KitchenSink(input, context)); + body = JSON.stringify(se_KitchenSink(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -276,7 +278,7 @@ export const se_NullOperationCommand = async ( "x-amz-target": "JsonProtocol.NullOperation", }; let body: any; - body = JSON.stringify(se_NullOperationInputOutput(input, context)); + body = JSON.stringify(se_NullOperationInputOutput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -292,7 +294,7 @@ export const se_OperationWithOptionalInputOutputCommand = async ( "x-amz-target": "JsonProtocol.OperationWithOptionalInputOutput", }; let body: any; - body = JSON.stringify(se_OperationWithOptionalInputOutputInput(input, context)); + body = JSON.stringify(_json(input) /* DEBUG_REMOVE yes elision */); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -308,7 +310,7 @@ export const se_PutAndGetInlineDocumentsCommand = async ( "x-amz-target": "JsonProtocol.PutAndGetInlineDocuments", }; let body: any; - body = JSON.stringify(se_PutAndGetInlineDocumentsInputOutput(input, context)); + body = JSON.stringify(se_PutAndGetInlineDocumentsInputOutput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -324,7 +326,7 @@ export const se_SimpleScalarPropertiesCommand = async ( "x-amz-target": "JsonProtocol.SimpleScalarProperties", }; let body: any; - body = JSON.stringify(se_SimpleScalarPropertiesInputOutput(input, context)); + body = JSON.stringify(se_SimpleScalarPropertiesInputOutput(input /* DEBUG_REMOVE no elision */, context)); return buildHttpRpcRequest(context, headers, "/", undefined, body); }; @@ -340,12 +342,12 @@ export const de_DatetimeOffsetsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_DatetimeOffsetsOutput(data, context); + contents = de_DatetimeOffsetsOutput(data /* DEBUG_REMOVE no elision */, context); const response: DatetimeOffsetsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -361,10 +363,9 @@ const de_DatetimeOffsetsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -383,7 +384,7 @@ export const de_EmptyOperationCommand = async ( const response: EmptyOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -399,10 +400,9 @@ const de_EmptyOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -421,7 +421,7 @@ export const de_EndpointOperationCommand = async ( const response: EndpointOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -437,10 +437,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -459,7 +458,7 @@ export const de_EndpointWithHostLabelOperationCommand = async ( const response: EndpointWithHostLabelOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -475,10 +474,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -495,12 +493,12 @@ export const de_FractionalSecondsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FractionalSecondsOutput(data, context); + contents = de_FractionalSecondsOutput(data /* DEBUG_REMOVE no elision */, context); const response: FractionalSecondsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -516,10 +514,9 @@ const de_FractionalSecondsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -536,12 +533,12 @@ export const de_GreetingWithErrorsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_GreetingWithErrorsOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: GreetingWithErrorsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -568,10 +565,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } @@ -591,7 +587,7 @@ export const de_HostWithPathOperationCommand = async ( const response: HostWithPathOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -607,10 +603,9 @@ const de_HostWithPathOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -627,12 +622,12 @@ export const de_JsonEnumsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_JsonEnumsInputOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: JsonEnumsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -648,10 +643,9 @@ const de_JsonEnumsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -668,12 +662,12 @@ export const de_JsonUnionsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_UnionInputOutput(data, context); + contents = de_UnionInputOutput(data /* DEBUG_REMOVE no elision */, context); const response: JsonUnionsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -689,10 +683,9 @@ const de_JsonUnionsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -709,12 +702,12 @@ export const de_KitchenSinkOperationCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_KitchenSink(data, context); + contents = de_KitchenSink(data /* DEBUG_REMOVE no elision */, context); const response: KitchenSinkOperationCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -738,10 +731,9 @@ const de_KitchenSinkOperationCommandError = async ( throw await de_ErrorWithoutMembersRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } @@ -759,12 +751,12 @@ export const de_NullOperationCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_NullOperationInputOutput(data, context); + contents = de_NullOperationInputOutput(data /* DEBUG_REMOVE no elision */, context); const response: NullOperationCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -780,10 +772,9 @@ const de_NullOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -800,12 +791,12 @@ export const de_OperationWithOptionalInputOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_OperationWithOptionalInputOutputOutput(data, context); + contents = _json(data) /* DEBUG_REMOVE yes elision */; const response: OperationWithOptionalInputOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -821,10 +812,9 @@ const de_OperationWithOptionalInputOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -841,12 +831,12 @@ export const de_PutAndGetInlineDocumentsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_PutAndGetInlineDocumentsInputOutput(data, context); + contents = de_PutAndGetInlineDocumentsInputOutput(data /* DEBUG_REMOVE no elision */, context); const response: PutAndGetInlineDocumentsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -862,10 +852,9 @@ const de_PutAndGetInlineDocumentsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -882,12 +871,12 @@ export const de_SimpleScalarPropertiesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_SimpleScalarPropertiesInputOutput(data, context); + contents = de_SimpleScalarPropertiesInputOutput(data /* DEBUG_REMOVE no elision */, context); const response: SimpleScalarPropertiesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -903,10 +892,9 @@ const de_SimpleScalarPropertiesCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -987,72 +975,64 @@ const se_Document = (input: __DocumentType, context: __SerdeContext): any => { * serializeAws_json1_1EmptyStruct */ const se_EmptyStruct = (input: EmptyStruct, context: __SerdeContext): any => { - return {}; + return take(input, {}); }; /** * serializeAws_json1_1HostLabelInput */ const se_HostLabelInput = (input: HostLabelInput, context: __SerdeContext): any => { - return { - ...(input.label != null && { label: input.label }), - }; + return take(input, { + label: [], + }); }; /** * serializeAws_json1_1JsonEnumsInputOutput */ const se_JsonEnumsInputOutput = (input: JsonEnumsInputOutput, context: __SerdeContext): any => { - return { - ...(input.fooEnum1 != null && { fooEnum1: input.fooEnum1 }), - ...(input.fooEnum2 != null && { fooEnum2: input.fooEnum2 }), - ...(input.fooEnum3 != null && { fooEnum3: input.fooEnum3 }), - ...(input.fooEnumList != null && { fooEnumList: se_FooEnumList(input.fooEnumList, context) }), - ...(input.fooEnumMap != null && { fooEnumMap: se_FooEnumMap(input.fooEnumMap, context) }), - ...(input.fooEnumSet != null && { fooEnumSet: se_FooEnumSet(input.fooEnumSet, context) }), - }; + return take(input, { + fooEnum1: [], + fooEnum2: [], + fooEnum3: [], + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); }; /** * serializeAws_json1_1KitchenSink */ const se_KitchenSink = (input: KitchenSink, context: __SerdeContext): any => { - return { - ...(input.Blob != null && { Blob: context.base64Encoder(input.Blob) }), - ...(input.Boolean != null && { Boolean: input.Boolean }), - ...(input.Double != null && { Double: __serializeFloat(input.Double) }), - ...(input.EmptyStruct != null && { EmptyStruct: se_EmptyStruct(input.EmptyStruct, context) }), - ...(input.Float != null && { Float: __serializeFloat(input.Float) }), - ...(input.HttpdateTimestamp != null && { HttpdateTimestamp: __dateToUtcString(input.HttpdateTimestamp) }), - ...(input.Integer != null && { Integer: input.Integer }), - ...(input.Iso8601Timestamp != null && { - Iso8601Timestamp: input.Iso8601Timestamp.toISOString().split(".")[0] + "Z", - }), - ...(input.JsonValue != null && { JsonValue: __LazyJsonString.fromObject(input.JsonValue) }), - ...(input.ListOfLists != null && { ListOfLists: se_ListOfListOfStrings(input.ListOfLists, context) }), - ...(input.ListOfMapsOfStrings != null && { - ListOfMapsOfStrings: se_ListOfMapsOfStrings(input.ListOfMapsOfStrings, context), - }), - ...(input.ListOfStrings != null && { ListOfStrings: se_ListOfStrings(input.ListOfStrings, context) }), - ...(input.ListOfStructs != null && { ListOfStructs: se_ListOfStructs(input.ListOfStructs, context) }), - ...(input.Long != null && { Long: input.Long }), - ...(input.MapOfListsOfStrings != null && { - MapOfListsOfStrings: se_MapOfListsOfStrings(input.MapOfListsOfStrings, context), - }), - ...(input.MapOfMaps != null && { MapOfMaps: se_MapOfMapOfStrings(input.MapOfMaps, context) }), - ...(input.MapOfStrings != null && { MapOfStrings: se_MapOfStrings(input.MapOfStrings, context) }), - ...(input.MapOfStructs != null && { MapOfStructs: se_MapOfStructs(input.MapOfStructs, context) }), - ...(input.RecursiveList != null && { RecursiveList: se_ListOfKitchenSinks(input.RecursiveList, context) }), - ...(input.RecursiveMap != null && { RecursiveMap: se_MapOfKitchenSinks(input.RecursiveMap, context) }), - ...(input.RecursiveStruct != null && { RecursiveStruct: se_KitchenSink(input.RecursiveStruct, context) }), - ...(input.SimpleStruct != null && { SimpleStruct: se_SimpleStruct(input.SimpleStruct, context) }), - ...(input.String != null && { String: input.String }), - ...(input.StructWithJsonName != null && { - StructWithJsonName: se_StructWithJsonName(input.StructWithJsonName, context), - }), - ...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }), - ...(input.UnixTimestamp != null && { UnixTimestamp: Math.round(input.UnixTimestamp.getTime() / 1000) }), - }; + return take(input, { + Blob: (_) => context.base64Encoder(_), + Boolean: [], + Double: (_) => __serializeFloat(_), + EmptyStruct: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + Float: (_) => __serializeFloat(_), + HttpdateTimestamp: (_) => __dateToUtcString(_), + Integer: [], + Iso8601Timestamp: (_) => _.toISOString().split(".")[0] + "Z", + JsonValue: (_) => __LazyJsonString.fromObject(_), + ListOfLists: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfMapsOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfStructs: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + Long: [], + MapOfListsOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfMaps: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfStructs: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + RecursiveList: (_) => se_ListOfKitchenSinks(_ /* DEBUG_REMOVE no elision */, context), + RecursiveMap: (_) => se_MapOfKitchenSinks(_ /* DEBUG_REMOVE no elision */, context), + RecursiveStruct: (_) => se_KitchenSink(_ /* DEBUG_REMOVE no elision */, context), + SimpleStruct: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + String: [], + StructWithJsonName: (_) => se_StructWithJsonName(_ /* DEBUG_REMOVE no elision */, context), + Timestamp: (_) => Math.round(_.getTime() / 1000), + UnixTimestamp: (_) => Math.round(_.getTime() / 1000), + }); }; /** @@ -1062,7 +1042,7 @@ const se_ListOfKitchenSinks = (input: KitchenSink[], context: __SerdeContext): a return input .filter((e: any) => e != null) .map((entry) => { - return se_KitchenSink(entry, context); + return se_KitchenSink(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -1073,7 +1053,7 @@ const se_ListOfListOfStrings = (input: string[][], context: __SerdeContext): any return input .filter((e: any) => e != null) .map((entry) => { - return se_ListOfStrings(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -1084,7 +1064,7 @@ const se_ListOfMapsOfStrings = (input: Record[], context: __Serd return input .filter((e: any) => e != null) .map((entry) => { - return se_MapOfStrings(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -1092,11 +1072,7 @@ const se_ListOfMapsOfStrings = (input: Record[], context: __Serd * serializeAws_json1_1ListOfStrings */ const se_ListOfStrings = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -1106,7 +1082,7 @@ const se_ListOfStructs = (input: SimpleStruct[], context: __SerdeContext): any = return input .filter((e: any) => e != null) .map((entry) => { - return se_SimpleStruct(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -1118,7 +1094,7 @@ const se_MapOfKitchenSinks = (input: Record, context: __Ser if (value === null) { return acc; } - acc[key] = se_KitchenSink(value, context); + acc[key] = se_KitchenSink(value /* DEBUG_REMOVE no elision */, context); return acc; }, {}); }; @@ -1131,7 +1107,7 @@ const se_MapOfListsOfStrings = (input: Record, context: __Serd if (value === null) { return acc; } - acc[key] = se_ListOfStrings(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -1144,7 +1120,7 @@ const se_MapOfMapOfStrings = (input: Record>, con if (value === null) { return acc; } - acc[key] = se_MapOfStrings(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -1170,7 +1146,7 @@ const se_MapOfStructs = (input: Record, context: __SerdeCo if (value === null) { return acc; } - acc[key] = se_SimpleStruct(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -1183,11 +1159,11 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), booleanValue: (value) => ({ booleanValue: value }), enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: se_StringList(value, context) }), - mapValue: (value) => ({ mapValue: se_StringMap(value, context) }), + listValue: (value) => ({ listValue: _json(value) /* DEBUG_REMOVE yes elision */ }), + mapValue: (value) => ({ mapValue: _json(value) /* DEBUG_REMOVE yes elision */ }), numberValue: (value) => ({ numberValue: value }), stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: se_GreetingStruct(value, context) }), + structureValue: (value) => ({ structureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), _: (name, value) => ({ name: value } as any), }); @@ -1197,11 +1173,11 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { * serializeAws_json1_1NullOperationInputOutput */ const se_NullOperationInputOutput = (input: NullOperationInputOutput, context: __SerdeContext): any => { - return { - ...(input.sparseStringList != null && { sparseStringList: se_SparseStringList(input.sparseStringList, context) }), - ...(input.sparseStringMap != null && { sparseStringMap: se_SparseStringMap(input.sparseStringMap, context) }), - ...(input.string != null && { string: input.string }), - }; + return take(input, { + sparseStringList: (_) => se_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => se_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + string: [], + }); }; /** @@ -1211,9 +1187,9 @@ const se_OperationWithOptionalInputOutputInput = ( input: OperationWithOptionalInputOutputInput, context: __SerdeContext ): any => { - return { - ...(input.Value != null && { Value: input.Value }), - }; + return take(input, { + Value: [], + }); }; /** @@ -1223,9 +1199,9 @@ const se_PutAndGetInlineDocumentsInputOutput = ( input: PutAndGetInlineDocumentsInputOutput, context: __SerdeContext ): any => { - return { - ...(input.inlineDocument != null && { inlineDocument: se_Document(input.inlineDocument, context) }), - }; + return take(input, { + inlineDocument: (_) => se_Document(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** @@ -1235,48 +1211,44 @@ const se_SimpleScalarPropertiesInputOutput = ( input: SimpleScalarPropertiesInputOutput, context: __SerdeContext ): any => { - return { - ...(input.doubleValue != null && { doubleValue: __serializeFloat(input.doubleValue) }), - ...(input.floatValue != null && { floatValue: __serializeFloat(input.floatValue) }), - }; + return take(input, { + doubleValue: (_) => __serializeFloat(_), + floatValue: (_) => __serializeFloat(_), + }); }; /** * serializeAws_json1_1SimpleStruct */ const se_SimpleStruct = (input: SimpleStruct, context: __SerdeContext): any => { - return { - ...(input.Value != null && { Value: input.Value }), - }; + return take(input, { + Value: [], + }); }; /** * serializeAws_json1_1StructWithJsonName */ const se_StructWithJsonName = (input: StructWithJsonName, context: __SerdeContext): any => { - return { - ...(input.Value != null && { Value: input.Value }), - }; + return take(input, { + Value: [, , `Value`], + }); }; /** * serializeAws_json1_1UnionInputOutput */ const se_UnionInputOutput = (input: UnionInputOutput, context: __SerdeContext): any => { - return { - ...(input.contents != null && { contents: se_MyUnion(input.contents, context) }), - }; + return take(input, { + contents: (_) => se_MyUnion(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** * serializeAws_json1_1FooEnumList */ const se_FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -1296,32 +1268,23 @@ const se_FooEnumMap = (input: Record, context: __Serde * serializeAws_json1_1FooEnumSet */ const se_FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_json1_1GreetingStruct */ const se_GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi != null && { hi: input.hi }), - }; + return take(input, { + hi: [], + }); }; /** * serializeAws_json1_1SparseStringList */ const se_SparseStringList = (input: string[], context: __SerdeContext): any => { - return input.map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); + return input; }; /** @@ -1342,11 +1305,7 @@ const se_SparseStringMap = (input: Record, context: __SerdeConte * serializeAws_json1_1StringList */ const se_StringList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -1366,28 +1325,28 @@ const se_StringMap = (input: Record, context: __SerdeContext): a * deserializeAws_json1_1ComplexError */ const de_ComplexError = (output: any, context: __SerdeContext): ComplexError => { - return { - Nested: output.Nested != null ? de_ComplexNestedErrorData(output.Nested, context) : undefined, - TopLevel: __expectString(output.TopLevel), - } as any; + return take(output, { + Nested: (_) => de_ComplexNestedErrorData(_ /* DEBUG_REMOVE no elision */, context), + TopLevel: __expectString, + }) as any; }; /** * deserializeAws_json1_1ComplexNestedErrorData */ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Foo), - } as any; + return take(output, { + Foo: [, __expectString, `Foo`], + }) as any; }; /** * deserializeAws_json1_1DatetimeOffsetsOutput */ const de_DatetimeOffsetsOutput = (output: any, context: __SerdeContext): DatetimeOffsetsOutput => { - return { - datetime: output.datetime != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.datetime)) : undefined, - } as any; + return take(output, { + datetime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + }) as any; }; /** @@ -1401,123 +1360,112 @@ const de_Document = (output: any, context: __SerdeContext): __DocumentType => { * deserializeAws_json1_1EmptyStruct */ const de_EmptyStruct = (output: any, context: __SerdeContext): EmptyStruct => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_1ErrorWithMembers */ const de_ErrorWithMembers = (output: any, context: __SerdeContext): ErrorWithMembers => { - return { - Code: __expectString(output.Code), - ComplexData: output.ComplexData != null ? de_KitchenSink(output.ComplexData, context) : undefined, - IntegerField: __expectInt32(output.IntegerField), - ListField: output.ListField != null ? de_ListOfStrings(output.ListField, context) : undefined, - MapField: output.MapField != null ? de_MapOfStrings(output.MapField, context) : undefined, - Message: __expectString(output.Message), - StringField: __expectString(output.StringField), - } as any; + return take(output, { + Code: __expectString, + ComplexData: (_) => de_KitchenSink(_ /* DEBUG_REMOVE no elision */, context), + IntegerField: __expectInt32, + ListField: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapField: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + Message: __expectString, + StringField: __expectString, + }) as any; }; /** * deserializeAws_json1_1ErrorWithoutMembers */ const de_ErrorWithoutMembers = (output: any, context: __SerdeContext): ErrorWithoutMembers => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_1FooError */ const de_FooError = (output: any, context: __SerdeContext): FooError => { - return {} as any; + return take(output, {}) as any; }; /** * deserializeAws_json1_1FractionalSecondsOutput */ const de_FractionalSecondsOutput = (output: any, context: __SerdeContext): FractionalSecondsOutput => { - return { - datetime: output.datetime != null ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.datetime)) : undefined, - httpdate: output.httpdate != null ? __expectNonNull(__parseRfc7231DateTime(output.httpdate)) : undefined, - } as any; + return take(output, { + datetime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + httpdate: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + }) as any; }; /** * deserializeAws_json1_1GreetingWithErrorsOutput */ const de_GreetingWithErrorsOutput = (output: any, context: __SerdeContext): GreetingWithErrorsOutput => { - return { - greeting: __expectString(output.greeting), - } as any; + return take(output, { + greeting: __expectString, + }) as any; }; /** * deserializeAws_json1_1InvalidGreeting */ const de_InvalidGreeting = (output: any, context: __SerdeContext): InvalidGreeting => { - return { - Message: __expectString(output.Message), - } as any; + return take(output, { + Message: __expectString, + }) as any; }; /** * deserializeAws_json1_1JsonEnumsInputOutput */ const de_JsonEnumsInputOutput = (output: any, context: __SerdeContext): JsonEnumsInputOutput => { - return { - fooEnum1: __expectString(output.fooEnum1), - fooEnum2: __expectString(output.fooEnum2), - fooEnum3: __expectString(output.fooEnum3), - fooEnumList: output.fooEnumList != null ? de_FooEnumList(output.fooEnumList, context) : undefined, - fooEnumMap: output.fooEnumMap != null ? de_FooEnumMap(output.fooEnumMap, context) : undefined, - fooEnumSet: output.fooEnumSet != null ? de_FooEnumSet(output.fooEnumSet, context) : undefined, - } as any; + return take(output, { + fooEnum1: __expectString, + fooEnum2: __expectString, + fooEnum3: __expectString, + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) as any; }; /** * deserializeAws_json1_1KitchenSink */ const de_KitchenSink = (output: any, context: __SerdeContext): KitchenSink => { - return { - Blob: output.Blob != null ? context.base64Decoder(output.Blob) : undefined, - Boolean: __expectBoolean(output.Boolean), - Double: __limitedParseDouble(output.Double), - EmptyStruct: output.EmptyStruct != null ? de_EmptyStruct(output.EmptyStruct, context) : undefined, - Float: __limitedParseFloat32(output.Float), - HttpdateTimestamp: - output.HttpdateTimestamp != null ? __expectNonNull(__parseRfc7231DateTime(output.HttpdateTimestamp)) : undefined, - Integer: __expectInt32(output.Integer), - Iso8601Timestamp: - output.Iso8601Timestamp != null - ? __expectNonNull(__parseRfc3339DateTimeWithOffset(output.Iso8601Timestamp)) - : undefined, - JsonValue: output.JsonValue != null ? new __LazyJsonString(output.JsonValue) : undefined, - ListOfLists: output.ListOfLists != null ? de_ListOfListOfStrings(output.ListOfLists, context) : undefined, - ListOfMapsOfStrings: - output.ListOfMapsOfStrings != null ? de_ListOfMapsOfStrings(output.ListOfMapsOfStrings, context) : undefined, - ListOfStrings: output.ListOfStrings != null ? de_ListOfStrings(output.ListOfStrings, context) : undefined, - ListOfStructs: output.ListOfStructs != null ? de_ListOfStructs(output.ListOfStructs, context) : undefined, - Long: __expectLong(output.Long), - MapOfListsOfStrings: - output.MapOfListsOfStrings != null ? de_MapOfListsOfStrings(output.MapOfListsOfStrings, context) : undefined, - MapOfMaps: output.MapOfMaps != null ? de_MapOfMapOfStrings(output.MapOfMaps, context) : undefined, - MapOfStrings: output.MapOfStrings != null ? de_MapOfStrings(output.MapOfStrings, context) : undefined, - MapOfStructs: output.MapOfStructs != null ? de_MapOfStructs(output.MapOfStructs, context) : undefined, - RecursiveList: output.RecursiveList != null ? de_ListOfKitchenSinks(output.RecursiveList, context) : undefined, - RecursiveMap: output.RecursiveMap != null ? de_MapOfKitchenSinks(output.RecursiveMap, context) : undefined, - RecursiveStruct: output.RecursiveStruct != null ? de_KitchenSink(output.RecursiveStruct, context) : undefined, - SimpleStruct: output.SimpleStruct != null ? de_SimpleStruct(output.SimpleStruct, context) : undefined, - String: __expectString(output.String), - StructWithJsonName: - output.StructWithJsonName != null ? de_StructWithJsonName(output.StructWithJsonName, context) : undefined, - Timestamp: - output.Timestamp != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.Timestamp))) : undefined, - UnixTimestamp: - output.UnixTimestamp != null - ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.UnixTimestamp))) - : undefined, - } as any; + return take(output, { + Blob: context.base64Decoder, + Boolean: __expectBoolean, + Double: __limitedParseDouble, + EmptyStruct: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + Float: __limitedParseFloat32, + HttpdateTimestamp: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + Integer: __expectInt32, + Iso8601Timestamp: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + JsonValue: (_) => new __LazyJsonString(_), + ListOfLists: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfMapsOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + ListOfStructs: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + Long: __expectLong, + MapOfListsOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfMaps: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfStrings: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + MapOfStructs: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + RecursiveList: (_) => de_ListOfKitchenSinks(_ /* DEBUG_REMOVE no elision */, context), + RecursiveMap: (_) => de_MapOfKitchenSinks(_ /* DEBUG_REMOVE no elision */, context), + RecursiveStruct: (_) => de_KitchenSink(_ /* DEBUG_REMOVE no elision */, context), + SimpleStruct: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + String: __expectString, + StructWithJsonName: (_) => de_StructWithJsonName(_ /* DEBUG_REMOVE no elision */, context), + Timestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + UnixTimestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + }) as any; }; /** @@ -1527,10 +1475,7 @@ const de_ListOfKitchenSinks = (output: any, context: __SerdeContext): KitchenSin const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_KitchenSink(entry, context); + return de_KitchenSink(entry /* DEBUG_REMOVE no elision */, context); }); return retVal; }; @@ -1542,10 +1487,7 @@ const de_ListOfListOfStrings = (output: any, context: __SerdeContext): string[][ const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_ListOfStrings(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -1557,10 +1499,7 @@ const de_ListOfMapsOfStrings = (output: any, context: __SerdeContext): Record e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_MapOfStrings(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -1572,9 +1511,6 @@ const de_ListOfStrings = (output: any, context: __SerdeContext): string[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -1587,10 +1523,7 @@ const de_ListOfStructs = (output: any, context: __SerdeContext): SimpleStruct[] const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_SimpleStruct(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -1603,7 +1536,7 @@ const de_MapOfKitchenSinks = (output: any, context: __SerdeContext): Record { } if (output.listValue != null) { return { - listValue: de_StringList(output.listValue, context), + listValue: _json(output.listValue) /* DEBUG_REMOVE yes elision */, }; } if (output.mapValue != null) { return { - mapValue: de_StringMap(output.mapValue, context), + mapValue: _json(output.mapValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectInt32(output.numberValue) !== undefined) { @@ -1693,7 +1626,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.structureValue != null) { return { - structureValue: de_GreetingStruct(output.structureValue, context), + structureValue: _json(output.structureValue) /* DEBUG_REMOVE yes elision */, }; } if (output.timestampValue != null) { @@ -1708,12 +1641,11 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { * deserializeAws_json1_1NullOperationInputOutput */ const de_NullOperationInputOutput = (output: any, context: __SerdeContext): NullOperationInputOutput => { - return { - sparseStringList: - output.sparseStringList != null ? de_SparseStringList(output.sparseStringList, context) : undefined, - sparseStringMap: output.sparseStringMap != null ? de_SparseStringMap(output.sparseStringMap, context) : undefined, - string: __expectString(output.string), - } as any; + return take(output, { + sparseStringList: (_) => de_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => de_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + string: __expectString, + }) as any; }; /** @@ -1723,9 +1655,9 @@ const de_OperationWithOptionalInputOutputOutput = ( output: any, context: __SerdeContext ): OperationWithOptionalInputOutputOutput => { - return { - Value: __expectString(output.Value), - } as any; + return take(output, { + Value: __expectString, + }) as any; }; /** @@ -1735,9 +1667,9 @@ const de_PutAndGetInlineDocumentsInputOutput = ( output: any, context: __SerdeContext ): PutAndGetInlineDocumentsInputOutput => { - return { - inlineDocument: output.inlineDocument != null ? de_Document(output.inlineDocument, context) : undefined, - } as any; + return take(output, { + inlineDocument: (_) => de_Document(_ /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -1747,37 +1679,37 @@ const de_SimpleScalarPropertiesInputOutput = ( output: any, context: __SerdeContext ): SimpleScalarPropertiesInputOutput => { - return { - doubleValue: __limitedParseDouble(output.doubleValue), - floatValue: __limitedParseFloat32(output.floatValue), - } as any; + return take(output, { + doubleValue: __limitedParseDouble, + floatValue: __limitedParseFloat32, + }) as any; }; /** * deserializeAws_json1_1SimpleStruct */ const de_SimpleStruct = (output: any, context: __SerdeContext): SimpleStruct => { - return { - Value: __expectString(output.Value), - } as any; + return take(output, { + Value: __expectString, + }) as any; }; /** * deserializeAws_json1_1StructWithJsonName */ const de_StructWithJsonName = (output: any, context: __SerdeContext): StructWithJsonName => { - return { - Value: __expectString(output.Value), - } as any; + return take(output, { + Value: [, __expectString, `Value`], + }) as any; }; /** * deserializeAws_json1_1UnionInputOutput */ const de_UnionInputOutput = (output: any, context: __SerdeContext): UnionInputOutput => { - return { - contents: output.contents != null ? de_MyUnion(__expectUnion(output.contents), context) : undefined, - } as any; + return take(output, { + contents: (_) => de_MyUnion(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -1787,9 +1719,6 @@ const de_FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -1815,9 +1744,6 @@ const de_FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string) const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -1827,9 +1753,9 @@ const de_FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string) * deserializeAws_json1_1GreetingStruct */ const de_GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; + return take(output, { + hi: __expectString, + }) as any; }; /** @@ -1866,9 +1792,6 @@ const de_StringList = (output: any, context: __SerdeContext): string[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -1907,6 +1830,7 @@ const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); +const throwDefaultError = withBaseException(__BaseException); const buildHttpRpcRequest = async ( context: __SerdeContext, headers: __HeaderBag, diff --git a/private/aws-protocoltests-query/src/protocols/Aws_query.ts b/private/aws-protocoltests-query/src/protocols/Aws_query.ts index 1253b09b6d972..3310bcb63cb4b 100644 --- a/private/aws-protocoltests-query/src/protocols/Aws_query.ts +++ b/private/aws-protocoltests-query/src/protocols/Aws_query.ts @@ -21,7 +21,7 @@ import { strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, strictParseShort as __strictParseShort, - throwDefaultError, + withBaseException, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -163,7 +163,7 @@ export const se_EmptyInputAndEmptyOutputCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_EmptyInputAndEmptyOutputInput(input, context), + ...se_EmptyInputAndEmptyOutputInput(input /* DEBUG_REMOVE no elision */, context), Action: "EmptyInputAndEmptyOutput", Version: "2020-01-08", }); @@ -206,7 +206,7 @@ export const se_EndpointWithHostLabelOperationCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_HostLabelInput(input, context), + ...se_HostLabelInput(input /* DEBUG_REMOVE no elision */, context), Action: "EndpointWithHostLabelOperation", Version: "2020-01-08", }); @@ -355,7 +355,7 @@ export const se_NestedStructuresCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_NestedStructuresInput(input, context), + ...se_NestedStructuresInput(input /* DEBUG_REMOVE no elision */, context), Action: "NestedStructures", Version: "2020-01-08", }); @@ -391,7 +391,7 @@ export const se_NoInputAndOutputCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_NoInputAndOutputInput(input, context), + ...se_NoInputAndOutputInput(input /* DEBUG_REMOVE no elision */, context), Action: "NoInputAndOutput", Version: "2020-01-08", }); @@ -410,7 +410,7 @@ export const se_QueryIdempotencyTokenAutoFillCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryIdempotencyTokenAutoFillInput(input, context), + ...se_QueryIdempotencyTokenAutoFillInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryIdempotencyTokenAutoFill", Version: "2020-01-08", }); @@ -429,7 +429,7 @@ export const se_QueryListsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryListsInput(input, context), + ...se_QueryListsInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryLists", Version: "2020-01-08", }); @@ -448,7 +448,7 @@ export const se_QueryMapsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryMapsInput(input, context), + ...se_QueryMapsInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryMaps", Version: "2020-01-08", }); @@ -467,7 +467,7 @@ export const se_QueryTimestampsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_QueryTimestampsInput(input, context), + ...se_QueryTimestampsInput(input /* DEBUG_REMOVE no elision */, context), Action: "QueryTimestamps", Version: "2020-01-08", }); @@ -503,7 +503,7 @@ export const se_SimpleInputParamsCommand = async ( }; let body: any; body = buildFormUrlencodedString({ - ...se_SimpleInputParamsInput(input, context), + ...se_SimpleInputParamsInput(input /* DEBUG_REMOVE no elision */, context), Action: "SimpleInputParams", Version: "2020-01-08", }); @@ -726,12 +726,12 @@ export const de_DatetimeOffsetsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_DatetimeOffsetsOutput(data.DatetimeOffsetsResult, context); + contents = de_DatetimeOffsetsOutput(data.DatetimeOffsetsResult /* DEBUG_REMOVE no elision */, context); const response: DatetimeOffsetsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -747,10 +747,9 @@ const de_DatetimeOffsetsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -767,12 +766,15 @@ export const de_EmptyInputAndEmptyOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_EmptyInputAndEmptyOutputOutput(data.EmptyInputAndEmptyOutputResult, context); + contents = de_EmptyInputAndEmptyOutputOutput( + data.EmptyInputAndEmptyOutputResult /* DEBUG_REMOVE no elision */, + context + ); const response: EmptyInputAndEmptyOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -788,10 +790,9 @@ const de_EmptyInputAndEmptyOutputCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -810,7 +811,7 @@ export const de_EndpointOperationCommand = async ( const response: EndpointOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -826,10 +827,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -848,7 +848,7 @@ export const de_EndpointWithHostLabelOperationCommand = async ( const response: EndpointWithHostLabelOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -864,10 +864,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -884,12 +883,12 @@ export const de_FlattenedXmlMapCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FlattenedXmlMapOutput(data.FlattenedXmlMapResult, context); + contents = de_FlattenedXmlMapOutput(data.FlattenedXmlMapResult /* DEBUG_REMOVE no elision */, context); const response: FlattenedXmlMapCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -905,10 +904,9 @@ const de_FlattenedXmlMapCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -925,12 +923,15 @@ export const de_FlattenedXmlMapWithXmlNameCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FlattenedXmlMapWithXmlNameOutput(data.FlattenedXmlMapWithXmlNameResult, context); + contents = de_FlattenedXmlMapWithXmlNameOutput( + data.FlattenedXmlMapWithXmlNameResult /* DEBUG_REMOVE no elision */, + context + ); const response: FlattenedXmlMapWithXmlNameCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -946,10 +947,9 @@ const de_FlattenedXmlMapWithXmlNameCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -966,12 +966,15 @@ export const de_FlattenedXmlMapWithXmlNamespaceCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FlattenedXmlMapWithXmlNamespaceOutput(data.FlattenedXmlMapWithXmlNamespaceResult, context); + contents = de_FlattenedXmlMapWithXmlNamespaceOutput( + data.FlattenedXmlMapWithXmlNamespaceResult /* DEBUG_REMOVE no elision */, + context + ); const response: FlattenedXmlMapWithXmlNamespaceCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -987,10 +990,9 @@ const de_FlattenedXmlMapWithXmlNamespaceCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1007,12 +1009,12 @@ export const de_FractionalSecondsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_FractionalSecondsOutput(data.FractionalSecondsResult, context); + contents = de_FractionalSecondsOutput(data.FractionalSecondsResult /* DEBUG_REMOVE no elision */, context); const response: FractionalSecondsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1028,10 +1030,9 @@ const de_FractionalSecondsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1048,12 +1049,12 @@ export const de_GreetingWithErrorsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_GreetingWithErrorsOutput(data.GreetingWithErrorsResult, context); + contents = de_GreetingWithErrorsOutput(data.GreetingWithErrorsResult /* DEBUG_REMOVE no elision */, context); const response: GreetingWithErrorsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1080,10 +1081,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); } @@ -1103,7 +1103,7 @@ export const de_HostWithPathOperationCommand = async ( const response: HostWithPathOperationCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1119,10 +1119,9 @@ const de_HostWithPathOperationCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1139,12 +1138,12 @@ export const de_IgnoresWrappingXmlNameCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_IgnoresWrappingXmlNameOutput(data.IgnoresWrappingXmlNameResult, context); + contents = de_IgnoresWrappingXmlNameOutput(data.IgnoresWrappingXmlNameResult /* DEBUG_REMOVE no elision */, context); const response: IgnoresWrappingXmlNameCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1160,10 +1159,9 @@ const de_IgnoresWrappingXmlNameCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1182,7 +1180,7 @@ export const de_NestedStructuresCommand = async ( const response: NestedStructuresCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1198,10 +1196,9 @@ const de_NestedStructuresCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1220,7 +1217,7 @@ export const de_NoInputAndNoOutputCommand = async ( const response: NoInputAndNoOutputCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1236,10 +1233,9 @@ const de_NoInputAndNoOutputCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1256,12 +1252,12 @@ export const de_NoInputAndOutputCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_NoInputAndOutputOutput(data.NoInputAndOutputResult, context); + contents = de_NoInputAndOutputOutput(data.NoInputAndOutputResult /* DEBUG_REMOVE no elision */, context); const response: NoInputAndOutputCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1277,10 +1273,9 @@ const de_NoInputAndOutputCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1299,7 +1294,7 @@ export const de_QueryIdempotencyTokenAutoFillCommand = async ( const response: QueryIdempotencyTokenAutoFillCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1315,10 +1310,9 @@ const de_QueryIdempotencyTokenAutoFillCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1337,7 +1331,7 @@ export const de_QueryListsCommand = async ( const response: QueryListsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1353,10 +1347,9 @@ const de_QueryListsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1375,7 +1368,7 @@ export const de_QueryMapsCommand = async ( const response: QueryMapsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1391,10 +1384,9 @@ const de_QueryMapsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1413,7 +1405,7 @@ export const de_QueryTimestampsCommand = async ( const response: QueryTimestampsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1429,10 +1421,9 @@ const de_QueryTimestampsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1449,12 +1440,12 @@ export const de_RecursiveXmlShapesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_RecursiveXmlShapesOutput(data.RecursiveXmlShapesResult, context); + contents = de_RecursiveXmlShapesOutput(data.RecursiveXmlShapesResult /* DEBUG_REMOVE no elision */, context); const response: RecursiveXmlShapesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1470,10 +1461,9 @@ const de_RecursiveXmlShapesCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1492,7 +1482,7 @@ export const de_SimpleInputParamsCommand = async ( const response: SimpleInputParamsCommandOutput = { $metadata: deserializeMetadata(output), }; - return Promise.resolve(response); + return response; }; /** @@ -1508,10 +1498,9 @@ const de_SimpleInputParamsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1528,12 +1517,15 @@ export const de_SimpleScalarXmlPropertiesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_SimpleScalarXmlPropertiesOutput(data.SimpleScalarXmlPropertiesResult, context); + contents = de_SimpleScalarXmlPropertiesOutput( + data.SimpleScalarXmlPropertiesResult /* DEBUG_REMOVE no elision */, + context + ); const response: SimpleScalarXmlPropertiesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1549,10 +1541,9 @@ const de_SimpleScalarXmlPropertiesCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1569,12 +1560,12 @@ export const de_XmlBlobsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlBlobsOutput(data.XmlBlobsResult, context); + contents = de_XmlBlobsOutput(data.XmlBlobsResult /* DEBUG_REMOVE no elision */, context); const response: XmlBlobsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1590,10 +1581,9 @@ const de_XmlBlobsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1610,12 +1600,12 @@ export const de_XmlEmptyBlobsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlBlobsOutput(data.XmlEmptyBlobsResult, context); + contents = de_XmlBlobsOutput(data.XmlEmptyBlobsResult /* DEBUG_REMOVE no elision */, context); const response: XmlEmptyBlobsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1631,10 +1621,9 @@ const de_XmlEmptyBlobsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1651,12 +1640,12 @@ export const de_XmlEmptyListsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlListsOutput(data.XmlEmptyListsResult, context); + contents = de_XmlListsOutput(data.XmlEmptyListsResult /* DEBUG_REMOVE no elision */, context); const response: XmlEmptyListsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1672,10 +1661,9 @@ const de_XmlEmptyListsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1692,12 +1680,12 @@ export const de_XmlEmptyMapsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlMapsOutput(data.XmlEmptyMapsResult, context); + contents = de_XmlMapsOutput(data.XmlEmptyMapsResult /* DEBUG_REMOVE no elision */, context); const response: XmlEmptyMapsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1713,10 +1701,9 @@ const de_XmlEmptyMapsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1733,12 +1720,12 @@ export const de_XmlEnumsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlEnumsOutput(data.XmlEnumsResult, context); + contents = de_XmlEnumsOutput(data.XmlEnumsResult /* DEBUG_REMOVE no elision */, context); const response: XmlEnumsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1754,10 +1741,9 @@ const de_XmlEnumsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1774,12 +1760,12 @@ export const de_XmlIntEnumsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlIntEnumsOutput(data.XmlIntEnumsResult, context); + contents = de_XmlIntEnumsOutput(data.XmlIntEnumsResult /* DEBUG_REMOVE no elision */, context); const response: XmlIntEnumsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1795,10 +1781,9 @@ const de_XmlIntEnumsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1815,12 +1800,12 @@ export const de_XmlListsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlListsOutput(data.XmlListsResult, context); + contents = de_XmlListsOutput(data.XmlListsResult /* DEBUG_REMOVE no elision */, context); const response: XmlListsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1836,10 +1821,9 @@ const de_XmlListsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1856,12 +1840,12 @@ export const de_XmlMapsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlMapsOutput(data.XmlMapsResult, context); + contents = de_XmlMapsOutput(data.XmlMapsResult /* DEBUG_REMOVE no elision */, context); const response: XmlMapsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1877,10 +1861,9 @@ const de_XmlMapsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1897,12 +1880,12 @@ export const de_XmlMapsXmlNameCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlMapsXmlNameOutput(data.XmlMapsXmlNameResult, context); + contents = de_XmlMapsXmlNameOutput(data.XmlMapsXmlNameResult /* DEBUG_REMOVE no elision */, context); const response: XmlMapsXmlNameCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1918,10 +1901,9 @@ const de_XmlMapsXmlNameCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1938,12 +1920,12 @@ export const de_XmlNamespacesCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlNamespacesOutput(data.XmlNamespacesResult, context); + contents = de_XmlNamespacesOutput(data.XmlNamespacesResult /* DEBUG_REMOVE no elision */, context); const response: XmlNamespacesCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -1959,10 +1941,9 @@ const de_XmlNamespacesCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -1979,12 +1960,12 @@ export const de_XmlTimestampsCommand = async ( } const data: any = await parseBody(output.body, context); let contents: any = {}; - contents = de_XmlTimestampsOutput(data.XmlTimestampsResult, context); + contents = de_XmlTimestampsOutput(data.XmlTimestampsResult /* DEBUG_REMOVE no elision */, context); const response: XmlTimestampsCommandOutput = { $metadata: deserializeMetadata(output), ...contents, }; - return Promise.resolve(response); + return response; }; /** @@ -2000,10 +1981,9 @@ const de_XmlTimestampsCommandError = async ( }; const errorCode = loadQueryErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2057,7 +2037,7 @@ const se_ComplexMap = (input: Record, context: __SerdeCo .filter((key) => input[key] != null) .forEach((key) => { entries[`entry.${counter}.key`] = key; - const memberEntries = se_GreetingStruct(input[key], context); + const memberEntries = se_GreetingStruct(input[key] /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { entries[`entry.${counter}.value.${key}`] = value; }); @@ -2111,7 +2091,7 @@ const se_MapOfLists = (input: Record, context: __SerdeContext) .filter((key) => input[key] != null) .forEach((key) => { entries[`entry.${counter}.key`] = key; - const memberEntries = se_StringList(input[key], context); + const memberEntries = se_StringList(input[key] /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { entries[`entry.${counter}.value.${key}`] = value; }); @@ -2142,7 +2122,7 @@ const se_MapWithXmlName = (input: Record, context: __SerdeContex const se_NestedStructuresInput = (input: NestedStructuresInput, context: __SerdeContext): any => { const entries: any = {}; if (input.Nested != null) { - const memberEntries = se_StructArg(input.Nested, context); + const memberEntries = se_StructArg(input.Nested /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `Nested.${key}`; entries[loc] = value; @@ -2157,7 +2137,7 @@ const se_NestedStructuresInput = (input: NestedStructuresInput, context: __Serde const se_NestedStructWithList = (input: NestedStructWithList, context: __SerdeContext): any => { const entries: any = {}; if (input.ListArg != null) { - const memberEntries = se_StringList(input.ListArg, context); + const memberEntries = se_StringList(input.ListArg /* DEBUG_REMOVE no elision */, context); if (input.ListArg?.length === 0) { entries.ListArg = []; } @@ -2175,7 +2155,7 @@ const se_NestedStructWithList = (input: NestedStructWithList, context: __SerdeCo const se_NestedStructWithMap = (input: NestedStructWithMap, context: __SerdeContext): any => { const entries: any = {}; if (input.MapArg != null) { - const memberEntries = se_StringMap(input.MapArg, context); + const memberEntries = se_StringMap(input.MapArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `MapArg.${key}`; entries[loc] = value; @@ -2215,7 +2195,7 @@ const se_QueryIdempotencyTokenAutoFillInput = ( const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): any => { const entries: any = {}; if (input.ListArg != null) { - const memberEntries = se_StringList(input.ListArg, context); + const memberEntries = se_StringList(input.ListArg /* DEBUG_REMOVE no elision */, context); if (input.ListArg?.length === 0) { entries.ListArg = []; } @@ -2225,7 +2205,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.ComplexListArg != null) { - const memberEntries = se_GreetingList(input.ComplexListArg, context); + const memberEntries = se_GreetingList(input.ComplexListArg /* DEBUG_REMOVE no elision */, context); if (input.ComplexListArg?.length === 0) { entries.ComplexListArg = []; } @@ -2235,7 +2215,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.FlattenedListArg != null) { - const memberEntries = se_StringList(input.FlattenedListArg, context); + const memberEntries = se_StringList(input.FlattenedListArg /* DEBUG_REMOVE no elision */, context); if (input.FlattenedListArg?.length === 0) { entries.FlattenedListArg = []; } @@ -2245,7 +2225,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.ListArgWithXmlNameMember != null) { - const memberEntries = se_ListWithXmlName(input.ListArgWithXmlNameMember, context); + const memberEntries = se_ListWithXmlName(input.ListArgWithXmlNameMember /* DEBUG_REMOVE no elision */, context); if (input.ListArgWithXmlNameMember?.length === 0) { entries.ListArgWithXmlNameMember = []; } @@ -2255,7 +2235,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.FlattenedListArgWithXmlName != null) { - const memberEntries = se_ListWithXmlName(input.FlattenedListArgWithXmlName, context); + const memberEntries = se_ListWithXmlName(input.FlattenedListArgWithXmlName /* DEBUG_REMOVE no elision */, context); if (input.FlattenedListArgWithXmlName?.length === 0) { entries.Hi = []; } @@ -2265,7 +2245,7 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an }); } if (input.NestedWithList != null) { - const memberEntries = se_NestedStructWithList(input.NestedWithList, context); + const memberEntries = se_NestedStructWithList(input.NestedWithList /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `NestedWithList.${key}`; entries[loc] = value; @@ -2280,56 +2260,56 @@ const se_QueryListsInput = (input: QueryListsInput, context: __SerdeContext): an const se_QueryMapsInput = (input: QueryMapsInput, context: __SerdeContext): any => { const entries: any = {}; if (input.MapArg != null) { - const memberEntries = se_StringMap(input.MapArg, context); + const memberEntries = se_StringMap(input.MapArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `MapArg.${key}`; entries[loc] = value; }); } if (input.RenamedMapArg != null) { - const memberEntries = se_StringMap(input.RenamedMapArg, context); + const memberEntries = se_StringMap(input.RenamedMapArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `Foo.${key}`; entries[loc] = value; }); } if (input.ComplexMapArg != null) { - const memberEntries = se_ComplexMap(input.ComplexMapArg, context); + const memberEntries = se_ComplexMap(input.ComplexMapArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `ComplexMapArg.${key}`; entries[loc] = value; }); } if (input.MapWithXmlMemberName != null) { - const memberEntries = se_MapWithXmlName(input.MapWithXmlMemberName, context); + const memberEntries = se_MapWithXmlName(input.MapWithXmlMemberName /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `MapWithXmlMemberName.${key}`; entries[loc] = value; }); } if (input.FlattenedMap != null) { - const memberEntries = se_StringMap(input.FlattenedMap, context); + const memberEntries = se_StringMap(input.FlattenedMap /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `FlattenedMap.${key.substring(key.indexOf(".") + 1)}`; entries[loc] = value; }); } if (input.FlattenedMapWithXmlName != null) { - const memberEntries = se_MapWithXmlName(input.FlattenedMapWithXmlName, context); + const memberEntries = se_MapWithXmlName(input.FlattenedMapWithXmlName /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `Hi.${key.substring(key.indexOf(".") + 1)}`; entries[loc] = value; }); } if (input.MapOfLists != null) { - const memberEntries = se_MapOfLists(input.MapOfLists, context); + const memberEntries = se_MapOfLists(input.MapOfLists /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `MapOfLists.${key}`; entries[loc] = value; }); } if (input.NestedStructWithMap != null) { - const memberEntries = se_NestedStructWithMap(input.NestedStructWithMap, context); + const memberEntries = se_NestedStructWithMap(input.NestedStructWithMap /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `NestedStructWithMap.${key}`; entries[loc] = value; @@ -2402,7 +2382,7 @@ const se_StructArg = (input: StructArg, context: __SerdeContext): any => { entries["OtherArg"] = input.OtherArg; } if (input.RecursiveArg != null) { - const memberEntries = se_StructArg(input.RecursiveArg, context); + const memberEntries = se_StructArg(input.RecursiveArg /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { const loc = `RecursiveArg.${key}`; entries[loc] = value; @@ -2421,7 +2401,7 @@ const se_GreetingList = (input: GreetingStruct[], context: __SerdeContext): any if (entry === null) { continue; } - const memberEntries = se_GreetingStruct(entry, context); + const memberEntries = se_GreetingStruct(entry /* DEBUG_REMOVE no elision */, context); Object.entries(memberEntries).forEach(([key, value]) => { entries[`member.${counter}.${key}`] = value; }); @@ -2482,7 +2462,7 @@ const de_ComplexError = (output: any, context: __SerdeContext): ComplexError => contents.TopLevel = __expectString(output["TopLevel"]); } if (output["Nested"] !== undefined) { - contents.Nested = de_ComplexNestedErrorData(output["Nested"], context); + contents.Nested = de_ComplexNestedErrorData(output["Nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2536,7 +2516,7 @@ const de_FlattenedXmlMapOutput = (output: any, context: __SerdeContext): Flatten if (output.myMap === "") { contents.myMap = {}; } else if (output["myMap"] !== undefined) { - contents.myMap = de_FooEnumMap(__getArrayIfSingleItem(output["myMap"]), context); + contents.myMap = de_FooEnumMap(__getArrayIfSingleItem(output["myMap"]) /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2552,7 +2532,10 @@ const de_FlattenedXmlMapWithXmlNameOutput = ( if (output.KVP === "") { contents.myMap = {}; } else if (output["KVP"] !== undefined) { - contents.myMap = de_FlattenedXmlMapWithXmlNameOutputMap(__getArrayIfSingleItem(output["KVP"]), context); + contents.myMap = de_FlattenedXmlMapWithXmlNameOutputMap( + __getArrayIfSingleItem(output["KVP"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2581,7 +2564,10 @@ const de_FlattenedXmlMapWithXmlNamespaceOutput = ( if (output.KVP === "") { contents.myMap = {}; } else if (output["KVP"] !== undefined) { - contents.myMap = de_FlattenedXmlMapWithXmlNamespaceOutputMap(__getArrayIfSingleItem(output["KVP"]), context); + contents.myMap = de_FlattenedXmlMapWithXmlNamespaceOutputMap( + __getArrayIfSingleItem(output["KVP"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2682,7 +2668,7 @@ const de_NoInputAndOutputOutput = (output: any, context: __SerdeContext): NoInpu const de_RecursiveXmlShapesOutput = (output: any, context: __SerdeContext): RecursiveXmlShapesOutput => { const contents: any = {}; if (output["nested"] !== undefined) { - contents.nested = de_RecursiveXmlShapesOutputNested1(output["nested"], context); + contents.nested = de_RecursiveXmlShapesOutputNested1(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2696,7 +2682,7 @@ const de_RecursiveXmlShapesOutputNested1 = (output: any, context: __SerdeContext contents.foo = __expectString(output["foo"]); } if (output["nested"] !== undefined) { - contents.nested = de_RecursiveXmlShapesOutputNested2(output["nested"], context); + contents.nested = de_RecursiveXmlShapesOutputNested2(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2710,7 +2696,10 @@ const de_RecursiveXmlShapesOutputNested2 = (output: any, context: __SerdeContext contents.bar = __expectString(output["bar"]); } if (output["recursiveMember"] !== undefined) { - contents.recursiveMember = de_RecursiveXmlShapesOutputNested1(output["recursiveMember"], context); + contents.recursiveMember = de_RecursiveXmlShapesOutputNested1( + output["recursiveMember"] /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2771,7 +2760,7 @@ const de_StructureList = (output: any, context: __SerdeContext): StructureListMe return (output || []) .filter((e: any) => e != null) .map((entry: any) => { - return de_StructureListMember(entry, context); + return de_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -2817,17 +2806,26 @@ const de_XmlEnumsOutput = (output: any, context: __SerdeContext): XmlEnumsOutput if (output.fooEnumList === "") { contents.fooEnumList = []; } else if (output["fooEnumList"] !== undefined && output["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = de_FooEnumList(__getArrayIfSingleItem(output["fooEnumList"]["member"]), context); + contents.fooEnumList = de_FooEnumList( + __getArrayIfSingleItem(output["fooEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.fooEnumSet === "") { contents.fooEnumSet = []; } else if (output["fooEnumSet"] !== undefined && output["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = de_FooEnumSet(__getArrayIfSingleItem(output["fooEnumSet"]["member"]), context); + contents.fooEnumSet = de_FooEnumSet( + __getArrayIfSingleItem(output["fooEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.fooEnumMap === "") { contents.fooEnumMap = {}; } else if (output["fooEnumMap"] !== undefined && output["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = de_FooEnumMap(__getArrayIfSingleItem(output["fooEnumMap"]["entry"]), context); + contents.fooEnumMap = de_FooEnumMap( + __getArrayIfSingleItem(output["fooEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2849,17 +2847,26 @@ const de_XmlIntEnumsOutput = (output: any, context: __SerdeContext): XmlIntEnums if (output.intEnumList === "") { contents.intEnumList = []; } else if (output["intEnumList"] !== undefined && output["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(output["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(output["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumSet === "") { contents.intEnumSet = []; } else if (output["intEnumSet"] !== undefined && output["intEnumSet"]["member"] !== undefined) { - contents.intEnumSet = de_IntegerEnumSet(__getArrayIfSingleItem(output["intEnumSet"]["member"]), context); + contents.intEnumSet = de_IntegerEnumSet( + __getArrayIfSingleItem(output["intEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumMap === "") { contents.intEnumMap = {}; } else if (output["intEnumMap"] !== undefined && output["intEnumMap"]["entry"] !== undefined) { - contents.intEnumMap = de_IntegerEnumMap(__getArrayIfSingleItem(output["intEnumMap"]["entry"]), context); + contents.intEnumMap = de_IntegerEnumMap( + __getArrayIfSingleItem(output["intEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2872,66 +2879,96 @@ const de_XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput if (output.stringList === "") { contents.stringList = []; } else if (output["stringList"] !== undefined && output["stringList"]["member"] !== undefined) { - contents.stringList = de_StringList(__getArrayIfSingleItem(output["stringList"]["member"]), context); + contents.stringList = de_StringList( + __getArrayIfSingleItem(output["stringList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.stringSet === "") { contents.stringSet = []; } else if (output["stringSet"] !== undefined && output["stringSet"]["member"] !== undefined) { - contents.stringSet = de_StringSet(__getArrayIfSingleItem(output["stringSet"]["member"]), context); + contents.stringSet = de_StringSet( + __getArrayIfSingleItem(output["stringSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.integerList === "") { contents.integerList = []; } else if (output["integerList"] !== undefined && output["integerList"]["member"] !== undefined) { - contents.integerList = de_IntegerList(__getArrayIfSingleItem(output["integerList"]["member"]), context); + contents.integerList = de_IntegerList( + __getArrayIfSingleItem(output["integerList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.booleanList === "") { contents.booleanList = []; } else if (output["booleanList"] !== undefined && output["booleanList"]["member"] !== undefined) { - contents.booleanList = de_BooleanList(__getArrayIfSingleItem(output["booleanList"]["member"]), context); + contents.booleanList = de_BooleanList( + __getArrayIfSingleItem(output["booleanList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.timestampList === "") { contents.timestampList = []; } else if (output["timestampList"] !== undefined && output["timestampList"]["member"] !== undefined) { - contents.timestampList = de_TimestampList(__getArrayIfSingleItem(output["timestampList"]["member"]), context); + contents.timestampList = de_TimestampList( + __getArrayIfSingleItem(output["timestampList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.enumList === "") { contents.enumList = []; } else if (output["enumList"] !== undefined && output["enumList"]["member"] !== undefined) { - contents.enumList = de_FooEnumList(__getArrayIfSingleItem(output["enumList"]["member"]), context); + contents.enumList = de_FooEnumList( + __getArrayIfSingleItem(output["enumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.intEnumList === "") { contents.intEnumList = []; } else if (output["intEnumList"] !== undefined && output["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(output["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(output["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.nestedStringList === "") { contents.nestedStringList = []; } else if (output["nestedStringList"] !== undefined && output["nestedStringList"]["member"] !== undefined) { contents.nestedStringList = de_NestedStringList( - __getArrayIfSingleItem(output["nestedStringList"]["member"]), + __getArrayIfSingleItem(output["nestedStringList"]["member"]) /* DEBUG_REMOVE no elision */, context ); } if (output.renamed === "") { contents.renamedListMembers = []; } else if (output["renamed"] !== undefined && output["renamed"]["item"] !== undefined) { - contents.renamedListMembers = de_RenamedListMembers(__getArrayIfSingleItem(output["renamed"]["item"]), context); + contents.renamedListMembers = de_RenamedListMembers( + __getArrayIfSingleItem(output["renamed"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.flattenedList === "") { contents.flattenedList = []; } else if (output["flattenedList"] !== undefined) { - contents.flattenedList = de_RenamedListMembers(__getArrayIfSingleItem(output["flattenedList"]), context); + contents.flattenedList = de_RenamedListMembers( + __getArrayIfSingleItem(output["flattenedList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.customName === "") { contents.flattenedList2 = []; } else if (output["customName"] !== undefined) { - contents.flattenedList2 = de_RenamedListMembers(__getArrayIfSingleItem(output["customName"]), context); + contents.flattenedList2 = de_RenamedListMembers( + __getArrayIfSingleItem(output["customName"]) /* DEBUG_REMOVE no elision */, + context + ); } if (output.flattenedListWithMemberNamespace === "") { contents.flattenedListWithMemberNamespace = []; } else if (output["flattenedListWithMemberNamespace"] !== undefined) { contents.flattenedListWithMemberNamespace = de_ListWithMemberNamespace( - __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]), + __getArrayIfSingleItem(output["flattenedListWithMemberNamespace"]) /* DEBUG_REMOVE no elision */, context ); } @@ -2939,14 +2976,17 @@ const de_XmlListsOutput = (output: any, context: __SerdeContext): XmlListsOutput contents.flattenedListWithNamespace = []; } else if (output["flattenedListWithNamespace"] !== undefined) { contents.flattenedListWithNamespace = de_ListWithNamespace( - __getArrayIfSingleItem(output["flattenedListWithNamespace"]), + __getArrayIfSingleItem(output["flattenedListWithNamespace"]) /* DEBUG_REMOVE no elision */, context ); } if (output.myStructureList === "") { contents.structureList = []; } else if (output["myStructureList"] !== undefined && output["myStructureList"]["item"] !== undefined) { - contents.structureList = de_StructureList(__getArrayIfSingleItem(output["myStructureList"]["item"]), context); + contents.structureList = de_StructureList( + __getArrayIfSingleItem(output["myStructureList"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2959,7 +2999,10 @@ const de_XmlMapsOutput = (output: any, context: __SerdeContext): XmlMapsOutput = if (output.myMap === "") { contents.myMap = {}; } else if (output["myMap"] !== undefined && output["myMap"]["entry"] !== undefined) { - contents.myMap = de_XmlMapsOutputMap(__getArrayIfSingleItem(output["myMap"]["entry"]), context); + contents.myMap = de_XmlMapsOutputMap( + __getArrayIfSingleItem(output["myMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2972,7 +3015,7 @@ const de_XmlMapsOutputMap = (output: any, context: __SerdeContext): Record { const contents: any = {}; if (output["nested"] !== undefined) { - contents.nested = de_XmlNamespaceNested(output["nested"], context); + contents.nested = de_XmlNamespaceNested(output["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -3180,7 +3229,7 @@ const de_NestedStringList = (output: any, context: __SerdeContext): string[][] = return (output || []) .filter((e: any) => e != null) .map((entry: any) => { - return de_StringList(__getArrayIfSingleItem(entry["member"]), context); + return de_StringList(__getArrayIfSingleItem(entry["member"]) /* DEBUG_REMOVE no elision */, context); }); }; @@ -3237,6 +3286,7 @@ const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext const collectBodyString = (streamBody: any, context: __SerdeContext): Promise => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)); +const throwDefaultError = withBaseException(__BaseException); const buildHttpRpcRequest = async ( context: __SerdeContext, headers: __HeaderBag, diff --git a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts index 4944c923ddd26..d4b63530f8bce 100644 --- a/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts +++ b/private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts @@ -5,6 +5,7 @@ import { isValidHostname as __isValidHostname, } from "@aws-sdk/protocol-http"; import { + _json, convertMap, dateToUtcString as __dateToUtcString, decorateServiceException as __decorateServiceException, @@ -22,7 +23,7 @@ import { LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, - map as __map, + map, parseBoolean as __parseBoolean, parseEpochTimestamp as __parseEpochTimestamp, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, @@ -36,7 +37,8 @@ import { strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, strictParseShort as __strictParseShort, - throwDefaultError, + take, + withBaseException, } from "@aws-sdk/smithy-client"; import { DocumentType as __DocumentType, @@ -488,10 +490,12 @@ export const se_DocumentTypeCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/DocumentType"; let body: any; - body = JSON.stringify({ - ...(input.documentValue != null && { documentValue: se_Document(input.documentValue, context) }), - ...(input.stringValue != null && { stringValue: input.stringValue }), - }); + body = JSON.stringify( + take(input, { + documentValue: (_) => se_Document(_ /* DEBUG_REMOVE no elision */, context), + stringValue: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -607,9 +611,11 @@ export const se_EndpointWithHostLabelOperationCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/EndpointWithHostLabelOperation"; let body: any; - body = JSON.stringify({ - ...(input.label != null && { label: input.label }), - }); + body = JSON.stringify( + take(input, { + label: [], + }) + ); let { hostname: resolvedHostname } = await context.endpoint(); if (context.disableHostPrefix !== true) { resolvedHostname = "foo.{label}." + resolvedHostname; @@ -720,9 +726,11 @@ export const se_HttpChecksumRequiredCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpChecksumRequired"; let body: any; - body = JSON.stringify({ - ...(input.foo != null && { foo: input.foo }), - }); + body = JSON.stringify( + take(input, { + foo: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -833,7 +841,7 @@ export const se_HttpPayloadWithStructureCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; let body: any; if (input.nested !== undefined) { - body = se_NestedPayload(input.nested, context); + body = _json(input.nested) /* DEBUG_REMOVE serde elision of input */; } if (body === undefined) { body = {}; @@ -1290,9 +1298,11 @@ export const se_JsonBlobsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonBlobs"; let body: any; - body = JSON.stringify({ - ...(input.data != null && { data: context.base64Encoder(input.data) }), - }); + body = JSON.stringify( + take(input, { + data: (_) => context.base64Encoder(_), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1317,14 +1327,16 @@ export const se_JsonEnumsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonEnums"; let body: any; - body = JSON.stringify({ - ...(input.fooEnum1 != null && { fooEnum1: input.fooEnum1 }), - ...(input.fooEnum2 != null && { fooEnum2: input.fooEnum2 }), - ...(input.fooEnum3 != null && { fooEnum3: input.fooEnum3 }), - ...(input.fooEnumList != null && { fooEnumList: se_FooEnumList(input.fooEnumList, context) }), - ...(input.fooEnumMap != null && { fooEnumMap: se_FooEnumMap(input.fooEnumMap, context) }), - ...(input.fooEnumSet != null && { fooEnumSet: se_FooEnumSet(input.fooEnumSet, context) }), - }); + body = JSON.stringify( + take(input, { + fooEnum1: [], + fooEnum2: [], + fooEnum3: [], + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1349,14 +1361,16 @@ export const se_JsonIntEnumsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonIntEnums"; let body: any; - body = JSON.stringify({ - ...(input.integerEnum1 != null && { integerEnum1: input.integerEnum1 }), - ...(input.integerEnum2 != null && { integerEnum2: input.integerEnum2 }), - ...(input.integerEnum3 != null && { integerEnum3: input.integerEnum3 }), - ...(input.integerEnumList != null && { integerEnumList: se_IntegerEnumList(input.integerEnumList, context) }), - ...(input.integerEnumMap != null && { integerEnumMap: se_IntegerEnumMap(input.integerEnumMap, context) }), - ...(input.integerEnumSet != null && { integerEnumSet: se_IntegerEnumSet(input.integerEnumSet, context) }), - }); + body = JSON.stringify( + take(input, { + integerEnum1: [], + integerEnum2: [], + integerEnum3: [], + integerEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1381,18 +1395,20 @@ export const se_JsonListsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonLists"; let body: any; - body = JSON.stringify({ - ...(input.booleanList != null && { booleanList: se_BooleanList(input.booleanList, context) }), - ...(input.enumList != null && { enumList: se_FooEnumList(input.enumList, context) }), - ...(input.intEnumList != null && { intEnumList: se_IntegerEnumList(input.intEnumList, context) }), - ...(input.integerList != null && { integerList: se_IntegerList(input.integerList, context) }), - ...(input.nestedStringList != null && { nestedStringList: se_NestedStringList(input.nestedStringList, context) }), - ...(input.sparseStringList != null && { sparseStringList: se_SparseStringList(input.sparseStringList, context) }), - ...(input.stringList != null && { stringList: se_StringList(input.stringList, context) }), - ...(input.stringSet != null && { stringSet: se_StringSet(input.stringSet, context) }), - ...(input.structureList != null && { myStructureList: se_StructureList(input.structureList, context) }), - ...(input.timestampList != null && { timestampList: se_TimestampList(input.timestampList, context) }), - }); + body = JSON.stringify( + take(input, { + booleanList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + enumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + intEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + nestedStringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseStringList: (_) => se_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + stringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + stringSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + myStructureList: [, (_) => se_StructureList(_ /* DEBUG_REMOVE no elision */, context), `structureList`], + timestampList: (_) => se_TimestampList(_ /* DEBUG_REMOVE no elision */, context), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1417,18 +1433,20 @@ export const se_JsonMapsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonMaps"; let body: any; - body = JSON.stringify({ - ...(input.denseBooleanMap != null && { denseBooleanMap: se_DenseBooleanMap(input.denseBooleanMap, context) }), - ...(input.denseNumberMap != null && { denseNumberMap: se_DenseNumberMap(input.denseNumberMap, context) }), - ...(input.denseSetMap != null && { denseSetMap: se_DenseSetMap(input.denseSetMap, context) }), - ...(input.denseStringMap != null && { denseStringMap: se_DenseStringMap(input.denseStringMap, context) }), - ...(input.denseStructMap != null && { denseStructMap: se_DenseStructMap(input.denseStructMap, context) }), - ...(input.sparseBooleanMap != null && { sparseBooleanMap: se_SparseBooleanMap(input.sparseBooleanMap, context) }), - ...(input.sparseNumberMap != null && { sparseNumberMap: se_SparseNumberMap(input.sparseNumberMap, context) }), - ...(input.sparseSetMap != null && { sparseSetMap: se_SparseSetMap(input.sparseSetMap, context) }), - ...(input.sparseStringMap != null && { sparseStringMap: se_SparseStringMap(input.sparseStringMap, context) }), - ...(input.sparseStructMap != null && { sparseStructMap: se_SparseStructMap(input.sparseStructMap, context) }), - }); + body = JSON.stringify( + take(input, { + denseBooleanMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseNumberMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseSetMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStringMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStructMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseBooleanMap: (_) => se_SparseBooleanMap(_ /* DEBUG_REMOVE no elision */, context), + sparseNumberMap: (_) => se_SparseNumberMap(_ /* DEBUG_REMOVE no elision */, context), + sparseSetMap: (_) => se_SparseSetMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => se_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStructMap: (_) => se_SparseStructMap(_ /* DEBUG_REMOVE no elision */, context), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1453,19 +1471,17 @@ export const se_JsonTimestampsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonTimestamps"; let body: any; - body = JSON.stringify({ - ...(input.dateTime != null && { dateTime: input.dateTime.toISOString().split(".")[0] + "Z" }), - ...(input.dateTimeOnTarget != null && { - dateTimeOnTarget: input.dateTimeOnTarget.toISOString().split(".")[0] + "Z", - }), - ...(input.epochSeconds != null && { epochSeconds: Math.round(input.epochSeconds.getTime() / 1000) }), - ...(input.epochSecondsOnTarget != null && { - epochSecondsOnTarget: Math.round(input.epochSecondsOnTarget.getTime() / 1000), - }), - ...(input.httpDate != null && { httpDate: __dateToUtcString(input.httpDate) }), - ...(input.httpDateOnTarget != null && { httpDateOnTarget: __dateToUtcString(input.httpDateOnTarget) }), - ...(input.normal != null && { normal: Math.round(input.normal.getTime() / 1000) }), - }); + body = JSON.stringify( + take(input, { + dateTime: (_) => _.toISOString().split(".")[0] + "Z", + dateTimeOnTarget: (_) => _.toISOString().split(".")[0] + "Z", + epochSeconds: (_) => Math.round(_.getTime() / 1000), + epochSecondsOnTarget: (_) => Math.round(_.getTime() / 1000), + httpDate: (_) => __dateToUtcString(_), + httpDateOnTarget: (_) => __dateToUtcString(_), + normal: (_) => Math.round(_.getTime() / 1000), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1490,9 +1506,11 @@ export const se_JsonUnionsCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/JsonUnions"; let body: any; - body = JSON.stringify({ - ...(input.contents != null && { contents: se_MyUnion(input.contents, context) }), - }); + body = JSON.stringify( + take(input, { + contents: (_) => se_MyUnion(_ /* DEBUG_REMOVE no elision */, context), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1595,9 +1613,11 @@ export const se_MalformedBlobCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedBlob"; let body: any; - body = JSON.stringify({ - ...(input.blob != null && { blob: context.base64Encoder(input.blob) }), - }); + body = JSON.stringify( + take(input, { + blob: (_) => context.base64Encoder(_), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1635,9 +1655,11 @@ export const se_MalformedBooleanCommand = async ( booleanInQuery: [() => input.booleanInQuery !== void 0, () => input.booleanInQuery!.toString()], }); let body: any; - body = JSON.stringify({ - ...(input.booleanInBody != null && { booleanInBody: input.booleanInBody }), - }); + body = JSON.stringify( + take(input, { + booleanInBody: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1676,9 +1698,11 @@ export const se_MalformedByteCommand = async ( byteInQuery: [() => input.byteInQuery !== void 0, () => input.byteInQuery!.toString()], }); let body: any; - body = JSON.stringify({ - ...(input.byteInBody != null && { byteInBody: input.byteInBody }), - }); + body = JSON.stringify( + take(input, { + byteInBody: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1705,9 +1729,11 @@ export const se_MalformedContentTypeWithBodyCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedContentTypeWithBody"; let body: any; - body = JSON.stringify({ - ...(input.hi != null && { hi: input.hi }), - }); + body = JSON.stringify( + take(input, { + hi: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1833,9 +1859,11 @@ export const se_MalformedDoubleCommand = async ( ], }); let body: any; - body = JSON.stringify({ - ...(input.doubleInBody != null && { doubleInBody: __serializeFloat(input.doubleInBody) }), - }); + body = JSON.stringify( + take(input, { + doubleInBody: (_) => __serializeFloat(_), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1880,9 +1908,11 @@ export const se_MalformedFloatCommand = async ( ], }); let body: any; - body = JSON.stringify({ - ...(input.floatInBody != null && { floatInBody: __serializeFloat(input.floatInBody) }), - }); + body = JSON.stringify( + take(input, { + floatInBody: (_) => __serializeFloat(_), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1921,9 +1951,11 @@ export const se_MalformedIntegerCommand = async ( integerInQuery: [() => input.integerInQuery !== void 0, () => input.integerInQuery!.toString()], }); let body: any; - body = JSON.stringify({ - ...(input.integerInBody != null && { integerInBody: input.integerInBody }), - }); + body = JSON.stringify( + take(input, { + integerInBody: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1949,9 +1981,11 @@ export const se_MalformedListCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedList"; let body: any; - body = JSON.stringify({ - ...(input.bodyList != null && { bodyList: se_SimpleList(input.bodyList, context) }), - }); + body = JSON.stringify( + take(input, { + bodyList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -1989,9 +2023,11 @@ export const se_MalformedLongCommand = async ( longInQuery: [() => input.longInQuery !== void 0, () => input.longInQuery!.toString()], }); let body: any; - body = JSON.stringify({ - ...(input.longInBody != null && { longInBody: input.longInBody }), - }); + body = JSON.stringify( + take(input, { + longInBody: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2017,9 +2053,11 @@ export const se_MalformedMapCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedMap"; let body: any; - body = JSON.stringify({ - ...(input.bodyMap != null && { bodyMap: se_SimpleMap(input.bodyMap, context) }), - }); + body = JSON.stringify( + take(input, { + bodyMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2044,10 +2082,12 @@ export const se_MalformedRequestBodyCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedRequestBody"; let body: any; - body = JSON.stringify({ - ...(input.float != null && { float: __serializeFloat(input.float) }), - ...(input.int != null && { int: input.int }), - }); + body = JSON.stringify( + take(input, { + float: (_) => __serializeFloat(_), + int: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2085,9 +2125,11 @@ export const se_MalformedShortCommand = async ( shortInQuery: [() => input.shortInQuery !== void 0, () => input.shortInQuery!.toString()], }); let body: any; - body = JSON.stringify({ - ...(input.shortInBody != null && { shortInBody: input.shortInBody }), - }); + body = JSON.stringify( + take(input, { + shortInBody: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2141,9 +2183,11 @@ export const se_MalformedTimestampBodyDateTimeCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyDateTime"; let body: any; - body = JSON.stringify({ - ...(input.timestamp != null && { timestamp: input.timestamp.toISOString().split(".")[0] + "Z" }), - }); + body = JSON.stringify( + take(input, { + timestamp: (_) => _.toISOString().split(".")[0] + "Z", + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2169,9 +2213,11 @@ export const se_MalformedTimestampBodyDefaultCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyDefault"; let body: any; - body = JSON.stringify({ - ...(input.timestamp != null && { timestamp: Math.round(input.timestamp.getTime() / 1000) }), - }); + body = JSON.stringify( + take(input, { + timestamp: (_) => Math.round(_.getTime() / 1000), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2197,9 +2243,11 @@ export const se_MalformedTimestampBodyHttpDateCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedTimestampBodyHttpDate"; let body: any; - body = JSON.stringify({ - ...(input.timestamp != null && { timestamp: __dateToUtcString(input.timestamp) }), - }); + body = JSON.stringify( + take(input, { + timestamp: (_) => __dateToUtcString(_), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2490,9 +2538,11 @@ export const se_MalformedUnionCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/MalformedUnion"; let body: any; - body = JSON.stringify({ - ...(input.union != null && { union: se_SimpleUnion(input.union, context) }), - }); + body = JSON.stringify( + take(input, { + union: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2730,9 +2780,11 @@ export const se_PostPlayerActionCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PostPlayerAction"; let body: any; - body = JSON.stringify({ - ...(input.action != null && { action: se_PlayerAction(input.action, context) }), - }); + body = JSON.stringify( + take(input, { + action: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2757,9 +2809,11 @@ export const se_PostUnionWithJsonNameCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/PostUnionWithJsonName"; let body: any; - body = JSON.stringify({ - ...(input.value != null && { value: se_UnionWithJsonName(input.value, context) }), - }); + body = JSON.stringify( + take(input, { + value: (_) => se_UnionWithJsonName(_ /* DEBUG_REMOVE no elision */, context), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2865,9 +2919,11 @@ export const se_RecursiveShapesCommand = async ( }; const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/RecursiveShapes"; let body: any; - body = JSON.stringify({ - ...(input.nested != null && { nested: se_RecursiveShapesInputOutputNested1(input.nested, context) }), - }); + body = JSON.stringify( + take(input, { + nested: (_) => se_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }) + ); return new __HttpRequest({ protocol, hostname, @@ -2894,17 +2950,19 @@ export const se_SimpleScalarPropertiesCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SimpleScalarProperties"; let body: any; - body = JSON.stringify({ - ...(input.byteValue != null && { byteValue: input.byteValue }), - ...(input.doubleValue != null && { DoubleDribble: __serializeFloat(input.doubleValue) }), - ...(input.falseBooleanValue != null && { falseBooleanValue: input.falseBooleanValue }), - ...(input.floatValue != null && { floatValue: __serializeFloat(input.floatValue) }), - ...(input.integerValue != null && { integerValue: input.integerValue }), - ...(input.longValue != null && { longValue: input.longValue }), - ...(input.shortValue != null && { shortValue: input.shortValue }), - ...(input.stringValue != null && { stringValue: input.stringValue }), - ...(input.trueBooleanValue != null && { trueBooleanValue: input.trueBooleanValue }), - }); + body = JSON.stringify( + take(input, { + byteValue: [], + DoubleDribble: [, (_) => __serializeFloat(_), `doubleValue`], + falseBooleanValue: [], + floatValue: (_) => __serializeFloat(_), + integerValue: [], + longValue: [], + shortValue: [], + stringValue: [], + trueBooleanValue: [], + }) + ); return new __HttpRequest({ protocol, hostname, @@ -3016,9 +3074,11 @@ export const se_TestBodyStructureCommand = async ( }); const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/body"; let body: any; - body = JSON.stringify({ - ...(input.testConfig != null && { testConfig: se_TestConfig(input.testConfig, context) }), - }); + body = JSON.stringify( + take(input, { + testConfig: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); return new __HttpRequest({ protocol, hostname, @@ -3096,7 +3156,7 @@ export const se_TestPayloadStructureCommand = async ( const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/payload"; let body: any; if (input.payloadConfig !== undefined) { - body = se_PayloadConfig(input.payloadConfig, context); + body = _json(input.payloadConfig) /* DEBUG_REMOVE serde elision of input */; } if (body === undefined) { body = {}; @@ -3220,10 +3280,9 @@ const de_AllQueryStringTypesCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3258,10 +3317,9 @@ const de_ConstantAndVariableQueryStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3296,10 +3354,9 @@ const de_ConstantQueryStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3318,9 +3375,10 @@ export const de_DatetimeOffsetsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.datetime != null) { - contents.datetime = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.datetime)); - } + const doc = take(data, { + datetime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + }); + Object.assign(contents, doc); return contents; }; @@ -3337,10 +3395,9 @@ const de_DatetimeOffsetsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3359,12 +3416,11 @@ export const de_DocumentTypeCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.documentValue != null) { - contents.documentValue = de_Document(data.documentValue, context); - } - if (data.stringValue != null) { - contents.stringValue = __expectString(data.stringValue); - } + const doc = take(data, { + documentValue: (_) => de_Document(_ /* DEBUG_REMOVE no elision */, context), + stringValue: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -3381,10 +3437,9 @@ const de_DocumentTypeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3421,10 +3476,9 @@ const de_DocumentTypeAsPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3459,10 +3513,9 @@ const de_EmptyInputAndEmptyOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3497,10 +3550,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3535,10 +3587,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3557,12 +3608,11 @@ export const de_FractionalSecondsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.datetime != null) { - contents.datetime = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.datetime)); - } - if (data.httpdate != null) { - contents.httpdate = __expectNonNull(__parseRfc7231DateTime(data.httpdate)); - } + const doc = take(data, { + datetime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + httpdate: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + }); + Object.assign(contents, doc); return contents; }; @@ -3579,10 +3629,9 @@ const de_FractionalSecondsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3629,10 +3678,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); } @@ -3668,10 +3716,9 @@ const de_HostWithPathOperationCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3690,9 +3737,10 @@ export const de_HttpChecksumRequiredCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.foo != null) { - contents.foo = __expectString(data.foo); - } + const doc = take(data, { + foo: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -3709,10 +3757,9 @@ const de_HttpChecksumRequiredCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3748,10 +3795,9 @@ const de_HttpEnumPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3788,10 +3834,9 @@ const de_HttpPayloadTraitsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3828,10 +3873,9 @@ const de_HttpPayloadTraitsWithMediaTypeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3850,7 +3894,7 @@ export const de_HttpPayloadWithStructureCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_NestedPayload(data, context); + contents.nested = _json(data) /* DEBUG_REMOVE serde elision of output */; return contents; }; @@ -3867,10 +3911,9 @@ const de_HttpPayloadWithStructureCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3915,10 +3958,9 @@ const de_HttpPrefixHeadersCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3962,10 +4004,9 @@ const de_HttpPrefixHeadersInResponseCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4000,10 +4041,9 @@ const de_HttpRequestWithFloatLabelsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4038,10 +4078,9 @@ const de_HttpRequestWithGreedyLabelInPathCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4076,10 +4115,9 @@ const de_HttpRequestWithLabelsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4114,10 +4152,9 @@ const de_HttpRequestWithLabelsAndTimestampFormatCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4152,10 +4189,9 @@ const de_HttpRequestWithRegexLiteralCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4193,10 +4229,9 @@ const de_HttpResponseCodeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4232,10 +4267,9 @@ const de_HttpStringPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4254,9 +4288,10 @@ export const de_IgnoreQueryParamsInResponseCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.baz != null) { - contents.baz = __expectString(data.baz); - } + const doc = take(data, { + baz: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -4273,10 +4308,9 @@ const de_IgnoreQueryParamsInResponseCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4366,10 +4400,9 @@ const de_InputAndOutputWithHeadersCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4388,9 +4421,10 @@ export const de_JsonBlobsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.data != null) { - contents.data = context.base64Decoder(data.data); - } + const doc = take(data, { + data: context.base64Decoder, + }); + Object.assign(contents, doc); return contents; }; @@ -4407,10 +4441,9 @@ const de_JsonBlobsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4429,24 +4462,15 @@ export const de_JsonEnumsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.fooEnum1 != null) { - contents.fooEnum1 = __expectString(data.fooEnum1); - } - if (data.fooEnum2 != null) { - contents.fooEnum2 = __expectString(data.fooEnum2); - } - if (data.fooEnum3 != null) { - contents.fooEnum3 = __expectString(data.fooEnum3); - } - if (data.fooEnumList != null) { - contents.fooEnumList = de_FooEnumList(data.fooEnumList, context); - } - if (data.fooEnumMap != null) { - contents.fooEnumMap = de_FooEnumMap(data.fooEnumMap, context); - } - if (data.fooEnumSet != null) { - contents.fooEnumSet = de_FooEnumSet(data.fooEnumSet, context); - } + const doc = take(data, { + fooEnum1: __expectString, + fooEnum2: __expectString, + fooEnum3: __expectString, + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -4463,10 +4487,9 @@ const de_JsonEnumsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4485,24 +4508,15 @@ export const de_JsonIntEnumsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.integerEnum1 != null) { - contents.integerEnum1 = __expectInt32(data.integerEnum1); - } - if (data.integerEnum2 != null) { - contents.integerEnum2 = __expectInt32(data.integerEnum2); - } - if (data.integerEnum3 != null) { - contents.integerEnum3 = __expectInt32(data.integerEnum3); - } - if (data.integerEnumList != null) { - contents.integerEnumList = de_IntegerEnumList(data.integerEnumList, context); - } - if (data.integerEnumMap != null) { - contents.integerEnumMap = de_IntegerEnumMap(data.integerEnumMap, context); - } - if (data.integerEnumSet != null) { - contents.integerEnumSet = de_IntegerEnumSet(data.integerEnumSet, context); - } + const doc = take(data, { + integerEnum1: __expectInt32, + integerEnum2: __expectInt32, + integerEnum3: __expectInt32, + integerEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -4519,10 +4533,9 @@ const de_JsonIntEnumsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4541,36 +4554,19 @@ export const de_JsonListsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.booleanList != null) { - contents.booleanList = de_BooleanList(data.booleanList, context); - } - if (data.enumList != null) { - contents.enumList = de_FooEnumList(data.enumList, context); - } - if (data.intEnumList != null) { - contents.intEnumList = de_IntegerEnumList(data.intEnumList, context); - } - if (data.integerList != null) { - contents.integerList = de_IntegerList(data.integerList, context); - } - if (data.nestedStringList != null) { - contents.nestedStringList = de_NestedStringList(data.nestedStringList, context); - } - if (data.sparseStringList != null) { - contents.sparseStringList = de_SparseStringList(data.sparseStringList, context); - } - if (data.stringList != null) { - contents.stringList = de_StringList(data.stringList, context); - } - if (data.stringSet != null) { - contents.stringSet = de_StringSet(data.stringSet, context); - } - if (data.myStructureList != null) { - contents.structureList = de_StructureList(data.myStructureList, context); - } - if (data.timestampList != null) { - contents.timestampList = de_TimestampList(data.timestampList, context); - } + const doc = take(data, { + booleanList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + enumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + intEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + nestedStringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseStringList: (_) => de_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + stringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + stringSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + structureList: [, (_) => de_StructureList(_ /* DEBUG_REMOVE no elision */, context), `myStructureList`], + timestampList: (_) => de_TimestampList(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -4587,10 +4583,9 @@ const de_JsonListsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4609,36 +4604,19 @@ export const de_JsonMapsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.denseBooleanMap != null) { - contents.denseBooleanMap = de_DenseBooleanMap(data.denseBooleanMap, context); - } - if (data.denseNumberMap != null) { - contents.denseNumberMap = de_DenseNumberMap(data.denseNumberMap, context); - } - if (data.denseSetMap != null) { - contents.denseSetMap = de_DenseSetMap(data.denseSetMap, context); - } - if (data.denseStringMap != null) { - contents.denseStringMap = de_DenseStringMap(data.denseStringMap, context); - } - if (data.denseStructMap != null) { - contents.denseStructMap = de_DenseStructMap(data.denseStructMap, context); - } - if (data.sparseBooleanMap != null) { - contents.sparseBooleanMap = de_SparseBooleanMap(data.sparseBooleanMap, context); - } - if (data.sparseNumberMap != null) { - contents.sparseNumberMap = de_SparseNumberMap(data.sparseNumberMap, context); - } - if (data.sparseSetMap != null) { - contents.sparseSetMap = de_SparseSetMap(data.sparseSetMap, context); - } - if (data.sparseStringMap != null) { - contents.sparseStringMap = de_SparseStringMap(data.sparseStringMap, context); - } - if (data.sparseStructMap != null) { - contents.sparseStructMap = de_SparseStructMap(data.sparseStructMap, context); - } + const doc = take(data, { + denseBooleanMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseNumberMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseSetMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStringMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStructMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseBooleanMap: (_) => de_SparseBooleanMap(_ /* DEBUG_REMOVE no elision */, context), + sparseNumberMap: (_) => de_SparseNumberMap(_ /* DEBUG_REMOVE no elision */, context), + sparseSetMap: (_) => de_SparseSetMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => de_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStructMap: (_) => de_SparseStructMap(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -4655,10 +4633,9 @@ const de_JsonMapsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4677,27 +4654,16 @@ export const de_JsonTimestampsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.dateTime != null) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.dateTime)); - } - if (data.dateTimeOnTarget != null) { - contents.dateTimeOnTarget = __expectNonNull(__parseRfc3339DateTimeWithOffset(data.dateTimeOnTarget)); - } - if (data.epochSeconds != null) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSeconds))); - } - if (data.epochSecondsOnTarget != null) { - contents.epochSecondsOnTarget = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSecondsOnTarget))); - } - if (data.httpDate != null) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data.httpDate)); - } - if (data.httpDateOnTarget != null) { - contents.httpDateOnTarget = __expectNonNull(__parseRfc7231DateTime(data.httpDateOnTarget)); - } - if (data.normal != null) { - contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); - } + const doc = take(data, { + dateTime: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + dateTimeOnTarget: (_) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + epochSeconds: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + epochSecondsOnTarget: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + httpDate: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + httpDateOnTarget: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + normal: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + }); + Object.assign(contents, doc); return contents; }; @@ -4714,10 +4680,9 @@ const de_JsonTimestampsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4736,9 +4701,10 @@ export const de_JsonUnionsCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.contents != null) { - contents.contents = de_MyUnion(__expectUnion(data.contents), context); - } + const doc = take(data, { + contents: (_) => de_MyUnion(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -4755,10 +4721,9 @@ const de_JsonUnionsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4777,9 +4742,10 @@ export const de_MalformedAcceptWithBodyCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.hi != null) { - contents.hi = __expectString(data.hi); - } + const doc = take(data, { + hi: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -4796,10 +4762,9 @@ const de_MalformedAcceptWithBodyCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4835,10 +4800,9 @@ const de_MalformedAcceptWithGenericStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4874,10 +4838,9 @@ const de_MalformedAcceptWithPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4912,10 +4875,9 @@ const de_MalformedBlobCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4950,10 +4912,9 @@ const de_MalformedBooleanCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4988,10 +4949,9 @@ const de_MalformedByteCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5026,10 +4986,9 @@ const de_MalformedContentTypeWithBodyCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5064,10 +5023,9 @@ const de_MalformedContentTypeWithGenericStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5102,10 +5060,9 @@ const de_MalformedContentTypeWithoutBodyCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5140,10 +5097,9 @@ const de_MalformedContentTypeWithPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5178,10 +5134,9 @@ const de_MalformedDoubleCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5216,10 +5171,9 @@ const de_MalformedFloatCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5254,10 +5208,9 @@ const de_MalformedIntegerCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5292,10 +5245,9 @@ const de_MalformedListCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5330,10 +5282,9 @@ const de_MalformedLongCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5368,10 +5319,9 @@ const de_MalformedMapCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5406,10 +5356,9 @@ const de_MalformedRequestBodyCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5444,10 +5393,9 @@ const de_MalformedShortCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5482,10 +5430,9 @@ const de_MalformedStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5520,10 +5467,9 @@ const de_MalformedTimestampBodyDateTimeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5558,10 +5504,9 @@ const de_MalformedTimestampBodyDefaultCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5596,10 +5541,9 @@ const de_MalformedTimestampBodyHttpDateCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5634,10 +5578,9 @@ const de_MalformedTimestampHeaderDateTimeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5672,10 +5615,9 @@ const de_MalformedTimestampHeaderDefaultCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5710,10 +5652,9 @@ const de_MalformedTimestampHeaderEpochCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5748,10 +5689,9 @@ const de_MalformedTimestampPathDefaultCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5786,10 +5726,9 @@ const de_MalformedTimestampPathEpochCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5824,10 +5763,9 @@ const de_MalformedTimestampPathHttpDateCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5862,10 +5800,9 @@ const de_MalformedTimestampQueryDefaultCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5900,10 +5837,9 @@ const de_MalformedTimestampQueryEpochCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5938,10 +5874,9 @@ const de_MalformedTimestampQueryHttpDateCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5976,10 +5911,9 @@ const de_MalformedUnionCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6018,10 +5952,9 @@ const de_MediaTypeHeaderCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6056,10 +5989,9 @@ const de_NoInputAndNoOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6094,10 +6026,9 @@ const de_NoInputAndOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6138,10 +6069,9 @@ const de_NullAndEmptyHeadersClientCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6182,10 +6112,9 @@ const de_NullAndEmptyHeadersServerCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6220,10 +6149,9 @@ const de_OmitsNullSerializesEmptyStringCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6258,10 +6186,9 @@ const de_OmitsSerializingEmptyListsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6280,9 +6207,10 @@ export const de_PostPlayerActionCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.action != null) { - contents.action = de_PlayerAction(__expectUnion(data.action), context); - } + const doc = take(data, { + action: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -6299,10 +6227,9 @@ const de_PostPlayerActionCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6321,9 +6248,10 @@ export const de_PostUnionWithJsonNameCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.value != null) { - contents.value = de_UnionWithJsonName(__expectUnion(data.value), context); - } + const doc = take(data, { + value: (_) => de_UnionWithJsonName(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -6340,10 +6268,9 @@ const de_PostUnionWithJsonNameCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6378,10 +6305,9 @@ const de_QueryIdempotencyTokenAutoFillCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6416,10 +6342,9 @@ const de_QueryParamsAsStringListMapCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6454,10 +6379,9 @@ const de_QueryPrecedenceCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6476,9 +6400,10 @@ export const de_RecursiveShapesCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.nested != null) { - contents.nested = de_RecursiveShapesInputOutputNested1(data.nested, context); - } + const doc = take(data, { + nested: (_) => de_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -6495,10 +6420,9 @@ const de_RecursiveShapesCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6518,33 +6442,18 @@ export const de_SimpleScalarPropertiesCommand = async ( foo: [, output.headers["x-foo"]], }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byteValue != null) { - contents.byteValue = __expectByte(data.byteValue); - } - if (data.DoubleDribble != null) { - contents.doubleValue = __limitedParseDouble(data.DoubleDribble); - } - if (data.falseBooleanValue != null) { - contents.falseBooleanValue = __expectBoolean(data.falseBooleanValue); - } - if (data.floatValue != null) { - contents.floatValue = __limitedParseFloat32(data.floatValue); - } - if (data.integerValue != null) { - contents.integerValue = __expectInt32(data.integerValue); - } - if (data.longValue != null) { - contents.longValue = __expectLong(data.longValue); - } - if (data.shortValue != null) { - contents.shortValue = __expectShort(data.shortValue); - } - if (data.stringValue != null) { - contents.stringValue = __expectString(data.stringValue); - } - if (data.trueBooleanValue != null) { - contents.trueBooleanValue = __expectBoolean(data.trueBooleanValue); - } + const doc = take(data, { + byteValue: __expectByte, + doubleValue: [, __limitedParseDouble, `DoubleDribble`], + falseBooleanValue: __expectBoolean, + floatValue: __limitedParseFloat32, + integerValue: __expectInt32, + longValue: __expectLong, + shortValue: __expectShort, + stringValue: __expectString, + trueBooleanValue: __expectBoolean, + }); + Object.assign(contents, doc); return contents; }; @@ -6561,10 +6470,9 @@ const de_SimpleScalarPropertiesCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6602,10 +6510,9 @@ const de_StreamingTraitsCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6640,10 +6547,9 @@ const de_StreamingTraitsRequireLengthCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6681,10 +6587,9 @@ const de_StreamingTraitsWithMediaTypeCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6704,9 +6609,10 @@ export const de_TestBodyStructureCommand = async ( testId: [, output.headers["x-amz-test-id"]], }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.testConfig != null) { - contents.testConfig = de_TestConfig(data.testConfig, context); - } + const doc = take(data, { + testConfig: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -6723,10 +6629,9 @@ const de_TestBodyStructureCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6762,10 +6667,9 @@ const de_TestNoPayloadCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6802,10 +6706,9 @@ const de_TestPayloadBlobCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6825,7 +6728,7 @@ export const de_TestPayloadStructureCommand = async ( testId: [, output.headers["x-amz-test-id"]], }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.payloadConfig = de_PayloadConfig(data, context); + contents.payloadConfig = _json(data) /* DEBUG_REMOVE serde elision of output */; return contents; }; @@ -6842,10 +6745,9 @@ const de_TestPayloadStructureCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6908,10 +6810,9 @@ const de_TimestampFormatHeadersCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; @@ -6946,15 +6847,14 @@ const de_UnitInputAndOutputCommandError = async ( }; const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody, - exceptionCtor: __BaseException, errorCode, }); }; -const map = __map; +const throwDefaultError = withBaseException(__BaseException); /** * deserializeAws_restJson1ComplexErrorRes */ @@ -6963,12 +6863,11 @@ const de_ComplexErrorRes = async (parsedOutput: any, context: __SerdeContext): P Header: [, parsedOutput.headers["x-header"]], }); const data: any = parsedOutput.body; - if (data.Nested != null) { - contents.Nested = de_ComplexNestedErrorData(data.Nested, context); - } - if (data.TopLevel != null) { - contents.TopLevel = __expectString(data.TopLevel); - } + const doc = take(data, { + Nested: (_) => de_ComplexNestedErrorData(_ /* DEBUG_REMOVE no elision */, context), + TopLevel: __expectString, + }); + Object.assign(contents, doc); const exception = new ComplexError({ $metadata: deserializeMetadata(parsedOutput), ...contents, @@ -6982,6 +6881,8 @@ const de_ComplexErrorRes = async (parsedOutput: any, context: __SerdeContext): P const de_FooErrorRes = async (parsedOutput: any, context: __SerdeContext): Promise => { const contents: any = map({}); const data: any = parsedOutput.body; + const doc = take(data, {}); + Object.assign(contents, doc); const exception = new FooError({ $metadata: deserializeMetadata(parsedOutput), ...contents, @@ -6995,9 +6896,10 @@ const de_FooErrorRes = async (parsedOutput: any, context: __SerdeContext): Promi const de_InvalidGreetingRes = async (parsedOutput: any, context: __SerdeContext): Promise => { const contents: any = map({}); const data: any = parsedOutput.body; - if (data.Message != null) { - contents.Message = __expectString(data.Message); - } + const doc = take(data, { + Message: __expectString, + }); + Object.assign(contents, doc); const exception = new InvalidGreeting({ $metadata: deserializeMetadata(parsedOutput), ...contents, @@ -7039,7 +6941,7 @@ const se_DenseSetMap = (input: Record, context: __SerdeContext if (value === null) { return acc; } - acc[key] = se_StringSet(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7065,7 +6967,7 @@ const se_DenseStructMap = (input: Record, context: __Ser if (value === null) { return acc; } - acc[key] = se_GreetingStruct(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7085,12 +6987,12 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), booleanValue: (value) => ({ booleanValue: value }), enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: se_StringList(value, context) }), - mapValue: (value) => ({ mapValue: se_StringMap(value, context) }), + listValue: (value) => ({ listValue: _json(value) /* DEBUG_REMOVE yes elision */ }), + mapValue: (value) => ({ mapValue: _json(value) /* DEBUG_REMOVE yes elision */ }), numberValue: (value) => ({ numberValue: value }), - renamedStructureValue: (value) => ({ renamedStructureValue: se_RenamedGreeting(value, context) }), + renamedStructureValue: (value) => ({ renamedStructureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: se_GreetingStruct(value, context) }), + structureValue: (value) => ({ structureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), _: (name, value) => ({ name: value } as any), }); @@ -7100,19 +7002,19 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { * serializeAws_restJson1NestedPayload */ const se_NestedPayload = (input: NestedPayload, context: __SerdeContext): any => { - return { - ...(input.greeting != null && { greeting: input.greeting }), - ...(input.name != null && { name: input.name }), - }; + return take(input, { + greeting: [], + name: [], + }); }; /** * serializeAws_restJson1PayloadConfig */ const se_PayloadConfig = (input: PayloadConfig, context: __SerdeContext): any => { - return { - ...(input.data != null && { data: input.data }), - }; + return take(input, { + data: [], + }); }; /** @@ -7120,7 +7022,7 @@ const se_PayloadConfig = (input: PayloadConfig, context: __SerdeContext): any => */ const se_PlayerAction = (input: PlayerAction, context: __SerdeContext): any => { return PlayerAction.visit(input, { - quit: (value) => ({ quit: se_Unit(value, context) }), + quit: (value) => ({ quit: _json(value) /* DEBUG_REMOVE yes elision */ }), _: (name, value) => ({ name: value } as any), }); }; @@ -7132,10 +7034,10 @@ const se_RecursiveShapesInputOutputNested1 = ( input: RecursiveShapesInputOutputNested1, context: __SerdeContext ): any => { - return { - ...(input.foo != null && { foo: input.foo }), - ...(input.nested != null && { nested: se_RecursiveShapesInputOutputNested2(input.nested, context) }), - }; + return take(input, { + foo: [], + nested: (_) => se_RecursiveShapesInputOutputNested2(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** @@ -7145,23 +7047,17 @@ const se_RecursiveShapesInputOutputNested2 = ( input: RecursiveShapesInputOutputNested2, context: __SerdeContext ): any => { - return { - ...(input.bar != null && { bar: input.bar }), - ...(input.recursiveMember != null && { - recursiveMember: se_RecursiveShapesInputOutputNested1(input.recursiveMember, context), - }), - }; + return take(input, { + bar: [], + recursiveMember: (_) => se_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** * serializeAws_restJson1SimpleList */ const se_SimpleList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7225,7 +7121,7 @@ const se_SparseSetMap = (input: Record, context: __SerdeContex acc[key] = null as any; return acc; } - acc[key] = se_StringSet(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7239,7 +7135,7 @@ const se_SparseStructMap = (input: Record, context: __Se acc[key] = null as any; return acc; } - acc[key] = se_GreetingStruct(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7251,7 +7147,7 @@ const se_StructureList = (input: StructureListMember[], context: __SerdeContext) return input .filter((e: any) => e != null) .map((entry) => { - return se_StructureListMember(entry, context); + return se_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -7259,19 +7155,19 @@ const se_StructureList = (input: StructureListMember[], context: __SerdeContext) * serializeAws_restJson1StructureListMember */ const se_StructureListMember = (input: StructureListMember, context: __SerdeContext): any => { - return { - ...(input.a != null && { value: input.a }), - ...(input.b != null && { other: input.b }), - }; + return take(input, { + value: [, , `a`], + other: [, , `b`], + }); }; /** * serializeAws_restJson1TestConfig */ const se_TestConfig = (input: TestConfig, context: __SerdeContext): any => { - return { - ...(input.timeout != null && { timeout: input.timeout }), - }; + return take(input, { + timeout: [], + }); }; /** @@ -7290,31 +7186,23 @@ const se_UnionWithJsonName = (input: UnionWithJsonName, context: __SerdeContext) * serializeAws_restJson1RenamedGreeting */ const se_RenamedGreeting = (input: RenamedGreeting, context: __SerdeContext): any => { - return { - ...(input.salutation != null && { salutation: input.salutation }), - }; + return take(input, { + salutation: [], + }); }; /** * serializeAws_restJson1BooleanList */ const se_BooleanList = (input: boolean[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1FooEnumList */ const se_FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7334,31 +7222,23 @@ const se_FooEnumMap = (input: Record, context: __Serde * serializeAws_restJson1FooEnumSet */ const se_FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1GreetingStruct */ const se_GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi != null && { hi: input.hi }), - }; + return take(input, { + hi: [], + }); }; /** * serializeAws_restJson1IntegerEnumList */ const se_IntegerEnumList = (input: (IntegerEnum | number)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7378,22 +7258,14 @@ const se_IntegerEnumMap = (input: Record, context: * serializeAws_restJson1IntegerEnumSet */ const se_IntegerEnumSet = (input: (IntegerEnum | number)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1IntegerList */ const se_IntegerList = (input: number[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7403,7 +7275,7 @@ const se_NestedStringList = (input: string[][], context: __SerdeContext): any => return input .filter((e: any) => e != null) .map((entry) => { - return se_StringList(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -7411,12 +7283,7 @@ const se_NestedStringList = (input: string[][], context: __SerdeContext): any => * serializeAws_restJson1SparseStringList */ const se_SparseStringList = (input: string[], context: __SerdeContext): any => { - return input.map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); + return input; }; /** @@ -7437,11 +7304,7 @@ const se_SparseStringMap = (input: Record, context: __SerdeConte * serializeAws_restJson1StringList */ const se_StringList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7461,11 +7324,7 @@ const se_StringMap = (input: Record, context: __SerdeContext): a * serializeAws_restJson1StringSet */ const se_StringSet = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7483,16 +7342,16 @@ const se_TimestampList = (input: Date[], context: __SerdeContext): any => { * serializeAws_restJson1Unit */ const se_Unit = (input: Unit, context: __SerdeContext): any => { - return {}; + return take(input, {}); }; /** * deserializeAws_restJson1ComplexNestedErrorData */ const de_ComplexNestedErrorData = (output: any, context: __SerdeContext): ComplexNestedErrorData => { - return { - Foo: __expectString(output.Fooooo), - } as any; + return take(output, { + Foo: [, __expectString, `Fooooo`], + }) as any; }; /** @@ -7529,7 +7388,7 @@ const de_DenseSetMap = (output: any, context: __SerdeContext): Record { } if (output.listValue != null) { return { - listValue: de_StringList(output.listValue, context), + listValue: _json(output.listValue) /* DEBUG_REMOVE yes elision */, }; } if (output.mapValue != null) { return { - mapValue: de_StringMap(output.mapValue, context), + mapValue: _json(output.mapValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectInt32(output.numberValue) !== undefined) { @@ -7597,7 +7456,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.renamedStructureValue != null) { return { - renamedStructureValue: de_RenamedGreeting(output.renamedStructureValue, context), + renamedStructureValue: _json(output.renamedStructureValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectString(output.stringValue) !== undefined) { @@ -7605,7 +7464,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.structureValue != null) { return { - structureValue: de_GreetingStruct(output.structureValue, context), + structureValue: _json(output.structureValue) /* DEBUG_REMOVE yes elision */, }; } if (output.timestampValue != null) { @@ -7620,19 +7479,19 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { * deserializeAws_restJson1NestedPayload */ const de_NestedPayload = (output: any, context: __SerdeContext): NestedPayload => { - return { - greeting: __expectString(output.greeting), - name: __expectString(output.name), - } as any; + return take(output, { + greeting: __expectString, + name: __expectString, + }) as any; }; /** * deserializeAws_restJson1PayloadConfig */ const de_PayloadConfig = (output: any, context: __SerdeContext): PayloadConfig => { - return { - data: __expectInt32(output.data), - } as any; + return take(output, { + data: __expectInt32, + }) as any; }; /** @@ -7641,7 +7500,7 @@ const de_PayloadConfig = (output: any, context: __SerdeContext): PayloadConfig = const de_PlayerAction = (output: any, context: __SerdeContext): PlayerAction => { if (output.quit != null) { return { - quit: de_Unit(output.quit, context), + quit: _json(output.quit) /* DEBUG_REMOVE yes elision */, }; } return { $unknown: Object.entries(output)[0] }; @@ -7654,10 +7513,10 @@ const de_RecursiveShapesInputOutputNested1 = ( output: any, context: __SerdeContext ): RecursiveShapesInputOutputNested1 => { - return { - foo: __expectString(output.foo), - nested: output.nested != null ? de_RecursiveShapesInputOutputNested2(output.nested, context) : undefined, - } as any; + return take(output, { + foo: __expectString, + nested: (_) => de_RecursiveShapesInputOutputNested2(_ /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -7667,13 +7526,10 @@ const de_RecursiveShapesInputOutputNested2 = ( output: any, context: __SerdeContext ): RecursiveShapesInputOutputNested2 => { - return { - bar: __expectString(output.bar), - recursiveMember: - output.recursiveMember != null - ? de_RecursiveShapesInputOutputNested1(output.recursiveMember, context) - : undefined, - } as any; + return take(output, { + bar: __expectString, + recursiveMember: (_) => de_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -7713,7 +7569,7 @@ const de_SparseSetMap = (output: any, context: __SerdeContext): Record e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_StructureListMember(entry, context); + return de_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); return retVal; }; @@ -7751,19 +7604,19 @@ const de_StructureList = (output: any, context: __SerdeContext): StructureListMe * deserializeAws_restJson1StructureListMember */ const de_StructureListMember = (output: any, context: __SerdeContext): StructureListMember => { - return { - a: __expectString(output.value), - b: __expectString(output.other), - } as any; + return take(output, { + a: [, __expectString, `value`], + b: [, __expectString, `other`], + }) as any; }; /** * deserializeAws_restJson1TestConfig */ const de_TestConfig = (output: any, context: __SerdeContext): TestConfig => { - return { - timeout: __expectInt32(output.timeout), - } as any; + return take(output, { + timeout: __expectInt32, + }) as any; }; /** @@ -7786,9 +7639,9 @@ const de_UnionWithJsonName = (output: any, context: __SerdeContext): UnionWithJs * deserializeAws_restJson1RenamedGreeting */ const de_RenamedGreeting = (output: any, context: __SerdeContext): RenamedGreeting => { - return { - salutation: __expectString(output.salutation), - } as any; + return take(output, { + salutation: __expectString, + }) as any; }; /** @@ -7798,9 +7651,6 @@ const de_BooleanList = (output: any, context: __SerdeContext): boolean[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectBoolean(entry) as any; }); return retVal; @@ -7813,9 +7663,6 @@ const de_FooEnumList = (output: any, context: __SerdeContext): (FooEnum | string const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -7841,9 +7688,6 @@ const de_FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string) const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -7853,9 +7697,9 @@ const de_FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string) * deserializeAws_restJson1GreetingStruct */ const de_GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; + return take(output, { + hi: __expectString, + }) as any; }; /** @@ -7865,9 +7709,6 @@ const de_IntegerEnumList = (output: any, context: __SerdeContext): (IntegerEnum const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectInt32(entry) as any; }); return retVal; @@ -7893,9 +7734,6 @@ const de_IntegerEnumSet = (output: any, context: __SerdeContext): (IntegerEnum | const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectInt32(entry) as any; }); return retVal; @@ -7908,9 +7746,6 @@ const de_IntegerList = (output: any, context: __SerdeContext): number[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectInt32(entry) as any; }); return retVal; @@ -7923,10 +7758,7 @@ const de_NestedStringList = (output: any, context: __SerdeContext): string[][] = const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } - return de_StringList(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -7965,9 +7797,6 @@ const de_StringList = (output: any, context: __SerdeContext): string[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -7993,9 +7822,6 @@ const de_StringSet = (output: any, context: __SerdeContext): string[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectString(entry) as any; }); return retVal; @@ -8008,9 +7834,6 @@ const de_TimestampList = (output: any, context: __SerdeContext): Date[] => { const retVal = (output || []) .filter((e: any) => e != null) .map((entry: any) => { - if (entry === null) { - return null as any; - } return __expectNonNull(__parseEpochTimestamp(__expectNumber(entry))); }); return retVal; @@ -8020,7 +7843,7 @@ const de_TimestampList = (output: any, context: __SerdeContext): Date[] => { * deserializeAws_restJson1Unit */ const de_Unit = (output: any, context: __SerdeContext): Unit => { - return {} as any; + return take(output, {}) as any; }; const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ diff --git a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts index baa2d3c4099d8..8d049712e491b 100644 --- a/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts +++ b/private/aws-protocoltests-restxml/src/protocols/Aws_restXml.ts @@ -15,7 +15,7 @@ import { extendedEncodeURIComponent as __extendedEncodeURIComponent, getArrayIfSingleItem as __getArrayIfSingleItem, getValueFromTextNode as __getValueFromTextNode, - map as __map, + map, parseBoolean as __parseBoolean, parseEpochTimestamp as __parseEpochTimestamp, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, @@ -28,7 +28,7 @@ import { strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, strictParseShort as __strictParseShort, - throwDefaultError, + withBaseException, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -298,7 +298,7 @@ export const se_BodyWithXmlNameCommand = async ( body = ''; const bodyNode = new __XmlNode("Ahoy"); if (input.nested !== undefined) { - const node = se_PayloadWithXmlName(input.nested, context).withName("nested"); + const node = se_PayloadWithXmlName(input.nested /* DEBUG_REMOVE no elision */, context).withName("nested"); bodyNode.addChildNode(node); } body += bodyNode.toString(); @@ -549,7 +549,7 @@ export const se_FlattenedXmlMapCommand = async ( body = ''; const bodyNode = new __XmlNode("FlattenedXmlMapInputOutput"); if (input.myMap !== undefined) { - const nodes = se_FooEnumMap(input.myMap, context); + const nodes = se_FooEnumMap(input.myMap /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("myMap"); bodyNode.addChildNode(node); @@ -584,7 +584,7 @@ export const se_FlattenedXmlMapWithXmlNameCommand = async ( body = ''; const bodyNode = new __XmlNode("FlattenedXmlMapWithXmlNameInputOutput"); if (input.myMap !== undefined) { - const nodes = se_FlattenedXmlMapWithXmlNameInputOutputMap(input.myMap, context); + const nodes = se_FlattenedXmlMapWithXmlNameInputOutputMap(input.myMap /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("KVP"); bodyNode.addChildNode(node); @@ -760,11 +760,11 @@ export const se_HttpPayloadWithMemberXmlNameCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithMemberXmlName"; let body: any; if (input.nested !== undefined) { - body = se_PayloadWithXmlName(input.nested, context); + body = se_PayloadWithXmlName(input.nested /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.nested !== undefined) { - contents = se_PayloadWithXmlName(input.nested, context); + contents = se_PayloadWithXmlName(input.nested /* DEBUG_REMOVE no elision */, context); contents = contents.withName("Hola"); body = ''; body += contents.toString(); @@ -795,11 +795,11 @@ export const se_HttpPayloadWithStructureCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithStructure"; let body: any; if (input.nested !== undefined) { - body = se_NestedPayload(input.nested, context); + body = se_NestedPayload(input.nested /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.nested !== undefined) { - contents = se_NestedPayload(input.nested, context); + contents = se_NestedPayload(input.nested /* DEBUG_REMOVE no elision */, context); body = ''; body += contents.toString(); } @@ -829,11 +829,11 @@ export const se_HttpPayloadWithXmlNameCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlName"; let body: any; if (input.nested !== undefined) { - body = se_PayloadWithXmlName(input.nested, context); + body = se_PayloadWithXmlName(input.nested /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.nested !== undefined) { - contents = se_PayloadWithXmlName(input.nested, context); + contents = se_PayloadWithXmlName(input.nested /* DEBUG_REMOVE no elision */, context); body = ''; body += contents.toString(); } @@ -863,11 +863,11 @@ export const se_HttpPayloadWithXmlNamespaceCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespace"; let body: any; if (input.nested !== undefined) { - body = se_PayloadWithXmlNamespace(input.nested, context); + body = se_PayloadWithXmlNamespace(input.nested /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.nested !== undefined) { - contents = se_PayloadWithXmlNamespace(input.nested, context); + contents = se_PayloadWithXmlNamespace(input.nested /* DEBUG_REMOVE no elision */, context); body = ''; contents.addAttribute("xmlns", "http://foo.com"); body += contents.toString(); @@ -898,11 +898,11 @@ export const se_HttpPayloadWithXmlNamespaceAndPrefixCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/HttpPayloadWithXmlNamespaceAndPrefix"; let body: any; if (input.nested !== undefined) { - body = se_PayloadWithXmlNamespaceAndPrefix(input.nested, context); + body = se_PayloadWithXmlNamespaceAndPrefix(input.nested /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.nested !== undefined) { - contents = se_PayloadWithXmlNamespaceAndPrefix(input.nested, context); + contents = se_PayloadWithXmlNamespaceAndPrefix(input.nested /* DEBUG_REMOVE no elision */, context); body = ''; contents.addAttribute("xmlns:baz", "http://foo.com"); body += contents.toString(); @@ -1276,14 +1276,14 @@ export const se_NestedXmlMapsCommand = async ( body = ''; const bodyNode = new __XmlNode("NestedXmlMapsInputOutput"); if (input.flatNestedMap !== undefined) { - const nodes = se_NestedMap(input.flatNestedMap, context); + const nodes = se_NestedMap(input.flatNestedMap /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flatNestedMap"); bodyNode.addChildNode(node); }); } if (input.nestedMap !== undefined) { - const nodes = se_NestedMap(input.nestedMap, context); + const nodes = se_NestedMap(input.nestedMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("nestedMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1532,7 +1532,9 @@ export const se_RecursiveShapesCommand = async ( body = ''; const bodyNode = new __XmlNode("RecursiveShapesInputOutput"); if (input.nested !== undefined) { - const node = se_RecursiveShapesInputOutputNested1(input.nested, context).withName("nested"); + const node = se_RecursiveShapesInputOutputNested1(input.nested /* DEBUG_REMOVE no elision */, context).withName( + "nested" + ); bodyNode.addChildNode(node); } body += bodyNode.toString(); @@ -1713,11 +1715,11 @@ export const se_XmlAttributesOnPayloadCommand = async ( `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/XmlAttributesOnPayload"; let body: any; if (input.payload !== undefined) { - body = se_XmlAttributesInputOutput(input.payload, context); + body = se_XmlAttributesInputOutput(input.payload /* DEBUG_REMOVE no elision */, context); } let contents: any; if (input.payload !== undefined) { - contents = se_XmlAttributesInputOutput(input.payload, context); + contents = se_XmlAttributesInputOutput(input.payload /* DEBUG_REMOVE no elision */, context); body = ''; body += contents.toString(); } @@ -1810,7 +1812,7 @@ export const se_XmlEmptyListsCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlListsInputOutput"); if (input.booleanList !== undefined) { - const nodes = se_BooleanList(input.booleanList, context); + const nodes = se_BooleanList(input.booleanList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("booleanList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1818,7 +1820,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.enumList !== undefined) { - const nodes = se_FooEnumList(input.enumList, context); + const nodes = se_FooEnumList(input.enumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("enumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1826,42 +1828,45 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.flattenedList !== undefined) { - const nodes = se_RenamedListMembers(input.flattenedList, context); + const nodes = se_RenamedListMembers(input.flattenedList /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedList"); bodyNode.addChildNode(node); }); } if (input.flattenedList2 !== undefined) { - const nodes = se_RenamedListMembers(input.flattenedList2, context); + const nodes = se_RenamedListMembers(input.flattenedList2 /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("customName"); bodyNode.addChildNode(node); }); } if (input.flattenedListWithMemberNamespace !== undefined) { - const nodes = se_ListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); + const nodes = se_ListWithMemberNamespace( + input.flattenedListWithMemberNamespace /* DEBUG_REMOVE no elision */, + context + ); nodes.map((node: any) => { node = node.withName("flattenedListWithMemberNamespace"); bodyNode.addChildNode(node); }); } if (input.flattenedListWithNamespace !== undefined) { - const nodes = se_ListWithNamespace(input.flattenedListWithNamespace, context); + const nodes = se_ListWithNamespace(input.flattenedListWithNamespace /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedListWithNamespace"); bodyNode.addChildNode(node); }); } if (input.flattenedStructureList !== undefined) { - const nodes = se_StructureList(input.flattenedStructureList, context); + const nodes = se_StructureList(input.flattenedStructureList /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedStructureList"); bodyNode.addChildNode(node); }); } if (input.intEnumList !== undefined) { - const nodes = se_IntegerEnumList(input.intEnumList, context); + const nodes = se_IntegerEnumList(input.intEnumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("intEnumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1869,7 +1874,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.integerList !== undefined) { - const nodes = se_IntegerList(input.integerList, context); + const nodes = se_IntegerList(input.integerList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("integerList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1877,7 +1882,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.nestedStringList !== undefined) { - const nodes = se_NestedStringList(input.nestedStringList, context); + const nodes = se_NestedStringList(input.nestedStringList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("nestedStringList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1885,7 +1890,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.renamedListMembers !== undefined) { - const nodes = se_RenamedListMembers(input.renamedListMembers, context); + const nodes = se_RenamedListMembers(input.renamedListMembers /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("renamed"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1893,7 +1898,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.stringList !== undefined) { - const nodes = se_StringList(input.stringList, context); + const nodes = se_StringList(input.stringList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("stringList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1901,7 +1906,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.stringSet !== undefined) { - const nodes = se_StringSet(input.stringSet, context); + const nodes = se_StringSet(input.stringSet /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("stringSet"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1909,7 +1914,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.structureList !== undefined) { - const nodes = se_StructureList(input.structureList, context); + const nodes = se_StructureList(input.structureList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("myStructureList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1917,7 +1922,7 @@ export const se_XmlEmptyListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.timestampList !== undefined) { - const nodes = se_TimestampList(input.timestampList, context); + const nodes = se_TimestampList(input.timestampList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("timestampList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -1952,7 +1957,7 @@ export const se_XmlEmptyMapsCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlMapsInputOutput"); if (input.myMap !== undefined) { - const nodes = se_XmlMapsInputOutputMap(input.myMap, context); + const nodes = se_XmlMapsInputOutputMap(input.myMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("myMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2030,7 +2035,7 @@ export const se_XmlEnumsCommand = async ( bodyNode.addChildNode(node); } if (input.fooEnumList !== undefined) { - const nodes = se_FooEnumList(input.fooEnumList, context); + const nodes = se_FooEnumList(input.fooEnumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("fooEnumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2038,7 +2043,7 @@ export const se_XmlEnumsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.fooEnumMap !== undefined) { - const nodes = se_FooEnumMap(input.fooEnumMap, context); + const nodes = se_FooEnumMap(input.fooEnumMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("fooEnumMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2046,7 +2051,7 @@ export const se_XmlEnumsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.fooEnumSet !== undefined) { - const nodes = se_FooEnumSet(input.fooEnumSet, context); + const nodes = se_FooEnumSet(input.fooEnumSet /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("fooEnumSet"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2093,7 +2098,7 @@ export const se_XmlIntEnumsCommand = async ( bodyNode.addChildNode(node); } if (input.intEnumList !== undefined) { - const nodes = se_IntegerEnumList(input.intEnumList, context); + const nodes = se_IntegerEnumList(input.intEnumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("intEnumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2101,7 +2106,7 @@ export const se_XmlIntEnumsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.intEnumMap !== undefined) { - const nodes = se_IntegerEnumMap(input.intEnumMap, context); + const nodes = se_IntegerEnumMap(input.intEnumMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("intEnumMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2109,7 +2114,7 @@ export const se_XmlIntEnumsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.intEnumSet !== undefined) { - const nodes = se_IntegerEnumSet(input.intEnumSet, context); + const nodes = se_IntegerEnumSet(input.intEnumSet /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("intEnumSet"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2144,7 +2149,7 @@ export const se_XmlListsCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlListsInputOutput"); if (input.booleanList !== undefined) { - const nodes = se_BooleanList(input.booleanList, context); + const nodes = se_BooleanList(input.booleanList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("booleanList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2152,7 +2157,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.enumList !== undefined) { - const nodes = se_FooEnumList(input.enumList, context); + const nodes = se_FooEnumList(input.enumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("enumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2160,42 +2165,45 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.flattenedList !== undefined) { - const nodes = se_RenamedListMembers(input.flattenedList, context); + const nodes = se_RenamedListMembers(input.flattenedList /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedList"); bodyNode.addChildNode(node); }); } if (input.flattenedList2 !== undefined) { - const nodes = se_RenamedListMembers(input.flattenedList2, context); + const nodes = se_RenamedListMembers(input.flattenedList2 /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("customName"); bodyNode.addChildNode(node); }); } if (input.flattenedListWithMemberNamespace !== undefined) { - const nodes = se_ListWithMemberNamespace(input.flattenedListWithMemberNamespace, context); + const nodes = se_ListWithMemberNamespace( + input.flattenedListWithMemberNamespace /* DEBUG_REMOVE no elision */, + context + ); nodes.map((node: any) => { node = node.withName("flattenedListWithMemberNamespace"); bodyNode.addChildNode(node); }); } if (input.flattenedListWithNamespace !== undefined) { - const nodes = se_ListWithNamespace(input.flattenedListWithNamespace, context); + const nodes = se_ListWithNamespace(input.flattenedListWithNamespace /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedListWithNamespace"); bodyNode.addChildNode(node); }); } if (input.flattenedStructureList !== undefined) { - const nodes = se_StructureList(input.flattenedStructureList, context); + const nodes = se_StructureList(input.flattenedStructureList /* DEBUG_REMOVE no elision */, context); nodes.map((node: any) => { node = node.withName("flattenedStructureList"); bodyNode.addChildNode(node); }); } if (input.intEnumList !== undefined) { - const nodes = se_IntegerEnumList(input.intEnumList, context); + const nodes = se_IntegerEnumList(input.intEnumList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("intEnumList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2203,7 +2211,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.integerList !== undefined) { - const nodes = se_IntegerList(input.integerList, context); + const nodes = se_IntegerList(input.integerList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("integerList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2211,7 +2219,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.nestedStringList !== undefined) { - const nodes = se_NestedStringList(input.nestedStringList, context); + const nodes = se_NestedStringList(input.nestedStringList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("nestedStringList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2219,7 +2227,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.renamedListMembers !== undefined) { - const nodes = se_RenamedListMembers(input.renamedListMembers, context); + const nodes = se_RenamedListMembers(input.renamedListMembers /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("renamed"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2227,7 +2235,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.stringList !== undefined) { - const nodes = se_StringList(input.stringList, context); + const nodes = se_StringList(input.stringList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("stringList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2235,7 +2243,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.stringSet !== undefined) { - const nodes = se_StringSet(input.stringSet, context); + const nodes = se_StringSet(input.stringSet /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("stringSet"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2243,7 +2251,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.structureList !== undefined) { - const nodes = se_StructureList(input.structureList, context); + const nodes = se_StructureList(input.structureList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("myStructureList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2251,7 +2259,7 @@ export const se_XmlListsCommand = async ( bodyNode.addChildNode(containerNode); } if (input.timestampList !== undefined) { - const nodes = se_TimestampList(input.timestampList, context); + const nodes = se_TimestampList(input.timestampList /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("timestampList"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2286,7 +2294,7 @@ export const se_XmlMapsCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlMapsInputOutput"); if (input.myMap !== undefined) { - const nodes = se_XmlMapsInputOutputMap(input.myMap, context); + const nodes = se_XmlMapsInputOutputMap(input.myMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("myMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2321,7 +2329,7 @@ export const se_XmlMapsXmlNameCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlMapsXmlNameInputOutput"); if (input.myMap !== undefined) { - const nodes = se_XmlMapsXmlNameInputOutputMap(input.myMap, context); + const nodes = se_XmlMapsXmlNameInputOutputMap(input.myMap /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("myMap"); nodes.map((node: any) => { containerNode.addChildNode(node); @@ -2357,7 +2365,7 @@ export const se_XmlNamespacesCommand = async ( const bodyNode = new __XmlNode("XmlNamespacesInputOutput"); bodyNode.addAttribute("xmlns", "http://foo.com"); if (input.nested !== undefined) { - const node = se_XmlNamespaceNested(input.nested, context).withName("nested"); + const node = se_XmlNamespaceNested(input.nested /* DEBUG_REMOVE no elision */, context).withName("nested"); bodyNode.addChildNode(node); } body += bodyNode.toString(); @@ -2453,7 +2461,7 @@ export const se_XmlUnionsCommand = async ( body = ''; const bodyNode = new __XmlNode("XmlUnionsInputOutput"); if (input.unionValue !== undefined) { - const node = se_XmlUnionShape(input.unionValue, context).withName("unionValue"); + const node = se_XmlUnionShape(input.unionValue /* DEBUG_REMOVE no elision */, context).withName("unionValue"); bodyNode.addChildNode(node); } body += bodyNode.toString(); @@ -2498,10 +2506,9 @@ const de_AllQueryStringTypesCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2521,7 +2528,7 @@ export const de_BodyWithXmlNameCommand = async ( }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data["nested"] !== undefined) { - contents.nested = de_PayloadWithXmlName(data["nested"], context); + contents.nested = de_PayloadWithXmlName(data["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2539,10 +2546,9 @@ const de_BodyWithXmlNameCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2577,10 +2583,9 @@ const de_ConstantAndVariableQueryStringCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2615,10 +2620,9 @@ const de_ConstantQueryStringCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2656,10 +2660,9 @@ const de_DatetimeOffsetsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2694,10 +2697,9 @@ const de_EmptyInputAndEmptyOutputCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2732,10 +2734,9 @@ const de_EndpointOperationCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2770,10 +2771,9 @@ const de_EndpointWithHostLabelHeaderOperationCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2808,10 +2808,9 @@ const de_EndpointWithHostLabelOperationCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2833,7 +2832,7 @@ export const de_FlattenedXmlMapCommand = async ( if (data.myMap === "") { contents.myMap = {}; } else if (data["myMap"] !== undefined) { - contents.myMap = de_FooEnumMap(__getArrayIfSingleItem(data["myMap"]), context); + contents.myMap = de_FooEnumMap(__getArrayIfSingleItem(data["myMap"]) /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -2851,10 +2850,9 @@ const de_FlattenedXmlMapCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2876,7 +2874,10 @@ export const de_FlattenedXmlMapWithXmlNameCommand = async ( if (data.KVP === "") { contents.myMap = {}; } else if (data["KVP"] !== undefined) { - contents.myMap = de_FlattenedXmlMapWithXmlNameInputOutputMap(__getArrayIfSingleItem(data["KVP"]), context); + contents.myMap = de_FlattenedXmlMapWithXmlNameInputOutputMap( + __getArrayIfSingleItem(data["KVP"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2894,10 +2895,9 @@ const de_FlattenedXmlMapWithXmlNameCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2919,7 +2919,10 @@ export const de_FlattenedXmlMapWithXmlNamespaceCommand = async ( if (data.KVP === "") { contents.myMap = {}; } else if (data["KVP"] !== undefined) { - contents.myMap = de_FlattenedXmlMapWithXmlNamespaceOutputMap(__getArrayIfSingleItem(data["KVP"]), context); + contents.myMap = de_FlattenedXmlMapWithXmlNamespaceOutputMap( + __getArrayIfSingleItem(data["KVP"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -2937,10 +2940,9 @@ const de_FlattenedXmlMapWithXmlNamespaceCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -2981,10 +2983,9 @@ const de_FractionalSecondsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3028,10 +3029,9 @@ const de_GreetingWithErrorsCommandError = async ( throw await de_InvalidGreetingRes(parsedOutput, context); default: const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); } @@ -3069,10 +3069,9 @@ const de_HttpPayloadTraitsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3109,10 +3108,9 @@ const de_HttpPayloadTraitsWithMediaTypeCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3131,7 +3129,7 @@ export const de_HttpPayloadWithMemberXmlNameCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_PayloadWithXmlName(data, context); + contents.nested = de_PayloadWithXmlName(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -3148,10 +3146,9 @@ const de_HttpPayloadWithMemberXmlNameCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3170,7 +3167,7 @@ export const de_HttpPayloadWithStructureCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_NestedPayload(data, context); + contents.nested = de_NestedPayload(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -3187,10 +3184,9 @@ const de_HttpPayloadWithStructureCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3209,7 +3205,7 @@ export const de_HttpPayloadWithXmlNameCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_PayloadWithXmlName(data, context); + contents.nested = de_PayloadWithXmlName(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -3226,10 +3222,9 @@ const de_HttpPayloadWithXmlNameCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3248,7 +3243,7 @@ export const de_HttpPayloadWithXmlNamespaceCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_PayloadWithXmlNamespace(data, context); + contents.nested = de_PayloadWithXmlNamespace(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -3265,10 +3260,9 @@ const de_HttpPayloadWithXmlNamespaceCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3287,7 +3281,7 @@ export const de_HttpPayloadWithXmlNamespaceAndPrefixCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_PayloadWithXmlNamespaceAndPrefix(data, context); + contents.nested = de_PayloadWithXmlNamespaceAndPrefix(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -3304,10 +3298,9 @@ const de_HttpPayloadWithXmlNamespaceAndPrefixCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3352,10 +3345,9 @@ const de_HttpPrefixHeadersCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3390,10 +3382,9 @@ const de_HttpRequestWithFloatLabelsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3428,10 +3419,9 @@ const de_HttpRequestWithGreedyLabelInPathCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3466,10 +3456,9 @@ const de_HttpRequestWithLabelsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3504,10 +3493,9 @@ const de_HttpRequestWithLabelsAndTimestampFormatCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3545,10 +3533,9 @@ const de_HttpResponseCodeCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3586,10 +3573,9 @@ const de_IgnoreQueryParamsInResponseCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3668,10 +3654,9 @@ const de_InputAndOutputWithHeadersCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3693,12 +3678,18 @@ export const de_NestedXmlMapsCommand = async ( if (data.flatNestedMap === "") { contents.flatNestedMap = {}; } else if (data["flatNestedMap"] !== undefined) { - contents.flatNestedMap = de_NestedMap(__getArrayIfSingleItem(data["flatNestedMap"]), context); + contents.flatNestedMap = de_NestedMap( + __getArrayIfSingleItem(data["flatNestedMap"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.nestedMap === "") { contents.nestedMap = {}; } else if (data["nestedMap"] !== undefined && data["nestedMap"]["entry"] !== undefined) { - contents.nestedMap = de_NestedMap(__getArrayIfSingleItem(data["nestedMap"]["entry"]), context); + contents.nestedMap = de_NestedMap( + __getArrayIfSingleItem(data["nestedMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -3716,10 +3707,9 @@ const de_NestedXmlMapsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3754,10 +3744,9 @@ const de_NoInputAndNoOutputCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3792,10 +3781,9 @@ const de_NoInputAndOutputCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3836,10 +3824,9 @@ const de_NullAndEmptyHeadersClientCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3880,10 +3867,9 @@ const de_NullAndEmptyHeadersServerCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3918,10 +3904,9 @@ const de_OmitsNullSerializesEmptyStringCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3956,10 +3941,9 @@ const de_QueryIdempotencyTokenAutoFillCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -3994,10 +3978,9 @@ const de_QueryParamsAsStringListMapCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4032,10 +4015,9 @@ const de_QueryPrecedenceCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4055,7 +4037,7 @@ export const de_RecursiveShapesCommand = async ( }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data["nested"] !== undefined) { - contents.nested = de_RecursiveShapesInputOutputNested1(data["nested"], context); + contents.nested = de_RecursiveShapesInputOutputNested1(data["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -4073,10 +4055,9 @@ const de_RecursiveShapesCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4139,10 +4120,9 @@ const de_SimpleScalarPropertiesCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4205,10 +4185,9 @@ const de_TimestampFormatHeadersCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4249,10 +4228,9 @@ const de_XmlAttributesCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4271,7 +4249,7 @@ export const de_XmlAttributesOnPayloadCommand = async ( $metadata: deserializeMetadata(output), }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.payload = de_XmlAttributesInputOutput(data, context); + contents.payload = de_XmlAttributesInputOutput(data /* DEBUG_REMOVE no elision */, context); return contents; }; @@ -4288,10 +4266,9 @@ const de_XmlAttributesOnPayloadCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4329,10 +4306,9 @@ const de_XmlBlobsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4370,10 +4346,9 @@ const de_XmlEmptyBlobsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4395,28 +4370,40 @@ export const de_XmlEmptyListsCommand = async ( if (data.booleanList === "") { contents.booleanList = []; } else if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { - contents.booleanList = de_BooleanList(__getArrayIfSingleItem(data["booleanList"]["member"]), context); + contents.booleanList = de_BooleanList( + __getArrayIfSingleItem(data["booleanList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.enumList === "") { contents.enumList = []; } else if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { - contents.enumList = de_FooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); + contents.enumList = de_FooEnumList( + __getArrayIfSingleItem(data["enumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.flattenedList === "") { contents.flattenedList = []; } else if (data["flattenedList"] !== undefined) { - contents.flattenedList = de_RenamedListMembers(__getArrayIfSingleItem(data["flattenedList"]), context); + contents.flattenedList = de_RenamedListMembers( + __getArrayIfSingleItem(data["flattenedList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.customName === "") { contents.flattenedList2 = []; } else if (data["customName"] !== undefined) { - contents.flattenedList2 = de_RenamedListMembers(__getArrayIfSingleItem(data["customName"]), context); + contents.flattenedList2 = de_RenamedListMembers( + __getArrayIfSingleItem(data["customName"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.flattenedListWithMemberNamespace === "") { contents.flattenedListWithMemberNamespace = []; } else if (data["flattenedListWithMemberNamespace"] !== undefined) { contents.flattenedListWithMemberNamespace = de_ListWithMemberNamespace( - __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), + __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]) /* DEBUG_REMOVE no elision */, context ); } @@ -4424,57 +4411,81 @@ export const de_XmlEmptyListsCommand = async ( contents.flattenedListWithNamespace = []; } else if (data["flattenedListWithNamespace"] !== undefined) { contents.flattenedListWithNamespace = de_ListWithNamespace( - __getArrayIfSingleItem(data["flattenedListWithNamespace"]), + __getArrayIfSingleItem(data["flattenedListWithNamespace"]) /* DEBUG_REMOVE no elision */, context ); } if (data.flattenedStructureList === "") { contents.flattenedStructureList = []; } else if (data["flattenedStructureList"] !== undefined) { - contents.flattenedStructureList = de_StructureList(__getArrayIfSingleItem(data["flattenedStructureList"]), context); + contents.flattenedStructureList = de_StructureList( + __getArrayIfSingleItem(data["flattenedStructureList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.intEnumList === "") { contents.intEnumList = []; } else if (data["intEnumList"] !== undefined && data["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(data["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(data["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.integerList === "") { contents.integerList = []; } else if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { - contents.integerList = de_IntegerList(__getArrayIfSingleItem(data["integerList"]["member"]), context); + contents.integerList = de_IntegerList( + __getArrayIfSingleItem(data["integerList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.nestedStringList === "") { contents.nestedStringList = []; } else if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { contents.nestedStringList = de_NestedStringList( - __getArrayIfSingleItem(data["nestedStringList"]["member"]), + __getArrayIfSingleItem(data["nestedStringList"]["member"]) /* DEBUG_REMOVE no elision */, context ); } if (data.renamed === "") { contents.renamedListMembers = []; } else if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { - contents.renamedListMembers = de_RenamedListMembers(__getArrayIfSingleItem(data["renamed"]["item"]), context); + contents.renamedListMembers = de_RenamedListMembers( + __getArrayIfSingleItem(data["renamed"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.stringList === "") { contents.stringList = []; } else if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { - contents.stringList = de_StringList(__getArrayIfSingleItem(data["stringList"]["member"]), context); + contents.stringList = de_StringList( + __getArrayIfSingleItem(data["stringList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.stringSet === "") { contents.stringSet = []; } else if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { - contents.stringSet = de_StringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); + contents.stringSet = de_StringSet( + __getArrayIfSingleItem(data["stringSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.myStructureList === "") { contents.structureList = []; } else if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { - contents.structureList = de_StructureList(__getArrayIfSingleItem(data["myStructureList"]["item"]), context); + contents.structureList = de_StructureList( + __getArrayIfSingleItem(data["myStructureList"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.timestampList === "") { contents.timestampList = []; } else if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { - contents.timestampList = de_TimestampList(__getArrayIfSingleItem(data["timestampList"]["member"]), context); + contents.timestampList = de_TimestampList( + __getArrayIfSingleItem(data["timestampList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4492,10 +4503,9 @@ const de_XmlEmptyListsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4517,7 +4527,10 @@ export const de_XmlEmptyMapsCommand = async ( if (data.myMap === "") { contents.myMap = {}; } else if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = de_XmlMapsInputOutputMap(__getArrayIfSingleItem(data["myMap"]["entry"]), context); + contents.myMap = de_XmlMapsInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4535,10 +4548,9 @@ const de_XmlEmptyMapsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4576,10 +4588,9 @@ const de_XmlEmptyStringsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4610,17 +4621,26 @@ export const de_XmlEnumsCommand = async ( if (data.fooEnumList === "") { contents.fooEnumList = []; } else if (data["fooEnumList"] !== undefined && data["fooEnumList"]["member"] !== undefined) { - contents.fooEnumList = de_FooEnumList(__getArrayIfSingleItem(data["fooEnumList"]["member"]), context); + contents.fooEnumList = de_FooEnumList( + __getArrayIfSingleItem(data["fooEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.fooEnumMap === "") { contents.fooEnumMap = {}; } else if (data["fooEnumMap"] !== undefined && data["fooEnumMap"]["entry"] !== undefined) { - contents.fooEnumMap = de_FooEnumMap(__getArrayIfSingleItem(data["fooEnumMap"]["entry"]), context); + contents.fooEnumMap = de_FooEnumMap( + __getArrayIfSingleItem(data["fooEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.fooEnumSet === "") { contents.fooEnumSet = []; } else if (data["fooEnumSet"] !== undefined && data["fooEnumSet"]["member"] !== undefined) { - contents.fooEnumSet = de_FooEnumSet(__getArrayIfSingleItem(data["fooEnumSet"]["member"]), context); + contents.fooEnumSet = de_FooEnumSet( + __getArrayIfSingleItem(data["fooEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4638,10 +4658,9 @@ const de_XmlEnumsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4672,17 +4691,26 @@ export const de_XmlIntEnumsCommand = async ( if (data.intEnumList === "") { contents.intEnumList = []; } else if (data["intEnumList"] !== undefined && data["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(data["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(data["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.intEnumMap === "") { contents.intEnumMap = {}; } else if (data["intEnumMap"] !== undefined && data["intEnumMap"]["entry"] !== undefined) { - contents.intEnumMap = de_IntegerEnumMap(__getArrayIfSingleItem(data["intEnumMap"]["entry"]), context); + contents.intEnumMap = de_IntegerEnumMap( + __getArrayIfSingleItem(data["intEnumMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.intEnumSet === "") { contents.intEnumSet = []; } else if (data["intEnumSet"] !== undefined && data["intEnumSet"]["member"] !== undefined) { - contents.intEnumSet = de_IntegerEnumSet(__getArrayIfSingleItem(data["intEnumSet"]["member"]), context); + contents.intEnumSet = de_IntegerEnumSet( + __getArrayIfSingleItem(data["intEnumSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4700,10 +4728,9 @@ const de_XmlIntEnumsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4725,28 +4752,40 @@ export const de_XmlListsCommand = async ( if (data.booleanList === "") { contents.booleanList = []; } else if (data["booleanList"] !== undefined && data["booleanList"]["member"] !== undefined) { - contents.booleanList = de_BooleanList(__getArrayIfSingleItem(data["booleanList"]["member"]), context); + contents.booleanList = de_BooleanList( + __getArrayIfSingleItem(data["booleanList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.enumList === "") { contents.enumList = []; } else if (data["enumList"] !== undefined && data["enumList"]["member"] !== undefined) { - contents.enumList = de_FooEnumList(__getArrayIfSingleItem(data["enumList"]["member"]), context); + contents.enumList = de_FooEnumList( + __getArrayIfSingleItem(data["enumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.flattenedList === "") { contents.flattenedList = []; } else if (data["flattenedList"] !== undefined) { - contents.flattenedList = de_RenamedListMembers(__getArrayIfSingleItem(data["flattenedList"]), context); + contents.flattenedList = de_RenamedListMembers( + __getArrayIfSingleItem(data["flattenedList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.customName === "") { contents.flattenedList2 = []; } else if (data["customName"] !== undefined) { - contents.flattenedList2 = de_RenamedListMembers(__getArrayIfSingleItem(data["customName"]), context); + contents.flattenedList2 = de_RenamedListMembers( + __getArrayIfSingleItem(data["customName"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.flattenedListWithMemberNamespace === "") { contents.flattenedListWithMemberNamespace = []; } else if (data["flattenedListWithMemberNamespace"] !== undefined) { contents.flattenedListWithMemberNamespace = de_ListWithMemberNamespace( - __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]), + __getArrayIfSingleItem(data["flattenedListWithMemberNamespace"]) /* DEBUG_REMOVE no elision */, context ); } @@ -4754,57 +4793,81 @@ export const de_XmlListsCommand = async ( contents.flattenedListWithNamespace = []; } else if (data["flattenedListWithNamespace"] !== undefined) { contents.flattenedListWithNamespace = de_ListWithNamespace( - __getArrayIfSingleItem(data["flattenedListWithNamespace"]), + __getArrayIfSingleItem(data["flattenedListWithNamespace"]) /* DEBUG_REMOVE no elision */, context ); } if (data.flattenedStructureList === "") { contents.flattenedStructureList = []; } else if (data["flattenedStructureList"] !== undefined) { - contents.flattenedStructureList = de_StructureList(__getArrayIfSingleItem(data["flattenedStructureList"]), context); + contents.flattenedStructureList = de_StructureList( + __getArrayIfSingleItem(data["flattenedStructureList"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.intEnumList === "") { contents.intEnumList = []; } else if (data["intEnumList"] !== undefined && data["intEnumList"]["member"] !== undefined) { - contents.intEnumList = de_IntegerEnumList(__getArrayIfSingleItem(data["intEnumList"]["member"]), context); + contents.intEnumList = de_IntegerEnumList( + __getArrayIfSingleItem(data["intEnumList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.integerList === "") { contents.integerList = []; } else if (data["integerList"] !== undefined && data["integerList"]["member"] !== undefined) { - contents.integerList = de_IntegerList(__getArrayIfSingleItem(data["integerList"]["member"]), context); + contents.integerList = de_IntegerList( + __getArrayIfSingleItem(data["integerList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.nestedStringList === "") { contents.nestedStringList = []; } else if (data["nestedStringList"] !== undefined && data["nestedStringList"]["member"] !== undefined) { contents.nestedStringList = de_NestedStringList( - __getArrayIfSingleItem(data["nestedStringList"]["member"]), + __getArrayIfSingleItem(data["nestedStringList"]["member"]) /* DEBUG_REMOVE no elision */, context ); } if (data.renamed === "") { contents.renamedListMembers = []; } else if (data["renamed"] !== undefined && data["renamed"]["item"] !== undefined) { - contents.renamedListMembers = de_RenamedListMembers(__getArrayIfSingleItem(data["renamed"]["item"]), context); + contents.renamedListMembers = de_RenamedListMembers( + __getArrayIfSingleItem(data["renamed"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.stringList === "") { contents.stringList = []; } else if (data["stringList"] !== undefined && data["stringList"]["member"] !== undefined) { - contents.stringList = de_StringList(__getArrayIfSingleItem(data["stringList"]["member"]), context); + contents.stringList = de_StringList( + __getArrayIfSingleItem(data["stringList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.stringSet === "") { contents.stringSet = []; } else if (data["stringSet"] !== undefined && data["stringSet"]["member"] !== undefined) { - contents.stringSet = de_StringSet(__getArrayIfSingleItem(data["stringSet"]["member"]), context); + contents.stringSet = de_StringSet( + __getArrayIfSingleItem(data["stringSet"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.myStructureList === "") { contents.structureList = []; } else if (data["myStructureList"] !== undefined && data["myStructureList"]["item"] !== undefined) { - contents.structureList = de_StructureList(__getArrayIfSingleItem(data["myStructureList"]["item"]), context); + contents.structureList = de_StructureList( + __getArrayIfSingleItem(data["myStructureList"]["item"]) /* DEBUG_REMOVE no elision */, + context + ); } if (data.timestampList === "") { contents.timestampList = []; } else if (data["timestampList"] !== undefined && data["timestampList"]["member"] !== undefined) { - contents.timestampList = de_TimestampList(__getArrayIfSingleItem(data["timestampList"]["member"]), context); + contents.timestampList = de_TimestampList( + __getArrayIfSingleItem(data["timestampList"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4822,10 +4885,9 @@ const de_XmlListsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4847,7 +4909,10 @@ export const de_XmlMapsCommand = async ( if (data.myMap === "") { contents.myMap = {}; } else if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = de_XmlMapsInputOutputMap(__getArrayIfSingleItem(data["myMap"]["entry"]), context); + contents.myMap = de_XmlMapsInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4865,10 +4930,9 @@ const de_XmlMapsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4890,7 +4954,10 @@ export const de_XmlMapsXmlNameCommand = async ( if (data.myMap === "") { contents.myMap = {}; } else if (data["myMap"] !== undefined && data["myMap"]["entry"] !== undefined) { - contents.myMap = de_XmlMapsXmlNameInputOutputMap(__getArrayIfSingleItem(data["myMap"]["entry"]), context); + contents.myMap = de_XmlMapsXmlNameInputOutputMap( + __getArrayIfSingleItem(data["myMap"]["entry"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -4908,10 +4975,9 @@ const de_XmlMapsXmlNameCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -4931,7 +4997,7 @@ export const de_XmlNamespacesCommand = async ( }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); if (data["nested"] !== undefined) { - contents.nested = de_XmlNamespaceNested(data["nested"], context); + contents.nested = de_XmlNamespaceNested(data["nested"] /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -4949,10 +5015,9 @@ const de_XmlNamespacesCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5008,10 +5073,9 @@ const de_XmlTimestampsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; @@ -5033,7 +5097,7 @@ export const de_XmlUnionsCommand = async ( if (data.unionValue === "") { // Pass empty tags. } else if (data["unionValue"] !== undefined) { - contents.unionValue = de_XmlUnionShape(__expectUnion(data["unionValue"]), context); + contents.unionValue = de_XmlUnionShape(__expectUnion(data["unionValue"]) /* DEBUG_REMOVE no elision */, context); } return contents; }; @@ -5051,15 +5115,14 @@ const de_XmlUnionsCommandError = async ( }; const errorCode = loadRestXmlErrorCode(output, parsedOutput.body); const parsedBody = parsedOutput.body; - throwDefaultError({ + return throwDefaultError({ output, parsedBody: parsedBody.Error, - exceptionCtor: __BaseException, errorCode, }); }; -const map = __map; +const throwDefaultError = withBaseException(__BaseException); /** * deserializeAws_restXmlComplexErrorRes */ @@ -5069,7 +5132,7 @@ const de_ComplexErrorRes = async (parsedOutput: any, context: __SerdeContext): P }); const data: any = parsedOutput.body.Error; if (data["Nested"] !== undefined) { - contents.Nested = de_ComplexNestedErrorData(data["Nested"], context); + contents.Nested = de_ComplexNestedErrorData(data["Nested"] /* DEBUG_REMOVE no elision */, context); } if (data["TopLevel"] !== undefined) { contents.TopLevel = __expectString(data["TopLevel"]); @@ -5150,7 +5213,7 @@ const se_NestedMap = (input: Record>, c const keyNode = __XmlNode.of("String", key).withName("key"); entryNode.addChildNode(keyNode); let node; - node = se_FooEnumMap(input[key], context); + node = se_FooEnumMap(input[key] /* DEBUG_REMOVE no elision */, context); entryNode.addChildNode( node.reduce((acc: __XmlNode, workingNode: any) => { return acc.addChildNode(workingNode); @@ -5225,7 +5288,9 @@ const se_RecursiveShapesInputOutputNested1 = ( bodyNode.addChildNode(node); } if (input.nested != null) { - const node = se_RecursiveShapesInputOutputNested2(input.nested, context).withName("nested"); + const node = se_RecursiveShapesInputOutputNested2(input.nested /* DEBUG_REMOVE no elision */, context).withName( + "nested" + ); bodyNode.addChildNode(node); } return bodyNode; @@ -5244,7 +5309,10 @@ const se_RecursiveShapesInputOutputNested2 = ( bodyNode.addChildNode(node); } if (input.recursiveMember != null) { - const node = se_RecursiveShapesInputOutputNested1(input.recursiveMember, context).withName("recursiveMember"); + const node = se_RecursiveShapesInputOutputNested1( + input.recursiveMember /* DEBUG_REMOVE no elision */, + context + ).withName("recursiveMember"); bodyNode.addChildNode(node); } return bodyNode; @@ -5269,7 +5337,7 @@ const se_StructureList = (input: StructureListMember[], context: __SerdeContext) return input .filter((e: any) => e != null) .map((entry) => { - const node = se_StructureListMember(entry, context); + const node = se_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); return node.withName("item"); }); }; @@ -5316,7 +5384,7 @@ const se_XmlMapsInputOutputMap = (input: Record, context const keyNode = __XmlNode.of("String", key).withName("key"); entryNode.addChildNode(keyNode); let node; - node = se_GreetingStruct(input[key], context); + node = se_GreetingStruct(input[key] /* DEBUG_REMOVE no elision */, context); entryNode.addChildNode(node.withName("value")); return entryNode; }); @@ -5333,7 +5401,7 @@ const se_XmlMapsXmlNameInputOutputMap = (input: Record, const keyNode = __XmlNode.of("String", key).withName("Attribute"); entryNode.addChildNode(keyNode); let node; - node = se_GreetingStruct(input[key], context); + node = se_GreetingStruct(input[key] /* DEBUG_REMOVE no elision */, context); entryNode.addChildNode(node.withName("Setting")); return entryNode; }); @@ -5363,7 +5431,7 @@ const se_XmlNamespaceNested = (input: XmlNamespaceNested, context: __SerdeContex bodyNode.addChildNode(node); } if (input.values != null) { - const nodes = se_XmlNamespacedList(input.values, context); + const nodes = se_XmlNamespacedList(input.values /* DEBUG_REMOVE no elision */, context); const containerNode = new __XmlNode("values"); containerNode.addAttribute("xmlns", "http://qux.com"); nodes.map((node: any) => { @@ -5453,11 +5521,11 @@ const se_XmlUnionShape = (input: XmlUnionShape, context: __SerdeContext): any => bodyNode.addChildNode(node); }, unionValue: (value) => { - const node = se_XmlUnionShape(value, context).withName("unionValue"); + const node = se_XmlUnionShape(value /* DEBUG_REMOVE no elision */, context).withName("unionValue"); bodyNode.addChildNode(node); }, structValue: (value) => { - const node = se_XmlNestedUnionStruct(value, context).withName("structValue"); + const node = se_XmlNestedUnionStruct(value /* DEBUG_REMOVE no elision */, context).withName("structValue"); bodyNode.addChildNode(node); }, _: (name: string, value: any) => { @@ -5595,7 +5663,7 @@ const se_NestedStringList = (input: string[][], context: __SerdeContext): any => return input .filter((e: any) => e != null) .map((entry) => { - const node = se_StringList(entry, context); + const node = se_StringList(entry /* DEBUG_REMOVE no elision */, context); return node.reduce((acc: __XmlNode, workingNode: any) => { return acc.addChildNode(workingNode); }, new __XmlNode("member")); @@ -5705,7 +5773,10 @@ const de_NestedMap = (output: any, context: __SerdeContext): Record e != null) .map((entry: any) => { - return de_StructureListMember(entry, context); + return de_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -5852,7 +5926,7 @@ const de_XmlMapsInputOutputMap = (output: any, context: __SerdeContext): Record< if (pair["value"] === null) { return acc; } - acc[pair["key"]] = de_GreetingStruct(pair["value"], context); + acc[pair["key"]] = de_GreetingStruct(pair["value"] /* DEBUG_REMOVE no elision */, context); return acc; }, {}); }; @@ -5865,7 +5939,7 @@ const de_XmlMapsXmlNameInputOutputMap = (output: any, context: __SerdeContext): if (pair["Setting"] === null) { return acc; } - acc[pair["Attribute"]] = de_GreetingStruct(pair["Setting"], context); + acc[pair["Attribute"]] = de_GreetingStruct(pair["Setting"] /* DEBUG_REMOVE no elision */, context); return acc; }, {}); }; @@ -5892,7 +5966,10 @@ const de_XmlNamespaceNested = (output: any, context: __SerdeContext): XmlNamespa if (output.values === "") { contents.values = []; } else if (output["values"] !== undefined && output["values"]["member"] !== undefined) { - contents.values = de_XmlNamespacedList(__getArrayIfSingleItem(output["values"]["member"]), context); + contents.values = de_XmlNamespacedList( + __getArrayIfSingleItem(output["values"]["member"]) /* DEBUG_REMOVE no elision */, + context + ); } return contents; }; @@ -5977,12 +6054,12 @@ const de_XmlUnionShape = (output: any, context: __SerdeContext): XmlUnionShape = // Pass empty tags. } else if (output["unionValue"] !== undefined) { return { - unionValue: de_XmlUnionShape(__expectUnion(output["unionValue"]), context), + unionValue: de_XmlUnionShape(__expectUnion(output["unionValue"]) /* DEBUG_REMOVE no elision */, context), }; } if (output["structValue"] !== undefined) { return { - structValue: de_XmlNestedUnionStruct(output["structValue"], context), + structValue: de_XmlNestedUnionStruct(output["structValue"] /* DEBUG_REMOVE no elision */, context), }; } return { $unknown: Object.entries(output)[0] }; @@ -6098,7 +6175,7 @@ const de_NestedStringList = (output: any, context: __SerdeContext): string[][] = return (output || []) .filter((e: any) => e != null) .map((entry: any) => { - return de_StringList(__getArrayIfSingleItem(entry["member"]), context); + return de_StringList(__getArrayIfSingleItem(entry["member"]) /* DEBUG_REMOVE no elision */, context); }); }; diff --git a/private/aws-restjson-server/src/protocols/Aws_restJson1.ts b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts index 5a884f5c7dec9..1ef015c01c9af 100644 --- a/private/aws-restjson-server/src/protocols/Aws_restJson1.ts +++ b/private/aws-restjson-server/src/protocols/Aws_restJson1.ts @@ -1,6 +1,7 @@ // smithy-typescript generated code import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; import { + _json, dateToUtcString as __dateToUtcString, expectBoolean as __expectBoolean, expectByte as __expectByte, @@ -15,7 +16,7 @@ import { LazyJsonString as __LazyJsonString, limitedParseDouble as __limitedParseDouble, limitedParseFloat32 as __limitedParseFloat32, - map as __map, + map, parseBoolean as __parseBoolean, parseEpochTimestamp as __parseEpochTimestamp, parseRfc3339DateTime as __parseRfc3339DateTime, @@ -28,6 +29,7 @@ import { strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, strictParseShort as __strictParseShort, + take, } from "@aws-sdk/smithy-client"; import { DocumentType as __DocumentType, @@ -673,12 +675,11 @@ export const deserializeDocumentTypeRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.documentValue != null) { - contents.documentValue = de_Document(data.documentValue, context); - } - if (data.stringValue != null) { - contents.stringValue = __expectString(data.stringValue); - } + const doc = take(data, { + documentValue: (_) => de_Document(_ /* DEBUG_REMOVE no elision */, context), + stringValue: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -786,9 +787,10 @@ export const deserializeEndpointWithHostLabelOperationRequest = async ( contents.label = parsedHost.groups.label; } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.label != null) { - contents.label = __expectString(data.label); - } + const doc = take(data, { + label: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -889,9 +891,10 @@ export const deserializeHttpChecksumRequiredRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.foo != null) { - contents.foo = __expectString(data.foo); - } + const doc = take(data, { + foo: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -983,7 +986,7 @@ export const deserializeHttpPayloadWithStructureRequest = async ( } const contents: any = map({}); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.nested = de_NestedPayload(data, context); + contents.nested = _json(data) /* DEBUG_REMOVE serde elision of output */; return contents; }; @@ -1410,9 +1413,10 @@ export const deserializeJsonBlobsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.data != null) { - contents.data = context.base64Decoder(data.data); - } + const doc = take(data, { + data: context.base64Decoder, + }); + Object.assign(contents, doc); return contents; }; @@ -1438,24 +1442,15 @@ export const deserializeJsonEnumsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.fooEnum1 != null) { - contents.fooEnum1 = __expectString(data.fooEnum1); - } - if (data.fooEnum2 != null) { - contents.fooEnum2 = __expectString(data.fooEnum2); - } - if (data.fooEnum3 != null) { - contents.fooEnum3 = __expectString(data.fooEnum3); - } - if (data.fooEnumList != null) { - contents.fooEnumList = de_FooEnumList(data.fooEnumList, context); - } - if (data.fooEnumMap != null) { - contents.fooEnumMap = de_FooEnumMap(data.fooEnumMap, context); - } - if (data.fooEnumSet != null) { - contents.fooEnumSet = de_FooEnumSet(data.fooEnumSet, context); - } + const doc = take(data, { + fooEnum1: __expectString, + fooEnum2: __expectString, + fooEnum3: __expectString, + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -1481,24 +1476,15 @@ export const deserializeJsonIntEnumsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.integerEnum1 != null) { - contents.integerEnum1 = __expectInt32(data.integerEnum1); - } - if (data.integerEnum2 != null) { - contents.integerEnum2 = __expectInt32(data.integerEnum2); - } - if (data.integerEnum3 != null) { - contents.integerEnum3 = __expectInt32(data.integerEnum3); - } - if (data.integerEnumList != null) { - contents.integerEnumList = de_IntegerEnumList(data.integerEnumList, context); - } - if (data.integerEnumMap != null) { - contents.integerEnumMap = de_IntegerEnumMap(data.integerEnumMap, context); - } - if (data.integerEnumSet != null) { - contents.integerEnumSet = de_IntegerEnumSet(data.integerEnumSet, context); - } + const doc = take(data, { + integerEnum1: __expectInt32, + integerEnum2: __expectInt32, + integerEnum3: __expectInt32, + integerEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -1524,36 +1510,19 @@ export const deserializeJsonListsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.booleanList != null) { - contents.booleanList = de_BooleanList(data.booleanList, context); - } - if (data.enumList != null) { - contents.enumList = de_FooEnumList(data.enumList, context); - } - if (data.intEnumList != null) { - contents.intEnumList = de_IntegerEnumList(data.intEnumList, context); - } - if (data.integerList != null) { - contents.integerList = de_IntegerList(data.integerList, context); - } - if (data.nestedStringList != null) { - contents.nestedStringList = de_NestedStringList(data.nestedStringList, context); - } - if (data.sparseStringList != null) { - contents.sparseStringList = de_SparseStringList(data.sparseStringList, context); - } - if (data.stringList != null) { - contents.stringList = de_StringList(data.stringList, context); - } - if (data.stringSet != null) { - contents.stringSet = de_StringSet(data.stringSet, context); - } - if (data.myStructureList != null) { - contents.structureList = de_StructureList(data.myStructureList, context); - } - if (data.timestampList != null) { - contents.timestampList = de_TimestampList(data.timestampList, context); - } + const doc = take(data, { + booleanList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + enumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + intEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + nestedStringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseStringList: (_) => de_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + stringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + stringSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + structureList: [, (_) => de_StructureList(_ /* DEBUG_REMOVE no elision */, context), `myStructureList`], + timestampList: (_) => de_TimestampList(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -1579,36 +1548,19 @@ export const deserializeJsonMapsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.denseBooleanMap != null) { - contents.denseBooleanMap = de_DenseBooleanMap(data.denseBooleanMap, context); - } - if (data.denseNumberMap != null) { - contents.denseNumberMap = de_DenseNumberMap(data.denseNumberMap, context); - } - if (data.denseSetMap != null) { - contents.denseSetMap = de_DenseSetMap(data.denseSetMap, context); - } - if (data.denseStringMap != null) { - contents.denseStringMap = de_DenseStringMap(data.denseStringMap, context); - } - if (data.denseStructMap != null) { - contents.denseStructMap = de_DenseStructMap(data.denseStructMap, context); - } - if (data.sparseBooleanMap != null) { - contents.sparseBooleanMap = de_SparseBooleanMap(data.sparseBooleanMap, context); - } - if (data.sparseNumberMap != null) { - contents.sparseNumberMap = de_SparseNumberMap(data.sparseNumberMap, context); - } - if (data.sparseSetMap != null) { - contents.sparseSetMap = de_SparseSetMap(data.sparseSetMap, context); - } - if (data.sparseStringMap != null) { - contents.sparseStringMap = de_SparseStringMap(data.sparseStringMap, context); - } - if (data.sparseStructMap != null) { - contents.sparseStructMap = de_SparseStructMap(data.sparseStructMap, context); - } + const doc = take(data, { + denseBooleanMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseNumberMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseSetMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStringMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStructMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseBooleanMap: (_) => de_SparseBooleanMap(_ /* DEBUG_REMOVE no elision */, context), + sparseNumberMap: (_) => de_SparseNumberMap(_ /* DEBUG_REMOVE no elision */, context), + sparseSetMap: (_) => de_SparseSetMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => de_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStructMap: (_) => de_SparseStructMap(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -1634,27 +1586,16 @@ export const deserializeJsonTimestampsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.dateTime != null) { - contents.dateTime = __expectNonNull(__parseRfc3339DateTime(data.dateTime)); - } - if (data.dateTimeOnTarget != null) { - contents.dateTimeOnTarget = __expectNonNull(__parseRfc3339DateTime(data.dateTimeOnTarget)); - } - if (data.epochSeconds != null) { - contents.epochSeconds = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSeconds))); - } - if (data.epochSecondsOnTarget != null) { - contents.epochSecondsOnTarget = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.epochSecondsOnTarget))); - } - if (data.httpDate != null) { - contents.httpDate = __expectNonNull(__parseRfc7231DateTime(data.httpDate)); - } - if (data.httpDateOnTarget != null) { - contents.httpDateOnTarget = __expectNonNull(__parseRfc7231DateTime(data.httpDateOnTarget)); - } - if (data.normal != null) { - contents.normal = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.normal))); - } + const doc = take(data, { + dateTime: (_) => __expectNonNull(__parseRfc3339DateTime(_)), + dateTimeOnTarget: (_) => __expectNonNull(__parseRfc3339DateTime(_)), + epochSeconds: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + epochSecondsOnTarget: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + httpDate: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + httpDateOnTarget: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + normal: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + }); + Object.assign(contents, doc); return contents; }; @@ -1680,9 +1621,10 @@ export const deserializeJsonUnionsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.contents != null) { - contents.contents = de_MyUnion(__expectUnion(data.contents), context); - } + const doc = take(data, { + contents: (_) => de_MyUnion(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -1783,9 +1725,10 @@ export const deserializeMalformedBlobRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.blob != null) { - contents.blob = context.base64Decoder(data.blob); - } + const doc = take(data, { + blob: context.base64Decoder, + }); + Object.assign(contents, doc); return contents; }; @@ -1837,9 +1780,10 @@ export const deserializeMalformedBooleanRequest = async ( contents.booleanInPath = __parseBoolean(decodeURIComponent(parsedPath.groups.booleanInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.booleanInBody != null) { - contents.booleanInBody = __expectBoolean(data.booleanInBody); - } + const doc = take(data, { + booleanInBody: __expectBoolean, + }); + Object.assign(contents, doc); return contents; }; @@ -1891,9 +1835,10 @@ export const deserializeMalformedByteRequest = async ( contents.byteInPath = __strictParseByte(decodeURIComponent(parsedPath.groups.byteInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byteInBody != null) { - contents.byteInBody = __expectByte(data.byteInBody); - } + const doc = take(data, { + byteInBody: __expectByte, + }); + Object.assign(contents, doc); return contents; }; @@ -1919,9 +1864,10 @@ export const deserializeMalformedContentTypeWithBodyRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.hi != null) { - contents.hi = __expectString(data.hi); - } + const doc = take(data, { + hi: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -2050,9 +1996,10 @@ export const deserializeMalformedDoubleRequest = async ( contents.doubleInPath = __strictParseDouble(decodeURIComponent(parsedPath.groups.doubleInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.doubleInBody != null) { - contents.doubleInBody = __limitedParseDouble(data.doubleInBody); - } + const doc = take(data, { + doubleInBody: __limitedParseDouble, + }); + Object.assign(contents, doc); return contents; }; @@ -2104,9 +2051,10 @@ export const deserializeMalformedFloatRequest = async ( contents.floatInPath = __strictParseFloat(decodeURIComponent(parsedPath.groups.floatInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.floatInBody != null) { - contents.floatInBody = __limitedParseFloat32(data.floatInBody); - } + const doc = take(data, { + floatInBody: __limitedParseFloat32, + }); + Object.assign(contents, doc); return contents; }; @@ -2158,9 +2106,10 @@ export const deserializeMalformedIntegerRequest = async ( contents.integerInPath = __strictParseInt32(decodeURIComponent(parsedPath.groups.integerInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.integerInBody != null) { - contents.integerInBody = __expectInt32(data.integerInBody); - } + const doc = take(data, { + integerInBody: __expectInt32, + }); + Object.assign(contents, doc); return contents; }; @@ -2186,9 +2135,10 @@ export const deserializeMalformedListRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.bodyList != null) { - contents.bodyList = de_SimpleList(data.bodyList, context); - } + const doc = take(data, { + bodyList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -2240,9 +2190,10 @@ export const deserializeMalformedLongRequest = async ( contents.longInPath = __strictParseLong(decodeURIComponent(parsedPath.groups.longInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.longInBody != null) { - contents.longInBody = __expectLong(data.longInBody); - } + const doc = take(data, { + longInBody: __expectLong, + }); + Object.assign(contents, doc); return contents; }; @@ -2268,9 +2219,10 @@ export const deserializeMalformedMapRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.bodyMap != null) { - contents.bodyMap = de_SimpleMap(data.bodyMap, context); - } + const doc = take(data, { + bodyMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -2296,12 +2248,11 @@ export const deserializeMalformedRequestBodyRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.float != null) { - contents.float = __limitedParseFloat32(data.float); - } - if (data.int != null) { - contents.int = __expectInt32(data.int); - } + const doc = take(data, { + float: __limitedParseFloat32, + int: __expectInt32, + }); + Object.assign(contents, doc); return contents; }; @@ -2353,9 +2304,10 @@ export const deserializeMalformedShortRequest = async ( contents.shortInPath = __strictParseShort(decodeURIComponent(parsedPath.groups.shortInPath)); } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.shortInBody != null) { - contents.shortInBody = __expectShort(data.shortInBody); - } + const doc = take(data, { + shortInBody: __expectShort, + }); + Object.assign(contents, doc); return contents; }; @@ -2414,9 +2366,10 @@ export const deserializeMalformedTimestampBodyDateTimeRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.timestamp != null) { - contents.timestamp = __expectNonNull(__parseRfc3339DateTime(data.timestamp)); - } + const doc = take(data, { + timestamp: (_) => __expectNonNull(__parseRfc3339DateTime(_)), + }); + Object.assign(contents, doc); return contents; }; @@ -2442,9 +2395,10 @@ export const deserializeMalformedTimestampBodyDefaultRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.timestamp != null) { - contents.timestamp = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.timestamp))); - } + const doc = take(data, { + timestamp: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + }); + Object.assign(contents, doc); return contents; }; @@ -2470,9 +2424,10 @@ export const deserializeMalformedTimestampBodyHttpDateRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.timestamp != null) { - contents.timestamp = __expectNonNull(__parseRfc7231DateTime(data.timestamp)); - } + const doc = take(data, { + timestamp: (_) => __expectNonNull(__parseRfc7231DateTime(_)), + }); + Object.assign(contents, doc); return contents; }; @@ -2801,9 +2756,10 @@ export const deserializeMalformedUnionRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.union != null) { - contents.union = de_SimpleUnion(__expectUnion(data.union), context); - } + const doc = take(data, { + union: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -3099,9 +3055,10 @@ export const deserializePostPlayerActionRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.action != null) { - contents.action = de_PlayerAction(__expectUnion(data.action), context); - } + const doc = take(data, { + action: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -3127,9 +3084,10 @@ export const deserializePostUnionWithJsonNameRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.value != null) { - contents.value = de_UnionWithJsonName(__expectUnion(data.value), context); - } + const doc = take(data, { + value: (_) => de_UnionWithJsonName(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -3300,9 +3258,10 @@ export const deserializeRecursiveShapesRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.nested != null) { - contents.nested = de_RecursiveShapesInputOutputNested1(data.nested, context); - } + const doc = take(data, { + nested: (_) => de_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -3330,33 +3289,18 @@ export const deserializeSimpleScalarPropertiesRequest = async ( foo: [, output.headers["x-foo"]], }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byteValue != null) { - contents.byteValue = __expectByte(data.byteValue); - } - if (data.DoubleDribble != null) { - contents.doubleValue = __limitedParseDouble(data.DoubleDribble); - } - if (data.falseBooleanValue != null) { - contents.falseBooleanValue = __expectBoolean(data.falseBooleanValue); - } - if (data.floatValue != null) { - contents.floatValue = __limitedParseFloat32(data.floatValue); - } - if (data.integerValue != null) { - contents.integerValue = __expectInt32(data.integerValue); - } - if (data.longValue != null) { - contents.longValue = __expectLong(data.longValue); - } - if (data.shortValue != null) { - contents.shortValue = __expectShort(data.shortValue); - } - if (data.stringValue != null) { - contents.stringValue = __expectString(data.stringValue); - } - if (data.trueBooleanValue != null) { - contents.trueBooleanValue = __expectBoolean(data.trueBooleanValue); - } + const doc = take(data, { + byteValue: __expectByte, + doubleValue: [, __limitedParseDouble, `DoubleDribble`], + falseBooleanValue: __expectBoolean, + floatValue: __limitedParseFloat32, + integerValue: __expectInt32, + longValue: __expectLong, + shortValue: __expectShort, + stringValue: __expectString, + trueBooleanValue: __expectBoolean, + }); + Object.assign(contents, doc); return contents; }; @@ -3443,9 +3387,10 @@ export const deserializeTestBodyStructureRequest = async ( testId: [, output.headers["x-amz-test-id"]], }); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.testConfig != null) { - contents.testConfig = de_TestConfig(data.testConfig, context); - } + const doc = take(data, { + testConfig: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -3512,7 +3457,7 @@ export const deserializeTestPayloadStructureRequest = async ( testId: [, output.headers["x-amz-test-id"]], }); const data: Record | undefined = __expectObject(await parseBody(output.body, context)); - contents.payloadConfig = de_PayloadConfig(data, context); + contents.payloadConfig = _json(data) /* DEBUG_REMOVE serde elision of output */; return contents; }; @@ -3715,9 +3660,11 @@ export const serializeDatetimeOffsetsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.datetime != null && { datetime: input.datetime.toISOString().split(".")[0] + "Z" }), - }); + body = JSON.stringify( + take(input, { + datetime: (_) => _.toISOString().split(".")[0] + "Z", + }) + ); if ( body && Object.keys(headers) @@ -3754,10 +3701,12 @@ export const serializeDocumentTypeResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.documentValue != null && { documentValue: se_Document(input.documentValue, context) }), - ...(input.stringValue != null && { stringValue: input.stringValue }), - }); + body = JSON.stringify( + take(input, { + documentValue: (_) => se_Document(_ /* DEBUG_REMOVE no elision */, context), + stringValue: [], + }) + ); if ( body && Object.keys(headers) @@ -3943,10 +3892,12 @@ export const serializeFractionalSecondsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.datetime != null && { datetime: input.datetime.toISOString().split(".")[0] + "Z" }), - ...(input.httpdate != null && { httpdate: __dateToUtcString(input.httpdate) }), - }); + body = JSON.stringify( + take(input, { + datetime: (_) => _.toISOString().split(".")[0] + "Z", + httpdate: (_) => __dateToUtcString(_), + }) + ); if ( body && Object.keys(headers) @@ -4055,9 +4006,11 @@ export const serializeHttpChecksumRequiredResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.foo != null && { foo: input.foo }), - }); + body = JSON.stringify( + take(input, { + foo: [], + }) + ); if ( body && Object.keys(headers) @@ -4214,7 +4167,7 @@ export const serializeHttpPayloadWithStructureResponse = async ( }); let body: any; if (input.nested !== undefined) { - body = se_NestedPayload(input.nested, context); + body = _json(input.nested) /* DEBUG_REMOVE serde elision of input */; } if (body === undefined) { body = {}; @@ -4590,9 +4543,11 @@ export const serializeIgnoreQueryParamsInResponseResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.baz != null && { baz: input.baz }), - }); + body = JSON.stringify( + take(input, { + baz: [], + }) + ); if ( body && Object.keys(headers) @@ -4714,9 +4669,11 @@ export const serializeJsonBlobsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.data != null && { data: context.base64Encoder(input.data) }), - }); + body = JSON.stringify( + take(input, { + data: (_) => context.base64Encoder(_), + }) + ); if ( body && Object.keys(headers) @@ -4753,14 +4710,16 @@ export const serializeJsonEnumsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.fooEnum1 != null && { fooEnum1: input.fooEnum1 }), - ...(input.fooEnum2 != null && { fooEnum2: input.fooEnum2 }), - ...(input.fooEnum3 != null && { fooEnum3: input.fooEnum3 }), - ...(input.fooEnumList != null && { fooEnumList: se_FooEnumList(input.fooEnumList, context) }), - ...(input.fooEnumMap != null && { fooEnumMap: se_FooEnumMap(input.fooEnumMap, context) }), - ...(input.fooEnumSet != null && { fooEnumSet: se_FooEnumSet(input.fooEnumSet, context) }), - }); + body = JSON.stringify( + take(input, { + fooEnum1: [], + fooEnum2: [], + fooEnum3: [], + fooEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + fooEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); if ( body && Object.keys(headers) @@ -4797,14 +4756,16 @@ export const serializeJsonIntEnumsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.integerEnum1 != null && { integerEnum1: input.integerEnum1 }), - ...(input.integerEnum2 != null && { integerEnum2: input.integerEnum2 }), - ...(input.integerEnum3 != null && { integerEnum3: input.integerEnum3 }), - ...(input.integerEnumList != null && { integerEnumList: se_IntegerEnumList(input.integerEnumList, context) }), - ...(input.integerEnumMap != null && { integerEnumMap: se_IntegerEnumMap(input.integerEnumMap, context) }), - ...(input.integerEnumSet != null && { integerEnumSet: se_IntegerEnumSet(input.integerEnumSet, context) }), - }); + body = JSON.stringify( + take(input, { + integerEnum1: [], + integerEnum2: [], + integerEnum3: [], + integerEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerEnumSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); if ( body && Object.keys(headers) @@ -4841,18 +4802,20 @@ export const serializeJsonListsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.booleanList != null && { booleanList: se_BooleanList(input.booleanList, context) }), - ...(input.enumList != null && { enumList: se_FooEnumList(input.enumList, context) }), - ...(input.intEnumList != null && { intEnumList: se_IntegerEnumList(input.intEnumList, context) }), - ...(input.integerList != null && { integerList: se_IntegerList(input.integerList, context) }), - ...(input.nestedStringList != null && { nestedStringList: se_NestedStringList(input.nestedStringList, context) }), - ...(input.sparseStringList != null && { sparseStringList: se_SparseStringList(input.sparseStringList, context) }), - ...(input.stringList != null && { stringList: se_StringList(input.stringList, context) }), - ...(input.stringSet != null && { stringSet: se_StringSet(input.stringSet, context) }), - ...(input.structureList != null && { myStructureList: se_StructureList(input.structureList, context) }), - ...(input.timestampList != null && { timestampList: se_TimestampList(input.timestampList, context) }), - }); + body = JSON.stringify( + take(input, { + booleanList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + enumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + intEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + nestedStringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseStringList: (_) => se_SparseStringList(_ /* DEBUG_REMOVE no elision */, context), + stringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + stringSet: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + myStructureList: [, (_) => se_StructureList(_ /* DEBUG_REMOVE no elision */, context), `structureList`], + timestampList: (_) => se_TimestampList(_ /* DEBUG_REMOVE no elision */, context), + }) + ); if ( body && Object.keys(headers) @@ -4889,18 +4852,20 @@ export const serializeJsonMapsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.denseBooleanMap != null && { denseBooleanMap: se_DenseBooleanMap(input.denseBooleanMap, context) }), - ...(input.denseNumberMap != null && { denseNumberMap: se_DenseNumberMap(input.denseNumberMap, context) }), - ...(input.denseSetMap != null && { denseSetMap: se_DenseSetMap(input.denseSetMap, context) }), - ...(input.denseStringMap != null && { denseStringMap: se_DenseStringMap(input.denseStringMap, context) }), - ...(input.denseStructMap != null && { denseStructMap: se_DenseStructMap(input.denseStructMap, context) }), - ...(input.sparseBooleanMap != null && { sparseBooleanMap: se_SparseBooleanMap(input.sparseBooleanMap, context) }), - ...(input.sparseNumberMap != null && { sparseNumberMap: se_SparseNumberMap(input.sparseNumberMap, context) }), - ...(input.sparseSetMap != null && { sparseSetMap: se_SparseSetMap(input.sparseSetMap, context) }), - ...(input.sparseStringMap != null && { sparseStringMap: se_SparseStringMap(input.sparseStringMap, context) }), - ...(input.sparseStructMap != null && { sparseStructMap: se_SparseStructMap(input.sparseStructMap, context) }), - }); + body = JSON.stringify( + take(input, { + denseBooleanMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseNumberMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseSetMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStringMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + denseStructMap: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + sparseBooleanMap: (_) => se_SparseBooleanMap(_ /* DEBUG_REMOVE no elision */, context), + sparseNumberMap: (_) => se_SparseNumberMap(_ /* DEBUG_REMOVE no elision */, context), + sparseSetMap: (_) => se_SparseSetMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStringMap: (_) => se_SparseStringMap(_ /* DEBUG_REMOVE no elision */, context), + sparseStructMap: (_) => se_SparseStructMap(_ /* DEBUG_REMOVE no elision */, context), + }) + ); if ( body && Object.keys(headers) @@ -4937,19 +4902,17 @@ export const serializeJsonTimestampsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.dateTime != null && { dateTime: input.dateTime.toISOString().split(".")[0] + "Z" }), - ...(input.dateTimeOnTarget != null && { - dateTimeOnTarget: input.dateTimeOnTarget.toISOString().split(".")[0] + "Z", - }), - ...(input.epochSeconds != null && { epochSeconds: Math.round(input.epochSeconds.getTime() / 1000) }), - ...(input.epochSecondsOnTarget != null && { - epochSecondsOnTarget: Math.round(input.epochSecondsOnTarget.getTime() / 1000), - }), - ...(input.httpDate != null && { httpDate: __dateToUtcString(input.httpDate) }), - ...(input.httpDateOnTarget != null && { httpDateOnTarget: __dateToUtcString(input.httpDateOnTarget) }), - ...(input.normal != null && { normal: Math.round(input.normal.getTime() / 1000) }), - }); + body = JSON.stringify( + take(input, { + dateTime: (_) => _.toISOString().split(".")[0] + "Z", + dateTimeOnTarget: (_) => _.toISOString().split(".")[0] + "Z", + epochSeconds: (_) => Math.round(_.getTime() / 1000), + epochSecondsOnTarget: (_) => Math.round(_.getTime() / 1000), + httpDate: (_) => __dateToUtcString(_), + httpDateOnTarget: (_) => __dateToUtcString(_), + normal: (_) => Math.round(_.getTime() / 1000), + }) + ); if ( body && Object.keys(headers) @@ -4986,9 +4949,11 @@ export const serializeJsonUnionsResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.contents != null && { contents: se_MyUnion(input.contents, context) }), - }); + body = JSON.stringify( + take(input, { + contents: (_) => se_MyUnion(_ /* DEBUG_REMOVE no elision */, context), + }) + ); if ( body && Object.keys(headers) @@ -5025,9 +4990,11 @@ export const serializeMalformedAcceptWithBodyResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.hi != null && { hi: input.hi }), - }); + body = JSON.stringify( + take(input, { + hi: [], + }) + ); if ( body && Object.keys(headers) @@ -6388,9 +6355,11 @@ export const serializePostPlayerActionResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.action != null && { action: se_PlayerAction(input.action, context) }), - }); + body = JSON.stringify( + take(input, { + action: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); if ( body && Object.keys(headers) @@ -6427,9 +6396,11 @@ export const serializePostUnionWithJsonNameResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.value != null && { value: se_UnionWithJsonName(input.value, context) }), - }); + body = JSON.stringify( + take(input, { + value: (_) => se_UnionWithJsonName(_ /* DEBUG_REMOVE no elision */, context), + }) + ); if ( body && Object.keys(headers) @@ -6568,9 +6539,11 @@ export const serializeRecursiveShapesResponse = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.nested != null && { nested: se_RecursiveShapesInputOutputNested1(input.nested, context) }), - }); + body = JSON.stringify( + take(input, { + nested: (_) => se_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }) + ); if ( body && Object.keys(headers) @@ -6608,17 +6581,19 @@ export const serializeSimpleScalarPropertiesResponse = async ( "x-foo": input.foo!, }); let body: any; - body = JSON.stringify({ - ...(input.byteValue != null && { byteValue: input.byteValue }), - ...(input.doubleValue != null && { DoubleDribble: __serializeFloat(input.doubleValue) }), - ...(input.falseBooleanValue != null && { falseBooleanValue: input.falseBooleanValue }), - ...(input.floatValue != null && { floatValue: __serializeFloat(input.floatValue) }), - ...(input.integerValue != null && { integerValue: input.integerValue }), - ...(input.longValue != null && { longValue: input.longValue }), - ...(input.shortValue != null && { shortValue: input.shortValue }), - ...(input.stringValue != null && { stringValue: input.stringValue }), - ...(input.trueBooleanValue != null && { trueBooleanValue: input.trueBooleanValue }), - }); + body = JSON.stringify( + take(input, { + byteValue: [], + DoubleDribble: [, (_) => __serializeFloat(_), `doubleValue`], + falseBooleanValue: [], + floatValue: (_) => __serializeFloat(_), + integerValue: [], + longValue: [], + shortValue: [], + stringValue: [], + trueBooleanValue: [], + }) + ); if ( body && Object.keys(headers) @@ -6770,9 +6745,11 @@ export const serializeTestBodyStructureResponse = async ( "x-amz-test-id": input.testId!, }); let body: any; - body = JSON.stringify({ - ...(input.testConfig != null && { testConfig: se_TestConfig(input.testConfig, context) }), - }); + body = JSON.stringify( + take(input, { + testConfig: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }) + ); if ( body && Object.keys(headers) @@ -6888,7 +6865,7 @@ export const serializeTestPayloadStructureResponse = async ( }); let body: any; if (input.payloadConfig !== undefined) { - body = se_PayloadConfig(input.payloadConfig, context); + body = _json(input.payloadConfig) /* DEBUG_REMOVE serde elision of input */; } if (body === undefined) { body = {}; @@ -7098,7 +7075,6 @@ export const serializeFrameworkException = async ( } }; -const map = __map; export const serializeComplexErrorError = async ( input: ComplexError, ctx: ServerSerdeContext @@ -7119,10 +7095,12 @@ export const serializeComplexErrorError = async ( "x-header": input.Header!, }); let body: any; - body = JSON.stringify({ - ...(input.Nested != null && { Nested: se_ComplexNestedErrorData(input.Nested, context) }), - ...(input.TopLevel != null && { TopLevel: input.TopLevel }), - }); + body = JSON.stringify( + take(input, { + Nested: (_) => se_ComplexNestedErrorData(_ /* DEBUG_REMOVE no elision */, context), + TopLevel: [], + }) + ); return new __HttpResponse({ headers, body, @@ -7173,9 +7151,11 @@ export const serializeInvalidGreetingError = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.Message != null && { Message: input.Message }), - }); + body = JSON.stringify( + take(input, { + Message: [], + }) + ); return new __HttpResponse({ headers, body, @@ -7187,9 +7167,9 @@ export const serializeInvalidGreetingError = async ( * serializeAws_restJson1ComplexNestedErrorData */ const se_ComplexNestedErrorData = (input: ComplexNestedErrorData, context: __SerdeContext): any => { - return { - ...(input.Foo != null && { Fooooo: input.Foo }), - }; + return take(input, { + Fooooo: [, , `Foo`], + }); }; /** @@ -7226,7 +7206,7 @@ const se_DenseSetMap = (input: Record, context: __SerdeContext if (value === null) { return acc; } - acc[key] = se_StringSet(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7252,7 +7232,7 @@ const se_DenseStructMap = (input: Record, context: __Ser if (value === null) { return acc; } - acc[key] = se_GreetingStruct(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7272,12 +7252,12 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { blobValue: (value) => ({ blobValue: context.base64Encoder(value) }), booleanValue: (value) => ({ booleanValue: value }), enumValue: (value) => ({ enumValue: value }), - listValue: (value) => ({ listValue: se_StringList(value, context) }), - mapValue: (value) => ({ mapValue: se_StringMap(value, context) }), + listValue: (value) => ({ listValue: _json(value) /* DEBUG_REMOVE yes elision */ }), + mapValue: (value) => ({ mapValue: _json(value) /* DEBUG_REMOVE yes elision */ }), numberValue: (value) => ({ numberValue: value }), - renamedStructureValue: (value) => ({ renamedStructureValue: se_RenamedGreeting(value, context) }), + renamedStructureValue: (value) => ({ renamedStructureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), stringValue: (value) => ({ stringValue: value }), - structureValue: (value) => ({ structureValue: se_GreetingStruct(value, context) }), + structureValue: (value) => ({ structureValue: _json(value) /* DEBUG_REMOVE yes elision */ }), timestampValue: (value) => ({ timestampValue: Math.round(value.getTime() / 1000) }), _: (name, value) => ({ name: value } as any), }); @@ -7287,19 +7267,19 @@ const se_MyUnion = (input: MyUnion, context: __SerdeContext): any => { * serializeAws_restJson1NestedPayload */ const se_NestedPayload = (input: NestedPayload, context: __SerdeContext): any => { - return { - ...(input.greeting != null && { greeting: input.greeting }), - ...(input.name != null && { name: input.name }), - }; + return take(input, { + greeting: [], + name: [], + }); }; /** * serializeAws_restJson1PayloadConfig */ const se_PayloadConfig = (input: PayloadConfig, context: __SerdeContext): any => { - return { - ...(input.data != null && { data: input.data }), - }; + return take(input, { + data: [], + }); }; /** @@ -7307,7 +7287,7 @@ const se_PayloadConfig = (input: PayloadConfig, context: __SerdeContext): any => */ const se_PlayerAction = (input: PlayerAction, context: __SerdeContext): any => { return PlayerAction.visit(input, { - quit: (value) => ({ quit: se_Unit(value, context) }), + quit: (value) => ({ quit: _json(value) /* DEBUG_REMOVE yes elision */ }), _: (name, value) => ({ name: value } as any), }); }; @@ -7319,10 +7299,10 @@ const se_RecursiveShapesInputOutputNested1 = ( input: RecursiveShapesInputOutputNested1, context: __SerdeContext ): any => { - return { - ...(input.foo != null && { foo: input.foo }), - ...(input.nested != null && { nested: se_RecursiveShapesInputOutputNested2(input.nested, context) }), - }; + return take(input, { + foo: [], + nested: (_) => se_RecursiveShapesInputOutputNested2(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** @@ -7332,12 +7312,10 @@ const se_RecursiveShapesInputOutputNested2 = ( input: RecursiveShapesInputOutputNested2, context: __SerdeContext ): any => { - return { - ...(input.bar != null && { bar: input.bar }), - ...(input.recursiveMember != null && { - recursiveMember: se_RecursiveShapesInputOutputNested1(input.recursiveMember, context), - }), - }; + return take(input, { + bar: [], + recursiveMember: (_) => se_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }); }; /** @@ -7377,7 +7355,7 @@ const se_SparseSetMap = (input: Record, context: __SerdeContex acc[key] = null as any; return acc; } - acc[key] = se_StringSet(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7391,7 +7369,7 @@ const se_SparseStructMap = (input: Record, context: __Se acc[key] = null as any; return acc; } - acc[key] = se_GreetingStruct(value, context); + acc[key] = _json(value) /* DEBUG_REMOVE yes elision */; return acc; }, {}); }; @@ -7403,7 +7381,7 @@ const se_StructureList = (input: StructureListMember[], context: __SerdeContext) return input .filter((e: any) => e != null) .map((entry) => { - return se_StructureListMember(entry, context); + return se_StructureListMember(entry /* DEBUG_REMOVE no elision */, context); }); }; @@ -7411,19 +7389,19 @@ const se_StructureList = (input: StructureListMember[], context: __SerdeContext) * serializeAws_restJson1StructureListMember */ const se_StructureListMember = (input: StructureListMember, context: __SerdeContext): any => { - return { - ...(input.a != null && { value: input.a }), - ...(input.b != null && { other: input.b }), - }; + return take(input, { + value: [, , `a`], + other: [, , `b`], + }); }; /** * serializeAws_restJson1TestConfig */ const se_TestConfig = (input: TestConfig, context: __SerdeContext): any => { - return { - ...(input.timeout != null && { timeout: input.timeout }), - }; + return take(input, { + timeout: [], + }); }; /** @@ -7442,31 +7420,23 @@ const se_UnionWithJsonName = (input: UnionWithJsonName, context: __SerdeContext) * serializeAws_restJson1RenamedGreeting */ const se_RenamedGreeting = (input: RenamedGreeting, context: __SerdeContext): any => { - return { - ...(input.salutation != null && { salutation: input.salutation }), - }; + return take(input, { + salutation: [], + }); }; /** * serializeAws_restJson1BooleanList */ const se_BooleanList = (input: boolean[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1FooEnumList */ const se_FooEnumList = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7486,31 +7456,23 @@ const se_FooEnumMap = (input: Record, context: __Serde * serializeAws_restJson1FooEnumSet */ const se_FooEnumSet = (input: (FooEnum | string)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1GreetingStruct */ const se_GreetingStruct = (input: GreetingStruct, context: __SerdeContext): any => { - return { - ...(input.hi != null && { hi: input.hi }), - }; + return take(input, { + hi: [], + }); }; /** * serializeAws_restJson1IntegerEnumList */ const se_IntegerEnumList = (input: (IntegerEnum | number)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7530,22 +7492,14 @@ const se_IntegerEnumMap = (input: Record, context: * serializeAws_restJson1IntegerEnumSet */ const se_IntegerEnumSet = (input: (IntegerEnum | number)[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** * serializeAws_restJson1IntegerList */ const se_IntegerList = (input: number[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7555,7 +7509,7 @@ const se_NestedStringList = (input: string[][], context: __SerdeContext): any => return input .filter((e: any) => e != null) .map((entry) => { - return se_StringList(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -7563,12 +7517,7 @@ const se_NestedStringList = (input: string[][], context: __SerdeContext): any => * serializeAws_restJson1SparseStringList */ const se_SparseStringList = (input: string[], context: __SerdeContext): any => { - return input.map((entry) => { - if (entry === null) { - return null as any; - } - return entry; - }); + return input; }; /** @@ -7589,11 +7538,7 @@ const se_SparseStringMap = (input: Record, context: __SerdeConte * serializeAws_restJson1StringList */ const se_StringList = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7613,11 +7558,7 @@ const se_StringMap = (input: Record, context: __SerdeContext): a * serializeAws_restJson1StringSet */ const se_StringSet = (input: string[], context: __SerdeContext): any => { - return input - .filter((e: any) => e != null) - .map((entry) => { - return entry; - }); + return input.filter((e: any) => e != null); }; /** @@ -7635,7 +7576,7 @@ const se_TimestampList = (input: Date[], context: __SerdeContext): any => { * serializeAws_restJson1Unit */ const se_Unit = (input: Unit, context: __SerdeContext): any => { - return {}; + return take(input, {}); }; /** @@ -7672,7 +7613,7 @@ const de_DenseSetMap = (output: any, context: __SerdeContext): Record { } if (output.listValue != null) { return { - listValue: de_StringList(output.listValue, context), + listValue: _json(output.listValue) /* DEBUG_REMOVE yes elision */, }; } if (output.mapValue != null) { return { - mapValue: de_StringMap(output.mapValue, context), + mapValue: _json(output.mapValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectInt32(output.numberValue) !== undefined) { @@ -7740,7 +7681,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.renamedStructureValue != null) { return { - renamedStructureValue: de_RenamedGreeting(output.renamedStructureValue, context), + renamedStructureValue: _json(output.renamedStructureValue) /* DEBUG_REMOVE yes elision */, }; } if (__expectString(output.stringValue) !== undefined) { @@ -7748,7 +7689,7 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { } if (output.structureValue != null) { return { - structureValue: de_GreetingStruct(output.structureValue, context), + structureValue: _json(output.structureValue) /* DEBUG_REMOVE yes elision */, }; } if (output.timestampValue != null) { @@ -7763,19 +7704,19 @@ const de_MyUnion = (output: any, context: __SerdeContext): MyUnion => { * deserializeAws_restJson1NestedPayload */ const de_NestedPayload = (output: any, context: __SerdeContext): NestedPayload => { - return { - greeting: __expectString(output.greeting), - name: __expectString(output.name), - } as any; + return take(output, { + greeting: __expectString, + name: __expectString, + }) as any; }; /** * deserializeAws_restJson1PayloadConfig */ const de_PayloadConfig = (output: any, context: __SerdeContext): PayloadConfig => { - return { - data: __expectInt32(output.data), - } as any; + return take(output, { + data: __expectInt32, + }) as any; }; /** @@ -7784,7 +7725,7 @@ const de_PayloadConfig = (output: any, context: __SerdeContext): PayloadConfig = const de_PlayerAction = (output: any, context: __SerdeContext): PlayerAction => { if (output.quit != null) { return { - quit: de_Unit(output.quit, context), + quit: _json(output.quit) /* DEBUG_REMOVE yes elision */, }; } return { $unknown: Object.entries(output)[0] }; @@ -7797,10 +7738,10 @@ const de_RecursiveShapesInputOutputNested1 = ( output: any, context: __SerdeContext ): RecursiveShapesInputOutputNested1 => { - return { - foo: __expectString(output.foo), - nested: output.nested != null ? de_RecursiveShapesInputOutputNested2(output.nested, context) : undefined, - } as any; + return take(output, { + foo: __expectString, + nested: (_) => de_RecursiveShapesInputOutputNested2(_ /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -7810,13 +7751,10 @@ const de_RecursiveShapesInputOutputNested2 = ( output: any, context: __SerdeContext ): RecursiveShapesInputOutputNested2 => { - return { - bar: __expectString(output.bar), - recursiveMember: - output.recursiveMember != null - ? de_RecursiveShapesInputOutputNested1(output.recursiveMember, context) - : undefined, - } as any; + return take(output, { + bar: __expectString, + recursiveMember: (_) => de_RecursiveShapesInputOutputNested1(_ /* DEBUG_REMOVE no elision */, context), + }) as any; }; /** @@ -7897,7 +7835,7 @@ const de_SparseSetMap = (output: any, context: __SerdeContext): Record { - return { - a: __expectString(output.value), - b: __expectString(output.other), - } as any; + return take(output, { + a: [, __expectString, `value`], + b: [, __expectString, `other`], + }) as any; }; /** * deserializeAws_restJson1TestConfig */ const de_TestConfig = (output: any, context: __SerdeContext): TestConfig => { - return { - timeout: __expectInt32(output.timeout), - } as any; + return take(output, { + timeout: __expectInt32, + }) as any; }; /** @@ -7970,9 +7908,9 @@ const de_UnionWithJsonName = (output: any, context: __SerdeContext): UnionWithJs * deserializeAws_restJson1RenamedGreeting */ const de_RenamedGreeting = (output: any, context: __SerdeContext): RenamedGreeting => { - return { - salutation: __expectString(output.salutation), - } as any; + return take(output, { + salutation: __expectString, + }) as any; }; /** @@ -8037,9 +7975,9 @@ const de_FooEnumSet = (output: any, context: __SerdeContext): (FooEnum | string) * deserializeAws_restJson1GreetingStruct */ const de_GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; + return take(output, { + hi: __expectString, + }) as any; }; /** @@ -8110,7 +8048,7 @@ const de_NestedStringList = (output: any, context: __SerdeContext): string[][] = 'All elements of the non-sparse list "aws.protocoltests.shared#NestedStringList" must be non-null.' ); } - return de_StringList(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -8202,7 +8140,7 @@ const de_TimestampList = (output: any, context: __SerdeContext): Date[] => { * deserializeAws_restJson1Unit */ const de_Unit = (output: any, context: __SerdeContext): Unit => { - return {} as any; + return take(output, {}) as any; }; const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({ diff --git a/private/aws-restjson-validation-server/src/protocols/Aws_restJson1.ts b/private/aws-restjson-validation-server/src/protocols/Aws_restJson1.ts index b8de5ffb30a96..4c9a2230961b0 100644 --- a/private/aws-restjson-validation-server/src/protocols/Aws_restJson1.ts +++ b/private/aws-restjson-validation-server/src/protocols/Aws_restJson1.ts @@ -1,6 +1,7 @@ // smithy-typescript generated code import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; import { + _json, expectBoolean as __expectBoolean, expectByte as __expectByte, expectInt32 as __expectInt32, @@ -12,10 +13,11 @@ import { expectString as __expectString, expectUnion as __expectUnion, limitedParseFloat32 as __limitedParseFloat32, - map as __map, + map, parseEpochTimestamp as __parseEpochTimestamp, parseRfc3339DateTime as __parseRfc3339DateTime, parseRfc7231DateTime as __parseRfc7231DateTime, + take, } from "@aws-sdk/smithy-client"; import { Endpoint as __Endpoint, @@ -103,18 +105,13 @@ export const deserializeMalformedEnumRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.list != null) { - contents.list = de_EnumList(data.list, context); - } - if (data.map != null) { - contents.map = de_EnumMap(data.map, context); - } - if (data.string != null) { - contents.string = __expectString(data.string); - } - if (data.union != null) { - contents.union = de_EnumUnion(__expectUnion(data.union), context); - } + const doc = take(data, { + list: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + map: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + string: __expectString, + union: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -140,24 +137,15 @@ export const deserializeMalformedLengthRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.blob != null) { - contents.blob = context.base64Decoder(data.blob); - } - if (data.list != null) { - contents.list = de_LengthList(data.list, context); - } - if (data.map != null) { - contents.map = de_LengthMap(data.map, context); - } - if (data.maxString != null) { - contents.maxString = __expectString(data.maxString); - } - if (data.minString != null) { - contents.minString = __expectString(data.minString); - } - if (data.string != null) { - contents.string = __expectString(data.string); - } + const doc = take(data, { + blob: context.base64Decoder, + list: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + map: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + maxString: __expectString, + minString: __expectString, + string: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -183,24 +171,15 @@ export const deserializeMalformedLengthOverrideRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.blob != null) { - contents.blob = context.base64Decoder(data.blob); - } - if (data.list != null) { - contents.list = de_LengthList(data.list, context); - } - if (data.map != null) { - contents.map = de_LengthMap(data.map, context); - } - if (data.maxString != null) { - contents.maxString = __expectString(data.maxString); - } - if (data.minString != null) { - contents.minString = __expectString(data.minString); - } - if (data.string != null) { - contents.string = __expectString(data.string); - } + const doc = take(data, { + blob: context.base64Decoder, + list: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + map: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + maxString: __expectString, + minString: __expectString, + string: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -267,21 +246,14 @@ export const deserializeMalformedPatternRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.evilString != null) { - contents.evilString = __expectString(data.evilString); - } - if (data.list != null) { - contents.list = de_PatternList(data.list, context); - } - if (data.map != null) { - contents.map = de_PatternMap(data.map, context); - } - if (data.string != null) { - contents.string = __expectString(data.string); - } - if (data.union != null) { - contents.union = de_PatternUnion(__expectUnion(data.union), context); - } + const doc = take(data, { + evilString: __expectString, + list: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + map: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + string: __expectString, + union: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -307,18 +279,13 @@ export const deserializeMalformedPatternOverrideRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.list != null) { - contents.list = de_PatternListOverride(data.list, context); - } - if (data.map != null) { - contents.map = de_PatternMapOverride(data.map, context); - } - if (data.string != null) { - contents.string = __expectString(data.string); - } - if (data.union != null) { - contents.union = de_PatternUnionOverride(__expectUnion(data.union), context); - } + const doc = take(data, { + list: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + map: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + string: __expectString, + union: (_) => _json(__expectUnion(_)) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -344,51 +311,24 @@ export const deserializeMalformedRangeRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byte != null) { - contents.byte = __expectByte(data.byte); - } - if (data.float != null) { - contents.float = __limitedParseFloat32(data.float); - } - if (data.integer != null) { - contents.integer = __expectInt32(data.integer); - } - if (data.long != null) { - contents.long = __expectLong(data.long); - } - if (data.maxByte != null) { - contents.maxByte = __expectByte(data.maxByte); - } - if (data.maxFloat != null) { - contents.maxFloat = __limitedParseFloat32(data.maxFloat); - } - if (data.maxInteger != null) { - contents.maxInteger = __expectInt32(data.maxInteger); - } - if (data.maxLong != null) { - contents.maxLong = __expectLong(data.maxLong); - } - if (data.maxShort != null) { - contents.maxShort = __expectShort(data.maxShort); - } - if (data.minByte != null) { - contents.minByte = __expectByte(data.minByte); - } - if (data.minFloat != null) { - contents.minFloat = __limitedParseFloat32(data.minFloat); - } - if (data.minInteger != null) { - contents.minInteger = __expectInt32(data.minInteger); - } - if (data.minLong != null) { - contents.minLong = __expectLong(data.minLong); - } - if (data.minShort != null) { - contents.minShort = __expectShort(data.minShort); - } - if (data.short != null) { - contents.short = __expectShort(data.short); - } + const doc = take(data, { + byte: __expectByte, + float: __limitedParseFloat32, + integer: __expectInt32, + long: __expectLong, + maxByte: __expectByte, + maxFloat: __limitedParseFloat32, + maxInteger: __expectInt32, + maxLong: __expectLong, + maxShort: __expectShort, + minByte: __expectByte, + minFloat: __limitedParseFloat32, + minInteger: __expectInt32, + minLong: __expectLong, + minShort: __expectShort, + short: __expectShort, + }); + Object.assign(contents, doc); return contents; }; @@ -414,51 +354,24 @@ export const deserializeMalformedRangeOverrideRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.byte != null) { - contents.byte = __expectByte(data.byte); - } - if (data.float != null) { - contents.float = __limitedParseFloat32(data.float); - } - if (data.integer != null) { - contents.integer = __expectInt32(data.integer); - } - if (data.long != null) { - contents.long = __expectLong(data.long); - } - if (data.maxByte != null) { - contents.maxByte = __expectByte(data.maxByte); - } - if (data.maxFloat != null) { - contents.maxFloat = __limitedParseFloat32(data.maxFloat); - } - if (data.maxInteger != null) { - contents.maxInteger = __expectInt32(data.maxInteger); - } - if (data.maxLong != null) { - contents.maxLong = __expectLong(data.maxLong); - } - if (data.maxShort != null) { - contents.maxShort = __expectShort(data.maxShort); - } - if (data.minByte != null) { - contents.minByte = __expectByte(data.minByte); - } - if (data.minFloat != null) { - contents.minFloat = __limitedParseFloat32(data.minFloat); - } - if (data.minInteger != null) { - contents.minInteger = __expectInt32(data.minInteger); - } - if (data.minLong != null) { - contents.minLong = __expectLong(data.minLong); - } - if (data.minShort != null) { - contents.minShort = __expectShort(data.minShort); - } - if (data.short != null) { - contents.short = __expectShort(data.short); - } + const doc = take(data, { + byte: __expectByte, + float: __limitedParseFloat32, + integer: __expectInt32, + long: __expectLong, + maxByte: __expectByte, + maxFloat: __limitedParseFloat32, + maxInteger: __expectInt32, + maxLong: __expectLong, + maxShort: __expectShort, + minByte: __expectByte, + minFloat: __limitedParseFloat32, + minInteger: __expectInt32, + minLong: __expectLong, + minShort: __expectShort, + short: __expectShort, + }); + Object.assign(contents, doc); return contents; }; @@ -502,9 +415,10 @@ export const deserializeMalformedRequiredRequest = async ( } } const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.string != null) { - contents.string = __expectString(data.string); - } + const doc = take(data, { + string: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -530,51 +444,24 @@ export const deserializeMalformedUniqueItemsRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.blobList != null) { - contents.blobList = de_BlobSet(data.blobList, context); - } - if (data.booleanList != null) { - contents.booleanList = de_BooleanSet(data.booleanList, context); - } - if (data.byteList != null) { - contents.byteList = de_ByteSet(data.byteList, context); - } - if (data.dateTimeList != null) { - contents.dateTimeList = de_DateTimeSet(data.dateTimeList, context); - } - if (data.enumList != null) { - contents.enumList = de_FooEnumSet(data.enumList, context); - } - if (data.httpDateList != null) { - contents.httpDateList = de_HttpDateSet(data.httpDateList, context); - } - if (data.intEnumList != null) { - contents.intEnumList = de_IntegerEnumSet(data.intEnumList, context); - } - if (data.integerList != null) { - contents.integerList = de_IntegerSet(data.integerList, context); - } - if (data.listList != null) { - contents.listList = de_ListSet(data.listList, context); - } - if (data.longList != null) { - contents.longList = de_LongSet(data.longList, context); - } - if (data.shortList != null) { - contents.shortList = de_ShortSet(data.shortList, context); - } - if (data.stringList != null) { - contents.stringList = de_StringSet(data.stringList, context); - } - if (data.structureList != null) { - contents.structureList = de_StructureSet(data.structureList, context); - } - if (data.timestampList != null) { - contents.timestampList = de_TimestampSet(data.timestampList, context); - } - if (data.unionList != null) { - contents.unionList = de_UnionSet(data.unionList, context); - } + const doc = take(data, { + blobList: (_) => de_BlobSet(_ /* DEBUG_REMOVE no elision */, context), + booleanList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + byteList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + dateTimeList: (_) => de_DateTimeSet(_ /* DEBUG_REMOVE no elision */, context), + enumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + httpDateList: (_) => de_HttpDateSet(_ /* DEBUG_REMOVE no elision */, context), + intEnumList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + integerList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + listList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + longList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + shortList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + stringList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + structureList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + timestampList: (_) => de_TimestampSet(_ /* DEBUG_REMOVE no elision */, context), + unionList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + }); + Object.assign(contents, doc); return contents; }; @@ -600,9 +487,10 @@ export const deserializeRecursiveStructuresRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.union != null) { - contents.union = de_RecursiveUnionOne(__expectUnion(data.union), context); - } + const doc = take(data, { + union: (_) => de_RecursiveUnionOne(__expectUnion(_) /* DEBUG_REMOVE no elision */, context), + }); + Object.assign(contents, doc); return contents; }; @@ -628,9 +516,10 @@ export const deserializeSensitiveValidationRequest = async ( } const contents: any = map({}); const data: Record = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body"); - if (data.string != null) { - contents.string = __expectString(data.string); - } + const doc = take(data, { + string: __expectString, + }); + Object.assign(contents, doc); return contents; }; @@ -1129,7 +1018,6 @@ export const serializeFrameworkException = async ( } }; -const map = __map; export const serializeValidationExceptionError = async ( input: ValidationException, ctx: ServerSerdeContext @@ -1149,10 +1037,12 @@ export const serializeValidationExceptionError = async ( "content-type": "application/json", }); let body: any; - body = JSON.stringify({ - ...(input.fieldList != null && { fieldList: se_ValidationExceptionFieldList(input.fieldList, context) }), - ...(input.message != null && { message: input.message }), - }); + body = JSON.stringify( + take(input, { + fieldList: (_) => _json(_) /* DEBUG_REMOVE yes elision */, + message: [], + }) + ); return new __HttpResponse({ headers, body, @@ -1164,10 +1054,10 @@ export const serializeValidationExceptionError = async ( * serializeAws_restJson1ValidationExceptionField */ const se_ValidationExceptionField = (input: ValidationExceptionField, context: __SerdeContext): any => { - return { - ...(input.message != null && { message: input.message }), - ...(input.path != null && { path: input.path }), - }; + return take(input, { + message: [], + path: [], + }); }; /** @@ -1177,7 +1067,7 @@ const se_ValidationExceptionFieldList = (input: ValidationExceptionField[], cont return input .filter((e: any) => e != null) .map((entry) => { - return se_ValidationExceptionField(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); }; @@ -1248,7 +1138,7 @@ const de_LengthMap = (output: any, context: __SerdeContext): Record { * deserializeAws_restJson1GreetingStruct */ const de_GreetingStruct = (output: any, context: __SerdeContext): GreetingStruct => { - return { - hi: __expectString(output.hi), - } as any; + return take(output, { + hi: __expectString, + }) as any; }; /** @@ -1511,7 +1401,7 @@ const de_ListSet = (output: any, context: __SerdeContext): string[][] => { if (entry === null) { throw new TypeError('All elements of the non-sparse list "aws.protocoltests.shared#ListSet" must be non-null.'); } - return de_StringList(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -1580,7 +1470,7 @@ const de_StructureSet = (output: any, context: __SerdeContext): GreetingStruct[] 'All elements of the non-sparse list "aws.protocoltests.shared#StructureSet" must be non-null.' ); } - return de_GreetingStruct(entry, context); + return _json(entry) /* DEBUG_REMOVE yes elision */; }); return retVal; }; @@ -1608,7 +1498,7 @@ const de_UnionSet = (output: any, context: __SerdeContext): FooUnion[] => { if (entry === null) { throw new TypeError('All elements of the non-sparse list "aws.protocoltests.shared#UnionSet" must be non-null.'); } - return de_FooUnion(__expectUnion(entry), context); + return _json(__expectUnion(entry)) /* DEBUG_REMOVE yes elision */; }); return retVal; };