@mastra/clickhouse 1.30.0-alpha.1 → 1.30.0-alpha.3
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 +7 -7
- package/dist/index.cjs +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/observability/v-next/feedback.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/index.d.ts +1 -1
- package/dist/storage/domains/observability/v-next/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/v-next/span-query.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.
|
|
6
|
+
version: "1.30.0-alpha.3"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.30.0-alpha.
|
|
2
|
+
"version": "1.30.0-alpha.3",
|
|
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":
|
|
13
|
+
"line": 11922
|
|
14
14
|
},
|
|
15
15
|
"ClickhouseStoreVNext": {
|
|
16
16
|
"types": "dist/storage/index.d.ts",
|
|
17
17
|
"implementation": "dist/index.js",
|
|
18
|
-
"line":
|
|
18
|
+
"line": 12038
|
|
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":
|
|
33
|
+
"line": 10340
|
|
34
34
|
},
|
|
35
35
|
"ScoresStorageClickhouse": {
|
|
36
36
|
"types": "dist/storage/domains/scores/index.d.ts",
|
|
37
37
|
"implementation": "dist/index.js",
|
|
38
|
-
"line":
|
|
38
|
+
"line": 11226
|
|
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":
|
|
53
|
+
"line": 11627
|
|
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":
|
|
58
|
+
"line": 10165
|
|
59
59
|
},
|
|
60
60
|
"markDeletionRequestApplied": {
|
|
61
61
|
"types": "dist/storage/domains/observability/v-next/deletion-requests.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -5092,7 +5092,7 @@ async function queryJson$2(client, query, params, settings = {}) {
|
|
|
5092
5092
|
}
|
|
5093
5093
|
})).json();
|
|
5094
5094
|
}
|
|
5095
|
-
async function feedbackRowsWithWriteVersions(client, feedbacks) {
|
|
5095
|
+
async function feedbackRowsWithWriteVersions(client, feedbacks, onConflict) {
|
|
5096
5096
|
const identifiedFeedback = feedbacks.map((feedback) => ({
|
|
5097
5097
|
...feedback,
|
|
5098
5098
|
feedbackId: feedback.feedbackId ?? ""
|
|
@@ -5103,23 +5103,29 @@ async function feedbackRowsWithWriteVersions(client, feedbacks) {
|
|
|
5103
5103
|
WHERE feedbackId IN ({feedbackIds:Array(String)})
|
|
5104
5104
|
GROUP BY feedbackId`, { feedbackIds });
|
|
5105
5105
|
const versions = new Map(existingVersions.map((row) => [row.feedbackId, BigInt(row.writeVersion)]));
|
|
5106
|
-
return identifiedFeedback.
|
|
5106
|
+
return identifiedFeedback.flatMap((feedback) => {
|
|
5107
|
+
if (onConflict === "ignore" && versions.has(feedback.feedbackId)) return [];
|
|
5107
5108
|
const writeVersion = (versions.get(feedback.feedbackId) ?? 0n) + 1n;
|
|
5108
5109
|
versions.set(feedback.feedbackId, writeVersion);
|
|
5109
|
-
return {
|
|
5110
|
+
return [{
|
|
5110
5111
|
...feedbackRecordToRow(feedback),
|
|
5111
5112
|
writeVersion: writeVersion.toString()
|
|
5112
|
-
};
|
|
5113
|
+
}];
|
|
5113
5114
|
});
|
|
5114
5115
|
}
|
|
5115
5116
|
async function createFeedback(client, args) {
|
|
5116
|
-
await batchCreateFeedback(client, {
|
|
5117
|
+
await batchCreateFeedback(client, {
|
|
5118
|
+
feedbacks: [args.feedback],
|
|
5119
|
+
onConflict: args.onConflict
|
|
5120
|
+
});
|
|
5117
5121
|
}
|
|
5118
5122
|
async function batchCreateFeedback(client, args) {
|
|
5119
5123
|
if (args.feedbacks.length === 0) return;
|
|
5124
|
+
const values = await feedbackRowsWithWriteVersions(client, args.feedbacks, args.onConflict);
|
|
5125
|
+
if (values.length === 0) return;
|
|
5120
5126
|
await client.insert({
|
|
5121
5127
|
table: TABLE_FEEDBACK_EVENTS,
|
|
5122
|
-
values
|
|
5128
|
+
values,
|
|
5123
5129
|
format: "JSONEachRow",
|
|
5124
5130
|
clickhouse_settings: CH_INSERT_SETTINGS
|
|
5125
5131
|
});
|
|
@@ -8232,7 +8238,7 @@ function afterCursor$1(plan, parameters) {
|
|
|
8232
8238
|
const equal = [];
|
|
8233
8239
|
if (cursor.sortValue === null) equal.push(`isNull(${field})`);
|
|
8234
8240
|
else {
|
|
8235
|
-
const numeric =
|
|
8241
|
+
const numeric = typeof cursor.sortValue === "number";
|
|
8236
8242
|
const value = parameters.add(cursor.sortValue, numeric ? "Float64" : "DateTime64(3, 'UTC')");
|
|
8237
8243
|
terms.push(`${field} ${plan.orderBy.direction === "asc" ? ">" : "<"} ${value}`);
|
|
8238
8244
|
if (numeric) terms.push(`isNull(${field})`);
|
|
@@ -8460,7 +8466,8 @@ async function querySpans(client, plan, timeoutMs) {
|
|
|
8460
8466
|
const selected = (await run(compileClickHouseSpanQuery(plan))).map((row) => ({
|
|
8461
8467
|
...row,
|
|
8462
8468
|
startedAt: iso$1(row.startedAt),
|
|
8463
|
-
endedAt: iso$1(row.endedAt)
|
|
8469
|
+
endedAt: iso$1(row.endedAt),
|
|
8470
|
+
...row.durationMs === void 0 ? {} : { durationMs: Number(row.durationMs) }
|
|
8464
8471
|
}));
|
|
8465
8472
|
const page = selected.slice(0, plan.limit);
|
|
8466
8473
|
if (!page.length) return {
|
|
@@ -10057,6 +10064,7 @@ function buildBranchCursor(row) {
|
|
|
10057
10064
|
const spanQueryFeatures = typeof _mastra_core_storage.planSpanQuery === "function" ? [
|
|
10058
10065
|
"span-query",
|
|
10059
10066
|
"span-query-context-fields",
|
|
10067
|
+
..._mastra_core_storage.SPAN_QUERY_ORDER_FIELDS?.includes("durationMs") ? ["span-query-duration-sort"] : [],
|
|
10060
10068
|
..."model" in (_mastra_core_storage.SPAN_QUERY_FIELD_REGISTRY ?? {}) ? ["span-query-model-fields"] : []
|
|
10061
10069
|
] : [];
|
|
10062
10070
|
const spanAggregateFeatures = typeof _mastra_core_storage.planSpanAggregate === "function" ? ["span-aggregate", ..."model" in (_mastra_core_storage.SPAN_AGGREGATE_DIMENSION_REGISTRY ?? {}) ? ["span-aggregate-model-dimensions"] : []] : [];
|
|
@@ -10497,6 +10505,7 @@ var ObservabilityStorageClickhouseVNext = class extends _mastra_core_storage.Obs
|
|
|
10497
10505
|
"thread-query",
|
|
10498
10506
|
"trace-query-tenant-scope",
|
|
10499
10507
|
"feedback",
|
|
10508
|
+
"feedback-replacement",
|
|
10500
10509
|
"trace-query-context-ids",
|
|
10501
10510
|
...contextFieldFeatures,
|
|
10502
10511
|
...timingFeatures,
|
|
@@ -10525,6 +10534,7 @@ var ObservabilityStorageClickhouseVNext = class extends _mastra_core_storage.Obs
|
|
|
10525
10534
|
"thread-query",
|
|
10526
10535
|
"trace-query-tenant-scope",
|
|
10527
10536
|
"feedback",
|
|
10537
|
+
"feedback-replacement",
|
|
10528
10538
|
"trace-query-context-ids",
|
|
10529
10539
|
...contextFieldFeatures,
|
|
10530
10540
|
...timingFeatures,
|