@mastra/cloudflare-d1 0.0.0-remove-unused-import-20250909212718 → 0.0.0-remove-ai-peer-dep-from-evals-20260105220639
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/CHANGELOG.md +1250 -3
- package/README.md +10 -5
- package/dist/docs/README.md +31 -0
- package/dist/docs/SKILL.md +32 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/storage/01-reference.md +110 -0
- package/dist/index.cjs +883 -1210
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +882 -1212
- package/dist/index.js.map +1 -1
- package/dist/storage/{domains/operations → db}/index.d.ts +42 -6
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +19 -49
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +19 -33
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +17 -23
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +56 -233
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +19 -14
- package/dist/storage/domains/legacy-evals/index.d.ts +0 -20
- package/dist/storage/domains/legacy-evals/index.d.ts.map +0 -1
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
- package/dist/storage/domains/traces/index.d.ts +0 -18
- package/dist/storage/domains/traces/index.d.ts.map +0 -1
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,39 +1,62 @@
|
|
|
1
1
|
import type { D1Database } from '@cloudflare/workers-types';
|
|
2
|
-
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
|
-
import type { StorageThreadType, MastraMessageV1, MastraMessageV2 } from '@mastra/core/memory';
|
|
4
|
-
import type { ScoreRowData, ScoringSource } from '@mastra/core/scores';
|
|
5
2
|
import { MastraStorage } from '@mastra/core/storage';
|
|
6
|
-
import type {
|
|
7
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
8
|
-
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
3
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
9
4
|
import Cloudflare from 'cloudflare';
|
|
5
|
+
import { MemoryStorageD1 } from './domains/memory/index.js';
|
|
6
|
+
import { ScoresStorageD1 } from './domains/scores/index.js';
|
|
7
|
+
import { WorkflowsStorageD1 } from './domains/workflows/index.js';
|
|
8
|
+
export { MemoryStorageD1, ScoresStorageD1, WorkflowsStorageD1 };
|
|
9
|
+
export type { D1DomainConfig } from './db/index.js';
|
|
10
|
+
/**
|
|
11
|
+
* Base configuration options shared across D1 configurations
|
|
12
|
+
*/
|
|
13
|
+
export interface D1BaseConfig {
|
|
14
|
+
/** Storage instance ID */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Optional prefix for table names */
|
|
17
|
+
tablePrefix?: string;
|
|
18
|
+
/**
|
|
19
|
+
* When true, automatic initialization (table creation/migrations) is disabled.
|
|
20
|
+
* This is useful for CI/CD pipelines where you want to:
|
|
21
|
+
* 1. Run migrations explicitly during deployment (not at runtime)
|
|
22
|
+
* 2. Use different credentials for schema changes vs runtime operations
|
|
23
|
+
*
|
|
24
|
+
* When disableInit is true:
|
|
25
|
+
* - The storage will not automatically create/alter tables on first use
|
|
26
|
+
* - You must call `storage.init()` explicitly in your CI/CD scripts
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // In CI/CD script:
|
|
30
|
+
* const storage = new D1Store({ ...config, disableInit: false });
|
|
31
|
+
* await storage.init(); // Explicitly run migrations
|
|
32
|
+
*
|
|
33
|
+
* // In runtime application:
|
|
34
|
+
* const storage = new D1Store({ ...config, disableInit: true });
|
|
35
|
+
* // No auto-init, tables must already exist
|
|
36
|
+
*/
|
|
37
|
+
disableInit?: boolean;
|
|
38
|
+
}
|
|
10
39
|
/**
|
|
11
40
|
* Configuration for D1 using the REST API
|
|
12
41
|
*/
|
|
13
|
-
export interface D1Config {
|
|
42
|
+
export interface D1Config extends D1BaseConfig {
|
|
14
43
|
/** Cloudflare account ID */
|
|
15
44
|
accountId: string;
|
|
16
45
|
/** Cloudflare API token with D1 access */
|
|
17
46
|
apiToken: string;
|
|
18
47
|
/** D1 database ID */
|
|
19
48
|
databaseId: string;
|
|
20
|
-
/** Optional prefix for table names */
|
|
21
|
-
tablePrefix?: string;
|
|
22
49
|
}
|
|
23
|
-
export interface D1ClientConfig {
|
|
24
|
-
/** Optional prefix for table names */
|
|
25
|
-
tablePrefix?: string;
|
|
50
|
+
export interface D1ClientConfig extends D1BaseConfig {
|
|
26
51
|
/** D1 Client */
|
|
27
52
|
client: D1Client;
|
|
28
53
|
}
|
|
29
54
|
/**
|
|
30
55
|
* Configuration for D1 using the Workers Binding API
|
|
31
56
|
*/
|
|
32
|
-
export interface D1WorkersConfig {
|
|
57
|
+
export interface D1WorkersConfig extends D1BaseConfig {
|
|
33
58
|
/** D1 database binding from Workers environment */
|
|
34
59
|
binding: D1Database;
|
|
35
|
-
/** Optional prefix for table names */
|
|
36
|
-
tablePrefix?: string;
|
|
37
60
|
}
|
|
38
61
|
/**
|
|
39
62
|
* Combined configuration type supporting both REST API and Workers Binding API
|
|
@@ -48,6 +71,24 @@ export interface D1Client {
|
|
|
48
71
|
result: D1QueryResult;
|
|
49
72
|
}>;
|
|
50
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Cloudflare D1 storage adapter for Mastra.
|
|
76
|
+
*
|
|
77
|
+
* Access domain-specific storage via `getStore()`:
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const storage = new D1Store({ id: 'my-store', accountId: '...', apiToken: '...', databaseId: '...' });
|
|
82
|
+
*
|
|
83
|
+
* // Access memory domain
|
|
84
|
+
* const memory = await storage.getStore('memory');
|
|
85
|
+
* await memory?.saveThread({ thread });
|
|
86
|
+
*
|
|
87
|
+
* // Access workflows domain
|
|
88
|
+
* const workflows = await storage.getStore('workflows');
|
|
89
|
+
* await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
51
92
|
export declare class D1Store extends MastraStorage {
|
|
52
93
|
private client?;
|
|
53
94
|
private binding?;
|
|
@@ -58,224 +99,6 @@ export declare class D1Store extends MastraStorage {
|
|
|
58
99
|
* @param config Configuration for D1 access (either REST API or Workers Binding API)
|
|
59
100
|
*/
|
|
60
101
|
constructor(config: D1StoreConfig);
|
|
61
|
-
get supports(): {
|
|
62
|
-
selectByIncludeResourceScope: boolean;
|
|
63
|
-
resourceWorkingMemory: boolean;
|
|
64
|
-
hasColumn: boolean;
|
|
65
|
-
createTable: boolean;
|
|
66
|
-
deleteMessages: boolean;
|
|
67
|
-
};
|
|
68
|
-
createTable({ tableName, schema, }: {
|
|
69
|
-
tableName: TABLE_NAMES;
|
|
70
|
-
schema: Record<string, StorageColumn>;
|
|
71
|
-
}): Promise<void>;
|
|
72
|
-
/**
|
|
73
|
-
* Alters table schema to add columns if they don't exist
|
|
74
|
-
* @param tableName Name of the table
|
|
75
|
-
* @param schema Schema of the table
|
|
76
|
-
* @param ifNotExists Array of column names to add if they don't exist
|
|
77
|
-
*/
|
|
78
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
79
|
-
tableName: TABLE_NAMES;
|
|
80
|
-
schema: Record<string, StorageColumn>;
|
|
81
|
-
ifNotExists: string[];
|
|
82
|
-
}): Promise<void>;
|
|
83
|
-
clearTable({ tableName }: {
|
|
84
|
-
tableName: TABLE_NAMES;
|
|
85
|
-
}): Promise<void>;
|
|
86
|
-
dropTable({ tableName }: {
|
|
87
|
-
tableName: TABLE_NAMES;
|
|
88
|
-
}): Promise<void>;
|
|
89
|
-
hasColumn(table: string, column: string): Promise<boolean>;
|
|
90
|
-
insert({ tableName, record }: {
|
|
91
|
-
tableName: TABLE_NAMES;
|
|
92
|
-
record: Record<string, any>;
|
|
93
|
-
}): Promise<void>;
|
|
94
|
-
load<R>({ tableName, keys }: {
|
|
95
|
-
tableName: TABLE_NAMES;
|
|
96
|
-
keys: Record<string, string>;
|
|
97
|
-
}): Promise<R | null>;
|
|
98
|
-
getThreadById({ threadId }: {
|
|
99
|
-
threadId: string;
|
|
100
|
-
}): Promise<StorageThreadType | null>;
|
|
101
|
-
/**
|
|
102
|
-
* @deprecated use getThreadsByResourceIdPaginated instead
|
|
103
|
-
*/
|
|
104
|
-
getThreadsByResourceId({ resourceId }: {
|
|
105
|
-
resourceId: string;
|
|
106
|
-
}): Promise<StorageThreadType[]>;
|
|
107
|
-
getThreadsByResourceIdPaginated(args: {
|
|
108
|
-
resourceId: string;
|
|
109
|
-
page: number;
|
|
110
|
-
perPage: number;
|
|
111
|
-
}): Promise<PaginationInfo & {
|
|
112
|
-
threads: StorageThreadType[];
|
|
113
|
-
}>;
|
|
114
|
-
saveThread({ thread }: {
|
|
115
|
-
thread: StorageThreadType;
|
|
116
|
-
}): Promise<StorageThreadType>;
|
|
117
|
-
updateThread({ id, title, metadata, }: {
|
|
118
|
-
id: string;
|
|
119
|
-
title: string;
|
|
120
|
-
metadata: Record<string, unknown>;
|
|
121
|
-
}): Promise<StorageThreadType>;
|
|
122
|
-
deleteThread({ threadId }: {
|
|
123
|
-
threadId: string;
|
|
124
|
-
}): Promise<void>;
|
|
125
|
-
saveMessages(args: {
|
|
126
|
-
messages: MastraMessageV1[];
|
|
127
|
-
format?: undefined | 'v1';
|
|
128
|
-
}): Promise<MastraMessageV1[]>;
|
|
129
|
-
saveMessages(args: {
|
|
130
|
-
messages: MastraMessageV2[];
|
|
131
|
-
format: 'v2';
|
|
132
|
-
}): Promise<MastraMessageV2[]>;
|
|
133
|
-
/**
|
|
134
|
-
* @deprecated use getMessagesPaginated instead
|
|
135
|
-
*/
|
|
136
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
137
|
-
format?: 'v1';
|
|
138
|
-
}): Promise<MastraMessageV1[]>;
|
|
139
|
-
getMessages(args: StorageGetMessagesArg & {
|
|
140
|
-
format: 'v2';
|
|
141
|
-
}): Promise<MastraMessageV2[]>;
|
|
142
|
-
getMessagesById({ messageIds, format }: {
|
|
143
|
-
messageIds: string[];
|
|
144
|
-
format: 'v1';
|
|
145
|
-
}): Promise<MastraMessageV1[]>;
|
|
146
|
-
getMessagesById({ messageIds, format }: {
|
|
147
|
-
messageIds: string[];
|
|
148
|
-
format?: 'v2';
|
|
149
|
-
}): Promise<MastraMessageV2[]>;
|
|
150
|
-
getMessagesPaginated({ threadId, selectBy, format, }: StorageGetMessagesArg & {
|
|
151
|
-
format?: 'v1' | 'v2';
|
|
152
|
-
}): Promise<PaginationInfo & {
|
|
153
|
-
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
154
|
-
}>;
|
|
155
|
-
updateWorkflowResults({ workflowName, runId, stepId, result, runtimeContext, }: {
|
|
156
|
-
workflowName: string;
|
|
157
|
-
runId: string;
|
|
158
|
-
stepId: string;
|
|
159
|
-
result: StepResult<any, any, any, any>;
|
|
160
|
-
runtimeContext: Record<string, any>;
|
|
161
|
-
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
162
|
-
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
163
|
-
workflowName: string;
|
|
164
|
-
runId: string;
|
|
165
|
-
opts: {
|
|
166
|
-
status: string;
|
|
167
|
-
result?: StepResult<any, any, any, any>;
|
|
168
|
-
error?: string;
|
|
169
|
-
suspendedPaths?: Record<string, number[]>;
|
|
170
|
-
waitingPaths?: Record<string, number[]>;
|
|
171
|
-
};
|
|
172
|
-
}): Promise<WorkflowRunState | undefined>;
|
|
173
|
-
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
174
|
-
workflowName: string;
|
|
175
|
-
runId: string;
|
|
176
|
-
snapshot: WorkflowRunState;
|
|
177
|
-
}): Promise<void>;
|
|
178
|
-
loadWorkflowSnapshot(params: {
|
|
179
|
-
workflowName: string;
|
|
180
|
-
runId: string;
|
|
181
|
-
}): Promise<WorkflowRunState | null>;
|
|
182
|
-
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
183
|
-
workflowName?: string;
|
|
184
|
-
fromDate?: Date;
|
|
185
|
-
toDate?: Date;
|
|
186
|
-
limit?: number;
|
|
187
|
-
offset?: number;
|
|
188
|
-
resourceId?: string;
|
|
189
|
-
}): Promise<WorkflowRuns>;
|
|
190
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
191
|
-
runId: string;
|
|
192
|
-
workflowName?: string;
|
|
193
|
-
}): Promise<WorkflowRun | null>;
|
|
194
|
-
/**
|
|
195
|
-
* Insert multiple records in a batch operation
|
|
196
|
-
* @param tableName The table to insert into
|
|
197
|
-
* @param records The records to insert
|
|
198
|
-
*/
|
|
199
|
-
batchInsert({ tableName, records }: {
|
|
200
|
-
tableName: TABLE_NAMES;
|
|
201
|
-
records: Record<string, any>[];
|
|
202
|
-
}): Promise<void>;
|
|
203
|
-
/**
|
|
204
|
-
* @deprecated use getTracesPaginated instead
|
|
205
|
-
*/
|
|
206
|
-
getTraces(args: {
|
|
207
|
-
name?: string;
|
|
208
|
-
scope?: string;
|
|
209
|
-
page: number;
|
|
210
|
-
perPage: number;
|
|
211
|
-
attributes?: Record<string, string>;
|
|
212
|
-
fromDate?: Date;
|
|
213
|
-
toDate?: Date;
|
|
214
|
-
}): Promise<Trace[]>;
|
|
215
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
216
|
-
traces: Trace[];
|
|
217
|
-
}>;
|
|
218
|
-
/**
|
|
219
|
-
* @deprecated use getEvals instead
|
|
220
|
-
*/
|
|
221
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
222
|
-
getEvals(options: {
|
|
223
|
-
agentName?: string;
|
|
224
|
-
type?: 'test' | 'live';
|
|
225
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
226
|
-
evals: EvalRow[];
|
|
227
|
-
}>;
|
|
228
|
-
updateMessages(_args: {
|
|
229
|
-
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
230
|
-
id: string;
|
|
231
|
-
content?: {
|
|
232
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
233
|
-
content?: MastraMessageContentV2['content'];
|
|
234
|
-
};
|
|
235
|
-
}[];
|
|
236
|
-
}): Promise<MastraMessageV2[]>;
|
|
237
|
-
getResourceById({ resourceId }: {
|
|
238
|
-
resourceId: string;
|
|
239
|
-
}): Promise<StorageResourceType | null>;
|
|
240
|
-
saveResource({ resource }: {
|
|
241
|
-
resource: StorageResourceType;
|
|
242
|
-
}): Promise<StorageResourceType>;
|
|
243
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
244
|
-
resourceId: string;
|
|
245
|
-
workingMemory?: string;
|
|
246
|
-
metadata?: Record<string, unknown>;
|
|
247
|
-
}): Promise<StorageResourceType>;
|
|
248
|
-
getScoreById({ id: _id }: {
|
|
249
|
-
id: string;
|
|
250
|
-
}): Promise<ScoreRowData | null>;
|
|
251
|
-
saveScore(_score: ScoreRowData): Promise<{
|
|
252
|
-
score: ScoreRowData;
|
|
253
|
-
}>;
|
|
254
|
-
getScoresByRunId({ runId: _runId, pagination: _pagination, }: {
|
|
255
|
-
runId: string;
|
|
256
|
-
pagination: StoragePagination;
|
|
257
|
-
}): Promise<{
|
|
258
|
-
pagination: PaginationInfo;
|
|
259
|
-
scores: ScoreRowData[];
|
|
260
|
-
}>;
|
|
261
|
-
getScoresByEntityId({ entityId: _entityId, entityType: _entityType, pagination: _pagination, }: {
|
|
262
|
-
pagination: StoragePagination;
|
|
263
|
-
entityId: string;
|
|
264
|
-
entityType: string;
|
|
265
|
-
}): Promise<{
|
|
266
|
-
pagination: PaginationInfo;
|
|
267
|
-
scores: ScoreRowData[];
|
|
268
|
-
}>;
|
|
269
|
-
getScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
270
|
-
scorerId: string;
|
|
271
|
-
pagination: StoragePagination;
|
|
272
|
-
entityId?: string;
|
|
273
|
-
entityType?: string;
|
|
274
|
-
source?: ScoringSource;
|
|
275
|
-
}): Promise<{
|
|
276
|
-
pagination: PaginationInfo;
|
|
277
|
-
scores: ScoreRowData[];
|
|
278
|
-
}>;
|
|
279
102
|
/**
|
|
280
103
|
* Close the database connection
|
|
281
104
|
* No explicit cleanup needed for D1 in either REST or Workers Binding mode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAwB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,CAAC;AAChE,YAAY,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,QAAS,SAAQ,YAAY;IAC5C,4BAA4B;IAC5B,SAA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1 provider for Mastra - includes db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,22 +26,23 @@
|
|
|
26
26
|
"cloudflare": "^4.5.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudflare/workers-types": "^4.
|
|
30
|
-
"@
|
|
31
|
-
"@
|
|
29
|
+
"@cloudflare/workers-types": "^4.20251111.0",
|
|
30
|
+
"@types/node": "22.13.17",
|
|
31
|
+
"@vitest/coverage-v8": "4.0.12",
|
|
32
|
+
"@vitest/ui": "4.0.12",
|
|
32
33
|
"dotenv": "^17.0.0",
|
|
33
|
-
"eslint": "^9.
|
|
34
|
-
"miniflare": "^4.
|
|
34
|
+
"eslint": "^9.37.0",
|
|
35
|
+
"miniflare": "^4.20251109.0",
|
|
35
36
|
"tsup": "^8.5.0",
|
|
36
|
-
"typescript": "^5.
|
|
37
|
-
"vitest": "
|
|
38
|
-
"@internal/
|
|
39
|
-
"@internal/
|
|
40
|
-
"@
|
|
41
|
-
"@
|
|
37
|
+
"typescript": "^5.9.3",
|
|
38
|
+
"vitest": "4.0.16",
|
|
39
|
+
"@internal/lint": "0.0.0-remove-ai-peer-dep-from-evals-20260105220639",
|
|
40
|
+
"@internal/types-builder": "0.0.0-remove-ai-peer-dep-from-evals-20260105220639",
|
|
41
|
+
"@internal/storage-test-utils": "0.0.49",
|
|
42
|
+
"@mastra/core": "0.0.0-remove-ai-peer-dep-from-evals-20260105220639"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
|
-
"@mastra/core": "0.0.0-remove-
|
|
45
|
+
"@mastra/core": "0.0.0-remove-ai-peer-dep-from-evals-20260105220639"
|
|
45
46
|
},
|
|
46
47
|
"homepage": "https://mastra.ai",
|
|
47
48
|
"repository": {
|
|
@@ -52,8 +53,12 @@
|
|
|
52
53
|
"bugs": {
|
|
53
54
|
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
54
55
|
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.13.0"
|
|
58
|
+
},
|
|
55
59
|
"scripts": {
|
|
56
|
-
"build": "tsup --silent --config tsup.config.ts",
|
|
60
|
+
"build:lib": "tsup --silent --config tsup.config.ts",
|
|
61
|
+
"build:docs": "pnpx tsx ../../scripts/generate-package-docs.ts stores/cloudflare-d1",
|
|
57
62
|
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
58
63
|
"test": "vitest run",
|
|
59
64
|
"lint": "eslint ."
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { EvalRow, PaginationArgs, PaginationInfo } from '@mastra/core/storage';
|
|
3
|
-
import type { StoreOperationsD1 } from '../operations/index.js';
|
|
4
|
-
export declare class LegacyEvalsStorageD1 extends LegacyEvalsStorage {
|
|
5
|
-
private operations;
|
|
6
|
-
constructor({ operations }: {
|
|
7
|
-
operations: StoreOperationsD1;
|
|
8
|
-
});
|
|
9
|
-
getEvals(options: {
|
|
10
|
-
agentName?: string;
|
|
11
|
-
type?: 'test' | 'live';
|
|
12
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
13
|
-
evals: EvalRow[];
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated use getEvals instead
|
|
17
|
-
*/
|
|
18
|
-
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/legacy-evals/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAA8B,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGpF,OAAO,KAAK,EAAE,iBAA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';
|
|
3
|
-
import type { Trace } from '@mastra/core/telemetry';
|
|
4
|
-
import type { StoreOperationsD1 } from '../operations/index.js';
|
|
5
|
-
export declare class TracesStorageD1 extends TracesStorage {
|
|
6
|
-
private operations;
|
|
7
|
-
constructor({ operations }: {
|
|
8
|
-
operations: StoreOperationsD1;
|
|
9
|
-
});
|
|
10
|
-
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
11
|
-
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
12
|
-
traces: Trace[];
|
|
13
|
-
}>;
|
|
14
|
-
batchTraceInsert({ records }: {
|
|
15
|
-
records: Record<string, any>[];
|
|
16
|
-
}): Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/traces/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAgB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOvD,qBAAa,eAAgB,SAAQ,aAAa;IAChD,OAAO,CAAC,UAAU,CAAoB;gBAE1B,EAAE,UAAU,EAAE,EAAE;QAAE,UAAU,EAAE,iBAAiB,CAAA;KAAE;IAKvD,SAAS,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAsCtD,kBAAkB,CAAC,IAAI,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,GAAG;QAAE,MAAM,EAAE,KAAK,EAAE,CAAA;KAAE,CAAC;IA+FrG,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvF"}
|