@mastra/duckdb 1.11.1 → 1.11.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.
@@ -4226,6 +4226,15 @@ async function listTraceRows(db, args, reconstructSelect, mapRow, toSpans) {
4226
4226
  `;
4227
4227
  const countResult = await db.query(countSql, prefilterParams);
4228
4228
  const total = Number(countResult[0]?.total ?? 0);
4229
+ if (total === 0 || offset >= total) return {
4230
+ pagination: {
4231
+ total,
4232
+ page,
4233
+ perPage,
4234
+ hasMore: false
4235
+ },
4236
+ spans: []
4237
+ };
4229
4238
  const pageSql = `
4230
4239
  WITH page_roots AS (
4231
4240
  SELECT traceId, spanId, min(timestamp) AS anchorStartedAt
@@ -4282,6 +4291,15 @@ async function listTraceRows(db, args, reconstructSelect, mapRow, toSpans) {
4282
4291
  `;
4283
4292
  const countResult = await db.query(countSql, [...prefilterParams, ...postAggParams]);
4284
4293
  const total = Number(countResult[0]?.total ?? 0);
4294
+ if (total === 0 || page * perPage >= total) return {
4295
+ pagination: {
4296
+ total,
4297
+ page,
4298
+ perPage,
4299
+ hasMore: false
4300
+ },
4301
+ spans: []
4302
+ };
4285
4303
  const dataSql = `
4286
4304
  ${cteSql},
4287
4305
  page_roots AS (
@@ -4589,9 +4607,9 @@ async function listBranches(db, args) {
4589
4607
  `;
4590
4608
  const countResult = await db.query(countSql, prefilterParams);
4591
4609
  const total = Number(countResult[0]?.total ?? 0);
4592
- if (total === 0) return {
4610
+ if (total === 0 || page * perPage >= total) return {
4593
4611
  pagination: {
4594
- total: 0,
4612
+ total,
4595
4613
  page,
4596
4614
  perPage,
4597
4615
  hasMore: false
@@ -4652,9 +4670,9 @@ async function listBranches(db, args) {
4652
4670
  `;
4653
4671
  const countResult = await db.query(countSql, [...prefilterParams, ...postAggParams]);
4654
4672
  const total = Number(countResult[0]?.total ?? 0);
4655
- if (total === 0) return {
4673
+ if (total === 0 || page * perPage >= total) return {
4656
4674
  pagination: {
4657
- total: 0,
4675
+ total,
4658
4676
  page,
4659
4677
  perPage,
4660
4678
  hasMore: false
@@ -4766,7 +4784,7 @@ async function getBranchDeltaCursor(db, filters) {
4766
4784
  branch_anchors AS (
4767
4785
  SELECT reconstructed.*, candidate_anchors.cursorId AS anchorCursorId
4768
4786
  FROM (
4769
- ${SPAN_RECONSTRUCT_SELECT}
4787
+ ${buildPostAggReconstructSelect(postAgg, "startedAt")}
4770
4788
  WHERE (traceId, spanId) IN (SELECT traceId, spanId FROM candidate_anchors)
4771
4789
  GROUP BY traceId, spanId
4772
4790
  ) AS reconstructed
@@ -5087,4 +5105,4 @@ var ObservabilityStorageDuckDB = class ObservabilityStorageDuckDB extends _mastr
5087
5105
  //#endregion
5088
5106
  exports.ObservabilityStorageDuckDB = ObservabilityStorageDuckDB;
5089
5107
 
5090
- //# sourceMappingURL=observability-B8uK8pWn.cjs.map
5108
+ //# sourceMappingURL=observability-DRS8TmSs.cjs.map