@mastra/dynamodb 0.13.3 → 0.14.0-alpha.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 (44) hide show
  1. package/dist/entities/eval.d.ts +102 -0
  2. package/dist/entities/eval.d.ts.map +1 -0
  3. package/dist/entities/index.d.ts +746 -0
  4. package/dist/entities/index.d.ts.map +1 -0
  5. package/dist/entities/message.d.ts +100 -0
  6. package/dist/entities/message.d.ts.map +1 -0
  7. package/dist/entities/resource.d.ts +54 -0
  8. package/dist/entities/resource.d.ts.map +1 -0
  9. package/dist/entities/score.d.ts +229 -0
  10. package/dist/entities/score.d.ts.map +1 -0
  11. package/dist/entities/thread.d.ts +69 -0
  12. package/dist/entities/thread.d.ts.map +1 -0
  13. package/dist/entities/trace.d.ts +127 -0
  14. package/dist/entities/trace.d.ts.map +1 -0
  15. package/dist/entities/utils.d.ts +21 -0
  16. package/dist/entities/utils.d.ts.map +1 -0
  17. package/dist/entities/workflow-snapshot.d.ts +74 -0
  18. package/dist/entities/workflow-snapshot.d.ts.map +1 -0
  19. package/dist/index.cjs +36 -2
  20. package/dist/index.cjs.map +1 -0
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +36 -2
  24. package/dist/index.js.map +1 -0
  25. package/dist/storage/domains/legacy-evals/index.d.ts +19 -0
  26. package/dist/storage/domains/legacy-evals/index.d.ts.map +1 -0
  27. package/dist/storage/domains/memory/index.d.ts +77 -0
  28. package/dist/storage/domains/memory/index.d.ts.map +1 -0
  29. package/dist/storage/domains/operations/index.d.ts +69 -0
  30. package/dist/storage/domains/operations/index.d.ts.map +1 -0
  31. package/dist/storage/domains/score/index.d.ts +42 -0
  32. package/dist/storage/domains/score/index.d.ts.map +1 -0
  33. package/dist/storage/domains/traces/index.d.ts +28 -0
  34. package/dist/storage/domains/traces/index.d.ts.map +1 -0
  35. package/dist/storage/domains/workflows/index.d.ts +32 -0
  36. package/dist/storage/domains/workflows/index.d.ts.map +1 -0
  37. package/dist/storage/index.d.ts +220 -0
  38. package/dist/storage/index.d.ts.map +1 -0
  39. package/package.json +6 -6
  40. package/src/entities/score.ts +32 -0
  41. package/src/storage/domains/score/index.ts +6 -3
  42. package/dist/_tsup-dts-rollup.d.cts +0 -1977
  43. package/dist/_tsup-dts-rollup.d.ts +0 -1977
  44. package/dist/index.d.cts +0 -2
@@ -1,1977 +0,0 @@
1
- import type { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
2
- import { Entity } from 'electrodb';
3
- import type { EvalRow } from '@mastra/core/storage';
4
- import { LegacyEvalsStorage } from '@mastra/core/storage';
5
- import type { MastraMessageContentV2 } from '@mastra/core/agent';
6
- import type { MastraMessageV1 } from '@mastra/core/memory';
7
- import type { MastraMessageV2 } from '@mastra/core/memory';
8
- import { MastraStorage } from '@mastra/core/storage';
9
- import { MemoryStorage } from '@mastra/core/storage';
10
- import type { PaginationArgs } from '@mastra/core/storage';
11
- import type { PaginationInfo } from '@mastra/core/storage';
12
- import type { ScoreRowData } from '@mastra/core/scores';
13
- import { ScoresStorage } from '@mastra/core/storage';
14
- import { Service } from 'electrodb';
15
- import type { StorageColumn } from '@mastra/core/storage';
16
- import type { StorageDomains } from '@mastra/core/storage';
17
- import type { StorageGetMessagesArg } from '@mastra/core/storage';
18
- import type { StorageGetTracesArg } from '@mastra/core/storage';
19
- import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
20
- import type { StoragePagination } from '@mastra/core/storage';
21
- import type { StorageResourceType } from '@mastra/core/storage';
22
- import type { StorageThreadType } from '@mastra/core/memory';
23
- import { StoreOperations } from '@mastra/core/storage';
24
- import type { TABLE_NAMES } from '@mastra/core/storage';
25
- import type { Trace } from '@mastra/core/telemetry';
26
- import { TracesStorage } from '@mastra/core/storage';
27
- import type { WorkflowRun } from '@mastra/core/storage';
28
- import type { WorkflowRuns } from '@mastra/core/storage';
29
- import type { WorkflowRunState } from '@mastra/core/workflows';
30
- import { WorkflowsStorage } from '@mastra/core/storage';
31
-
32
- export declare const baseAttributes: {
33
- readonly createdAt: {
34
- readonly type: "string";
35
- readonly required: true;
36
- readonly readOnly: true;
37
- readonly set: (value?: Date | string) => string;
38
- readonly default: () => string;
39
- };
40
- readonly updatedAt: {
41
- readonly type: "string";
42
- readonly required: true;
43
- readonly set: (value?: Date | string) => string;
44
- readonly default: () => string;
45
- };
46
- readonly metadata: {
47
- readonly type: "string";
48
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
49
- readonly get: (value?: string) => any;
50
- };
51
- };
52
-
53
- declare class DynamoDBStore extends MastraStorage {
54
- private tableName;
55
- private client;
56
- private service;
57
- protected hasInitialized: Promise<boolean> | null;
58
- stores: StorageDomains;
59
- constructor({ name, config }: {
60
- name: string;
61
- config: DynamoDBStoreConfig;
62
- });
63
- get supports(): {
64
- selectByIncludeResourceScope: boolean;
65
- resourceWorkingMemory: boolean;
66
- hasColumn: boolean;
67
- createTable: boolean;
68
- deleteMessages: boolean;
69
- };
70
- /**
71
- * Validates that the required DynamoDB table exists and is accessible.
72
- * This does not check the table structure - it assumes the table
73
- * was created with the correct structure via CDK/CloudFormation.
74
- */
75
- private validateTableExists;
76
- /**
77
- * Initialize storage, validating the externally managed table is accessible.
78
- * For the single-table design, we only validate once that we can access
79
- * the table that was created via CDK/CloudFormation.
80
- */
81
- init(): Promise<void>;
82
- /**
83
- * Performs the actual table validation and stores the promise.
84
- * Handles resetting the stored promise on failure to allow retries.
85
- */
86
- private _performInitializationAndStore;
87
- createTable({ tableName, schema }: {
88
- tableName: TABLE_NAMES;
89
- schema: Record<string, any>;
90
- }): Promise<void>;
91
- alterTable(_args: {
92
- tableName: TABLE_NAMES;
93
- schema: Record<string, StorageColumn>;
94
- ifNotExists: string[];
95
- }): Promise<void>;
96
- clearTable({ tableName }: {
97
- tableName: TABLE_NAMES;
98
- }): Promise<void>;
99
- dropTable({ tableName }: {
100
- tableName: TABLE_NAMES;
101
- }): Promise<void>;
102
- insert({ tableName, record }: {
103
- tableName: TABLE_NAMES;
104
- record: Record<string, any>;
105
- }): Promise<void>;
106
- batchInsert({ tableName, records }: {
107
- tableName: TABLE_NAMES;
108
- records: Record<string, any>[];
109
- }): Promise<void>;
110
- load<R>({ tableName, keys }: {
111
- tableName: TABLE_NAMES;
112
- keys: Record<string, string>;
113
- }): Promise<R | null>;
114
- getThreadById({ threadId }: {
115
- threadId: string;
116
- }): Promise<StorageThreadType | null>;
117
- getThreadsByResourceId({ resourceId }: {
118
- resourceId: string;
119
- }): Promise<StorageThreadType[]>;
120
- saveThread({ thread }: {
121
- thread: StorageThreadType;
122
- }): Promise<StorageThreadType>;
123
- updateThread({ id, title, metadata, }: {
124
- id: string;
125
- title: string;
126
- metadata: Record<string, unknown>;
127
- }): Promise<StorageThreadType>;
128
- deleteThread({ threadId }: {
129
- threadId: string;
130
- }): Promise<void>;
131
- getMessages(args: StorageGetMessagesArg & {
132
- format?: 'v1';
133
- }): Promise<MastraMessageV1[]>;
134
- getMessages(args: StorageGetMessagesArg & {
135
- format: 'v2';
136
- }): Promise<MastraMessageV2[]>;
137
- saveMessages(args: {
138
- messages: MastraMessageV1[];
139
- format?: undefined | 'v1';
140
- }): Promise<MastraMessageV1[]>;
141
- saveMessages(args: {
142
- messages: MastraMessageV2[];
143
- format: 'v2';
144
- }): Promise<MastraMessageV2[]>;
145
- getThreadsByResourceIdPaginated(args: {
146
- resourceId: string;
147
- page: number;
148
- perPage: number;
149
- }): Promise<PaginationInfo & {
150
- threads: StorageThreadType[];
151
- }>;
152
- getMessagesPaginated(args: StorageGetMessagesArg & {
153
- format?: 'v1' | 'v2';
154
- }): Promise<PaginationInfo & {
155
- messages: MastraMessageV1[] | MastraMessageV2[];
156
- }>;
157
- updateMessages(_args: {
158
- messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
159
- id: string;
160
- content?: {
161
- metadata?: MastraMessageContentV2['metadata'];
162
- content?: MastraMessageContentV2['content'];
163
- };
164
- }[];
165
- }): Promise<MastraMessageV2[]>;
166
- getTraces(args: {
167
- name?: string;
168
- scope?: string;
169
- page: number;
170
- perPage: number;
171
- attributes?: Record<string, string>;
172
- filters?: Record<string, any>;
173
- }): Promise<any[]>;
174
- batchTraceInsert({ records }: {
175
- records: Record<string, any>[];
176
- }): Promise<void>;
177
- getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
178
- traces: Trace[];
179
- }>;
180
- persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
181
- workflowName: string;
182
- runId: string;
183
- snapshot: WorkflowRunState;
184
- }): Promise<void>;
185
- loadWorkflowSnapshot({ workflowName, runId, }: {
186
- workflowName: string;
187
- runId: string;
188
- }): Promise<WorkflowRunState | null>;
189
- getWorkflowRuns(args?: {
190
- workflowName?: string;
191
- fromDate?: Date;
192
- toDate?: Date;
193
- limit?: number;
194
- offset?: number;
195
- resourceId?: string;
196
- }): Promise<WorkflowRuns>;
197
- getWorkflowRunById(args: {
198
- runId: string;
199
- workflowName?: string;
200
- }): Promise<WorkflowRun | null>;
201
- getResourceById({ resourceId }: {
202
- resourceId: string;
203
- }): Promise<StorageResourceType | null>;
204
- saveResource({ resource }: {
205
- resource: StorageResourceType;
206
- }): Promise<StorageResourceType>;
207
- updateResource({ resourceId, workingMemory, metadata, }: {
208
- resourceId: string;
209
- workingMemory?: string;
210
- metadata?: Record<string, any>;
211
- }): Promise<StorageResourceType>;
212
- getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
213
- getEvals(options: {
214
- agentName?: string;
215
- type?: 'test' | 'live';
216
- } & PaginationArgs): Promise<PaginationInfo & {
217
- evals: EvalRow[];
218
- }>;
219
- /**
220
- * Closes the DynamoDB client connection and cleans up resources.
221
- * Should be called when the store is no longer needed, e.g., at the end of tests or application shutdown.
222
- */
223
- close(): Promise<void>;
224
- /**
225
- * SCORERS - Not implemented
226
- */
227
- getScoreById({ id: _id }: {
228
- id: string;
229
- }): Promise<ScoreRowData | null>;
230
- saveScore(_score: ScoreRowData): Promise<{
231
- score: ScoreRowData;
232
- }>;
233
- getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
234
- runId: string;
235
- pagination: StoragePagination;
236
- }): Promise<{
237
- pagination: PaginationInfo;
238
- scores: ScoreRowData[];
239
- }>;
240
- getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
241
- pagination: StoragePagination;
242
- entityId: string;
243
- entityType: string;
244
- }): Promise<{
245
- pagination: PaginationInfo;
246
- scores: ScoreRowData[];
247
- }>;
248
- getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
249
- scorerId: string;
250
- pagination: StoragePagination;
251
- }): Promise<{
252
- pagination: PaginationInfo;
253
- scores: ScoreRowData[];
254
- }>;
255
- }
256
- export { DynamoDBStore }
257
- export { DynamoDBStore as DynamoDBStore_alias_1 }
258
-
259
- declare interface DynamoDBStoreConfig {
260
- region?: string;
261
- tableName: string;
262
- endpoint?: string;
263
- credentials?: {
264
- accessKeyId: string;
265
- secretAccessKey: string;
266
- };
267
- }
268
- export { DynamoDBStoreConfig }
269
- export { DynamoDBStoreConfig as DynamoDBStoreConfig_alias_1 }
270
-
271
- export declare const evalEntity: Entity<string, string, string, {
272
- model: {
273
- entity: string;
274
- version: string;
275
- service: string;
276
- };
277
- attributes: {
278
- input: {
279
- type: "string";
280
- required: true;
281
- };
282
- output: {
283
- type: "string";
284
- required: true;
285
- };
286
- result: {
287
- type: "string";
288
- required: true;
289
- set: (value?: any) => any;
290
- get: (value?: string) => any;
291
- };
292
- agent_name: {
293
- type: "string";
294
- required: true;
295
- };
296
- metric_name: {
297
- type: "string";
298
- required: true;
299
- };
300
- instructions: {
301
- type: "string";
302
- required: true;
303
- };
304
- test_info: {
305
- type: "string";
306
- required: false;
307
- set: (value?: any) => any;
308
- get: (value?: string) => string | undefined;
309
- };
310
- global_run_id: {
311
- type: "string";
312
- required: true;
313
- };
314
- run_id: {
315
- type: "string";
316
- required: true;
317
- };
318
- created_at: {
319
- type: "string";
320
- required: true;
321
- default: () => string;
322
- set: (value?: Date | string) => string;
323
- };
324
- createdAt: {
325
- readonly type: "string";
326
- readonly required: true;
327
- readonly readOnly: true;
328
- readonly set: (value?: Date | string) => string;
329
- readonly default: () => string;
330
- };
331
- updatedAt: {
332
- readonly type: "string";
333
- readonly required: true;
334
- readonly set: (value?: Date | string) => string;
335
- readonly default: () => string;
336
- };
337
- metadata: {
338
- readonly type: "string";
339
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
340
- readonly get: (value?: string) => any;
341
- };
342
- entity: {
343
- type: "string";
344
- required: true;
345
- };
346
- };
347
- indexes: {
348
- primary: {
349
- pk: {
350
- field: string;
351
- composite: ("entity" | "run_id")[];
352
- };
353
- sk: {
354
- field: string;
355
- composite: never[];
356
- };
357
- };
358
- byAgent: {
359
- index: string;
360
- pk: {
361
- field: string;
362
- composite: ("entity" | "agent_name")[];
363
- };
364
- sk: {
365
- field: string;
366
- composite: "created_at"[];
367
- };
368
- };
369
- };
370
- }>;
371
-
372
- export declare function getElectroDbService(client: DynamoDBDocumentClient, tableName: string): Service<{
373
- thread: Entity<string, string, string, {
374
- model: {
375
- entity: string;
376
- version: string;
377
- service: string;
378
- };
379
- attributes: {
380
- id: {
381
- type: "string";
382
- required: true;
383
- };
384
- resourceId: {
385
- type: "string";
386
- required: true;
387
- };
388
- title: {
389
- type: "string";
390
- required: true;
391
- };
392
- metadata: {
393
- type: "string";
394
- required: false;
395
- set: (value?: Record<string, unknown> | string) => string | undefined;
396
- get: (value?: string) => any;
397
- };
398
- createdAt: {
399
- readonly type: "string";
400
- readonly required: true;
401
- readonly readOnly: true;
402
- readonly set: (value?: Date | string) => string;
403
- readonly default: () => string;
404
- };
405
- updatedAt: {
406
- readonly type: "string";
407
- readonly required: true;
408
- readonly set: (value?: Date | string) => string;
409
- readonly default: () => string;
410
- };
411
- entity: {
412
- type: "string";
413
- required: true;
414
- };
415
- };
416
- indexes: {
417
- primary: {
418
- pk: {
419
- field: string;
420
- composite: ("entity" | "id")[];
421
- };
422
- sk: {
423
- field: string;
424
- composite: "id"[];
425
- };
426
- };
427
- byResource: {
428
- index: string;
429
- pk: {
430
- field: string;
431
- composite: ("entity" | "resourceId")[];
432
- };
433
- sk: {
434
- field: string;
435
- composite: "createdAt"[];
436
- };
437
- };
438
- };
439
- }>;
440
- message: Entity<string, string, string, {
441
- model: {
442
- entity: string;
443
- version: string;
444
- service: string;
445
- };
446
- attributes: {
447
- id: {
448
- type: "string";
449
- required: true;
450
- };
451
- threadId: {
452
- type: "string";
453
- required: true;
454
- };
455
- content: {
456
- type: "string";
457
- required: true;
458
- set: (value?: string | void | undefined) => string | void;
459
- get: (value?: string) => any;
460
- };
461
- role: {
462
- type: "string";
463
- required: true;
464
- };
465
- type: {
466
- type: "string";
467
- default: string;
468
- };
469
- resourceId: {
470
- type: "string";
471
- required: false;
472
- };
473
- toolCallIds: {
474
- type: "string";
475
- required: false;
476
- set: (value?: string[] | string) => string | undefined;
477
- get: (value?: string) => any;
478
- };
479
- toolCallArgs: {
480
- type: "string";
481
- required: false;
482
- set: (value?: Record<string, unknown>[] | string) => string | undefined;
483
- get: (value?: string) => any;
484
- };
485
- toolNames: {
486
- type: "string";
487
- required: false;
488
- set: (value?: string[] | string) => string | undefined;
489
- get: (value?: string) => any;
490
- };
491
- createdAt: {
492
- readonly type: "string";
493
- readonly required: true;
494
- readonly readOnly: true;
495
- readonly set: (value?: Date | string) => string;
496
- readonly default: () => string;
497
- };
498
- updatedAt: {
499
- readonly type: "string";
500
- readonly required: true;
501
- readonly set: (value?: Date | string) => string;
502
- readonly default: () => string;
503
- };
504
- metadata: {
505
- readonly type: "string";
506
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
507
- readonly get: (value?: string) => any;
508
- };
509
- entity: {
510
- type: "string";
511
- required: true;
512
- };
513
- };
514
- indexes: {
515
- primary: {
516
- pk: {
517
- field: string;
518
- composite: ("entity" | "id")[];
519
- };
520
- sk: {
521
- field: string;
522
- composite: "entity"[];
523
- };
524
- };
525
- byThread: {
526
- index: string;
527
- pk: {
528
- field: string;
529
- composite: ("entity" | "threadId")[];
530
- };
531
- sk: {
532
- field: string;
533
- composite: "createdAt"[];
534
- };
535
- };
536
- };
537
- }>;
538
- eval: Entity<string, string, string, {
539
- model: {
540
- entity: string;
541
- version: string;
542
- service: string;
543
- };
544
- attributes: {
545
- input: {
546
- type: "string";
547
- required: true;
548
- };
549
- output: {
550
- type: "string";
551
- required: true;
552
- };
553
- result: {
554
- type: "string";
555
- required: true;
556
- set: (value?: any) => any;
557
- get: (value?: string) => any;
558
- };
559
- agent_name: {
560
- type: "string";
561
- required: true;
562
- };
563
- metric_name: {
564
- type: "string";
565
- required: true;
566
- };
567
- instructions: {
568
- type: "string";
569
- required: true;
570
- };
571
- test_info: {
572
- type: "string";
573
- required: false;
574
- set: (value?: any) => any;
575
- get: (value?: string) => string | undefined;
576
- };
577
- global_run_id: {
578
- type: "string";
579
- required: true;
580
- };
581
- run_id: {
582
- type: "string";
583
- required: true;
584
- };
585
- created_at: {
586
- type: "string";
587
- required: true;
588
- default: () => string;
589
- set: (value?: Date | string) => string;
590
- };
591
- createdAt: {
592
- readonly type: "string";
593
- readonly required: true;
594
- readonly readOnly: true;
595
- readonly set: (value?: Date | string) => string;
596
- readonly default: () => string;
597
- };
598
- updatedAt: {
599
- readonly type: "string";
600
- readonly required: true;
601
- readonly set: (value?: Date | string) => string;
602
- readonly default: () => string;
603
- };
604
- metadata: {
605
- readonly type: "string";
606
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
607
- readonly get: (value?: string) => any;
608
- };
609
- entity: {
610
- type: "string";
611
- required: true;
612
- };
613
- };
614
- indexes: {
615
- primary: {
616
- pk: {
617
- field: string;
618
- composite: ("entity" | "run_id")[];
619
- };
620
- sk: {
621
- field: string;
622
- composite: never[];
623
- };
624
- };
625
- byAgent: {
626
- index: string;
627
- pk: {
628
- field: string;
629
- composite: ("entity" | "agent_name")[];
630
- };
631
- sk: {
632
- field: string;
633
- composite: "created_at"[];
634
- };
635
- };
636
- };
637
- }>;
638
- trace: Entity<string, string, string, {
639
- model: {
640
- entity: string;
641
- version: string;
642
- service: string;
643
- };
644
- attributes: {
645
- id: {
646
- type: "string";
647
- required: true;
648
- };
649
- parentSpanId: {
650
- type: "string";
651
- required: false;
652
- };
653
- name: {
654
- type: "string";
655
- required: true;
656
- };
657
- traceId: {
658
- type: "string";
659
- required: true;
660
- };
661
- scope: {
662
- type: "string";
663
- required: true;
664
- };
665
- kind: {
666
- type: "number";
667
- required: true;
668
- };
669
- attributes: {
670
- type: "string";
671
- required: false;
672
- set: (value?: any) => any;
673
- get: (value?: string) => any;
674
- };
675
- status: {
676
- type: "string";
677
- required: false;
678
- set: (value?: any) => any;
679
- get: (value?: string) => string | undefined;
680
- };
681
- events: {
682
- type: "string";
683
- required: false;
684
- set: (value?: any) => any;
685
- get: (value?: string) => string | undefined;
686
- };
687
- links: {
688
- type: "string";
689
- required: false;
690
- set: (value?: any) => any;
691
- get: (value?: string) => string | undefined;
692
- };
693
- other: {
694
- type: "string";
695
- required: false;
696
- };
697
- startTime: {
698
- type: "number";
699
- required: true;
700
- };
701
- endTime: {
702
- type: "number";
703
- required: true;
704
- };
705
- createdAt: {
706
- readonly type: "string";
707
- readonly required: true;
708
- readonly readOnly: true;
709
- readonly set: (value?: Date | string) => string;
710
- readonly default: () => string;
711
- };
712
- updatedAt: {
713
- readonly type: "string";
714
- readonly required: true;
715
- readonly set: (value?: Date | string) => string;
716
- readonly default: () => string;
717
- };
718
- metadata: {
719
- readonly type: "string";
720
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
721
- readonly get: (value?: string) => any;
722
- };
723
- entity: {
724
- type: "string";
725
- required: true;
726
- };
727
- };
728
- indexes: {
729
- primary: {
730
- pk: {
731
- field: string;
732
- composite: ("entity" | "id")[];
733
- };
734
- sk: {
735
- field: string;
736
- composite: never[];
737
- };
738
- };
739
- byName: {
740
- index: string;
741
- pk: {
742
- field: string;
743
- composite: ("entity" | "name")[];
744
- };
745
- sk: {
746
- field: string;
747
- composite: "startTime"[];
748
- };
749
- };
750
- byScope: {
751
- index: string;
752
- pk: {
753
- field: string;
754
- composite: ("entity" | "scope")[];
755
- };
756
- sk: {
757
- field: string;
758
- composite: "startTime"[];
759
- };
760
- };
761
- };
762
- }>;
763
- workflow_snapshot: Entity<string, string, string, {
764
- model: {
765
- entity: string;
766
- version: string;
767
- service: string;
768
- };
769
- attributes: {
770
- workflow_name: {
771
- type: "string";
772
- required: true;
773
- };
774
- run_id: {
775
- type: "string";
776
- required: true;
777
- };
778
- snapshot: {
779
- type: "string";
780
- required: true;
781
- set: (value?: any) => any;
782
- get: (value?: string) => any;
783
- };
784
- resourceId: {
785
- type: "string";
786
- required: false;
787
- };
788
- createdAt: {
789
- readonly type: "string";
790
- readonly required: true;
791
- readonly readOnly: true;
792
- readonly set: (value?: Date | string) => string;
793
- readonly default: () => string;
794
- };
795
- updatedAt: {
796
- readonly type: "string";
797
- readonly required: true;
798
- readonly set: (value?: Date | string) => string;
799
- readonly default: () => string;
800
- };
801
- metadata: {
802
- readonly type: "string";
803
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
804
- readonly get: (value?: string) => any;
805
- };
806
- entity: {
807
- type: "string";
808
- required: true;
809
- };
810
- };
811
- indexes: {
812
- primary: {
813
- pk: {
814
- field: string;
815
- composite: ("entity" | "workflow_name")[];
816
- };
817
- sk: {
818
- field: string;
819
- composite: "run_id"[];
820
- };
821
- };
822
- gsi2: {
823
- index: string;
824
- pk: {
825
- field: string;
826
- composite: ("entity" | "run_id")[];
827
- };
828
- sk: {
829
- field: string;
830
- composite: "workflow_name"[];
831
- };
832
- };
833
- };
834
- }>;
835
- resource: Entity<string, string, string, {
836
- model: {
837
- entity: string;
838
- version: string;
839
- service: string;
840
- };
841
- attributes: {
842
- id: {
843
- type: "string";
844
- required: true;
845
- };
846
- workingMemory: {
847
- type: "string";
848
- required: false;
849
- };
850
- metadata: {
851
- type: "string";
852
- required: false;
853
- set: (value?: string | void | undefined) => string | void;
854
- get: (value?: string) => any;
855
- };
856
- createdAt: {
857
- readonly type: "string";
858
- readonly required: true;
859
- readonly readOnly: true;
860
- readonly set: (value?: Date | string) => string;
861
- readonly default: () => string;
862
- };
863
- updatedAt: {
864
- readonly type: "string";
865
- readonly required: true;
866
- readonly set: (value?: Date | string) => string;
867
- readonly default: () => string;
868
- };
869
- entity: {
870
- type: "string";
871
- required: true;
872
- };
873
- };
874
- indexes: {
875
- primary: {
876
- pk: {
877
- field: string;
878
- composite: ("entity" | "id")[];
879
- };
880
- sk: {
881
- field: string;
882
- composite: "entity"[];
883
- };
884
- };
885
- };
886
- }>;
887
- score: Entity<string, string, string, {
888
- model: {
889
- entity: string;
890
- version: string;
891
- service: string;
892
- };
893
- attributes: {
894
- id: {
895
- type: "string";
896
- required: true;
897
- };
898
- scorerId: {
899
- type: "string";
900
- required: true;
901
- };
902
- traceId: {
903
- type: "string";
904
- required: false;
905
- };
906
- runId: {
907
- type: "string";
908
- required: true;
909
- };
910
- scorer: {
911
- type: "string";
912
- required: true;
913
- set: (value?: Record<string, unknown> | string) => string | undefined;
914
- get: (value?: string) => any;
915
- };
916
- extractStepResult: {
917
- type: "string";
918
- required: false;
919
- set: (value?: Record<string, unknown> | string) => string | undefined;
920
- get: (value?: string) => any;
921
- };
922
- analyzeStepResult: {
923
- type: "string";
924
- required: false;
925
- set: (value?: Record<string, unknown> | string) => string | undefined;
926
- get: (value?: string) => any;
927
- };
928
- score: {
929
- type: "number";
930
- required: true;
931
- };
932
- reason: {
933
- type: "string";
934
- required: false;
935
- };
936
- extractPrompt: {
937
- type: "string";
938
- required: false;
939
- };
940
- analyzePrompt: {
941
- type: "string";
942
- required: false;
943
- };
944
- reasonPrompt: {
945
- type: "string";
946
- required: false;
947
- };
948
- input: {
949
- type: "string";
950
- required: true;
951
- set: (value?: Record<string, unknown> | string) => string | undefined;
952
- get: (value?: string) => any;
953
- };
954
- output: {
955
- type: "string";
956
- required: true;
957
- set: (value?: Record<string, unknown> | string) => string | undefined;
958
- get: (value?: string) => any;
959
- };
960
- additionalContext: {
961
- type: "string";
962
- required: false;
963
- set: (value?: Record<string, unknown> | string) => string | undefined;
964
- get: (value?: string) => any;
965
- };
966
- runtimeContext: {
967
- type: "string";
968
- required: false;
969
- set: (value?: Record<string, unknown> | string) => string | undefined;
970
- get: (value?: string) => any;
971
- };
972
- entityType: {
973
- type: "string";
974
- required: false;
975
- };
976
- entityData: {
977
- type: "string";
978
- required: false;
979
- set: (value?: Record<string, unknown> | string) => string | undefined;
980
- get: (value?: string) => any;
981
- };
982
- entityId: {
983
- type: "string";
984
- required: false;
985
- };
986
- source: {
987
- type: "string";
988
- required: true;
989
- };
990
- resourceId: {
991
- type: "string";
992
- required: false;
993
- };
994
- threadId: {
995
- type: "string";
996
- required: false;
997
- };
998
- createdAt: {
999
- readonly type: "string";
1000
- readonly required: true;
1001
- readonly readOnly: true;
1002
- readonly set: (value?: Date | string) => string;
1003
- readonly default: () => string;
1004
- };
1005
- updatedAt: {
1006
- readonly type: "string";
1007
- readonly required: true;
1008
- readonly set: (value?: Date | string) => string;
1009
- readonly default: () => string;
1010
- };
1011
- metadata: {
1012
- readonly type: "string";
1013
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
1014
- readonly get: (value?: string) => any;
1015
- };
1016
- entity: {
1017
- type: "string";
1018
- required: true;
1019
- };
1020
- };
1021
- indexes: {
1022
- primary: {
1023
- pk: {
1024
- field: string;
1025
- composite: ("entity" | "id")[];
1026
- };
1027
- sk: {
1028
- field: string;
1029
- composite: "entity"[];
1030
- };
1031
- };
1032
- byScorer: {
1033
- index: string;
1034
- pk: {
1035
- field: string;
1036
- composite: ("entity" | "scorerId")[];
1037
- };
1038
- sk: {
1039
- field: string;
1040
- composite: "createdAt"[];
1041
- };
1042
- };
1043
- byRun: {
1044
- index: string;
1045
- pk: {
1046
- field: string;
1047
- composite: ("entity" | "runId")[];
1048
- };
1049
- sk: {
1050
- field: string;
1051
- composite: "createdAt"[];
1052
- };
1053
- };
1054
- byTrace: {
1055
- index: string;
1056
- pk: {
1057
- field: string;
1058
- composite: ("entity" | "traceId")[];
1059
- };
1060
- sk: {
1061
- field: string;
1062
- composite: "createdAt"[];
1063
- };
1064
- };
1065
- byEntityData: {
1066
- index: string;
1067
- pk: {
1068
- field: string;
1069
- composite: ("entity" | "entityId")[];
1070
- };
1071
- sk: {
1072
- field: string;
1073
- composite: "createdAt"[];
1074
- };
1075
- };
1076
- byResource: {
1077
- index: string;
1078
- pk: {
1079
- field: string;
1080
- composite: ("entity" | "resourceId")[];
1081
- };
1082
- sk: {
1083
- field: string;
1084
- composite: "createdAt"[];
1085
- };
1086
- };
1087
- byThread: {
1088
- index: string;
1089
- pk: {
1090
- field: string;
1091
- composite: ("entity" | "threadId")[];
1092
- };
1093
- sk: {
1094
- field: string;
1095
- composite: "createdAt"[];
1096
- };
1097
- };
1098
- };
1099
- }>;
1100
- }>;
1101
-
1102
- export declare class LegacyEvalsDynamoDB extends LegacyEvalsStorage {
1103
- service: Service<Record<string, any>>;
1104
- tableName: string;
1105
- constructor({ service, tableName }: {
1106
- service: Service<Record<string, any>>;
1107
- tableName: string;
1108
- });
1109
- getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
1110
- getEvals(options?: {
1111
- agentName?: string;
1112
- type?: 'test' | 'live';
1113
- } & PaginationArgs): Promise<PaginationInfo & {
1114
- evals: EvalRow[];
1115
- }>;
1116
- }
1117
-
1118
- export declare class MemoryStorageDynamoDB extends MemoryStorage {
1119
- private service;
1120
- constructor({ service }: {
1121
- service: Service<Record<string, any>>;
1122
- });
1123
- private parseMessageData;
1124
- getThreadById({ threadId }: {
1125
- threadId: string;
1126
- }): Promise<StorageThreadType | null>;
1127
- getThreadsByResourceId({ resourceId }: {
1128
- resourceId: string;
1129
- }): Promise<StorageThreadType[]>;
1130
- saveThread({ thread }: {
1131
- thread: StorageThreadType;
1132
- }): Promise<StorageThreadType>;
1133
- updateThread({ id, title, metadata, }: {
1134
- id: string;
1135
- title: string;
1136
- metadata: Record<string, unknown>;
1137
- }): Promise<StorageThreadType>;
1138
- deleteThread({ threadId }: {
1139
- threadId: string;
1140
- }): Promise<void>;
1141
- getMessages(args: StorageGetMessagesArg & {
1142
- format?: 'v1';
1143
- }): Promise<MastraMessageV1[]>;
1144
- getMessages(args: StorageGetMessagesArg & {
1145
- format: 'v2';
1146
- }): Promise<MastraMessageV2[]>;
1147
- saveMessages(args: {
1148
- messages: MastraMessageV1[];
1149
- format?: undefined | 'v1';
1150
- }): Promise<MastraMessageV1[]>;
1151
- saveMessages(args: {
1152
- messages: MastraMessageV2[];
1153
- format: 'v2';
1154
- }): Promise<MastraMessageV2[]>;
1155
- getThreadsByResourceIdPaginated(args: {
1156
- resourceId: string;
1157
- page?: number;
1158
- perPage?: number;
1159
- }): Promise<PaginationInfo & {
1160
- threads: StorageThreadType[];
1161
- }>;
1162
- getMessagesPaginated(args: StorageGetMessagesArg & {
1163
- format?: 'v1' | 'v2';
1164
- }): Promise<PaginationInfo & {
1165
- messages: MastraMessageV1[] | MastraMessageV2[];
1166
- }>;
1167
- private _getIncludedMessages;
1168
- updateMessages(args: {
1169
- messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
1170
- id: string;
1171
- content?: {
1172
- metadata?: MastraMessageContentV2['metadata'];
1173
- content?: MastraMessageContentV2['content'];
1174
- };
1175
- }[];
1176
- }): Promise<MastraMessageV2[]>;
1177
- getResourceById({ resourceId }: {
1178
- resourceId: string;
1179
- }): Promise<StorageResourceType | null>;
1180
- saveResource({ resource }: {
1181
- resource: StorageResourceType;
1182
- }): Promise<StorageResourceType>;
1183
- updateResource({ resourceId, workingMemory, metadata, }: {
1184
- resourceId: string;
1185
- workingMemory?: string;
1186
- metadata?: Record<string, unknown>;
1187
- }): Promise<StorageResourceType>;
1188
- }
1189
-
1190
- export declare const messageEntity: Entity<string, string, string, {
1191
- model: {
1192
- entity: string;
1193
- version: string;
1194
- service: string;
1195
- };
1196
- attributes: {
1197
- id: {
1198
- type: "string";
1199
- required: true;
1200
- };
1201
- threadId: {
1202
- type: "string";
1203
- required: true;
1204
- };
1205
- content: {
1206
- type: "string";
1207
- required: true;
1208
- set: (value?: string | void | undefined) => string | void;
1209
- get: (value?: string) => any;
1210
- };
1211
- role: {
1212
- type: "string";
1213
- required: true;
1214
- };
1215
- type: {
1216
- type: "string";
1217
- default: string;
1218
- };
1219
- resourceId: {
1220
- type: "string";
1221
- required: false;
1222
- };
1223
- toolCallIds: {
1224
- type: "string";
1225
- required: false;
1226
- set: (value?: string[] | string) => string | undefined;
1227
- get: (value?: string) => any;
1228
- };
1229
- toolCallArgs: {
1230
- type: "string";
1231
- required: false;
1232
- set: (value?: Record<string, unknown>[] | string) => string | undefined;
1233
- get: (value?: string) => any;
1234
- };
1235
- toolNames: {
1236
- type: "string";
1237
- required: false;
1238
- set: (value?: string[] | string) => string | undefined;
1239
- get: (value?: string) => any;
1240
- };
1241
- createdAt: {
1242
- readonly type: "string";
1243
- readonly required: true;
1244
- readonly readOnly: true;
1245
- readonly set: (value?: Date | string) => string;
1246
- readonly default: () => string;
1247
- };
1248
- updatedAt: {
1249
- readonly type: "string";
1250
- readonly required: true;
1251
- readonly set: (value?: Date | string) => string;
1252
- readonly default: () => string;
1253
- };
1254
- metadata: {
1255
- readonly type: "string";
1256
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
1257
- readonly get: (value?: string) => any;
1258
- };
1259
- entity: {
1260
- type: "string";
1261
- required: true;
1262
- };
1263
- };
1264
- indexes: {
1265
- primary: {
1266
- pk: {
1267
- field: string;
1268
- composite: ("entity" | "id")[];
1269
- };
1270
- sk: {
1271
- field: string;
1272
- composite: "entity"[];
1273
- };
1274
- };
1275
- byThread: {
1276
- index: string;
1277
- pk: {
1278
- field: string;
1279
- composite: ("entity" | "threadId")[];
1280
- };
1281
- sk: {
1282
- field: string;
1283
- composite: "createdAt"[];
1284
- };
1285
- };
1286
- };
1287
- }>;
1288
-
1289
- export declare const resourceEntity: Entity<string, string, string, {
1290
- model: {
1291
- entity: string;
1292
- version: string;
1293
- service: string;
1294
- };
1295
- attributes: {
1296
- id: {
1297
- type: "string";
1298
- required: true;
1299
- };
1300
- workingMemory: {
1301
- type: "string";
1302
- required: false;
1303
- };
1304
- metadata: {
1305
- type: "string";
1306
- required: false;
1307
- set: (value?: string | void | undefined) => string | void;
1308
- get: (value?: string) => any;
1309
- };
1310
- createdAt: {
1311
- readonly type: "string";
1312
- readonly required: true;
1313
- readonly readOnly: true;
1314
- readonly set: (value?: Date | string) => string;
1315
- readonly default: () => string;
1316
- };
1317
- updatedAt: {
1318
- readonly type: "string";
1319
- readonly required: true;
1320
- readonly set: (value?: Date | string) => string;
1321
- readonly default: () => string;
1322
- };
1323
- entity: {
1324
- type: "string";
1325
- required: true;
1326
- };
1327
- };
1328
- indexes: {
1329
- primary: {
1330
- pk: {
1331
- field: string;
1332
- composite: ("entity" | "id")[];
1333
- };
1334
- sk: {
1335
- field: string;
1336
- composite: "entity"[];
1337
- };
1338
- };
1339
- };
1340
- }>;
1341
-
1342
- export declare const scoreEntity: Entity<string, string, string, {
1343
- model: {
1344
- entity: string;
1345
- version: string;
1346
- service: string;
1347
- };
1348
- attributes: {
1349
- id: {
1350
- type: "string";
1351
- required: true;
1352
- };
1353
- scorerId: {
1354
- type: "string";
1355
- required: true;
1356
- };
1357
- traceId: {
1358
- type: "string";
1359
- required: false;
1360
- };
1361
- runId: {
1362
- type: "string";
1363
- required: true;
1364
- };
1365
- scorer: {
1366
- type: "string";
1367
- required: true;
1368
- set: (value?: Record<string, unknown> | string) => string | undefined;
1369
- get: (value?: string) => any;
1370
- };
1371
- extractStepResult: {
1372
- type: "string";
1373
- required: false;
1374
- set: (value?: Record<string, unknown> | string) => string | undefined;
1375
- get: (value?: string) => any;
1376
- };
1377
- analyzeStepResult: {
1378
- type: "string";
1379
- required: false;
1380
- set: (value?: Record<string, unknown> | string) => string | undefined;
1381
- get: (value?: string) => any;
1382
- };
1383
- score: {
1384
- type: "number";
1385
- required: true;
1386
- };
1387
- reason: {
1388
- type: "string";
1389
- required: false;
1390
- };
1391
- extractPrompt: {
1392
- type: "string";
1393
- required: false;
1394
- };
1395
- analyzePrompt: {
1396
- type: "string";
1397
- required: false;
1398
- };
1399
- reasonPrompt: {
1400
- type: "string";
1401
- required: false;
1402
- };
1403
- input: {
1404
- type: "string";
1405
- required: true;
1406
- set: (value?: Record<string, unknown> | string) => string | undefined;
1407
- get: (value?: string) => any;
1408
- };
1409
- output: {
1410
- type: "string";
1411
- required: true;
1412
- set: (value?: Record<string, unknown> | string) => string | undefined;
1413
- get: (value?: string) => any;
1414
- };
1415
- additionalContext: {
1416
- type: "string";
1417
- required: false;
1418
- set: (value?: Record<string, unknown> | string) => string | undefined;
1419
- get: (value?: string) => any;
1420
- };
1421
- runtimeContext: {
1422
- type: "string";
1423
- required: false;
1424
- set: (value?: Record<string, unknown> | string) => string | undefined;
1425
- get: (value?: string) => any;
1426
- };
1427
- entityType: {
1428
- type: "string";
1429
- required: false;
1430
- };
1431
- entityData: {
1432
- type: "string";
1433
- required: false;
1434
- set: (value?: Record<string, unknown> | string) => string | undefined;
1435
- get: (value?: string) => any;
1436
- };
1437
- entityId: {
1438
- type: "string";
1439
- required: false;
1440
- };
1441
- source: {
1442
- type: "string";
1443
- required: true;
1444
- };
1445
- resourceId: {
1446
- type: "string";
1447
- required: false;
1448
- };
1449
- threadId: {
1450
- type: "string";
1451
- required: false;
1452
- };
1453
- createdAt: {
1454
- readonly type: "string";
1455
- readonly required: true;
1456
- readonly readOnly: true;
1457
- readonly set: (value?: Date | string) => string;
1458
- readonly default: () => string;
1459
- };
1460
- updatedAt: {
1461
- readonly type: "string";
1462
- readonly required: true;
1463
- readonly set: (value?: Date | string) => string;
1464
- readonly default: () => string;
1465
- };
1466
- metadata: {
1467
- readonly type: "string";
1468
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
1469
- readonly get: (value?: string) => any;
1470
- };
1471
- entity: {
1472
- type: "string";
1473
- required: true;
1474
- };
1475
- };
1476
- indexes: {
1477
- primary: {
1478
- pk: {
1479
- field: string;
1480
- composite: ("entity" | "id")[];
1481
- };
1482
- sk: {
1483
- field: string;
1484
- composite: "entity"[];
1485
- };
1486
- };
1487
- byScorer: {
1488
- index: string;
1489
- pk: {
1490
- field: string;
1491
- composite: ("entity" | "scorerId")[];
1492
- };
1493
- sk: {
1494
- field: string;
1495
- composite: "createdAt"[];
1496
- };
1497
- };
1498
- byRun: {
1499
- index: string;
1500
- pk: {
1501
- field: string;
1502
- composite: ("entity" | "runId")[];
1503
- };
1504
- sk: {
1505
- field: string;
1506
- composite: "createdAt"[];
1507
- };
1508
- };
1509
- byTrace: {
1510
- index: string;
1511
- pk: {
1512
- field: string;
1513
- composite: ("entity" | "traceId")[];
1514
- };
1515
- sk: {
1516
- field: string;
1517
- composite: "createdAt"[];
1518
- };
1519
- };
1520
- byEntityData: {
1521
- index: string;
1522
- pk: {
1523
- field: string;
1524
- composite: ("entity" | "entityId")[];
1525
- };
1526
- sk: {
1527
- field: string;
1528
- composite: "createdAt"[];
1529
- };
1530
- };
1531
- byResource: {
1532
- index: string;
1533
- pk: {
1534
- field: string;
1535
- composite: ("entity" | "resourceId")[];
1536
- };
1537
- sk: {
1538
- field: string;
1539
- composite: "createdAt"[];
1540
- };
1541
- };
1542
- byThread: {
1543
- index: string;
1544
- pk: {
1545
- field: string;
1546
- composite: ("entity" | "threadId")[];
1547
- };
1548
- sk: {
1549
- field: string;
1550
- composite: "createdAt"[];
1551
- };
1552
- };
1553
- };
1554
- }>;
1555
-
1556
- export declare class ScoresStorageDynamoDB extends ScoresStorage {
1557
- private service;
1558
- constructor({ service }: {
1559
- service: Service<Record<string, any>>;
1560
- });
1561
- private parseScoreData;
1562
- getScoreById({ id }: {
1563
- id: string;
1564
- }): Promise<ScoreRowData | null>;
1565
- saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
1566
- score: ScoreRowData;
1567
- }>;
1568
- getScoresByScorerId({ scorerId, pagination, entityId, entityType, }: {
1569
- scorerId: string;
1570
- pagination: StoragePagination;
1571
- entityId?: string;
1572
- entityType?: string;
1573
- }): Promise<{
1574
- pagination: PaginationInfo;
1575
- scores: ScoreRowData[];
1576
- }>;
1577
- getScoresByRunId({ runId, pagination, }: {
1578
- runId: string;
1579
- pagination: StoragePagination;
1580
- }): Promise<{
1581
- pagination: PaginationInfo;
1582
- scores: ScoreRowData[];
1583
- }>;
1584
- getScoresByEntityId({ entityId, entityType, pagination, }: {
1585
- entityId: string;
1586
- entityType: string;
1587
- pagination: StoragePagination;
1588
- }): Promise<{
1589
- pagination: PaginationInfo;
1590
- scores: ScoreRowData[];
1591
- }>;
1592
- }
1593
-
1594
- export declare class StoreOperationsDynamoDB extends StoreOperations {
1595
- client: DynamoDBDocumentClient;
1596
- tableName: string;
1597
- service: Service<Record<string, any>>;
1598
- constructor({ service, tableName, client, }: {
1599
- service: Service<Record<string, any>>;
1600
- tableName: string;
1601
- client: DynamoDBDocumentClient;
1602
- });
1603
- hasColumn(): Promise<boolean>;
1604
- dropTable(): Promise<void>;
1605
- private getEntityNameForTable;
1606
- /**
1607
- * Pre-processes a record to ensure Date objects are converted to ISO strings
1608
- * This is necessary because ElectroDB validation happens before setters are applied
1609
- */
1610
- private preprocessRecord;
1611
- /**
1612
- * Validates that the required DynamoDB table exists and is accessible.
1613
- * This does not check the table structure - it assumes the table
1614
- * was created with the correct structure via CDK/CloudFormation.
1615
- */
1616
- private validateTableExists;
1617
- /**
1618
- * This method is modified for DynamoDB with ElectroDB single-table design.
1619
- * It assumes the table is created and managed externally via CDK/CloudFormation.
1620
- *
1621
- * This implementation only validates that the required table exists and is accessible.
1622
- * No table creation is attempted - we simply check if we can access the table.
1623
- */
1624
- createTable({ tableName }: {
1625
- tableName: TABLE_NAMES;
1626
- schema: Record<string, any>;
1627
- }): Promise<void>;
1628
- insert({ tableName, record }: {
1629
- tableName: TABLE_NAMES;
1630
- record: Record<string, any>;
1631
- }): Promise<void>;
1632
- alterTable(_args: {
1633
- tableName: TABLE_NAMES;
1634
- schema: Record<string, StorageColumn>;
1635
- ifNotExists: string[];
1636
- }): Promise<void>;
1637
- /**
1638
- * Clear all items from a logical "table" (entity type)
1639
- */
1640
- clearTable({ tableName }: {
1641
- tableName: TABLE_NAMES;
1642
- }): Promise<void>;
1643
- /**
1644
- * Insert multiple records as a batch
1645
- */
1646
- batchInsert({ tableName, records }: {
1647
- tableName: TABLE_NAMES;
1648
- records: Record<string, any>[];
1649
- }): Promise<void>;
1650
- /**
1651
- * Load a record by its keys
1652
- */
1653
- load<R>({ tableName, keys }: {
1654
- tableName: TABLE_NAMES;
1655
- keys: Record<string, string>;
1656
- }): Promise<R | null>;
1657
- }
1658
-
1659
- export declare const threadEntity: Entity<string, string, string, {
1660
- model: {
1661
- entity: string;
1662
- version: string;
1663
- service: string;
1664
- };
1665
- attributes: {
1666
- id: {
1667
- type: "string";
1668
- required: true;
1669
- };
1670
- resourceId: {
1671
- type: "string";
1672
- required: true;
1673
- };
1674
- title: {
1675
- type: "string";
1676
- required: true;
1677
- };
1678
- metadata: {
1679
- type: "string";
1680
- required: false;
1681
- set: (value?: Record<string, unknown> | string) => string | undefined;
1682
- get: (value?: string) => any;
1683
- };
1684
- createdAt: {
1685
- readonly type: "string";
1686
- readonly required: true;
1687
- readonly readOnly: true;
1688
- readonly set: (value?: Date | string) => string;
1689
- readonly default: () => string;
1690
- };
1691
- updatedAt: {
1692
- readonly type: "string";
1693
- readonly required: true;
1694
- readonly set: (value?: Date | string) => string;
1695
- readonly default: () => string;
1696
- };
1697
- entity: {
1698
- type: "string";
1699
- required: true;
1700
- };
1701
- };
1702
- indexes: {
1703
- primary: {
1704
- pk: {
1705
- field: string;
1706
- composite: ("entity" | "id")[];
1707
- };
1708
- sk: {
1709
- field: string;
1710
- composite: "id"[];
1711
- };
1712
- };
1713
- byResource: {
1714
- index: string;
1715
- pk: {
1716
- field: string;
1717
- composite: ("entity" | "resourceId")[];
1718
- };
1719
- sk: {
1720
- field: string;
1721
- composite: "createdAt"[];
1722
- };
1723
- };
1724
- };
1725
- }>;
1726
-
1727
- export declare const traceEntity: Entity<string, string, string, {
1728
- model: {
1729
- entity: string;
1730
- version: string;
1731
- service: string;
1732
- };
1733
- attributes: {
1734
- id: {
1735
- type: "string";
1736
- required: true;
1737
- };
1738
- parentSpanId: {
1739
- type: "string";
1740
- required: false;
1741
- };
1742
- name: {
1743
- type: "string";
1744
- required: true;
1745
- };
1746
- traceId: {
1747
- type: "string";
1748
- required: true;
1749
- };
1750
- scope: {
1751
- type: "string";
1752
- required: true;
1753
- };
1754
- kind: {
1755
- type: "number";
1756
- required: true;
1757
- };
1758
- attributes: {
1759
- type: "string";
1760
- required: false;
1761
- set: (value?: any) => any;
1762
- get: (value?: string) => any;
1763
- };
1764
- status: {
1765
- type: "string";
1766
- required: false;
1767
- set: (value?: any) => any;
1768
- get: (value?: string) => string | undefined;
1769
- };
1770
- events: {
1771
- type: "string";
1772
- required: false;
1773
- set: (value?: any) => any;
1774
- get: (value?: string) => string | undefined;
1775
- };
1776
- links: {
1777
- type: "string";
1778
- required: false;
1779
- set: (value?: any) => any;
1780
- get: (value?: string) => string | undefined;
1781
- };
1782
- other: {
1783
- type: "string";
1784
- required: false;
1785
- };
1786
- startTime: {
1787
- type: "number";
1788
- required: true;
1789
- };
1790
- endTime: {
1791
- type: "number";
1792
- required: true;
1793
- };
1794
- createdAt: {
1795
- readonly type: "string";
1796
- readonly required: true;
1797
- readonly readOnly: true;
1798
- readonly set: (value?: Date | string) => string;
1799
- readonly default: () => string;
1800
- };
1801
- updatedAt: {
1802
- readonly type: "string";
1803
- readonly required: true;
1804
- readonly set: (value?: Date | string) => string;
1805
- readonly default: () => string;
1806
- };
1807
- metadata: {
1808
- readonly type: "string";
1809
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
1810
- readonly get: (value?: string) => any;
1811
- };
1812
- entity: {
1813
- type: "string";
1814
- required: true;
1815
- };
1816
- };
1817
- indexes: {
1818
- primary: {
1819
- pk: {
1820
- field: string;
1821
- composite: ("entity" | "id")[];
1822
- };
1823
- sk: {
1824
- field: string;
1825
- composite: never[];
1826
- };
1827
- };
1828
- byName: {
1829
- index: string;
1830
- pk: {
1831
- field: string;
1832
- composite: ("entity" | "name")[];
1833
- };
1834
- sk: {
1835
- field: string;
1836
- composite: "startTime"[];
1837
- };
1838
- };
1839
- byScope: {
1840
- index: string;
1841
- pk: {
1842
- field: string;
1843
- composite: ("entity" | "scope")[];
1844
- };
1845
- sk: {
1846
- field: string;
1847
- composite: "startTime"[];
1848
- };
1849
- };
1850
- };
1851
- }>;
1852
-
1853
- export declare class TracesStorageDynamoDB extends TracesStorage {
1854
- private service;
1855
- private operations;
1856
- constructor({ service, operations }: {
1857
- service: Service<Record<string, any>>;
1858
- operations: StoreOperationsDynamoDB;
1859
- });
1860
- getTraces(args: {
1861
- name?: string;
1862
- scope?: string;
1863
- page: number;
1864
- perPage: number;
1865
- attributes?: Record<string, string>;
1866
- filters?: Record<string, any>;
1867
- }): Promise<any[]>;
1868
- batchTraceInsert({ records }: {
1869
- records: Record<string, any>[];
1870
- }): Promise<void>;
1871
- getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
1872
- traces: Trace[];
1873
- }>;
1874
- }
1875
-
1876
- export declare const workflowSnapshotEntity: Entity<string, string, string, {
1877
- model: {
1878
- entity: string;
1879
- version: string;
1880
- service: string;
1881
- };
1882
- attributes: {
1883
- workflow_name: {
1884
- type: "string";
1885
- required: true;
1886
- };
1887
- run_id: {
1888
- type: "string";
1889
- required: true;
1890
- };
1891
- snapshot: {
1892
- type: "string";
1893
- required: true;
1894
- set: (value?: any) => any;
1895
- get: (value?: string) => any;
1896
- };
1897
- resourceId: {
1898
- type: "string";
1899
- required: false;
1900
- };
1901
- createdAt: {
1902
- readonly type: "string";
1903
- readonly required: true;
1904
- readonly readOnly: true;
1905
- readonly set: (value?: Date | string) => string;
1906
- readonly default: () => string;
1907
- };
1908
- updatedAt: {
1909
- readonly type: "string";
1910
- readonly required: true;
1911
- readonly set: (value?: Date | string) => string;
1912
- readonly default: () => string;
1913
- };
1914
- metadata: {
1915
- readonly type: "string";
1916
- readonly set: (value?: Record<string, unknown> | string) => string | undefined;
1917
- readonly get: (value?: string) => any;
1918
- };
1919
- entity: {
1920
- type: "string";
1921
- required: true;
1922
- };
1923
- };
1924
- indexes: {
1925
- primary: {
1926
- pk: {
1927
- field: string;
1928
- composite: ("entity" | "workflow_name")[];
1929
- };
1930
- sk: {
1931
- field: string;
1932
- composite: "run_id"[];
1933
- };
1934
- };
1935
- gsi2: {
1936
- index: string;
1937
- pk: {
1938
- field: string;
1939
- composite: ("entity" | "run_id")[];
1940
- };
1941
- sk: {
1942
- field: string;
1943
- composite: "workflow_name"[];
1944
- };
1945
- };
1946
- };
1947
- }>;
1948
-
1949
- export declare class WorkflowStorageDynamoDB extends WorkflowsStorage {
1950
- private service;
1951
- constructor({ service }: {
1952
- service: Service<Record<string, any>>;
1953
- });
1954
- persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
1955
- workflowName: string;
1956
- runId: string;
1957
- snapshot: WorkflowRunState;
1958
- }): Promise<void>;
1959
- loadWorkflowSnapshot({ workflowName, runId, }: {
1960
- workflowName: string;
1961
- runId: string;
1962
- }): Promise<WorkflowRunState | null>;
1963
- getWorkflowRuns(args?: {
1964
- workflowName?: string;
1965
- fromDate?: Date;
1966
- toDate?: Date;
1967
- limit?: number;
1968
- offset?: number;
1969
- resourceId?: string;
1970
- }): Promise<WorkflowRuns>;
1971
- getWorkflowRunById(args: {
1972
- runId: string;
1973
- workflowName?: string;
1974
- }): Promise<WorkflowRun | null>;
1975
- }
1976
-
1977
- export { }