@voltro/plugin-duckdb 0.32.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.
@@ -5,7 +5,7 @@ property of its respective copyright holders and is used under the terms of
5
5
  its license. This file is provided for attribution; it grants no rights in
6
6
  @voltro/plugin-duckdb itself, which is proprietary (see LICENSE).
7
7
 
8
- Generated from the resolved runtime dependency closure (55 packages).
8
+ Generated from the resolved runtime dependency closure (54 packages).
9
9
 
10
10
  ---
11
11
 
@@ -79,34 +79,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
79
79
  SOFTWARE.
80
80
  ```
81
81
 
82
- ## @effect/opentelemetry@0.64.0
83
-
84
- License: MIT
85
-
86
- ```
87
- MIT License
88
-
89
- Copyright (c) 2020-present The Contributors
90
-
91
- Permission is hereby granted, free of charge, to any person obtaining a copy
92
- of this software and associated documentation files (the "Software"), to deal
93
- in the Software without restriction, including without limitation the rights
94
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
95
- copies of the Software, and to permit persons to whom the Software is
96
- furnished to do so, subject to the following conditions:
97
-
98
- The above copyright notice and this permission notice shall be included in all
99
- copies or substantial portions of the Software.
100
-
101
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
102
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
103
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
104
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
106
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
107
- SOFTWARE.
108
- ```
109
-
110
82
  ## @effect/platform-node@0.108.0
111
83
 
112
84
  License: MIT
package/dist/index.js CHANGED
@@ -54,38 +54,52 @@ var r = "duckdb", i = "voltro_events", a = null, o = () => a === null ? e.tryPro
54
54
  params: l,
55
55
  types: u
56
56
  };
57
- }, C = (t, n, r) => {
58
- let i = /* @__PURE__ */ new Set(), o = (n, r) => e.gen(function* () {
57
+ }, C = (e, t, n, r, i) => [
58
+ `INSERT INTO ${e} (id, data, version, is_deleted) VALUES (?, ?::JSON, ?::BIGINT, ?) ON CONFLICT (id) DO UPDATE SET data = EXCLUDED.data, version = EXCLUDED.version, is_deleted = EXCLUDED.is_deleted WHERE EXCLUDED.version > ${e}.version`,
59
+ [
60
+ t,
61
+ n,
62
+ String(r),
63
+ i
64
+ ],
65
+ [
66
+ a.VARCHAR,
67
+ a.VARCHAR,
68
+ a.VARCHAR,
69
+ a.BOOLEAN
70
+ ]
71
+ ], w = (t, n, r) => {
72
+ let i = /* @__PURE__ */ new Set(), a = (n, r) => e.gen(function* () {
59
73
  if (i.has(r)) return;
60
74
  u(n, r, "mirror table name");
61
75
  let a = yield* g(t), o = c(r);
62
76
  yield* e.tryPromise({
63
- try: () => a.run(`CREATE TABLE IF NOT EXISTS ${o} (id VARCHAR PRIMARY KEY, data JSON NOT NULL)`),
77
+ try: () => a.run(`CREATE TABLE IF NOT EXISTS ${o} (id VARCHAR PRIMARY KEY, data JSON NOT NULL, version BIGINT NOT NULL DEFAULT 0, is_deleted BOOLEAN NOT NULL DEFAULT false)`),
64
78
  catch: (e) => e
65
79
  }), i.add(r);
66
80
  });
67
81
  return {
68
82
  tables: n,
69
83
  primaryKey: r,
70
- upsert: (n, i) => e.gen(function* () {
71
- yield* o("mirror.upsert", n);
72
- let s = yield* g(t), { VARCHAR: l } = a, u = c(n), d = String(i[r]), f = JSON.stringify(i);
84
+ upsert: ({ table: n, row: i, version: o }) => e.gen(function* () {
85
+ yield* a("mirror.upsert", n);
86
+ let s = yield* g(t), l = c(n), u = String(i[r]);
73
87
  yield* e.tryPromise({
74
- try: () => s.run(`INSERT INTO ${u} (id, data) VALUES (?, ?::JSON) ON CONFLICT (id) DO UPDATE SET data = EXCLUDED.data`, [d, f], [l, l]),
88
+ try: () => s.run(...C(l, u, JSON.stringify(i), o, !1)),
75
89
  catch: (e) => e
76
90
  });
77
91
  }).pipe(h("mirror.upsert")),
78
- remove: (n, r) => e.gen(function* () {
79
- yield* o("mirror.remove", n);
80
- let i = yield* g(t), { VARCHAR: s } = a, l = c(n), u = String(r);
92
+ remove: ({ table: n, primaryKeyValue: r, version: i }) => e.gen(function* () {
93
+ yield* a("mirror.remove", n);
94
+ let o = yield* g(t), s = c(n), l = String(r);
81
95
  yield* e.tryPromise({
82
- try: () => i.run(`DELETE FROM ${l} WHERE id = ?`, [u], [s]),
96
+ try: () => o.run(...C(s, l, "{}", i, !0)),
83
97
  catch: (e) => e
84
98
  });
85
99
  }).pipe(h("mirror.remove"))
86
100
  };
87
- }, w = (t, n) => {
88
- let o = n.mirrorTables ?? [], c = o.length > 0 ? C(t, o, n.mirrorPrimaryKey ?? "id") : void 0;
101
+ }, T = (t, n) => {
102
+ let o = n.mirrorTables ?? [], c = o.length > 0 ? w(t, o, n.mirrorPrimaryKey ?? "id") : void 0;
89
103
  return {
90
104
  info: {
91
105
  provider: r,
@@ -162,7 +176,7 @@ var r = "duckdb", i = "voltro_events", a = null, o = () => a === null ? e.tryPro
162
176
  }).pipe(h("topN")),
163
177
  ...c === void 0 ? {} : { mirror: c }
164
178
  };
165
- }, T = (t, i) => e.gen(function* () {
179
+ }, E = (t, i) => e.gen(function* () {
166
180
  if (t.conn !== null) return;
167
181
  let a = yield* o(), s = yield* e.tryPromise({
168
182
  try: async () => {
@@ -179,7 +193,7 @@ var r = "duckdb", i = "voltro_events", a = null, o = () => a === null ? e.tryPro
179
193
  })
180
194
  });
181
195
  t.instance = s.instance, t.conn = s.connection;
182
- }), E = (t) => e.gen(function* () {
196
+ }), D = (t) => e.gen(function* () {
183
197
  let { conn: n, instance: i } = t;
184
198
  t.conn = null, t.instance = null, !(n === null && i === null) && (yield* e.try(() => {
185
199
  n?.closeSync(), i?.closeSync();
@@ -187,17 +201,17 @@ var r = "duckdb", i = "voltro_events", a = null, o = () => a === null ? e.tryPro
187
201
  provider: r,
188
202
  err: t
189
203
  }))));
190
- }), D = (e = {}) => {
204
+ }), O = (e = {}) => {
191
205
  let t = {
192
206
  conn: null,
193
207
  instance: null
194
208
  };
195
209
  return {
196
210
  kind: "duckdb",
197
- build: (n) => w(t, e),
198
- initialize: () => T(t, e),
199
- dispose: () => E(t)
211
+ build: (n) => T(t, e),
212
+ initialize: () => E(t, e),
213
+ dispose: () => D(t)
200
214
  };
201
215
  };
202
216
  //#endregion
203
- export { D as duckdbAnalytics };
217
+ export { O as duckdbAnalytics };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-duckdb",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "description": "Embedded DuckDB AnalyticsSink. Runs DuckDB in-process for real OLAP performance without an external service. Events land in a DuckDB column-store table; aggregate / timeseries / topN queries execute vectorized.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -22,7 +22,8 @@
22
22
  "types": "./dist/index.d.ts",
23
23
  "import": "./dist/index.js",
24
24
  "default": "./dist/index.js"
25
- }
25
+ },
26
+ "./package.json": "./package.json"
26
27
  },
27
28
  "main": "./dist/index.js",
28
29
  "module": "./dist/index.js",
@@ -32,7 +33,7 @@
32
33
  "node": ">=24.0.0"
33
34
  },
34
35
  "dependencies": {
35
- "@voltro/runtime": "0.32.0"
36
+ "@voltro/runtime": "0.34.0"
36
37
  },
37
38
  "optionalDependencies": {
38
39
  "@duckdb/node-api": "1.5.5-r.2"