@mastra/cloudflare 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-transpile-packages-20250724123433

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,7 +1,15 @@
1
- Copyright 2025 Mastra AI, Inc.
1
+ # Apache License 2.0
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Copyright (c) 2025 Kepler Software, Inc.
4
4
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
6
8
 
7
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
@@ -1,26 +1,47 @@
1
+ import type { default as Cloudflare_2 } from 'cloudflare';
1
2
  import type { EvalRow } from '@mastra/core/storage';
2
3
  import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types';
3
4
  import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types';
5
+ import { LegacyEvalsStorage } from '@mastra/core/storage';
6
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
4
7
  import type { MastraMessageV1 } from '@mastra/core/memory';
5
- import type { MastraMessageV2 } from '@mastra/core/agent';
6
- import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
7
- import type { MastraMessageV2 as MastraMessageV2_3 } from '@mastra/core';
8
+ import type { MastraMessageV1 as MastraMessageV1_2 } from '@mastra/core';
9
+ import type { MastraMessageV2 } from '@mastra/core/memory';
10
+ import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core';
8
11
  import { MastraStorage } from '@mastra/core/storage';
12
+ import { MemoryStorage } from '@mastra/core/storage';
13
+ import type { PaginationArgs } from '@mastra/core/storage';
14
+ import type { PaginationInfo } from '@mastra/core/storage';
15
+ import type { PaginationInfo as PaginationInfo_2 } from '@mastra/core';
16
+ import type { ScoreRowData } from '@mastra/core/scores';
17
+ import { ScoresStorage } from '@mastra/core/storage';
9
18
  import type { StorageColumn } from '@mastra/core/storage';
19
+ import type { StorageDomains } from '@mastra/core/storage';
10
20
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
21
+ import type { StorageGetMessagesArg as StorageGetMessagesArg_2 } from '@mastra/core';
22
+ import type { StorageGetTracesArg } from '@mastra/core/storage';
23
+ import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
24
+ import type { StoragePagination } from '@mastra/core/storage';
25
+ import type { StorageResourceType } from '@mastra/core/storage';
26
+ import type { StorageResourceType as StorageResourceType_2 } from '@mastra/core';
11
27
  import type { StorageThreadType } from '@mastra/core/memory';
28
+ import type { StorageThreadType as StorageThreadType_2 } from '@mastra/core';
29
+ import { StoreOperations } from '@mastra/core/storage';
12
30
  import type { TABLE_EVALS } from '@mastra/core/storage';
13
31
  import type { TABLE_MESSAGES } from '@mastra/core/storage';
14
32
  import type { TABLE_NAMES } from '@mastra/core/storage';
33
+ import type { TABLE_RESOURCES } from '@mastra/core/storage';
34
+ import type { TABLE_SCORERS } from '@mastra/core/storage';
15
35
  import type { TABLE_THREADS } from '@mastra/core/storage';
16
36
  import type { TABLE_TRACES } from '@mastra/core/storage';
17
37
  import type { TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
38
+ import type { Trace } from '@mastra/core/telemetry';
39
+ import { TracesStorage } from '@mastra/core/storage';
18
40
  import type { WorkflowRun } from '@mastra/core/storage';
19
41
  import type { WorkflowRuns } from '@mastra/core/storage';
20
42
  import type { WorkflowRunState } from '@mastra/core/workflows';
21
43
  import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
22
-
23
- export declare const checkWorkflowSnapshot: (snapshot: WorkflowRunState_2 | string, stepId: string, status: string) => void;
44
+ import { WorkflowsStorage } from '@mastra/core/storage';
24
45
 
25
46
  /**
26
47
  * Configuration for Cloudflare KV using REST API
@@ -39,6 +60,7 @@ export declare interface CloudflareRestConfig {
39
60
  }
40
61
 
41
62
  declare class CloudflareStore extends MastraStorage {
63
+ stores: StorageDomains;
42
64
  private client?;
43
65
  private accountId?;
44
66
  private namespacePrefix;
@@ -46,79 +68,21 @@ declare class CloudflareStore extends MastraStorage {
46
68
  private validateWorkersConfig;
47
69
  private validateRestConfig;
48
70
  constructor(config: CloudflareStoreConfig);
49
- private getBinding;
50
- private listNamespaces;
51
- private getNamespaceValue;
52
- private putNamespaceValue;
53
- private deleteNamespaceValue;
54
- listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<KVNamespaceListKey_2<unknown, string>[]>;
55
- private createNamespaceById;
56
- private getNamespaceIdByName;
57
- private createNamespace;
58
- private getOrCreateNamespaceId;
59
- private getNamespaceId;
60
- private LEGACY_NAMESPACE_MAP;
61
- /**
62
- * There were a few legacy mappings for tables such as
63
- * - messages -> threads
64
- * - workflow_snapshot -> mastra_workflows
65
- * - traces -> evals
66
- * This has been updated to use dedicated namespaces for each table.
67
- * In the case of data for a table existing in the legacy namespace, warn the user to migrate to the new namespace.
68
- *
69
- * @param tableName The table name to check for legacy data
70
- * @param prefix The namespace prefix
71
- * @returns The legacy namespace ID if data exists; otherwise, null
72
- */
73
- private checkLegacyNamespace;
74
- /**
75
- * Helper to safely serialize data for KV storage
76
- */
77
- private safeSerialize;
78
- /**
79
- * Helper to safely parse data from KV storage
80
- */
81
- private safeParse;
82
- private putKV;
83
- private getKV;
84
- private deleteKV;
85
- private listKV;
86
- private getSortedMessages;
87
- private updateSorting;
88
- private getIncludedMessagesWithContext;
89
- private getRecentMessages;
90
- private fetchAndParseMessages;
91
- /**
92
- * Queue for serializing sorted order updates.
93
- * Updates the sorted order for a given key. This operation is eventually consistent.
94
- */
95
- private updateQueue;
96
- /**
97
- * Updates the sorted order for a given key. This operation is eventually consistent.
98
- * Note: Operations on the same orderKey are serialized using a queue to prevent
99
- * concurrent updates from conflicting with each other.
100
- */
101
- private updateSortedMessages;
102
- private getRank;
103
- private getRange;
104
- private getLastN;
105
- private getFullOrder;
106
- private getKey;
107
- private getSchemaKey;
108
- private getTableSchema;
109
- private validateColumnValue;
110
- private validateAgainstSchema;
111
- private validateRecord;
112
- private ensureDate;
113
- private serializeDate;
114
- private ensureMetadata;
115
71
  createTable({ tableName, schema, }: {
116
72
  tableName: TABLE_NAMES;
117
73
  schema: Record<string, StorageColumn>;
118
74
  }): Promise<void>;
75
+ alterTable(_args: {
76
+ tableName: TABLE_NAMES;
77
+ schema: Record<string, StorageColumn>;
78
+ ifNotExists: string[];
79
+ }): Promise<void>;
119
80
  clearTable({ tableName }: {
120
81
  tableName: TABLE_NAMES;
121
82
  }): Promise<void>;
83
+ dropTable({ tableName }: {
84
+ tableName: TABLE_NAMES;
85
+ }): Promise<void>;
122
86
  insert<T extends TABLE_NAMES>({ tableName, record, }: {
123
87
  tableName: T;
124
88
  record: Record<string, any>;
@@ -144,8 +108,6 @@ declare class CloudflareStore extends MastraStorage {
144
108
  deleteThread({ threadId }: {
145
109
  threadId: string;
146
110
  }): Promise<void>;
147
- private getMessageKey;
148
- private getThreadMessagesKey;
149
111
  saveMessages(args: {
150
112
  messages: MastraMessageV1[];
151
113
  format?: undefined | 'v1';
@@ -160,18 +122,12 @@ declare class CloudflareStore extends MastraStorage {
160
122
  getMessages(args: StorageGetMessagesArg & {
161
123
  format: 'v2';
162
124
  }): Promise<MastraMessageV2[]>;
163
- private validateWorkflowParams;
164
- private validateWorkflowState;
165
- private normalizeSteps;
166
- private normalizeWorkflowState;
167
125
  persistWorkflowSnapshot(params: {
168
- namespace: string;
169
126
  workflowName: string;
170
127
  runId: string;
171
128
  snapshot: WorkflowRunState;
172
129
  }): Promise<void>;
173
130
  loadWorkflowSnapshot(params: {
174
- namespace: string;
175
131
  workflowName: string;
176
132
  runId: string;
177
133
  }): Promise<WorkflowRunState | null>;
@@ -188,12 +144,18 @@ declare class CloudflareStore extends MastraStorage {
188
144
  fromDate?: Date;
189
145
  toDate?: Date;
190
146
  }): Promise<any[]>;
191
- private parseJSON;
192
- getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
193
- private parseWorkflowRun;
194
- private buildWorkflowSnapshotPrefix;
195
- getWorkflowRuns({ namespace, workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
196
- namespace?: string;
147
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
148
+ getEvals(options: {
149
+ agentName?: string;
150
+ type?: 'test' | 'live';
151
+ dateRange?: {
152
+ start?: Date;
153
+ end?: Date;
154
+ };
155
+ } & PaginationArgs): Promise<PaginationInfo & {
156
+ evals: EvalRow[];
157
+ }>;
158
+ getWorkflowRuns({ workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
197
159
  workflowName?: string;
198
160
  limit?: number;
199
161
  offset?: number;
@@ -201,11 +163,71 @@ declare class CloudflareStore extends MastraStorage {
201
163
  fromDate?: Date;
202
164
  toDate?: Date;
203
165
  }): Promise<WorkflowRuns>;
204
- getWorkflowRunById({ namespace, runId, workflowName, }: {
205
- namespace: string;
166
+ getWorkflowRunById({ runId, workflowName, }: {
206
167
  runId: string;
207
168
  workflowName: string;
208
169
  }): Promise<WorkflowRun | null>;
170
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
171
+ traces: Trace[];
172
+ }>;
173
+ getThreadsByResourceIdPaginated(args: {
174
+ resourceId: string;
175
+ page: number;
176
+ perPage: number;
177
+ }): Promise<PaginationInfo & {
178
+ threads: StorageThreadType[];
179
+ }>;
180
+ getMessagesPaginated(args: StorageGetMessagesArg): Promise<PaginationInfo & {
181
+ messages: MastraMessageV1[] | MastraMessageV2[];
182
+ }>;
183
+ updateMessages(args: {
184
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
185
+ id: string;
186
+ content?: {
187
+ metadata?: MastraMessageContentV2['metadata'];
188
+ content?: MastraMessageContentV2['content'];
189
+ };
190
+ }[];
191
+ }): Promise<MastraMessageV2[]>;
192
+ getScoreById({ id }: {
193
+ id: string;
194
+ }): Promise<ScoreRowData | null>;
195
+ saveScore(score: ScoreRowData): Promise<{
196
+ score: ScoreRowData;
197
+ }>;
198
+ getScoresByRunId({ runId, pagination, }: {
199
+ runId: string;
200
+ pagination: StoragePagination;
201
+ }): Promise<{
202
+ pagination: PaginationInfo;
203
+ scores: ScoreRowData[];
204
+ }>;
205
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
206
+ pagination: StoragePagination;
207
+ entityId: string;
208
+ entityType: string;
209
+ }): Promise<{
210
+ pagination: PaginationInfo;
211
+ scores: ScoreRowData[];
212
+ }>;
213
+ getScoresByScorerId({ scorerId, pagination, }: {
214
+ scorerId: string;
215
+ pagination: StoragePagination;
216
+ }): Promise<{
217
+ pagination: PaginationInfo;
218
+ scores: ScoreRowData[];
219
+ }>;
220
+ getResourceById({ resourceId }: {
221
+ resourceId: string;
222
+ }): Promise<StorageResourceType | null>;
223
+ saveResource({ resource }: {
224
+ resource: StorageResourceType;
225
+ }): Promise<StorageResourceType>;
226
+ updateResource({ resourceId, workingMemory, metadata, }: {
227
+ resourceId: string;
228
+ workingMemory?: string;
229
+ metadata?: Record<string, unknown>;
230
+ }): Promise<StorageResourceType>;
209
231
  close(): Promise<void>;
210
232
  }
211
233
  export { CloudflareStore }
@@ -228,19 +250,6 @@ export declare interface CloudflareWorkersConfig {
228
250
  keyPrefix?: string;
229
251
  }
230
252
 
231
- export declare const createSampleMessage: (threadId: string, parts?: MastraMessageV2_3["content"]["parts"]) => MastraMessageV2_3;
232
-
233
- export declare const createSampleThread: () => {
234
- id: string;
235
- resourceId: string;
236
- title: string;
237
- createdAt: Date;
238
- updatedAt: Date;
239
- metadata: {
240
- key: string;
241
- };
242
- };
243
-
244
253
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
245
254
  id: string;
246
255
  parentSpanId: string;
@@ -283,20 +292,292 @@ export declare interface KVOperation {
283
292
  metadata?: any;
284
293
  }
285
294
 
295
+ export declare class LegacyEvalsStorageCloudflare extends LegacyEvalsStorage {
296
+ operations: StoreOperationsCloudflare;
297
+ constructor({ operations }: {
298
+ operations: StoreOperationsCloudflare;
299
+ });
300
+ getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
301
+ getEvals(options: {
302
+ agentName?: string;
303
+ type?: 'test' | 'live';
304
+ dateRange?: {
305
+ start?: Date;
306
+ end?: Date;
307
+ };
308
+ } & PaginationArgs): Promise<PaginationInfo & {
309
+ evals: EvalRow[];
310
+ }>;
311
+ }
312
+
286
313
  export declare type ListOptions = {
287
314
  limit?: number;
288
315
  prefix?: string;
289
316
  };
290
317
 
318
+ export declare class MemoryStorageCloudflare extends MemoryStorage {
319
+ operations: StoreOperationsCloudflare;
320
+ constructor({ operations }: {
321
+ operations: StoreOperationsCloudflare;
322
+ });
323
+ private ensureMetadata;
324
+ getThreadById({ threadId }: {
325
+ threadId: string;
326
+ }): Promise<StorageThreadType_2 | null>;
327
+ getThreadsByResourceId({ resourceId }: {
328
+ resourceId: string;
329
+ }): Promise<StorageThreadType_2[]>;
330
+ getThreadsByResourceIdPaginated(args: {
331
+ resourceId: string;
332
+ page?: number;
333
+ perPage?: number;
334
+ }): Promise<PaginationInfo_2 & {
335
+ threads: StorageThreadType_2[];
336
+ }>;
337
+ saveThread({ thread }: {
338
+ thread: StorageThreadType_2;
339
+ }): Promise<StorageThreadType_2>;
340
+ updateThread({ id, title, metadata, }: {
341
+ id: string;
342
+ title: string;
343
+ metadata: Record<string, unknown>;
344
+ }): Promise<StorageThreadType_2>;
345
+ private getMessageKey;
346
+ private getThreadMessagesKey;
347
+ deleteThread({ threadId }: {
348
+ threadId: string;
349
+ }): Promise<void>;
350
+ private findMessageInAnyThread;
351
+ /**
352
+ * Queue for serializing sorted order updates.
353
+ * Updates the sorted order for a given key. This operation is eventually consistent.
354
+ */
355
+ private updateQueue;
356
+ private updateSorting;
357
+ /**
358
+ * Updates the sorted order for a given key. This operation is eventually consistent.
359
+ * Note: Operations on the same orderKey are serialized using a queue to prevent
360
+ * concurrent updates from conflicting with each other.
361
+ */
362
+ private updateSortedMessages;
363
+ private getSortedMessages;
364
+ private migrateMessage;
365
+ saveMessages(args: {
366
+ messages: MastraMessageV1_2[];
367
+ format?: undefined | 'v1';
368
+ }): Promise<MastraMessageV1_2[]>;
369
+ saveMessages(args: {
370
+ messages: MastraMessageV2_2[];
371
+ format: 'v2';
372
+ }): Promise<MastraMessageV2_2[]>;
373
+ private getRank;
374
+ private getRange;
375
+ private getLastN;
376
+ private getFullOrder;
377
+ private getIncludedMessagesWithContext;
378
+ private getRecentMessages;
379
+ private fetchAndParseMessagesFromMultipleThreads;
380
+ getMessages(args: StorageGetMessagesArg_2 & {
381
+ format?: 'v1';
382
+ }): Promise<MastraMessageV1_2[]>;
383
+ getMessages(args: StorageGetMessagesArg_2 & {
384
+ format: 'v2';
385
+ }): Promise<MastraMessageV2_2[]>;
386
+ getMessagesPaginated(args: StorageGetMessagesArg_2): Promise<PaginationInfo_2 & {
387
+ messages: MastraMessageV1_2[] | MastraMessageV2_2[];
388
+ }>;
389
+ updateMessages(args: {
390
+ messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
391
+ id: string;
392
+ threadId?: string;
393
+ content?: {
394
+ metadata?: MastraMessageContentV2['metadata'];
395
+ content?: MastraMessageContentV2['content'];
396
+ };
397
+ })[];
398
+ }): Promise<MastraMessageV2_2[]>;
399
+ getResourceById({ resourceId }: {
400
+ resourceId: string;
401
+ }): Promise<StorageResourceType_2 | null>;
402
+ saveResource({ resource }: {
403
+ resource: StorageResourceType_2;
404
+ }): Promise<StorageResourceType_2>;
405
+ updateResource({ resourceId, workingMemory, metadata, }: {
406
+ resourceId: string;
407
+ workingMemory?: string;
408
+ metadata?: Record<string, unknown>;
409
+ }): Promise<StorageResourceType_2>;
410
+ }
411
+
291
412
  export declare type RecordTypes = {
292
413
  [TABLE_THREADS]: StorageThreadType;
293
- [TABLE_MESSAGES]: MastraMessageV2_2;
414
+ [TABLE_MESSAGES]: MastraMessageV2;
294
415
  [TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
295
416
  [TABLE_EVALS]: EvalRow;
417
+ [TABLE_SCORERS]: ScoreRowData;
296
418
  [TABLE_TRACES]: any;
419
+ [TABLE_RESOURCES]: StorageResourceType;
297
420
  };
298
421
 
299
422
  export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
300
423
  interval?: number) => Promise<T>;
301
424
 
425
+ export declare class ScoresStorageCloudflare extends ScoresStorage {
426
+ private operations;
427
+ constructor({ operations }: {
428
+ operations: StoreOperationsCloudflare;
429
+ });
430
+ getScoreById({ id }: {
431
+ id: string;
432
+ }): Promise<ScoreRowData | null>;
433
+ saveScore(score: Omit<ScoreRowData, 'createdAt' | 'updatedAt'>): Promise<{
434
+ score: ScoreRowData;
435
+ }>;
436
+ getScoresByScorerId({ scorerId, pagination, }: {
437
+ scorerId: string;
438
+ pagination: StoragePagination;
439
+ }): Promise<{
440
+ pagination: PaginationInfo;
441
+ scores: ScoreRowData[];
442
+ }>;
443
+ getScoresByRunId({ runId, pagination, }: {
444
+ runId: string;
445
+ pagination: StoragePagination;
446
+ }): Promise<{
447
+ pagination: PaginationInfo;
448
+ scores: ScoreRowData[];
449
+ }>;
450
+ getScoresByEntityId({ entityId, entityType, pagination, }: {
451
+ pagination: StoragePagination;
452
+ entityId: string;
453
+ entityType: string;
454
+ }): Promise<{
455
+ pagination: PaginationInfo;
456
+ scores: ScoreRowData[];
457
+ }>;
458
+ }
459
+
460
+ export declare class StoreOperationsCloudflare extends StoreOperations {
461
+ private bindings?;
462
+ client?: Cloudflare_2;
463
+ accountId?: string;
464
+ namespacePrefix: string;
465
+ constructor({ namespacePrefix, bindings, client, accountId, }: {
466
+ bindings?: Record<TABLE_NAMES, KVNamespace_2>;
467
+ namespacePrefix: string;
468
+ client?: Cloudflare_2;
469
+ accountId?: string;
470
+ });
471
+ hasColumn(): Promise<boolean>;
472
+ alterTable(_args: {
473
+ tableName: TABLE_NAMES;
474
+ schema: Record<string, StorageColumn>;
475
+ ifNotExists: string[];
476
+ }): Promise<void>;
477
+ clearTable({ tableName }: {
478
+ tableName: TABLE_NAMES;
479
+ }): Promise<void>;
480
+ dropTable({ tableName }: {
481
+ tableName: TABLE_NAMES;
482
+ }): Promise<void>;
483
+ private getBinding;
484
+ getKey<T extends TABLE_NAMES>(tableName: T, record: Record<string, string>): string;
485
+ private getSchemaKey;
486
+ /**
487
+ * Helper to safely parse data from KV storage
488
+ */
489
+ private safeParse;
490
+ private createNamespaceById;
491
+ private createNamespace;
492
+ private listNamespaces;
493
+ private getNamespaceIdByName;
494
+ private getOrCreateNamespaceId;
495
+ private getNamespaceId;
496
+ private getNamespaceValue;
497
+ getKV(tableName: TABLE_NAMES, key: string): Promise<any>;
498
+ private getTableSchema;
499
+ private validateColumnValue;
500
+ private validateAgainstSchema;
501
+ private validateRecord;
502
+ insert({ tableName, record }: {
503
+ tableName: TABLE_NAMES;
504
+ record: Record<string, any>;
505
+ }): Promise<void>;
506
+ private ensureMetadata;
507
+ load<R>({ tableName, keys }: {
508
+ tableName: TABLE_NAMES;
509
+ keys: Record<string, string>;
510
+ }): Promise<R | null>;
511
+ batchInsert<T extends TABLE_NAMES>(input: {
512
+ tableName: T;
513
+ records: Partial<RecordTypes[T]>[];
514
+ }): Promise<void>;
515
+ /**
516
+ * Helper to safely serialize data for KV storage
517
+ */
518
+ private safeSerialize;
519
+ private putNamespaceValue;
520
+ putKV({ tableName, key, value, metadata, }: {
521
+ tableName: TABLE_NAMES;
522
+ key: string;
523
+ value: any;
524
+ metadata?: any;
525
+ }): Promise<void>;
526
+ createTable({ tableName, schema, }: {
527
+ tableName: TABLE_NAMES;
528
+ schema: Record<string, StorageColumn>;
529
+ }): Promise<void>;
530
+ listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<KVNamespaceListKey_2<unknown, string>[]>;
531
+ private deleteNamespaceValue;
532
+ deleteKV(tableName: TABLE_NAMES, key: string): Promise<void>;
533
+ listKV(tableName: TABLE_NAMES, options?: ListOptions): Promise<Array<{
534
+ name: string;
535
+ }>>;
536
+ }
537
+
538
+ export declare class TracesStorageCloudflare extends TracesStorage {
539
+ private operations;
540
+ constructor({ operations }: {
541
+ operations: StoreOperationsCloudflare;
542
+ });
543
+ getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
544
+ getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
545
+ traces: Trace[];
546
+ }>;
547
+ batchTraceInsert({ records }: {
548
+ records: Record<string, any>[];
549
+ }): Promise<void>;
550
+ }
551
+
552
+ export declare class WorkflowsStorageCloudflare extends WorkflowsStorage {
553
+ private operations;
554
+ constructor({ operations }: {
555
+ operations: StoreOperationsCloudflare;
556
+ });
557
+ private validateWorkflowParams;
558
+ persistWorkflowSnapshot(params: {
559
+ workflowName: string;
560
+ runId: string;
561
+ snapshot: WorkflowRunState;
562
+ }): Promise<void>;
563
+ loadWorkflowSnapshot(params: {
564
+ workflowName: string;
565
+ runId: string;
566
+ }): Promise<WorkflowRunState | null>;
567
+ private parseWorkflowRun;
568
+ private buildWorkflowSnapshotPrefix;
569
+ getWorkflowRuns({ workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
570
+ workflowName?: string;
571
+ limit?: number;
572
+ offset?: number;
573
+ resourceId?: string;
574
+ fromDate?: Date;
575
+ toDate?: Date;
576
+ }): Promise<WorkflowRuns>;
577
+ getWorkflowRunById({ runId, workflowName, }: {
578
+ runId: string;
579
+ workflowName: string;
580
+ }): Promise<WorkflowRun | null>;
581
+ }
582
+
302
583
  export { }