@jcbuisson/express-x-client 3.1.1 → 3.1.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/package.json +1 -1
- package/src/client.mts +5 -6
package/package.json
CHANGED
package/src/client.mts
CHANGED
|
@@ -159,6 +159,7 @@ export async function reloadPlugin(app) {
|
|
|
159
159
|
})
|
|
160
160
|
socket.once('cnx-transfer-error', async (fromSocketId, toSocketId) => {
|
|
161
161
|
console.log('ERR ERR!!!', fromSocketId, toSocketId)
|
|
162
|
+
cnxid.value = socketId
|
|
162
163
|
})
|
|
163
164
|
socket.emit('cnx-transfer', prevSocketId, socketId)
|
|
164
165
|
} else {
|
|
@@ -314,7 +315,7 @@ export function offlinePlugin(app) {
|
|
|
314
315
|
|
|
315
316
|
function addSynchroWhere(where: object) {
|
|
316
317
|
const promise = addSynchroDBWhere(where, db.whereList)
|
|
317
|
-
promise.then(isNew => isNew &&
|
|
318
|
+
promise.then(isNew => isNew && console.log(`addSynchroWhere (${++count})`, dbName, modelName, where))
|
|
318
319
|
return promise
|
|
319
320
|
}
|
|
320
321
|
|
|
@@ -435,14 +436,13 @@ export function offlinePlugin(app) {
|
|
|
435
436
|
// assigned, so checking fullValue == null afterwards is too late.
|
|
436
437
|
if (elt.uid == null) continue
|
|
437
438
|
const fullValue = await idbValues.get(elt.uid)
|
|
438
|
-
const meta = await idbMetadata.get(elt.uid)
|
|
439
439
|
if (fullValue == null) continue // record deleted concurrently
|
|
440
440
|
delete fullValue.uid
|
|
441
441
|
delete fullValue.__deleted__
|
|
442
442
|
try {
|
|
443
|
-
await app.service(modelName).createWithMeta(elt.uid, fullValue,
|
|
443
|
+
await app.service(modelName).createWithMeta(elt.uid, fullValue, elt.created_at)
|
|
444
444
|
} catch(err) {
|
|
445
|
-
console.log("*** err sync user addDatabase", err, elt.uid, fullValue,
|
|
445
|
+
console.log("*** err sync user addDatabase", err, elt.uid, fullValue, elt.created_at)
|
|
446
446
|
// rollback
|
|
447
447
|
await idbValues.delete(elt.uid)
|
|
448
448
|
await idbMetadata.delete(elt.uid)
|
|
@@ -453,12 +453,11 @@ export function offlinePlugin(app) {
|
|
|
453
453
|
for (const elt of updateDatabase) {
|
|
454
454
|
if (elt.uid == null) continue
|
|
455
455
|
const fullValue = await idbValues.get(elt.uid)
|
|
456
|
-
const meta = await idbMetadata.get(elt.uid)
|
|
457
456
|
if (fullValue == null) continue // record deleted concurrently
|
|
458
457
|
delete fullValue.uid
|
|
459
458
|
delete fullValue.__deleted__
|
|
460
459
|
try {
|
|
461
|
-
await app.service(modelName).updateWithMeta(elt.uid, fullValue,
|
|
460
|
+
await app.service(modelName).updateWithMeta(elt.uid, fullValue, elt.updated_at)
|
|
462
461
|
} catch(err) {
|
|
463
462
|
console.log("*** err sync user updateDatabase", err)
|
|
464
463
|
// Leave client's local version intact; it will be retried on the next sync.
|