@overmap-ai/core 1.1.0 → 1.1.1-allauth-2.2
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 +157 -126
- package/dist/overmap-core.umd.cjs +6 -6
- package/dist/sdk/errors.d.ts +6 -0
- package/dist/sdk/services/BaseAuthService.d.ts +24 -0
- package/dist/sdk/services/BaseAuthService.spec.d.ts +1 -0
- package/dist/sdk/services/index.d.ts +1 -0
- package/dist/store/discard.spec.d.ts +1 -0
- package/package.json +1 -1
package/dist/sdk/errors.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ export interface APIErrorOptions {
|
|
|
3
3
|
response?: request.Response;
|
|
4
4
|
innerError?: unknown;
|
|
5
5
|
message?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Whether to drop the request rather than retry it. Three-valued on purpose:
|
|
8
|
+
* `true` discards, `false` insists on a retry even when the status code says otherwise, and leaving it unset lets
|
|
9
|
+
* `discard()` in store.ts decide from the status code. Do not default it -- collapsing unset into `false` is what
|
|
10
|
+
* makes "the auth service says retry this" indistinguishable from "nobody expressed an opinion".
|
|
11
|
+
*/
|
|
6
12
|
discard?: boolean;
|
|
7
13
|
}
|
|
8
14
|
export declare const UNKNOWN_ERROR_MESSAGE = "An unknown error occurred";
|
|
@@ -9,4 +9,28 @@ export declare abstract class BaseAuthService<TStore extends BaseState, TSDK ext
|
|
|
9
9
|
abstract prepareAuth(): Promise<void>;
|
|
10
10
|
abstract getAuthHeader(): string;
|
|
11
11
|
abstract handleUnauthorized(request: SuperAgentRequest, response: Response): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Attaches this service's credentials to an outgoing request, and is the only place `performRequest` authenticates.
|
|
14
|
+
*
|
|
15
|
+
* A bearer token is a header and nothing else, so the default implementation just sets `Authorization` from
|
|
16
|
+
* `getAuthHeader()`. A cookie-based scheme has no header to return: it needs `withCredentials()` on the request
|
|
17
|
+
* itself, which a `getAuthHeader()` return value cannot express. Overriding this is how such a service reaches the
|
|
18
|
+
* request at all.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: The empty-header guard is not just tidiness. Sending `Authorization:` with an empty value still counts as a
|
|
21
|
+
* non-simple header, so the browser would preflight every request to carry nothing.
|
|
22
|
+
* @param request The request about to be sent.
|
|
23
|
+
* @returns The request, with credentials attached.
|
|
24
|
+
*/
|
|
25
|
+
applyAuth(request: SuperAgentRequest): SuperAgentRequest;
|
|
26
|
+
/**
|
|
27
|
+
* Whether `response` means "you are not authenticated", as opposed to any other failure.
|
|
28
|
+
*
|
|
29
|
+
* Only responses this returns true for are routed to `handleUnauthorized`. A bearer token can only ever fail with a
|
|
30
|
+
* 401, but a session-based service also has to recognise the 403 that Django's CSRF check produces, which is
|
|
31
|
+
* otherwise indistinguishable from a genuine permission denial.
|
|
32
|
+
* @param response The failing response.
|
|
33
|
+
* @returns Whether the request failed because it was not authenticated.
|
|
34
|
+
*/
|
|
35
|
+
isAuthFailure(response: Response): boolean;
|
|
12
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,6 +12,7 @@ export * from './AssetTypeIdentifierValueService';
|
|
|
12
12
|
export * from './AssetTypeService';
|
|
13
13
|
export * from './AssetTypeStatusService';
|
|
14
14
|
export * from './BaseApiService';
|
|
15
|
+
export * from './BaseAuthService';
|
|
15
16
|
export * from './DocumentAttachmentService';
|
|
16
17
|
export * from './DocumentService';
|
|
17
18
|
export * from './EmailDomainsService';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|