@mastra/pg 1.0.0-beta.7 → 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 +278 -0
- package/dist/index.cjs +2465 -2217
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2466 -2218
- package/dist/index.js.map +1 -1
- package/dist/shared/config.d.ts +77 -2
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/storage/{domains/operations → db}/index.d.ts +77 -45
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +22 -8
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +30 -11
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts +29 -36
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts +25 -28
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/storage/domains/utils.d.ts +1 -5
- package/dist/storage/domains/utils.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +26 -19
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +23 -199
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/performance-indexes/performance-test.d.ts +3 -1
- package/dist/storage/performance-indexes/performance-test.d.ts.map +1 -1
- package/dist/storage/test-utils.d.ts.map +1 -1
- package/package.json +2 -3
- package/dist/storage/domains/operations/index.d.ts.map +0 -1
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { WorkflowsStorage } from '@mastra/core/storage';
|
|
2
|
-
import type { StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns } from '@mastra/core/storage';
|
|
2
|
+
import type { UpdateWorkflowStateOptions, StorageListWorkflowRunsInput, WorkflowRun, WorkflowRuns, CreateIndexOptions } from '@mastra/core/storage';
|
|
3
3
|
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
4
|
-
import type {
|
|
5
|
-
import type { StoreOperationsPG } from '../operations/index.js';
|
|
4
|
+
import type { PgDomainConfig } from '../../db/index.js';
|
|
6
5
|
export declare class WorkflowsPG extends WorkflowsStorage {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
#private;
|
|
7
|
+
/** Tables managed by this domain */
|
|
8
|
+
static readonly MANAGED_TABLES: readonly ["mastra_workflow_snapshot"];
|
|
9
|
+
constructor(config: PgDomainConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Returns default index definitions for the workflows domain tables.
|
|
12
|
+
* Currently no default indexes are defined for workflows.
|
|
13
|
+
*/
|
|
14
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
15
|
+
/**
|
|
16
|
+
* Creates default indexes for optimal query performance.
|
|
17
|
+
* Currently no default indexes are defined for workflows.
|
|
18
|
+
*/
|
|
19
|
+
createDefaultIndexes(): Promise<void>;
|
|
20
|
+
init(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates custom user-defined indexes for this domain's tables.
|
|
23
|
+
*/
|
|
24
|
+
createCustomIndexes(): Promise<void>;
|
|
25
|
+
dangerouslyClearAll(): Promise<void>;
|
|
15
26
|
updateWorkflowResults({}: {
|
|
16
27
|
workflowName: string;
|
|
17
28
|
runId: string;
|
|
@@ -22,19 +33,15 @@ export declare class WorkflowsPG extends WorkflowsStorage {
|
|
|
22
33
|
updateWorkflowState({}: {
|
|
23
34
|
workflowName: string;
|
|
24
35
|
runId: string;
|
|
25
|
-
opts:
|
|
26
|
-
status: string;
|
|
27
|
-
result?: StepResult<any, any, any, any>;
|
|
28
|
-
error?: string;
|
|
29
|
-
suspendedPaths?: Record<string, number[]>;
|
|
30
|
-
waitingPaths?: Record<string, number[]>;
|
|
31
|
-
};
|
|
36
|
+
opts: UpdateWorkflowStateOptions;
|
|
32
37
|
}): Promise<WorkflowRunState | undefined>;
|
|
33
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
38
|
+
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, createdAt, updatedAt, }: {
|
|
34
39
|
workflowName: string;
|
|
35
40
|
runId: string;
|
|
36
41
|
resourceId?: string;
|
|
37
42
|
snapshot: WorkflowRunState;
|
|
43
|
+
createdAt?: Date;
|
|
44
|
+
updatedAt?: Date;
|
|
38
45
|
}): Promise<void>;
|
|
39
46
|
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
40
47
|
workflowName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/workflows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,gBAAgB,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,WAAW,EACX,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA8B/C,qBAAa,WAAY,SAAQ,gBAAgB;;IAM/C,oCAAoC;IACpC,MAAM,CAAC,QAAQ,CAAC,cAAc,wCAAsC;gBAExD,MAAM,EAAE,cAAc;IAUlC;;;OAGG;IACH,0BAA0B,IAAI,kBAAkB,EAAE;IAIlD;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAOrC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;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GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAmDzB,qBAAqB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBtG,gBAAgB,CAAC,EACrB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,MAAM,GACP,GAAE,4BAAiC,GAAG,OAAO,CAAC,YAAY,CAAC;CAqF7D"}
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import type { MastraMessageContentV2, MastraDBMessage } from '@mastra/core/agent';
|
|
2
|
-
import type { SaveScorePayload, ScoreRowData, ScoringSource } from '@mastra/core/evals';
|
|
3
|
-
import type { StorageThreadType } from '@mastra/core/memory';
|
|
4
1
|
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import type { StepResult, WorkflowRunState } from '@mastra/core/workflows';
|
|
2
|
+
import type { StorageDomains, StorageSupports } from '@mastra/core/storage';
|
|
7
3
|
import pgPromise from 'pg-promise';
|
|
8
4
|
import type { PostgresStoreConfig } from '../shared/config.js';
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* PostgreSQL storage adapter for Mastra.
|
|
7
|
+
*
|
|
8
|
+
* Access domain-specific storage via `getStore()`:
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const storage = new PostgresStore({ connectionString: '...' });
|
|
13
|
+
*
|
|
14
|
+
* // Access memory domain
|
|
15
|
+
* const memory = await storage.getStore('memory');
|
|
16
|
+
* await memory?.saveThread({ thread });
|
|
17
|
+
*
|
|
18
|
+
* // Access workflows domain
|
|
19
|
+
* const workflows = await storage.getStore('workflows');
|
|
20
|
+
* await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
10
23
|
export declare class PostgresStore extends MastraStorage {
|
|
11
24
|
#private;
|
|
12
25
|
private schema;
|
|
@@ -16,201 +29,12 @@ export declare class PostgresStore extends MastraStorage {
|
|
|
16
29
|
init(): Promise<void>;
|
|
17
30
|
get db(): pgPromise.IDatabase<{}, import("pg-promise/typescript/pg-subset").IClient>;
|
|
18
31
|
get pgp(): pgPromise.IMain<{}, import("pg-promise/typescript/pg-subset").IClient>;
|
|
19
|
-
get supports():
|
|
20
|
-
selectByIncludeResourceScope: boolean;
|
|
21
|
-
resourceWorkingMemory: boolean;
|
|
22
|
-
hasColumn: boolean;
|
|
23
|
-
createTable: boolean;
|
|
24
|
-
deleteMessages: boolean;
|
|
25
|
-
observabilityInstance: boolean;
|
|
26
|
-
indexManagement: boolean;
|
|
27
|
-
listScoresBySpan: boolean;
|
|
28
|
-
agents: boolean;
|
|
29
|
-
};
|
|
30
|
-
createTable({ tableName, schema, }: {
|
|
31
|
-
tableName: TABLE_NAMES;
|
|
32
|
-
schema: Record<string, StorageColumn>;
|
|
33
|
-
}): Promise<void>;
|
|
34
|
-
alterTable({ tableName, schema, ifNotExists, }: {
|
|
35
|
-
tableName: TABLE_NAMES;
|
|
36
|
-
schema: Record<string, StorageColumn>;
|
|
37
|
-
ifNotExists: string[];
|
|
38
|
-
}): Promise<void>;
|
|
39
|
-
clearTable({ tableName }: {
|
|
40
|
-
tableName: TABLE_NAMES;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
dropTable({ tableName }: {
|
|
43
|
-
tableName: TABLE_NAMES;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
insert({ tableName, record }: {
|
|
46
|
-
tableName: TABLE_NAMES;
|
|
47
|
-
record: Record<string, any>;
|
|
48
|
-
}): Promise<void>;
|
|
49
|
-
batchInsert({ tableName, records }: {
|
|
50
|
-
tableName: TABLE_NAMES;
|
|
51
|
-
records: Record<string, any>[];
|
|
52
|
-
}): Promise<void>;
|
|
53
|
-
load<R>({ tableName, keys }: {
|
|
54
|
-
tableName: TABLE_NAMES;
|
|
55
|
-
keys: Record<string, string>;
|
|
56
|
-
}): Promise<R | null>;
|
|
32
|
+
get supports(): StorageSupports;
|
|
57
33
|
/**
|
|
58
|
-
*
|
|
34
|
+
* Closes the pg-promise connection pool.
|
|
35
|
+
*
|
|
36
|
+
* This will close ALL connections in the pool, including pre-configured clients.
|
|
59
37
|
*/
|
|
60
|
-
getThreadById({ threadId }: {
|
|
61
|
-
threadId: string;
|
|
62
|
-
}): Promise<StorageThreadType | null>;
|
|
63
|
-
saveThread({ thread }: {
|
|
64
|
-
thread: StorageThreadType;
|
|
65
|
-
}): Promise<StorageThreadType>;
|
|
66
|
-
updateThread({ id, title, metadata, }: {
|
|
67
|
-
id: string;
|
|
68
|
-
title: string;
|
|
69
|
-
metadata: Record<string, unknown>;
|
|
70
|
-
}): Promise<StorageThreadType>;
|
|
71
|
-
deleteThread({ threadId }: {
|
|
72
|
-
threadId: string;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
listMessagesById({ messageIds }: {
|
|
75
|
-
messageIds: string[];
|
|
76
|
-
}): Promise<{
|
|
77
|
-
messages: MastraDBMessage[];
|
|
78
|
-
}>;
|
|
79
|
-
saveMessages(args: {
|
|
80
|
-
messages: MastraDBMessage[];
|
|
81
|
-
}): Promise<{
|
|
82
|
-
messages: MastraDBMessage[];
|
|
83
|
-
}>;
|
|
84
|
-
updateMessages({ messages, }: {
|
|
85
|
-
messages: (Partial<Omit<MastraDBMessage, 'createdAt'>> & {
|
|
86
|
-
id: string;
|
|
87
|
-
content?: {
|
|
88
|
-
metadata?: MastraMessageContentV2['metadata'];
|
|
89
|
-
content?: MastraMessageContentV2['content'];
|
|
90
|
-
};
|
|
91
|
-
})[];
|
|
92
|
-
}): Promise<MastraDBMessage[]>;
|
|
93
|
-
deleteMessages(messageIds: string[]): Promise<void>;
|
|
94
|
-
getResourceById({ resourceId }: {
|
|
95
|
-
resourceId: string;
|
|
96
|
-
}): Promise<StorageResourceType | null>;
|
|
97
|
-
saveResource({ resource }: {
|
|
98
|
-
resource: StorageResourceType;
|
|
99
|
-
}): Promise<StorageResourceType>;
|
|
100
|
-
updateResource({ resourceId, workingMemory, metadata, }: {
|
|
101
|
-
resourceId: string;
|
|
102
|
-
workingMemory?: string;
|
|
103
|
-
metadata?: Record<string, unknown>;
|
|
104
|
-
}): Promise<StorageResourceType>;
|
|
105
|
-
/**
|
|
106
|
-
* Workflows
|
|
107
|
-
*/
|
|
108
|
-
updateWorkflowResults({ workflowName, runId, stepId, result, requestContext, }: {
|
|
109
|
-
workflowName: string;
|
|
110
|
-
runId: string;
|
|
111
|
-
stepId: string;
|
|
112
|
-
result: StepResult<any, any, any, any>;
|
|
113
|
-
requestContext: Record<string, any>;
|
|
114
|
-
}): Promise<Record<string, StepResult<any, any, any, any>>>;
|
|
115
|
-
updateWorkflowState({ workflowName, runId, opts, }: {
|
|
116
|
-
workflowName: string;
|
|
117
|
-
runId: string;
|
|
118
|
-
opts: {
|
|
119
|
-
status: string;
|
|
120
|
-
result?: StepResult<any, any, any, any>;
|
|
121
|
-
error?: string;
|
|
122
|
-
suspendedPaths?: Record<string, number[]>;
|
|
123
|
-
waitingPaths?: Record<string, number[]>;
|
|
124
|
-
};
|
|
125
|
-
}): Promise<WorkflowRunState | undefined>;
|
|
126
|
-
persistWorkflowSnapshot({ workflowName, runId, resourceId, snapshot, }: {
|
|
127
|
-
workflowName: string;
|
|
128
|
-
runId: string;
|
|
129
|
-
resourceId?: string;
|
|
130
|
-
snapshot: WorkflowRunState;
|
|
131
|
-
}): Promise<void>;
|
|
132
|
-
loadWorkflowSnapshot({ workflowName, runId, }: {
|
|
133
|
-
workflowName: string;
|
|
134
|
-
runId: string;
|
|
135
|
-
}): Promise<WorkflowRunState | null>;
|
|
136
|
-
listWorkflowRuns(args?: StorageListWorkflowRunsInput): Promise<WorkflowRuns>;
|
|
137
|
-
getWorkflowRunById({ runId, workflowName, }: {
|
|
138
|
-
runId: string;
|
|
139
|
-
workflowName?: string;
|
|
140
|
-
}): Promise<WorkflowRun | null>;
|
|
141
|
-
deleteWorkflowRunById({ runId, workflowName }: {
|
|
142
|
-
runId: string;
|
|
143
|
-
workflowName: string;
|
|
144
|
-
}): Promise<void>;
|
|
145
38
|
close(): Promise<void>;
|
|
146
|
-
/**
|
|
147
|
-
* Tracing / Observability
|
|
148
|
-
*/
|
|
149
|
-
createSpan(span: SpanRecord): Promise<void>;
|
|
150
|
-
updateSpan({ spanId, traceId, updates, }: {
|
|
151
|
-
spanId: string;
|
|
152
|
-
traceId: string;
|
|
153
|
-
updates: Partial<Omit<SpanRecord, 'spanId' | 'traceId'>>;
|
|
154
|
-
}): Promise<void>;
|
|
155
|
-
getTrace(traceId: string): Promise<TraceRecord | null>;
|
|
156
|
-
getTracesPaginated(args: TracesPaginatedArg): Promise<{
|
|
157
|
-
pagination: PaginationInfo;
|
|
158
|
-
spans: SpanRecord[];
|
|
159
|
-
}>;
|
|
160
|
-
batchCreateSpans(args: {
|
|
161
|
-
records: SpanRecord[];
|
|
162
|
-
}): Promise<void>;
|
|
163
|
-
batchUpdateSpans(args: {
|
|
164
|
-
records: {
|
|
165
|
-
traceId: string;
|
|
166
|
-
spanId: string;
|
|
167
|
-
updates: Partial<Omit<SpanRecord, 'spanId' | 'traceId'>>;
|
|
168
|
-
}[];
|
|
169
|
-
}): Promise<void>;
|
|
170
|
-
batchDeleteTraces(args: {
|
|
171
|
-
traceIds: string[];
|
|
172
|
-
}): Promise<void>;
|
|
173
|
-
/**
|
|
174
|
-
* Scorers
|
|
175
|
-
*/
|
|
176
|
-
getScoreById({ id }: {
|
|
177
|
-
id: string;
|
|
178
|
-
}): Promise<ScoreRowData | null>;
|
|
179
|
-
listScoresByScorerId({ scorerId, pagination, entityId, entityType, source, }: {
|
|
180
|
-
scorerId: string;
|
|
181
|
-
pagination: StoragePagination;
|
|
182
|
-
entityId?: string;
|
|
183
|
-
entityType?: string;
|
|
184
|
-
source?: ScoringSource;
|
|
185
|
-
}): Promise<{
|
|
186
|
-
pagination: PaginationInfo;
|
|
187
|
-
scores: ScoreRowData[];
|
|
188
|
-
}>;
|
|
189
|
-
saveScore(score: SaveScorePayload): Promise<{
|
|
190
|
-
score: ScoreRowData;
|
|
191
|
-
}>;
|
|
192
|
-
listScoresByRunId({ runId, pagination, }: {
|
|
193
|
-
runId: string;
|
|
194
|
-
pagination: StoragePagination;
|
|
195
|
-
}): Promise<{
|
|
196
|
-
pagination: PaginationInfo;
|
|
197
|
-
scores: ScoreRowData[];
|
|
198
|
-
}>;
|
|
199
|
-
listScoresByEntityId({ entityId, entityType, pagination, }: {
|
|
200
|
-
pagination: StoragePagination;
|
|
201
|
-
entityId: string;
|
|
202
|
-
entityType: string;
|
|
203
|
-
}): Promise<{
|
|
204
|
-
pagination: PaginationInfo;
|
|
205
|
-
scores: ScoreRowData[];
|
|
206
|
-
}>;
|
|
207
|
-
listScoresBySpan({ traceId, spanId, pagination, }: {
|
|
208
|
-
traceId: string;
|
|
209
|
-
spanId: string;
|
|
210
|
-
pagination: StoragePagination;
|
|
211
|
-
}): Promise<{
|
|
212
|
-
pagination: PaginationInfo;
|
|
213
|
-
scores: ScoreRowData[];
|
|
214
|
-
}>;
|
|
215
39
|
}
|
|
216
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,SAAS,MAAM,YAAY,CAAC;AAQnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAQ5D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,aAAa;;IAG9C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAkB;IAEvC,MAAM,EAAE,cAAc,CAAC;gBAEX,MAAM,EAAE,mBAAmB;IAyFjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAuB3B,IAAW,EAAE,+EAEZ;IAED,IAAW,GAAG,2EAEb;IAED,IAAW,QAAQ,IAAI,eAAe,CAYrC;IAED;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
|
@@ -26,13 +26,15 @@ interface PerformanceComparison {
|
|
|
26
26
|
}
|
|
27
27
|
export declare class PostgresPerformanceTest {
|
|
28
28
|
private store;
|
|
29
|
+
private memory;
|
|
30
|
+
private dbOps;
|
|
29
31
|
private config;
|
|
30
32
|
constructor(config: PerformanceTestConfig);
|
|
31
33
|
init(): Promise<void>;
|
|
32
34
|
cleanup(): Promise<void>;
|
|
33
35
|
resetDatabase(): Promise<void>;
|
|
34
36
|
dropPerformanceIndexes(): Promise<void>;
|
|
35
|
-
|
|
37
|
+
createDefaultIndexes(): Promise<void>;
|
|
36
38
|
seedTestData(): Promise<void>;
|
|
37
39
|
measureOperation(name: string, operation: () => Promise<any>, scenario: 'without_indexes' | 'with_indexes'): Promise<PerformanceResult>;
|
|
38
40
|
runPerformanceTests(scenario: 'without_indexes' | 'with_indexes'): Promise<PerformanceResult[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"performance-test.d.ts","sourceRoot":"","sources":["../../../src/storage/performance-indexes/performance-test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"performance-test.d.ts","sourceRoot":"","sources":["../../../src/storage/performance-indexes/performance-test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,UAAU,qBAAqB;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACz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;IAoCrD,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IA+B5C,eAAe,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAI;IAwB3D,YAAY,CAAC,OAAO,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAiB1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAkBpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/storage/test-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,eAAO,MAAM,WAAW,EAAE,mBAOF,CAAC;AAEzB,eAAO,MAAM,gBAAgB,QAA0K,CAAC;AAExM,wBAAgB,OAAO,SA+qBtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/pg",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"description": "Postgres provider for Mastra - includes both vector and db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"xxhash-wasm": "^1.1.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@microsoft/api-extractor": "^7.52.8",
|
|
30
29
|
"@types/node": "22.13.17",
|
|
31
30
|
"@types/pg": "^8.15.6",
|
|
32
31
|
"@vitest/coverage-v8": "4.0.12",
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"@internal/lint": "0.0.53",
|
|
39
38
|
"@internal/storage-test-utils": "0.0.49",
|
|
40
39
|
"@internal/types-builder": "0.0.28",
|
|
41
|
-
"@mastra/core": "1.0.0-beta.
|
|
40
|
+
"@mastra/core": "1.0.0-beta.15"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/operations/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,EAQhB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AAEjE,qBAAa,iBAAkB,SAAQ,eAAe;IAC7C,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,CAAC,kBAAkB,CAA8B;IACxD,OAAO,CAAC,mBAAmB,CAAkC;gBAEjD,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAM5E,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYhE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;;OAGG;IACH,OAAO,CAAC,YAAY;YA2BN,WAAW;IAmDnB,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MA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