@anfenn/dync 1.0.30 → 1.0.32
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/README.md +31 -9
- package/dist/capacitor.cjs +2 -2
- package/dist/capacitor.cjs.map +1 -1
- package/dist/capacitor.d.cts +1 -1
- package/dist/capacitor.d.ts +1 -1
- package/dist/capacitor.js +1 -1
- package/dist/{chunk-SQB6E7V2.js → chunk-XAHQXK76.js} +3 -3
- package/dist/{chunk-SQB6E7V2.js.map → chunk-XAHQXK76.js.map} +1 -1
- package/dist/{dexie-T9m1mP1h.d.cts → dexie-3VOQSn1s.d.cts} +5 -5
- package/dist/{dexie-BFPA0JU2.d.ts → dexie-D85rTx4g.d.ts} +5 -5
- package/dist/dexie.d.cts +2 -2
- package/dist/dexie.d.ts +2 -2
- package/dist/expoSqlite.d.cts +1 -1
- package/dist/expoSqlite.d.ts +1 -1
- package/dist/index.cjs +11 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +11 -23
- package/dist/index.js.map +1 -1
- package/dist/node.cjs +5 -5
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +9 -9
- package/dist/node.d.ts +9 -9
- package/dist/node.js +4 -4
- package/dist/node.js.map +1 -1
- package/dist/react/index.d.cts +3 -3
- package/dist/react/index.d.ts +3 -3
- package/dist/{types-CSbIAfu2.d.cts → types-6-NyRQ0D.d.cts} +3 -11
- package/dist/{types-CSbIAfu2.d.ts → types-6-NyRQ0D.d.ts} +3 -11
- package/dist/{types-DW42y281.d.cts → types-BszcepJK.d.cts} +1 -1
- package/dist/{types-n8Zge2zF.d.ts → types-Dhx9MuUp.d.ts} +1 -1
- package/dist/wa-sqlite.cjs +9 -9
- package/dist/wa-sqlite.cjs.map +1 -1
- package/dist/wa-sqlite.d.cts +13 -13
- package/dist/wa-sqlite.d.ts +13 -13
- package/dist/wa-sqlite.js +8 -8
- package/dist/wa-sqlite.js.map +1 -1
- package/package.json +2 -2
- package/src/index.native.ts +1 -1
- package/src/index.shared.ts +5 -14
- package/src/index.ts +1 -1
- package/src/node.ts +1 -1
- package/src/storage/sqlite/SQLiteAdapter.ts +10 -13
- package/src/storage/sqlite/{SqliteQueryContext.ts → SQLiteQueryContext.ts} +1 -1
- package/src/storage/sqlite/drivers/{BetterSqlite3Driver.ts → BetterSQLite3Driver.ts} +8 -8
- package/src/storage/sqlite/drivers/CapacitorSQLiteDriver.ts +2 -2
- package/src/storage/sqlite/drivers/{WaSqliteDriver.ts → WaSQLiteDriver.ts} +20 -20
- package/src/storage/sqlite/index.ts +1 -1
- package/src/storage/sqlite/types.ts +2 -12
- package/src/storage/types.ts +2 -2
- 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-
|
|
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-
|
|
3
|
-
import { T as TableSchemaDefinition, D as DexieQueryContext, S as
|
|
4
|
-
export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-
|
|
5
|
-
import { c as
|
|
6
|
-
export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-
|
|
1
|
+
import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-BszcepJK.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-BszcepJK.cjs';
|
|
3
|
+
import { T as TableSchemaDefinition, D as DexieQueryContext, S as SQLiteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-3VOQSn1s.cjs';
|
|
4
|
+
export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-3VOQSn1s.cjs';
|
|
5
|
+
import { c as SQLiteVersionMigration } from './types-6-NyRQ0D.cjs';
|
|
6
|
+
export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-6-NyRQ0D.cjs';
|
|
7
7
|
import 'dexie';
|
|
8
8
|
|
|
9
9
|
declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, any>> {
|
|
@@ -51,12 +51,12 @@ declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, a
|
|
|
51
51
|
constructor(config: DyncOptions<_TStoreMap>);
|
|
52
52
|
version(versionNumber: number): {
|
|
53
53
|
stores(schema: Record<string, TableSchemaDefinition>): /*elided*/ any;
|
|
54
|
-
sqlite(
|
|
54
|
+
sqlite(migrations: SQLiteVersionMigration): /*elided*/ any;
|
|
55
55
|
};
|
|
56
56
|
open(): Promise<void>;
|
|
57
57
|
close(): Promise<void>;
|
|
58
58
|
delete(): Promise<void>;
|
|
59
|
-
query<R>(callback: (ctx: DexieQueryContext |
|
|
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,
|
|
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-
|
|
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-
|
|
3
|
-
import { T as TableSchemaDefinition, D as DexieQueryContext, S as
|
|
4
|
-
export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-
|
|
5
|
-
import { c as
|
|
6
|
-
export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-
|
|
1
|
+
import { D as DyncOptions, S as SyncStatus, a as SyncApi, T as TableMap } from './types-Dhx9MuUp.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-Dhx9MuUp.js';
|
|
3
|
+
import { T as TableSchemaDefinition, D as DexieQueryContext, S as SQLiteQueryContext, M as MemoryQueryContext, a as StorageTable } from './dexie-D85rTx4g.js';
|
|
4
|
+
export { b as MemoryAdapter, c as SQLiteAdapter, d as StorageAdapter } from './dexie-D85rTx4g.js';
|
|
5
|
+
import { c as SQLiteVersionMigration } from './types-6-NyRQ0D.js';
|
|
6
|
+
export { S as SQLiteDatabaseDriver, b as SQLiteQueryResult, a as SQLiteRunResult } from './types-6-NyRQ0D.js';
|
|
7
7
|
import 'dexie';
|
|
8
8
|
|
|
9
9
|
declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, any>> {
|
|
@@ -51,12 +51,12 @@ declare class DyncBase<_TStoreMap extends Record<string, any> = Record<string, a
|
|
|
51
51
|
constructor(config: DyncOptions<_TStoreMap>);
|
|
52
52
|
version(versionNumber: number): {
|
|
53
53
|
stores(schema: Record<string, TableSchemaDefinition>): /*elided*/ any;
|
|
54
|
-
sqlite(
|
|
54
|
+
sqlite(migrations: SQLiteVersionMigration): /*elided*/ any;
|
|
55
55
|
};
|
|
56
56
|
open(): Promise<void>;
|
|
57
57
|
close(): Promise<void>;
|
|
58
58
|
delete(): Promise<void>;
|
|
59
|
-
query<R>(callback: (ctx: DexieQueryContext |
|
|
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,
|
|
97
|
+
export { Dync, DyncOptions, MemoryQueryContext, SQLiteQueryContext, TableMap, createLocalId };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-XAHQXK76.js";
|
|
2
2
|
|
|
3
3
|
// src/logger.ts
|
|
4
4
|
function newLogger(base, min) {
|
|
@@ -1408,21 +1408,12 @@ var DyncBase = class {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
return builder;
|
|
1410
1410
|
},
|
|
1411
|
-
sqlite(
|
|
1411
|
+
sqlite(migrations) {
|
|
1412
1412
|
if (!storesDefined) {
|
|
1413
1413
|
throw new Error("Call stores() before registering sqlite migrations");
|
|
1414
1414
|
}
|
|
1415
1415
|
const sqliteOptions = schemaOptions.sqlite ??= {};
|
|
1416
|
-
|
|
1417
|
-
const configurator = {
|
|
1418
|
-
upgrade(handler) {
|
|
1419
|
-
migrations.upgrade = handler;
|
|
1420
|
-
},
|
|
1421
|
-
downgrade(handler) {
|
|
1422
|
-
migrations.downgrade = handler;
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
configure(configurator);
|
|
1416
|
+
sqliteOptions.migrations = migrations;
|
|
1426
1417
|
return builder;
|
|
1427
1418
|
}
|
|
1428
1419
|
};
|
|
@@ -2502,8 +2493,8 @@ var normalizeComparableValue = (value) => {
|
|
|
2502
2493
|
return value;
|
|
2503
2494
|
};
|
|
2504
2495
|
|
|
2505
|
-
// src/storage/sqlite/
|
|
2506
|
-
var
|
|
2496
|
+
// src/storage/sqlite/SQLiteQueryContext.ts
|
|
2497
|
+
var SQLiteQueryContext = class {
|
|
2507
2498
|
constructor(driver, adapter) {
|
|
2508
2499
|
this.driver = driver;
|
|
2509
2500
|
this.adapter = adapter;
|
|
@@ -2689,7 +2680,7 @@ var SQLiteAdapter2 = class {
|
|
|
2689
2680
|
async query(arg1, arg2) {
|
|
2690
2681
|
if (typeof arg1 === "function") {
|
|
2691
2682
|
const driver2 = await this.getDriver();
|
|
2692
|
-
return arg1(new
|
|
2683
|
+
return arg1(new SQLiteQueryContext(driver2, this));
|
|
2693
2684
|
}
|
|
2694
2685
|
const statement = arg1;
|
|
2695
2686
|
const values = arg2;
|
|
@@ -2808,25 +2799,22 @@ var SQLiteAdapter2 = class {
|
|
|
2808
2799
|
}
|
|
2809
2800
|
if (currentVersion < targetVersion) {
|
|
2810
2801
|
for (let version = currentVersion + 1; version <= targetVersion; version += 1) {
|
|
2811
|
-
await this.runMigrationStep(version, "
|
|
2802
|
+
await this.runMigrationStep(version, "up");
|
|
2812
2803
|
await this.setStoredSchemaVersion(version);
|
|
2813
2804
|
}
|
|
2814
2805
|
return;
|
|
2815
2806
|
}
|
|
2816
2807
|
for (let version = currentVersion; version > targetVersion; version -= 1) {
|
|
2817
|
-
await this.runMigrationStep(version, "
|
|
2808
|
+
await this.runMigrationStep(version, "down");
|
|
2818
2809
|
await this.setStoredSchemaVersion(version - 1);
|
|
2819
2810
|
}
|
|
2820
2811
|
}
|
|
2821
|
-
async runMigrationStep(version, direction
|
|
2812
|
+
async runMigrationStep(version, direction) {
|
|
2822
2813
|
const handler = this.getMigrationHandler(version, direction);
|
|
2823
2814
|
if (!handler) {
|
|
2824
2815
|
return;
|
|
2825
2816
|
}
|
|
2826
2817
|
const context = {
|
|
2827
|
-
direction,
|
|
2828
|
-
fromVersion,
|
|
2829
|
-
toVersion,
|
|
2830
2818
|
execute: (statement) => this.internalExecute(statement),
|
|
2831
2819
|
run: (statement, values) => this.internalRun(statement, values),
|
|
2832
2820
|
query: (statement, values) => this.internalQuery(statement, values)
|
|
@@ -2839,7 +2827,7 @@ var SQLiteAdapter2 = class {
|
|
|
2839
2827
|
if (!migrations) {
|
|
2840
2828
|
return void 0;
|
|
2841
2829
|
}
|
|
2842
|
-
return direction === "
|
|
2830
|
+
return direction === "up" ? migrations.up : migrations.down;
|
|
2843
2831
|
}
|
|
2844
2832
|
async applySchema() {
|
|
2845
2833
|
if (this.schemaApplied) {
|
|
@@ -3896,7 +3884,7 @@ export {
|
|
|
3896
3884
|
MemoryAdapter,
|
|
3897
3885
|
MemoryQueryContext,
|
|
3898
3886
|
SQLiteAdapter2 as SQLiteAdapter,
|
|
3899
|
-
|
|
3887
|
+
SQLiteQueryContext,
|
|
3900
3888
|
SyncAction,
|
|
3901
3889
|
createLocalId
|
|
3902
3890
|
};
|