@mastra/libsql 0.11.0-alpha.3 → 0.11.1-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 +60 -0
- package/LICENSE.md +12 -4
- package/dist/_tsup-dts-rollup.d.cts +336 -30
- package/dist/_tsup-dts-rollup.d.ts +336 -30
- package/dist/index.cjs +1357 -847
- package/dist/index.js +1227 -717
- package/package.json +6 -6
- package/src/storage/domains/legacy-evals/index.ts +149 -0
- package/src/storage/domains/memory/index.ts +786 -0
- package/src/storage/domains/operations/index.ts +296 -0
- package/src/storage/domains/scores/index.ts +217 -0
- package/src/storage/domains/traces/index.ts +150 -0
- package/src/storage/domains/utils.ts +67 -0
- package/src/storage/domains/workflows/index.ts +198 -0
- package/src/storage/index.test.ts +2 -515
- package/src/storage/index.ts +186 -1338
|
@@ -1,42 +1,81 @@
|
|
|
1
1
|
import { BaseFilterTranslator } from '@mastra/core/vector/filter';
|
|
2
|
+
import type { Client } from '@libsql/client';
|
|
2
3
|
import type { CreateIndexParams } from '@mastra/core/vector';
|
|
3
4
|
import type { DeleteIndexParams } from '@mastra/core/vector';
|
|
4
5
|
import type { DeleteVectorParams } from '@mastra/core/vector';
|
|
5
6
|
import type { DescribeIndexParams } from '@mastra/core/vector';
|
|
6
7
|
import type { EvalRow } from '@mastra/core/storage';
|
|
8
|
+
import type { IMastraLogger } from '@mastra/core/logger';
|
|
7
9
|
import type { IndexStats } from '@mastra/core/vector';
|
|
8
10
|
import type { InValue } from '@libsql/client';
|
|
11
|
+
import { LegacyEvalsStorage } from '@mastra/core/storage';
|
|
9
12
|
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
10
13
|
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
11
14
|
import type { MastraMessageV2 } from '@mastra/core/agent';
|
|
15
|
+
import type { MastraMessageV2 as MastraMessageV2_2 } from '@mastra/core/memory';
|
|
12
16
|
import { MastraStorage } from '@mastra/core/storage';
|
|
13
17
|
import { MastraVector } from '@mastra/core/vector';
|
|
18
|
+
import { MemoryStorage } from '@mastra/core/storage';
|
|
14
19
|
import type { OperatorSupport } from '@mastra/core/vector/filter';
|
|
15
20
|
import type { OperatorValueMap } from '@mastra/core/vector/filter';
|
|
16
21
|
import type { PaginationArgs } from '@mastra/core/storage';
|
|
17
22
|
import type { PaginationInfo } from '@mastra/core/storage';
|
|
18
23
|
import type { QueryResult } from '@mastra/core/vector';
|
|
19
24
|
import type { QueryVectorParams } from '@mastra/core/vector';
|
|
25
|
+
import type { ScoreRowData } from '@mastra/core/scores';
|
|
26
|
+
import { ScoresStorage } from '@mastra/core/storage';
|
|
20
27
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
28
|
+
import type { StorageDomains } from '@mastra/core/storage';
|
|
21
29
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
30
|
+
import type { StorageGetTracesArg } from '@mastra/core/storage';
|
|
31
|
+
import type { StorageGetTracesPaginatedArg } from '@mastra/core/storage';
|
|
32
|
+
import type { StoragePagination } from '@mastra/core/storage';
|
|
22
33
|
import type { StorageResourceType } from '@mastra/core/storage';
|
|
23
34
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
35
|
+
import { StoreOperations } from '@mastra/core/storage';
|
|
24
36
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
25
37
|
import type { Trace } from '@mastra/core/telemetry';
|
|
38
|
+
import { TracesStorage } from '@mastra/core/storage';
|
|
26
39
|
import type { UpdateVectorParams } from '@mastra/core/vector';
|
|
27
40
|
import type { UpsertVectorParams } from '@mastra/core/vector';
|
|
28
41
|
import type { VectorFieldValue } from '@mastra/core/vector/filter';
|
|
29
42
|
import type { VectorFilter } from '@mastra/core/vector/filter';
|
|
30
43
|
import type { WorkflowRun } from '@mastra/core/storage';
|
|
44
|
+
import type { WorkflowRun as WorkflowRun_2 } from '@mastra/core';
|
|
31
45
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
46
|
+
import type { WorkflowRuns as WorkflowRuns_2 } from '@mastra/core';
|
|
47
|
+
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
48
|
+
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
49
|
+
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
32
50
|
|
|
33
51
|
export declare function buildFilterQuery(filter: LibSQLVectorFilter): FilterResult;
|
|
34
52
|
|
|
53
|
+
export declare function createExecuteWriteOperationWithRetry({ logger, maxRetries, initialBackoffMs, }: {
|
|
54
|
+
logger: IMastraLogger;
|
|
55
|
+
maxRetries: number;
|
|
56
|
+
initialBackoffMs: number;
|
|
57
|
+
}): <T>(operationFn: () => Promise<T>, operationDescription: string) => Promise<T>;
|
|
58
|
+
|
|
35
59
|
declare interface FilterResult {
|
|
36
60
|
sql: string;
|
|
37
61
|
values: InValue[];
|
|
38
62
|
}
|
|
39
63
|
|
|
64
|
+
export declare class LegacyEvalsLibSQL extends LegacyEvalsStorage {
|
|
65
|
+
private client;
|
|
66
|
+
constructor({ client }: {
|
|
67
|
+
client: Client;
|
|
68
|
+
});
|
|
69
|
+
/** @deprecated use getEvals instead */
|
|
70
|
+
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
71
|
+
getEvals(options?: {
|
|
72
|
+
agentName?: string;
|
|
73
|
+
type?: 'test' | 'live';
|
|
74
|
+
} & PaginationArgs): Promise<PaginationInfo & {
|
|
75
|
+
evals: EvalRow[];
|
|
76
|
+
}>;
|
|
77
|
+
}
|
|
78
|
+
|
|
40
79
|
/**
|
|
41
80
|
* Vector store specific prompt that details supported operators and examples.
|
|
42
81
|
* This prompt helps users construct valid filters for LibSQL Vector.
|
|
@@ -45,7 +84,7 @@ declare const LIBSQL_PROMPT = "When querying LibSQL Vector, you can ONLY use the
|
|
|
45
84
|
export { LIBSQL_PROMPT }
|
|
46
85
|
export { LIBSQL_PROMPT as LIBSQL_PROMPT_alias_1 }
|
|
47
86
|
|
|
48
|
-
declare
|
|
87
|
+
declare type LibSQLConfig = {
|
|
49
88
|
url: string;
|
|
50
89
|
authToken?: string;
|
|
51
90
|
/**
|
|
@@ -59,7 +98,11 @@ declare interface LibSQLConfig {
|
|
|
59
98
|
* @default 100
|
|
60
99
|
*/
|
|
61
100
|
initialBackoffMs?: number;
|
|
62
|
-
}
|
|
101
|
+
} | {
|
|
102
|
+
client: Client;
|
|
103
|
+
maxRetries?: number;
|
|
104
|
+
initialBackoffMs?: number;
|
|
105
|
+
};
|
|
63
106
|
export { LibSQLConfig }
|
|
64
107
|
export { LibSQLConfig as LibSQLConfig_alias_1 }
|
|
65
108
|
|
|
@@ -97,17 +140,18 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
97
140
|
private client;
|
|
98
141
|
private readonly maxRetries;
|
|
99
142
|
private readonly initialBackoffMs;
|
|
143
|
+
stores: StorageDomains;
|
|
100
144
|
constructor(config: LibSQLConfig);
|
|
101
145
|
get supports(): {
|
|
102
146
|
selectByIncludeResourceScope: boolean;
|
|
103
147
|
resourceWorkingMemory: boolean;
|
|
148
|
+
hasColumn: boolean;
|
|
149
|
+
createTable: boolean;
|
|
104
150
|
};
|
|
105
|
-
private getCreateTableSQL;
|
|
106
151
|
createTable({ tableName, schema, }: {
|
|
107
152
|
tableName: TABLE_NAMES;
|
|
108
153
|
schema: Record<string, StorageColumn>;
|
|
109
154
|
}): Promise<void>;
|
|
110
|
-
protected getSqlType(type: StorageColumn['type']): string;
|
|
111
155
|
/**
|
|
112
156
|
* Alters table schema to add columns if they don't exist
|
|
113
157
|
* @param tableName Name of the table
|
|
@@ -122,18 +166,17 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
122
166
|
clearTable({ tableName }: {
|
|
123
167
|
tableName: TABLE_NAMES;
|
|
124
168
|
}): Promise<void>;
|
|
125
|
-
|
|
126
|
-
|
|
169
|
+
dropTable({ tableName }: {
|
|
170
|
+
tableName: TABLE_NAMES;
|
|
171
|
+
}): Promise<void>;
|
|
127
172
|
insert(args: {
|
|
128
173
|
tableName: TABLE_NAMES;
|
|
129
174
|
record: Record<string, any>;
|
|
130
175
|
}): Promise<void>;
|
|
131
|
-
private doInsert;
|
|
132
176
|
batchInsert(args: {
|
|
133
177
|
tableName: TABLE_NAMES;
|
|
134
178
|
records: Record<string, any>[];
|
|
135
179
|
}): Promise<void>;
|
|
136
|
-
private doBatchInsert;
|
|
137
180
|
load<R>({ tableName, keys }: {
|
|
138
181
|
tableName: TABLE_NAMES;
|
|
139
182
|
keys: Record<string, string>;
|
|
@@ -149,7 +192,9 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
149
192
|
}): Promise<StorageThreadType[]>;
|
|
150
193
|
getThreadsByResourceIdPaginated(args: {
|
|
151
194
|
resourceId: string;
|
|
152
|
-
|
|
195
|
+
page: number;
|
|
196
|
+
perPage: number;
|
|
197
|
+
}): Promise<PaginationInfo & {
|
|
153
198
|
threads: StorageThreadType[];
|
|
154
199
|
}>;
|
|
155
200
|
saveThread({ thread }: {
|
|
@@ -163,8 +208,6 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
163
208
|
deleteThread({ threadId }: {
|
|
164
209
|
threadId: string;
|
|
165
210
|
}): Promise<void>;
|
|
166
|
-
private parseRow;
|
|
167
|
-
private _getIncludedMessages;
|
|
168
211
|
/**
|
|
169
212
|
* @deprecated use getMessagesPaginated instead for paginated results.
|
|
170
213
|
*/
|
|
@@ -196,7 +239,6 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
196
239
|
};
|
|
197
240
|
})[];
|
|
198
241
|
}): Promise<MastraMessageV2[]>;
|
|
199
|
-
private transformEvalRow;
|
|
200
242
|
/** @deprecated use getEvals instead */
|
|
201
243
|
getEvalsByAgentName(agentName: string, type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
202
244
|
getEvals(options?: {
|
|
@@ -205,27 +247,61 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
205
247
|
} & PaginationArgs): Promise<PaginationInfo & {
|
|
206
248
|
evals: EvalRow[];
|
|
207
249
|
}>;
|
|
250
|
+
getScoreById({ id }: {
|
|
251
|
+
id: string;
|
|
252
|
+
}): Promise<ScoreRowData | null>;
|
|
253
|
+
saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
254
|
+
score: ScoreRowData;
|
|
255
|
+
}>;
|
|
256
|
+
getScoresByScorerId({ scorerId, entityId, entityType, pagination, }: {
|
|
257
|
+
scorerId: string;
|
|
258
|
+
entityId?: string;
|
|
259
|
+
entityType?: string;
|
|
260
|
+
pagination: StoragePagination;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
pagination: PaginationInfo;
|
|
263
|
+
scores: ScoreRowData[];
|
|
264
|
+
}>;
|
|
265
|
+
getScoresByRunId({ runId, pagination, }: {
|
|
266
|
+
runId: string;
|
|
267
|
+
pagination: StoragePagination;
|
|
268
|
+
}): Promise<{
|
|
269
|
+
pagination: PaginationInfo;
|
|
270
|
+
scores: ScoreRowData[];
|
|
271
|
+
}>;
|
|
272
|
+
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
273
|
+
pagination: StoragePagination;
|
|
274
|
+
entityId: string;
|
|
275
|
+
entityType: string;
|
|
276
|
+
}): Promise<{
|
|
277
|
+
pagination: PaginationInfo;
|
|
278
|
+
scores: ScoreRowData[];
|
|
279
|
+
}>;
|
|
280
|
+
/**
|
|
281
|
+
* TRACES
|
|
282
|
+
*/
|
|
208
283
|
/**
|
|
209
284
|
* @deprecated use getTracesPaginated instead.
|
|
210
285
|
*/
|
|
211
|
-
getTraces(args:
|
|
212
|
-
|
|
213
|
-
scope?: string;
|
|
214
|
-
page: number;
|
|
215
|
-
perPage: number;
|
|
216
|
-
attributes?: Record<string, string>;
|
|
217
|
-
filters?: Record<string, any>;
|
|
218
|
-
fromDate?: Date;
|
|
219
|
-
toDate?: Date;
|
|
220
|
-
}): Promise<Trace[]>;
|
|
221
|
-
getTracesPaginated(args: {
|
|
222
|
-
name?: string;
|
|
223
|
-
scope?: string;
|
|
224
|
-
attributes?: Record<string, string>;
|
|
225
|
-
filters?: Record<string, any>;
|
|
226
|
-
} & PaginationArgs): Promise<PaginationInfo & {
|
|
286
|
+
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
287
|
+
getTracesPaginated(args: StorageGetTracesArg): Promise<PaginationInfo & {
|
|
227
288
|
traces: Trace[];
|
|
228
289
|
}>;
|
|
290
|
+
batchTraceInsert(args: {
|
|
291
|
+
records: Record<string, any>[];
|
|
292
|
+
}): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* WORKFLOWS
|
|
295
|
+
*/
|
|
296
|
+
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
297
|
+
workflowName: string;
|
|
298
|
+
runId: string;
|
|
299
|
+
snapshot: WorkflowRunState;
|
|
300
|
+
}): Promise<void>;
|
|
301
|
+
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
302
|
+
workflowName: string;
|
|
303
|
+
runId: string;
|
|
304
|
+
}): Promise<WorkflowRunState | null>;
|
|
229
305
|
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
230
306
|
workflowName?: string;
|
|
231
307
|
fromDate?: Date;
|
|
@@ -249,8 +325,6 @@ declare class LibSQLStore extends MastraStorage {
|
|
|
249
325
|
workingMemory?: string;
|
|
250
326
|
metadata?: Record<string, unknown>;
|
|
251
327
|
}): Promise<StorageResourceType>;
|
|
252
|
-
private hasColumn;
|
|
253
|
-
private parseWorkflowRun;
|
|
254
328
|
}
|
|
255
329
|
export { LibSQLStore as DefaultStorage }
|
|
256
330
|
export { LibSQLStore as DefaultStorage_alias_1 }
|
|
@@ -329,4 +403,236 @@ export { LibSQLVectorConfig as LibSQLVectorConfig_alias_1 }
|
|
|
329
403
|
|
|
330
404
|
export declare type LibSQLVectorFilter = VectorFilter<keyof LibSQLOperatorValueMap, LibSQLOperatorValueMap>;
|
|
331
405
|
|
|
406
|
+
export declare class MemoryLibSQL extends MemoryStorage {
|
|
407
|
+
private client;
|
|
408
|
+
private operations;
|
|
409
|
+
constructor({ client, operations }: {
|
|
410
|
+
client: Client;
|
|
411
|
+
operations: StoreOperationsLibSQL;
|
|
412
|
+
});
|
|
413
|
+
private parseRow;
|
|
414
|
+
private _getIncludedMessages;
|
|
415
|
+
/**
|
|
416
|
+
* @deprecated use getMessagesPaginated instead for paginated results.
|
|
417
|
+
*/
|
|
418
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
419
|
+
format?: 'v1';
|
|
420
|
+
}): Promise<MastraMessageV1[]>;
|
|
421
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
422
|
+
format: 'v2';
|
|
423
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
424
|
+
getMessagesPaginated(args: StorageGetMessagesArg & {
|
|
425
|
+
format?: 'v1' | 'v2';
|
|
426
|
+
}): Promise<PaginationInfo & {
|
|
427
|
+
messages: MastraMessageV1[] | MastraMessageV2_2[];
|
|
428
|
+
}>;
|
|
429
|
+
saveMessages(args: {
|
|
430
|
+
messages: MastraMessageV1[];
|
|
431
|
+
format?: undefined | 'v1';
|
|
432
|
+
}): Promise<MastraMessageV1[]>;
|
|
433
|
+
saveMessages(args: {
|
|
434
|
+
messages: MastraMessageV2_2[];
|
|
435
|
+
format: 'v2';
|
|
436
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
437
|
+
updateMessages({ messages, }: {
|
|
438
|
+
messages: (Partial<Omit<MastraMessageV2_2, 'createdAt'>> & {
|
|
439
|
+
id: string;
|
|
440
|
+
content?: {
|
|
441
|
+
metadata?: MastraMessageContentV2['metadata'];
|
|
442
|
+
content?: MastraMessageContentV2['content'];
|
|
443
|
+
};
|
|
444
|
+
})[];
|
|
445
|
+
}): Promise<MastraMessageV2_2[]>;
|
|
446
|
+
getResourceById({ resourceId }: {
|
|
447
|
+
resourceId: string;
|
|
448
|
+
}): Promise<StorageResourceType | null>;
|
|
449
|
+
saveResource({ resource }: {
|
|
450
|
+
resource: StorageResourceType;
|
|
451
|
+
}): Promise<StorageResourceType>;
|
|
452
|
+
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
453
|
+
resourceId: string;
|
|
454
|
+
workingMemory?: string;
|
|
455
|
+
metadata?: Record<string, unknown>;
|
|
456
|
+
}): Promise<StorageResourceType>;
|
|
457
|
+
getThreadById({ threadId }: {
|
|
458
|
+
threadId: string;
|
|
459
|
+
}): Promise<StorageThreadType | null>;
|
|
460
|
+
/**
|
|
461
|
+
* @deprecated use getThreadsByResourceIdPaginated instead for paginated results.
|
|
462
|
+
*/
|
|
463
|
+
getThreadsByResourceId(args: {
|
|
464
|
+
resourceId: string;
|
|
465
|
+
}): Promise<StorageThreadType[]>;
|
|
466
|
+
getThreadsByResourceIdPaginated(args: {
|
|
467
|
+
resourceId: string;
|
|
468
|
+
page: number;
|
|
469
|
+
perPage: number;
|
|
470
|
+
}): Promise<PaginationInfo & {
|
|
471
|
+
threads: StorageThreadType[];
|
|
472
|
+
}>;
|
|
473
|
+
saveThread({ thread }: {
|
|
474
|
+
thread: StorageThreadType;
|
|
475
|
+
}): Promise<StorageThreadType>;
|
|
476
|
+
updateThread({ id, title, metadata, }: {
|
|
477
|
+
id: string;
|
|
478
|
+
title: string;
|
|
479
|
+
metadata: Record<string, unknown>;
|
|
480
|
+
}): Promise<StorageThreadType>;
|
|
481
|
+
deleteThread({ threadId }: {
|
|
482
|
+
threadId: string;
|
|
483
|
+
}): Promise<void>;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export declare function prepareStatement({ tableName, record }: {
|
|
487
|
+
tableName: TABLE_NAMES;
|
|
488
|
+
record: Record<string, any>;
|
|
489
|
+
}): {
|
|
490
|
+
sql: string;
|
|
491
|
+
args: InValue[];
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export declare class ScoresLibSQL extends ScoresStorage {
|
|
495
|
+
private operations;
|
|
496
|
+
private client;
|
|
497
|
+
constructor({ client, operations }: {
|
|
498
|
+
client: Client;
|
|
499
|
+
operations: StoreOperationsLibSQL;
|
|
500
|
+
});
|
|
501
|
+
getScoresByRunId({ runId, pagination, }: {
|
|
502
|
+
runId: string;
|
|
503
|
+
pagination: StoragePagination;
|
|
504
|
+
}): Promise<{
|
|
505
|
+
pagination: PaginationInfo;
|
|
506
|
+
scores: ScoreRowData[];
|
|
507
|
+
}>;
|
|
508
|
+
getScoresByScorerId({ scorerId, entityId, entityType, pagination, }: {
|
|
509
|
+
scorerId: string;
|
|
510
|
+
entityId?: string;
|
|
511
|
+
entityType?: string;
|
|
512
|
+
pagination: StoragePagination;
|
|
513
|
+
}): Promise<{
|
|
514
|
+
pagination: PaginationInfo;
|
|
515
|
+
scores: ScoreRowData[];
|
|
516
|
+
}>;
|
|
517
|
+
private transformScoreRow;
|
|
518
|
+
getScoreById({ id }: {
|
|
519
|
+
id: string;
|
|
520
|
+
}): Promise<ScoreRowData | null>;
|
|
521
|
+
saveScore(score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>): Promise<{
|
|
522
|
+
score: ScoreRowData;
|
|
523
|
+
}>;
|
|
524
|
+
getScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
525
|
+
pagination: StoragePagination;
|
|
526
|
+
entityId: string;
|
|
527
|
+
entityType: string;
|
|
528
|
+
}): Promise<{
|
|
529
|
+
pagination: PaginationInfo;
|
|
530
|
+
scores: ScoreRowData[];
|
|
531
|
+
}>;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export declare class StoreOperationsLibSQL extends StoreOperations {
|
|
535
|
+
private client;
|
|
536
|
+
/**
|
|
537
|
+
* Maximum number of retries for write operations if an SQLITE_BUSY error occurs.
|
|
538
|
+
* @default 5
|
|
539
|
+
*/
|
|
540
|
+
maxRetries: number;
|
|
541
|
+
/**
|
|
542
|
+
* Initial backoff time in milliseconds for retrying write operations on SQLITE_BUSY.
|
|
543
|
+
* The backoff time will double with each retry (exponential backoff).
|
|
544
|
+
* @default 100
|
|
545
|
+
*/
|
|
546
|
+
initialBackoffMs: number;
|
|
547
|
+
constructor({ client, maxRetries, initialBackoffMs, }: {
|
|
548
|
+
client: Client;
|
|
549
|
+
maxRetries?: number;
|
|
550
|
+
initialBackoffMs?: number;
|
|
551
|
+
});
|
|
552
|
+
hasColumn(table: string, column: string): Promise<boolean>;
|
|
553
|
+
private getCreateTableSQL;
|
|
554
|
+
createTable({ tableName, schema, }: {
|
|
555
|
+
tableName: TABLE_NAMES;
|
|
556
|
+
schema: Record<string, StorageColumn>;
|
|
557
|
+
}): Promise<void>;
|
|
558
|
+
protected getSqlType(type: StorageColumn['type']): string;
|
|
559
|
+
private doInsert;
|
|
560
|
+
insert(args: {
|
|
561
|
+
tableName: TABLE_NAMES;
|
|
562
|
+
record: Record<string, any>;
|
|
563
|
+
}): Promise<void>;
|
|
564
|
+
load<R>({ tableName, keys }: {
|
|
565
|
+
tableName: TABLE_NAMES;
|
|
566
|
+
keys: Record<string, string>;
|
|
567
|
+
}): Promise<R | null>;
|
|
568
|
+
private doBatchInsert;
|
|
569
|
+
batchInsert(args: {
|
|
570
|
+
tableName: TABLE_NAMES;
|
|
571
|
+
records: Record<string, any>[];
|
|
572
|
+
}): Promise<void>;
|
|
573
|
+
/**
|
|
574
|
+
* Alters table schema to add columns if they don't exist
|
|
575
|
+
* @param tableName Name of the table
|
|
576
|
+
* @param schema Schema of the table
|
|
577
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
578
|
+
*/
|
|
579
|
+
alterTable({ tableName, schema, ifNotExists, }: {
|
|
580
|
+
tableName: TABLE_NAMES;
|
|
581
|
+
schema: Record<string, StorageColumn>;
|
|
582
|
+
ifNotExists: string[];
|
|
583
|
+
}): Promise<void>;
|
|
584
|
+
clearTable({ tableName }: {
|
|
585
|
+
tableName: TABLE_NAMES;
|
|
586
|
+
}): Promise<void>;
|
|
587
|
+
dropTable({ tableName }: {
|
|
588
|
+
tableName: TABLE_NAMES;
|
|
589
|
+
}): Promise<void>;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export declare class TracesLibSQL extends TracesStorage {
|
|
593
|
+
private client;
|
|
594
|
+
private operations;
|
|
595
|
+
constructor({ client, operations }: {
|
|
596
|
+
client: Client;
|
|
597
|
+
operations: StoreOperationsLibSQL;
|
|
598
|
+
});
|
|
599
|
+
getTraces(args: StorageGetTracesArg): Promise<Trace[]>;
|
|
600
|
+
getTracesPaginated(args: StorageGetTracesPaginatedArg): Promise<PaginationInfo & {
|
|
601
|
+
traces: Trace[];
|
|
602
|
+
}>;
|
|
603
|
+
batchTraceInsert({ records }: {
|
|
604
|
+
records: Record<string, any>[];
|
|
605
|
+
}): Promise<void>;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export declare class WorkflowsLibSQL extends WorkflowsStorage {
|
|
609
|
+
operations: StoreOperationsLibSQL;
|
|
610
|
+
client: Client;
|
|
611
|
+
constructor({ operations, client }: {
|
|
612
|
+
operations: StoreOperationsLibSQL;
|
|
613
|
+
client: Client;
|
|
614
|
+
});
|
|
615
|
+
persistWorkflowSnapshot({ workflowName, runId, snapshot, }: {
|
|
616
|
+
workflowName: string;
|
|
617
|
+
runId: string;
|
|
618
|
+
snapshot: WorkflowRunState_2;
|
|
619
|
+
}): Promise<void>;
|
|
620
|
+
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
621
|
+
workflowName: string;
|
|
622
|
+
runId: string;
|
|
623
|
+
}): Promise<WorkflowRunState_2 | null>;
|
|
624
|
+
getWorkflowRunById({ runId, workflowName, }: {
|
|
625
|
+
runId: string;
|
|
626
|
+
workflowName?: string;
|
|
627
|
+
}): Promise<WorkflowRun_2 | null>;
|
|
628
|
+
getWorkflowRuns({ workflowName, fromDate, toDate, limit, offset, resourceId, }?: {
|
|
629
|
+
workflowName?: string;
|
|
630
|
+
fromDate?: Date;
|
|
631
|
+
toDate?: Date;
|
|
632
|
+
limit?: number;
|
|
633
|
+
offset?: number;
|
|
634
|
+
resourceId?: string;
|
|
635
|
+
}): Promise<WorkflowRuns_2>;
|
|
636
|
+
}
|
|
637
|
+
|
|
332
638
|
export { }
|