You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
8 lines
2.3 KiB
8 lines
2.3 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("require ../chunks/tslib.es6 ../core/Accessor ../core/Error ../core/Logger ../core/urlUtils ../core/accessorSupport/decorators/property ../core/accessorSupport/decorators/cast ../core/RandomLCG ../core/has ../core/accessorSupport/decorators/subclass".split(" "),function(k,d,b,l,m,g,e,n,t,u,p){function h(a,c){if(null==a)return a;a=a.replace(/^\/+/,"");null!=c&&g.isAbsolute(a)&&(a=g.makeRelative(a,c.itemUrl));return a?.replace(/^\/+/,"").replace(/^(\.\/)?resources\//,"")}b=class extends b{constructor(a){super(a); |
|
this.portalItem=null}normalizeCtorArgs(a){return a?.portalItem&&a.path?{...a,path:h(a.path,a.portalItem)}:a}set path(a){null!=a&&g.isAbsolute(a)?m.getLogger(this).error("portalitemresource:invalid-path","A portal item resource path must be relative"):this._set("path",a)}_castPath(a){return h(a,this.portalItem)}get url(){return this.portalItem&&this.path?`${this.portalItem.itemUrl}/resources/${this.path}`:null}get cdnUrl(){return this.portalItem&&this.path?`${this.portalItem.itemCdnUrl}/resources/${this.path}`: |
|
null}get itemRelativeUrl(){return this.portalItem&&this.path?`./resources/${this.path}`:null}fetch(a="json",c){const f=this.cdnUrl;if(null==f)throw new l("portal-item-resource:fetch","Portal item resource does not refer to a valid item or path");return this.portalItem.portal.request(f,{responseType:a,query:{token:this.portalItem.apiKey},signal:c?.signal})}async update(a,c){const {addOrUpdateResources:f}=await new Promise((q,r)=>k(["./support/resourceUtils"],q,r));await f(this.portalItem,[{resource:this, |
|
content:a,compress:c?.compress,access:c?.access}],"update",c);return this}hasPath(){return null!=this.path}};d.__decorate([e.property()],b.prototype,"portalItem",void 0);d.__decorate([e.property({type:String,value:null})],b.prototype,"path",null);d.__decorate([n.cast("path")],b.prototype,"_castPath",null);d.__decorate([e.property({type:String,readOnly:!0})],b.prototype,"url",null);d.__decorate([e.property({type:String,readOnly:!0})],b.prototype,"cdnUrl",null);d.__decorate([e.property({type:String, |
|
readOnly:!0})],b.prototype,"itemRelativeUrl",null);return b=d.__decorate([p.subclass("esri.portal.PortalItemResource")],b)}); |