nexabase-console 2.0.9 → 2.1.0
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/app/NexaApp.d.ts +2 -0
- package/dist/app/NexaApp.js +18 -1
- package/dist/firestore/writes.js +3 -1
- package/package.json +1 -1
package/dist/app/NexaApp.d.ts
CHANGED
package/dist/app/NexaApp.js
CHANGED
|
@@ -166,14 +166,31 @@ class NexaApp {
|
|
|
166
166
|
const db = this.indexedDB.getRawDB();
|
|
167
167
|
const queue = this.mutationQueue.inMemoryQueue;
|
|
168
168
|
const jobIndex = queue.findIndex((j) => j.id === mutationId);
|
|
169
|
-
|
|
169
|
+
let jobData = null;
|
|
170
|
+
if (jobIndex !== -1) {
|
|
171
|
+
jobData = queue[jobIndex];
|
|
170
172
|
queue.splice(jobIndex, 1);
|
|
173
|
+
}
|
|
171
174
|
if (options.action === 'delete') {
|
|
172
175
|
this.localStore.getServerBaseCache()[path] = null;
|
|
173
176
|
}
|
|
174
177
|
else if (serverDocument && serverDocument.fields) {
|
|
175
178
|
this.localStore.getServerBaseCache()[path] = (0, QueryUtils_1.reviveNexaData)(serverDocument.fields);
|
|
176
179
|
}
|
|
180
|
+
else {
|
|
181
|
+
// PROMOTION: If server returned success: true without serverDocument.fields (lightweight ACK),
|
|
182
|
+
// promote the local mutation payload to Server Base Cache so the document does not revert to null!
|
|
183
|
+
const rawData = (jobData ? jobData.data : options.mutationData) || {};
|
|
184
|
+
const isMerge = jobData ? jobData.merge : options.merge;
|
|
185
|
+
let currentBase = this.localStore.getServerBaseCache()[path];
|
|
186
|
+
currentBase = currentBase !== undefined && currentBase !== null ? (0, QueryUtils_1.cloneNexaData)(currentBase) : currentBase;
|
|
187
|
+
if (options.action === 'set' && !isMerge) {
|
|
188
|
+
this.localStore.getServerBaseCache()[path] = (0, QueryUtils_1.reviveNexaData)((0, helpers_1.applyDataTransforms)({}, rawData));
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
this.localStore.getServerBaseCache()[path] = (0, QueryUtils_1.reviveNexaData)((0, helpers_1.applyDataTransforms)(currentBase || {}, rawData));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
177
194
|
const view = this._calculateLocalView(path);
|
|
178
195
|
const rebasedData = view.data;
|
|
179
196
|
if (rebasedData === null) {
|
package/dist/firestore/writes.js
CHANGED
|
@@ -173,7 +173,9 @@ const executeWriteMutation = async (docRef, action, data, options) => {
|
|
|
173
173
|
path: docRef.path,
|
|
174
174
|
action,
|
|
175
175
|
serverDocument: res.document,
|
|
176
|
-
updateTime: res.document?.updateTime
|
|
176
|
+
updateTime: res.document?.updateTime,
|
|
177
|
+
mutationData: data,
|
|
178
|
+
merge: options?.merge
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
181
|
catch (ackError) {
|
package/package.json
CHANGED