# dynamo-parser

> _Parse, don't validate_ This package is in early development, and things may change at any time!

Latest version **0.2.0-alpha** (published 2021-01-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install dynamo-parser
pnpm add dynamo-parser
yarn add dynamo-parser
bun add dynamo-parser
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0-alpha |
| Published | 2021-01-06 |
| First published | 2020-12-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 2 |
| Unpacked size | 273.1 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| Author | Randy Halim |
| Maintainers | fcrh |

## Links

- npm: https://www.npmjs.com/package/dynamo-parser
- npm.io page: https://npm.io/package/dynamo-parser

## Dependencies (2)

- [zod](https://npm.io/package/zod.md) ^2.0.0-beta.29
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.811.0

## Recent versions

- 0.2.0-alpha (latest) — 2021-01-06
- 0.1.4-alpha — 2020-12-19
- 0.1.3-alpha — 2020-12-18
- 0.1.2-alpha — 2020-12-17
- 0.1.1-alpha — 2020-12-16
- 0.1.0-alpha — 2020-12-16

## README

# dynamo-parser

_Parse, don't validate_  
This package is in early development, and things may change at any time!

`dynamo-parser` is a tool to work with AWS DynamoDB built with TypeScript. Using the power of [zod](https://github.com/colinhacks/zod), you get static type inference as well as ensuring that all your records match your schema!

# Installation

```zsh
# with yarn
yarn add dynamo-parser

# or npm
npm i dynamo-parser
```

# Usage

Your journey starts with the `Item`:

```ts
import { Item } from 'dynamo-parser';
import z from 'zod';

const Book = new Item(
  'books-table',
  {
    title: z.string(),
    rating: z
      .number()
      .min(1)
      .max(5),
  },
  ['title']
);
```

`Item` needs a table name, the schema of your item, and the primary attribute names of the item. You can optionally specify other options, including plugging in your own instance of `AWS.DynamoDB.DocumentClient` (defaults to `"us-west-2"`).

You can then call various methods on your `Item`, including:

```ts
Book.new({
  title: 'Ready Player One',
  rating: 5,
});
Book.get({ title: 'Ready Player Two' });
Book.all(); // get all items from the table
```

---

Created with 💖 with tsdx.

---
_Source: https://npm.io/package/dynamo-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
