@anfenn/dync 1.1.0 → 1.1.3
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 +9 -4
- package/dist/{dexie-D85rTx4g.d.ts → dexie-B3Ihrrxi.d.ts} +1 -6
- package/dist/{dexie-3VOQSn1s.d.cts → dexie-BRWUYM02.d.cts} +1 -6
- package/dist/dexie.d.cts +1 -1
- package/dist/dexie.d.ts +1 -1
- package/dist/index.cjs +2 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -16
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/{types-BIJhsSOf.d.ts → types-DhlgTu1o.d.ts} +1 -1
- package/dist/{types-DhCTdAep.d.cts → types-Di82FTAL.d.cts} +1 -1
- package/package.json +5 -3
- package/src/storage/sqlite/SQLiteAdapter.ts +1 -2
- package/src/storage/sqlite/SQLiteQueryContext.ts +1 -22
package/README.md
CHANGED
|
@@ -11,13 +11,16 @@ Start with a Website or PWA using IndexedDB, sync with your existing REST API, a
|
|
|
11
11
|
1. Target IndexedDB as a PWA, and SQLite in the AppStores, with no code changes and native storage performance
|
|
12
12
|
2. Frictionless upgrade path from an offline-first PWA targeting IndexedDB, to when:
|
|
13
13
|
|
|
14
|
-
**
|
|
14
|
+
**_A) Substring search is required on many records:_**
|
|
15
|
+
- IndexedDB doesn't support this so will do a full table scan in the JS VM, which is both slow and will spike memory
|
|
15
16
|
|
|
16
|
-
**
|
|
17
|
+
**_AND/OR_**
|
|
17
18
|
|
|
18
|
-
**
|
|
19
|
+
**_B) Encryption is required:_**
|
|
20
|
+
- Browsers can't store the encryption key securely
|
|
21
|
+
- A user's password could be used as the encryption key instead, but if the app allows biometric login, then there will be no password during those logins to decrypt the database
|
|
19
22
|
|
|
20
|
-
... you can simply add CapacitorJs or move to React Native which have sqlite & secure enclave storage, and only change the adapter Dync uses
|
|
23
|
+
... so you can simply add CapacitorJs or move to React Native which have sqlite & secure enclave storage, and only change the adapter Dync uses
|
|
21
24
|
|
|
22
25
|
3. Completely free and open source
|
|
23
26
|
|
|
@@ -58,6 +61,8 @@ And see how Dync compares to the alternatives [below](#hasnt-this-already-been-d
|
|
|
58
61
|
update: (id, changes) => fetch(`/api/items/${id}`),
|
|
59
62
|
remove: (id) => fetch(`/api/items/${id}`),
|
|
60
63
|
list: (since) => fetch(`/api/items?since=${since}`),
|
|
64
|
+
// Optional: Delay calling this endpoint during a pull if slow changing data, to reduce server load
|
|
65
|
+
listExtraIntervalMs: 7 * 24 * 60 * 60 * 1000, // 1 week
|
|
61
66
|
},
|
|
62
67
|
},
|
|
63
68
|
});
|
|
@@ -304,13 +304,8 @@ declare class SQLiteAdapter implements StorageAdapter {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
declare class SQLiteQueryContext {
|
|
307
|
-
private readonly driver;
|
|
308
307
|
private readonly adapter;
|
|
309
|
-
constructor(
|
|
310
|
-
table<T = any>(name: string): StorageTable<T>;
|
|
311
|
-
transaction<T>(mode: TransactionMode, tableNames: string[], callback: (context: StorageTransactionContext) => Promise<T>): Promise<T>;
|
|
312
|
-
execute(statement: string): Promise<void>;
|
|
313
|
-
run(statement: string, values?: any[]): Promise<SQLiteRunResult>;
|
|
308
|
+
constructor(adapter: SQLiteAdapter);
|
|
314
309
|
queryRows(statement: string, values?: any[]): Promise<Array<Record<string, any>>>;
|
|
315
310
|
}
|
|
316
311
|
|
|
@@ -304,13 +304,8 @@ declare class SQLiteAdapter implements StorageAdapter {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
declare class SQLiteQueryContext {
|
|
307
|
-
private readonly driver;
|
|
308
307
|
private readonly adapter;
|
|
309
|
-
constructor(
|
|
310
|
-
table<T = any>(name: string): StorageTable<T>;
|
|
311
|
-
transaction<T>(mode: TransactionMode, tableNames: string[], callback: (context: StorageTransactionContext) => Promise<T>): Promise<T>;
|
|
312
|
-
execute(statement: string): Promise<void>;
|
|
313
|
-
run(statement: string, values?: any[]): Promise<SQLiteRunResult>;
|
|
308
|
+
constructor(adapter: SQLiteAdapter);
|
|
314
309
|
queryRows(statement: string, values?: any[]): Promise<Array<Record<string, any>>>;
|
|
315
310
|
}
|
|
316
311
|
|
package/dist/dexie.d.cts
CHANGED
package/dist/dexie.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2556,22 +2556,9 @@ var normalizeComparableValue = (value) => {
|
|
|
2556
2556
|
|
|
2557
2557
|
// src/storage/sqlite/SQLiteQueryContext.ts
|
|
2558
2558
|
var SQLiteQueryContext = class {
|
|
2559
|
-
constructor(
|
|
2560
|
-
this.driver = driver;
|
|
2559
|
+
constructor(adapter) {
|
|
2561
2560
|
this.adapter = adapter;
|
|
2562
2561
|
}
|
|
2563
|
-
table(name) {
|
|
2564
|
-
return this.adapter.table(name);
|
|
2565
|
-
}
|
|
2566
|
-
transaction(mode, tableNames, callback) {
|
|
2567
|
-
return this.adapter.transaction(mode, tableNames, callback);
|
|
2568
|
-
}
|
|
2569
|
-
async execute(statement) {
|
|
2570
|
-
return this.driver.execute(statement);
|
|
2571
|
-
}
|
|
2572
|
-
async run(statement, values) {
|
|
2573
|
-
return this.driver.run(statement, values);
|
|
2574
|
-
}
|
|
2575
2562
|
async queryRows(statement, values) {
|
|
2576
2563
|
return this.adapter.queryRows(statement, values);
|
|
2577
2564
|
}
|
|
@@ -2740,8 +2727,7 @@ var SQLiteAdapter2 = class {
|
|
|
2740
2727
|
}
|
|
2741
2728
|
async query(arg1, arg2) {
|
|
2742
2729
|
if (typeof arg1 === "function") {
|
|
2743
|
-
|
|
2744
|
-
return arg1(new SQLiteQueryContext(driver2, this));
|
|
2730
|
+
return arg1(new SQLiteQueryContext(this));
|
|
2745
2731
|
}
|
|
2746
2732
|
const statement = arg1;
|
|
2747
2733
|
const values = arg2;
|