dexie-cloud-addon 4.0.8 → 4.0.12
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/dist/modern/define-ydoc-trigger.d.ts +2 -0
- package/dist/modern/dexie-cloud-addon.js +21 -14
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/service-worker.js +21 -14
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/modern/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +1 -0
- package/dist/modern/yjs/Y.d.ts +3 -0
- package/dist/modern/yjs/YDexieCloudSyncState.d.ts +3 -0
- package/dist/modern/yjs/YTable.d.ts +2 -0
- package/dist/modern/yjs/applyYMessages.d.ts +9 -0
- package/dist/modern/yjs/awareness.d.ts +4 -0
- package/dist/modern/yjs/createYClientUpdateObservable.d.ts +4 -0
- package/dist/modern/yjs/createYHandler.d.ts +5 -0
- package/dist/modern/yjs/downloadYDocsFromServer.d.ts +3 -0
- package/dist/modern/yjs/getUpdatesTable.d.ts +3 -0
- package/dist/modern/yjs/listUpdatesSince.d.ts +2 -0
- package/dist/modern/yjs/listYClientMessagesAndStateVector.d.ts +26 -0
- package/dist/modern/yjs/reopenDocSignal.d.ts +10 -0
- package/dist/modern/yjs/updateYSyncStates.d.ts +6 -0
- package/dist/umd/define-ydoc-trigger.d.ts +2 -0
- package/dist/umd/dexie-cloud-addon.js +21 -14
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +21 -14
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/dist/umd/sync/DEXIE_CLOUD_SYNCER_ID.d.ts +1 -0
- package/dist/umd/yjs/Y.d.ts +3 -0
- package/dist/umd/yjs/YDexieCloudSyncState.d.ts +3 -0
- package/dist/umd/yjs/YTable.d.ts +2 -0
- package/dist/umd/yjs/applyYMessages.d.ts +9 -0
- package/dist/umd/yjs/awareness.d.ts +4 -0
- package/dist/umd/yjs/createYClientUpdateObservable.d.ts +4 -0
- package/dist/umd/yjs/createYHandler.d.ts +5 -0
- package/dist/umd/yjs/downloadYDocsFromServer.d.ts +3 -0
- package/dist/umd/yjs/getUpdatesTable.d.ts +3 -0
- package/dist/umd/yjs/listUpdatesSince.d.ts +2 -0
- package/dist/umd/yjs/listYClientMessagesAndStateVector.d.ts +26 -0
- package/dist/umd/yjs/reopenDocSignal.d.ts +10 -0
- package/dist/umd/yjs/updateYSyncStates.d.ts +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEXIE_CLOUD_SYNCER_ID = "dexie-cloud-syncer";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { YServerMessage } from 'dexie-cloud-common';
|
|
3
|
+
export declare function applyYServerMessages(yMessages: YServerMessage[], db: DexieCloudDB): Promise<{
|
|
4
|
+
receivedUntils: {
|
|
5
|
+
[yTable: string]: number;
|
|
6
|
+
};
|
|
7
|
+
resyncNeeded: boolean;
|
|
8
|
+
yServerRevision?: string;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DexieCloudDB } from "../db/DexieCloudDB";
|
|
2
|
+
export declare function getAwarenessLibrary(db: DexieCloudDB): typeof import('y-protocols/awareness');
|
|
3
|
+
export declare const awarenessWeakMap: WeakMap<any, import("y-protocols/awareness").Awareness>;
|
|
4
|
+
export declare const getDocAwareness: (doc: any) => import("y-protocols/awareness").Awareness | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
2
|
+
import { PersistedSyncState } from '../db/entities/PersistedSyncState';
|
|
3
|
+
export declare function downloadYDocsFromServer(db: DexieCloudDB, databaseUrl: string, { yDownloadedRealms, realms }: PersistedSyncState): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Table } from 'dexie';
|
|
2
|
+
import type { YClientMessage } from 'dexie-cloud-common';
|
|
3
|
+
import { DexieCloudDB } from '../db/DexieCloudDB';
|
|
4
|
+
import { EntityCommon } from '../db/entities/EntityCommon';
|
|
5
|
+
/** Queries the local database for YMessages to send to server.
|
|
6
|
+
*
|
|
7
|
+
* There are 2 messages that this function can provide:
|
|
8
|
+
* YUpdateFromClientRequest ( for local updates )
|
|
9
|
+
* YStateVector ( for state vector of foreign updates so that server can reduce the number of udpates to send back )
|
|
10
|
+
*
|
|
11
|
+
* Notice that we do not do a step 1 sync phase here to get a state vector from the server. Reason we can avoid
|
|
12
|
+
* the 2-step sync is that we are client-server and not client-client here and we keep track of the client changes
|
|
13
|
+
* sent to server by letting server acknowledge them. There is always a chance that some client update has already
|
|
14
|
+
* been sent and that the client failed to receive the ack. However, if this happens it does not matter - the change
|
|
15
|
+
* would be sent again and Yjs handles duplicate changes anyway. And it's rare so we earn the cost of roundtrips by
|
|
16
|
+
* avoiding the step1 sync and instead keep track of this in the `unsentFrom` property of the SyncState.
|
|
17
|
+
*
|
|
18
|
+
* @param db
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function listYClientMessagesAndStateVector(db: DexieCloudDB, tablesToSync: Table<EntityCommon>[]): Promise<{
|
|
22
|
+
yMessages: YClientMessage[];
|
|
23
|
+
lastUpdateIds: {
|
|
24
|
+
[yTable: string]: number;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { YjsDoc } from "dexie";
|
|
2
|
+
import { Subject } from "rxjs";
|
|
3
|
+
/** A property (package-private) on Y.Doc that is used
|
|
4
|
+
* to signal that the server wants us to send a 'doc-open' message
|
|
5
|
+
* to the server for this document.
|
|
6
|
+
*
|
|
7
|
+
* @param doc
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function getOpenDocSignal(doc: YjsDoc): Subject<void>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.0.
|
|
11
|
+
* Version 4.0.12, Mon Jun 09 2025
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -3143,7 +3143,7 @@
|
|
|
3143
3143
|
},
|
|
3144
3144
|
};
|
|
3145
3145
|
|
|
3146
|
-
const bigIntDef = {
|
|
3146
|
+
const bigIntDef$1 = {
|
|
3147
3147
|
bigint: {
|
|
3148
3148
|
replace: (realVal) => {
|
|
3149
3149
|
return { $t: "bigint", v: "" + realVal };
|
|
@@ -3386,7 +3386,7 @@
|
|
|
3386
3386
|
|
|
3387
3387
|
const builtin = {
|
|
3388
3388
|
...numberDef,
|
|
3389
|
-
...bigIntDef,
|
|
3389
|
+
...bigIntDef$1,
|
|
3390
3390
|
...DateDef,
|
|
3391
3391
|
...SetDef,
|
|
3392
3392
|
...MapDef,
|
|
@@ -3496,7 +3496,7 @@
|
|
|
3496
3496
|
this.v = value;
|
|
3497
3497
|
}
|
|
3498
3498
|
}
|
|
3499
|
-
const
|
|
3499
|
+
const bigIntDef = hasBigIntSupport
|
|
3500
3500
|
? {}
|
|
3501
3501
|
: {
|
|
3502
3502
|
bigint: {
|
|
@@ -3504,17 +3504,19 @@
|
|
|
3504
3504
|
replace: (fakeBigInt) => {
|
|
3505
3505
|
return Object.assign({ $t: 'bigint' }, fakeBigInt);
|
|
3506
3506
|
},
|
|
3507
|
-
revive: ({ v
|
|
3508
|
-
}
|
|
3509
|
-
}
|
|
3507
|
+
revive: ({ v }) => new FakeBigInt(v),
|
|
3508
|
+
},
|
|
3509
|
+
};
|
|
3510
|
+
const defs = Object.assign(Object.assign(Object.assign({}, undefinedDef), bigIntDef), { PropModification: {
|
|
3510
3511
|
test: (val) => val instanceof Dexie.PropModification,
|
|
3511
3512
|
replace: (propModification) => {
|
|
3512
|
-
return Object.assign({ $t: 'PropModification' }, propModification);
|
|
3513
|
+
return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
|
|
3513
3514
|
},
|
|
3514
3515
|
revive: (_a) => {
|
|
3515
|
-
var
|
|
3516
|
-
|
|
3517
|
-
|
|
3516
|
+
var propModSpec = __rest(_a, ["$t"]) // keep the rest
|
|
3517
|
+
;
|
|
3518
|
+
return new Dexie.PropModification(propModSpec);
|
|
3519
|
+
},
|
|
3518
3520
|
} });
|
|
3519
3521
|
const TSON = TypesonSimplified(builtin, defs);
|
|
3520
3522
|
const BISON = Bison(defs);
|
|
@@ -3753,6 +3755,9 @@
|
|
|
3753
3755
|
serverRev,
|
|
3754
3756
|
};
|
|
3755
3757
|
}));
|
|
3758
|
+
// Clean up baseRevs for tables that do not exist anymore or are no longer marked for sync
|
|
3759
|
+
// Resolve #2168 by also cleaning up baseRevs for tables that are not marked for sync
|
|
3760
|
+
yield db.$baseRevs.where('tableName').noneOf(Object.keys(schema).filter((table) => schema[table].markedForSync)).delete();
|
|
3756
3761
|
});
|
|
3757
3762
|
}
|
|
3758
3763
|
|
|
@@ -3958,7 +3963,9 @@
|
|
|
3958
3963
|
//
|
|
3959
3964
|
const [clientChangeSet, syncState, baseRevs] = yield db.transaction('r', db.tables, () => __awaiter(this, void 0, void 0, function* () {
|
|
3960
3965
|
const syncState = yield db.getPersistedSyncState();
|
|
3961
|
-
|
|
3966
|
+
let baseRevs = yield db.$baseRevs.toArray();
|
|
3967
|
+
// Resolve #2168
|
|
3968
|
+
baseRevs = baseRevs.filter(br => tablesToSync.some(tbl => tbl.name === br.tableName));
|
|
3962
3969
|
let clientChanges = yield listClientChanges(mutationTables);
|
|
3963
3970
|
throwIfCancelled(cancelToken);
|
|
3964
3971
|
if (doSyncify) {
|
|
@@ -6313,7 +6320,7 @@
|
|
|
6313
6320
|
const syncComplete = new rxjs.Subject();
|
|
6314
6321
|
dexie.cloud = {
|
|
6315
6322
|
// @ts-ignore
|
|
6316
|
-
version: "4.0.
|
|
6323
|
+
version: "4.0.12",
|
|
6317
6324
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6318
6325
|
schema: null,
|
|
6319
6326
|
get currentUserId() {
|
|
@@ -6608,7 +6615,7 @@
|
|
|
6608
6615
|
}
|
|
6609
6616
|
}
|
|
6610
6617
|
// @ts-ignore
|
|
6611
|
-
dexieCloud.version = "4.0.
|
|
6618
|
+
dexieCloud.version = "4.0.12";
|
|
6612
6619
|
Dexie.Cloud = dexieCloud;
|
|
6613
6620
|
|
|
6614
6621
|
exports.default = dexieCloud;
|