(
storeOperations: StoreOperations,
dbID: DatabaseIdentifier,
)
| 242 | }, |
| 243 | |
| 244 | async processDBStoreOperations( |
| 245 | storeOperations: StoreOperations, |
| 246 | dbID: DatabaseIdentifier, |
| 247 | ): Promise<void> { |
| 248 | const dbOps = |
| 249 | convertStoreOperationsToClientDBStoreOperations(storeOperations); |
| 250 | |
| 251 | if (!values(dbOps).some(ops => ops && ops.length > 0)) { |
| 252 | return; |
| 253 | } |
| 254 | |
| 255 | const sharedWorker = await getCommSharedWorker(); |
| 256 | const isSupported = await sharedWorker.isSupported(); |
| 257 | if (!isSupported) { |
| 258 | return; |
| 259 | } |
| 260 | try { |
| 261 | await sharedWorker.schedule({ |
| 262 | type: workerRequestMessageTypes.PROCESS_STORE_OPERATIONS, |
| 263 | storeOperations: dbOps, |
| 264 | dbID, |
| 265 | }); |
| 266 | } catch (e) { |
| 267 | console.log(e); |
| 268 | if ( |
| 269 | entries(storeOperations).some( |
| 270 | ([key, ops]) => |
| 271 | key !== 'draftStoreOperations' && |
| 272 | key !== 'reportStoreOperations' && |
| 273 | ops.length > 0, |
| 274 | ) |
| 275 | ) { |
| 276 | await sharedWorker.init({ clearDatabase: true, markAsCorrupted: true }); |
| 277 | location.reload(); |
| 278 | } |
| 279 | } |
| 280 | }, |
| 281 | |
| 282 | //backup |
| 283 | async restoreUserData( |
no test coverage detected