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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions javascriptv3/example_code/dynamodb/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "dynamodb-examples",
"version": "1.0.0",
"author": "Brian Murray <brmur@amazon.com>",
"author": "Brian Murray <brmur@amazon.com> and Corey Pyle <corepyle@amazon.com",
"license": "Apache-2.0",
"type": "module",
"scripts": {
"test": "echo 'No test script found.'"
},
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.208.0",
"@aws-sdk/lib-dynamodb": "^3.208.0",
"@aws-sdk/client-dynamodb": "^3.210.0",
"@aws-sdk/lib-dynamodb": "^3.210.0",
"ramda": "^0.28.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const getMovie = async (tableName, title, year) => {
TableName: tableName,
Key: {
title,
year,
year
},
// By default, reads are eventually consistent. "ConsistentRead: true" represents
// a strongly consistent read. This guarantees that the most up-to-date data is returned. It
Expand Down Expand Up @@ -308,7 +308,6 @@ const deleteTable = async (tableName) => {
{ TableName: tableName }
);
};

export const runScenario = async ({
tableName,
newMovieName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ describe("dynamodb_basics#run", () => {

it("should successfully run", async () => {
await runScenario(
"myNewTable",
"myMovieName",
2022,
"This Is the End",
2013,
200,
"A coder cracks code..."
{
tableName: "myNewTable",
newMovieName: "myMovieName",
newMovieYear: 2022,
existingMovieName: "This Is the End",
existingMovieYear: 2013,
newMovieRank: 200,
newMoviePlot: "A coder cracks code...",
moviesPath: "../../../../../../resources/sample_files/movies.json",
}
);
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"author": "Brian Murray <brmur@amazon.com>",
"author": "Brian Murray <brmur@amazon.com> and Corey Pyle <corepyle@amazon.com>",
"license": "Apache 2.0",
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.210.0",
Expand Down
1,264 changes: 583 additions & 681 deletions javascriptv3/example_code/dynamodb/scenarios/dynamodb_basics/tests/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ Inputs (replace in code):
// snippet-start:[dynamodb.JavaScript.scenario.partiQL.basics.createclientv3]
// Create the DynamoDB service client module using ES6 syntax.
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
// Set the AWS Region.
export const REGION = "eu-west-1"; // For example, "us-east-1".
import { DEFAULT_REGION } from "../../../../libs/utils/util-aws-sdk.js";
// Create an Amazon DynamoDB service client object.
export const ddbClient = new DynamoDBClient({ region: REGION });
export const ddbClient = new DynamoDBClient({ region: DEFAULT_REGION });
// snippet-end:[dynamodb.JavaScript.scenario.partiQL.basics.createclientv3]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const marshallOptions = {
// Whether to automatically convert empty strings, blobs, and sets to `null`.
convertEmptyValues: false, // false, by default.
// Whether to remove undefined values while marshalling.
removeUndefinedValues: false, // false, by default.
removeUndefinedValues: true, // false, by default.
// Whether to convert typeof object to map attribute.
convertClassInstanceToMap: false, // false, by default.
};
Expand All @@ -30,10 +30,11 @@ const unmarshallOptions = {
wrapNumbers: false, // false, by default.
};

const translateConfig = { marshallOptions, unmarshallOptions };

// Create the DynamoDB document client.
const ddbDocClient = DynamoDBDocumentClient.from(ddbClient, translateConfig);
const ddbDocClient = DynamoDBDocumentClient.from(ddbClient, {
marshallOptions,
unmarshallOptions,
});

export { ddbDocClient };
// snippet-end:[dynamodb.JavaScript.scenario.partiQL.createdocclientv3]
Loading