@overmap-ai/core 1.0.16-fix-misc-issues.7 → 1.0.16-fix-misc-issues.8
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.
|
@@ -9,9 +9,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
})(this, function(exports2, React, jsxRuntime, blocks, dependencyGraph, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, reactRedux, uuid, ColorCls, jwtDecode, constants, idb) {
|
|
10
10
|
var _a;
|
|
11
11
|
"use strict";
|
|
12
|
-
const debugLog = (...args) => {
|
|
13
|
-
console.trace(...args);
|
|
14
|
-
};
|
|
15
12
|
class OutboxCoordinator {
|
|
16
13
|
constructor() {
|
|
17
14
|
__publicField(this, "graph");
|
|
@@ -73,7 +70,6 @@ var __publicField = (obj, key, value) => {
|
|
|
73
70
|
* dependency from the new request node to that node.
|
|
74
71
|
*/
|
|
75
72
|
addRequest(request2) {
|
|
76
|
-
debugLog("Adding request to outbox:", request2);
|
|
77
73
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
78
74
|
if (request2.payload.blockers.length === 0 || this.graph.size() === 1) {
|
|
79
75
|
return;
|
|
@@ -83,7 +79,6 @@ var __publicField = (obj, key, value) => {
|
|
|
83
79
|
continue;
|
|
84
80
|
const details = this.graph.getNodeData(node);
|
|
85
81
|
if (request2.payload.blockers.some((blocker) => details.payload.blocks.includes(blocker))) {
|
|
86
|
-
debugLog("Adding dependency from", request2.payload.uuid, "to", node);
|
|
87
82
|
this._addDependency(request2.payload.uuid, node);
|
|
88
83
|
}
|
|
89
84
|
}
|
|
@@ -96,7 +91,6 @@ var __publicField = (obj, key, value) => {
|
|
|
96
91
|
* @param request The request to insert at the beginning of the queue.
|
|
97
92
|
*/
|
|
98
93
|
insertRequest(request2) {
|
|
99
|
-
debugLog("Inserting request at the beginning of the queue:", request2);
|
|
100
94
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
101
95
|
for (const node of this.graph.overallOrder()) {
|
|
102
96
|
if (node === request2.payload.uuid)
|
|
@@ -112,7 +106,6 @@ var __publicField = (obj, key, value) => {
|
|
|
112
106
|
* (from the offline store's outbox state) when the app is loaded.
|
|
113
107
|
*/
|
|
114
108
|
sneakRequest(request2) {
|
|
115
|
-
debugLog("Sneaking request into outbox:", request2);
|
|
116
109
|
this.graph.addNode(request2.payload.uuid, request2);
|
|
117
110
|
}
|
|
118
111
|
/**
|
|
@@ -121,7 +114,7 @@ var __publicField = (obj, key, value) => {
|
|
|
121
114
|
*/
|
|
122
115
|
_getNextNode() {
|
|
123
116
|
const leafNodes = this.graph.overallOrder(true);
|
|
124
|
-
let minAttempts =
|
|
117
|
+
let minAttempts = Number.MAX_SAFE_INTEGER;
|
|
125
118
|
let minAttemptsNode;
|
|
126
119
|
for (const node of leafNodes) {
|
|
127
120
|
const attempts = this.requestAttemptCounter[node] || 0;
|
|
@@ -130,7 +123,7 @@ var __publicField = (obj, key, value) => {
|
|
|
130
123
|
minAttemptsNode = node;
|
|
131
124
|
}
|
|
132
125
|
}
|
|
133
|
-
|
|
126
|
+
console.debug("Next node with the least attempts:", minAttemptsNode, "with", minAttempts, "attempts");
|
|
134
127
|
return minAttemptsNode;
|
|
135
128
|
}
|
|
136
129
|
/**
|
|
@@ -139,11 +132,9 @@ var __publicField = (obj, key, value) => {
|
|
|
139
132
|
peek() {
|
|
140
133
|
const nextNode = this._getNextNode();
|
|
141
134
|
if (!nextNode) {
|
|
142
|
-
debugLog("In peek: No next node; outbox is empty.");
|
|
143
135
|
return void 0;
|
|
144
136
|
}
|
|
145
137
|
const ret = this.graph.getNodeData(nextNode);
|
|
146
|
-
debugLog("Next node:", nextNode, "with data", ret);
|
|
147
138
|
return ret;
|
|
148
139
|
}
|
|
149
140
|
/**
|
|
@@ -151,7 +142,6 @@ var __publicField = (obj, key, value) => {
|
|
|
151
142
|
* @param uuid The UUID of the request to remove.
|
|
152
143
|
*/
|
|
153
144
|
remove(uuid2) {
|
|
154
|
-
debugLog("Removing request from outbox:", uuid2);
|
|
155
145
|
this.graph.removeNode(uuid2);
|
|
156
146
|
delete this.requestAttemptCounter[uuid2];
|
|
157
147
|
}
|
|
@@ -163,7 +153,6 @@ var __publicField = (obj, key, value) => {
|
|
|
163
153
|
if (nextRequestDetails) {
|
|
164
154
|
this.graph.removeNode(nextRequestDetails.payload.uuid);
|
|
165
155
|
}
|
|
166
|
-
debugLog("Popped request from outbox:", nextRequestDetails);
|
|
167
156
|
return nextRequestDetails;
|
|
168
157
|
}
|
|
169
158
|
/**
|
|
@@ -179,7 +168,6 @@ var __publicField = (obj, key, value) => {
|
|
|
179
168
|
(request2) => request2.payload.uuid === nextRequestDetails.payload.uuid
|
|
180
169
|
);
|
|
181
170
|
if (nextRequestIndex !== -1) {
|
|
182
|
-
debugLog("In getQueue: Moving next request to the front of the queue");
|
|
183
171
|
ret.splice(nextRequestIndex, 1);
|
|
184
172
|
ret.unshift(nextRequestDetails);
|
|
185
173
|
}
|
|
@@ -200,12 +188,10 @@ var __publicField = (obj, key, value) => {
|
|
|
200
188
|
const bAttempts = this.requestAttemptCounter[b.payload.uuid] || 0;
|
|
201
189
|
return aAttempts - bAttempts;
|
|
202
190
|
});
|
|
203
|
-
debugLog("In getReady: Ready requests:", ret);
|
|
204
191
|
return ret;
|
|
205
192
|
}
|
|
206
193
|
registerRetry(uuid2) {
|
|
207
194
|
this.requestAttemptCounter[uuid2] = (this.requestAttemptCounter[uuid2] || 0) + 1;
|
|
208
|
-
debugLog("Registered retry for request:", uuid2, "with", this.requestAttemptCounter[uuid2], "attempts");
|
|
209
195
|
}
|
|
210
196
|
}
|
|
211
197
|
class APIError extends Error {
|
|
@@ -3307,7 +3293,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3307
3293
|
});
|
|
3308
3294
|
async function performRequest(action, client) {
|
|
3309
3295
|
var _a2;
|
|
3310
|
-
debugLog("Inside performRequest. Action:", action);
|
|
3311
3296
|
async function checkToken() {
|
|
3312
3297
|
console.debug("CHECKING TOKEN");
|
|
3313
3298
|
if (client.auth.tokenIsExpiringSoon()) {
|
|
@@ -3320,7 +3305,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3320
3305
|
console.debug("A1");
|
|
3321
3306
|
const state = client.store.getState();
|
|
3322
3307
|
if (state.outboxReducer.deletedRequests.includes(action.payload.uuid)) {
|
|
3323
|
-
debugLog("Request was marked for deletion; throwing error.");
|
|
3324
3308
|
throw new Error("Request was marked for deletion");
|
|
3325
3309
|
}
|
|
3326
3310
|
await checkToken();
|
|
@@ -3340,12 +3324,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3340
3324
|
const accessToken = selectAccessToken(state);
|
|
3341
3325
|
console.debug("A");
|
|
3342
3326
|
if (attachmentHash && !file) {
|
|
3343
|
-
debugLog("Cannot upload uncached attachment:", attachmentHash);
|
|
3344
3327
|
throw new Error(`Cannot upload file ${attachmentHash} because it's not cached.`);
|
|
3345
3328
|
}
|
|
3346
3329
|
console.debug("B");
|
|
3347
3330
|
if ((!isExternalUrl || false) && !url.startsWith("http")) {
|
|
3348
|
-
debugLog("Prepending base URL to relative URL:", url);
|
|
3349
3331
|
if (!url.startsWith("/") && !url.startsWith("blob:")) {
|
|
3350
3332
|
url = "/" + url;
|
|
3351
3333
|
}
|
|
@@ -3402,10 +3384,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3402
3384
|
}
|
|
3403
3385
|
console.debug("D");
|
|
3404
3386
|
try {
|
|
3405
|
-
debugLog("Sending request:", requestDetails, "with params:", queryParams);
|
|
3406
3387
|
return await requestToSend.query(queryParams);
|
|
3407
3388
|
} catch (error) {
|
|
3408
|
-
debugLog("Request failed:", error);
|
|
3409
3389
|
console.error(error);
|
|
3410
3390
|
const originalError = error;
|
|
3411
3391
|
if (originalError.status === 401) {
|
|
@@ -3427,7 +3407,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3427
3407
|
}
|
|
3428
3408
|
}
|
|
3429
3409
|
const apiErrorMessage = (_a2 = originalError.body) == null ? void 0 : _a2.error;
|
|
3430
|
-
debugLog("API error message:", apiErrorMessage);
|
|
3431
3410
|
throw new APIError(
|
|
3432
3411
|
typeof apiErrorMessage === "string" ? apiErrorMessage : (
|
|
3433
3412
|
// TODO: Error codes for all APIErrors.
|
|
@@ -5802,7 +5781,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5802
5781
|
exports2.coordinatesToUrlText = coordinatesToUrlText;
|
|
5803
5782
|
exports2.createOfflineAction = createOfflineAction;
|
|
5804
5783
|
exports2.createPointMarker = createPointMarker;
|
|
5805
|
-
exports2.debugLog = debugLog;
|
|
5806
5784
|
exports2.defaultBadgeColor = defaultBadgeColor;
|
|
5807
5785
|
exports2.defaultStore = defaultStore;
|
|
5808
5786
|
exports2.deleteComponentType = deleteComponentType;
|