@mastra/duckdb 1.19.0-alpha.4 → 1.19.0-alpha.5
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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +2 -2
- package/dist/{features-_JgLl7HD.js → features-B1nGGPUm.js} +3 -1
- package/dist/{features-_JgLl7HD.js.map → features-B1nGGPUm.js.map} +1 -1
- package/dist/{features-xTAPLAPX.cjs → features-TxRZAzYn.cjs} +3 -1
- package/dist/{features-xTAPLAPX.cjs.map → features-TxRZAzYn.cjs.map} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +2 -2
- package/dist/{observability-D0ilOnfe.js → observability-B8zqEeyT.js} +13 -6
- package/dist/observability-B8zqEeyT.js.map +1 -0
- package/dist/{observability-cJFzLpu4.cjs → observability-BT6At9hS.cjs} +13 -6
- package/dist/observability-BT6At9hS.cjs.map +1 -0
- package/dist/storage/domains/observability/index.d.ts +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/span-query.d.ts.map +1 -1
- package/dist/storage/features.d.ts +1 -1
- package/dist/storage/features.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/observability-D0ilOnfe.js.map +0 -1
- package/dist/observability-cJFzLpu4.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_features = require("./features-
|
|
1
|
+
const require_features = require("./features-TxRZAzYn.cjs");
|
|
2
2
|
let _mastra_core_error = require("@mastra/core/error");
|
|
3
3
|
let _mastra_core_storage = require("@mastra/core/storage");
|
|
4
4
|
_mastra_core_storage = require_features.__toESM(_mastra_core_storage, 1);
|
|
@@ -4097,15 +4097,19 @@ function keys(rows, values, alias = "") {
|
|
|
4097
4097
|
return `${alias}${field} IS NOT DISTINCT FROM ?`;
|
|
4098
4098
|
}).join(" AND ")})`).join(" OR ");
|
|
4099
4099
|
}
|
|
4100
|
+
function sortColumn(plan) {
|
|
4101
|
+
const column = `s.${plan.orderBy.field}`;
|
|
4102
|
+
return plan.orderBy.field === "model" || plan.orderBy.field === "provider" ? `${column} COLLATE "C"` : column;
|
|
4103
|
+
}
|
|
4100
4104
|
function afterCursor(plan) {
|
|
4101
4105
|
if (!plan.cursor) return {
|
|
4102
4106
|
sql: "TRUE",
|
|
4103
4107
|
values: []
|
|
4104
4108
|
};
|
|
4105
4109
|
const cursor = plan.cursor;
|
|
4106
|
-
const sort =
|
|
4110
|
+
const sort = sortColumn(plan);
|
|
4107
4111
|
const empty = cursor.sortValue === null;
|
|
4108
|
-
const value = `CAST(? AS ${typeof cursor.sortValue === "number" ? "DOUBLE" : "TIMESTAMP"})`;
|
|
4112
|
+
const value = plan.orderBy.field === "model" || plan.orderBy.field === "provider" ? "CAST(? AS VARCHAR) COLLATE \"C\"" : `CAST(? AS ${typeof cursor.sortValue === "number" ? "DOUBLE" : "TIMESTAMP"})`;
|
|
4109
4113
|
const comparisons = empty ? [] : [`${sort} ${plan.orderBy.direction === "asc" ? ">" : "<"} ${value}`, `${sort} IS NULL`];
|
|
4110
4114
|
const values = empty ? [] : [cursor.sortValue];
|
|
4111
4115
|
for (let i = 0; i < identityFields.length; i++) {
|
|
@@ -4186,10 +4190,12 @@ function compileDuckDBSpanQuery(plan) {
|
|
|
4186
4190
|
"endedAt",
|
|
4187
4191
|
"durationMs",
|
|
4188
4192
|
"status",
|
|
4189
|
-
"cursorId"
|
|
4193
|
+
"cursorId",
|
|
4194
|
+
"model",
|
|
4195
|
+
"provider"
|
|
4190
4196
|
].map((field) => `s.${field}`).join(", ")}
|
|
4191
4197
|
FROM selected s WHERE ${after.sql}
|
|
4192
|
-
ORDER BY
|
|
4198
|
+
ORDER BY ${sortColumn(plan)} ${plan.orderBy.direction === "asc" ? "ASC" : "DESC"} NULLS LAST, ${identityFields.map((field) => `s.${field} ASC NULLS LAST`).join(", ")}
|
|
4193
4199
|
LIMIT ?`,
|
|
4194
4200
|
values
|
|
4195
4201
|
};
|
|
@@ -4227,6 +4233,7 @@ async function querySpans(db, plan) {
|
|
|
4227
4233
|
const rows = await query(compiled.sql, compiled.values);
|
|
4228
4234
|
const selected = rows.map(({ cursorId: _cursorId, startedAt, endedAt, timeToFirstChunkMs, timeToFirstTokenMs, outcome, stopReason, ...row }) => ({
|
|
4229
4235
|
...row,
|
|
4236
|
+
...(plan.orderBy.field === "model" || plan.orderBy.field === "provider") && { cursorSortValue: row[plan.orderBy.field] },
|
|
4230
4237
|
startedAt: startedAt.toISOString(),
|
|
4231
4238
|
endedAt: endedAt.toISOString(),
|
|
4232
4239
|
...require_features.timeToFirstChunkSupported && { timeToFirstChunkMs: timeToFirstChunkMs == null ? null : Number(timeToFirstChunkMs) },
|
|
@@ -6721,4 +6728,4 @@ var ObservabilityStorageDuckDB = class ObservabilityStorageDuckDB extends _mastr
|
|
|
6721
6728
|
};
|
|
6722
6729
|
exports.ObservabilityStorageDuckDB = ObservabilityStorageDuckDB;
|
|
6723
6730
|
|
|
6724
|
-
//# sourceMappingURL=observability-
|
|
6731
|
+
//# sourceMappingURL=observability-BT6At9hS.cjs.map
|