@mastra/pg 1.19.0-alpha.2 → 1.19.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/CHANGELOG.md +126 -0
- package/dist/docs/SKILL.md +7 -4
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/{docs-rag-overview.md → guides-rag-overview.md} +2 -2
- package/dist/docs/references/{docs-rag-retrieval.md → guides-rag-retrieval.md} +1 -1
- package/dist/docs/references/reference-storage-composite.md +2 -0
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/datasets/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/metrics.d.ts.map +1 -1
- package/package.json +6 -6
- /package/dist/docs/references/{docs-rag-vector-databases.md → guides-rag-vector-databases.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,131 @@
|
|
|
1
1
|
# @mastra/pg
|
|
2
2
|
|
|
3
|
+
## 1.19.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added batch trace ID filtering to observability metric queries. ([#20535](https://github.com/mastra-ai/mastra/pull/20535))
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const result = await observability.getMetricBreakdown({
|
|
11
|
+
name: ['mastra_model_total_input_tokens'],
|
|
12
|
+
aggregation: 'sum',
|
|
13
|
+
groupBy: ['traceId'],
|
|
14
|
+
filters: { traceIds: ['trace-1', 'trace-2'] },
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Added persistence for dataset item undeclared tool policies. ([#19643](https://github.com/mastra-ai/mastra/pull/19643))
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
await dataset.addItem({
|
|
22
|
+
input: 'What is the weather?',
|
|
23
|
+
unmockedToolPolicy: 'deny',
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Stored workflow definitions now persist across restarts on every major database backend. ([#20471](https://github.com/mastra-ai/mastra/pull/20471))
|
|
28
|
+
|
|
29
|
+
Implement the `workflowDefinitions` storage domain for libsql, pg, mysql, mssql, mongodb, and spanner. Previously the stored-workflow persistence path (`POST /stored/workflows`, `Mastra.addStoredWorkflow`) only worked against `@mastra/core`'s in-memory store. Persistent adapters returned `undefined` from `storage.getStore('workflowDefinitions')` and threw when the HTTP handler tried to read/write a workflow.
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const workflowDefinitions = await storage.getStore('workflowDefinitions');
|
|
33
|
+
if (!workflowDefinitions) {
|
|
34
|
+
throw new Error('This storage adapter does not support the workflowDefinitions domain');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
await workflowDefinitions.upsert({
|
|
38
|
+
id: 'greeting-workflow',
|
|
39
|
+
inputSchema: { type: 'object', properties: { name: { type: 'string' } }, required: ['name'] },
|
|
40
|
+
outputSchema: { type: 'object', properties: { text: { type: 'string' } }, required: ['text'] },
|
|
41
|
+
graph: [{ type: 'agent', id: 'greet', agentId: 'greeter-agent' }],
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const { definitions, total } = await workflowDefinitions.list({ status: 'active' });
|
|
45
|
+
const definition = await workflowDefinitions.get('greeting-workflow');
|
|
46
|
+
await workflowDefinitions.delete('greeting-workflow');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Each adapter now ships a `WorkflowDefinitions*` domain that:
|
|
50
|
+
|
|
51
|
+
- Creates the shared `mastra_workflow_definitions` table (or Mongo collection) from `WORKFLOW_DEFINITIONS_SCHEMA` during `init()`, plus a default index on `status`.
|
|
52
|
+
- Implements `upsert` / `get` / `list` / `delete` matching `WorkflowDefinitionsStorage` semantics (`list` supports `status` and `authorId` filters and orders by `updatedAt` desc). Partial upserts preserve unspecified fields, including `authorId` updates and `createdAt` / `updatedAt` semantics.
|
|
53
|
+
- Handles concurrent first-writes race-safely: if two callers upsert the same new id simultaneously, the losing insert detects the duplicate key, re-reads the row, and applies the partial-update path instead of failing.
|
|
54
|
+
- Round-trips the JSON columns (`inputSchema`, `outputSchema`, `stateSchema`, `requestContextSchema`, `metadata`, `graph`) through each adapter's JSON handling, so declarative workflow graphs rehydrate identically no matter which backend they were stored in. Malformed persisted JSON surfaces as an actionable error naming the row and column instead of hydrating raw strings.
|
|
55
|
+
|
|
56
|
+
Exported class names by adapter: `WorkflowDefinitionsLibSQL`, `WorkflowDefinitionsPG`, `WorkflowDefinitionsMySQL`, `WorkflowDefinitionsMSSQL`, `MongoDBWorkflowDefinitionsStore`, `WorkflowDefinitionsSpanner`. The composite stores (`LibSQLStore`, `PostgresStore`, `MySQLStore`, `MSSQLStore`, `MongoDBStore`, `SpannerStore`) auto-wire the new domain, so callers do not need to construct it manually — `storage.getStore('workflowDefinitions')` now returns a live handle.
|
|
57
|
+
|
|
58
|
+
The pg adapter reads `createdAt` / `updatedAt` from the auto-added `createdAtZ` / `updatedAtZ` `timestamptz` companion columns to avoid the naive-timestamp / local-TZ drift that a plain `TIMESTAMP` read exhibits under node-pg.
|
|
59
|
+
|
|
60
|
+
`@mastra/clickhouse` and `@mastra/cloudflare` register the new `mastra_workflow_definitions` table in their table/type maps so shared table constants stay exhaustive (no workflow-definitions domain implementation yet).
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Added a comment column to experiment results so review comments persist. The column is added automatically and non-destructively on startup for existing databases (https://github.com/mastra-ai/mastra/issues/19857). ([#19865](https://github.com/mastra-ai/mastra/pull/19865))
|
|
65
|
+
|
|
66
|
+
- Dataset item scorer selections now persist across PostgreSQL writes and reads. Setting `scorerIds` to `null` clears an item override, while `[]` remains an explicit override with no scorers. ([#20191](https://github.com/mastra-ai/mastra/pull/20191))
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
await dataset.addItem({
|
|
70
|
+
input: 'Evaluate this response',
|
|
71
|
+
scorerIds: [],
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Improved PostgresStore startup: init now reads the schema catalog up front (3 read-only queries) instead of issuing hundreds of per-object existence checks and no-op DDL statements. On an already-migrated database this cuts init from ~350 serialized queries to 6, dropping init time on a 50ms connection from ~18.5s to ~0.5s. Fixed init failing for roles without CREATE privileges when the schema already exists, and removed a table lock that could block writers while init re-created triggers that were already in place. Fresh and partially-migrated databases are set up exactly as before. ([#20394](https://github.com/mastra-ai/mastra/pull/20394))
|
|
76
|
+
|
|
77
|
+
- Fixed nine storage adapters declaring a `@mastra/core` peer range that permitted core versions too old to load them. Each adapter imports `storageMessageMatchesMetadataFilter` from `@mastra/core/storage`, which core only exports from 1.53.0, but every one of them still advertised a floor below that — as low as `>=1.0.0-0`. Package managers accepted the incompatible pair without a warning and the install then failed at import time: ([#20591](https://github.com/mastra-ai/mastra/pull/20591))
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
SyntaxError: The requested module '@mastra/core/storage' does not provide an export named 'storageMessageMatchesMetadataFilter'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
All nine now declare `>=1.53.0-0 <2.0.0-0`, so npm and pnpm surface a peer conflict at install time instead of letting the project break on first import.
|
|
84
|
+
|
|
85
|
+
Fixes [#20586](https://github.com/mastra-ai/mastra/issues/20586).
|
|
86
|
+
|
|
87
|
+
- Updated dependencies [[`4844167`](https://github.com/mastra-ai/mastra/commit/4844167cff2d5ec5004e94edd34970833040fa3f), [`c5e56ff`](https://github.com/mastra-ai/mastra/commit/c5e56ff3bcabdf062708f2d48744fec304df6792), [`594f7b2`](https://github.com/mastra-ai/mastra/commit/594f7b28f5263fb9982fd50d95c471fb971ea984), [`7f4e26d`](https://github.com/mastra-ai/mastra/commit/7f4e26dd57bd9b23c278ea21235ab823a3810a6c), [`311f943`](https://github.com/mastra-ai/mastra/commit/311f943bee60e8fdf5c84499ea50e884276c936c), [`322daa6`](https://github.com/mastra-ai/mastra/commit/322daa6d90552909204044790d850958f6745fed), [`db4e6ff`](https://github.com/mastra-ai/mastra/commit/db4e6ff744503112eb64deeaf6c2b54bf26a54c7), [`5faf93f`](https://github.com/mastra-ai/mastra/commit/5faf93f03e19daea394b9e2a923f2e4f833407f2), [`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`cadaa13`](https://github.com/mastra-ai/mastra/commit/cadaa1372e1077c8e85eb64c5499ba8803caa323), [`0c89896`](https://github.com/mastra-ai/mastra/commit/0c8989673fb7d106837098398131e570c6023b68), [`6d19a65`](https://github.com/mastra-ai/mastra/commit/6d19a6517f5da3911023d446b7e2d5dad8adb1cb), [`23b4238`](https://github.com/mastra-ai/mastra/commit/23b423844ad0bcf2a502a68dd62866d6160f9f6d), [`80ad891`](https://github.com/mastra-ai/mastra/commit/80ad891f8cd10379aa5b5af7510c763783b2ab56), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`e320a76`](https://github.com/mastra-ai/mastra/commit/e320a763feaf65c6be3cebecf746defcbde161b3), [`03b4918`](https://github.com/mastra-ai/mastra/commit/03b4918c80d188ce375334c393e131c6e94bd7eb), [`14ef73a`](https://github.com/mastra-ai/mastra/commit/14ef73a4bbd73e7808414816eb0628ce1d80b5d7), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`06000d7`](https://github.com/mastra-ai/mastra/commit/06000d73712911572e913b8a83339270296d0a22), [`1d677d5`](https://github.com/mastra-ai/mastra/commit/1d677d5f99d7db403f7828585e8c25f299f72628), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`4e35a56`](https://github.com/mastra-ai/mastra/commit/4e35a56cdf8d74a5ff6d5eda01f2c1deaf6cc7be), [`d94b8e1`](https://github.com/mastra-ai/mastra/commit/d94b8e1cee67416d518a8c30099040061bef6a1c), [`93e28ec`](https://github.com/mastra-ai/mastra/commit/93e28ecce9031c02397e0ae8406593e5c7a95883), [`729dab4`](https://github.com/mastra-ai/mastra/commit/729dab408faccfaef0cbb048e5a4338f9172847e), [`484003d`](https://github.com/mastra-ai/mastra/commit/484003d33ff59330c86b19863e4a38732d7e4155), [`3de0188`](https://github.com/mastra-ai/mastra/commit/3de0188bfaf9a9c09c95fe322b53838cf52c70b6), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866), [`b582f7f`](https://github.com/mastra-ai/mastra/commit/b582f7fa2f9c1f87d19efc63d344fbe5dda2608c), [`933d291`](https://github.com/mastra-ai/mastra/commit/933d291146b789c19442ad206f94da3e4be90c64), [`a1cb98d`](https://github.com/mastra-ai/mastra/commit/a1cb98d11990b560b98482292a1f34aa1a2d9092), [`598ad82`](https://github.com/mastra-ai/mastra/commit/598ad82d41c41389a686338a1d0e50b7400e1938), [`1fd6aad`](https://github.com/mastra-ai/mastra/commit/1fd6aad1ea4a9d32f65efa832307c35e981a4c0a)]:
|
|
88
|
+
- @mastra/core@1.56.0
|
|
89
|
+
|
|
90
|
+
## 1.19.0-alpha.3
|
|
91
|
+
|
|
92
|
+
### Minor Changes
|
|
93
|
+
|
|
94
|
+
- Added batch trace ID filtering to observability metric queries. ([#20535](https://github.com/mastra-ai/mastra/pull/20535))
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
const result = await observability.getMetricBreakdown({
|
|
98
|
+
name: ['mastra_model_total_input_tokens'],
|
|
99
|
+
aggregation: 'sum',
|
|
100
|
+
groupBy: ['traceId'],
|
|
101
|
+
filters: { traceIds: ['trace-1', 'trace-2'] },
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- Dataset item scorer selections now persist across PostgreSQL writes and reads. Setting `scorerIds` to `null` clears an item override, while `[]` remains an explicit override with no scorers. ([#20191](https://github.com/mastra-ai/mastra/pull/20191))
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
await dataset.addItem({
|
|
111
|
+
input: 'Evaluate this response',
|
|
112
|
+
scorerIds: [],
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
- Fixed nine storage adapters declaring a `@mastra/core` peer range that permitted core versions too old to load them. Each adapter imports `storageMessageMatchesMetadataFilter` from `@mastra/core/storage`, which core only exports from 1.53.0, but every one of them still advertised a floor below that — as low as `>=1.0.0-0`. Package managers accepted the incompatible pair without a warning and the install then failed at import time: ([#20591](https://github.com/mastra-ai/mastra/pull/20591))
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
SyntaxError: The requested module '@mastra/core/storage' does not provide an export named 'storageMessageMatchesMetadataFilter'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
All nine now declare `>=1.53.0-0 <2.0.0-0`, so npm and pnpm surface a peer conflict at install time instead of letting the project break on first import.
|
|
123
|
+
|
|
124
|
+
Fixes [#20586](https://github.com/mastra-ai/mastra/issues/20586).
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [[`82201f7`](https://github.com/mastra-ai/mastra/commit/82201f75fae8e050a8de2df08b74875ee74c6b83), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`fb18da5`](https://github.com/mastra-ai/mastra/commit/fb18da56fc35689ae370621a8f10b5b0d8606e20), [`0a6598b`](https://github.com/mastra-ai/mastra/commit/0a6598bde80bde008986ad6616bed9632b9294cb), [`9e1dad8`](https://github.com/mastra-ai/mastra/commit/9e1dad8f7b1cab2bb7ade90e5b7561f24577b88a), [`2f43145`](https://github.com/mastra-ai/mastra/commit/2f4314504c03cbba280414ac81ba3197448ee6b0), [`34d34d8`](https://github.com/mastra-ai/mastra/commit/34d34d8c811df512fef4dd5459f79b7821be1866)]:
|
|
127
|
+
- @mastra/core@1.56.0-alpha.6
|
|
128
|
+
|
|
3
129
|
## 1.19.0-alpha.2
|
|
4
130
|
|
|
5
131
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-pg
|
|
|
3
3
|
description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/pg"
|
|
6
|
-
version: "1.19.0
|
|
6
|
+
version: "1.19.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -19,11 +19,14 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
19
19
|
- [Workers](references/docs-deployment-workers.md) - Separate background processing from the API layer by running workflow execution, cron schedules, and background tasks in dedicated worker processes.
|
|
20
20
|
- [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
|
|
21
21
|
- [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
|
|
22
|
-
- [RAG (Retrieval-Augmented Generation) in Mastra](references/docs-rag-overview.md) - Overview of Retrieval-Augmented Generation (RAG) in Mastra, detailing its capabilities for enhancing LLM outputs with relevant context.
|
|
23
|
-
- [Retrieval, semantic search, reranking](references/docs-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
|
|
24
|
-
- [Storing embeddings in a vector database](references/docs-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
|
|
25
22
|
- [Storage overview](references/docs-storage-overview.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
|
|
26
23
|
|
|
24
|
+
### Guides
|
|
25
|
+
|
|
26
|
+
- [RAG (Retrieval-Augmented Generation) in Mastra](references/guides-rag-overview.md) - Overview of Retrieval-Augmented Generation (RAG) in Mastra, detailing its capabilities for enhancing LLM outputs with relevant context.
|
|
27
|
+
- [Retrieval, semantic search, reranking](references/guides-rag-retrieval.md) - Guide on retrieval processes in Mastra's RAG systems, including semantic search, filtering, and re-ranking.
|
|
28
|
+
- [Storing embeddings in a vector database](references/guides-rag-vector-databases.md) - Guide on vector storage options in Mastra, including embedded and dedicated vector databases for similarity search.
|
|
29
|
+
|
|
27
30
|
### Reference
|
|
28
31
|
|
|
29
32
|
- [Reference: Memory class](references/reference-memory-memory-class.md) - Documentation for the `Memory` class in Mastra, which provides a reliable system for managing conversation history and thread-based message storage.
|
|
@@ -63,11 +63,11 @@ This example shows the essentials. Initialize a document and create chunks, then
|
|
|
63
63
|
|
|
64
64
|
## Document processing
|
|
65
65
|
|
|
66
|
-
The basic building block of RAG is document processing. Documents can be chunked using strategies (recursive, sliding window, etc.) and enriched with metadata. See the [chunking and embedding doc](https://mastra.ai/
|
|
66
|
+
The basic building block of RAG is document processing. Documents can be chunked using strategies (recursive, sliding window, etc.) and enriched with metadata. See the [chunking and embedding doc](https://mastra.ai/guides/rag/chunking-and-embedding).
|
|
67
67
|
|
|
68
68
|
## Vector storage
|
|
69
69
|
|
|
70
|
-
Mastra supports multiple vector stores for embedding persistence and similarity search, including pgvector, Pinecone, Qdrant, and MongoDB. See the [vector database doc](https://mastra.ai/
|
|
70
|
+
Mastra supports multiple vector stores for embedding persistence and similarity search, including pgvector, Pinecone, Qdrant, and MongoDB. See the [vector database doc](https://mastra.ai/guides/rag/vector-databases).
|
|
71
71
|
|
|
72
72
|
## More resources
|
|
73
73
|
|
|
@@ -517,4 +517,4 @@ The re-ranked results combine vector similarity with semantic understanding to i
|
|
|
517
517
|
|
|
518
518
|
For more details about re-ranking, see the [rerank()](https://mastra.ai/reference/rag/rerankWithScorer) method.
|
|
519
519
|
|
|
520
|
-
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/
|
|
520
|
+
For graph-based retrieval that follows connections between chunks, see the [GraphRAG](https://mastra.ai/guides/rag/graph-rag) documentation.
|
|
@@ -188,6 +188,8 @@ export const mastra = new Mastra({
|
|
|
188
188
|
|
|
189
189
|
**default** (`MastraCompositeStore`): Default storage adapter. Domains not explicitly specified in domains will use this storage's domains as fallbacks.
|
|
190
190
|
|
|
191
|
+
**editor** (`MastraCompositeStore`): Storage adapter for Editor-owned domains, including agents, prompt blocks, scorers, MCP clients and servers, workspaces, and skills. Takes precedence over default storage but not explicit domain overrides.
|
|
192
|
+
|
|
191
193
|
**disableInit** (`boolean`): When true, automatic initialization is disabled. You must call init() explicitly.
|
|
192
194
|
|
|
193
195
|
**domains** (`object`): Individual domain overrides. Each domain can come from a different storage adapter. These take precedence over both editor and default storage. Set a domain to false to disable it entirely; a disabled domain does not fall back to editor or default.
|
package/dist/index.cjs
CHANGED
|
@@ -5299,6 +5299,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5299
5299
|
await this.#addColumnIfNotExists(_mastra_core_storage.TABLE_DATASET_ITEMS, "projectId", "TEXT");
|
|
5300
5300
|
await this.#addColumnIfNotExists(_mastra_core_storage.TABLE_DATASET_ITEMS, "toolMocks", "JSONB");
|
|
5301
5301
|
await this.#addColumnIfNotExists(_mastra_core_storage.TABLE_DATASET_ITEMS, "unmockedToolPolicy", "TEXT");
|
|
5302
|
+
await this.#addColumnIfNotExists(_mastra_core_storage.TABLE_DATASET_ITEMS, "scorerIds", "JSONB");
|
|
5302
5303
|
await this.#addColumnIfNotExists(_mastra_core_storage.TABLE_DATASET_ITEMS, "externalId", "TEXT");
|
|
5303
5304
|
await this.createDefaultIndexes();
|
|
5304
5305
|
await this.createCustomIndexes();
|
|
@@ -5422,6 +5423,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5422
5423
|
expectedTrajectory: row.expectedTrajectory ? (0, _mastra_core_storage.safelyParseJSON)(row.expectedTrajectory) : void 0,
|
|
5423
5424
|
toolMocks: row.toolMocks ? (0, _mastra_core_storage.safelyParseJSON)(row.toolMocks) : void 0,
|
|
5424
5425
|
unmockedToolPolicy: row.unmockedToolPolicy ?? void 0,
|
|
5426
|
+
scorerIds: row.scorerIds ? (0, _mastra_core_storage.safelyParseJSON)(row.scorerIds) : void 0,
|
|
5425
5427
|
requestContext: row.requestContext ? (0, _mastra_core_storage.safelyParseJSON)(row.requestContext) : void 0,
|
|
5426
5428
|
metadata: row.metadata ? (0, _mastra_core_storage.safelyParseJSON)(row.metadata) : void 0,
|
|
5427
5429
|
source: row.source ? (0, _mastra_core_storage.safelyParseJSON)(row.source) : void 0,
|
|
@@ -5444,6 +5446,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5444
5446
|
expectedTrajectory: row.expectedTrajectory ? (0, _mastra_core_storage.safelyParseJSON)(row.expectedTrajectory) : void 0,
|
|
5445
5447
|
toolMocks: row.toolMocks ? (0, _mastra_core_storage.safelyParseJSON)(row.toolMocks) : void 0,
|
|
5446
5448
|
unmockedToolPolicy: row.unmockedToolPolicy ?? void 0,
|
|
5449
|
+
scorerIds: row.scorerIds ? (0, _mastra_core_storage.safelyParseJSON)(row.scorerIds) : void 0,
|
|
5447
5450
|
requestContext: row.requestContext ? (0, _mastra_core_storage.safelyParseJSON)(row.requestContext) : void 0,
|
|
5448
5451
|
metadata: row.metadata ? (0, _mastra_core_storage.safelyParseJSON)(row.metadata) : void 0,
|
|
5449
5452
|
source: row.source ? (0, _mastra_core_storage.safelyParseJSON)(row.source) : void 0,
|
|
@@ -5775,7 +5778,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5775
5778
|
newVersion = row.version;
|
|
5776
5779
|
parentOrganizationId = row.organizationId ?? null;
|
|
5777
5780
|
parentProjectId = row.projectId ?? null;
|
|
5778
|
-
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)`, [
|
|
5781
|
+
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","scorerIds","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)`, [
|
|
5779
5782
|
id,
|
|
5780
5783
|
args.datasetId,
|
|
5781
5784
|
newVersion,
|
|
@@ -5787,6 +5790,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5787
5790
|
jsonbArg(args.expectedTrajectory),
|
|
5788
5791
|
jsonbArg(args.toolMocks),
|
|
5789
5792
|
args.unmockedToolPolicy ?? null,
|
|
5793
|
+
jsonbArg(args.scorerIds),
|
|
5790
5794
|
jsonbArg(args.requestContext),
|
|
5791
5795
|
jsonbArg(args.metadata),
|
|
5792
5796
|
jsonbArg(args.source),
|
|
@@ -5814,6 +5818,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5814
5818
|
expectedTrajectory: args.expectedTrajectory,
|
|
5815
5819
|
toolMocks: args.toolMocks,
|
|
5816
5820
|
unmockedToolPolicy: args.unmockedToolPolicy,
|
|
5821
|
+
scorerIds: args.scorerIds,
|
|
5817
5822
|
requestContext: args.requestContext,
|
|
5818
5823
|
metadata: args.metadata,
|
|
5819
5824
|
source: args.source,
|
|
@@ -5868,6 +5873,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5868
5873
|
const mergedExpectedTrajectory = args.expectedTrajectory !== void 0 ? args.expectedTrajectory : existing.expectedTrajectory;
|
|
5869
5874
|
const mergedToolMocks = args.toolMocks !== void 0 ? args.toolMocks : existing.toolMocks;
|
|
5870
5875
|
const mergedUnmockedToolPolicy = args.unmockedToolPolicy !== void 0 ? args.unmockedToolPolicy : existing.unmockedToolPolicy;
|
|
5876
|
+
const mergedScorerIds = args.scorerIds !== void 0 ? args.scorerIds ?? void 0 : existing.scorerIds;
|
|
5871
5877
|
const mergedRequestContext = args.requestContext !== void 0 ? args.requestContext : existing.requestContext;
|
|
5872
5878
|
const mergedMetadata = args.metadata !== void 0 ? args.metadata : existing.metadata;
|
|
5873
5879
|
const mergedSource = args.source !== void 0 ? args.source : existing.source;
|
|
@@ -5880,7 +5886,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5880
5886
|
parentOrganizationId = row.organizationId ?? null;
|
|
5881
5887
|
parentProjectId = row.projectId ?? null;
|
|
5882
5888
|
await t.none(`UPDATE ${itemsTable} SET "validTo" = $1 WHERE "id" = $2 AND "validTo" IS NULL AND "isDeleted" = false`, [newVersion, args.id]);
|
|
5883
|
-
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)`, [
|
|
5889
|
+
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","scorerIds","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)`, [
|
|
5884
5890
|
args.id,
|
|
5885
5891
|
args.datasetId,
|
|
5886
5892
|
newVersion,
|
|
@@ -5892,6 +5898,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5892
5898
|
jsonbArg(mergedExpectedTrajectory),
|
|
5893
5899
|
jsonbArg(mergedToolMocks),
|
|
5894
5900
|
mergedUnmockedToolPolicy ?? null,
|
|
5901
|
+
jsonbArg(mergedScorerIds),
|
|
5895
5902
|
jsonbArg(mergedRequestContext),
|
|
5896
5903
|
jsonbArg(mergedMetadata),
|
|
5897
5904
|
jsonbArg(mergedSource),
|
|
@@ -5918,6 +5925,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5918
5925
|
expectedTrajectory: mergedExpectedTrajectory,
|
|
5919
5926
|
toolMocks: mergedToolMocks,
|
|
5920
5927
|
unmockedToolPolicy: mergedUnmockedToolPolicy,
|
|
5928
|
+
scorerIds: mergedScorerIds,
|
|
5921
5929
|
requestContext: mergedRequestContext,
|
|
5922
5930
|
metadata: mergedMetadata,
|
|
5923
5931
|
source: mergedSource,
|
|
@@ -5966,7 +5974,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5966
5974
|
const parentOrganizationId = row.organizationId ?? null;
|
|
5967
5975
|
const parentProjectId = row.projectId ?? null;
|
|
5968
5976
|
await t.none(`UPDATE ${itemsTable} SET "validTo" = $1 WHERE "id" = $2 AND "validTo" IS NULL AND "isDeleted" = false`, [newVersion, id]);
|
|
5969
|
-
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,true,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)`, [
|
|
5977
|
+
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","scorerIds","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,true,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)`, [
|
|
5970
5978
|
id,
|
|
5971
5979
|
datasetId,
|
|
5972
5980
|
newVersion,
|
|
@@ -5978,6 +5986,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
5978
5986
|
jsonbArg(existing.expectedTrajectory),
|
|
5979
5987
|
jsonbArg(existing.toolMocks),
|
|
5980
5988
|
existing.unmockedToolPolicy ?? null,
|
|
5989
|
+
jsonbArg(existing.scorerIds),
|
|
5981
5990
|
jsonbArg(existing.requestContext),
|
|
5982
5991
|
jsonbArg(existing.metadata),
|
|
5983
5992
|
jsonbArg(existing.source),
|
|
@@ -6037,7 +6046,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
6037
6046
|
const nowIso = now.toISOString();
|
|
6038
6047
|
await t.none(`UPDATE ${datasetsTable} SET "version" = $2 WHERE "id" = $1`, [input.datasetId, newVersion]);
|
|
6039
6048
|
for (const { id, item } of plan.inserts) {
|
|
6040
|
-
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)`, [
|
|
6049
|
+
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","scorerIds","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,false,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)`, [
|
|
6041
6050
|
id,
|
|
6042
6051
|
input.datasetId,
|
|
6043
6052
|
newVersion,
|
|
@@ -6049,6 +6058,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
6049
6058
|
jsonbArg(item.expectedTrajectory),
|
|
6050
6059
|
jsonbArg(item.toolMocks),
|
|
6051
6060
|
item.unmockedToolPolicy ?? null,
|
|
6061
|
+
jsonbArg(item.scorerIds),
|
|
6052
6062
|
jsonbArg(item.requestContext),
|
|
6053
6063
|
jsonbArg(item.metadata),
|
|
6054
6064
|
jsonbArg(item.source),
|
|
@@ -6069,6 +6079,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
6069
6079
|
expectedTrajectory: item.expectedTrajectory,
|
|
6070
6080
|
toolMocks: item.toolMocks,
|
|
6071
6081
|
unmockedToolPolicy: item.unmockedToolPolicy,
|
|
6082
|
+
scorerIds: item.scorerIds,
|
|
6072
6083
|
requestContext: item.requestContext,
|
|
6073
6084
|
metadata: item.metadata,
|
|
6074
6085
|
source: item.source,
|
|
@@ -6131,7 +6142,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
6131
6142
|
const newVersion = (await t.one(`UPDATE ${datasetsTable} SET "version" = "version" + 1 WHERE "id" = $1 RETURNING "version"`, [input.datasetId])).version;
|
|
6132
6143
|
for (const item of currentItems) {
|
|
6133
6144
|
await t.none(`UPDATE ${itemsTable} SET "validTo" = $1 WHERE "id" = $2 AND "validTo" IS NULL AND "isDeleted" = false`, [newVersion, item.id]);
|
|
6134
|
-
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,true,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18)`, [
|
|
6145
|
+
await t.none(`INSERT INTO ${itemsTable} ("id","datasetId","datasetVersion","externalId","organizationId","projectId","validTo","isDeleted","input","groundTruth","expectedTrajectory","toolMocks","unmockedToolPolicy","scorerIds","requestContext","metadata","source","createdAt","createdAtZ","updatedAt","updatedAtZ") VALUES ($1,$2,$3,$4,$5,$6,NULL,true,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)`, [
|
|
6135
6146
|
item.id,
|
|
6136
6147
|
input.datasetId,
|
|
6137
6148
|
newVersion,
|
|
@@ -6143,6 +6154,7 @@ var DatasetsPG = class DatasetsPG extends _mastra_core_storage.DatasetsStorage {
|
|
|
6143
6154
|
jsonbArg(item.expectedTrajectory),
|
|
6144
6155
|
jsonbArg(item.toolMocks),
|
|
6145
6156
|
item.unmockedToolPolicy ?? null,
|
|
6157
|
+
jsonbArg(item.scorerIds),
|
|
6146
6158
|
jsonbArg(item.requestContext),
|
|
6147
6159
|
jsonbArg(item.metadata),
|
|
6148
6160
|
jsonbArg(item.source),
|
|
@@ -14252,6 +14264,7 @@ async function listLogsDelta(client, table, filters, after, limit) {
|
|
|
14252
14264
|
*/
|
|
14253
14265
|
function applyMetricFilters(acc, filters) {
|
|
14254
14266
|
applyCommonFilters(acc, filters);
|
|
14267
|
+
applySingleOrArrayFilter(acc, "traceId", filters?.traceIds);
|
|
14255
14268
|
applySingleOrArrayFilter(acc, "name", filters?.name);
|
|
14256
14269
|
applySingleOrArrayFilter(acc, "provider", filters?.provider);
|
|
14257
14270
|
applySingleOrArrayFilter(acc, "model", filters?.model);
|