@overmap-ai/core 1.0.53-fix-outbox.4 → 1.0.53-fix-outbox.6
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/overmap-core.js +28 -29
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +28 -29
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/store/store.d.ts +1 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -4544,6 +4544,8 @@ function setClientStore(store) {
|
|
|
4544
4544
|
function getClientStore() {
|
|
4545
4545
|
return clientStore;
|
|
4546
4546
|
}
|
|
4547
|
+
const useAppDispatch = () => useDispatch();
|
|
4548
|
+
const useAppSelector = useSelector;
|
|
4547
4549
|
const VERSION_REDUCER_KEY = "versioning";
|
|
4548
4550
|
const overmapReducers = {
|
|
4549
4551
|
// TODO: attachmentReducer,
|
|
@@ -4640,37 +4642,36 @@ const rootReducer = (state, action) => {
|
|
|
4640
4642
|
}
|
|
4641
4643
|
return overmapReducer(mutatedState, action);
|
|
4642
4644
|
};
|
|
4643
|
-
let __OUTBOX_COORDINATOR = null;
|
|
4644
4645
|
let __resolveOutboxCoordinator = null;
|
|
4646
|
+
let __outboxCoordinator = null;
|
|
4645
4647
|
const __OUTBOX_COORDINATOR_PROMISE = new Promise((resolve) => {
|
|
4646
4648
|
__resolveOutboxCoordinator = resolve;
|
|
4647
4649
|
}).then((coordinator) => {
|
|
4648
|
-
|
|
4649
|
-
return
|
|
4650
|
+
__outboxCoordinator = coordinator;
|
|
4651
|
+
return coordinator;
|
|
4650
4652
|
});
|
|
4651
|
-
function
|
|
4652
|
-
|
|
4653
|
+
async function getOutboxCoordinator() {
|
|
4654
|
+
return await __OUTBOX_COORDINATOR_PROMISE;
|
|
4655
|
+
}
|
|
4656
|
+
const useOutboxCoordinator = () => {
|
|
4657
|
+
const [coordinator, setCoordinator] = useState(null);
|
|
4658
|
+
const rehydrated = useAppSelector(selectRehydrated);
|
|
4659
|
+
useEffect(() => {
|
|
4660
|
+
if (!rehydrated) {
|
|
4661
|
+
return;
|
|
4662
|
+
}
|
|
4653
4663
|
const clientStore2 = getClientStore();
|
|
4654
4664
|
if (!clientStore2) {
|
|
4655
|
-
|
|
4665
|
+
throw new Error("Client store not set");
|
|
4656
4666
|
}
|
|
4657
4667
|
const outbox = clientStore2.getState().offline.outbox;
|
|
4658
|
-
|
|
4668
|
+
const coordinator2 = OutboxCoordinator._fromOutbox(outbox);
|
|
4669
|
+
setCoordinator(coordinator2);
|
|
4659
4670
|
if (!__resolveOutboxCoordinator) {
|
|
4660
|
-
throw new Error("Outbox coordinator promise not set");
|
|
4671
|
+
throw new Error("Outbox coordinator promise resolver not set");
|
|
4661
4672
|
}
|
|
4662
|
-
__resolveOutboxCoordinator(
|
|
4663
|
-
}
|
|
4664
|
-
return __OUTBOX_COORDINATOR;
|
|
4665
|
-
}
|
|
4666
|
-
const useOutboxCoordinator = () => {
|
|
4667
|
-
const [coordinator, setCoordinator] = useState(null);
|
|
4668
|
-
useEffect(() => {
|
|
4669
|
-
async function getCoordinator() {
|
|
4670
|
-
setCoordinator(await __OUTBOX_COORDINATOR_PROMISE);
|
|
4671
|
-
}
|
|
4672
|
-
void getCoordinator();
|
|
4673
|
-
}, []);
|
|
4673
|
+
__resolveOutboxCoordinator(coordinator2);
|
|
4674
|
+
}, [rehydrated]);
|
|
4674
4675
|
return coordinator;
|
|
4675
4676
|
};
|
|
4676
4677
|
const persistCallback = (err) => {
|
|
@@ -4684,7 +4685,7 @@ const persistCallback = (err) => {
|
|
|
4684
4685
|
}
|
|
4685
4686
|
};
|
|
4686
4687
|
const enqueue = (_array, item, _context) => {
|
|
4687
|
-
const coordinator =
|
|
4688
|
+
const coordinator = __outboxCoordinator;
|
|
4688
4689
|
if (!coordinator) {
|
|
4689
4690
|
throw new Error("Outbox coordinator not set");
|
|
4690
4691
|
}
|
|
@@ -4692,7 +4693,7 @@ const enqueue = (_array, item, _context) => {
|
|
|
4692
4693
|
return coordinator.getQueue();
|
|
4693
4694
|
};
|
|
4694
4695
|
const dequeue = (_array, item, _context) => {
|
|
4695
|
-
const coordinator =
|
|
4696
|
+
const coordinator = __outboxCoordinator;
|
|
4696
4697
|
if (!coordinator) {
|
|
4697
4698
|
throw new Error("Outbox coordinator not set");
|
|
4698
4699
|
}
|
|
@@ -4987,7 +4988,7 @@ function discard(reason, action, retries = 0) {
|
|
|
4987
4988
|
const uuid = action.payload.uuid;
|
|
4988
4989
|
function rollbackAndThrow() {
|
|
4989
4990
|
clientStore2.dispatch(markAsDeleted(uuid));
|
|
4990
|
-
|
|
4991
|
+
__outboxCoordinator.remove(action.payload.uuid);
|
|
4991
4992
|
const rollbackAction = action.meta.offline.rollback;
|
|
4992
4993
|
if (rollbackAction) {
|
|
4993
4994
|
console.warn("Rolling back request due to SDK error:", action);
|
|
@@ -5018,24 +5019,22 @@ function discard(reason, action, retries = 0) {
|
|
|
5018
5019
|
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
5019
5020
|
}
|
|
5020
5021
|
}
|
|
5021
|
-
|
|
5022
|
+
__outboxCoordinator.remove(action.payload.uuid);
|
|
5022
5023
|
reason.options.discard = true;
|
|
5023
5024
|
rollbackAndThrow();
|
|
5024
5025
|
}
|
|
5025
5026
|
}
|
|
5026
5027
|
console.debug("Registering a retry for request:", action.payload.uuid);
|
|
5027
|
-
|
|
5028
|
+
__outboxCoordinator.registerRetry(action.payload.uuid);
|
|
5028
5029
|
return false;
|
|
5029
5030
|
}
|
|
5030
5031
|
function peek(_array, _item, _context) {
|
|
5031
|
-
return
|
|
5032
|
+
return __outboxCoordinator == null ? void 0 : __outboxCoordinator.peek();
|
|
5032
5033
|
}
|
|
5033
5034
|
function retry(_action, _retries) {
|
|
5034
5035
|
getClientStore().dispatch(_setLatestRetryTime((/* @__PURE__ */ new Date()).getTime()));
|
|
5035
5036
|
return OUTBOX_RETRY_DELAY;
|
|
5036
5037
|
}
|
|
5037
|
-
const useAppDispatch = () => useDispatch();
|
|
5038
|
-
const useAppSelector = useSelector;
|
|
5039
5038
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
5040
5039
|
function parseTokens(response) {
|
|
5041
5040
|
if (!response.access)
|
|
@@ -16814,7 +16813,6 @@ export {
|
|
|
16814
16813
|
VerificationCodeType,
|
|
16815
16814
|
WorkspaceService,
|
|
16816
16815
|
YELLOW,
|
|
16817
|
-
_getOutboxCoordinator,
|
|
16818
16816
|
_selectLatestFormRevision,
|
|
16819
16817
|
_setLatestRetryTime,
|
|
16820
16818
|
acceptProjectInvite,
|
|
@@ -16956,6 +16954,7 @@ export {
|
|
|
16956
16954
|
getLocalDateString,
|
|
16957
16955
|
getLocalRelativeDateString,
|
|
16958
16956
|
getMarkerCoordinates,
|
|
16957
|
+
getOutboxCoordinator,
|
|
16959
16958
|
getRenamedFile,
|
|
16960
16959
|
getStageColor,
|
|
16961
16960
|
hashFile,
|