@overmap-ai/core 1.0.78-attachment-model-improvements.16 → 1.0.78-attachment-model-improvements.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +12 -13
- package/dist/overmap-core.umd.cjs +2 -2
- package/dist/sdk/services/BaseOfflineFileModelApiService.d.ts +4 -4
- package/dist/sdk/services/DocumentAttachmentService.d.ts +2 -2
- package/dist/sdk/typings.d.ts +3 -3
- package/dist/typings/files.d.ts +2 -6
- package/dist/typings/models/assets.d.ts +4 -4
- package/dist/typings/models/documents.d.ts +2 -2
- package/dist/typings/models/fields.d.ts +3 -3
- package/dist/typings/models/geoImages.d.ts +2 -2
- package/dist/typings/models/issues.d.ts +4 -4
- package/dist/typings/models/projects.d.ts +3 -3
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -3785,18 +3785,17 @@ class D extends v {
|
|
|
3785
3785
|
if (!o)
|
|
3786
3786
|
throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);
|
|
3787
3787
|
this.dispatch(a(this.getId(o)));
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
}), c;
|
|
3788
|
+
try {
|
|
3789
|
+
return await this.enqueueRequest({
|
|
3790
|
+
description: S(h.DELETE, this.name, !1),
|
|
3791
|
+
method: h.DELETE,
|
|
3792
|
+
url: `${this.url}/${e}/`,
|
|
3793
|
+
blockers: [e],
|
|
3794
|
+
blocks: []
|
|
3795
|
+
});
|
|
3796
|
+
} catch (c) {
|
|
3797
|
+
throw this.dispatch(i(o)), c;
|
|
3798
|
+
}
|
|
3800
3799
|
}
|
|
3801
3800
|
}
|
|
3802
3801
|
class mg extends D {
|
|
@@ -8635,7 +8634,7 @@ class pP extends zI {
|
|
|
8635
8634
|
const n = await this._getRenewedTokens(e);
|
|
8636
8635
|
if (!n)
|
|
8637
8636
|
return;
|
|
8638
|
-
console.
|
|
8637
|
+
console.debug("Got renewed tokens"), this.setTokens(n);
|
|
8639
8638
|
} catch (n) {
|
|
8640
8639
|
throw console.error("Could not renew tokens; clearing auth", n), this.clearAuth(), n;
|
|
8641
8640
|
}
|
|
@@ -4,11 +4,11 @@ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ER
|
|
|
4
4
|
Action:`,s);const p=nt();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const r=nt();if(!r)throw new Error("Outbox coordinator not set");return r.registerRetry(s.payload.uuid),!1}function vF(t,s,e){var n;return(n=nt())==null?void 0:n.peek()}function VF(t,s){return ut().dispatch(tT(new Date().getTime())),Wn}const ct="An unknown error occurred",zF=500,ZI=["non_field_errors","detail"];function jF(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?ZI.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?ZI.includes(a)?c.join(`
|
|
5
5
|
`):c.map(d=>`${a}: ${d}`).join(`
|
|
6
6
|
`):`${a}: ${JSON.stringify(c)}`).join(`
|
|
7
|
-
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>zF?ct:e}class C extends Error{constructor(e){super(ct);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??jF(n,a)??ct,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function JI(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class DF extends UI{constructor(s){super(s)}}class st extends UI{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class qF extends st{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ra(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(la(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ua(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(da(n)),n}}function it(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class B extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class D extends B{constructor(){super(...arguments);y(this,"pageSize",$I)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,l=null,r=null;if("file"in e){const{file:_,...w}=e;l=await this.client.files.getFilePayload(_),r=URL.createObjectURL(_),d={...w,file_sha1:l.sha1,file_type:l.file_type,file_name:_.name,file_extension:l.extension,file_url:r}}else d=e;const u=this.buildModel(d),h=this.buildPayload(u);this.dispatch(n(u));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...h,...l?{file:l}:{}},blockers:this.getBlockers(u),blocks:this.getBlocks(u)});p.then(({instance:_})=>{this.dispatch(a(_))}).catch(_=>{throw this.dispatch(c(this.getId(u))),_}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=p.then(({instance:_})=>_),I=p.then(async({instance:_,presigned_url:w})=>{try{return w&&await this.client.files.processPresignedUrl(_.file_sha1,w),_.file_sha1}catch(b){throw console.error("Upload to s3 using presigned url failed.",b),b}});return[u,A,I]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=[],u=new Set,h=it(e,Math.min(n??e.length,Qe)),p=[];for(const w of h){const b=[],R={},M=[],q=[];for(const z of w){let k;if("file"in z){const{file:qn,...xg}=z,lt=await this.client.files.getFilePayload(qn);lt.sha1 in R||(R[lt.sha1]=lt);const rO=URL.createObjectURL(qn);u.add(rO),k={...xg,file_sha1:lt.sha1,file_type:lt.file_type,file_name:qn.name,file_extension:lt.extension,file_url:rO}}else k=z;const v=this.buildModel(k);r.push(v);const N=this.buildBulkPayload(v);b.push(N);const kt=this.getBlockers(v);M.push(...kt);const Qg=this.getBlocks(v);q.push(...Qg)}const U={payloads:b,submittedAt:l,files:Object.values(R),blockers:M,blocks:q};p.push(U)}this.dispatch(a(r));const A=p.map(w=>{const{submittedAt:b,files:R,payloads:M,blocks:q,blockers:U}=w;return this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:b,files:R,payloads:M},blockers:U,blocks:q})});Promise.all(A).then(w=>{const b=w.flatMap(R=>R.instances);this.dispatch(c(b))}).catch(w=>{throw this.dispatch(d(r.map(b=>this.getId(b)))),console.error(w),w}).finally(()=>{for(const w of u)URL.revokeObjectURL(w)});const I=Promise.all(A).then(w=>w.flatMap(({instances:b})=>b)),_=Promise.all(A).then(async w=>{const b=[];for(const{presigned_urls:R}of w){const M=this.client.files.processPresignedUrls(R);for(const[q,U]of Object.entries(M))try{await U,b.push(q)}catch(z){throw console.error("Upload to s3 using presigned url failed.",z),z}}return b});return[r,I,_]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const r=this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),r}}class $F extends D{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:ya,addMany:Qt,setOne:pa,setMany:Aa,updateOne:fa,updateMany:Sa,deleteOne:Ta,deleteMany:xt,initialize:ma});y(this,"selectors",{selectById:Oa,selectByIds:Pa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class CF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ma,addMany:Ra,setOne:wa,setMany:Ea,updateOne:Ba,updateMany:va,deleteOne:Va,deleteMany:za,initialize:ba});y(this,"selectors",{selectById:qa,selectByIds:$a})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){var A;const{store:n}=this.client,{asset_procedure_type:a,file_sha1:c,file_extension:d,file_name:l,file_type:r,file_url:u}=e,h=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,p=new Date().toISOString();return P({file_url:u,file_sha1:c,file_extension:d,file_name:l,file_type:r,created_by:h,submitted_at:p,asset_procedure_type:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class UF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:La,addMany:ka,setOne:Na,setMany:Ga,updateOne:Ha,updateMany:Wa,deleteOne:Ka,deleteMany:Ya,initialize:Ua});y(this,"selectors",{selectById:Xa,selectByIds:Qa})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class LF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:tc,addMany:sc,setOne:ic,setMany:nc,updateOne:ac,updateMany:cc,deleteOne:dc,deleteMany:rc,initialize:ec});y(this,"selectors",{selectById:oc,selectByIds:hc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class kF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:pc,addMany:ds,setOne:Ac,setMany:fc,updateOne:Sc,updateMany:Tc,deleteOne:Ic,deleteMany:rs,initialize:yc});y(this,"selectors",{selectById:Fc,selectByIds:gc})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class NF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:Rc,addMany:wc,setOne:Ec,setMany:Bc,updateOne:vc,updateMany:Vc,deleteOne:zc,deleteMany:jc,initialize:Mc});y(this,"selectors",{selectById:$c,selectByIds:Cc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{values:a,payloads:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=it(c,Math.min(n??c.length,Qe)),I=[];for(const b of A){const R=[];for(const M of b){const q=P({...M,values:M.values,created_by:h,submitted_at:u});p.push(q),R.push({uuid:q.uuid,asset:M.asset,fields_revision:M.fields_revision,asset_procedure:M.asset_procedure,published_at:M.published_at,values:q.values})}I.push({submitted_at:u,values:a,field_values:R})}this.dispatch(d(p));const _=[];for(const b of I){const{field_values:R}=b,M=R.map(({asset:v})=>v),q=R.map(({fields_revision:v})=>v),U=R.map(({asset_procedure:v})=>v),z=R.map(({uuid:v})=>v),k=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:b,blockers:M.concat(q).concat(U),blocks:z});_.push(k)}return Promise.all(_).then(b=>{this.dispatch(l(b.flat()))}).catch(()=>{this.dispatch(r(V(p)))}),[p,_]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=_c(e)(l);this.dispatch(a(e)),this.dispatch(rs(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ds(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class GF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:kc,addMany:hs,setOne:Wc,setMany:Kc,updateOne:Nc,updateMany:Gc,deleteOne:Hc,deleteMany:ms,initialize:Lc});y(this,"selectors",{selectById:Xc,selectByIds:Qc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_procedure_type,e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class HF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:td,addMany:sd,setOne:dd,setMany:rd,updateOne:id,updateMany:nd,deleteOne:ad,deleteMany:cd,initialize:ed});y(this,"selectors",{selectById:od,selectByIds:hd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=Jc(e)(l);this.dispatch(a(e)),this.dispatch(ms(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(hs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class WF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:pd,addMany:Ad,setOne:fd,setMany:Sd,updateOne:Td,updateMany:Id,deleteOne:Od,deleteMany:Pd,initialize:yd});y(this,"selectors",{selectById:gd,selectByIds:_d})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}buildBulkPayload(e){return{uuid:e.uuid,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class KF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:wd,addMany:Ed,setOne:Bd,setMany:vd,updateOne:Vd,updateMany:zd,deleteOne:jd,deleteMany:Dd,initialize:Rd});y(this,"selectors",{selectById:qd,selectByIds:$d})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_step],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const l=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(c)),r}),[d,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(d)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class YF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:kd,addMany:Os,setOne:Nd,setMany:Gd,updateOne:Hd,updateMany:Wd,deleteOne:Kd,deleteMany:Ps,initialize:Ld});y(this,"selectors",{selectById:Zd,selectByIds:Jd})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ZF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:tr,addMany:sr,setOne:ir,setMany:nr,updateOne:ar,updateMany:cr,deleteOne:dr,deleteMany:rr,initialize:er});y(this,"selectors",{selectById:lr,selectByIds:or})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=it(a,Math.min(n??a.length,Qe)),I=[];for(const b of A){const R=[];for(const M of b){const q=P({...M,values:M.values,created_by:h,submitted_at:u});p.push(q),R.push({uuid:q.uuid,asset:M.asset,fields_revision:M.fields_revision,asset_procedure:M.asset_procedure,asset_procedure_step:M.asset_procedure_step,published_at:M.published_at,values:q.values})}I.push({submitted_at:u,values:c,field_values:R})}this.dispatch(d(p));const _=[];for(const b of I){const{field_values:R}=b,M=R.map(({asset:v})=>v),q=R.map(({fields_revision:v})=>v),U=R.map(({asset_procedure:v})=>v),z=R.map(({uuid:v})=>v),k=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:b,blockers:M.concat(q).concat(U),blocks:z});_.push(k)}return Promise.all(_).then(b=>{this.dispatch(l(b.flat()))}).catch(()=>{this.dispatch(r(V(p)))}),[p,_]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Xd(e)(l);this.dispatch(a(e)),this.dispatch(Ps(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Os(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class JF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:fr,addMany:Sr,setOne:pr,setMany:Ar,updateOne:Tr,updateMany:Ir,deleteOne:Or,deleteMany:Pr,initialize:yr});y(this,"selectors",{selectById:gr,selectByIds:_r})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:d,deleteOne:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=br(e)(u);this.dispatch(l(e)),this.dispatch(a(V(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(d(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class XF extends B{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:wr,addMany:Rs,setOne:Vr,setMany:zr,updateOne:Er,updateMany:Br,deleteOne:vr,deleteMany:ws,initialize:Rr});y(this,"selectors",{selectById:qr,selectByIds:$r})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset with uuid ${e} found in the store`);const u=Fa(e)(l),h=qy(e)(l);this.dispatch(c(e)),this.dispatch(xt(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(Qt(u)),this.dispatch(xe(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Xe.v4(),l=it(e,Math.min(n??e.length,Qe)).map(h=>{const p=h.map(A=>P(A));return{batchId:Xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),r=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,I=A.assets.map(({uuid:M})=>M),_=A.assets.map(({asset_type:M})=>M),w=A.assets.map(({project:M})=>M),b=A.assets.map(({status:M})=>M),R=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:(u?[u]:[]).concat(_).concat(w).concat(b),blocks:[p].concat(I)});u=h.batchId,r.push(R)}return Promise.all(r).then(h=>{const p=h.flat();this.dispatch(a(p))}),r}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=V(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Yt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} assets that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=it(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const _=Xe.v4(),w=V(I),b=I.map(({status:M})=>M).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(b),blocks:[_].concat(w)});p.push(R),A=_}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class QF extends B{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:kr,addMany:Nr,setOne:Gr,setMany:Hr,updateOne:Wr,updateMany:Kr,deleteOne:Yr,deleteMany:Zr,initialize:Lr});y(this,"selectors",{selectById:xr,selectByIds:eu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_stage],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=e.map(_=>P(_)),h=u.map(_=>({..._,created_by:r,submitted_at:l})),p=h.map(({uuid:_})=>_);this.dispatch(a(h));const A=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:u},blockers:[...e.map(_=>_.asset_procedure),...e.map(_=>_.asset_stage),...e.map(_=>_.asset)],blocks:p});return A.then(_=>{this.dispatch(c(_))}).catch(()=>{this.dispatch(d(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class xF extends B{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:au,addMany:cu,setOne:iu,setMany:nu,updateOne:du,updateMany:ru,deleteOne:uu,deleteMany:lu,initialize:su});y(this,"selectors",{selectById:hu,selectByIds:mu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class eg extends D{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Au,addMany:js,setOne:fu,setMany:Su,updateOne:Tu,updateMany:Iu,deleteOne:Ou,deleteMany:Ds,initialize:pu});y(this,"selectors",{selectById:Fu,selectByIds:gu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class tg extends D{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:wu,addMany:Eu,setOne:Bu,setMany:vu,updateOne:Vu,updateMany:zu,deleteOne:ju,deleteMany:Du,initialize:Ru});y(this,"selectors",{selectById:$u,selectByIds:Cu})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class sg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Nu,addMany:Gu,setOne:Hu,setMany:Wu,updateOne:Ku,updateMany:Yu,deleteOne:Zu,deleteMany:Ju,initialize:ku});y(this,"selectors",{selectById:Qu,selectByIds:xu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ig extends D{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:il,addMany:ks,setOne:nl,setMany:al,updateOne:cl,updateMany:dl,deleteOne:rl,deleteMany:Ns,initialize:sl});y(this,"selectors",{selectById:ll,selectByIds:ol})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ng extends B{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Al,addMany:fl,setOne:Sl,setMany:Tl,updateOne:Il,updateMany:Ol,deleteOne:Pl,deleteMany:Fl,initialize:pl});y(this,"selectors",{selectById:_l,selectByIds:bl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var _;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=[],p=it(a,Math.min(n??a.length,Qe)),A=[];for(const w of p){const b=[];for(const R of w){const M=P({...R,values:R.values,created_by:((_=this.client.store.getState().userReducer.currentUser)==null?void 0:_.id)??null,submitted_at:u});h.push(M),b.push({uuid:M.uuid,asset:R.asset,fields_revision:R.fields_revision,published_at:R.published_at,values:M.values})}A.push({submitted_at:u,values:c,field_values:b})}this.dispatch(d(h));const I=[];for(const w of A){const{field_values:b}=w,R=b.map(({asset:z})=>z),M=b.map(({fields_revision:z})=>z),q=b.map(({uuid:z})=>z),U=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:w,blockers:R.concat(M),blocks:q});I.push(U)}return Promise.all(I).then(w=>{this.dispatch(l(w.flat()))}).catch(()=>{this.dispatch(r(V(h)))}),[h,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.asset],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=hl(e)(l);this.dispatch(a(e)),this.dispatch(Ns(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ks(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ag extends B{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:El,addMany:Bl,setOne:vl,setMany:Vl,updateOne:zl,updateMany:jl,deleteOne:Dl,deleteMany:ql,initialize:wl});y(this,"selectors",{selectById:Cl,selectByIds:Ul})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class cg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Gl,addMany:Hl,setOne:Wl,setMany:Kl,updateOne:Yl,updateMany:Zl,deleteOne:Jl,deleteMany:Xl,initialize:Nl});y(this,"selectors",{selectById:xl,selectByIds:eo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class dg extends B{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:co,addMany:ro,setOne:no,setMany:ao,updateOne:uo,updateMany:lo,deleteOne:oo,deleteMany:ho,initialize:io});y(this,"selectors",{selectById:yo,selectByIds:po})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=Dr(e)(l),h=_u(e)(l);this.dispatch(a(e)),this.dispatch(ws(V(u))),this.dispatch(Ds(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(Rs(u)),this.dispatch(js(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class rg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:To,addMany:Io,setOne:Oo,setMany:Po,updateOne:Fo,updateMany:go,deleteOne:_o,deleteMany:bo,initialize:So});y(this,"selectors",{selectById:Ro,selectByIds:wo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ug extends D{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Do,addMany:qo,setOne:$o,setMany:Co,updateOne:Uo,updateMany:Lo,deleteOne:ko,deleteMany:No,initialize:jo});y(this,"selectors",{selectById:Ho,selectByIds:Wo})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[a,c,d]=await super.bulkAdd(e,n),l={};for(const{file_sha1:r,uuid:u}of a)r in l||(l[r]=[]),l[r].push(u);return d.then(r=>{const u=r.flatMap(h=>l[h]??[]);for(const h of u)this.makeReadable(h)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class lg extends B{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:Jo,addMany:Xo,setOne:Qo,setMany:xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:ih,initialize:Zo});y(this,"selectors",{selectById:ah,selectByIds:ch})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:u.parent_document?[u.parent_document]:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:d,deleteMany:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=dh(e)(u);this.dispatch(a(e)),this.dispatch(l(V(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(d(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class dt extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class og extends dt{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:lh,addMany:oh,setOne:hh,setMany:mh,updateOne:yh,updateMany:ph,deleteOne:Ah,deleteMany:fh,initialize:uh});y(this,"selectors",{selectById:Th,selectByIds:Ih})}async add(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class hg extends st{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const At={},Vn=new Set;class mg extends st{constructor(){super(...arguments);y(this,"host");y(this,"dbPromise",yO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async getDB(){return await this.dbPromise}async addCache(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Tt(e);if(Vn.has(n))return;const a=await this.getDB();!!await a.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,n),Vn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),Vn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let l;c in At?l=At[c]:Xn(e)?(l=Jn(e,a),At[c]=l):(l=new Promise(h=>{this.performRequest({method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const A=new File([p],a,{type:p.type});h(A)})}),At[c]=l);let r;try{r=await l}catch(h){throw h instanceof C&&delete At[c],h}const u=await Tt(r);if(u!==n){const h=`The hash of the file returned from the server (${u}) does not match the
|
|
7
|
+
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>zF?ct:e}class C extends Error{constructor(e){super(ct);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??jF(n,a)??ct,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function JI(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class DF extends UI{constructor(s){super(s)}}class st extends UI{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class qF extends st{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ra(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(la(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ua(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(da(n)),n}}function it(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}function T(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class B extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class D extends B{constructor(){super(...arguments);y(this,"pageSize",$I)}async add(e){const{addOne:n,updateOne:a,deleteOne:c}=this.actions;let d,l=null,r=null;if("file"in e){const{file:_,...w}=e;l=await this.client.files.getFilePayload(_),r=URL.createObjectURL(_),d={...w,file_sha1:l.sha1,file_type:l.file_type,file_name:_.name,file_extension:l.extension,file_url:r}}else d=e;const u=this.buildModel(d),h=this.buildPayload(u);this.dispatch(n(u));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...h,...l?{file:l}:{}},blockers:this.getBlockers(u),blocks:this.getBlocks(u)});p.then(({instance:_})=>{this.dispatch(a(_))}).catch(_=>{throw this.dispatch(c(this.getId(u))),_}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=p.then(({instance:_})=>_),I=p.then(async({instance:_,presigned_url:w})=>{try{return w&&await this.client.files.processPresignedUrl(_.file_sha1,w),_.file_sha1}catch(b){throw console.error("Upload to s3 using presigned url failed.",b),b}});return[u,A,I]}async bulkAdd(e,n){const{addMany:a,updateMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=[],u=new Set,h=it(e,Math.min(n??e.length,Qe)),p=[];for(const w of h){const b=[],R={},M=[],q=[];for(const z of w){let k;if("file"in z){const{file:qn,...xg}=z,lt=await this.client.files.getFilePayload(qn);lt.sha1 in R||(R[lt.sha1]=lt);const rO=URL.createObjectURL(qn);u.add(rO),k={...xg,file_sha1:lt.sha1,file_type:lt.file_type,file_name:qn.name,file_extension:lt.extension,file_url:rO}}else k=z;const v=this.buildModel(k);r.push(v);const N=this.buildBulkPayload(v);b.push(N);const kt=this.getBlockers(v);M.push(...kt);const Qg=this.getBlocks(v);q.push(...Qg)}const U={payloads:b,submittedAt:l,files:Object.values(R),blockers:M,blocks:q};p.push(U)}this.dispatch(a(r));const A=p.map(w=>{const{submittedAt:b,files:R,payloads:M,blocks:q,blockers:U}=w;return this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:b,files:R,payloads:M},blockers:U,blocks:q})});Promise.all(A).then(w=>{const b=w.flatMap(R=>R.instances);this.dispatch(c(b))}).catch(w=>{throw this.dispatch(d(r.map(b=>this.getId(b)))),console.error(w),w}).finally(()=>{for(const w of u)URL.revokeObjectURL(w)});const I=Promise.all(A).then(w=>w.flatMap(({instances:b})=>b)),_=Promise.all(A).then(async w=>{const b=[];for(const{presigned_urls:R}of w){const M=this.client.files.processPresignedUrls(R);for(const[q,U]of Object.entries(M))try{await U,b.push(q)}catch(z){throw console.error("Upload to s3 using presigned url failed.",z),z}}return b});return[r,I,_]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(l)),r}}}class $F extends D{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:ya,addMany:Qt,setOne:pa,setMany:Aa,updateOne:fa,updateMany:Sa,deleteOne:Ta,deleteMany:xt,initialize:ma});y(this,"selectors",{selectById:Oa,selectByIds:Pa})}getId(e){return e.uuid}getBlockers(e){const{asset:n}=e;return[n]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(d)),d}}class CF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ma,addMany:Ra,setOne:wa,setMany:Ea,updateOne:Ba,updateMany:va,deleteOne:Va,deleteMany:za,initialize:ba});y(this,"selectors",{selectById:qa,selectByIds:$a})}getId(e){return e.uuid}getBlockers(e){return[e.asset_procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){var A;const{store:n}=this.client,{asset_procedure_type:a,file_sha1:c,file_extension:d,file_name:l,file_type:r,file_url:u}=e,h=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,p=new Date().toISOString();return P({file_url:u,file_sha1:c,file_extension:d,file_name:l,file_type:r,created_by:h,submitted_at:p,asset_procedure_type:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_procedure_type:e.asset_procedure_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class UF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:La,addMany:ka,setOne:Na,setMany:Ga,updateOne:Ha,updateMany:Wa,deleteOne:Ka,deleteMany:Ya,initialize:Ua});y(this,"selectors",{selectById:Xa,selectByIds:Qa})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class LF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:tc,addMany:sc,setOne:ic,setMany:nc,updateOne:ac,updateMany:cc,deleteOne:dc,deleteMany:rc,initialize:ec});y(this,"selectors",{selectById:oc,selectByIds:hc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class kF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:pc,addMany:ds,setOne:Ac,setMany:fc,updateOne:Sc,updateMany:Tc,deleteOne:Ic,deleteMany:rs,initialize:yc});y(this,"selectors",{selectById:Fc,selectByIds:gc})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class NF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:Rc,addMany:wc,setOne:Ec,setMany:Bc,updateOne:vc,updateMany:Vc,deleteOne:zc,deleteMany:jc,initialize:Mc});y(this,"selectors",{selectById:$c,selectByIds:Cc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{values:a,payloads:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=it(c,Math.min(n??c.length,Qe)),I=[];for(const b of A){const R=[];for(const M of b){const q=P({...M,values:M.values,created_by:h,submitted_at:u});p.push(q),R.push({uuid:q.uuid,asset:M.asset,fields_revision:M.fields_revision,asset_procedure:M.asset_procedure,published_at:M.published_at,values:q.values})}I.push({submitted_at:u,values:a,field_values:R})}this.dispatch(d(p));const _=[];for(const b of I){const{field_values:R}=b,M=R.map(({asset:v})=>v),q=R.map(({fields_revision:v})=>v),U=R.map(({asset_procedure:v})=>v),z=R.map(({uuid:v})=>v),k=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:b,blockers:M.concat(q).concat(U),blocks:z});_.push(k)}return Promise.all(_).then(b=>{this.dispatch(l(b.flat()))}).catch(()=>{this.dispatch(r(V(p)))}),[p,_]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=_c(e)(l);this.dispatch(a(e)),this.dispatch(rs(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ds(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class GF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:kc,addMany:hs,setOne:Wc,setMany:Kc,updateOne:Nc,updateMany:Gc,deleteOne:Hc,deleteMany:ms,initialize:Lc});y(this,"selectors",{selectById:Xc,selectByIds:Qc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_procedure_type,e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class HF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:td,addMany:sd,setOne:dd,setMany:rd,updateOne:id,updateMany:nd,deleteOne:ad,deleteMany:cd,initialize:ed});y(this,"selectors",{selectById:od,selectByIds:hd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const u=Jc(e)(l);this.dispatch(a(e)),this.dispatch(ms(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(hs(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class WF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:pd,addMany:Ad,setOne:fd,setMany:Sd,updateOne:Td,updateMany:Id,deleteOne:Od,deleteMany:Pd,initialize:yd});y(this,"selectors",{selectById:gd,selectByIds:_d})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}buildBulkPayload(e){return{uuid:e.uuid,field_identifier:e.field_identifier,fields_revision:e.fields_revision,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class KF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:wd,addMany:Ed,setOne:Bd,setMany:vd,updateOne:Vd,updateMany:zd,deleteOne:jd,deleteMany:Dd,initialize:Rd});y(this,"selectors",{selectById:qd,selectByIds:$d})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_step],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const d={...c,...e};this.dispatch(a(d));const l=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(a(c)),r}),[d,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,d=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!d)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(d)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class YF extends D{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:kd,addMany:Os,setOne:Nd,setMany:Gd,updateOne:Hd,updateMany:Wd,deleteOne:Kd,deleteMany:Ps,initialize:Ld});y(this,"selectors",{selectById:Zd,selectByIds:Jd})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ZF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:tr,addMany:sr,setOne:ir,setMany:nr,updateOne:ar,updateMany:cr,deleteOne:dr,deleteMany:rr,initialize:er});y(this,"selectors",{selectById:lr,selectByIds:or})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var w;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=((w=this.client.store.getState().userReducer.currentUser)==null?void 0:w.id)??null,p=[],A=it(a,Math.min(n??a.length,Qe)),I=[];for(const b of A){const R=[];for(const M of b){const q=P({...M,values:M.values,created_by:h,submitted_at:u});p.push(q),R.push({uuid:q.uuid,asset:M.asset,fields_revision:M.fields_revision,asset_procedure:M.asset_procedure,asset_procedure_step:M.asset_procedure_step,published_at:M.published_at,values:q.values})}I.push({submitted_at:u,values:c,field_values:R})}this.dispatch(d(p));const _=[];for(const b of I){const{field_values:R}=b,M=R.map(({asset:v})=>v),q=R.map(({fields_revision:v})=>v),U=R.map(({asset_procedure:v})=>v),z=R.map(({uuid:v})=>v),k=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:b,blockers:M.concat(q).concat(U),blocks:z});_.push(k)}return Promise.all(_).then(b=>{this.dispatch(l(b.flat()))}).catch(()=>{this.dispatch(r(V(p)))}),[p,_]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.fields_revision,r.asset,r.asset_procedure],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Xd(e)(l);this.dispatch(a(e)),this.dispatch(Ps(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Os(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class JF extends B{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:fr,addMany:Sr,setOne:pr,setMany:Ar,updateOne:Tr,updateMany:Ir,deleteOne:Or,deleteMany:Pr,initialize:yr});y(this,"selectors",{selectById:gr,selectByIds:_r})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:d,deleteOne:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=br(e)(u);this.dispatch(l(e)),this.dispatch(a(V(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(d(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class XF extends B{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:wr,addMany:Rs,setOne:Vr,setMany:zr,updateOne:Er,updateMany:Br,deleteOne:vr,deleteMany:ws,initialize:Rr});y(this,"selectors",{selectById:qr,selectByIds:$r})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset with uuid ${e} found in the store`);const u=Fa(e)(l),h=qy(e)(l);this.dispatch(c(e)),this.dispatch(xt(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(Qt(u)),this.dispatch(xe(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),d=Xe.v4(),l=it(e,Math.min(n??e.length,Qe)).map(h=>{const p=h.map(A=>P(A));return{batchId:Xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),r=[];let u=null;for(const h of l){const{batchId:p,payload:A}=h,I=A.assets.map(({uuid:M})=>M),_=A.assets.map(({asset_type:M})=>M),w=A.assets.map(({project:M})=>M),b=A.assets.map(({status:M})=>M),R=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:(u?[u]:[]).concat(_).concat(w).concat(b),blocks:[p].concat(I)});u=h.batchId,r.push(R)}return Promise.all(r).then(h=>{const p=h.flat();this.dispatch(a(p))}),r}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=V(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Yt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} assets that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=it(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const _=Xe.v4(),w=V(I),b=I.map(({status:M})=>M).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(b),blocks:[_].concat(w)});p.push(R),A=_}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(a(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class QF extends B{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:kr,addMany:Nr,setOne:Gr,setMany:Hr,updateOne:Wr,updateMany:Kr,deleteOne:Yr,deleteMany:Zr,initialize:Lr});y(this,"selectors",{selectById:xr,selectByIds:eu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_stage],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=new Date().toISOString(),r=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=e.map(_=>P(_)),h=u.map(_=>({..._,created_by:r,submitted_at:l})),p=h.map(({uuid:_})=>_);this.dispatch(a(h));const A=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:u},blockers:[...e.map(_=>_.asset_procedure),...e.map(_=>_.asset_stage),...e.map(_=>_.asset)],blocks:p});return A.then(_=>{this.dispatch(c(_))}).catch(()=>{this.dispatch(d(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(d)),d}}class xF extends B{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:au,addMany:cu,setOne:iu,setMany:nu,updateOne:du,updateMany:ru,deleteOne:uu,deleteMany:lu,initialize:su});y(this,"selectors",{selectById:hu,selectByIds:mu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_procedure_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class eg extends D{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Au,addMany:js,setOne:fu,setMany:Su,updateOne:Tu,updateMany:Iu,deleteOne:Ou,deleteMany:Ds,initialize:pu});y(this,"selectors",{selectById:Fu,selectByIds:gu})}getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class tg extends D{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:wu,addMany:Eu,setOne:Bu,setMany:vu,updateOne:Vu,updateMany:zu,deleteOne:ju,deleteMany:Du,initialize:Ru});y(this,"selectors",{selectById:$u,selectByIds:Cu})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class sg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Nu,addMany:Gu,setOne:Hu,setMany:Wu,updateOne:Ku,updateMany:Yu,deleteOne:Zu,deleteMany:Ju,initialize:ku});y(this,"selectors",{selectById:Qu,selectByIds:xu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ig extends D{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:il,addMany:ks,setOne:nl,setMany:al,updateOne:cl,updateMany:dl,deleteOne:rl,deleteMany:Ns,initialize:sl});y(this,"selectors",{selectById:ll,selectByIds:ol})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ng extends B{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Al,addMany:fl,setOne:Sl,setMany:Tl,updateOne:Il,updateMany:Ol,deleteOne:Pl,deleteMany:Fl,initialize:pl});y(this,"selectors",{selectById:_l,selectByIds:bl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}bulkAdd(e,n){var _;const{payloads:a,values:c}=e,{addMany:d,setMany:l,deleteMany:r}=this.actions,u=new Date().toISOString(),h=[],p=it(a,Math.min(n??a.length,Qe)),A=[];for(const w of p){const b=[];for(const R of w){const M=P({...R,values:R.values,created_by:((_=this.client.store.getState().userReducer.currentUser)==null?void 0:_.id)??null,submitted_at:u});h.push(M),b.push({uuid:M.uuid,asset:R.asset,fields_revision:R.fields_revision,published_at:R.published_at,values:M.values})}A.push({submitted_at:u,values:c,field_values:b})}this.dispatch(d(h));const I=[];for(const w of A){const{field_values:b}=w,R=b.map(({asset:z})=>z),M=b.map(({fields_revision:z})=>z),q=b.map(({uuid:z})=>z),U=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:w,blockers:R.concat(M),blocks:q});I.push(U)}return Promise.all(I).then(w=>{this.dispatch(l(w.flat()))}).catch(()=>{this.dispatch(r(V(h)))}),[h,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.asset],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=hl(e)(l);this.dispatch(a(e)),this.dispatch(Ns(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(ks(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class ag extends B{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:El,addMany:Bl,setOne:vl,setMany:Vl,updateOne:zl,updateMany:jl,deleteOne:Dl,deleteMany:ql,initialize:wl});y(this,"selectors",{selectById:Cl,selectByIds:Ul})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class cg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Gl,addMany:Hl,setOne:Wl,setMany:Kl,updateOne:Yl,updateMany:Zl,deleteOne:Jl,deleteMany:Xl,initialize:Nl});y(this,"selectors",{selectById:xl,selectByIds:eo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset,e.asset_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class dg extends B{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:co,addMany:ro,setOne:no,setMany:ao,updateOne:uo,updateMany:lo,deleteOne:oo,deleteMany:ho,initialize:io});y(this,"selectors",{selectById:yo,selectByIds:po})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected asset type with uuid ${e} to exist`);const u=Dr(e)(l),h=_u(e)(l);this.dispatch(a(e)),this.dispatch(ws(V(u))),this.dispatch(Ds(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(Rs(u)),this.dispatch(js(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class rg extends B{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:To,addMany:Io,setOne:Oo,setMany:Po,updateOne:Fo,updateMany:go,deleteOne:_o,deleteMany:bo,initialize:So});y(this,"selectors",{selectById:Ro,selectByIds:wo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.asset_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class ug extends D{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Do,addMany:qo,setOne:$o,setMany:Co,updateOne:Uo,updateMany:Lo,deleteOne:ko,deleteMany:No,initialize:jo});y(this,"selectors",{selectById:Ho,selectByIds:Wo})}getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,n){const[a,c,d]=await super.bulkAdd(e,n),l={};for(const{file_sha1:r,uuid:u}of a)r in l||(l[r]=[]),l[r].push(u);return d.then(r=>{const u=r.flatMap(h=>l[h]??[]);for(const h of u)this.makeReadable(h)}),[a,c,d]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),d=this.list({queryParams:{document__organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class lg extends B{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:Jo,addMany:Xo,setOne:Qo,setMany:xo,updateOne:eh,updateMany:th,deleteOne:sh,deleteMany:ih,initialize:Zo});y(this,"selectors",{selectById:ah,selectByIds:ch})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:u.parent_document?[u.parent_document]:[],blocks:[u.uuid]});return h.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:d,deleteMany:l}=this.actions,{selectById:r}=this.selectors,u=n.getState(),h=r(e)(u);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=dh(e)(u);this.dispatch(a(e)),this.dispatch(l(V(p)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(d(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),d=this.list({queryParams:{organization:e}},n),r=(await Promise.all([c,d])).flat();return this.dispatch(a(r)),r}}class dt extends st{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class og extends dt{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:lh,addMany:oh,setOne:hh,setMany:mh,updateOne:yh,updateMany:ph,deleteOne:Ah,deleteMany:fh,initialize:uh});y(this,"selectors",{selectById:Th,selectByIds:Ih})}async add(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class hg extends st{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const At={},Vn=new Set;class mg extends st{constructor(){super(...arguments);y(this,"host");y(this,"dbPromise",yO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async getDB(){return await this.dbPromise}async addCache(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const n=await Tt(e);if(Vn.has(n))return;const a=await this.getDB();!!await a.get("files",n)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,n),Vn.add(n)}async removeCache(e){await(await this.getDB()).delete("files",e),Vn.delete(e)}async fetchCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,n,a=n){const c=e.split("?")[0]??e,d=await this.fetchCache(n);if(d)return d;let l;c in At?l=At[c]:Xn(e)?(l=Jn(e,a),At[c]=l):(l=new Promise(h=>{this.performRequest({method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1}).then(p=>{const A=new File([p],a,{type:p.type});h(A)})}),At[c]=l);let r;try{r=await l}catch(h){throw h instanceof C&&delete At[c],h}const u=await Tt(r);if(u!==n){const h=`The hash of the file returned from the server (${u}) does not match the
|
|
8
8
|
expected hash (${n}). This can happen if you're using a local development server and the
|
|
9
9
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
10
10
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
11
11
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
12
12
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
13
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(h)}return await this.addCache(r),r}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(n.warning),new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.processPresignedUrl(a,c);return n}async getFilePayload(e){const a={sha1:await Tt(e),file_type:e.type,extension:Yn(e),size:e.size};return await this.client.files.addCache(e),a}}class yg extends B{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Mh,addMany:Rh,setOne:wh,setMany:Eh,updateOne:Bh,updateMany:vh,deleteOne:Vh,deleteMany:zh,initialize:bh});y(this,"selectors",{selectById:Dh,selectByIds:qh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.form],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class pg extends B{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:Lh,addMany:kh,setOne:Nh,setMany:Gh,updateOne:Hh,updateMany:Wh,deleteOne:Kh,deleteMany:Yh,initialize:Uh});y(this,"selectors",{selectById:Jh,selectByIds:Xh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.form_submission,e.form_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Ag extends D{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:tm,addMany:sm,setOne:im,setMany:nm,updateOne:am,updateMany:cm,deleteOne:dm,deleteMany:rm,initialize:em});y(this,"selectors",{selectById:lm,selectByIds:om})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends B{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:oi,addMany:hi,setOne:pm,setMany:Am,updateOne:fm,updateMany:Sm,deleteOne:mi,deleteMany:yi,initialize:ym});y(this,"selectors",{selectById:Tm,selectByIds:Im})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Sg extends B{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:_m,addMany:bm,setOne:Mm,setMany:Rm,updateOne:wm,updateMany:Em,deleteOne:Bm,deleteMany:vm,initialize:gm});y(this,"selectors",{selectById:jm,selectByIds:Dm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=P({...e,submitted_at:l,created_by:r}),h=P({...n,form:u.uuid,submitted_at:l,created_by:r});this.dispatch(c(u)),this.dispatch(oi(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...E(u),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[u.uuid,h.uuid]});return p.catch(I=>{throw this.dispatch(d(u.uuid)),this.dispatch(mi(h.uuid)),I}),[u,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error("Expected form to exist");const u=cy(e)(l),h=Om(e)(l);this.dispatch(a(e)),this.dispatch(bi(V(u))),this.dispatch(yi(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(hi(h)),this.dispatch(_i(u)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends D{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:Cm,addMany:Ti,setOne:Um,setMany:Lm,updateOne:km,updateMany:Nm,deleteOne:Gm,deleteMany:Ii,initialize:$m});y(this,"selectors",{selectById:Hm,selectByIds:Wm})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,d=n.getState(),l=Fi(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Ig extends B{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:xm,addMany:_i,setOne:Xm,setMany:Qm,updateOne:ey,updateMany:ty,deleteOne:sy,deleteMany:bi,initialize:Jm});y(this,"selectors",{selectById:ny,selectByIds:ay})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Km(e)(l);this.dispatch(a(e)),this.dispatch(Ii(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ti(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Og extends D{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:hy,addMany:my,setOne:ly,setMany:oy,updateOne:yy,updateMany:py,deleteOne:Ay,deleteMany:fy,initialize:uy});y(this,"selectors",{selectById:Ty,selectByIds:Iy})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Pg extends B{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Ry,addMany:xe,setOne:_y,setMany:gy,updateOne:by,updateMany:My,deleteOne:wy,deleteMany:et,initialize:Fy});y(this,"selectors",{selectById:By,selectByIds:vy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=P({...e,submitted_at:l,created_by:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Fg extends D{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:Ly,addMany:vi,setOne:ky,setMany:Ny,updateOne:Gy,updateMany:Hy,deleteOne:Wy,deleteMany:Vi,initialize:Uy});y(this,"selectors",{selectById:Zy,selectByIds:Jy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class gg extends D{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:ep,addMany:tp,setOne:sp,setMany:ip,updateOne:np,updateMany:ap,deleteOne:cp,deleteMany:dp,initialize:xy});y(this,"selectors",{selectById:up,selectByIds:lp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class _g extends B{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:yp,addMany:pp,setOne:Ap,setMany:fp,updateOne:Sp,updateMany:Tp,deleteOne:Ip,deleteMany:Op,initialize:mp});y(this,"selectors",{selectById:Pp,selectByIds:Fp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=P({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.issue],blocks:[l.uuid]});return r.then(u=>{this.dispatch(c(u))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class bg extends B{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Mp,addMany:Ui,setOne:Rp,setMany:wp,updateOne:Ep,updateMany:Bp,deleteOne:vp,deleteMany:Li,initialize:bp});y(this,"selectors",{selectById:zp,selectByIds:jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=n.getState(),r=new Date().toISOString(),u=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=P({...e,submitted_at:r,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,h.status],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(I=>{throw this.dispatch(d(h.uuid)),I}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...d,...e};this.dispatch(n(l));const r={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==d[A])switch(A){case $.PRIORITY:r[A]=e[A];break;case $.DUE_DATE:r[A]=e[A];break;case $.DESCRIPTION:r[A]=e[A];break;case $.TITLE:r[A]=e[A];break;case $.STATUS:{const I=e[A],_=cn(I)(c);if(!_)throw new Error(`Trying to update issue type status with ${I} which does not exist in store`);r[A]={name:_.name,color:_.color,uuid:_.uuid};break}case $.ASSIGNED_TO:{const I=e[A];if(I===null)r[A]=null;else{const _=$t(I)(c);if(!_)throw new Error(`Trying to update assigned to with ${I} which does not exist in store.`);r[A]={full_name:_.username,id:_.id}}break}}const u=P({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:r});this.dispatch(rn(u));const h=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(d)),this.dispatch(ln(u.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=V(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Yt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} issues that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=it(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const _=Xe.v4(),w=V(I),b=I.map(({status:M})=>M).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(b),blocks:[_].concat(w)});p.push(R),A=_}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No issue with uuid ${e} found in the store`);const u=Vy(e)(l),h=Dy(e)(l),p=Yy(e)(l),A=uS(e)(l);this.dispatch(a(e)),this.dispatch(Vi(V(p))),this.dispatch(on(V(A))),this.dispatch(et(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(c(r)),this.dispatch(vi(p)),this.dispatch(un(A)),this.dispatch(xe(u)),this.dispatch(xe(h)),I}}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l),u=zy(e)(l),h=jy(e)(l);this.dispatch(c(e)),this.dispatch(et(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(xe(u)),this.dispatch(xe(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Mg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:Up,addMany:Lp,setOne:kp,setMany:Np,updateOne:Gp,updateMany:Hp,deleteOne:Wp,deleteMany:Kp,initialize:Cp});y(this,"selectors",{selectById:Zp,selectByIds:Jp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:eA,addMany:tA,setOne:sA,setMany:iA,updateOne:nA,updateMany:aA,deleteOne:cA,deleteMany:dA,initialize:xp});y(this,"selectors",{selectById:uA,selectByIds:lA})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class wg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:RA,addMany:wA,setOne:EA,setMany:BA,updateOne:vA,updateMany:VA,deleteOne:zA,deleteMany:jA,initialize:MA});y(this,"selectors",{selectById:qA,selectByIds:$A})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:kA,addMany:Zi,setOne:NA,setMany:GA,updateOne:HA,updateMany:WA,deleteOne:KA,deleteMany:Ji,initialize:LA});y(this,"selectors",{selectById:ZA,selectByIds:JA})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Bg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:yA,addMany:pA,setOne:AA,setMany:fA,updateOne:SA,updateMany:TA,deleteOne:IA,deleteMany:OA,initialize:mA});y(this,"selectors",{selectById:FA,selectByIds:gA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.issue],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=XA(e)(l);this.dispatch(a(e)),this.dispatch(Ji(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Zi(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class vg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:tf,addMany:sf,setOne:nf,setMany:af,updateOne:cf,updateMany:df,deleteOne:rf,deleteMany:uf,initialize:ef});y(this,"selectors",{selectById:of,selectByIds:hf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:Af,addMany:ff,setOne:Sf,setMany:Tf,updateOne:If,updateMany:Of,deleteOne:Pf,deleteMany:Ff,initialize:pf});y(this,"selectors",{selectById:_f,selectByIds:bf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue,e.issue_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class zg extends B{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Ef,addMany:Bf,setOne:vf,setMany:Vf,updateOne:zf,updateMany:jf,deleteOne:Df,deleteMany:qf,initialize:wf});y(this,"selectors",{selectById:Cf,selectByIds:Uf})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,submitted_at:u,created_by:r});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=Dp(e)(l);this.dispatch(a(e)),this.dispatch(Li(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ui(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class jg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:Gf,addMany:Hf,setOne:Wf,setMany:Kf,updateOne:Yf,updateMany:Zf,deleteOne:Jf,deleteMany:Xf,initialize:Nf});y(this,"selectors",{selectById:cn,selectByIds:xf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Dg extends B{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:rn,addMany:un,setOne:iS,setMany:nS,updateOne:aS,updateMany:cS,deleteOne:ln,deleteMany:on,initialize:sS});y(this,"selectors",{selectById:dS,selectByIds:rS})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const qg=1800;function $g(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 Cg extends DF{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(vo(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=pO(e).exp??n}catch{a=n}return a-n<qg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof C&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??ct).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new C({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new C({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=Xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens($g(a))})}}class Ug extends dt{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:gS,addMany:_S,setOne:bS,setMany:MS,updateOne:RS,updateMany:wS,deleteOne:ES,deleteMany:BS,initialize:FS});y(this,"selectors",{selectById:VS,selectByIds:zS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l),u=$t(r.user)(l);this.dispatch(a(r.uuid)),this.dispatch(An(r.user));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${r.uuid}/`,blockers:[r.uuid],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(pn(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends dt{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:LS,addMany:US,setOne:CS,setMany:$S,updateOne:NS,updateMany:kS,deleteOne:GS,deleteMany:HS,initialize:qS});y(this,"selectors",{selectById:YS,selectByIds:ZS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class kg extends B{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:aT,addMany:cT,setOne:dT,setMany:rT,updateOne:uT,updateMany:lT,deleteOne:oT,deleteMany:hT,initialize:nT});y(this,"selectors",{selectById:yT,selectByIds:pT})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(d(l.uuid)),h}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:r.map(p=>E(p))},blockers:r.flatMap(p=>[p.project,p.organization_access]),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(d(p))}).catch(p=>{throw this.dispatch(c(r.map(A=>A.uuid))),p}),[r,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends D{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:ST,addMany:TT,setOne:IT,setMany:OT,updateOne:PT,updateMany:FT,deleteOne:gT,deleteMany:_T,initialize:fT});y(this,"selectors",{selectById:MT,selectByIds:RT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends D{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:zT,addMany:jT,setOne:vT,setMany:VT,updateOne:DT,updateMany:qT,deleteOne:$T,deleteMany:CT,initialize:BT});y(this,"selectors",{selectById:kT,selectByIds:NT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Hg extends dt{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:JT,addMany:ZT,setOne:YT,setMany:KT,updateOne:QT,updateMany:XT,deleteOne:xT,deleteMany:eI,initialize:WT});y(this,"selectors",{selectById:iI,selectByIds:nI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Wg extends B{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:rI,addMany:uI,setOne:lI,setMany:oI,updateOne:hI,updateMany:mI,deleteOne:yI,deleteMany:pI,initialize:dI});y(this,"selectors",{selectById:SI,selectByIds:TI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.team],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:r.map(p=>E(p))},blockers:r.map(p=>p.team),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(d(r.map(p=>p.uuid)))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class Kg extends B{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:PI,addMany:FI,setOne:gI,setMany:_I,updateOne:bI,updateMany:MI,deleteOne:RI,deleteMany:wI,initialize:OI});y(this,"selectors",{selectById:BI,selectByIds:vI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,submitted_at:new Date().toISOString(),created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Yg extends dt{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:pn,addMany:pS,setOne:yS,setMany:mS,updateOne:fS,updateMany:AS,deleteOne:An,deleteMany:SS,initialize:hS});y(this,"selectors",{selectById:$t,selectByIds:OS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:d,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function zn(t,s,e,n,a){const c=n instanceof st;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:r,headers:u,method:h,queryParams:p,attachmentHash:A,isExternalUrl:I,isAuthNeeded:_,isResponseBlob:w}={...d,...s};let b=s.url;const R=A?await e.files.fetchCache(A):void 0;if(A&&!R)throw new Error(`Cannot upload file ${A} because it's not cached.`);!I&&!b.startsWith("http")&&(!b.startsWith("/")&&!b.startsWith("blob:")&&(b="/"+b),b=t+b);const M=v=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!R)throw new Error(`No file for file ${A}`);const N=l.fields["x-amz-checksum-sha1"];if(!N)throw new Error(`No checksum for file ${A}`);return v.set("x-amz-checksum-sha1",N).field({...r,...l.fields}).attach("file",R)}return v.send(r)},U={[m.GET]:()=>w?at.get(b.toString()).responseType("blob"):at.get(b.toString()),[m.POST]:()=>{const v=at.post(b.toString());return M(v)},[m.PATCH]:()=>{const v=at.patch(b.toString());return M(v)},[m.PUT]:()=>{const v=at.put(b.toString());return M(v)},[m.DELETE]:()=>{const v=at.delete(b.toString());return M(v)}}[h];let z=U();const k=()=>{console.debug("aborting request:",s.url),z.abort()};if(a==null||a.addEventListener("abort",k),_&&c){const v=n.auth.getAuthHeader();z=z.set("Authorization",v)}u&&(z=z.set(u));try{return await z.query(p)}catch(v){const N=JI(v),kt=N==null?void 0:N.status;if(c&&kt===401)return await n.auth.handleUnauthorized(z,N),z.query(p);throw new C({response:N,innerError:v,discard:vn.includes(kt)})}finally{a==null||a.removeEventListener("abort",k)}}class Zg{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Gt,d={...e,uuid:e.uuid??Xe.v4()};return zn(s,d,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??ct).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof C)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof C)throw a;return a})}_enqueueRequest(s,e,n){const a=new Gt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(xS(c)),l=u=>{if(u)a.resolve(u.body);else{const h=new C({message:"Could not get a response from the server.",response:u,discard:!0});a.reject(h)}},r=u=>{u instanceof C?u.options.discard=!0:(console.error("Received an unexpected error while processing a request:",u,`
|
|
13
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(h)}return await this.addCache(r),r}processPresignedUrl(e,n){if("warning"in n){if(n.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(n.warning),new Error(n.warning)}return this.enqueueRequest({url:n.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n.fields.key}`],blocks:[e],s3url:n})}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.processPresignedUrl(a,c);return n}async getFilePayload(e){const a={sha1:await Tt(e),file_type:e.type,extension:Yn(e),size:e.size};return await this.client.files.addCache(e),a}}class yg extends B{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Mh,addMany:Rh,setOne:wh,setMany:Eh,updateOne:Bh,updateMany:vh,deleteOne:Vh,deleteMany:zh,initialize:bh});y(this,"selectors",{selectById:Dh,selectByIds:qh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.form],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class pg extends B{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:Lh,addMany:kh,setOne:Nh,setMany:Gh,updateOne:Hh,updateMany:Wh,deleteOne:Kh,deleteMany:Yh,initialize:Uh});y(this,"selectors",{selectById:Jh,selectByIds:Xh})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.form_submission,e.form_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Ag extends D{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:tm,addMany:sm,setOne:im,setMany:nm,updateOne:am,updateMany:cm,deleteOne:dm,deleteMany:rm,initialize:em});y(this,"selectors",{selectById:lm,selectByIds:om})}getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends B{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:oi,addMany:hi,setOne:pm,setMany:Am,updateOne:fm,updateMany:Sm,deleteOne:mi,deleteMany:yi,initialize:ym});y(this,"selectors",{selectById:Tm,selectByIds:Im})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Sg extends B{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:_m,addMany:bm,setOne:Mm,setMany:Rm,updateOne:wm,updateMany:Em,deleteOne:Bm,deleteMany:vm,initialize:gm});y(this,"selectors",{selectById:jm,selectByIds:Dm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=P({...e,submitted_at:l,created_by:r}),h=P({...n,form:u.uuid,submitted_at:l,created_by:r});this.dispatch(c(u)),this.dispatch(oi(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...E(u),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[u.uuid,h.uuid]});return p.catch(I=>{throw this.dispatch(d(u.uuid)),this.dispatch(mi(h.uuid)),I}),[u,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error("Expected form to exist");const u=cy(e)(l),h=Om(e)(l);this.dispatch(a(e)),this.dispatch(bi(V(u))),this.dispatch(yi(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(r)),this.dispatch(hi(h)),this.dispatch(_i(u)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends D{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:Cm,addMany:Ti,setOne:Um,setMany:Lm,updateOne:km,updateMany:Nm,deleteOne:Gm,deleteMany:Ii,initialize:$m});y(this,"selectors",{selectById:Hm,selectByIds:Wm})}getId(e){return e.uuid}getBlockers(e){return[e.form_submission]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,form_submission:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,d=n.getState(),l=Fi(e)(d);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Ig extends B{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:xm,addMany:_i,setOne:Xm,setMany:Qm,updateOne:ey,updateMany:ty,deleteOne:sy,deleteMany:bi,initialize:Jm});y(this,"selectors",{selectById:ny,selectByIds:ay})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=Km(e)(l);this.dispatch(a(e)),this.dispatch(Ii(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ti(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(d)),d}}class Og extends D{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:hy,addMany:my,setOne:ly,setMany:oy,updateOne:yy,updateMany:py,deleteOne:Ay,deleteMany:fy,initialize:uy});y(this,"selectors",{selectById:Ty,selectByIds:Iy})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,canvas_marker:e.canvas_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Pg extends B{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Ry,addMany:xe,setOne:_y,setMany:gy,updateOne:by,updateMany:My,deleteOne:wy,deleteMany:et,initialize:Fy});y(this,"selectors",{selectById:By,selectByIds:vy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=new Date().toISOString(),r=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=P({...e,submitted_at:l,created_by:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class Fg extends D{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:Ly,addMany:vi,setOne:ky,setMany:Ny,updateOne:Gy,updateMany:Hy,deleteOne:Wy,deleteMany:Vi,initialize:Uy});y(this,"selectors",{selectById:Zy,selectByIds:Jy})}getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class gg extends D{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:ep,addMany:tp,setOne:sp,setMany:ip,updateOne:np,updateMany:ap,deleteOne:cp,deleteMany:dp,initialize:xy});y(this,"selectors",{selectById:up,selectByIds:lp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class _g extends B{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:yp,addMany:pp,setOne:Ap,setMany:fp,updateOne:Sp,updateMany:Tp,deleteOne:Ip,deleteMany:Op,initialize:mp});y(this,"selectors",{selectById:Pp,selectByIds:Fp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:d}=this.actions,l=P({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.issue],blocks:[l.uuid]});return r.then(u=>{this.dispatch(c(u))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{setMany:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}class bg extends B{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:Mp,addMany:Ui,setOne:Rp,setMany:wp,updateOne:Ep,updateMany:Bp,deleteOne:vp,deleteMany:Li,initialize:bp});y(this,"selectors",{selectById:zp,selectByIds:jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=n.getState(),r=new Date().toISOString(),u=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=P({...e,submitted_at:r,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[h.project,h.issue_type,h.status],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(I=>{throw this.dispatch(d(h.uuid)),I}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...d,...e};this.dispatch(n(l));const r={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==d[A])switch(A){case $.PRIORITY:r[A]=e[A];break;case $.DUE_DATE:r[A]=e[A];break;case $.DESCRIPTION:r[A]=e[A];break;case $.TITLE:r[A]=e[A];break;case $.STATUS:{const I=e[A],_=cn(I)(c);if(!_)throw new Error(`Trying to update issue type status with ${I} which does not exist in store`);r[A]={name:_.name,color:_.color,uuid:_.uuid};break}case $.ASSIGNED_TO:{const I=e[A];if(I===null)r[A]=null;else{const _=$t(I)(c);if(!_)throw new Error(`Trying to update assigned to with ${I} which does not exist in store.`);r[A]={full_name:_.username,id:_.id}}break}}const u=P({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:d.uuid,changes:r});this.dispatch(rn(u));const h=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(d)),this.dispatch(ln(u.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:d}=this.selectors,l=V(e).toSorted(It);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const r=d(l)(a.getState()).toSorted(Yt);if(l.length!=r.length)throw new Error(`Attempting to bulk update ${l.length-r.length} issues that dont exist in the store`);const u=[];for(let I=0;I<l.length;I++)u.push({...r[I],...e[I]});this.dispatch(c(u));const h=it(e,Math.min(n??e.length,Qe)),p=[];let A=null;for(const I of h){const _=Xe.v4(),w=V(I),b=I.map(({status:M})=>M).filter(Boolean),R=this.enqueueRequest({description:T(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:I},blockers:(A?[A]:[]).concat(w).concat(b),blocks:[_].concat(w)});p.push(R),A=_}return Promise.all(p).then(I=>{this.dispatch(c(I.flat()))}).catch(()=>{this.dispatch(c(r))}),[u,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`No issue with uuid ${e} found in the store`);const u=Vy(e)(l),h=Dy(e)(l),p=Yy(e)(l),A=uS(e)(l);this.dispatch(a(e)),this.dispatch(Vi(V(p))),this.dispatch(on(V(A))),this.dispatch(et(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(I){throw this.dispatch(c(r)),this.dispatch(vi(p)),this.dispatch(un(A)),this.dispatch(xe(u)),this.dispatch(xe(h)),I}}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l),u=zy(e)(l),h=jy(e)(l);this.dispatch(c(e)),this.dispatch(et(V(u))),this.dispatch(et(V(h)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(a(r)),this.dispatch(xe(u)),this.dispatch(xe(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Mg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:Up,addMany:Lp,setOne:kp,setMany:Np,updateOne:Gp,updateMany:Hp,deleteOne:Wp,deleteMany:Kp,initialize:Cp});y(this,"selectors",{selectById:Zp,selectByIds:Jp})}getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:eA,addMany:tA,setOne:sA,setMany:iA,updateOne:nA,updateMany:aA,deleteOne:cA,deleteMany:dA,initialize:xp});y(this,"selectors",{selectById:uA,selectByIds:lA})}getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,fields_revision:c,file_sha1:d,file_name:l,file_extension:r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class wg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:RA,addMany:wA,setOne:EA,setMany:BA,updateOne:vA,updateMany:VA,deleteOne:zA,deleteMany:jA,initialize:MA});y(this,"selectors",{selectById:qA,selectByIds:$A})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(d(u.uuid)),A}),[u,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends D{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:kA,addMany:Zi,setOne:NA,setMany:GA,updateOne:HA,updateMany:WA,deleteOne:KA,deleteMany:Ji,initialize:LA});y(this,"selectors",{selectById:ZA,selectByIds:JA})}getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,submitted_at:e.submitted_at,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}buildBulkPayload(e){const{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}=e;return{uuid:n,field_identifier:a,field_values:c,file_sha1:d,file_name:l,file_extension:r}}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:d}=this.selectors,l=n.getState(),r=d(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class Bg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:yA,addMany:pA,setOne:AA,setMany:fA,updateOne:SA,updateMany:TA,deleteOne:IA,deleteMany:OA,initialize:mA});y(this,"selectors",{selectById:FA,selectByIds:gA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,created_by:r,submitted_at:u}),p=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid,r.fields_revision,r.issue],blocks:[r.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected submission with uuid ${e} to exist`);const u=XA(e)(l);this.dispatch(a(e)),this.dispatch(Ji(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Zi(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class vg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:tf,addMany:sf,setOne:nf,setMany:af,updateOne:cf,updateMany:df,deleteOne:rf,deleteMany:uf,initialize:ef});y(this,"selectors",{selectById:of,selectByIds:hf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[u.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:Af,addMany:ff,setOne:Sf,setMany:Tf,updateOne:If,updateMany:Of,deleteOne:Pf,deleteMany:Ff,initialize:pf});y(this,"selectors",{selectById:_f,selectByIds:bf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue,e.issue_type_identifier],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(d)),d}}class zg extends B{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Ef,addMany:Bf,setOne:vf,setMany:Vf,updateOne:zf,updateMany:jf,deleteOne:Df,deleteMany:qf,initialize:wf});y(this,"selectors",{selectById:Cf,selectByIds:Uf})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,r=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,u=new Date().toISOString(),h=P({...e,submitted_at:u,created_by:r});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:E(h),blockers:[],blocks:[h.uuid]});return p.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(d(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const u=Dp(e)(l);this.dispatch(a(e)),this.dispatch(Li(V(u)));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(Ui(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class jg extends B{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:Gf,addMany:Hf,setOne:Wf,setMany:Kf,updateOne:Yf,updateMany:Zf,deleteOne:Jf,deleteMany:Xf,initialize:Nf});y(this,"selectors",{selectById:cn,selectByIds:xf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,r=new Date().toISOString(),u=P({...e,created_by:l,submitted_at:r});this.dispatch(a(u));const h=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(u),blockers:[e.issue_type],blocks:[u.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(u.uuid))}),[u,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),d=a(e.uuid)(c);if(!d)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...d,...e};this.dispatch(n(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(n(u))}).catch(()=>{this.dispatch(n(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Dg extends B{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:rn,addMany:un,setOne:iS,setMany:nS,updateOne:aS,updateMany:cS,deleteOne:ln,deleteMany:on,initialize:sS});y(this,"selectors",{selectById:dS,selectByIds:rS})}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(d)),d}}const qg=1800;function $g(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 Cg extends DF{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(vo(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.debug("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=pO(e).exp??n}catch{a=n}return a-n<qg}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof C&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??ct).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new C({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new C({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=Xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens($g(a))})}}class Ug extends dt{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:gS,addMany:_S,setOne:bS,setMany:MS,updateOne:RS,updateMany:wS,deleteOne:ES,deleteMany:BS,initialize:FS});y(this,"selectors",{selectById:VS,selectByIds:zS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l),u=$t(r.user)(l);this.dispatch(a(r.uuid)),this.dispatch(An(r.user));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${r.uuid}/`,blockers:[r.uuid],blocks:[]})}catch(h){throw this.dispatch(c(r)),this.dispatch(pn(u)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends dt{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:LS,addMany:US,setOne:CS,setMany:$S,updateOne:NS,updateMany:kS,deleteOne:GS,deleteMany:HS,initialize:qS});y(this,"selectors",{selectById:YS,selectByIds:ZS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class kg extends B{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:aT,addMany:cT,setOne:dT,setMany:rT,updateOne:uT,updateMany:lT,deleteOne:oT,deleteMany:hT,initialize:nT});y(this,"selectors",{selectById:yT,selectByIds:pT})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(d(l.uuid)),h}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:r.map(p=>E(p))},blockers:r.flatMap(p=>[p.project,p.organization_access]),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(d(p))}).catch(p=>{throw this.dispatch(c(r.map(A=>A.uuid))),p}),[r,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState()),l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return r.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(d)),u}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:d}=this.selectors,l=d(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(c(l)),r}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends D{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:ST,addMany:TT,setOne:IT,setMany:OT,updateOne:PT,updateMany:FT,deleteOne:gT,deleteMany:_T,initialize:fT});y(this,"selectors",{selectById:MT,selectByIds:RT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Gg extends D{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:zT,addMany:jT,setOne:vT,setMany:VT,updateOne:DT,updateMany:qT,deleteOne:$T,deleteMany:CT,initialize:BT});y(this,"selectors",{selectById:kT,selectByIds:NT})}getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){var d;const{store:n}=this.client,a=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,c=new Date().toISOString();return P({...e,created_by:a,submitted_at:c})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,canvas_bounds:e.canvas_bounds,bounds:e.bounds}}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=n.getState(),l=c(e.uuid)(d);if(!l)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const r={...l,...e};this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return u.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[r,u]}async refreshStore(e,n){const{initialize:a}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(d)),d}}class Hg extends dt{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:JT,addMany:ZT,setOne:YT,setMany:KT,updateOne:QT,updateMany:XT,deleteOne:xT,deleteMany:eI,initialize:WT});y(this,"selectors",{selectById:iI,selectByIds:nI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:E(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Wg extends B{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:rI,addMany:uI,setOne:lI,setMany:oI,updateOne:hI,updateMany:mI,deleteOne:yI,deleteMany:pI,initialize:dI});y(this,"selectors",{selectById:SI,selectByIds:TI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[e.team],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:d}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,r=e.map(p=>P({...p,created_by:l}));this.dispatch(a(r));const u=this.enqueueRequest({description:T(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:r.map(p=>E(p))},blockers:r.map(p=>p.team),blocks:r.map(p=>p.uuid)});return u.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(d(r.map(p=>p.uuid)))}),[r,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class Kg extends B{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:PI,addMany:FI,setOne:gI,setMany:_I,updateOne:bI,updateMany:MI,deleteOne:RI,deleteMany:wI,initialize:OI});y(this,"selectors",{selectById:BI,selectByIds:vI})}add(e){var u;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:d}=this.actions,l=P({...e,submitted_at:new Date().toISOString(),created_by:((u=n.getState().userReducer.currentUser)==null?void 0:u.id)??null});this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:E(l),blockers:[],blocks:[l.uuid]});return r.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(d(l.uuid))}),[l,r]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(n.getState());if(!d)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...d,...e};this.dispatch(a(l));const r=this.enqueueRequest({description:T(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:E(e),blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(a(u))}).catch(()=>{this.dispatch(a(d))}),[l,r]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:d}=this.selectors,l=n.getState(),r=d(e)(l);if(!r)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:T(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(u){throw this.dispatch(c(r)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Yg extends dt{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:pn,addMany:pS,setOne:yS,setMany:mS,updateOne:fS,updateMany:AS,deleteOne:An,deleteMany:SS,initialize:hS});y(this,"selectors",{selectById:$t,selectByIds:OS})}async list(e,n){const{organizationUuid:a,...c}=e,d=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:d,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function zn(t,s,e,n,a){const c=n instanceof st;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:r,headers:u,method:h,queryParams:p,attachmentHash:A,isExternalUrl:I,isAuthNeeded:_,isResponseBlob:w}={...d,...s};let b=s.url;const R=A?await e.files.fetchCache(A):void 0;if(A&&!R)throw new Error(`Cannot upload file ${A} because it's not cached.`);!I&&!b.startsWith("http")&&(!b.startsWith("/")&&!b.startsWith("blob:")&&(b="/"+b),b=t+b);const M=v=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!R)throw new Error(`No file for file ${A}`);const N=l.fields["x-amz-checksum-sha1"];if(!N)throw new Error(`No checksum for file ${A}`);return v.set("x-amz-checksum-sha1",N).field({...r,...l.fields}).attach("file",R)}return v.send(r)},U={[m.GET]:()=>w?at.get(b.toString()).responseType("blob"):at.get(b.toString()),[m.POST]:()=>{const v=at.post(b.toString());return M(v)},[m.PATCH]:()=>{const v=at.patch(b.toString());return M(v)},[m.PUT]:()=>{const v=at.put(b.toString());return M(v)},[m.DELETE]:()=>{const v=at.delete(b.toString());return M(v)}}[h];let z=U();const k=()=>{console.debug("aborting request:",s.url),z.abort()};if(a==null||a.addEventListener("abort",k),_&&c){const v=n.auth.getAuthHeader();z=z.set("Authorization",v)}u&&(z=z.set(u));try{return await z.query(p)}catch(v){const N=JI(v),kt=N==null?void 0:N.status;if(c&&kt===401)return await n.auth.handleUnauthorized(z,N),z.query(p);throw new C({response:N,innerError:v,discard:vn.includes(kt)})}finally{a==null||a.removeEventListener("abort",k)}}class Zg{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Gt,d={...e,uuid:e.uuid??Xe.v4()};return zn(s,d,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??ct).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof C)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof C)throw a;return a})}_enqueueRequest(s,e,n){const a=new Gt,c={...s,BASE_URL:e,serviceName:n},d=this.store.dispatch(xS(c)),l=u=>{if(u)a.resolve(u.body);else{const h=new C({message:"Could not get a response from the server.",response:u,discard:!0});a.reject(h)}},r=u=>{u instanceof C?u.options.discard=!0:(console.error("Received an unexpected error while processing a request:",u,`
|
|
14
14
|
Converting error to APIError and discarding.`),u=new C({message:"An error occurred while processing the request.",innerError:u,discard:!0})),a.reject(u)};return d.then(l,r),a}async performPagination(s,e,n,a,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=d,r=[];let u=await this.performRequest(s,d,a,c);for(r.push(u.results);u.next;)u=await this.performRequest(s,{url:u.next,method:l},a,c),r.push(u.results);return r}}class rt{constructor(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new AO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new rt;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==a.payload.uuid&&d.payload.blocks.some(l=>a.payload.blockers.includes(l))&&rt._addDependency(a.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){rt._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(n.payload.blocks);s.payload.blockers.some(c=>a.has(c))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e),a=new Set(s.payload.blocks);n.payload.blockers.some(c=>a.has(c))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let XI;function QI(t){XI=t}function ut(){return XI}let xI;function eO(t){xI=t}function tO(){return xI}let jn=null;function nt(){const t=ut();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(jn)return jn;const s=t.getState().offline.outbox,e=rt._fromOutbox(s);return jn=e,e}const Jg=(t,s)=>{const e=new s(t);return eO(e),QI(t),e};class Xg{constructor(s){y(this,"_all");y(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class Dn{constructor(){y(this,"next");this.next=null}then(s){return new Xg(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s.payload.url),!ut())throw new Error("Client store not set");const n=tO();if(!n)throw new Error("Client SDK not set");return KI(s,n)}}}class sO extends Dn{async run(s){return super.run(s)}}class iO extends Dn{async run(s){return super.run(s)}}const nO=new sO().then(new iO).compile();function aO(t){var s;return(s=nO[0])==null?void 0:s.run(t)}var cO=(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))(cO||{});i.ALL_MIDDLEWARE=nO,i.APIError=C,i.AgentService=qF,i.AssetAttachmentService=$F,i.AssetProcedureService=GF,i.AssetProcedureStepFieldValuesAttachmentService=YF,i.AssetProcedureStepFieldValuesService=ZF,i.AssetProcedureStepFieldsAttachmentService=WF,i.AssetProcedureStepFieldsService=KF,i.AssetProcedureStepService=JF,i.AssetProcedureTypeAttachmentService=CF,i.AssetProcedureTypeFieldValuesAttachmentService=kF,i.AssetProcedureTypeFieldValuesService=NF,i.AssetProcedureTypeFieldsAttachmentService=UF,i.AssetProcedureTypeFieldsService=LF,i.AssetProcedureTypeService=HF,i.AssetService=XF,i.AssetStageCompletionService=QF,i.AssetStageService=xF,i.AssetStatusType=Nn,i.AssetTypeAttachmentService=eg,i.AssetTypeFieldValuesAttachmentService=ig,i.AssetTypeFieldValuesService=ng,i.AssetTypeFieldsAttachmentService=tg,i.AssetTypeFieldsService=sg,i.AssetTypeIdentifierService=ag,i.AssetTypeIdentifierValueService=cg,i.AssetTypeService=dg,i.AssetTypeStatusService=rg,i.AttachmentModel=Gn,i.BaseApiService=st,i.BaseModelApiService=dt,i.BaseOfflineFileModelApiService=D,i.BaseOfflineModelApiService=B,i.BaseSDK=Zg,i.COMMON_AUTO_FIELDS=xn,i.DEFAULT_ISSUE_PRIORITY=fO,i.DEFAULT_PAGE_SIZE=qI,i.DISCARD_HTTP_STATUSES=vn,i.DeferredPromise=Gt,i.DocumentAttachmentService=ug,i.DocumentService=lg,i.EMPTY_ARRAY=Un,i.EMPTY_OBJECT=Ln,i.EmailDomainsService=og,i.EmailVerificationService=hg,i.FILE_MODEL_DEFAULT_PAGE_SIZE=$I,i.FileService=mg,i.FormIdentifierService=yg,i.FormIdentifierValueService=pg,i.FormRevisionAttachmentService=Ag,i.FormRevisionService=fg,i.FormService=Sg,i.FormSubmissionAttachmentService=Tg,i.FormSubmissionService=Ig,i.GeoImageService=Og,i.HttpMethod=m,i.IssueAssociationService=Pg,i.IssueAttachmentService=Fg,i.IssueCommentAttachmentService=gg,i.IssueCommentService=_g,i.IssuePriority=Nt,i.IssueService=bg,i.IssueStatusType=Hn,i.IssueTypeAttachmentService=Mg,i.IssueTypeFieldValuesAttachmentService=Eg,i.IssueTypeFieldValuesService=Bg,i.IssueTypeFieldsAttachmentService=Rg,i.IssueTypeFieldsService=wg,i.IssueTypeIdentifierService=vg,i.IssueTypeIdentifierValueService=Vg,i.IssueTypeService=zg,i.IssueTypeStatusService=jg,i.IssueUpdateChange=$,i.IssueUpdateService=Dg,i.JWTService=Cg,i.MAX_SERVICE_BATCH_SIZE=Qe,i.OUTBOX_RETRY_DELAY=Wn,i.OfflineAnalyticsMiddleware=sO,i.OfflineMiddleware=Dn,i.OrganizationAccessLevel=kn,i.OrganizationAccessService=Ug,i.OrganizationService=Lg,i.OutboxCoordinator=rt,i.ProjectAccessService=kg,i.ProjectAttachmentService=Ng,i.ProjectFileService=Gg,i.ProjectService=Hg,i.RESET_ORGANIZATION_STATE=g,i.RESET_PROJECT_STATE=j,i.RESET_STATE=O,i.RateLimitingMiddleware=iO,i.SelectorBuilder=UO,i.TeamMembershipService=Wg,i.TeamService=Kg,i.UNKNOWN_ERROR_MESSAGE=ct,i.UserService=Yg,i.VERSION_REDUCER_KEY=ot,i.VerificationCodeType=cO,i._setLatestRetryTime=tT,i.addAsset=wr,i.addAssetAttachment=ya,i.addAssetAttachments=Qt,i.addAssetProcedure=kc,i.addAssetProcedureStep=fr,i.addAssetProcedureStepFieldValues=tr,i.addAssetProcedureStepFieldValuesAttachment=kd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=sr,i.addAssetProcedureStepFields=wd,i.addAssetProcedureStepFieldsAttachment=pd,i.addAssetProcedureStepFieldsAttachments=Ad,i.addAssetProcedureStepFieldsMany=Ed,i.addAssetProcedureSteps=Sr,i.addAssetProcedureType=td,i.addAssetProcedureTypeAttachment=Ma,i.addAssetProcedureTypeAttachments=Ra,i.addAssetProcedureTypeFieldValues=Rc,i.addAssetProcedureTypeFieldValuesAttachment=pc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=wc,i.addAssetProcedureTypeFields=tc,i.addAssetProcedureTypeFieldsAttachment=La,i.addAssetProcedureTypeFieldsAttachments=ka,i.addAssetProcedureTypeFieldsMany=sc,i.addAssetProcedureTypes=sd,i.addAssetProcedures=hs,i.addAssetStage=au,i.addAssetStageCompletion=kr,i.addAssetStageCompletions=Nr,i.addAssetStages=cu,i.addAssetType=co,i.addAssetTypeAttachment=Au,i.addAssetTypeAttachments=js,i.addAssetTypeFieldValues=Al,i.addAssetTypeFieldValuesAttachment=il,i.addAssetTypeFieldValuesAttachments=ks,i.addAssetTypeFieldValuesMany=fl,i.addAssetTypeFields=Nu,i.addAssetTypeFieldsAttachment=wu,i.addAssetTypeFieldsAttachments=Eu,i.addAssetTypeFieldsMany=Gu,i.addAssetTypeIdentifier=El,i.addAssetTypeIdentifierValue=Gl,i.addAssetTypeIdentifierValues=Hl,i.addAssetTypeIdentifiers=Bl,i.addAssetTypeStatus=To,i.addAssetTypeStatuses=Io,i.addAssetTypes=ro,i.addAssets=Rs,i.addConversation=ra,i.addConversations=LO,i.addDocument=Jo,i.addDocumentAttachment=Do,i.addDocumentAttachments=qo,i.addDocuments=Xo,i.addEmailDomain=lh,i.addEmailDomains=oh,i.addForm=_m,i.addFormIdentifier=Mh,i.addFormIdentifierValue=Lh,i.addFormIdentifierValues=kh,i.addFormIdentifiers=Rh,i.addFormRevision=oi,i.addFormRevisionAttachment=tm,i.addFormRevisionAttachments=sm,i.addFormRevisions=hi,i.addFormSubmission=xm,i.addFormSubmissionAttachment=Cm,i.addFormSubmissionAttachments=Ti,i.addFormSubmissions=_i,i.addForms=bm,i.addGeoImage=hy,i.addGeoImages=my,i.addIssue=Mp,i.addIssueAssociation=Ry,i.addIssueAssociations=xe,i.addIssueAttachment=Ly,i.addIssueAttachments=vi,i.addIssueComment=yp,i.addIssueCommentAttachment=ep,i.addIssueCommentAttachments=tp,i.addIssueComments=pp,i.addIssueType=Ef,i.addIssueTypeAttachment=Up,i.addIssueTypeAttachments=Lp,i.addIssueTypeFieldValues=yA,i.addIssueTypeFieldValuesAttachment=kA,i.addIssueTypeFieldValuesAttachments=Zi,i.addIssueTypeFieldValuesMany=pA,i.addIssueTypeFields=RA,i.addIssueTypeFieldsAttachment=eA,i.addIssueTypeFieldsAttachments=tA,i.addIssueTypeFieldsMany=wA,i.addIssueTypeIdentifier=tf,i.addIssueTypeIdentifierValue=Af,i.addIssueTypeIdentifierValues=ff,i.addIssueTypeIdentifiers=sf,i.addIssueTypeStatus=Gf,i.addIssueTypeStatuses=Hf,i.addIssueTypes=Bf,i.addIssueUpdate=rn,i.addIssueUpdates=un,i.addIssues=Ui,i.addOrganization=LS,i.addOrganizationAccess=gS,i.addOrganizationAccesses=_S,i.addOrganizations=US,i.addProject=JT,i.addProjectAccess=aT,i.addProjectAccesses=cT,i.addProjectAttachment=ST,i.addProjectAttachments=TT,i.addProjectFile=zT,i.addProjectFiles=jT,i.addProjects=ZT,i.addTeam=PI,i.addTeamMembership=rI,i.addTeamMemberships=uI,i.addTeams=FI,i.addUser=pn,i.addUsers=pS,i.agentsReducer=oa,i.agentsSlice=Zt,i.areArraysEqual=OO,i.assetAttachmentReducer=ga,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=Yc,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=Qd,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=hr,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=bd,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=Cd,i.assetProcedureStepFieldsSlice=Ss,i.assetProcedureStepReducer=Fr,i.assetProcedureStepSlice=_s,i.assetProcedureTypeAttachmentReducer=ja,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=Oc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=Dc,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=Za,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=uc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=ud,i.assetProcedureTypeSlice=ys,i.assetReducer=Cr,i.assetSlice=Ms,i.assetStageCompletionReducer=Jr,i.assetStageCompletionSlice=Es,i.assetStageReducer=ou,i.assetStageSlice=Bs,i.assetTypeAttachmentReducer=bu,i.assetTypeAttachmentSlice=zs,i.assetTypeFieldValuesAttachmentReducer=ml,i.assetTypeFieldValuesAttachmentSlice=Ls,i.assetTypeFieldValuesReducer=Ml,i.assetTypeFieldValuesSlice=Hs,i.assetTypeFieldsAttachmentReducer=Uu,i.assetTypeFieldsAttachmentSlice=$s,i.assetTypeFieldsReducer=el,i.assetTypeFieldsSlice=Us,i.assetTypeIdentifierReducer=Ll,i.assetTypeIdentifierSlice=Ws,i.assetTypeIdentifierValueReducer=to,i.assetTypeIdentifierValueSlice=Ys,i.assetTypeReducer=Ao,i.assetTypeSlice=Zs,i.assetTypeStatusReducer=Eo,i.assetTypeStatusSlice=Xs,i.assetTypeStatusSortFn=sa,i.authReducer=Vo,i.authSlice=wt,i.baseReducer=PF,i.baseReducers=Bn,i.clearTokens=_P,i.createModelAdapter=F,i.createOfflineAction=XS,i.createPayload=E,i.createSelectionAdapter=SO,i.deleteAsset=vr,i.deleteAssetAttachment=Ta,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Hc,i.deleteAssetProcedureStep=Or,i.deleteAssetProcedureStepFieldValues=dr,i.deleteAssetProcedureStepFieldValuesAttachment=Kd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,i.deleteAssetProcedureStepFieldValuesMany=rr,i.deleteAssetProcedureStepFields=jd,i.deleteAssetProcedureStepFieldsAttachment=Od,i.deleteAssetProcedureStepFieldsAttachments=Pd,i.deleteAssetProcedureStepFieldsMany=Dd,i.deleteAssetProcedureSteps=Pr,i.deleteAssetProcedureType=ad,i.deleteAssetProcedureTypeAttachment=Va,i.deleteAssetProcedureTypeAttachments=za,i.deleteAssetProcedureTypeFieldValues=zc,i.deleteAssetProcedureTypeFieldValuesAttachment=Ic,i.deleteAssetProcedureTypeFieldValuesAttachments=rs,i.deleteAssetProcedureTypeFieldValuesMany=jc,i.deleteAssetProcedureTypeFields=dc,i.deleteAssetProcedureTypeFieldsAttachment=Ka,i.deleteAssetProcedureTypeFieldsAttachments=Ya,i.deleteAssetProcedureTypeFieldsMany=rc,i.deleteAssetProcedureTypes=cd,i.deleteAssetProcedures=ms,i.deleteAssetStage=uu,i.deleteAssetStageCompletion=Yr,i.deleteAssetStageCompletions=Zr,i.deleteAssetStages=lu,i.deleteAssetType=oo,i.deleteAssetTypeAttachment=Ou,i.deleteAssetTypeAttachments=Ds,i.deleteAssetTypeFieldValues=Pl,i.deleteAssetTypeFieldValuesAttachment=rl,i.deleteAssetTypeFieldValuesAttachments=Ns,i.deleteAssetTypeFieldValuesMany=Fl,i.deleteAssetTypeFields=Zu,i.deleteAssetTypeFieldsAttachment=ju,i.deleteAssetTypeFieldsAttachments=Du,i.deleteAssetTypeFieldsMany=Ju,i.deleteAssetTypeIdentifier=Dl,i.deleteAssetTypeIdentifierValue=Jl,i.deleteAssetTypeIdentifierValues=Xl,i.deleteAssetTypeIdentifiers=ql,i.deleteAssetTypeStatus=_o,i.deleteAssetTypeStatuses=bo,i.deleteAssetTypes=ho,i.deleteAssets=ws,i.deleteConversation=GO,i.deleteConversations=HO,i.deleteDocument=sh,i.deleteDocumentAttachment=ko,i.deleteDocumentAttachments=No,i.deleteDocuments=ih,i.deleteEmailDomain=Ah,i.deleteEmailDomains=fh,i.deleteForm=Bm,i.deleteFormIdentifier=Vh,i.deleteFormIdentifierValue=Kh,i.deleteFormIdentifierValues=Yh,i.deleteFormIdentifiers=zh,i.deleteFormRevision=mi,i.deleteFormRevisionAttachment=dm,i.deleteFormRevisionAttachments=rm,i.deleteFormRevisions=yi,i.deleteFormSubmission=sy,i.deleteFormSubmissionAttachment=Gm,i.deleteFormSubmissionAttachments=Ii,i.deleteFormSubmissions=bi,i.deleteForms=vm,i.deleteGeoImage=Ay,i.deleteGeoImages=fy,i.deleteIssue=vp,i.deleteIssueAssociation=wy,i.deleteIssueAssociations=et,i.deleteIssueAttachment=Wy,i.deleteIssueAttachments=Vi,i.deleteIssueComment=Ip,i.deleteIssueCommentAttachment=cp,i.deleteIssueCommentAttachments=dp,i.deleteIssueComments=Op,i.deleteIssueType=Df,i.deleteIssueTypeAttachment=Wp,i.deleteIssueTypeAttachments=Kp,i.deleteIssueTypeFieldValues=IA,i.deleteIssueTypeFieldValuesAttachment=KA,i.deleteIssueTypeFieldValuesAttachments=Ji,i.deleteIssueTypeFieldValuesMany=OA,i.deleteIssueTypeFields=zA,i.deleteIssueTypeFieldsAttachment=cA,i.deleteIssueTypeFieldsAttachments=dA,i.deleteIssueTypeFieldsMany=jA,i.deleteIssueTypeIdentifier=rf,i.deleteIssueTypeIdentifierValue=Pf,i.deleteIssueTypeIdentifierValues=Ff,i.deleteIssueTypeIdentifiers=uf,i.deleteIssueTypeStatus=Jf,i.deleteIssueTypeStatuses=Xf,i.deleteIssueTypes=qf,i.deleteIssueUpdate=ln,i.deleteIssueUpdates=on,i.deleteIssues=Li,i.deleteOrganization=GS,i.deleteOrganizationAccess=ES,i.deleteOrganizationAccesses=BS,i.deleteOrganizations=HS,i.deleteProject=xT,i.deleteProjectAccess=oT,i.deleteProjectAccesses=hT,i.deleteProjectAttachment=gT,i.deleteProjectAttachments=_T,i.deleteProjectFile=$T,i.deleteProjectFiles=CT,i.deleteProjects=eI,i.deleteTeam=RI,i.deleteTeamMembership=yI,i.deleteTeamMemberships=pI,i.deleteTeams=wI,i.deleteUser=An,i.deleteUsers=SS,i.dequeue=WI,i.discard=YI,i.documentAttachmentReducer=Ko,i.documentAttachmentSlice=xs,i.documentSlice=ti,i.documentsReducer=nh,i.downloadFile=wO,i.emailDomainsReducer=Oh,i.emailDomainsSlice=ii,i.emailRegex=qO,i.enqueue=HI,i.enqueueRequest=xS,i.extractResponseFromError=JI,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=St,i.fetchBlobFromObjectUrl=Zn,i.fetchFileFromObjectUrl=Jn,i.fileReducer=gh,i.fileSlice=ai,i.formIdentifierReducer=$h,i.formIdentifierSlice=ci,i.formIdentifierValueReducer=Qh,i.formIdentifierValueSlice=ri,i.formReducer=Vm,i.formRevisionAttachmentReducer=hm,i.formRevisionAttachmentSlice=ui,i.formRevisionReducer=Pm,i.formRevisionsSlice=li,i.formSlice=Ai,i.formSubmissionAttachmentReducer=Ym,i.formSubmissionAttachmentSlice=Si,i.formSubmissionReducer=dy,i.formSubmissionSlice=gi,i.geoImageReducer=Oy,i.geoImageSlice=Ri,i.getAssetProcedureStepSubTree=ta,i.getAssetProcedureStepTrees=$O,i.getClientSDK=tO,i.getClientStore=ut,i.getDocumentSubTree=aa,i.getDocumentTrees=CO,i.getFileExtension=Yn,i.getLocalDateString=Kn,i.getLocalRelativeDateString=_O,i.getOutboxCoordinator=nt,i.getRenamedFile=RO,i.getRequestDescription=T,i.getS3FileKey=MO,i.hashFile=Tt,i.initSDK=Jg,i.initializeAssetAttachments=ma,i.initializeAssetProcedureStepFieldValues=er,i.initializeAssetProcedureStepFieldValuesAttachments=Ld,i.initializeAssetProcedureStepFields=Rd,i.initializeAssetProcedureStepFieldsAttachments=yd,i.initializeAssetProcedureSteps=yr,i.initializeAssetProcedureTypeAttachments=ba,i.initializeAssetProcedureTypeFieldValues=Mc,i.initializeAssetProcedureTypeFieldValuesAttachments=yc,i.initializeAssetProcedureTypeFields=ec,i.initializeAssetProcedureTypeFieldsAttachments=Ua,i.initializeAssetProcedureTypes=ed,i.initializeAssetProcedures=Lc,i.initializeAssetStageCompletions=Lr,i.initializeAssetStages=su,i.initializeAssetTypeAttachments=pu,i.initializeAssetTypeFieldValues=pl,i.initializeAssetTypeFieldValuesAttachments=sl,i.initializeAssetTypeFields=ku,i.initializeAssetTypeFieldsAttachments=Ru,i.initializeAssetTypeIdentifierValues=Nl,i.initializeAssetTypeIdentifiers=wl,i.initializeAssetTypeStatuses=So,i.initializeAssetTypes=io,i.initializeAssets=Rr,i.initializeConversations=da,i.initializeDocumentAttachments=jo,i.initializeDocuments=Zo,i.initializeEmailDomains=uh,i.initializeFormIdentifierValues=Uh,i.initializeFormIdentifiers=bh,i.initializeFormRevisionAttachments=em,i.initializeFormRevisions=ym,i.initializeFormSubmissionAttachments=$m,i.initializeFormSubmissions=Jm,i.initializeForms=gm,i.initializeGeoImages=uy,i.initializeIssueAssociations=Fy,i.initializeIssueAttachments=Uy,i.initializeIssueCommentAttachments=xy,i.initializeIssueComments=mp,i.initializeIssueTypeAttachments=Cp,i.initializeIssueTypeFieldValues=mA,i.initializeIssueTypeFieldValuesAttachments=LA,i.initializeIssueTypeFields=MA,i.initializeIssueTypeFieldsAttachments=xp,i.initializeIssueTypeIdentifierValues=pf,i.initializeIssueTypeIdentifiers=ef,i.initializeIssueTypeStatuses=Nf,i.initializeIssueTypes=wf,i.initializeIssueUpdates=sS,i.initializeIssues=bp,i.initializeOrganizationAccesses=FS,i.initializeOrganizations=qS,i.initializeProjectAccesses=nT,i.initializeProjectAttachments=fT,i.initializeProjectFiles=BT,i.initializeProjects=WT,i.initializeTeamMemberships=dI,i.initializeTeams=OI,i.initializeUsers=hS,i.isImageFile=EO,i.isObjectUrl=Xn,i.isToday=gO,i.issueAssociationReducer=$y,i.issueAssociationSlice=Ei,i.issueAttachmentReducer=Xy,i.issueAttachmentSlice=Bi,i.issueCommentAttachmentReducer=op,i.issueCommentAttachmentSlice=ji,i.issueCommentReducer=gp,i.issueCommentSlice=qi,i.issueReducer=qp,i.issueSlice=Ci,i.issueTypeAttachmentReducer=Xp,i.issueTypeAttachmentSlice=ki,i.issueTypeFieldValuesAttachmentReducer=QA,i.issueTypeFieldValuesAttachmentSlice=Yi,i.issueTypeFieldValuesReducer=_A,i.issueTypeFieldValuesSlice=Wi,i.issueTypeFieldsAttachmentReducer=oA,i.issueTypeFieldsAttachmentSlice=Gi,i.issueTypeFieldsReducer=CA,i.issueTypeFieldsSlice=Ki,i.issueTypeIdentifierReducer=mf,i.issueTypeIdentifierSlice=Qi,i.issueTypeIdentifierValueReducer=Mf,i.issueTypeIdentifierValueSlice=en,i.issueTypeReducer=Lf,i.issueTypeSlice=tn,i.issueTypeStatusReducer=eS,i.issueTypeStatusSlice=nn,i.issueTypeStatusSortFn=ia,i.issueUpdateReducer=lS,i.issueUpdateSlice=dn,i.logOnlyOnce=BO,i.markAsDeleted=eT,i.markForDeletion=rF,i.memoize=Wt,i.organizationAccessReducer=vS,i.organizationAccessSlice=Sn,i.organizationReducer=JS,i.organizationSlice=Tn,i.outboxReducer=sT,i.outboxSlice=In,i.overmapEnhancer=BF,i.overmapReducer=FF,i.overmapReducers=DI,i.performRequest=zn,i.performRequestFromAction=KI,i.projectAccessReducer=mT,i.projectAccessSlice=On,i.projectAttachmentReducer=wT,i.projectAttachmentSlice=Fn,i.projectFileReducer=GT,i.projectFileSlice=_n,i.projectReducer=tI,i.projectSlice=bn,i.rehydratedReducer=aI,i.rehydratedSlice=Mn,i.restructureSelectorWithArgs=f,i.runMiddleware=aO,i.selectAccessToken=bP,i.selectAccessesByUserOfProject=lF,i.selectAccessibleProjects=mF,i.selectActiveOrganizationAccess=nF,i.selectAllDocumentAttachments=ei,i.selectAssetAttachmentById=Oa,i.selectAssetAttachmentMapping=Ia,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=Pa,i.selectAssetById=qr,i.selectAssetProcedureById=Xc,i.selectAssetProcedureStepById=gr,i.selectAssetProcedureStepFieldValues=ht,i.selectAssetProcedureStepFieldValuesAttachmentById=Zd,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Jd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Yd,i.selectAssetProcedureStepFieldValuesById=lr,i.selectAssetProcedureStepFieldValuesByIds=or,i.selectAssetProcedureStepFieldValuesMapping=ur,i.selectAssetProcedureStepFieldValuesOfAsset=cP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=dP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=rP,i.selectAssetProcedureStepFields=gt,i.selectAssetProcedureStepFieldsAttachmentById=gd,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=_d,i.selectAssetProcedureStepFieldsAttachmentsMapping=Fd,i.selectAssetProcedureStepFieldsById=qd,i.selectAssetProcedureStepFieldsByIds=$d,i.selectAssetProcedureStepFieldsMapping=Ts,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=iP,i.selectAssetProcedureStepMapping=_t,i.selectAssetProcedureSteps=bs,i.selectAssetProcedureStepsByIds=_r,i.selectAssetProcedureStepsMappingOfAssetProcedureType=uP,i.selectAssetProcedureStepsOfAssetProcedureType=lP,i.selectAssetProcedureTypeAttachmentById=qa,i.selectAssetProcedureTypeAttachmentMapping=Da,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=$a,i.selectAssetProcedureTypeById=od,i.selectAssetProcedureTypeFieldValues=Pt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Fc,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=gc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Pc,i.selectAssetProcedureTypeFieldValuesById=$c,i.selectAssetProcedureTypeFieldValuesByIds=Cc,i.selectAssetProcedureTypeFieldValuesMapping=qc,i.selectAssetProcedureTypeFieldValuesOfAsset=QO,i.selectAssetProcedureTypeFields=Ot,i.selectAssetProcedureTypeFieldsAttachmentById=Xa,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Qa,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Ja,i.selectAssetProcedureTypeFieldsById=oc,i.selectAssetProcedureTypeFieldsByIds=hc,i.selectAssetProcedureTypeFieldsMapping=lc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=JO,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=hd,i.selectAssetProcedureTypesMapping=ld,i.selectAssetProcedureTypesOfOrganization=tP,i.selectAssetProcedures=Ft,i.selectAssetProceduresByIds=Qc,i.selectAssetProceduresMapping=Zc,i.selectAssetProceduresOfAssetProcedureType=Jc,i.selectAssetProceduresOfAssetType=eP,i.selectAssetStageById=hu,i.selectAssetStageCompletionById=xr,i.selectAssetStageCompletionMapping=Xr,i.selectAssetStageCompletions=Qr,i.selectAssetStageCompletionsByIds=eu,i.selectAssetStages=Vs,i.selectAssetStagesByIds=mu,i.selectAssetStagesMappingOfAssetProcedureType=hP,i.selectAssetStagesOfAssetProcedureType=mP,i.selectAssetTypeAttachmentById=Fu,i.selectAssetTypeAttachmentMapping=Pu,i.selectAssetTypeAttachments=qs,i.selectAssetTypeAttachmentsByIds=gu,i.selectAssetTypeById=yo,i.selectAssetTypeFieldValues=Mt,i.selectAssetTypeFieldValuesAttachmentById=ll,i.selectAssetTypeFieldValuesAttachments=Gs,i.selectAssetTypeFieldValuesAttachmentsByIds=ol,i.selectAssetTypeFieldValuesAttachmentsMapping=ul,i.selectAssetTypeFieldValuesById=_l,i.selectAssetTypeFieldValuesByIds=bl,i.selectAssetTypeFieldValuesMapping=gl,i.selectAssetTypeFieldValuesOfAsset=fP,i.selectAssetTypeFields=mt,i.selectAssetTypeFieldsAttachmentById=$u,i.selectAssetTypeFieldsAttachments=Cs,i.selectAssetTypeFieldsAttachmentsByIds=Cu,i.selectAssetTypeFieldsAttachmentsMapping=qu,i.selectAssetTypeFieldsById=Qu,i.selectAssetTypeFieldsByIds=xu,i.selectAssetTypeFieldsMapping=Xu,i.selectAssetTypeFieldsOfAssetType=pP,i.selectAssetTypeIdentifierById=Cl,i.selectAssetTypeIdentifierMapping=$l,i.selectAssetTypeIdentifierValueById=xl,i.selectAssetTypeIdentifierValueMapping=Ql,i.selectAssetTypeIdentifierValues=Rt,i.selectAssetTypeIdentifierValuesByIds=eo,i.selectAssetTypeIdentifierValuesOfAsset=IP,i.selectAssetTypeIdentifierValuesOfIdentifier=OP,i.selectAssetTypeIdentifiers=Ks,i.selectAssetTypeIdentifiersByIds=Ul,i.selectAssetTypeIdentifiersOfAssetType=TP,i.selectAssetTypeStatusById=Ro,i.selectAssetTypeStatusMapping=Mo,i.selectAssetTypeStatuses=Qs,i.selectAssetTypeStatusesByIds=wo,i.selectAssetTypeStatusesOfAssetType=FP,i.selectAssetTypeValuesOfAssetType=SP,i.selectAssetTypes=Js,i.selectAssetTypesByIds=po,i.selectAssetTypesMapping=mo,i.selectAssetTypesOfOrganization=PP,i.selectAssets=bt,i.selectAssetsByIds=$r,i.selectAssetsMapping=jr,i.selectAssetsOfAssetType=Dr,i.selectAssetsOfProject=oP,i.selectAttachmentsOfAsset=Fa,i.selectAttachmentsOfAssetProcedureStepFieldValues=Xd,i.selectAttachmentsOfAssetProcedureStepFields=sP,i.selectAttachmentsOfAssetProcedureType=YO,i.selectAttachmentsOfAssetProcedureTypeFieldValues=_c,i.selectAttachmentsOfAssetProcedureTypeFields=ZO,i.selectAttachmentsOfAssetType=_u,i.selectAttachmentsOfAssetTypeFieldValues=hl,i.selectAttachmentsOfAssetTypeFields=yP,i.selectAttachmentsOfDocument=RP,i.selectAttachmentsOfFormRevision=$P,i.selectAttachmentsOfFormSubmission=Km,i.selectAttachmentsOfIssue=Yy,i.selectAttachmentsOfIssueComment=kP,i.selectAttachmentsOfIssueType=HP,i.selectAttachmentsOfIssueTypeFieldValues=XA,i.selectAttachmentsOfIssueTypeFields=WP,i.selectAttachmentsOfProject=hF,i.selectCommentsOfIssue=NP,i.selectConversation=KO,i.selectConversationMapping=Jt,i.selectConversations=WO,i.selectCurrentUser=IS,i.selectDeletedRequests=cF,i.selectDescendantsOfAssetProcedureStep=br,i.selectDescendantsOfDocument=dh,i.selectDocumentAttachmentById=Ho,i.selectDocumentAttachmentMapping=Go,i.selectDocumentAttachmentsByIds=Wo,i.selectDocumentById=ah,i.selectDocuments=Et,i.selectDocumentsByIds=ch,i.selectDocumentsMapping=si,i.selectEmailDomainById=Th,i.selectEmailDomains=ni,i.selectEmailDomainsAsMapping=Sh,i.selectEmailDomainsByIds=Ih,i.selectEmailDomainsOfOrganization=BP,i.selectFieldValuesOfAssetProcedure=xO,i.selectFormById=jm,i.selectFormIdentifierById=Dh,i.selectFormIdentifierMapping=jh,i.selectFormIdentifierValueById=Jh,i.selectFormIdentifierValueMapping=Zh,i.selectFormIdentifierValues=Bt,i.selectFormIdentifierValuesByIds=Xh,i.selectFormIdentifierValuesOfFormSubmission=DP,i.selectFormIdentifierValuesOfIdentifier=qP,i.selectFormIdentifiers=di,i.selectFormIdentifiersByIds=qh,i.selectFormIdentifiersOfForm=jP,i.selectFormMapping=zm,i.selectFormRevisionAttachmentById=lm,i.selectFormRevisionAttachments=um,i.selectFormRevisionAttachmentsByIds=om,i.selectFormRevisionAttachmentsMapping=vt,i.selectFormRevisionById=Tm,i.selectFormRevisionMapping=pi,i.selectFormRevisions=Vt,i.selectFormRevisionsByIds=Im,i.selectFormRevisionsOfForm=Om,i.selectFormSubmissionAttachemntsByIds=Fi,i.selectFormSubmissionAttachmentById=Hm,i.selectFormSubmissionAttachments=Pi,i.selectFormSubmissionAttachmentsByIds=Wm,i.selectFormSubmissionAttachmentsMapping=Oi,i.selectFormSubmissionById=ny,i.selectFormSubmissions=iy,i.selectFormSubmissionsByIds=ay,i.selectFormSubmissionsMapping=Mi,i.selectFormSubmissionsOfForm=cy,i.selectForms=fi,i.selectFormsByIds=Dm,i.selectFormsOfOrganization=UP,i.selectGeoImageById=Ty,i.selectGeoImageMapping=Sy,i.selectGeoImages=wi,i.selectGeoImagesByIds=Iy,i.selectGeoImagesOfProject=LP,i.selectIsLoggedIn=MP,i.selectIssueAssociationById=By,i.selectIssueAssociationMapping=Ey,i.selectIssueAssociations=tt,i.selectIssueAssociationsByIds=vy,i.selectIssueAssociationsOfAsset=qy,i.selectIssueAssociationsOfIssue=Dy,i.selectIssueAssociationsOfIssues=jy,i.selectIssueAssociationsToIssue=Vy,i.selectIssueAssociationsToIssues=zy,i.selectIssueAttachmentById=Zy,i.selectIssueAttachmentMapping=Ky,i.selectIssueAttachments=zi,i.selectIssueAttachmentsByIds=Jy,i.selectIssueById=zp,i.selectIssueCommentAttachmentById=up,i.selectIssueCommentAttachmentMapping=rp,i.selectIssueCommentAttachments=Di,i.selectIssueCommentAttachmentsByIds=lp,i.selectIssueCommentById=Pp,i.selectIssueCommentMapping=$i,i.selectIssueCommentsByIds=Fp,i.selectIssueMapping=Vp,i.selectIssueTypeAttachmentById=Zp,i.selectIssueTypeAttachmentMapping=Yp,i.selectIssueTypeAttachments=Ni,i.selectIssueTypeAttachmentsByIds=Jp,i.selectIssueTypeById=Cf,i.selectIssueTypeFieldValues=jt,i.selectIssueTypeFieldValuesAttachmentById=ZA,i.selectIssueTypeFieldValuesAttachments=Xi,i.selectIssueTypeFieldValuesAttachmentsByIds=JA,i.selectIssueTypeFieldValuesAttachmentsMapping=YA,i.selectIssueTypeFieldValuesById=FA,i.selectIssueTypeFieldValuesByIds=gA,i.selectIssueTypeFieldValuesMapping=PA,i.selectIssueTypeFieldValuesOfIssue=KP,i.selectIssueTypeFields=yt,i.selectIssueTypeFieldsAttachmentById=uA,i.selectIssueTypeFieldsAttachments=Hi,i.selectIssueTypeFieldsAttachmentsByIds=lA,i.selectIssueTypeFieldsAttachmentsMapping=rA,i.selectIssueTypeFieldsById=qA,i.selectIssueTypeFieldsByIds=$A,i.selectIssueTypeFieldsMapping=DA,i.selectIssueTypeFieldsOfIssueType=YP,i.selectIssueTypeIdentifierById=of,i.selectIssueTypeIdentifierMapping=lf,i.selectIssueTypeIdentifierValueById=_f,i.selectIssueTypeIdentifierValueMapping=gf,i.selectIssueTypeIdentifierValues=Dt,i.selectIssueTypeIdentifierValuesByIds=bf,i.selectIssueTypeIdentifierValuesOfIdentifier=xP,i.selectIssueTypeIdentifierValuesOfIssue=QP,i.selectIssueTypeIdentifiers=xi,i.selectIssueTypeIdentifiersByIds=hf,i.selectIssueTypeIdentifiersOfIssueType=XP,i.selectIssueTypeMapping=$f,i.selectIssueTypeStatusById=cn,i.selectIssueTypeStatusMapping=Qf,i.selectIssueTypeStatuses=an,i.selectIssueTypeStatusesByIds=xf,i.selectIssueTypeStatusesOfIssueType=tF,i.selectIssueTypeValuesOfIssueType=JP,i.selectIssueTypes=sn,i.selectIssueTypesByIds=Uf,i.selectIssueTypesOfOrganization=eF,i.selectIssueUpdateById=dS,i.selectIssueUpdateMapping=hn,i.selectIssueUpdates=mn,i.selectIssueUpdatesByIds=rS,i.selectIssueUpdatesOfIssue=uS,i.selectIssues=zt,i.selectIssuesByIds=jp,i.selectIssuesOfIssueType=Dp,i.selectIssuesOfProject=GP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=nP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=XO,i.selectLatestAssetTypeFieldsOfAssetType=AP,i.selectLatestFieldsByAssetProcedureStep=aP,i.selectLatestFormRevisionOfForm=CP,i.selectLatestIssueTypeFieldsOfIssueType=ZP,i.selectLatestRetryTime=dF,i.selectMembershipsByUserOfTeam=SF,i.selectOrganizationAccessById=VS,i.selectOrganizationAccessMapping=Ct,i.selectOrganizationAccessUserMapping=jS,i.selectOrganizationAccessesByIds=zS,i.selectOrganizationById=YS,i.selectOrganizationDocuments=EP,i.selectOrganizations=KS,i.selectOrganizationsByIds=ZS,i.selectOrganizationsMapping=WS,i.selectProjectAccessById=yT,i.selectProjectAccessMapping=Pn,i.selectProjectAccesses=pt,i.selectProjectAccessesByIds=pT,i.selectProjectAccessesOfProject=uF,i.selectProjectAttachmentById=MT,i.selectProjectAttachmentMapping=bT,i.selectProjectAttachments=gn,i.selectProjectAttachmentsByIds=RT,i.selectProjectById=iI,i.selectProjectDocuments=wP,i.selectProjectFileById=kT,i.selectProjectFileMapping=UT,i.selectProjectFiles=LT,i.selectProjectFilesByIds=NT,i.selectProjectMapping=sI,i.selectProjects=Ut,i.selectProjectsByIds=nI,i.selectProjectsOfOrganization=yF,i.selectRehydrated=fF,i.selectStageMapping=vs,i.selectTeamById=BI,i.selectTeamMembershipById=SI,i.selectTeamMemberships=Lt,i.selectTeamMembershipsByIds=TI,i.selectTeamMembershipsMapping=fI,i.selectTeams=En,i.selectTeamsByIds=vI,i.selectTeamsMapping=EI,i.selectTeamsOfOrganization=IF,i.selectUploadUrl=zP,i.selectUserById=$t,i.selectUsers=qt,i.selectUsersByIds=OS,i.selectUsersMapping=fn,i.selectUsersOfOrganization=aF,i.selectUsersOfProject=oF,i.selectUsersOfTeam=TF,i.setAsset=Vr,i.setAssetAttachment=pa,i.setAssetAttachments=Aa,i.setAssetProcedure=Wc,i.setAssetProcedureStep=pr,i.setAssetProcedureStepFieldValues=ir,i.setAssetProcedureStepFieldValuesAttachment=Nd,i.setAssetProcedureStepFieldValuesAttachments=Gd,i.setAssetProcedureStepFieldValuesMany=nr,i.setAssetProcedureStepFields=Bd,i.setAssetProcedureStepFieldsAttachment=fd,i.setAssetProcedureStepFieldsAttachments=Sd,i.setAssetProcedureStepFieldsMany=vd,i.setAssetProcedureSteps=Ar,i.setAssetProcedureType=dd,i.setAssetProcedureTypeAttachment=wa,i.setAssetProcedureTypeAttachments=Ea,i.setAssetProcedureTypeFieldValues=Ec,i.setAssetProcedureTypeFieldValuesAttachment=Ac,i.setAssetProcedureTypeFieldValuesAttachments=fc,i.setAssetProcedureTypeFieldValuesMany=Bc,i.setAssetProcedureTypeFields=ic,i.setAssetProcedureTypeFieldsAttachment=Na,i.setAssetProcedureTypeFieldsAttachments=Ga,i.setAssetProcedureTypeFieldsMany=nc,i.setAssetProcedureTypes=rd,i.setAssetProcedures=Kc,i.setAssetStage=iu,i.setAssetStageCompletion=Gr,i.setAssetStageCompletions=Hr,i.setAssetStages=nu,i.setAssetType=no,i.setAssetTypeAttachment=fu,i.setAssetTypeAttachments=Su,i.setAssetTypeFieldValues=Sl,i.setAssetTypeFieldValuesAttachment=nl,i.setAssetTypeFieldValuesAttachments=al,i.setAssetTypeFieldValuesMany=Tl,i.setAssetTypeFields=Hu,i.setAssetTypeFieldsAttachment=Bu,i.setAssetTypeFieldsAttachments=vu,i.setAssetTypeFieldsMany=Wu,i.setAssetTypeIdentifier=vl,i.setAssetTypeIdentifierValue=Wl,i.setAssetTypeIdentifierValues=Kl,i.setAssetTypeIdentifiers=Vl,i.setAssetTypeStatus=Oo,i.setAssetTypeStatuses=Po,i.setAssetTypes=ao,i.setAssets=zr,i.setClientSDK=eO,i.setClientStore=QI,i.setConversation=ua,i.setConversations=kO,i.setCurrentUser=sF,i.setCurrentUserProfile=iF,i.setDocument=Qo,i.setDocumentAttachment=$o,i.setDocumentAttachments=Co,i.setDocuments=xo,i.setEmailDomain=hh,i.setEmailDomains=mh,i.setForm=Mm,i.setFormIdentifier=wh,i.setFormIdentifierValue=Nh,i.setFormIdentifierValues=Gh,i.setFormIdentifiers=Eh,i.setFormRevision=pm,i.setFormRevisionAttachment=im,i.setFormRevisionAttachments=nm,i.setFormRevisions=Am,i.setFormSubmission=Xm,i.setFormSubmissionAttachment=Um,i.setFormSubmissionAttachments=Lm,i.setFormSubmissions=Qm,i.setForms=Rm,i.setGeoImage=ly,i.setGeoImages=oy,i.setIssue=Rp,i.setIssueAssociation=_y,i.setIssueAssociations=gy,i.setIssueAttachment=ky,i.setIssueAttachments=Ny,i.setIssueComment=Ap,i.setIssueCommentAttachment=sp,i.setIssueCommentAttachments=ip,i.setIssueComments=fp,i.setIssueType=vf,i.setIssueTypeAttachment=kp,i.setIssueTypeAttachments=Np,i.setIssueTypeFieldValues=AA,i.setIssueTypeFieldValuesAttachment=NA,i.setIssueTypeFieldValuesAttachments=GA,i.setIssueTypeFieldValuesMany=fA,i.setIssueTypeFields=EA,i.setIssueTypeFieldsAttachment=sA,i.setIssueTypeFieldsAttachments=iA,i.setIssueTypeFieldsMany=BA,i.setIssueTypeIdentifier=nf,i.setIssueTypeIdentifierValue=Sf,i.setIssueTypeIdentifierValues=Tf,i.setIssueTypeIdentifiers=af,i.setIssueTypeStatus=Wf,i.setIssueTypeStatuses=Kf,i.setIssueTypes=Vf,i.setIssueUpdate=iS,i.setIssueUpdates=nS,i.setIssues=wp,i.setLoggedIn=vo,i.setOrganization=CS,i.setOrganizationAccess=bS,i.setOrganizationAccesses=MS,i.setOrganizations=$S,i.setProject=YT,i.setProjectAccess=dT,i.setProjectAccesses=rT,i.setProjectAttachment=IT,i.setProjectAttachments=OT,i.setProjectFile=vT,i.setProjectFiles=VT,i.setProjects=KT,i.setRehydrated=AF,i.setTeam=gI,i.setTeamMembership=lI,i.setTeamMemberships=oI,i.setTeams=_I,i.setTokens=gP,i.setUploadUrl=VP,i.setUser=yS,i.setUsers=mS,i.shallowEqual=IO,i.slugify=jO,i.spacesToDashesLower=zO,i.teamMembershipReducer=AI,i.teamMembershipSlice=Rn,i.teamReducer=VI,i.teamSlice=wn,i.toFileNameSafeString=VO,i.toUuidArray=V,i.toUuidIdRecord=vO,i.truncate=DO,i.updateAsset=Er,i.updateAssetAttachment=fa,i.updateAssetAttachments=Sa,i.updateAssetProcedure=Nc,i.updateAssetProcedureStep=Tr,i.updateAssetProcedureStepFieldValues=ar,i.updateAssetProcedureStepFieldValuesAttachment=Hd,i.updateAssetProcedureStepFieldValuesAttachments=Wd,i.updateAssetProcedureStepFieldValuesMany=cr,i.updateAssetProcedureStepFields=Vd,i.updateAssetProcedureStepFieldsAttachment=Td,i.updateAssetProcedureStepFieldsAttachments=Id,i.updateAssetProcedureStepFieldsMany=zd,i.updateAssetProcedureSteps=Ir,i.updateAssetProcedureType=id,i.updateAssetProcedureTypeAttachment=Ba,i.updateAssetProcedureTypeAttachments=va,i.updateAssetProcedureTypeFieldValues=vc,i.updateAssetProcedureTypeFieldValuesAttachment=Sc,i.updateAssetProcedureTypeFieldValuesAttachments=Tc,i.updateAssetProcedureTypeFieldValuesMany=Vc,i.updateAssetProcedureTypeFields=ac,i.updateAssetProcedureTypeFieldsAttachment=Ha,i.updateAssetProcedureTypeFieldsAttachments=Wa,i.updateAssetProcedureTypeFieldsMany=cc,i.updateAssetProcedureTypes=nd,i.updateAssetProcedures=Gc,i.updateAssetStage=du,i.updateAssetStageCompletion=Wr,i.updateAssetStageCompletions=Kr,i.updateAssetStages=ru,i.updateAssetType=uo,i.updateAssetTypeAttachment=Tu,i.updateAssetTypeAttachments=Iu,i.updateAssetTypeFieldValues=Il,i.updateAssetTypeFieldValuesAttachment=cl,i.updateAssetTypeFieldValuesAttachments=dl,i.updateAssetTypeFieldValuesMany=Ol,i.updateAssetTypeFields=Ku,i.updateAssetTypeFieldsAttachment=Vu,i.updateAssetTypeFieldsAttachments=zu,i.updateAssetTypeFieldsMany=Yu,i.updateAssetTypeIdentifier=zl,i.updateAssetTypeIdentifierValue=Yl,i.updateAssetTypeIdentifierValues=Zl,i.updateAssetTypeIdentifiers=jl,i.updateAssetTypeStatus=Fo,i.updateAssetTypeStatuses=go,i.updateAssetTypes=lo,i.updateAssets=Br,i.updateConversation=la,i.updateConversations=NO,i.updateDocument=eh,i.updateDocumentAttachment=Uo,i.updateDocumentAttachments=Lo,i.updateDocuments=th,i.updateEmailDomain=yh,i.updateEmailDomains=ph,i.updateForm=wm,i.updateFormIdentifier=Bh,i.updateFormIdentifierValue=Hh,i.updateFormIdentifierValues=Wh,i.updateFormIdentifiers=vh,i.updateFormRevision=fm,i.updateFormRevisionAttachment=am,i.updateFormRevisionAttachments=cm,i.updateFormRevisions=Sm,i.updateFormSubmission=ey,i.updateFormSubmissionAttachment=km,i.updateFormSubmissionAttachments=Nm,i.updateFormSubmissions=ty,i.updateForms=Em,i.updateGeoImage=yy,i.updateGeoImages=py,i.updateIssue=Ep,i.updateIssueAssociation=by,i.updateIssueAssociations=My,i.updateIssueAttachment=Gy,i.updateIssueAttachments=Hy,i.updateIssueComment=Sp,i.updateIssueCommentAttachment=np,i.updateIssueCommentAttachments=ap,i.updateIssueComments=Tp,i.updateIssueType=zf,i.updateIssueTypeAttachment=Gp,i.updateIssueTypeAttachments=Hp,i.updateIssueTypeFieldValues=SA,i.updateIssueTypeFieldValuesAttachment=HA,i.updateIssueTypeFieldValuesAttachments=WA,i.updateIssueTypeFieldValuesMany=TA,i.updateIssueTypeFields=vA,i.updateIssueTypeFieldsAttachment=nA,i.updateIssueTypeFieldsAttachments=aA,i.updateIssueTypeFieldsMany=VA,i.updateIssueTypeIdentifier=cf,i.updateIssueTypeIdentifierValue=If,i.updateIssueTypeIdentifierValues=Of,i.updateIssueTypeIdentifiers=df,i.updateIssueTypeStatus=Yf,i.updateIssueTypeStatuses=Zf,i.updateIssueTypes=jf,i.updateIssueUpdate=aS,i.updateIssueUpdates=cS,i.updateIssues=Bp,i.updateOrganization=NS,i.updateOrganizationAccess=RS,i.updateOrganizationAccesses=wS,i.updateOrganizations=kS,i.updateProject=QT,i.updateProjectAccess=uT,i.updateProjectAccesses=lT,i.updateProjectAttachment=PT,i.updateProjectAttachments=FT,i.updateProjectFile=DT,i.updateProjectFiles=qT,i.updateProjects=XT,i.updateTeam=bI,i.updateTeamMembership=hI,i.updateTeamMemberships=mI,i.updateTeams=MI,i.updateUser=fS,i.updateUsers=AS,i.useSelectorBuilder=TO,i.userReducer=TS,i.userSlice=yn,i.uuidObj=P,i.uuidObjSortFn=Yt,i.uuidSortFn=It,i.versioningReducer=jI,i.versioningSlice=zI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OvermapRootState } from '../../store';
|
|
2
|
-
import { FileAnnotated, Payload,
|
|
2
|
+
import { FileAnnotated, Payload, RequiredFileModel, Stored, Submitted } from '../../typings';
|
|
3
3
|
import { BaseSDK } from '../base';
|
|
4
4
|
import { OptimisticFileModelResult, OptimisticMultipleFileModelResult } from '../typings';
|
|
5
5
|
import { BaseOfflineModelApiService } from './BaseOfflineModelApiService';
|
|
6
|
-
export declare abstract class BaseOfflineFileModelApiService<TModelId extends string, TModel extends
|
|
6
|
+
export declare abstract class BaseOfflineFileModelApiService<TModelId extends string, TModel extends RequiredFileModel, TState extends OvermapRootState, TSDK extends BaseSDK<TState>> extends BaseOfflineModelApiService<TModelId, TModel, TState, TSDK> {
|
|
7
7
|
protected pageSize: number;
|
|
8
8
|
protected abstract getId(model: Stored<TModel>): TModelId;
|
|
9
9
|
protected abstract getBlockers(model: Stored<TModel>): string[];
|
|
@@ -11,7 +11,7 @@ export declare abstract class BaseOfflineFileModelApiService<TModelId extends st
|
|
|
11
11
|
protected abstract buildModel(data: Payload<TModel>): Submitted<TModel>;
|
|
12
12
|
protected abstract buildPayload(model: Submitted<TModel>): object;
|
|
13
13
|
protected abstract buildBulkPayload(model: Submitted<TModel>): object;
|
|
14
|
-
add(payload: Payload<TModel> | FileAnnotated<Omit<Payload<TModel>, keyof
|
|
15
|
-
bulkAdd(payloads: (Payload<TModel> | FileAnnotated<Omit<Payload<TModel>, keyof
|
|
14
|
+
add(payload: Payload<TModel> | FileAnnotated<Omit<Payload<TModel>, keyof RequiredFileModel>>): Promise<OptimisticFileModelResult<TModel>>;
|
|
15
|
+
bulkAdd(payloads: (Payload<TModel> | FileAnnotated<Omit<Payload<TModel>, keyof RequiredFileModel>>)[], batchSize?: number): Promise<OptimisticMultipleFileModelResult<TModel>>;
|
|
16
16
|
delete(uuid: TModelId): Promise<void>;
|
|
17
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentAttachment, FileAnnotated, Organization, Payload,
|
|
1
|
+
import { DocumentAttachment, FileAnnotated, Organization, Payload, RequiredFileModel, Stored, Submitted } from '../../typings';
|
|
2
2
|
import { BaseSDK } from '../base';
|
|
3
3
|
import { OptimisticMultipleFileModelResult } from '../typings';
|
|
4
4
|
import { OvermapRootState } from '../../store';
|
|
@@ -27,7 +27,7 @@ export declare abstract class DocumentAttachmentService<TState extends OvermapRo
|
|
|
27
27
|
protected buildModel(data: Payload<DocumentAttachment>): Submitted<DocumentAttachment>;
|
|
28
28
|
protected buildPayload(model: Submitted<DocumentAttachment>): object;
|
|
29
29
|
protected buildBulkPayload(model: Submitted<DocumentAttachment>): object;
|
|
30
|
-
bulkAdd(payloads: (Payload<DocumentAttachment> | FileAnnotated<Omit<Payload<DocumentAttachment>, keyof
|
|
30
|
+
bulkAdd(payloads: (Payload<DocumentAttachment> | FileAnnotated<Omit<Payload<DocumentAttachment>, keyof RequiredFileModel>>)[], batchSize?: number): Promise<OptimisticMultipleFileModelResult<DocumentAttachment>>;
|
|
31
31
|
private makeReadable;
|
|
32
32
|
refreshStore(organizationUuid: Organization["uuid"], signal?: AbortSignal): Promise<DocumentAttachment[]>;
|
|
33
33
|
}
|
package/dist/sdk/typings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Store } from '@reduxjs/toolkit';
|
|
2
2
|
import { BaseState } from '../store';
|
|
3
|
-
import { Created, GetS3UrlResponse, Model,
|
|
3
|
+
import { Created, GetS3UrlResponse, Model, RequiredFileModel, Stored } from '../typings';
|
|
4
4
|
import { HttpMethod } from '../enums';
|
|
5
5
|
import { DeferredPromise } from '../utils';
|
|
6
6
|
import { BaseSDK } from './base';
|
|
@@ -65,12 +65,12 @@ export type OptimisticModelResult<TModel extends Model> = [Stored<TModel>, Promi
|
|
|
65
65
|
* Analogous to `OptimisticModelResult<TModel>`, but for multiple model instances.
|
|
66
66
|
*/
|
|
67
67
|
export type OptimisticMultipleModelResult<TModel extends Model> = [Stored<TModel>[], Promise<Created<TModel>[]>];
|
|
68
|
-
export type OptimisticFileModelResult<TModel extends
|
|
68
|
+
export type OptimisticFileModelResult<TModel extends RequiredFileModel> = [
|
|
69
69
|
Stored<TModel>,
|
|
70
70
|
Promise<Created<TModel>>,
|
|
71
71
|
Promise<string>
|
|
72
72
|
];
|
|
73
|
-
export type OptimisticMultipleFileModelResult<TModel extends
|
|
73
|
+
export type OptimisticMultipleFileModelResult<TModel extends RequiredFileModel> = [
|
|
74
74
|
Stored<TModel>[],
|
|
75
75
|
Promise<Created<TModel>[]>,
|
|
76
76
|
Promise<string[]>
|
package/dist/typings/files.d.ts
CHANGED
|
@@ -3,17 +3,13 @@ export interface OptionalFileModel extends Model {
|
|
|
3
3
|
file_url: string | null;
|
|
4
4
|
file_sha1: string | null;
|
|
5
5
|
file_extension: string | null;
|
|
6
|
-
}
|
|
7
|
-
export interface OptionalFileWithNameModel extends OptionalFileModel {
|
|
8
6
|
file_name: string | null;
|
|
9
7
|
}
|
|
10
|
-
export interface RequiredFileModel {
|
|
8
|
+
export interface RequiredFileModel extends Model {
|
|
11
9
|
file_url: NonNullable<OptionalFileModel["file_url"]>;
|
|
12
10
|
file_sha1: NonNullable<OptionalFileModel["file_sha1"]>;
|
|
13
11
|
file_extension: NonNullable<OptionalFileModel["file_extension"]>;
|
|
14
|
-
|
|
15
|
-
export interface RequiredFileWithNameModel extends RequiredFileModel {
|
|
16
|
-
file_name: NonNullable<OptionalFileWithNameModel["file_name"]>;
|
|
12
|
+
file_name: NonNullable<OptionalFileModel["file_name"]>;
|
|
17
13
|
file_type: string | null;
|
|
18
14
|
}
|
|
19
15
|
export interface FilePayload {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedCondition } from '@overmap-ai/forms';
|
|
2
|
-
import {
|
|
2
|
+
import { RequiredFileModel } from '../files';
|
|
3
3
|
import { AbbreviationModel, ColorModel, CreatedByModel, GeometryModel, IconModel, IdentifierModel, IdentifierValueModel, IndexedModel, SubmittedAtModel, TimestampedModel, TreeModel, UUIDModel } from './base';
|
|
4
4
|
import { FieldsAttachmentModel, FieldsModel, FieldValuesModel } from './fields';
|
|
5
5
|
import { Organization } from './organizations';
|
|
@@ -97,13 +97,13 @@ export interface AssetTypeIdentifierValue extends UUIDModel, SubmittedAtModel, T
|
|
|
97
97
|
asset: Asset["uuid"];
|
|
98
98
|
asset_type_identifier: AssetTypeIdentifier["uuid"];
|
|
99
99
|
}
|
|
100
|
-
export interface AssetAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
100
|
+
export interface AssetAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
101
101
|
asset: Asset["uuid"];
|
|
102
102
|
}
|
|
103
|
-
export interface AssetTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
103
|
+
export interface AssetTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
104
104
|
asset_type: AssetType["uuid"];
|
|
105
105
|
}
|
|
106
|
-
export interface AssetProcedureTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
106
|
+
export interface AssetProcedureTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
107
107
|
asset_procedure_type: AssetProcedureType["uuid"];
|
|
108
108
|
}
|
|
109
109
|
export interface AssetTypeStatus extends UUIDModel, SubmittedAtModel, TimestampedModel, ColorModel, CreatedByModel {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredFileModel } from '../files';
|
|
2
2
|
import { ColorModel, CreatedByModel, IconModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { Organization } from './organizations';
|
|
4
4
|
import { Project } from './projects';
|
|
@@ -10,7 +10,7 @@ export interface Document extends UUIDModel, SubmittedAtModel, CreatedByModel, T
|
|
|
10
10
|
project: Project["uuid"] | null;
|
|
11
11
|
organization: Organization["uuid"] | null;
|
|
12
12
|
}
|
|
13
|
-
export interface DocumentAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
13
|
+
export interface DocumentAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
14
14
|
document: Document["uuid"];
|
|
15
15
|
}
|
|
16
16
|
export type MovePosition = "left" | "right" | "left-child" | "right-child";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedField, SerializedFieldSection, SerializedFieldValues } from '@overmap-ai/forms';
|
|
2
|
-
import {
|
|
2
|
+
import { RequiredFileModel } from '../files';
|
|
3
3
|
export interface FieldsModel {
|
|
4
4
|
fields: SerializedFieldSection[];
|
|
5
5
|
revision: number;
|
|
@@ -8,9 +8,9 @@ export interface FieldValuesModel {
|
|
|
8
8
|
published_at: string | null;
|
|
9
9
|
values: SerializedFieldValues;
|
|
10
10
|
}
|
|
11
|
-
export interface FieldsAttachmentModel extends
|
|
11
|
+
export interface FieldsAttachmentModel extends RequiredFileModel {
|
|
12
12
|
field_identifier: SerializedField["identifier"];
|
|
13
13
|
}
|
|
14
|
-
export interface FieldValuesAttachmentModel extends
|
|
14
|
+
export interface FieldValuesAttachmentModel extends RequiredFileModel {
|
|
15
15
|
field_identifier: SerializedField["identifier"];
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredFileModel } from '../files';
|
|
2
2
|
import { CanvasMarkableModel, CreatedByModel, IndexedModel, MarkableModel, Payload, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { Project } from './projects';
|
|
4
|
-
export interface GeoImage extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, MarkableModel, CanvasMarkableModel,
|
|
4
|
+
export interface GeoImage extends UUIDModel, SubmittedAtModel, TimestampedModel, CreatedByModel, MarkableModel, CanvasMarkableModel, RequiredFileModel, IndexedModel {
|
|
5
5
|
title: string | null;
|
|
6
6
|
description: string | null;
|
|
7
7
|
project: Project["uuid"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredFileModel } from '../files';
|
|
2
2
|
import { Asset } from './assets';
|
|
3
3
|
import { AbbreviationModel, CanvasMarkableModel, ColorModel, CreatedByModel, IconModel, IdentifierModel, IdentifierValueModel, IndexedModel, MarkableModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
4
4
|
import { FieldsAttachmentModel, FieldsModel, FieldValuesModel } from './fields';
|
|
@@ -71,13 +71,13 @@ export interface IssueTypeIdentifierValue extends UUIDModel, SubmittedAtModel, T
|
|
|
71
71
|
issue: Issue["uuid"];
|
|
72
72
|
issue_type_identifier: IssueTypeIdentifier["uuid"];
|
|
73
73
|
}
|
|
74
|
-
export interface IssueAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
74
|
+
export interface IssueAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
75
75
|
issue: Issue["uuid"];
|
|
76
76
|
}
|
|
77
|
-
export interface IssueTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
77
|
+
export interface IssueTypeAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
78
78
|
issue_type: IssueType["uuid"];
|
|
79
79
|
}
|
|
80
|
-
export interface IssueCommentAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
80
|
+
export interface IssueCommentAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
81
81
|
issue_comment: IssueComment["uuid"];
|
|
82
82
|
}
|
|
83
83
|
export interface IssueTypeStatus extends UUIDModel, SubmittedAtModel, TimestampedModel, ColorModel, CreatedByModel {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RequiredFileModel } from '../files';
|
|
2
2
|
import { BoundableModel, CanvasBoundableModel, CreatedByModel, PolygonBoundedModel, SubmittedAtModel, TimestampedModel, UUIDModel } from './base';
|
|
3
3
|
import { Organization, OrganizationAccess } from './organizations';
|
|
4
4
|
import { User } from './users';
|
|
@@ -6,7 +6,7 @@ export interface Project extends UUIDModel, TimestampedModel, PolygonBoundedMode
|
|
|
6
6
|
name: string;
|
|
7
7
|
organization: Organization["uuid"];
|
|
8
8
|
}
|
|
9
|
-
export interface ProjectFile extends UUIDModel, SubmittedAtModel, TimestampedModel,
|
|
9
|
+
export interface ProjectFile extends UUIDModel, SubmittedAtModel, TimestampedModel, RequiredFileModel, BoundableModel, CanvasBoundableModel, CreatedByModel {
|
|
10
10
|
z_index: number;
|
|
11
11
|
project: Project["uuid"];
|
|
12
12
|
}
|
|
@@ -15,6 +15,6 @@ export interface ProjectAccess extends UUIDModel, CreatedByModel, TimestampedMod
|
|
|
15
15
|
project: Project["uuid"];
|
|
16
16
|
organization_access: OrganizationAccess["uuid"];
|
|
17
17
|
}
|
|
18
|
-
export interface ProjectAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel,
|
|
18
|
+
export interface ProjectAttachment extends UUIDModel, TimestampedModel, SubmittedAtModel, RequiredFileModel, CreatedByModel {
|
|
19
19
|
project: Project["uuid"];
|
|
20
20
|
}
|