Skip to content

daveharig/amazon-dax-client-v3

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amazon DAX Client for JavaScript AWS sdk-v3

The official version of amazon-dax-client does not work with AWS's javascript sdk-v3.

This is a port of the library that works with sdk-v3.

Installing

The Amazon DAX client only runs from NodeJS, and can be installed using npm:

npm install amazon-dax-client-sdkv3

https://www.npmjs.com/package/amazon-dax-client-sdkv3

Usage and Getting Started

Using Document Client

import AmazonDaxClient from "amazon-dax-client-sdkv3";
import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";

const documentDaxClient = new AmazonDaxClient({
    client: DynamoDBDocumentClient.from(new DynamoDBClient({
        endpoint: process.env.dax,
        region: 'us-east-2'
    }))
});

const putItem = new PutCommand({
    TableName: 'test',
    Item: {
        CommonName: `${id}`
    }
});

await documentDaxClient.send(putItem);

Using Low Level Client

import AmazonDaxClient from "amazon-dax-client-sdkv3";
import { GetItemCommand } from "@aws-sdk/client-dynamodb";

const daxEndpoint = process.env.dax;
const lowLevelDaxClient = new AmazonDaxClient({
    client: new DynamoDBClient({
        region: 'us-east-1',
        endpoint: daxEndpoint
    })
});

const params = {
    TableName: 'test',
    Key: {
        CommonName: { S: 'example-id' }
    }
};

const getItemCommand = new GetItemCommand(params);
const response = await daxClient.send(getItemCommand);
console.log(response.Item);

You can see more examples under the test folder

About

AWS JS SDK v3 compatible dax client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.7%
  • TypeScript 1.2%
  • ANTLR 1.1%