@overmap-ai/core 1.0.74-geojson-layers.1 → 1.0.74-geojson-layers.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.
@@ -5316,7 +5316,7 @@ class hg extends I {
5316
5316
  method: u.GET,
5317
5317
  url: "/geojson-features/",
5318
5318
  queryParams: {
5319
- geojson_layer: e
5319
+ project: e
5320
5320
  },
5321
5321
  blockers: [],
5322
5322
  blocks: []
@@ -11,5 +11,5 @@ Action:`,e);const p=_e();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(y)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??u+"."+p;if(d=Xa(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,u),vt[c]=new Promise(y=>{y(d)})}return d}}class zS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{revisionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_revision:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,form_revision:u};r.push(I)}this.dispatch(nd(c));const o=this.enqueueRequest({description:"Attach files to form revision",method:h.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.form_revision),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(cd(d.attachments))}).catch(()=>{this.dispatch(rd(c.map(d=>d.uuid)))}),[c,o.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:h.GET,url:"/form-revision-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(ad(s))}}class DS extends E{add(e){var o;const{store:s}=this.client,n=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,c=F({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ni(c));const r=this.enqueueRequest({description:"Create form revision",method:h.POST,url:"/form-revisions/",payload:O(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ld(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization form revisions",method:h.GET,url:"/form-revisions/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(hd(s))}}class US extends E{add(e,s){var d;const{store:a}=this.client,n=new Date().toISOString(),c=(d=a.getState().userReducer.currentUser)==null?void 0:d.id,r=F({...e,submitted_at:n,created_by:c}),o=F({...s,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(di(r)),this.dispatch(ni(o));const m=this.enqueueRequest({description:"Create form",method:h.POST,url:"/forms/",payload:{...O(r),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[r.uuid,o.uuid]});return m.catch(u=>{throw this.dispatch(oi(r.uuid)),this.dispatch(ci(o.uuid)),u}),[r,o,m]}async delete(e){const{store:s}=this.client,a=s.getState(),n=Fd(e)(a);if(!n)throw new Error("Expected form to exist");const c=qd(e)(a);c.length>0&&this.dispatch(ft(c.map(({uuid:o})=>o)));const r=yd(e)(a);r.length>0&&this.dispatch(pd(r.map(({uuid:o})=>o))),this.dispatch(oi(e));try{return await this.enqueueRequest({description:"Delete form",method:h.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(di(n)),r.length>0&&this.dispatch(md(r)),c.length>0&&this.dispatch(yt(c)),o}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization forms",method:h.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(gd(s))}}class VS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{submissionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_submission:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,form_submission:u};r.push(I)}this.dispatch(mt(c));const o=this.enqueueRequest({description:"Attach files to form submission",method:h.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.form_submission),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(Pd(d.attachments))}).catch(d=>{throw this.dispatch(pt(c.map(u=>u.uuid))),d}),[c,o.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),n=Od(e)(a);this.dispatch(pt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:h.DELETE,url:"/form-submission-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(mt(n)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get form submission attachments",method:h.GET,url:"/form-submission-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Rd(s))}}class GS extends E{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:h.POST,url:"/form-submissions/",payload:O(n),blockers:["add-form-entry",e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(mi(n)),c.then(o=>(this.dispatch(At(o)),o)).catch(()=>{this.dispatch(pi(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=fi(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(jd(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:h.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(o=>{this.dispatch(At(o))}).catch(()=>{this.dispatch(At(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=fi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=_d(e)(a);this.dispatch(pi(e)),this.dispatch(pt(c.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(mi(n)),this.dispatch(mt(c)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch form submissions",method:h.GET,url:"/form-submissions/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Ed(s))}}class $S extends E{async add(e){var p;const{store:s}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=s.getState().userReducer.currentUser)==null?void 0:p.id,o=n.project,m=await this.getFilePayload(a),d=F({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Vd(d));const u=this.enqueueRequest({description:"Add geo image",method:h.POST,url:"/geo-images/",payload:{uuid:d.uuid,submitted_at:c,title:d.title,description:d.description,geo_marker:d.geo_marker,canvas_marker:d.canvas_marker,sha1:d.file_sha1,project:d.project,file_name:d.file_name,direction:d.direction,original_date:d.original_date,file:m},blocks:[o],blockers:[o]});return u.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(We(A.geo_image))}).catch(()=>{this.dispatch(gi(d.uuid))}),[d,u.then(A=>A.geo_image)]}async bulkAdd(e,s){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],o=[],m=[],d={};for(const A of e){const{file:y,...b}=A,I=await this.getFilePayload(y);I.sha1 in d||(d[I.sha1]=I);const R=F({...b,file_name:y.name,file_sha1:I.sha1,file:URL.createObjectURL(y),submitted_at:n,created_by:c,project:s});r.push(R),o.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(Gd(r));const u=this.enqueueRequest({description:"Bulk add geo images",method:h.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:s,geo_images:m,files:Object.values(d)},blocks:[s],blockers:o});return u.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Ud(A.geo_images))}).catch(()=>{this.dispatch(Ld(o))}),[r,u.then(A=>A.geo_images)]}update(e){const{store:s}=this.client,a=s.getState(),n=bi(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch($d(c));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(o=>{this.dispatch(We(o))}).catch(()=>{this.dispatch(We(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=bi(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(gi(e));const c=this.enqueueRequest({description:"Delete geo image",method:h.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(We(n))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get geo images",method:h.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]});this.dispatch(Dd(s))}}class LS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Fi(c));const r=this.enqueueRequest({description:"Create GeoJSON feature",method:h.POST,url:"/geojson-features/",payload:O(c),blockers:[c.geojson_layer],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Ke(m))}).catch(()=>{this.dispatch(Ii(c.uuid))}),[c,r]}update(e){const{store:s}=this.client,a=Pi(e.uuid)(s.getState());if(!a)throw new Error(`No GeoJSON feature with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Ke(n));const c=this.enqueueRequest({description:"Edit GeoJSON feature",method:h.PATCH,url:`/geojson-features/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ke(r))}).catch(()=>{this.dispatch(Ke(a))}),[n,c]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Pi(e)(a);if(!n)throw new Error(`No GeoJSON feature with uuid ${e} found in the store`);return this.dispatch(Ii(e)),this.enqueueRequest({description:"Delete GeoJSON feature",method:h.DELETE,url:`/geojson-features/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Fi(n)),c})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get GeoJSON features",method:h.GET,url:"/geojson-features/",queryParams:{geojson_layer:e},blockers:[],blocks:[]});this.dispatch(Wd(s))}}class BS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create GeoJSON layer",method:h.POST,url:"/geojson-layers/",payload:O(c),blockers:[c.project],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Ye(m))}).catch(()=>{this.dispatch(vi(c.uuid))}),[c,r]}update(e){const{store:s}=this.client,a=Ei(e.uuid)(s.getState());if(!a)throw new Error(`No GeoJSON layer with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Ye(n));const c=this.enqueueRequest({description:"Edit GeoJSON layer",method:h.PATCH,url:`/geojson-layers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ye(r))}).catch(()=>{this.dispatch(Ye(a))}),[n,c]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Ei(e)(a);if(!n)throw new Error(`No GeoJSON layer with uuid ${e} found in the store`);const c=Qd(e)(a);if(this.dispatch(vi(e)),c.length>0){const r=c.map(({uuid:o})=>o);this.dispatch(Yd(r))}return this.enqueueRequest({description:"Delete GeoJSON layer",method:h.DELETE,url:`/geojson-layers/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(_i(n)),this.dispatch(Kd(c)),r})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get GeoJSON layers",method:h.GET,url:"/geojson-layers/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(eo(s))}}class NS extends P{add(e){var o;const{store:s}=this.client,a=new Date().toISOString(),n=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,c=F({...e,submitted_at:a,created_by:n});this.dispatch(qi(c));const r=this.enqueueRequest({description:"Add issue association",method:h.POST,url:"/issue-associations/",payload:O(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(no(m))}).catch(()=>{this.dispatch(ki(c.uuid))}),[c,r]}async delete(e){const{store:s}=this.client,a=co(e)(s.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(ki(e));const n=this.enqueueRequest({description:"Delete issue association",method:h.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(qi(a))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch issue associations",method:h.GET,url:"/issue-associations/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(ao(s))}}class JS extends be{constructor(){super(...arguments);f(this,"name","Issue Attachment");f(this,"url","/issue-attachments");f(this,"initializeAttachments",Di);f(this,"addAttachments",Ui);f(this,"updateAttachments",po);f(this,"removeAttachments",Vi);f(this,"removeAttachment",Ao);f(this,"setAttachment",mo);f(this,"selectAttachment",go)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch(Di(a))}}class HS extends be{constructor(){super(...arguments);f(this,"name","Issue Comment Attachment");f(this,"url","/issue-comment-attachments");f(this,"initializeAttachments",$i);f(this,"addAttachments",Fo);f(this,"updateAttachments",Ro);f(this,"removeAttachments",Oo);f(this,"removeAttachment",Po);f(this,"setAttachment",Io);f(this,"selectAttachment",wo)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_comment:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_comment:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue comment attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch($i(a))}}class WS extends P{add(e){var c;const{store:s}=this.client,a=F({...e,author:(c=s.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ni(a));const n=this.enqueueRequest({description:"Add issue comment",method:h.POST,url:"/issue-comments/",payload:O(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ji(a.uuid))}),[a,n]}update(e){const{store:s}=this.client,a=Hi(e.uuid)(s.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Bi(n));const c=this.enqueueRequest({description:"Edit issue comment",method:h.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Bi(a))}),[n,c]}remove(e){const{store:s}=this.client,a=Hi(e)(s.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ji(e));const n=this.enqueueRequest({description:"Delete comment",method:h.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ni(a))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Get comments",method:h.GET,url:"/issue-comments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(qo(s))}}class KS extends P{add(e){var m;const{store:s}=this.client,a=s.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=F({...e,submitted_at:n,created_by:c});this.dispatch(Ki(r));const o=this.enqueueRequest({description:"Create issue",method:h.POST,url:"/issues/",payload:O(r),blockers:["add-issue",r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return o.then(d=>{this.dispatch(St(d))}).catch(d=>{throw this.dispatch(Yi(r.uuid)),d}),[r,o]}update(e){var m;const s=this.client.store.getState(),a=Xi(e.uuid)(s);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(St(n));const c={};for(const d of[v.TITLE,v.DESCRIPTION,v.STATUS,v.CATEGORY,v.PRIORITY,v.ASSIGNED_TO,v.DUE_DATE])if(d in e&&e[d]!==a[d])switch(d){case v.PRIORITY:case v.STATUS:{const u=e[d];c[d]=u!==void 0?Number(u):null;break}case v.DUE_DATE:case v.DESCRIPTION:case v.TITLE:c[d]=e[d]??null;break;case v.CATEGORY:{let u=null;const p=e[d];if(p&&(u=s.categoryReducer.instances[p]??null,!u))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[d]=u?{name:u.name,color:u.color,uuid:u.uuid}:null;break}case v.ASSIGNED_TO:{let u=null;const p=e[d];if(p&&(u=s.userReducer.instances[p]??null,!u))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[d]=u?{full_name:u.username,id:u.id}:null;break}}const r=F({created_by:(m=s.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(qu(r));const o=this.enqueueRequest({description:"Edit issue",method:h.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.catch(()=>{this.dispatch(St(a)),this.dispatch(ku(r.uuid))}),[n,o]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Xi(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=So(e)(a),r=Du(e)(a),o=Md(e)(a),m={};for(const u of ro(e)(a))m[u.uuid]=u;for(const u of oo(e)(a))m[u.uuid]=u;const d=Object.values(m);this.dispatch(Yi(e)),c.length>0&&this.dispatch(Vi(c.map(({uuid:u})=>u))),r.length>0&&this.dispatch(Cu(r.map(({uuid:u})=>u))),o.length>0&&this.dispatch(ft(o.map(({uuid:u})=>u))),d.length>0&&this.dispatch(Ci(d.map(({uuid:u})=>u)));try{return await this.enqueueRequest({description:"Delete issue",method:h.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(Ki(n)),this.dispatch(Ui(c)),this.dispatch(Mu(r)),this.dispatch(yt(o)),this.dispatch(Mi(d)),u}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issues",method:h.GET,url:"/issues/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(zo(s))}}class YS extends be{constructor(){super(...arguments);f(this,"name","Issue Type Attachment");f(this,"url","/issue-type-attachments");f(this,"initializeAttachments",Zi);f(this,"addAttachments",Lo);f(this,"updateAttachments",No);f(this,"removeAttachments",Ho);f(this,"removeAttachment",Jo);f(this,"setAttachment",Bo);f(this,"selectAttachment",Yo)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_type:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_type:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue type attachments",method:h.GET,url:`${this.url}/`,queryParams:{organization:s},blocks:[],blockers:[]});this.dispatch(Zi(a))}}class XS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{fieldsRevisionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_extension:y.extension,field_identifier:p,file_sha1:y.sha1,fields_revision:u};r.push(I)}this.dispatch(xo(c));const o=this.enqueueRequest({description:"Add issue type fields attachments",method:h.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.fields_revision),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(eu(d.attachments))}).catch(()=>{this.dispatch(tu(c.map(d=>d.uuid)))}),[c,o.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"get issue type fields attachments",method:h.GET,url:"/issue-type-fields-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(Zo(s))}}class QS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(lu(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:h.POST,url:"/issue-type-fields/",payload:O(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(hu(m))}).catch(m=>{throw this.dispatch(mu(c.uuid)),m}),[c,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Issue Type Fields",method:h.GET,url:"/issue-type-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(uu(s))}}class ZS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{fieldValuesUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,field_values:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,field_values:u};r.push(I)}this.dispatch(bt(c));const o=this.enqueueRequest({description:"Add issue type field values attachments",method:h.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.field_values),blocks:c.map(d=>d.uuid)});return o.then(({presigned_urls:d,attachments:u})=>{this.processPresignedUrls(d),this.dispatch(Su(u))}).catch(d=>{throw this.dispatch(Tt(c.map(u=>u.uuid))),d}),[c,o.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),n=bu(e)(a);this.dispatch(Tt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:h.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(bt(n)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values attachments",method:h.GET,url:"/issue-type-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(fu(s))}}class xS extends P{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:h.POST,url:"/issue-type-field-values/",payload:O(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(ta(n)),c.then(o=>(this.dispatch(Qe(o)),o)).catch(()=>{this.dispatch(sa(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=aa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Qe(c));const r=this.enqueueRequest({description:"Update issue type field values",method:h.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(o=>{this.dispatch(Qe(o))}).catch(()=>{this.dispatch(Qe(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=aa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Tu(e)(a);this.dispatch(sa(e)),this.dispatch(Tt(c.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(ta(n)),this.dispatch(bt(c)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values",method:h.GET,url:"/issue-type-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(cu(s))}}class eg extends P{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Pu(n));const c=this.enqueueRequest({method:h.POST,url:"/issue-types/",payload:O(n),blockers:[],blocks:[n.uuid]});return c.then(o=>{this.dispatch(Ze(o))}).catch(()=>{this.dispatch(oa(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=ua(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Ou(c));const r=this.enqueueRequest({method:h.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(o=>{this.dispatch(Ze(o))}).catch(()=>{this.dispatch(Ze(n))}),[c,r]}delete(e){const{store:s}=this.client,a=s.getState(),n=ua(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=la(e)(a);this.dispatch(oa(e)),this.dispatch(Uo(c.map(o=>o.uuid)));const r=this.enqueueRequest({method:h.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(Ze(n)),this.dispatch(Do(c))}),r}async refreshStore(e){const s=await this.enqueueRequest({method:h.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Ru(s))}}class tg extends P{async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue updates",method:h.GET,url:"/issue-updates/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(ju(s))}}const sg=1800;function ig(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 ag extends uS{constructor(){super(...arguments);f(this,"_getRenewedTokens",async s=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:h.POST,url:this.refreshTokensUrl,payload:{refresh:s},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Tr(!1)),this.clearTokens(),this.dispatch({type:_h.RESET_STATE}),this.dispatch({type:ph})}async renewTokens(){const s=this.getRefreshToken();if(!s)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(s);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 s=this.getAccessToken();if(!s)return!1;const a=Date.now()/1e3;let n;try{n=vh(s).exp??a}catch{n=a}return n-a<sg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(s){return s instanceof q&&this.clearAuth(),s instanceof Error?Promise.reject(s):Promise.reject(new Error((s??De).toString()))}}}async handleUnauthorized(s,a){const n=this.client.store.getState();if(s.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new q({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new q({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(s){const a=Te.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:h.POST,url:this.initTokensUrl,payload:s,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(ig(n))})}}class ng extends P{async getLicense(e){const s=await this.enqueueRequest({description:"Get license",method:h.GET,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async pauseLicense(e){const s=await this.enqueueRequest({description:"Pause license",method:h.DELETE,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async resumeLicense(e){const s=await this.enqueueRequest({description:"Resume license",method:h.PATCH,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async cancelLicense(e){const s=await this.enqueueRequest({description:"Cancel license",method:h.DELETE,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async attachLicenseToProject(e,s){const a=await this.enqueueRequest({description:"Attach license",method:h.PATCH,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,payload:{project:s.uuid},blockers:[e.organization_owner,s.uuid],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(fe(a)),a}async detachLicenseFromProject(e){const s=await this.enqueueRequest({description:"Detach license",method:h.DELETE,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(fe(s)),s}async getLatestTransaction(e){return await this.enqueueRequest({description:"Get latest transaction",method:h.GET,url:`/billing/${e.uuid}/transaction/`,isAuthNeeded:!0,blockers:[e.uuid],blocks:[e.uuid]})}async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/organizations/${s}/licenses/`,isAuthNeeded:!0,blockers:[s],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of n)a[r.uuid]=r;const c=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/projects/${e}/licenses/`,isAuthNeeded:!0,blockers:[e],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of c)a[r.uuid]=r;this.dispatch(Gu(Object.values(a)))}}class cg extends P{async update(e){const s=this.enqueueRequest({description:"Edit organization access",method:h.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return s.then(()=>{this.dispatch(Yu(e))}),s}async remove(e){return this.dispatch(Xu(e.uuid)),this.dispatch(Ju(e.user)),this.enqueueRequest({description:"Remove organization access",method:h.DELETE,url:`/organization-accesses/${e.uuid}/`,blockers:[e.uuid],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization accesses",method:h.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Ku(s))}}class rg extends P{create(e){return this.enqueueRequest({description:"Create organization",method:h.POST,url:"/organizations/",payload:{name:e},blockers:[],blocks:[`add-org-${e}`,"create-org"]})}async update(e){return this.enqueueRequest({description:"Edit organization",method:h.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[`add-org-${e.name}`,e.uuid],blocks:[e.uuid]})}async invite(e,s){return this.enqueueRequest({description:"Invite user to organization",method:h.POST,url:`/organizations/${e}/invite/${s}/`,blockers:[],blocks:[]})}async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Get organizations",method:h.GET,url:`/projects/${e}/organizations/`,blockers:[],blocks:[]});for(const r of n)a[r.uuid]=r;const c=await this.enqueueRequest({description:"Get organization",method:h.GET,url:`/organizations/${s}/`,blockers:[],blocks:[]});a[c.uuid]=c,this.dispatch(Al(Object.values(a)))}}class dg extends P{async update(e){return this.dispatch(el(e)),this.enqueueRequest({description:"Edit project access",method:h.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid,"change-access-level"],blocks:[e.uuid]})}async remove(e){return this.dispatch(tl(e)),this.enqueueRequest({description:"Delete project access",method:h.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project accesses",method:h.GET,url:"/project-accesses/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Sa(s))}}class og extends be{constructor(){super(...arguments);f(this,"name","Project Attachment");f(this,"url","/project-attachments");f(this,"addAttachments",wl);f(this,"updateAttachments",ql);f(this,"removeAttachments",Ra);f(this,"removeAttachment",Ml);f(this,"setAttachment",El);f(this,"selectAttachment",zl)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,project:s.modelUuid})}buildAttachmentPayload(s){return{...s,project:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get project attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blockers:[],blocks:[]});this.dispatch(vl(a))}}class ug extends P{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 s={...e};delete s.file;const a=this.enqueueRequest({method:h.PATCH,url:`/projects/files/${e.uuid}/`,payload:s,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(Oa(n))}),a}saveActive(){const{store:e}=this.client,s=e.getState(),a=s.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=s.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:h.PATCH,url:`/projects/files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,d)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([u])=>{m({method:h.POST,url:`/projects/${n.project}/files/`,payload:{...n,...u},blockers:[a],blocks:[a]})}).catch(d)});const o=Promise.resolve(c).then(m=>this.enqueueRequest(m));return o.then(m=>{this.dispatch(Oa(m))}),this.dispatch(Hl),this.dispatch(Jl(null)),this.dispatch(Nl(!1)),[n,o]}delete(e){return this.dispatch(Ll(e)),this.enqueueRequest({method:h.DELETE,url:`/projects/files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project files",method:h.GET,url:`/projects/${e}/files/`,blockers:[],blocks:[]});this.dispatch(Gl(s))}}class lg extends P{async add(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return await this.enqueueRequest({description:"Create project",method:h.POST,url:"/projects/",payload:{name:e.name,bounds:e.bounds,organization_owner:e.organization_owner},blockers:[],blocks:[]})}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(dl(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:s}=this.client,a=s.getState(),n=_t(a),c=n[e];if(!c)throw new Error("Expected project to exist");const r=Kl(a).filter(u=>u.project===e);this.dispatch(Bl(r.map(({uuid:u})=>u)));const o=Dl(c.uuid)(a);this.dispatch(Ra(o.map(({uuid:u})=>u)));const m=il(a);this.dispatch(sl(m.map(({uuid:u})=>u))),this.dispatch({type:"rehydrated/setRehydrated",payload:!1}),this.dispatch(ol(c.uuid));const d=$u(c.uuid)(a);d&&this.dispatch(fe({...d,project:null}));try{await this.enqueueRequest({description:"Delete project",method:h.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch({type:"rehydrated/setRehydrated",payload:!0})}catch(u){throw this.dispatch(rl(Object.values(n))),this.dispatch(Sa(Object.values(m))),this.dispatch($l(r)),this.dispatch(jl(o)),this.dispatch({type:"rehydrated/setRehydrated",payload:!0}),d&&this.dispatch(fe({...d,project:c.uuid})),u}}invite(e,s){const a=Te.v4();return this.enqueueRequest({description:"Invite user to project",method:h.POST,url:`/projects/${e}/invite/${s}/`,payload:{uuid:a},blockers:[],blocks:[a]})}joinProject(e,s,a){return this.enqueueRequest({description:"Join project",method:h.GET,url:`/projects/${e}/join-project/${s}/${a}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}async acceptInvite(e){return this.enqueueRequest({description:"Accept project invite",method:h.PATCH,url:`/projects/${e}/accept-invite/`,blockers:[e],blocks:[e]}).then(()=>{this.dispatch(ul(e))})}}class hg extends P{add(e){const s=F({...e,submitted_at:new Date().toISOString()});this.dispatch(xl(s));const a=this.enqueueRequest({description:"Create team",method:h.POST,url:"/teams/",payload:s,blockers:[],blocks:[s.uuid]});return a.then(n=>{this.dispatch(Ce(n))}).catch(()=>{this.dispatch(Ea(s.uuid))}),[s,a]}update(e){const{store:s}=this.client,a=ze(e.uuid)(s.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(wa(n));const c=this.enqueueRequest({description:"Update team",method:h.PATCH,url:`/teams/${e.uuid}/`,payload:O(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ce(r))}).catch(()=>{this.dispatch(Ce(a))}),[n,c]}async delete(e){const{store:s}=this.client,a=s.getState(),n=ze(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Ea(e));try{return await this.enqueueRequest({description:"Delete team",method:h.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Ce(n)),c}}async setMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);if(s.length!==new Set(s).size)throw new Error("Duplicate members found in the list");this.dispatch(wa({...n,members:s}));const c=this.enqueueRequest({description:"Set team members",method:h.PUT,url:`/teams/${e}/set-members/`,payload:{users:s},blockers:[e],blocks:[e]});return c.catch(()=>{this.dispatch(Ce(n))}),c}async addMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);const c=[...n.members,...s];return this.setMembers(e,c)}async removeMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);const c=n.members.filter(r=>!s.includes(r));return this.setMembers(e,c)}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch teams",method:h.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Zl(s))}}class mg extends P{async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Fetch organization users",method:h.GET,url:`/organizations/${s}/users/`,blockers:[],blocks:[]});for(const r of n)a[r.id]=r;const c=await this.enqueueRequest({description:"Fetch project users",method:h.GET,url:`/projects/${e}/users/`,blockers:[],blocks:[]});for(const r of c)a[r.id]=r;this.dispatch(Nu(Object.values(a)))}}class pg{constructor(e){f(this,"store");this.store=e}async enqueueRequest(e,s,a){return this._enqueueRequest(e,s,a).then(n=>{if(n instanceof q)throw n;return n})}_enqueueRequest(e,s,a){const n=new Ka,c={...e,BASE_URL:s,serviceName:a};if(e.immediate){const r={...c,uuid:e.uuid??Te.v4()},o={payload:r,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:r,BASE_URL:s,serviceName:a}}}};Ca(o,this).then(m=>{n.resolve(m.body)}).catch(m=>{za(m,o),m instanceof Error?n.reject(m):n.reject(new Error((m??De).toString()))})}else{const r=this.store.dispatch(Il(c)),o=d=>{if(d)n.resolve(d.body);else{const u=new q({message:"Could not get a response from the server.",response:d,discard:!0});n.reject(u)}},m=d=>{d instanceof q?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(y)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??u+"."+p;if(d=Xa(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,u),vt[c]=new Promise(y=>{y(d)})}return d}}class zS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{revisionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_revision:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,field_identifier:p,file_extension:y.extension,file_sha1:y.sha1,form_revision:u};r.push(I)}this.dispatch(nd(c));const o=this.enqueueRequest({description:"Attach files to form revision",method:h.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.form_revision),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(cd(d.attachments))}).catch(()=>{this.dispatch(rd(c.map(d=>d.uuid)))}),[c,o.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization form revision attachments",method:h.GET,url:"/form-revision-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(ad(s))}}class DS extends E{add(e){var o;const{store:s}=this.client,n=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,c=F({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ni(c));const r=this.enqueueRequest({description:"Create form revision",method:h.POST,url:"/form-revisions/",payload:O(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ld(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization form revisions",method:h.GET,url:"/form-revisions/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(hd(s))}}class US extends E{add(e,s){var d;const{store:a}=this.client,n=new Date().toISOString(),c=(d=a.getState().userReducer.currentUser)==null?void 0:d.id,r=F({...e,submitted_at:n,created_by:c}),o=F({...s,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(di(r)),this.dispatch(ni(o));const m=this.enqueueRequest({description:"Create form",method:h.POST,url:"/forms/",payload:{...O(r),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[r.uuid,o.uuid]});return m.catch(u=>{throw this.dispatch(oi(r.uuid)),this.dispatch(ci(o.uuid)),u}),[r,o,m]}async delete(e){const{store:s}=this.client,a=s.getState(),n=Fd(e)(a);if(!n)throw new Error("Expected form to exist");const c=qd(e)(a);c.length>0&&this.dispatch(ft(c.map(({uuid:o})=>o)));const r=yd(e)(a);r.length>0&&this.dispatch(pd(r.map(({uuid:o})=>o))),this.dispatch(oi(e));try{return await this.enqueueRequest({description:"Delete form",method:h.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(di(n)),r.length>0&&this.dispatch(md(r)),c.length>0&&this.dispatch(yt(c)),o}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch organization forms",method:h.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(gd(s))}}class VS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{submissionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,form_submission:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,form_submission:u};r.push(I)}this.dispatch(mt(c));const o=this.enqueueRequest({description:"Attach files to form submission",method:h.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.form_submission),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(Pd(d.attachments))}).catch(d=>{throw this.dispatch(pt(c.map(u=>u.uuid))),d}),[c,o.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),n=Od(e)(a);this.dispatch(pt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:h.DELETE,url:"/form-submission-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(mt(n)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get form submission attachments",method:h.GET,url:"/form-submission-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Rd(s))}}class GS extends E{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:h.POST,url:"/form-submissions/",payload:O(n),blockers:["add-form-entry",e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(mi(n)),c.then(o=>(this.dispatch(At(o)),o)).catch(()=>{this.dispatch(pi(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=fi(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(jd(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:h.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(o=>{this.dispatch(At(o))}).catch(()=>{this.dispatch(At(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=fi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=_d(e)(a);this.dispatch(pi(e)),this.dispatch(pt(c.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(mi(n)),this.dispatch(mt(c)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch form submissions",method:h.GET,url:"/form-submissions/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Ed(s))}}class $S extends E{async add(e){var p;const{store:s}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=s.getState().userReducer.currentUser)==null?void 0:p.id,o=n.project,m=await this.getFilePayload(a),d=F({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Vd(d));const u=this.enqueueRequest({description:"Add geo image",method:h.POST,url:"/geo-images/",payload:{uuid:d.uuid,submitted_at:c,title:d.title,description:d.description,geo_marker:d.geo_marker,canvas_marker:d.canvas_marker,sha1:d.file_sha1,project:d.project,file_name:d.file_name,direction:d.direction,original_date:d.original_date,file:m},blocks:[o],blockers:[o]});return u.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(We(A.geo_image))}).catch(()=>{this.dispatch(gi(d.uuid))}),[d,u.then(A=>A.geo_image)]}async bulkAdd(e,s){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],o=[],m=[],d={};for(const A of e){const{file:y,...b}=A,I=await this.getFilePayload(y);I.sha1 in d||(d[I.sha1]=I);const R=F({...b,file_name:y.name,file_sha1:I.sha1,file:URL.createObjectURL(y),submitted_at:n,created_by:c,project:s});r.push(R),o.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(Gd(r));const u=this.enqueueRequest({description:"Bulk add geo images",method:h.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:s,geo_images:m,files:Object.values(d)},blocks:[s],blockers:o});return u.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Ud(A.geo_images))}).catch(()=>{this.dispatch(Ld(o))}),[r,u.then(A=>A.geo_images)]}update(e){const{store:s}=this.client,a=s.getState(),n=bi(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch($d(c));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(o=>{this.dispatch(We(o))}).catch(()=>{this.dispatch(We(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=bi(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(gi(e));const c=this.enqueueRequest({description:"Delete geo image",method:h.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(We(n))}),c}async refreshStore(e){const s=await this.enqueueRequest({description:"Get geo images",method:h.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]});this.dispatch(Dd(s))}}class LS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(Fi(c));const r=this.enqueueRequest({description:"Create GeoJSON feature",method:h.POST,url:"/geojson-features/",payload:O(c),blockers:[c.geojson_layer],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Ke(m))}).catch(()=>{this.dispatch(Ii(c.uuid))}),[c,r]}update(e){const{store:s}=this.client,a=Pi(e.uuid)(s.getState());if(!a)throw new Error(`No GeoJSON feature with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Ke(n));const c=this.enqueueRequest({description:"Edit GeoJSON feature",method:h.PATCH,url:`/geojson-features/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ke(r))}).catch(()=>{this.dispatch(Ke(a))}),[n,c]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Pi(e)(a);if(!n)throw new Error(`No GeoJSON feature with uuid ${e} found in the store`);return this.dispatch(Ii(e)),this.enqueueRequest({description:"Delete GeoJSON feature",method:h.DELETE,url:`/geojson-features/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Fi(n)),c})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get GeoJSON features",method:h.GET,url:"/geojson-features/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Wd(s))}}class BS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create GeoJSON layer",method:h.POST,url:"/geojson-layers/",payload:O(c),blockers:[c.project],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Ye(m))}).catch(()=>{this.dispatch(vi(c.uuid))}),[c,r]}update(e){const{store:s}=this.client,a=Ei(e.uuid)(s.getState());if(!a)throw new Error(`No GeoJSON layer with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Ye(n));const c=this.enqueueRequest({description:"Edit GeoJSON layer",method:h.PATCH,url:`/geojson-layers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ye(r))}).catch(()=>{this.dispatch(Ye(a))}),[n,c]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Ei(e)(a);if(!n)throw new Error(`No GeoJSON layer with uuid ${e} found in the store`);const c=Qd(e)(a);if(this.dispatch(vi(e)),c.length>0){const r=c.map(({uuid:o})=>o);this.dispatch(Yd(r))}return this.enqueueRequest({description:"Delete GeoJSON layer",method:h.DELETE,url:`/geojson-layers/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(_i(n)),this.dispatch(Kd(c)),r})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get GeoJSON layers",method:h.GET,url:"/geojson-layers/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(eo(s))}}class NS extends P{add(e){var o;const{store:s}=this.client,a=new Date().toISOString(),n=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,c=F({...e,submitted_at:a,created_by:n});this.dispatch(qi(c));const r=this.enqueueRequest({description:"Add issue association",method:h.POST,url:"/issue-associations/",payload:O(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(no(m))}).catch(()=>{this.dispatch(ki(c.uuid))}),[c,r]}async delete(e){const{store:s}=this.client,a=co(e)(s.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(ki(e));const n=this.enqueueRequest({description:"Delete issue association",method:h.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(qi(a))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch issue associations",method:h.GET,url:"/issue-associations/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(ao(s))}}class JS extends be{constructor(){super(...arguments);f(this,"name","Issue Attachment");f(this,"url","/issue-attachments");f(this,"initializeAttachments",Di);f(this,"addAttachments",Ui);f(this,"updateAttachments",po);f(this,"removeAttachments",Vi);f(this,"removeAttachment",Ao);f(this,"setAttachment",mo);f(this,"selectAttachment",go)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch(Di(a))}}class HS extends be{constructor(){super(...arguments);f(this,"name","Issue Comment Attachment");f(this,"url","/issue-comment-attachments");f(this,"initializeAttachments",$i);f(this,"addAttachments",Fo);f(this,"updateAttachments",Ro);f(this,"removeAttachments",Oo);f(this,"removeAttachment",Po);f(this,"setAttachment",Io);f(this,"selectAttachment",wo)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_comment:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_comment:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue comment attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blocks:[],blockers:[]});this.dispatch($i(a))}}class WS extends P{add(e){var c;const{store:s}=this.client,a=F({...e,author:(c=s.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ni(a));const n=this.enqueueRequest({description:"Add issue comment",method:h.POST,url:"/issue-comments/",payload:O(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ji(a.uuid))}),[a,n]}update(e){const{store:s}=this.client,a=Hi(e.uuid)(s.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Bi(n));const c=this.enqueueRequest({description:"Edit issue comment",method:h.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Bi(a))}),[n,c]}remove(e){const{store:s}=this.client,a=Hi(e)(s.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ji(e));const n=this.enqueueRequest({description:"Delete comment",method:h.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ni(a))}),n}async refreshStore(e){const s=await this.enqueueRequest({description:"Get comments",method:h.GET,url:"/issue-comments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(qo(s))}}class KS extends P{add(e){var m;const{store:s}=this.client,a=s.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=F({...e,submitted_at:n,created_by:c});this.dispatch(Ki(r));const o=this.enqueueRequest({description:"Create issue",method:h.POST,url:"/issues/",payload:O(r),blockers:["add-issue",r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return o.then(d=>{this.dispatch(St(d))}).catch(d=>{throw this.dispatch(Yi(r.uuid)),d}),[r,o]}update(e){var m;const s=this.client.store.getState(),a=Xi(e.uuid)(s);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(St(n));const c={};for(const d of[v.TITLE,v.DESCRIPTION,v.STATUS,v.CATEGORY,v.PRIORITY,v.ASSIGNED_TO,v.DUE_DATE])if(d in e&&e[d]!==a[d])switch(d){case v.PRIORITY:case v.STATUS:{const u=e[d];c[d]=u!==void 0?Number(u):null;break}case v.DUE_DATE:case v.DESCRIPTION:case v.TITLE:c[d]=e[d]??null;break;case v.CATEGORY:{let u=null;const p=e[d];if(p&&(u=s.categoryReducer.instances[p]??null,!u))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[d]=u?{name:u.name,color:u.color,uuid:u.uuid}:null;break}case v.ASSIGNED_TO:{let u=null;const p=e[d];if(p&&(u=s.userReducer.instances[p]??null,!u))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[d]=u?{full_name:u.username,id:u.id}:null;break}}const r=F({created_by:(m=s.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(qu(r));const o=this.enqueueRequest({description:"Edit issue",method:h.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.catch(()=>{this.dispatch(St(a)),this.dispatch(ku(r.uuid))}),[n,o]}async remove(e){const{store:s}=this.client,a=s.getState(),n=Xi(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=So(e)(a),r=Du(e)(a),o=Md(e)(a),m={};for(const u of ro(e)(a))m[u.uuid]=u;for(const u of oo(e)(a))m[u.uuid]=u;const d=Object.values(m);this.dispatch(Yi(e)),c.length>0&&this.dispatch(Vi(c.map(({uuid:u})=>u))),r.length>0&&this.dispatch(Cu(r.map(({uuid:u})=>u))),o.length>0&&this.dispatch(ft(o.map(({uuid:u})=>u))),d.length>0&&this.dispatch(Ci(d.map(({uuid:u})=>u)));try{return await this.enqueueRequest({description:"Delete issue",method:h.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(Ki(n)),this.dispatch(Ui(c)),this.dispatch(Mu(r)),this.dispatch(yt(o)),this.dispatch(Mi(d)),u}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issues",method:h.GET,url:"/issues/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(zo(s))}}class YS extends be{constructor(){super(...arguments);f(this,"name","Issue Type Attachment");f(this,"url","/issue-type-attachments");f(this,"initializeAttachments",Zi);f(this,"addAttachments",Lo);f(this,"updateAttachments",No);f(this,"removeAttachments",Ho);f(this,"removeAttachment",Jo);f(this,"setAttachment",Bo);f(this,"selectAttachment",Yo)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,issue_type:s.modelUuid})}buildAttachmentPayload(s){return{...s,issue_type:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get issue type attachments",method:h.GET,url:`${this.url}/`,queryParams:{organization:s},blocks:[],blockers:[]});this.dispatch(Zi(a))}}class XS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{fieldsRevisionUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,fields_revision:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_extension:y.extension,field_identifier:p,file_sha1:y.sha1,fields_revision:u};r.push(I)}this.dispatch(xo(c));const o=this.enqueueRequest({description:"Add issue type fields attachments",method:h.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.fields_revision),blocks:c.map(d=>d.uuid)});return o.then(d=>{this.processPresignedUrls(d.presigned_urls),this.dispatch(eu(d.attachments))}).catch(()=>{this.dispatch(tu(c.map(d=>d.uuid)))}),[c,o.then(({attachments:d})=>d)]}async refreshStore(e){const s=await this.enqueueRequest({description:"get issue type fields attachments",method:h.GET,url:"/issue-type-fields-attachments/",queryParams:{organization:e},blockers:[e],blocks:[]});this.dispatch(Zo(s))}}class QS extends P{add(e){var o;const{store:s}=this.client,a=(o=s.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=F({...e,created_by:a,submitted_at:n});this.dispatch(lu(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:h.POST,url:"/issue-type-fields/",payload:O(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(hu(m))}).catch(m=>{throw this.dispatch(mu(c.uuid)),m}),[c,r]}async refreshStore(e){const s=await this.enqueueRequest({description:"Get Issue Type Fields",method:h.GET,url:"/issue-type-fields/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(uu(s))}}class ZS extends E{async bulkAdd(e){var m;const s=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const d of e){const{fieldValuesUuid:u,fieldIdentifier:p,file:A}=d,y=await this.getFilePayload(A);y.sha1 in n||(n[y.sha1]=y);const b=F({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:y.sha1,created_by:a,field_values:u,submitted_at:s,field_identifier:p});c.push(b);const I={uuid:b.uuid,file_name:A.name,file_sha1:y.sha1,file_extension:y.extension,field_identifier:p,field_values:u};r.push(I)}this.dispatch(bt(c));const o=this.enqueueRequest({description:"Add issue type field values attachments",method:h.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:s,attachments:r,files:Object.values(n)},blockers:c.map(d=>d.field_values),blocks:c.map(d=>d.uuid)});return o.then(({presigned_urls:d,attachments:u})=>{this.processPresignedUrls(d),this.dispatch(Su(u))}).catch(d=>{throw this.dispatch(Tt(c.map(u=>u.uuid))),d}),[c,o.then(({attachments:d})=>d)]}async bulkDelete(e){const{store:s}=this.client,a=s.getState(),n=bu(e)(a);this.dispatch(Tt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:h.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{attachment_ids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(bt(n)),c}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values attachments",method:h.GET,url:"/issue-type-field-values-attachments/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(fu(s))}}class xS extends P{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:h.POST,url:"/issue-type-field-values/",payload:O(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(ta(n)),c.then(o=>(this.dispatch(Qe(o)),o)).catch(()=>{this.dispatch(sa(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=aa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Qe(c));const r=this.enqueueRequest({description:"Update issue type field values",method:h.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(o=>{this.dispatch(Qe(o))}).catch(()=>{this.dispatch(Qe(n))}),[c,r]}async delete(e){const{store:s}=this.client,a=s.getState(),n=aa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Tu(e)(a);this.dispatch(sa(e)),this.dispatch(Tt(c.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(ta(n)),this.dispatch(bt(c)),r}}async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue type field values",method:h.GET,url:"/issue-type-field-values/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(cu(s))}}class eg extends P{add(e){var r;const{store:s}=this.client,a=s.getState(),n=F({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Pu(n));const c=this.enqueueRequest({method:h.POST,url:"/issue-types/",payload:O(n),blockers:[],blocks:[n.uuid]});return c.then(o=>{this.dispatch(Ze(o))}).catch(()=>{this.dispatch(oa(n.uuid))}),[n,c]}update(e){const{store:s}=this.client,a=s.getState(),n=ua(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Ou(c));const r=this.enqueueRequest({method:h.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(o=>{this.dispatch(Ze(o))}).catch(()=>{this.dispatch(Ze(n))}),[c,r]}delete(e){const{store:s}=this.client,a=s.getState(),n=ua(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=la(e)(a);this.dispatch(oa(e)),this.dispatch(Uo(c.map(o=>o.uuid)));const r=this.enqueueRequest({method:h.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(Ze(n)),this.dispatch(Do(c))}),r}async refreshStore(e){const s=await this.enqueueRequest({method:h.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Ru(s))}}class tg extends P{async refreshStore(e){const s=await this.enqueueRequest({description:"Get issue updates",method:h.GET,url:"/issue-updates/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(ju(s))}}const sg=1800;function ig(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 ag extends uS{constructor(){super(...arguments);f(this,"_getRenewedTokens",async s=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:h.POST,url:this.refreshTokensUrl,payload:{refresh:s},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Tr(!1)),this.clearTokens(),this.dispatch({type:_h.RESET_STATE}),this.dispatch({type:ph})}async renewTokens(){const s=this.getRefreshToken();if(!s)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(s);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 s=this.getAccessToken();if(!s)return!1;const a=Date.now()/1e3;let n;try{n=vh(s).exp??a}catch{n=a}return n-a<sg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(s){return s instanceof q&&this.clearAuth(),s instanceof Error?Promise.reject(s):Promise.reject(new Error((s??De).toString()))}}}async handleUnauthorized(s,a){const n=this.client.store.getState();if(s.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new q({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new q({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(s){const a=Te.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:h.POST,url:this.initTokensUrl,payload:s,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(ig(n))})}}class ng extends P{async getLicense(e){const s=await this.enqueueRequest({description:"Get license",method:h.GET,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async pauseLicense(e){const s=await this.enqueueRequest({description:"Pause license",method:h.DELETE,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async resumeLicense(e){const s=await this.enqueueRequest({description:"Resume license",method:h.PATCH,url:`/billing/${e.uuid}/suspend/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async cancelLicense(e){const s=await this.enqueueRequest({description:"Cancel license",method:h.DELETE,url:`/billing/${e.uuid}/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:[]});return this.dispatch(fe(s)),s}async attachLicenseToProject(e,s){const a=await this.enqueueRequest({description:"Attach license",method:h.PATCH,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,payload:{project:s.uuid},blockers:[e.organization_owner,s.uuid],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(fe(a)),a}async detachLicenseFromProject(e){const s=await this.enqueueRequest({description:"Detach license",method:h.DELETE,url:`/billing/${e.uuid}/project/`,isAuthNeeded:!0,blockers:[e.organization_owner],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});return this.dispatch(fe(s)),s}async getLatestTransaction(e){return await this.enqueueRequest({description:"Get latest transaction",method:h.GET,url:`/billing/${e.uuid}/transaction/`,isAuthNeeded:!0,blockers:[e.uuid],blocks:[e.uuid]})}async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/organizations/${s}/licenses/`,isAuthNeeded:!0,blockers:[s],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of n)a[r.uuid]=r;const c=await this.enqueueRequest({description:"Get licenses",method:h.GET,url:`/projects/${e}/licenses/`,isAuthNeeded:!0,blockers:[e],blocks:["add-issue","add-form-entry","change-access-level","add-workspace"]});for(const r of c)a[r.uuid]=r;this.dispatch(Gu(Object.values(a)))}}class cg extends P{async update(e){const s=this.enqueueRequest({description:"Edit organization access",method:h.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return s.then(()=>{this.dispatch(Yu(e))}),s}async remove(e){return this.dispatch(Xu(e.uuid)),this.dispatch(Ju(e.user)),this.enqueueRequest({description:"Remove organization access",method:h.DELETE,url:`/organization-accesses/${e.uuid}/`,blockers:[e.uuid],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get organization accesses",method:h.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Ku(s))}}class rg extends P{create(e){return this.enqueueRequest({description:"Create organization",method:h.POST,url:"/organizations/",payload:{name:e},blockers:[],blocks:[`add-org-${e}`,"create-org"]})}async update(e){return this.enqueueRequest({description:"Edit organization",method:h.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[`add-org-${e.name}`,e.uuid],blocks:[e.uuid]})}async invite(e,s){return this.enqueueRequest({description:"Invite user to organization",method:h.POST,url:`/organizations/${e}/invite/${s}/`,blockers:[],blocks:[]})}async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Get organizations",method:h.GET,url:`/projects/${e}/organizations/`,blockers:[],blocks:[]});for(const r of n)a[r.uuid]=r;const c=await this.enqueueRequest({description:"Get organization",method:h.GET,url:`/organizations/${s}/`,blockers:[],blocks:[]});a[c.uuid]=c,this.dispatch(Al(Object.values(a)))}}class dg extends P{async update(e){return this.dispatch(el(e)),this.enqueueRequest({description:"Edit project access",method:h.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid,"change-access-level"],blocks:[e.uuid]})}async remove(e){return this.dispatch(tl(e)),this.enqueueRequest({description:"Delete project access",method:h.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project accesses",method:h.GET,url:"/project-accesses/",queryParams:{project:e},blockers:[],blocks:[]});this.dispatch(Sa(s))}}class og extends be{constructor(){super(...arguments);f(this,"name","Project Attachment");f(this,"url","/project-attachments");f(this,"addAttachments",wl);f(this,"updateAttachments",ql);f(this,"removeAttachments",Ra);f(this,"removeAttachment",Ml);f(this,"setAttachment",El);f(this,"selectAttachment",zl)}buildOfflineAttachment(s){return F({file:URL.createObjectURL(s.file),file_sha1:s.file_sha1,created_by:s.created_by,file_name:s.file.name,file_type:s.file.type,submitted_at:s.submitted_at,description:s.description,project:s.modelUuid})}buildAttachmentPayload(s){return{...s,project:s.modelUuid}}async bulkAdd(s){return this._bulkAdd(s.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(s){return this._delete(s)}async refreshStore(s){const a=await this.enqueueRequest({description:"Get project attachments",method:h.GET,url:`${this.url}/`,queryParams:{project:s},blockers:[],blocks:[]});this.dispatch(vl(a))}}class ug extends P{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 s={...e};delete s.file;const a=this.enqueueRequest({method:h.PATCH,url:`/projects/files/${e.uuid}/`,payload:s,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(Oa(n))}),a}saveActive(){const{store:e}=this.client,s=e.getState(),a=s.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=s.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:h.PATCH,url:`/projects/files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,d)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([u])=>{m({method:h.POST,url:`/projects/${n.project}/files/`,payload:{...n,...u},blockers:[a],blocks:[a]})}).catch(d)});const o=Promise.resolve(c).then(m=>this.enqueueRequest(m));return o.then(m=>{this.dispatch(Oa(m))}),this.dispatch(Hl),this.dispatch(Jl(null)),this.dispatch(Nl(!1)),[n,o]}delete(e){return this.dispatch(Ll(e)),this.enqueueRequest({method:h.DELETE,url:`/projects/files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e){const s=await this.enqueueRequest({description:"Get project files",method:h.GET,url:`/projects/${e}/files/`,blockers:[],blocks:[]});this.dispatch(Gl(s))}}class lg extends P{async add(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return await this.enqueueRequest({description:"Create project",method:h.POST,url:"/projects/",payload:{name:e.name,bounds:e.bounds,organization_owner:e.organization_owner},blockers:[],blocks:[]})}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(dl(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:s}=this.client,a=s.getState(),n=_t(a),c=n[e];if(!c)throw new Error("Expected project to exist");const r=Kl(a).filter(u=>u.project===e);this.dispatch(Bl(r.map(({uuid:u})=>u)));const o=Dl(c.uuid)(a);this.dispatch(Ra(o.map(({uuid:u})=>u)));const m=il(a);this.dispatch(sl(m.map(({uuid:u})=>u))),this.dispatch({type:"rehydrated/setRehydrated",payload:!1}),this.dispatch(ol(c.uuid));const d=$u(c.uuid)(a);d&&this.dispatch(fe({...d,project:null}));try{await this.enqueueRequest({description:"Delete project",method:h.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch({type:"rehydrated/setRehydrated",payload:!0})}catch(u){throw this.dispatch(rl(Object.values(n))),this.dispatch(Sa(Object.values(m))),this.dispatch($l(r)),this.dispatch(jl(o)),this.dispatch({type:"rehydrated/setRehydrated",payload:!0}),d&&this.dispatch(fe({...d,project:c.uuid})),u}}invite(e,s){const a=Te.v4();return this.enqueueRequest({description:"Invite user to project",method:h.POST,url:`/projects/${e}/invite/${s}/`,payload:{uuid:a},blockers:[],blocks:[a]})}joinProject(e,s,a){return this.enqueueRequest({description:"Join project",method:h.GET,url:`/projects/${e}/join-project/${s}/${a}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}async acceptInvite(e){return this.enqueueRequest({description:"Accept project invite",method:h.PATCH,url:`/projects/${e}/accept-invite/`,blockers:[e],blocks:[e]}).then(()=>{this.dispatch(ul(e))})}}class hg extends P{add(e){const s=F({...e,submitted_at:new Date().toISOString()});this.dispatch(xl(s));const a=this.enqueueRequest({description:"Create team",method:h.POST,url:"/teams/",payload:s,blockers:[],blocks:[s.uuid]});return a.then(n=>{this.dispatch(Ce(n))}).catch(()=>{this.dispatch(Ea(s.uuid))}),[s,a]}update(e){const{store:s}=this.client,a=ze(e.uuid)(s.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(wa(n));const c=this.enqueueRequest({description:"Update team",method:h.PATCH,url:`/teams/${e.uuid}/`,payload:O(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ce(r))}).catch(()=>{this.dispatch(Ce(a))}),[n,c]}async delete(e){const{store:s}=this.client,a=s.getState(),n=ze(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Ea(e));try{return await this.enqueueRequest({description:"Delete team",method:h.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Ce(n)),c}}async setMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);if(s.length!==new Set(s).size)throw new Error("Duplicate members found in the list");this.dispatch(wa({...n,members:s}));const c=this.enqueueRequest({description:"Set team members",method:h.PUT,url:`/teams/${e}/set-members/`,payload:{users:s},blockers:[e],blocks:[e]});return c.catch(()=>{this.dispatch(Ce(n))}),c}async addMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);const c=[...n.members,...s];return this.setMembers(e,c)}async removeMembers(e,s){const{store:a}=this.client,n=ze(e)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e} to exist`);const c=n.members.filter(r=>!s.includes(r));return this.setMembers(e,c)}async refreshStore(e){const s=await this.enqueueRequest({description:"Fetch teams",method:h.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]});this.dispatch(Zl(s))}}class mg extends P{async refreshStore(e,s){const a={},n=await this.enqueueRequest({description:"Fetch organization users",method:h.GET,url:`/organizations/${s}/users/`,blockers:[],blocks:[]});for(const r of n)a[r.id]=r;const c=await this.enqueueRequest({description:"Fetch project users",method:h.GET,url:`/projects/${e}/users/`,blockers:[],blocks:[]});for(const r of c)a[r.id]=r;this.dispatch(Nu(Object.values(a)))}}class pg{constructor(e){f(this,"store");this.store=e}async enqueueRequest(e,s,a){return this._enqueueRequest(e,s,a).then(n=>{if(n instanceof q)throw n;return n})}_enqueueRequest(e,s,a){const n=new Ka,c={...e,BASE_URL:s,serviceName:a};if(e.immediate){const r={...c,uuid:e.uuid??Te.v4()},o={payload:r,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:r,BASE_URL:s,serviceName:a}}}};Ca(o,this).then(m=>{n.resolve(m.body)}).catch(m=>{za(m,o),m instanceof Error?n.reject(m):n.reject(new Error((m??De).toString()))})}else{const r=this.store.dispatch(Il(c)),o=d=>{if(d)n.resolve(d.body);else{const u=new q({message:"Could not get a response from the server.",response:d,discard:!0});n.reject(u)}},m=d=>{d instanceof q?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
15
  Converting error to APIError and discarding.`),d=new q({message:"An error occurred while processing the request.",innerError:d,discard:!0})),n.reject(d)};r.then(o,m)}return n}}class Ue{constructor(){f(this,"graph");f(this,"requestAttemptCounter");this.graph=new wh.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const s=new Ue;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}s.sneakRequest(n);for(let c=0;c<a;c++){const r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(o=>n.payload.blockers.includes(o))&&Ue._addDependency(n.payload.uuid,r.payload.uuid,s.graph)}}return s}_addDependency(e,s){Ue._addDependency(e,s,this.graph)}static _addDependency(e,s,a){if(e===s)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: ${s})`);if(!a.hasNode(s))throw new Error(`Tried to add dependency to non-existent node: ${s} (from node: ${e})`);a.addDependency(e,s)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const s of this.graph.overallOrder()){if(s===e.payload.uuid)continue;const a=this.graph.getNodeData(s);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(e.payload.uuid,s)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const s of this.graph.overallOrder()){if(s===e.payload.uuid)continue;this.graph.getNodeData(s).payload.blockers.some(n=>e.payload.blocks.includes(n))&&this._addDependency(s,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let s=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<s&&(s=c,a=n)}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)),s=this._getNextNode();if(s){const a=this.graph.getNodeData(s),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(s=>this.graph.getNodeData(s));return e=e.sort((s,a)=>s.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((s,a)=>{const n=this.requestAttemptCounter[s.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}const Ag=(t,e)=>{const s=new e(t);return Bf(s),Lf(t),s};var bh=(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))(bh||{});i.APIError=q,i.AgentService=lS,i.AssetAttachmentService=hS,i.AssetProcedureAttachmentService=mS,i.AssetProcedureFieldValuesAttachmentService=yS,i.AssetProcedureFieldValuesService=fS,i.AssetProcedureFieldsAttachmentService=pS,i.AssetProcedureFieldsService=AS,i.AssetProcedureInstanceService=SS,i.AssetProcedureService=gS,i.AssetService=bS,i.AssetStageCompletionService=TS,i.AssetStageService=FS,i.AssetTypeAttachmentService=IS,i.AssetTypeFieldValuesAttachmentService=OS,i.AssetTypeFieldValuesService=_S,i.AssetTypeFieldsAttachmentService=RS,i.AssetTypeFieldsService=PS,i.AssetTypeService=vS,i.AttachmentModel=Ba,i.BaseApiService=P,i.BaseSDK=pg,i.COMMON_AUTO_FIELDS=xa,i.CategoryService=wS,i.DEFAULT_ISSUE_PRIORITY=jh,i.DEFAULT_ISSUE_STATUS=Eh,i.DeferredPromise=Ka,i.DocumentAttachmentService=ES,i.DocumentService=jS,i.EMPTY_ARRAY=$a,i.EMPTY_OBJECT=La,i.EmailDomainsService=qS,i.EmailVerificationService=MS,i.FileService=CS,i.FormRevisionAttachmentService=zS,i.FormRevisionService=DS,i.FormService=US,i.FormSubmissionAttachmentService=VS,i.FormSubmissionService=GS,i.GeoImageService=$S,i.GeoJsonFeatureService=LS,i.GeoJsonLayerService=BS,i.HttpMethod=h,i.IssueAssociationService=NS,i.IssueAttachmentService=JS,i.IssueCommentAttachmentService=HS,i.IssueCommentService=WS,i.IssuePriority=Mt,i.IssueService=KS,i.IssueStatus=kt,i.IssueTypeAttachmentService=YS,i.IssueTypeFieldValuesAttachmentService=ZS,i.IssueTypeFieldValuesService=xS,i.IssueTypeFieldsAttachmentService=XS,i.IssueTypeFieldsService=QS,i.IssueTypeService=eg,i.IssueUpdateChange=v,i.IssueUpdateService=tg,i.JWTService=ag,i.LicenseLevel=Ja,i.LicenseService=ng,i.LicenseStatus=Ha,i.OUTBOX_RETRY_DELAY=Wa,i.OrganizationAccessLevel=qt,i.OrganizationAccessService=cg,i.OrganizationService=rg,i.OutboxCoordinator=Ue,i.PaddleCheckoutEvent=Na,i.ProjectAccessLevel=jt,i.ProjectAccessService=dg,i.ProjectAttachmentService=og,i.ProjectFileService=ug,i.ProjectService=lg,i.TeamService=hg,i.UNKNOWN_ERROR_MESSAGE=De,i.UserService=mg,i.VERSION_REDUCER_KEY=Ma,i.VerificationCodeType=bh,i._setLatestRetryTime=Pl,i.acceptProjectInvite=ul,i.addAsset=ps,i.addAssetAttachment=im,i.addAssetAttachments=Bt,i.addAssetProcedure=os,i.addAssetProcedureAttachment=cm,i.addAssetProcedureAttachments=bn,i.addAssetProcedureFieldValues=Zt,i.addAssetProcedureFieldValuesAttachment=Pm,i.addAssetProcedureFieldValuesAttachments=it,i.addAssetProcedureFieldValuesMany=xn,i.addAssetProcedureFields=Vn,i.addAssetProcedureFieldsAttachment=um,i.addAssetProcedureFieldsAttachments=jn,i.addAssetProcedureFieldsMany=fm,i.addAssetProcedureInstance=is,i.addAssetProcedureInstances=cc,i.addAssetProcedures=Gm,i.addAssetStage=ep,i.addAssetStageCompletion=Ts,i.addAssetStageCompletions=Fs,i.addAssetStages=_s,i.addAssetType=Ns,i.addAssetTypeAttachment=ap,i.addAssetTypeAttachments=qs,i.addAssetTypeFieldValues=Vs,i.addAssetTypeFieldValuesAttachment=Fp,i.addAssetTypeFieldValuesAttachments=dt,i.addAssetTypeFieldValuesMany=hr,i.addAssetTypeFields=Zc,i.addAssetTypeFieldsAttachment=rp,i.addAssetTypeFieldsAttachments=Nc,i.addAssetTypeFieldsMany=pp,i.addAssetTypes=kp,i.addAssets=As,i.addCategory=Ys,i.addConversation=nn,i.addDocumentAttachment=Hp,i.addDocumentAttachments=Er,i.addDocuments=$r,i.addEmailDomain=Wr,i.addForm=di,i.addFormRevision=ni,i.addFormRevisionAttachment=sA,i.addFormRevisionAttachments=nd,i.addFormRevisions=md,i.addFormSubmission=mi,i.addFormSubmissionAttachment=AA,i.addFormSubmissionAttachments=mt,i.addFormSubmissions=yt,i.addForms=hA,i.addGeoImage=Vd,i.addGeoImages=Gd,i.addGeoJsonFeature=Fi,i.addGeoJsonFeatures=Kd,i.addGeoJsonLayer=_i,i.addGeoJsonLayers=vA,i.addIssue=Ki,i.addIssueAssociation=qi,i.addIssueAssociations=Mi,i.addIssueAttachment=VA,i.addIssueAttachments=Ui,i.addIssueComment=Ni,i.addIssueCommentAttachment=LA,i.addIssueCommentAttachments=Fo,i.addIssueComments=HA,i.addIssueType=Pu,i.addIssueTypeAttachment=XA,i.addIssueTypeAttachments=Lo,i.addIssueTypeFieldValues=ta,i.addIssueTypeFieldValuesAttachment=Fy,i.addIssueTypeFieldValuesAttachments=bt,i.addIssueTypeFieldValuesMany=ry,i.addIssueTypeFields=lu,i.addIssueTypeFieldsAttachment=ey,i.addIssueTypeFieldsAttachments=xo,i.addIssueTypeFieldsMany=my,i.addIssueUpdate=qu,i.addIssueUpdates=Mu,i.addIssues=Do,i.addLicenses=qy,i.addOrganization=hf,i.addOrganizations=lf,i.addProject=sf,i.addProjectAttachment=Pf,i.addProjectAttachments=wl,i.addProjectFile=wf,i.addProjectFiles=$l,i.addProjects=tf,i.addTeam=xl,i.addUser=Vy,i.addUsers=Uy,i.agentsReducer=dn,i.agentsSlice=Vt,i.areArraysEqual=Dh,i.assetAttachmentReducer=fn,i.assetAttachmentSlice=$t,i.assetProcedureAttachmentReducer=vn,i.assetProcedureAttachmentSlice=Jt,i.assetProcedureFieldValuesAttachmentReducer=Xn,i.assetProcedureFieldValuesAttachmentSlice=Yt,i.assetProcedureFieldValuesReducer=ic,i.assetProcedureFieldValuesSlice=Qt,i.assetProcedureFieldsAttachmentReducer=zn,i.assetProcedureFieldsAttachmentSlice=Ht,i.assetProcedureFieldsReducer=Bn,i.assetProcedureFieldsSlice=Wt,i.assetProcedureInstanceReducer=oc,i.assetProcedureInstanceSlice=ss,i.assetProcedureReducer=mc,i.assetProcedureSlice=ds,i.assetReducer=Sc,i.assetSlice=ms,i.assetStageCompletionReducer=Ic,i.assetStageCompletionSlice=bs,i.assetStageReducer=wc,i.assetStageSlice=Os,i.assetTypeAttachmentReducer=$c,i.assetTypeAttachmentSlice=js,i.assetTypeFieldValuesAttachmentReducer=or,i.assetTypeFieldValuesAttachmentSlice=zs,i.assetTypeFieldValuesReducer=yr,i.assetTypeFieldValuesSlice=Us,i.assetTypeFieldsAttachmentReducer=Yc,i.assetTypeFieldsAttachmentSlice=ks,i.assetTypeFieldsReducer=sr,i.assetTypeFieldsSlice=Cs,i.assetTypeReducer=gr,i.assetTypeSlice=Bs,i.authReducer=Fr,i.authSlice=ut,i.blobToBase64=Hh,i.categoryReducer=_r,i.categorySlice=Ks,i.clearTokens=Gp,i.constructUploadedFilePayloads=Jh,i.coordinatesAreEqual=Ch,i.createModelAdapter=T,i.createMultiPointGeometry=kh,i.createOfflineAction=Tl,i.createPayload=O,i.createPointGeometry=Mh,i.createSelectionAdapter=qh,i.deleteAsset=ys,i.deleteAssetAttachment=hn,i.deleteAssetAttachments=Nt,i.deleteAssetProcedure=us,i.deleteAssetProcedureAttachment=In,i.deleteAssetProcedureAttachments=Rn,i.deleteAssetProcedureFieldValues=xt,i.deleteAssetProcedureFieldValuesAttachment=wm,i.deleteAssetProcedureFieldValuesAttachments=at,i.deleteAssetProcedureFieldValuesMany=tc,i.deleteAssetProcedureFields=$n,i.deleteAssetProcedureFieldsAttachment=pm,i.deleteAssetProcedureFieldsAttachments=Mn,i.deleteAssetProcedureFieldsMany=Tm,i.deleteAssetProcedureInstance=as,i.deleteAssetProcedureInstances=rc,i.deleteAssetProcedures=Lm,i.deleteAssetStage=tp,i.deleteAssetStageCompletion=Is,i.deleteAssetStageCompletions=Rs,i.deleteAssetStages=ws,i.deleteAssetType=Js,i.deleteAssetTypeAttachment=zc,i.deleteAssetTypeAttachments=Ms,i.deleteAssetTypeFieldValues=Gs,i.deleteAssetTypeFieldValuesAttachment=Op,i.deleteAssetTypeFieldValuesAttachments=ot,i.deleteAssetTypeFieldValuesMany=pr,i.deleteAssetTypeFields=er,i.deleteAssetTypeFieldsAttachment=lp,i.deleteAssetTypeFieldsAttachments=Hc,i.deleteAssetTypeFieldsMany=Sp,i.deleteAssetTypes=zp,i.deleteAssets=yc,i.deleteCategory=Or,i.deleteDocumentAttachment=Mr,i.deleteDocumentAttachments=kr,i.deleteEmailDomain=Kr,i.deleteForm=oi,i.deleteFormRevision=ci,i.deleteFormRevisionAttachment=cA,i.deleteFormRevisionAttachments=rd,i.deleteFormRevisions=pd,i.deleteFormSubmission=pi,i.deleteFormSubmissionAttachment=gA,i.deleteFormSubmissionAttachments=pt,i.deleteFormSubmissions=ft,i.deleteGeoImage=gi,i.deleteGeoImages=Ld,i.deleteGeoJsonFeature=Ii,i.deleteGeoJsonFeatures=Yd,i.deleteGeoJsonLayer=vi,i.deleteGeoJsonLayers=EA,i.deleteIssue=Yi,i.deleteIssueAssociation=ki,i.deleteIssueAssociations=Ci,i.deleteIssueAttachment=Ao,i.deleteIssueAttachments=Vi,i.deleteIssueComment=Ji,i.deleteIssueCommentAttachment=Po,i.deleteIssueCommentAttachments=Oo,i.deleteIssueComments=WA,i.deleteIssueTypeAttachment=Jo,i.deleteIssueTypeAttachments=Ho,i.deleteIssueTypeFieldValues=sa,i.deleteIssueTypeFieldValuesAttachment=Oy,i.deleteIssueTypeFieldValuesAttachments=Tt,i.deleteIssueTypeFieldValuesMany=ly,i.deleteIssueTypeFields=mu,i.deleteIssueTypeFieldsAttachment=ay,i.deleteIssueTypeFieldsAttachments=tu,i.deleteIssueTypeFieldsMany=fy,i.deleteIssueUpdate=ku,i.deleteIssueUpdates=Cu,i.deleteIssues=Uo,i.deleteOrganization=Af,i.deleteOrganizationAccess=Xu,i.deleteOrganizations=yf,i.deleteProject=ol,i.deleteProjectAccess=tl,i.deleteProjectAccesses=sl,i.deleteProjectAttachment=Ml,i.deleteProjectAttachments=Ra,i.deleteProjectFile=Ll,i.deleteProjectFiles=Bl,i.deleteProjects=nf,i.deleteTeam=Ea,i.deleteUser=Ly,i.deleteUsers=By,i.dequeue=yh,i.discard=za,i.documentAttachmentReducer=Ur,i.documentAttachmentSlice=Zs,i.documentSlice=xs,i.documentsReducer=Jr,i.downloadFile=Wh,i.downloadInMemoryFile=Nh,i.emailDomainsReducer=Qr,i.emailDomainsSlice=ti,i.emailRegex=em,i.enqueue=Ah,i.enqueueRequest=Il,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=Ee,i.fileReducer=sd,i.fileSlice=si,i.fileToBlob=Qa,i.formReducer=bd,i.formRevisionAttachmentReducer=od,i.formRevisionAttachmentSlice=ii,i.formRevisionReducer=fd,i.formRevisionsSlice=ai,i.formSlice=ri,i.formSubmissionAttachmentReducer=vd,i.formSubmissionAttachmentSlice=ui,i.formSubmissionReducer=Cd,i.formSubmissionSlice=hi,i.geoImageReducer=Jd,i.geoImageSlice=Si,i.geoJsonFeatureReducer=Zd,i.geoJsonFeatureSlice=Ti,i.geoJsonLayerReducer=so,i.geoJsonLayerSlice=Oi,i.getFileIdentifier=Bh,i.getFileS3Key=Ut,i.getLocalDateString=Ya,i.getLocalRelativeDateString=$h,i.getOutboxCoordinator=_e,i.getRenamedFile=Xa,i.hashFile=je,i.initSDK=Ag,i.initializeAssetAttachments=Lt,i.initializeAssetProcedureAttachments=gn,i.initializeAssetProcedureFieldValues=Zn,i.initializeAssetProcedureFieldValuesAttachments=Jn,i.initializeAssetProcedureFields=Un,i.initializeAssetProcedureFieldsAttachments=En,i.initializeAssetProcedureInstances=nc,i.initializeAssetProcedures=lc,i.initializeAssetStageCompletions=bc,i.initializeAssetStages=_c,i.initializeAssetTypeAttachments=Mc,i.initializeAssetTypeFieldValues=lr,i.initializeAssetTypeFieldValuesAttachments=ar,i.initializeAssetTypeFields=Qc,i.initializeAssetTypeFieldsAttachments=Bc,i.initializeAssetTypes=Sr,i.initializeAssets=Ac,i.initializeCategories=Rr,i.initializeConversations=an,i.initializeDocumentAttachments=wr,i.initializeEmailDomains=Hr,i.initializeFormRevisionAttachments=ad,i.initializeFormRevisions=hd,i.initializeFormSubmissionAttachments=Rd,i.initializeFormSubmissions=Ed,i.initializeForms=gd,i.initializeGeoImages=Dd,i.initializeGeoJsonFeatures=Wd,i.initializeGeoJsonLayers=eo,i.initializeIssueAssociations=ao,i.initializeIssueAttachments=Di,i.initializeIssueCommentAttachments=$i,i.initializeIssueTypeAttachments=Zi,i.initializeIssueTypeFieldValues=cu,i.initializeIssueTypeFieldValuesAttachments=fu,i.initializeIssueTypeFields=uu,i.initializeIssueTypeFieldsAttachments=Zo,i.initializeIssueTypes=Ru,i.initializeIssueUpdates=ju,i.initializeIssues=zo,i.initializeLicences=Gu,i.initializeOrganizationAccesses=Ku,i.initializeOrganizations=of,i.initializeProjectAccesses=Sa,i.initializeProjectAttachments=vl,i.initializeProjectFiles=Gl,i.initializeProjects=xy,i.initializeTeams=Zl,i.initializeUsers=Nu,i.isToday=Gh,i.issueAssociationReducer=lo,i.issueAssociationSlice=ji,i.issueAttachmentReducer=bo,i.issueAttachmentSlice=zi,i.issueCommentAttachmentReducer=Eo,i.issueCommentAttachmentSlice=Gi,i.issueCommentReducer=ko,i.issueCommentSlice=Li,i.issueReducer=Go,i.issueSlice=Wi,i.issueTypeAttachmentReducer=Xo,i.issueTypeAttachmentSlice=Qi,i.issueTypeFieldValuesAttachmentReducer=Fu,i.issueTypeFieldValuesAttachmentSlice=ca,i.issueTypeFieldValuesReducer=du,i.issueTypeFieldValuesSlice=ea,i.issueTypeFieldsAttachmentReducer=au,i.issueTypeFieldsAttachmentSlice=xi,i.issueTypeFieldsReducer=Au,i.issueTypeFieldsSlice=na,i.issueTypeReducer=wu,i.issueTypeSlice=da,i.issueUpdateReducer=Uu,i.issueUpdateSlice=ha,i.licenseReducer=Lu,i.licenseSlice=ma,i.logOnlyOnce=Kh,i.markAsDeleted=Rl,i.markForDeletion=Rf,i.memoize=zt,i.moveDocument=Lr,i.offline=F,i.onlyUniqueHashes=xh,i.onlyUniqueOfflineIds=tn,i.organizationAccessReducer=Zu,i.organizationAccessSlice=Aa,i.organizationReducer=bl,i.organizationSlice=Ta,i.outboxReducer=Ol,i.outboxSlice=Fa,i.overmapEnhancer=xf,i.overmapReducers=hh,i.overmapRootReducer=Kf,i.performRequest=Ca,i.projectAccessReducer=nl,i.projectAccessSlice=fa,i.projectAttachmentReducer=Ul,i.projectAttachmentSlice=Ia,i.projectFileReducer=Yl,i.projectFileSlice=Pa,i.projectReducer=ll,i.projectSlice=ba,i.rehydratedReducer=Xl,i.rehydratedSlice=_a,i.removeDocuments=ei,i.removeIssueType=oa,i.removeUser=Ju,i.resetProjectFileObjectUrls=jf,i.resetStore=ph,i.restructureCreateSelectorWithArgs=g,i.saveActiveProjectFileBounds=Hl,i.selectAccessToken=$p,i.selectActiveOrganizationAccess=Yy,i.selectActiveProjectFileId=Mf,i.selectActiveStatusLicenses=ky,i.selectAllDocumentAttachments=zr,i.selectAllProjectAttachments=Cl,i.selectAncestorIdsOfDocument=Qp,i.selectAssetAttachmentById=An,i.selectAssetAttachmentMapping=mn,i.selectAssetAttachments=pn,i.selectAssetById=gs,i.selectAssetProcedureAttachmentById=_n,i.selectAssetProcedureAttachmentMapping=Pn,i.selectAssetProcedureAttachments=On,i.selectAssetProcedureById=hs,i.selectAssetProcedureFieldValues=es,i.selectAssetProcedureFieldValuesAttachmentById=Em,i.selectAssetProcedureFieldValuesAttachments=Wn,i.selectAssetProcedureFieldValuesAttachmentsByIds=Kn,i.selectAssetProcedureFieldValuesAttachmentsMapping=Xt,i.selectAssetProcedureFieldValuesById=ts,i.selectAssetProcedureFieldValuesMapping=sc,i.selectAssetProcedureFieldValuesOfAsset=Mm,i.selectAssetProcedureFields=Kt,i.selectAssetProcedureFieldsAttachmentById=ym,i.selectAssetProcedureFieldsAttachments=Cn,i.selectAssetProcedureFieldsAttachmentsMapping=kn,i.selectAssetProcedureFieldsById=Rm,i.selectAssetProcedureFieldsMapping=Ln,i.selectAssetProcedureFieldsOfAssetProcedure=Fm,i.selectAssetProcedureInstanceById=rs,i.selectAssetProcedureInstances=cs,i.selectAssetProcedureInstancesByIds=Vm,i.selectAssetProcedureInstancesMapping=ns,i.selectAssetProcedureInstancesOfAssetProcedure=dc,i.selectAssetProcedureInstancesOfAssetType=Um,i.selectAssetProcedures=hc,i.selectAssetProceduresByIds=Hm,i.selectAssetProceduresMapping=ls,i.selectAssetProceduresOfOrganization=Jm,i.selectAssetStageById=Ec,i.selectAssetStageCompletionById=Rc,i.selectAssetStageCompletionMapping=Ps,i.selectAssetStageCompletions=Zm,i.selectAssetStageCompletionsByIds=Pc,i.selectAssetStages=jc,i.selectAssetStagesByIds=Es,i.selectAssetStagesMappingOfAssetProcedure=sp,i.selectAssetStagesOfAssetProcedure=ip,i.selectAssetTypeAttachmentById=Vc,i.selectAssetTypeAttachmentMapping=Dc,i.selectAssetTypeAttachments=Uc,i.selectAssetTypeById=Ws,i.selectAssetTypeFieldValues=$s,i.selectAssetTypeFieldValuesAttachmentById=_p,i.selectAssetTypeFieldValuesAttachments=cr,i.selectAssetTypeFieldValuesAttachmentsByIds=rr,i.selectAssetTypeFieldValuesAttachmentsMapping=Ds,i.selectAssetTypeFieldValuesById=Ls,i.selectAssetTypeFieldValuesMapping=Ar,i.selectAssetTypeFieldValuesOfAsset=Ep,i.selectAssetTypeFields=rt,i.selectAssetTypeFieldsAttachmentById=mp,i.selectAssetTypeFieldsAttachments=Kc,i.selectAssetTypeFieldsAttachmentsMapping=Wc,i.selectAssetTypeFieldsById=Tp,i.selectAssetTypeFieldsMapping=tr,i.selectAssetTypeFieldsOfAssetType=gp,i.selectAssetTypeValuesOfAssetType=jp,i.selectAssetTypes=Dp,i.selectAssetTypesByIds=Up,i.selectAssetTypesMapping=Hs,i.selectAssets=fc,i.selectAssetsByIds=Xm,i.selectAssetsMapping=fs,i.selectAssetsOfAssetType=Ss,i.selectAttachmentsOfAsset=yn,i.selectAttachmentsOfAssetProcedure=om,i.selectAttachmentsOfAssetProcedureFieldValues=Yn,i.selectAttachmentsOfAssetProcedureFields=Am,i.selectAttachmentsOfAssetType=Gc,i.selectAttachmentsOfAssetTypeFieldValues=dr,i.selectAttachmentsOfAssetTypeFields=hp,i.selectAttachmentsOfDocument=Yp,i.selectAttachmentsOfFormRevision=rA,i.selectAttachmentsOfFormSubmission=_d,i.selectAttachmentsOfIssue=So,i.selectAttachmentsOfIssueComment=JA,i.selectAttachmentsOfIssueType=xA,i.selectAttachmentsOfIssueTypeFieldValues=Tu,i.selectAttachmentsOfIssueTypeFields=ny,i.selectAttachmentsOfProject=Dl,i.selectCategories=Bp,i.selectCategoriesByIds=Np,i.selectCategoryById=Qs,i.selectCategoryMapping=Xs,i.selectCommentsOfIssue=KA,i.selectConversation=sm,i.selectConversationMapping=Gt,i.selectConversations=tm,i.selectCurrentUser=Rt,i.selectDeletedRequests=Ff,i.selectDocumentAttachmentById=Dr,i.selectDocumentAttachmentMapping=Cr,i.selectDocumentById=Nr,i.selectDocuments=Br,i.selectDocumentsByIds=Xp,i.selectDocumentsMapping=qe,i.selectEmailDomains=Xr,i.selectEmailDomainsAsMapping=Yr,i.selectEmailDomainsOfOrganization=eA,i.selectFieldValuesOfAssetProcedureInstance=km,i.selectFormById=Fd,i.selectFormMapping=Td,i.selectFormRevisionAttachmentsMapping=dd,i.selectFormRevisionById=oA,i.selectFormRevisionMapping=ht,i.selectFormRevisions=Ad,i.selectFormRevisionsOfForm=yd,i.selectFormSubmissionAttachemntsByIds=Od,i.selectFormSubmissionAttachmentsMapping=li,i.selectFormSubmissionById=fi,i.selectFormSubmissions=yi,i.selectFormSubmissionsMapping=Ai,i.selectFormSubmissionsOfAsset=kd,i.selectFormSubmissionsOfForm=qd,i.selectFormSubmissionsOfIssue=Md,i.selectForms=pA,i.selectGeoImageById=bi,i.selectGeoImageMapping=Bd,i.selectGeoImages=Nd,i.selectGeoImagesOfProject=IA,i.selectGeoJsonFeatureById=Pi,i.selectGeoJsonFeatures=Xd,i.selectGeoJsonFeaturesByIds=_A,i.selectGeoJsonFeaturesMapping=Ri,i.selectGeoJsonFeaturesOfLayer=Qd,i.selectGeoJsonLayerById=Ei,i.selectGeoJsonLayers=to,i.selectGeoJsonLayersByIds=kA,i.selectGeoJsonLayersMapping=wi,i.selectGeoJsonLayersOfProject=MA,i.selectIsImportingProjectFile=kf,i.selectIsLoggedIn=Lp,i.selectIssueAssociationById=co,i.selectIssueAssociationMapping=Xe,i.selectIssueAssociations=UA,i.selectIssueAssociationsOfAsset=uo,i.selectIssueAssociationsOfIssue=oo,i.selectIssueAssociationsToIssue=ro,i.selectIssueAttachmentById=go,i.selectIssueAttachmentMapping=yo,i.selectIssueAttachments=fo,i.selectIssueById=Xi,i.selectIssueCommentAttachmentById=wo,i.selectIssueCommentAttachmentMapping=_o,i.selectIssueCommentAttachments=vo,i.selectIssueCommentById=Hi,i.selectIssueCommentMapping=Mo,i.selectIssueCountOfCategory=Jp,i.selectIssueMapping=Vo,i.selectIssueTypeAttachmentById=Yo,i.selectIssueTypeAttachmentMapping=Wo,i.selectIssueTypeAttachments=Ko,i.selectIssueTypeById=ua,i.selectIssueTypeFieldValues=ia,i.selectIssueTypeFieldValuesAttachmentById=_y,i.selectIssueTypeFieldValuesAttachments=gu,i.selectIssueTypeFieldValuesAttachmentsByIds=bu,i.selectIssueTypeFieldValuesAttachmentsMapping=ra,i.selectIssueTypeFieldValuesById=aa,i.selectIssueTypeFieldValuesMapping=ru,i.selectIssueTypeFieldValuesOfIssue=hy,i.selectIssueTypeFields=gt,i.selectIssueTypeFieldsAttachmentById=cy,i.selectIssueTypeFieldsAttachments=iu,i.selectIssueTypeFieldsAttachmentsMapping=su,i.selectIssueTypeFieldsById=Ty,i.selectIssueTypeFieldsMapping=pu,i.selectIssueTypeFieldsOfIssueType=Sy,i.selectIssueTypeMapping=_u,i.selectIssueTypeValuesOfIssueType=by,i.selectIssueTypes=vu,i.selectIssueTypesByIds=vy,i.selectIssueTypesOfOrganization=wy,i.selectIssueUpdateMapping=zu,i.selectIssueUpdatesOfIssue=Du,i.selectIssuesByIds=YA,i.selectIssuesOfIssueType=la,i.selectIssuesOfIssueTypeCount=Ey,i.selectLatestAssetProcedureFieldsOfAssetProcedure=Im,i.selectLatestAssetTypeFieldsOfAssetType=bp,i.selectLatestFormRevisionOfForm=uA,i.selectLatestIssueTypeFieldsOfIssueType=gy,i.selectLatestRetryTime=If,i.selectLicense=My,i.selectLicenseForProject=$u,i.selectLicenses=It,i.selectLicensesForProjectsMapping=Cy,i.selectLicensesOfOrganization=bf,i.selectNumberOfAssetsOfAssetType=Qm,i.selectOrganizationAccessById=Ky,i.selectOrganizationAccessForUser=Xy,i.selectOrganizationAccessUserMapping=Qu,i.selectOrganizationAccesses=ya,i.selectOrganizationById=ff,i.selectOrganizationUsersAsMapping=gl,i.selectOrganizationUsersIds=Sl,i.selectOrganizations=fl,i.selectOrganizationsMapping=yl,i.selectOrganizationsWithAccess=Sf,i.selectProjectAccessById=Qy,i.selectProjectAccessForUser=Zy,i.selectProjectAccessMapping=ga,i.selectProjectAccessUserMapping=al,i.selectProjectAccesses=il,i.selectProjectAttachmentById=zl,i.selectProjectAttachmentMapping=kl,i.selectProjectById=rf,i.selectProjectFileById=qf,i.selectProjectFileMapping=Wl,i.selectProjectFiles=Kl,i.selectProjectMapping=_t,i.selectProjectUsersAsMapping=ml,i.selectProjectUsersIds=hl,i.selectProjects=cf,i.selectProjectsOfOrganization=gf,i.selectRehydrated=Df,i.selectRootDocuments=Zp,i.selectSortedOrganizationUsers=Tf,i.selectSortedProjectUsers=df,i.selectStageMapping=ct,i.selectTeamById=ze,i.selectTeams=qa,i.selectTeamsByIds=Uf,i.selectTeamsMapping=ja,i.selectTeamsOfOrganization=Vf,i.selectTeamsOfUser=Gf,i.selectUploadUrl=td,i.selectUserById=Hy,i.selectUsersByIds=Wy,i.selectUsersMapping=Pt,i.setActiveProjectFileId=Jl,i.setAsset=Km,i.setAssetAttachment=un,i.setAssetAttachments=am,i.setAssetProcedure=Bm,i.setAssetProcedureAttachment=Tn,i.setAssetProcedureAttachments=rm,i.setAssetProcedureFieldValues=jm,i.setAssetProcedureFieldValuesAttachment=Om,i.setAssetProcedureFieldValuesAttachments=_m,i.setAssetProcedureFieldValuesMany=qm,i.setAssetProcedureFields=Sm,i.setAssetProcedureFieldsAttachment=lm,i.setAssetProcedureFieldsAttachments=hm,i.setAssetProcedureFieldsMany=gm,i.setAssetProcedureInstance=zm,i.setAssetProcedureInstances=Dm,i.setAssetProcedures=Nm,i.setAssetStage=vc,i.setAssetStages=xm,i.setAssetType=qp,i.setAssetTypeAttachment=kc,i.setAssetTypeAttachments=np,i.setAssetTypeFieldValues=vp,i.setAssetTypeFieldValuesAttachment=Ip,i.setAssetTypeFieldValuesAttachments=Rp,i.setAssetTypeFieldValuesMany=wp,i.setAssetTypeFields=Ap,i.setAssetTypeFieldsAttachment=dp,i.setAssetTypeFieldsAttachments=op,i.setAssetTypeFieldsMany=yp,i.setAssetTypes=Mp,i.setAssets=Ym,i.setConversation=cn,i.setCurrentUser=Ny,i.setDocumentAttachment=jr,i.setDocumentAttachments=Wp,i.setDocuments=Gr,i.setForm=lA,i.setFormRevision=ld,i.setFormRevisionAttachment=iA,i.setFormRevisionAttachments=aA,i.setFormSubmission=At,i.setFormSubmissionAttachment=yA,i.setFormSubmissionAttachments=fA,i.setFormSubmissions=bA,i.setGeoImage=We,i.setGeoImages=Ud,i.setGeoJsonFeature=PA,i.setGeoJsonFeatures=OA,i.setGeoJsonLayer=jA,i.setGeoJsonLayers=qA,i.setIsImportingProjectFile=Nl,i.setIssueAssociation=zA,i.setIssueAssociations=CA,i.setIssueAttachment=mo,i.setIssueAttachments=GA,i.setIssueComment=Bi,i.setIssueCommentAttachment=Io,i.setIssueCommentAttachments=BA,i.setIssueComments=qo,i.setIssueType=Ze,i.setIssueTypeAttachment=Bo,i.setIssueTypeAttachments=QA,i.setIssueTypeFieldValues=dy,i.setIssueTypeFieldValuesAttachment=Iy,i.setIssueTypeFieldValuesAttachments=Ry,i.setIssueTypeFieldValuesMany=oy,i.setIssueTypeFields=py,i.setIssueTypeFieldsAttachment=ty,i.setIssueTypeFieldsAttachments=sy,i.setIssueTypeFieldsMany=Ay,i.setIssueUpdate=jy,i.setLoggedIn=Tr,i.setOrganization=uf,i.setOrganizations=Al,i.setProfilePicture=Jy,i.setProject=ef,i.setProjectAttachment=El,i.setProjectAttachments=jl,i.setProjectFile=_f,i.setProjectFiles=vf,i.setProjects=rl,i.setRehydrated=zf,i.setTeam=Ce,i.setTokens=Vp,i.setUploadUrl=ed,i.setUser=Dy,i.setUsers=zy,i.shallowEqual=zh,i.slugify=Qh,i.spacesToDashesLower=Xh,i.teamReducer=eh,i.teamSlice=va,i.toFileNameSafeString=Yh,i.toOfflineIdRecord=en,i.truncate=Zh,i.updateAsset=Be,i.updateAssetAttachment=nm,i.updateAssetAttachments=ln,i.updateAssetProcedure=Le,i.updateAssetProcedureAttachment=dm,i.updateAssetProcedureAttachments=Fn,i.updateAssetProcedureFieldValues=Ge,i.updateAssetProcedureFieldValuesAttachment=vm,i.updateAssetProcedureFieldValuesAttachments=Hn,i.updateAssetProcedureFieldValuesMany=ec,i.updateAssetProcedureFields=Gn,i.updateAssetProcedureFieldsAttachment=mm,i.updateAssetProcedureFieldsAttachments=qn,i.updateAssetProcedureFieldsMany=bm,i.updateAssetProcedureInstance=$e,i.updateAssetProcedureInstances=Cm,i.updateAssetProcedures=$m,i.updateAssetStage=vs,i.updateAssetStageCompletion=Tc,i.updateAssetStageCompletions=Fc,i.updateAssetStages=nt,i.updateAssetType=Je,i.updateAssetTypeAttachment=cp,i.updateAssetTypeAttachments=Cc,i.updateAssetTypeFieldValues=Ne,i.updateAssetTypeFieldValuesAttachment=Pp,i.updateAssetTypeFieldValuesAttachments=nr,i.updateAssetTypeFieldValuesMany=mr,i.updateAssetTypeFields=xc,i.updateAssetTypeFieldsAttachment=up,i.updateAssetTypeFieldsAttachments=Jc,i.updateAssetTypeFieldsMany=fp,i.updateAssetTypes=Cp,i.updateAssets=Wm,i.updateCategory=Pr,i.updateConversation=rn,i.updateDocumentAttachment=Kp,i.updateDocumentAttachments=qr,i.updateDocuments=ge,i.updateForm=mA,i.updateFormRevisionAttachment=nA,i.updateFormRevisionAttachments=cd,i.updateFormSubmission=jd,i.updateFormSubmissionAttachment=SA,i.updateFormSubmissionAttachments=Pd,i.updateFormSubmissions=TA,i.updateGeoImage=$d,i.updateGeoImages=FA,i.updateGeoJsonFeature=Ke,i.updateGeoJsonFeatures=RA,i.updateGeoJsonLayer=Ye,i.updateGeoJsonLayers=wA,i.updateIssue=St,i.updateIssueAssociation=no,i.updateIssueAssociations=DA,i.updateIssueAttachment=$A,i.updateIssueAttachments=po,i.updateIssueCommentAttachment=NA,i.updateIssueCommentAttachments=Ro,i.updateIssueType=Ou,i.updateIssueTypeAttachment=ZA,i.updateIssueTypeAttachments=No,i.updateIssueTypeFieldValues=Qe,i.updateIssueTypeFieldValuesAttachment=Py,i.updateIssueTypeFieldValuesAttachments=Su,i.updateIssueTypeFieldValuesMany=uy,i.updateIssueTypeFields=hu,i.updateIssueTypeFieldsAttachment=iy,i.updateIssueTypeFieldsAttachments=eu,i.updateIssueTypeFieldsMany=yy,i.updateLicense=fe,i.updateOrganization=pf,i.updateOrganizationAccess=Yu,i.updateOrganizations=mf,i.updateProject=dl,i.updateProjectAccess=el,i.updateProjectAttachment=Of,i.updateProjectAttachments=ql,i.updateProjectFile=Oa,i.updateProjectFiles=Ef,i.updateProjects=af,i.updateTeam=wa,i.updateUser=$y,i.updateUsers=Gy,i.userReducer=Hu,i.userSlice=pa,i.versioningReducer=sh,i.versioningSlice=th,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
@@ -1,4 +1,4 @@
1
- import { GeoJsonFeature, GeoJsonLayer, OvermapRootState, Payload, UUID } from '../../typings';
1
+ import { GeoJsonFeature, OvermapRootState, Payload, Project, UUID } from '../../typings';
2
2
  import { BaseSDK } from '../base';
3
3
  import { OptimisticModelResult } from '../typings';
4
4
  import { BaseApiService } from './BaseApiService';
@@ -6,5 +6,5 @@ export declare abstract class GeoJsonFeatureService<TState extends OvermapRootSt
6
6
  add(payload: Payload<GeoJsonFeature>): OptimisticModelResult<GeoJsonFeature>;
7
7
  update(payload: UUID<Partial<Payload<GeoJsonFeature>>>): OptimisticModelResult<GeoJsonFeature>;
8
8
  remove(uuid: GeoJsonFeature["uuid"]): Promise<undefined>;
9
- refreshStore(layerUuid: GeoJsonLayer["uuid"]): Promise<void>;
9
+ refreshStore(projectUuid: Project["uuid"]): Promise<void>;
10
10
  }
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.74-geojson-layers.1",
6
+ "version": "1.0.74-geojson-layers.2",
7
7
  "type": "module",
8
8
  "main": "dist/overmap-core.umd.cjs",
9
9
  "module": "dist/overmap-core.js",