@overmap-ai/core 1.0.60-sdk-refactor.7 → 1.0.60-sdk-refactor.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.
- package/dist/overmap-core.js +14 -14
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +14 -14
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/BaseApiService.d.ts +3 -8
- package/dist/sdk/services/BaseAuthService.d.ts +3 -8
- package/dist/sdk/services/BaseService.d.ts +15 -0
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -15071,11 +15071,12 @@ async function performRequest(action, client) {
|
|
|
15071
15071
|
if (!serviceOfRequest) {
|
|
15072
15072
|
throw new Error(`Service ${action.meta.offline.effect.serviceName} not found`);
|
|
15073
15073
|
}
|
|
15074
|
+
const isApiService = serviceOfRequest instanceof BaseApiService;
|
|
15074
15075
|
const state = client.store.getState();
|
|
15075
15076
|
if (state.outboxReducer.deletedRequests.includes(action.payload.uuid)) {
|
|
15076
15077
|
throw new Error("Request was marked for deletion");
|
|
15077
15078
|
}
|
|
15078
|
-
if (action.payload.checkAuth !== false) {
|
|
15079
|
+
if (isApiService && action.payload.checkAuth !== false) {
|
|
15079
15080
|
await serviceOfRequest.auth.prepareAuth();
|
|
15080
15081
|
}
|
|
15081
15082
|
const defaultSettings = {
|
|
@@ -15141,7 +15142,7 @@ async function performRequest(action, client) {
|
|
|
15141
15142
|
};
|
|
15142
15143
|
const selectedRequest = methodRequestMapping[method];
|
|
15143
15144
|
let requestToSend = selectedRequest();
|
|
15144
|
-
if (isAuthNeeded) {
|
|
15145
|
+
if (isAuthNeeded && isApiService) {
|
|
15145
15146
|
const authHeader = serviceOfRequest.auth.getAuthHeader();
|
|
15146
15147
|
requestToSend = requestToSend.set("Authorization", authHeader);
|
|
15147
15148
|
}
|
|
@@ -15153,7 +15154,7 @@ async function performRequest(action, client) {
|
|
|
15153
15154
|
} catch (error2) {
|
|
15154
15155
|
const errorResponse = extractResponseFromError(error2);
|
|
15155
15156
|
const status = errorResponse == null ? void 0 : errorResponse.status;
|
|
15156
|
-
if (status === 401) {
|
|
15157
|
+
if (isApiService && status === 401) {
|
|
15157
15158
|
await serviceOfRequest.auth.handleUnauthorized(requestToSend, errorResponse);
|
|
15158
15159
|
return requestToSend.query(queryParams);
|
|
15159
15160
|
}
|
|
@@ -15409,9 +15410,11 @@ const initSDK = (store, sdk) => {
|
|
|
15409
15410
|
setClientStore(store);
|
|
15410
15411
|
return sdkInstance;
|
|
15411
15412
|
};
|
|
15412
|
-
|
|
15413
|
+
const CLASS_NAME_TO_SERVICE$1 = {};
|
|
15414
|
+
class BaseService {
|
|
15413
15415
|
constructor(sdk) {
|
|
15414
15416
|
__publicField(this, "client");
|
|
15417
|
+
CLASS_NAME_TO_SERVICE$1[this.constructor.name] = this;
|
|
15415
15418
|
this.client = sdk;
|
|
15416
15419
|
}
|
|
15417
15420
|
async enqueueRequest(requestDetails) {
|
|
@@ -15421,6 +15424,11 @@ class BaseAuthService {
|
|
|
15421
15424
|
this.client.store.dispatch(action);
|
|
15422
15425
|
}
|
|
15423
15426
|
}
|
|
15427
|
+
class BaseAuthService extends BaseService {
|
|
15428
|
+
constructor(sdk) {
|
|
15429
|
+
super(sdk);
|
|
15430
|
+
}
|
|
15431
|
+
}
|
|
15424
15432
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
15425
15433
|
function parseTokens(response) {
|
|
15426
15434
|
if (!response.access)
|
|
@@ -15605,20 +15613,12 @@ class JWTService extends BaseAuthService {
|
|
|
15605
15613
|
}
|
|
15606
15614
|
}
|
|
15607
15615
|
const CLASS_NAME_TO_SERVICE = {};
|
|
15608
|
-
class BaseApiService {
|
|
15616
|
+
class BaseApiService extends BaseService {
|
|
15609
15617
|
constructor(sdk, auth) {
|
|
15610
|
-
|
|
15618
|
+
super(sdk);
|
|
15611
15619
|
__publicField(this, "auth");
|
|
15612
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
15613
|
-
this.client = sdk;
|
|
15614
15620
|
this.auth = auth;
|
|
15615
15621
|
}
|
|
15616
|
-
async enqueueRequest(requestDetails) {
|
|
15617
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
15618
|
-
}
|
|
15619
|
-
dispatch(action) {
|
|
15620
|
-
this.client.store.dispatch(action);
|
|
15621
|
-
}
|
|
15622
15622
|
}
|
|
15623
15623
|
class CategoryService extends BaseApiService {
|
|
15624
15624
|
add(category, workspaceId) {
|