@overmap-ai/core 1.0.78-view-sets-development.0 → 1.0.78-view-sets.30

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.
@@ -0,0 +1,5 @@
1
+ /** Default pagination max page size as defined on the BaseOvermapCursorPagination class in /api */
2
+ export declare const PAGINATION_MAX_PAGE_SIZE = 50000;
3
+ /** Default pagination page size as */
4
+ export declare const DEFAULT_PAGINATION_PAGE_SIZE = 10000;
5
+ export declare const PAGINATION_PAGE_SIZE_QUERY_PARAM = "limit";
@@ -1,5 +1,6 @@
1
1
  export * from './base';
2
2
  export * from './classes';
3
+ export * from './constants';
3
4
  export * from './errors';
4
5
  export * from './sdk';
5
6
  export * from './services';
@@ -3,9 +3,10 @@ import { BaseState } from '../../store';
3
3
  import { BaseSDK } from '../base';
4
4
  import { BaseService } from './BaseService';
5
5
  export declare abstract class BaseAuthService<TStore extends BaseState, TSDK extends BaseSDK<TStore>> extends BaseService<TStore, TSDK> {
6
- clearAuth(): void;
7
- initAuth(payload: object): Promise<void>;
8
- prepareAuth(): Promise<void>;
9
- abstract prepareRequest(request: SuperAgentRequest): SuperAgentRequest;
6
+ protected constructor(sdk: TSDK);
7
+ abstract initAuth(payload: object): Promise<void>;
8
+ abstract clearAuth(): void;
9
+ abstract prepareAuth(): Promise<void>;
10
+ abstract getAuthHeader(): string;
10
11
  abstract handleUnauthorized(request: SuperAgentRequest, response: Response): Promise<void>;
11
12
  }
@@ -2,15 +2,17 @@ import { ResultAction } from '@redux-offline/redux-offline/lib/types';
2
2
  import { ActionCreatorWithPayload, UnknownAction } from '@reduxjs/toolkit';
3
3
  import { BaseState } from '../../store';
4
4
  import { BaseSDK } from '../base';
5
- import { SDKRequest } from '../typings';
5
+ import { PaginatedResult, SDKRequest } from '../typings';
6
6
  export declare const CLASS_NAME_TO_SERVICE: Record<string, BaseService<BaseState, BaseSDK<BaseState>>>;
7
7
  /**
8
8
  * Abstract base class for building a service that can enqueue API requests
9
9
  */
10
10
  export declare abstract class BaseService<TStore extends BaseState, TSDK extends BaseSDK<TStore>> {
11
11
  protected readonly client: TSDK;
12
- protected abstract readonly host: string;
12
+ abstract readonly host: string;
13
13
  protected constructor(sdk: TSDK);
14
14
  protected enqueueRequest<TResult>(requestDetails: SDKRequest): Promise<TResult>;
15
+ protected performPagination<TResult>(initialRequest: SDKRequest, nextRequest: (next: NonNullable<PaginatedResult<TResult>["next"]>) => SDKRequest): Promise<TResult[]>;
16
+ protected enqueuePaginatedRequest<TResult>(requestDetails: SDKRequest, limit?: number): Promise<TResult[]>;
15
17
  protected dispatch(action: UnknownAction | ResultAction | ActionCreatorWithPayload<any, any>): void;
16
18
  }
@@ -18,7 +18,7 @@ interface DatabaseFileProperties {
18
18
  file: string;
19
19
  }
20
20
  export declare abstract class FileService<TState extends BaseState, TSDK extends BaseSDK<TState>> extends BaseApiService<TState, TSDK> {
21
- protected readonly host: string;
21
+ host: string;
22
22
  private _dbPromise;
23
23
  private renewUploadUrl;
24
24
  /**
@@ -1,4 +1,4 @@
1
- import { default as request, SuperAgentRequest } from 'superagent';
1
+ import { default as request } from 'superagent';
2
2
  import { BaseState } from '../../store';
3
3
  import { BaseSDK } from '../base';
4
4
  import { TokenPair } from '../typings';
@@ -6,7 +6,7 @@ import { BaseAuthService } from './BaseAuthService';
6
6
  /**
7
7
  * Handles login, logout and renewing tokens
8
8
  */
9
- export declare abstract class JWTAuthService<TState extends BaseState, TSDK extends BaseSDK<TState>> extends BaseAuthService<TState, TSDK> {
9
+ export declare abstract class JWTService<TState extends BaseState, TSDK extends BaseSDK<TState>> extends BaseAuthService<TState, TSDK> {
10
10
  protected abstract initTokensUrl: string;
11
11
  protected abstract refreshTokensUrl: string;
12
12
  protected abstract setTokens: (tokens: TokenPair) => void;
@@ -28,10 +28,9 @@ export declare abstract class JWTAuthService<TState extends BaseState, TSDK exte
28
28
  * Attempts to renew tokens
29
29
  */
30
30
  renewTokens(): Promise<undefined>;
31
- protected tokenIsExpiringSoon(): boolean;
31
+ tokenIsExpiringSoon(): boolean;
32
+ getAuthHeader(): string;
32
33
  prepareAuth(): Promise<undefined>;
33
- private getAuthHeader;
34
- prepareRequest(request: SuperAgentRequest): SuperAgentRequest;
35
34
  handleUnauthorized(request: request.SuperAgentRequest, response: request.Response): Promise<void>;
36
35
  initAuth(payload: object): Promise<void>;
37
36
  }
@@ -53,7 +53,6 @@ export * from './ProjectAccessService';
53
53
  export * from './ProjectAttachmentService';
54
54
  export * from './ProjectFileService';
55
55
  export * from './ProjectService';
56
- export * from './SessionAuthService';
57
56
  export * from './TeamMembershipService';
58
57
  export * from './TeamService';
59
58
  export * from './UserService';
@@ -27,7 +27,7 @@ export interface RequestDetails {
27
27
  immediate?: boolean;
28
28
  isExternalUrl?: boolean;
29
29
  isResponseBlob?: boolean;
30
- queryParams?: Record<string, string | undefined>;
30
+ queryParams?: Record<string, string | boolean | number | undefined>;
31
31
  isAuthNeeded?: boolean;
32
32
  /** The hash of any included attachments being uploaded to S3, retrieved from cache before the request is fired */
33
33
  attachmentHash?: string;
@@ -50,6 +50,10 @@ export interface RequestDetails {
50
50
  export type SDKRequest = Omit<RequestDetails, "uuid"> & {
51
51
  uuid?: string;
52
52
  };
53
+ export type PaginatedSDKRequest = SDKRequest & {
54
+ limit: number;
55
+ paginate: true;
56
+ };
53
57
  /**
54
58
  * Represents the result of a successful API request.
55
59
  * @deprecated Use `T` directly instead.
@@ -107,6 +111,11 @@ export type OptimisticEmptyResult = Promise<undefined>;
107
111
  * Used where the result of an API request is not one or more model instances, but some arbitrary data.
108
112
  */
109
113
  export type OptimisticGenericResult<T> = [T, DeferredPromise<T> | Promise<T>];
114
+ export type PaginatedResult<T> = {
115
+ next: string | null;
116
+ previous: string | null;
117
+ results: T;
118
+ };
110
119
  export interface OfflineMetaEffect {
111
120
  request: RequestDetails;
112
121
  /** An ISO timestamp of when the request was created. */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core functionality for Overmap",
4
4
  "author": "Wôrdn Inc.",
5
5
  "license": "UNLICENSED",
6
- "version": "1.0.78-view-sets-development.0",
6
+ "version": "1.0.78-view-sets.30",
7
7
  "type": "module",
8
8
  "main": "dist/overmap-core.umd.cjs",
9
9
  "module": "dist/overmap-core.js",
@@ -64,7 +64,7 @@
64
64
  "rollup-plugin-polyfill-node": "^0.13.0",
65
65
  "typescript": "^5.2.2",
66
66
  "typescript-eslint": "^8.38.0",
67
- "vite": "^6.4.1",
67
+ "vite": "^6.3.4",
68
68
  "vite-plugin-dts": "^4.5.4",
69
69
  "vite-plugin-externalize-deps": "^0.9.0",
70
70
  "vitest": "3.2.4"
@@ -1,14 +0,0 @@
1
- import { default as request, SuperAgentRequest } from 'superagent';
2
- import { BaseState } from '../../store';
3
- import { BaseSDK } from '../base';
4
- import { BaseAuthService } from './BaseAuthService';
5
- /**
6
- * Provides session-based authentication, which does not allow or require accessing tokens using JavaScript.
7
- */
8
- export declare abstract class SessionAuthService<TState extends BaseState, TSDK extends BaseSDK<TState>> extends BaseAuthService<TState, TSDK> {
9
- protected abstract loginUrl: string;
10
- private redirectToLogin;
11
- clearAuth(): void;
12
- handleUnauthorized(_request: request.SuperAgentRequest, _response: request.Response): Promise<void>;
13
- prepareRequest(request: SuperAgentRequest): SuperAgentRequest;
14
- }