From 0cbe0e11abd241b71147be36e1ab6cdf87e809ba Mon Sep 17 00:00:00 2001 From: Olli Date: Tue, 12 Mar 2024 19:14:28 +0200 Subject: [PATCH] add installation and basic usage guide --- README.md | 34 ++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82e8e3e..308707f 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,38 @@ Usable with AWS SDK v3 `DynamoDBDocumentClient`. ![](https://github.com/woltsu/tsynamo/blob/main/assets/demo.gif) +## Installation + +Available in [NPM](https://www.npmjs.com/package/tsynamo). + +```bash +npm i tsynamo +pnpm install tsynamo +yarn add tsynamo +``` + +## Usage + +First, create the types for your DynamoDB tables: + +```ts +import { PartitionKey, SortKey } from "tsynamo"; + +export interface DDB { + UserEvents: { + userId: PartitionKey; + eventId: SortKey; + eventType: string; + }; +} +``` + +and then, pass that to the Tsynamo instance: + +```ts +const tsynamoClient = new Tsynamo({ + ddbClient: dynamoDbDocumentClient, +}); +``` + diff --git a/package.json b/package.json index 58b8df4..bfc3bdd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tsynamo", "author": "woltsu", - "version": "0.0.2", + "version": "0.0.3", "description": "Typed query builder for DynamoDB", "main": "dist/index.js", "types": "dist/index.d.ts",