@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
|
@@ -4534,6 +4534,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4534
4534
|
function getClientStore() {
|
|
4535
4535
|
return clientStore;
|
|
4536
4536
|
}
|
|
4537
|
+
const useAppDispatch = () => reactRedux.useDispatch();
|
|
4538
|
+
const useAppSelector = reactRedux.useSelector;
|
|
4537
4539
|
const VERSION_REDUCER_KEY = "versioning";
|
|
4538
4540
|
const overmapReducers = {
|
|
4539
4541
|
// TODO: attachmentReducer,
|
|
@@ -4630,37 +4632,36 @@ var __publicField = (obj, key, value) => {
|
|
|
4630
4632
|
}
|
|
4631
4633
|
return overmapReducer(mutatedState, action);
|
|
4632
4634
|
};
|
|
4633
|
-
let __OUTBOX_COORDINATOR = null;
|
|
4634
4635
|
let __resolveOutboxCoordinator = null;
|
|
4636
|
+
let __outboxCoordinator = null;
|
|
4635
4637
|
const __OUTBOX_COORDINATOR_PROMISE = new Promise((resolve) => {
|
|
4636
4638
|
__resolveOutboxCoordinator = resolve;
|
|
4637
4639
|
}).then((coordinator) => {
|
|
4638
|
-
|
|
4639
|
-
return
|
|
4640
|
+
__outboxCoordinator = coordinator;
|
|
4641
|
+
return coordinator;
|
|
4640
4642
|
});
|
|
4641
|
-
function
|
|
4642
|
-
|
|
4643
|
+
async function getOutboxCoordinator() {
|
|
4644
|
+
return await __OUTBOX_COORDINATOR_PROMISE;
|
|
4645
|
+
}
|
|
4646
|
+
const useOutboxCoordinator = () => {
|
|
4647
|
+
const [coordinator, setCoordinator] = React.useState(null);
|
|
4648
|
+
const rehydrated = useAppSelector(selectRehydrated);
|
|
4649
|
+
React.useEffect(() => {
|
|
4650
|
+
if (!rehydrated) {
|
|
4651
|
+
return;
|
|
4652
|
+
}
|
|
4643
4653
|
const clientStore2 = getClientStore();
|
|
4644
4654
|
if (!clientStore2) {
|
|
4645
|
-
|
|
4655
|
+
throw new Error("Client store not set");
|
|
4646
4656
|
}
|
|
4647
4657
|
const outbox = clientStore2.getState().offline.outbox;
|
|
4648
|
-
|
|
4658
|
+
const coordinator2 = OutboxCoordinator._fromOutbox(outbox);
|
|
4659
|
+
setCoordinator(coordinator2);
|
|
4649
4660
|
if (!__resolveOutboxCoordinator) {
|
|
4650
|
-
throw new Error("Outbox coordinator promise not set");
|
|
4661
|
+
throw new Error("Outbox coordinator promise resolver not set");
|
|
4651
4662
|
}
|
|
4652
|
-
__resolveOutboxCoordinator(
|
|
4653
|
-
}
|
|
4654
|
-
return __OUTBOX_COORDINATOR;
|
|
4655
|
-
}
|
|
4656
|
-
const useOutboxCoordinator = () => {
|
|
4657
|
-
const [coordinator, setCoordinator] = React.useState(null);
|
|
4658
|
-
React.useEffect(() => {
|
|
4659
|
-
async function getCoordinator() {
|
|
4660
|
-
setCoordinator(await __OUTBOX_COORDINATOR_PROMISE);
|
|
4661
|
-
}
|
|
4662
|
-
void getCoordinator();
|
|
4663
|
-
}, []);
|
|
4663
|
+
__resolveOutboxCoordinator(coordinator2);
|
|
4664
|
+
}, [rehydrated]);
|
|
4664
4665
|
return coordinator;
|
|
4665
4666
|
};
|
|
4666
4667
|
const persistCallback = (err) => {
|
|
@@ -4674,7 +4675,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4674
4675
|
}
|
|
4675
4676
|
};
|
|
4676
4677
|
const enqueue = (_array, item, _context) => {
|
|
4677
|
-
const coordinator =
|
|
4678
|
+
const coordinator = __outboxCoordinator;
|
|
4678
4679
|
if (!coordinator) {
|
|
4679
4680
|
throw new Error("Outbox coordinator not set");
|
|
4680
4681
|
}
|
|
@@ -4682,7 +4683,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4682
4683
|
return coordinator.getQueue();
|
|
4683
4684
|
};
|
|
4684
4685
|
const dequeue = (_array, item, _context) => {
|
|
4685
|
-
const coordinator =
|
|
4686
|
+
const coordinator = __outboxCoordinator;
|
|
4686
4687
|
if (!coordinator) {
|
|
4687
4688
|
throw new Error("Outbox coordinator not set");
|
|
4688
4689
|
}
|
|
@@ -4977,7 +4978,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4977
4978
|
const uuid2 = action.payload.uuid;
|
|
4978
4979
|
function rollbackAndThrow() {
|
|
4979
4980
|
clientStore2.dispatch(markAsDeleted(uuid2));
|
|
4980
|
-
|
|
4981
|
+
__outboxCoordinator.remove(action.payload.uuid);
|
|
4981
4982
|
const rollbackAction = action.meta.offline.rollback;
|
|
4982
4983
|
if (rollbackAction) {
|
|
4983
4984
|
console.warn("Rolling back request due to SDK error:", action);
|
|
@@ -5008,24 +5009,22 @@ var __publicField = (obj, key, value) => {
|
|
|
5008
5009
|
console.error(`Could not display toast for status ${status} because there is no toast handle.`);
|
|
5009
5010
|
}
|
|
5010
5011
|
}
|
|
5011
|
-
|
|
5012
|
+
__outboxCoordinator.remove(action.payload.uuid);
|
|
5012
5013
|
reason.options.discard = true;
|
|
5013
5014
|
rollbackAndThrow();
|
|
5014
5015
|
}
|
|
5015
5016
|
}
|
|
5016
5017
|
console.debug("Registering a retry for request:", action.payload.uuid);
|
|
5017
|
-
|
|
5018
|
+
__outboxCoordinator.registerRetry(action.payload.uuid);
|
|
5018
5019
|
return false;
|
|
5019
5020
|
}
|
|
5020
5021
|
function peek(_array, _item, _context) {
|
|
5021
|
-
return
|
|
5022
|
+
return __outboxCoordinator == null ? void 0 : __outboxCoordinator.peek();
|
|
5022
5023
|
}
|
|
5023
5024
|
function retry(_action, _retries) {
|
|
5024
5025
|
getClientStore().dispatch(_setLatestRetryTime((/* @__PURE__ */ new Date()).getTime()));
|
|
5025
5026
|
return OUTBOX_RETRY_DELAY;
|
|
5026
5027
|
}
|
|
5027
|
-
const useAppDispatch = () => reactRedux.useDispatch();
|
|
5028
|
-
const useAppSelector = reactRedux.useSelector;
|
|
5029
5028
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
5030
5029
|
function parseTokens(response) {
|
|
5031
5030
|
if (!response.access)
|
|
@@ -16803,7 +16802,6 @@ var __publicField = (obj, key, value) => {
|
|
|
16803
16802
|
exports2.VerificationCodeType = VerificationCodeType;
|
|
16804
16803
|
exports2.WorkspaceService = WorkspaceService;
|
|
16805
16804
|
exports2.YELLOW = YELLOW;
|
|
16806
|
-
exports2._getOutboxCoordinator = _getOutboxCoordinator;
|
|
16807
16805
|
exports2._selectLatestFormRevision = _selectLatestFormRevision;
|
|
16808
16806
|
exports2._setLatestRetryTime = _setLatestRetryTime;
|
|
16809
16807
|
exports2.acceptProjectInvite = acceptProjectInvite;
|
|
@@ -16945,6 +16943,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16945
16943
|
exports2.getLocalDateString = getLocalDateString;
|
|
16946
16944
|
exports2.getLocalRelativeDateString = getLocalRelativeDateString;
|
|
16947
16945
|
exports2.getMarkerCoordinates = getMarkerCoordinates;
|
|
16946
|
+
exports2.getOutboxCoordinator = getOutboxCoordinator;
|
|
16948
16947
|
exports2.getRenamedFile = getRenamedFile;
|
|
16949
16948
|
exports2.getStageColor = getStageColor;
|
|
16950
16949
|
exports2.hashFile = hashFile;
|