@overmap-ai/core 1.0.75-more-clean-ups.0 → 1.0.75

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.
Files changed (45) hide show
  1. package/dist/overmap-core.js +2486 -2378
  2. package/dist/overmap-core.umd.cjs +7 -7
  3. package/dist/sdk/services/BaseAttachmentService.d.ts +3 -3
  4. package/dist/sdk/services/IssueAttachmentService.d.ts +1 -0
  5. package/dist/sdk/services/IssueCommentAttachmentService.d.ts +40 -0
  6. package/dist/sdk/services/IssueTypeAttachmentService.d.ts +40 -0
  7. package/dist/sdk/services/ProjectAttachmentService.d.ts +1 -1
  8. package/dist/sdk/services/index.d.ts +2 -0
  9. package/dist/store/slices/assetAttachmentSlice.d.ts +0 -4
  10. package/dist/store/slices/assetSlice.d.ts +2 -2
  11. package/dist/store/slices/assetStageCompletionSlice.d.ts +19 -19
  12. package/dist/store/slices/assetStageSlice.d.ts +9 -9
  13. package/dist/store/slices/assetTypeAttachmentSlice.d.ts +0 -4
  14. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -1
  15. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +2 -2
  16. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +2 -2
  17. package/dist/store/slices/assetTypeFieldsSlice.d.ts +3 -3
  18. package/dist/store/slices/assetTypeSlice.d.ts +2 -2
  19. package/dist/store/slices/documentAttachmentSlice.d.ts +0 -4
  20. package/dist/store/slices/emailDomainsSlice.d.ts +10 -10
  21. package/dist/store/slices/formRevisionSlice.d.ts +0 -1
  22. package/dist/store/slices/formSlice.d.ts +0 -1
  23. package/dist/store/slices/geoImageSlice.d.ts +17 -17
  24. package/dist/store/slices/index.d.ts +2 -0
  25. package/dist/store/slices/issueAttachmentSlice.d.ts +0 -4
  26. package/dist/store/slices/issueCommentAttachmentSlice.d.ts +42 -0
  27. package/dist/store/slices/issueTypeAttachmentSlice.d.ts +42 -0
  28. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +2 -2
  29. package/dist/store/slices/issueTypeFieldsSlice.d.ts +1 -1
  30. package/dist/store/slices/licenseSlice.d.ts +9 -9
  31. package/dist/store/slices/organizationAccessSlice.d.ts +9 -9
  32. package/dist/store/slices/projectAccessSlice.d.ts +9 -9
  33. package/dist/store/slices/projectAttachmentSlice.d.ts +0 -4
  34. package/dist/store/store.d.ts +3 -1
  35. package/dist/typings/models/assets.d.ts +2 -3
  36. package/dist/typings/models/attachments.d.ts +6 -0
  37. package/dist/typings/models/base.d.ts +7 -6
  38. package/dist/typings/models/fields.d.ts +1 -1
  39. package/dist/typings/models/forms.d.ts +4 -4
  40. package/dist/typings/models/geoImages.d.ts +3 -3
  41. package/dist/typings/models/issues.d.ts +22 -34
  42. package/dist/typings/models/store.d.ts +3 -1
  43. package/dist/utils/offline.d.ts +1 -0
  44. package/dist/utils/utils.d.ts +1 -0
  45. package/package.json +1 -1
@@ -58,7 +58,7 @@ export declare const selectIssueTypeFields: ((state: OvermapRootState) => Stored
58
58
  memoize: typeof import('reselect').weakMapMemoize;
59
59
  };
60
60
  export declare const selectIssueTypeFieldsOfIssueType: OvermapSelectorWithArgs<string, Stored<IssueTypeFields>[]>;
61
- export declare const selectLatestIssueTypeFieldsOfIssueType: OvermapSelectorWithArgs<string, IssueTypeFields | undefined>;
61
+ export declare const selectLatestIssueTypeFieldsOfIssueType: OvermapSelectorWithArgs<string, Stored<IssueTypeFields> | undefined>;
62
62
  export declare const selectIssueTypeValuesOfIssueType: OvermapSelectorWithArgs<string, Stored<IssueTypeFieldValues>[]>;
63
63
  export declare const selectIssueTypeFieldsById: OvermapSelectorWithArgs<string, Stored<IssueTypeFields> | undefined>;
64
64
  export declare const issueTypeFieldsReducer: Reducer<IssueTypeFieldsState>;
@@ -1,22 +1,22 @@
1
1
  import { Reducer } from '@reduxjs/toolkit';
2
- import { License, OvermapSelector, OvermapSelectorWithArgs } from '../../typings';
2
+ import { License, OvermapSelector, OvermapSelectorWithArgs, Stored } from '../../typings';
3
3
  import { ModelState } from '../typings';
4
- export type LicenseState = ModelState<License>;
4
+ export type LicenseState = ModelState<Stored<License>>;
5
5
  export declare const licenseSlice: import('@reduxjs/toolkit').Slice<LicenseState, {
6
- initializeLicences: (state: ModelState<License>, action: {
7
- payload: License[];
6
+ initializeLicences: (state: ModelState<Stored<License>>, action: {
7
+ payload: Stored<License>[];
8
8
  type: string;
9
9
  }) => void;
10
- addLicenses: (state: ModelState<License>, action: {
11
- payload: License[];
10
+ addLicenses: (state: ModelState<Stored<License>>, action: {
11
+ payload: Stored<License>[];
12
12
  type: string;
13
13
  }) => void;
14
- updateLicense: (state: ModelState<License>, action: {
15
- payload: License;
14
+ updateLicense: (state: ModelState<Stored<License>>, action: {
15
+ payload: Stored<License>;
16
16
  type: string;
17
17
  }) => void;
18
18
  }, "license", "license", import('@reduxjs/toolkit').SliceSelectors<LicenseState>>;
19
- export declare const initializeLicences: import('@reduxjs/toolkit').ActionCreatorWithPayload<License[], "license/initializeLicences">, addLicenses: import('@reduxjs/toolkit').ActionCreatorWithPayload<License[], "license/addLicenses">, updateLicense: import('@reduxjs/toolkit').ActionCreatorWithPayload<License, "license/updateLicense">;
19
+ export declare const initializeLicences: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<License>[], "license/initializeLicences">, addLicenses: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<License>[], "license/addLicenses">, updateLicense: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<License>, "license/updateLicense">;
20
20
  export declare const selectLicenses: OvermapSelector<Record<string, License>>;
21
21
  export declare const selectLicense: OvermapSelectorWithArgs<string, License | undefined>;
22
22
  export declare const selectLicenseForProject: OvermapSelectorWithArgs<number, License | undefined>;
@@ -1,20 +1,20 @@
1
1
  import { Reducer } from '@reduxjs/toolkit';
2
- import { OrganizationAccess, OvermapRootState, OvermapSelector, OvermapSelectorWithArgs, User } from '../../typings';
2
+ import { OrganizationAccess, OvermapRootState, OvermapSelector, OvermapSelectorWithArgs, Stored, User } from '../../typings';
3
3
  import { ModelState } from '../typings';
4
- export type OrganizationAccessState = ModelState<OrganizationAccess>;
4
+ export type OrganizationAccessState = ModelState<Stored<OrganizationAccess>>;
5
5
  export declare const organizationAccessSlice: import('@reduxjs/toolkit').Slice<OrganizationAccessState, {
6
- initializeOrganizationAccesses: (state: ModelState<OrganizationAccess>, action: {
7
- payload: OrganizationAccess[];
6
+ initializeOrganizationAccesses: (state: ModelState<Stored<OrganizationAccess>>, action: {
7
+ payload: Stored<OrganizationAccess>[];
8
8
  type: string;
9
9
  }) => void;
10
- updateOrganizationAccess: (state: ModelState<OrganizationAccess>, action: {
11
- payload: OrganizationAccess;
10
+ updateOrganizationAccess: (state: ModelState<Stored<OrganizationAccess>>, action: {
11
+ payload: Stored<OrganizationAccess>;
12
12
  type: string;
13
13
  }) => void;
14
- deleteOrganizationAccess: (state: ModelState<OrganizationAccess>, action: import('@reduxjs/toolkit').PayloadAction<string>) => void;
14
+ deleteOrganizationAccess: (state: ModelState<Stored<OrganizationAccess>>, action: import('@reduxjs/toolkit').PayloadAction<string>) => void;
15
15
  }, "organizationAccess", "organizationAccess", import('@reduxjs/toolkit').SliceSelectors<OrganizationAccessState>>;
16
- export declare const initializeOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess[], "organizationAccess/initializeOrganizationAccesses">, updateOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess, "organizationAccess/updateOrganizationAccess">, deleteOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "organizationAccess/deleteOrganizationAccess">;
17
- export declare const selectOrganizationAccesses: (state: OvermapRootState) => Record<string, OrganizationAccess>;
16
+ export declare const initializeOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<OrganizationAccess>[], "organizationAccess/initializeOrganizationAccesses">, updateOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<OrganizationAccess>, "organizationAccess/updateOrganizationAccess">, deleteOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "organizationAccess/deleteOrganizationAccess">;
17
+ export declare const selectOrganizationAccesses: (state: OvermapRootState) => Record<string, Stored<OrganizationAccess>>;
18
18
  export declare const selectOrganizationAccessById: OvermapSelectorWithArgs<string, OrganizationAccess | undefined>;
19
19
  export declare const selectActiveOrganizationAccess: OvermapSelector<OrganizationAccess | null>;
20
20
  export declare const selectOrganizationAccessForUser: OvermapSelectorWithArgs<User, OrganizationAccess | undefined>;
@@ -1,21 +1,21 @@
1
1
  import { Reducer } from '@reduxjs/toolkit';
2
2
  import { OvermapRootState, OvermapSelector, OvermapSelectorWithArgs, ProjectAccess, Stored, User } from '../../typings';
3
3
  import { ModelState } from '../typings';
4
- export type ProjectAccessState = ModelState<ProjectAccess>;
4
+ export type ProjectAccessState = ModelState<Stored<ProjectAccess>>;
5
5
  export declare const projectAccessSlice: import('@reduxjs/toolkit').Slice<ProjectAccessState, {
6
- initializeProjectAccesses: (state: ModelState<ProjectAccess>, action: {
7
- payload: ProjectAccess[];
6
+ initializeProjectAccesses: (state: ModelState<Stored<ProjectAccess>>, action: {
7
+ payload: Stored<ProjectAccess>[];
8
8
  type: string;
9
9
  }) => void;
10
- updateProjectAccess: (state: ModelState<ProjectAccess>, action: {
11
- payload: ProjectAccess;
10
+ updateProjectAccess: (state: ModelState<Stored<ProjectAccess>>, action: {
11
+ payload: Stored<ProjectAccess>;
12
12
  type: string;
13
13
  }) => void;
14
- deleteProjectAccess: (state: ModelState<ProjectAccess>, action: import('@reduxjs/toolkit').PayloadAction<string>) => void;
15
- deleteProjectAccesses: (state: ModelState<ProjectAccess>, action: import('@reduxjs/toolkit').PayloadAction<string[]>) => void;
14
+ deleteProjectAccess: (state: ModelState<Stored<ProjectAccess>>, action: import('@reduxjs/toolkit').PayloadAction<string>) => void;
15
+ deleteProjectAccesses: (state: ModelState<Stored<ProjectAccess>>, action: import('@reduxjs/toolkit').PayloadAction<string[]>) => void;
16
16
  }, "projectAccess", "projectAccess", import('@reduxjs/toolkit').SliceSelectors<ProjectAccessState>>;
17
- export declare const initializeProjectAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<ProjectAccess[], "projectAccess/initializeProjectAccesses">, updateProjectAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<ProjectAccess, "projectAccess/updateProjectAccess">, deleteProjectAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "projectAccess/deleteProjectAccess">, deleteProjectAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<string[], "projectAccess/deleteProjectAccesses">;
18
- export declare const selectProjectAccessMapping: (state: OvermapRootState) => Record<string, ProjectAccess>;
17
+ export declare const initializeProjectAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAccess>[], "projectAccess/initializeProjectAccesses">, updateProjectAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAccess>, "projectAccess/updateProjectAccess">, deleteProjectAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "projectAccess/deleteProjectAccess">, deleteProjectAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<string[], "projectAccess/deleteProjectAccesses">;
18
+ export declare const selectProjectAccessMapping: (state: OvermapRootState) => Record<string, Stored<ProjectAccess>>;
19
19
  export declare const selectProjectAccesses: OvermapSelector<Stored<ProjectAccess>[]>;
20
20
  export declare const selectProjectAccessById: OvermapSelectorWithArgs<string, ProjectAccess | undefined>;
21
21
  export declare const selectProjectAccessForUser: OvermapSelectorWithArgs<User, ProjectAccess | undefined>;
@@ -39,8 +39,4 @@ export declare const selectProjectAttachmentMapping: (state: OvermapRootState) =
39
39
  export declare const selectAllProjectAttachments: OvermapSelector<Stored<ProjectAttachment>[]>;
40
40
  export declare const selectProjectAttachmentById: OvermapSelectorWithArgs<string, ProjectAttachment | undefined>;
41
41
  export declare const selectAttachmentsOfProject: (args: number) => (state: OvermapRootState) => Stored<ProjectAttachment>[];
42
- export declare const selectAttachmentsOfProjectByType: (args: number) => (state: OvermapRootState) => {
43
- fileAttachments: Stored<ProjectAttachment>[];
44
- imageAttachments: Stored<ProjectAttachment>[];
45
- };
46
42
  export declare const projectAttachmentReducer: Reducer<ProjectAttachmentState>;
@@ -3,7 +3,7 @@ import { Reducer } from '@reduxjs/toolkit';
3
3
  import { default as request } from 'superagent';
4
4
  import { BaseSDK, OfflineMetaEffect, OutboxCoordinator, RequestDetails } from '../sdk';
5
5
  import { BaseState, OvermapRootState } from '../typings';
6
- import { AgentsState, AssetAttachmentState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeAttachmentState, AssetTypeFieldsAttachmentState, AssetTypeFieldsState, AssetTypeFieldValuesAttachmentState, AssetTypeFieldValuesState, AssetTypeState, AuthState, CategoryState, DocumentAttachmentState, DocumentState, EmailDomainState, FileState, FormRevisionAttachmentState, FormRevisionState, FormState, FormSubmissionAttachmentState, FormSubmissionState, GeoImageSliceState, IssueAssociationSliceState, IssueAttachmentState, IssueCommentState, IssueState, IssueTypeFieldsAttachmentState, IssueTypeFieldsState, IssueTypeFieldValuesAttachmentState, IssueTypeFieldValuesState, IssueTypeState, IssueUpdateState, LicenseState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectAttachmentState, ProjectFileState, ProjectState, RehydratedState, TeamState, UserState, VersioningState } from './slices';
6
+ import { AgentsState, AssetAttachmentState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeAttachmentState, AssetTypeFieldsAttachmentState, AssetTypeFieldsState, AssetTypeFieldValuesAttachmentState, AssetTypeFieldValuesState, AssetTypeState, AuthState, CategoryState, DocumentAttachmentState, DocumentState, EmailDomainState, FileState, FormRevisionAttachmentState, FormRevisionState, FormState, FormSubmissionAttachmentState, FormSubmissionState, GeoImageSliceState, IssueAssociationSliceState, IssueAttachmentState, IssueCommentAttachmentState, IssueCommentState, IssueState, IssueTypeAttachmentState, IssueTypeFieldsAttachmentState, IssueTypeFieldsState, IssueTypeFieldValuesAttachmentState, IssueTypeFieldValuesState, IssueTypeState, IssueUpdateState, LicenseState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectAttachmentState, ProjectFileState, ProjectState, RehydratedState, TeamState, UserState, VersioningState } from './slices';
7
7
  export declare const VERSION_REDUCER_KEY = "versioning";
8
8
  export declare const overmapReducers: {
9
9
  versioning: Reducer<VersioningState>;
@@ -18,6 +18,7 @@ export declare const overmapReducers: {
18
18
  assetTypeAttachmentReducer: Reducer<AssetTypeAttachmentState>;
19
19
  issueReducer: Reducer<IssueState>;
20
20
  issueTypeReducer: Reducer<IssueTypeState>;
21
+ issueTypeAttachmentReducer: Reducer<IssueTypeAttachmentState>;
21
22
  organizationReducer: Reducer<OrganizationState>;
22
23
  outboxReducer: Reducer<OutboxState>;
23
24
  projectReducer: Reducer<ProjectState>;
@@ -39,6 +40,7 @@ export declare const overmapReducers: {
39
40
  teamReducer: Reducer<TeamState>;
40
41
  agentsReducer: Reducer<AgentsState>;
41
42
  issueCommentReducer: Reducer<IssueCommentState>;
43
+ issueCommentAttachmentReducer: Reducer<IssueCommentAttachmentState>;
42
44
  issueUpdateReducer: Reducer<IssueUpdateState>;
43
45
  issueAttachmentReducer: Reducer<IssueAttachmentState>;
44
46
  geoImageReducer: Reducer<GeoImageSliceState>;
@@ -1,10 +1,9 @@
1
1
  import { BaseSerializedObject, ISerializedField } from '@overmap-ai/forms';
2
- import { ColorModel, CreatedByModel, IconModel, OfflineModel, SubmittedAtModel, TimestampedModel } from './base';
2
+ import { ColorModel, CreatedByModel, IconModel, IndexedModel, OfflineModel, SubmittedAtModel, TimestampedModel } from './base';
3
3
  import { FieldsAttachmentModel, FieldsModel, FieldValuesModel } from './fields';
4
4
  import { CanvasMarkableModel, MarkableModel } from './geo';
5
- export interface Asset extends OfflineModel, TimestampedModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel {
5
+ export interface Asset extends OfflineModel, TimestampedModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, IndexedModel {
6
6
  asset_type: string;
7
- created_at?: string;
8
7
  label: string | null;
9
8
  description?: string;
10
9
  project: number;
@@ -7,6 +7,12 @@ export interface Attachment extends OfflineModel, SubmittedAtModel, FileWithName
7
7
  export interface IssueAttachment extends Attachment {
8
8
  issue: string;
9
9
  }
10
+ export interface IssueTypeAttachment extends Attachment {
11
+ issue_type: string;
12
+ }
13
+ export interface IssueCommentAttachment extends Attachment {
14
+ issue_comment: string;
15
+ }
10
16
  export interface AssetAttachment extends Attachment {
11
17
  asset: string;
12
18
  }
@@ -1,4 +1,5 @@
1
1
  import { CSSColor } from '../colors';
2
+ import { CommonAutoFields } from './issues';
2
3
  import { User } from './users';
3
4
  export interface Model {
4
5
  }
@@ -9,17 +10,14 @@ export interface SubmittedAtModel extends Model {
9
10
  submitted_at: string;
10
11
  }
11
12
  export interface TimestampedModel extends Model {
12
- created_at?: string;
13
- updated_at?: string;
13
+ created_at: string;
14
+ updated_at: string;
14
15
  }
15
16
  export type Offline<T> = T & {
16
17
  offline_id: string;
17
18
  };
18
19
  export type OfflineIdMapping<TModel extends OfflineModel> = Record<TModel["offline_id"], TModel>;
19
- export type Payload<TModel> = Omit<TModel, "offline_id" | "created_at" | "updated_at" | "id" | "submitted_at" | "created_by">;
20
- export type MaybePayload<TModel extends OfflineModel> = Payload<TModel> & {
21
- offline_id?: string | null;
22
- };
20
+ export type Payload<TModel> = Omit<TModel, CommonAutoFields | "offline_id" | "id" | "submitted_at" | "created_by">;
23
21
  export interface FileObject {
24
22
  file_sha1: string;
25
23
  file: string;
@@ -42,3 +40,6 @@ export interface ColorModel {
42
40
  export interface CreatedByModel {
43
41
  created_by?: User["id"] | null;
44
42
  }
43
+ export interface IndexedModel {
44
+ index: number;
45
+ }
@@ -2,7 +2,7 @@ import { BaseSerializedObject, FieldValue, ISerializedField } from '@overmap-ai/
2
2
  import { FileWithNameModel } from '../files';
3
3
  export interface FieldsModel<TFields extends BaseSerializedObject = ISerializedField> {
4
4
  fields: TFields[];
5
- revision: number | "Pending";
5
+ revision: number;
6
6
  }
7
7
  export interface FieldValuesModel {
8
8
  published_at?: string | null;
@@ -1,5 +1,5 @@
1
1
  import { BaseSerializedObject, ISerializedField } from '@overmap-ai/forms';
2
- import { CreatedByModel, OfflineModel, Payload, SubmittedAtModel, TimestampedModel } from './base';
2
+ import { CreatedByModel, IndexedModel, OfflineModel, Payload, SubmittedAtModel, TimestampedModel } from './base';
3
3
  import { FieldsAttachmentModel, FieldsModel, FieldValuesAttachmentModel, FieldValuesModel } from './fields';
4
4
  export interface Form extends OfflineModel, SubmittedAtModel, CreatedByModel {
5
5
  organization: number;
@@ -10,15 +10,15 @@ export interface FormRevision<TFields extends BaseSerializedObject = ISerialized
10
10
  description?: string;
11
11
  }
12
12
  export type FormRevisionPayload = Omit<Payload<FormRevision>, "revision">;
13
- export interface FormSubmission extends OfflineModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldValuesModel {
13
+ export interface FormSubmission extends OfflineModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldValuesModel, IndexedModel {
14
14
  form_revision: string;
15
15
  project: number;
16
16
  issue?: string | null;
17
17
  asset?: string | null;
18
18
  }
19
- export interface FormSubmissionAttachment extends FieldValuesAttachmentModel {
19
+ export interface FormSubmissionAttachment extends OfflineModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldValuesAttachmentModel {
20
20
  form_submission: string;
21
21
  }
22
- export interface FormRevisionAttachment extends FieldsAttachmentModel {
22
+ export interface FormRevisionAttachment extends OfflineModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsAttachmentModel {
23
23
  form_revision: string;
24
24
  }
@@ -1,14 +1,14 @@
1
1
  import { FileWithNameModel } from '../files';
2
- import { CreatedByModel, OfflineModel, SubmittedAtModel } from './base';
2
+ import { CreatedByModel, IndexedModel, OfflineModel, Payload, SubmittedAtModel } from './base';
3
3
  import { CanvasMarkableModel, MarkableModel } from './geo';
4
- export interface GeoImage extends OfflineModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, FileWithNameModel {
4
+ export interface GeoImage extends OfflineModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, FileWithNameModel, IndexedModel {
5
5
  title?: string;
6
6
  description?: string;
7
7
  project: number;
8
8
  direction?: number;
9
9
  original_date?: string;
10
10
  }
11
- export type GeoImagePayload = Omit<GeoImage, "offline_id" | "submitted_at" | "created_by" | "file_name" | "file_sha1" | "file"> & {
11
+ export type GeoImagePayload = Omit<Payload<GeoImage>, "file_name" | "file_sha1" | "file"> & {
12
12
  file: File;
13
13
  };
14
14
  export type BulkGeoImagePayload = Omit<GeoImagePayload, "project">;
@@ -1,21 +1,37 @@
1
1
  import { BaseSerializedObject, ISerializedField } from '@overmap-ai/forms';
2
2
  import { IssuePriority, IssueStatus, IssueUpdateChange } from '../../enums';
3
+ import { COMMON_AUTO_FIELDS } from '../../utils';
3
4
  import { CSSColor } from '../colors';
4
- import { CreatedByModel, Offline, OfflineModel, SubmittedAtModel, TimestampedModel } from './base';
5
+ import { CreatedByModel, IndexedModel, OfflineModel, SubmittedAtModel, TimestampedModel } from './base';
5
6
  import { FieldsAttachmentModel, FieldsModel, FieldValuesModel } from './fields';
6
7
  import { CanvasMarkableModel, MarkableModel } from './geo';
7
8
  import { User } from './users';
9
+ type FilteredKeys<T> = {
10
+ [P in keyof T]: T[P] extends never ? never : P;
11
+ }[keyof T];
12
+ type ExcludeNeverFields<O> = {
13
+ [K in FilteredKeys<O>]: O[K];
14
+ };
15
+ type PropertyUndefined<T> = {
16
+ [P in keyof T]?: T[P];
17
+ };
18
+ export type CommonAutoFields = (typeof COMMON_AUTO_FIELDS)[number];
8
19
  /**
9
20
  * Represents a model instance that has been submitted to the backend. Some properties (depending on which model, but in
10
21
  * all cases, the `offline_id`) are guaranteed to be set.
11
22
  */
12
- export type Submitted<TModel> = Offline<TModel> & (TModel extends Issue ? SubmittedIssue : Omit<TModel, "created_at" | "id">);
23
+ export type Submitted<TModel> = Omit<TModel, CommonAutoFields> & PropertyUndefined<ExcludeNeverFields<{
24
+ created_at: "created_at" extends keyof TModel ? undefined : never;
25
+ updated_at: "updated_at" extends keyof TModel ? undefined : never;
26
+ index: "index" extends keyof TModel ? undefined : never;
27
+ revision: "revision" extends keyof TModel ? undefined : never;
28
+ }>>;
13
29
  /**
14
30
  * Represents a model instance that has been submitted to the backend, accepted, then downloaded. Created models
15
31
  * typically have additional properties that are only known once it has been processed and accepted by the API, such as
16
32
  * the `created_at` timestamp, which is the time at which the data was written to the database.
17
33
  */
18
- export type Created<TModel> = Submitted<TModel> & (TModel extends Issue ? CreatedIssue : TModel extends IssueComment ? CreatedIssueComment : TModel);
34
+ export type Created<TModel> = TModel;
19
35
  /**
20
36
  * Model instances that are stored in the Redux store can be already-created (and will likely be gotten with the initial
21
37
  * data load), or to-be-created. In the former case, you will get a `Created<TModel>`. In the latter case, you will get
@@ -26,7 +42,7 @@ export type Stored<TModel> = Created<TModel> | Submitted<TModel>;
26
42
  * Represents the properties you can always expect on any object representing an issue. These are the minimal details
27
43
  * required when creating an issue.
28
44
  */
29
- export interface Issue extends OfflineModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel {
45
+ export interface Issue extends OfflineModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, IndexedModel {
30
46
  title?: string | null;
31
47
  description?: string | null;
32
48
  priority: IssuePriority;
@@ -34,43 +50,14 @@ export interface Issue extends OfflineModel, SubmittedAtModel, CreatedByModel, M
34
50
  assigned_to?: number | null;
35
51
  due_date?: string | Date | null;
36
52
  category?: string | null;
37
- issue_type?: string | null;
53
+ issue_type: string;
38
54
  project: number;
39
55
  }
40
- /**
41
- * These details need to be provided by the frontend code before submitting to the backend.
42
- */
43
- export interface SubmittedIssue extends OfflineModel, CreatedByModel {
44
- submitted_at: string;
45
- status: Exclude<Issue["status"], undefined>;
46
- priority: Exclude<Issue["priority"], undefined>;
47
- }
48
- /**
49
- * These details exist on issues that have been successfully submitted, accepted, created, and serialized by the
50
- * backend, then downloaded by the frontend.
51
- */
52
- export interface CreatedIssue extends Issue {
53
- title: Exclude<Issue["title"], undefined>;
54
- description: Exclude<Issue["description"], undefined>;
55
- assigned_to: Exclude<Issue["assigned_to"], undefined>;
56
- due_date: Exclude<Issue["due_date"], undefined>;
57
- category: Exclude<Issue["category"], undefined>;
58
- geo_marker: Exclude<Issue["geo_marker"], undefined>;
59
- created_at: string;
60
- }
61
56
  export interface IssueComment extends OfflineModel, SubmittedAtModel, TimestampedModel {
62
57
  issue: string;
63
58
  content: string;
64
59
  author?: number;
65
60
  }
66
- export interface SubmittedIssueComment {
67
- created_at: Exclude<IssueComment["created_at"], undefined>;
68
- }
69
- export interface CreatedIssueComment {
70
- author: Exclude<IssueComment["author"], undefined>;
71
- created_at: Exclude<IssueComment["created_at"], undefined>;
72
- }
73
- export type IssueCommentPayload = Omit<IssueComment, "author" | "created_at" | "offline_id">;
74
61
  export interface IssueUpdateChangeTypes {
75
62
  status: IssueStatus;
76
63
  priority: IssuePriority;
@@ -110,3 +97,4 @@ export interface IssueTypeFieldValues extends OfflineModel, SubmittedAtModel, Ti
110
97
  export interface IssueTypeFieldValuesAttachment extends OfflineModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsAttachmentModel {
111
98
  field_values: string;
112
99
  }
100
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { OfflineState } from '@redux-offline/redux-offline/lib/types';
2
- import { AgentsState, AssetAttachmentState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeAttachmentState, AssetTypeFieldsAttachmentState, AssetTypeFieldsState, AssetTypeFieldValuesAttachmentState, AssetTypeFieldValuesState, AssetTypeState, AuthState, CategoryState, DocumentAttachmentState, DocumentState, EmailDomainState, FileState, FormRevisionAttachmentState, FormRevisionState, FormState, FormSubmissionAttachmentState, FormSubmissionState, GeoImageSliceState, IssueAssociationSliceState, IssueAttachmentState, IssueCommentState, IssueState, IssueTypeFieldsAttachmentState, IssueTypeFieldsState, IssueTypeFieldValuesAttachmentState, IssueTypeFieldValuesState, IssueTypeState, IssueUpdateState, LicenseState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectAttachmentState, ProjectFileState, ProjectState, RehydratedState, TeamState, UserState, VERSION_REDUCER_KEY, VersioningState } from '../../store';
2
+ import { AgentsState, AssetAttachmentState, AssetStageCompletionState, AssetStageState, AssetState, AssetTypeAttachmentState, AssetTypeFieldsAttachmentState, AssetTypeFieldsState, AssetTypeFieldValuesAttachmentState, AssetTypeFieldValuesState, AssetTypeState, AuthState, CategoryState, DocumentAttachmentState, DocumentState, EmailDomainState, FileState, FormRevisionAttachmentState, FormRevisionState, FormState, FormSubmissionAttachmentState, FormSubmissionState, GeoImageSliceState, IssueAssociationSliceState, IssueAttachmentState, IssueCommentAttachmentState, IssueCommentState, IssueState, IssueTypeAttachmentState, IssueTypeFieldsAttachmentState, IssueTypeFieldsState, IssueTypeFieldValuesAttachmentState, IssueTypeFieldValuesState, IssueTypeState, IssueUpdateState, LicenseState, OrganizationAccessState, OrganizationState, OutboxState, ProjectAccessState, ProjectAttachmentState, ProjectFileState, ProjectState, RehydratedState, TeamState, UserState, VERSION_REDUCER_KEY, VersioningState } from '../../store';
3
3
  export interface BaseState {
4
4
  outboxReducer: OutboxState;
5
5
  offline: OfflineState;
@@ -18,8 +18,10 @@ export interface OvermapRootState extends BaseState {
18
18
  issueReducer: IssueState;
19
19
  issueAttachmentReducer: IssueAttachmentState;
20
20
  issueCommentReducer: IssueCommentState;
21
+ issueCommentAttachmentReducer: IssueCommentAttachmentState;
21
22
  issueUpdateReducer: IssueUpdateState;
22
23
  issueTypeReducer: IssueTypeState;
24
+ issueTypeAttachmentReducer: IssueTypeAttachmentState;
23
25
  organizationReducer: OrganizationState;
24
26
  projectReducer: ProjectState;
25
27
  projectAttachmentReducer: ProjectAttachmentState;
@@ -1,4 +1,5 @@
1
1
  import { Offline, OfflineModel } from '../typings';
2
+ export declare const COMMON_AUTO_FIELDS: readonly ["created_at", "updated_at", "index", "revision"];
2
3
  /**
3
4
  * Adds a generated UUID to the "offline_id" key of the object.
4
5
  * @param draft The model data to add the offline_id to
@@ -4,4 +4,5 @@ export declare const restructureCreateSelectorWithArgs: <TArgs, TRet>(selector:
4
4
  export declare function onlyUniqueOfflineIds(value: OfflineModel, index: number, self: OfflineModel[]): boolean;
5
5
  export declare function onlyUniqueHashes(value: IssueAttachment, index: number, self: IssueAttachment[]): boolean;
6
6
  export declare const emailRegex: RegExp;
7
+ export declare function createPayload<TPayload extends object>(payload: TPayload): TPayload;
7
8
  export {};
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.75-more-clean-ups.0",
6
+ "version": "1.0.75",
7
7
  "type": "module",
8
8
  "main": "dist/overmap-core.umd.cjs",
9
9
  "module": "dist/overmap-core.js",