@arcgis/core 4.30.0-next.20240213 → 4.30.0-next.20240215
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/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/08ba549f9c4afc42a21c.js +1 -0
- package/assets/esri/core/workers/chunks/114afcee6a66415cd123.js +1 -0
- package/assets/esri/core/workers/chunks/1320562881294ce93806.js +1 -0
- package/assets/esri/core/workers/chunks/13451fa3e4b02ca2beb0.js +1 -0
- package/assets/esri/core/workers/chunks/{a384f29cb3256401962a.js → 1629a8c2085dce59cd1b.js} +1 -1
- package/assets/esri/core/workers/chunks/18512caeeb03b9759ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{cc1c958aad790a44048b.js → 1ca28af7c516d8283bb0.js} +1 -1
- package/assets/esri/core/workers/chunks/1f8a0fb32b96e50f5909.js +1 -0
- package/assets/esri/core/workers/chunks/{abab3abb8ea7610d9fb8.js → 21e7a88478f5d15e0e71.js} +1 -1
- package/assets/esri/core/workers/chunks/24452a26b0c5322c7d2b.js +1 -0
- package/assets/esri/core/workers/chunks/25b88787ead0cc44cda4.js +1 -0
- package/assets/esri/core/workers/chunks/2649166d1a462c7f8338.js +1 -0
- package/assets/esri/core/workers/chunks/2c96771a365f8f70e996.js +1 -0
- package/assets/esri/core/workers/chunks/352e7f8d694f3f217a2d.js +1 -0
- package/assets/esri/core/workers/chunks/392214a3a1d712eda155.js +1 -0
- package/assets/esri/core/workers/chunks/397f15b5bce6838db084.js +1 -0
- package/assets/esri/core/workers/chunks/3bf281e979408b9363ed.js +1 -0
- package/assets/esri/core/workers/chunks/4edc667148d023b5b5af.js +1 -0
- package/assets/esri/core/workers/chunks/51e4f771bfe352967c97.js +1 -0
- package/assets/esri/core/workers/chunks/55cd747e06bb59d1a328.js +1 -0
- package/assets/esri/core/workers/chunks/5638d95e600ff271c5b1.js +1 -0
- package/assets/esri/core/workers/chunks/563d172caa15ea1b510d.js +1108 -0
- package/assets/esri/core/workers/chunks/58f088b08e12c5435dbc.js +1 -0
- package/assets/esri/core/workers/chunks/5aef1e898618f8dda2c9.js +1 -0
- package/assets/esri/core/workers/chunks/608be8ebf772aefc36a5.js +1 -0
- package/assets/esri/core/workers/chunks/64df2521b2814d2fb918.js +1 -0
- package/assets/esri/core/workers/chunks/65070fb591f6ef8313c3.js +1 -0
- package/assets/esri/core/workers/chunks/656ec8a14df0e4b68433.js +1 -0
- package/assets/esri/core/workers/chunks/6601fe99d587b9dff3c7.js +1 -0
- package/assets/esri/core/workers/chunks/{274e623323e24250ca46.js → 6ac424af4f2825fabceb.js} +1 -1
- package/assets/esri/core/workers/chunks/{eb2d6f1ee63b40ae0736.js → 774b655498289b1b36bb.js} +1 -1
- package/assets/esri/core/workers/chunks/781bb63af571568358e3.js +1 -0
- package/assets/esri/core/workers/chunks/9e54d2cbe42f5552aaca.js +1 -0
- package/assets/esri/core/workers/chunks/{f03d62ab7806b68d0b62.js → 9fbf61675e2a5374f754.js} +1 -1
- package/assets/esri/core/workers/chunks/a5253543eae1708d11b9.js +1 -0
- package/assets/esri/core/workers/chunks/aa9b46bcb75c96731de3.js +1 -0
- package/assets/esri/core/workers/chunks/cfb8b6b5e9c21d582cf4.js +1 -0
- package/assets/esri/core/workers/chunks/d1b2372084c1e8c60f79.js +1 -0
- package/assets/esri/core/workers/chunks/{1c6914ded7db720f7bf7.js → daf6eab5dd198ca9a67b.js} +1 -1
- package/assets/esri/core/workers/chunks/e03edeaf3af46495449e.js +1 -0
- package/assets/esri/core/workers/chunks/e685214698fbc84276dd.js +1 -0
- package/assets/esri/core/workers/chunks/ebb294c82207f3ff9f04.js +1 -0
- package/assets/esri/core/workers/chunks/ec20e23aec9370df8a55.js +1 -0
- package/assets/esri/core/workers/chunks/{e4da908079417cc2f495.js → ee0c77889059815a31b2.js} +1 -1
- package/assets/esri/core/workers/chunks/f68b7bb88c444a7cbbd2.js +1 -0
- package/assets/esri/core/workers/chunks/f90bbebd2dc07a77ce09.js +1 -0
- package/assets/esri/core/workers/chunks/fa388680ff976a6b30f6.js +1 -0
- package/chunks/vec32.js +1 -1
- package/interfaces.d.ts +135 -68
- package/layers/WFSLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/layers/support/fromPortalItem.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalGroup.js +1 -1
- package/portal/PortalUser.js +1 -1
- package/portal/support/geometryServiceUtils.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/visualVariables/SizeVariable.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/places.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/defaultCIMValues.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/VisualVariablesSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +9 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceConstants.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/drawSurfaces.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/SnappingOptions.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webdoc/support/webdocLoadUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/support/EditorItem.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/Search/support/locatorUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +0 -1
- package/assets/esri/core/workers/chunks/02a6c43ec17e7223fac5.js +0 -1
- package/assets/esri/core/workers/chunks/02ee044597c89c86b934.js +0 -1
- package/assets/esri/core/workers/chunks/05ebb9cec0e1826b283f.js +0 -1
- package/assets/esri/core/workers/chunks/143ccb14c9e915dd1412.js +0 -1
- package/assets/esri/core/workers/chunks/24649b410b757599a549.js +0 -1
- package/assets/esri/core/workers/chunks/24d19abc680b341d13bb.js +0 -1
- package/assets/esri/core/workers/chunks/2519b207894132d5ea91.js +0 -1
- package/assets/esri/core/workers/chunks/30f9b2a3417cbcfeecca.js +0 -1
- package/assets/esri/core/workers/chunks/42ab9c282bb267c3db03.js +0 -1
- package/assets/esri/core/workers/chunks/478815fc19b452d8317d.js +0 -1
- package/assets/esri/core/workers/chunks/49afeac45250b15b5f36.js +0 -1
- package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +0 -1
- package/assets/esri/core/workers/chunks/50cdc59426ba859027e2.js +0 -1
- package/assets/esri/core/workers/chunks/5401ec9c9fd62dcac6ec.js +0 -1
- package/assets/esri/core/workers/chunks/554d86df71821d671d2c.js +0 -1
- package/assets/esri/core/workers/chunks/58c5861d060c808813a1.js +0 -1
- package/assets/esri/core/workers/chunks/5dbb3ef6fdd25ac632ad.js +0 -1
- package/assets/esri/core/workers/chunks/61c4bb58ef9f2d99c75e.js +0 -1
- package/assets/esri/core/workers/chunks/6e50220f8e2d392e2855.js +0 -1
- package/assets/esri/core/workers/chunks/6fd8047741a0df006ddd.js +0 -1
- package/assets/esri/core/workers/chunks/7709248f59520aee6f51.js +0 -1
- package/assets/esri/core/workers/chunks/8852a64918caf80fc414.js +0 -1
- package/assets/esri/core/workers/chunks/8d119dc0a92ad3612daa.js +0 -1
- package/assets/esri/core/workers/chunks/94dfb80ab23dda92918b.js +0 -1
- package/assets/esri/core/workers/chunks/9ebbc75ba5c623a322aa.js +0 -1
- package/assets/esri/core/workers/chunks/a5babc10f47c24651d15.js +0 -1
- package/assets/esri/core/workers/chunks/a74c59cf5d1c4e63a4e1.js +0 -1
- package/assets/esri/core/workers/chunks/ada5d6fd70bd3e403442.js +0 -1
- package/assets/esri/core/workers/chunks/b95d69d84d60ac9828b9.js +0 -1
- package/assets/esri/core/workers/chunks/be562536212360943388.js +0 -1
- package/assets/esri/core/workers/chunks/ce823fc2d0e0095f398c.js +0 -1
- package/assets/esri/core/workers/chunks/d06d36815c2121484a13.js +0 -1
- package/assets/esri/core/workers/chunks/d5f06a7b0ea7951c8dd0.js +0 -1
- package/assets/esri/core/workers/chunks/ddc71fe66c7a49082920.js +0 -1
- package/assets/esri/core/workers/chunks/de6d54df7ae32694fd70.js +0 -1
- package/assets/esri/core/workers/chunks/f13c4b9692dad5802a32.js +0 -1106
- package/assets/esri/core/workers/chunks/f1e8f7d1a98b9e207b1b.js +0 -1
- package/assets/esri/core/workers/chunks/f9e9675f1c2287231653.js +0 -1
package/portal/Portal.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import B from"./PortalUser.js";import{supportsApiKey as D}from"../support/apiKeyUtils.js";var _;let M;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:B})};let C=_=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=B.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O;if(r.num=100,r.sortField="title",t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&U[r]?U[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new O;o.query=e||(t.apiKey&&D(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};C.AUTH_MODE_ANONYMOUS="anonymous",C.AUTH_MODE_AUTO="auto",C.AUTH_MODE_IMMEDIATE="immediate",C.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],C.prototype,"access",void 0),e([y()],C.prototype,"allSSL",void 0),e([y()],C.prototype,"authMode",void 0),e([y()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],C.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],C.prototype,"bingKey",void 0),e([y()],C.prototype,"canListApps",void 0),e([y()],C.prototype,"canListData",void 0),e([y()],C.prototype,"canListPreProvisionedItems",void 0),e([y()],C.prototype,"canProvisionDirectPurchase",void 0),e([y()],C.prototype,"canSearchPublic",void 0),e([y()],C.prototype,"canShareBingPublic",void 0),e([y()],C.prototype,"canSharePublic",void 0),e([y()],C.prototype,"canSignInArcGIS",void 0),e([y()],C.prototype,"canSignInIDP",void 0),e([y()],C.prototype,"colorSetsGroupQuery",void 0),e([y()],C.prototype,"commentsEnabled",void 0),e([y({type:Date})],C.prototype,"created",void 0),e([y()],C.prototype,"credential",void 0),e([y()],C.prototype,"culture",void 0),e([y()],C.prototype,"currentVersion",void 0),e([y()],C.prototype,"customBaseUrl",void 0),e([y()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([y()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([y({type:v})],C.prototype,"defaultExtent",void 0),e([y()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([y()],C.prototype,"description",void 0),e([y()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],C.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],C.prototype,"extraQuery",null),e([y()],C.prototype,"featuredGroups",void 0),e([y()],C.prototype,"featuredItemsGroupQuery",void 0),e([y()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],C.prototype,"layoutGroupQuery",void 0),e([y()],C.prototype,"livingAtlasGroupQuery",void 0),e([y()],C.prototype,"hasCategorySchema",void 0),e([y()],C.prototype,"helpBase",void 0),e([y()],C.prototype,"helperServices",void 0),e([y()],C.prototype,"helpMap",void 0),e([y()],C.prototype,"homePageFeaturedContent",void 0),e([y()],C.prototype,"homePageFeaturedContentCount",void 0),e([y()],C.prototype,"httpPort",void 0),e([y()],C.prototype,"httpsPort",void 0),e([y()],C.prototype,"id",void 0),e([y()],C.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],C.prototype,"isOrganization",null),e([y()],C.prototype,"isPortal",void 0),e([y()],C.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],C.prototype,"itemPageUrl",null),e([y()],C.prototype,"layerTemplatesGroupQuery",void 0),e([y()],C.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],C.prototype,"modified",void 0),e([y()],C.prototype,"name",void 0),e([y()],C.prototype,"portalHostname",void 0),e([y()],C.prototype,"portalMode",void 0),e([y()],C.prototype,"portalProperties",void 0),e([y()],C.prototype,"region",void 0),e([y({readOnly:!0})],C.prototype,"restUrl",null),e([y()],C.prototype,"rotatorPanels",void 0),e([y()],C.prototype,"showHomePageDescription",void 0),e([y()],C.prototype,"sourceJSON",void 0),e([y()],C.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([y()],C.prototype,"supportsHostedServices",void 0),e([y()],C.prototype,"symbolSetsGroupQuery",void 0),e([y()],C.prototype,"templatesGroupQuery",void 0),e([y()],C.prototype,"thumbnail",void 0),e([y({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([y()],C.prototype,"units",void 0),e([y()],C.prototype,"url",void 0),e([y()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([y()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([y()],C.prototype,"use3dBasemaps",void 0),e([y()],C.prototype,"useStandardizedQuery",void 0),e([y()],C.prototype,"useVectorBasemaps",void 0),e([y()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=_=e([f("esri.portal.Portal")],C);const Q=C,b=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{Q as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../config.js";import{id as r}from"../kernel.js";import o from"../request.js";import s from"../core/Error.js";import{JSONSupportMixin as i}from"../core/JSONSupport.js";import a from"../core/Loadable.js";import{destroyMaybe as l,removeMaybe as u}from"../core/maybe.js";import{throwIfAborted as n,isAborted as p,createAbortError as d,throwIfAbortError as h}from"../core/promiseUtils.js";import{property as y}from"../core/accessorSupport/decorators/property.js";import{ensureType as c}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import v from"../geometry/Extent.js";import{getLocale as S}from"../intl/locale.js";import{ensureDefaultPortalInstance as P}from"./portalDefault.js";import g from"./PortalGroup.js";import O from"./PortalQueryParams.js";import G from"./PortalQueryResult.js";import B from"./PortalUser.js";import{supportsApiKey as D}from"../support/apiKeyUtils.js";var _;let M;const U={PortalGroup:()=>Promise.resolve({default:g}),PortalItem:()=>import("./PortalItem.js"),PortalUser:()=>Promise.resolve({default:B})};let C=_=class extends(i(a)){constructor(e){super(e),this._esriIdCredentialCreateHandle=null,this.access=null,this.allSSL=!1,this.authMode="auto",this.authorizedCrossOriginDomains=null,this.basemapGalleryGroupQuery=null,this.basemapGalleryGroupQuery3D=null,this.bingKey=null,this.canListApps=!1,this.canListData=!1,this.canListPreProvisionedItems=!1,this.canProvisionDirectPurchase=!1,this.canSearchPublic=!0,this.canShareBingPublic=!1,this.canSharePublic=!1,this.canSignInArcGIS=!1,this.canSignInIDP=!1,this.colorSetsGroupQuery=null,this.commentsEnabled=!1,this.created=null,this.culture=null,this.customBaseUrl=null,this.defaultBasemap=null,this.defaultDevBasemap=null,this.defaultExtent=null,this.defaultVectorBasemap=null,this.description=null,this.devBasemapGalleryGroupQuery=null,this.eueiEnabled=null,this.featuredGroups=null,this.featuredItemsGroupQuery=null,this.galleryTemplatesGroupQuery=null,this.layoutGroupQuery=null,this.livingAtlasGroupQuery=null,this.hasCategorySchema=!1,this.helperServices=null,this.homePageFeaturedContent=null,this.homePageFeaturedContentCount=null,this.httpPort=null,this.httpsPort=null,this.id=null,this.ipCntryCode=null,this.isPortal=!1,this.isReadOnly=!1,this.layerTemplatesGroupQuery=null,this.maxTokenExpirationMinutes=null,this.modified=null,this.name=null,this.portalHostname=null,this.portalMode=null,this.portalProperties=null,this.region=null,this.rotatorPanels=null,this.showHomePageDescription=!1,this.sourceJSON=null,this.supportsHostedServices=!1,this.symbolSetsGroupQuery=null,this.templatesGroupQuery=null,this.units=null,this.url=t.portalUrl,this.urlKey=null,this.user=null,this.use3dBasemaps=!0,this.useStandardizedQuery=!1,this.useVectorBasemaps=!1,this.vectorBasemapGalleryGroupQuery=null}normalizeCtorArgs(e){return"string"==typeof e?{url:e}:e}destroy(){b.unregister(this),this.defaultBasemap=l(this.defaultBasemap),this.defaultDevBasemap=l(this.defaultDevBasemap),this.defaultVectorBasemap=l(this.defaultVectorBasemap),this._esriIdCredentialCreateHandle=u(this._esriIdCredentialCreateHandle)}readAuthorizedCrossOriginDomains(e){if(e)for(const r of e)t.request.trustedServers.includes(r)||t.request.trustedServers.push(r);return e}readDefaultBasemap(e){return this._readBasemap(e)}readDefaultDevBasemap(e){return this._readBasemap(e)}readDefaultVectorBasemap(e){return this._readBasemap(e)}get extraQuery(){const e=this.user?.orgId,t=!e||this.canSearchPublic;return this.id&&!t?` AND orgid:${this.id}`:null}get isOrganization(){return!!this.access}get itemPageUrl(){return this.url?`${this.url}/home/item.html`:null}get restUrl(){let e=this.url;if(e){const t=e.indexOf("/sharing");e=t>0?e.substring(0,t):this.url.replace(/\/+$/,""),e+="/sharing/rest"}return e}get thumbnailUrl(){const e=this.restUrl,t=this.thumbnail;return e&&t?this._normalizeSSL(e+"/portals/self/resources/"+t):null}readUrlKey(e){return e?e.toLowerCase():e}readUser(e){let t=null;return e&&(t=B.fromJSON(e),t.portal=this),t}load(e){const t=import("../Basemap.js").then((({default:t})=>{n(e),M=t})).then((()=>this.sourceJSON?this.sourceJSON:this.fetchSelf(this.authMode,!1,e))).then((e=>{if(r){const e=r;this.credential=e.findCredential(this.restUrl),this.credential||this.authMode!==_.AUTH_MODE_AUTO&&this.authMode!==_.AUTH_MODE_NO_PROMPT||(this._esriIdCredentialCreateHandle?.remove(),this._esriIdCredentialCreateHandle=e.on("credential-create",w(new WeakRef(this))),b.register(this,this._esriIdCredentialCreateHandle,this))}this.sourceJSON=e,this.read(e)}));return this.addResolvingPromise(t),Promise.resolve(this)}async createElevationLayers(){await this.load();const e=this._getHelperService("defaultElevationLayers"),t=(await import("../layers/ElevationLayer.js")).default;return e?e.map((e=>new t({id:e.id,url:e.url}))):[]}async fetchBasemaps(e,t){const r=await this._fetchBasemaps(e,t);if(!0===t?.include3d&&!1!==this.use3dBasemaps){const o=await this._fetchBasemaps3D(e,t);r.unshift(...o)}return r}fetchCategorySchema(e){return this.hasCategorySchema?this.request(this.restUrl+"/portals/self/categorySchema",e).then((e=>e.categorySchema)):p(e)?Promise.reject(d()):Promise.resolve([])}fetchFeaturedGroups(e){const t=this.featuredGroups,r=new O({num:100,sortField:"title"});if(t&&t.length){const o=[];for(const e of t)o.push(`(title:"${e.title}" AND owner:${e.owner})`);return r.query=o.join(" OR "),this.queryGroups(r,e).then((e=>e.results))}return p(e)?Promise.reject(d()):Promise.resolve([])}fetchRegions(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/regions",{...e,query:{culture:t}})}fetchSettings(e){const t=this.user?.culture||this.culture||S();return this.request(this.restUrl+"/portals/self/settings",{...e,query:{culture:t}})}static getDefault(){return P((()=>new _))}queryGroups(e,t){return this.queryPortal("/community/groups",e,"PortalGroup",t)}queryItems(e,t){return this.queryPortal("/search",e,"PortalItem",t)}queryUsers(e,t){return e.sortField||(e.sortField="username"),this.queryPortal("/community/users",e,"PortalUser",t)}fetchSelf(e=this.authMode,t=!1,r){const o=this.restUrl+"/portals/self",s={authMode:e,query:{culture:S().toLowerCase()},withCredentials:!0,...r};return"auto"===s.authMode&&(s.authMode="no-prompt"),t&&(s.query.default=!0),this.request(o,s)}queryPortal(e,t,r,o){const s=c(O,t),i=t=>this.request(this.restUrl+e,{...s.toRequestOptions(this),...o}).then((e=>{const r=s.clone();return r.start=e.nextStart,new G({nextQueryParams:r,queryParams:s,total:e.total,results:_._resultsToTypedArray(t,{portal:this},e,o)})})).then((e=>Promise.all(e.results.map((t=>"function"==typeof t.when?t.when():e))).then((()=>e),(t=>(h(t),e)))));return r&&U[r]?U[r]().then((({default:e})=>(n(o),i(e)))):i()}signIn(){if(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT&&!r)return Promise.reject(new s("portal:invalid-auth-mode",`Current "authMode"' is "${this.authMode}"`));if("failed"===this.loadStatus)return Promise.reject(this.loadError);const e=e=>Promise.resolve().then((()=>"not-loaded"===this.loadStatus?(e||(this.authMode="immediate"),this.load().then((()=>null))):"loading"===this.loadStatus?this.load().then((()=>this.credential?null:(this.credential=e,this.fetchSelf("immediate")))):this.user&&this.credential===e?null:(this.credential=e,this.fetchSelf("immediate")))).then((e=>{e&&(this.sourceJSON=e,this.read(e))}));return r?r.getCredential(this.restUrl,{prompt:this.authMode!==_.AUTH_MODE_NO_PROMPT}).then((t=>e(t))):e(this.credential)}normalizeUrl(e){const t=this.credential?.token;return this._normalizeSSL(t?e+(e.includes("?")?"&":"?")+"token="+t:e)}requestToTypedArray(e,t,r){return this.request(e,t).then((e=>{const t=_._resultsToTypedArray(r,{portal:this},e);return Promise.all(t.map((t=>"function"==typeof t.when?t.when():e))).then((()=>t),(()=>t))}))}request(e,t={}){const r={f:"json",...t.query},{authMode:s=(this.authMode===_.AUTH_MODE_ANONYMOUS||this.authMode===_.AUTH_MODE_NO_PROMPT?this.authMode:"auto"),body:i=null,cacheBust:a=!1,method:l="auto",responseType:u="json",signal:n}=t,p={authMode:s,body:i,cacheBust:a,method:l,query:r,responseType:u,timeout:0,signal:n};return t.withCredentials&&(p.withCredentials=!0),o(this._normalizeSSL(e),p).then((e=>e.data))}toJSON(){throw new s("internal:not-yet-implemented","Portal.toJSON is not yet implemented")}static fromJSON(e){if(!e)return null;if(e.declaredClass)throw new Error("JSON object is already hydrated");return new _({sourceJSON:e})}_getHelperService(e){const t=this.helperServices&&this.helperServices[e];if(!t)throw new s("portal:service-not-found",`The \`helperServices\` do not include an entry named "${e}"`);return t}async _fetchBasemaps(e,r){const o=new O;o.query=e||(t.apiKey&&D(this.url)?this.devBasemapGalleryGroupQuery:this.useVectorBasemaps?this.vectorBasemapGalleryGroupQuery:this.basemapGalleryGroupQuery),o.disableExtraQuery=!0;const s=await this.queryGroups(o,r);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Map" -type:"Web Application"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,r);if(!a.total)return[];return a.results.filter((e=>"Web Map"===e.type)).map((e=>new M({portalItem:e})))}async _fetchBasemaps3D(e,t){const r=e||this.basemapGalleryGroupQuery3D;if(!r)return[];const o=new O({query:r,disableExtraQuery:!0}),s=await this.queryGroups(o,t);if(!s.total)return[];const i=s.results[0];o.num=100,o.query='type:"Web Scene"',o.sortField=i.sortField||"name",o.sortOrder=i.sortOrder||"desc";const a=await i.queryItems(o,t);if(!a.total)return[];return a.results.filter((e=>"Web Scene"===e.type)).map((e=>new M({portalItem:e})))}_normalizeSSL(e){return e.replace(/^http:/i,"https:").replace(":7080",":7443")}_readBasemap(e){if(e){const t=M.fromJSON(e);return t.portalItem={portal:this},t}return null}static _resultsToTypedArray(e,t,r,o){let s=[];if(r){const i=null!=o?o.signal:null;s=r.listings||r.notifications||r.userInvitations||r.tags||r.items||r.groups||r.comments||r.provisions||r.results||r.relatedItems||r,(e||t)&&(s=s.map((r=>{const o=Object.assign(e?e.fromJSON(r):r,t);return"function"==typeof o.load&&o.load(i),o})))}else s=[];return s}};C.AUTH_MODE_ANONYMOUS="anonymous",C.AUTH_MODE_AUTO="auto",C.AUTH_MODE_IMMEDIATE="immediate",C.AUTH_MODE_NO_PROMPT="no-prompt",e([y()],C.prototype,"access",void 0),e([y()],C.prototype,"allSSL",void 0),e([y()],C.prototype,"authMode",void 0),e([y()],C.prototype,"authorizedCrossOriginDomains",void 0),e([m("authorizedCrossOriginDomains")],C.prototype,"readAuthorizedCrossOriginDomains",null),e([y()],C.prototype,"basemapGalleryGroupQuery",void 0),e([y({json:{name:"3DBasemapGalleryGroupQuery"}})],C.prototype,"basemapGalleryGroupQuery3D",void 0),e([y()],C.prototype,"bingKey",void 0),e([y()],C.prototype,"canListApps",void 0),e([y()],C.prototype,"canListData",void 0),e([y()],C.prototype,"canListPreProvisionedItems",void 0),e([y()],C.prototype,"canProvisionDirectPurchase",void 0),e([y()],C.prototype,"canSearchPublic",void 0),e([y()],C.prototype,"canShareBingPublic",void 0),e([y()],C.prototype,"canSharePublic",void 0),e([y()],C.prototype,"canSignInArcGIS",void 0),e([y()],C.prototype,"canSignInIDP",void 0),e([y()],C.prototype,"colorSetsGroupQuery",void 0),e([y()],C.prototype,"commentsEnabled",void 0),e([y({type:Date})],C.prototype,"created",void 0),e([y()],C.prototype,"credential",void 0),e([y()],C.prototype,"culture",void 0),e([y()],C.prototype,"currentVersion",void 0),e([y()],C.prototype,"customBaseUrl",void 0),e([y()],C.prototype,"defaultBasemap",void 0),e([m("defaultBasemap")],C.prototype,"readDefaultBasemap",null),e([y()],C.prototype,"defaultDevBasemap",void 0),e([m("defaultDevBasemap")],C.prototype,"readDefaultDevBasemap",null),e([y({type:v})],C.prototype,"defaultExtent",void 0),e([y()],C.prototype,"defaultVectorBasemap",void 0),e([m("defaultVectorBasemap")],C.prototype,"readDefaultVectorBasemap",null),e([y()],C.prototype,"description",void 0),e([y()],C.prototype,"devBasemapGalleryGroupQuery",void 0),e([y()],C.prototype,"eueiEnabled",void 0),e([y({readOnly:!0})],C.prototype,"extraQuery",null),e([y()],C.prototype,"featuredGroups",void 0),e([y()],C.prototype,"featuredItemsGroupQuery",void 0),e([y()],C.prototype,"galleryTemplatesGroupQuery",void 0),e([y()],C.prototype,"layoutGroupQuery",void 0),e([y()],C.prototype,"livingAtlasGroupQuery",void 0),e([y()],C.prototype,"hasCategorySchema",void 0),e([y()],C.prototype,"helpBase",void 0),e([y()],C.prototype,"helperServices",void 0),e([y()],C.prototype,"helpMap",void 0),e([y()],C.prototype,"homePageFeaturedContent",void 0),e([y()],C.prototype,"homePageFeaturedContentCount",void 0),e([y()],C.prototype,"httpPort",void 0),e([y()],C.prototype,"httpsPort",void 0),e([y()],C.prototype,"id",void 0),e([y()],C.prototype,"ipCntryCode",void 0),e([y({readOnly:!0})],C.prototype,"isOrganization",null),e([y()],C.prototype,"isPortal",void 0),e([y()],C.prototype,"isReadOnly",void 0),e([y({readOnly:!0})],C.prototype,"itemPageUrl",null),e([y()],C.prototype,"layerTemplatesGroupQuery",void 0),e([y()],C.prototype,"maxTokenExpirationMinutes",void 0),e([y({type:Date})],C.prototype,"modified",void 0),e([y()],C.prototype,"name",void 0),e([y()],C.prototype,"portalHostname",void 0),e([y()],C.prototype,"portalMode",void 0),e([y()],C.prototype,"portalProperties",void 0),e([y()],C.prototype,"region",void 0),e([y({readOnly:!0})],C.prototype,"restUrl",null),e([y()],C.prototype,"rotatorPanels",void 0),e([y()],C.prototype,"showHomePageDescription",void 0),e([y()],C.prototype,"sourceJSON",void 0),e([y()],C.prototype,"staticImagesUrl",void 0),e([y({json:{name:"2DStylesGroupQuery"}})],C.prototype,"stylesGroupQuery2d",void 0),e([y({json:{name:"stylesGroupQuery"}})],C.prototype,"stylesGroupQuery3d",void 0),e([y()],C.prototype,"supportsHostedServices",void 0),e([y()],C.prototype,"symbolSetsGroupQuery",void 0),e([y()],C.prototype,"templatesGroupQuery",void 0),e([y()],C.prototype,"thumbnail",void 0),e([y({readOnly:!0})],C.prototype,"thumbnailUrl",null),e([y()],C.prototype,"units",void 0),e([y()],C.prototype,"url",void 0),e([y()],C.prototype,"urlKey",void 0),e([m("urlKey")],C.prototype,"readUrlKey",null),e([y()],C.prototype,"user",void 0),e([m("user")],C.prototype,"readUser",null),e([y()],C.prototype,"use3dBasemaps",void 0),e([y()],C.prototype,"useStandardizedQuery",void 0),e([y()],C.prototype,"useVectorBasemaps",void 0),e([y()],C.prototype,"vectorBasemapGalleryGroupQuery",void 0),C=_=e([f("esri.portal.Portal")],C);const Q=C,b=new FinalizationRegistry((e=>{e.remove()}));function w(e){const t=r;return()=>{const r=e.deref();r&&t.findCredential(r.restUrl)&&r.signIn().catch((()=>{}))}}export{Q as default};
|
package/portal/PortalGroup.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import i from"./PortalQueryParams.js";var l;let u=l=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r&&this.portal?this.portal?.normalizeUrl(`${t}/info/${r}?f=json`):null}get url(){const t=this.portal?.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then((r=>{const e=r.categorySchema||[];return e.some((t=>"contentCategorySetsGroupQuery.LivingAtlas"===t.source))?this._fetchCategorySchemaSet("LivingAtlas",t):e}))}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}toJSON(){throw new r("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new l;return r.
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../core/accessorSupport/ensureType.js";import"../core/RandomLCG.js";import"../core/has.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import i from"./PortalQueryParams.js";var l;let u=l=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.sourceJSON=null,this.tags=null,this.title=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r&&this.portal?this.portal?.normalizeUrl(`${t}/info/${r}?f=json`):null}get url(){const t=this.portal?.restUrl;return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return this.portal.request(this.url+"/categorySchema",t).then((r=>{const e=r.categorySchema||[];return e.some((t=>"contentCategorySetsGroupQuery.LivingAtlas"===t.source))?this._fetchCategorySchemaSet("LivingAtlas",t):e}))}fetchMembers(t){return this.portal.request(this.url+"/users",t)}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}toJSON(){throw new r("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new l({sourceJSON:t});return r.read(t),r}queryItems(t,r){let e=s(i,t);const o=this.portal;return parseFloat(o.currentVersion)>5?(e=e||new i,o.queryPortal(`/content/groups/${this.id}/search`,e,"PortalItem",r)):(e=e?e.clone():new i,e.query="group:"+this.id+(e.query?" "+e.query:""),o.queryItems(e,r))}_fetchCategorySchemaSet(t,e){const o=this.portal;return o.fetchSelf(o.authMode,!0,e).then((t=>{const s=t.contentCategorySetsGroupQuery;if(s){const t=new i({disableExtraQuery:!0,num:1,query:s});return o.queryGroups(t,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery value not found")})).then((o=>{if(o.total){const r=o.results[0],s=new i({num:1,query:`typekeywords:"${t}"`});return r.queryItems(s,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery group not found")})).then((t=>{if(t.total){return t.results[0].fetchData("json",e).then((t=>{const r=t?.categorySchema;return r?.length?r:[]}))}return[]}))}};t([o()],u.prototype,"access",void 0),t([o({type:Date})],u.prototype,"created",void 0),t([o()],u.prototype,"description",void 0),t([o()],u.prototype,"id",void 0),t([o()],u.prototype,"isInvitationOnly",void 0),t([o({type:Date})],u.prototype,"modified",void 0),t([o()],u.prototype,"owner",void 0),t([o()],u.prototype,"portal",void 0),t([o()],u.prototype,"snippet",void 0),t([o()],u.prototype,"sortField",void 0),t([o()],u.prototype,"sortOrder",void 0),t([o()],u.prototype,"sourceJSON",void 0),t([o()],u.prototype,"tags",void 0),t([o()],u.prototype,"thumbnail",void 0),t([o({readOnly:!0})],u.prototype,"thumbnailUrl",null),t([o()],u.prototype,"title",void 0),t([o({readOnly:!0})],u.prototype,"url",null),u=l=t([n("esri.portal.PortalGroup")],u);const p=u;export{p as default};
|
package/portal/PortalUser.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import s from"./PortalFolder.js";import n from"./PortalGroup.js";var i;let u=i=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r?this.portal.normalizeUrl(`${t}/info/${r}?f=json`):null}get userContentUrl(){const t=this.portal?.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){const t=this.portal?.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const r=t&&t.item,e=t?.data,o=t?.folder,l={method:"post"};r&&(l.query=r.createPostQuery(),null!=e&&("string"==typeof e?l.query.text=e:"object"==typeof e&&(l.query.text=JSON.stringify(e))));let s=this.userContentUrl;return o&&(s+="/"+("string"==typeof o?o:o.id)),this.portal.request(s+"/addItem",l).then((t=>(r.id=t.id,r.portal=this.portal,r.loaded?r.reload():r.load())))}deleteItem(t){let r=this.userContentUrl;return t.ownerFolder&&(r+="/"+t.ownerFolder),this.portal.request(r+`/items/${t.id}/delete`,{method:"post"}).then((()=>{t.id=null,t.portal=null}))}deleteItems(t){const r=this.userContentUrl+"/deleteItems",e=t.map((t=>t.id));if(e.length){const o={method:"post",query:{items:e.join(",")}};return this.portal.request(r,o).then((()=>{t.forEach((t=>{t.id=null,t.portal=null}))}))}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then((t=>{let r;return r=t&&t.folders?t.folders.map((t=>{const r=s.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchGroups(){return this.portal.request(this.url??"").then((t=>{let r;return r=t&&t.groups?t.groups.map((t=>{const r=n.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchItems(t){const r=t??{};let e,o=this.userContentUrl??"";return r.folder&&(o+="/"+r.folder.id),import("./PortalItem.js").then((({default:t})=>{e=t;const l={folders:!1,num:r.num||10,start:r.start||1,sortField:r.sortField||"created",sortOrder:r.sortOrder||"asc"};return this.portal.request(o,{query:l})})).then((t=>{let r;return t?.items?(r=t.items.map((t=>{const r=e.fromJSON(t);return r.portal=this.portal,r})),Promise.all(r.map((t=>t.load()))).catch((t=>t)).then((()=>({items:r,nextStart:t.nextStart,total:t.total})))):{items:[],nextStart:-1,total:0}}))}fetchTags(){return this.portal.request(this.url+"/tags").then((t=>t.tags))}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new n({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new r("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new r("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new i;return r.
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import s from"./PortalFolder.js";import n from"./PortalGroup.js";var i;let u=i=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.culture=null,this.description=null,this.email=null,this.fullName=null,this.modified=null,this.orgId=null,this.portal=null,this.preferredView=null,this.privileges=null,this.region=null,this.role=null,this.roleId=null,this.sourceJSON=null,this.units=null,this.username=null,this.userType=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r?this.portal.normalizeUrl(`${t}/info/${r}?f=json`):null}get userContentUrl(){const t=this.portal?.restUrl;return t?`${t}/content/users/${this.username}`:null}get url(){const t=this.portal?.restUrl;return t?`${t}/community/users/${this.username}`:null}addItem(t){const r=t&&t.item,e=t?.data,o=t?.folder,l={method:"post"};r&&(l.query=r.createPostQuery(),null!=e&&("string"==typeof e?l.query.text=e:"object"==typeof e&&(l.query.text=JSON.stringify(e))));let s=this.userContentUrl;return o&&(s+="/"+("string"==typeof o?o:o.id)),this.portal.request(s+"/addItem",l).then((t=>(r.id=t.id,r.portal=this.portal,r.loaded?r.reload():r.load())))}deleteItem(t){let r=this.userContentUrl;return t.ownerFolder&&(r+="/"+t.ownerFolder),this.portal.request(r+`/items/${t.id}/delete`,{method:"post"}).then((()=>{t.id=null,t.portal=null}))}deleteItems(t){const r=this.userContentUrl+"/deleteItems",e=t.map((t=>t.id));if(e.length){const o={method:"post",query:{items:e.join(",")}};return this.portal.request(r,o).then((()=>{t.forEach((t=>{t.id=null,t.portal=null}))}))}return Promise.resolve(void 0)}fetchFolders(){const t={query:{num:1}};return this.portal.request(this.userContentUrl??"",t).then((t=>{let r;return r=t&&t.folders?t.folders.map((t=>{const r=s.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchGroups(){return this.portal.request(this.url??"").then((t=>{let r;return r=t&&t.groups?t.groups.map((t=>{const r=n.fromJSON(t);return r.portal=this.portal,r})):[],r}))}fetchItems(t){const r=t??{};let e,o=this.userContentUrl??"";return r.folder&&(o+="/"+r.folder.id),import("./PortalItem.js").then((({default:t})=>{e=t;const l={folders:!1,num:r.num||10,start:r.start||1,sortField:r.sortField||"created",sortOrder:r.sortOrder||"asc"};return this.portal.request(o,{query:l})})).then((t=>{let r;return t?.items?(r=t.items.map((t=>{const r=e.fromJSON(t);return r.portal=this.portal,r})),Promise.all(r.map((t=>t.load()))).catch((t=>t)).then((()=>({items:r,nextStart:t.nextStart,total:t.total})))):{items:[],nextStart:-1,total:0}}))}fetchTags(){return this.portal.request(this.url+"/tags").then((t=>t.tags))}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}queryFavorites(t){return this.favGroupId?(this._favGroup||(this._favGroup=new n({id:this.favGroupId,portal:this.portal})),this._favGroup.queryItems(t)):Promise.reject(new r("internal:unknown","Unknown internal error",{internalError:"Unknown favGroupId"}))}toJSON(){throw new r("internal:not-yet-implemented","PortalUser.toJSON is not yet implemented")}static fromJSON(t){if(!t)return null;if(t.declaredClass)throw new Error("JSON object is already hydrated");const r=new i({sourceJSON:t});return r.read(t),r}};t([o()],u.prototype,"access",void 0),t([o({type:Date})],u.prototype,"created",void 0),t([o()],u.prototype,"culture",void 0),t([o()],u.prototype,"description",void 0),t([o()],u.prototype,"email",void 0),t([o()],u.prototype,"favGroupId",void 0),t([o()],u.prototype,"fullName",void 0),t([o({type:Date})],u.prototype,"modified",void 0),t([o()],u.prototype,"orgId",void 0),t([o()],u.prototype,"portal",void 0),t([o()],u.prototype,"preferredView",void 0),t([o()],u.prototype,"privileges",void 0),t([o()],u.prototype,"region",void 0),t([o()],u.prototype,"role",void 0),t([o()],u.prototype,"roleId",void 0),t([o()],u.prototype,"sourceJSON",void 0),t([o()],u.prototype,"thumbnail",void 0),t([o({readOnly:!0})],u.prototype,"thumbnailUrl",null),t([o()],u.prototype,"units",void 0),t([o({readOnly:!0})],u.prototype,"userContentUrl",null),t([o({readOnly:!0})],u.prototype,"url",null),t([o()],u.prototype,"username",void 0),t([o()],u.prototype,"userType",void 0),u=i=t([l("esri.portal.PortalUser")],u);const p=u;export{p as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"../../config.js";import e from"../../core/Error.js";import t from"../Portal.js";import{project as o}from"../../rest/geometryService/project.js";import i from"../../rest/support/ProjectParameters.js";async function n(o=null,i){if(r.geometryServiceUrl)return r.geometryServiceUrl;if(!o)throw new e("internal:geometry-service-url-not-configured");let n;n="portal"in o?o.portal||t.getDefault():o,await n.load({signal:i});const a=n.helperServices?.geometry?.url;if(!a)throw new e("internal:geometry-service-url-not-configured");return a}async function a(r,t,a=null,l){const c=await n(a,l),s=new i
|
|
5
|
+
import r from"../../config.js";import e from"../../core/Error.js";import t from"../Portal.js";import{project as o}from"../../rest/geometryService/project.js";import i from"../../rest/support/ProjectParameters.js";async function n(o=null,i){if(r.geometryServiceUrl)return r.geometryServiceUrl;if(!o)throw new e("internal:geometry-service-url-not-configured");let n;n="portal"in o?o.portal||t.getDefault():o,await n.load({signal:i});const a=n.helperServices?.geometry?.url;if(!a)throw new e("internal:geometry-service-url-not-configured");return a}async function a(r,t,a=null,l){const c=await n(a,l),s=new i({geometries:[r],outSpatialReference:t}),m=await o(c,s,{signal:l});if(m&&Array.isArray(m)&&1===m.length)return m[0];throw new e("internal:geometry-service-projection-failed")}export{n as getGeometryServiceURL,a as projectGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{populateGroupLayer as o}from"../../layers/support/layersCreator.js";import{layerLookupMap as n}from"../../layers/support/lazyLayerLoader.js";import s from"../Portal.js";import{createForItemRead as l}from"./jsonContext.js";import{getFirstLayerOrTable as i,preprocessFSItemData as
|
|
5
|
+
import e from"../../core/Error.js";import{parse as t}from"../../layers/support/arcgisLayerUrl.js";import{fetchFeatureService as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as a}from"../../layers/support/LayerLoadContext.js";import{populateGroupLayer as o}from"../../layers/support/layersCreator.js";import{layerLookupMap as n}from"../../layers/support/lazyLayerLoader.js";import s from"../Portal.js";import{createForItemRead as l}from"./jsonContext.js";import{getFirstLayerOrTable as i,preprocessFSItemData as u,populateSceneServiceItemData as c,getNumLayersAndTables as p,createSublayerData as y,getSubtypeGroupLayerIds as f,layerTypeToLayerModuleType as m}from"./loadUtils.js";import{hasTypeKeyword as d}from"./portalItemUtils.js";import{loadStyleRenderer as w}from"../../renderers/support/styleUtils.js";import{fetchArcGISServiceJSON as h}from"../../support/requestPresets.js";async function b(e,t){const r=e.instance.portalItem;if(r?.id)return await r.load(t),I(e),e.validateItem&&e.validateItem(r),g(e,t)}function I(t){const r=t.instance.portalItem;if(!r?.type||!t.supportedTypes.includes(r.type))throw new e("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:r?.type,expectedType:t.supportedTypes.join(", ")})}async function g(e,t){const r=e.instance,o=r.portalItem;if(!o)return;const{url:n,title:s}=o,i=l(o,"portal-item");if("group"===r.type)return L(r,i,e);n&&"media"!==r.type&&r.read({url:n},i);const u=new a,c=await M(e,u,t);return c&&r.read(c,i),r.resourceReferences={portalItem:o,paths:i.readResourcePaths??[]},"subtype-group"!==r.type&&r.read({title:s},i),w(r,i)}async function L(t,r,a){const o=t.portalItem;if(!t.sourceIsPortalItem)return;const{title:n,type:s}=o;if("Group Layer"===s){if(!d(o,"Map"))throw new e("portal:invalid-layer-item-typekeyword","'Group Layer' item without 'Map' type keyword is not supported");return v(t)}return t.read({title:n},r),S(t,a)}async function v(e){const t=e.portalItem,r=await t.fetchData("json");if(!r)return;const a=l(t,"web-map");e.read(r,a),await o(e,r,{context:a}),e.resourceReferences={portalItem:t,paths:a.readResourcePaths??[]}}async function S(t,r){let o;const{portalItem:n}=t;if(!n)return;const s=n.type,l=r.layerModuleTypeMap;switch(s){case"Feature Service":case"Feature Collection":o=l.FeatureLayer;break;case"Stream Service":o=l.StreamLayer;break;case"Scene Service":o=l.SceneLayer;break;default:throw new e("portal:unsupported-item-type-as-group",`The item type '${s}' is not supported as a 'IGroupLayer'`)}const y=new a;let[f,m]=await Promise.all([o(),M(r,y)]),d=()=>f;if("Feature Service"===s){const e=i(m)?.customParameters;m=n.url?await u(m,n.url,y):{},d=await E(m,l)||d;const r=await k(n.url,{customParameters:e,loadContext:y});return await j(t,d,m,r)}return"Scene Service"===s&&n.url&&(m=await c(n,m,y)),p(m)>0?await j(t,d,m):await T(t,d)}async function T(e,t){const{portalItem:r}=e;if(!r?.url)return;const a=await h(r.url);a&&j(e,t,{layers:a.layers?.map(y),tables:a.tables?.map(y)})}async function j(e,t,r,a){let o=r.layers||[];const s=r.tables||[];if("Feature Collection"===e.portalItem?.type?(o.forEach(((e,t)=>{e.id=t,"Table"===e?.layerDefinition?.type&&s.push(e)})),o=o.filter((e=>"Table"!==e?.layerDefinition?.type))):(o.reverse(),s.reverse()),o.forEach((o=>{const n=a?.(o);if(n||!a){const a=P(e,t(o),r,o,n);e.add(a)}})),s.length){const t=await n.FeatureLayer();s.forEach((o=>{const n=a?.(o);if(n||!a){const a=P(e,t,r,o,n);e.tables.add(a)}}))}}function P(e,t,r,a,o){const n=e.portalItem,l={portalItem:n.clone(),layerId:a.id};null!=a.url&&(l.url=a.url);const i=new t(l);if("sourceJSON"in i&&(i.sourceJSON=o),"subtype-group"!==i.type&&"catalog"!==i.type&&(i.sublayerTitleMode="service-name"),"Feature Collection"===n.type){const e={origin:"portal-item",portal:n.portal||s.getDefault()};i.read(a,e);const t=r.showLegend;null!=t&&i.read({showLegend:t},e)}return i}async function M(e,t,r){if(!1===e.supportsData)return;const a=e.instance,o=a.portalItem;if(!o)return;let n=null;try{n=await o.fetchData("json",r)}catch(s){}if(C(a)){let e=null;const r=await F(o,n,t);if((n?.layers||n?.tables)&&r>0){if(null==a.layerId){const e=f(n);a.layerId="subtype-group"===a.type?e?.[0]:i(n).id}e=x(n,a),e&&null!=n.showLegend&&(e.showLegend=n.showLegend)}return r>1&&"sublayerTitleMode"in a&&"service-name"!==a.sublayerTitleMode&&(a.sublayerTitleMode="item-title-and-service-name"),e}return n}async function F(e,r,a){if(r?.layers&&r?.tables)return p(r);const o=t(e.url);if(!o)return 1;const n=await a.fetchServiceMetadata(o.url.path,{customParameters:i(r)?.customParameters}).catch((()=>null));return(r?.layers?.length??n?.layers?.length??0)+(r?.tables?.length??n?.tables?.length??0)}function x(e,t){const{layerId:r}=t,a=e.layers?.find((e=>e.id===r))||e.tables?.find((e=>e.id===r));return a&&D(a,t)?a:null}function C(e){return"stream"!==e.type&&"layerId"in e}function D(e,t){return!("feature"===t.type&&"layerType"in e&&"SubtypeGroupLayer"===e.layerType||"subtype-group"===t.type&&!("layerType"in e))}async function k(e,t){const{layersJSON:a}=await r(e,t);if(!a)return null;const o=[...a.layers,...a.tables];return e=>o.find((t=>t.id===e.id))}async function E(e,t){const{layers:r}=e;if(!r?.length)return;const a=new Set,o=[];for(const{layerType:l}of r){const e=l??"FeatureLayer";if(a.has(e))continue;a.add(e);const r=t[m(e)];o.push(r())}const n=await Promise.all(o),s=new Map;return Array.from(a).forEach(((e,t)=>{s.set(e,n[t])})),({layerType:e})=>{const t=e??"FeatureLayer";return s.get(t)}}export{b as load};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{findAssociatedFeatureService as e}from"../../layers/support/associatedFeatureServiceUtils.js";function
|
|
5
|
+
import{findAssociatedFeatureService as e}from"../../layers/support/associatedFeatureServiceUtils.js";import{getLayerModuleType as t}from"../../layers/support/fetchService.js";function r(e){const r={id:e.id,name:e.name},a=t(e.type);return"FeatureLayer"!==a&&(r.layerType=a),r}async function a(e,t,a){if(null==e?.layers||null==e?.tables){const l=await a.fetchServiceMetadata(t,{customParameters:s(e)?.customParameters});(e=e||{}).layers=e.layers||l?.layers?.map(r),e.tables=e.tables||l?.tables?.map(r)}return e}function s(e){if(!e)return null;const{layers:t,tables:r}=e;return t?.length?t[0]:r?.length?r[0]:null}function l(e,t){if(null==t)return null;return[...e.layers||[],...e.tables||[]].find((e=>e.id===t))}function n(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function u(e){switch(e){case"CatalogLayer":return"CatalogLayer";case"OrientedImageryLayer":return"OrientedImageryLayer";case"SubtypeGroupLayer":return"SubtypeGroupLayer"}return"FeatureLayer"}function c(e){const t=[];return e?.layers?.forEach((e=>{"SubtypeGroupLayer"===e.layerType&&t.push(e.id)})),t}async function o(t,a,l){if(!t?.url)return a??{};if(a??={},!a.layers){const e=await l.fetchServiceMetadata(t.url);a.layers=e.layers?.map(r)}const{serverUrl:n,portalItem:u}=await e(t.url,{sceneLayerItem:t,customParameters:s(a)?.customParameters}).catch((()=>({serverUrl:null,portalItem:null})));if(null==n)return a.tables=[],a;if(!a.tables&&u){const e=await u.fetchData();if(e?.tables)a.tables=e.tables.map(r);else{const t=await l.fetchServiceMetadata(n,{customParameters:s(e)?.customParameters});a.tables=t?.tables?.map(r)}}if(a.tables)for(const e of a.tables)e.url=`${n}/${e.id}`;return a}export{r as createSublayerData,s as getFirstLayerOrTable,l as getLayerOrTable,n as getNumLayersAndTables,c as getSubtypeGroupLayerIds,u as layerTypeToLayerModuleType,o as populateSceneServiceItemData,a as preprocessFSItemData};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{findAssociatedFeatureService as a}from"../../layers/support/associatedFeatureServiceUtils.js";import{
|
|
5
|
+
import e from"../../core/Error.js";import{findAssociatedFeatureService as a}from"../../layers/support/associatedFeatureServiceUtils.js";import{getLayerModuleType as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as t}from"../../layers/support/LayerLoadContext.js";import{sceneServiceLayerTypeToClassName as s}from"../../layers/support/layerUtils.js";import{layerLookupMap as c}from"../../layers/support/lazyLayerLoader.js";import n from"../PortalItem.js";import{getFirstLayerOrTable as o,getNumLayersAndTables as i,preprocessFSItemData as u,getLayerOrTable as l,layerTypeToLayerModuleType as m,populateSceneServiceItemData as y}from"./loadUtils.js";import{hasTypeKeyword as f}from"./portalItemUtils.js";async function p(e){let{portalItem:a}=e;!a||a instanceof n||(a=new n(a));const r=await L(a);return new(0,r.constructor)({portalItem:a,...r.properties})}async function L(e){await e.load();const a=new t;return w(await d(e,a))}async function d(a,r){switch(a.type){case"3DTiles Service":return g();case"CSV":return C();case"Feature Collection":return I(a);case"Feature Service":return S(a,r);case"Feed":return U();case"GeoJson":return j();case"Group Layer":return V();case"Image Service":return h(a,r);case"KML":return P();case"Map Service":return N(a,r);case"Media Layer":return W();case"Scene Service":return v(a,r);case"Stream Service":return M();case"Vector Tile Service":return T();case"WFS":return F();case"WMS":return G();case"WMTS":return b();default:throw new e("portal:unknown-item-type","Unknown item type '${type}'",{type:a.type})}}async function w(e){const a=e.className,r=c[a];return{constructor:await r(),properties:e.properties}}async function N(e,a){return await D(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}async function S(e,a){const r=await J(e,a);if("object"==typeof r){const{sourceJSON:e,className:a}=r,t={sourceJSON:e};return null!=r.id&&(t.layerId=r.id),{className:a||"FeatureLayer",properties:t}}return{className:"GroupLayer"}}async function v(e,r){const t=await J(e,r,(async()=>{try{if(!e.url)return[];const{serverUrl:t}=await a(e.url,{sceneLayerItem:e}),s=await r.fetchServiceMetadata(t);return s?.tables??[]}catch{return[]}}));if("object"==typeof t){const a={};let c;if(null!=t.id?(a.layerId=t.id,c=`${e.url}/layers/${t.id}`):c=e.url,e.typeKeywords?.length)for(const r of Object.keys(s))if(e.typeKeywords.includes(r))return{className:s[r]};const n=await r.fetchServiceMetadata(c,{customParameters:await r.fetchCustomParameters(e,(e=>o(e)?.customParameters))});return{className:s[n?.layerType]||"SceneLayer",properties:a}}if(!1===t){const a=await r.fetchServiceMetadata(e.url);if("Voxel"===a?.layerType)return{className:"VoxelLayer"}}return{className:"GroupLayer"}}async function I(e){await e.load();const a=f(e,"Map Notes"),r=f(e,"Markup");if(a||r)return{className:"MapNotesLayer"};if(f(e,"Route Layer"))return{className:"RouteLayer"};const t=await e.fetchData();return 1===i(t)?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function h(e,a){await e.load();const r=e.typeKeywords?.map((e=>e.toLowerCase()))??[];if(r.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(r.includes("tiled imagery"))return{className:"ImageryTileLayer"};const t=await a.fetchItemData(e),s=t?.layerType;if("ArcGISTiledImageServiceLayer"===s)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===s)return{className:"ImageryLayer"};const c=await a.fetchServiceMetadata(e.url,{customParameters:await a.fetchCustomParameters(e)}),n=c.cacheType?.toLowerCase(),o=c.capabilities?.toLowerCase().includes("tilesonly");return"map"===n||o?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function M(){return{className:"StreamLayer"}}function T(){return{className:"VectorTileLayer"}}function j(){return{className:"GeoJSONLayer"}}function g(){return{className:"IntegratedMesh3DTilesLayer"}}function C(){return{className:"CSVLayer"}}function P(){return{className:"KMLLayer"}}function F(){return{className:"WFSLayer"}}function G(){return{className:"WMSLayer"}}function b(){return{className:"WMTSLayer"}}function U(){return{className:"StreamLayer"}}function V(){return{className:"GroupLayer"}}function W(){return{className:"MediaLayer"}}async function D(e,a){const{tileInfo:r}=await a.fetchServiceMetadata(e.url,{customParameters:await a.fetchCustomParameters(e)});return r}async function J(e,a,t){const{url:s,type:c}=e,n="Feature Service"===c;if(!s)return{};if(/\/\d+$/.test(s)){if(n){const t=await a.fetchServiceMetadata(s,{customParameters:await a.fetchCustomParameters(e,(e=>o(e)?.customParameters))});return{id:t.id,className:r(t.type),sourceJSON:t}}return{}}await e.load();let f=await a.fetchItemData(e);if(n){const e=await u(f,s,a),r=K(e);if("object"==typeof r){const a=l(e,r.id);r.className=m(a?.layerType)}return r}"Scene Service"===c&&(f=await y(e,f,a));if(i(f)>0)return K(f);const p=await a.fetchServiceMetadata(s);return t&&(p.tables=await t()),K(p)}function K(e){return 1===i(e)&&{id:o(e)?.id}}export{p as fromItem,d as selectLayerClassPath};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import s from"../../core/Logger.js";import{toPt as r}from"../../core/screenUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import s from"../../core/Logger.js";import{toPt as r}from"../../core/screenUtils.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as n}from"../../core/accessorSupport/decorators/cast.js";import{reader as o}from"../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../core/accessorSupport/decorators/subclass.js";import{writer as p}from"../../core/accessorSupport/decorators/writer.js";import u from"./VisualVariable.js";import m from"./support/SizeStop.js";import h from"./support/SizeVariableLegendOptions.js";import{isSizeVariable as c,getInputValueType as d,getTransformationType as y,TransformationType as S}from"./support/sizeVariableUtils.js";import{viewScaleRE as x}from"./support/visualVariableUtils.js";var z;const v=new i({width:"width",depth:"depth",height:"height",widthAndDepth:"width-and-depth",all:"all"}),w=new i({unknown:"unknown",inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers","decimal-degree":"decimal-degrees"});function g(e){if(null!=e)return"string"==typeof e||"number"==typeof e?r(e):"size"===e.type?c(e)?e:(delete(e={...e}).type,new V(e)):void 0}function f(e,t,i){if("object"!=typeof e)return e;const s=new V;return s.read(e,i),s}let V=z=class extends u{constructor(e){super(e),this.axis=null,this.legendOptions=null,this.normalizationField=null,this.scaleBy=null,this.target=null,this.type="size",this.useSymbolValue=null,this.valueExpression=null,this.valueRepresentation=null,this.valueUnit=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null,isScaleDriven:null!=this.valueExpression&&x.test(this.valueExpression)}}set index(e){c(this.maxSize)&&(this.maxSize.index=`visualVariables[${e}].maxSize`),c(this.minSize)&&(this.minSize.index=`visualVariables[${e}].minSize`),this._set("index",e)}get inputValueType(){return d(this)}set maxDataValue(e){e&&this.stops&&(s.getLogger(this).warn("cannot set maxDataValue when stops is not null."),e=null),this._set("maxDataValue",e)}set maxSize(e){e&&this.stops&&(s.getLogger(this).warn("cannot set maxSize when stops is not null."),e=null),this._set("maxSize",e)}castMaxSize(e){return g(e)}readMaxSize(e,t,i){return f(e,t,i)}set minDataValue(e){e&&this.stops&&(s.getLogger(this).warn("cannot set minDataValue when stops is not null."),e=null),this._set("minDataValue",e)}set minSize(e){e&&this.stops&&(s.getLogger(this).warn("cannot set minSize when stops is not null."),e=null),this._set("minSize",e)}castMinSize(e){return g(e)}readMinSize(e,t,i){return f(e,t,i)}get arcadeRequired(){return!!this.valueExpression||(null!=this.minSize&&"object"==typeof this.minSize&&this.minSize.arcadeRequired||null!=this.maxSize&&"object"==typeof this.maxSize&&this.maxSize.arcadeRequired)}set stops(e){null==this.minDataValue&&null==this.maxDataValue&&null==this.minSize&&null==this.maxSize?e&&Array.isArray(e)&&(e=e.filter((e=>!!e))).sort(((e,t)=>e.value-t.value)):e&&(s.getLogger(this).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),e=null),this._set("stops",e)}get transformationType(){return y(this,this.inputValueType)}readValueExpression(e,t){return e||t.expression&&"$view.scale"}writeValueExpressionWebScene(e,i,s,r){if("$view.scale"===e){if(r?.messages){const e=this.index,i="string"==typeof e?e:`visualVariables[${e}]`;r.messages.push(new t("property:unsupported",this.type+"VisualVariable.valueExpression = '$view.scale' is not supported in Web Scene. Please remove this property to save the Web Scene.",{instance:this,propertyName:i+".valueExpression",context:r}))}}else i[s]=e}readValueUnit(e){return e?w.read(e):null}clone(){return new z({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:c(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:c(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:this.stops?.map((e=>e.clone())),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:this.legendOptions?.clone()})}flipSizes(){if(this.transformationType===S.ClampedLinear){const{minSize:e,maxSize:t}=this;return this.minSize=t,this.maxSize=e,this}if(this.transformationType===S.Stops){const e=this.stops;if(!e)return this;const t=e.map((e=>e.size)).reverse(),i=e.length;for(let s=0;s<i;s++)e[s].size=t[s];return this}return this}getAttributeHash(){return`${super.getAttributeHash()}-${this.target}-${this.normalizationField}`}_interpolateData(){return this.stops?.map((e=>e.value||0))}};e([a({readOnly:!0})],V.prototype,"cache",null),e([a({type:v.apiValues,json:{type:v.jsonValues,origins:{"web-map":{read:!1}},read:v.read,write:v.write}})],V.prototype,"axis",void 0),e([a()],V.prototype,"index",null),e([a({type:String,readOnly:!0})],V.prototype,"inputValueType",null),e([a({type:h,json:{write:!0}})],V.prototype,"legendOptions",void 0),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"maxSize",null),e([n("maxSize")],V.prototype,"castMaxSize",null),e([o("maxSize")],V.prototype,"readMaxSize",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minDataValue",null),e([a({type:Number,value:null,json:{write:!0}})],V.prototype,"minSize",null),e([n("minSize")],V.prototype,"castMinSize",null),e([o("minSize")],V.prototype,"readMinSize",null),e([a({type:String,json:{write:!0}})],V.prototype,"normalizationField",void 0),e([a({readOnly:!0})],V.prototype,"arcadeRequired",null),e([a({type:String})],V.prototype,"scaleBy",void 0),e([a({type:[m],value:null,json:{write:!0}})],V.prototype,"stops",null),e([a({type:["outline"],json:{write:!0}})],V.prototype,"target",void 0),e([a({type:String,readOnly:!0})],V.prototype,"transformationType",null),e([a({type:["size"],json:{type:["sizeInfo"]}})],V.prototype,"type",void 0),e([a({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],V.prototype,"useSymbolValue",void 0),e([a({type:String,json:{write:!0}})],V.prototype,"valueExpression",void 0),e([o("valueExpression",["valueExpression","expression"])],V.prototype,"readValueExpression",null),e([p("web-scene","valueExpression")],V.prototype,"writeValueExpressionWebScene",null),e([a({type:["radius","diameter","area","width","distance"],json:{write:!0}})],V.prototype,"valueRepresentation",void 0),e([a({type:w.apiValues,json:{write:w.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],V.prototype,"valueUnit",void 0),e([o("valueUnit")],V.prototype,"readValueUnit",null),V=z=e([l("esri.renderers.visualVariables.SizeVariable")],V);const b=V;export{b as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import r from"../GraphApplyEditsResult.js";function e(e){const o=
|
|
5
|
+
import r from"../GraphApplyEditsResult.js";function e(e){const o=e.has_error(),t=new r({hasError:o,error:o?{errorCode:e.error.error_code,errorMessage:e.error.error_message}:null}),s=e.get_edit_results_count();for(let r=0;r<s;r++){const o=e.get_edit_results_at(r),s=e.get_edit_results_type_name_at(r),_=[],d=[],u=[],a=o.get_add_results_count(),l=o.get_update_results_count(),g=o.get_delete_results_count();for(let r=0;r<a;r++){const e=o.get_add_result_at(r);_.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}for(let r=0;r<l;r++){const e=o.get_update_result_at(r);d.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}for(let r=0;r<g;r++){const e=o.get_delete_result_at(r);u.push({id:e.id,error:{errorCode:e.error.error_code,errorMessage:e.error.error_message}})}t.editResults.push({typeName:s,adds:_,updates:d,deletes:u})}return t}export{e as decoderToApplyEditsResponse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{reader as t}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../../core/accessorSupport/decorators/writer.js";import{associationTypeKebabDict as n}from"../../../networks/support/typeUtils.js";import m from"./NetworkElement.js";import i from"../../../geometry/Polyline.js";let p=class extends e{constructor(o){super(o),this.globalId=null,this.associationType=null,this.fromNetworkElement=null,this.toNetworkElement=null,this.geometry=null,this.errorMessage=null,this.percentAlong=null,this.errorCode=null,this.isContentVisible=null,this.status=null}readFromNetworkElement(o,e){
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{reader as t}from"../../../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{writer as s}from"../../../core/accessorSupport/decorators/writer.js";import{associationTypeKebabDict as n}from"../../../networks/support/typeUtils.js";import m from"./NetworkElement.js";import i from"../../../geometry/Polyline.js";let p=class extends e{constructor(o){super(o),this.globalId=null,this.associationType=null,this.fromNetworkElement=null,this.toNetworkElement=null,this.geometry=null,this.errorMessage=null,this.percentAlong=null,this.errorCode=null,this.isContentVisible=null,this.status=null}readFromNetworkElement(o,e){return new m({globalId:e.fromGlobalId,networkSourceId:e.fromNetworkSourceId,terminalId:e.fromTerminalId})}writeFromNetworkElement(o,e){o&&(e.fromGlobalId=o.globalId,e.fromNetworkSourceId=o.networkSourceId,e.fromTerminalId=o.terminalId)}readToNetworkElement(o,e){return new m({globalId:e.toGlobalId,networkSourceId:e.toNetworkSourceId,terminalId:e.toTerminalId})}writeToNetworkElement(o,e){o&&(e.toGlobalId=o.globalId,e.toNetworkSourceId=o.networkSourceId,e.toTerminalId=o.terminalId)}};o([r({type:String,json:{write:!0}})],p.prototype,"globalId",void 0),o([r({type:n.apiValues,json:{type:n.jsonValues,read:n.read,write:n.write}})],p.prototype,"associationType",void 0),o([r({type:m,json:{write:{target:{fromGlobalId:{type:String},fromNetworkSourceId:{type:Number},fromTerminalId:{type:Number}}},read:{source:["fromGlobalId","fromNetworkSourceId","fromTerminalId"]}}})],p.prototype,"fromNetworkElement",void 0),o([t("fromNetworkElement")],p.prototype,"readFromNetworkElement",null),o([s("fromNetworkElement")],p.prototype,"writeFromNetworkElement",null),o([r({type:m,json:{write:{target:{toGlobalId:{type:String},toNetworkSourceId:{type:Number},toTerminalId:{type:Number}}},read:{source:["toGlobalId","toNetworkSourceId","toTerminalId"]}}})],p.prototype,"toNetworkElement",void 0),o([t("toNetworkElement")],p.prototype,"readToNetworkElement",null),o([s("toNetworkElement")],p.prototype,"writeToNetworkElement",null),o([r({type:i,json:{write:!0}})],p.prototype,"geometry",void 0),o([r({type:String,json:{write:!0}})],p.prototype,"errorMessage",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"percentAlong",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"errorCode",void 0),o([r({type:Boolean,json:{write:!0}})],p.prototype,"isContentVisible",void 0),o([r({type:Number,json:{write:!0}})],p.prototype,"status",void 0),p=o([l("esri.rest.networks.support.Association")],p);const d=p;export{d as default};
|
package/rest/places.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../geometry.js";import e from"../request.js";import{ensureClass as
|
|
5
|
+
import"../geometry.js";import e from"../request.js";import{ensureClass as r}from"../core/accessorSupport/ensureType.js";import t from"../portal/Portal.js";import{asValidOptions as s,parseUrl as o}from"./utils.js";import a from"./support/FetchPlaceParameters.js";import i from"./support/PlacesQueryParameters.js";import n from"./support/PlacesQueryResult.js";import{projectWithEngineOrService as p}from"../views/support/projectionUtils.js";import u from"../geometry/SpatialReference.js";async function m(t,o){t=r(a,t);const i={requestedFields:t.requestedFields?.join(),token:t.apiKey},n=s(i,o),{data:p}=await e(`${t.url}/places/${t.placeId}`,n);return p}async function c(e,s){const o={radius:(e=r(i,e)).radius};let a=e.point;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,t.getDefault(),s?.signal)),a&&(o.x=a.x,o.y=a.y),f(`${e.url}/places/near-point`,o,e,s)}async function l(e,s){const o={};let a=(e=r(i,e)).extent;return a&&!a.spatialReference.isWGS84&&(a=await p(a,u.WGS84,t.getDefault(),s?.signal)),a&&(o.xmin=a.xmin,o.ymin=a.ymin,o.xmax=a.xmax,o.ymax=a.ymax),f(`${e.url}/places/within-extent`,o,e,s)}async function f(r,t,a,i){t={...t,categoryIds:a.categoryIds?.join(),offset:a.offset,pageSize:a.pageSize,searchText:a.searchText,token:a.apiKey};const p=s(t,i),{data:u}=await e(r,p),m=new n({results:u.results}),{pagination:c,links:l}=u;if(c?.nextUrl||l?.next){m.nextQueryParams=a.clone();const e=o(c?.nextUrl||l?.next).query;m.nextQueryParams.offset=Number(e.offset)}if(c?.previousUrl||l?.previous){m.previousQueryParams=a.clone();const e=o(c?.previousUrl||l?.previous).query;m.previousQueryParams.offset=Number(e.offset)}return m}export{m as fetchPlace,c as queryPlacesNearPoint,l as queryPlacesWithinExtent};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,
|
|
5
|
+
import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,3):i(e,t,r,s)}function h(e,t,r,s){return 3===r?0===t?0:u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,r):0}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?n:r?a:i}}export{d as JSONFeatureSetParserContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import a from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new y({spatialReference:t[0].spatialReference
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{geometryTypes as e}from"../../geometry.js";import o from"../../TimeExtent.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import{clone as s}from"../../core/lang.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import{getJsonType as n,fromJSON as m}from"../../geometry/support/jsonUtils.js";import a from"../../layers/support/MosaicRule.js";import{interpolationKebab as u}from"../../layers/support/rasterEnums.js";import y from"../../geometry/Multipoint.js";import c from"../../geometry/Point.js";var d;let j=d=class extends r{constructor(){super(...arguments),this.geometry=null,this.interpolation="nearest",this.mosaicRule=null,this.outFields=null,this.pixelSize=null,this.returnFirstValueOnly=!0,this.sampleDistance=null,this.sampleCount=null,this.sliceId=null,this.timeExtent=null}writeGeometry(t,e,o){null!=t&&(e.geometryType=n(t),e[o]=t.toJSON())}set locations(t){if(t?.length){const e=new y({spatialReference:t[0].spatialReference,points:t.map((({x:t,y:e})=>[t,e]))});this._set("locations",t),this.geometry=e}}clone(){return new d(s({geometry:this.geometry,locations:this.locations,interpolation:this.interpolation,mosaicRule:this.mosaicRule,outFields:this.outFields,raster:this.raster,returnFirstValueOnly:this.returnFirstValueOnly,sampleDistance:this.sampleDistance,sampleCount:this.sampleCount,sliceId:this.sliceId,pixelSize:this.pixelSize,timeExtent:this.timeExtent}))}};t([i({types:e,json:{read:m}})],j.prototype,"geometry",void 0),t([l("geometry")],j.prototype,"writeGeometry",null),t([i()],j.prototype,"locations",null),t([i({type:String,json:{type:u.jsonValues,read:u.read,write:u.write}})],j.prototype,"interpolation",void 0),t([i({type:a,json:{write:!0}})],j.prototype,"mosaicRule",void 0),t([i({type:[String],json:{write:!0}})],j.prototype,"outFields",void 0),t([i({type:c,json:{write:!0}})],j.prototype,"pixelSize",void 0),t([i({type:String,json:{write:!0}})],j.prototype,"raster",void 0),t([i({type:Boolean,json:{write:!0}})],j.prototype,"returnFirstValueOnly",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleDistance",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sampleCount",void 0),t([i({type:Number,json:{write:!0}})],j.prototype,"sliceId",void 0),t([i({type:o,json:{read:{source:"time"},write:{target:"time"}}})],j.prototype,"timeExtent",void 0),j=d=t([p("esri.rest.support.ImageSampleParameters")],j);const h=j;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{assertIsSome as s}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as l}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as u,isNumericField as m}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import h from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import d from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as f,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as F,getSQLFilterForNormalization as S,getRangeExpr as g}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as x}from"../utils.js";import _ from"./InMemoryLayerAdapter.js";import{ensureFeaturesJSON as z,getSummaryStatsQuery as E,getSummaryStatisticsFromFeatureSet as q,getUVQuery as L,getUniqueValuesFromFeatureSet as T,getSQLExpressionForDateOrTimeField as V,getFieldExpr as j,defaultNumBins as Q,updateQueryWithFeatureFilter as b,getHistogramFromFeatureSet as N,generateBinParams as R,getDomainsForFields as C,getBins as I,getPredominantCategoriesFromUVInfos as M,getMissingFields as B}from"./support/utils.js";import{processSummaryStatisticsResult as $,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as O}from"../../../statistics/utils.js";const P=5,A=2e4,U=4e5;let W=class extends _{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!l(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then((e=>e.features))}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(z)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:P,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then((e=>{let t,r,i;if(e.classBreakInfos?.some((e=>(e.hasAvg&&(t=e),!!t))),t){const e=t.maxValue-t.minValue;r=t.minValue+e/2,i=4*e}const s={min:e.minValue,max:e.maxValue,avg:r,stddev:i};return $(s)}))}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=w(t)||u(t),i=E(this,e,t),s=await this.layer.queryFeatures(i,{signal:e.signal}),a=q(s,r);return $(a)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new d;i.attributeField=r;const s=new h;return s.classificationDefinition=i,this.generateRenderer(s,e.signal).then((e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach((e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:m(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count})),{count:t}})).then((r=>k(r,[t],e.returnAllCodedValues)))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(L(this,e),{signal:e.signal}))).then((t=>T(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal}))).then((r=>k(r,t,e.returnAllCodedValues,x)))}_calcBinsSQL(e,t,r){const i=[],s=t.length;return t.forEach(((t,a)=>{const[n,o]=t;let l=null;l=0!==a||r?a!==s-1||r?F(`${e} >= ${n}`,`${e} ${a===s-1?" <= ":" < "} ${o}`):`${e} >= ${n}`:`${e} < ${o}`,i.push("WHEN ("+l+") THEN "+(a+1))})),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,filter:r,signal:i}).then((e=>e.sum)):Promise.resolve(null)}_getQueryParamsForExpr(e,t){const r=e.valueExpression||e.sqlExpression,i=e.signal;if(!r){const{field:r,normalizationType:s,normalizationField:a}=e,n=r?this.getField(r):null,o=w(n)||u(n),l={field:r,normalizationType:s,normalizationField:a,normalizationTotal:t,layer:this};return{sqlExpression:o?V(this,n):j(l),sqlWhere:o?null:e.sqlWhere||S({field:r,normalizationType:s,normalizationField:a}),filter:e.filter,signal:i}}return{valueExpression:e.valueExpression,sqlExpression:e.sqlExpression,sqlWhere:e.sqlWhere,filter:e.filter,signal:i}}_getDataRange(e,t,r){return null!=t&&null!=r?Promise.resolve({min:t,max:r}):this.summaryStatistics(e).then((e=>({min:e.min,max:e.max})))}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then((t=>{const r=this._getQueryParamsForExpr(e,t);return this._getDataRange(r,e.minValue,e.maxValue).then((i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const n=e.numBins||Q,o=D(s,a,n),l=this._calcBinsSQL(r.sqlExpression,o,null!=e.minValue&&null!=e.maxValue),u=new p({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),m=this.layer.createQuery();return m.where=F(m.where,r.sqlWhere),m.sqlFormat="standard",m.outStatistics=[u],m.groupByFieldsForStatistics=[l],m.orderByFields=[l],b(m,e.filter),this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(m,{signal:r.signal}))).then((e=>N(e,s,a,n,t)))}))}))}_binParamsFromGenRend(e,t){const{field:r,normalizationType:i,normalizationField:s,signal:a}=e,n=S({field:r,normalizationType:i,normalizationField:s}),o=new h({classificationDefinition:G({field:r,normalizationType:i,normalizationField:s,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numBins||Q}),where:F(n,t)});return this.generateRenderer(o,a).then((e=>{const{normalizationTotal:t,classBreaks:a}=e;return R({field:r,normalizationType:i,normalizationField:s,normalizationTotal:t,classBreaks:a,where:n,layer:this})}))}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,n=S({field:t,normalizationType:r,normalizationField:i}),o=j({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=g(o,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||P}),m=new h;return m.classificationDefinition=u,m.where=F(n,l),this.generateRenderer(m,a).then((t=>O(t,e.classificationMethod)))}async summaryStatistics(e){const{field:t,normalizationType:r,sqlExpression:s,view:n,features:o,useFeaturesInView:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||s,p=h&&!s,d=this._hasLocalSource||o||l,f=n&&"3d"===n.type;if(d||p)return p||o||l||f?this._summaryStatsFromMemory(e,m):this._summaryStatsFromClientQuery(e,m);if(!this.supportsSQLExpression&&(c||h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(r&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,m)).catch((()=>(a(e.signal),this._summaryStatsFromMemory(e,m))))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:s,signal:n}=e,o=t&&(!r||!this.supportsSQLExpression),l=this._hasLocalSource||i||s||o,u=e.view,m=u&&"3d"===u.type,c=await C(e,this);return l?o||i||s||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch((t=>(a(n),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0])))).catch((()=>(a(n),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c))))}async histogram(e){const{field:t,normalizationType:r,normalizationField:s,classificationMethod:a,view:n,filter:o,signal:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||e.sqlExpression,p=h&&!e.sqlExpression,d=this._hasLocalSource||e.features||e.useFeaturesInView||p,f=this.supportsSQLExpression,y=!a||"equal-interval"===a,F=e.minValue,S=e.maxValue,v=null!=F&&null!=S,x=e.numBins||Q;if(d)return this._histogramFromMemory(e);if((h||f)&&y){if(!f&&(h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(c&&y)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!y?this._binParamsFromGenRend(e).then((a=>{if(!v)return I(this,a,t,x,n,o,l);if(F>a.max||S<a.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(y)return I(this,{min:F,max:S,sqlExpr:a.sqlExpr,excludeZerosExpr:a.excludeZerosExpr},t,x,n,o,l);{const i={field:t,normalizationType:r,normalizationField:s,normalizationTotal:a.normTotal,layer:this},u=j(i),m=g(u,F,S);return this._binParamsFromGenRend(e,m).then((e=>I(this,e,t,x,n,o,l)))}})):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch((()=>(a(e.signal),this._classBreaksFromMemory(e))))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=F(r.where,e.whereClause),b(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=F(e.where,s.where),c(r.parsedUrl.path,{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s}=e,a=f(t),n=y(t),o=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:a,view:r,signal:s}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:a,signal:s});return M(o.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:n,requiredFields:o,returnGeometry:l,filter:u,signal:m}=e,c=e.sampleSize;if(null==c||0===c)return[];const h=this.layer.createQuery(),p=1,d="json"===i;h.outSpatialReference=n?.spatialReference,h.returnGeometry=!!l,h.outFields=o,b(h,u);let f=[],y=!1;if(n)try{const s=await n.whenLayerView(this.layer);if(y=!B(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return d?e:e.map((e=>t.fromJSON(e)))}if(f=await this._fetchFeaturesFromMemory(s,h,m,i),f.length>=c&&c>0)return r(f,c,p)}}catch(F){a(m)}try{if(this._hasLocalSource)return y?f:d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);const t=await this.queryFeatureCount({view:n,filter:u,signal:m}),i=this.layer.capabilities.query.maxRecordCount;let a=-1===c?t:c;if(a=i&&a>i?i:a,t<=f.length||f.length>=i)return f;s(n,"FeatureLayerAdapter: must have a view");const o=n.extent.width/n.width/n.scale*U;if(h.maxAllowableOffset=e.resolution||o,t<=a)return d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);if(t<=A){const e=this.layer.createQuery();b(e,u);const t=await this.layer.queryObjectIds();return h.objectIds=r(t,a,p),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}return this.layer.capabilities?.query?.supportsPagination&&(h.num=Math.min(a,A)),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}catch(F){return a(m),f}}load(e){const t=this.layer.load(e).then((async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],W.prototype,"layer",void 0),W=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],W);const J=W;export{J as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import{assertIsSome as s}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{isHostedAgolService as l}from"../../../layers/support/arcgisLayerUrl.js";import{isTimeOnlyField as u,isNumericField as m}from"../../../layers/support/fieldUtils.js";import{generateRenderer as c}from"../../../rest/generateRenderer.js";import h from"../../../rest/support/GenerateRendererParameters.js";import p from"../../../rest/support/StatisticDefinition.js";import d from"../../../rest/support/UniqueValueDefinition.js";import{getArcadeForPredominantCategory as f,getSQLForPredominantCategoryName as y}from"../../statistics/support/predominanceUtils.js";import{mergeWhereClauses as F,getSQLFilterForNormalization as S,getRangeExpr as g}from"../../statistics/support/utils.js";import{WorkerClient as v}from"../../statistics/support/WorkerClient.js";import{isAnyDateField as w,fieldDelimiter as x}from"../utils.js";import _ from"./InMemoryLayerAdapter.js";import{ensureFeaturesJSON as z,getSummaryStatsQuery as E,getSummaryStatisticsFromFeatureSet as q,getUVQuery as L,getUniqueValuesFromFeatureSet as T,getSQLExpressionForDateOrTimeField as V,getFieldExpr as j,defaultNumBins as Q,updateQueryWithFeatureFilter as b,getHistogramFromFeatureSet as N,generateBinParams as R,getDomainsForFields as C,getBins as I,getPredominantCategoriesFromUVInfos as M,getMissingFields as B}from"./support/utils.js";import{processSummaryStatisticsResult as $,createUVResult as k,getEqualIntervalBins as D,createClassBreaksDefinition as G,resolveCBResult as O}from"../../../statistics/utils.js";const P=5,A=2e4,U=4e5;let W=class extends _{constructor(){super(...arguments),this.adapterName="feature-layer-adapter"}_isStatsSupportedOnService(){const e=this.layer;if(!e.capabilities?.query?.supportsStatistics||"multipatch"===this.geometryType&&!l(e.url)&&e.version<10.5)throw new i(`${this.adapterName}:not-supported`,"Layer does not support statistics query");return Promise.resolve()}_fetchFeaturesFromService(e,t){return this.layer.queryFeatures(e,{signal:t}).then((e=>e.features))}_fetchFeaturesJSONFromService(e,t){return this._fetchFeaturesFromService(e,t).then(z)}_summaryStatsFromGenRend(e){const t=e.normalizationType,r=e.normalizationField;return this.classBreaks({field:e.field,numClasses:P,classificationMethod:"standard-deviation",standardDeviationInterval:.25,normalizationType:t,normalizationField:"field"===t?r:void 0,minValue:e.minValue,maxValue:e.maxValue,filter:e.filter,signal:e.signal}).then((e=>{let t,r,i;if(e.classBreakInfos?.some((e=>(e.hasAvg&&(t=e),!!t))),t){const e=t.maxValue-t.minValue;r=t.minValue+e/2,i=4*e}const s={min:e.minValue,max:e.maxValue,avg:r,stddev:i};return $(s)}))}async _summaryStatsFromServiceQuery(e,t){await this._isStatsSupportedOnService(),"percent-of-total"===e.normalizationType&&(e.normalizationTotal=await this._getNormalizationTotal(e.field,e.normalizationType,e.filter));const r=w(t)||u(t),i=E(this,e,t),s=await this.layer.queryFeatures(i,{signal:e.signal}),a=q(s,r);return $(a)}_uvFromGenRenderer(e,t){const r=e.field??void 0,i=new d({attributeField:r}),s=new h({classificationDefinition:i});return this.generateRenderer(s,e.signal).then((e=>{const t={},i=this.getField(r);return e.uniqueValues.forEach((e=>{let r=e.value;null!=r&&""!==r&&("string"!=typeof r||""!==r.trim()&&"<null>"!==r.toLowerCase())||(r=null),null==t[r]?t[r]={count:e.count,data:m(i)&&r?Number(r):r}:t[r].count=t[r].count+e.count})),{count:t}})).then((r=>k(r,[t],e.returnAllCodedValues)))}async _uvFromServiceQuery(e,t){return this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(L(this,e),{signal:e.signal}))).then((t=>T(t,{layer:this,field:e.field,field2:e.field2,field3:e.field3,fieldDelimiter:x,view:e.view,signal:e.signal}))).then((r=>k(r,t,e.returnAllCodedValues,x)))}_calcBinsSQL(e,t,r){const i=[],s=t.length;return t.forEach(((t,a)=>{const[n,o]=t;let l=null;l=0!==a||r?a!==s-1||r?F(`${e} >= ${n}`,`${e} ${a===s-1?" <= ":" < "} ${o}`):`${e} >= ${n}`:`${e} < ${o}`,i.push("WHEN ("+l+") THEN "+(a+1))})),["CASE",i.join(" "),"ELSE 0","END"].join(" ")}_getNormalizationTotal(e,t,r,i){return e&&"percent-of-total"===t?this.summaryStatistics({field:e,filter:r,signal:i}).then((e=>e.sum)):Promise.resolve(null)}_getQueryParamsForExpr(e,t){const r=e.valueExpression||e.sqlExpression,i=e.signal;if(!r){const{field:r,normalizationType:s,normalizationField:a}=e,n=r?this.getField(r):null,o=w(n)||u(n),l={field:r,normalizationType:s,normalizationField:a,normalizationTotal:t,layer:this};return{sqlExpression:o?V(this,n):j(l),sqlWhere:o?null:e.sqlWhere||S({field:r,normalizationType:s,normalizationField:a}),filter:e.filter,signal:i}}return{valueExpression:e.valueExpression,sqlExpression:e.sqlExpression,sqlWhere:e.sqlWhere,filter:e.filter,signal:i}}_getDataRange(e,t,r){return null!=t&&null!=r?Promise.resolve({min:t,max:r}):this.summaryStatistics(e).then((e=>({min:e.min,max:e.max})))}_histogramForExpr(e){return this._getNormalizationTotal(e.field,e.normalizationType,e.filter,e.signal).then((t=>{const r=this._getQueryParamsForExpr(e,t);return this._getDataRange(r,e.minValue,e.maxValue).then((i=>{const s=i.min,a=i.max;if(null==s||null==a)return{bins:[],minValue:s,maxValue:a,normalizationTotal:t};const n=e.numBins||Q,o=D(s,a,n),l=this._calcBinsSQL(r.sqlExpression,o,null!=e.minValue&&null!=e.maxValue),u=new p({statisticType:"count",outStatisticFieldName:"countOFExpr",onStatisticField:"1"}),m=this.layer.createQuery();return m.where=F(m.where,r.sqlWhere),m.sqlFormat="standard",m.outStatistics=[u],m.groupByFieldsForStatistics=[l],m.orderByFields=[l],b(m,e.filter),this._isStatsSupportedOnService().then((()=>this.layer.queryFeatures(m,{signal:r.signal}))).then((e=>N(e,s,a,n,t)))}))}))}_binParamsFromGenRend(e,t){const{field:r,normalizationType:i,normalizationField:s,signal:a}=e,n=S({field:r,normalizationType:i,normalizationField:s}),o=new h({classificationDefinition:G({field:r,normalizationType:i,normalizationField:s,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numBins||Q}),where:F(n,t)});return this.generateRenderer(o,a).then((e=>{const{normalizationTotal:t,classBreaks:a}=e;return R({field:r,normalizationType:i,normalizationField:s,normalizationTotal:t,classBreaks:a,where:n,layer:this})}))}_classBreaksFromGenRend(e){const{field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,signal:a}=e,n=S({field:t,normalizationType:r,normalizationField:i}),o=j({field:t,normalizationType:r,normalizationField:i,normalizationTotal:s,layer:this}),l=g(o,e.minValue,e.maxValue),u=G({field:t,normalizationType:r,normalizationField:i,classificationMethod:e.classificationMethod,standardDeviationInterval:e.standardDeviationInterval,breakCount:e.numClasses||P}),m=new h({classificationDefinition:u});return m.where=F(n,l),this.generateRenderer(m,a).then((t=>O(t,e.classificationMethod)))}async summaryStatistics(e){const{field:t,normalizationType:r,sqlExpression:s,view:n,features:o,useFeaturesInView:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||s,p=h&&!s,d=this._hasLocalSource||o||l,f=n&&"3d"===n.type;if(d||p)return p||o||l||f?this._summaryStatsFromMemory(e,m):this._summaryStatsFromClientQuery(e,m);if(!this.supportsSQLExpression&&(c||h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return(r&&!this.supportsSQLExpression?this._summaryStatsFromGenRend(e):this._summaryStatsFromServiceQuery(e,m)).catch((()=>(a(e.signal),this._summaryStatsFromMemory(e,m))))}async uniqueValues(e){const{valueExpression:t,sqlExpression:r,features:i,useFeaturesInView:s,signal:n}=e,o=t&&(!r||!this.supportsSQLExpression),l=this._hasLocalSource||i||s||o,u=e.view,m=u&&"3d"===u.type,c=await C(e,this);return l?o||i||s||m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c):this._uvFromServiceQuery(e,c).catch((t=>(a(n),!e.field||e.field2||e.field3||e.filter?t:this._uvFromGenRenderer(e,c[0])))).catch((()=>(a(n),m?this._uvFromMemory(e,c):this._uvFromClientQuery(e,c))))}async histogram(e){const{field:t,normalizationType:r,normalizationField:s,classificationMethod:a,view:n,filter:o,signal:l}=e,m=t?this.getField(t):null,c=w(m)||u(m),h=e.valueExpression||e.sqlExpression,p=h&&!e.sqlExpression,d=this._hasLocalSource||e.features||e.useFeaturesInView||p,f=this.supportsSQLExpression,y=!a||"equal-interval"===a,F=e.minValue,S=e.maxValue,v=null!=F&&null!=S,x=e.numBins||Q;if(d)return this._histogramFromMemory(e);if((h||f)&&y){if(!f&&(h||"natural-log"===r||"square-root"===r))throw new i(`${this.adapterName}:not-supported`,"Layer does not support standardized SQL expression for queries");return this._histogramForExpr(e)}if(c&&y)throw new i(`${this.adapterName}:not-supported`,"Normalization and date field are not allowed when layer does not support standardized SQL expression for queries");return r||!y?this._binParamsFromGenRend(e).then((a=>{if(!v)return I(this,a,t,x,n,o,l);if(F>a.max||S<a.min)throw new i(`${this.adapterName}:insufficient-data`,"Range defined by 'minValue' and 'maxValue' does not intersect available data range of the field");if(y)return I(this,{min:F,max:S,sqlExpr:a.sqlExpr,excludeZerosExpr:a.excludeZerosExpr},t,x,n,o,l);{const i={field:t,normalizationType:r,normalizationField:s,normalizationTotal:a.normTotal,layer:this},u=j(i),m=g(u,F,S);return this._binParamsFromGenRend(e,m).then((e=>I(this,e,t,x,n,o,l)))}})):this._histogramForField(e)}async classBreaks(e){const t=!1!==e.analyzeData,r=this._hasLocalSource||e.features||e.useFeaturesInView||e.valueExpression||e.filter;if(t&&r)return this._classBreaksFromMemory(e);return(t?this._classBreaksFromGenRend(e):this._classBreaksFromInterpolation(e)).catch((()=>(a(e.signal),this._classBreaksFromMemory(e))))}async queryFeatureCount(e){if(this._hasLocalSource)throw new i(`${this.adapterName}:not-supported`,"Layer does not support count query");const t=this.layer,r=t.createQuery();return r.where=F(r.where,e.whereClause),b(r,e.filter),t.queryFeatureCount(r,{signal:e.signal})}async generateRenderer(e,t){const r=this.layer;if(this._hasLocalSource||r.version<10.1)throw new i(`${this.adapterName}:not-supported`,"Layer does not support generateRenderer operation (requires ArcGIS Server version 10.1+)");const s=r.createQuery();return e.where=F(e.where,s.where),c(r.parsedUrl.path,{source:r.dynamicDataSource??void 0,gdbVersion:r.gdbVersion??void 0},e,{signal:t})}async predominantCategories(e){if(!this._hasLocalSource&&!this.supportsSQLExpression)throw new i(`${this.adapterName}:not-supported`,"Layer does not support advanced SQL expressions and standardized queries");const{fields:t,view:r,signal:s}=e,a=f(t),n=y(t),o=r&&this._hasLocalSource?await this._uvFromMemory({valueExpression:a,view:r,signal:s}):await this._uvFromServiceQuery({sqlExpression:n.expression,valueExpression:a,signal:s});return M(o.uniqueValueInfos,t)}async getSampleFeatures(e,i){const{view:n,requiredFields:o,returnGeometry:l,filter:u,signal:m}=e,c=e.sampleSize;if(null==c||0===c)return[];const h=this.layer.createQuery(),p=1,d="json"===i;h.outSpatialReference=n?.spatialReference,h.returnGeometry=!!l,h.outFields=o,b(h,u);let f=[],y=!1;if(n)try{const s=await n.whenLayerView(this.layer);if(y=!B(this,o,s).length,y){if(c>=1&&!e.filter&&"getSampleFeatures"in s){const e=await s.getSampleFeatures({minFeatureCount:c,sampleSize:c});if(null!=e)return d?e:e.map((e=>t.fromJSON(e)))}if(f=await this._fetchFeaturesFromMemory(s,h,m,i),f.length>=c&&c>0)return r(f,c,p)}}catch(F){a(m)}try{if(this._hasLocalSource)return y?f:d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);const t=await this.queryFeatureCount({view:n,filter:u,signal:m}),i=this.layer.capabilities.query.maxRecordCount;let a=-1===c?t:c;if(a=i&&a>i?i:a,t<=f.length||f.length>=i)return f;s(n,"FeatureLayerAdapter: must have a view");const o=n.extent.width/n.width/n.scale*U;if(h.maxAllowableOffset=e.resolution||o,t<=a)return d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m);if(t<=A){const e=this.layer.createQuery();b(e,u);const t=await this.layer.queryObjectIds();return h.objectIds=r(t,a,p),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}return this.layer.capabilities?.query?.supportsPagination&&(h.num=Math.min(a,A)),d?this._fetchFeaturesJSONFromService(h,m):this._fetchFeaturesFromService(h,m)}catch(F){return a(m),f}}load(e){const t=this.layer.load(e).then((async t=>{this.geometryType=t.geometryType,this.objectIdField=t.objectIdField,this.supportsSQLExpression=t.capabilities?.query?.supportsSqlExpression,this._hasLocalSource=!t.url&&!!t.source,this.hasQueryEngine=this._hasLocalSource,this.minScale=t.minScale,this.maxScale=t.maxScale,this.fullExtent=t.fullExtent,this.workerClient=v.getInstance(),await this.workerClient.open(e.signal)}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],W.prototype,"layer",void 0),W=e([o("esri.smartMapping.support.adapters.FeatureLayerAdapter")],W);const J=W;export{J as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import a from"../../../core/Error.js";import{timeout as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{kebabDict as u}from"../../../layers/support/fieldType.js";import{isNumericField as p}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/FeatureSet.js";import{summaryStatistics as c,uniqueValues as d,classBreaks as h,histogram as f}from"../../statistics/support/statsWorker.js";import{WorkerClient as y}from"../../statistics/support/WorkerClient.js";import{getFieldsList as g,isAnyDateField as w,fieldDelimiter as F}from"../utils.js";import _ from"./FeatureLayerAdapter.js";import S from"./LayerAdapter.js";import{getMissingFields as v,ensureFeaturesJSON as x,getViewInfoParams as L,getUniqueValuesFromFeatureSet as C,getHistogramFromFeatureSet as E,getDomainsForFields as z}from"./support/utils.js";import{createUVResult as T}from"../../../statistics/utils.js";let A=class extends S{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],r=[]){if(!e||!r.length)return e;const a=this.layer.objectIdField,s=e.clone(),i=t.filter((e=>{const t=this.layer.getField(e);return!r.includes(t.name)})),o=i.some((e=>this.layer.getField(e).name===a));return s.outFields=o?i:[...i,a],s}async _fetchFeaturesFromMemory(e,t,r){if(!e)throw new a("scene-layer-adapter:insufficient-data","view is required to fetch the features from layerView");const n=await e.whenLayerView(this.layer),l=new AbortController,u=l.signal,p=o((()=>!n.updating),u);await s(p,5e3,l);const m=v(this,r,n);i(u);const c=this._updateQuery(t,r??[],m),d=await n.queryFeatures(c,{signal:u});i(u);const h=d.features;return m.length?n.whenGraphicAttributes(h,m):h}async _fetchFeaturesJSONFromMemory(e,t,r){return this._fetchFeaturesFromMemory(e,t,r).then(x)}_fetchFeaturesForStats(e,t){return g({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:r,signal:e.signal},t)))}async _processStatsFromMemoryParams(e){const t=e.features;if(t?.length){return t.length&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass?{graphics:t}:{featuresJSON:t}}const{view:r,field:s,normalizationField:i,valueExpression:o,signal:n}=e,l=await this._fetchFeaturesForStats({field:s,valueExpression:o,normalizationField:i,view:r,signal:n},null);if(!l?.length)throw new a("scene-layer-adapter:insufficient-data","No features are available to calculate statistics");return{graphics:l}}_generateFeatureSetForCachedHistogram(e,r=e.minimum,a=e.maximum,s){const i=[];for(let t=0;t<s;t++)i[t]=0;const o=e.counts.length,n=e.minimum,l=e.maximum;for(let t=0;t<o;t++){const u=(t+.5)/o,p=((1-u)*n+u*l-r)/(a-r)*s;p>=0&&p<=s&&(i[p===s?s-1:Math.floor(p)]+=e.counts[t])}const u=[];i.forEach(((e,r)=>{const a=new t({attributes:{}});a.attributes.EXPR_1=r+1,a.attributes.countOFExpr=e,u.push(a)}));const p=new m;return p.features=u,p}_getCachedStatistics(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified")):r.queryCachedStatistics(t?.name,{signal:e.signal}).then((e=>{const t=e.stats,{min:r,max:a,totalValuesCount:s}=t;let{avg:i,stddev:o,sum:n,variance:l,count:u}=t;return 0===r&&0===a||(i=0===i?null:i,n=0===n?null:n,o=0===o?null:o,l=0===l?null:l,u=0===u?null:u),null==u&&(null!=n&&null!=i?u=Math.round(n/i):null!=s&&(u=s)),{avg:i,count:u,max:a,min:r,stddev:o,sum:n,variance:l}}))}async _getNormalizationTotal(e,t,r){const s=(t?await this.workerClient.summaryStatistics({field:e},t):await c({attribute:{field:e},features:r})).sum;if(null==s)throw new a("scene-layer-adapter:invalid","invalid normalizationTotal");return s}async _getSummaryStatisticsFromMemory(e,t){const{view:r,field:a,normalizationField:s,valueExpression:i}=e,{featuresJSON:o,graphics:n}=await this._processStatsFromMemoryParams(e),l={field:a,valueExpression:i,normalizationType:e.normalizationType,normalizationField:s,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue};return e.valueExpression&&r&&o&&(l.fieldType=t?.type?u.toJSON(t.type):null,l.viewInfoParams=L(r),l.timeZone=r.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(l.normalizationTotal=await this._getNormalizationTotal(a,o,n)),o?this.workerClient.summaryStatistics(l,o):c({attribute:l,features:n})}_getCachedStatisticsForUniqueValues(e,r){const s=this.layer,i=r?.name,o=r&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified")):s.queryCachedStatistics(i,{signal:e.signal}).then((a=>{const o=a.stats;if(!o.mostFrequentValues)throw new Error;const n=a.labels?.labels,l={},u=[],c="countOF"+i;o.mostFrequentValues.forEach((e=>{const a=new t({attributes:{}});a.attributes[i]=r&&r.name!==s.objectIdField&&(p(r)||w(r))?Number(e.value):e.value,a.attributes[c]=e.count,u.push(a)})),n&&n.forEach((e=>{l[e.value]=e.label}));const d=new m;return d.features=u,C(d,{layer:this,field:e.field,labels:l,view:e.view,signal:e.signal})})).then((t=>T(t,[o],e.returnAllCodedValues)))}async _getUniqueValuesFromMemory(e,t){const{view:r,field:a,field2:s,field3:i,valueExpression:o,returnAllCodedValues:n}=e,l={field:a,field2:s,field3:i,fieldDelimiter:F,valueExpression:o,domains:t,returnAllCodedValues:n},{featuresJSON:u,graphics:p}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&r&&u&&(l.viewInfoParams=L(r),l.timeZone=r.timeZone),u?this.workerClient.uniqueValues(l,u):d({attribute:l,features:p})}_getCachedStatisticsForHistogram(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified")):r.queryCachedStatistics(t&&t.name,{signal:e.signal}).then((t=>{const r=t.stats,{minValue:a,maxValue:s}=e,i=null!=a?a:r.min,o=null!=s?s:r.max,n=e.numBins||10,l=this._generateFeatureSetForCachedHistogram(r.histogram,i,o,n);return E(l,i,o,n)}))}async _getClassBreaksFromMemory(e){const{view:t,field:r,normalizationField:a,valueExpression:s}=e,{featuresJSON:i,graphics:o}=await this._processStatsFromMemoryParams(e),n={field:r,valueExpression:s,normalizationType:e.normalizationType,normalizationField:a,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&i&&(n.viewInfoParams=L(t),n.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotal(r,i,o)),i?this.workerClient.classBreaks(n,i):h({attribute:n,features:o})}async _getHistogramFromMemory(e){const{view:t,field:r}=e,{featuresJSON:a,graphics:s}=await this._processStatsFromMemoryParams(e),i={field:r,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&a&&(i.viewInfoParams=L(t),i.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(i.normalizationTotal=await this._getNormalizationTotal(r,a,s)),a?this.workerClient.histogram(i,a):f({attribute:i,features:s})}getField(e){return this.layer.getField(e??"")}getFieldUsageInfo(e){const t=this.getField(e);if(!t)return null;const r=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:r.supportsLabelingInfo,supportsPopupTemplate:r.supportsPopupTemplate,supportsRenderer:r.supportsRenderer,supportsLayerQuery:r.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch((()=>(i(e.signal),this._getSummaryStatisticsFromMemory(e,t)))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const t=await z(e,this),{field:r,field2:s}=e,o=r&&s,n=this.getField(r);return!o&&n&&this._hasCachedStatistics(n.name)?this._getCachedStatisticsForUniqueValues(e,n).catch((()=>(i(e.signal),this._getUniqueValuesFromMemory(e,t)))):this._getUniqueValuesFromMemory(e,t)}histogram(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch((()=>(i(e.signal),this._getHistogramFromMemory(e)))):this._getHistogramFromMemory(e)}classBreaks(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?Promise.reject(new a("scene-layer-adapter:not-supported","Cached stats not supported")):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support count query"))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support generateRenderer operation"))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support heatmapStatistics operation"))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support predominantCategories")}async getSampleFeatures(e,t){if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const{view:s,sampleSize:o,requiredFields:n,returnGeometry:l,signal:u}=e,p=1,m="json"===t,c=this.createQuery();c.outFields=n,c.returnGeometry=!!l,c.where=null,c.num=o;let d=[];try{if(d=m?await this._fetchFeaturesJSONFromMemory(s,c,n):await this._fetchFeaturesFromMemory(s,c,n),d.length&&null!=o&&o>0&&o<=d.length)return r(d,o,p)}catch(f){i(u)}let h=null;if(this._featureLayerAdapter){const r={...e};delete r.view,h=await this._featureLayerAdapter.getSampleFeatures(r,t)}return h&&h.length?h:r(d,d.length,p)}load(e){const t=this.layer.load(e).then((async t=>{this.workerClient=y.getInstance(),await this.workerClient.open(e.signal);const r=t.associatedLayer;if(this.geometryType=t.geometryType,null!=r){this._featureLayerAdapter=new _({layer:r});return this._featureLayerAdapter.load(e).then((()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent}))}this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],A.prototype,"layer",void 0),A=e([l("esri.smartMapping.support.adapters.SceneLayerAdapter")],A);const j=A;export{j as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{pickRandom as r}from"../../../core/arrayUtils.js";import a from"../../../core/Error.js";import{timeout as s,throwIfAborted as i}from"../../../core/promiseUtils.js";import{whenOnce as o}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{kebabDict as u}from"../../../layers/support/fieldType.js";import{isNumericField as p}from"../../../layers/support/fieldUtils.js";import m from"../../../rest/support/FeatureSet.js";import{summaryStatistics as c,uniqueValues as d,classBreaks as h,histogram as f}from"../../statistics/support/statsWorker.js";import{WorkerClient as y}from"../../statistics/support/WorkerClient.js";import{getFieldsList as g,isAnyDateField as w,fieldDelimiter as F}from"../utils.js";import _ from"./FeatureLayerAdapter.js";import S from"./LayerAdapter.js";import{getMissingFields as v,ensureFeaturesJSON as x,getViewInfoParams as L,getUniqueValuesFromFeatureSet as C,getHistogramFromFeatureSet as E,getDomainsForFields as z}from"./support/utils.js";import{createUVResult as T}from"../../../statistics/utils.js";let A=class extends S{constructor(e){super(e),this._featureLayerAdapter=null,this.workerClient=null}destroy(){this.workerClient?.destroy()}_hasCachedStatistics(e){return this.layer.hasCachedStatistics(e)}_updateQuery(e,t=[],r=[]){if(!e||!r.length)return e;const a=this.layer.objectIdField,s=e.clone(),i=t.filter((e=>{const t=this.layer.getField(e);return!r.includes(t.name)})),o=i.some((e=>this.layer.getField(e).name===a));return s.outFields=o?i:[...i,a],s}async _fetchFeaturesFromMemory(e,t,r){if(!e)throw new a("scene-layer-adapter:insufficient-data","view is required to fetch the features from layerView");const n=await e.whenLayerView(this.layer),l=new AbortController,u=l.signal,p=o((()=>!n.updating),u);await s(p,5e3,l);const m=v(this,r,n);i(u);const c=this._updateQuery(t,r??[],m),d=await n.queryFeatures(c,{signal:u});i(u);const h=d.features;return m.length?n.whenGraphicAttributes(h,m):h}async _fetchFeaturesJSONFromMemory(e,t,r){return this._fetchFeaturesFromMemory(e,t,r).then(x)}_fetchFeaturesForStats(e,t){return g({field:e.field,normalizationField:e.normalizationField,valueExpression:e.valueExpression}).then((r=>this.getSampleFeatures({sampleSize:-1,view:e.view,returnGeometry:e.returnGeometry,requiredFields:r,signal:e.signal},t)))}async _processStatsFromMemoryParams(e){const t=e.features;if(t?.length){return t.length&&"declaredClass"in t[0]&&"esri.Graphic"===t[0].declaredClass?{graphics:t}:{featuresJSON:t}}const{view:r,field:s,normalizationField:i,valueExpression:o,signal:n}=e,l=await this._fetchFeaturesForStats({field:s,valueExpression:o,normalizationField:i,view:r,signal:n},null);if(!l?.length)throw new a("scene-layer-adapter:insufficient-data","No features are available to calculate statistics");return{graphics:l}}_generateFeatureSetForCachedHistogram(e,r=e.minimum,a=e.maximum,s){const i=[];for(let t=0;t<s;t++)i[t]=0;const o=e.counts.length,n=e.minimum,l=e.maximum;for(let t=0;t<o;t++){const u=(t+.5)/o,p=((1-u)*n+u*l-r)/(a-r)*s;p>=0&&p<=s&&(i[p===s?s-1:Math.floor(p)]+=e.counts[t])}const u=[];return i.forEach(((e,r)=>{const a=new t({attributes:{}});a.attributes.EXPR_1=r+1,a.attributes.countOFExpr=e,u.push(a)})),new m({features:u})}_getCachedStatistics(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.minValue||e.maxValue?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression', 'sqlWhere', 'minValue' or 'maxValue' is specified")):r.queryCachedStatistics(t?.name,{signal:e.signal}).then((e=>{const t=e.stats,{min:r,max:a,totalValuesCount:s}=t;let{avg:i,stddev:o,sum:n,variance:l,count:u}=t;return 0===r&&0===a||(i=0===i?null:i,n=0===n?null:n,o=0===o?null:o,l=0===l?null:l,u=0===u?null:u),null==u&&(null!=n&&null!=i?u=Math.round(n/i):null!=s&&(u=s)),{avg:i,count:u,max:a,min:r,stddev:o,sum:n,variance:l}}))}async _getNormalizationTotal(e,t,r){const s=(t?await this.workerClient.summaryStatistics({field:e},t):await c({attribute:{field:e},features:r})).sum;if(null==s)throw new a("scene-layer-adapter:invalid","invalid normalizationTotal");return s}async _getSummaryStatisticsFromMemory(e,t){const{view:r,field:a,normalizationField:s,valueExpression:i}=e,{featuresJSON:o,graphics:n}=await this._processStatsFromMemoryParams(e),l={field:a,valueExpression:i,normalizationType:e.normalizationType,normalizationField:s,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue};return e.valueExpression&&r&&o&&(l.fieldType=t?.type?u.toJSON(t.type):null,l.viewInfoParams=L(r),l.timeZone=r.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(l.normalizationTotal=await this._getNormalizationTotal(a,o,n)),o?this.workerClient.summaryStatistics(l,o):c({attribute:l,features:n})}_getCachedStatisticsForUniqueValues(e,r){const s=this.layer,i=r?.name,o=r&&e.field?this.getFieldDomain(e.field):null;return e.valueExpression||e.sqlExpression||e.sqlWhere?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression', 'sqlExpression' or 'sqlWhere' is specified")):s.queryCachedStatistics(i,{signal:e.signal}).then((a=>{const o=a.stats;if(!o.mostFrequentValues)throw new Error;const n=a.labels?.labels,l={},u=[],c="countOF"+i;o.mostFrequentValues.forEach((e=>{const a=new t({attributes:{}});a.attributes[i]=r&&r.name!==s.objectIdField&&(p(r)||w(r))?Number(e.value):e.value,a.attributes[c]=e.count,u.push(a)})),n&&n.forEach((e=>{l[e.value]=e.label}));const d=new m({features:u});return C(d,{layer:this,field:e.field,labels:l,view:e.view,signal:e.signal})})).then((t=>T(t,[o],e.returnAllCodedValues)))}async _getUniqueValuesFromMemory(e,t){const{view:r,field:a,field2:s,field3:i,valueExpression:o,returnAllCodedValues:n}=e,l={field:a,field2:s,field3:i,fieldDelimiter:F,valueExpression:o,domains:t,returnAllCodedValues:n},{featuresJSON:u,graphics:p}=await this._processStatsFromMemoryParams(e);return e.valueExpression&&r&&u&&(l.viewInfoParams=L(r),l.timeZone=r.timeZone),u?this.workerClient.uniqueValues(l,u):d({attribute:l,features:p})}_getCachedStatisticsForHistogram(e,t){const r=this.layer;return e.valueExpression||e.sqlExpression||e.sqlWhere||e.normalizationType?Promise.reject(new a("scene-layer-adapter:not-supported","This Layer does not support calculating statistics when 'valueExpression' or 'sqlExpression' or 'sqlWhere' or 'normalizationType' is specified")):r.queryCachedStatistics(t&&t.name,{signal:e.signal}).then((t=>{const r=t.stats,{minValue:a,maxValue:s}=e,i=null!=a?a:r.min,o=null!=s?s:r.max,n=e.numBins||10,l=this._generateFeatureSetForCachedHistogram(r.histogram,i,o,n);return E(l,i,o,n)}))}async _getClassBreaksFromMemory(e){const{view:t,field:r,normalizationField:a,valueExpression:s}=e,{featuresJSON:i,graphics:o}=await this._processStatsFromMemoryParams(e),n={field:r,valueExpression:s,normalizationType:e.normalizationType,normalizationField:a,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numClasses:e.numClasses};return e.valueExpression&&t&&i&&(n.viewInfoParams=L(t),n.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(n.normalizationTotal=await this._getNormalizationTotal(r,i,o)),i?this.workerClient.classBreaks(n,i):h({attribute:n,features:o})}async _getHistogramFromMemory(e){const{view:t,field:r}=e,{featuresJSON:a,graphics:s}=await this._processStatsFromMemoryParams(e),i={field:r,valueExpression:e.valueExpression,normalizationType:e.normalizationType,normalizationField:e.normalizationField,normalizationTotal:e.normalizationTotal,minValue:e.minValue,maxValue:e.maxValue,standardDeviationInterval:e.standardDeviationInterval,classificationMethod:e.classificationMethod,numBins:e.numBins};return e.valueExpression&&t&&a&&(i.viewInfoParams=L(t),i.timeZone=t.timeZone),"percent-of-total"===e.normalizationType&&null==e.normalizationTotal&&(i.normalizationTotal=await this._getNormalizationTotal(r,a,s)),a?this.workerClient.histogram(i,a):f({attribute:i,features:s})}getField(e){return this.layer.getField(e??"")}getFieldUsageInfo(e){const t=this.getField(e);if(!t)return null;const r=this.layer.getFieldUsageInfo(t.name);return{supportsLabelingInfo:r.supportsLabelingInfo,supportsPopupTemplate:r.supportsPopupTemplate,supportsRenderer:r.supportsRenderer,supportsLayerQuery:r.supportsLayerQuery,supportsStatistics:!0}}getFieldDomain(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.getFieldDomain(e,t):null}createQuery(){return this.layer.createQuery()}summaryStatistics(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.summaryStatistics(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?this._getCachedStatistics(e,t).catch((()=>(i(e.signal),this._getSummaryStatisticsFromMemory(e,t)))):this._getSummaryStatisticsFromMemory(e,t)}async uniqueValues(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.uniqueValues(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const t=await z(e,this),{field:r,field2:s}=e,o=r&&s,n=this.getField(r);return!o&&n&&this._hasCachedStatistics(n.name)?this._getCachedStatisticsForUniqueValues(e,n).catch((()=>(i(e.signal),this._getUniqueValuesFromMemory(e,t)))):this._getUniqueValuesFromMemory(e,t)}histogram(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.histogram(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return t&&this._hasCachedStatistics(t.name)?this._getCachedStatisticsForHistogram(e,t).catch((()=>(i(e.signal),this._getHistogramFromMemory(e)))):this._getHistogramFromMemory(e)}classBreaks(e){const t=this.getField(e.field);if(this._featureLayerAdapter)return this._featureLayerAdapter.classBreaks(e);if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");return this._hasCachedStatistics(t?.name)?Promise.reject(new a("scene-layer-adapter:not-supported","Cached stats not supported")):this._getClassBreaksFromMemory(e)}queryFeatureCount(e){return this._featureLayerAdapter?this._featureLayerAdapter.queryFeatureCount(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support count query"))}generateRenderer(e,t){return this._featureLayerAdapter?this._featureLayerAdapter.generateRenderer(e,t):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support generateRenderer operation"))}heatmapStatistics(e){return this._featureLayerAdapter?this._featureLayerAdapter.heatmapStatistics(e):Promise.reject(new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support heatmapStatistics operation"))}async predominantCategories(e){if(this._featureLayerAdapter)return this._featureLayerAdapter.predominantCategories(e);throw new a("scene-layer-adapter:not-supported","SceneLayer without associated FeatureLayer does not support predominantCategories")}async getSampleFeatures(e,t){if(e.filter)throw new a("scene-layer-adapter:not-supported","filter is not supported");const{view:s,sampleSize:o,requiredFields:n,returnGeometry:l,signal:u}=e,p=1,m="json"===t,c=this.createQuery();c.outFields=n,c.returnGeometry=!!l,c.where=null,c.num=o;let d=[];try{if(d=m?await this._fetchFeaturesJSONFromMemory(s,c,n):await this._fetchFeaturesFromMemory(s,c,n),d.length&&null!=o&&o>0&&o<=d.length)return r(d,o,p)}catch(f){i(u)}let h=null;if(this._featureLayerAdapter){const r={...e};delete r.view,h=await this._featureLayerAdapter.getSampleFeatures(r,t)}return h&&h.length?h:r(d,d.length,p)}load(e){const t=this.layer.load(e).then((async t=>{this.workerClient=y.getInstance(),await this.workerClient.open(e.signal);const r=t.associatedLayer;if(this.geometryType=t.geometryType,null!=r){this._featureLayerAdapter=new _({layer:r});return this._featureLayerAdapter.load(e).then((()=>{this.objectIdField=this._featureLayerAdapter.objectIdField,this.supportsSQLExpression=this._featureLayerAdapter.supportsSQLExpression,this.minScale=this._featureLayerAdapter.minScale,this.maxScale=this._featureLayerAdapter.maxScale,this.fullExtent=this._featureLayerAdapter.fullExtent}))}this.objectIdField=t.objectIdField,this.supportsSQLExpression=!1,this.hasQueryEngine=!1,this.fullExtent=t.fullExtent}));return this.addResolvingPromise(t),Promise.resolve(this)}};e([n({constructOnly:!0})],A.prototype,"layer",void 0),A=e([l("esri.smartMapping.support.adapters.SceneLayerAdapter")],A);const j=A;export{j as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getMetersPerUnit as e}from"../symbols/support/unitConversionUtils.js";function n(e){return e?
|
|
5
|
+
import{getMetersPerUnit as e}from"../symbols/support/unitConversionUtils.js";function n(e){return e?Z:I}function t(e,t){return t?.mode?t.mode:n(e).mode}function o(e,t){return null!=t?t:n(e)}function r(e,n){return t(null!=e&&e.hasZ,n)}function u(e,n){return o(null!=e&&!!e.hasZ,n)}function l(e){const n=a(e);return r(e.geometry,n)}function i(e){const n=a(e),t=r(e.geometry,n);return{mode:t,offset:null!=n&&"on-the-ground"!==t?y(n):0}}function s(e){if("on-the-ground"===l(e))return!1;const n=a(e),t=n?.featureExpressionInfo?n.featureExpressionInfo.expression:null;return!(!t||"0"===t)}function a(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function f(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=null!=t.offset?t.offset:0;switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function c(e,n,t,o=null){return v(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function d(e,n,t,o,r=null){return v(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function v(e,n,t,o,r,u,l=null){if(null==u)return;const i=null!=l?l.mode:"absolute-height";if("on-the-ground"===i)return 0;const{absoluteZ:s}=g(n,t,o,r,e,u);return h(s,n,t,o,r,e,l,i)}function g(e,n,t,o,r,u){const l=null!=u.offset?u.offset:0;switch(u.mode){case"absolute-height":return{absoluteZ:t+l,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+l,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+l,elevation:u}}}}function h(e,n,t,o,r,u,l,i){const s=null!=l?.offset?l.offset:0;switch(i){case"absolute-height":return e-s;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+s);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+s)}}function m(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function p(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function b(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function E(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function x(e,n){n&&e.warn(".elevationInfo=",n)}function y(n){return(n?.offset??0)*e(n?.unit)}const Z={mode:"absolute-height",offset:0},I={mode:"on-the-ground",offset:null};export{Z as absoluteHeightElevationInfo,m as elevationContextAffectsAlignment,p as elevationModeRequiredMessage,b as elevationModeUnsupportedMessage,E as featureExpressionUnsupportedMessage,c as getConvertedElevation,d as getConvertedElevationFromVector,v as getConvertedElevationFromXYZ,o as getEffectiveElevationInfo,t as getEffectiveElevationMode,y as getElevationOffsetInMeters,u as getGeometryEffectiveElevationInfo,r as getGeometryEffectiveElevationMode,i as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,f as getZForElevationMode,s as hasGraphicFeatureExpressionInfo,x as logInvalidElevationInfoWarning,I as onTheGroundElevationInfo,g as zValueInAbsoluteHeightMode};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20240215",c="d984114540ca2065bb572e26ac4f395b6994d10f";export{b as buildDate,c as commitHash};
|