cry-synced-db-client 0.1.215 → 0.1.217
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/CHANGELOG.md +29 -0
- package/dist/index.js +40 -7
- package/dist/src/db/DexieDb.d.ts +5 -0
- package/dist/src/db/SyncedDb.d.ts +9 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 0.1.216 (2026-06-25)
|
|
4
|
+
|
|
5
|
+
### `onSyncProgress` fires for every chunk (not just first per collection)
|
|
6
|
+
|
|
7
|
+
Previously `onSyncProgress` only fired for the first chunk of each collection
|
|
8
|
+
in server-sync phase, causing the progress bar to freeze for 30+ seconds while
|
|
9
|
+
large collections (osemenitevGoveda, terapije) silently processed thousands of
|
|
10
|
+
items. Now fires for every chunk.
|
|
11
|
+
|
|
12
|
+
New fields on `onSyncProgress`:
|
|
13
|
+
- `itemsCumulative: number` — running total for current collection
|
|
14
|
+
- `isNewCollection: boolean` — true only for the first chunk
|
|
15
|
+
- `processingMs: number` — total processing time (dexie + inMem)
|
|
16
|
+
- `dexieMs: number` — IndexedDB write time
|
|
17
|
+
- `inMemMs: number` — Vuex/dbx write time
|
|
18
|
+
|
|
19
|
+
### Configurable sync batch size (`syncBatchSize`)
|
|
20
|
+
|
|
21
|
+
`SyncedDbConfig.syncBatchSize` controls how many items `processIncomingServerData`
|
|
22
|
+
processes per batch. Default 5000 (was hardcoded 2000). Larger batches mean fewer
|
|
23
|
+
IndexedDB transactions, reducing queue buildup for large collections.
|
|
24
|
+
|
|
25
|
+
### Fixed: scope-exit skip on initial sync (cry-db 2.5.6)
|
|
26
|
+
|
|
27
|
+
When timestamp is 0 (initial sync), `findNewerManyStream` no longer runs a
|
|
28
|
+
pointless scope-exit full-collection scan with `matchesQuery()`. The positive
|
|
29
|
+
query already returned everything. Saves ~38s on osemenitevGoveda, ~14s on
|
|
30
|
+
terapije.
|
|
31
|
+
|
|
3
32
|
## 0.1.211 (2026-06-25)
|
|
4
33
|
|
|
5
34
|
### Added `streamActivityTimeoutMs` to SyncedDbConfig
|
package/dist/index.js
CHANGED
|
@@ -7684,17 +7684,30 @@ var _SyncedDb = class _SyncedDb {
|
|
|
7684
7684
|
}
|
|
7685
7685
|
}
|
|
7686
7686
|
}
|
|
7687
|
-
/**
|
|
7687
|
+
/**
|
|
7688
|
+
* Stringify an Id parameter (ObjectId → hex string).
|
|
7689
|
+
*
|
|
7690
|
+
* Throws when `id` is falsy (null, undefined, 0, "", false) or is a
|
|
7691
|
+
* stringified-falsy value ("undefined", "null", "0", "false", "").
|
|
7692
|
+
* Passing a garbage _id creates a stuck dirty item that can never be
|
|
7693
|
+
* uploaded (server rejects it) and can never be auto-healed (library
|
|
7694
|
+
* doesn't know the correct _id). Fail-fast prevents silent data loss.
|
|
7695
|
+
*/
|
|
7688
7696
|
normalizeId(id, method, collection) {
|
|
7689
7697
|
if (!id && id !== void 0) {
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
);
|
|
7698
|
+
const msg = `[SyncedDb] SyncedDb.${method != null ? method : "?"}("${collection != null ? collection : "?"}"): id parameter is falsy (${JSON.stringify(id)}). This is a bug \u2014 the caller must provide a valid _id.`;
|
|
7699
|
+
console.error(msg);
|
|
7700
|
+
throw new Error(msg);
|
|
7693
7701
|
}
|
|
7694
7702
|
if (typeof id === "string" && _SyncedDb.STRINGIFIED_FALSY.has(id)) {
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
);
|
|
7703
|
+
const msg = `[SyncedDb] SyncedDb.${method != null ? method : "?"}("${collection != null ? collection : "?"}"): id is a stringified falsy value ("${id}"). This is a bug \u2014 a falsy value was coerced to string before being passed as _id.`;
|
|
7704
|
+
console.error(msg);
|
|
7705
|
+
throw new Error(msg);
|
|
7706
|
+
}
|
|
7707
|
+
if (id === void 0) {
|
|
7708
|
+
const msg = `[SyncedDb] SyncedDb.${method != null ? method : "?"}("${collection != null ? collection : "?"}"): id parameter is undefined. This is a bug \u2014 the caller must provide a valid _id.`;
|
|
7709
|
+
console.error(msg);
|
|
7710
|
+
throw new Error(msg);
|
|
7698
7711
|
}
|
|
7699
7712
|
return typeof id === "object" && id !== null ? String(id) : id;
|
|
7700
7713
|
}
|
|
@@ -7976,7 +7989,27 @@ var DexieDb = class extends Dexie {
|
|
|
7976
7989
|
}
|
|
7977
7990
|
return table;
|
|
7978
7991
|
}
|
|
7992
|
+
/**
|
|
7993
|
+
* Convert an Id to its string representation for IndexedDB key storage.
|
|
7994
|
+
* Throws on falsy values to prevent stuck-dirty items with garbage
|
|
7995
|
+
* _id values like "undefined" / "null" that can never be uploaded.
|
|
7996
|
+
*/
|
|
7979
7997
|
idToString(id) {
|
|
7998
|
+
if (!id && id !== void 0) {
|
|
7999
|
+
throw new Error(
|
|
8000
|
+
`[DexieDb.idToString] id is falsy (${JSON.stringify(id)}). This is a bug \u2014 a valid _id is required.`
|
|
8001
|
+
);
|
|
8002
|
+
}
|
|
8003
|
+
if (id === void 0) {
|
|
8004
|
+
throw new Error(
|
|
8005
|
+
`[DexieDb.idToString] id is undefined. This is a bug \u2014 a valid _id is required.`
|
|
8006
|
+
);
|
|
8007
|
+
}
|
|
8008
|
+
if (typeof id === "string" && (id === "undefined" || id === "null" || id === "0" || id === "false" || id === "")) {
|
|
8009
|
+
throw new Error(
|
|
8010
|
+
`[DexieDb.idToString] id is a stringified falsy value ("${id}"). This is a bug \u2014 a falsy value was coerced to string before being passed as _id.`
|
|
8011
|
+
);
|
|
8012
|
+
}
|
|
7980
8013
|
return String(id);
|
|
7981
8014
|
}
|
|
7982
8015
|
/** Ensure _id is a primitive string. IndexedDB rejects ObjectId objects as keys. */
|
package/dist/src/db/DexieDb.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export declare class DexieDb extends Dexie implements I_DexieDb {
|
|
|
15
15
|
private _isNewDatabase;
|
|
16
16
|
constructor(tenant: string, collectionConfigs: CollectionConfig<any>[]);
|
|
17
17
|
private getTable;
|
|
18
|
+
/**
|
|
19
|
+
* Convert an Id to its string representation for IndexedDB key storage.
|
|
20
|
+
* Throws on falsy values to prevent stuck-dirty items with garbage
|
|
21
|
+
* _id values like "undefined" / "null" that can never be uploaded.
|
|
22
|
+
*/
|
|
18
23
|
private idToString;
|
|
19
24
|
/** Ensure _id is a primitive string. IndexedDB rejects ObjectId objects as keys. */
|
|
20
25
|
private ensureStringId;
|
|
@@ -617,7 +617,15 @@ export declare class SyncedDb implements I_SyncedDb {
|
|
|
617
617
|
*/
|
|
618
618
|
private _autoRegisterTemporaryForFind;
|
|
619
619
|
private static readonly STRINGIFIED_FALSY;
|
|
620
|
-
/**
|
|
620
|
+
/**
|
|
621
|
+
* Stringify an Id parameter (ObjectId → hex string).
|
|
622
|
+
*
|
|
623
|
+
* Throws when `id` is falsy (null, undefined, 0, "", false) or is a
|
|
624
|
+
* stringified-falsy value ("undefined", "null", "0", "false", "").
|
|
625
|
+
* Passing a garbage _id creates a stuck dirty item that can never be
|
|
626
|
+
* uploaded (server rejects it) and can never be auto-healed (library
|
|
627
|
+
* doesn't know the correct _id). Fail-fast prevents silent data loss.
|
|
628
|
+
*/
|
|
621
629
|
private normalizeId;
|
|
622
630
|
/**
|
|
623
631
|
* Warn if a query/data object has `_id` present but falsy.
|