@koolbase/core 12.38.1 → 12.38.2
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/cjs/database.d.ts +7 -0
- package/dist/cjs/database.js +17 -0
- package/dist/esm/database.d.ts +7 -0
- package/dist/esm/database.js +17 -0
- package/package.json +1 -1
package/dist/cjs/database.d.ts
CHANGED
|
@@ -215,6 +215,13 @@ export declare class KoolbaseDatabase {
|
|
|
215
215
|
* rebase onto: the conflict is removed and the held writes stay as they are.
|
|
216
216
|
*/
|
|
217
217
|
private settleConflict;
|
|
218
|
+
/**
|
|
219
|
+
* The server's version stands (keep theirs, abandon): the device's saved
|
|
220
|
+
* copy takes it -- it still held the refused change -- and what shows the
|
|
221
|
+
* collection hears of it (R125), so the screen stops showing what was
|
|
222
|
+
* discarded, offline too.
|
|
223
|
+
*/
|
|
224
|
+
private showServerVersion;
|
|
218
225
|
private dropConflict;
|
|
219
226
|
/**
|
|
220
227
|
* Issues the resolving write, conditional on the revision the refusal
|
package/dist/cjs/database.js
CHANGED
|
@@ -72,12 +72,14 @@ class KoolbaseDatabase {
|
|
|
72
72
|
// conflict, rather than the change quietly disappearing -- and what
|
|
73
73
|
// stands is what the writes held behind it now build on.
|
|
74
74
|
await this.settleConflict(c, c.server, c.serverRevision);
|
|
75
|
+
await this.showServerVersion(c);
|
|
75
76
|
},
|
|
76
77
|
abandon: async (id) => {
|
|
77
78
|
const c = await this.requireConflict(id);
|
|
78
79
|
// Neither version claimed to win, so the record stands as the server
|
|
79
80
|
// has it: what anything still queued must build on.
|
|
80
81
|
await this.settleConflict(c, c.server, c.serverRevision);
|
|
82
|
+
await this.showServerVersion(c);
|
|
81
83
|
},
|
|
82
84
|
};
|
|
83
85
|
this.config = config;
|
|
@@ -695,6 +697,21 @@ class KoolbaseDatabase {
|
|
|
695
697
|
(0, offline_state_js_1.rebaseHeldWrites)(s, c.recordId, resolved, revision);
|
|
696
698
|
});
|
|
697
699
|
}
|
|
700
|
+
/**
|
|
701
|
+
* The server's version stands (keep theirs, abandon): the device's saved
|
|
702
|
+
* copy takes it -- it still held the refused change -- and what shows the
|
|
703
|
+
* collection hears of it (R125), so the screen stops showing what was
|
|
704
|
+
* discarded, offline too.
|
|
705
|
+
*/
|
|
706
|
+
async showServerVersion(c) {
|
|
707
|
+
const userId = this.getUserId();
|
|
708
|
+
if (userId && c.recordId && c.server) {
|
|
709
|
+
const fields = Object.fromEntries(Object.entries(c.server).filter(([k]) => !k.startsWith('$')));
|
|
710
|
+
await (0, cache_store_js_1.cacheRecord)(userId, c.collection, c.recordId, fields, c.serverRevision);
|
|
711
|
+
await (0, cache_store_js_2.updateInCachedQueries)(userId, c.collection, c.recordId, fields);
|
|
712
|
+
}
|
|
713
|
+
void (0, query_refresh_js_1.refreshCollectionQueries)(c.collection);
|
|
714
|
+
}
|
|
698
715
|
async dropConflict(id) {
|
|
699
716
|
const userId = this.requireUserId('conflict resolution');
|
|
700
717
|
await (0, offline_state_js_1.mutateOfflineState)(userId, (s) => {
|
package/dist/esm/database.d.ts
CHANGED
|
@@ -215,6 +215,13 @@ export declare class KoolbaseDatabase {
|
|
|
215
215
|
* rebase onto: the conflict is removed and the held writes stay as they are.
|
|
216
216
|
*/
|
|
217
217
|
private settleConflict;
|
|
218
|
+
/**
|
|
219
|
+
* The server's version stands (keep theirs, abandon): the device's saved
|
|
220
|
+
* copy takes it -- it still held the refused change -- and what shows the
|
|
221
|
+
* collection hears of it (R125), so the screen stops showing what was
|
|
222
|
+
* discarded, offline too.
|
|
223
|
+
*/
|
|
224
|
+
private showServerVersion;
|
|
218
225
|
private dropConflict;
|
|
219
226
|
/**
|
|
220
227
|
* Issues the resolving write, conditional on the revision the refusal
|
package/dist/esm/database.js
CHANGED
|
@@ -69,12 +69,14 @@ export class KoolbaseDatabase {
|
|
|
69
69
|
// conflict, rather than the change quietly disappearing -- and what
|
|
70
70
|
// stands is what the writes held behind it now build on.
|
|
71
71
|
await this.settleConflict(c, c.server, c.serverRevision);
|
|
72
|
+
await this.showServerVersion(c);
|
|
72
73
|
},
|
|
73
74
|
abandon: async (id) => {
|
|
74
75
|
const c = await this.requireConflict(id);
|
|
75
76
|
// Neither version claimed to win, so the record stands as the server
|
|
76
77
|
// has it: what anything still queued must build on.
|
|
77
78
|
await this.settleConflict(c, c.server, c.serverRevision);
|
|
79
|
+
await this.showServerVersion(c);
|
|
78
80
|
},
|
|
79
81
|
};
|
|
80
82
|
this.config = config;
|
|
@@ -692,6 +694,21 @@ export class KoolbaseDatabase {
|
|
|
692
694
|
rebaseHeldWrites(s, c.recordId, resolved, revision);
|
|
693
695
|
});
|
|
694
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* The server's version stands (keep theirs, abandon): the device's saved
|
|
699
|
+
* copy takes it -- it still held the refused change -- and what shows the
|
|
700
|
+
* collection hears of it (R125), so the screen stops showing what was
|
|
701
|
+
* discarded, offline too.
|
|
702
|
+
*/
|
|
703
|
+
async showServerVersion(c) {
|
|
704
|
+
const userId = this.getUserId();
|
|
705
|
+
if (userId && c.recordId && c.server) {
|
|
706
|
+
const fields = Object.fromEntries(Object.entries(c.server).filter(([k]) => !k.startsWith('$')));
|
|
707
|
+
await cacheRecord(userId, c.collection, c.recordId, fields, c.serverRevision);
|
|
708
|
+
await updateInCachedQueries(userId, c.collection, c.recordId, fields);
|
|
709
|
+
}
|
|
710
|
+
void refreshCollectionQueries(c.collection);
|
|
711
|
+
}
|
|
695
712
|
async dropConflict(id) {
|
|
696
713
|
const userId = this.requireUserId('conflict resolution');
|
|
697
714
|
await mutateOfflineState(userId, (s) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/core",
|
|
3
|
-
"version": "12.38.
|
|
3
|
+
"version": "12.38.2",
|
|
4
4
|
"description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|