wn-turso 0.1.0 → 0.2.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.
Files changed (104) hide show
  1. package/README.md +385 -0
  2. package/dist/adapters.d.ts +2 -0
  3. package/dist/adapters.js +5 -0
  4. package/dist/cli/index.d.ts +1 -6
  5. package/dist/cli/index.js +27 -34
  6. package/dist/config.d.ts +2 -77
  7. package/dist/config.js +25 -35
  8. package/dist/database.d.ts +2 -0
  9. package/dist/database.js +8 -0
  10. package/dist/embedded-adapter-aWF095Qo.js +92 -0
  11. package/dist/index.d.ts +2 -11
  12. package/dist/index.js +96 -15
  13. package/dist/pipeline-builder-ERaxT48h.js +275 -0
  14. package/dist/pipeline.d.ts +2 -0
  15. package/dist/pipeline.js +189 -0
  16. package/dist/{adapters → src/adapters}/adapter.d.ts +2 -5
  17. package/dist/src/adapters/adapter.d.ts.map +1 -0
  18. package/dist/{adapters → src/adapters}/embedded-adapter.d.ts +3 -6
  19. package/dist/src/adapters/embedded-adapter.d.ts.map +1 -0
  20. package/dist/src/adapters/index.d.ts.map +1 -0
  21. package/dist/{adapters → src/adapters}/remote-adapter.d.ts +3 -7
  22. package/dist/src/adapters/remote-adapter.d.ts.map +1 -0
  23. package/dist/src/cli/index.d.ts +6 -0
  24. package/dist/{cli → src/cli}/index.d.ts.map +1 -1
  25. package/dist/src/config.d.ts +74 -0
  26. package/dist/src/config.d.ts.map +1 -0
  27. package/dist/src/database/index.d.ts.map +1 -0
  28. package/dist/{database → src/database}/kysely-query-service.d.ts +2 -5
  29. package/dist/src/database/kysely-query-service.d.ts.map +1 -0
  30. package/dist/{database → src/database}/turso-connection.d.ts +2 -5
  31. package/dist/src/database/turso-connection.d.ts.map +1 -0
  32. package/dist/{database → src/database}/turso-database.d.ts +3 -6
  33. package/dist/src/database/turso-database.d.ts.map +1 -0
  34. package/dist/{database → src/database}/turso-dialect.d.ts +3 -6
  35. package/dist/src/database/turso-dialect.d.ts.map +1 -0
  36. package/dist/{database → src/database}/turso-driver.d.ts +2 -5
  37. package/dist/src/database/turso-driver.d.ts.map +1 -0
  38. package/dist/src/index.d.ts +11 -0
  39. package/dist/src/index.d.ts.map +1 -0
  40. package/dist/src/pipeline/index.d.ts.map +1 -0
  41. package/dist/{pipeline → src/pipeline}/operators.d.ts +3 -6
  42. package/dist/src/pipeline/operators.d.ts.map +1 -0
  43. package/dist/{pipeline → src/pipeline}/pipeline-builder.d.ts +12 -6
  44. package/dist/src/pipeline/pipeline-builder.d.ts.map +1 -0
  45. package/dist/src/pipeline/sink.d.ts +25 -0
  46. package/dist/src/pipeline/sink.d.ts.map +1 -0
  47. package/dist/src/pipeline/source.d.ts +23 -0
  48. package/dist/src/pipeline/source.d.ts.map +1 -0
  49. package/dist/src/pipeline/streams.d.ts +19 -0
  50. package/dist/src/pipeline/streams.d.ts.map +1 -0
  51. package/dist/{pipeline → src/pipeline}/types.d.ts +15 -7
  52. package/dist/src/pipeline/types.d.ts.map +1 -0
  53. package/dist/src/wordnet/index.d.ts.map +1 -0
  54. package/dist/{wordnet → src/wordnet}/turso-wordnet.d.ts +3 -7
  55. package/dist/src/wordnet/turso-wordnet.d.ts.map +1 -0
  56. package/dist/turso-database-CNWM_LV6.js +1669 -0
  57. package/package.json +14 -12
  58. package/dist/adapters/adapter.d.ts.map +0 -1
  59. package/dist/adapters/adapter.js +0 -4
  60. package/dist/adapters/embedded-adapter.d.ts.map +0 -1
  61. package/dist/adapters/embedded-adapter.js +0 -78
  62. package/dist/adapters/index.d.ts.map +0 -1
  63. package/dist/adapters/index.js +0 -5
  64. package/dist/adapters/remote-adapter.d.ts.map +0 -1
  65. package/dist/adapters/remote-adapter.js +0 -49
  66. package/dist/config.d.ts.map +0 -1
  67. package/dist/database/index.d.ts.map +0 -1
  68. package/dist/database/index.js +0 -8
  69. package/dist/database/kysely-query-service.d.ts.map +0 -1
  70. package/dist/database/kysely-query-service.js +0 -39
  71. package/dist/database/turso-connection.d.ts.map +0 -1
  72. package/dist/database/turso-connection.js +0 -29
  73. package/dist/database/turso-database.d.ts.map +0 -1
  74. package/dist/database/turso-database.js +0 -124
  75. package/dist/database/turso-dialect.d.ts.map +0 -1
  76. package/dist/database/turso-dialect.js +0 -25
  77. package/dist/database/turso-driver.d.ts.map +0 -1
  78. package/dist/database/turso-driver.js +0 -43
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/pipeline/index.d.ts.map +0 -1
  81. package/dist/pipeline/index.js +0 -13
  82. package/dist/pipeline/operators.d.ts.map +0 -1
  83. package/dist/pipeline/operators.js +0 -174
  84. package/dist/pipeline/pipeline-builder.d.ts.map +0 -1
  85. package/dist/pipeline/pipeline-builder.js +0 -181
  86. package/dist/pipeline/sink.d.ts +0 -22
  87. package/dist/pipeline/sink.d.ts.map +0 -1
  88. package/dist/pipeline/sink.js +0 -63
  89. package/dist/pipeline/source.d.ts +0 -20
  90. package/dist/pipeline/source.d.ts.map +0 -1
  91. package/dist/pipeline/source.js +0 -66
  92. package/dist/pipeline/streams.d.ts +0 -18
  93. package/dist/pipeline/streams.d.ts.map +0 -1
  94. package/dist/pipeline/streams.js +0 -115
  95. package/dist/pipeline/types.d.ts.map +0 -1
  96. package/dist/pipeline/types.js +0 -4
  97. package/dist/wordnet/index.d.ts.map +0 -1
  98. package/dist/wordnet/index.js +0 -4
  99. package/dist/wordnet/turso-wordnet.d.ts.map +0 -1
  100. package/dist/wordnet/turso-wordnet.js +0 -107
  101. /package/dist/{adapters → src/adapters}/index.d.ts +0 -0
  102. /package/dist/{database → src/database}/index.d.ts +0 -0
  103. /package/dist/{pipeline → src/pipeline}/index.d.ts +0 -0
  104. /package/dist/{wordnet → src/wordnet}/index.d.ts +0 -0
@@ -0,0 +1,92 @@
1
+ import { createClient as e } from "@libsql/client";
2
+ class s {
3
+ client;
4
+ connected = !1;
5
+ async initialize(t) {
6
+ if (!t.authToken)
7
+ throw new Error("authToken is required for remote Turso connections");
8
+ this.client = e({
9
+ url: t.url,
10
+ authToken: t.authToken
11
+ }), await this.client.execute("SELECT 1"), this.connected = !0;
12
+ }
13
+ getClient() {
14
+ if (!this.client)
15
+ throw new Error("Adapter not initialized");
16
+ return this.client;
17
+ }
18
+ getInfo() {
19
+ return {
20
+ mode: "remote",
21
+ connected: this.connected
22
+ };
23
+ }
24
+ isConnected() {
25
+ return this.connected;
26
+ }
27
+ async close() {
28
+ this.client && (this.client.close(), this.connected = !1);
29
+ }
30
+ getName() {
31
+ return "remote-turso";
32
+ }
33
+ }
34
+ class c {
35
+ client;
36
+ config;
37
+ connected = !1;
38
+ lastSync;
39
+ syncStatus = "pending";
40
+ async initialize(t) {
41
+ this.config = t, this.client = e({
42
+ url: t.url,
43
+ // Local file path: file:./local.db
44
+ syncUrl: t.syncUrl,
45
+ authToken: t.authToken,
46
+ encryptionKey: t.encryptionKey
47
+ }), t.syncUrl && t.authToken && await this.sync(), this.connected = !0;
48
+ }
49
+ getClient() {
50
+ if (!this.client)
51
+ throw new Error("Adapter not initialized");
52
+ return this.client;
53
+ }
54
+ getInfo() {
55
+ return {
56
+ mode: "embedded",
57
+ connected: this.connected,
58
+ syncStatus: this.syncStatus,
59
+ lastSync: this.lastSync
60
+ };
61
+ }
62
+ isConnected() {
63
+ return this.connected;
64
+ }
65
+ async close() {
66
+ if (this.client) {
67
+ if (this.config?.syncUrl)
68
+ try {
69
+ await this.sync();
70
+ } catch (t) {
71
+ console.warn("Failed to sync before close:", t);
72
+ }
73
+ this.client.close(), this.connected = !1;
74
+ }
75
+ }
76
+ getName() {
77
+ return "embedded-turso";
78
+ }
79
+ async sync() {
80
+ if (!this.client)
81
+ throw new Error("Adapter not initialized");
82
+ try {
83
+ await this.client.sync(), this.lastSync = /* @__PURE__ */ new Date(), this.syncStatus = "synced";
84
+ } catch (t) {
85
+ throw this.syncStatus = "error", t;
86
+ }
87
+ }
88
+ }
89
+ export {
90
+ c as E,
91
+ s as R
92
+ };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,2 @@
1
- /**
2
- * wn-turso - Turso/libsql database backend and data pipeline utilities for WordNet
3
- *
4
- * @packageDocumentation
5
- */
6
- export { TursoWordnet, type TursoWordnetOptions } from './wordnet/index.js';
7
- export { TursoDatabase, TursoQueryService, createTursoDialect, TursoDriver, TursoConnection, type Database, } from './database/index.js';
8
- export { RemoteTursoAdapter, EmbeddedTursoAdapter, type TursoAdapter, type TursoAdapterInfo, } from './adapters/index.js';
9
- export { type TursoDatabaseConfig, type TursoConnectionMode, type SyncConfig, defaultSyncConfig, validateTursoConfig, } from './config.js';
10
- export { Pipeline } from './pipeline/index.js';
11
- //# sourceMappingURL=index.d.ts.map
1
+ export * from './src/index'
2
+ export {}
package/dist/index.js CHANGED
@@ -1,15 +1,96 @@
1
- /**
2
- * wn-turso - Turso/libsql database backend and data pipeline utilities for WordNet
3
- *
4
- * @packageDocumentation
5
- */
6
- // Main WordNet class
7
- export { TursoWordnet } from './wordnet/index.js';
8
- // Database components
9
- export { TursoDatabase, TursoQueryService, createTursoDialect, TursoDriver, TursoConnection, } from './database/index.js';
10
- // Adapters
11
- export { RemoteTursoAdapter, EmbeddedTursoAdapter, } from './adapters/index.js';
12
- // Configuration
13
- export { defaultSyncConfig, validateTursoConfig, } from './config.js';
14
- // Pipeline (re-export from subpath for convenience)
15
- export { Pipeline } from './pipeline/index.js';
1
+ import { T as s } from "./turso-database-CNWM_LV6.js";
2
+ import { d, b as u, a as y, c as h } from "./turso-database-CNWM_LV6.js";
3
+ import { E as b, R as l } from "./embedded-adapter-aWF095Qo.js";
4
+ import { defaultSyncConfig as w, validateTursoConfig as m } from "./config.js";
5
+ import { P as p } from "./pipeline-builder-ERaxT48h.js";
6
+ class n {
7
+ database;
8
+ config;
9
+ constructor(e, t = {}) {
10
+ this.config = e;
11
+ }
12
+ /**
13
+ * Initialize the WordNet connection
14
+ */
15
+ async initialize() {
16
+ this.database = new s(this.config), await this.database.initialize();
17
+ }
18
+ /**
19
+ * Query synsets
20
+ */
21
+ async synsets(e) {
22
+ return this.getQueryService().getSynsets(e);
23
+ }
24
+ /**
25
+ * Query words
26
+ */
27
+ async words(e) {
28
+ return this.getQueryService().getWords(e);
29
+ }
30
+ /**
31
+ * Query senses
32
+ */
33
+ async senses(e) {
34
+ return this.getQueryService().getSenses(e);
35
+ }
36
+ /**
37
+ * Get all lexicons
38
+ */
39
+ async lexicons() {
40
+ return this.getQueryService().getLexicons();
41
+ }
42
+ /**
43
+ * Get lemmas for a synset
44
+ */
45
+ async getSynsetLemmas(e) {
46
+ return (await this.getQueryService().getWordsBySynsetAndLanguage(
47
+ e
48
+ )).map((a) => a.lemma);
49
+ }
50
+ /**
51
+ * Sync embedded replica with remote (only for embedded mode)
52
+ */
53
+ async sync() {
54
+ if (!this.database)
55
+ throw new Error("Not initialized");
56
+ await this.database.sync();
57
+ }
58
+ /**
59
+ * Check if initialized
60
+ */
61
+ isInitialized() {
62
+ return this.database?.isInitialized() ?? !1;
63
+ }
64
+ /**
65
+ * Close the connection
66
+ */
67
+ async close() {
68
+ this.database && (await this.database.close(), this.database = void 0);
69
+ }
70
+ /**
71
+ * Get the underlying database instance
72
+ */
73
+ getDatabase() {
74
+ if (!this.database)
75
+ throw new Error("Not initialized");
76
+ return this.database;
77
+ }
78
+ getQueryService() {
79
+ if (!this.database)
80
+ throw new Error("Not initialized");
81
+ return this.database.getQueryService();
82
+ }
83
+ }
84
+ export {
85
+ b as EmbeddedTursoAdapter,
86
+ p as Pipeline,
87
+ l as RemoteTursoAdapter,
88
+ d as TursoConnection,
89
+ s as TursoDatabase,
90
+ u as TursoDriver,
91
+ y as TursoQueryService,
92
+ n as TursoWordnet,
93
+ h as createTursoDialect,
94
+ w as defaultSyncConfig,
95
+ m as validateTursoConfig
96
+ };
@@ -0,0 +1,275 @@
1
+ function a(s) {
2
+ return async function* (t) {
3
+ for await (const n of t)
4
+ s(n) && (yield n);
5
+ };
6
+ }
7
+ function e(s) {
8
+ return async function* (t) {
9
+ for await (const n of t)
10
+ yield s(n);
11
+ };
12
+ }
13
+ function c(s) {
14
+ return async function* (t) {
15
+ for await (const n of t) {
16
+ const o = s(n);
17
+ o != null && (yield o);
18
+ }
19
+ };
20
+ }
21
+ function u(s) {
22
+ return async function* (t) {
23
+ for await (const n of t) {
24
+ const o = await s(n);
25
+ o != null && (yield o);
26
+ }
27
+ };
28
+ }
29
+ function f(s) {
30
+ return async function* (t) {
31
+ for await (const n of t) {
32
+ const o = s(n);
33
+ yield { ...n, ...o };
34
+ }
35
+ };
36
+ }
37
+ function h(s) {
38
+ return async function* (t) {
39
+ for await (const n of t) {
40
+ const o = await s(n);
41
+ yield { ...n, ...o };
42
+ }
43
+ };
44
+ }
45
+ function w(s) {
46
+ return async function* (t) {
47
+ let n = [];
48
+ for await (const o of t)
49
+ n.push(o), n.length >= s && (yield n, n = []);
50
+ n.length > 0 && (yield n);
51
+ };
52
+ }
53
+ function b() {
54
+ return async function* (s) {
55
+ for await (const t of s)
56
+ for (const n of t)
57
+ yield n;
58
+ };
59
+ }
60
+ function y(s) {
61
+ return async function* (t) {
62
+ for await (const n of t)
63
+ s(n), yield n;
64
+ };
65
+ }
66
+ function p(s) {
67
+ return async function* (t) {
68
+ for await (const n of t)
69
+ await s(n), yield n;
70
+ };
71
+ }
72
+ function l(s) {
73
+ return async function* (t) {
74
+ let n = 0;
75
+ for await (const o of t) {
76
+ if (n >= s) break;
77
+ yield o, n++;
78
+ }
79
+ };
80
+ }
81
+ function d(s) {
82
+ return async function* (t) {
83
+ let n = 0;
84
+ for await (const o of t)
85
+ n >= s && (yield o), n++;
86
+ };
87
+ }
88
+ function m(s) {
89
+ return async function* (t) {
90
+ const n = /* @__PURE__ */ new Set();
91
+ for await (const o of t) {
92
+ const r = s(o);
93
+ n.has(r) || (n.add(r), yield o);
94
+ }
95
+ };
96
+ }
97
+ function A(...s) {
98
+ return (t) => s.reduce((n, o) => o(n), t);
99
+ }
100
+ class i {
101
+ // Internal state uses unknown for type erasure - public API maintains type safety
102
+ source;
103
+ operations = [];
104
+ constructor(t) {
105
+ this.source = t;
106
+ }
107
+ /**
108
+ * Create a new pipeline from a source
109
+ */
110
+ static from(t) {
111
+ return new i(t);
112
+ }
113
+ /**
114
+ * Filter rows based on a predicate
115
+ */
116
+ filter(t) {
117
+ return this.operations.push(
118
+ a(t)
119
+ ), this;
120
+ }
121
+ /**
122
+ * Map rows to a new shape
123
+ */
124
+ map(t) {
125
+ return this.operations.push(e(t)), this;
126
+ }
127
+ /**
128
+ * Transform rows, returning null to skip a row
129
+ */
130
+ transform(t) {
131
+ return this.operations.push(c(t)), this;
132
+ }
133
+ /**
134
+ * Async transform for operations that need to await
135
+ */
136
+ transformAsync(t) {
137
+ return this.operations.push(
138
+ u(t)
139
+ ), this;
140
+ }
141
+ /**
142
+ * Extend rows with additional properties
143
+ * Useful for adding columns to a "working DB" schema
144
+ */
145
+ extend(t) {
146
+ return this.operations.push(
147
+ f(
148
+ t
149
+ )
150
+ ), this;
151
+ }
152
+ /**
153
+ * Async extend for operations that need to await
154
+ */
155
+ extendAsync(t) {
156
+ return this.operations.push(
157
+ h(
158
+ t
159
+ )
160
+ ), this;
161
+ }
162
+ /**
163
+ * Batch rows into arrays
164
+ */
165
+ batch(t) {
166
+ return this.operations.push(w(t)), this;
167
+ }
168
+ /**
169
+ * Side effect for each row (logging, metrics)
170
+ */
171
+ tap(t) {
172
+ return this.operations.push(y(t)), this;
173
+ }
174
+ /**
175
+ * Async side effect
176
+ */
177
+ tapAsync(t) {
178
+ return this.operations.push(p(t)), this;
179
+ }
180
+ /**
181
+ * Take first n rows
182
+ */
183
+ take(t) {
184
+ return this.operations.push(l(t)), this;
185
+ }
186
+ /**
187
+ * Skip first n rows
188
+ */
189
+ skip(t) {
190
+ return this.operations.push(d(t)), this;
191
+ }
192
+ /**
193
+ * Deduplicate rows by key
194
+ */
195
+ distinct(t) {
196
+ return this.operations.push(
197
+ m(t)
198
+ ), this;
199
+ }
200
+ /**
201
+ * Build the pipeline as an async iterable
202
+ * Useful for manual iteration or custom sinks
203
+ */
204
+ build() {
205
+ let t = this.source.read();
206
+ for (const n of this.operations)
207
+ t = n(t);
208
+ return t;
209
+ }
210
+ /**
211
+ * Execute the pipeline and write to a sink
212
+ */
213
+ async to(t) {
214
+ const n = this.build();
215
+ return t.write(n);
216
+ }
217
+ /**
218
+ * Execute the pipeline and collect results into an array
219
+ */
220
+ async toArray() {
221
+ const t = [], n = this.build();
222
+ for await (const o of n)
223
+ t.push(o);
224
+ return t;
225
+ }
226
+ /**
227
+ * Count the rows that pass through the pipeline
228
+ */
229
+ async count() {
230
+ let t = 0;
231
+ const n = this.build();
232
+ for await (const o of n)
233
+ t++;
234
+ return t;
235
+ }
236
+ /**
237
+ * Execute a function for each row
238
+ */
239
+ async forEach(t) {
240
+ const n = this.build();
241
+ for await (const o of n)
242
+ t(o);
243
+ }
244
+ /**
245
+ * Execute an async function for each row
246
+ */
247
+ async forEachAsync(t) {
248
+ const n = this.build();
249
+ for await (const o of n)
250
+ await t(o);
251
+ }
252
+ /**
253
+ * Get the source count (if available)
254
+ */
255
+ async sourceCount() {
256
+ return this.source.count?.();
257
+ }
258
+ }
259
+ export {
260
+ i as P,
261
+ u as a,
262
+ h as b,
263
+ w as c,
264
+ y as d,
265
+ f as e,
266
+ a as f,
267
+ p as g,
268
+ l as h,
269
+ m as i,
270
+ A as j,
271
+ e as m,
272
+ d as s,
273
+ c as t,
274
+ b as u
275
+ };
@@ -0,0 +1,2 @@
1
+ export * from './src/pipeline/index'
2
+ export {}
@@ -0,0 +1,189 @@
1
+ import { P as q, c as P, j as v, i as C, e as N, b as j, f as I, m as M, s as O, h as R, d as E, g as G, t as H, a as J, u as K } from "./pipeline-builder-ERaxT48h.js";
2
+ import { T as m } from "./turso-database-CNWM_LV6.js";
3
+ async function* p(t, r, a = {}) {
4
+ const { batchSize: e = 1e3, where: n, orderBy: i, limit: c, offset: y = 0 } = a;
5
+ let l = y, u = !0, f = 0;
6
+ for (; u; ) {
7
+ let s = t.selectFrom(r).selectAll();
8
+ n && (s = n(s)), i && (s = s.orderBy(i)), s = s.limit(e).offset(l);
9
+ const o = await s.execute();
10
+ if (o.length === 0) {
11
+ u = !1;
12
+ break;
13
+ }
14
+ for (const w of o)
15
+ if (yield w, f++, c !== void 0 && f >= c) {
16
+ u = !1;
17
+ break;
18
+ }
19
+ o.length < e && (u = !1), l += e;
20
+ }
21
+ }
22
+ async function b(t, r, a, e = {}) {
23
+ const { batchSize: n = 100, onConflict: i = "error", onProgress: c } = e, y = Date.now();
24
+ let l = 0, u = 0, f = 0, s = 0, o = [];
25
+ const w = async () => {
26
+ if (o.length !== 0) {
27
+ try {
28
+ let h = t.insertInto(r).values(o);
29
+ (i === "ignore" || i === "replace") && (h = h.onConflict((D) => D.doNothing())), await h.execute(), u += o.length;
30
+ } catch (d) {
31
+ if (i === "error")
32
+ throw d;
33
+ s += o.length;
34
+ }
35
+ o = [];
36
+ }
37
+ };
38
+ for await (const d of a)
39
+ o.push(d), l++, o.length >= n && (await w(), c && c({
40
+ current: l,
41
+ processed: l,
42
+ skipped: f,
43
+ errors: s
44
+ }));
45
+ return await w(), {
46
+ processed: l,
47
+ inserted: u,
48
+ skipped: f,
49
+ errors: s,
50
+ duration: Date.now() - y
51
+ };
52
+ }
53
+ async function k(t, r, a = {}) {
54
+ const { where: e } = a;
55
+ let i = t.selectFrom(r).select((y) => y.fn.countAll().as("count"));
56
+ e && (i = e(i));
57
+ const c = await i.executeTakeFirst();
58
+ return Number(c?.count ?? 0);
59
+ }
60
+ function S(t, r, a = {}) {
61
+ return {
62
+ name: `turso:${t.url}/${r}`,
63
+ async *read() {
64
+ const e = new m(t);
65
+ await e.initialize();
66
+ try {
67
+ yield* p(
68
+ e.getDatabase(),
69
+ r,
70
+ a
71
+ );
72
+ } finally {
73
+ await e.close();
74
+ }
75
+ },
76
+ async count() {
77
+ const e = new m(t);
78
+ await e.initialize();
79
+ try {
80
+ return await k(
81
+ e.getDatabase(),
82
+ r,
83
+ a
84
+ );
85
+ } finally {
86
+ await e.close();
87
+ }
88
+ }
89
+ };
90
+ }
91
+ function x(t, r, a = {}) {
92
+ return {
93
+ name: `kysely:${r}`,
94
+ async *read() {
95
+ yield* p(t, r, a);
96
+ },
97
+ async count() {
98
+ return k(t, r, a);
99
+ }
100
+ };
101
+ }
102
+ function T(t, r = "array") {
103
+ return {
104
+ name: r,
105
+ async *read() {
106
+ for (const a of t)
107
+ yield a;
108
+ },
109
+ async count() {
110
+ return t.length;
111
+ }
112
+ };
113
+ }
114
+ function $(t, r, a = {}) {
115
+ return {
116
+ name: `turso:${t.url}/${r}`,
117
+ async write(e) {
118
+ const n = new m({
119
+ ...t,
120
+ readonly: !1
121
+ // Ensure we can write
122
+ });
123
+ await n.initialize();
124
+ try {
125
+ return await b(
126
+ n.getDatabase(),
127
+ r,
128
+ e,
129
+ a
130
+ );
131
+ } finally {
132
+ await n.close();
133
+ }
134
+ }
135
+ };
136
+ }
137
+ function z(t, r, a = {}) {
138
+ return {
139
+ name: `kysely:${r}`,
140
+ async write(e) {
141
+ return b(t, r, e, a);
142
+ }
143
+ };
144
+ }
145
+ function A() {
146
+ const t = [], r = Date.now();
147
+ return {
148
+ name: "array",
149
+ items: t,
150
+ async write(a) {
151
+ let e = 0;
152
+ for await (const n of a)
153
+ t.push(n), e++;
154
+ return {
155
+ processed: e,
156
+ inserted: e,
157
+ skipped: 0,
158
+ errors: 0,
159
+ duration: Date.now() - r
160
+ };
161
+ }
162
+ };
163
+ }
164
+ export {
165
+ q as Pipeline,
166
+ A as arraySink,
167
+ T as arraySource,
168
+ P as batch,
169
+ v as compose,
170
+ k as countRows,
171
+ C as distinct,
172
+ N as extend,
173
+ j as extendAsync,
174
+ I as filter,
175
+ z as kyselySink,
176
+ x as kyselySource,
177
+ M as map,
178
+ O as skip,
179
+ p as streamTable,
180
+ R as take,
181
+ E as tap,
182
+ G as tapAsync,
183
+ H as transform,
184
+ J as transformAsync,
185
+ $ as tursoSink,
186
+ S as tursoSource,
187
+ K as unbatch,
188
+ b as writeBatches
189
+ };
@@ -1,8 +1,5 @@
1
- /**
2
- * Turso adapter interface
3
- */
4
- import type { Client } from '@libsql/client';
5
- import type { TursoDatabaseConfig } from '../config.js';
1
+ import { Client } from '@libsql/client';
2
+ import { TursoDatabaseConfig } from '../config.js';
6
3
  /**
7
4
  * Adapter status information
8
5
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/adapters/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB;IACnB,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5B,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;IAC5C,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvD;;OAEG;IACH,SAAS,IAAI,MAAM,CAAC;IAEpB;;OAEG;IACH,OAAO,IAAI,gBAAgB,CAAC;IAE5B;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,OAAO,IAAI,MAAM,CAAC;IAElB;;OAEG;IACH,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
@@ -1,9 +1,6 @@
1
- /**
2
- * Embedded Turso adapter - Local SQLite with sync
3
- */
4
- import { type Client } from '@libsql/client';
5
- import type { TursoDatabaseConfig } from '../config.js';
6
- import type { TursoAdapter, TursoAdapterInfo } from './adapter.js';
1
+ import { Client } from '@libsql/client';
2
+ import { TursoDatabaseConfig } from '../config.js';
3
+ import { TursoAdapter, TursoAdapterInfo } from './adapter.js';
7
4
  /**
8
5
  * Embedded Turso adapter for local SQLite with optional sync
9
6
  */