@mastra/libsql 0.10.4-alpha.0 → 0.10.4-alpha.2
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +28 -0
- package/dist/_tsup-dts-rollup.d.cts +33 -6
- package/dist/_tsup-dts-rollup.d.ts +33 -6
- package/dist/index.cjs +555 -155
- package/dist/index.js +545 -145
- package/package.json +4 -4
- package/src/storage/index.test.ts +1 -30
- package/src/storage/index.ts +453 -137
- package/src/vector/filter.test.ts +22 -84
- package/src/vector/filter.ts +19 -5
- package/src/vector/index.test.ts +1 -11
- package/src/vector/index.ts +130 -18
- package/src/vector/sql-builder.ts +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/libsql@0.10.4-alpha.
|
|
2
|
+
> @mastra/libsql@0.10.4-alpha.2 build /home/runner/work/mastra/mastra/stores/libsql
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
7
|
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 10168ms
|
|
10
10
|
[34mDTS[39m Build start
|
|
11
11
|
[34mCLI[39m Target: es2022
|
|
12
12
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
13
13
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/libsql/dist/_tsup-dts-rollup.d.ts[39m
|
|
14
14
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
15
15
|
[36mWriting package typings: /home/runner/work/mastra/mastra/stores/libsql/dist/_tsup-dts-rollup.d.cts[39m
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 12199ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[32mESM[39m [1mdist/index.js [22m[
|
|
21
|
-
[32mESM[39m ⚡️ Build success in
|
|
22
|
-
[32mCJS[39m [1mdist/index.cjs [22m[
|
|
23
|
-
[32mCJS[39m ⚡️ Build success in
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m72.42 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 1829ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m73.39 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 1829ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 0.10.4-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 15e9d26: Added per-resource working memory for LibSQL, Upstash, and PG
|
|
8
|
+
- 0fb9d64: [MASTRA-4018] Update saveMessages in storage adapters to upsert messages
|
|
9
|
+
- 144eb0b: [MASTRA-3669] Metadata Filter Types
|
|
10
|
+
- f0150c4: Fix LibSQLStore and PgStore getMessagesPaginated implementation
|
|
11
|
+
- Updated dependencies [15e9d26]
|
|
12
|
+
- Updated dependencies [07d6d88]
|
|
13
|
+
- Updated dependencies [5d74aab]
|
|
14
|
+
- Updated dependencies [144eb0b]
|
|
15
|
+
- @mastra/core@0.10.7-alpha.2
|
|
16
|
+
|
|
17
|
+
## 0.10.4-alpha.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 2097952: [MASTRA-4021] Fix PG getMessages and update messageLimit for all storage adapters
|
|
22
|
+
- 0e17048: Throw mastra errors in storage packages
|
|
23
|
+
- Updated dependencies [d1baedb]
|
|
24
|
+
- Updated dependencies [4d21bf2]
|
|
25
|
+
- Updated dependencies [2097952]
|
|
26
|
+
- Updated dependencies [4fb0cc2]
|
|
27
|
+
- Updated dependencies [d2a7a31]
|
|
28
|
+
- Updated dependencies [0e17048]
|
|
29
|
+
- @mastra/core@0.10.7-alpha.1
|
|
30
|
+
|
|
3
31
|
## 0.10.4-alpha.0
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -12,22 +12,25 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
|
12
12
|
import { MastraStorage } from '@mastra/core/storage';
|
|
13
13
|
import { MastraVector } from '@mastra/core/vector';
|
|
14
14
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
15
|
+
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
15
16
|
import type { PaginationArgs } from '@mastra/core/storage';
|
|
16
17
|
import type { PaginationInfo } from '@mastra/core/storage';
|
|
17
18
|
import type { QueryResult } from '@mastra/core/vector';
|
|
18
19
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
19
20
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
20
21
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
22
|
+
import type { StorageResourceType } from '@mastra/core/storage';
|
|
21
23
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
22
24
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
23
25
|
import type { Trace } from '@mastra/core/telemetry';
|
|
24
26
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
25
27
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
28
|
+
import type { VectorFieldValue } from '@mastra/core/vector/filter';
|
|
26
29
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
27
30
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
28
31
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
29
32
|
|
|
30
|
-
export declare function buildFilterQuery(filter:
|
|
33
|
+
export declare function buildFilterQuery(filter: LibSQLVectorFilter): FilterResult;
|
|
31
34
|
|
|
32
35
|
declare interface FilterResult {
|
|
33
36
|
sql: string;
|
|
@@ -70,13 +73,23 @@ export { LibSQLConfig as LibSQLConfig_alias_1 }
|
|
|
70
73
|
* - Can take either a single condition or an array of conditions
|
|
71
74
|
*
|
|
72
75
|
*/
|
|
73
|
-
export declare class LibSQLFilterTranslator extends BaseFilterTranslator {
|
|
76
|
+
export declare class LibSQLFilterTranslator extends BaseFilterTranslator<LibSQLVectorFilter> {
|
|
74
77
|
protected getSupportedOperators(): OperatorSupport;
|
|
75
|
-
translate(filter?:
|
|
78
|
+
translate(filter?: LibSQLVectorFilter): LibSQLVectorFilter;
|
|
76
79
|
private translateNode;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
declare
|
|
82
|
+
declare type LibSQLOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$in' | '$all' | '$nin' | '$eq' | '$ne'> & {
|
|
83
|
+
$size: number;
|
|
84
|
+
$contains: VectorFieldValue | Record<string, unknown>;
|
|
85
|
+
$all: VectorFieldValue;
|
|
86
|
+
$in: VectorFieldValue;
|
|
87
|
+
$nin: VectorFieldValue;
|
|
88
|
+
$eq: VectorFieldValue;
|
|
89
|
+
$ne: VectorFieldValue;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare interface LibSQLQueryVectorParams extends QueryVectorParams<LibSQLVectorFilter> {
|
|
80
93
|
minScore?: number;
|
|
81
94
|
}
|
|
82
95
|
|
|
@@ -87,6 +100,7 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
87
100
|
constructor(config: LibSQLConfig);
|
|
88
101
|
get supports(): {
|
|
89
102
|
selectByIncludeResourceScope: boolean;
|
|
103
|
+
resourceWorkingMemory: boolean;
|
|
90
104
|
};
|
|
91
105
|
private getCreateTableSQL;
|
|
92
106
|
createTable({ tableName, schema, }: {
|
|
@@ -224,6 +238,17 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
224
238
|
runId: string;
|
|
225
239
|
workflowName?: string;
|
|
226
240
|
}): Promise<WorkflowRun | null>;
|
|
241
|
+
getResourceById({ resourceId }: {
|
|
242
|
+
resourceId: string;
|
|
243
|
+
}): Promise<StorageResourceType | null>;
|
|
244
|
+
saveResource({ resource }: {
|
|
245
|
+
resource: StorageResourceType;
|
|
246
|
+
}): Promise<StorageResourceType>;
|
|
247
|
+
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
248
|
+
resourceId: string;
|
|
249
|
+
workingMemory?: string;
|
|
250
|
+
metadata?: Record<string, unknown>;
|
|
251
|
+
}): Promise<StorageResourceType>;
|
|
227
252
|
private hasColumn;
|
|
228
253
|
private parseWorkflowRun;
|
|
229
254
|
}
|
|
@@ -232,13 +257,13 @@ export { LibSQLStore as DefaultStorage_alias_1 }
|
|
|
232
257
|
export { LibSQLStore }
|
|
233
258
|
export { LibSQLStore as LibSQLStore_alias_1 }
|
|
234
259
|
|
|
235
|
-
declare class LibSQLVector extends MastraVector {
|
|
260
|
+
declare class LibSQLVector extends MastraVector<LibSQLVectorFilter> {
|
|
236
261
|
private turso;
|
|
237
262
|
private readonly maxRetries;
|
|
238
263
|
private readonly initialBackoffMs;
|
|
239
264
|
constructor({ connectionUrl, authToken, syncUrl, syncInterval, maxRetries, initialBackoffMs, }: LibSQLVectorConfig);
|
|
240
265
|
private executeWriteOperationWithRetry;
|
|
241
|
-
transformFilter(filter?:
|
|
266
|
+
transformFilter(filter?: LibSQLVectorFilter): LibSQLVectorFilter;
|
|
242
267
|
query({ indexName, queryVector, topK, filter, includeVector, minScore, }: LibSQLQueryVectorParams): Promise<QueryResult[]>;
|
|
243
268
|
upsert(args: UpsertVectorParams): Promise<string[]>;
|
|
244
269
|
private doUpsert;
|
|
@@ -302,4 +327,6 @@ declare interface LibSQLVectorConfig {
|
|
|
302
327
|
export { LibSQLVectorConfig }
|
|
303
328
|
export { LibSQLVectorConfig as LibSQLVectorConfig_alias_1 }
|
|
304
329
|
|
|
330
|
+
export declare type LibSQLVectorFilter = VectorFilter<keyof LibSQLOperatorValueMap, LibSQLOperatorValueMap>;
|
|
331
|
+
|
|
305
332
|
export { }
|
|
@@ -12,22 +12,25 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
|
12
12
|
import { MastraStorage } from '@mastra/core/storage';
|
|
13
13
|
import { MastraVector } from '@mastra/core/vector';
|
|
14
14
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
15
|
+
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
15
16
|
import type { PaginationArgs } from '@mastra/core/storage';
|
|
16
17
|
import type { PaginationInfo } from '@mastra/core/storage';
|
|
17
18
|
import type { QueryResult } from '@mastra/core/vector';
|
|
18
19
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
19
20
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
20
21
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
22
|
+
import type { StorageResourceType } from '@mastra/core/storage';
|
|
21
23
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
22
24
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
23
25
|
import type { Trace } from '@mastra/core/telemetry';
|
|
24
26
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
25
27
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
28
|
+
import type { VectorFieldValue } from '@mastra/core/vector/filter';
|
|
26
29
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
27
30
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
28
31
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
29
32
|
|
|
30
|
-
export declare function buildFilterQuery(filter:
|
|
33
|
+
export declare function buildFilterQuery(filter: LibSQLVectorFilter): FilterResult;
|
|
31
34
|
|
|
32
35
|
declare interface FilterResult {
|
|
33
36
|
sql: string;
|
|
@@ -70,13 +73,23 @@ export { LibSQLConfig as LibSQLConfig_alias_1 }
|
|
|
70
73
|
* - Can take either a single condition or an array of conditions
|
|
71
74
|
*
|
|
72
75
|
*/
|
|
73
|
-
export declare class LibSQLFilterTranslator extends BaseFilterTranslator {
|
|
76
|
+
export declare class LibSQLFilterTranslator extends BaseFilterTranslator<LibSQLVectorFilter> {
|
|
74
77
|
protected getSupportedOperators(): OperatorSupport;
|
|
75
|
-
translate(filter?:
|
|
78
|
+
translate(filter?: LibSQLVectorFilter): LibSQLVectorFilter;
|
|
76
79
|
private translateNode;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
declare
|
|
82
|
+
declare type LibSQLOperatorValueMap = Omit<OperatorValueMap, '$regex' | '$options' | '$in' | '$all' | '$nin' | '$eq' | '$ne'> & {
|
|
83
|
+
$size: number;
|
|
84
|
+
$contains: VectorFieldValue | Record<string, unknown>;
|
|
85
|
+
$all: VectorFieldValue;
|
|
86
|
+
$in: VectorFieldValue;
|
|
87
|
+
$nin: VectorFieldValue;
|
|
88
|
+
$eq: VectorFieldValue;
|
|
89
|
+
$ne: VectorFieldValue;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare interface LibSQLQueryVectorParams extends QueryVectorParams<LibSQLVectorFilter> {
|
|
80
93
|
minScore?: number;
|
|
81
94
|
}
|
|
82
95
|
|
|
@@ -87,6 +100,7 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
87
100
|
constructor(config: LibSQLConfig);
|
|
88
101
|
get supports(): {
|
|
89
102
|
selectByIncludeResourceScope: boolean;
|
|
103
|
+
resourceWorkingMemory: boolean;
|
|
90
104
|
};
|
|
91
105
|
private getCreateTableSQL;
|
|
92
106
|
createTable({ tableName, schema, }: {
|
|
@@ -224,6 +238,17 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
224
238
|
runId: string;
|
|
225
239
|
workflowName?: string;
|
|
226
240
|
}): Promise<WorkflowRun | null>;
|
|
241
|
+
getResourceById({ resourceId }: {
|
|
242
|
+
resourceId: string;
|
|
243
|
+
}): Promise<StorageResourceType | null>;
|
|
244
|
+
saveResource({ resource }: {
|
|
245
|
+
resource: StorageResourceType;
|
|
246
|
+
}): Promise<StorageResourceType>;
|
|
247
|
+
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
248
|
+
resourceId: string;
|
|
249
|
+
workingMemory?: string;
|
|
250
|
+
metadata?: Record<string, unknown>;
|
|
251
|
+
}): Promise<StorageResourceType>;
|
|
227
252
|
private hasColumn;
|
|
228
253
|
private parseWorkflowRun;
|
|
229
254
|
}
|
|
@@ -232,13 +257,13 @@ export { LibSQLStore as DefaultStorage_alias_1 }
|
|
|
232
257
|
export { LibSQLStore }
|
|
233
258
|
export { LibSQLStore as LibSQLStore_alias_1 }
|
|
234
259
|
|
|
235
|
-
declare class LibSQLVector extends MastraVector {
|
|
260
|
+
declare class LibSQLVector extends MastraVector<LibSQLVectorFilter> {
|
|
236
261
|
private turso;
|
|
237
262
|
private readonly maxRetries;
|
|
238
263
|
private readonly initialBackoffMs;
|
|
239
264
|
constructor({ connectionUrl, authToken, syncUrl, syncInterval, maxRetries, initialBackoffMs, }: LibSQLVectorConfig);
|
|
240
265
|
private executeWriteOperationWithRetry;
|
|
241
|
-
transformFilter(filter?:
|
|
266
|
+
transformFilter(filter?: LibSQLVectorFilter): LibSQLVectorFilter;
|
|
242
267
|
query({ indexName, queryVector, topK, filter, includeVector, minScore, }: LibSQLQueryVectorParams): Promise<QueryResult[]>;
|
|
243
268
|
upsert(args: UpsertVectorParams): Promise<string[]>;
|
|
244
269
|
private doUpsert;
|
|
@@ -302,4 +327,6 @@ declare interface LibSQLVectorConfig {
|
|
|
302
327
|
export { LibSQLVectorConfig }
|
|
303
328
|
export { LibSQLVectorConfig as LibSQLVectorConfig_alias_1 }
|
|
304
329
|
|
|
330
|
+
export declare type LibSQLVectorFilter = VectorFilter<keyof LibSQLOperatorValueMap, LibSQLOperatorValueMap>;
|
|
331
|
+
|
|
305
332
|
export { }
|