@mastra/cloudflare-d1 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-update-stores-peerDeps-20250723031338

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.
@@ -1,42 +1,32 @@
1
+ import { default as Cloudflare_2 } from 'cloudflare';
1
2
  import type { D1Database as D1Database_2 } from '@cloudflare/workers-types';
2
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';
3
8
  import { MastraStorage } from '@mastra/core/storage';
4
- import type { MessageType } from '@mastra/core/memory';
5
- import type { MessageType as MessageType_2 } from '@mastra/core';
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';
6
14
  import type { StorageColumn } from '@mastra/core/storage';
15
+ import type { StorageDomains } from '@mastra/core/storage';
7
16
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
17
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
18
+ import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
19
+ import type { StoragePagination } from '@mastra/core/storage';
20
+ import type { StorageResourceType } from '@mastra/core/storage';
8
21
  import type { StorageThreadType } from '@mastra/core/memory';
22
+ import { StoreOperations } from '@mastra/core/storage';
9
23
  import type { TABLE_NAMES } from '@mastra/core/storage';
24
+ import type { Trace } from '@mastra/core/telemetry';
25
+ import { TracesStorage } from '@mastra/core/storage';
10
26
  import type { WorkflowRun } from '@mastra/core/storage';
11
27
  import type { WorkflowRuns } from '@mastra/core/storage';
12
28
  import type { WorkflowRunState } from '@mastra/core/workflows';
13
- import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
14
-
15
- export declare const checkWorkflowSnapshot: (snapshot: WorkflowRunState_2 | string, stepId: string, status: string) => void;
16
-
17
- export declare const createSampleMessage: (threadId: string) => MessageType_2;
18
-
19
- export declare const createSampleThread: () => {
20
- id: string;
21
- resourceId: string;
22
- title: string;
23
- createdAt: Date;
24
- updatedAt: Date;
25
- metadata: {
26
- key: string;
27
- };
28
- };
29
-
30
- export declare const createSampleThreadWithParams: (threadId: string, resourceId: string, createdAt: Date, updatedAt: Date) => {
31
- id: string;
32
- resourceId: string;
33
- title: string;
34
- createdAt: Date;
35
- updatedAt: Date;
36
- metadata: {
37
- key: string;
38
- };
39
- };
29
+ import { WorkflowsStorage } from '@mastra/core/storage';
40
30
 
41
31
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
42
32
  id: string;
@@ -55,14 +45,46 @@ export declare const createSampleTrace: (name: string, scope?: string, attribute
55
45
  createdAt: string;
56
46
  };
57
47
 
58
- export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
59
- snapshot: WorkflowRunState_2;
60
- runId: string;
61
- stepId: string;
62
- };
63
-
64
48
  export declare function createSqlBuilder(): SqlBuilder;
65
49
 
50
+ declare interface D1Client {
51
+ query(args: {
52
+ sql: string;
53
+ params: string[];
54
+ }): Promise<{
55
+ result: D1QueryResult;
56
+ }>;
57
+ }
58
+ export { D1Client }
59
+ export { D1Client as D1Client_alias_1 }
60
+
61
+ export declare interface D1Client_alias_2 {
62
+ query(args: {
63
+ sql: string;
64
+ params: string[];
65
+ }): Promise<{
66
+ result: D1QueryResult_alias_2;
67
+ }>;
68
+ }
69
+
70
+ export declare interface D1Client_alias_3 {
71
+ query(args: {
72
+ sql: string;
73
+ params: string[];
74
+ }): Promise<{
75
+ result: D1QueryResult_alias_3;
76
+ }>;
77
+ }
78
+
79
+ declare interface D1ClientConfig {
80
+ /** Optional prefix for table names */
81
+ tablePrefix?: string;
82
+ /** D1 Client */
83
+ client: D1Client;
84
+ }
85
+ export { D1ClientConfig }
86
+ export { D1ClientConfig as D1ClientConfig_alias_1 }
87
+
66
88
  /**
67
89
  * Configuration for D1 using the REST API
68
90
  */
@@ -79,41 +101,52 @@ declare interface D1Config {
79
101
  export { D1Config }
80
102
  export { D1Config as D1Config_alias_1 }
81
103
 
104
+ declare type D1QueryResult = Awaited<ReturnType<Cloudflare_2['d1']['database']['query']>>['result'];
105
+ export { D1QueryResult }
106
+ export { D1QueryResult as D1QueryResult_alias_1 }
107
+
108
+ export declare type D1QueryResult_alias_2 = Awaited<ReturnType<Cloudflare_2['d1']['database']['query']>>['result'];
109
+
110
+ export declare type D1QueryResult_alias_3 = Awaited<ReturnType<Cloudflare_2['d1']['database']['query']>>['result'];
111
+
82
112
  declare class D1Store extends MastraStorage {
83
113
  private client?;
84
- private accountId?;
85
- private databaseId?;
86
114
  private binding?;
87
115
  private tablePrefix;
116
+ stores: StorageDomains;
88
117
  /**
89
118
  * Creates a new D1Store instance
90
119
  * @param config Configuration for D1 access (either REST API or Workers Binding API)
91
120
  */
92
121
  constructor(config: D1StoreConfig);
93
- private getTableName;
94
- private formatSqlParams;
95
- private createIndexIfNotExists;
96
- private executeWorkersBindingQuery;
97
- private executeRestQuery;
122
+ get supports(): {
123
+ selectByIncludeResourceScope: boolean;
124
+ resourceWorkingMemory: boolean;
125
+ hasColumn: boolean;
126
+ createTable: boolean;
127
+ };
128
+ createTable({ tableName, schema, }: {
129
+ tableName: TABLE_NAMES;
130
+ schema: Record<string, StorageColumn>;
131
+ }): Promise<void>;
98
132
  /**
99
- * Execute a SQL query against the D1 database
100
- * @param options Query options including SQL, parameters, and whether to return only the first result
101
- * @returns Query results as an array or a single object if first=true
133
+ * Alters table schema to add columns if they don't exist
134
+ * @param tableName Name of the table
135
+ * @param schema Schema of the table
136
+ * @param ifNotExists Array of column names to add if they don't exist
102
137
  */
103
- private executeQuery;
104
- private getSqlType;
105
- private ensureDate;
106
- private serializeDate;
107
- private serializeValue;
108
- private deserializeValue;
109
- createTable({ tableName, schema, }: {
138
+ alterTable({ tableName, schema, ifNotExists, }: {
110
139
  tableName: TABLE_NAMES;
111
140
  schema: Record<string, StorageColumn>;
141
+ ifNotExists: string[];
112
142
  }): Promise<void>;
113
143
  clearTable({ tableName }: {
114
144
  tableName: TABLE_NAMES;
115
145
  }): Promise<void>;
116
- private processRecord;
146
+ dropTable({ tableName }: {
147
+ tableName: TABLE_NAMES;
148
+ }): Promise<void>;
149
+ hasColumn(table: string, column: string): Promise<boolean>;
117
150
  insert({ tableName, record }: {
118
151
  tableName: TABLE_NAMES;
119
152
  record: Record<string, any>;
@@ -125,9 +158,19 @@ declare class D1Store extends MastraStorage {
125
158
  getThreadById({ threadId }: {
126
159
  threadId: string;
127
160
  }): Promise<StorageThreadType | null>;
161
+ /**
162
+ * @deprecated use getThreadsByResourceIdPaginated instead
163
+ */
128
164
  getThreadsByResourceId({ resourceId }: {
129
165
  resourceId: string;
130
166
  }): Promise<StorageThreadType[]>;
167
+ getThreadsByResourceIdPaginated(args: {
168
+ resourceId: string;
169
+ page: number;
170
+ perPage: number;
171
+ }): Promise<PaginationInfo & {
172
+ threads: StorageThreadType[];
173
+ }>;
131
174
  saveThread({ thread }: {
132
175
  thread: StorageThreadType;
133
176
  }): Promise<StorageThreadType>;
@@ -139,10 +182,28 @@ declare class D1Store extends MastraStorage {
139
182
  deleteThread({ threadId }: {
140
183
  threadId: string;
141
184
  }): Promise<void>;
142
- saveMessages({ messages }: {
143
- messages: MessageType[];
144
- }): Promise<MessageType[]>;
145
- getMessages<T = MessageType>({ threadId, selectBy }: StorageGetMessagesArg): Promise<T[]>;
185
+ saveMessages(args: {
186
+ messages: MastraMessageV1[];
187
+ format?: undefined | 'v1';
188
+ }): Promise<MastraMessageV1[]>;
189
+ saveMessages(args: {
190
+ messages: MastraMessageV2[];
191
+ format: 'v2';
192
+ }): Promise<MastraMessageV2[]>;
193
+ /**
194
+ * @deprecated use getMessagesPaginated instead
195
+ */
196
+ getMessages(args: StorageGetMessagesArg & {
197
+ format?: 'v1';
198
+ }): Promise<MastraMessageV1[]>;
199
+ getMessages(args: StorageGetMessagesArg & {
200
+ format: 'v2';
201
+ }): Promise<MastraMessageV2[]>;
202
+ getMessagesPaginated({ threadId, selectBy, format, }: StorageGetMessagesArg & {
203
+ format?: 'v1' | 'v2';
204
+ }): Promise<PaginationInfo & {
205
+ messages: MastraMessageV1[] | MastraMessageV2[];
206
+ }>;
146
207
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
147
208
  workflowName: string;
148
209
  runId: string;
@@ -152,6 +213,18 @@ declare class D1Store extends MastraStorage {
152
213
  workflowName: string;
153
214
  runId: string;
154
215
  }): Promise<WorkflowRunState | null>;
216
+ getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
217
+ workflowName?: string;
218
+ fromDate?: Date;
219
+ toDate?: Date;
220
+ limit?: number;
221
+ offset?: number;
222
+ resourceId?: string;
223
+ }): Promise<WorkflowRuns>;
224
+ getWorkflowRunById({ runId, workflowName, }: {
225
+ runId: string;
226
+ workflowName?: string;
227
+ }): Promise<WorkflowRun | null>;
155
228
  /**
156
229
  * Insert multiple records in a batch operation
157
230
  * @param tableName The table to insert into
@@ -161,7 +234,10 @@ declare class D1Store extends MastraStorage {
161
234
  tableName: TABLE_NAMES;
162
235
  records: Record<string, any>[];
163
236
  }): Promise<void>;
164
- getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
237
+ /**
238
+ * @deprecated use getTracesPaginated instead
239
+ */
240
+ getTraces(args: {
165
241
  name?: string;
166
242
  scope?: string;
167
243
  page: number;
@@ -169,22 +245,68 @@ declare class D1Store extends MastraStorage {
169
245
  attributes?: Record<string, string>;
170
246
  fromDate?: Date;
171
247
  toDate?: Date;
172
- }): Promise<Record<string, any>[]>;
248
+ }): Promise<Trace[]>;
249
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
250
+ traces: Trace[];
251
+ }>;
252
+ /**
253
+ * @deprecated use getEvals instead
254
+ */
173
255
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
174
- private parseWorkflowRun;
175
- private hasColumn;
176
- getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
177
- workflowName?: string;
178
- fromDate?: Date;
179
- toDate?: Date;
180
- limit?: number;
181
- offset?: number;
182
- resourceId?: string;
183
- }): Promise<WorkflowRuns>;
184
- getWorkflowRunById({ runId, workflowName, }: {
256
+ getEvals(options: {
257
+ agentName?: string;
258
+ type?: 'test' | 'live';
259
+ } & PaginationArgs): Promise<PaginationInfo & {
260
+ evals: EvalRow[];
261
+ }>;
262
+ updateMessages(_args: {
263
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
264
+ id: string;
265
+ content?: {
266
+ metadata?: MastraMessageContentV2['metadata'];
267
+ content?: MastraMessageContentV2['content'];
268
+ };
269
+ }[];
270
+ }): Promise<MastraMessageV2[]>;
271
+ getResourceById({ resourceId }: {
272
+ resourceId: string;
273
+ }): Promise<StorageResourceType | null>;
274
+ saveResource({ resource }: {
275
+ resource: StorageResourceType;
276
+ }): Promise<StorageResourceType>;
277
+ updateResource({ resourceId, workingMemory, metadata, }: {
278
+ resourceId: string;
279
+ workingMemory?: string;
280
+ metadata?: Record<string, unknown>;
281
+ }): Promise<StorageResourceType>;
282
+ getScoreById({ id: _id }: {
283
+ id: string;
284
+ }): Promise<ScoreRowData | null>;
285
+ saveScore(_score: ScoreRowData): Promise<{
286
+ score: ScoreRowData;
287
+ }>;
288
+ getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
185
289
  runId: string;
186
- workflowName?: string;
187
- }): Promise<WorkflowRun | null>;
290
+ pagination: StoragePagination;
291
+ }): Promise<{
292
+ pagination: PaginationInfo;
293
+ scores: ScoreRowData[];
294
+ }>;
295
+ getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
296
+ pagination: StoragePagination;
297
+ entityId: string;
298
+ entityType: string;
299
+ }): Promise<{
300
+ pagination: PaginationInfo;
301
+ scores: ScoreRowData[];
302
+ }>;
303
+ getScoresByScorerId({ scorerId: _scorerId, pagination: _pagination, }: {
304
+ scorerId: string;
305
+ pagination: StoragePagination;
306
+ }): Promise<{
307
+ pagination: PaginationInfo;
308
+ scores: ScoreRowData[];
309
+ }>;
188
310
  /**
189
311
  * Close the database connection
190
312
  * No explicit cleanup needed for D1 in either REST or Workers Binding mode
@@ -197,7 +319,7 @@ export { D1Store as D1Store_alias_1 }
197
319
  /**
198
320
  * Combined configuration type supporting both REST API and Workers Binding API
199
321
  */
200
- declare type D1StoreConfig = D1Config | D1WorkersConfig;
322
+ declare type D1StoreConfig = D1Config | D1WorkersConfig | D1ClientConfig;
201
323
  export { D1StoreConfig }
202
324
  export { D1StoreConfig as D1StoreConfig_alias_1 }
203
325
 
@@ -213,9 +335,163 @@ declare interface D1WorkersConfig {
213
335
  export { D1WorkersConfig }
214
336
  export { D1WorkersConfig as D1WorkersConfig_alias_1 }
215
337
 
338
+ export declare function deserializeValue(value: any, type?: string): any;
339
+
340
+ export declare function isArrayOfRecords(value: any): value is Record<string, any>[];
341
+
342
+ export declare class LegacyEvalsStorageD1 extends LegacyEvalsStorage {
343
+ private operations;
344
+ constructor({ operations }: {
345
+ operations: StoreOperationsD1;
346
+ });
347
+ getEvals(options: {
348
+ agentName?: string;
349
+ type?: 'test' | 'live';
350
+ } & PaginationArgs): Promise<PaginationInfo & {
351
+ evals: EvalRow[];
352
+ }>;
353
+ /**
354
+ * @deprecated use getEvals instead
355
+ */
356
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
357
+ }
358
+
359
+ export declare class MemoryStorageD1 extends MemoryStorage {
360
+ private operations;
361
+ constructor({ operations }: {
362
+ operations: StoreOperationsD1;
363
+ });
364
+ getResourceById({ resourceId }: {
365
+ resourceId: string;
366
+ }): Promise<StorageResourceType | null>;
367
+ saveResource({ resource }: {
368
+ resource: StorageResourceType;
369
+ }): Promise<StorageResourceType>;
370
+ updateResource({ resourceId, workingMemory, metadata, }: {
371
+ resourceId: string;
372
+ workingMemory?: string;
373
+ metadata?: Record<string, unknown>;
374
+ }): Promise<StorageResourceType>;
375
+ getThreadById({ threadId }: {
376
+ threadId: string;
377
+ }): Promise<StorageThreadType | null>;
378
+ /**
379
+ * @deprecated use getThreadsByResourceIdPaginated instead
380
+ */
381
+ getThreadsByResourceId({ resourceId }: {
382
+ resourceId: string;
383
+ }): Promise<StorageThreadType[]>;
384
+ getThreadsByResourceIdPaginated(args: {
385
+ resourceId: string;
386
+ page: number;
387
+ perPage: number;
388
+ }): Promise<PaginationInfo & {
389
+ threads: StorageThreadType[];
390
+ }>;
391
+ saveThread({ thread }: {
392
+ thread: StorageThreadType;
393
+ }): Promise<StorageThreadType>;
394
+ updateThread({ id, title, metadata, }: {
395
+ id: string;
396
+ title: string;
397
+ metadata: Record<string, unknown>;
398
+ }): Promise<StorageThreadType>;
399
+ deleteThread({ threadId }: {
400
+ threadId: string;
401
+ }): Promise<void>;
402
+ saveMessages(args: {
403
+ messages: MastraMessageV1[];
404
+ format?: undefined | 'v1';
405
+ }): Promise<MastraMessageV1[]>;
406
+ saveMessages(args: {
407
+ messages: MastraMessageV2[];
408
+ format: 'v2';
409
+ }): Promise<MastraMessageV2[]>;
410
+ private _getIncludedMessages;
411
+ /**
412
+ * @deprecated use getMessagesPaginated instead
413
+ */
414
+ getMessages(args: StorageGetMessagesArg & {
415
+ format?: 'v1';
416
+ }): Promise<MastraMessageV1[]>;
417
+ getMessages(args: StorageGetMessagesArg & {
418
+ format: 'v2';
419
+ }): Promise<MastraMessageV2[]>;
420
+ getMessagesPaginated({ threadId, selectBy, format, }: StorageGetMessagesArg & {
421
+ format?: 'v1' | 'v2';
422
+ }): Promise<PaginationInfo & {
423
+ messages: MastraMessageV1[] | MastraMessageV2[];
424
+ }>;
425
+ updateMessages(args: {
426
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
427
+ id: string;
428
+ content?: {
429
+ metadata?: MastraMessageContentV2['metadata'];
430
+ content?: MastraMessageContentV2['content'];
431
+ };
432
+ }[];
433
+ }): Promise<MastraMessageV2[]>;
434
+ }
435
+
436
+ /**
437
+ * Parses and returns a valid SQL SELECT column identifier.
438
+ * Allows a single identifier (letters, numbers, underscores), or '*', optionally with 'AS alias'.
439
+ *
440
+ * @param column - The column identifier string to parse.
441
+ * @returns The validated column identifier as a branded type.
442
+ * @throws {Error} If invalid.
443
+ *
444
+ * @example
445
+ * const col = parseSelectIdentifier('user_id'); // Ok
446
+ * parseSelectIdentifier('user_id AS uid'); // Ok
447
+ * parseSelectIdentifier('*'); // Ok
448
+ * parseSelectIdentifier('user id'); // Throws error
449
+ */
450
+ export declare function parseSelectIdentifier(column: string): SelectIdentifier;
451
+
216
452
  export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
217
453
  interval?: number) => Promise<T>;
218
454
 
455
+ export declare class ScoresStorageD1 extends ScoresStorage {
456
+ private operations;
457
+ constructor({ operations }: {
458
+ operations: StoreOperationsD1;
459
+ });
460
+ getScoreById({ id }: {
461
+ id: string;
462
+ }): Promise<ScoreRowData | null>;
463
+ saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
464
+ score: ScoreRowData;
465
+ }>;
466
+ getScoresByScorerId({ scorerId, pagination, }: {
467
+ scorerId: string;
468
+ pagination: StoragePagination;
469
+ }): Promise<{
470
+ pagination: PaginationInfo;
471
+ scores: ScoreRowData[];
472
+ }>;
473
+ getScoresByRunId({ runId, pagination, }: {
474
+ runId: string;
475
+ pagination: StoragePagination;
476
+ }): Promise<{
477
+ pagination: PaginationInfo;
478
+ scores: ScoreRowData[];
479
+ }>;
480
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
481
+ pagination: StoragePagination;
482
+ entityId: string;
483
+ entityType: string;
484
+ }): Promise<{
485
+ pagination: PaginationInfo;
486
+ scores: ScoreRowData[];
487
+ }>;
488
+ }
489
+
490
+ /** Represents a validated SQL SELECT column identifier (or '*', optionally with 'AS alias'). */
491
+ declare type SelectIdentifier = string & {
492
+ __brand: 'SelectIdentifier';
493
+ };
494
+
219
495
  /**
220
496
  * SQL Builder class for constructing type-safe SQL queries
221
497
  * This helps create maintainable and secure SQL queries with proper parameter handling
@@ -279,7 +555,6 @@ export declare class SqlBuilder {
279
555
  * @returns The builder instance
280
556
  */
281
557
  createIndex(indexName: string, tableName: string, columnName: string, indexType?: string): SqlBuilder;
282
- raw(sql: string, ...params: SqlParam[]): SqlBuilder;
283
558
  /**
284
559
  * Add a LIKE condition to the query
285
560
  * @param column The column to check
@@ -317,7 +592,7 @@ export declare type SqlParam = string | number | boolean | null | undefined;
317
592
  /**
318
593
  * Interface for SQL query options with generic type support
319
594
  */
320
- declare interface SqlQueryOptions {
595
+ export declare interface SqlQueryOptions {
321
596
  /** SQL query to execute */
322
597
  sql: string;
323
598
  /** Parameters to bind to the query */
@@ -325,7 +600,107 @@ declare interface SqlQueryOptions {
325
600
  /** Whether to return only the first result */
326
601
  first?: boolean;
327
602
  }
328
- export { SqlQueryOptions }
329
- export { SqlQueryOptions as SqlQueryOptions_alias_1 }
603
+
604
+ export declare class StoreOperationsD1 extends StoreOperations {
605
+ private client?;
606
+ private binding?;
607
+ private tablePrefix;
608
+ constructor(config: StoreOperationsD1Config);
609
+ hasColumn(table: string, column: string): Promise<boolean>;
610
+ getTableName(tableName: TABLE_NAMES): string;
611
+ private formatSqlParams;
612
+ private executeWorkersBindingQuery;
613
+ private executeRestQuery;
614
+ executeQuery(options: SqlQueryOptions): Promise<Record<string, any>[] | Record<string, any> | null>;
615
+ private getTableColumns;
616
+ private serializeValue;
617
+ protected getSqlType(type: StorageColumn['type']): string;
618
+ createTable({ tableName, schema, }: {
619
+ tableName: TABLE_NAMES;
620
+ schema: Record<string, StorageColumn>;
621
+ }): Promise<void>;
622
+ clearTable({ tableName }: {
623
+ tableName: TABLE_NAMES;
624
+ }): Promise<void>;
625
+ dropTable({ tableName }: {
626
+ tableName: TABLE_NAMES;
627
+ }): Promise<void>;
628
+ alterTable(args: {
629
+ tableName: TABLE_NAMES;
630
+ schema: Record<string, StorageColumn>;
631
+ ifNotExists: string[];
632
+ }): Promise<void>;
633
+ insert({ tableName, record }: {
634
+ tableName: TABLE_NAMES;
635
+ record: Record<string, any>;
636
+ }): Promise<void>;
637
+ batchInsert({ tableName, records }: {
638
+ tableName: TABLE_NAMES;
639
+ records: Record<string, any>[];
640
+ }): Promise<void>;
641
+ load<R>({ tableName, keys }: {
642
+ tableName: TABLE_NAMES;
643
+ keys: Record<string, string>;
644
+ }): Promise<R | null>;
645
+ processRecord(record: Record<string, any>): Promise<Record<string, any>>;
646
+ /**
647
+ * Upsert multiple records in a batch operation
648
+ * @param tableName The table to insert into
649
+ * @param records The records to insert
650
+ */
651
+ batchUpsert({ tableName, records }: {
652
+ tableName: TABLE_NAMES;
653
+ records: Record<string, any>[];
654
+ }): Promise<void>;
655
+ }
656
+
657
+ export declare interface StoreOperationsD1Config {
658
+ client?: D1Client_alias_2;
659
+ binding?: D1Database_2;
660
+ tablePrefix?: string;
661
+ }
662
+
663
+ export declare class TracesStorageD1 extends TracesStorage {
664
+ private operations;
665
+ constructor({ operations }: {
666
+ operations: StoreOperationsD1;
667
+ });
668
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
669
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
670
+ traces: Trace[];
671
+ }>;
672
+ batchTraceInsert({ records }: {
673
+ records: Record<string, any>[];
674
+ }): Promise<void>;
675
+ }
676
+
677
+ export declare class WorkflowsStorageD1 extends WorkflowsStorage {
678
+ private operations;
679
+ constructor({ operations }: {
680
+ operations: StoreOperationsD1;
681
+ });
682
+ persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
683
+ workflowName: string;
684
+ runId: string;
685
+ snapshot: WorkflowRunState;
686
+ }): Promise<void>;
687
+ loadWorkflowSnapshot(params: {
688
+ workflowName: string;
689
+ runId: string;
690
+ }): Promise<WorkflowRunState | null>;
691
+ private parseWorkflowRun;
692
+ getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
693
+ workflowName?: string;
694
+ fromDate?: Date;
695
+ toDate?: Date;
696
+ limit?: number;
697
+ offset?: number;
698
+ resourceId?: string;
699
+ }): Promise<WorkflowRuns>;
700
+ getWorkflowRunById({ runId, workflowName, }: {
701
+ runId: string;
702
+ workflowName?: string;
703
+ }): Promise<WorkflowRun | null>;
704
+ }
330
705
 
331
706
  export { }