@mastra/clickhouse 1.30.0-alpha.2 → 1.30.0-alpha.4

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.
@@ -3,7 +3,7 @@ name: mastra-clickhouse
3
3
  description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/clickhouse"
6
- version: "1.30.0-alpha.2"
6
+ version: "1.30.0-alpha.4"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.30.0-alpha.2",
2
+ "version": "1.30.0-alpha.4",
3
3
  "package": "@mastra/clickhouse",
4
4
  "exports": {
5
5
  "COLUMN_TYPES": {
@@ -10,12 +10,12 @@
10
10
  "ClickhouseStore": {
11
11
  "types": "dist/storage/index.d.ts",
12
12
  "implementation": "dist/index.js",
13
- "line": 11920
13
+ "line": 11926
14
14
  },
15
15
  "ClickhouseStoreVNext": {
16
16
  "types": "dist/storage/index.d.ts",
17
17
  "implementation": "dist/index.js",
18
- "line": 12036
18
+ "line": 12042
19
19
  },
20
20
  "MemoryStorageClickhouse": {
21
21
  "types": "dist/storage/domains/memory/index.d.ts",
@@ -30,12 +30,12 @@
30
30
  "ObservabilityStorageClickhouseVNext": {
31
31
  "types": "dist/storage/domains/observability/v-next/index.d.ts",
32
32
  "implementation": "dist/index.js",
33
- "line": 10338
33
+ "line": 10344
34
34
  },
35
35
  "ScoresStorageClickhouse": {
36
36
  "types": "dist/storage/domains/scores/index.d.ts",
37
37
  "implementation": "dist/index.js",
38
- "line": 11224
38
+ "line": 11230
39
39
  },
40
40
  "TABLE_DELETION_REQUESTS": {
41
41
  "types": "dist/storage/domains/observability/v-next/ddl.d.ts",
@@ -50,12 +50,12 @@
50
50
  "WorkflowsStorageClickhouse": {
51
51
  "types": "dist/storage/domains/workflows/index.d.ts",
52
52
  "implementation": "dist/index.js",
53
- "line": 11625
53
+ "line": 11631
54
54
  },
55
55
  "applyClickHouseRetention": {
56
56
  "types": "dist/storage/domains/observability/v-next/index.d.ts",
57
57
  "implementation": "dist/index.js",
58
- "line": 10163
58
+ "line": 10169
59
59
  },
60
60
  "markDeletionRequestApplied": {
61
61
  "types": "dist/storage/domains/observability/v-next/deletion-requests.d.ts",
package/dist/index.cjs CHANGED
@@ -8238,10 +8238,11 @@ function afterCursor$1(plan, parameters) {
8238
8238
  const equal = [];
8239
8239
  if (cursor.sortValue === null) equal.push(`isNull(${field})`);
8240
8240
  else {
8241
- const numeric = plan.orderBy.field === "timeToFirstChunkMs" || plan.orderBy.field === "timeToFirstTokenMs";
8242
- const value = parameters.add(cursor.sortValue, numeric ? "Float64" : "DateTime64(3, 'UTC')");
8241
+ const numeric = typeof cursor.sortValue === "number";
8242
+ const stringSort = plan.orderBy.field === "model" || plan.orderBy.field === "provider";
8243
+ const value = parameters.add(cursor.sortValue, stringSort ? "String" : numeric ? "Float64" : "DateTime64(3, 'UTC')");
8243
8244
  terms.push(`${field} ${plan.orderBy.direction === "asc" ? ">" : "<"} ${value}`);
8244
- if (numeric) terms.push(`isNull(${field})`);
8245
+ if (numeric || stringSort) terms.push(`isNull(${field})`);
8245
8246
  equal.push(`${field} = ${value}`);
8246
8247
  }
8247
8248
  for (const key of identityFields) {
@@ -8466,7 +8467,8 @@ async function querySpans(client, plan, timeoutMs) {
8466
8467
  const selected = (await run(compileClickHouseSpanQuery(plan))).map((row) => ({
8467
8468
  ...row,
8468
8469
  startedAt: iso$1(row.startedAt),
8469
- endedAt: iso$1(row.endedAt)
8470
+ endedAt: iso$1(row.endedAt),
8471
+ ...row.durationMs === void 0 ? {} : { durationMs: Number(row.durationMs) }
8470
8472
  }));
8471
8473
  const page = selected.slice(0, plan.limit);
8472
8474
  if (!page.length) return {
@@ -8508,6 +8510,8 @@ async function querySpans(client, plan, timeoutMs) {
8508
8510
  return [{
8509
8511
  ...metadata,
8510
8512
  ...identity,
8513
+ model: row.model,
8514
+ provider: row.provider,
8511
8515
  durationMs: Number(row.durationMs),
8512
8516
  ...timeToFirstChunkSupported && { timeToFirstChunkMs: timeToFirstChunkMs == null ? null : Number(timeToFirstChunkMs) },
8513
8517
  ...timeToFirstTokenSupported && { timeToFirstTokenMs: timeToFirstTokenMs == null ? null : Number(timeToFirstTokenMs) },
@@ -10063,6 +10067,8 @@ function buildBranchCursor(row) {
10063
10067
  const spanQueryFeatures = typeof _mastra_core_storage.planSpanQuery === "function" ? [
10064
10068
  "span-query",
10065
10069
  "span-query-context-fields",
10070
+ ..._mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("durationMs") ? ["span-query-duration-sort"] : [],
10071
+ ..._mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("model") && _mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("provider") ? ["span-query-model-provider-sort"] : [],
10066
10072
  ..."model" in (_mastra_core_storage.SPAN_QUERY_FIELD_REGISTRY ?? {}) ? ["span-query-model-fields"] : []
10067
10073
  ] : [];
10068
10074
  const spanAggregateFeatures = typeof _mastra_core_storage.planSpanAggregate === "function" ? ["span-aggregate", ..."model" in (_mastra_core_storage.SPAN_AGGREGATE_DIMENSION_REGISTRY ?? {}) ? ["span-aggregate-model-dimensions"] : []] : [];