@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
|
@@ -15060,11 +15060,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15060
15060
|
if (!serviceOfRequest) {
|
|
15061
15061
|
throw new Error(`Service ${action.meta.offline.effect.serviceName} not found`);
|
|
15062
15062
|
}
|
|
15063
|
+
const isApiService = serviceOfRequest instanceof BaseApiService;
|
|
15063
15064
|
const state = client.store.getState();
|
|
15064
15065
|
if (state.outboxReducer.deletedRequests.includes(action.payload.uuid)) {
|
|
15065
15066
|
throw new Error("Request was marked for deletion");
|
|
15066
15067
|
}
|
|
15067
|
-
if (action.payload.checkAuth !== false) {
|
|
15068
|
+
if (isApiService && action.payload.checkAuth !== false) {
|
|
15068
15069
|
await serviceOfRequest.auth.prepareAuth();
|
|
15069
15070
|
}
|
|
15070
15071
|
const defaultSettings = {
|
|
@@ -15130,7 +15131,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15130
15131
|
};
|
|
15131
15132
|
const selectedRequest = methodRequestMapping[method];
|
|
15132
15133
|
let requestToSend = selectedRequest();
|
|
15133
|
-
if (isAuthNeeded) {
|
|
15134
|
+
if (isAuthNeeded && isApiService) {
|
|
15134
15135
|
const authHeader = serviceOfRequest.auth.getAuthHeader();
|
|
15135
15136
|
requestToSend = requestToSend.set("Authorization", authHeader);
|
|
15136
15137
|
}
|
|
@@ -15142,7 +15143,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15142
15143
|
} catch (error2) {
|
|
15143
15144
|
const errorResponse = extractResponseFromError(error2);
|
|
15144
15145
|
const status = errorResponse == null ? void 0 : errorResponse.status;
|
|
15145
|
-
if (status === 401) {
|
|
15146
|
+
if (isApiService && status === 401) {
|
|
15146
15147
|
await serviceOfRequest.auth.handleUnauthorized(requestToSend, errorResponse);
|
|
15147
15148
|
return requestToSend.query(queryParams);
|
|
15148
15149
|
}
|
|
@@ -15398,9 +15399,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15398
15399
|
setClientStore(store);
|
|
15399
15400
|
return sdkInstance;
|
|
15400
15401
|
};
|
|
15401
|
-
|
|
15402
|
+
const CLASS_NAME_TO_SERVICE$1 = {};
|
|
15403
|
+
class BaseService {
|
|
15402
15404
|
constructor(sdk) {
|
|
15403
15405
|
__publicField(this, "client");
|
|
15406
|
+
CLASS_NAME_TO_SERVICE$1[this.constructor.name] = this;
|
|
15404
15407
|
this.client = sdk;
|
|
15405
15408
|
}
|
|
15406
15409
|
async enqueueRequest(requestDetails) {
|
|
@@ -15410,6 +15413,11 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15410
15413
|
this.client.store.dispatch(action);
|
|
15411
15414
|
}
|
|
15412
15415
|
}
|
|
15416
|
+
class BaseAuthService extends BaseService {
|
|
15417
|
+
constructor(sdk) {
|
|
15418
|
+
super(sdk);
|
|
15419
|
+
}
|
|
15420
|
+
}
|
|
15413
15421
|
const EXPIRING_SOON_THRESHOLD = 1800;
|
|
15414
15422
|
function parseTokens(response) {
|
|
15415
15423
|
if (!response.access)
|
|
@@ -15594,20 +15602,12 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
15594
15602
|
}
|
|
15595
15603
|
}
|
|
15596
15604
|
const CLASS_NAME_TO_SERVICE = {};
|
|
15597
|
-
class BaseApiService {
|
|
15605
|
+
class BaseApiService extends BaseService {
|
|
15598
15606
|
constructor(sdk, auth) {
|
|
15599
|
-
|
|
15607
|
+
super(sdk);
|
|
15600
15608
|
__publicField(this, "auth");
|
|
15601
|
-
CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
|
|
15602
|
-
this.client = sdk;
|
|
15603
15609
|
this.auth = auth;
|
|
15604
15610
|
}
|
|
15605
|
-
async enqueueRequest(requestDetails) {
|
|
15606
|
-
return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
|
|
15607
|
-
}
|
|
15608
|
-
dispatch(action) {
|
|
15609
|
-
this.client.store.dispatch(action);
|
|
15610
|
-
}
|
|
15611
15611
|
}
|
|
15612
15612
|
class CategoryService extends BaseApiService {
|
|
15613
15613
|
add(category, workspaceId) {
|