@voltro/plugin-clickhouse 0.33.0 → 0.34.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.
package/dist/index.d.ts CHANGED
@@ -70,8 +70,13 @@ export declare const EVENTS_TABLE_DDL: (database: string, table: string) => stri
70
70
  * gives idempotent upserts — re-inserting the same row with a newer
71
71
  * `version` collapses to the latest on merge. Deletes insert a tombstone
72
72
  * (`is_deleted = 1`); queries filter `is_deleted = 0` (or use the
73
- * `FINAL` modifier). `version` is a monotonic micro-timestamp so a later
74
- * write always wins.
73
+ * `FINAL` modifier).
74
+ *
75
+ * `version` is the framework's per-change ordering token
76
+ * (`MirrorVersion`), assigned in COMMIT order and carried on the write.
77
+ * It is never read from a clock inside this sink — that is what makes
78
+ * "a later write always wins" true of the later COMMIT rather than of
79
+ * whichever HTTP request happened to arrive last.
75
80
  */
76
81
  export declare const MIRROR_TABLE_DDL: (database: string, sourceTable: string) => string;
77
82
 
package/dist/index.js CHANGED
@@ -138,20 +138,20 @@ var a = r({ scope: "@voltro/plugin-clickhouse" }), o = "clickhouse", s = (e) =>
138
138
  return {
139
139
  tables: e.mirrorTables,
140
140
  primaryKey: e.mirrorPrimaryKey,
141
- upsert: (r, i) => t.gen(function* () {
141
+ upsert: ({ table: r, row: i, version: a }) => t.gen(function* () {
142
142
  let t = String(i[e.mirrorPrimaryKey]);
143
143
  yield* n(r, {
144
144
  id: t,
145
145
  data: JSON.stringify(i),
146
- version: Date.now() * 1e3,
146
+ version: a,
147
147
  is_deleted: 0
148
148
  });
149
149
  }).pipe(d("mirror.upsert")),
150
- remove: (e, r) => t.gen(function* () {
150
+ remove: ({ table: e, primaryKeyValue: r, version: i }) => t.gen(function* () {
151
151
  yield* n(e, {
152
152
  id: String(r),
153
153
  data: "{}",
154
- version: Date.now() * 1e3,
154
+ version: i,
155
155
  is_deleted: 1
156
156
  });
157
157
  }).pipe(d("mirror.remove"))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-clickhouse",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "ClickHouse AnalyticsSink. Native HTTP ingest into a ClickHouse cluster — self-hosted OR ClickHouse Cloud. Production-grade OLAP for high-cardinality events with millisecond aggregate queries over billions of rows.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -34,8 +34,8 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@clickhouse/client": "^1.23.1",
37
- "@voltro/logger": "0.33.0",
38
- "@voltro/runtime": "0.33.0"
37
+ "@voltro/logger": "0.34.0",
38
+ "@voltro/runtime": "0.34.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "effect": "^3.22.0"