@overmap-ai/core 1.0.58-form-improvements.2 → 1.0.58-map-images.1

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/sdk/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AgentService, AuthService, CategoryService, AssetService, AssetStageCompletionService, AssetStageService, AssetAttachmentService, AssetTypeService, AssetTypeAttachmentService, DocumentAttachmentService, DocumentService, EmailDomainsService, EmailVerificationService, FileService, IssueAttachmentService, IssueCommentService, IssueService, IssueTypeService, IssueUpdateService, LicenseService, MainService, OrganizationAccessService, OrganizationService, ProjectAccessService, ProjectAttachmentService, ProjectFileService, ProjectService, TeamService, UserFormService, UserFormSubmissionService, WorkspaceService } from "./services";
1
+ import { AgentService, AuthService, CategoryService, AssetService, AssetStageCompletionService, AssetStageService, AssetAttachmentService, AssetTypeService, AssetTypeAttachmentService, DocumentAttachmentService, DocumentService, EmailDomainsService, EmailVerificationService, FileService, IssueAttachmentService, IssueCommentService, IssueService, IssueTypeService, IssueUpdateService, LicenseService, MainService, OrganizationAccessService, OrganizationService, ProjectAccessService, ProjectAttachmentService, ProjectFileService, ProjectService, TeamService, UserFormService, UserFormSubmissionService, WorkspaceService, MapImageService } from "./services";
2
2
  import { ToolkitStore } from "@reduxjs/toolkit/dist/configureStore";
3
3
  import { RootState } from "../typings";
4
4
  import { SDKRequest } from "./typings";
@@ -48,5 +48,6 @@ export declare class OvermapSDK {
48
48
  documents: DocumentService;
49
49
  teams: TeamService;
50
50
  documentAttachments: DocumentAttachmentService;
51
+ mapImages: MapImageService;
51
52
  }
52
53
  export declare const makeClient: (apiUrl: string, store: ToolkitStore<RootState>) => OvermapSDK;
@@ -1,7 +1,13 @@
1
1
  import { ActionCreatorWithPayload } from "@reduxjs/toolkit";
2
- import { BaseApiService } from "./BaseApiService";
3
2
  import { OptimisticMultipleModelResult } from "../typings";
4
3
  import { Attachment, AttachmentModel, SelectorWithArgs, Stored, Submitted } from "../../typings";
4
+ import { BaseFileUploadService } from "./BaseFileUploadService";
5
+ export interface FilePayload {
6
+ sha1: Attachment["file_sha1"];
7
+ file_type: string;
8
+ extension: string;
9
+ size: number;
10
+ }
5
11
  export interface BuildOfflineAttachmentData<TModelId> {
6
12
  file: File;
7
13
  sha1: string;
@@ -10,10 +16,8 @@ export interface BuildOfflineAttachmentData<TModelId> {
10
16
  description?: string;
11
17
  modelId: TModelId;
12
18
  }
13
- export declare abstract class BaseAttachmentService extends BaseApiService {
19
+ export declare abstract class BaseAttachmentService extends BaseFileUploadService {
14
20
  abstract readonly attachmentModel: AttachmentModel;
15
- private getNumberOfAttachmentsWithSha1;
16
- private processPresignedUrls;
17
21
  protected getAttachments<TAttachment extends Attachment>(actions: {
18
22
  setAttachments: ActionCreatorWithPayload<Submitted<TAttachment>[]>;
19
23
  }): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { BaseApiService } from "./BaseApiService";
2
+ import { GetS3UrlSuccessResponse } from "./FileService";
3
+ export declare abstract class BaseFileUploadService extends BaseApiService {
4
+ protected getNumberOfAttachmentsWithSha1(sha1: string): number;
5
+ protected processPresignedUrls(presignedUrls: Record<string, GetS3UrlSuccessResponse>): void;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseFileUploadService } from "./BaseFileUploadService";
2
+ import { MapImage, MapImagePayload, Offline } from "../../typings";
3
+ import { OptimisticModelResult, OptimisticMultipleModelResult } from "../typings";
4
+ export declare class MapImageService extends BaseFileUploadService {
5
+ add(mapImagePayload: MapImagePayload, file: File, projectId: number): Promise<OptimisticModelResult<MapImage>>;
6
+ bulkAdd(payloadAndFiles: {
7
+ payload: MapImagePayload;
8
+ file: File;
9
+ }[], projectId: number): Promise<OptimisticMultipleModelResult<MapImage>>;
10
+ update(mapImagePayload: Offline<Partial<MapImagePayload>>): OptimisticModelResult<MapImage>;
11
+ delete(mapImageId: string): Promise<void>;
12
+ refreshStore(): Promise<void>;
13
+ }
@@ -30,3 +30,4 @@ export * from "./DocumentService";
30
30
  export * from "./DocumentAttachmentService";
31
31
  export * from "./AgentService";
32
32
  export * from "./TeamService";
33
+ export * from "./MapImageService";
@@ -0,0 +1,20 @@
1
+ import { PayloadAction } from "@reduxjs/toolkit";
2
+ import { ModelState } from "./typings";
3
+ export interface OvermapModelAdapterSelectors<TRootState, TModel> {
4
+ selectModelsRecord: (state: TRootState) => ModelState<TModel>["models"];
5
+ selectModels: (state: TRootState) => TModel[];
6
+ selectModelById: (id: string) => (state: TRootState) => TModel | undefined;
7
+ selectModelsByIds: (ids: string[]) => (state: TRootState) => TModel[];
8
+ }
9
+ export interface OvermapModelAdapter<TModel> {
10
+ addOne: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel>) => void;
11
+ addMany: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel[]>) => void;
12
+ setOne: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel>) => void;
13
+ setMany: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel[]>) => void;
14
+ updateOne: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel>) => void;
15
+ updateMany: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<TModel[]>) => void;
16
+ deleteOne: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<string>) => void;
17
+ deleteMany: <TState extends ModelState<TModel>>(state: TState, action: PayloadAction<string[]>) => void;
18
+ getInitialState: <TState extends object>(state: TState) => TState & ModelState<TModel>;
19
+ }
20
+ export declare function createModelAdapter<TModel>(computeModelId: (model: TModel) => string): OvermapModelAdapter<TModel>;
@@ -71,6 +71,7 @@ export declare const selectCategories: ((state: import("redux").EmptyObject & {
71
71
  documentsReducer: import('..').DocumentState;
72
72
  teamReducer: import('..').TeamState;
73
73
  agentsReducer: import('..').AgentsState;
74
+ mapImageReducer: import('..').MapImageSliceState;
74
75
  } & {
75
76
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
76
77
  }) => Category[]) & import("reselect").OutputSelectorFields<(args_0: Record<string, Category>, args_1: string | null) => Category[], {
@@ -270,6 +270,7 @@ export declare const selectRootDocuments: ((state: import("redux").EmptyObject &
270
270
  documentsReducer: DocumentState;
271
271
  teamReducer: import('..').TeamState;
272
272
  agentsReducer: import('..').AgentsState;
273
+ mapImageReducer: import('..').MapImageSliceState;
273
274
  } & {
274
275
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
275
276
  }) => ((import('../../typings/models/base').OfflineModel & import('../../typings/models/base').CreatedByModel & {
@@ -50,6 +50,7 @@ export declare const selectFormRevisions: ((state: import("redux").EmptyObject &
50
50
  documentsReducer: import('..').DocumentState;
51
51
  teamReducer: import('..').TeamState;
52
52
  agentsReducer: import('..').AgentsState;
53
+ mapImageReducer: import('..').MapImageSliceState;
53
54
  } & {
54
55
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
55
56
  }) => Stored<UserFormRevision<import('../../forms').ISerializedField>>[]) & import("reselect").OutputSelectorFields<(args_0: Record<string, Stored<UserFormRevision<import('../../forms').ISerializedField>>>) => Stored<UserFormRevision<import('../../forms').ISerializedField>>[], {
@@ -26,3 +26,4 @@ export * from "./licenseSlice";
26
26
  export * from "./documentSlice";
27
27
  export * from "./teamSlice";
28
28
  export * from "./agentsSlice";
29
+ export * from "./mapImageSlice";
@@ -159,6 +159,7 @@ export declare const selectAllAttachments: ((state: import("redux").EmptyObject
159
159
  documentsReducer: import('..').DocumentState;
160
160
  teamReducer: import('..').TeamState;
161
161
  agentsReducer: import('..').AgentsState;
162
+ mapImageReducer: import('..').MapImageSliceState;
162
163
  } & {
163
164
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
164
165
  }) => Stored<IssueAttachment>[]) & import("reselect").OutputSelectorFields<(args_0: Record<string, Stored<IssueAttachment>>) => Stored<IssueAttachment>[], {
@@ -0,0 +1,44 @@
1
+ import { Reducer } from "@reduxjs/toolkit";
2
+ import { MapImage, Stored } from "../../typings";
3
+ import { ModelState } from "../typings";
4
+ export type MapImageSliceState = ModelState<Stored<MapImage>>;
5
+ export declare const mapImageSlice: import("@reduxjs/toolkit").Slice<MapImageSliceState, {
6
+ setMapImage: <TState extends ModelState<MapImage>>(state: TState, action: {
7
+ payload: MapImage;
8
+ type: string;
9
+ }) => void;
10
+ setMapImages: <TState_1 extends ModelState<MapImage>>(state: TState_1, action: {
11
+ payload: MapImage[];
12
+ type: string;
13
+ }) => void;
14
+ addMapImage: <TState_2 extends ModelState<MapImage>>(state: TState_2, action: {
15
+ payload: MapImage;
16
+ type: string;
17
+ }) => void;
18
+ addMapImages: <TState_3 extends ModelState<MapImage>>(state: TState_3, action: {
19
+ payload: MapImage[];
20
+ type: string;
21
+ }) => void;
22
+ updateMapImage: <TState_4 extends ModelState<MapImage>>(state: TState_4, action: {
23
+ payload: MapImage;
24
+ type: string;
25
+ }) => void;
26
+ updateMapImages: <TState_5 extends ModelState<MapImage>>(state: TState_5, action: {
27
+ payload: MapImage[];
28
+ type: string;
29
+ }) => void;
30
+ deleteMapImage: <TState_6 extends ModelState<MapImage>>(state: TState_6, action: {
31
+ payload: string;
32
+ type: string;
33
+ }) => void;
34
+ deleteMapImages: <TState_7 extends ModelState<MapImage>>(state: TState_7, action: {
35
+ payload: string[];
36
+ type: string;
37
+ }) => void;
38
+ }, "mapImages">;
39
+ export declare const setMapImage: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage, "mapImages/setMapImage">, setMapImages: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage[], "mapImages/setMapImages">, addMapImage: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage, "mapImages/addMapImage">, addMapImages: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage[], "mapImages/addMapImages">, updateMapImage: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage, "mapImages/updateMapImage">, updateMapImages: import("@reduxjs/toolkit").ActionCreatorWithPayload<MapImage[], "mapImages/updateMapImages">, deleteMapImage: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "mapImages/deleteMapImage">, deleteMapImages: import("@reduxjs/toolkit").ActionCreatorWithPayload<string[], "mapImages/deleteMapImages">;
40
+ export declare const selectMapImageMapping: (state: MapImageSliceState) => Record<string, Stored<MapImage>>;
41
+ export declare const selectMapImages: (state: MapImageSliceState) => Stored<MapImage>[];
42
+ export declare const selectMapImageById: (id: string) => (state: MapImageSliceState) => Stored<MapImage> | undefined;
43
+ export declare const selectMapImagesOfProject: (args: number) => (state: import('../../typings/models/store').RootState) => Stored<MapImage>[];
44
+ export declare const mapImageReducer: Reducer<MapImageSliceState>;
@@ -79,6 +79,7 @@ export declare const selectProjectFiles: ((state: import("redux").EmptyObject &
79
79
  documentsReducer: import('..').DocumentState;
80
80
  teamReducer: import('..').TeamState;
81
81
  agentsReducer: import('..').AgentsState;
82
+ mapImageReducer: import('..').MapImageSliceState;
82
83
  } & {
83
84
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
84
85
  }) => ProjectFile[]) & import("reselect").OutputSelectorFields<(args_0: Record<string, ProjectFile>, args_1: number | null) => ProjectFile[], {
@@ -57,6 +57,7 @@ export declare const selectWorkspaces: ((state: import("redux").EmptyObject & {
57
57
  documentsReducer: import('..').DocumentState;
58
58
  teamReducer: import('..').TeamState;
59
59
  agentsReducer: import('..').AgentsState;
60
+ mapImageReducer: import('..').MapImageSliceState;
60
61
  } & {
61
62
  offline: import("@redux-offline/redux-offline/lib/types").OfflineState;
62
63
  }) => Workspace[]) & import("reselect").OutputSelectorFields<(args_0: Record<string, Workspace>) => Workspace[], {
@@ -3,7 +3,7 @@ import { AnyAction, Reducer } from "redux";
3
3
  import { Config, OfflineAction, OfflineMetadata, OfflineState } from "@redux-offline/redux-offline/lib/types";
4
4
  import request from "superagent";
5
5
  import { type OfflineMetaEffect, OutboxCoordinator, type OvermapSDK, RequestDetails } from "../sdk";
6
- import { AgentsState, AuthState, CategoryState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeState, DocumentState, EmailDomainState, FileState, FormRevisionState, FormState, FormSubmissionState, IssueState, IssueTypeState, LicenseState, MapState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectFileState, ProjectState, RehydratedState, SettingState, UserState, WorkspaceState, TeamState } from "./slices";
6
+ import { AgentsState, AuthState, CategoryState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeState, DocumentState, EmailDomainState, FileState, FormRevisionState, FormState, FormSubmissionState, IssueState, IssueTypeState, LicenseState, MapState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectFileState, ProjectState, RehydratedState, SettingState, UserState, WorkspaceState, TeamState, MapImageSliceState } from "./slices";
7
7
  import { VersioningState } from "./slices/versioningSlice";
8
8
  import { RootState } from "../typings";
9
9
  export declare const overmapReducers: {
@@ -36,6 +36,7 @@ export declare const overmapReducers: {
36
36
  documentsReducer: Reducer<DocumentState>;
37
37
  teamReducer: Reducer<TeamState>;
38
38
  agentsReducer: Reducer<AgentsState>;
39
+ mapImageReducer: Reducer<MapImageSliceState>;
39
40
  };
40
41
  export declare const overmapReducer: Reducer<import("redux").CombinedState<{
41
42
  versioning: VersioningState;
@@ -67,6 +68,7 @@ export declare const overmapReducer: Reducer<import("redux").CombinedState<{
67
68
  documentsReducer: DocumentState;
68
69
  teamReducer: TeamState;
69
70
  agentsReducer: AgentsState;
71
+ mapImageReducer: MapImageSliceState;
70
72
  }>, AnyAction>;
71
73
  export declare const resetStore = "RESET";
72
74
  export declare const rootReducer: Reducer<RootState>;
@@ -117,6 +119,7 @@ export declare const defaultStore: import("@reduxjs/toolkit/dist/configureStore"
117
119
  documentsReducer: DocumentState;
118
120
  teamReducer: TeamState;
119
121
  agentsReducer: AgentsState;
122
+ mapImageReducer: MapImageSliceState;
120
123
  } & {
121
124
  offline: OfflineState;
122
125
  }, AnyAction, import("@reduxjs/toolkit").MiddlewareArray<[import("@reduxjs/toolkit").ThunkMiddleware<RootState, AnyAction>]>>;
@@ -0,0 +1,3 @@
1
+ export interface ModelState<TModel> {
2
+ models: Record<string, TModel>;
3
+ }
@@ -18,3 +18,4 @@ export * from "./license";
18
18
  export * from "./documents";
19
19
  export * from "./teams";
20
20
  export * from "./agents";
21
+ export * from "./mapImage";
@@ -0,0 +1,12 @@
1
+ import { CreatedByModel, OfflineModel, SubmittedAtModel } from "./base";
2
+ import { FileWithNameModel } from "../files";
3
+ import { Marker } from "./geo";
4
+ export interface MapImage extends OfflineModel, SubmittedAtModel, FileWithNameModel, CreatedByModel {
5
+ project: number;
6
+ marker: Marker;
7
+ title: string | null;
8
+ description: string | null;
9
+ direction: number | null;
10
+ original_date: string | null;
11
+ }
12
+ export type MapImagePayload = Omit<MapImage, "offline_id" | "created_by" | "submitted_at" | "file_name" | "file_sha1" | "file" | "project">;
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.58-form-improvements.2",
6
+ "version": "1.0.58-map-images.1",
7
7
  "type": "module",
8
8
  "main": "dist/overmap-core.umd.cjs",
9
9
  "module": "dist/overmap-core.js",