@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 881 B
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import t from"../../request.js";import e from"../../core/Error.js";import{join as s}from"../../core/urlUtils.js";async function i({fieldName:i,statisticsInfo:a,errorContext:o,fieldsIndex:r,path:n,customParameters:l,apiKey:c,signal:f}){if(null==a)throw new e(`${o}:no-cached-statistics`,"Cached statistics are not available for this layer");const d=r.get(i);if(null==d)throw new e(`${o}:field-unexisting`,`Field '${i}' does not exist on the layer`);const h=a.find((t=>t.name===d.name));if(null==h)throw new e(`${o}:no-cached-statistics`,"Cached statistics for this attribute are not available");const m=s(n,h.href),{data:u}=await t(m,{query:{f:"json",...l,token:c},responseType:"json",signal:f});return u}export{i as fetchStatistics};