@overmap-ai/core 1.0.60-sdk-refactor.4 → 1.0.60-sdk-refactor.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.
|
@@ -64,7 +64,7 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
|
|
|
64
64
|
readonly results?: number | undefined;
|
|
65
65
|
readonly security?: string | undefined;
|
|
66
66
|
readonly unselectable?: "on" | "off" | undefined;
|
|
67
|
-
readonly inputMode?: "search" | "text" | "email" | "
|
|
67
|
+
readonly inputMode?: "search" | "text" | "email" | "url" | "none" | "numeric" | "tel" | "decimal" | undefined;
|
|
68
68
|
readonly is?: string | undefined;
|
|
69
69
|
readonly "aria-activedescendant"?: string | undefined;
|
|
70
70
|
readonly "aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
@@ -280,10 +280,10 @@ export declare const useFormikInput: <TField extends AnyField>(props: ComponentP
|
|
|
280
280
|
readonly onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLElement> | undefined;
|
|
281
281
|
readonly onTransitionEnd?: import("react").TransitionEventHandler<HTMLElement> | undefined;
|
|
282
282
|
readonly onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLElement> | undefined;
|
|
283
|
-
readonly href?: string | undefined;
|
|
284
|
-
readonly download?: any;
|
|
285
283
|
readonly headers?: string | undefined;
|
|
286
284
|
readonly method?: string | undefined;
|
|
285
|
+
readonly href?: string | undefined;
|
|
286
|
+
readonly download?: any;
|
|
287
287
|
readonly placeholder?: string | undefined;
|
|
288
288
|
readonly required?: boolean | undefined;
|
|
289
289
|
readonly target?: string | undefined;
|
package/dist/overmap-core.js
CHANGED
|
@@ -15432,9 +15432,6 @@ function parseTokens(response) {
|
|
|
15432
15432
|
class JWTService extends BaseAuthService {
|
|
15433
15433
|
constructor() {
|
|
15434
15434
|
super(...arguments);
|
|
15435
|
-
// AUTH below
|
|
15436
|
-
__publicField(this, "_getAccessToken", () => this.client.store.getState().authReducer.accessToken);
|
|
15437
|
-
__publicField(this, "_getRefreshToken", () => this.client.store.getState().authReducer.refreshToken);
|
|
15438
15435
|
// _getTokenPair and _getRenewedTokens don't need to use enqueueRequest from the BaseApiService because
|
|
15439
15436
|
// they are very simple. However, if we need robust error handling or want these operations to queue in the Outbox,
|
|
15440
15437
|
// we will use enqueueRequest.
|
|
@@ -15448,7 +15445,7 @@ class JWTService extends BaseAuthService {
|
|
|
15448
15445
|
const promise = this.enqueueRequest({
|
|
15449
15446
|
description: "Get renewed tokens",
|
|
15450
15447
|
method: HttpMethod.POST,
|
|
15451
|
-
url:
|
|
15448
|
+
url: this.refreshTokensUrl,
|
|
15452
15449
|
payload: { refresh: refreshToken },
|
|
15453
15450
|
isAuthNeeded: false,
|
|
15454
15451
|
blockers: [],
|
|
@@ -15459,14 +15456,14 @@ class JWTService extends BaseAuthService {
|
|
|
15459
15456
|
immediate: true
|
|
15460
15457
|
}).catch((e) => {
|
|
15461
15458
|
console.error("Could not renew tokens; logging out due to error:", e);
|
|
15462
|
-
void this.
|
|
15459
|
+
void this.clearAuth();
|
|
15463
15460
|
return void 0;
|
|
15464
15461
|
});
|
|
15465
15462
|
let response = void 0;
|
|
15466
15463
|
try {
|
|
15467
15464
|
response = await promise;
|
|
15468
15465
|
} catch (e) {
|
|
15469
|
-
await this.
|
|
15466
|
+
await this.clearAuth();
|
|
15470
15467
|
}
|
|
15471
15468
|
if (!response)
|
|
15472
15469
|
return void 0;
|
|
@@ -15480,9 +15477,9 @@ class JWTService extends BaseAuthService {
|
|
|
15480
15477
|
/**
|
|
15481
15478
|
* Logs the user out
|
|
15482
15479
|
*/
|
|
15483
|
-
async
|
|
15480
|
+
async clearAuth() {
|
|
15484
15481
|
this.dispatch(setLoggedIn(false));
|
|
15485
|
-
this.
|
|
15482
|
+
this.clearTokens();
|
|
15486
15483
|
this.dispatch(setActiveProjectId(null));
|
|
15487
15484
|
this.dispatch(setActiveWorkspaceId(null));
|
|
15488
15485
|
this.dispatch({ type: RESET_STATE });
|
|
@@ -15494,7 +15491,7 @@ class JWTService extends BaseAuthService {
|
|
|
15494
15491
|
* Attempts to renew tokens
|
|
15495
15492
|
*/
|
|
15496
15493
|
async renewTokens() {
|
|
15497
|
-
const dyingRefreshToken = this.
|
|
15494
|
+
const dyingRefreshToken = this.getRefreshToken();
|
|
15498
15495
|
if (!dyingRefreshToken) {
|
|
15499
15496
|
throw new Error("No refresh token found");
|
|
15500
15497
|
}
|
|
@@ -15503,12 +15500,11 @@ class JWTService extends BaseAuthService {
|
|
|
15503
15500
|
if (!tokens) {
|
|
15504
15501
|
return void 0;
|
|
15505
15502
|
}
|
|
15506
|
-
const { accessToken, refreshToken } = tokens;
|
|
15507
15503
|
console.log("Got renewed tokens");
|
|
15508
|
-
this.
|
|
15504
|
+
this.setTokens(tokens);
|
|
15509
15505
|
} catch (e) {
|
|
15510
15506
|
console.error("Could not renew tokens; logging out.");
|
|
15511
|
-
await this.
|
|
15507
|
+
await this.clearAuth();
|
|
15512
15508
|
throw e;
|
|
15513
15509
|
}
|
|
15514
15510
|
}
|
|
@@ -15517,7 +15513,7 @@ class JWTService extends BaseAuthService {
|
|
|
15517
15513
|
* @returns {boolean}
|
|
15518
15514
|
*/
|
|
15519
15515
|
tokenIsExpiringSoon() {
|
|
15520
|
-
const accessToken = this.
|
|
15516
|
+
const accessToken = this.getAccessToken();
|
|
15521
15517
|
if (!accessToken) {
|
|
15522
15518
|
return false;
|
|
15523
15519
|
}
|
|
@@ -15532,7 +15528,7 @@ class JWTService extends BaseAuthService {
|
|
|
15532
15528
|
return secondsUntilExpiry < EXPIRING_SOON_THRESHOLD;
|
|
15533
15529
|
}
|
|
15534
15530
|
getAuthHeader() {
|
|
15535
|
-
const accesseToken =
|
|
15531
|
+
const accesseToken = this.getAccessToken();
|
|
15536
15532
|
return `Bearer ${accesseToken}`;
|
|
15537
15533
|
}
|
|
15538
15534
|
async prepareAuth() {
|
|
@@ -15542,7 +15538,7 @@ class JWTService extends BaseAuthService {
|
|
|
15542
15538
|
await this.renewTokens();
|
|
15543
15539
|
} catch (e) {
|
|
15544
15540
|
if (e instanceof APIError) {
|
|
15545
|
-
await this.
|
|
15541
|
+
await this.clearAuth();
|
|
15546
15542
|
}
|
|
15547
15543
|
return Promise.reject(e);
|
|
15548
15544
|
}
|
|
@@ -15554,7 +15550,7 @@ class JWTService extends BaseAuthService {
|
|
|
15554
15550
|
if (state.authReducer.isLoggedIn) {
|
|
15555
15551
|
console.warn("No signed-in user to sign out.");
|
|
15556
15552
|
}
|
|
15557
|
-
await this.
|
|
15553
|
+
await this.clearAuth();
|
|
15558
15554
|
throw new APIError({
|
|
15559
15555
|
message: "You have been signed out due to inactivity.",
|
|
15560
15556
|
response,
|
|
@@ -15583,7 +15579,7 @@ class JWTService extends BaseAuthService {
|
|
|
15583
15579
|
uuid,
|
|
15584
15580
|
description: "Get token pair",
|
|
15585
15581
|
method: HttpMethod.POST,
|
|
15586
|
-
url:
|
|
15582
|
+
url: this.initTokensUrl,
|
|
15587
15583
|
payload: { username, password },
|
|
15588
15584
|
isAuthNeeded: false,
|
|
15589
15585
|
checkAuth: false,
|
|
@@ -15603,87 +15599,12 @@ class JWTService extends BaseAuthService {
|
|
|
15603
15599
|
if (timedOut) {
|
|
15604
15600
|
return void 0;
|
|
15605
15601
|
}
|
|
15606
|
-
this.
|
|
15602
|
+
this.setTokens(tokens);
|
|
15607
15603
|
this.dispatch(setLoggedIn(true));
|
|
15608
15604
|
this.dispatch({ type: "rehydrated/setRehydrated", payload: true });
|
|
15609
15605
|
});
|
|
15610
15606
|
return Promise.race([timeoutPromise, successPromise]);
|
|
15611
15607
|
}
|
|
15612
|
-
/**
|
|
15613
|
-
* Register a new user
|
|
15614
|
-
*/
|
|
15615
|
-
register(payload) {
|
|
15616
|
-
return this.enqueueRequest({
|
|
15617
|
-
description: "Register",
|
|
15618
|
-
method: HttpMethod.POST,
|
|
15619
|
-
url: "/authentication/users/register/",
|
|
15620
|
-
isAuthNeeded: false,
|
|
15621
|
-
payload,
|
|
15622
|
-
blockers: [],
|
|
15623
|
-
blocks: []
|
|
15624
|
-
});
|
|
15625
|
-
}
|
|
15626
|
-
async resetPassword(email) {
|
|
15627
|
-
return this.enqueueRequest({
|
|
15628
|
-
description: "Reset password",
|
|
15629
|
-
method: HttpMethod.PATCH,
|
|
15630
|
-
url: "/authentication/users/reset-password/",
|
|
15631
|
-
isAuthNeeded: false,
|
|
15632
|
-
payload: {
|
|
15633
|
-
email
|
|
15634
|
-
},
|
|
15635
|
-
blockers: [],
|
|
15636
|
-
blocks: []
|
|
15637
|
-
});
|
|
15638
|
-
}
|
|
15639
|
-
async replaceProfilePicture(file) {
|
|
15640
|
-
const hash = await hashFile(file);
|
|
15641
|
-
await this.client.files.addCache(file, hash);
|
|
15642
|
-
const [fileProps] = await this.client.files.uploadFileToS3(hash);
|
|
15643
|
-
this.dispatch(setProfilePicture({ file: `/files/${fileProps.file}`, file_sha1: hash }));
|
|
15644
|
-
return this.enqueueRequest({
|
|
15645
|
-
description: "Replace profile picture",
|
|
15646
|
-
method: HttpMethod.PATCH,
|
|
15647
|
-
url: "/authentication/users/profile-details/",
|
|
15648
|
-
payload: fileProps,
|
|
15649
|
-
blockers: [],
|
|
15650
|
-
blocks: []
|
|
15651
|
-
});
|
|
15652
|
-
}
|
|
15653
|
-
async addFavouriteProjectId(projectId) {
|
|
15654
|
-
this.dispatch(addFavouriteProjectId(projectId));
|
|
15655
|
-
return this.enqueueRequest({
|
|
15656
|
-
description: "Add favourite project",
|
|
15657
|
-
method: HttpMethod.POST,
|
|
15658
|
-
url: `/authentication/users/favourite-project/${projectId}/`,
|
|
15659
|
-
blockers: [],
|
|
15660
|
-
blocks: []
|
|
15661
|
-
});
|
|
15662
|
-
}
|
|
15663
|
-
async removeFavouriteProjectId(projectId) {
|
|
15664
|
-
this.dispatch(removeFavouriteProjectId(projectId));
|
|
15665
|
-
return this.enqueueRequest({
|
|
15666
|
-
description: "Add favourite project",
|
|
15667
|
-
method: HttpMethod.POST,
|
|
15668
|
-
url: `/authentication/users/unfavourite-project/${projectId}/`,
|
|
15669
|
-
blockers: [`favorite-project-${projectId}`],
|
|
15670
|
-
blocks: [`favorite-project-${projectId}`]
|
|
15671
|
-
});
|
|
15672
|
-
}
|
|
15673
|
-
async joinApplication(projectInviteId, verification_code, username, password) {
|
|
15674
|
-
return this.enqueueRequest({
|
|
15675
|
-
description: "Join application",
|
|
15676
|
-
method: HttpMethod.PATCH,
|
|
15677
|
-
url: `/authentication/join-app/${projectInviteId}/${verification_code}/`,
|
|
15678
|
-
payload: {
|
|
15679
|
-
username,
|
|
15680
|
-
password
|
|
15681
|
-
},
|
|
15682
|
-
isAuthNeeded: false,
|
|
15683
|
-
blockers: [],
|
|
15684
|
-
blocks: []
|
|
15685
|
-
});
|
|
15686
|
-
}
|
|
15687
15608
|
}
|
|
15688
15609
|
const CLASS_NAME_TO_SERVICE = {};
|
|
15689
15610
|
class BaseApiService {
|