@mastra/pg 1.8.4-alpha.2 → 1.8.4

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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 1.8.4
4
+
5
+ ### Patch Changes
6
+
7
+ - The internal architecture of observational memory has been refactored. The public API and behavior remain unchanged. ([#14453](https://github.com/mastra-ai/mastra/pull/14453))
8
+
9
+ - Add `getReviewSummary()` to experiments storage for aggregating review status counts ([#14649](https://github.com/mastra-ai/mastra/pull/14649))
10
+
11
+ Query experiment results grouped by experiment ID, returning counts of `needs-review`, `reviewed`, and `complete` items in a single query instead of fetching all results client-side.
12
+
13
+ ```ts
14
+ const summary = await storage.experiments.getReviewSummary();
15
+ // [{ experimentId: 'exp-1', needsReview: 3, reviewed: 5, complete: 2, total: 10 }, ...]
16
+ ```
17
+
18
+ - Added `scorerIds` persistence for datasets. The `scorerIds` field is now stored and retrieved correctly when creating or updating datasets. ([#14783](https://github.com/mastra-ai/mastra/pull/14783))
19
+
20
+ - Updated dependencies [[`dc514a8`](https://github.com/mastra-ai/mastra/commit/dc514a83dba5f719172dddfd2c7b858e4943d067), [`e333b77`](https://github.com/mastra-ai/mastra/commit/e333b77e2d76ba57ccec1818e08cebc1993469ff), [`dc9fc19`](https://github.com/mastra-ai/mastra/commit/dc9fc19da4437f6b508cc355f346a8856746a76b), [`60a224d`](https://github.com/mastra-ai/mastra/commit/60a224dd497240e83698cfa5bfd02e3d1d854844), [`fbf22a7`](https://github.com/mastra-ai/mastra/commit/fbf22a7ad86bcb50dcf30459f0d075e51ddeb468), [`f16d92c`](https://github.com/mastra-ai/mastra/commit/f16d92c677a119a135cebcf7e2b9f51ada7a9df4), [`949b7bf`](https://github.com/mastra-ai/mastra/commit/949b7bfd4e40f2b2cba7fef5eb3f108a02cfe938), [`404fea1`](https://github.com/mastra-ai/mastra/commit/404fea13042181f0b0c73a101392ac87c79ceae2), [`ebf5047`](https://github.com/mastra-ai/mastra/commit/ebf5047e825c38a1a356f10b214c1d4260dfcd8d), [`12c647c`](https://github.com/mastra-ai/mastra/commit/12c647cf3a26826eb72d40b42e3c8356ceae16ed), [`d084b66`](https://github.com/mastra-ai/mastra/commit/d084b6692396057e83c086b954c1857d20b58a14), [`79c699a`](https://github.com/mastra-ai/mastra/commit/79c699acf3cd8a77e11c55530431f48eb48456e9), [`62757b6`](https://github.com/mastra-ai/mastra/commit/62757b6db6e8bb86569d23ad0b514178f57053f8), [`675f15b`](https://github.com/mastra-ai/mastra/commit/675f15b7eaeea649158d228ea635be40480c584d), [`b174c63`](https://github.com/mastra-ai/mastra/commit/b174c63a093108d4e53b9bc89a078d9f66202b3f), [`819f03c`](https://github.com/mastra-ai/mastra/commit/819f03c25823373b32476413bd76be28a5d8705a), [`04160ee`](https://github.com/mastra-ai/mastra/commit/04160eedf3130003cf842ad08428c8ff69af4cc1), [`2c27503`](https://github.com/mastra-ai/mastra/commit/2c275032510d131d2cde47f99953abf0fe02c081), [`424a1df`](https://github.com/mastra-ai/mastra/commit/424a1df7bee59abb5c83717a54807fdd674a6224), [`3d70b0b`](https://github.com/mastra-ai/mastra/commit/3d70b0b3524d817173ad870768f259c06d61bd23), [`eef7cb2`](https://github.com/mastra-ai/mastra/commit/eef7cb2abe7ef15951e2fdf792a5095c6c643333), [`260fe12`](https://github.com/mastra-ai/mastra/commit/260fe1295fe7354e39d6def2775e0797a7a277f0), [`12c88a6`](https://github.com/mastra-ai/mastra/commit/12c88a6e32bf982c2fe0c6af62e65a3414519a75), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`78670e9`](https://github.com/mastra-ai/mastra/commit/78670e97e76d7422cf7025faf371b2aeafed860d), [`e8a5b0b`](https://github.com/mastra-ai/mastra/commit/e8a5b0b9bc94d12dee4150095512ca27a288d778), [`3b45a13`](https://github.com/mastra-ai/mastra/commit/3b45a138d09d040779c0aba1edbbfc1b57442d23), [`d400e7c`](https://github.com/mastra-ai/mastra/commit/d400e7c8b8d7afa6ba2c71769eace4048e3cef8e), [`f58d1a7`](https://github.com/mastra-ai/mastra/commit/f58d1a7a457588a996c3ecb53201a68f3d28c432), [`a49a929`](https://github.com/mastra-ai/mastra/commit/a49a92904968b4fc67e01effee8c7c8d0464ba85), [`8127d96`](https://github.com/mastra-ai/mastra/commit/8127d96280492e335d49b244501088dfdd59a8f1)]:
21
+ - @mastra/core@1.18.0
22
+
23
+ ## 1.8.4-alpha.3
24
+
25
+ ### Patch Changes
26
+
27
+ - Added `scorerIds` persistence for datasets. The `scorerIds` field is now stored and retrieved correctly when creating or updating datasets. ([#14783](https://github.com/mastra-ai/mastra/pull/14783))
28
+
29
+ - Updated dependencies [[`fbf22a7`](https://github.com/mastra-ai/mastra/commit/fbf22a7ad86bcb50dcf30459f0d075e51ddeb468), [`04160ee`](https://github.com/mastra-ai/mastra/commit/04160eedf3130003cf842ad08428c8ff69af4cc1), [`2c27503`](https://github.com/mastra-ai/mastra/commit/2c275032510d131d2cde47f99953abf0fe02c081), [`424a1df`](https://github.com/mastra-ai/mastra/commit/424a1df7bee59abb5c83717a54807fdd674a6224), [`12c88a6`](https://github.com/mastra-ai/mastra/commit/12c88a6e32bf982c2fe0c6af62e65a3414519a75), [`43595bf`](https://github.com/mastra-ai/mastra/commit/43595bf7b8df1a6edce7a23b445b5124d2a0b473), [`78670e9`](https://github.com/mastra-ai/mastra/commit/78670e97e76d7422cf7025faf371b2aeafed860d), [`d400e7c`](https://github.com/mastra-ai/mastra/commit/d400e7c8b8d7afa6ba2c71769eace4048e3cef8e), [`f58d1a7`](https://github.com/mastra-ai/mastra/commit/f58d1a7a457588a996c3ecb53201a68f3d28c432), [`a49a929`](https://github.com/mastra-ai/mastra/commit/a49a92904968b4fc67e01effee8c7c8d0464ba85)]:
30
+ - @mastra/core@1.18.0-alpha.4
31
+
3
32
  ## 1.8.4-alpha.2
4
33
 
5
34
  ### Patch Changes
@@ -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.8.4-alpha.2"
6
+ version: "1.8.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.4-alpha.2",
2
+ "version": "1.8.4",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
package/dist/index.cjs CHANGED
@@ -4355,6 +4355,7 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4355
4355
  await this.#addColumnIfNotExists(storage.TABLE_DATASETS, "tags", "JSONB");
4356
4356
  await this.#addColumnIfNotExists(storage.TABLE_DATASETS, "targetType", "TEXT");
4357
4357
  await this.#addColumnIfNotExists(storage.TABLE_DATASETS, "targetIds", "JSONB");
4358
+ await this.#addColumnIfNotExists(storage.TABLE_DATASETS, "scorerIds", "JSONB");
4358
4359
  await this.#addColumnIfNotExists(storage.TABLE_DATASET_ITEMS, "requestContext", "JSONB");
4359
4360
  await this.#addColumnIfNotExists(storage.TABLE_DATASET_ITEMS, "source", "JSONB");
4360
4361
  await this.createDefaultIndexes();
@@ -4426,6 +4427,7 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4426
4427
  tags: row.tags ? storage.safelyParseJSON(row.tags) : void 0,
4427
4428
  targetType: row.targetType || null,
4428
4429
  targetIds: row.targetIds || null,
4430
+ scorerIds: row.scorerIds || null,
4429
4431
  version: row.version,
4430
4432
  createdAt: storage.ensureDate(row.createdAtZ || row.createdAt),
4431
4433
  updatedAt: storage.ensureDate(row.updatedAtZ || row.updatedAt)
@@ -4487,6 +4489,7 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4487
4489
  requestContextSchema: input.requestContextSchema ?? null,
4488
4490
  targetType: input.targetType ?? null,
4489
4491
  targetIds: input.targetIds !== void 0 ? JSON.stringify(input.targetIds) : null,
4492
+ scorerIds: input.scorerIds ? JSON.stringify(input.scorerIds) : null,
4490
4493
  version: 0,
4491
4494
  createdAt: nowIso,
4492
4495
  updatedAt: nowIso
@@ -4502,6 +4505,7 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4502
4505
  requestContextSchema: input.requestContextSchema ?? void 0,
4503
4506
  targetType: input.targetType ?? null,
4504
4507
  targetIds: input.targetIds ?? null,
4508
+ scorerIds: input.scorerIds ?? null,
4505
4509
  version: 0,
4506
4510
  createdAt: now,
4507
4511
  updatedAt: now
@@ -4585,6 +4589,10 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4585
4589
  setClauses.push(`"targetIds" = $${paramIndex++}`);
4586
4590
  values.push(args.targetIds === null ? null : JSON.stringify(args.targetIds));
4587
4591
  }
4592
+ if (args.scorerIds !== void 0) {
4593
+ setClauses.push(`"scorerIds" = $${paramIndex++}`);
4594
+ values.push(args.scorerIds === null ? null : JSON.stringify(args.scorerIds));
4595
+ }
4588
4596
  values.push(args.id);
4589
4597
  await this.#db.client.none(
4590
4598
  `UPDATE ${tableName} SET ${setClauses.join(", ")} WHERE "id" = $${paramIndex}`,
@@ -4601,6 +4609,7 @@ var DatasetsPG = class _DatasetsPG extends storage.DatasetsStorage {
4601
4609
  tags: (args.tags !== void 0 ? args.tags : existing.tags) ?? void 0,
4602
4610
  targetType: (args.targetType !== void 0 ? args.targetType : existing.targetType) ?? null,
4603
4611
  targetIds: (args.targetIds !== void 0 ? args.targetIds : existing.targetIds) ?? null,
4612
+ scorerIds: (args.scorerIds !== void 0 ? args.scorerIds : existing.scorerIds) ?? null,
4604
4613
  updatedAt: new Date(now)
4605
4614
  };
4606
4615
  } catch (error$1) {
@@ -12420,7 +12429,7 @@ function getTableName5({ indexName, schemaName }) {
12420
12429
  return schemaName ? `${schemaName}.${quotedIndexName}` : quotedIndexName;
12421
12430
  }
12422
12431
  function sanitizeJsonForPg(jsonString) {
12423
- return jsonString.replace(/\\u(0000|[Dd][89A-Fa-f][0-9A-Fa-f]{2})/g, "");
12432
+ return jsonString.replace(/(^|[^\\])(\\(?!["\\/bfnrtu]))/g, "$1\\\\").replace(/\\u(0000|[Dd][89A-Fa-f][0-9A-Fa-f]{2})/g, "");
12424
12433
  }
12425
12434
  var WorkflowsPG = class _WorkflowsPG extends storage.WorkflowsStorage {
12426
12435
  #db;