@tursodatabase/sync 0.3.2 → 0.4.0-pre.14

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.
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAmB,YAAY,EAAE,cAAc,EAAW,mBAAmB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,aAAa,EAAoB,MAAM,4BAA4B,CAAC;AAwC5M,cAAM,QAAS,SAAQ,eAAe;;gBAKtB,IAAI,EAAE,YAAY;IAiD9B;;OAEG;IACY,OAAO;IAUtB;;;;OAIG;IACG,IAAI;IAWV;;;OAGG;IACG,IAAI;IAMV;;OAEG;IACG,UAAU;IAMhB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC;IAMrC;;OAEG;IACY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAMxC;AAED;;;;;GAKG;AACH,iBAAe,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI5D;AAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC5B,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,CAAA"}
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAmB,YAAY,EAAE,cAAc,EAAW,mBAAmB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,aAAa,EAAoC,MAAM,4BAA4B,CAAC;AAwC5N,cAAM,QAAS,SAAQ,eAAe;;gBAItB,IAAI,EAAE,YAAY;IA2E9B;;OAEG;IACY,OAAO;IAUtB;;;;OAIG;IACG,IAAI;IAWV;;;OAGG;IACG,IAAI;IAMV;;OAEG;IACG,UAAU;IAMhB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC;IAMrC;;OAEG;IACY,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAMxC;AAED;;;;;GAKG;AACH,iBAAe,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI5D;AAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC5B,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,CAAA"}
package/dist/promise.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DatabasePromise } from "@tursodatabase/database-common";
2
- import { run, SyncEngineGuards } from "@tursodatabase/sync-common";
2
+ import { run, SyncEngineGuards, runner } from "@tursodatabase/sync-common";
3
3
  import { SyncEngine, Database as NativeDatabase } from "#index";
4
4
  import { promises } from "node:fs";
5
5
  let NodeIO = {
@@ -41,16 +41,34 @@ function memoryIO() {
41
41
  }
42
42
  ;
43
43
  class Database extends DatabasePromise {
44
- #runOpts;
45
44
  #engine;
46
- #io;
47
45
  #guards;
46
+ #runner;
48
47
  constructor(opts) {
49
48
  if (opts.url == null) {
50
49
  super(new NativeDatabase(opts.path, { tracing: opts.tracing }));
51
50
  this.#engine = null;
52
51
  return;
53
52
  }
53
+ let partialSyncOpts = undefined;
54
+ if (opts.partialSync != null) {
55
+ switch (opts.partialSync.bootstrapStrategy.kind) {
56
+ case "prefix":
57
+ partialSyncOpts = {
58
+ bootstrapStrategy: { type: "Prefix", length: opts.partialSync.bootstrapStrategy.length },
59
+ segmentSize: opts.partialSync.segmentSize,
60
+ speculativeLoad: opts.partialSync.speculativeLoad,
61
+ };
62
+ break;
63
+ case "query":
64
+ partialSyncOpts = {
65
+ bootstrapStrategy: { type: "Query", query: opts.partialSync.bootstrapStrategy.query },
66
+ segmentSize: opts.partialSync.segmentSize,
67
+ speculativeLoad: opts.partialSync.speculativeLoad,
68
+ };
69
+ break;
70
+ }
71
+ }
54
72
  const engine = new SyncEngine({
55
73
  path: opts.path,
56
74
  clientName: opts.clientName,
@@ -60,8 +78,8 @@ class Database extends DatabasePromise {
60
78
  tracing: opts.tracing,
61
79
  bootstrapIfEmpty: typeof opts.url != "function" || opts.url() != null,
62
80
  remoteEncryption: opts.remoteEncryption?.cipher,
81
+ partialSyncOpts: partialSyncOpts
63
82
  });
64
- super(engine.db());
65
83
  let headers;
66
84
  if (typeof opts.authToken == "function") {
67
85
  const authToken = opts.authToken;
@@ -83,14 +101,19 @@ class Database extends DatabasePromise {
83
101
  })
84
102
  };
85
103
  }
86
- this.#runOpts = {
104
+ const runOpts = {
87
105
  url: opts.url,
88
106
  headers: headers,
89
107
  preemptionMs: 1,
90
108
  transform: opts.transform,
91
109
  };
110
+ const db = engine.db();
111
+ const memory = db.memory;
112
+ const io = memory ? memoryIO() : NodeIO;
113
+ const run = runner(runOpts, io, engine);
114
+ super(engine.db(), () => run.wait());
115
+ this.#runner = run;
92
116
  this.#engine = engine;
93
- this.#io = this.memory ? memoryIO() : NodeIO;
94
117
  this.#guards = new SyncEngineGuards();
95
118
  }
96
119
  /**
@@ -104,7 +127,7 @@ class Database extends DatabasePromise {
104
127
  await super.connect();
105
128
  }
106
129
  else {
107
- await run(this.#runOpts, this.#io, this.#engine, this.#engine.connect());
130
+ await run(this.#runner, this.#engine.connect());
108
131
  }
109
132
  this.connected = true;
110
133
  }
@@ -117,11 +140,11 @@ class Database extends DatabasePromise {
117
140
  if (this.#engine == null) {
118
141
  throw new Error("sync is disabled as database was opened without sync support");
119
142
  }
120
- const changes = await this.#guards.wait(async () => await run(this.#runOpts, this.#io, this.#engine, this.#engine.wait()));
143
+ const changes = await this.#guards.wait(async () => await run(this.#runner, this.#engine.wait()));
121
144
  if (changes.empty()) {
122
145
  return false;
123
146
  }
124
- await this.#guards.apply(async () => await run(this.#runOpts, this.#io, this.#engine, this.#engine.apply(changes)));
147
+ await this.#guards.apply(async () => await run(this.#runner, this.#engine.apply(changes)));
125
148
  return true;
126
149
  }
127
150
  /**
@@ -132,7 +155,7 @@ class Database extends DatabasePromise {
132
155
  if (this.#engine == null) {
133
156
  throw new Error("sync is disabled as database was opened without sync support");
134
157
  }
135
- await this.#guards.push(async () => await run(this.#runOpts, this.#io, this.#engine, this.#engine.push()));
158
+ await this.#guards.push(async () => await run(this.#runner, this.#engine.push()));
136
159
  }
137
160
  /**
138
161
  * checkpoint WAL for local database
@@ -141,7 +164,7 @@ class Database extends DatabasePromise {
141
164
  if (this.#engine == null) {
142
165
  throw new Error("sync is disabled as database was opened without sync support");
143
166
  }
144
- await this.#guards.checkpoint(async () => await run(this.#runOpts, this.#io, this.#engine, this.#engine.checkpoint()));
167
+ await this.#guards.checkpoint(async () => await run(this.#runner, this.#engine.checkpoint()));
145
168
  }
146
169
  /**
147
170
  * @returns statistic of current local database
@@ -150,7 +173,7 @@ class Database extends DatabasePromise {
150
173
  if (this.#engine == null) {
151
174
  throw new Error("sync is disabled as database was opened without sync support");
152
175
  }
153
- return (await run(this.#runOpts, this.#io, this.#engine, this.#engine.stats()));
176
+ return (await run(this.#runner, this.#engine.stats()));
154
177
  }
155
178
  /**
156
179
  * close the database
@@ -13,6 +13,174 @@ function cleanup(path) {
13
13
  }
14
14
  catch (e) { }
15
15
  }
16
+ test('partial sync concurrency', async () => {
17
+ {
18
+ const db = await connect({
19
+ path: ':memory:',
20
+ url: process.env.VITE_TURSO_DB_URL,
21
+ longPollTimeoutMs: 100,
22
+ });
23
+ await db.exec("CREATE TABLE IF NOT EXISTS partial(value BLOB)");
24
+ await db.exec("DELETE FROM partial");
25
+ await db.exec("INSERT INTO partial SELECT randomblob(1024) FROM generate_series(1, 2000)");
26
+ await db.push();
27
+ await db.close();
28
+ }
29
+ const dbs = [];
30
+ for (let i = 0; i < 16; i++) {
31
+ dbs.push(await connect({
32
+ path: 'partial-1.db',
33
+ url: process.env.VITE_TURSO_DB_URL,
34
+ longPollTimeoutMs: 100,
35
+ partialSync: {
36
+ bootstrapStrategy: { kind: 'prefix', length: 128 * 1024 },
37
+ segmentSize: 128 * 1024,
38
+ },
39
+ }));
40
+ }
41
+ const qs = [];
42
+ for (const db of dbs) {
43
+ qs.push(db.prepare("SELECT COUNT(*) as cnt FROM partial").all());
44
+ }
45
+ const values = await Promise.all(qs);
46
+ expect(values).toEqual(new Array(16).fill([{ cnt: 2000 }]));
47
+ });
48
+ test('partial sync (prefix bootstrap strategy)', async () => {
49
+ {
50
+ const db = await connect({
51
+ path: ':memory:',
52
+ url: process.env.VITE_TURSO_DB_URL,
53
+ longPollTimeoutMs: 100,
54
+ });
55
+ await db.exec("CREATE TABLE IF NOT EXISTS partial(value BLOB)");
56
+ await db.exec("DELETE FROM partial");
57
+ await db.exec("INSERT INTO partial SELECT randomblob(1024) FROM generate_series(1, 2000)");
58
+ await db.push();
59
+ await db.close();
60
+ }
61
+ const db = await connect({
62
+ path: ':memory:',
63
+ url: process.env.VITE_TURSO_DB_URL,
64
+ longPollTimeoutMs: 100,
65
+ partialSync: {
66
+ bootstrapStrategy: { kind: 'prefix', length: 128 * 1024 },
67
+ segmentSize: 4096,
68
+ },
69
+ });
70
+ // 128kb plus some overhead
71
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(128 * (1024 + 128));
72
+ // select of one record shouldn't increase amount of received data
73
+ expect(await db.prepare("SELECT length(value) as length FROM partial LIMIT 1").all()).toEqual([{ length: 1024 }]);
74
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(128 * (1024 + 128));
75
+ await db.prepare("INSERT INTO partial VALUES (-1)").run();
76
+ expect(await db.prepare("SELECT COUNT(*) as cnt FROM partial").all()).toEqual([{ cnt: 2001 }]);
77
+ expect((await db.stats()).networkReceivedBytes).toBeGreaterThanOrEqual(2000 * 1024);
78
+ });
79
+ test('partial sync (prefix bootstrap strategy; large segment size)', async () => {
80
+ {
81
+ const db = await connect({
82
+ path: ':memory:',
83
+ url: process.env.VITE_TURSO_DB_URL,
84
+ longPollTimeoutMs: 100,
85
+ });
86
+ await db.exec("CREATE TABLE IF NOT EXISTS partial(value BLOB)");
87
+ await db.exec("DELETE FROM partial");
88
+ await db.exec("INSERT INTO partial SELECT randomblob(1024) FROM generate_series(1, 2000)");
89
+ await db.push();
90
+ await db.close();
91
+ }
92
+ const db = await connect({
93
+ path: ':memory:',
94
+ url: process.env.VITE_TURSO_DB_URL,
95
+ longPollTimeoutMs: 100,
96
+ partialSync: {
97
+ bootstrapStrategy: { kind: 'prefix', length: 128 * 1024 },
98
+ segmentSize: 128 * 1024,
99
+ },
100
+ });
101
+ // 128kb plus some overhead
102
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(128 * (1024 + 128));
103
+ const startLast = performance.now();
104
+ // select of one record shouldn't increase amount of received data
105
+ expect(await db.prepare("SELECT length(value) as length FROM partial LIMIT 1").all()).toEqual([{ length: 1024 }]);
106
+ console.info('select last', 'elapsed', performance.now() - startLast);
107
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(2 * 128 * (1024 + 128));
108
+ await db.prepare("INSERT INTO partial VALUES (-1)").run();
109
+ const startAll = performance.now();
110
+ expect(await db.prepare("SELECT COUNT(*) as cnt FROM partial").all()).toEqual([{ cnt: 2001 }]);
111
+ console.info('select all', 'elapsed', performance.now() - startAll);
112
+ expect((await db.stats()).networkReceivedBytes).toBeGreaterThanOrEqual(2000 * 1024);
113
+ });
114
+ test('partial sync (prefix bootstrap strategy; speculative load)', async () => {
115
+ {
116
+ const db = await connect({
117
+ path: ':memory:',
118
+ url: process.env.VITE_TURSO_DB_URL,
119
+ longPollTimeoutMs: 100,
120
+ });
121
+ await db.exec("CREATE TABLE IF NOT EXISTS partial(value BLOB)");
122
+ await db.exec("DELETE FROM partial");
123
+ await db.exec("INSERT INTO partial SELECT randomblob(1024) FROM generate_series(1, 2000)");
124
+ await db.push();
125
+ await db.close();
126
+ }
127
+ const db = await connect({
128
+ path: ':memory:',
129
+ url: process.env.VITE_TURSO_DB_URL,
130
+ longPollTimeoutMs: 100,
131
+ partialSync: {
132
+ bootstrapStrategy: { kind: 'prefix', length: 128 * 1024 },
133
+ segmentSize: 4 * 1024,
134
+ speculativeLoad: true,
135
+ },
136
+ });
137
+ // 128kb plus some overhead
138
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(128 * (1024 + 128));
139
+ const startLast = performance.now();
140
+ // select of one record shouldn't increase amount of received data
141
+ expect(await db.prepare("SELECT length(value) as length FROM partial LIMIT 1").all()).toEqual([{ length: 1024 }]);
142
+ console.info('select last', 'elapsed', performance.now() - startLast);
143
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(10 * 128 * (1024 + 128));
144
+ await db.prepare("INSERT INTO partial VALUES (-1)").run();
145
+ const startAll = performance.now();
146
+ expect(await db.prepare("SELECT COUNT(*) as cnt FROM partial").all()).toEqual([{ cnt: 2001 }]);
147
+ console.info('select all', 'elapsed', performance.now() - startAll);
148
+ expect((await db.stats()).networkReceivedBytes).toBeGreaterThanOrEqual(2000 * 1024);
149
+ });
150
+ test('partial sync (query bootstrap strategy)', async () => {
151
+ {
152
+ const db = await connect({
153
+ path: ':memory:',
154
+ url: process.env.VITE_TURSO_DB_URL,
155
+ longPollTimeoutMs: 100,
156
+ });
157
+ await db.exec("CREATE TABLE IF NOT EXISTS partial_keyed(key INTEGER PRIMARY KEY, value BLOB)");
158
+ await db.exec("DELETE FROM partial_keyed");
159
+ await db.exec("INSERT INTO partial_keyed SELECT value, randomblob(1024) FROM generate_series(1, 2000)");
160
+ await db.push();
161
+ await db.close();
162
+ }
163
+ const db = await connect({
164
+ path: ':memory:',
165
+ url: process.env.VITE_TURSO_DB_URL,
166
+ longPollTimeoutMs: 100,
167
+ partialSync: {
168
+ bootstrapStrategy: { kind: 'query', query: 'SELECT * FROM partial_keyed WHERE key = 1000' },
169
+ segmentSize: 4096,
170
+ },
171
+ });
172
+ // we must sync only few pages
173
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(10 * (4096 + 128));
174
+ // select of one record shouldn't increase amount of received data by a lot
175
+ expect(await db.prepare("SELECT length(value) as length FROM partial_keyed LIMIT 1").all()).toEqual([{ length: 1024 }]);
176
+ expect((await db.stats()).networkReceivedBytes).toBeLessThanOrEqual(10 * (4096 + 128));
177
+ await db.prepare("INSERT INTO partial_keyed VALUES (-1, -1)").run();
178
+ const n1 = await db.stats();
179
+ // same as bootstrap query - we shouldn't bring any more pages
180
+ expect(await db.prepare("SELECT length(value) as length FROM partial_keyed WHERE key = 1000").all()).toEqual([{ length: 1024 }]);
181
+ const n2 = await db.stats();
182
+ expect(n1.networkReceivedBytes).toEqual(n2.networkReceivedBytes);
183
+ });
16
184
  test('concurrent-actions-consistency', async () => {
17
185
  {
18
186
  const db = await connect({
package/index.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('@tursodatabase/sync-android-arm64')
83
83
  const bindingPackageVersion = require('@tursodatabase/sync-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('@tursodatabase/sync-android-arm-eabi')
99
99
  const bindingPackageVersion = require('@tursodatabase/sync-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -117,8 +117,8 @@ function requireNative() {
117
117
  try {
118
118
  const binding = require('@tursodatabase/sync-win32-x64-msvc')
119
119
  const bindingPackageVersion = require('@tursodatabase/sync-win32-x64-msvc/package.json').version
120
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
120
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
122
  }
123
123
  return binding
124
124
  } catch (e) {
@@ -133,8 +133,8 @@ function requireNative() {
133
133
  try {
134
134
  const binding = require('@tursodatabase/sync-win32-ia32-msvc')
135
135
  const bindingPackageVersion = require('@tursodatabase/sync-win32-ia32-msvc/package.json').version
136
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
138
  }
139
139
  return binding
140
140
  } catch (e) {
@@ -149,8 +149,8 @@ function requireNative() {
149
149
  try {
150
150
  const binding = require('@tursodatabase/sync-win32-arm64-msvc')
151
151
  const bindingPackageVersion = require('@tursodatabase/sync-win32-arm64-msvc/package.json').version
152
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
154
  }
155
155
  return binding
156
156
  } catch (e) {
@@ -168,8 +168,8 @@ function requireNative() {
168
168
  try {
169
169
  const binding = require('@tursodatabase/sync-darwin-universal')
170
170
  const bindingPackageVersion = require('@tursodatabase/sync-darwin-universal/package.json').version
171
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
173
  }
174
174
  return binding
175
175
  } catch (e) {
@@ -184,8 +184,8 @@ function requireNative() {
184
184
  try {
185
185
  const binding = require('@tursodatabase/sync-darwin-x64')
186
186
  const bindingPackageVersion = require('@tursodatabase/sync-darwin-x64/package.json').version
187
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
189
  }
190
190
  return binding
191
191
  } catch (e) {
@@ -200,8 +200,8 @@ function requireNative() {
200
200
  try {
201
201
  const binding = require('@tursodatabase/sync-darwin-arm64')
202
202
  const bindingPackageVersion = require('@tursodatabase/sync-darwin-arm64/package.json').version
203
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
205
  }
206
206
  return binding
207
207
  } catch (e) {
@@ -220,8 +220,8 @@ function requireNative() {
220
220
  try {
221
221
  const binding = require('@tursodatabase/sync-freebsd-x64')
222
222
  const bindingPackageVersion = require('@tursodatabase/sync-freebsd-x64/package.json').version
223
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
225
225
  }
226
226
  return binding
227
227
  } catch (e) {
@@ -236,8 +236,8 @@ function requireNative() {
236
236
  try {
237
237
  const binding = require('@tursodatabase/sync-freebsd-arm64')
238
238
  const bindingPackageVersion = require('@tursodatabase/sync-freebsd-arm64/package.json').version
239
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
241
  }
242
242
  return binding
243
243
  } catch (e) {
@@ -257,8 +257,8 @@ function requireNative() {
257
257
  try {
258
258
  const binding = require('@tursodatabase/sync-linux-x64-musl')
259
259
  const bindingPackageVersion = require('@tursodatabase/sync-linux-x64-musl/package.json').version
260
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
262
262
  }
263
263
  return binding
264
264
  } catch (e) {
@@ -273,8 +273,8 @@ function requireNative() {
273
273
  try {
274
274
  const binding = require('@tursodatabase/sync-linux-x64-gnu')
275
275
  const bindingPackageVersion = require('@tursodatabase/sync-linux-x64-gnu/package.json').version
276
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
278
  }
279
279
  return binding
280
280
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('@tursodatabase/sync-linux-arm64-musl')
293
293
  const bindingPackageVersion = require('@tursodatabase/sync-linux-arm64-musl/package.json').version
294
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -307,8 +307,8 @@ function requireNative() {
307
307
  try {
308
308
  const binding = require('@tursodatabase/sync-linux-arm64-gnu')
309
309
  const bindingPackageVersion = require('@tursodatabase/sync-linux-arm64-gnu/package.json').version
310
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
312
  }
313
313
  return binding
314
314
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@tursodatabase/sync-linux-arm-musleabihf')
327
327
  const bindingPackageVersion = require('@tursodatabase/sync-linux-arm-musleabihf/package.json').version
328
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -341,8 +341,8 @@ function requireNative() {
341
341
  try {
342
342
  const binding = require('@tursodatabase/sync-linux-arm-gnueabihf')
343
343
  const bindingPackageVersion = require('@tursodatabase/sync-linux-arm-gnueabihf/package.json').version
344
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
346
  }
347
347
  return binding
348
348
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('@tursodatabase/sync-linux-riscv64-musl')
361
361
  const bindingPackageVersion = require('@tursodatabase/sync-linux-riscv64-musl/package.json').version
362
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -375,8 +375,8 @@ function requireNative() {
375
375
  try {
376
376
  const binding = require('@tursodatabase/sync-linux-riscv64-gnu')
377
377
  const bindingPackageVersion = require('@tursodatabase/sync-linux-riscv64-gnu/package.json').version
378
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
380
  }
381
381
  return binding
382
382
  } catch (e) {
@@ -392,8 +392,8 @@ function requireNative() {
392
392
  try {
393
393
  const binding = require('@tursodatabase/sync-linux-ppc64-gnu')
394
394
  const bindingPackageVersion = require('@tursodatabase/sync-linux-ppc64-gnu/package.json').version
395
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
395
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
397
  }
398
398
  return binding
399
399
  } catch (e) {
@@ -408,8 +408,8 @@ function requireNative() {
408
408
  try {
409
409
  const binding = require('@tursodatabase/sync-linux-s390x-gnu')
410
410
  const bindingPackageVersion = require('@tursodatabase/sync-linux-s390x-gnu/package.json').version
411
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
413
  }
414
414
  return binding
415
415
  } catch (e) {
@@ -428,8 +428,8 @@ function requireNative() {
428
428
  try {
429
429
  const binding = require('@tursodatabase/sync-openharmony-arm64')
430
430
  const bindingPackageVersion = require('@tursodatabase/sync-openharmony-arm64/package.json').version
431
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
432
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
432
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
433
433
  }
434
434
  return binding
435
435
  } catch (e) {
@@ -444,8 +444,8 @@ function requireNative() {
444
444
  try {
445
445
  const binding = require('@tursodatabase/sync-openharmony-x64')
446
446
  const bindingPackageVersion = require('@tursodatabase/sync-openharmony-x64/package.json').version
447
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
449
  }
450
450
  return binding
451
451
  } catch (e) {
@@ -460,8 +460,8 @@ function requireNative() {
460
460
  try {
461
461
  const binding = require('@tursodatabase/sync-openharmony-arm')
462
462
  const bindingPackageVersion = require('@tursodatabase/sync-openharmony-arm/package.json').version
463
- if (bindingPackageVersion !== '0.3.0-pre.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 0.3.0-pre.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '0.4.0-pre.7' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
+ throw new Error(`Native binding package version mismatch, expected 0.4.0-pre.7 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
465
  }
466
466
  return binding
467
467
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tursodatabase/sync",
3
- "version": "0.3.2",
3
+ "version": "0.4.0-pre.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tursodatabase/turso"
@@ -44,16 +44,16 @@
44
44
  ]
45
45
  },
46
46
  "dependencies": {
47
- "@tursodatabase/database-common": "^0.3.2",
48
- "@tursodatabase/sync-common": "^0.3.2"
47
+ "@tursodatabase/database-common": "^0.4.0-pre.14",
48
+ "@tursodatabase/sync-common": "^0.4.0-pre.14"
49
49
  },
50
50
  "imports": {
51
51
  "#index": "./index.js"
52
52
  },
53
53
  "optionalDependencies": {
54
- "@tursodatabase/sync-linux-x64-gnu": "0.3.2",
55
- "@tursodatabase/sync-win32-x64-msvc": "0.3.2",
56
- "@tursodatabase/sync-darwin-arm64": "0.3.2",
57
- "@tursodatabase/sync-linux-arm64-gnu": "0.3.2"
54
+ "@tursodatabase/sync-linux-x64-gnu": "0.4.0-pre.14",
55
+ "@tursodatabase/sync-win32-x64-msvc": "0.4.0-pre.14",
56
+ "@tursodatabase/sync-darwin-arm64": "0.4.0-pre.14",
57
+ "@tursodatabase/sync-linux-arm64-gnu": "0.4.0-pre.14"
58
58
  }
59
59
  }