AWS SDK v3 adapter for @patternmeshjs/core.
It turns a DynamoDBDocumentClient into the DynamoAdapter interface used by
patternmesh repositories and transaction services.
pnpm add @patternmeshjs/aws-sdk-v3 @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { createAwsSdkV3Adapter } from "@patternmeshjs/aws-sdk-v3";
const base = new DynamoDBClient({ region: "us-east-1" });
const doc = DynamoDBDocumentClient.from(base);
const adapter = createAwsSdkV3Adapter(doc);
DynamoDBClient / DynamoDBDocumentClientimport { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { NodeHttpHandler } from "@smithy/node-http-handler";
import { createAwsSdkV3Adapter } from "@patternmeshjs/aws-sdk-v3";
const base = new DynamoDBClient({
region: "us-east-1",
retryMode: "adaptive",
maxAttempts: 5,
requestHandler: new NodeHttpHandler({
connectionTimeout: 2_000,
requestTimeout: 5_000,
}),
});
const doc = DynamoDBDocumentClient.from(base);
const adapter = createAwsSdkV3Adapter(doc);
const base = new DynamoDBClient({
region: "us-east-1",
endpoint: process.env.DYNAMODB_ENDPOINT,
credentials: { accessKeyId: "local", secretAccessKey: "local" },
});
batchWriteItem is a single-table adapter surface in this library. Mixed
tables in one request are not supported.
An empty batch write now throws instead of silently succeeding.
docker compose up -d dynamodb-local
export DYNAMODB_ENDPOINT=http://localhost:8000
pnpm build
pnpm --filter @patternmeshjs/aws-sdk-v3 test
Without DYNAMODB_ENDPOINT, Local integration tests are skipped.