@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.51 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import{a3 as e}from"../../../chunks/languageUtils.js";import{throwIfCancelled as t}from"../support/errorsupport.js";import{FeatureSet as a}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import{splitIntoChunks as o}from"../../../core/arrayUtils.js";class n extends a{constructor(r){super(),this.declaredClass="esri.arcade.featureset.actions.OrderBy",this._maxProcessing=100,this._parent=r.parentfeatureset,this._orderByClause=r.orderbyclause}async _queryAll(){return(await this.query({abortSignal:r})).features}async query(r){await this._ensureLoaded();const e=await this._parent.query({...r,orderBy:null==r.orderBy?this._orderByClause:r.orderBy});return t(r.abortSignal),!1===e.ordered?{...e,ordered:!0,features:this._sortFeatures(e.features,r.abortSignal)}:e}async*_sortFeatures(r,a){const s=[];for await(const o of r)s.push(o),await e(),t(a);const n=s.flat();this._orderByClause.order(n);for(const e of o(n,this._maxQueryRate()))yield e}async queryStat(r){const e=await this._parent.queryStat(r);return e.calculated?e:null==r.where&&null==r.spatialFilter?this._manualStat(r.stat,r.field,r.limit??s,r.abortSignal):{calculated:!1}}async canQueryAggregate(r){return this._parent.canQueryAggregate(r)}async queryAggregate(r){return this._parent.queryAggregate(r)}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{n as default};