@peers-app/peers-sdk 0.21.5 → 0.21.7
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.
|
@@ -43,6 +43,14 @@ export interface INetworkStatusSummary {
|
|
|
43
43
|
connectionCount: number;
|
|
44
44
|
syncingContextCount: number;
|
|
45
45
|
errorCount: number;
|
|
46
|
+
/**
|
|
47
|
+
* Personal/shared sync contexts that have at least one other known sync peer
|
|
48
|
+
* but currently have no live SyncGroup connection. Personal peers are other
|
|
49
|
+
* same-user devices; shared peers are other devices (or group members) in that group.
|
|
50
|
+
*/
|
|
51
|
+
disconnectedContextCount: number;
|
|
52
|
+
/** Sync contexts that currently have at least one live SyncGroup connection. */
|
|
53
|
+
connectedContextCount: number;
|
|
46
54
|
lastSuccessfulSyncAt?: number;
|
|
47
55
|
errors: INetworkSyncError[];
|
|
48
56
|
}
|
|
@@ -76,7 +76,13 @@ export declare class PersistentVarsTable extends Table<IPersistentVar> {
|
|
|
76
76
|
}
|
|
77
77
|
/** Return the persistent-variable table for a data context. */
|
|
78
78
|
export declare function PersistentVars(dataContext?: DataContext): PersistentVarsTable;
|
|
79
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Reactive persistent value with an awaitable initial load and explicit deletion.
|
|
81
|
+
*
|
|
82
|
+
* A default value is an in-memory fallback and is not persisted by itself. The first
|
|
83
|
+
* observable-driven save for a locally absent record uses a weak insert so an established
|
|
84
|
+
* value arriving from another device takes precedence; later saves are normal updates.
|
|
85
|
+
*/
|
|
80
86
|
export type PersistentVar<T> = Observable<T> & {
|
|
81
87
|
loadingPromise: Promise<PersistentVar<T>>;
|
|
82
88
|
/** Delete the persistent variable from the database and reset to default value */
|
|
@@ -331,7 +331,7 @@ function persistentVarFactory(name, opts) {
|
|
|
331
331
|
const dc = getDataContext();
|
|
332
332
|
const table = PersistentVars(dc);
|
|
333
333
|
try {
|
|
334
|
-
rec = await table.save(rec);
|
|
334
|
+
rec = await table.save(rec, { weakInsert: true });
|
|
335
335
|
if (name === "colorModePreference") {
|
|
336
336
|
console.log(`Saved var ${name} to db:`, rec.value.value);
|
|
337
337
|
}
|