@tursodatabase/sync 0.1.5 → 0.2.0-pre.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -74,23 +74,33 @@ function requireNative() {
74
74
  } else if (process.platform === 'android') {
75
75
  if (process.arch === 'arm64') {
76
76
  try {
77
- return require('./turso-sync-js.android-arm64.node')
77
+ return require('./sync.android-arm64.node')
78
78
  } catch (e) {
79
79
  loadErrors.push(e)
80
80
  }
81
81
  try {
82
- return require('@tursodatabase/sync-android-arm64')
82
+ const binding = require('@tursodatabase/sync-android-arm64')
83
+ const bindingPackageVersion = require('@tursodatabase/sync-android-arm64/package.json').version
84
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
+ }
87
+ return binding
83
88
  } catch (e) {
84
89
  loadErrors.push(e)
85
90
  }
86
91
  } else if (process.arch === 'arm') {
87
92
  try {
88
- return require('./turso-sync-js.android-arm-eabi.node')
93
+ return require('./sync.android-arm-eabi.node')
89
94
  } catch (e) {
90
95
  loadErrors.push(e)
91
96
  }
92
97
  try {
93
- return require('@tursodatabase/sync-android-arm-eabi')
98
+ const binding = require('@tursodatabase/sync-android-arm-eabi')
99
+ const bindingPackageVersion = require('@tursodatabase/sync-android-arm-eabi/package.json').version
100
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
+ }
103
+ return binding
94
104
  } catch (e) {
95
105
  loadErrors.push(e)
96
106
  }
@@ -100,34 +110,49 @@ function requireNative() {
100
110
  } else if (process.platform === 'win32') {
101
111
  if (process.arch === 'x64') {
102
112
  try {
103
- return require('./turso-sync-js.win32-x64-msvc.node')
113
+ return require('./sync.win32-x64-msvc.node')
104
114
  } catch (e) {
105
115
  loadErrors.push(e)
106
116
  }
107
117
  try {
108
- return require('@tursodatabase/sync-win32-x64-msvc')
118
+ const binding = require('@tursodatabase/sync-win32-x64-msvc')
119
+ const bindingPackageVersion = require('@tursodatabase/sync-win32-x64-msvc/package.json').version
120
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
+ }
123
+ return binding
109
124
  } catch (e) {
110
125
  loadErrors.push(e)
111
126
  }
112
127
  } else if (process.arch === 'ia32') {
113
128
  try {
114
- return require('./turso-sync-js.win32-ia32-msvc.node')
129
+ return require('./sync.win32-ia32-msvc.node')
115
130
  } catch (e) {
116
131
  loadErrors.push(e)
117
132
  }
118
133
  try {
119
- return require('@tursodatabase/sync-win32-ia32-msvc')
134
+ const binding = require('@tursodatabase/sync-win32-ia32-msvc')
135
+ const bindingPackageVersion = require('@tursodatabase/sync-win32-ia32-msvc/package.json').version
136
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
+ }
139
+ return binding
120
140
  } catch (e) {
121
141
  loadErrors.push(e)
122
142
  }
123
143
  } else if (process.arch === 'arm64') {
124
144
  try {
125
- return require('./turso-sync-js.win32-arm64-msvc.node')
145
+ return require('./sync.win32-arm64-msvc.node')
126
146
  } catch (e) {
127
147
  loadErrors.push(e)
128
148
  }
129
149
  try {
130
- return require('@tursodatabase/sync-win32-arm64-msvc')
150
+ const binding = require('@tursodatabase/sync-win32-arm64-msvc')
151
+ const bindingPackageVersion = require('@tursodatabase/sync-win32-arm64-msvc/package.json').version
152
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
+ }
155
+ return binding
131
156
  } catch (e) {
132
157
  loadErrors.push(e)
133
158
  }
@@ -136,34 +161,49 @@ function requireNative() {
136
161
  }
137
162
  } else if (process.platform === 'darwin') {
138
163
  try {
139
- return require('./turso-sync-js.darwin-universal.node')
164
+ return require('./sync.darwin-universal.node')
140
165
  } catch (e) {
141
166
  loadErrors.push(e)
142
167
  }
143
168
  try {
144
- return require('@tursodatabase/sync-darwin-universal')
169
+ const binding = require('@tursodatabase/sync-darwin-universal')
170
+ const bindingPackageVersion = require('@tursodatabase/sync-darwin-universal/package.json').version
171
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
+ }
174
+ return binding
145
175
  } catch (e) {
146
176
  loadErrors.push(e)
147
177
  }
148
178
  if (process.arch === 'x64') {
149
179
  try {
150
- return require('./turso-sync-js.darwin-x64.node')
180
+ return require('./sync.darwin-x64.node')
151
181
  } catch (e) {
152
182
  loadErrors.push(e)
153
183
  }
154
184
  try {
155
- return require('@tursodatabase/sync-darwin-x64')
185
+ const binding = require('@tursodatabase/sync-darwin-x64')
186
+ const bindingPackageVersion = require('@tursodatabase/sync-darwin-x64/package.json').version
187
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
+ }
190
+ return binding
156
191
  } catch (e) {
157
192
  loadErrors.push(e)
158
193
  }
159
194
  } else if (process.arch === 'arm64') {
160
195
  try {
161
- return require('./turso-sync-js.darwin-arm64.node')
196
+ return require('./sync.darwin-arm64.node')
162
197
  } catch (e) {
163
198
  loadErrors.push(e)
164
199
  }
165
200
  try {
166
- return require('@tursodatabase/sync-darwin-arm64')
201
+ const binding = require('@tursodatabase/sync-darwin-arm64')
202
+ const bindingPackageVersion = require('@tursodatabase/sync-darwin-arm64/package.json').version
203
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
+ }
206
+ return binding
167
207
  } catch (e) {
168
208
  loadErrors.push(e)
169
209
  }
@@ -173,23 +213,33 @@ function requireNative() {
173
213
  } else if (process.platform === 'freebsd') {
174
214
  if (process.arch === 'x64') {
175
215
  try {
176
- return require('./turso-sync-js.freebsd-x64.node')
216
+ return require('./sync.freebsd-x64.node')
177
217
  } catch (e) {
178
218
  loadErrors.push(e)
179
219
  }
180
220
  try {
181
- return require('@tursodatabase/sync-freebsd-x64')
221
+ const binding = require('@tursodatabase/sync-freebsd-x64')
222
+ const bindingPackageVersion = require('@tursodatabase/sync-freebsd-x64/package.json').version
223
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
225
+ }
226
+ return binding
182
227
  } catch (e) {
183
228
  loadErrors.push(e)
184
229
  }
185
230
  } else if (process.arch === 'arm64') {
186
231
  try {
187
- return require('./turso-sync-js.freebsd-arm64.node')
232
+ return require('./sync.freebsd-arm64.node')
188
233
  } catch (e) {
189
234
  loadErrors.push(e)
190
235
  }
191
236
  try {
192
- return require('@tursodatabase/sync-freebsd-arm64')
237
+ const binding = require('@tursodatabase/sync-freebsd-arm64')
238
+ const bindingPackageVersion = require('@tursodatabase/sync-freebsd-arm64/package.json').version
239
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
+ }
242
+ return binding
193
243
  } catch (e) {
194
244
  loadErrors.push(e)
195
245
  }
@@ -200,23 +250,33 @@ function requireNative() {
200
250
  if (process.arch === 'x64') {
201
251
  if (isMusl()) {
202
252
  try {
203
- return require('./turso-sync-js.linux-x64-musl.node')
253
+ return require('./sync.linux-x64-musl.node')
204
254
  } catch (e) {
205
255
  loadErrors.push(e)
206
256
  }
207
257
  try {
208
- return require('@tursodatabase/sync-linux-x64-musl')
258
+ const binding = require('@tursodatabase/sync-linux-x64-musl')
259
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-x64-musl/package.json').version
260
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
262
+ }
263
+ return binding
209
264
  } catch (e) {
210
265
  loadErrors.push(e)
211
266
  }
212
267
  } else {
213
268
  try {
214
- return require('./turso-sync-js.linux-x64-gnu.node')
269
+ return require('./sync.linux-x64-gnu.node')
215
270
  } catch (e) {
216
271
  loadErrors.push(e)
217
272
  }
218
273
  try {
219
- return require('@tursodatabase/sync-linux-x64-gnu')
274
+ const binding = require('@tursodatabase/sync-linux-x64-gnu')
275
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-x64-gnu/package.json').version
276
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
+ }
279
+ return binding
220
280
  } catch (e) {
221
281
  loadErrors.push(e)
222
282
  }
@@ -224,23 +284,33 @@ function requireNative() {
224
284
  } else if (process.arch === 'arm64') {
225
285
  if (isMusl()) {
226
286
  try {
227
- return require('./turso-sync-js.linux-arm64-musl.node')
287
+ return require('./sync.linux-arm64-musl.node')
228
288
  } catch (e) {
229
289
  loadErrors.push(e)
230
290
  }
231
291
  try {
232
- return require('@tursodatabase/sync-linux-arm64-musl')
292
+ const binding = require('@tursodatabase/sync-linux-arm64-musl')
293
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-arm64-musl/package.json').version
294
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
+ }
297
+ return binding
233
298
  } catch (e) {
234
299
  loadErrors.push(e)
235
300
  }
236
301
  } else {
237
302
  try {
238
- return require('./turso-sync-js.linux-arm64-gnu.node')
303
+ return require('./sync.linux-arm64-gnu.node')
239
304
  } catch (e) {
240
305
  loadErrors.push(e)
241
306
  }
242
307
  try {
243
- return require('@tursodatabase/sync-linux-arm64-gnu')
308
+ const binding = require('@tursodatabase/sync-linux-arm64-gnu')
309
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-arm64-gnu/package.json').version
310
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
+ }
313
+ return binding
244
314
  } catch (e) {
245
315
  loadErrors.push(e)
246
316
  }
@@ -248,23 +318,33 @@ function requireNative() {
248
318
  } else if (process.arch === 'arm') {
249
319
  if (isMusl()) {
250
320
  try {
251
- return require('./turso-sync-js.linux-arm-musleabihf.node')
321
+ return require('./sync.linux-arm-musleabihf.node')
252
322
  } catch (e) {
253
323
  loadErrors.push(e)
254
324
  }
255
325
  try {
256
- return require('@tursodatabase/sync-linux-arm-musleabihf')
326
+ const binding = require('@tursodatabase/sync-linux-arm-musleabihf')
327
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-arm-musleabihf/package.json').version
328
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
+ }
331
+ return binding
257
332
  } catch (e) {
258
333
  loadErrors.push(e)
259
334
  }
260
335
  } else {
261
336
  try {
262
- return require('./turso-sync-js.linux-arm-gnueabihf.node')
337
+ return require('./sync.linux-arm-gnueabihf.node')
263
338
  } catch (e) {
264
339
  loadErrors.push(e)
265
340
  }
266
341
  try {
267
- return require('@tursodatabase/sync-linux-arm-gnueabihf')
342
+ const binding = require('@tursodatabase/sync-linux-arm-gnueabihf')
343
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-arm-gnueabihf/package.json').version
344
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
+ }
347
+ return binding
268
348
  } catch (e) {
269
349
  loadErrors.push(e)
270
350
  }
@@ -272,46 +352,66 @@ function requireNative() {
272
352
  } else if (process.arch === 'riscv64') {
273
353
  if (isMusl()) {
274
354
  try {
275
- return require('./turso-sync-js.linux-riscv64-musl.node')
355
+ return require('./sync.linux-riscv64-musl.node')
276
356
  } catch (e) {
277
357
  loadErrors.push(e)
278
358
  }
279
359
  try {
280
- return require('@tursodatabase/sync-linux-riscv64-musl')
360
+ const binding = require('@tursodatabase/sync-linux-riscv64-musl')
361
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-riscv64-musl/package.json').version
362
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
+ }
365
+ return binding
281
366
  } catch (e) {
282
367
  loadErrors.push(e)
283
368
  }
284
369
  } else {
285
370
  try {
286
- return require('./turso-sync-js.linux-riscv64-gnu.node')
371
+ return require('./sync.linux-riscv64-gnu.node')
287
372
  } catch (e) {
288
373
  loadErrors.push(e)
289
374
  }
290
375
  try {
291
- return require('@tursodatabase/sync-linux-riscv64-gnu')
376
+ const binding = require('@tursodatabase/sync-linux-riscv64-gnu')
377
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-riscv64-gnu/package.json').version
378
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
+ }
381
+ return binding
292
382
  } catch (e) {
293
383
  loadErrors.push(e)
294
384
  }
295
385
  }
296
386
  } else if (process.arch === 'ppc64') {
297
387
  try {
298
- return require('./turso-sync-js.linux-ppc64-gnu.node')
388
+ return require('./sync.linux-ppc64-gnu.node')
299
389
  } catch (e) {
300
390
  loadErrors.push(e)
301
391
  }
302
392
  try {
303
- return require('@tursodatabase/sync-linux-ppc64-gnu')
393
+ const binding = require('@tursodatabase/sync-linux-ppc64-gnu')
394
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-ppc64-gnu/package.json').version
395
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
+ }
398
+ return binding
304
399
  } catch (e) {
305
400
  loadErrors.push(e)
306
401
  }
307
402
  } else if (process.arch === 's390x') {
308
403
  try {
309
- return require('./turso-sync-js.linux-s390x-gnu.node')
404
+ return require('./sync.linux-s390x-gnu.node')
310
405
  } catch (e) {
311
406
  loadErrors.push(e)
312
407
  }
313
408
  try {
314
- return require('@tursodatabase/sync-linux-s390x-gnu')
409
+ const binding = require('@tursodatabase/sync-linux-s390x-gnu')
410
+ const bindingPackageVersion = require('@tursodatabase/sync-linux-s390x-gnu/package.json').version
411
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
+ }
414
+ return binding
315
415
  } catch (e) {
316
416
  loadErrors.push(e)
317
417
  }
@@ -321,34 +421,49 @@ function requireNative() {
321
421
  } else if (process.platform === 'openharmony') {
322
422
  if (process.arch === 'arm64') {
323
423
  try {
324
- return require('./turso-sync-js.linux-arm64-ohos.node')
424
+ return require('./sync.openharmony-arm64.node')
325
425
  } catch (e) {
326
426
  loadErrors.push(e)
327
427
  }
328
428
  try {
329
- return require('@tursodatabase/sync-linux-arm64-ohos')
429
+ const binding = require('@tursodatabase/sync-openharmony-arm64')
430
+ const bindingPackageVersion = require('@tursodatabase/sync-openharmony-arm64/package.json').version
431
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
433
+ }
434
+ return binding
330
435
  } catch (e) {
331
436
  loadErrors.push(e)
332
437
  }
333
438
  } else if (process.arch === 'x64') {
334
439
  try {
335
- return require('./turso-sync-js.linux-x64-ohos.node')
440
+ return require('./sync.openharmony-x64.node')
336
441
  } catch (e) {
337
442
  loadErrors.push(e)
338
443
  }
339
444
  try {
340
- return require('@tursodatabase/sync-linux-x64-ohos')
445
+ const binding = require('@tursodatabase/sync-openharmony-x64')
446
+ const bindingPackageVersion = require('@tursodatabase/sync-openharmony-x64/package.json').version
447
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
+ }
450
+ return binding
341
451
  } catch (e) {
342
452
  loadErrors.push(e)
343
453
  }
344
454
  } else if (process.arch === 'arm') {
345
455
  try {
346
- return require('./turso-sync-js.linux-arm-ohos.node')
456
+ return require('./sync.openharmony-arm.node')
347
457
  } catch (e) {
348
458
  loadErrors.push(e)
349
459
  }
350
460
  try {
351
- return require('@tursodatabase/sync-linux-arm-ohos')
461
+ const binding = require('@tursodatabase/sync-openharmony-arm')
462
+ const bindingPackageVersion = require('@tursodatabase/sync-openharmony-arm/package.json').version
463
+ if (bindingPackageVersion !== '0.2.0-pre.8' && 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.2.0-pre.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
+ }
466
+ return binding
352
467
  } catch (e) {
353
468
  loadErrors.push(e)
354
469
  }
@@ -364,7 +479,7 @@ nativeBinding = requireNative()
364
479
 
365
480
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
366
481
  try {
367
- nativeBinding = require('./turso-sync-js.wasi.cjs')
482
+ nativeBinding = require('./sync.wasi.cjs')
368
483
  } catch (err) {
369
484
  if (process.env.NAPI_RS_FORCE_WASI) {
370
485
  loadErrors.push(err)
@@ -393,14 +508,15 @@ if (!nativeBinding) {
393
508
  throw new Error(`Failed to load native binding`)
394
509
  }
395
510
 
396
- const { Database, Statement, GeneratorHolder, JsDataCompletion, JsDataPollResult, JsProtocolIo, JsProtocolRequestData, SyncEngine, DatabaseChangeTypeJs, SyncEngineProtocolVersion } = nativeBinding
511
+ const { BatchExecutor, Database, Statement, GeneratorHolder, JsDataCompletion, JsProtocolIo, JsProtocolRequestBytes, SyncEngine, SyncEngineChanges, DatabaseChangeTypeJs, SyncEngineProtocolVersion } = nativeBinding
512
+ export { BatchExecutor }
397
513
  export { Database }
398
514
  export { Statement }
399
515
  export { GeneratorHolder }
400
516
  export { JsDataCompletion }
401
- export { JsDataPollResult }
402
517
  export { JsProtocolIo }
403
- export { JsProtocolRequestData }
518
+ export { JsProtocolRequestBytes }
404
519
  export { SyncEngine }
520
+ export { SyncEngineChanges }
405
521
  export { DatabaseChangeTypeJs }
406
522
  export { SyncEngineProtocolVersion }
package/package.json CHANGED
@@ -1,70 +1,59 @@
1
1
  {
2
2
  "name": "@tursodatabase/sync",
3
- "version": "0.1.5",
3
+ "version": "0.2.0-pre.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tursodatabase/turso"
7
7
  },
8
- "description": "Sync engine for the Turso database library",
9
- "module": "./dist/sync_engine.js",
10
- "main": "./dist/sync_engine.js",
8
+ "license": "MIT",
9
+ "module": "./dist/promise.js",
10
+ "main": "./dist/promise.js",
11
11
  "type": "module",
12
- "exports": "./dist/sync_engine.js",
12
+ "exports": {
13
+ ".": "./dist/promise.js",
14
+ "./compat": "./dist/compat.js"
15
+ },
13
16
  "files": [
14
- "browser.js",
15
17
  "index.js",
16
- "dist/**"
18
+ "dist/**",
19
+ "README.md"
17
20
  ],
18
- "types": "./dist/sync_engine.d.ts",
21
+ "packageManager": "yarn@4.9.2",
22
+ "devDependencies": {
23
+ "@napi-rs/cli": "^3.1.5",
24
+ "@types/node": "^24.3.1",
25
+ "typescript": "^5.9.2",
26
+ "vitest": "^3.2.4"
27
+ },
28
+ "scripts": {
29
+ "napi-build": "napi build --platform --release --esm --manifest-path ../../Cargo.toml --output-dir .",
30
+ "napi-dirs": "napi create-npm-dirs",
31
+ "napi-artifacts": "napi artifacts --output-dir .",
32
+ "tsc-build": "npm exec tsc",
33
+ "build": "npm run napi-build && npm run tsc-build",
34
+ "test": "VITE_TURSO_DB_URL=http://d--a--a.localhost:10000 vitest --run",
35
+ "prepublishOnly": "npm run napi-dirs && npm run napi-artifacts && napi prepublish -t npm"
36
+ },
19
37
  "napi": {
20
- "binaryName": "turso-sync-js",
38
+ "binaryName": "sync",
21
39
  "targets": [
22
40
  "x86_64-unknown-linux-gnu",
23
41
  "x86_64-pc-windows-msvc",
24
- "universal-apple-darwin",
25
- "aarch64-unknown-linux-gnu",
26
- "wasm32-wasip1-threads"
42
+ "aarch64-apple-darwin",
43
+ "aarch64-unknown-linux-gnu"
27
44
  ]
28
45
  },
29
- "license": "MIT",
30
- "devDependencies": {
31
- "@napi-rs/cli": "^3.0.4",
32
- "@napi-rs/wasm-runtime": "^1.0.1",
33
- "@types/node": "^24.2.0",
34
- "ava": "^6.0.1",
35
- "typescript": "^5.9.2"
36
- },
37
- "ava": {
38
- "timeout": "3m"
39
- },
40
- "engines": {
41
- "node": ">= 10"
42
- },
43
- "scripts": {
44
- "artifacts": "napi artifacts",
45
- "build": "npm exec tsc && napi build --platform --release --esm",
46
- "build:debug": "npm exec tsc && napi build --platform",
47
- "prepublishOnly": "npm exec tsc && napi prepublish -t npm",
48
- "test": "true",
49
- "universal": "napi universalize",
50
- "version": "napi version"
46
+ "dependencies": {
47
+ "@tursodatabase/database-common": "^0.2.0-pre.10",
48
+ "@tursodatabase/sync-common": "^0.2.0-pre.10"
51
49
  },
52
- "packageManager": "yarn@4.9.2",
53
50
  "imports": {
54
- "#entry-point": {
55
- "types": "./index.d.ts",
56
- "browser": "./browser.js",
57
- "node": "./index.js"
58
- }
59
- },
60
- "dependencies": {
61
- "@tursodatabase/database": "~0.1.4-pre.5"
51
+ "#index": "./index.js"
62
52
  },
63
53
  "optionalDependencies": {
64
- "@tursodatabase/sync-linux-x64-gnu": "0.1.5",
65
- "@tursodatabase/sync-win32-x64-msvc": "0.1.5",
66
- "@tursodatabase/sync-darwin-universal": "0.1.5",
67
- "@tursodatabase/sync-linux-arm64-gnu": "0.1.5",
68
- "@tursodatabase/sync-wasm32-wasi": "0.1.5"
54
+ "@tursodatabase/sync-linux-x64-gnu": "0.2.0-pre.10",
55
+ "@tursodatabase/sync-win32-x64-msvc": "0.2.0-pre.10",
56
+ "@tursodatabase/sync-darwin-arm64": "0.2.0-pre.10",
57
+ "@tursodatabase/sync-linux-arm64-gnu": "0.2.0-pre.10"
69
58
  }
70
59
  }
package/browser.js DELETED
@@ -1 +0,0 @@
1
- export * from '@tursodatabase/sync-wasm32-wasi'
@@ -1,24 +0,0 @@
1
- import { DatabaseRowMutationJs, DatabaseRowStatementJs } from '#entry-point';
2
- import { Database } from '@tursodatabase/database';
3
- interface ConnectOpts {
4
- path: string;
5
- clientName?: string;
6
- url: string;
7
- authToken?: string;
8
- encryptionKey?: string;
9
- tablesIgnore?: string[];
10
- transform?: (arg: DatabaseRowMutationJs) => DatabaseRowStatementJs | null;
11
- enableTracing?: string;
12
- }
13
- interface Sync {
14
- sync(): Promise<void>;
15
- push(): Promise<void>;
16
- pull(): Promise<void>;
17
- checkpoint(): Promise<void>;
18
- stats(): Promise<{
19
- operations: number;
20
- wal: number;
21
- }>;
22
- }
23
- export declare function connect(opts: ConnectOpts): Database & Sync;
24
- export { Database, Sync };