@anfenn/dync 1.0.30 → 1.0.31

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 (52) hide show
  1. package/README.md +31 -9
  2. package/dist/capacitor.cjs +2 -2
  3. package/dist/capacitor.cjs.map +1 -1
  4. package/dist/capacitor.d.cts +1 -1
  5. package/dist/capacitor.d.ts +1 -1
  6. package/dist/capacitor.js +1 -1
  7. package/dist/{chunk-SQB6E7V2.js → chunk-XAHQXK76.js} +3 -3
  8. package/dist/{chunk-SQB6E7V2.js.map → chunk-XAHQXK76.js.map} +1 -1
  9. package/dist/{dexie-BFPA0JU2.d.ts → dexie-ImxmapkS.d.ts} +5 -5
  10. package/dist/{dexie-T9m1mP1h.d.cts → dexie-q17SmbBw.d.cts} +5 -5
  11. package/dist/dexie.d.cts +2 -2
  12. package/dist/dexie.d.ts +2 -2
  13. package/dist/expoSqlite.d.cts +1 -1
  14. package/dist/expoSqlite.d.ts +1 -1
  15. package/dist/index.cjs +13 -16
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +8 -8
  18. package/dist/index.d.ts +8 -8
  19. package/dist/index.js +13 -16
  20. package/dist/index.js.map +1 -1
  21. package/dist/node.cjs +5 -5
  22. package/dist/node.cjs.map +1 -1
  23. package/dist/node.d.cts +9 -9
  24. package/dist/node.d.ts +9 -9
  25. package/dist/node.js +4 -4
  26. package/dist/node.js.map +1 -1
  27. package/dist/react/index.d.cts +3 -3
  28. package/dist/react/index.d.ts +3 -3
  29. package/dist/{types-DW42y281.d.cts → types-B7xq90Kc.d.cts} +1 -1
  30. package/dist/{types-n8Zge2zF.d.ts → types-CfvYBKI_.d.ts} +1 -1
  31. package/dist/{types-CSbIAfu2.d.cts → types-DeiRXWKl.d.cts} +4 -8
  32. package/dist/{types-CSbIAfu2.d.ts → types-DeiRXWKl.d.ts} +4 -8
  33. package/dist/wa-sqlite.cjs +9 -9
  34. package/dist/wa-sqlite.cjs.map +1 -1
  35. package/dist/wa-sqlite.d.cts +13 -13
  36. package/dist/wa-sqlite.d.ts +13 -13
  37. package/dist/wa-sqlite.js +8 -8
  38. package/dist/wa-sqlite.js.map +1 -1
  39. package/package.json +2 -2
  40. package/src/index.native.ts +1 -1
  41. package/src/index.shared.ts +6 -6
  42. package/src/index.ts +1 -1
  43. package/src/node.ts +1 -1
  44. package/src/storage/sqlite/SQLiteAdapter.ts +10 -13
  45. package/src/storage/sqlite/{SqliteQueryContext.ts → SQLiteQueryContext.ts} +1 -1
  46. package/src/storage/sqlite/drivers/{BetterSqlite3Driver.ts → BetterSQLite3Driver.ts} +8 -8
  47. package/src/storage/sqlite/drivers/CapacitorSQLiteDriver.ts +2 -2
  48. package/src/storage/sqlite/drivers/{WaSqliteDriver.ts → WaSQLiteDriver.ts} +20 -20
  49. package/src/storage/sqlite/index.ts +1 -1
  50. package/src/storage/sqlite/types.ts +4 -9
  51. package/src/storage/types.ts +2 -2
  52. package/src/wa-sqlite.ts +1 -1
package/dist/index.d.cts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-DW42y281.cjs';
2
- export { A as AfterRemoteAddCallback, c as ApiFunctions, f as BatchFirstLoadResult, d as BatchPushPayload, e as BatchPushResult, B as BatchSync, C as ConflictResolutionStrategy, F as FirstLoadProgress, g as FirstLoadProgressCallback, h as MissingRemoteRecordDuringUpdateCallback, M as MissingRemoteRecordStrategy, i as MutationEvent, b as SyncAction, j as SyncOptions, k as SyncState, l as SyncedRecord } from './types-DW42y281.cjs';
3
- import { T as TableSchemaDefinition, D as DexieQueryContext, S as SqliteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-T9m1mP1h.cjs';
4
- export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-T9m1mP1h.cjs';
5
- import { c as SQLiteVersionConfigurator } from './types-CSbIAfu2.cjs';
6
- export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-CSbIAfu2.cjs';
1
+ import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-B7xq90Kc.cjs';
2
+ export { A as AfterRemoteAddCallback, c as ApiFunctions, f as BatchFirstLoadResult, d as BatchPushPayload, e as BatchPushResult, B as BatchSync, C as ConflictResolutionStrategy, F as FirstLoadProgress, g as FirstLoadProgressCallback, h as MissingRemoteRecordDuringUpdateCallback, M as MissingRemoteRecordStrategy, i as MutationEvent, b as SyncAction, j as SyncOptions, k as SyncState, l as SyncedRecord } from './types-B7xq90Kc.cjs';
3
+ import { T as TableSchemaDefinition, D as DexieQueryContext, S as SQLiteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-q17SmbBw.cjs';
4
+ export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-q17SmbBw.cjs';
5
+ import { c as SQLiteVersionConfigurator } from './types-DeiRXWKl.cjs';
6
+ export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-DeiRXWKl.cjs';
7
7
  import 'dexie';
8
8
 
9
9
  declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, any>> {
@@ -56,7 +56,7 @@ declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, a
56
56
  open(): Promise<void>;
57
57
  close(): Promise<void>;
58
58
  delete(): Promise<void>;
59
- query<R>(callback: (ctx: DexieQueryContext | SqliteQueryContext | MemoryQueryContext) => Promise<R>): Promise<R>;
59
+ query<R>(callback: (ctx: DexieQueryContext | SQLiteQueryContext | MemoryQueryContext) => Promise<R>): Promise<R>;
60
60
  table<K extends keyof _TStoreMap>(name: K): StorageTable<_TStoreMap[K]>;
61
61
  table<T = any>(name: string): StorageTable<T>;
62
62
  private withTransaction;
@@ -94,4 +94,4 @@ type Dync<TStoreMap extends Record<string, any> = Record<string, any>> = DyncIns
94
94
 
95
95
  declare function createLocalId(): string;
96
96
 
97
- export { Dync, DyncOptions, MemoryQueryContext, SqliteQueryContext, TableMap, createLocalId };
97
+ export { Dync, DyncOptions, MemoryQueryContext, SQLiteQueryContext, TableMap, createLocalId };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-n8Zge2zF.js';
2
- export { A as AfterRemoteAddCallback, c as ApiFunctions, f as BatchFirstLoadResult, d as BatchPushPayload, e as BatchPushResult, B as BatchSync, C as ConflictResolutionStrategy, F as FirstLoadProgress, g as FirstLoadProgressCallback, h as MissingRemoteRecordDuringUpdateCallback, M as MissingRemoteRecordStrategy, i as MutationEvent, b as SyncAction, j as SyncOptions, k as SyncState, l as SyncedRecord } from './types-n8Zge2zF.js';
3
- import { T as TableSchemaDefinition, D as DexieQueryContext, S as SqliteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-BFPA0JU2.js';
4
- export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-BFPA0JU2.js';
5
- import { c as SQLiteVersionConfigurator } from './types-CSbIAfu2.js';
6
- export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-CSbIAfu2.js';
1
+ import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-CfvYBKI_.js';
2
+ export { A as AfterRemoteAddCallback, c as ApiFunctions, f as BatchFirstLoadResult, d as BatchPushPayload, e as BatchPushResult, B as BatchSync, C as ConflictResolutionStrategy, F as FirstLoadProgress, g as FirstLoadProgressCallback, h as MissingRemoteRecordDuringUpdateCallback, M as MissingRemoteRecordStrategy, i as MutationEvent, b as SyncAction, j as SyncOptions, k as SyncState, l as SyncedRecord } from './types-CfvYBKI_.js';
3
+ import { T as TableSchemaDefinition, D as DexieQueryContext, S as SQLiteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-ImxmapkS.js';
4
+ export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-ImxmapkS.js';
5
+ import { c as SQLiteVersionConfigurator } from './types-DeiRXWKl.js';
6
+ export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-DeiRXWKl.js';
7
7
  import 'dexie';
8
8
 
9
9
  declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, any>> {
@@ -56,7 +56,7 @@ declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, a
56
56
  open(): Promise<void>;
57
57
  close(): Promise<void>;
58
58
  delete(): Promise<void>;
59
- query<R>(callback: (ctx: DexieQueryContext | SqliteQueryContext | MemoryQueryContext) => Promise<R>): Promise<R>;
59
+ query<R>(callback: (ctx: DexieQueryContext | SQLiteQueryContext | MemoryQueryContext) => Promise<R>): Promise<R>;
60
60
  table<K extends keyof _TStoreMap>(name: K): StorageTable<_TStoreMap[K]>;
61
61
  table<T = any>(name: string): StorageTable<T>;
62
62
  private withTransaction;
@@ -94,4 +94,4 @@ type Dync<TStoreMap extends Record<string, any> = Record<string, any>> = DyncIns
94
94
 
95
95
  declare function createLocalId(): string;
96
96
 
97
- export { Dync, DyncOptions, MemoryQueryContext, SqliteQueryContext, TableMap, createLocalId };
97
+ export { Dync, DyncOptions, MemoryQueryContext, SQLiteQueryContext, TableMap, createLocalId };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./chunk-SQB6E7V2.js";
1
+ import "./chunk-XAHQXK76.js";
2
2
 
3
3
  // src/logger.ts
4
4
  function newLogger(base, min) {
@@ -1415,11 +1415,11 @@ var DyncBase = class {
1415
1415
  const sqliteOptions = schemaOptions.sqlite ??= {};
1416
1416
  const migrations = sqliteOptions.migrations ??= {};
1417
1417
  const configurator = {
1418
- upgrade(handler) {
1419
- migrations.upgrade = handler;
1418
+ up(handler) {
1419
+ migrations.up = handler;
1420
1420
  },
1421
- downgrade(handler) {
1422
- migrations.downgrade = handler;
1421
+ down(handler) {
1422
+ migrations.down = handler;
1423
1423
  }
1424
1424
  };
1425
1425
  configure(configurator);
@@ -2502,8 +2502,8 @@ var normalizeComparableValue = (value) => {
2502
2502
  return value;
2503
2503
  };
2504
2504
 
2505
- // src/storage/sqlite/SqliteQueryContext.ts
2506
- var SqliteQueryContext = class {
2505
+ // src/storage/sqlite/SQLiteQueryContext.ts
2506
+ var SQLiteQueryContext = class {
2507
2507
  constructor(driver, adapter) {
2508
2508
  this.driver = driver;
2509
2509
  this.adapter = adapter;
@@ -2689,7 +2689,7 @@ var SQLiteAdapter2 = class {
2689
2689
  async query(arg1, arg2) {
2690
2690
  if (typeof arg1 === "function") {
2691
2691
  const driver2 = await this.getDriver();
2692
- return arg1(new SqliteQueryContext(driver2, this));
2692
+ return arg1(new SQLiteQueryContext(driver2, this));
2693
2693
  }
2694
2694
  const statement = arg1;
2695
2695
  const values = arg2;
@@ -2808,25 +2808,22 @@ var SQLiteAdapter2 = class {
2808
2808
  }
2809
2809
  if (currentVersion < targetVersion) {
2810
2810
  for (let version = currentVersion + 1; version <= targetVersion; version += 1) {
2811
- await this.runMigrationStep(version, "upgrade", version - 1, version);
2811
+ await this.runMigrationStep(version, "up");
2812
2812
  await this.setStoredSchemaVersion(version);
2813
2813
  }
2814
2814
  return;
2815
2815
  }
2816
2816
  for (let version = currentVersion; version > targetVersion; version -= 1) {
2817
- await this.runMigrationStep(version, "downgrade", version, version - 1);
2817
+ await this.runMigrationStep(version, "down");
2818
2818
  await this.setStoredSchemaVersion(version - 1);
2819
2819
  }
2820
2820
  }
2821
- async runMigrationStep(version, direction, fromVersion, toVersion) {
2821
+ async runMigrationStep(version, direction) {
2822
2822
  const handler = this.getMigrationHandler(version, direction);
2823
2823
  if (!handler) {
2824
2824
  return;
2825
2825
  }
2826
2826
  const context = {
2827
- direction,
2828
- fromVersion,
2829
- toVersion,
2830
2827
  execute: (statement) => this.internalExecute(statement),
2831
2828
  run: (statement, values) => this.internalRun(statement, values),
2832
2829
  query: (statement, values) => this.internalQuery(statement, values)
@@ -2839,7 +2836,7 @@ var SQLiteAdapter2 = class {
2839
2836
  if (!migrations) {
2840
2837
  return void 0;
2841
2838
  }
2842
- return direction === "upgrade" ? migrations.upgrade : migrations.downgrade;
2839
+ return direction === "up" ? migrations.up : migrations.down;
2843
2840
  }
2844
2841
  async applySchema() {
2845
2842
  if (this.schemaApplied) {
@@ -3896,7 +3893,7 @@ export {
3896
3893
  MemoryAdapter,
3897
3894
  MemoryQueryContext,
3898
3895
  SQLiteAdapter2 as SQLiteAdapter,
3899
- SqliteQueryContext,
3896
+ SQLiteQueryContext,
3900
3897
  SyncAction,
3901
3898
  createLocalId
3902
3899
  };