@mastra/cloudflare-d1 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-tool-call-parts-20250630193309

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,43 +1,18 @@
1
1
  import type { D1Database as D1Database_2 } from '@cloudflare/workers-types';
2
2
  import type { EvalRow } from '@mastra/core/storage';
3
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
4
  import type { MastraMessageV1 } from '@mastra/core/memory';
4
5
  import type { MastraMessageV2 } from '@mastra/core/memory';
5
- import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core';
6
6
  import { MastraStorage } from '@mastra/core/storage';
7
+ import type { PaginationInfo } from '@mastra/core/storage';
7
8
  import type { StorageColumn } from '@mastra/core/storage';
8
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
9
10
  import type { StorageThreadType } from '@mastra/core/memory';
10
11
  import type { TABLE_NAMES } from '@mastra/core/storage';
12
+ import type { Trace } from '@mastra/core/telemetry';
11
13
  import type { WorkflowRun } from '@mastra/core/storage';
12
14
  import type { WorkflowRuns } from '@mastra/core/storage';
13
15
  import type { WorkflowRunState } from '@mastra/core/workflows';
14
- import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
15
-
16
- export declare const checkWorkflowSnapshot: (snapshot: WorkflowRunState_2 | string, stepId: string, status: string) => void;
17
-
18
- export declare const createSampleMessage: (threadId: string, parts?: MastraMessageV2_2["content"]["parts"]) => MastraMessageV2_2;
19
-
20
- export declare const createSampleThread: () => {
21
- id: string;
22
- resourceId: string;
23
- title: string;
24
- createdAt: Date;
25
- updatedAt: Date;
26
- metadata: {
27
- key: string;
28
- };
29
- };
30
-
31
- export declare const createSampleThreadWithParams: (threadId: string, resourceId: string, createdAt: Date, updatedAt: Date) => {
32
- id: string;
33
- resourceId: string;
34
- title: string;
35
- createdAt: Date;
36
- updatedAt: Date;
37
- metadata: {
38
- key: string;
39
- };
40
- };
41
16
 
42
17
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
43
18
  id: string;
@@ -56,12 +31,6 @@ export declare const createSampleTrace: (name: string, scope?: string, attribute
56
31
  createdAt: string;
57
32
  };
58
33
 
59
- export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
60
- snapshot: WorkflowRunState_2;
61
- runId: string;
62
- stepId: string;
63
- };
64
-
65
34
  export declare function createSqlBuilder(): SqlBuilder;
66
35
 
67
36
  /**
@@ -101,15 +70,25 @@ declare class D1Store extends MastraStorage {
101
70
  * @returns Query results as an array or a single object if first=true
102
71
  */
103
72
  private executeQuery;
104
- private getSqlType;
105
- private ensureDate;
106
- private serializeDate;
73
+ private getTableColumns;
107
74
  private serializeValue;
108
75
  private deserializeValue;
76
+ protected getSqlType(type: StorageColumn['type']): string;
109
77
  createTable({ tableName, schema, }: {
110
78
  tableName: TABLE_NAMES;
111
79
  schema: Record<string, StorageColumn>;
112
80
  }): Promise<void>;
81
+ /**
82
+ * Alters table schema to add columns if they don't exist
83
+ * @param tableName Name of the table
84
+ * @param schema Schema of the table
85
+ * @param ifNotExists Array of column names to add if they don't exist
86
+ */
87
+ alterTable({ tableName, schema, ifNotExists, }: {
88
+ tableName: TABLE_NAMES;
89
+ schema: Record<string, StorageColumn>;
90
+ ifNotExists: string[];
91
+ }): Promise<void>;
113
92
  clearTable({ tableName }: {
114
93
  tableName: TABLE_NAMES;
115
94
  }): Promise<void>;
@@ -125,9 +104,19 @@ declare class D1Store extends MastraStorage {
125
104
  getThreadById({ threadId }: {
126
105
  threadId: string;
127
106
  }): Promise<StorageThreadType | null>;
107
+ /**
108
+ * @deprecated use getThreadsByResourceIdPaginated instead
109
+ */
128
110
  getThreadsByResourceId({ resourceId }: {
129
111
  resourceId: string;
130
112
  }): Promise<StorageThreadType[]>;
113
+ getThreadsByResourceIdPaginated(args: {
114
+ resourceId: string;
115
+ page: number;
116
+ perPage: number;
117
+ }): Promise<PaginationInfo & {
118
+ threads: StorageThreadType[];
119
+ }>;
131
120
  saveThread({ thread }: {
132
121
  thread: StorageThreadType;
133
122
  }): Promise<StorageThreadType>;
@@ -147,12 +136,21 @@ declare class D1Store extends MastraStorage {
147
136
  messages: MastraMessageV2[];
148
137
  format: 'v2';
149
138
  }): Promise<MastraMessageV2[]>;
139
+ private _getIncludedMessages;
140
+ /**
141
+ * @deprecated use getMessagesPaginated instead
142
+ */
150
143
  getMessages(args: StorageGetMessagesArg & {
151
144
  format?: 'v1';
152
145
  }): Promise<MastraMessageV1[]>;
153
146
  getMessages(args: StorageGetMessagesArg & {
154
147
  format: 'v2';
155
148
  }): Promise<MastraMessageV2[]>;
149
+ getMessagesPaginated({ threadId, selectBy, format, }: StorageGetMessagesArg & {
150
+ format?: 'v1' | 'v2';
151
+ }): Promise<PaginationInfo & {
152
+ messages: MastraMessageV1[] | MastraMessageV2[];
153
+ }>;
156
154
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
157
155
  workflowName: string;
158
156
  runId: string;
@@ -171,6 +169,15 @@ declare class D1Store extends MastraStorage {
171
169
  tableName: TABLE_NAMES;
172
170
  records: Record<string, any>[];
173
171
  }): Promise<void>;
172
+ /**
173
+ * Upsert multiple records in a batch operation
174
+ * @param tableName The table to insert into
175
+ * @param records The records to insert
176
+ */
177
+ private batchUpsert;
178
+ /**
179
+ * @deprecated use getTracesPaginated instead
180
+ */
174
181
  getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
175
182
  name?: string;
176
183
  scope?: string;
@@ -179,8 +186,32 @@ declare class D1Store extends MastraStorage {
179
186
  attributes?: Record<string, string>;
180
187
  fromDate?: Date;
181
188
  toDate?: Date;
182
- }): Promise<Record<string, any>[]>;
189
+ }): Promise<Trace[]>;
190
+ getTracesPaginated(args: {
191
+ name?: string;
192
+ scope?: string;
193
+ attributes?: Record<string, string>;
194
+ page: number;
195
+ perPage: number;
196
+ fromDate?: Date;
197
+ toDate?: Date;
198
+ }): Promise<PaginationInfo & {
199
+ traces: Trace[];
200
+ }>;
201
+ /**
202
+ * @deprecated use getEvals instead
203
+ */
183
204
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
205
+ getEvals(options?: {
206
+ agentName?: string;
207
+ type?: 'test' | 'live';
208
+ page?: number;
209
+ perPage?: number;
210
+ fromDate?: Date;
211
+ toDate?: Date;
212
+ }): Promise<PaginationInfo & {
213
+ evals: EvalRow[];
214
+ }>;
184
215
  private parseWorkflowRun;
185
216
  private hasColumn;
186
217
  getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
@@ -200,6 +231,15 @@ declare class D1Store extends MastraStorage {
200
231
  * No explicit cleanup needed for D1 in either REST or Workers Binding mode
201
232
  */
202
233
  close(): Promise<void>;
234
+ updateMessages(_args: {
235
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
236
+ id: string;
237
+ content?: {
238
+ metadata?: MastraMessageContentV2['metadata'];
239
+ content?: MastraMessageContentV2['content'];
240
+ };
241
+ }[];
242
+ }): Promise<MastraMessageV2[]>;
203
243
  }
204
244
  export { D1Store }
205
245
  export { D1Store as D1Store_alias_1 }
@@ -1,43 +1,18 @@
1
1
  import type { D1Database as D1Database_2 } from '@cloudflare/workers-types';
2
2
  import type { EvalRow } from '@mastra/core/storage';
3
+ import type { MastraMessageContentV2 } from '@mastra/core/agent';
3
4
  import type { MastraMessageV1 } from '@mastra/core/memory';
4
5
  import type { MastraMessageV2 } from '@mastra/core/memory';
5
- import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core';
6
6
  import { MastraStorage } from '@mastra/core/storage';
7
+ import type { PaginationInfo } from '@mastra/core/storage';
7
8
  import type { StorageColumn } from '@mastra/core/storage';
8
9
  import type { StorageGetMessagesArg } from '@mastra/core/storage';
9
10
  import type { StorageThreadType } from '@mastra/core/memory';
10
11
  import type { TABLE_NAMES } from '@mastra/core/storage';
12
+ import type { Trace } from '@mastra/core/telemetry';
11
13
  import type { WorkflowRun } from '@mastra/core/storage';
12
14
  import type { WorkflowRuns } from '@mastra/core/storage';
13
15
  import type { WorkflowRunState } from '@mastra/core/workflows';
14
- import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
15
-
16
- export declare const checkWorkflowSnapshot: (snapshot: WorkflowRunState_2 | string, stepId: string, status: string) => void;
17
-
18
- export declare const createSampleMessage: (threadId: string, parts?: MastraMessageV2_2["content"]["parts"]) => MastraMessageV2_2;
19
-
20
- export declare const createSampleThread: () => {
21
- id: string;
22
- resourceId: string;
23
- title: string;
24
- createdAt: Date;
25
- updatedAt: Date;
26
- metadata: {
27
- key: string;
28
- };
29
- };
30
-
31
- export declare const createSampleThreadWithParams: (threadId: string, resourceId: string, createdAt: Date, updatedAt: Date) => {
32
- id: string;
33
- resourceId: string;
34
- title: string;
35
- createdAt: Date;
36
- updatedAt: Date;
37
- metadata: {
38
- key: string;
39
- };
40
- };
41
16
 
42
17
  export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
43
18
  id: string;
@@ -56,12 +31,6 @@ export declare const createSampleTrace: (name: string, scope?: string, attribute
56
31
  createdAt: string;
57
32
  };
58
33
 
59
- export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
60
- snapshot: WorkflowRunState_2;
61
- runId: string;
62
- stepId: string;
63
- };
64
-
65
34
  export declare function createSqlBuilder(): SqlBuilder;
66
35
 
67
36
  /**
@@ -101,15 +70,25 @@ declare class D1Store extends MastraStorage {
101
70
  * @returns Query results as an array or a single object if first=true
102
71
  */
103
72
  private executeQuery;
104
- private getSqlType;
105
- private ensureDate;
106
- private serializeDate;
73
+ private getTableColumns;
107
74
  private serializeValue;
108
75
  private deserializeValue;
76
+ protected getSqlType(type: StorageColumn['type']): string;
109
77
  createTable({ tableName, schema, }: {
110
78
  tableName: TABLE_NAMES;
111
79
  schema: Record<string, StorageColumn>;
112
80
  }): Promise<void>;
81
+ /**
82
+ * Alters table schema to add columns if they don't exist
83
+ * @param tableName Name of the table
84
+ * @param schema Schema of the table
85
+ * @param ifNotExists Array of column names to add if they don't exist
86
+ */
87
+ alterTable({ tableName, schema, ifNotExists, }: {
88
+ tableName: TABLE_NAMES;
89
+ schema: Record<string, StorageColumn>;
90
+ ifNotExists: string[];
91
+ }): Promise<void>;
113
92
  clearTable({ tableName }: {
114
93
  tableName: TABLE_NAMES;
115
94
  }): Promise<void>;
@@ -125,9 +104,19 @@ declare class D1Store extends MastraStorage {
125
104
  getThreadById({ threadId }: {
126
105
  threadId: string;
127
106
  }): Promise<StorageThreadType | null>;
107
+ /**
108
+ * @deprecated use getThreadsByResourceIdPaginated instead
109
+ */
128
110
  getThreadsByResourceId({ resourceId }: {
129
111
  resourceId: string;
130
112
  }): Promise<StorageThreadType[]>;
113
+ getThreadsByResourceIdPaginated(args: {
114
+ resourceId: string;
115
+ page: number;
116
+ perPage: number;
117
+ }): Promise<PaginationInfo & {
118
+ threads: StorageThreadType[];
119
+ }>;
131
120
  saveThread({ thread }: {
132
121
  thread: StorageThreadType;
133
122
  }): Promise<StorageThreadType>;
@@ -147,12 +136,21 @@ declare class D1Store extends MastraStorage {
147
136
  messages: MastraMessageV2[];
148
137
  format: 'v2';
149
138
  }): Promise<MastraMessageV2[]>;
139
+ private _getIncludedMessages;
140
+ /**
141
+ * @deprecated use getMessagesPaginated instead
142
+ */
150
143
  getMessages(args: StorageGetMessagesArg & {
151
144
  format?: 'v1';
152
145
  }): Promise<MastraMessageV1[]>;
153
146
  getMessages(args: StorageGetMessagesArg & {
154
147
  format: 'v2';
155
148
  }): Promise<MastraMessageV2[]>;
149
+ getMessagesPaginated({ threadId, selectBy, format, }: StorageGetMessagesArg & {
150
+ format?: 'v1' | 'v2';
151
+ }): Promise<PaginationInfo & {
152
+ messages: MastraMessageV1[] | MastraMessageV2[];
153
+ }>;
156
154
  persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
157
155
  workflowName: string;
158
156
  runId: string;
@@ -171,6 +169,15 @@ declare class D1Store extends MastraStorage {
171
169
  tableName: TABLE_NAMES;
172
170
  records: Record<string, any>[];
173
171
  }): Promise<void>;
172
+ /**
173
+ * Upsert multiple records in a batch operation
174
+ * @param tableName The table to insert into
175
+ * @param records The records to insert
176
+ */
177
+ private batchUpsert;
178
+ /**
179
+ * @deprecated use getTracesPaginated instead
180
+ */
174
181
  getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
175
182
  name?: string;
176
183
  scope?: string;
@@ -179,8 +186,32 @@ declare class D1Store extends MastraStorage {
179
186
  attributes?: Record<string, string>;
180
187
  fromDate?: Date;
181
188
  toDate?: Date;
182
- }): Promise<Record<string, any>[]>;
189
+ }): Promise<Trace[]>;
190
+ getTracesPaginated(args: {
191
+ name?: string;
192
+ scope?: string;
193
+ attributes?: Record<string, string>;
194
+ page: number;
195
+ perPage: number;
196
+ fromDate?: Date;
197
+ toDate?: Date;
198
+ }): Promise<PaginationInfo & {
199
+ traces: Trace[];
200
+ }>;
201
+ /**
202
+ * @deprecated use getEvals instead
203
+ */
183
204
  getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
205
+ getEvals(options?: {
206
+ agentName?: string;
207
+ type?: 'test' | 'live';
208
+ page?: number;
209
+ perPage?: number;
210
+ fromDate?: Date;
211
+ toDate?: Date;
212
+ }): Promise<PaginationInfo & {
213
+ evals: EvalRow[];
214
+ }>;
184
215
  private parseWorkflowRun;
185
216
  private hasColumn;
186
217
  getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
@@ -200,6 +231,15 @@ declare class D1Store extends MastraStorage {
200
231
  * No explicit cleanup needed for D1 in either REST or Workers Binding mode
201
232
  */
202
233
  close(): Promise<void>;
234
+ updateMessages(_args: {
235
+ messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
236
+ id: string;
237
+ content?: {
238
+ metadata?: MastraMessageContentV2['metadata'];
239
+ content?: MastraMessageContentV2['content'];
240
+ };
241
+ }[];
242
+ }): Promise<MastraMessageV2[]>;
203
243
  }
204
244
  export { D1Store }
205
245
  export { D1Store as D1Store_alias_1 }