sensemaking 0.18.2 → 0.18.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.
Files changed (179) hide show
  1. package/dist/cjs/cli/status.js +32 -31
  2. package/dist/cjs/cli/status.js.map +1 -1
  3. package/dist/cjs/commands/map.js +50 -67
  4. package/dist/cjs/commands/map.js.map +1 -1
  5. package/dist/cjs/config/access.d.cts +2 -2
  6. package/dist/cjs/config/access.d.ts +2 -2
  7. package/dist/cjs/config/access.js.map +1 -1
  8. package/dist/cjs/config/index.d.cts +1 -1
  9. package/dist/cjs/config/index.d.ts +1 -1
  10. package/dist/cjs/config/index.js.map +1 -1
  11. package/dist/cjs/config/load.js +3 -2
  12. package/dist/cjs/config/load.js.map +1 -1
  13. package/dist/cjs/config/types.d.cts +2 -1
  14. package/dist/cjs/config/types.d.ts +2 -1
  15. package/dist/cjs/config/types.js.map +1 -1
  16. package/dist/cjs/config/validate.js +3 -0
  17. package/dist/cjs/config/validate.js.map +1 -1
  18. package/dist/cjs/embed/identity.js +3 -2
  19. package/dist/cjs/embed/identity.js.map +1 -1
  20. package/dist/cjs/embed/store.js +3 -3
  21. package/dist/cjs/embed/store.js.map +1 -1
  22. package/dist/cjs/index.d.cts +2 -2
  23. package/dist/cjs/index.d.ts +2 -2
  24. package/dist/cjs/index.js.map +1 -1
  25. package/dist/cjs/lib/atomic-write.d.cts +1 -0
  26. package/dist/cjs/lib/atomic-write.d.ts +1 -0
  27. package/dist/cjs/lib/atomic-write.js +26 -0
  28. package/dist/cjs/lib/atomic-write.js.map +1 -0
  29. package/dist/cjs/store/duckdb/batch.js +3 -2
  30. package/dist/cjs/store/duckdb/batch.js.map +1 -1
  31. package/dist/cjs/store/duckdb/connection.js +12 -0
  32. package/dist/cjs/store/duckdb/connection.js.map +1 -1
  33. package/dist/cjs/store/duckdb/fieldStats.d.cts +2 -0
  34. package/dist/cjs/store/duckdb/fieldStats.d.ts +2 -0
  35. package/dist/cjs/store/duckdb/fieldStats.js +219 -0
  36. package/dist/cjs/store/duckdb/fieldStats.js.map +1 -0
  37. package/dist/cjs/store/duckdb/lexical.js +16 -9
  38. package/dist/cjs/store/duckdb/lexical.js.map +1 -1
  39. package/dist/cjs/store/duckdb/native.d.cts +0 -1
  40. package/dist/cjs/store/duckdb/native.d.ts +0 -1
  41. package/dist/cjs/store/duckdb/native.js +7 -336
  42. package/dist/cjs/store/duckdb/native.js.map +1 -1
  43. package/dist/cjs/store/duckdb/sql-functions.js +1 -1
  44. package/dist/cjs/store/duckdb/sql-functions.js.map +1 -1
  45. package/dist/cjs/store/duckdb/store.js +16 -1
  46. package/dist/cjs/store/duckdb/store.js.map +1 -1
  47. package/dist/cjs/store/duckdb/vectors.js +5 -17
  48. package/dist/cjs/store/duckdb/vectors.js.map +1 -1
  49. package/dist/cjs/store/index.js +6 -0
  50. package/dist/cjs/store/index.js.map +1 -1
  51. package/dist/cjs/store/native.d.cts +7 -0
  52. package/dist/cjs/store/native.d.ts +7 -0
  53. package/dist/cjs/store/native.js +350 -0
  54. package/dist/cjs/store/native.js.map +1 -0
  55. package/dist/cjs/store/sqlite/fieldStats.d.cts +2 -0
  56. package/dist/cjs/store/sqlite/fieldStats.d.ts +2 -0
  57. package/dist/cjs/store/sqlite/fieldStats.js +201 -0
  58. package/dist/cjs/store/sqlite/fieldStats.js.map +1 -0
  59. package/dist/cjs/store/sqlite/open.js +82 -29
  60. package/dist/cjs/store/sqlite/open.js.map +1 -1
  61. package/dist/cjs/store/sqlite/store.js +32 -4
  62. package/dist/cjs/store/sqlite/store.js.map +1 -1
  63. package/dist/cjs/store/sqlite/vectors.d.cts +0 -5
  64. package/dist/cjs/store/sqlite/vectors.d.ts +0 -5
  65. package/dist/cjs/store/sqlite/vectors.js +5 -71
  66. package/dist/cjs/store/sqlite/vectors.js.map +1 -1
  67. package/dist/cjs/store/turso/connection.d.cts +3 -0
  68. package/dist/cjs/store/turso/connection.d.ts +3 -0
  69. package/dist/cjs/store/turso/connection.js +529 -0
  70. package/dist/cjs/store/turso/connection.js.map +1 -0
  71. package/dist/cjs/store/turso/fieldStats.d.cts +2 -0
  72. package/dist/cjs/store/turso/fieldStats.d.ts +2 -0
  73. package/dist/cjs/store/turso/fieldStats.js +201 -0
  74. package/dist/cjs/store/turso/fieldStats.js.map +1 -0
  75. package/dist/cjs/store/turso/native.d.cts +2 -0
  76. package/dist/cjs/store/turso/native.d.ts +2 -0
  77. package/dist/cjs/store/turso/native.js +31 -0
  78. package/dist/cjs/store/turso/native.js.map +1 -0
  79. package/dist/cjs/store/turso/open.d.cts +12 -0
  80. package/dist/cjs/store/turso/open.d.ts +12 -0
  81. package/dist/cjs/store/turso/open.js +500 -0
  82. package/dist/cjs/store/turso/open.js.map +1 -0
  83. package/dist/cjs/store/turso/reconcile.d.cts +6 -0
  84. package/dist/cjs/store/turso/reconcile.d.ts +6 -0
  85. package/dist/cjs/store/turso/reconcile.js +793 -0
  86. package/dist/cjs/store/turso/reconcile.js.map +1 -0
  87. package/dist/cjs/store/turso/store.d.cts +5 -0
  88. package/dist/cjs/store/turso/store.d.ts +5 -0
  89. package/dist/cjs/store/turso/store.js +609 -0
  90. package/dist/cjs/store/turso/store.js.map +1 -0
  91. package/dist/cjs/store/types.d.cts +9 -1
  92. package/dist/cjs/store/types.d.ts +9 -1
  93. package/dist/cjs/store/types.js +0 -7
  94. package/dist/cjs/store/types.js.map +1 -1
  95. package/dist/cjs/store/vectors.d.cts +9 -0
  96. package/dist/cjs/store/vectors.d.ts +9 -0
  97. package/dist/cjs/store/vectors.js +215 -0
  98. package/dist/cjs/store/vectors.js.map +1 -0
  99. package/dist/esm/cli/status.js +5 -7
  100. package/dist/esm/cli/status.js.map +1 -1
  101. package/dist/esm/commands/map.js +7 -19
  102. package/dist/esm/commands/map.js.map +1 -1
  103. package/dist/esm/config/access.d.ts +2 -2
  104. package/dist/esm/config/access.js.map +1 -1
  105. package/dist/esm/config/index.d.ts +1 -1
  106. package/dist/esm/config/index.js.map +1 -1
  107. package/dist/esm/config/load.js +4 -3
  108. package/dist/esm/config/load.js.map +1 -1
  109. package/dist/esm/config/types.d.ts +2 -1
  110. package/dist/esm/config/types.js.map +1 -1
  111. package/dist/esm/config/validate.js +3 -0
  112. package/dist/esm/config/validate.js.map +1 -1
  113. package/dist/esm/embed/identity.js +4 -3
  114. package/dist/esm/embed/identity.js.map +1 -1
  115. package/dist/esm/embed/store.js +3 -3
  116. package/dist/esm/embed/store.js.map +1 -1
  117. package/dist/esm/index.d.ts +2 -2
  118. package/dist/esm/index.js.map +1 -1
  119. package/dist/esm/lib/atomic-write.d.ts +1 -0
  120. package/dist/esm/lib/atomic-write.js +17 -0
  121. package/dist/esm/lib/atomic-write.js.map +1 -0
  122. package/dist/esm/store/duckdb/batch.js +3 -2
  123. package/dist/esm/store/duckdb/batch.js.map +1 -1
  124. package/dist/esm/store/duckdb/connection.js +12 -0
  125. package/dist/esm/store/duckdb/connection.js.map +1 -1
  126. package/dist/esm/store/duckdb/fieldStats.d.ts +2 -0
  127. package/dist/esm/store/duckdb/fieldStats.js +39 -0
  128. package/dist/esm/store/duckdb/fieldStats.js.map +1 -0
  129. package/dist/esm/store/duckdb/lexical.js +19 -9
  130. package/dist/esm/store/duckdb/lexical.js.map +1 -1
  131. package/dist/esm/store/duckdb/native.d.ts +0 -1
  132. package/dist/esm/store/duckdb/native.js +7 -84
  133. package/dist/esm/store/duckdb/native.js.map +1 -1
  134. package/dist/esm/store/duckdb/sql-functions.js +1 -1
  135. package/dist/esm/store/duckdb/sql-functions.js.map +1 -1
  136. package/dist/esm/store/duckdb/store.js +8 -5
  137. package/dist/esm/store/duckdb/store.js.map +1 -1
  138. package/dist/esm/store/duckdb/vectors.js +2 -12
  139. package/dist/esm/store/duckdb/vectors.js.map +1 -1
  140. package/dist/esm/store/index.js +6 -0
  141. package/dist/esm/store/index.js.map +1 -1
  142. package/dist/esm/store/native.d.ts +7 -0
  143. package/dist/esm/store/native.js +83 -0
  144. package/dist/esm/store/native.js.map +1 -0
  145. package/dist/esm/store/sqlite/fieldStats.d.ts +2 -0
  146. package/dist/esm/store/sqlite/fieldStats.js +25 -0
  147. package/dist/esm/store/sqlite/fieldStats.js.map +1 -0
  148. package/dist/esm/store/sqlite/open.js +21 -8
  149. package/dist/esm/store/sqlite/open.js.map +1 -1
  150. package/dist/esm/store/sqlite/store.js +14 -1
  151. package/dist/esm/store/sqlite/store.js.map +1 -1
  152. package/dist/esm/store/sqlite/vectors.d.ts +0 -5
  153. package/dist/esm/store/sqlite/vectors.js +2 -22
  154. package/dist/esm/store/sqlite/vectors.js.map +1 -1
  155. package/dist/esm/store/turso/connection.d.ts +3 -0
  156. package/dist/esm/store/turso/connection.js +52 -0
  157. package/dist/esm/store/turso/connection.js.map +1 -0
  158. package/dist/esm/store/turso/fieldStats.d.ts +2 -0
  159. package/dist/esm/store/turso/fieldStats.js +24 -0
  160. package/dist/esm/store/turso/fieldStats.js.map +1 -0
  161. package/dist/esm/store/turso/native.d.ts +2 -0
  162. package/dist/esm/store/turso/native.js +19 -0
  163. package/dist/esm/store/turso/native.js.map +1 -0
  164. package/dist/esm/store/turso/open.d.ts +12 -0
  165. package/dist/esm/store/turso/open.js +113 -0
  166. package/dist/esm/store/turso/open.js.map +1 -0
  167. package/dist/esm/store/turso/reconcile.d.ts +6 -0
  168. package/dist/esm/store/turso/reconcile.js +158 -0
  169. package/dist/esm/store/turso/reconcile.js.map +1 -0
  170. package/dist/esm/store/turso/store.d.ts +5 -0
  171. package/dist/esm/store/turso/store.js +93 -0
  172. package/dist/esm/store/turso/store.js.map +1 -0
  173. package/dist/esm/store/types.d.ts +9 -1
  174. package/dist/esm/store/types.js +0 -7
  175. package/dist/esm/store/types.js.map +1 -1
  176. package/dist/esm/store/vectors.d.ts +9 -0
  177. package/dist/esm/store/vectors.js +26 -0
  178. package/dist/esm/store/vectors.js.map +1 -0
  179. package/package.json +2 -1
@@ -0,0 +1,529 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createConnection", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createConnection;
9
+ }
10
+ });
11
+ var _transactionts = require("../transaction.js");
12
+ function _array_like_to_array(arr, len) {
13
+ if (len == null || len > arr.length) len = arr.length;
14
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
15
+ return arr2;
16
+ }
17
+ function _array_without_holes(arr) {
18
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
19
+ }
20
+ function _async_generator(gen) {
21
+ var front, back;
22
+ function send(key, arg) {
23
+ return new Promise(function(resolve, reject) {
24
+ var request = {
25
+ key: key,
26
+ arg: arg,
27
+ resolve: resolve,
28
+ reject: reject,
29
+ next: null
30
+ };
31
+ if (back) back = back.next = request;
32
+ else {
33
+ front = back = request;
34
+ resume(key, arg);
35
+ }
36
+ });
37
+ }
38
+ function resume(key, arg) {
39
+ try {
40
+ var result = gen[key](arg);
41
+ var value = result.value;
42
+ var overloaded = value instanceof _overload_yield;
43
+ Promise.resolve(overloaded ? value.v : value).then(function(arg) {
44
+ if (overloaded) {
45
+ var nextKey = key === "return" ? "return" : "next";
46
+ if (!value.k || arg.done) return resume(nextKey, arg);
47
+ else arg = gen[nextKey](arg).value;
48
+ }
49
+ settle(result.done ? "return" : "normal", arg);
50
+ }, function(err) {
51
+ resume("throw", err);
52
+ });
53
+ } catch (err) {
54
+ settle("throw", err);
55
+ }
56
+ }
57
+ function settle(type, value) {
58
+ switch(type){
59
+ case "return":
60
+ front.resolve({
61
+ value: value,
62
+ done: true
63
+ });
64
+ break;
65
+ case "throw":
66
+ front.reject(value);
67
+ break;
68
+ default:
69
+ front.resolve({
70
+ value: value,
71
+ done: false
72
+ });
73
+ break;
74
+ }
75
+ front = front.next;
76
+ if (front) resume(front.key, front.arg);
77
+ else back = null;
78
+ }
79
+ this._invoke = send;
80
+ if (typeof gen.return !== "function") this.return = undefined;
81
+ }
82
+ _async_generator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function() {
83
+ return this;
84
+ };
85
+ _async_generator.prototype.next = function(arg) {
86
+ return this._invoke("next", arg);
87
+ };
88
+ _async_generator.prototype.throw = function(arg) {
89
+ return this._invoke("throw", arg);
90
+ };
91
+ _async_generator.prototype.return = function(arg) {
92
+ return this._invoke("return", arg);
93
+ };
94
+ function _async_generator_delegate(inner) {
95
+ var iter = {}, waiting = false;
96
+ function pump(key, value) {
97
+ waiting = true;
98
+ value = new Promise(function(resolve) {
99
+ resolve(inner[key](value));
100
+ });
101
+ return {
102
+ done: false,
103
+ value: new _overload_yield(value, 1)
104
+ };
105
+ }
106
+ iter[typeof Symbol !== "undefined" && Symbol.iterator || "@@iterator"] = function() {
107
+ return this;
108
+ };
109
+ iter.next = function(value) {
110
+ if (waiting) {
111
+ waiting = false;
112
+ return value;
113
+ }
114
+ return pump("next", value);
115
+ };
116
+ if (typeof inner.throw === "function") {
117
+ iter.throw = function(value) {
118
+ if (waiting) {
119
+ waiting = false;
120
+ throw value;
121
+ }
122
+ return pump("throw", value);
123
+ };
124
+ }
125
+ if (typeof inner.return === "function") {
126
+ iter.return = function(value) {
127
+ if (waiting) {
128
+ waiting = false;
129
+ return value;
130
+ }
131
+ return pump("return", value);
132
+ };
133
+ }
134
+ return iter;
135
+ }
136
+ function _async_iterator(iterable) {
137
+ var method, async, sync, retry = 2;
138
+ for("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;){
139
+ if (async && null != (method = iterable[async])) return method.call(iterable);
140
+ if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
141
+ async = "@@asyncIterator", sync = "@@iterator";
142
+ }
143
+ throw new TypeError("Object is not async iterable");
144
+ }
145
+ function AsyncFromSyncIterator(s) {
146
+ function AsyncFromSyncIteratorContinuation(r) {
147
+ if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
148
+ var done = r.done;
149
+ return Promise.resolve(r.value).then(function(value) {
150
+ return {
151
+ value: value,
152
+ done: done
153
+ };
154
+ });
155
+ }
156
+ return AsyncFromSyncIterator = function(s) {
157
+ this.s = s, this.n = s.next;
158
+ }, AsyncFromSyncIterator.prototype = {
159
+ s: null,
160
+ n: null,
161
+ next: function() {
162
+ return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
163
+ },
164
+ return: function(value) {
165
+ var ret = this.s.return;
166
+ return void 0 === ret ? Promise.resolve({
167
+ value: value,
168
+ done: !0
169
+ }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
170
+ },
171
+ throw: function(value) {
172
+ var thr = this.s.return;
173
+ return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
174
+ }
175
+ }, new AsyncFromSyncIterator(s);
176
+ }
177
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
178
+ try {
179
+ var info = gen[key](arg);
180
+ var value = info.value;
181
+ } catch (error) {
182
+ reject(error);
183
+ return;
184
+ }
185
+ if (info.done) resolve(value);
186
+ else Promise.resolve(value).then(_next, _throw);
187
+ }
188
+ function _async_to_generator(fn) {
189
+ return function() {
190
+ var self = this, args = arguments;
191
+ return new Promise(function(resolve, reject) {
192
+ var gen = fn.apply(self, args);
193
+ function _next(value) {
194
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
195
+ }
196
+ function _throw(err) {
197
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
198
+ }
199
+ _next(undefined);
200
+ });
201
+ };
202
+ }
203
+ function _class_call_check(instance, Constructor) {
204
+ if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
205
+ }
206
+ function _iterable_to_array(iter) {
207
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
208
+ return Array.from(iter);
209
+ }
210
+ }
211
+ function _non_iterable_spread() {
212
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
213
+ }
214
+ function _overload_yield(value, kind) {
215
+ this.v = value;
216
+ this.k = kind;
217
+ }
218
+ function _to_consumable_array(arr) {
219
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
220
+ }
221
+ function _ts_generator(thisArg, body) {
222
+ var f, y, t, _ = {
223
+ label: 0,
224
+ sent: function() {
225
+ if (t[0] & 1) throw t[1];
226
+ return t[1];
227
+ },
228
+ trys: [],
229
+ ops: []
230
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
231
+ return d(g, "next", {
232
+ value: verb(0)
233
+ }), d(g, "throw", {
234
+ value: verb(1)
235
+ }), d(g, "return", {
236
+ value: verb(2)
237
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
238
+ value: function() {
239
+ return this;
240
+ }
241
+ }), g;
242
+ function verb(n) {
243
+ return function(v) {
244
+ return step([
245
+ n,
246
+ v
247
+ ]);
248
+ };
249
+ }
250
+ function step(op) {
251
+ if (f) throw new TypeError("Generator is already executing.");
252
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
253
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
254
+ if (y = 0, t) op = [
255
+ op[0] & 2,
256
+ t.value
257
+ ];
258
+ switch(op[0]){
259
+ case 0:
260
+ case 1:
261
+ t = op;
262
+ break;
263
+ case 4:
264
+ _.label++;
265
+ return {
266
+ value: op[1],
267
+ done: false
268
+ };
269
+ case 5:
270
+ _.label++;
271
+ y = op[1];
272
+ op = [
273
+ 0
274
+ ];
275
+ continue;
276
+ case 7:
277
+ op = _.ops.pop();
278
+ _.trys.pop();
279
+ continue;
280
+ default:
281
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
282
+ _ = 0;
283
+ continue;
284
+ }
285
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
286
+ _.label = op[1];
287
+ break;
288
+ }
289
+ if (op[0] === 6 && _.label < t[1]) {
290
+ _.label = t[1];
291
+ t = op;
292
+ break;
293
+ }
294
+ if (t && _.label < t[2]) {
295
+ _.label = t[2];
296
+ _.ops.push(op);
297
+ break;
298
+ }
299
+ if (t[2]) _.ops.pop();
300
+ _.trys.pop();
301
+ continue;
302
+ }
303
+ op = body.call(thisArg, _);
304
+ } catch (e) {
305
+ op = [
306
+ 6,
307
+ e
308
+ ];
309
+ y = 0;
310
+ } finally{
311
+ f = t = 0;
312
+ }
313
+ if (op[0] & 5) throw op[1];
314
+ return {
315
+ value: op[0] ? op[1] : void 0,
316
+ done: true
317
+ };
318
+ }
319
+ }
320
+ function _ts_values(o) {
321
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
322
+ if (m) {
323
+ return m.call(o);
324
+ }
325
+ if (o && typeof o.length === "number") {
326
+ return {
327
+ next: function() {
328
+ if (o && i >= o.length) {
329
+ o = void 0;
330
+ }
331
+ return {
332
+ value: o && o[i++],
333
+ done: !o
334
+ };
335
+ }
336
+ };
337
+ }
338
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
339
+ }
340
+ function _unsupported_iterable_to_array(o, minLen) {
341
+ if (!o) return;
342
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
343
+ var n = Object.prototype.toString.call(o).slice(8, -1);
344
+ if (n === "Object" && o.constructor) n = o.constructor.name;
345
+ if (n === "Map" || n === "Set") return Array.from(n);
346
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
347
+ }
348
+ function _wrap_async_generator(fn) {
349
+ return function() {
350
+ return new _async_generator(fn.apply(this, arguments));
351
+ };
352
+ }
353
+ // Turso's client is async end to end (no synchronous escape hatch like node:sqlite's), so this
354
+ // wraps it in the same Connection/Statement shape 1:1, no sync-over-async and no worker bridge.
355
+ var TursoStatementWrapper = /*#__PURE__*/ function() {
356
+ "use strict";
357
+ function TursoStatementWrapper(stmt) {
358
+ _class_call_check(this, TursoStatementWrapper);
359
+ this.stmt = stmt;
360
+ }
361
+ var _proto = TursoStatementWrapper.prototype;
362
+ _proto.run = function run() {
363
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
364
+ params[_key] = arguments[_key];
365
+ }
366
+ return _async_to_generator(function() {
367
+ var _this_stmt;
368
+ return _ts_generator(this, function(_state) {
369
+ return [
370
+ 2,
371
+ (_this_stmt = this.stmt).run.apply(_this_stmt, _to_consumable_array(params))
372
+ ];
373
+ });
374
+ }).call(this);
375
+ };
376
+ _proto.get = function get() {
377
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
378
+ params[_key] = arguments[_key];
379
+ }
380
+ return _async_to_generator(function() {
381
+ var _this_stmt;
382
+ return _ts_generator(this, function(_state) {
383
+ return [
384
+ 2,
385
+ (_this_stmt = this.stmt).get.apply(_this_stmt, _to_consumable_array(params))
386
+ ];
387
+ });
388
+ }).call(this);
389
+ };
390
+ _proto.all = function all() {
391
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
392
+ params[_key] = arguments[_key];
393
+ }
394
+ return _async_to_generator(function() {
395
+ var _this_stmt;
396
+ return _ts_generator(this, function(_state) {
397
+ return [
398
+ 2,
399
+ (_this_stmt = this.stmt).all.apply(_this_stmt, _to_consumable_array(params))
400
+ ];
401
+ });
402
+ }).call(this);
403
+ };
404
+ _proto.iterate = function iterate() {
405
+ for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
406
+ params[_key] = arguments[_key];
407
+ }
408
+ return _wrap_async_generator(function() {
409
+ var _this_stmt;
410
+ return _ts_generator(this, function(_state) {
411
+ switch(_state.label){
412
+ case 0:
413
+ return [
414
+ 5,
415
+ _ts_values(_async_generator_delegate(_async_iterator((_this_stmt = this.stmt).iterate.apply(_this_stmt, _to_consumable_array(params)))))
416
+ ];
417
+ case 1:
418
+ _state.sent();
419
+ return [
420
+ 2
421
+ ];
422
+ }
423
+ });
424
+ }).call(this);
425
+ };
426
+ _proto.columns = function columns() {
427
+ return this.stmt.columns();
428
+ };
429
+ _proto.setReadBigInts = function setReadBigInts(enabled) {
430
+ this.stmt.safeIntegers(enabled);
431
+ };
432
+ return TursoStatementWrapper;
433
+ }();
434
+ function createConnection(db) {
435
+ var conn = {
436
+ exec: function exec(sql) {
437
+ return _async_to_generator(function() {
438
+ return _ts_generator(this, function(_state) {
439
+ switch(_state.label){
440
+ case 0:
441
+ return [
442
+ 4,
443
+ db.exec(sql)
444
+ ];
445
+ case 1:
446
+ _state.sent();
447
+ return [
448
+ 2
449
+ ];
450
+ }
451
+ });
452
+ })();
453
+ },
454
+ prepare: function prepare(sql) {
455
+ return _async_to_generator(function() {
456
+ var _;
457
+ return _ts_generator(this, function(_state) {
458
+ switch(_state.label){
459
+ case 0:
460
+ _ = TursoStatementWrapper.bind;
461
+ return [
462
+ 4,
463
+ db.prepare(sql)
464
+ ];
465
+ case 1:
466
+ return [
467
+ 2,
468
+ new (_.apply(TursoStatementWrapper, [
469
+ void 0,
470
+ _state.sent()
471
+ ]))
472
+ ];
473
+ }
474
+ });
475
+ })();
476
+ },
477
+ runBatch: // db.batch() is the engine's own bulk idiom: one crossing, N rows, each row its own
478
+ // statement (no 32k bind-variable ceiling to chunk around, unlike a single giant statement).
479
+ // Spike-confirmed: batch() joins an already-open exec-level BEGIN rather than erroring, and a
480
+ // literal nested BEGIN hard-errors ("cannot start a transaction within a transaction"), so
481
+ // the shared withTransaction join-not-savepoint helper is what makes this safe to call both
482
+ // standalone and inside reconcile's own transaction.
483
+ function runBatch(sql, paramRows) {
484
+ return _async_to_generator(function() {
485
+ return _ts_generator(this, function(_state) {
486
+ switch(_state.label){
487
+ case 0:
488
+ if (paramRows.length === 0) return [
489
+ 2
490
+ ];
491
+ return [
492
+ 4,
493
+ (0, _transactionts.withTransaction)(conn, function() {
494
+ return _async_to_generator(function() {
495
+ return _ts_generator(this, function(_state) {
496
+ switch(_state.label){
497
+ case 0:
498
+ return [
499
+ 4,
500
+ db.batch(paramRows.map(function(args) {
501
+ return {
502
+ sql: sql,
503
+ args: args
504
+ };
505
+ }))
506
+ ];
507
+ case 1:
508
+ _state.sent();
509
+ return [
510
+ 2
511
+ ];
512
+ }
513
+ });
514
+ })();
515
+ })
516
+ ];
517
+ case 1:
518
+ _state.sent();
519
+ return [
520
+ 2
521
+ ];
522
+ }
523
+ });
524
+ })();
525
+ }
526
+ };
527
+ return conn;
528
+ }
529
+ /* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/store/turso/connection.ts"],"sourcesContent":["import type { Database } from '@tursodatabase/database';\nimport { withTransaction } from '../transaction.ts';\nimport type { Connection, RunResult, Statement } from '../types.ts';\n\n// The client's own Statement class isn't re-exported by name from '@tursodatabase/database'\n// (it lives on @tursodatabase/database-common, a transitive dependency), so its type is derived\n// structurally from Database.prepare()'s return type rather than imported by name.\ntype TursoStatement = Awaited<ReturnType<Database['prepare']>>;\n\n// Turso's client is async end to end (no synchronous escape hatch like node:sqlite's), so this\n// wraps it in the same Connection/Statement shape 1:1, no sync-over-async and no worker bridge.\nclass TursoStatementWrapper implements Statement {\n private stmt: TursoStatement;\n\n constructor(stmt: TursoStatement) {\n this.stmt = stmt;\n }\n\n async run(...params: unknown[]): Promise<RunResult> {\n return this.stmt.run(...params);\n }\n\n async get(...params: unknown[]): Promise<unknown> {\n return this.stmt.get(...params);\n }\n\n async all(...params: unknown[]): Promise<unknown[]> {\n return this.stmt.all(...params);\n }\n\n async *iterate(...params: unknown[]): AsyncIterable<unknown> {\n yield* this.stmt.iterate(...params);\n }\n\n columns(): Array<{ name: string }> {\n return this.stmt.columns();\n }\n\n setReadBigInts(enabled: boolean): void {\n this.stmt.safeIntegers(enabled);\n }\n}\n\nexport function createConnection(db: Database): Connection {\n const conn: Connection = {\n async exec(sql: string): Promise<void> {\n await db.exec(sql);\n },\n async prepare(sql: string): Promise<Statement> {\n return new TursoStatementWrapper(await db.prepare(sql));\n },\n // db.batch() is the engine's own bulk idiom: one crossing, N rows, each row its own\n // statement (no 32k bind-variable ceiling to chunk around, unlike a single giant statement).\n // Spike-confirmed: batch() joins an already-open exec-level BEGIN rather than erroring, and a\n // literal nested BEGIN hard-errors (\"cannot start a transaction within a transaction\"), so\n // the shared withTransaction join-not-savepoint helper is what makes this safe to call both\n // standalone and inside reconcile's own transaction.\n async runBatch(sql: string, paramRows: unknown[][]): Promise<void> {\n if (paramRows.length === 0) return;\n await withTransaction(conn, async () => {\n await db.batch(paramRows.map((args) => ({ sql, args })));\n });\n },\n };\n return conn;\n}\n"],"names":["createConnection","TursoStatementWrapper","stmt","run","params","get","all","iterate","columns","setReadBigInts","enabled","safeIntegers","db","conn","exec","sql","prepare","runBatch","paramRows","length","withTransaction","batch","map","args"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import type { Connection, FieldStat } from '../types.js';
2
+ export declare function fieldStats(conn: Connection, columns: string[], scopeWhere: string): Promise<FieldStat[]>;
@@ -0,0 +1,2 @@
1
+ import type { Connection, FieldStat } from '../types.js';
2
+ export declare function fieldStats(conn: Connection, columns: string[], scopeWhere: string): Promise<FieldStat[]>;