@mastra/libsql 1.0.0-beta.8 → 1.0.0-beta.9
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 +194 -0
- package/dist/index.cjs +1911 -1780
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1912 -1781
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +264 -0
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/{domains → db}/utils.d.ts +5 -12
- package/dist/storage/db/utils.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +5 -7
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +5 -8
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +19 -27
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +11 -26
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +9 -14
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +20 -187
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/storage/domains/operations/index.d.ts +0 -110
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
- package/dist/storage/domains/utils.d.ts.map +0 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import type { Client, InValue } from '@libsql/client';
|
|
2
|
+
import { MastraBase } from '@mastra/core/base';
|
|
3
|
+
import type { TABLE_NAMES, StorageColumn } from '@mastra/core/storage';
|
|
4
|
+
/**
|
|
5
|
+
* Base configuration options shared across LibSQL domain configurations
|
|
6
|
+
*/
|
|
7
|
+
export type LibSQLDomainBaseConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* Maximum number of retries for write operations if an SQLITE_BUSY error occurs.
|
|
10
|
+
* @default 5
|
|
11
|
+
*/
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Initial backoff time in milliseconds for retrying write operations on SQLITE_BUSY.
|
|
15
|
+
* The backoff time will double with each retry (exponential backoff).
|
|
16
|
+
* @default 100
|
|
17
|
+
*/
|
|
18
|
+
initialBackoffMs?: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for LibSQL domains - accepts either credentials or an existing client
|
|
22
|
+
*/
|
|
23
|
+
export type LibSQLDomainConfig = (LibSQLDomainBaseConfig & {
|
|
24
|
+
/** The database connection URL (e.g., "file:local.db", "libsql://...", "file::memory:") */
|
|
25
|
+
url: string;
|
|
26
|
+
/** Optional authentication token for remote databases */
|
|
27
|
+
authToken?: string;
|
|
28
|
+
}) | (LibSQLDomainBaseConfig & {
|
|
29
|
+
/** An existing LibSQL client instance */
|
|
30
|
+
client: Client;
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Resolves a LibSQLDomainConfig to a Client instance.
|
|
34
|
+
* Creates a new client if credentials are provided, or returns the existing client.
|
|
35
|
+
*
|
|
36
|
+
* @param config - The domain configuration
|
|
37
|
+
* @returns The resolved LibSQL client
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveClient(config: LibSQLDomainConfig): Client;
|
|
40
|
+
export declare class LibSQLDB extends MastraBase {
|
|
41
|
+
private client;
|
|
42
|
+
maxRetries: number;
|
|
43
|
+
initialBackoffMs: number;
|
|
44
|
+
executeWriteOperationWithRetry: <T>(operationFn: () => Promise<T>, operationDescription: string) => Promise<T>;
|
|
45
|
+
constructor({ client, maxRetries, initialBackoffMs, }: {
|
|
46
|
+
client: Client;
|
|
47
|
+
maxRetries?: number;
|
|
48
|
+
initialBackoffMs?: number;
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Checks if a column exists in the specified table.
|
|
52
|
+
*
|
|
53
|
+
* @param table - The name of the table to check
|
|
54
|
+
* @param column - The name of the column to look for
|
|
55
|
+
* @returns `true` if the column exists in the table, `false` otherwise
|
|
56
|
+
*/
|
|
57
|
+
hasColumn(table: string, column: string): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Internal insert implementation without retry logic.
|
|
60
|
+
*/
|
|
61
|
+
private doInsert;
|
|
62
|
+
/**
|
|
63
|
+
* Inserts or replaces a record in the specified table with automatic retry on lock errors.
|
|
64
|
+
*
|
|
65
|
+
* @param args - The insert arguments
|
|
66
|
+
* @param args.tableName - The name of the table to insert into
|
|
67
|
+
* @param args.record - The record to insert (key-value pairs)
|
|
68
|
+
*/
|
|
69
|
+
insert(args: {
|
|
70
|
+
tableName: TABLE_NAMES;
|
|
71
|
+
record: Record<string, any>;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Internal update implementation without retry logic.
|
|
75
|
+
*/
|
|
76
|
+
private doUpdate;
|
|
77
|
+
/**
|
|
78
|
+
* Updates a record in the specified table with automatic retry on lock errors.
|
|
79
|
+
*
|
|
80
|
+
* @param args - The update arguments
|
|
81
|
+
* @param args.tableName - The name of the table to update
|
|
82
|
+
* @param args.keys - The key(s) identifying the record to update
|
|
83
|
+
* @param args.data - The fields to update (key-value pairs)
|
|
84
|
+
*/
|
|
85
|
+
update(args: {
|
|
86
|
+
tableName: TABLE_NAMES;
|
|
87
|
+
keys: Record<string, any>;
|
|
88
|
+
data: Record<string, any>;
|
|
89
|
+
}): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Internal batch insert implementation without retry logic.
|
|
92
|
+
*/
|
|
93
|
+
private doBatchInsert;
|
|
94
|
+
/**
|
|
95
|
+
* Inserts multiple records in a single batch transaction with automatic retry on lock errors.
|
|
96
|
+
*
|
|
97
|
+
* @param args - The batch insert arguments
|
|
98
|
+
* @param args.tableName - The name of the table to insert into
|
|
99
|
+
* @param args.records - Array of records to insert
|
|
100
|
+
* @throws {MastraError} When the batch insert fails after retries
|
|
101
|
+
*/
|
|
102
|
+
batchInsert(args: {
|
|
103
|
+
tableName: TABLE_NAMES;
|
|
104
|
+
records: Record<string, any>[];
|
|
105
|
+
}): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Internal batch update implementation without retry logic.
|
|
108
|
+
* Each record can be updated based on single or composite keys.
|
|
109
|
+
*/
|
|
110
|
+
private doBatchUpdate;
|
|
111
|
+
/**
|
|
112
|
+
* Updates multiple records in a single batch transaction with automatic retry on lock errors.
|
|
113
|
+
* Each record can be updated based on single or composite keys.
|
|
114
|
+
*
|
|
115
|
+
* @param args - The batch update arguments
|
|
116
|
+
* @param args.tableName - The name of the table to update
|
|
117
|
+
* @param args.updates - Array of update operations, each containing keys and data
|
|
118
|
+
* @throws {MastraError} When the batch update fails after retries
|
|
119
|
+
*/
|
|
120
|
+
batchUpdate(args: {
|
|
121
|
+
tableName: TABLE_NAMES;
|
|
122
|
+
updates: Array<{
|
|
123
|
+
keys: Record<string, any>;
|
|
124
|
+
data: Record<string, any>;
|
|
125
|
+
}>;
|
|
126
|
+
}): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Internal batch delete implementation without retry logic.
|
|
129
|
+
* Each record can be deleted based on single or composite keys.
|
|
130
|
+
*/
|
|
131
|
+
private doBatchDelete;
|
|
132
|
+
/**
|
|
133
|
+
* Deletes multiple records in a single batch transaction with automatic retry on lock errors.
|
|
134
|
+
* Each record can be deleted based on single or composite keys.
|
|
135
|
+
*
|
|
136
|
+
* @param args - The batch delete arguments
|
|
137
|
+
* @param args.tableName - The name of the table to delete from
|
|
138
|
+
* @param args.keys - Array of key objects identifying records to delete
|
|
139
|
+
* @throws {MastraError} When the batch delete fails after retries
|
|
140
|
+
*/
|
|
141
|
+
batchDelete({ tableName, keys, }: {
|
|
142
|
+
tableName: TABLE_NAMES;
|
|
143
|
+
keys: Array<Record<string, any>>;
|
|
144
|
+
}): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Internal single-record delete implementation without retry logic.
|
|
147
|
+
*/
|
|
148
|
+
private doDelete;
|
|
149
|
+
/**
|
|
150
|
+
* Deletes a single record from the specified table with automatic retry on lock errors.
|
|
151
|
+
*
|
|
152
|
+
* @param args - The delete arguments
|
|
153
|
+
* @param args.tableName - The name of the table to delete from
|
|
154
|
+
* @param args.keys - The key(s) identifying the record to delete
|
|
155
|
+
* @throws {MastraError} When the delete fails after retries
|
|
156
|
+
*/
|
|
157
|
+
delete(args: {
|
|
158
|
+
tableName: TABLE_NAMES;
|
|
159
|
+
keys: Record<string, any>;
|
|
160
|
+
}): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Selects a single record from the specified table by key(s).
|
|
163
|
+
* Returns the most recently created record if multiple matches exist.
|
|
164
|
+
* Automatically parses JSON string values back to objects/arrays.
|
|
165
|
+
*
|
|
166
|
+
* @typeParam R - The expected return type of the record
|
|
167
|
+
* @param args - The select arguments
|
|
168
|
+
* @param args.tableName - The name of the table to select from
|
|
169
|
+
* @param args.keys - The key(s) identifying the record to select
|
|
170
|
+
* @returns The matching record or `null` if not found
|
|
171
|
+
*/
|
|
172
|
+
select<R>({ tableName, keys }: {
|
|
173
|
+
tableName: TABLE_NAMES;
|
|
174
|
+
keys: Record<string, string>;
|
|
175
|
+
}): Promise<R | null>;
|
|
176
|
+
/**
|
|
177
|
+
* Selects multiple records from the specified table with optional filtering, ordering, and pagination.
|
|
178
|
+
*
|
|
179
|
+
* @typeParam R - The expected return type of each record
|
|
180
|
+
* @param args - The select arguments
|
|
181
|
+
* @param args.tableName - The name of the table to select from
|
|
182
|
+
* @param args.whereClause - Optional WHERE clause with SQL string and arguments
|
|
183
|
+
* @param args.orderBy - Optional ORDER BY clause (e.g., "createdAt DESC")
|
|
184
|
+
* @param args.offset - Optional offset for pagination
|
|
185
|
+
* @param args.limit - Optional limit for pagination
|
|
186
|
+
* @param args.args - Optional additional query arguments
|
|
187
|
+
* @returns Array of matching records
|
|
188
|
+
*/
|
|
189
|
+
selectMany<R>({ tableName, whereClause, orderBy, offset, limit, args, }: {
|
|
190
|
+
tableName: TABLE_NAMES;
|
|
191
|
+
whereClause?: {
|
|
192
|
+
sql: string;
|
|
193
|
+
args: InValue[];
|
|
194
|
+
};
|
|
195
|
+
orderBy?: string;
|
|
196
|
+
offset?: number;
|
|
197
|
+
limit?: number;
|
|
198
|
+
args?: any[];
|
|
199
|
+
}): Promise<R[]>;
|
|
200
|
+
/**
|
|
201
|
+
* Returns the total count of records matching the optional WHERE clause.
|
|
202
|
+
*
|
|
203
|
+
* @param args - The count arguments
|
|
204
|
+
* @param args.tableName - The name of the table to count from
|
|
205
|
+
* @param args.whereClause - Optional WHERE clause with SQL string and arguments
|
|
206
|
+
* @returns The total count of matching records
|
|
207
|
+
*/
|
|
208
|
+
selectTotalCount({ tableName, whereClause, }: {
|
|
209
|
+
tableName: TABLE_NAMES;
|
|
210
|
+
whereClause?: {
|
|
211
|
+
sql: string;
|
|
212
|
+
args: InValue[];
|
|
213
|
+
};
|
|
214
|
+
}): Promise<number>;
|
|
215
|
+
/**
|
|
216
|
+
* Maps a storage column type to its SQLite equivalent.
|
|
217
|
+
*/
|
|
218
|
+
protected getSqlType(type: StorageColumn['type']): string;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a table if it doesn't exist based on the provided schema.
|
|
221
|
+
*
|
|
222
|
+
* @param args - The create table arguments
|
|
223
|
+
* @param args.tableName - The name of the table to create
|
|
224
|
+
* @param args.schema - The schema definition for the table columns
|
|
225
|
+
*/
|
|
226
|
+
createTable({ tableName, schema, }: {
|
|
227
|
+
tableName: TABLE_NAMES;
|
|
228
|
+
schema: Record<string, StorageColumn>;
|
|
229
|
+
}): Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Migrates the spans table schema from OLD_SPAN_SCHEMA to current SPAN_SCHEMA.
|
|
232
|
+
* This adds new columns that don't exist in old schema.
|
|
233
|
+
*/
|
|
234
|
+
private migrateSpansTable;
|
|
235
|
+
/**
|
|
236
|
+
* Gets a default value for a column type (used when adding NOT NULL columns).
|
|
237
|
+
*/
|
|
238
|
+
private getDefaultValue;
|
|
239
|
+
/**
|
|
240
|
+
* Alters an existing table to add missing columns.
|
|
241
|
+
* Used for schema migrations when new columns are added.
|
|
242
|
+
*
|
|
243
|
+
* @param args - The alter table arguments
|
|
244
|
+
* @param args.tableName - The name of the table to alter
|
|
245
|
+
* @param args.schema - The full schema definition for the table
|
|
246
|
+
* @param args.ifNotExists - Array of column names to add if they don't exist
|
|
247
|
+
*/
|
|
248
|
+
alterTable({ tableName, schema, ifNotExists, }: {
|
|
249
|
+
tableName: TABLE_NAMES;
|
|
250
|
+
schema: Record<string, StorageColumn>;
|
|
251
|
+
ifNotExists: string[];
|
|
252
|
+
}): Promise<void>;
|
|
253
|
+
/**
|
|
254
|
+
* Deletes all records from the specified table.
|
|
255
|
+
* Errors are logged but not thrown.
|
|
256
|
+
*
|
|
257
|
+
* @param args - The delete arguments
|
|
258
|
+
* @param args.tableName - The name of the table to clear
|
|
259
|
+
*/
|
|
260
|
+
deleteData({ tableName }: {
|
|
261
|
+
tableName: TABLE_NAMES;
|
|
262
|
+
}): Promise<void>;
|
|
263
|
+
}
|
|
264
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AASvE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,CAAC,sBAAsB,GAAG;IACxB,2FAA2F;IAC3F,GAAG,E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AE,MAAM,EAAE,CAAC;KACvB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCjB;;;;;;OAMG;IACG,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB3E"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { InValue } from '@libsql/client';
|
|
2
2
|
import type { IMastraLogger } from '@mastra/core/logger';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StorageColumn, TABLE_NAMES } from '@mastra/core/storage';
|
|
4
|
+
/**
|
|
5
|
+
* Checks if an error is a SQLite lock/busy error that should be retried
|
|
6
|
+
*/
|
|
7
|
+
export declare function isLockError(error: any): boolean;
|
|
4
8
|
export declare function createExecuteWriteOperationWithRetry({ logger, maxRetries, initialBackoffMs, }: {
|
|
5
9
|
logger: IMastraLogger;
|
|
6
10
|
maxRetries: number;
|
|
@@ -37,17 +41,6 @@ export declare function prepareWhereClause(filters: Record<string, WhereValue>,
|
|
|
37
41
|
sql: string;
|
|
38
42
|
args: InValue[];
|
|
39
43
|
};
|
|
40
|
-
type DateRangeFilter = {
|
|
41
|
-
startAt?: string;
|
|
42
|
-
endAt?: string;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Converts pagination date range to where clause date range format
|
|
46
|
-
* @param dateRange - The date range from pagination
|
|
47
|
-
* @param columnName - The timestamp column to filter on (defaults to 'createdAt')
|
|
48
|
-
* @returns Object with the date range filter, or empty object if no date range
|
|
49
|
-
*/
|
|
50
|
-
export declare function buildDateRangeFilter(dateRange?: PaginationArgs['dateRange'], columnName?: string): Record<string, DateRangeFilter>;
|
|
51
44
|
/**
|
|
52
45
|
* Transforms SQL row data back to a typed object format
|
|
53
46
|
* Reverses the transformations done in prepareStatement
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/db/utils.ts"],"names":[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,EAAE,EAAE;IAAE,SAAS,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,GAAG;IAClH,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB,CAQA;AAED,KAAK,UAAU,GAAG,OAAO,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACpC;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB,CAqBA;AA+CD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,EACrC,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC7B,GAAG,CAAC,CAiCJ"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type { Client } from '@libsql/client';
|
|
2
1
|
import { AgentsStorage } from '@mastra/core/storage';
|
|
3
2
|
import type { StorageAgentType, StorageCreateAgentInput, StorageUpdateAgentInput, StorageListAgentsInput, StorageListAgentsOutput } from '@mastra/core/storage';
|
|
4
|
-
import type {
|
|
3
|
+
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
5
4
|
export declare class AgentsLibSQL extends AgentsStorage {
|
|
6
|
-
private
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: LibSQLDomainConfig);
|
|
7
|
+
init(): Promise<void>;
|
|
8
|
+
dangerouslyClearAll(): Promise<void>;
|
|
11
9
|
private parseJson;
|
|
12
10
|
private parseRow;
|
|
13
11
|
getAgentById({ id }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAMd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,qBAAa,YAAa,SAAQ,aAAa;;gBAGjC,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,SAAS;IA2BjB,OAAO,CAAC,QAAQ;IAqBV,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAqBtE,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,uBAAuB,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA4CrF,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0EnF,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBlD,UAAU,CAAC,IAAI,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;CA8DlF"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import type { Client } from '@libsql/client';
|
|
2
1
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
3
2
|
import type { MastraDBMessage, StorageThreadType } from '@mastra/core/memory';
|
|
4
3
|
import type { StorageResourceType, StorageListMessagesInput, StorageListMessagesOutput, StorageListThreadsByResourceIdInput, StorageListThreadsByResourceIdOutput } from '@mastra/core/storage';
|
|
5
4
|
import { MemoryStorage } from '@mastra/core/storage';
|
|
6
|
-
import type {
|
|
5
|
+
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
7
6
|
export declare class MemoryLibSQL extends MemoryStorage {
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
operations: StoreOperationsLibSQL;
|
|
13
|
-
});
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: LibSQLDomainConfig);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
dangerouslyClearAll(): Promise<void>;
|
|
14
11
|
private parseRow;
|
|
15
12
|
private _getIncludedMessages;
|
|
16
13
|
listMessagesById({ messageIds }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/memory/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mCAAmC,EACnC,oCAAoC,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,aAAa,EAOd,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,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AmB,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3F,cAAc,CAAC,EACnB,UAAU,EACV,aAAa,EACb,QAAQ,GACT,EAAE;QACD,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmD1B,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAgC7E,uBAAuB,CAClC,IAAI,EAAE,mCAAmC,GACxC,OAAO,CAAC,oCAAoC,CAAC;IAqF1C,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA2BjF,YAAY,CAAC,EACjB,EAAE,EACF,KAAK,EACL,QAAQ,GACT,EAAE;QACD,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6CxB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CA0BtE"}
|
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
import { ObservabilityStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { SpanRecord,
|
|
3
|
-
import type {
|
|
2
|
+
import type { SpanRecord, ListTracesArgs, PaginationInfo, TracingStorageStrategy, UpdateSpanArgs, BatchDeleteTracesArgs, BatchUpdateSpansArgs, BatchCreateSpansArgs, CreateSpanArgs, GetSpanArgs, GetSpanResponse, GetRootSpanArgs, GetRootSpanResponse, GetTraceArgs, GetTraceResponse } from '@mastra/core/storage';
|
|
3
|
+
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
4
4
|
export declare class ObservabilityLibSQL extends ObservabilityStorage {
|
|
5
|
-
private
|
|
6
|
-
constructor(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
#private;
|
|
6
|
+
constructor(config: LibSQLDomainConfig);
|
|
7
|
+
init(): Promise<void>;
|
|
8
|
+
dangerouslyClearAll(): Promise<void>;
|
|
9
|
+
get tracingStrategy(): {
|
|
10
|
+
preferred: TracingStorageStrategy;
|
|
11
|
+
supported: TracingStorageStrategy[];
|
|
12
|
+
};
|
|
13
|
+
createSpan(args: CreateSpanArgs): Promise<void>;
|
|
14
|
+
getSpan(args: GetSpanArgs): Promise<GetSpanResponse | null>;
|
|
15
|
+
getRootSpan(args: GetRootSpanArgs): Promise<GetRootSpanResponse | null>;
|
|
16
|
+
getTrace(args: GetTraceArgs): Promise<GetTraceResponse | null>;
|
|
17
|
+
updateSpan(args: UpdateSpanArgs): Promise<void>;
|
|
18
|
+
listTraces(args: ListTracesArgs): Promise<{
|
|
17
19
|
pagination: PaginationInfo;
|
|
18
20
|
spans: SpanRecord[];
|
|
19
21
|
}>;
|
|
20
|
-
batchCreateSpans(args:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
batchUpdateSpans(args: {
|
|
24
|
-
records: {
|
|
25
|
-
traceId: string;
|
|
26
|
-
spanId: string;
|
|
27
|
-
updates: Partial<UpdateSpanRecord>;
|
|
28
|
-
}[];
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
batchDeleteTraces(args: {
|
|
31
|
-
traceIds: string[];
|
|
32
|
-
}): Promise<void>;
|
|
22
|
+
batchCreateSpans(args: BatchCreateSpansArgs): Promise<void>;
|
|
23
|
+
batchUpdateSpans(args: BatchUpdateSpansArgs): Promise<void>;
|
|
24
|
+
batchDeleteTraces(args: BatchDeleteTracesArgs): Promise<void>;
|
|
33
25
|
}
|
|
34
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/observability/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,oBAAoB,EAIrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGnD,qBAAa,mBAAoB,SAAQ,oBAAoB;;gBAG/C,MAAM,EAAE,kBAAkB;IAMhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,IAAoB,eAAe,IAAI;QACrC,SAAS,EAAE,sBAAsB,CAAC;QAClC,SAAS,EAAE,sBAAsB,EAAE,CAAC;KACrC,CAKA;IAEK,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/C,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IA6B3D,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA6BvE,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAgC9D,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC/C,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAoP9F,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC3D,gBAAgB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAkC3D,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;CAkBpE"}
|
|
@@ -1,32 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
1
|
+
import type { ListScoresResponse, SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
2
|
import { ScoresStorage } from '@mastra/core/storage';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
3
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
4
|
+
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class ScoresLibSQL extends ScoresStorage {
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
operations: StoreOperationsLibSQL;
|
|
12
|
-
});
|
|
6
|
+
#private;
|
|
7
|
+
constructor(config: LibSQLDomainConfig);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
dangerouslyClearAll(): Promise<void>;
|
|
13
10
|
listScoresByRunId({ runId, pagination, }: {
|
|
14
11
|
runId: string;
|
|
15
12
|
pagination: StoragePagination;
|
|
16
|
-
}): Promise<
|
|
17
|
-
pagination: PaginationInfo;
|
|
18
|
-
scores: ScoreRowData[];
|
|
19
|
-
}>;
|
|
13
|
+
}): Promise<ListScoresResponse>;
|
|
20
14
|
listScoresByScorerId({ scorerId, entityId, entityType, source, pagination, }: {
|
|
21
15
|
scorerId: string;
|
|
22
16
|
entityId?: string;
|
|
23
17
|
entityType?: string;
|
|
24
18
|
source?: ScoringSource;
|
|
25
19
|
pagination: StoragePagination;
|
|
26
|
-
}): Promise<
|
|
27
|
-
pagination: PaginationInfo;
|
|
28
|
-
scores: ScoreRowData[];
|
|
29
|
-
}>;
|
|
20
|
+
}): Promise<ListScoresResponse>;
|
|
30
21
|
/**
|
|
31
22
|
* LibSQL-specific score row transformation.
|
|
32
23
|
* Maps additionalLLMContext column to additionalContext field.
|
|
@@ -42,17 +33,11 @@ export declare class ScoresLibSQL extends ScoresStorage {
|
|
|
42
33
|
pagination: StoragePagination;
|
|
43
34
|
entityId: string;
|
|
44
35
|
entityType: string;
|
|
45
|
-
}): Promise<
|
|
46
|
-
pagination: PaginationInfo;
|
|
47
|
-
scores: ScoreRowData[];
|
|
48
|
-
}>;
|
|
36
|
+
}): Promise<ListScoresResponse>;
|
|
49
37
|
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
50
38
|
traceId: string;
|
|
51
39
|
spanId: string;
|
|
52
40
|
pagination: StoragePagination;
|
|
53
|
-
}): Promise<
|
|
54
|
-
pagination: PaginationInfo;
|
|
55
|
-
scores: ScoreRowData[];
|
|
56
|
-
}>;
|
|
41
|
+
}): Promise<ListScoresResponse>;
|
|
57
42
|
}
|
|
58
43
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/scores/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5G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CAAC;IAwDzB,gBAAgB,CAAC,EACrB,OAAO,EACP,MAAM,EACN,UAAU,GACX,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,iBAAiB,CAAC;KAC/B,GAAG,OAAO,CAAC,kBAAkB,CAAC;CA2ChC"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import type { Client } from '@libsql/client';
|
|
2
1
|
import type { WorkflowRun, WorkflowRuns, StorageListWorkflowRunsInput, UpdateWorkflowStateOptions } from '@mastra/core/storage';
|
|
3
2
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
4
3
|
import type { WorkflowRunState, StepResult } from '@mastra/core/workflows';
|
|
5
|
-
import type {
|
|
4
|
+
import type { LibSQLDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class WorkflowsLibSQL extends WorkflowsStorage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
operations: StoreOperationsLibSQL;
|
|
13
|
-
client: Client;
|
|
14
|
-
maxRetries?: number;
|
|
15
|
-
initialBackoffMs?: number;
|
|
16
|
-
});
|
|
6
|
+
#private;
|
|
7
|
+
private readonly executeWithRetry;
|
|
8
|
+
constructor(config: LibSQLDomainConfig);
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
dangerouslyClearAll(): Promise<void>;
|
|
17
11
|
private setupPragmaSettings;
|
|
18
|
-
private executeWithRetry;
|
|
19
12
|
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
20
13
|
workflowName: string;
|
|
21
14
|
runId: string;
|
|
@@ -28,11 +21,13 @@ export declare class WorkflowsLibSQL extends WorkflowsStorage {
|
|
|
28
21
|
runId: string;
|
|
29
22
|
opts: UpdateWorkflowStateOptions;
|
|
30
23
|
}): Promise<WorkflowRunState | undefined>;
|
|
31
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
24
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
|
|
32
25
|
workflowName: string;
|
|
33
26
|
runId: string;
|
|
34
27
|
resourceId?: string;
|
|
35
28
|
snapshot: WorkflowRunState;
|
|
29
|
+
createdAt?: Date;
|
|
30
|
+
updatedAt?: Date;
|
|
36
31
|
}): Promise<void>;
|
|
37
32
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
38
33
|
workflowName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAKL,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAuBnD,qBAAa,eAAgB,SAAQ,gBAAgB;;IAGnD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAiF;gBAEtG,MAAM,EAAE,kBAAkB;IAqBhC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;YAI5B,mBAAmB;IA0B3B,qBAAqB,CAAC,EAC1B,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,EACN,cAAc,GACf,EAAE;QACD,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,G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