@mastra/dynamodb 1.3.3-alpha.0 → 1.3.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -89
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
# @mastra/dynamodb
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- Efficient single-table design for all Mastra storage needs
|
|
8
|
-
- Based on ElectroDB for type-safe DynamoDB access
|
|
9
|
-
- Support for AWS credentials, regions, and endpoints
|
|
10
|
-
- Compatible with AWS DynamoDB Local for development
|
|
11
|
-
- Thread, Message, Trace, Eval, and Workflow operations
|
|
12
|
-
- Optimized for serverless environments
|
|
3
|
+
Persist Mastra data in Amazon DynamoDB with a single-table ElectroDB design, configurable indexes, TTL support, credentials, and table initialization.
|
|
13
4
|
|
|
14
5
|
## Installation
|
|
15
6
|
|
|
16
7
|
```bash
|
|
17
8
|
npm install @mastra/dynamodb
|
|
18
|
-
# or
|
|
19
|
-
pnpm add @mastra/dynamodb
|
|
20
|
-
# or
|
|
21
|
-
yarn add @mastra/dynamodb
|
|
22
9
|
```
|
|
23
10
|
|
|
24
|
-
## Prerequisites
|
|
25
|
-
|
|
26
|
-
Before using this package, you need to create a DynamoDB table with the required structure. See [TABLE_SETUP.md](./TABLE_SETUP.md) for detailed instructions on how to set up the table using CloudFormation or AWS CDK.
|
|
27
|
-
|
|
28
11
|
## Usage
|
|
29
12
|
|
|
30
13
|
### Basic Usage
|
|
@@ -61,79 +44,14 @@ const memory = new Memory({
|
|
|
61
44
|
});
|
|
62
45
|
```
|
|
63
46
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
For local development, you can use DynamoDB Local:
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
const storage = new DynamoDBStore({
|
|
70
|
-
name: 'dynamodb',
|
|
71
|
-
config: {
|
|
72
|
-
region: 'us-east-1',
|
|
73
|
-
tableName: 'mastra-single-table',
|
|
74
|
-
endpoint: 'http://localhost:8000', // Local DynamoDB endpoint
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### AWS IAM Permissions
|
|
80
|
-
|
|
81
|
-
The IAM role or user used by this package needs the following permissions:
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"Version": "2012-10-17",
|
|
86
|
-
"Statement": [
|
|
87
|
-
{
|
|
88
|
-
"Effect": "Allow",
|
|
89
|
-
"Action": [
|
|
90
|
-
"dynamodb:DescribeTable",
|
|
91
|
-
"dynamodb:GetItem",
|
|
92
|
-
"dynamodb:PutItem",
|
|
93
|
-
"dynamodb:UpdateItem",
|
|
94
|
-
"dynamodb:DeleteItem",
|
|
95
|
-
"dynamodb:Query",
|
|
96
|
-
"dynamodb:Scan",
|
|
97
|
-
"dynamodb:BatchGetItem",
|
|
98
|
-
"dynamodb:BatchWriteItem"
|
|
99
|
-
],
|
|
100
|
-
"Resource": [
|
|
101
|
-
"arn:aws:dynamodb:*:*:table/${YOUR_TABLE_NAME}",
|
|
102
|
-
"arn:aws:dynamodb:*:*:table/${YOUR_TABLE_NAME}/index/*"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Configuration Options
|
|
110
|
-
|
|
111
|
-
The `DynamoDBStore` constructor accepts the following configuration options:
|
|
112
|
-
|
|
113
|
-
| Option | Type | Required | Description |
|
|
114
|
-
| -------------------- | ------ | -------- | ---------------------------------------------------------- |
|
|
115
|
-
| `name` | string | Yes | A name for the storage instance |
|
|
116
|
-
| `config.region` | string | No | AWS region (default: 'us-east-1') |
|
|
117
|
-
| `config.tableName` | string | Yes | The name of your DynamoDB table |
|
|
118
|
-
| `config.endpoint` | string | No | Custom endpoint for DynamoDB (e.g., for local development) |
|
|
119
|
-
| `config.credentials` | object | No | AWS credentials (accessKeyId, secretAccessKey) |
|
|
120
|
-
|
|
121
|
-
## Architectural Approach
|
|
122
|
-
|
|
123
|
-
This storage adapter utilizes a **single-table design pattern** leveraging [ElectroDB](https://electrodb.dev/), which is a common and recommended approach for DynamoDB. This differs architecturally from relational database adapters (like `@mastra/pg` or `@mastra/libsql`) that typically use multiple tables, each dedicated to a specific entity (threads, messages, etc.).
|
|
47
|
+
## Documentation
|
|
124
48
|
|
|
125
|
-
|
|
49
|
+
- [DynamoDB](https://mastra.ai/integrations/databases/dynamodb)
|
|
126
50
|
|
|
127
|
-
|
|
128
|
-
- **External Table Management:** Unlike some adapters that might offer helper functions to create tables via code, this adapter **expects the DynamoDB table and its associated Global Secondary Indexes (GSIs) to be provisioned externally** before use. Please refer to `TABLE_SETUP.md` for detailed instructions using tools like AWS CloudFormation or CDK. The adapter focuses solely on interacting with the pre-existing table structure.
|
|
129
|
-
- **Consistency via Interface:** While the underlying storage model differs, this adapter adheres to the same `MastraStorage` interface as other adapters, ensuring it can be used interchangeably within the Mastra `Memory` component.
|
|
51
|
+
## Changelog
|
|
130
52
|
|
|
131
|
-
|
|
53
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/dynamodb/CHANGELOG.md) for version history and release notes.
|
|
132
54
|
|
|
133
|
-
|
|
55
|
+
## Support
|
|
134
56
|
|
|
135
|
-
|
|
136
|
-
2. **Better performance**: Related data is stored together for faster access
|
|
137
|
-
3. **Simplified administration**: Only one table to monitor and back up
|
|
138
|
-
4. **Reduced complexity**: Consistent access patterns across entities
|
|
139
|
-
5. **Transaction support**: Atomic operations across different entity types
|
|
57
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-dynamodb
|
|
|
3
3
|
description: Documentation for @mastra/dynamodb. Use when working with @mastra/dynamodb APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/dynamodb"
|
|
6
|
-
version: "1.3.3-alpha.
|
|
6
|
+
version: "1.3.3-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/dynamodb",
|
|
3
|
-
"version": "1.3.3-alpha.
|
|
3
|
+
"version": "1.3.3-alpha.1",
|
|
4
4
|
"description": "DynamoDB storage adapter for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@internal/lint": "0.0.129",
|
|
42
42
|
"@internal/storage-test-utils": "0.0.125",
|
|
43
43
|
"@internal/types-builder": "0.0.104",
|
|
44
|
-
"@mastra/core": "1.64.0-alpha.
|
|
44
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://mastra.ai",
|
|
47
47
|
"repository": {
|