@mastra/pg 0.13.2-alpha.0 → 0.13.2

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @mastra/pg@0.13.2-alpha.0 build /home/runner/work/mastra/mastra/stores/pg
2
+ > @mastra/pg@0.13.2-alpha.1 build /home/runner/work/mastra/mastra/stores/pg
3
3
  > tsup --silent --config tsup.config.ts
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @mastra/pg
2
2
 
3
+ ## 0.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a780fcd: ensure score id is generated for postgres store
8
+ - 2871020: update safelyParseJSON to check for value of param when handling parse
9
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
10
+ - Updated dependencies [cb36de0]
11
+ - Updated dependencies [d0496e6]
12
+ - Updated dependencies [a82b851]
13
+ - Updated dependencies [ea0c5f2]
14
+ - Updated dependencies [41a0a0e]
15
+ - Updated dependencies [2871020]
16
+ - Updated dependencies [94f4812]
17
+ - Updated dependencies [e202b82]
18
+ - Updated dependencies [e00f6a0]
19
+ - Updated dependencies [4a406ec]
20
+ - Updated dependencies [b0e43c1]
21
+ - Updated dependencies [5d377e5]
22
+ - Updated dependencies [1fb812e]
23
+ - Updated dependencies [35c5798]
24
+ - @mastra/core@0.13.0
25
+
26
+ ## 0.13.2-alpha.1
27
+
28
+ ### Patch Changes
29
+
30
+ - 2871020: update safelyParseJSON to check for value of param when handling parse
31
+ - 4a406ec: fixes TypeScript declaration file imports to ensure proper ESM compatibility
32
+ - Updated dependencies [cb36de0]
33
+ - Updated dependencies [a82b851]
34
+ - Updated dependencies [41a0a0e]
35
+ - Updated dependencies [2871020]
36
+ - Updated dependencies [4a406ec]
37
+ - Updated dependencies [5d377e5]
38
+ - @mastra/core@0.13.0-alpha.2
39
+
3
40
  ## 0.13.2-alpha.0
4
41
 
5
42
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -2296,17 +2296,17 @@ var StoreOperationsPG = class extends storage.StoreOperations {
2296
2296
  }
2297
2297
  };
2298
2298
  function transformScoreRow(row) {
2299
- let input = void 0;
2300
- if (row.input) {
2301
- try {
2302
- input = JSON.parse(row.input);
2303
- } catch {
2304
- input = row.input;
2305
- }
2306
- }
2307
2299
  return {
2308
2300
  ...row,
2309
- input,
2301
+ input: storage.safelyParseJSON(row.input),
2302
+ scorer: storage.safelyParseJSON(row.scorer),
2303
+ preprocessStepResult: storage.safelyParseJSON(row.preprocessStepResult),
2304
+ analyzeStepResult: storage.safelyParseJSON(row.analyzeStepResult),
2305
+ metadata: storage.safelyParseJSON(row.metadata),
2306
+ output: storage.safelyParseJSON(row.output),
2307
+ additionalContext: storage.safelyParseJSON(row.additionalContext),
2308
+ runtimeContext: storage.safelyParseJSON(row.runtimeContext),
2309
+ entity: storage.safelyParseJSON(row.entity),
2310
2310
  createdAt: row.createdAtZ || row.createdAt,
2311
2311
  updatedAt: row.updatedAtZ || row.updatedAt
2312
2312
  };
@@ -2374,7 +2374,7 @@ var ScoresPG = class extends storage.ScoresStorage {
2374
2374
  perPage: pagination.perPage,
2375
2375
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2376
2376
  },
2377
- scores: result
2377
+ scores: result.map(transformScoreRow)
2378
2378
  };
2379
2379
  } catch (error$1) {
2380
2380
  throw new error.MastraError(
@@ -2390,13 +2390,32 @@ var ScoresPG = class extends storage.ScoresStorage {
2390
2390
  async saveScore(score) {
2391
2391
  try {
2392
2392
  const scoreId = crypto.randomUUID();
2393
- const { input, ...rest } = score;
2393
+ const {
2394
+ scorer,
2395
+ preprocessStepResult,
2396
+ analyzeStepResult,
2397
+ metadata,
2398
+ input,
2399
+ output,
2400
+ additionalContext,
2401
+ runtimeContext,
2402
+ entity,
2403
+ ...rest
2404
+ } = score;
2394
2405
  await this.operations.insert({
2395
2406
  tableName: storage.TABLE_SCORERS,
2396
2407
  record: {
2397
2408
  id: scoreId,
2398
2409
  ...rest,
2399
- input: JSON.stringify(input),
2410
+ input: JSON.stringify(input) || "",
2411
+ output: JSON.stringify(output) || "",
2412
+ scorer: scorer ? JSON.stringify(scorer) : null,
2413
+ preprocessStepResult: preprocessStepResult ? JSON.stringify(preprocessStepResult) : null,
2414
+ analyzeStepResult: analyzeStepResult ? JSON.stringify(analyzeStepResult) : null,
2415
+ metadata: metadata ? JSON.stringify(metadata) : null,
2416
+ additionalContext: additionalContext ? JSON.stringify(additionalContext) : null,
2417
+ runtimeContext: runtimeContext ? JSON.stringify(runtimeContext) : null,
2418
+ entity: entity ? JSON.stringify(entity) : null,
2400
2419
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2401
2420
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2402
2421
  }
@@ -2445,7 +2464,7 @@ var ScoresPG = class extends storage.ScoresStorage {
2445
2464
  perPage: pagination.perPage,
2446
2465
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2447
2466
  },
2448
- scores: result
2467
+ scores: result.map(transformScoreRow)
2449
2468
  };
2450
2469
  } catch (error$1) {
2451
2470
  throw new error.MastraError(
@@ -2490,7 +2509,7 @@ var ScoresPG = class extends storage.ScoresStorage {
2490
2509
  perPage: pagination.perPage,
2491
2510
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2492
2511
  },
2493
- scores: result
2512
+ scores: result.map(transformScoreRow)
2494
2513
  };
2495
2514
  } catch (error$1) {
2496
2515
  throw new error.MastraError(