@mastra/libsql 0.10.1 → 0.10.2-alpha.1
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 +8 -8
- package/CHANGELOG.md +27 -0
- package/dist/_tsup-dts-rollup.d.cts +53 -3
- package/dist/_tsup-dts-rollup.d.ts +53 -3
- package/dist/index.cjs +347 -129
- package/dist/index.js +347 -129
- package/package.json +10 -10
- package/src/storage/index.test.ts +356 -6
- package/src/storage/index.ts +437 -157
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/libsql@0.10.
|
|
2
|
+
> @mastra/libsql@0.10.2-alpha.1 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
|
-
[34mCLI[39m tsup v8.
|
|
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 10122ms
|
|
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 11851ms
|
|
17
17
|
[34mCLI[39m Cleaning output folder
|
|
18
18
|
[34mESM[39m Build start
|
|
19
19
|
[34mCJS[39m Build start
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
20
|
+
[32mESM[39m [1mdist/index.js [22m[32m57.43 KB[39m
|
|
21
|
+
[32mESM[39m ⚡️ Build success in 1740ms
|
|
22
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m57.72 KB[39m
|
|
23
|
+
[32mCJS[39m ⚡️ Build success in 1740ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @mastra/libsql
|
|
2
2
|
|
|
3
|
+
## 0.10.2-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dffb67b: updated stores to add alter table and change tests
|
|
8
|
+
- Updated dependencies [f6fd25f]
|
|
9
|
+
- Updated dependencies [dffb67b]
|
|
10
|
+
- Updated dependencies [f1309d3]
|
|
11
|
+
- Updated dependencies [f7f8293]
|
|
12
|
+
- @mastra/core@0.10.4-alpha.1
|
|
13
|
+
|
|
14
|
+
## 0.10.2-alpha.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 5d3dc1e: dependencies updates:
|
|
19
|
+
- Updated dependency [`@libsql/client@^0.15.8` ↗︎](https://www.npmjs.com/package/@libsql/client/v/0.15.8) (from `^0.15.4`, in `dependencies`)
|
|
20
|
+
- 14a2566: Add pagination to libsql storage APIs
|
|
21
|
+
- Updated dependencies [d1ed912]
|
|
22
|
+
- Updated dependencies [f1f1f1b]
|
|
23
|
+
- Updated dependencies [f9816ae]
|
|
24
|
+
- Updated dependencies [82090c1]
|
|
25
|
+
- Updated dependencies [1b443fd]
|
|
26
|
+
- Updated dependencies [ce97900]
|
|
27
|
+
- Updated dependencies [14a2566]
|
|
28
|
+
- @mastra/core@0.10.4-alpha.0
|
|
29
|
+
|
|
3
30
|
## 0.10.1
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -11,12 +11,15 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
|
11
11
|
import { MastraStorage } from '@mastra/core/storage';
|
|
12
12
|
import { MastraVector } from '@mastra/core/vector';
|
|
13
13
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
14
|
+
import type { PaginationArgs } from '@mastra/core/storage';
|
|
15
|
+
import type { PaginationInfo } from '@mastra/core/storage';
|
|
14
16
|
import type { QueryResult } from '@mastra/core/vector';
|
|
15
17
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
16
18
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
17
19
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
18
20
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
19
21
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
22
|
+
import type { Trace } from '@mastra/core/telemetry';
|
|
20
23
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
21
24
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
22
25
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
@@ -86,6 +89,18 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
86
89
|
tableName: TABLE_NAMES;
|
|
87
90
|
schema: Record<string, StorageColumn>;
|
|
88
91
|
}): Promise<void>;
|
|
92
|
+
protected getSqlType(type: StorageColumn['type']): string;
|
|
93
|
+
/**
|
|
94
|
+
* Alters table schema to add columns if they don't exist
|
|
95
|
+
* @param tableName Name of the table
|
|
96
|
+
* @param schema Schema of the table
|
|
97
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
98
|
+
*/
|
|
99
|
+
alterTable({ tableName, schema, ifNotExists, }: {
|
|
100
|
+
tableName: TABLE_NAMES;
|
|
101
|
+
schema: Record<string, StorageColumn>;
|
|
102
|
+
ifNotExists: string[];
|
|
103
|
+
}): Promise<void>;
|
|
89
104
|
clearTable({ tableName }: {
|
|
90
105
|
tableName: TABLE_NAMES;
|
|
91
106
|
}): Promise<void>;
|
|
@@ -108,9 +123,17 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
108
123
|
getThreadById({ threadId }: {
|
|
109
124
|
threadId: string;
|
|
110
125
|
}): Promise<StorageThreadType | null>;
|
|
111
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
|
|
128
|
+
*/
|
|
129
|
+
getThreadsByResourceId(args: {
|
|
112
130
|
resourceId: string;
|
|
113
131
|
}): Promise<StorageThreadType[]>;
|
|
132
|
+
getThreadsByResourceIdPaginated(args: {
|
|
133
|
+
resourceId: string;
|
|
134
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
135
|
+
threads: StorageThreadType[];
|
|
136
|
+
}>;
|
|
114
137
|
saveThread({ thread }: {
|
|
115
138
|
thread: StorageThreadType;
|
|
116
139
|
}): Promise<StorageThreadType>;
|
|
@@ -123,12 +146,21 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
123
146
|
threadId: string;
|
|
124
147
|
}): Promise<void>;
|
|
125
148
|
private parseRow;
|
|
149
|
+
private _getIncludedMessages;
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated use getMessagesPaginated instead for paginated results.
|
|
152
|
+
*/
|
|
126
153
|
getMessages(args: StorageGetMessagesArg & {
|
|
127
154
|
format?: 'v1';
|
|
128
155
|
}): Promise<MastraMessageV1[]>;
|
|
129
156
|
getMessages(args: StorageGetMessagesArg & {
|
|
130
157
|
format: 'v2';
|
|
131
158
|
}): Promise<MastraMessageV2[]>;
|
|
159
|
+
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
160
|
+
format?: 'v1' | 'v2';
|
|
161
|
+
}): Promise<PaginationInfo & {
|
|
162
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
163
|
+
}>;
|
|
132
164
|
saveMessages(args: {
|
|
133
165
|
messages: MastraMessageV1[];
|
|
134
166
|
format?: undefined | 'v1';
|
|
@@ -138,8 +170,18 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
138
170
|
format: 'v2';
|
|
139
171
|
}): Promise<MastraMessageV2[]>;
|
|
140
172
|
private transformEvalRow;
|
|
173
|
+
/** @deprecated use getEvals instead */
|
|
141
174
|
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
142
|
-
|
|
175
|
+
getEvals(options?: {
|
|
176
|
+
agentName?: string;
|
|
177
|
+
type?: 'test' | 'live';
|
|
178
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
179
|
+
evals: EvalRow[];
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* @deprecated use getTracesPaginated instead.
|
|
183
|
+
*/
|
|
184
|
+
getTraces(args: {
|
|
143
185
|
name?: string;
|
|
144
186
|
scope?: string;
|
|
145
187
|
page: number;
|
|
@@ -148,7 +190,15 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
148
190
|
filters?: Record<string, any>;
|
|
149
191
|
fromDate?: Date;
|
|
150
192
|
toDate?: Date;
|
|
151
|
-
}): Promise<
|
|
193
|
+
}): Promise<Trace[]>;
|
|
194
|
+
getTracesPaginated(args: {
|
|
195
|
+
name?: string;
|
|
196
|
+
scope?: string;
|
|
197
|
+
attributes?: Record<string, string>;
|
|
198
|
+
filters?: Record<string, any>;
|
|
199
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
200
|
+
traces: Trace[];
|
|
201
|
+
}>;
|
|
152
202
|
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
153
203
|
workflowName?: string;
|
|
154
204
|
fromDate?: Date;
|
|
@@ -11,12 +11,15 @@ import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
|
11
11
|
import { MastraStorage } from '@mastra/core/storage';
|
|
12
12
|
import { MastraVector } from '@mastra/core/vector';
|
|
13
13
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
14
|
+
import type { PaginationArgs } from '@mastra/core/storage';
|
|
15
|
+
import type { PaginationInfo } from '@mastra/core/storage';
|
|
14
16
|
import type { QueryResult } from '@mastra/core/vector';
|
|
15
17
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
16
18
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
17
19
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
18
20
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
19
21
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
22
|
+
import type { Trace } from '@mastra/core/telemetry';
|
|
20
23
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
21
24
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
22
25
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
@@ -86,6 +89,18 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
86
89
|
tableName: TABLE_NAMES;
|
|
87
90
|
schema: Record<string, StorageColumn>;
|
|
88
91
|
}): Promise<void>;
|
|
92
|
+
protected getSqlType(type: StorageColumn['type']): string;
|
|
93
|
+
/**
|
|
94
|
+
* Alters table schema to add columns if they don't exist
|
|
95
|
+
* @param tableName Name of the table
|
|
96
|
+
* @param schema Schema of the table
|
|
97
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
98
|
+
*/
|
|
99
|
+
alterTable({ tableName, schema, ifNotExists, }: {
|
|
100
|
+
tableName: TABLE_NAMES;
|
|
101
|
+
schema: Record<string, StorageColumn>;
|
|
102
|
+
ifNotExists: string[];
|
|
103
|
+
}): Promise<void>;
|
|
89
104
|
clearTable({ tableName }: {
|
|
90
105
|
tableName: TABLE_NAMES;
|
|
91
106
|
}): Promise<void>;
|
|
@@ -108,9 +123,17 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
108
123
|
getThreadById({ threadId }: {
|
|
109
124
|
threadId: string;
|
|
110
125
|
}): Promise<StorageThreadType | null>;
|
|
111
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
|
|
128
|
+
*/
|
|
129
|
+
getThreadsByResourceId(args: {
|
|
112
130
|
resourceId: string;
|
|
113
131
|
}): Promise<StorageThreadType[]>;
|
|
132
|
+
getThreadsByResourceIdPaginated(args: {
|
|
133
|
+
resourceId: string;
|
|
134
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
135
|
+
threads: StorageThreadType[];
|
|
136
|
+
}>;
|
|
114
137
|
saveThread({ thread }: {
|
|
115
138
|
thread: StorageThreadType;
|
|
116
139
|
}): Promise<StorageThreadType>;
|
|
@@ -123,12 +146,21 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
123
146
|
threadId: string;
|
|
124
147
|
}): Promise<void>;
|
|
125
148
|
private parseRow;
|
|
149
|
+
private _getIncludedMessages;
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated use getMessagesPaginated instead for paginated results.
|
|
152
|
+
*/
|
|
126
153
|
getMessages(args: StorageGetMessagesArg & {
|
|
127
154
|
format?: 'v1';
|
|
128
155
|
}): Promise<MastraMessageV1[]>;
|
|
129
156
|
getMessages(args: StorageGetMessagesArg & {
|
|
130
157
|
format: 'v2';
|
|
131
158
|
}): Promise<MastraMessageV2[]>;
|
|
159
|
+
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
160
|
+
format?: 'v1' | 'v2';
|
|
161
|
+
}): Promise<PaginationInfo & {
|
|
162
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
163
|
+
}>;
|
|
132
164
|
saveMessages(args: {
|
|
133
165
|
messages: MastraMessageV1[];
|
|
134
166
|
format?: undefined | 'v1';
|
|
@@ -138,8 +170,18 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
138
170
|
format: 'v2';
|
|
139
171
|
}): Promise<MastraMessageV2[]>;
|
|
140
172
|
private transformEvalRow;
|
|
173
|
+
/** @deprecated use getEvals instead */
|
|
141
174
|
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
142
|
-
|
|
175
|
+
getEvals(options?: {
|
|
176
|
+
agentName?: string;
|
|
177
|
+
type?: 'test' | 'live';
|
|
178
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
179
|
+
evals: EvalRow[];
|
|
180
|
+
}>;
|
|
181
|
+
/**
|
|
182
|
+
* @deprecated use getTracesPaginated instead.
|
|
183
|
+
*/
|
|
184
|
+
getTraces(args: {
|
|
143
185
|
name?: string;
|
|
144
186
|
scope?: string;
|
|
145
187
|
page: number;
|
|
@@ -148,7 +190,15 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
148
190
|
filters?: Record<string, any>;
|
|
149
191
|
fromDate?: Date;
|
|
150
192
|
toDate?: Date;
|
|
151
|
-
}): Promise<
|
|
193
|
+
}): Promise<Trace[]>;
|
|
194
|
+
getTracesPaginated(args: {
|
|
195
|
+
name?: string;
|
|
196
|
+
scope?: string;
|
|
197
|
+
attributes?: Record<string, string>;
|
|
198
|
+
filters?: Record<string, any>;
|
|
199
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
200
|
+
traces: Trace[];
|
|
201
|
+
}>;
|
|
152
202
|
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
153
203
|
workflowName?: string;
|
|
154
204
|
fromDate?: Date;
|