@mastra/libsql 0.0.4 → 0.0.5-alpha.0
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 +15 -0
- package/dist/_tsup-dts-rollup.d.cts +18 -29
- package/dist/_tsup-dts-rollup.d.ts +18 -29
- package/dist/index.cjs +285 -184
- package/dist/index.js +285 -184
- package/package.json +2 -2
- package/src/storage/index.ts +18 -10
- package/src/vector/index.test.ts +154 -119
- package/src/vector/index.ts +63 -27
- package/src/vector/sql-builder.ts +243 -175
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/libsql@0.0.
|
|
2
|
+
> @mastra/libsql@0.0.5-alpha.0 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.4.0
|
|
8
8
|
[34mTSC[39m Build start
|
|
9
|
-
[32mTSC[39m ⚡️ Build success in
|
|
9
|
+
[32mTSC[39m ⚡️ Build success in 8603ms
|
|
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 8936ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m47.82 KB[39m
|
|
21
|
+
[32mCJS[39m ⚡️ Build success in 807ms
|
|
22
|
+
[32mESM[39m [1mdist/index.js [22m[32m47.62 KB[39m
|
|
23
|
+
[32mESM[39m ⚡️ Build success in 808ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 0.0.5-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- eabdcd9: [MASTRA-3451] SQL Injection Protection
|
|
8
|
+
- d0ee3c6: Change all public functions and constructors in vector stores to use named args and prepare to phase out positional args
|
|
9
|
+
- Updated dependencies [f53a6ac]
|
|
10
|
+
- Updated dependencies [eabdcd9]
|
|
11
|
+
- Updated dependencies [90be034]
|
|
12
|
+
- Updated dependencies [99f050a]
|
|
13
|
+
- Updated dependencies [d0ee3c6]
|
|
14
|
+
- Updated dependencies [23f258c]
|
|
15
|
+
- Updated dependencies [2672a05]
|
|
16
|
+
- @mastra/core@0.9.5-alpha.0
|
|
17
|
+
|
|
3
18
|
## 0.0.4
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import type { ArrayOperator } from '@mastra/core/vector/filter';
|
|
2
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
3
|
-
import type { BasicOperator } from '@mastra/core/vector/filter';
|
|
4
2
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
5
|
-
import type {
|
|
3
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
6
|
import type { EvalRow } from '@mastra/core/storage';
|
|
7
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
8
|
import type { InValue } from '@libsql/client';
|
|
9
|
-
import type { LogicalOperator } from '@mastra/core/vector/filter';
|
|
10
9
|
import { MastraStorage } from '@mastra/core/storage';
|
|
11
10
|
import { MastraVector } from '@mastra/core/vector';
|
|
12
11
|
import type { MessageType } from '@mastra/core/memory';
|
|
13
|
-
import type { NumericOperator } from '@mastra/core/vector/filter';
|
|
14
12
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
15
13
|
import type { ParamsToArgs } from '@mastra/core/vector';
|
|
16
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
17
15
|
import type { QueryVectorArgs } from '@mastra/core/vector';
|
|
18
16
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
19
|
-
import type { RegexOperator } from '@mastra/core/vector/filter';
|
|
20
17
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
21
18
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
22
19
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
23
20
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
21
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
24
22
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
25
23
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
26
24
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
@@ -28,21 +26,11 @@ import type { WorkflowRuns } from '@mastra/core/storage';
|
|
|
28
26
|
|
|
29
27
|
export declare function buildFilterQuery(filter: VectorFilter): FilterResult;
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare type FilterOperator = {
|
|
34
|
-
sql: string;
|
|
35
|
-
needsValue: boolean;
|
|
36
|
-
transformValue?: (value: any) => any;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export declare interface FilterResult {
|
|
29
|
+
declare interface FilterResult {
|
|
40
30
|
sql: string;
|
|
41
31
|
values: InValue[];
|
|
42
32
|
}
|
|
43
33
|
|
|
44
|
-
export declare const handleKey: (key: string) => string;
|
|
45
|
-
|
|
46
34
|
/**
|
|
47
35
|
* Vector store specific prompt that details supported operators and examples.
|
|
48
36
|
* This prompt helps users construct valid filters for LibSQL Vector.
|
|
@@ -170,9 +158,16 @@ declare class LibSQLVector extends MastraVector {
|
|
|
170
158
|
query(...args: ParamsToArgs<LibSQLQueryParams> | LibSQLQueryArgs): Promise<QueryResult[]>;
|
|
171
159
|
upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
172
160
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
173
|
-
deleteIndex(
|
|
161
|
+
deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
174
162
|
listIndexes(): Promise<string[]>;
|
|
175
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Retrieves statistics about a vector index.
|
|
165
|
+
*
|
|
166
|
+
* @param params - The parameters for describing an index
|
|
167
|
+
* @param params.indexName - The name of the index to describe
|
|
168
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
169
|
+
*/
|
|
170
|
+
describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
|
|
176
171
|
/**
|
|
177
172
|
* @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
|
|
178
173
|
*
|
|
@@ -191,6 +186,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
191
186
|
}): Promise<void>;
|
|
192
187
|
/**
|
|
193
188
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
189
|
+
*
|
|
194
190
|
* @param indexName - The name of the index containing the vector.
|
|
195
191
|
* @param id - The ID of the vector to update.
|
|
196
192
|
* @param update - An object containing the vector and/or metadata to update.
|
|
@@ -199,10 +195,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
199
195
|
* @returns A promise that resolves when the update is complete.
|
|
200
196
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
201
197
|
*/
|
|
202
|
-
updateVector(
|
|
203
|
-
vector?: number[];
|
|
204
|
-
metadata?: Record<string, any>;
|
|
205
|
-
}): Promise<void>;
|
|
198
|
+
updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
|
|
206
199
|
/**
|
|
207
200
|
* @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
|
|
208
201
|
*
|
|
@@ -220,14 +213,10 @@ declare class LibSQLVector extends MastraVector {
|
|
|
220
213
|
* @returns A promise that resolves when the deletion is complete.
|
|
221
214
|
* @throws Will throw an error if the deletion operation fails.
|
|
222
215
|
*/
|
|
223
|
-
deleteVector(
|
|
224
|
-
truncateIndex(
|
|
216
|
+
deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
|
|
217
|
+
truncateIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
225
218
|
}
|
|
226
219
|
export { LibSQLVector }
|
|
227
220
|
export { LibSQLVector as LibSQLVector_alias_1 }
|
|
228
221
|
|
|
229
|
-
declare type OperatorFn = (key: string, value?: any) => FilterOperator;
|
|
230
|
-
|
|
231
|
-
export declare type OperatorType = BasicOperator | NumericOperator | ArrayOperator | ElementOperator | LogicalOperator | '$contains' | Exclude<RegexOperator, '$options'>;
|
|
232
|
-
|
|
233
222
|
export { }
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import type { ArrayOperator } from '@mastra/core/vector/filter';
|
|
2
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
3
|
-
import type { BasicOperator } from '@mastra/core/vector/filter';
|
|
4
2
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
5
|
-
import type {
|
|
3
|
+
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
|
+
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
|
+
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
6
|
import type { EvalRow } from '@mastra/core/storage';
|
|
7
7
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
8
|
import type { InValue } from '@libsql/client';
|
|
9
|
-
import type { LogicalOperator } from '@mastra/core/vector/filter';
|
|
10
9
|
import { MastraStorage } from '@mastra/core/storage';
|
|
11
10
|
import { MastraVector } from '@mastra/core/vector';
|
|
12
11
|
import type { MessageType } from '@mastra/core/memory';
|
|
13
|
-
import type { NumericOperator } from '@mastra/core/vector/filter';
|
|
14
12
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
15
13
|
import type { ParamsToArgs } from '@mastra/core/vector';
|
|
16
14
|
import type { QueryResult } from '@mastra/core/vector';
|
|
17
15
|
import type { QueryVectorArgs } from '@mastra/core/vector';
|
|
18
16
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
19
|
-
import type { RegexOperator } from '@mastra/core/vector/filter';
|
|
20
17
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
21
18
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
22
19
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
23
20
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
21
|
+
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
24
22
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
25
23
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
26
24
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
@@ -28,21 +26,11 @@ import type { WorkflowRuns } from '@mastra/core/storage';
|
|
|
28
26
|
|
|
29
27
|
export declare function buildFilterQuery(filter: VectorFilter): FilterResult;
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
declare type FilterOperator = {
|
|
34
|
-
sql: string;
|
|
35
|
-
needsValue: boolean;
|
|
36
|
-
transformValue?: (value: any) => any;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export declare interface FilterResult {
|
|
29
|
+
declare interface FilterResult {
|
|
40
30
|
sql: string;
|
|
41
31
|
values: InValue[];
|
|
42
32
|
}
|
|
43
33
|
|
|
44
|
-
export declare const handleKey: (key: string) => string;
|
|
45
|
-
|
|
46
34
|
/**
|
|
47
35
|
* Vector store specific prompt that details supported operators and examples.
|
|
48
36
|
* This prompt helps users construct valid filters for LibSQL Vector.
|
|
@@ -170,9 +158,16 @@ declare class LibSQLVector extends MastraVector {
|
|
|
170
158
|
query(...args: ParamsToArgs<LibSQLQueryParams> | LibSQLQueryArgs): Promise<QueryResult[]>;
|
|
171
159
|
upsert(...args: ParamsToArgs<UpsertVectorParams>): Promise<string[]>;
|
|
172
160
|
createIndex(...args: ParamsToArgs<CreateIndexParams>): Promise<void>;
|
|
173
|
-
deleteIndex(
|
|
161
|
+
deleteIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
174
162
|
listIndexes(): Promise<string[]>;
|
|
175
|
-
|
|
163
|
+
/**
|
|
164
|
+
* Retrieves statistics about a vector index.
|
|
165
|
+
*
|
|
166
|
+
* @param params - The parameters for describing an index
|
|
167
|
+
* @param params.indexName - The name of the index to describe
|
|
168
|
+
* @returns A promise that resolves to the index statistics including dimension, count and metric
|
|
169
|
+
*/
|
|
170
|
+
describeIndex(...args: ParamsToArgs<DescribeIndexParams>): Promise<IndexStats>;
|
|
176
171
|
/**
|
|
177
172
|
* @deprecated Use {@link updateVector} instead. This method will be removed on May 20th, 2025.
|
|
178
173
|
*
|
|
@@ -191,6 +186,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
191
186
|
}): Promise<void>;
|
|
192
187
|
/**
|
|
193
188
|
* Updates a vector by its ID with the provided vector and/or metadata.
|
|
189
|
+
*
|
|
194
190
|
* @param indexName - The name of the index containing the vector.
|
|
195
191
|
* @param id - The ID of the vector to update.
|
|
196
192
|
* @param update - An object containing the vector and/or metadata to update.
|
|
@@ -199,10 +195,7 @@ declare class LibSQLVector extends MastraVector {
|
|
|
199
195
|
* @returns A promise that resolves when the update is complete.
|
|
200
196
|
* @throws Will throw an error if no updates are provided or if the update operation fails.
|
|
201
197
|
*/
|
|
202
|
-
updateVector(
|
|
203
|
-
vector?: number[];
|
|
204
|
-
metadata?: Record<string, any>;
|
|
205
|
-
}): Promise<void>;
|
|
198
|
+
updateVector(...args: ParamsToArgs<UpdateVectorParams>): Promise<void>;
|
|
206
199
|
/**
|
|
207
200
|
* @deprecated Use {@link deleteVector} instead. This method will be removed on May 20th, 2025.
|
|
208
201
|
*
|
|
@@ -220,14 +213,10 @@ declare class LibSQLVector extends MastraVector {
|
|
|
220
213
|
* @returns A promise that resolves when the deletion is complete.
|
|
221
214
|
* @throws Will throw an error if the deletion operation fails.
|
|
222
215
|
*/
|
|
223
|
-
deleteVector(
|
|
224
|
-
truncateIndex(
|
|
216
|
+
deleteVector(...args: ParamsToArgs<DeleteVectorParams>): Promise<void>;
|
|
217
|
+
truncateIndex(...args: ParamsToArgs<DeleteIndexParams>): Promise<void>;
|
|
225
218
|
}
|
|
226
219
|
export { LibSQLVector }
|
|
227
220
|
export { LibSQLVector as LibSQLVector_alias_1 }
|
|
228
221
|
|
|
229
|
-
declare type OperatorFn = (key: string, value?: any) => FilterOperator;
|
|
230
|
-
|
|
231
|
-
export declare type OperatorType = BasicOperator | NumericOperator | ArrayOperator | ElementOperator | LogicalOperator | '$contains' | Exclude<RegexOperator, '$options'>;
|
|
232
|
-
|
|
233
222
|
export { }
|