@overmap-ai/core 1.0.78-organization-owner-rename.1 → 1.0.78-organization-owner-rename.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 +40 -32
- package/dist/overmap-core.umd.cjs +1 -1
- package/dist/sdk/services/ProjectAttachmentService.d.ts +2 -2
- package/dist/store/slices/organizationAccessSlice.d.ts +20 -20
- package/dist/store/slices/projectAccessSlice.d.ts +1 -1
- package/dist/store/slices/projectAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/projectFileSlice.d.ts +1 -1
- package/dist/typings/models/attachments.d.ts +2 -2
- package/dist/typings/models/forms.d.ts +1 -1
- package/dist/typings/models/geoImages.d.ts +2 -2
- package/dist/typings/models/issueTypes.d.ts +2 -2
- package/dist/typings/models/issues.d.ts +3 -4
- package/dist/typings/models/organizations.d.ts +3 -3
- package/dist/typings/models/projects.d.ts +4 -4
- package/dist/typings/models/teams.d.ts +3 -3
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -7436,21 +7436,25 @@ class V_ extends w {
|
|
|
7436
7436
|
}
|
|
7437
7437
|
class C_ extends w {
|
|
7438
7438
|
add(e) {
|
|
7439
|
-
|
|
7440
|
-
this.
|
|
7441
|
-
|
|
7439
|
+
var n;
|
|
7440
|
+
const { store: s } = this.client, i = T({
|
|
7441
|
+
...e,
|
|
7442
|
+
created_by: (n = s.getState().userReducer.currentUser) == null ? void 0 : n.id
|
|
7443
|
+
});
|
|
7444
|
+
this.dispatch(aa(i));
|
|
7445
|
+
const a = this.enqueueRequest({
|
|
7442
7446
|
description: "Add project access",
|
|
7443
7447
|
method: u.POST,
|
|
7444
7448
|
url: "/project-accesses/",
|
|
7445
|
-
payload: k(
|
|
7446
|
-
blockers: [
|
|
7447
|
-
blocks: [
|
|
7449
|
+
payload: k(i),
|
|
7450
|
+
blockers: [i.organization_access, i.project],
|
|
7451
|
+
blocks: [i.uuid]
|
|
7448
7452
|
});
|
|
7449
|
-
return
|
|
7450
|
-
this.dispatch(ot(
|
|
7451
|
-
}).catch((
|
|
7452
|
-
throw this.dispatch(na(
|
|
7453
|
-
}), [
|
|
7453
|
+
return a.then((r) => {
|
|
7454
|
+
this.dispatch(ot(r));
|
|
7455
|
+
}).catch((r) => {
|
|
7456
|
+
throw this.dispatch(na(i.uuid)), r;
|
|
7457
|
+
}), [i, a];
|
|
7454
7458
|
}
|
|
7455
7459
|
update(e) {
|
|
7456
7460
|
const { store: s } = this.client, i = ra(e.uuid)(s.getState()), a = {
|
|
@@ -7723,21 +7727,25 @@ class B_ extends w {
|
|
|
7723
7727
|
}
|
|
7724
7728
|
class L_ extends w {
|
|
7725
7729
|
add(e) {
|
|
7726
|
-
|
|
7727
|
-
this.
|
|
7728
|
-
|
|
7730
|
+
var n;
|
|
7731
|
+
const { store: s } = this.client, i = T({
|
|
7732
|
+
...e,
|
|
7733
|
+
created_by: (n = s.getState().userReducer.currentUser) == null ? void 0 : n.id
|
|
7734
|
+
});
|
|
7735
|
+
this.dispatch(gm(i));
|
|
7736
|
+
const a = this.enqueueRequest({
|
|
7729
7737
|
description: "Create team membership",
|
|
7730
7738
|
method: u.POST,
|
|
7731
7739
|
url: "/team-memberships/",
|
|
7732
|
-
payload: k(
|
|
7740
|
+
payload: k(i),
|
|
7733
7741
|
blockers: [e.team],
|
|
7734
|
-
blocks: [
|
|
7742
|
+
blocks: [i.uuid]
|
|
7735
7743
|
});
|
|
7736
|
-
return
|
|
7737
|
-
this.dispatch(pa(
|
|
7744
|
+
return a.then((r) => {
|
|
7745
|
+
this.dispatch(pa(r));
|
|
7738
7746
|
}).catch(() => {
|
|
7739
|
-
this.dispatch(fa(
|
|
7740
|
-
}), [
|
|
7747
|
+
this.dispatch(fa(i.uuid));
|
|
7748
|
+
}), [i, a];
|
|
7741
7749
|
}
|
|
7742
7750
|
async delete(e) {
|
|
7743
7751
|
const { store: s } = this.client, i = s.getState(), a = Pm(e)(i);
|
|
@@ -7776,26 +7784,26 @@ class L_ extends w {
|
|
|
7776
7784
|
}
|
|
7777
7785
|
class N_ extends w {
|
|
7778
7786
|
add(e) {
|
|
7779
|
-
|
|
7787
|
+
var n;
|
|
7788
|
+
const { store: s } = this.client, i = T({
|
|
7780
7789
|
...e,
|
|
7781
|
-
submitted_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
7782
|
-
|
|
7783
|
-
// created_by: state.userReducer.currentUser.uuid,
|
|
7790
|
+
submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7791
|
+
created_by: (n = s.getState().userReducer.currentUser) == null ? void 0 : n.id
|
|
7784
7792
|
});
|
|
7785
|
-
this.dispatch(Fm(
|
|
7786
|
-
const
|
|
7793
|
+
this.dispatch(Fm(i));
|
|
7794
|
+
const a = this.enqueueRequest({
|
|
7787
7795
|
description: "Create team",
|
|
7788
7796
|
method: u.POST,
|
|
7789
7797
|
url: "/teams/",
|
|
7790
|
-
payload: k(
|
|
7798
|
+
payload: k(i),
|
|
7791
7799
|
blockers: [],
|
|
7792
|
-
blocks: [
|
|
7800
|
+
blocks: [i.uuid]
|
|
7793
7801
|
});
|
|
7794
|
-
return
|
|
7795
|
-
this.dispatch(dt(
|
|
7802
|
+
return a.then((r) => {
|
|
7803
|
+
this.dispatch(dt(r));
|
|
7796
7804
|
}).catch(() => {
|
|
7797
|
-
this.dispatch(ya(
|
|
7798
|
-
}), [
|
|
7805
|
+
this.dispatch(ya(i.uuid));
|
|
7806
|
+
}), [i, a];
|
|
7799
7807
|
}
|
|
7800
7808
|
update(e) {
|
|
7801
7809
|
const { store: s } = this.client, i = ba(e.uuid)(s.getState());
|
|
@@ -11,5 +11,5 @@ Action:`,e);const p=Ge();if(!p)throw new Error("Outbox coordinator not set");p.r
|
|
|
11
11
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
12
12
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
13
13
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
14
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=u.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=c??o+"."+p;if(u=Fc(u,A),!u.name)throw new Error("Failed to set file's name");await this.addCache(u,o),Bt[n]=new Promise(f=>{f(u)})}return u}}class Wb extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{revisionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:o};r.push(P)}this.dispatch(ru(n));const l=this.enqueueRequest({description:"Attach files to form revision",method:h.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.form_revision),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(du(u.attachments))}).catch(()=>{this.dispatch(uu(n.map(u=>u.uuid)))}),[n,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:h.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(nu(a)),a}}class Yb extends q{add(e){var l;const{store:i}=this.client,c=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=T({...e,created_by:c,submitted_at:new Date().toISOString()});this.dispatch(Mi(n));const r=this.enqueueRequest({description:"Create form revision",method:h.POST,url:"/form-revisions/",payload:w(n),blockers:[e.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Au(m))}).catch(()=>{this.dispatch(Ei(n.uuid))}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:h.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(mu(a)),a}}class Kb extends q{add(e,i){var u;const{store:a}=this.client,c=new Date().toISOString(),n=(u=a.getState().userReducer.currentUser)==null?void 0:u.id,r=T({...e,submitted_at:c,created_by:n}),l=T({...i,form:r.uuid,submitted_at:c,created_by:n});this.dispatch(zi(r)),this.dispatch(Mi(l));const m=this.enqueueRequest({description:"Create form",method:h.POST,url:"/forms/",payload:{...w(r),initial_revision:{uuid:l.uuid,submitted_at:l.submitted_at,title:l.title,description:l.description,fields:l.fields}},blockers:[],blocks:[r.uuid,l.uuid]});return m.catch(o=>{throw this.dispatch(Ui(r.uuid)),this.dispatch(Ei(l.uuid)),o}),[r,l,m]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Iu(e)(a);if(!c)throw new Error("Expected form to exist");const n=zu(e)(a);n.length>0&&this.dispatch(jt(n.map(({uuid:l})=>l)));const r=yu(e)(a);r.length>0&&this.dispatch(fu(r.map(({uuid:l})=>l))),this.dispatch(Ui(e));try{return await this.enqueueRequest({description:"Delete form",method:h.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(zi(c)),r.length>0&&this.dispatch(pu(r)),n.length>0&&this.dispatch(Et(n)),l}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:h.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(bu(a)),a}}class Zb extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{submissionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:o};r.push(P)}this.dispatch(vt(n));const l=this.enqueueRequest({description:"Attach files to form submission",method:h.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.form_submission),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Ru(u.attachments))}).catch(u=>{throw this.dispatch(wt(n.map(o=>o.uuid))),u}),[n,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=wu(e)(a);this.dispatch(wt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:h.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(vt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:h.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form submission attachments",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(_u(c)),c}}class Jb extends q{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add form submission",method:h.POST,url:"/form-submissions/",payload:w(c),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return this.dispatch(Bi(c)),n.then(l=>(this.dispatch(Mt(l)),l)).catch(()=>{this.dispatch(Gi(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ni(e.uuid)(a);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Vu(n));const r=this.enqueueRequest({description:"Delete user form submissions",method:h.PATCH,url:`/form-submissions/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return r.then(l=>{this.dispatch(Mt(l))}).catch(()=>{this.dispatch(Mt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ni(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Mu(e)(a);this.dispatch(Gi(e)),this.dispatch(wt(n.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:h.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Bi(c)),this.dispatch(vt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:h.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch form submissions",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qu(c)),c}}class Xb extends q{async add(e){var p;const{store:i}=this.client,{file:a,...c}=e,n=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,l=c.project,m=await this.getFilePayload(a),u=T({...c,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:n,created_by:r});this.dispatch($u(u));const o=this.enqueueRequest({description:"Add geo image",method:h.POST,url:"/geo-images/",payload:{uuid:u.uuid,submitted_at:n,title:u.title,description:u.description,geo_marker:u.geo_marker,canvas_marker:u.canvas_marker,sha1:u.file_sha1,project:u.project,file_name:u.file_name,direction:u.direction,original_date:u.original_date,file:m},blocks:[l],blockers:[l]});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(at(A.geo_image))}).catch(()=>{this.dispatch(Wi(u.uuid))}),[u,o.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,c=new Date().toISOString(),n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],l=[],m=[],u={};for(const A of e){const{file:f,...b}=A,P=await this.getFilePayload(f);P.sha1 in u||(u[P.sha1]=P);const _=T({...b,file_name:f.name,file_sha1:P.sha1,file:URL.createObjectURL(f),submitted_at:c,created_by:n,project:i});r.push(_),l.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Lu(r));const o=this.enqueueRequest({description:"Bulk add geo images",method:h.POST,url:"/geo-images/bulk/",payload:{submitted_at:c,project:i,geo_images:m,files:Object.values(u)},blocks:[i],blockers:l});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Gu(A.geo_images))}).catch(()=>{this.dispatch(Hu(l))}),[r,o.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),c=Yi(e.uuid)(a);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const n={...c,...e};this.dispatch(Nu(n));const r=this.enqueueRequest({description:"Update geo image",method:h.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(l=>{this.dispatch(at(l))}).catch(()=>{this.dispatch(at(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Yi(e)(a);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Wi(e));const n=this.enqueueRequest({description:"Delete geo image",method:h.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return n.catch(()=>{this.dispatch(at(c))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:h.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Bu(a)),a}}class Qb extends v{add(e){var l;const{store:i}=this.client,a=new Date().toISOString(),c=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=T({...e,submitted_at:a,created_by:c});this.dispatch(Zi(n));const r=this.enqueueRequest({description:"Add issue association",method:h.POST,url:"/issue-associations/",payload:w(n),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Xu(m))}).catch(()=>{this.dispatch(Xi(n.uuid))}),[n,r]}async delete(e){const{store:i}=this.client,a=Qu(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Xi(e));const c=this.enqueueRequest({description:"Delete issue association",method:h.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Zi(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:h.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch issue associations",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ju(c)),c}}class xb extends ke{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",ea);S(this,"addAttachments",ta);S(this,"updateAttachments",co);S(this,"removeAttachments",sa);S(this,"removeAttachment",no);S(this,"setAttachment",ao);S(this,"selectAttachment",lo)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:h.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:h.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(ea(n)),n}}class eP extends ke{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",aa);S(this,"addAttachments",po);S(this,"updateAttachments",fo);S(this,"removeAttachments",So);S(this,"removeAttachment",yo);S(this,"setAttachment",Ao);S(this,"selectAttachment",Po)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:h.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:h.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(aa(n)),n}}class tP extends v{add(e){var n;const{store:i}=this.client,a=T({...e,author:(n=i.getState().userReducer.currentUser)==null?void 0:n.id,submitted_at:new Date().toISOString()});this.dispatch(na(a));const c=this.enqueueRequest({description:"Add issue comment",method:h.POST,url:"/issue-comments/",payload:w(a),blockers:[e.issue],blocks:[a.uuid]});return c.catch(()=>{this.dispatch(da(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=ua(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...a,...e};this.dispatch(ra(c));const n=this.enqueueRequest({description:"Edit issue comment",method:h.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{this.dispatch(ra(a))}),[c,n]}remove(e){const{store:i}=this.client,a=ua(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(da(e));const c=this.enqueueRequest({description:"Delete comment",method:h.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(na(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:h.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(Io(a)),a}}class sP extends v{add(e){var m;const{store:i}=this.client,a=i.getState(),c=new Date().toISOString(),n=(m=a.userReducer.currentUser)==null?void 0:m.id,r=T({...e,submitted_at:c,created_by:n});this.dispatch(la(r));const l=this.enqueueRequest({description:"Create issue",method:h.POST,url:"/issues/",payload:w(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return l.then(u=>{this.dispatch(qt(u))}).catch(u=>{throw this.dispatch(ha(r.uuid)),u}),[r,l]}update(e){var m;const i=this.client.store.getState(),a=Aa(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...a,...e};this.dispatch(qt(c));const n={};for(const u of[j.TITLE,j.DESCRIPTION,j.STATUS,j.CATEGORY,j.PRIORITY,j.ASSIGNED_TO,j.DUE_DATE])if(u in e&&e[u]!==a[u])switch(u){case j.PRIORITY:case j.STATUS:{const o=e[u];n[u]=o!==void 0?Number(o):null;break}case j.DUE_DATE:case j.DESCRIPTION:case j.TITLE:n[u]=e[u]??null;break;case j.CATEGORY:{let o=null;const p=e[u];if(p&&(o=i.categoryReducer.instances[p]??null,!o))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);n[u]=o?{name:o.name,color:o.color,uuid:o.uuid}:null;break}case j.ASSIGNED_TO:{let o=null;const p=e[u];if(p&&(o=i.userReducer.instances[p]??null,!o))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);n[u]=o?{full_name:o.username,id:o.id}:null;break}}const r=T({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:n});this.dispatch(Tl(r));const l=this.enqueueRequest({description:"Edit issue",method:h.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.catch(()=>{this.dispatch(qt(a)),this.dispatch(Ol(r.uuid))}),[c,l]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Aa(e)(a);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const n=oo(e)(a),r=wl(e)(a),l=Uu(e)(a),m={};for(const o of xu(e)(a))m[o.uuid]=o;for(const o of eo(e)(a))m[o.uuid]=o;const u=Object.values(m);this.dispatch(ha(e)),n.length>0&&this.dispatch(sa(n.map(({uuid:o})=>o))),r.length>0&&this.dispatch(_l(r.map(({uuid:o})=>o))),l.length>0&&this.dispatch(jt(l.map(({uuid:o})=>o))),u.length>0&&this.dispatch(Qi(u.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:h.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(la(c)),this.dispatch(ta(n)),this.dispatch(Il(r)),this.dispatch(Et(l)),this.dispatch(Ji(u)),o}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issues",method:h.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issues",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(vo(c)),c}}class iP extends ke{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",ya);S(this,"addAttachments",Vo);S(this,"updateAttachments",Uo);S(this,"removeAttachments",Co);S(this,"removeAttachment",Do);S(this,"setAttachment",zo);S(this,"selectAttachment",Go)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:h.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(ya(c)),c}}class aP extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:o};r.push(P)}this.dispatch(Ho(n));const l=this.enqueueRequest({description:"Add issue type fields attachments",method:h.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.fields_revision),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Wo(u.attachments))}).catch(()=>{this.dispatch(Yo(n.map(u=>u.uuid)))}),[n,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:h.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(No(a)),a}}class cP extends v{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=new Date().toISOString(),n=T({...e,created_by:a,submitted_at:c});this.dispatch(il(n));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:h.POST,url:"/issue-type-fields/",payload:w(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(al(m))}).catch(m=>{throw this.dispatch(cl(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:h.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(sl(a)),a}}class nP extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{fieldValuesUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:o};r.push(P)}this.dispatch(zt(n));const l=this.enqueueRequest({description:"Add issue type field values attachments",method:h.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.field_values),blocks:n.map(u=>u.uuid)});return l.then(({presigned_urls:u,attachments:o})=>{this.processPresignedUrls(u),this.dispatch(ol(o))}).catch(u=>{throw this.dispatch(Ut(n.map(o=>o.uuid))),u}),[n,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=hl(e)(a);this.dispatch(Ut(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:h.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(zt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:h.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values attachments",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ul(c)),c}}class rP extends v{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add issue type field values",method:h.POST,url:"/issue-type-field-values/",payload:w(c),blockers:[e.issue,e.fields_revision],blocks:[c.uuid]});return this.dispatch(ba(c)),n.then(l=>(this.dispatch(nt(l)),l)).catch(()=>{this.dispatch(Pa(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ta(e.uuid)(a);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(nt(n));const r=this.enqueueRequest({description:"Update issue type field values",method:h.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.issue],blocks:[n.uuid]});return r.then(l=>{this.dispatch(nt(l))}).catch(()=>{this.dispatch(nt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ta(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=ml(e)(a);this.dispatch(Pa(e)),this.dispatch(Ut(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:h.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ba(c)),this.dispatch(zt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:h.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Qo(c)),c}}class dP extends v{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(yl(c));const n=this.enqueueRequest({method:h.POST,url:"/issue-types/",payload:w(c),blockers:[],blocks:[c.uuid]});return n.then(l=>{this.dispatch(rt(l))}).catch(()=>{this.dispatch(va(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ma(e.uuid)(a);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const n={...c,...e};this.dispatch(Sl(n));const r=this.enqueueRequest({method:h.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(l=>{this.dispatch(rt(l))}).catch(()=>{this.dispatch(rt(c))}),[n,r]}delete(e){const{store:i}=this.client,a=i.getState(),c=Ma(e)(a);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const n=Eo(e)(a);this.dispatch(va(e)),this.dispatch(Mo(n.map(l=>l.uuid)));const r=this.enqueueRequest({method:h.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(rt(c)),this.dispatch(wo(n))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:h.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(fl(a)),a}}class uP extends v{async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue updates",method:h.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue updates",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Fl(c)),c}}const oP=1800;function lP(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class hP extends mb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:h.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let c;try{c=await a}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Td(!1)),this.clearTokens(),this.dispatch(F()),this.dispatch(F())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let c;try{c=bm(i).exp??a}catch{c=a}return c-a<oP}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??Ye).toString()))}}}async handleUnauthorized(i,a){const c=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw c.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(c.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Ne.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:h.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(c=>{this.setTokens(lP(c))})}}class mP extends v{update(e){const{store:i}=this.client,a=Ua(e.uuid)(i.getState()),c={...a,...e};this.dispatch(Ct(c));const n=this.enqueueRequest({description:"Edit organization access",method:h.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Ct(r))}).catch(r=>{throw this.dispatch(Ct(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Ua(e)(a),n=Dl(c.user)(a);this.dispatch(Gl(c.uuid)),this.dispatch(Vl(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:h.DELETE,url:`/organization-accesses/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(Bl(c)),this.dispatch(ql(n)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:h.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(kl(a)),a}}class pP extends v{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:h.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(Wl(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:h.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(Yl(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:h.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:h.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(Hl(i)),i}}class AP extends v{add(e){const i=T(e);this.dispatch(Ba(i));const a=this.enqueueRequest({description:"Add project access",method:h.POST,url:"/project-accesses/",payload:w(i),blockers:[i.organization_access,i.project],blocks:[i.uuid]});return a.then(c=>{this.dispatch(dt(c))}).catch(c=>{throw this.dispatch(Ga(i.uuid)),c}),[i,a]}update(e){const{store:i}=this.client,a=La(e.uuid)(i.getState()),c={...a,...e};this.dispatch(dt(c));const n=this.enqueueRequest({description:"Edit project access",method:h.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return n.then(r=>{this.dispatch(dt(r))}).catch(r=>{throw this.dispatch(dt(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=La(e)(i.getState());this.dispatch(Ga(e));try{await this.enqueueRequest({description:"Delete project access",method:h.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ba(a)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:h.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ih(a)),a}}class fP extends ke{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",oh);S(this,"updateAttachments",mh);S(this,"removeAttachments",Ha);S(this,"removeAttachment",ph);S(this,"setAttachment",lh);S(this,"selectAttachment",yh)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:h.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(uh(c)),c}}class yP extends v{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:h.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(c=>{this.dispatch(Ya(c))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const c=i.projectFileReducer.instances[a];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let n;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,n={method:h.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else n=new Promise((m,u)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([o])=>{m({method:h.POST,url:`/project-files${c.project}/`,payload:{...c,...o},blockers:[a],blocks:[a]})}).catch(u)});const l=Promise.resolve(n).then(m=>this.enqueueRequest(m));return l.then(m=>{this.dispatch(Ya(m))}),this.dispatch(Rh),this.dispatch(_h(null)),this.dispatch(Oh(!1)),[c,l]}delete(e){return this.dispatch(Th(e)),this.enqueueRequest({method:h.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get project files",method:h.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get project files",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ph(c)),c}}class SP extends v{async add(e){const i=await this.enqueueRequest({description:"Create project",method:h.POST,url:"/projects/",payload:w(e),blockers:[],blocks:[]});return this.dispatch(Za(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(qh(e)),await this.enqueueRequest({description:"Update project",method:h.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),c=Uh(e)(a);if(!c)throw new Error("Expected project to exist");const n=wh(a).filter(m=>m.project===e);this.dispatch(Ih(n.map(({uuid:m})=>m)));const r=Sh(c.uuid)(a);this.dispatch(Ha(r.map(({uuid:m})=>m)));const l=rh(e)(a);this.dispatch(ch(l.map(({uuid:m})=>m))),this.dispatch(Ja(c.uuid));try{await this.enqueueRequest({description:"Delete project",method:h.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Ja(c.uuid))}catch(m){throw this.dispatch(Za(c)),this.dispatch(ah(Object.values(l))),this.dispatch(Fh(n)),this.dispatch(hh(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:h.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(jh(a)),a}}class gP extends v{add(e){const i=T(e);this.dispatch(Bh(i));const a=this.enqueueRequest({description:"Create team membership",method:h.POST,url:"/team-memberships/",payload:w(i),blockers:[e.team],blocks:[i.uuid]});return a.then(c=>{this.dispatch(ec(c))}).catch(()=>{this.dispatch(tc(i.uuid))}),[i,a]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Lh(e)(a);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(tc(e));try{return await this.enqueueRequest({description:"Delete team membership",method:h.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(ec(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:h.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(kh(a)),a}}class bP extends v{add(e){const i=T({...e,submitted_at:new Date().toISOString()});this.dispatch(Wh(i));const a=this.enqueueRequest({description:"Create team",method:h.POST,url:"/teams/",payload:w(i),blockers:[],blocks:[i.uuid]});return a.then(c=>{this.dispatch(ut(c))}).catch(()=>{this.dispatch(ac(i.uuid))}),[i,a]}update(e){const{store:i}=this.client,a=nc(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Yh(c));const n=this.enqueueRequest({description:"Update team",method:h.PATCH,url:`/teams/${e.uuid}/`,payload:w(e),blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=nc(e)(a);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(ac(e));try{return await this.enqueueRequest({description:"Delete team",method:h.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(ut(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:h.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hh(a)),a}}class PP extends v{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:h.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(jl(a)),a}}class FP{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,c){return this._enqueueRequest(e,i,a,c).then(n=>{if(n instanceof D)throw n;return n})}_enqueueRequest(e,i,a,c){const n=new bc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const l={...r,uuid:e.uuid??Ne.v4()},m={payload:l,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:l,BASE_URL:i,serviceName:a}}}};uc(m,this,c).then(u=>{n.resolve(u.body)}).catch(u=>{oc(u,m),u instanceof Error?n.reject(u):n.reject(new Error((u??Ye).toString()))})}else{const l=this.store.dispatch(Ql(r)),m=o=>{if(o)n.resolve(o.body);else{const p=new D({message:"Could not get a response from the server.",response:o,discard:!0});n.reject(p)}},u=o=>{o instanceof D?o.options.discard=!0:(console.error("Received an unexpected error while processing a request:",o,`
|
|
14
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=u.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=c??o+"."+p;if(u=Fc(u,A),!u.name)throw new Error("Failed to set file's name");await this.addCache(u,o),Bt[n]=new Promise(f=>{f(u)})}return u}}class Wb extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{revisionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:o};r.push(P)}this.dispatch(ru(n));const l=this.enqueueRequest({description:"Attach files to form revision",method:h.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.form_revision),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(du(u.attachments))}).catch(()=>{this.dispatch(uu(n.map(u=>u.uuid)))}),[n,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:h.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(nu(a)),a}}class Yb extends q{add(e){var l;const{store:i}=this.client,c=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=T({...e,created_by:c,submitted_at:new Date().toISOString()});this.dispatch(Mi(n));const r=this.enqueueRequest({description:"Create form revision",method:h.POST,url:"/form-revisions/",payload:w(n),blockers:[e.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Au(m))}).catch(()=>{this.dispatch(Ei(n.uuid))}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:h.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(mu(a)),a}}class Kb extends q{add(e,i){var u;const{store:a}=this.client,c=new Date().toISOString(),n=(u=a.getState().userReducer.currentUser)==null?void 0:u.id,r=T({...e,submitted_at:c,created_by:n}),l=T({...i,form:r.uuid,submitted_at:c,created_by:n});this.dispatch(zi(r)),this.dispatch(Mi(l));const m=this.enqueueRequest({description:"Create form",method:h.POST,url:"/forms/",payload:{...w(r),initial_revision:{uuid:l.uuid,submitted_at:l.submitted_at,title:l.title,description:l.description,fields:l.fields}},blockers:[],blocks:[r.uuid,l.uuid]});return m.catch(o=>{throw this.dispatch(Ui(r.uuid)),this.dispatch(Ei(l.uuid)),o}),[r,l,m]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Iu(e)(a);if(!c)throw new Error("Expected form to exist");const n=zu(e)(a);n.length>0&&this.dispatch(jt(n.map(({uuid:l})=>l)));const r=yu(e)(a);r.length>0&&this.dispatch(fu(r.map(({uuid:l})=>l))),this.dispatch(Ui(e));try{return await this.enqueueRequest({description:"Delete form",method:h.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(zi(c)),r.length>0&&this.dispatch(pu(r)),n.length>0&&this.dispatch(Et(n)),l}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:h.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(bu(a)),a}}class Zb extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{submissionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:o};r.push(P)}this.dispatch(vt(n));const l=this.enqueueRequest({description:"Attach files to form submission",method:h.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.form_submission),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Ru(u.attachments))}).catch(u=>{throw this.dispatch(wt(n.map(o=>o.uuid))),u}),[n,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=wu(e)(a);this.dispatch(wt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:h.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(vt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:h.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form submission attachments",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(_u(c)),c}}class Jb extends q{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add form submission",method:h.POST,url:"/form-submissions/",payload:w(c),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return this.dispatch(Bi(c)),n.then(l=>(this.dispatch(Mt(l)),l)).catch(()=>{this.dispatch(Gi(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ni(e.uuid)(a);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(Vu(n));const r=this.enqueueRequest({description:"Delete user form submissions",method:h.PATCH,url:`/form-submissions/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return r.then(l=>{this.dispatch(Mt(l))}).catch(()=>{this.dispatch(Mt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ni(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Mu(e)(a);this.dispatch(Gi(e)),this.dispatch(wt(n.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:h.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Bi(c)),this.dispatch(vt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:h.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch form submissions",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qu(c)),c}}class Xb extends q{async add(e){var p;const{store:i}=this.client,{file:a,...c}=e,n=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,l=c.project,m=await this.getFilePayload(a),u=T({...c,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:n,created_by:r});this.dispatch($u(u));const o=this.enqueueRequest({description:"Add geo image",method:h.POST,url:"/geo-images/",payload:{uuid:u.uuid,submitted_at:n,title:u.title,description:u.description,geo_marker:u.geo_marker,canvas_marker:u.canvas_marker,sha1:u.file_sha1,project:u.project,file_name:u.file_name,direction:u.direction,original_date:u.original_date,file:m},blocks:[l],blockers:[l]});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(at(A.geo_image))}).catch(()=>{this.dispatch(Wi(u.uuid))}),[u,o.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,c=new Date().toISOString(),n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],l=[],m=[],u={};for(const A of e){const{file:f,...b}=A,P=await this.getFilePayload(f);P.sha1 in u||(u[P.sha1]=P);const _=T({...b,file_name:f.name,file_sha1:P.sha1,file:URL.createObjectURL(f),submitted_at:c,created_by:n,project:i});r.push(_),l.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Lu(r));const o=this.enqueueRequest({description:"Bulk add geo images",method:h.POST,url:"/geo-images/bulk/",payload:{submitted_at:c,project:i,geo_images:m,files:Object.values(u)},blocks:[i],blockers:l});return o.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Gu(A.geo_images))}).catch(()=>{this.dispatch(Hu(l))}),[r,o.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),c=Yi(e.uuid)(a);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const n={...c,...e};this.dispatch(Nu(n));const r=this.enqueueRequest({description:"Update geo image",method:h.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(l=>{this.dispatch(at(l))}).catch(()=>{this.dispatch(at(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Yi(e)(a);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Wi(e));const n=this.enqueueRequest({description:"Delete geo image",method:h.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return n.catch(()=>{this.dispatch(at(c))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:h.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Bu(a)),a}}class Qb extends v{add(e){var l;const{store:i}=this.client,a=new Date().toISOString(),c=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,n=T({...e,submitted_at:a,created_by:c});this.dispatch(Zi(n));const r=this.enqueueRequest({description:"Add issue association",method:h.POST,url:"/issue-associations/",payload:w(n),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Xu(m))}).catch(()=>{this.dispatch(Xi(n.uuid))}),[n,r]}async delete(e){const{store:i}=this.client,a=Qu(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Xi(e));const c=this.enqueueRequest({description:"Delete issue association",method:h.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Zi(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:h.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch issue associations",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ju(c)),c}}class xb extends ke{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",ea);S(this,"addAttachments",ta);S(this,"updateAttachments",co);S(this,"removeAttachments",sa);S(this,"removeAttachment",no);S(this,"setAttachment",ao);S(this,"selectAttachment",lo)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:h.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:h.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(ea(n)),n}}class eP extends ke{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",aa);S(this,"addAttachments",po);S(this,"updateAttachments",fo);S(this,"removeAttachments",So);S(this,"removeAttachment",yo);S(this,"setAttachment",Ao);S(this,"selectAttachment",Po)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:h.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:h.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(aa(n)),n}}class tP extends v{add(e){var n;const{store:i}=this.client,a=T({...e,author:(n=i.getState().userReducer.currentUser)==null?void 0:n.id,submitted_at:new Date().toISOString()});this.dispatch(na(a));const c=this.enqueueRequest({description:"Add issue comment",method:h.POST,url:"/issue-comments/",payload:w(a),blockers:[e.issue],blocks:[a.uuid]});return c.catch(()=>{this.dispatch(da(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=ua(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...a,...e};this.dispatch(ra(c));const n=this.enqueueRequest({description:"Edit issue comment",method:h.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{this.dispatch(ra(a))}),[c,n]}remove(e){const{store:i}=this.client,a=ua(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(da(e));const c=this.enqueueRequest({description:"Delete comment",method:h.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(na(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:h.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(Io(a)),a}}class sP extends v{add(e){var m;const{store:i}=this.client,a=i.getState(),c=new Date().toISOString(),n=(m=a.userReducer.currentUser)==null?void 0:m.id,r=T({...e,submitted_at:c,created_by:n});this.dispatch(la(r));const l=this.enqueueRequest({description:"Create issue",method:h.POST,url:"/issues/",payload:w(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return l.then(u=>{this.dispatch(qt(u))}).catch(u=>{throw this.dispatch(ha(r.uuid)),u}),[r,l]}update(e){var m;const i=this.client.store.getState(),a=Aa(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...a,...e};this.dispatch(qt(c));const n={};for(const u of[j.TITLE,j.DESCRIPTION,j.STATUS,j.CATEGORY,j.PRIORITY,j.ASSIGNED_TO,j.DUE_DATE])if(u in e&&e[u]!==a[u])switch(u){case j.PRIORITY:case j.STATUS:{const o=e[u];n[u]=o!==void 0?Number(o):null;break}case j.DUE_DATE:case j.DESCRIPTION:case j.TITLE:n[u]=e[u]??null;break;case j.CATEGORY:{let o=null;const p=e[u];if(p&&(o=i.categoryReducer.instances[p]??null,!o))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);n[u]=o?{name:o.name,color:o.color,uuid:o.uuid}:null;break}case j.ASSIGNED_TO:{let o=null;const p=e[u];if(p&&(o=i.userReducer.instances[p]??null,!o))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);n[u]=o?{full_name:o.username,id:o.id}:null;break}}const r=T({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:n});this.dispatch(Tl(r));const l=this.enqueueRequest({description:"Edit issue",method:h.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return l.catch(()=>{this.dispatch(qt(a)),this.dispatch(Ol(r.uuid))}),[c,l]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Aa(e)(a);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const n=oo(e)(a),r=wl(e)(a),l=Uu(e)(a),m={};for(const o of xu(e)(a))m[o.uuid]=o;for(const o of eo(e)(a))m[o.uuid]=o;const u=Object.values(m);this.dispatch(ha(e)),n.length>0&&this.dispatch(sa(n.map(({uuid:o})=>o))),r.length>0&&this.dispatch(_l(r.map(({uuid:o})=>o))),l.length>0&&this.dispatch(jt(l.map(({uuid:o})=>o))),u.length>0&&this.dispatch(Qi(u.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:h.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(la(c)),this.dispatch(ta(n)),this.dispatch(Il(r)),this.dispatch(Et(l)),this.dispatch(Ji(u)),o}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issues",method:h.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issues",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(vo(c)),c}}class iP extends ke{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",ya);S(this,"addAttachments",Vo);S(this,"updateAttachments",Uo);S(this,"removeAttachments",Co);S(this,"removeAttachment",Do);S(this,"setAttachment",zo);S(this,"selectAttachment",Go)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:h.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(ya(c)),c}}class aP extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{fieldsRevisionUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:o};r.push(P)}this.dispatch(Ho(n));const l=this.enqueueRequest({description:"Add issue type fields attachments",method:h.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.fields_revision),blocks:n.map(u=>u.uuid)});return l.then(u=>{this.processPresignedUrls(u.presigned_urls),this.dispatch(Wo(u.attachments))}).catch(()=>{this.dispatch(Yo(n.map(u=>u.uuid)))}),[n,l.then(({attachments:u})=>u)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:h.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(No(a)),a}}class cP extends v{add(e){var l;const{store:i}=this.client,a=(l=i.getState().userReducer.currentUser)==null?void 0:l.id,c=new Date().toISOString(),n=T({...e,created_by:a,submitted_at:c});this.dispatch(il(n));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:h.POST,url:"/issue-type-fields/",payload:w(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(al(m))}).catch(m=>{throw this.dispatch(cl(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:h.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(sl(a)),a}}class nP extends q{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const u of e){const{fieldValuesUuid:o,fieldIdentifier:p,file:A}=u,f=await this.getFilePayload(A);f.sha1 in c||(c[f.sha1]=f);const b=T({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:o,submitted_at:i,field_identifier:p});n.push(b);const P={uuid:b.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:o};r.push(P)}this.dispatch(zt(n));const l=this.enqueueRequest({description:"Add issue type field values attachments",method:h.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(u=>u.field_values),blocks:n.map(u=>u.uuid)});return l.then(({presigned_urls:u,attachments:o})=>{this.processPresignedUrls(u),this.dispatch(ol(o))}).catch(u=>{throw this.dispatch(Ut(n.map(o=>o.uuid))),u}),[n,l.then(({attachments:u})=>u)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=hl(e)(a);this.dispatch(Ut(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:h.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(zt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:h.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values attachments",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ul(c)),c}}class rP extends v{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add issue type field values",method:h.POST,url:"/issue-type-field-values/",payload:w(c),blockers:[e.issue,e.fields_revision],blocks:[c.uuid]});return this.dispatch(ba(c)),n.then(l=>(this.dispatch(nt(l)),l)).catch(()=>{this.dispatch(Pa(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ta(e.uuid)(a);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(nt(n));const r=this.enqueueRequest({description:"Update issue type field values",method:h.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.issue],blocks:[n.uuid]});return r.then(l=>{this.dispatch(nt(l))}).catch(()=>{this.dispatch(nt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ta(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=ml(e)(a);this.dispatch(Pa(e)),this.dispatch(Ut(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:h.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ba(c)),this.dispatch(zt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:h.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Qo(c)),c}}class dP extends v{add(e){var r;const{store:i}=this.client,a=i.getState(),c=T({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(yl(c));const n=this.enqueueRequest({method:h.POST,url:"/issue-types/",payload:w(c),blockers:[],blocks:[c.uuid]});return n.then(l=>{this.dispatch(rt(l))}).catch(()=>{this.dispatch(va(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ma(e.uuid)(a);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const n={...c,...e};this.dispatch(Sl(n));const r=this.enqueueRequest({method:h.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(l=>{this.dispatch(rt(l))}).catch(()=>{this.dispatch(rt(c))}),[n,r]}delete(e){const{store:i}=this.client,a=i.getState(),c=Ma(e)(a);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const n=Eo(e)(a);this.dispatch(va(e)),this.dispatch(Mo(n.map(l=>l.uuid)));const r=this.enqueueRequest({method:h.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(rt(c)),this.dispatch(wo(n))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:h.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(fl(a)),a}}class uP extends v{async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue updates",method:h.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue updates",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Fl(c)),c}}const oP=1800;function lP(t){if(!t.access)throw new Error("Missing access token");if(!t.refresh)throw new Error("Missing refresh token");return{accessToken:t.access,refreshToken:t.refresh}}class hP extends mb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:h.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let c;try{c=await a}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Td(!1)),this.clearTokens(),this.dispatch(F()),this.dispatch(F())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let c;try{c=bm(i).exp??a}catch{c=a}return c-a<oP}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??Ye).toString()))}}}async handleUnauthorized(i,a){const c=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw c.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(c.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Ne.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:h.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(c=>{this.setTokens(lP(c))})}}class mP extends v{update(e){const{store:i}=this.client,a=Ua(e.uuid)(i.getState()),c={...a,...e};this.dispatch(Ct(c));const n=this.enqueueRequest({description:"Edit organization access",method:h.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Ct(r))}).catch(r=>{throw this.dispatch(Ct(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Ua(e)(a),n=Dl(c.user)(a);this.dispatch(Gl(c.uuid)),this.dispatch(Vl(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:h.DELETE,url:`/organization-accesses/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(Bl(c)),this.dispatch(ql(n)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:h.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(kl(a)),a}}class pP extends v{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:h.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(Wl(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:h.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(Yl(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:h.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:h.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(Hl(i)),i}}class AP extends v{add(e){var n;const{store:i}=this.client,a=T({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(Ba(a));const c=this.enqueueRequest({description:"Add project access",method:h.POST,url:"/project-accesses/",payload:w(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return c.then(r=>{this.dispatch(dt(r))}).catch(r=>{throw this.dispatch(Ga(a.uuid)),r}),[a,c]}update(e){const{store:i}=this.client,a=La(e.uuid)(i.getState()),c={...a,...e};this.dispatch(dt(c));const n=this.enqueueRequest({description:"Edit project access",method:h.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return n.then(r=>{this.dispatch(dt(r))}).catch(r=>{throw this.dispatch(dt(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=La(e)(i.getState());this.dispatch(Ga(e));try{await this.enqueueRequest({description:"Delete project access",method:h.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ba(a)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:h.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ih(a)),a}}class fP extends ke{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",oh);S(this,"updateAttachments",mh);S(this,"removeAttachments",Ha);S(this,"removeAttachment",ph);S(this,"setAttachment",lh);S(this,"selectAttachment",yh)}buildOfflineAttachment(i){return T({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:h.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(uh(c)),c}}class yP extends v{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:h.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(c=>{this.dispatch(Ya(c))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const c=i.projectFileReducer.instances[a];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let n;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,n={method:h.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else n=new Promise((m,u)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([o])=>{m({method:h.POST,url:`/project-files${c.project}/`,payload:{...c,...o},blockers:[a],blocks:[a]})}).catch(u)});const l=Promise.resolve(n).then(m=>this.enqueueRequest(m));return l.then(m=>{this.dispatch(Ya(m))}),this.dispatch(Rh),this.dispatch(_h(null)),this.dispatch(Oh(!1)),[c,l]}delete(e){return this.dispatch(Th(e)),this.enqueueRequest({method:h.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get project files",method:h.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get project files",method:h.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ph(c)),c}}class SP extends v{async add(e){const i=await this.enqueueRequest({description:"Create project",method:h.POST,url:"/projects/",payload:w(e),blockers:[],blocks:[]});return this.dispatch(Za(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(qh(e)),await this.enqueueRequest({description:"Update project",method:h.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),c=Uh(e)(a);if(!c)throw new Error("Expected project to exist");const n=wh(a).filter(m=>m.project===e);this.dispatch(Ih(n.map(({uuid:m})=>m)));const r=Sh(c.uuid)(a);this.dispatch(Ha(r.map(({uuid:m})=>m)));const l=rh(e)(a);this.dispatch(ch(l.map(({uuid:m})=>m))),this.dispatch(Ja(c.uuid));try{await this.enqueueRequest({description:"Delete project",method:h.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Ja(c.uuid))}catch(m){throw this.dispatch(Za(c)),this.dispatch(ah(Object.values(l))),this.dispatch(Fh(n)),this.dispatch(hh(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:h.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(jh(a)),a}}class gP extends v{add(e){var n;const{store:i}=this.client,a=T({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(Bh(a));const c=this.enqueueRequest({description:"Create team membership",method:h.POST,url:"/team-memberships/",payload:w(a),blockers:[e.team],blocks:[a.uuid]});return c.then(r=>{this.dispatch(ec(r))}).catch(()=>{this.dispatch(tc(a.uuid))}),[a,c]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Lh(e)(a);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(tc(e));try{return await this.enqueueRequest({description:"Delete team membership",method:h.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(ec(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:h.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(kh(a)),a}}class bP extends v{add(e){var n;const{store:i}=this.client,a=T({...e,submitted_at:new Date().toISOString(),created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(Wh(a));const c=this.enqueueRequest({description:"Create team",method:h.POST,url:"/teams/",payload:w(a),blockers:[],blocks:[a.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ac(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=nc(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Yh(c));const n=this.enqueueRequest({description:"Update team",method:h.PATCH,url:`/teams/${e.uuid}/`,payload:w(e),blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=nc(e)(a);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(ac(e));try{return await this.enqueueRequest({description:"Delete team",method:h.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(ut(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:h.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hh(a)),a}}class PP extends v{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:h.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(jl(a)),a}}class FP{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,c){return this._enqueueRequest(e,i,a,c).then(n=>{if(n instanceof D)throw n;return n})}_enqueueRequest(e,i,a,c){const n=new bc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const l={...r,uuid:e.uuid??Ne.v4()},m={payload:l,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:l,BASE_URL:i,serviceName:a}}}};uc(m,this,c).then(u=>{n.resolve(u.body)}).catch(u=>{oc(u,m),u instanceof Error?n.reject(u):n.reject(new Error((u??Ye).toString()))})}else{const l=this.store.dispatch(Ql(r)),m=o=>{if(o)n.resolve(o.body);else{const p=new D({message:"Could not get a response from the server.",response:o,discard:!0});n.reject(p)}},u=o=>{o instanceof D?o.options.discard=!0:(console.error("Received an unexpected error while processing a request:",o,`
|
|
15
15
|
Converting error to APIError and discarding.`),o=new D({message:"An error occurred while processing the request.",innerError:o,discard:!0})),n.reject(o)};l.then(m,u)}return n}}class Ke{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new Pm.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new Ke;for(let a=0;a<e.length;a++){const c=e[a];if(!c){console.error("Outbox item was undefined");continue}i.sneakRequest(c);for(let n=0;n<a;n++){const r=e[n];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==c.payload.uuid&&r.payload.blocks.some(l=>c.payload.blockers.includes(l))&&Ke._addDependency(c.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){Ke._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(c=>a.payload.blocks.includes(c))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(c=>e.payload.blocks.includes(c))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const c of e){const n=this.requestAttemptCounter[c]||0;n<i&&(i=n,a=c)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),c=e.findIndex(n=>n.payload.uuid===a.payload.uuid);c!==-1&&(e.splice(c,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const c=this.requestAttemptCounter[i.payload.uuid]||0,n=this.requestAttemptCounter[a.payload.uuid]||0;return c-n}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}const TP=(t,e)=>{const i=new e(t);return Yg(i),Wg(t),i};var hm=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(hm||{});s.APIError=D,s.AgentService=pb,s.AssetAttachmentService=yb,s.AssetProcedureAttachmentService=Sb,s.AssetProcedureFieldValuesAttachmentService=Pb,s.AssetProcedureFieldValuesService=Fb,s.AssetProcedureFieldsAttachmentService=gb,s.AssetProcedureFieldsService=bb,s.AssetProcedureInstanceService=Tb,s.AssetProcedureService=Ib,s.AssetProcedureStepFieldValuesAttachmentService=Rb,s.AssetProcedureStepFieldValuesService=vb,s.AssetProcedureStepFieldsAttachmentService=Ob,s.AssetProcedureStepFieldsService=_b,s.AssetProcedureStepService=wb,s.AssetService=Mb,s.AssetStageCompletionService=Eb,s.AssetStageService=jb,s.AssetTypeAttachmentService=qb,s.AssetTypeFieldValuesAttachmentService=Ub,s.AssetTypeFieldValuesService=Db,s.AssetTypeFieldsAttachmentService=Vb,s.AssetTypeFieldsService=zb,s.AssetTypeService=Cb,s.AttachmentModel=Sc,s.BaseApiService=v,s.BaseSDK=FP,s.COMMON_AUTO_FIELDS=Oc,s.CategoryService=kb,s.DEFAULT_ISSUE_PRIORITY=Tm,s.DEFAULT_ISSUE_STATUS=Fm,s.DEFAULT_PAGINATION_PAGE_SIZE=E,s.DeferredPromise=bc,s.DocumentAttachmentService=Bb,s.DocumentService=Gb,s.EMPTY_ARRAY=Ac,s.EMPTY_OBJECT=fc,s.EmailDomainsService=$b,s.EmailVerificationService=Lb,s.FileService=Hb,s.FormRevisionAttachmentService=Wb,s.FormRevisionService=Yb,s.FormService=Kb,s.FormSubmissionAttachmentService=Zb,s.FormSubmissionService=Jb,s.GeoImageService=Xb,s.HttpMethod=h,s.IssueAssociationService=Qb,s.IssueAttachmentService=xb,s.IssueCommentAttachmentService=eP,s.IssueCommentService=tP,s.IssuePriority=$t,s.IssueService=sP,s.IssueStatus=Lt,s.IssueTypeAttachmentService=iP,s.IssueTypeFieldValuesAttachmentService=nP,s.IssueTypeFieldValuesService=rP,s.IssueTypeFieldsAttachmentService=aP,s.IssueTypeFieldsService=cP,s.IssueTypeService=dP,s.IssueUpdateChange=j,s.IssueUpdateService=uP,s.JWTService=hP,s.OUTBOX_RETRY_DELAY=gc,s.OrganizationAccessLevel=yc,s.OrganizationAccessService=mP,s.OrganizationService=pP,s.OutboxCoordinator=Ke,s.PAGINATION_MAX_PAGE_SIZE=Ab,s.PAGINATION_PAGE_SIZE_QUERY_PARAM=fb,s.ProjectAccessService=AP,s.ProjectAttachmentService=fP,s.ProjectFileService=yP,s.ProjectService=SP,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=F,s.SelectorBuilder=Hg,s.TeamMembershipService=gP,s.TeamService=bP,s.UNKNOWN_ERROR_MESSAGE=Ye,s.UserService=PP,s.VERSION_REDUCER_KEY=Ze,s.VerificationCodeType=hm,s._setLatestRetryTime=eh,s.addAsset=ks,s.addAssetAttachment=ep,s.addAssetAttachments=Qt,s.addAssetProcedure=Ss,s.addAssetProcedureAttachment=ip,s.addAssetProcedureAttachments=Hc,s.addAssetProcedureFieldValues=rs,s.addAssetProcedureFieldValuesAttachment=Fp,s.addAssetProcedureFieldValuesAttachments=mt,s.addAssetProcedureFieldValuesMany=On,s.addAssetProcedureFields=ln,s.addAssetProcedureFieldsAttachment=rp,s.addAssetProcedureFieldsAttachments=sn,s.addAssetProcedureFieldsMany=pp,s.addAssetProcedureInstance=hs,s.addAssetProcedureInstances=jn,s.addAssetProcedureStep=zs,s.addAssetProcedureStepFieldValues=Es,s.addAssetProcedureStepFieldValuesAttachment=nA,s.addAssetProcedureStepFieldValuesAttachments=At,s.addAssetProcedureStepFieldValuesMany=nr,s.addAssetProcedureStepFields=Is,s.addAssetProcedureStepFieldsAttachment=Np,s.addAssetProcedureStepFieldsAttachments=$n,s.addAssetProcedureStepFieldsMany=Xp,s.addAssetProcedureSteps=SA,s.addAssetProcedures=Dp,s.addAssetStage=Qs,s.addAssetStageCompletion=Ws,s.addAssetStageCompletions=Ys,s.addAssetStages=jA,s.addAssetType=pi,s.addAssetTypeAttachment=CA,s.addAssetTypeAttachments=si,s.addAssetTypeFieldValues=ui,s.addAssetTypeFieldValuesAttachment=sf,s.addAssetTypeFieldValuesAttachments=It,s.addAssetTypeFieldValuesMany=md,s.addAssetTypeFields=xr,s.addAssetTypeFieldsAttachment=GA,s.addAssetTypeFieldsAttachments=Hr,s.addAssetTypeFieldsMany=KA,s.addAssetTypes=Af,s.addAssets=bt,s.addCategories=If,s.addCategory=gi,s.addConversation=Mc,s.addConversations=Ym,s.addDocumentAttachment=Ef,s.addDocumentAttachments=qd,s.addDocuments=Nd,s.addEmailDomain=Zd,s.addEmailDomains=Cf,s.addForm=zi,s.addFormRevision=Mi,s.addFormRevisionAttachment=Wf,s.addFormRevisionAttachments=ru,s.addFormRevisions=pu,s.addFormSubmission=Bi,s.addFormSubmissionAttachment=oy,s.addFormSubmissionAttachments=vt,s.addFormSubmissions=Et,s.addForms=iy,s.addGeoImage=$u,s.addGeoImages=Lu,s.addIssue=la,s.addIssueAssociation=Zi,s.addIssueAssociations=Ji,s.addIssueAttachment=Ty,s.addIssueAttachments=ta,s.addIssueComment=na,s.addIssueCommentAttachment=_y,s.addIssueCommentAttachments=po,s.addIssueComments=Ey,s.addIssueType=yl,s.addIssueTypeAttachment=Gy,s.addIssueTypeAttachments=Vo,s.addIssueTypeFieldValues=ba,s.addIssueTypeFieldValuesAttachment=mS,s.addIssueTypeFieldValuesAttachments=zt,s.addIssueTypeFieldValuesMany=Qy,s.addIssueTypeFields=il,s.addIssueTypeFieldsAttachment=Hy,s.addIssueTypeFieldsAttachments=Ho,s.addIssueTypeFieldsMany=aS,s.addIssueTypes=gS,s.addIssueUpdate=Tl,s.addIssueUpdates=Il,s.addIssues=wo,s.addOrganization=Wl,s.addOrganizationAccess=Bl,s.addOrganizationAccesses=kS,s.addOrganizations=KS,s.addProject=Za,s.addProjectAccess=Ba,s.addProjectAccesses=ah,s.addProjectAttachment=dg,s.addProjectAttachments=oh,s.addProjectFile=hg,s.addProjectFiles=Fh,s.addProjects=bg,s.addTeam=Wh,s.addTeamMembership=Bh,s.addTeamMemberships=vg,s.addTeams=zg,s.addUser=ql,s.addUsers=jS,s.agentsReducer=qc,s.agentsSlice=Kt,s.areArraysEqual=wm,s.assetAttachmentReducer=$c,s.assetAttachmentSlice=Jt,s.assetProcedureAttachmentReducer=Jc,s.assetProcedureAttachmentSlice=es,s.assetProcedureFieldValuesAttachmentReducer=Fn,s.assetProcedureFieldValuesAttachmentSlice=as,s.assetProcedureFieldValuesReducer=vn,s.assetProcedureFieldValuesSlice=ns,s.assetProcedureFieldsAttachmentReducer=dn,s.assetProcedureFieldsAttachmentSlice=ts,s.assetProcedureFieldsReducer=An,s.assetProcedureFieldsSlice=ss,s.assetProcedureInstanceReducer=Vn,s.assetProcedureInstanceSlice=ls,s.assetProcedureReducer=Cn,s.assetProcedureSlice=ys,s.assetProcedureStepFieldValuesAttachmentReducer=ir,s.assetProcedureStepFieldValuesAttachmentSlice=vs,s.assetProcedureStepFieldValuesReducer=or,s.assetProcedureStepFieldValuesSlice=Ms,s.assetProcedureStepFieldsAttachmentReducer=Yn,s.assetProcedureStepFieldsAttachmentSlice=Fs,s.assetProcedureStepFieldsReducer=Jn,s.assetProcedureStepFieldsSlice=Ts,s.assetProcedureStepReducer=pr,s.assetProcedureStepSlice=Vs,s.assetReducer=br,s.assetSlice=Cs,s.assetStageCompletionReducer=Or,s.assetStageCompletionSlice=Hs,s.assetStageReducer=Er,s.assetStageSlice=Xs,s.assetTypeAttachmentReducer=$r,s.assetTypeAttachmentSlice=ti,s.assetTypeFieldValuesAttachmentReducer=od,s.assetTypeFieldValuesAttachmentSlice=ni,s.assetTypeFieldValuesReducer=yd,s.assetTypeFieldValuesSlice=di,s.assetTypeFieldsAttachmentReducer=Jr,s.assetTypeFieldsAttachmentSlice=ai,s.assetTypeFieldsReducer=id,s.assetTypeFieldsSlice=ci,s.assetTypeReducer=Pd,s.assetTypeSlice=mi,s.authReducer=Id,s.authSlice=_t,s.baseReducer=$g,s.baseReducers=rc,s.blobToBase64=Cm,s.categoryReducer=Md,s.categorySlice=Si,s.clearTokens=Pf,s.constructUploadedFilePayloads=Dm,s.coordinatesAreEqual=Rm,s.createModelAdapter=I,s.createMultiPointGeometry=_m,s.createOfflineAction=Jl,s.createPayload=w,s.createPointGeometry=Om,s.createSelectionAdapter=Im,s.deleteAsset=Bs,s.deleteAssetAttachment=Dc,s.deleteAssetAttachments=xt,s.deleteAssetProcedure=gs,s.deleteAssetProcedureAttachment=Kc,s.deleteAssetProcedureAttachments=Zc,s.deleteAssetProcedureFieldValues=ds,s.deleteAssetProcedureFieldValuesAttachment=_p,s.deleteAssetProcedureFieldValuesAttachments=pt,s.deleteAssetProcedureFieldValuesMany=Rn,s.deleteAssetProcedureFields=mn,s.deleteAssetProcedureFieldsAttachment=lp,s.deleteAssetProcedureFieldsAttachments=cn,s.deleteAssetProcedureFieldsMany=Sp,s.deleteAssetProcedureInstance=ms,s.deleteAssetProcedureInstances=qn,s.deleteAssetProcedureStep=Us,s.deleteAssetProcedureStepFieldValues=js,s.deleteAssetProcedureStepFieldValuesAttachment=oA,s.deleteAssetProcedureStepFieldValuesAttachments=ft,s.deleteAssetProcedureStepFieldValuesMany=dr,s.deleteAssetProcedureStepFields=Os,s.deleteAssetProcedureStepFieldsAttachment=Kp,s.deleteAssetProcedureStepFieldsAttachments=Nn,s.deleteAssetProcedureStepFieldsMany=tA,s.deleteAssetProcedureSteps=bA,s.deleteAssetProcedures=kp,s.deleteAssetStage=xs,s.deleteAssetStageCompletion=Ks,s.deleteAssetStageCompletions=Zs,s.deleteAssetStages=VA,s.deleteAssetType=Ai,s.deleteAssetTypeAttachment=Dr,s.deleteAssetTypeAttachments=ii,s.deleteAssetTypeFieldValues=oi,s.deleteAssetTypeFieldValuesAttachment=rf,s.deleteAssetTypeFieldValuesAttachments=Ot,s.deleteAssetTypeFieldValuesMany=Ad,s.deleteAssetTypeFields=td,s.deleteAssetTypeFieldsAttachment=HA,s.deleteAssetTypeFieldsAttachments=Yr,s.deleteAssetTypeFieldsMany=QA,s.deleteAssetTypes=yf,s.deleteAssets=Gs,s.deleteCategories=vf,s.deleteCategory=vd,s.deleteConversation=Jm,s.deleteConversations=Xm,s.deleteDocumentAttachment=Ud,s.deleteDocumentAttachments=Dd,s.deleteEmailDomain=Jd,s.deleteEmailDomains=Lf,s.deleteForm=Ui,s.deleteFormRevision=Ei,s.deleteFormRevisionAttachment=Jf,s.deleteFormRevisionAttachments=uu,s.deleteFormRevisions=fu,s.deleteFormSubmission=Gi,s.deleteFormSubmissionAttachment=py,s.deleteFormSubmissionAttachments=wt,s.deleteFormSubmissions=jt,s.deleteForms=dy,s.deleteGeoImage=Wi,s.deleteGeoImages=Hu,s.deleteIssue=ha,s.deleteIssueAssociation=Xi,s.deleteIssueAssociations=Qi,s.deleteIssueAttachment=no,s.deleteIssueAttachments=sa,s.deleteIssueComment=da,s.deleteIssueCommentAttachment=yo,s.deleteIssueCommentAttachments=So,s.deleteIssueComments=Vy,s.deleteIssueType=FS,s.deleteIssueTypeAttachment=Do,s.deleteIssueTypeAttachments=Co,s.deleteIssueTypeFieldValues=Pa,s.deleteIssueTypeFieldValuesAttachment=yS,s.deleteIssueTypeFieldValuesAttachments=Ut,s.deleteIssueTypeFieldValuesMany=sS,s.deleteIssueTypeFields=cl,s.deleteIssueTypeFieldsAttachment=Zy,s.deleteIssueTypeFieldsAttachments=Yo,s.deleteIssueTypeFieldsMany=dS,s.deleteIssueTypes=TS,s.deleteIssueUpdate=Ol,s.deleteIssueUpdates=_l,s.deleteIssues=Mo,s.deleteOrganization=JS,s.deleteOrganizationAccess=Gl,s.deleteOrganizationAccesses=LS,s.deleteOrganizations=XS,s.deleteProject=Ja,s.deleteProjectAccess=Ga,s.deleteProjectAccesses=ch,s.deleteProjectAttachment=ph,s.deleteProjectAttachments=Ha,s.deleteProjectFile=Th,s.deleteProjectFiles=Ih,s.deleteProjects=Fg,s.deleteTeam=ac,s.deleteTeamMembership=tc,s.deleteTeamMemberships=jg,s.deleteTeams=Cg,s.deleteUser=Vl,s.deleteUsers=zS,s.dequeue=dm,s.discard=oc,s.documentAttachmentReducer=Gd,s.documentAttachmentSlice=Fi,s.documentSlice=Ti,s.documentsReducer=Wd,s.downloadFile=km,s.downloadInMemoryFile=Um,s.emailDomainsReducer=xd,s.emailDomainsSlice=_i,s.emailRegex=Wm,s.enqueue=rm,s.enqueueRequest=Ql,s.fallbackToEmptyArray=g,s.fallbackToEmptyObject=ht,s.fileReducer=au,s.fileSlice=Ri,s.fileToBlob=Tc,s.formReducer=Pu,s.formRevisionAttachmentReducer=lu,s.formRevisionAttachmentSlice=vi,s.formRevisionReducer=Su,s.formRevisionsSlice=wi,s.formSlice=Vi,s.formSubmissionAttachmentReducer=Eu,s.formSubmissionAttachmentSlice=Di,s.formSubmissionReducer=Cu,s.formSubmissionSlice=ki,s.geoImageReducer=Ku,s.geoImageSlice=Hi,s.getFileIdentifier=zm,s.getFileS3Key=Yt,s.getLocalDateString=Pc,s.getLocalRelativeDateString=qm,s.getOutboxCoordinator=Ge,s.getRenamedFile=Fc,s.hashFile=He,s.initSDK=TP,s.initializeAssetAttachments=Xt,s.initializeAssetProcedureAttachments=Nc,s.initializeAssetProcedureFieldValues=In,s.initializeAssetProcedureFieldValuesAttachments=yn,s.initializeAssetProcedureFields=on,s.initializeAssetProcedureFieldsAttachments=tn,s.initializeAssetProcedureInstances=En,s.initializeAssetProcedureStepFieldValues=cr,s.initializeAssetProcedureStepFieldValuesAttachments=Qn,s.initializeAssetProcedureStepFields=Zn,s.initializeAssetProcedureStepFieldsAttachments=Gn,s.initializeAssetProcedureSteps=hr,s.initializeAssetProcedures=Dn,s.initializeAssetStageCompletions=Fr,s.initializeAssetStages=wr,s.initializeAssetTypeAttachments=Vr,s.initializeAssetTypeFieldValues=hd,s.initializeAssetTypeFieldValuesAttachments=cd,s.initializeAssetTypeFields=Qr,s.initializeAssetTypeFieldsAttachments=Nr,s.initializeAssetTypes=gd,s.initializeAssets=yr,s.initializeCategories=_d,s.initializeConversations=wc,s.initializeDocumentAttachments=jd,s.initializeEmailDomains=Kd,s.initializeFormRevisionAttachments=nu,s.initializeFormRevisions=mu,s.initializeFormSubmissionAttachments=_u,s.initializeFormSubmissions=qu,s.initializeForms=bu,s.initializeGeoImages=Bu,s.initializeIssueAssociations=Ju,s.initializeIssueAttachments=ea,s.initializeIssueCommentAttachments=aa,s.initializeIssueComments=My,s.initializeIssueTypeAttachments=ya,s.initializeIssueTypeFieldValues=Qo,s.initializeIssueTypeFieldValuesAttachments=ul,s.initializeIssueTypeFields=sl,s.initializeIssueTypeFieldsAttachments=No,s.initializeIssueTypes=fl,s.initializeIssueUpdates=Fl,s.initializeIssues=vo,s.initializeOrganizationAccesses=kl,s.initializeOrganizations=Hl,s.initializeProjectAccesses=ih,s.initializeProjectAttachments=uh,s.initializeProjectFiles=Ph,s.initializeProjects=jh,s.initializeTeamMemberships=kh,s.initializeTeams=Hh,s.initializeUsers=jl,s.isToday=jm,s.issueAssociationReducer=so,s.issueAssociationSlice=Ki,s.issueAttachmentReducer=ho,s.issueAttachmentSlice=xi,s.issueCommentAttachmentReducer=Fo,s.issueCommentAttachmentSlice=ia,s.issueCommentReducer=_o,s.issueCommentSlice=ca,s.issueReducer=jo,s.issueSlice=oa,s.issueTypeAttachmentReducer=$o,s.issueTypeAttachmentSlice=fa,s.issueTypeFieldValuesAttachmentReducer=pl,s.issueTypeFieldValuesAttachmentSlice=Oa,s.issueTypeFieldValuesReducer=el,s.issueTypeFieldValuesSlice=ga,s.issueTypeFieldsAttachmentReducer=Jo,s.issueTypeFieldsAttachmentSlice=Sa,s.issueTypeFieldsReducer=rl,s.issueTypeFieldsSlice=Ia,s.issueTypeReducer=bl,s.issueTypeSlice=Ra,s.issueUpdateReducer=Ml,s.issueUpdateSlice=Ea,s.logOnlyOnce=Bm,s.markAsDeleted=xl,s.markForDeletion=sg,s.memoize=Ht,s.offline=T,s.onlyUniqueHashes=Hm,s.onlyUniqueOfflineIds=Rc,s.organizationAccessReducer=$l,s.organizationAccessSlice=Va,s.organizationReducer=Zl,s.organizationSlice=Da,s.outboxReducer=th,s.outboxSlice=Ca,s.overmapEnhancer=sb,s.overmapReducer=Lg,s.overmapReducers=Qh,s.performRequest=uc,s.projectAccessReducer=nh,s.projectAccessSlice=ka,s.projectAttachmentReducer=gh,s.projectAttachmentSlice=Na,s.projectFileReducer=Mh,s.projectFileSlice=Wa,s.projectReducer=Vh,s.projectSlice=Ka,s.rehydratedReducer=Dh,s.rehydratedSlice=Qa,s.removeDocuments=Ii,s.removeIssueType=va,s.resetProjectFileObjectUrls=pg,s.restructureCreateSelectorWithArgs=y,s.saveActiveProjectFileBounds=Rh,s.selectAccessToken=Ff,s.selectAccessesByUserOfProject=ng,s.selectAccessibleProjects=Tg,s.selectActiveOrganizationAccess=NS,s.selectActiveProjectFileId=fg,s.selectAllDocumentAttachments=kd,s.selectAllProjectAttachments=fh,s.selectAssetAttachmentById=Bc,s.selectAssetAttachmentMapping=Cc,s.selectAssetAttachments=kc,s.selectAssetById=Ns,s.selectAssetProcedureAttachmentById=xc,s.selectAssetProcedureAttachmentMapping=Xc,s.selectAssetProcedureAttachments=Qc,s.selectAssetProcedureById=Ps,s.selectAssetProcedureFieldValues=us,s.selectAssetProcedureFieldValuesAttachmentById=Rp,s.selectAssetProcedureFieldValuesAttachments=gn,s.selectAssetProcedureFieldValuesAttachmentsByIds=bn,s.selectAssetProcedureFieldValuesAttachmentsMapping=cs,s.selectAssetProcedureFieldValuesById=os,s.selectAssetProcedureFieldValuesMapping=wn,s.selectAssetProcedureFieldValuesOfAsset=Mp,s.selectAssetProcedureFields=is,s.selectAssetProcedureFieldsAttachmentById=mp,s.selectAssetProcedureFieldsAttachments=rn,s.selectAssetProcedureFieldsAttachmentsMapping=nn,s.selectAssetProcedureFieldsById=Pp,s.selectAssetProcedureFieldsMapping=pn,s.selectAssetProcedureFieldsOfAssetProcedure=gp,s.selectAssetProcedureInstanceById=fs,s.selectAssetProcedureInstances=As,s.selectAssetProcedureInstancesByIds=Up,s.selectAssetProcedureInstancesMapping=ps,s.selectAssetProcedureInstancesOfAssetProcedure=zn,s.selectAssetProcedureInstancesOfAssetType=zp,s.selectAssetProcedureStepById=Ds,s.selectAssetProcedureStepFieldValues=yt,s.selectAssetProcedureStepFieldValuesAttachmentById=lA,s.selectAssetProcedureStepFieldValuesAttachments=er,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=tr,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=ws,s.selectAssetProcedureStepFieldValuesById=qs,s.selectAssetProcedureStepFieldValuesMapping=ur,s.selectAssetProcedureStepFieldValuesOfAsset=pA,s.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=AA,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=fA,s.selectAssetProcedureStepFields=Rs,s.selectAssetProcedureStepFieldsAttachmentById=Jp,s.selectAssetProcedureStepFieldsAttachments=Wn,s.selectAssetProcedureStepFieldsAttachmentsMapping=Hn,s.selectAssetProcedureStepFieldsById=cA,s.selectAssetProcedureStepFieldsMapping=_s,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=sA,s.selectAssetProcedureStepMapping=gt,s.selectAssetProcedureSteps=Ar,s.selectAssetProcedureStepsByIds=TA,s.selectAssetProcedureStepsMappingOfAssetProcedure=PA,s.selectAssetProcedureStepsOfAssetProcedure=FA,s.selectAssetProcedures=kn,s.selectAssetProceduresByIds=$p,s.selectAssetProceduresMapping=bs,s.selectAssetProceduresOfOrganization=Lp,s.selectAssetStageById=ei,s.selectAssetStageCompletionById=_r,s.selectAssetStageCompletionMapping=Js,s.selectAssetStageCompletions=MA,s.selectAssetStageCompletionsByIds=Rr,s.selectAssetStages=jr,s.selectAssetStagesByIds=DA,s.selectAssetStagesMappingOfAssetProcedure=zA,s.selectAssetStagesOfAssetProcedure=UA,s.selectAssetTypeAttachmentById=Br,s.selectAssetTypeAttachmentMapping=Cr,s.selectAssetTypeAttachments=kr,s.selectAssetTypeById=yi,s.selectAssetTypeFieldValues=li,s.selectAssetTypeFieldValuesAttachmentById=df,s.selectAssetTypeFieldValuesAttachments=rd,s.selectAssetTypeFieldValuesAttachmentsByIds=dd,s.selectAssetTypeFieldValuesAttachmentsMapping=ri,s.selectAssetTypeFieldValuesById=hi,s.selectAssetTypeFieldValuesMapping=fd,s.selectAssetTypeFieldValuesOfAsset=lf,s.selectAssetTypeFields=Tt,s.selectAssetTypeFieldsAttachmentById=YA,s.selectAssetTypeFieldsAttachments=Zr,s.selectAssetTypeFieldsAttachmentsMapping=Kr,s.selectAssetTypeFieldsById=tf,s.selectAssetTypeFieldsMapping=sd,s.selectAssetTypeFieldsOfAssetType=xA,s.selectAssetTypeValuesOfAssetType=hf,s.selectAssetTypes=bd,s.selectAssetTypesByIds=Sf,s.selectAssetTypesMapping=fi,s.selectAssetTypesOfOrganization=gf,s.selectAssets=Sr,s.selectAssetsByIds=gr,s.selectAssetsMapping=$s,s.selectAssetsOfAssetType=Ls,s.selectAttachmentsOfAsset=Gc,s.selectAttachmentsOfAssetProcedure=np,s.selectAttachmentsOfAssetProcedureFieldValues=Pn,s.selectAttachmentsOfAssetProcedureFields=hp,s.selectAttachmentsOfAssetProcedureStepFieldValues=sr,s.selectAttachmentsOfAssetProcedureStepFields=Zp,s.selectAttachmentsOfAssetType=Gr,s.selectAttachmentsOfAssetTypeFieldValues=ud,s.selectAttachmentsOfAssetTypeFields=WA,s.selectAttachmentsOfDocument=Vf,s.selectAttachmentsOfFormRevision=Xf,s.selectAttachmentsOfFormSubmission=Mu,s.selectAttachmentsOfIssue=oo,s.selectAttachmentsOfIssueComment=wy,s.selectAttachmentsOfIssueType=Ny,s.selectAttachmentsOfIssueTypeFieldValues=ml,s.selectAttachmentsOfIssueTypeFields=Jy,s.selectAttachmentsOfProject=Sh,s.selectCategories=wd,s.selectCategoriesByIds=wf,s.selectCategoriesOfProject=Mf,s.selectCategoryById=Pi,s.selectCategoryMapping=bi,s.selectCommentsOfIssue=zy,s.selectConversation=xm,s.selectConversationMapping=Zt,s.selectConversations=Qm,s.selectCurrentUser=Ul,s.selectDeletedRequests=eg,s.selectDocumentAttachmentById=Bd,s.selectDocumentAttachmentMapping=Cd,s.selectDocumentById=Hd,s.selectDocuments=Oi,s.selectDocumentsByIds=zf,s.selectDocumentsMapping=Rt,s.selectEmailDomains=Qd,s.selectEmailDomainsAsMapping=Xd,s.selectEmailDomainsOfOrganization=Nf,s.selectFieldValuesOfAssetProcedureInstance=Ep,s.selectFormById=Iu,s.selectFormMapping=Fu,s.selectFormRevisionAttachmentsMapping=ou,s.selectFormRevisionById=ty,s.selectFormRevisionMapping=ji,s.selectFormRevisions=qi,s.selectFormRevisionsOfForm=yu,s.selectFormSubmissionAttachemntsByIds=wu,s.selectFormSubmissionAttachments=Ci,s.selectFormSubmissionAttachmentsMapping=vu,s.selectFormSubmissionById=Ni,s.selectFormSubmissions=Li,s.selectFormSubmissionsMapping=$i,s.selectFormSubmissionsOfAsset=Du,s.selectFormSubmissionsOfForm=zu,s.selectFormSubmissionsOfIssue=Uu,s.selectForms=Tu,s.selectFormsOfOrganization=uy,s.selectGeoImageById=Yi,s.selectGeoImageMapping=Wu,s.selectGeoImages=Yu,s.selectGeoImagesOfProject=Sy,s.selectIsImportingProjectFile=yg,s.selectIsLoggedIn=Tf,s.selectIssueAssociationById=Qu,s.selectIssueAssociationMapping=ct,s.selectIssueAssociations=Fy,s.selectIssueAssociationsOfAsset=to,s.selectIssueAssociationsOfIssue=eo,s.selectIssueAssociationsToIssue=xu,s.selectIssueAttachmentById=lo,s.selectIssueAttachmentMapping=ro,s.selectIssueAttachments=uo,s.selectIssueById=Aa,s.selectIssueCommentAttachmentById=Po,s.selectIssueCommentAttachmentMapping=go,s.selectIssueCommentAttachments=bo,s.selectIssueCommentById=ua,s.selectIssueCommentMapping=Oo,s.selectIssueMapping=ma,s.selectIssueTypeAttachmentById=Go,s.selectIssueTypeAttachmentMapping=ko,s.selectIssueTypeAttachments=Bo,s.selectIssueTypeById=Ma,s.selectIssueTypeFieldValues=Fa,s.selectIssueTypeFieldValuesAttachmentById=SS,s.selectIssueTypeFieldValuesAttachments=_a,s.selectIssueTypeFieldValuesAttachmentsByIds=hl,s.selectIssueTypeFieldValuesAttachmentsMapping=ll,s.selectIssueTypeFieldValuesById=Ta,s.selectIssueTypeFieldValuesMapping=xo,s.selectIssueTypeFieldValuesOfIssue=iS,s.selectIssueTypeFields=Vt,s.selectIssueTypeFieldsAttachmentById=Xy,s.selectIssueTypeFieldsAttachments=Zo,s.selectIssueTypeFieldsAttachmentsMapping=Ko,s.selectIssueTypeFieldsById=hS,s.selectIssueTypeFieldsMapping=nl,s.selectIssueTypeFieldsOfIssueType=uS,s.selectIssueTypeMapping=wa,s.selectIssueTypeValuesOfIssueType=lS,s.selectIssueTypes=gl,s.selectIssueTypesByIds=IS,s.selectIssueTypesOfOrganization=OS,s.selectIssueUpdateMapping=Rl,s.selectIssueUpdates=vl,s.selectIssueUpdatesOfIssue=wl,s.selectIssues=pa,s.selectIssuesByIds=ky,s.selectIssuesOfIssueType=Eo,s.selectIssuesOfProject=By,s.selectLatestAssetProcedureFieldsOfAssetProcedure=bp,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=iA,s.selectLatestAssetTypeFieldsOfAssetType=ef,s.selectLatestFieldsByAssetProcedureStep=aA,s.selectLatestFormRevisionOfForm=sy,s.selectLatestIssueTypeFieldsOfIssueType=oS,s.selectLatestRetryTime=tg,s.selectMembershipsByUserOfTeam=qg,s.selectNumberOfAssetsOfAssetType=RA,s.selectOrganizationAccessById=Ua,s.selectOrganizationAccessMapping=za,s.selectOrganizationAccessUserMapping=Ll,s.selectOrganizationById=xS,s.selectOrganizationDocuments=Df,s.selectOrganizations=QS,s.selectOrganizationsMapping=Kl,s.selectProjectAccessById=La,s.selectProjectAccessMapping=$a,s.selectProjectAccesses=kt,s.selectProjectAccessesOfProject=rh,s.selectProjectAttachmentById=yh,s.selectProjectAttachmentMapping=Ah,s.selectProjectById=Uh,s.selectProjectDocuments=Uf,s.selectProjectFileById=Ag,s.selectProjectFileMapping=vh,s.selectProjectFiles=wh,s.selectProjectMapping=zh,s.selectProjects=Xa,s.selectProjectsOfOrganization=Ig,s.selectRehydrated=Rg,s.selectStageMapping=Ft,s.selectTeamById=nc,s.selectTeamMembershipById=Lh,s.selectTeamMemberships=sc,s.selectTeamMembershipsMapping=$h,s.selectTeams=Kh,s.selectTeamsByIds=kg,s.selectTeamsMapping=cc,s.selectTeamsOfOrganization=Bg,s.selectUploadUrl=iu,s.selectUserById=Dl,s.selectUsers=qa,s.selectUsersByIds=CS,s.selectUsersMapping=Dt,s.selectUsersOfOrganization=HS,s.selectUsersOfProject=rg,s.selectUsersOfTeam=Vg,s.setActiveProjectFileId=_h,s.setAsset=OA,s.setAssetAttachment=zc,s.setAssetAttachments=tp,s.setAssetProcedure=Bp,s.setAssetProcedureAttachment=Wc,s.setAssetProcedureAttachments=ap,s.setAssetProcedureFieldValues=vp,s.setAssetProcedureFieldValuesAttachment=Tp,s.setAssetProcedureFieldValuesAttachments=Ip,s.setAssetProcedureFieldValuesMany=wp,s.setAssetProcedureFields=Ap,s.setAssetProcedureFieldsAttachment=dp,s.setAssetProcedureFieldsAttachments=up,s.setAssetProcedureFieldsMany=fp,s.setAssetProcedureInstance=qp,s.setAssetProcedureInstances=Vp,s.setAssetProcedureStep=mr,s.setAssetProcedureStepFieldValues=hA,s.setAssetProcedureStepFieldValuesAttachment=rA,s.setAssetProcedureStepFieldValuesAttachments=dA,s.setAssetProcedureStepFieldValuesMany=mA,s.setAssetProcedureStepFields=Qp,s.setAssetProcedureStepFieldsAttachment=Hp,s.setAssetProcedureStepFieldsAttachments=Wp,s.setAssetProcedureStepFieldsMany=xp,s.setAssetProcedureSteps=yA,s.setAssetProcedures=Gp,s.setAssetStage=Mr,s.setAssetStageCompletion=vA,s.setAssetStageCompletions=wA,s.setAssetStages=EA,s.setAssetType=mf,s.setAssetTypeAttachment=zr,s.setAssetTypeAttachments=kA,s.setAssetTypeFieldValues=uf,s.setAssetTypeFieldValuesAttachment=af,s.setAssetTypeFieldValuesAttachments=cf,s.setAssetTypeFieldValuesMany=of,s.setAssetTypeFields=ZA,s.setAssetTypeFieldsAttachment=$A,s.setAssetTypeFieldsAttachments=LA,s.setAssetTypeFieldsMany=JA,s.setAssetTypes=pf,s.setAssets=_A,s.setCategories=_f,s.setCategory=Of,s.setConversation=Ec,s.setConversations=Km,s.setCurrentUser=US,s.setDocumentAttachment=Vd,s.setDocumentAttachments=jf,s.setDocuments=Ld,s.setEmailDomain=kf,s.setEmailDomains=Bf,s.setForm=ay,s.setFormRevision=Au,s.setFormRevisionAttachment=Yf,s.setFormRevisionAttachments=Kf,s.setFormRevisions=Qf,s.setFormSubmission=Mt,s.setFormSubmissionAttachment=ly,s.setFormSubmissionAttachments=hy,s.setFormSubmissions=Ay,s.setForms=cy,s.setGeoImage=at,s.setGeoImages=Gu,s.setIsImportingProjectFile=Oh,s.setIssue=Uy,s.setIssueAssociation=by,s.setIssueAssociations=gy,s.setIssueAttachment=ao,s.setIssueAttachments=Iy,s.setIssueComment=ra,s.setIssueCommentAttachment=Ao,s.setIssueCommentAttachments=Ry,s.setIssueComments=Io,s.setIssueType=rt,s.setIssueTypeAttachment=zo,s.setIssueTypeAttachments=$y,s.setIssueTypeFieldValues=xy,s.setIssueTypeFieldValuesAttachment=pS,s.setIssueTypeFieldValuesAttachments=AS,s.setIssueTypeFieldValuesMany=eS,s.setIssueTypeFields=cS,s.setIssueTypeFieldsAttachment=Wy,s.setIssueTypeFieldsAttachments=Yy,s.setIssueTypeFieldsMany=nS,s.setIssueTypes=bS,s.setIssueUpdate=_S,s.setIssueUpdates=RS,s.setIssues=Dy,s.setLoggedIn=Td,s.setOrganization=YS,s.setOrganizationAccess=BS,s.setOrganizationAccesses=GS,s.setOrganizations=WS,s.setProfilePicture=DS,s.setProject=gg,s.setProjectAccess=ig,s.setProjectAccesses=ag,s.setProjectAttachment=lh,s.setProjectAttachments=hh,s.setProjectFile=og,s.setProjectFiles=lg,s.setProjects=Sg,s.setRehydrated=_g,s.setTeam=ut,s.setTeamMembership=ec,s.setTeamMemberships=wg,s.setTeams=Ug,s.setTokens=bf,s.setUploadUrl=su,s.setUser=ES,s.setUsers=MS,s.shallowEqual=vm,s.slugify=Lm,s.spacesToDashesLower=$m,s.teamMembershipReducer=Gh,s.teamMembershipSlice=xa,s.teamReducer=Zh,s.teamSlice=ic,s.toFileNameSafeString=Gm,s.toOfflineIdRecord=_c,s.truncate=Nm,s.updateAsset=tt,s.updateAssetAttachment=sp,s.updateAssetAttachments=Uc,s.updateAssetProcedure=Qe,s.updateAssetProcedureAttachment=cp,s.updateAssetProcedureAttachments=Yc,s.updateAssetProcedureFieldValues=Je,s.updateAssetProcedureFieldValuesAttachment=Op,s.updateAssetProcedureFieldValuesAttachments=Sn,s.updateAssetProcedureFieldValuesMany=_n,s.updateAssetProcedureFields=hn,s.updateAssetProcedureFieldsAttachment=op,s.updateAssetProcedureFieldsAttachments=an,s.updateAssetProcedureFieldsMany=yp,s.updateAssetProcedureInstance=Xe,s.updateAssetProcedureInstances=jp,s.updateAssetProcedureStep=St,s.updateAssetProcedureStepFieldValues=et,s.updateAssetProcedureStepFieldValuesAttachment=uA,s.updateAssetProcedureStepFieldValuesAttachments=xn,s.updateAssetProcedureStepFieldValuesMany=rr,s.updateAssetProcedureStepFields=xe,s.updateAssetProcedureStepFieldsAttachment=Yp,s.updateAssetProcedureStepFieldsAttachments=Ln,s.updateAssetProcedureStepFieldsMany=eA,s.updateAssetProcedureSteps=gA,s.updateAssetProcedures=Cp,s.updateAssetStage=Pt,s.updateAssetStageCompletion=Tr,s.updateAssetStageCompletions=Ir,s.updateAssetStages=qA,s.updateAssetType=it,s.updateAssetTypeAttachment=BA,s.updateAssetTypeAttachments=Ur,s.updateAssetTypeFieldValues=st,s.updateAssetTypeFieldValuesAttachment=nf,s.updateAssetTypeFieldValuesAttachments=nd,s.updateAssetTypeFieldValuesMany=pd,s.updateAssetTypeFields=ed,s.updateAssetTypeFieldsAttachment=NA,s.updateAssetTypeFieldsAttachments=Wr,s.updateAssetTypeFieldsMany=XA,s.updateAssetTypes=ff,s.updateAssets=IA,s.updateCategories=Rf,s.updateCategory=Rd,s.updateConversation=jc,s.updateConversations=Zm,s.updateDocumentAttachment=qf,s.updateDocumentAttachments=zd,s.updateDocuments=We,s.updateEmailDomain=Gf,s.updateEmailDomains=$f,s.updateForm=ny,s.updateFormRevision=xf,s.updateFormRevisionAttachment=Zf,s.updateFormRevisionAttachments=du,s.updateFormRevisions=ey,s.updateFormSubmission=Vu,s.updateFormSubmissionAttachment=my,s.updateFormSubmissionAttachments=Ru,s.updateFormSubmissions=fy,s.updateForms=ry,s.updateGeoImage=Nu,s.updateGeoImages=yy,s.updateIssue=qt,s.updateIssueAssociation=Xu,s.updateIssueAssociations=Py,s.updateIssueAttachment=Oy,s.updateIssueAttachments=co,s.updateIssueComment=jy,s.updateIssueCommentAttachment=vy,s.updateIssueCommentAttachments=fo,s.updateIssueComments=qy,s.updateIssueType=Sl,s.updateIssueTypeAttachment=Ly,s.updateIssueTypeAttachments=Uo,s.updateIssueTypeFieldValues=nt,s.updateIssueTypeFieldValuesAttachment=fS,s.updateIssueTypeFieldValuesAttachments=ol,s.updateIssueTypeFieldValuesMany=tS,s.updateIssueTypeFields=al,s.updateIssueTypeFieldsAttachment=Ky,s.updateIssueTypeFieldsAttachments=Wo,s.updateIssueTypeFieldsMany=rS,s.updateIssueTypes=PS,s.updateIssueUpdate=vS,s.updateIssueUpdates=wS,s.updateIssues=Cy,s.updateOrganization=Yl,s.updateOrganizationAccess=Ct,s.updateOrganizationAccesses=$S,s.updateOrganizations=ZS,s.updateProject=qh,s.updateProjectAccess=dt,s.updateProjectAccesses=cg,s.updateProjectAttachment=ug,s.updateProjectAttachments=mh,s.updateProjectFile=Ya,s.updateProjectFiles=mg,s.updateProjects=Pg,s.updateTeam=Yh,s.updateTeamMembership=Mg,s.updateTeamMemberships=Eg,s.updateTeams=Dg,s.updateUser=VS,s.updateUsers=qS,s.useSelectorBuilder=Ng,s.userReducer=zl,s.userSlice=ja,s.versioningReducer=Xh,s.versioningSlice=Jh,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -3,7 +3,7 @@ import { Organization, Project, ProjectAttachment, Stored } from '../../typings'
|
|
|
3
3
|
import { BaseSDK } from '../base';
|
|
4
4
|
import { OptimisticMultipleModelResult } from '../typings';
|
|
5
5
|
import { BaseAttachmentService, BuildAttachmentPayloadData, BuildOfflineAttachmentData } from './BaseAttachmentService';
|
|
6
|
-
export declare abstract class ProjectAttachmentService<TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseAttachmentService<TState, TSDK,
|
|
6
|
+
export declare abstract class ProjectAttachmentService<TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseAttachmentService<TState, TSDK, ProjectAttachment> {
|
|
7
7
|
name: string;
|
|
8
8
|
url: string;
|
|
9
9
|
addAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>[], "projectAttachments/addProjectAttachments">;
|
|
@@ -11,7 +11,7 @@ export declare abstract class ProjectAttachmentService<TState extends OvermapRoo
|
|
|
11
11
|
removeAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<string[], "projectAttachments/deleteProjectAttachments">;
|
|
12
12
|
removeAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "projectAttachments/deleteProjectAttachment">;
|
|
13
13
|
setAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>, "projectAttachments/setProjectAttachment">;
|
|
14
|
-
selectAttachment: import('../..').OvermapSelectorWithArgs<string, ProjectAttachment | undefined>;
|
|
14
|
+
selectAttachment: import('../..').OvermapSelectorWithArgs<string, Stored<ProjectAttachment> | undefined>;
|
|
15
15
|
protected buildOfflineAttachment(data: BuildOfflineAttachmentData): import('../..').UUID<{
|
|
16
16
|
file: string;
|
|
17
17
|
file_sha1: string;
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { Organization, OrganizationAccess,
|
|
1
|
+
import { Organization, OrganizationAccess, User } from '../../typings';
|
|
2
2
|
import { ModelState } from '../adapters';
|
|
3
3
|
import { OvermapRootState, OvermapSelector, OvermapSelectorWithArgs } from '../typings';
|
|
4
|
-
export type OrganizationAccessState = ModelState<OrganizationAccess["uuid"],
|
|
4
|
+
export type OrganizationAccessState = ModelState<OrganizationAccess["uuid"], OrganizationAccess>;
|
|
5
5
|
export declare const organizationAccessSlice: import('@reduxjs/toolkit').Slice<OrganizationAccessState, {
|
|
6
|
-
initializeOrganizationAccesses: (state: ModelState<string,
|
|
7
|
-
payload:
|
|
6
|
+
initializeOrganizationAccesses: (state: ModelState<string, OrganizationAccess>, action: {
|
|
7
|
+
payload: OrganizationAccess[];
|
|
8
8
|
type: string;
|
|
9
9
|
}) => void;
|
|
10
|
-
addOrganizationAccess: (state: ModelState<string,
|
|
11
|
-
payload:
|
|
10
|
+
addOrganizationAccess: (state: ModelState<string, OrganizationAccess>, action: {
|
|
11
|
+
payload: OrganizationAccess;
|
|
12
12
|
type: string;
|
|
13
13
|
}) => void;
|
|
14
|
-
addOrganizationAccesses: (state: ModelState<string,
|
|
15
|
-
payload:
|
|
14
|
+
addOrganizationAccesses: (state: ModelState<string, OrganizationAccess>, action: {
|
|
15
|
+
payload: OrganizationAccess[];
|
|
16
16
|
type: string;
|
|
17
17
|
}) => void;
|
|
18
|
-
setOrganizationAccess: (state: ModelState<string,
|
|
19
|
-
payload:
|
|
18
|
+
setOrganizationAccess: (state: ModelState<string, OrganizationAccess>, action: {
|
|
19
|
+
payload: OrganizationAccess;
|
|
20
20
|
type: string;
|
|
21
21
|
}) => void;
|
|
22
|
-
setOrganizationAccesses: (state: ModelState<string,
|
|
23
|
-
payload:
|
|
22
|
+
setOrganizationAccesses: (state: ModelState<string, OrganizationAccess>, action: {
|
|
23
|
+
payload: OrganizationAccess[];
|
|
24
24
|
type: string;
|
|
25
25
|
}) => void;
|
|
26
|
-
updateOrganizationAccess: (state: ModelState<string,
|
|
27
|
-
payload:
|
|
26
|
+
updateOrganizationAccess: (state: ModelState<string, OrganizationAccess>, action: {
|
|
27
|
+
payload: OrganizationAccess;
|
|
28
28
|
type: string;
|
|
29
29
|
}) => void;
|
|
30
|
-
updateOrganizationAccesses: (state: ModelState<string,
|
|
31
|
-
payload:
|
|
30
|
+
updateOrganizationAccesses: (state: ModelState<string, OrganizationAccess>, action: {
|
|
31
|
+
payload: OrganizationAccess[];
|
|
32
32
|
type: string;
|
|
33
33
|
}) => void;
|
|
34
|
-
deleteOrganizationAccess: (state: ModelState<string,
|
|
34
|
+
deleteOrganizationAccess: (state: ModelState<string, OrganizationAccess>, action: {
|
|
35
35
|
payload: string;
|
|
36
36
|
type: string;
|
|
37
37
|
}) => void;
|
|
38
|
-
deleteOrganizationAccesses: (state: ModelState<string,
|
|
38
|
+
deleteOrganizationAccesses: (state: ModelState<string, OrganizationAccess>, action: {
|
|
39
39
|
payload: string[];
|
|
40
40
|
type: string;
|
|
41
41
|
}) => void;
|
|
42
42
|
}, "organizationAccess", "organizationAccess", import('@reduxjs/toolkit').SliceSelectors<OrganizationAccessState>>;
|
|
43
|
-
export declare const initializeOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<
|
|
43
|
+
export declare const initializeOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess[], "organizationAccess/initializeOrganizationAccesses">, addOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess, "organizationAccess/addOrganizationAccess">, addOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess[], "organizationAccess/addOrganizationAccesses">, setOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess, "organizationAccess/setOrganizationAccess">, setOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess[], "organizationAccess/setOrganizationAccesses">, updateOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess, "organizationAccess/updateOrganizationAccess">, updateOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<OrganizationAccess[], "organizationAccess/updateOrganizationAccesses">, deleteOrganizationAccess: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "organizationAccess/deleteOrganizationAccess">, deleteOrganizationAccesses: import('@reduxjs/toolkit').ActionCreatorWithPayload<string[], "organizationAccess/deleteOrganizationAccesses">;
|
|
44
44
|
export declare const organizationAccessReducer: import('redux').Reducer<OrganizationAccessState>;
|
|
45
|
-
export declare const selectOrganizationAccessMapping: (state: OvermapRootState) => Record<string,
|
|
45
|
+
export declare const selectOrganizationAccessMapping: (state: OvermapRootState) => Record<string, OrganizationAccess>;
|
|
46
46
|
export declare const selectOrganizationAccessById: OvermapSelectorWithArgs<OrganizationAccess["uuid"], OrganizationAccess | undefined>;
|
|
47
47
|
export declare const selectActiveOrganizationAccess: OvermapSelector<OrganizationAccess | null>;
|
|
48
48
|
export declare const selectOrganizationAccessUserMapping: OvermapSelector<Record<User["id"], OrganizationAccess>>;
|
|
@@ -45,6 +45,6 @@ export declare const projectAccessReducer: import('redux').Reducer<ProjectAccess
|
|
|
45
45
|
export declare const selectProjectAccessMapping: (state: OvermapRootState) => Record<string, Stored<ProjectAccess>>;
|
|
46
46
|
export declare const selectProjectAccesses: OvermapSelector<Stored<ProjectAccess>[]>;
|
|
47
47
|
export declare const selectProjectAccessById: OvermapSelectorWithArgs<ProjectAccess["uuid"], Stored<ProjectAccess> | undefined>;
|
|
48
|
-
export declare const selectProjectAccessesOfProject: OvermapSelectorWithArgs<ProjectAccess["uuid"], ProjectAccess[]>;
|
|
48
|
+
export declare const selectProjectAccessesOfProject: OvermapSelectorWithArgs<ProjectAccess["uuid"], Stored<ProjectAccess>[]>;
|
|
49
49
|
export declare const selectAccessesByUserOfProject: OvermapSelectorWithArgs<Project["uuid"], Record<User["id"], Stored<ProjectAccess>>>;
|
|
50
50
|
export declare const selectUsersOfProject: OvermapSelectorWithArgs<Project["uuid"], User[]>;
|
|
@@ -43,6 +43,6 @@ export declare const projectAttachmentSlice: import('@reduxjs/toolkit').Slice<Pr
|
|
|
43
43
|
export declare const initializeProjectAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>[], "projectAttachments/initializeProjectAttachments">, addProjectAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>, "projectAttachments/addProjectAttachment">, addProjectAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>[], "projectAttachments/addProjectAttachments">, setProjectAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>, "projectAttachments/setProjectAttachment">, setProjectAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>[], "projectAttachments/setProjectAttachments">, updateProjectAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>, "projectAttachments/updateProjectAttachment">, updateProjectAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<Stored<ProjectAttachment>[], "projectAttachments/updateProjectAttachments">, deleteProjectAttachment: import('@reduxjs/toolkit').ActionCreatorWithPayload<string, "projectAttachments/deleteProjectAttachment">, deleteProjectAttachments: import('@reduxjs/toolkit').ActionCreatorWithPayload<string[], "projectAttachments/deleteProjectAttachments">;
|
|
44
44
|
export declare const selectProjectAttachmentMapping: (state: OvermapRootState) => Record<string, Stored<ProjectAttachment>>;
|
|
45
45
|
export declare const selectAllProjectAttachments: OvermapSelector<Stored<ProjectAttachment>[]>;
|
|
46
|
-
export declare const selectProjectAttachmentById: OvermapSelectorWithArgs<ProjectAttachment["uuid"], ProjectAttachment | undefined>;
|
|
46
|
+
export declare const selectProjectAttachmentById: OvermapSelectorWithArgs<ProjectAttachment["uuid"], Stored<ProjectAttachment> | undefined>;
|
|
47
47
|
export declare const selectAttachmentsOfProject: (args: string) => (state: OvermapRootState) => Stored<ProjectAttachment>[];
|
|
48
48
|
export declare const projectAttachmentReducer: import('redux').Reducer<ProjectAttachmentState>;
|
|
@@ -139,7 +139,7 @@ export declare const selectProjectFiles: ((state: {
|
|
|
139
139
|
argsMemoize: typeof import('reselect').weakMapMemoize;
|
|
140
140
|
memoize: typeof import('reselect').weakMapMemoize;
|
|
141
141
|
};
|
|
142
|
-
export declare const selectProjectFileById: OvermapSelectorWithArgs<ProjectFile["uuid"], ProjectFile | undefined>;
|
|
142
|
+
export declare const selectProjectFileById: OvermapSelectorWithArgs<ProjectFile["uuid"], Stored<ProjectFile> | undefined>;
|
|
143
143
|
export declare const selectActiveProjectFileId: OvermapSelector<ProjectFile["uuid"] | null>;
|
|
144
144
|
export declare const selectIsImportingProjectFile: OvermapSelector<boolean>;
|
|
145
145
|
export declare const projectFileReducer: import('redux').Reducer<ProjectFileState>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileModel, FileWithNameModel } from '../files';
|
|
2
|
-
import { CreatedByModel, SubmittedAtModel, UUIDModel } from './base';
|
|
3
|
-
export interface Attachment extends UUIDModel, SubmittedAtModel, FileWithNameModel, CreatedByModel {
|
|
2
|
+
import { CreatedByModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
|
+
export interface Attachment extends UUIDModel, TimestampedModel, SubmittedAtModel, FileWithNameModel, CreatedByModel {
|
|
4
4
|
description?: string;
|
|
5
5
|
file_type: string;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreatedByModel, IndexedModel, Payload, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
2
2
|
import { FieldsAttachmentModel, FieldsModel, FieldValuesAttachmentModel, FieldValuesModel } from './fields';
|
|
3
|
-
export interface Form extends UUIDModel, SubmittedAtModel, CreatedByModel {
|
|
3
|
+
export interface Form extends UUIDModel, TimestampedModel, SubmittedAtModel, CreatedByModel {
|
|
4
4
|
organization: string;
|
|
5
5
|
}
|
|
6
6
|
export interface FormRevision extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, FieldsModel {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileWithNameModel } from '../files';
|
|
2
|
-
import { CanvasMarkableModel, CreatedByModel, IndexedModel, MarkableModel, Payload, SubmittedAtModel, UUIDModel } from './base';
|
|
2
|
+
import { CanvasMarkableModel, CreatedByModel, IndexedModel, MarkableModel, Payload, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { Project } from './projects';
|
|
4
|
-
export interface GeoImage extends UUIDModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, FileWithNameModel, IndexedModel {
|
|
4
|
+
export interface GeoImage extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, MarkableModel, CanvasMarkableModel, FileWithNameModel, IndexedModel {
|
|
5
5
|
title?: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
project: Project["uuid"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ColorModel, CreatedByModel, IconModel, SubmittedAtModel, UUIDModel } from './base';
|
|
1
|
+
import { ColorModel, CreatedByModel, IconModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
2
2
|
import { Organization } from './organizations';
|
|
3
|
-
export interface IssueType extends UUIDModel, SubmittedAtModel, IconModel, ColorModel, CreatedByModel {
|
|
3
|
+
export interface IssueType extends UUIDModel, SubmittedAtModel, TimestampedModel, IconModel, ColorModel, CreatedByModel {
|
|
4
4
|
name?: string;
|
|
5
5
|
description?: string;
|
|
6
6
|
organization: Organization["uuid"];
|
|
@@ -3,7 +3,7 @@ import { CSSColor } from '../colors';
|
|
|
3
3
|
import { CanvasMarkableModel, CreatedByModel, IndexedModel, MarkableModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
4
4
|
import { FieldsAttachmentModel, FieldsModel, FieldValuesModel } from './fields';
|
|
5
5
|
import { User } from './users';
|
|
6
|
-
export interface Issue extends UUIDModel, SubmittedAtModel, CreatedByModel, MarkableModel, CanvasMarkableModel, IndexedModel {
|
|
6
|
+
export interface Issue extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, MarkableModel, CanvasMarkableModel, IndexedModel {
|
|
7
7
|
title?: string | null;
|
|
8
8
|
description?: string | null;
|
|
9
9
|
priority: IssuePriority;
|
|
@@ -35,12 +35,11 @@ export interface IssueUpdateChangeTypes {
|
|
|
35
35
|
} | null;
|
|
36
36
|
due_date: string;
|
|
37
37
|
}
|
|
38
|
-
export interface IssueUpdate extends UUIDModel, CreatedByModel {
|
|
39
|
-
submitted_at: string;
|
|
38
|
+
export interface IssueUpdate extends UUIDModel, CreatedByModel, SubmittedAtModel, TimestampedModel {
|
|
40
39
|
issue: UUIDModel["uuid"];
|
|
41
40
|
changes: Partial<Record<IssueUpdateChange, IssueUpdateChangeTypes[IssueUpdateChange]>>;
|
|
42
41
|
}
|
|
43
|
-
export interface IssueAssociation extends UUIDModel, SubmittedAtModel, CreatedByModel {
|
|
42
|
+
export interface IssueAssociation extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel {
|
|
44
43
|
associated_issue: string;
|
|
45
44
|
issue?: string;
|
|
46
45
|
asset?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { OrganizationAccessLevel } from '../../enums';
|
|
2
|
-
import { UUIDModel } from './base';
|
|
2
|
+
import { TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { User } from './users';
|
|
4
|
-
export interface Organization extends UUIDModel {
|
|
4
|
+
export interface Organization extends UUIDModel, TimestampedModel {
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
|
-
export interface OrganizationAccess extends UUIDModel {
|
|
7
|
+
export interface OrganizationAccess extends UUIDModel, TimestampedModel {
|
|
8
8
|
user: User["id"];
|
|
9
9
|
organization: string;
|
|
10
10
|
access_level: OrganizationAccessLevel;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { FileWithNameModel } from '../files';
|
|
2
|
-
import { BoundableModel, CanvasBoundableModel, SubmittedAtModel, UUIDModel } from './base';
|
|
2
|
+
import { BoundableModel, CanvasBoundableModel, CreatedByModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { OrganizationAccess } from './organizations';
|
|
4
4
|
import { User } from './users';
|
|
5
|
-
export interface Project extends UUIDModel, BoundableModel, CanvasBoundableModel {
|
|
5
|
+
export interface Project extends UUIDModel, TimestampedModel, BoundableModel, CanvasBoundableModel, CreatedByModel {
|
|
6
6
|
name: string;
|
|
7
7
|
organization: string;
|
|
8
8
|
}
|
|
9
|
-
export interface ProjectFile extends UUIDModel, SubmittedAtModel, FileWithNameModel, BoundableModel, CanvasBoundableModel {
|
|
9
|
+
export interface ProjectFile extends UUIDModel, SubmittedAtModel, TimestampedModel, FileWithNameModel, BoundableModel, CanvasBoundableModel, CreatedByModel {
|
|
10
10
|
z_index: number;
|
|
11
11
|
project: Project["uuid"];
|
|
12
12
|
}
|
|
13
|
-
export interface ProjectAccess extends UUIDModel {
|
|
13
|
+
export interface ProjectAccess extends UUIDModel, CreatedByModel, TimestampedModel {
|
|
14
14
|
user: User["id"];
|
|
15
15
|
project: Project["uuid"];
|
|
16
16
|
organization_access: OrganizationAccess["uuid"];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ColorModel, IconModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
1
|
+
import { ColorModel, CreatedByModel, IconModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
2
2
|
import { Organization } from './organizations';
|
|
3
3
|
import { User } from './users';
|
|
4
|
-
export interface Team extends UUIDModel, SubmittedAtModel, IconModel, ColorModel {
|
|
4
|
+
export interface Team extends UUIDModel, TimestampedModel, SubmittedAtModel, IconModel, ColorModel, CreatedByModel {
|
|
5
5
|
name: string;
|
|
6
6
|
parent: Team["uuid"] | null;
|
|
7
7
|
organization: Organization["uuid"];
|
|
8
8
|
}
|
|
9
|
-
export interface TeamMembership extends UUIDModel, TimestampedModel {
|
|
9
|
+
export interface TeamMembership extends UUIDModel, TimestampedModel, CreatedByModel {
|
|
10
10
|
team: Team["uuid"];
|
|
11
11
|
user: User["id"];
|
|
12
12
|
}
|
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-organization-owner-rename.
|
|
6
|
+
"version": "1.0.78-organization-owner-rename.2",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/overmap-core.umd.cjs",
|
|
9
9
|
"module": "dist/overmap-core.js",
|