@overmap-ai/core 1.0.63-form-submission-fix.4 → 1.0.63-org-projs-only.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.
@@ -1,20 +1,16 @@
1
- import { Form, FormRevision, FormRevisionAttachment, FormRevisionPayload, ISerializedField } from '../../typings/models/forms';
2
- import { Created, OvermapRootState, Stored } from "../../typings";
1
+ import { Form, FormRevision, FormRevisionPayload, ISerializedField } from '../../typings/models/forms';
2
+ import { OptimisticModelResult } from "../typings";
3
+ import { Created, OvermapRootState, Submitted } from "../../typings";
4
+ import { BaseApiService } from "./BaseApiService";
3
5
  import type { BaseSDK } from "../base";
4
- import { BaseUploadService } from "./BaseUploadService";
5
- export declare abstract class FormService<TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseUploadService<TState, TSDK> {
6
- private bulkAddRevisionAttachments;
6
+ export declare abstract class FormService<TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseApiService<TState, TSDK> {
7
+ private getAttachImagePromises;
7
8
  private add;
8
- addForOrganization(organizationId: number, initialRevision: FormRevisionPayload): Promise<[Stored<Form>, Stored<FormRevision<ISerializedField>>, Stored<FormRevisionAttachment>[], Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevisionAttachment>[]>]>;
9
- addForProject(projectId: number, initialRevision: FormRevisionPayload): Promise<[Stored<Form>, Stored<FormRevision<ISerializedField>>, Stored<FormRevisionAttachment>[], Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevisionAttachment>[]>]>;
10
- addForIssueType(issueTypeId: string, initialRevision: FormRevisionPayload): Promise<[Stored<Form>, Stored<FormRevision<ISerializedField>>, Stored<FormRevisionAttachment>[], Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevisionAttachment>[]>]>;
11
- addForAssetType(assetTypeId: string, initialRevision: FormRevisionPayload): Promise<[Stored<Form>, Stored<FormRevision<ISerializedField>>, Stored<FormRevisionAttachment>[], Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevisionAttachment>[]>]>;
12
- createRevision(formId: string, revision: FormRevisionPayload): Promise<[
13
- Stored<FormRevision>,
14
- Stored<FormRevisionAttachment>[],
15
- Promise<Created<FormRevision>>,
16
- Promise<Created<FormRevisionAttachment>[]>
17
- ]>;
9
+ addForOrganization(organizationId: number, initialRevision: FormRevisionPayload): Promise<[Submitted<Form>, Submitted<FormRevision<ISerializedField>>, Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevision<ISerializedField>>>]>;
10
+ addForProject(projectId: number, initialRevision: FormRevisionPayload): Promise<[Submitted<Form>, Submitted<FormRevision<ISerializedField>>, Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevision<ISerializedField>>>]>;
11
+ addForIssueType(issueTypeId: string, initialRevision: FormRevisionPayload): Promise<[Submitted<Form>, Submitted<FormRevision<ISerializedField>>, Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevision<ISerializedField>>>]>;
12
+ addForAssetType(assetTypeId: string, initialRevision: FormRevisionPayload): Promise<[Submitted<Form>, Submitted<FormRevision<ISerializedField>>, Promise<Created<FormRevision<ISerializedField>>>, Promise<Created<FormRevision<ISerializedField>>>]>;
13
+ createRevision(formId: string, revision: FormRevisionPayload): Promise<OptimisticModelResult<FormRevision>>;
18
14
  favorite(formId: string): Promise<undefined>;
19
15
  unfavorite(formId: string): Promise<undefined>;
20
16
  delete(formId: string): Promise<undefined>;
@@ -1,5 +1,6 @@
1
+ import { Offline } from '../../typings/models/base';
1
2
  import { FieldValue, FormSubmission, FormSubmissionAttachment, FormSubmissionPayload } from '../../typings/models/forms';
2
- import { PresignedUrlsResponse } from "../typings";
3
+ import { OptimisticModelResult, PresignedUrlsResponse } from "../typings";
3
4
  import { Created, OvermapRootState, Stored } from "../../typings";
4
5
  import type { BaseSDK } from "../base";
5
6
  import { BaseUploadService } from "./BaseUploadService";
@@ -9,18 +10,14 @@ interface BulkAddRequestReturnValue {
9
10
  presigned_urls: PresignedUrlsResponse;
10
11
  }
11
12
  export declare abstract class FormSubmissionService<TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseUploadService<TState, TSDK> {
12
- private bulkAddSubmissionAttachments;
13
- add(payload: FormSubmissionPayload): Promise<[
14
- Stored<FormSubmission>,
15
- Stored<FormSubmissionAttachment>[],
16
- Promise<Created<FormSubmission>>,
17
- Promise<Created<FormSubmissionAttachment>[]>
18
- ]>;
13
+ private getAttachFilesPromises;
14
+ add(payload: Offline<FormSubmissionPayload>): OptimisticModelResult<FormSubmission>;
19
15
  bulkAdd(args: {
20
16
  formRevision: string;
21
17
  commonFieldValues: Record<string, FieldValue>;
22
18
  fieldValuesByAsset: Record<string, Record<string, FieldValue>>;
23
19
  }, batchSize: number): Promise<Promise<BulkAddRequestReturnValue>[]>;
20
+ update(submission: Stored<FormSubmission>): OptimisticModelResult<FormSubmission>;
24
21
  delete(submissionId: string): Promise<undefined>;
25
22
  refreshStore(projectId: number): Promise<void>;
26
23
  }
@@ -1,8 +1,11 @@
1
- import { CreatedByModel, OfflineModel, SubmittedAtModel } from "./base";
2
- import { FileModel, FileWithNameModel, MaybeObjectURL } from "../files";
3
- export interface Attachment extends OfflineModel, SubmittedAtModel, FileWithNameModel, CreatedByModel {
1
+ import { CreatedByModel, OfflineModel } from "./base";
2
+ import { MaybeObjectURL, FileModel, FileWithNameModel } from "../files";
3
+ import { Project } from "./projects";
4
+ import { Document } from "./documents";
5
+ export interface Attachment extends OfflineModel, FileWithNameModel, CreatedByModel {
4
6
  description?: string;
5
7
  file_type: string;
8
+ submitted_at: string;
6
9
  }
7
10
  export interface IssueAttachment extends Attachment {
8
11
  issue: string;
@@ -14,10 +17,10 @@ export interface AssetTypeAttachment extends Attachment {
14
17
  asset_type: string;
15
18
  }
16
19
  export interface ProjectAttachment extends Attachment {
17
- project: number;
20
+ project: Project["id"];
18
21
  }
19
22
  export interface DocumentAttachment extends Attachment {
20
- document: string;
23
+ document: Document["offline_id"];
21
24
  }
22
25
  export declare enum AttachmentModel {
23
26
  Issue = "issue",
@@ -30,8 +30,7 @@ export interface OptionalFileModel {
30
30
  file?: string | null;
31
31
  objectURL?: string;
32
32
  }
33
- export interface OwnedByUserOrOrganization {
34
- user_owner: number;
33
+ export interface OwnedByOrganization {
35
34
  organization_owner: number;
36
35
  }
37
36
  export interface SubmittedAtModel {
@@ -1,6 +1,6 @@
1
1
  import { HTMLInputTypeAttribute } from "react";
2
2
  import { CreatedByModel, OfflineModel, Payload, SubmittedAtModel } from "./base";
3
- import { Attachment } from "./attachments";
3
+ import { FileWithNameModel } from '../files';
4
4
  export interface BaseSerializedField<TIdentifier extends FieldTypeIdentifier = FieldTypeIdentifier> extends BaseSerializedObject<TIdentifier> {
5
5
  label: string;
6
6
  required: boolean;
@@ -121,11 +121,11 @@ export interface FormSubmission extends OfflineModel, SubmittedAtModel, CreatedB
121
121
  asset?: string;
122
122
  asset_stage?: string;
123
123
  }
124
- export interface FormSubmissionAttachment extends Attachment {
124
+ export interface FormSubmissionAttachment extends OfflineModel, FileWithNameModel {
125
125
  submission: string;
126
126
  field_identifier: string;
127
127
  }
128
- export interface FormRevisionAttachment extends Attachment {
128
+ export interface FormRevisionAttachment extends OfflineModel, FileWithNameModel {
129
129
  revision: string;
130
130
  field_identifier: string;
131
131
  }
@@ -1,4 +1,4 @@
1
- import { OfflineModel, OwnedByUserOrOrganization } from "./base";
1
+ import { OfflineModel, OwnedByOrganization } from "./base";
2
2
  export declare enum PaddleCheckoutEvent {
3
3
  COMPLETED = "checkout.completed",
4
4
  CLOSED = "checkout.closed"
@@ -16,7 +16,7 @@ export declare enum LicenseStatus {
16
16
  export interface Transaction {
17
17
  id: string;
18
18
  }
19
- export interface License extends OfflineModel, OwnedByUserOrOrganization {
19
+ export interface License extends OfflineModel, OwnedByOrganization {
20
20
  project: number | null;
21
21
  level: LicenseLevel;
22
22
  status: LicenseStatus;
@@ -1,11 +1,9 @@
1
- import { Model, OfflineModel } from "./base";
1
+ import { Model, OfflineModel, OwnedByOrganization } from "./base";
2
2
  import { FileWithNameModel } from "../files";
3
3
  import { BoundableModel, CanvasBoundableModel } from "./geo";
4
- export interface Project extends Model, BoundableModel, CanvasBoundableModel {
4
+ export interface Project extends Model, BoundableModel, CanvasBoundableModel, OwnedByOrganization {
5
5
  id: number;
6
6
  name: string;
7
- organization_owner: number | null;
8
- user_owner: number | null;
9
7
  invited?: boolean;
10
8
  issues_count?: number;
11
9
  form_submissions_count?: number;
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.63-form-submission-fix.4",
6
+ "version": "1.0.63-org-projs-only.1",
7
7
  "type": "module",
8
8
  "main": "dist/overmap-core.umd.cjs",
9
9
  "module": "dist/overmap-core.js",