@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
1 lines • 3.34 kB
JavaScript
;(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[9239],{9239:(t,e,o)=>{o.r(e),o.d(e,{executeAttachmentQuery:()=>b,fetchAttachments:()=>j,processAttachmentQueryResult:()=>I});var n,r=o(70333),i=o(78888),s=o(84952),a=o(10536),l=o(90237),d=o(25482),p=o(10107),c=o(56507),u=(o(44208),o(87811),o(40608));const h={1:{id:1,rotation:0,mirrored:!1},2:{id:2,rotation:0,mirrored:!0},3:{id:3,rotation:180,mirrored:!1},4:{id:4,rotation:180,mirrored:!0},5:{id:5,rotation:-90,mirrored:!0},6:{id:6,rotation:90,mirrored:!1},7:{id:7,rotation:90,mirrored:!0},8:{id:8,rotation:-90,mirrored:!1}};let y=n=class extends d.A{constructor(t){super(t),this.contentType=null,this.exifInfo=null,this.id=null,this.globalId=null,this.keywords=null,this.name=null,this.parentGlobalId=null,this.parentObjectId=null,this.size=null,this.url=null}get orientationInfo(){const{exifInfo:t}=this,e=function(t){const{exifInfo:e,exifName:o,tagName:n}=t;if(!e||!o||!n)return null;const r=e.find((t=>t.name===o));return r?function(t){const{tagName:e,tags:o}=t;if(!o||!e)return null;const n=o.find((t=>t.name===e));return n?.value||null}({tagName:n,tags:r.tags}):null}({exifName:"Exif IFD0",tagName:"Orientation",exifInfo:t});return h[e]||null}clone(){return new n({contentType:this.contentType,exifInfo:this.exifInfo,id:this.id,globalId:this.globalId,keywords:this.keywords,name:this.name,parentGlobalId:this.parentGlobalId,parentObjectId:this.parentObjectId,size:this.size,url:this.url})}};(0,l._)([(0,p.MZ)({type:String})],y.prototype,"contentType",void 0),(0,l._)([(0,p.MZ)()],y.prototype,"exifInfo",void 0),(0,l._)([(0,p.MZ)({readOnly:!0})],y.prototype,"orientationInfo",null),(0,l._)([(0,p.MZ)({type:c.jz})],y.prototype,"id",void 0),(0,l._)([(0,p.MZ)({type:String})],y.prototype,"globalId",void 0),(0,l._)([(0,p.MZ)({type:String})],y.prototype,"keywords",void 0),(0,l._)([(0,p.MZ)({type:String})],y.prototype,"name",void 0),(0,l._)([(0,p.MZ)({json:{read:!1}})],y.prototype,"parentGlobalId",void 0),(0,l._)([(0,p.MZ)({json:{read:!1}})],y.prototype,"parentObjectId",void 0),(0,l._)([(0,p.MZ)({type:c.jz})],y.prototype,"size",void 0),(0,l._)([(0,p.MZ)({json:{read:!1}})],y.prototype,"url",void 0),y=n=(0,l._)([(0,u.$)("esri.rest.query.support.AttachmentInfo")],y);const f=y;function m(t){const e=t.toJSON();return e.attachmentTypes&&(e.attachmentTypes=e.attachmentTypes.join(",")),e.keywords&&(e.keywords=e.keywords.join(",")),e.globalIds&&(e.globalIds=e.globalIds.join(",")),e.objectIds&&(e.objectIds=e.objectIds.join(",")),e.size&&(e.size=e.size.join(",")),e.orderByFields&&(e.orderByFields=e.orderByFields.join(",")),e}function I(t,e){const o={};for(const n of e){const{parentObjectId:e,parentGlobalId:i,attachmentInfos:a}=n;for(const n of a){const{id:a}=n,l=(0,s.yM)((0,r.Y3)(`${t.path}/${e}/attachments/${a}`)),d=f.fromJSON(n);d.set({url:l,parentObjectId:e,parentGlobalId:i}),o[e]?o[e].push(d):o[e]=[d]}}return o}function b(t,e,o){let n={query:(0,a.z)({...t.query,f:"json",...m(e)})};return o&&(n={...o,...n,query:{...o.query,...n.query}}),(0,i.A)(t.path+"/queryAttachments",n).then((t=>t.data.attachmentGroups))}async function j(t,e,o){const{objectIds:n}=e,r=[];for(const e of n)r.push((0,i.A)(t.path+"/"+e+"/attachments",o));return Promise.all(r).then((t=>n.map(((e,o)=>({parentObjectId:e,attachmentInfos:t[o].data.attachmentInfos})))))}}}]);