@mastra/dynamodb 1.0.0-beta.9 → 1.0.0

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +763 -0
  2. package/README.md +1 -2
  3. package/dist/docs/README.md +1 -1
  4. package/dist/docs/SKILL.md +1 -1
  5. package/dist/docs/SOURCE_MAP.json +1 -1
  6. package/dist/docs/storage/01-reference.md +93 -2
  7. package/dist/entities/eval.d.ts +8 -0
  8. package/dist/entities/eval.d.ts.map +1 -1
  9. package/dist/entities/index.d.ts +61 -4
  10. package/dist/entities/index.d.ts.map +1 -1
  11. package/dist/entities/message.d.ts +8 -0
  12. package/dist/entities/message.d.ts.map +1 -1
  13. package/dist/entities/resource.d.ts +8 -0
  14. package/dist/entities/resource.d.ts.map +1 -1
  15. package/dist/entities/score.d.ts +13 -4
  16. package/dist/entities/score.d.ts.map +1 -1
  17. package/dist/entities/thread.d.ts +8 -0
  18. package/dist/entities/thread.d.ts.map +1 -1
  19. package/dist/entities/trace.d.ts +8 -0
  20. package/dist/entities/trace.d.ts.map +1 -1
  21. package/dist/entities/utils.d.ts +90 -0
  22. package/dist/entities/utils.d.ts.map +1 -1
  23. package/dist/entities/workflow-snapshot.d.ts +8 -0
  24. package/dist/entities/workflow-snapshot.d.ts.map +1 -1
  25. package/dist/index.cjs +149 -30
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.js +147 -32
  28. package/dist/index.js.map +1 -1
  29. package/dist/storage/db/index.d.ts +18 -2
  30. package/dist/storage/db/index.d.ts.map +1 -1
  31. package/dist/storage/domains/memory/index.d.ts +3 -2
  32. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  33. package/dist/storage/domains/scores/index.d.ts +1 -0
  34. package/dist/storage/domains/scores/index.d.ts.map +1 -1
  35. package/dist/storage/domains/workflows/index.d.ts +1 -0
  36. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  37. package/dist/storage/index.d.ts +90 -2
  38. package/dist/storage/index.d.ts.map +1 -1
  39. package/dist/storage/ttl.d.ts +52 -0
  40. package/dist/storage/ttl.d.ts.map +1 -0
  41. package/package.json +5 -5
package/README.md CHANGED
@@ -45,9 +45,8 @@ const storage = new DynamoDBStore({
45
45
 
46
46
  // Initialize vector store (if using semantic recall)
47
47
  const vector = new PineconeVector({
48
+ id: 'dynamodb-pinecone',
48
49
  apiKey: process.env.PINECONE_API_KEY,
49
- environment: process.env.PINECONE_ENVIRONMENT,
50
- index: process.env.PINECONE_INDEX,
51
50
  });
52
51
 
53
52
  // Memory combines storage (like DynamoDBStore) with an optional vector store for recall
@@ -28,4 +28,4 @@ docs/
28
28
  ## Version
29
29
 
30
30
  Package: @mastra/dynamodb
31
- Version: 1.0.0-beta.9
31
+ Version: 1.0.0
@@ -5,7 +5,7 @@ description: Documentation for @mastra/dynamodb. Includes links to type definiti
5
5
 
6
6
  # @mastra/dynamodb Documentation
7
7
 
8
- > **Version**: 1.0.0-beta.9
8
+ > **Version**: 1.0.0
9
9
  > **Package**: @mastra/dynamodb
10
10
 
11
11
  ## Quick Navigation
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.0-beta.9",
2
+ "version": "1.0.0",
3
3
  "package": "@mastra/dynamodb",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -19,6 +19,7 @@ The DynamoDB storage implementation provides a scalable and performant NoSQL dat
19
19
  - Compatible with AWS DynamoDB Local for development
20
20
  - Stores Thread, Message, Trace, Eval, and Workflow data
21
21
  - Optimized for serverless environments
22
+ - Configurable TTL (Time To Live) for automatic data expiration per entity type
22
23
 
23
24
  ## Installation
24
25
 
@@ -46,7 +47,7 @@ import { DynamoDBStore } from "@mastra/dynamodb";
46
47
 
47
48
  // Initialize the DynamoDB storage
48
49
  const storage = new DynamoDBStore({
49
- name: "dynamodb", // A name for this storage instance
50
+ id: "dynamodb", // Unique identifier for this storage instance
50
51
  config: {
51
52
  tableName: "mastra-single-table", // Name of your DynamoDB table
52
53
  region: "us-east-1", // Optional: AWS region, defaults to 'us-east-1'
@@ -80,7 +81,7 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
80
81
  import { DynamoDBStore } from "@mastra/dynamodb";
81
82
 
82
83
  const storage = new DynamoDBStore({
83
- name: "dynamodb-local",
84
+ id: "dynamodb-local",
84
85
  config: {
85
86
  tableName: "mastra-single-table", // Ensure this table is created in your local DynamoDB
86
87
  region: "localhost", // Can be any string for local, 'localhost' is common
@@ -96,6 +97,96 @@ For local development, you can use [DynamoDB Local](https://docs.aws.amazon.com/
96
97
 
97
98
  ## Parameters
98
99
 
100
+ ## TTL (Time To Live) Configuration
101
+
102
+ DynamoDB TTL allows you to automatically delete items after a specified time period. This is useful for:
103
+
104
+ - **Cost optimization**: Automatically remove old data to reduce storage costs
105
+ - **Data lifecycle management**: Implement retention policies for compliance
106
+ - **Performance**: Prevent tables from growing indefinitely
107
+ - **Privacy compliance**: Automatically purge personal data after specified periods
108
+
109
+ ### Enabling TTL
110
+
111
+ To use TTL, you must:
112
+
113
+ 1. **Configure TTL in DynamoDBStore** (shown below)
114
+ 2. **Enable TTL on your DynamoDB table** via AWS Console or CLI, specifying the attribute name (default: `ttl`)
115
+
116
+ ```typescript
117
+ import { DynamoDBStore } from "@mastra/dynamodb";
118
+
119
+ const storage = new DynamoDBStore({
120
+ name: "dynamodb",
121
+ config: {
122
+ tableName: "mastra-single-table",
123
+ region: "us-east-1",
124
+ ttl: {
125
+ // Messages expire after 30 days
126
+ message: {
127
+ enabled: true,
128
+ defaultTtlSeconds: 30 * 24 * 60 * 60, // 30 days
129
+ },
130
+ // Threads expire after 90 days
131
+ thread: {
132
+ enabled: true,
133
+ defaultTtlSeconds: 90 * 24 * 60 * 60, // 90 days
134
+ },
135
+ // Traces expire after 7 days with custom attribute name
136
+ trace: {
137
+ enabled: true,
138
+ attributeName: "expiresAt", // Custom TTL attribute
139
+ defaultTtlSeconds: 7 * 24 * 60 * 60, // 7 days
140
+ },
141
+ // Workflow snapshots don't expire
142
+ workflow_snapshot: {
143
+ enabled: false,
144
+ },
145
+ },
146
+ },
147
+ });
148
+ ```
149
+
150
+ ### Supported Entity Types
151
+
152
+ TTL can be configured for these entity types:
153
+
154
+ | Entity | Description |
155
+ |--------|-------------|
156
+ | `thread` | Conversation threads |
157
+ | `message` | Messages within threads |
158
+ | `trace` | Observability traces |
159
+ | `eval` | Evaluation results |
160
+ | `workflow_snapshot` | Workflow state snapshots |
161
+ | `resource` | User/resource data |
162
+ | `score` | Scoring results |
163
+
164
+ ### TTL Entity Configuration
165
+
166
+ Each entity type accepts the following configuration:
167
+
168
+ ### Enabling TTL on Your DynamoDB Table
169
+
170
+ After configuring TTL in your code, you must enable TTL on the DynamoDB table itself:
171
+
172
+ **Using AWS CLI:**
173
+
174
+ ```bash
175
+ aws dynamodb update-time-to-live \
176
+ --table-name mastra-single-table \
177
+ --time-to-live-specification "Enabled=true, AttributeName=ttl"
178
+ ```
179
+
180
+ **Using AWS Console:**
181
+
182
+ 1. Go to the DynamoDB console
183
+ 2. Select your table
184
+ 3. Go to "Additional settings" tab
185
+ 4. Under "Time to Live (TTL)", click "Manage TTL"
186
+ 5. Enable TTL and specify the attribute name (default: `ttl`)
187
+
188
+ > **Note**: DynamoDB deletes expired items within 48 hours after expiration. Items remain queryable until actually deleted.
189
+
99
190
  ## AWS IAM Permissions
100
191
 
101
192
  The IAM role or user executing the code needs appropriate permissions to interact with the specified DynamoDB table and its indexes. Below is a sample policy. Replace `${YOUR_TABLE_NAME}` with your actual table name and `${YOUR_AWS_REGION}` and `${YOUR_AWS_ACCOUNT_ID}` with appropriate values.
@@ -70,6 +70,14 @@ export declare const evalEntity: Entity<string, string, string, {
70
70
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
71
71
  readonly get: (value?: string) => any;
72
72
  };
73
+ ttl: {
74
+ readonly type: "number";
75
+ readonly required: false;
76
+ };
77
+ expiresAt: {
78
+ readonly type: "number";
79
+ readonly required: false;
80
+ };
73
81
  entity: {
74
82
  type: "string";
75
83
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/entities/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;0BAwBH,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;0BAuBN,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;0BAkBN,IAAI,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB/B,CAAC"}
1
+ {"version":3,"file":"eval.d.ts","sourceRoot":"","sources":["../../src/entities/eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;0BAwBH,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;0BAuBN,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;0BAkBN,IAAI,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB/B,CAAC"}
@@ -39,6 +39,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
39
39
  readonly set: (value?: Date | string) => string;
40
40
  readonly default: () => string;
41
41
  };
42
+ ttl: {
43
+ readonly type: "number";
44
+ readonly required: false;
45
+ };
46
+ expiresAt: {
47
+ readonly type: "number";
48
+ readonly required: false;
49
+ };
42
50
  entity: {
43
51
  type: "string";
44
52
  required: true;
@@ -137,6 +145,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
137
145
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
138
146
  readonly get: (value?: string) => any;
139
147
  };
148
+ ttl: {
149
+ readonly type: "number";
150
+ readonly required: false;
151
+ };
152
+ expiresAt: {
153
+ readonly type: "number";
154
+ readonly required: false;
155
+ };
140
156
  entity: {
141
157
  type: "string";
142
158
  required: true;
@@ -237,6 +253,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
237
253
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
238
254
  readonly get: (value?: string) => any;
239
255
  };
256
+ ttl: {
257
+ readonly type: "number";
258
+ readonly required: false;
259
+ };
260
+ expiresAt: {
261
+ readonly type: "number";
262
+ readonly required: false;
263
+ };
240
264
  entity: {
241
265
  type: "string";
242
266
  required: true;
@@ -351,6 +375,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
351
375
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
352
376
  readonly get: (value?: string) => any;
353
377
  };
378
+ ttl: {
379
+ readonly type: "number";
380
+ readonly required: false;
381
+ };
382
+ expiresAt: {
383
+ readonly type: "number";
384
+ readonly required: false;
385
+ };
354
386
  entity: {
355
387
  type: "string";
356
388
  required: true;
@@ -434,6 +466,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
434
466
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
435
467
  readonly get: (value?: string) => any;
436
468
  };
469
+ ttl: {
470
+ readonly type: "number";
471
+ readonly required: false;
472
+ };
473
+ expiresAt: {
474
+ readonly type: "number";
475
+ readonly required: false;
476
+ };
437
477
  entity: {
438
478
  type: "string";
439
479
  required: true;
@@ -497,6 +537,14 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
497
537
  readonly set: (value?: Date | string) => string;
498
538
  readonly default: () => string;
499
539
  };
540
+ ttl: {
541
+ readonly type: "number";
542
+ readonly required: false;
543
+ };
544
+ expiresAt: {
545
+ readonly type: "number";
546
+ readonly required: false;
547
+ };
500
548
  entity: {
501
549
  type: "string";
502
550
  required: true;
@@ -616,6 +664,12 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
616
664
  set: (value?: Record<string, unknown> | string) => string | undefined;
617
665
  get: (value?: string) => any;
618
666
  };
667
+ metadata: {
668
+ type: "string";
669
+ required: false;
670
+ set: (value?: Record<string, unknown> | string) => string | undefined;
671
+ get: (value?: string) => any;
672
+ };
619
673
  requestContext: {
620
674
  type: "string";
621
675
  required: false;
@@ -661,10 +715,13 @@ export declare function getElectroDbService(client: DynamoDBDocumentClient, tabl
661
715
  readonly set: (value?: Date | string) => string;
662
716
  readonly default: () => string;
663
717
  };
664
- metadata: {
665
- readonly type: "string";
666
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
667
- readonly get: (value?: string) => any;
718
+ ttl: {
719
+ readonly type: "number";
720
+ readonly required: false;
721
+ };
722
+ expiresAt: {
723
+ readonly type: "number";
724
+ readonly required: false;
668
725
  };
669
726
  entity: {
670
727
  type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgBpF"}
@@ -68,6 +68,14 @@ export declare const messageEntity: Entity<string, string, string, {
68
68
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
69
69
  readonly get: (value?: string) => any;
70
70
  };
71
+ ttl: {
72
+ readonly type: "number";
73
+ readonly required: false;
74
+ };
75
+ expiresAt: {
76
+ readonly type: "number";
77
+ readonly required: false;
78
+ };
71
79
  entity: {
72
80
  type: "string";
73
81
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/entities/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;0BA+BN,MAAM;;;;;;;;;;;;;;;;;0BA8BN,MAAM,EAAE,GAAG,MAAM;0BAOjB,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM;0BAOlC,MAAM;;;;;0BAgBN,MAAM,EAAE,GAAG,MAAM;0BAOjB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,CAAC"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/entities/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;0BA+BN,MAAM;;;;;;;;;;;;;;;;;0BA8BN,MAAM,EAAE,GAAG,MAAM;0BAOjB,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM;0BAOlC,MAAM;;;;;0BAgBN,MAAM,EAAE,GAAG,MAAM;0BAOjB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxB,CAAC"}
@@ -33,6 +33,14 @@ export declare const resourceEntity: Entity<string, string, string, {
33
33
  readonly set: (value?: Date | string) => string;
34
34
  readonly default: () => string;
35
35
  };
36
+ ttl: {
37
+ readonly type: "number";
38
+ readonly required: false;
39
+ };
40
+ expiresAt: {
41
+ readonly type: "number";
42
+ readonly required: false;
43
+ };
36
44
  entity: {
37
45
  type: "string";
38
46
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/entities/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;0BA+BP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBxB,CAAC"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/entities/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;0BA+BP,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBxB,CAAC"}
@@ -100,6 +100,12 @@ export declare const scoreEntity: Entity<string, string, string, {
100
100
  set: (value?: Record<string, unknown> | string) => string | undefined;
101
101
  get: (value?: string) => any;
102
102
  };
103
+ metadata: {
104
+ type: "string";
105
+ required: false;
106
+ set: (value?: Record<string, unknown> | string) => string | undefined;
107
+ get: (value?: string) => any;
108
+ };
103
109
  requestContext: {
104
110
  type: "string";
105
111
  required: false;
@@ -145,10 +151,13 @@ export declare const scoreEntity: Entity<string, string, string, {
145
151
  readonly set: (value?: Date | string) => string;
146
152
  readonly default: () => string;
147
153
  };
148
- metadata: {
149
- readonly type: "string";
150
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
151
- readonly get: (value?: string) => any;
154
+ ttl: {
155
+ readonly type: "number";
156
+ readonly required: false;
157
+ };
158
+ expiresAt: {
159
+ readonly type: "number";
160
+ readonly required: false;
152
161
  };
153
162
  entity: {
154
163
  type: "string";
@@ -1 +1 @@
1
- {"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/entities/score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAmCJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;;;;;0BAoBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BA8CN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;0BAgBN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;0BAgBN,MAAM,CAAC,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,EAAE,OAAO,CAAC,GAAG,MAAM;0BAMhC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuExB,CAAC"}
@@ -37,6 +37,14 @@ export declare const threadEntity: Entity<string, string, string, {
37
37
  readonly set: (value?: Date | string) => string;
38
38
  readonly default: () => string;
39
39
  };
40
+ ttl: {
41
+ readonly type: "number";
42
+ readonly required: false;
43
+ };
44
+ expiresAt: {
45
+ readonly type: "number";
46
+ readonly required: false;
47
+ };
40
48
  entity: {
41
49
  type: "string";
42
50
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/entities/thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;0BA4BL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAOhC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BxB,CAAC"}
1
+ {"version":3,"file":"thread.d.ts","sourceRoot":"","sources":["../../src/entities/thread.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;0BA4BL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;0BAOhC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BxB,CAAC"}
@@ -84,6 +84,14 @@ export declare const traceEntity: Entity<string, string, string, {
84
84
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
85
85
  readonly get: (value?: string) => any;
86
86
  };
87
+ ttl: {
88
+ readonly type: "number";
89
+ readonly required: false;
90
+ };
91
+ expiresAt: {
92
+ readonly type: "number";
93
+ readonly required: false;
94
+ };
87
95
  entity: {
88
96
  type: "string";
89
97
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/entities/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAwCJ,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCxB,CAAC"}
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/entities/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAwCJ,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;0BAQN,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCxB,CAAC"}
@@ -1,3 +1,74 @@
1
+ /**
2
+ * Base fields shared by all entities
3
+ */
4
+ export interface BaseEntityData {
5
+ entity: string;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ metadata?: string;
9
+ ttl?: number;
10
+ expiresAt?: number;
11
+ }
12
+ export interface ThreadEntityData extends BaseEntityData {
13
+ entity: 'thread';
14
+ id: string;
15
+ resourceId: string;
16
+ title: string;
17
+ }
18
+ export interface MessageEntityData extends BaseEntityData {
19
+ entity: 'message';
20
+ id: string;
21
+ threadId?: string;
22
+ role: string;
23
+ type?: string;
24
+ content: string;
25
+ resourceId?: string;
26
+ toolCallIds?: string;
27
+ toolCallArgs?: string;
28
+ toolNames?: string;
29
+ }
30
+ export interface ResourceEntityData extends BaseEntityData {
31
+ entity: 'resource';
32
+ id: string;
33
+ workingMemory?: string;
34
+ }
35
+ export interface WorkflowSnapshotEntityData extends BaseEntityData {
36
+ entity: 'workflow_snapshot';
37
+ workflow_name: string;
38
+ run_id: string;
39
+ snapshot: string;
40
+ resourceId?: string;
41
+ }
42
+ export interface ScoreEntityData extends BaseEntityData {
43
+ entity: 'score';
44
+ id: string;
45
+ scorerId: string;
46
+ runId: string;
47
+ scorer: string;
48
+ score: number;
49
+ input: string;
50
+ output: string;
51
+ source: string;
52
+ traceId?: string;
53
+ spanId?: string;
54
+ reason?: string;
55
+ extractPrompt?: string;
56
+ analyzePrompt?: string;
57
+ reasonPrompt?: string;
58
+ generateScorePrompt?: string;
59
+ generateReasonPrompt?: string;
60
+ preprocessPrompt?: string;
61
+ extractStepResult?: string;
62
+ preprocessStepResult?: string;
63
+ analyzeStepResult?: string;
64
+ additionalContext?: string;
65
+ requestContext?: string;
66
+ entityType?: string;
67
+ entityData?: string;
68
+ entityId?: string;
69
+ resourceId?: string;
70
+ threadId?: string;
71
+ }
1
72
  export declare const baseAttributes: {
2
73
  readonly createdAt: {
3
74
  readonly type: "string";
@@ -17,5 +88,24 @@ export declare const baseAttributes: {
17
88
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
18
89
  readonly get: (value?: string) => any;
19
90
  };
91
+ /**
92
+ * TTL attribute for DynamoDB automatic item expiration.
93
+ * This is a Unix timestamp (epoch seconds) that indicates when the item should be deleted.
94
+ *
95
+ * Note: For TTL to work, you must enable TTL on your DynamoDB table
96
+ * specifying this attribute name (default: 'ttl').
97
+ */
98
+ readonly ttl: {
99
+ readonly type: "number";
100
+ readonly required: false;
101
+ };
102
+ /**
103
+ * Alternative TTL attribute with configurable name.
104
+ * Use this if you've configured TTL on your DynamoDB table with 'expiresAt' as the attribute name.
105
+ */
106
+ readonly expiresAt: {
107
+ readonly type: "number";
108
+ readonly required: false;
109
+ };
20
110
  };
21
111
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/entities/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;+BAMT,IAAI,GAAG,MAAM;;;;;;+BAab,IAAI,GAAG,MAAM;;;;;+BAYb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;+BAOhC,MAAM;;CAYd,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/entities/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAiB,SAAQ,cAAc;IACtD,MAAM,EAAE,QAAQ,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,MAAM,EAAE,SAAS,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;I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C,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,cAAc;;;;;+BAMT,IAAI,GAAG,MAAM;;;;;;+BAab,IAAI,GAAG,MAAM;;;;;+BAYb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;+BAOhC,MAAM;;IAYtB;;;;;;OAMG;;;;;IAKH;;;OAGG;;;;;CAKK,CAAC"}
@@ -42,6 +42,14 @@ export declare const workflowSnapshotEntity: Entity<string, string, string, {
42
42
  readonly set: (value?: Record<string, unknown> | string) => string | undefined;
43
43
  readonly get: (value?: string) => any;
44
44
  };
45
+ ttl: {
46
+ readonly type: "number";
47
+ readonly required: false;
48
+ };
49
+ expiresAt: {
50
+ readonly type: "number";
51
+ readonly required: false;
52
+ };
45
53
  entity: {
46
54
  type: "string";
47
55
  required: true;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-snapshot.d.ts","sourceRoot":"","sources":["../../src/entities/workflow-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;0BAwBf,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBxB,CAAC"}
1
+ {"version":3,"file":"workflow-snapshot.d.ts","sourceRoot":"","sources":["../../src/entities/workflow-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;0BAwBf,GAAG;0BAOH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBxB,CAAC"}