1.3.43 • Published 9 months ago

@adobe/spacecat-shared-dynamo v1.3.43

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

Dynamo Client

Overview

This package, @adobe/spacecat-shared-dynamo, is a shared module designed for interacting with Amazon DynamoDB. It is a part of the Spacecat Services, providing a streamlined interface for DynamoDB operations.

Features

  • Query Operations: Perform read operations using primary or secondary indexes.
  • Get Item: Retrieve single items from DynamoDB using a table name and key.
  • Put Item: Insert or update items in DynamoDB.
  • Remove Item: Delete items from a DynamoDB table.

Installation

Install the package using npm:

npm install @adobe/spacecat-shared-dynamo

Usage

First, import the createClient function from the package:

import { createClient } from '@adobe/spacecat-shared-dynamo';

Then, use it to create a DynamoDB client:

const dynamoClient = createClient();

API Overview

  • query(params): Queries DynamoDB with the specified parameters.
  • getItem(tableName, key): Retrieves an item from a specified table using a key.
  • putItem(tableName, item): Inserts or updates an item in the specified table.
  • removeItem(tableName, key): Removes an item from the specified table.

Example

const tableName = 'YourTableName';
const key = { primaryKey: 'YourPrimaryKey' };

// Get an item
const item = await dynamoClient.getItem(tableName, key);

// Put an item
await dynamoClient.putItem(tableName, { primaryKey: 'NewKey', data: 'YourData' });

// Query
const queryResult = await dynamoClient.query({ TableName: tableName, KeyConditionExpression: 'primaryKey = :pk', ExpressionAttributeValues: { ':pk': 'YourPrimaryKey' } });

// Remove an item
await dynamoClient.removeItem(tableName, key);

Testing

Run the included tests with the following command:

npm test

Linting

Lint the codebase using:

npm run lint

Cleaning

To clean the package (remove node_modules and package-lock.json):

npm run clean

Repository

Find the source code and contribute here.

Issues

Report issues or bugs here.

License

This project is licensed under the Apache-2.0 License.

1.3.43

9 months ago

1.3.42

9 months ago

1.3.41

9 months ago

1.3.39

9 months ago

1.3.38

10 months ago

1.3.40

9 months ago

1.3.35

10 months ago

1.3.36

10 months ago

1.3.37

10 months ago

1.3.21

1 year ago

1.3.24

1 year ago

1.3.25

1 year ago

1.3.22

1 year ago

1.3.23

1 year ago

1.3.28

12 months ago

1.3.29

12 months ago

1.3.26

1 year ago

1.3.27

1 year ago

1.3.31

11 months ago

1.3.32

11 months ago

1.3.30

12 months ago

1.3.33

11 months ago

1.3.34

11 months ago

1.3.20

1 year ago

1.3.19

1 year ago

1.3.18

1 year ago

1.3.17

1 year ago

1.3.16

1 year ago

1.3.15

1 year ago

1.3.14

1 year ago

1.3.13

1 year ago

1.3.12

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.3.5

1 year ago

1.3.4

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago