@mastra/duckdb 1.3.1 → 1.3.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.
@@ -2692,7 +2692,7 @@ async function getTraceLight(db, args) {
2692
2692
  spans: rows.map((row) => rowToLightSpanRecord(row))
2693
2693
  };
2694
2694
  }
2695
- async function listTraces(db, args) {
2695
+ async function listTraceRows(db, args, reconstructSelect, mapRow, toSpans) {
2696
2696
  const filters = args.filters ?? {};
2697
2697
  const page = Number(args.pagination?.page ?? 0);
2698
2698
  const perPage = Number(args.pagination?.perPage ?? 10);
@@ -2727,16 +2727,16 @@ async function listTraces(db, args) {
2727
2727
  ${prefilterOrderBy}
2728
2728
  LIMIT ? OFFSET ?
2729
2729
  )
2730
- ${SPAN_RECONSTRUCT_SELECT}
2730
+ ${reconstructSelect}
2731
2731
  WHERE (traceId, spanId) IN (SELECT traceId, spanId FROM page_roots)
2732
2732
  GROUP BY traceId, spanId
2733
2733
  ${buildOrderByClause(orderBy)}
2734
2734
  `;
2735
2735
  const rows2 = await db.query(pageSql, [...prefilterParams, perPage, offset]);
2736
- const spans2 = rows2.map((row) => rowToSpanRecord(row));
2736
+ const spans2 = rows2.map((row) => mapRow(row));
2737
2737
  return {
2738
2738
  pagination: { total: total2, page, perPage, hasMore: (page + 1) * perPage < total2 },
2739
- spans: toTraceSpans(spans2)
2739
+ spans: toSpans(spans2)
2740
2740
  };
2741
2741
  }
2742
2742
  const { clause: postAggClause, params: postAggParams } = buildWhereClause(postAgg);
@@ -2752,7 +2752,7 @@ async function listTraces(db, args) {
2752
2752
  ${prefilterWhere}
2753
2753
  ),
2754
2754
  root_spans AS (
2755
- ${SPAN_RECONSTRUCT_SELECT}
2755
+ ${reconstructSelect}
2756
2756
  WHERE (traceId, spanId) IN (SELECT traceId, spanId FROM candidate_roots)
2757
2757
  GROUP BY traceId, spanId
2758
2758
  )
@@ -2770,12 +2770,30 @@ async function listTraces(db, args) {
2770
2770
  SELECT * FROM root_spans ${postAggWhere} ${orderByClause} ${paginationClause}
2771
2771
  `;
2772
2772
  const rows = await db.query(dataSql, [...prefilterParams, ...postAggParams, ...paginationParams]);
2773
- const spans = rows.map((row) => rowToSpanRecord(row));
2773
+ const spans = rows.map((row) => mapRow(row));
2774
2774
  return {
2775
2775
  pagination: { total, page, perPage, hasMore: (page + 1) * perPage < total },
2776
- spans: toTraceSpans(spans)
2776
+ spans: toSpans(spans)
2777
2777
  };
2778
2778
  }
2779
+ async function listTraces(db, args) {
2780
+ return listTraceRows(
2781
+ db,
2782
+ args,
2783
+ SPAN_RECONSTRUCT_SELECT,
2784
+ rowToSpanRecord,
2785
+ (spans) => toTraceSpans(spans)
2786
+ );
2787
+ }
2788
+ async function listTracesLight(db, args) {
2789
+ return listTraceRows(
2790
+ db,
2791
+ args,
2792
+ SPAN_RECONSTRUCT_SELECT_LIGHT,
2793
+ rowToLightSpanRecord,
2794
+ (spans) => spans
2795
+ );
2796
+ }
2779
2797
  var BRANCH_SPAN_TYPE_PLACEHOLDERS = BRANCH_SPAN_TYPES.map(() => "?").join(", ");
2780
2798
  async function getSpans(db, args) {
2781
2799
  if (args.spanIds.length === 0) {
@@ -3014,6 +3032,9 @@ var ObservabilityStorageDuckDB = class extends ObservabilityStorage {
3014
3032
  async listTraces(args) {
3015
3033
  return listTraces(this.db, args);
3016
3034
  }
3035
+ async listTracesLight(args) {
3036
+ return listTracesLight(this.db, args);
3037
+ }
3017
3038
  async listBranches(args) {
3018
3039
  return listBranches(this.db, args);
3019
3040
  }
@@ -3119,5 +3140,5 @@ var ObservabilityStorageDuckDB = class extends ObservabilityStorage {
3119
3140
  };
3120
3141
 
3121
3142
  export { ObservabilityStorageDuckDB };
3122
- //# sourceMappingURL=observability-MKVTGAKX.js.map
3123
- //# sourceMappingURL=observability-MKVTGAKX.js.map
3143
+ //# sourceMappingURL=observability-TS5QIHIC.js.map
3144
+ //# sourceMappingURL=observability-TS5QIHIC.js.map