Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public void generateSharedComponents(GenerationContext context) {
AwsProtocolUtils.generateXmlParseBody(context);
AwsProtocolUtils.generateXmlParseErrorBody(context);
AwsProtocolUtils.generateBuildFormUrlencodedString(context);
AwsProtocolUtils.addItempotencyAutofillImport(context);

TypeScriptWriter writer = context.getWriter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,29 +238,6 @@ static boolean writeXmlNamespace(GenerationContext context, Shape shape, String
return true;
}

/**
* Imports a UUID v4 generating function used for auto-filling idempotency tokens.
*
* @param context The generation context.
*/
static void addItempotencyAutofillImport(GenerationContext context) {
// servers do not autogenerate idempotency tokens during deserialization
if (!context.getSettings().generateClient()) {
return;
}
context.getModel().shapes(MemberShape.class)
.filter(memberShape -> memberShape.hasTrait(IdempotencyTokenTrait.class))
.findFirst()
.ifPresent(memberShape -> {
TypeScriptWriter writer = context.getWriter();

// Include the uuid package and import the v4 function as our more clearly named alias.
writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);
});
}

/**
* Writes a statement that auto-fills the value of a member that is an idempotency
* token if it is undefined at the time of serialization.
Expand All @@ -273,6 +250,10 @@ static void writeIdempotencyAutofill(GenerationContext context, MemberShape memb
if (memberShape.hasTrait(IdempotencyTokenTrait.class)) {
TypeScriptWriter writer = context.getWriter();

writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);

writer.openBlock("if ($L === undefined) {", "}", inputLocation, () ->
writer.write("$L = generateIdempotencyToken();", inputLocation));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public void generateSharedComponents(GenerationContext context) {
AwsProtocolUtils.generateXmlParseBody(context);
AwsProtocolUtils.generateXmlParseErrorBody(context);
AwsProtocolUtils.generateBuildFormUrlencodedString(context);
AwsProtocolUtils.addItempotencyAutofillImport(context);

TypeScriptWriter writer = context.getWriter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public void generateSharedComponents(GenerationContext context) {
super.generateSharedComponents(context);
AwsProtocolUtils.generateXmlParseBody(context);
AwsProtocolUtils.generateXmlParseErrorBody(context);
AwsProtocolUtils.addItempotencyAutofillImport(context);

TypeScriptWriter writer = context.getWriter();
writer.addDependency(AwsDependency.XML_BUILDER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public void generateSharedComponents(GenerationContext context) {
super.generateSharedComponents(context);
AwsProtocolUtils.generateJsonParseBody(context);
AwsProtocolUtils.generateJsonParseErrorBody(context);
AwsProtocolUtils.addItempotencyAutofillImport(context);

TypeScriptWriter writer = context.getWriter();
writer.addUseImports(getApplicationProtocol().getResponseType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ public void serializeStructure(GenerationContext context, StructureShape shape)

if (hasJsonName) {
if (memberShape.hasTrait(IdempotencyTokenTrait.class)) {
writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);
writer.write("'$L': [true, _ => _ ?? generateIdempotencyToken(), `$L`],", wireName, memberName);
} else {
if (valueProvider.equals("_ => _")) {
Expand All @@ -183,6 +186,9 @@ public void serializeStructure(GenerationContext context, StructureShape shape)
}
} else {
if (memberShape.hasTrait(IdempotencyTokenTrait.class)) {
writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);
writer.write("'$L': [true, _ => _ ?? generateIdempotencyToken()],", memberName);
} else {
if (valueProvider.equals("_ => _")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public void generateSharedComponents(GenerationContext context) {
super.generateSharedComponents(context);
AwsProtocolUtils.generateJsonParseBody(context);
AwsProtocolUtils.generateJsonParseErrorBody(context);
AwsProtocolUtils.addItempotencyAutofillImport(context);

TypeScriptWriter writer = context.getWriter();
writer.addUseImports(getApplicationProtocol().getResponseType());
Expand Down Expand Up @@ -351,6 +350,9 @@ private void serializeDocumentBody(GenerationContext context, List<HttpBinding>

if (hasJsonName) {
if (memberShape.hasTrait(IdempotencyTokenTrait.class)) {
writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);
writer.write("'$L': [true,_ => _ ?? generateIdempotencyToken(),`$L`],",
wireName, memberName);
} else {
Expand All @@ -362,6 +364,9 @@ private void serializeDocumentBody(GenerationContext context, List<HttpBinding>
}
} else {
if (memberShape.hasTrait(IdempotencyTokenTrait.class)) {
writer.addDependency(TypeScriptDependency.UUID);
writer.addDependency(TypeScriptDependency.UUID_TYPES);
writer.addImport("v4", "generateIdempotencyToken", TypeScriptDependency.UUID);
writer.write("'$L': [true, _ => _ ?? generateIdempotencyToken()],", wireName);
} else {
if (valueProvider.equals("_ => _")) {
Expand Down
4 changes: 1 addition & 3 deletions private/aws-echo-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
1 change: 0 additions & 1 deletion private/aws-echo-service/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

/**
* serializeAws_restJson1EchoCommand
Expand Down
4 changes: 1 addition & 3 deletions private/aws-protocoltests-json-10/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import {
ContentTypeParametersCommandInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import { PredictCommandInput, PredictCommandOutput } from "../commands/PredictCommand";
import { MachineLearningServiceException as __BaseException } from "../models/MachineLearningServiceException";
Expand Down
4 changes: 1 addition & 3 deletions private/aws-protocoltests-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import {
ContentTypeParametersCommandInput,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import { GetRestApisCommandInput, GetRestApisCommandOutput } from "../commands/GetRestApisCommand";
import { APIGatewayServiceException as __BaseException } from "../models/APIGatewayServiceException";
Expand Down
4 changes: 1 addition & 3 deletions private/aws-protocoltests-restjson-glacier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

import { UploadArchiveCommandInput, UploadArchiveCommandOutput } from "../commands/UploadArchiveCommand";
import {
Expand Down
4 changes: 1 addition & 3 deletions private/weather-legacy-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

/**
* serializeAws_restJson1OnlyCustomAuthCommand
Expand Down
4 changes: 1 addition & 3 deletions private/weather/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@
"@smithy/util-middleware": "^4.1.1",
"@smithy/util-retry": "^4.1.2",
"@smithy/util-utf8": "^4.1.0",
"@types/uuid": "^9.0.1",
"tslib": "^2.6.2",
"uuid": "^9.0.1"
"tslib": "^2.6.2"
},
"devDependencies": {
"@tsconfig/node18": "18.2.4",
Expand Down
1 change: 0 additions & 1 deletion private/weather/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ import {
ResponseMetadata as __ResponseMetadata,
SerdeContext as __SerdeContext,
} from "@smithy/types";
import { v4 as generateIdempotencyToken } from "uuid";

/**
* serializeAws_restJson1OnlyCustomAuthCommand
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-clients/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Update this commit when taking up new changes from smithy-typescript.
module.exports = {
// Use full commit hash as we explicitly fetch it.
SMITHY_TS_COMMIT: "db1947fae12619ba48a32c1ae4398d3a0a6d845d",
SMITHY_TS_COMMIT: "568d71789cca2c66ab7c84686a9071c32f8c395c",
};

if (module.exports.SMITHY_TS_COMMIT.length < 40) {
Expand Down
16 changes: 0 additions & 16 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -444,13 +442,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
vitest: "npm:^3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -500,13 +496,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
vitest: "npm:^3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -664,13 +658,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
vitest: "npm:^3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -830,13 +822,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
vitest: "npm:^3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -888,13 +878,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
vitest: "npm:^3.2.4"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -24918,13 +24906,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -24972,13 +24958,11 @@ __metadata:
"@smithy/util-utf8": "npm:^4.1.0"
"@tsconfig/node18": "npm:18.2.4"
"@types/node": "npm:^18.19.69"
"@types/uuid": "npm:^9.0.1"
concurrently: "npm:7.0.0"
downlevel-dts: "npm:0.10.1"
rimraf: "npm:3.0.2"
tslib: "npm:^2.6.2"
typescript: "npm:~5.8.3"
uuid: "npm:^9.0.1"
languageName: unknown
linkType: soft

Expand Down
Loading