@mastra/libsql 0.13.1-alpha.0 → 0.13.2-alpha.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/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
3
3
  import { parseSqlIdentifier, parseFieldKey } from '@mastra/core/utils';
4
4
  import { MastraVector } from '@mastra/core/vector';
5
5
  import { BaseFilterTranslator } from '@mastra/core/vector/filter';
6
- import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS, TracesStorage, TABLE_TRACES, safelyParseJSON, WorkflowsStorage, MemoryStorage, resolveMessageLimit, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
6
+ import { MastraStorage, StoreOperations, TABLE_WORKFLOW_SNAPSHOT, ScoresStorage, TABLE_SCORERS, safelyParseJSON, TracesStorage, TABLE_TRACES, WorkflowsStorage, MemoryStorage, resolveMessageLimit, TABLE_MESSAGES, TABLE_THREADS, TABLE_RESOURCES, LegacyEvalsStorage, TABLE_EVALS } from '@mastra/core/storage';
7
7
  import { parseSqlIdentifier as parseSqlIdentifier$1 } from '@mastra/core';
8
8
  import { MessageList } from '@mastra/core/agent';
9
9
 
@@ -2058,6 +2058,7 @@ var ScoresLibSQL = class extends ScoresStorage {
2058
2058
  scorerId,
2059
2059
  entityId,
2060
2060
  entityType,
2061
+ source,
2061
2062
  pagination
2062
2063
  }) {
2063
2064
  try {
@@ -2075,6 +2076,10 @@ var ScoresLibSQL = class extends ScoresStorage {
2075
2076
  conditions.push(`entityType = ?`);
2076
2077
  queryParams.push(entityType);
2077
2078
  }
2079
+ if (source) {
2080
+ conditions.push(`source = ?`);
2081
+ queryParams.push(source);
2082
+ }
2078
2083
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
2079
2084
  const result = await this.client.execute({
2080
2085
  sql: `SELECT * FROM ${TABLE_SCORERS} ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,
@@ -2101,15 +2106,15 @@ var ScoresLibSQL = class extends ScoresStorage {
2101
2106
  }
2102
2107
  }
2103
2108
  transformScoreRow(row) {
2104
- const scorerValue = JSON.parse(row.scorer ?? "{}");
2105
- const inputValue = JSON.parse(row.input ?? "{}");
2106
- const outputValue = JSON.parse(row.output ?? "{}");
2107
- const additionalLLMContextValue = row.additionalLLMContext ? JSON.parse(row.additionalLLMContext) : null;
2108
- const runtimeContextValue = row.runtimeContext ? JSON.parse(row.runtimeContext) : null;
2109
- const metadataValue = row.metadata ? JSON.parse(row.metadata) : null;
2110
- const entityValue = row.entity ? JSON.parse(row.entity) : null;
2111
- const preprocessStepResultValue = row.preprocessStepResult ? JSON.parse(row.preprocessStepResult) : null;
2112
- const analyzeStepResultValue = row.analyzeStepResult ? JSON.parse(row.analyzeStepResult) : null;
2109
+ const scorerValue = safelyParseJSON(row.scorer);
2110
+ const inputValue = safelyParseJSON(row.input ?? "{}");
2111
+ const outputValue = safelyParseJSON(row.output ?? "{}");
2112
+ const additionalLLMContextValue = row.additionalLLMContext ? safelyParseJSON(row.additionalLLMContext) : null;
2113
+ const runtimeContextValue = row.runtimeContext ? safelyParseJSON(row.runtimeContext) : null;
2114
+ const metadataValue = row.metadata ? safelyParseJSON(row.metadata) : null;
2115
+ const entityValue = row.entity ? safelyParseJSON(row.entity) : null;
2116
+ const preprocessStepResultValue = row.preprocessStepResult ? safelyParseJSON(row.preprocessStepResult) : null;
2117
+ const analyzeStepResultValue = row.analyzeStepResult ? safelyParseJSON(row.analyzeStepResult) : null;
2113
2118
  return {
2114
2119
  id: row.id,
2115
2120
  traceId: row.traceId,
@@ -2630,9 +2635,10 @@ var LibSQLStore = class extends MastraStorage {
2630
2635
  scorerId,
2631
2636
  entityId,
2632
2637
  entityType,
2638
+ source,
2633
2639
  pagination
2634
2640
  }) {
2635
- return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, pagination });
2641
+ return this.stores.scores.getScoresByScorerId({ scorerId, entityId, entityType, source, pagination });
2636
2642
  }
2637
2643
  async getScoresByRunId({
2638
2644
  runId,