@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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './vector';
2
- export * from './storage';
3
- export { PGVECTOR_PROMPT } from './vector/prompt';
1
+ export * from './vector/index.js';
2
+ export * from './storage/index.js';
3
+ export { PGVECTOR_PROMPT } from './vector/prompt.js';
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -2288,17 +2288,17 @@ var StoreOperationsPG = class extends StoreOperations {
2288
2288
  }
2289
2289
  };
2290
2290
  function transformScoreRow(row) {
2291
- let input = void 0;
2292
- if (row.input) {
2293
- try {
2294
- input = JSON.parse(row.input);
2295
- } catch {
2296
- input = row.input;
2297
- }
2298
- }
2299
2291
  return {
2300
2292
  ...row,
2301
- input,
2293
+ input: safelyParseJSON(row.input),
2294
+ scorer: safelyParseJSON(row.scorer),
2295
+ preprocessStepResult: safelyParseJSON(row.preprocessStepResult),
2296
+ analyzeStepResult: safelyParseJSON(row.analyzeStepResult),
2297
+ metadata: safelyParseJSON(row.metadata),
2298
+ output: safelyParseJSON(row.output),
2299
+ additionalContext: safelyParseJSON(row.additionalContext),
2300
+ runtimeContext: safelyParseJSON(row.runtimeContext),
2301
+ entity: safelyParseJSON(row.entity),
2302
2302
  createdAt: row.createdAtZ || row.createdAt,
2303
2303
  updatedAt: row.updatedAtZ || row.updatedAt
2304
2304
  };
@@ -2366,7 +2366,7 @@ var ScoresPG = class extends ScoresStorage {
2366
2366
  perPage: pagination.perPage,
2367
2367
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2368
2368
  },
2369
- scores: result
2369
+ scores: result.map(transformScoreRow)
2370
2370
  };
2371
2371
  } catch (error) {
2372
2372
  throw new MastraError(
@@ -2382,13 +2382,32 @@ var ScoresPG = class extends ScoresStorage {
2382
2382
  async saveScore(score) {
2383
2383
  try {
2384
2384
  const scoreId = crypto.randomUUID();
2385
- const { input, ...rest } = score;
2385
+ const {
2386
+ scorer,
2387
+ preprocessStepResult,
2388
+ analyzeStepResult,
2389
+ metadata,
2390
+ input,
2391
+ output,
2392
+ additionalContext,
2393
+ runtimeContext,
2394
+ entity,
2395
+ ...rest
2396
+ } = score;
2386
2397
  await this.operations.insert({
2387
2398
  tableName: TABLE_SCORERS,
2388
2399
  record: {
2389
2400
  id: scoreId,
2390
2401
  ...rest,
2391
- input: JSON.stringify(input),
2402
+ input: JSON.stringify(input) || "",
2403
+ output: JSON.stringify(output) || "",
2404
+ scorer: scorer ? JSON.stringify(scorer) : null,
2405
+ preprocessStepResult: preprocessStepResult ? JSON.stringify(preprocessStepResult) : null,
2406
+ analyzeStepResult: analyzeStepResult ? JSON.stringify(analyzeStepResult) : null,
2407
+ metadata: metadata ? JSON.stringify(metadata) : null,
2408
+ additionalContext: additionalContext ? JSON.stringify(additionalContext) : null,
2409
+ runtimeContext: runtimeContext ? JSON.stringify(runtimeContext) : null,
2410
+ entity: entity ? JSON.stringify(entity) : null,
2392
2411
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
2393
2412
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2394
2413
  }
@@ -2437,7 +2456,7 @@ var ScoresPG = class extends ScoresStorage {
2437
2456
  perPage: pagination.perPage,
2438
2457
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2439
2458
  },
2440
- scores: result
2459
+ scores: result.map(transformScoreRow)
2441
2460
  };
2442
2461
  } catch (error) {
2443
2462
  throw new MastraError(
@@ -2482,7 +2501,7 @@ var ScoresPG = class extends ScoresStorage {
2482
2501
  perPage: pagination.perPage,
2483
2502
  hasMore: Number(total?.count) > (pagination.page + 1) * pagination.perPage
2484
2503
  },
2485
- scores: result
2504
+ scores: result.map(transformScoreRow)
2486
2505
  };
2487
2506
  } catch (error) {
2488
2507
  throw new MastraError(