@arcgis/core 5.2.0-next.16 → 5.2.0-next.18
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/arcgisGlobal.d.ts +3 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00bcb04934972179b9ca.js +1 -0
- package/assets/esri/core/workers/chunks/073ee52705ea326fecfb.js +1 -0
- package/assets/esri/core/workers/chunks/{282930645ce525d5bc92.js → 0e81b6aa64d5491870b2.js} +1 -1
- package/assets/esri/core/workers/chunks/{4162a2bb774e6ba2c0db.js → 0fb685f385e91d0f0601.js} +1 -1
- package/assets/esri/core/workers/chunks/11d1af758e2140095b10.js +1 -0
- package/assets/esri/core/workers/chunks/{a8ef7acb6d3d1f45e14c.js → 29e6f4b19c3da9129439.js} +1 -1
- package/assets/esri/core/workers/chunks/31c4128b23968575feca.js +1 -0
- package/assets/esri/core/workers/chunks/35a508a9311689d8df52.js +1 -0
- package/assets/esri/core/workers/chunks/3a35779cae6a11cde51b.js +1 -0
- package/assets/esri/core/workers/chunks/3a526e1d18490b99332f.js +1 -0
- package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +1 -0
- package/assets/esri/core/workers/chunks/{cf9a132c4c37e62de3d7.js → 50c88e2545380800381f.js} +1 -1
- package/assets/esri/core/workers/chunks/{a892b3be70f482bef0ba.js → 57a6572d440d2c62432b.js} +1 -1
- package/assets/esri/core/workers/chunks/6849282c4a5cd733779d.js +1 -0
- package/assets/esri/core/workers/chunks/{2b781de7b467c61849b2.js → 6a21a22b08f968fa8d60.js} +1 -1
- package/assets/esri/core/workers/chunks/8104ac2eee69d79ada86.js +1 -0
- package/assets/esri/core/workers/chunks/{1c689bb502657b1f173b.js → 9d59cc5c0a63a4e41d99.js} +1 -1
- package/assets/esri/core/workers/chunks/{91c0de3950991d81b7f2.js → 9de673a04c70bd47047e.js} +1 -1
- package/assets/esri/core/workers/chunks/a195f569eada3a8736be.js +1 -0
- package/assets/esri/core/workers/chunks/{9da1a514e042eb642d35.js → a32651777e4f07df5b6a.js} +1 -1
- package/assets/esri/core/workers/chunks/a3c5b754a6fa0f4250bf.js +1 -0
- package/assets/esri/core/workers/chunks/a59a1fdcd37a875f179b.js +1 -0
- package/assets/esri/core/workers/chunks/{ac7ecd90330090c90005.js → aeeee92b86554962711e.js} +1 -1
- package/assets/esri/core/workers/chunks/b0e4af49fc968b0a910f.js +1 -0
- package/assets/esri/core/workers/chunks/b466af9019f10420115e.js +1 -0
- package/assets/esri/core/workers/chunks/bb9232d9f63ec0c32447.js +1 -0
- package/assets/esri/core/workers/chunks/bf9eca7dd107bdb06614.js +1 -0
- package/assets/esri/core/workers/chunks/cbe8adc100582e746a8c.js +1 -0
- package/assets/esri/core/workers/chunks/{a1509e2e7809b6754b4f.js → d523af1db620b5381c99.js} +1 -1
- package/assets/esri/core/workers/chunks/d5a0e3a73df827dc7b06.js +1 -0
- package/assets/esri/core/workers/chunks/d670e134348954ce465d.js +1 -0
- package/assets/esri/core/workers/chunks/e3ea4b7217df16592def.js +1 -0
- package/assets/esri/core/workers/chunks/{c538435216d253f7702e.js → f23351a04643c464be84.js} +1 -1
- package/assets/esri/core/workers/chunks/f3d331da3c61af5c5a2f.js +1 -0
- package/assets/esri/core/workers/chunks/{68b77b36daae2b4b4237.js → f3fe865506fd7428eb6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{a4d918b47cd4ee0e1666.js → f8cfd0045d06aa24beec.js} +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/networks/CircuitManager.d.ts +247 -1
- package/networks/UnitIdentifierManager.d.ts +40 -3
- package/networks/UtilityNetwork.d.ts +0 -11
- package/networks/support/Circuit.d.ts +0 -1
- package/networks/support/CircuitLocation.d.ts +0 -1
- package/networks/support/CircuitPath.d.ts +0 -1
- package/networks/support/CircuitPathConnectivityElement.d.ts +0 -1
- package/networks/support/CircuitSection.d.ts +0 -1
- package/networks/support/NamedTraceConfiguration.d.ts +1 -7
- package/networks/support/Subcircuit.d.ts +0 -1
- package/networks/support/UNTraceConfiguration.d.ts +0 -4
- package/networks/support/jsonTypes.d.ts +1 -1
- package/networks/support/typeUtils.d.ts +10 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +1 -1
- package/rest/networks/circuits/support/CircuitTraceResult.d.ts +0 -1
- package/rest/networks/circuits/support/CircuitVerifyResult.d.ts +0 -1
- package/rest/networks/support/TelecomNetworkElement.d.ts +0 -1
- package/rest/networks/support/TraceLocation.d.ts +1 -11
- package/rest/networks/support/TraceParameters.d.ts +1 -7
- package/rest/networks/support/TraceResult.d.ts +0 -2
- package/rest/networks/support/TraverseAssociationsParameters.d.ts +69 -0
- package/rest/networks/support/TraverseAssociationsParameters.js +2 -0
- package/rest/networks/support/TraverseAssociationsResult.d.ts +39 -0
- package/rest/networks/support/TraverseAssociationsResult.js +2 -0
- package/rest/networks/traverseAssociations.d.ts +21 -0
- package/rest/networks/traverseAssociations.js +2 -0
- package/rest/networks/unitIdentifiers/support/UnitQueryResult.d.ts +0 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.d.ts +3 -2
- package/assets/esri/core/workers/chunks/01ba5319cac3e0f14205.js +0 -1
- package/assets/esri/core/workers/chunks/05e1f1628a3726eca03d.js +0 -1
- package/assets/esri/core/workers/chunks/1d38b2fcd85ac9ebd7c6.js +0 -1
- package/assets/esri/core/workers/chunks/1effde6a39ef0d4af525.js +0 -1
- package/assets/esri/core/workers/chunks/1ff57bf19f021f5fd246.js +0 -1
- package/assets/esri/core/workers/chunks/3dc6e9494af16f7b8009.js +0 -1
- package/assets/esri/core/workers/chunks/3ecb906322a6a5c8c93b.js +0 -1
- package/assets/esri/core/workers/chunks/3f67162456a1f02190fa.js +0 -1
- package/assets/esri/core/workers/chunks/4e4419282c4bf7ee4678.js +0 -1
- package/assets/esri/core/workers/chunks/609edb4da427ec37bcf7.js +0 -1
- package/assets/esri/core/workers/chunks/6f5a82388a5eb5fcf1b7.js +0 -1
- package/assets/esri/core/workers/chunks/7c61b18e43c789aaecc6.js +0 -1
- package/assets/esri/core/workers/chunks/8dcb3e77f76d8396706b.js +0 -1
- package/assets/esri/core/workers/chunks/a3195521a83565c7c2d3.js +0 -1
- package/assets/esri/core/workers/chunks/b0212df1fe8d9448f3d6.js +0 -1
- package/assets/esri/core/workers/chunks/b590402170ae289290d7.js +0 -1
- package/assets/esri/core/workers/chunks/bfa6f4c08e7571bb1f37.js +0 -1
- package/assets/esri/core/workers/chunks/c5e172d3baf5414868f0.js +0 -1
- package/assets/esri/core/workers/chunks/cf41a66fb97c1076fb34.js +0 -1
- package/assets/esri/core/workers/chunks/f23e995320674b32e142.js +0 -1
- package/assets/esri/core/workers/chunks/f3fd40df92e59f7c687c.js +0 -1
- package/assets/esri/core/workers/chunks/fa1336b60278017d2525.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as c,create as p,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{copy as y,negativeInfinity as h,create as g,expandWithRect as _}from"../../../../geometry/support/aaBoundingRect.js";import{getScaleForResolution as w}from"../../../../geometry/support/scaleUtils.js";import{isWebMercator as x,isWGS84 as F}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertToGeometry as S}from"../../featureConversionUtils.js";import{getQueryResultExtent as I,getQueryBoundingRects as v,QueryEngine as q}from"../../data/QueryEngine.js";import{queryCapabilities as R}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as b}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as C}from"../../data/queryUtils.js";import{createFileProvider as E}from"../parquet/createFileProvider.js";import{createDrawingInfo as O}from"./clientSideDefaults.js";import{getParquetFileId as T,getParquetRowId as P,getParquetObjectId as j}from"./parquetIdUtils.js";import Q from"../../../support/Field.js";import N from"../../../support/FieldsIndex.js";import{isNumericField as A}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as G}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as B,fromParquetJSONGeometryType as M,toParquetJSONGeometryType as z}from"../../../support/parquetUtils.js";import{loadParquetModule as D}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as k}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as U}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as W}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as J}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const Z=new k,L=4,H="__OBJECTID",Y=new TextDecoder,X=8e3,$=2e7,K=8,ee=2,te=20;class re{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){n(e),await this._fill(e);const t=await se(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<K;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=K?K:ee;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new ie(t.id,this._createFileStream(t,e));return this._streams.push(r),r}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const r=(this._streamIndex+t)%e,s=this._streams[r];if(s.canRead)return this._streamIndex=(r+1)%e,s}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function se(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class ie{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,r=await t.next(e);return null==r?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:r}}finally{this._readCount--}}}class ae{constructor(){this._queue=new o({concurrency:L,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=E(e.provider,null,()=>this._customParameters);const r=await this._provider.getMetadata(),a=await B(r,{fields:e.fields?.map(e=>Q.fromJSON(e)),geometryEncoding:e.geometryEncoding?G(e.geometryEncoding):null,geometryType:e.geometryType?M(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=l.WGS84),n={geometry:a.geometryEncoding?{geometryType:z(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=Se(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:Se(null)};const u=await o[0].file;a.file=u;const{fields:c}=a;if(null==c)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",c);c.push(new Q({name:H,type:"oid",alias:H}));for(const s of c){const e=u.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const p=new N(c.map(e=>e.toJSON()));this._fieldsIndex=p;const d=z(a.geometryType??"point");return this._metadata=W.createFeature({fieldsIndex:p.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:H},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:H},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:O(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=E(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){if(this._validateQuery(e),Ie(e)||(e.resultRecordCount=e.resultRecordCount?Math.min(e.resultRecordCount,X):X,e.resultOffset=e.resultOffset??0),e.outStatistics)return this._queryStatistics(e,t);e.returnDistinctValues&&(e.returnGeometry=void 0);return(await this._enqueueQuery(e,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!ne(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!ne(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryAttributeBins(e,t={}){throw new s("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(e,t){const s=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!ne(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const a=c(p(),m),n=p(),o=await this._enqueueQuery(s,t);let u=0;for(const r of o.items)r.getBounds(n)&&(d(a,n),u+=1);return{count:u,extent:I(a,i,s.outSR?r(s.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=await this._getCandidateFiles(e),s=new re(r,async(t,r)=>{const s=await t.file,i=await this._createParquetQuery(s,t.id,e);return s.executeQuery(i,r)}),i=this._streamIdCounter++,n=a(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:s,handle:n}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=this._streams.get(e);if(!r)return{result:null};const s=await r.stream.next(t.signal);if(null==s)return r.handle.remove(),this._streams.delete(e),{result:null};const i=s.chunk.serialize().buffer,a={fileId:s.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){const{result:r}=await this.getStreamNext(e,t);if(null==r)return null;const s=(await D()).ParquetChunk.deserialize(new Uint8Array(r.buffer)),i=new J(this._metadata,this._indexMap,s,r.fileId),a=[];for(;i.next();){const e=S(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const a=await this._getFileInfoById(e),n=await a.file;return(await n.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),r=await this._getSpatialFilePruning(e);if(null==r)return t;const s=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,r));return"xz"===r.type?he(s,r):s}async _queryStatistics(e,t){const r=await C({...e},null,this._queryEngineParams.spatialReference);if(r.returnGeometry=void 0,oe(r,this._fieldsIndex)){const e=await this._getStatisticsFromFiles(r);if(e)return e}return(await this._enqueueQuery(r,t)).createQueryResponse()}async _getStatisticsFromFiles(e){const t=await this._provider.getFiles(),r={},s=[];for(const i of e.outStatistics??[]){const e=ce(i,t);if(!e.available)return null;r[i.outStatisticFieldName]=e.value,s.push(le(i,this._fieldsIndex))}return{fields:s,features:[{attributes:r}]}}async _getSpatialFilePruning(e){if("tile"!==e.type&&("arcade"!==e.type||null==e.extent))return null;const t=this._displayOptimization,r=t?.index;if(null==r)return null;const s=e.outSpatialReference.wkid;if(null==r.wkid||null==s)return null;const i=r.wkid,a=await D();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,te,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,o)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=ye(e,t);return null==r||we(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=_e(e,t);return null==r||null==s||xe(r,s,t)}}}async _tryDeriveParquetFullExtent(r){if(!r.spatialReference)return null;if(null==this._fullExtent&&"location"===r.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:a,yField:n}=r.geometryEncoding,o=c(p(),m);for(const r of i){const i=await r.file;for(const r of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,r.columnDescriptorForAttribute(a),!1),s=e(i,r.columnDescriptorForAttribute(n),!1),u=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];f(o,u),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:r.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const r of t)if(r.id===e)return r;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,r){const s=(await D()).Query.new();return"tile"===r.type?(s.setExtent(r.extent),s.setQuantizationTransform(r.transform),s.setScale(r.scale)):"arcade"===r.type&&null!=r.extent&&s.setExtent(r.extent),s.setOutFields(r.outFields.filter(e=>null!=this._indexMap[e])),s.setOutSpatialReference(r.outSpatialReference.wkid),s.setReturnGeometry(r.returnGeometry),r.where&&await this._setWhereClause(s,e,t,r.where),s}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r,i){const a=this._indexMap,n=this._fieldsIndex,o={getAttribute(e,s){const i=a[s];if(null==i){const t=n.get(s);if("__OBJECTID"===t?.name){const t=e.row+e.rowGroupStart;return j(r,t)}return null}const o=t.readAttribute(e.rowGroup,e.row,i);if(null==o)return null;const u=n.get(s);return"esriFieldTypeString"===u.type||"esriFieldTypeDateOnly"===u.type||"esriFieldTypeTimeOnly"===u.type||"esriFieldTypeTimestampOffset"===u.type?Y.decode(o):o}},l=await u(i,this._fieldsIndex);if(!l.isStandardized)throw new s("sql-parse-error","expression is not standardized");const c=(e,t,r)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:r},o,null),p=l.fieldNames.map(e=>n.get(e)).filter(e=>e&&null!=this._indexMap[e?.name]);e.setWhere(i),e.setWhereEvaluator(c),e.setWhereFields(p.map(e=>e.name))}async*_queryChunks(e,t){const r=await D(),s=await this._provider.getFiles(),i=await this._getRequiredFields(e),a=this._tryGetGeneralizedGeometryScale(e);for(const o of s){const s=await o.file,u=r.Query.new();u.setOutFields(i),(e.geometry||e.returnGeometry)&&u.setReturnGeometry(!0),null!=a&&u.setScale(a);const l=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,c=l.wkid;if(e.geometry&&(x(l)||F(l))){const t=y(g(),h);for(const r of v(e.geometry))_(t,r);u.setOutSpatialReference(c),u.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}e.where&&await this._setWhereClause(u,s,o.id,e.where);const p=await s.executeQuery(u),d=[],f=p.next(t);for(let e=0;e<L;e++)d.push(p.next(t));let m=await f;for(;null!=m;){n(t);const e=new J(this._metadata,this._indexMap,m,o.id),r=me([new V(e,null,0,!1)],this._queryEngineParams),s=d.shift();d.push(p.next(t)),yield r,m=await s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=T(t),s=P(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,a]of r.entries()){const r=await this._executeFileIdQuery(e,i,a,t);for(const e of r)s.push(e)}return new b(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}let r=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;if(r>$)throw new s("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");const a={...e};e.where=void 0,e.resultRecordCount=void 0,e.resultOffset=void 0;const n=[];for await(const s of this._queryChunks(a,t)){const a=await s.executeQueryForOpaqueFeatures(e,t);if(a.length>i){const t=a.slice(i,Math.min(i+r,a.length));for(const e of t)n.push(e);if(i=0,r-=t.length,0===r)return new b(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=a.length}return new b(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getRequiredFields(e),a=(await D()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),o=await n.executeQuery(a,s);let u=await o.next(s),l=0;const c=[];for(;null!=u;){const e=new J(this._metadata,this._indexMap,u,t),r=new V(e,null,l++,!1);c.push(r),u=await o.next(s)}return me(c,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getRequiredFields(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);else if(e.outFields)for(const r of e.outFields)t.add(r);return(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e])}_tryGetGeneralizedGeometryScale(e){if(!this._displayOptimization)return null;const t=e.outSR??this._queryEngineParams.spatialReference;if(!x(t)&&!F(t))return null;const r=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return r?w(r,t):null}}function ne(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function oe(e,t){return!!e.outStatistics?.length&&!ne(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ue(e,t))}function ue(e,t){switch(e.statisticType){case"count":return"1"===e.onStatisticField||null!=t.get(e.onStatisticField);case"min":case"max":{const r=t.get(e.onStatisticField);return null!=r&&A(r)}default:return!1}}function le(e,t){const r="exceedslimit"!==e.statisticType?t.get(e.onStatisticField):null,s="min"!==e.statisticType&&"max"!==e.statisticType||"esriFieldTypeDate"!==r?.type?"esriFieldTypeDouble":r.type;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:s}}function ce(e,t){switch(e.statisticType){case"count":return pe(e,t);case"min":return de(e,t,Math.min);case"max":return de(e,t,Math.max);default:return{available:!1,value:null}}}function pe(e,t){if("count"!==e.statisticType)return{available:!1,value:null};if("1"===e.onStatisticField)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let r=0;for(const s of t){const t=s.statistics.statistics.get(e.onStatisticField);if(null==t||null==t.nullCount)return{available:!1,value:null};r+=s.statistics.rowCount-t.nullCount}return{available:!0,value:r}}function de(e,t,r){if("min"!==e.statisticType&&"max"!==e.statisticType)return{available:!1,value:null};let s=null;const i="min"===e.statisticType?"minValue":"maxValue";for(const a of t){const t=a.statistics.statistics.get(e.onStatisticField);if(null==t)return{available:!1,value:null};const n=fe(t[i]);null!=n&&(s=null==s?n:r(s,n))}return{available:!0,value:s}}function fe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function me(e,t){const r=new U;for(const s of e)r.insert(s);return new q({...t,featureStore:r})}function ye(e,t){return e.statistics.statistics.get(t.fieldName)??null}function he(e,t){return e.slice().sort((e,r)=>{const s=ge(e,t),i=ge(r,t);return s===i?0:s<i?-1:1})}function ge(e,t){const r=ye(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=Fe(r.minValue),i=Fe(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function _e(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function we(e,t){const r=Fe(e.minValue),s=Fe(e.maxValue);return null==r||null==s||t.intersects(r,s)}function xe(e,t,r){const s=Fe(e.minValue),i=Fe(e.maxValue),a=Fe(t.minValue),n=Fe(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function Fe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Se(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...R,maxRecordCount:X,supportsOrderBy:r,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function Ie(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{ae as default};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{toConst as r}from"../../../../core/compilerUtils.js";import s from"../../../../core/Error.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{onAbortOrThrow as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{parseWhereClause as u}from"../../../../core/sql.js";import l from"../../../../geometry/SpatialReference.js";import{set as c,create as p,expandWithAABB as d,expandWithRect as f,negativeInfinity as m}from"../../../../geometry/support/aaBoundingBox.js";import{copy as y,negativeInfinity as h,create as g,expandWithRect as _}from"../../../../geometry/support/aaBoundingRect.js";import{getScaleForResolution as w}from"../../../../geometry/support/scaleUtils.js";import{isWebMercator as x,isWGS84 as F}from"../../../../geometry/support/spatialReferenceUtils.js";import{convertToGeometry as S}from"../../featureConversionUtils.js";import{getQueryResultExtent as I,getQueryBoundingRects as v,QueryEngine as q}from"../../data/QueryEngine.js";import{queryCapabilities as R}from"../../data/QueryEngineCapabilities.js";import{QueryEngineResult as b}from"../../data/QueryEngineResult.js";import{normalizeQueryLike as C}from"../../data/queryUtils.js";import{createFileProvider as E}from"../parquet/createFileProvider.js";import{createDrawingInfo as O}from"./clientSideDefaults.js";import{getParquetFileId as T,getParquetRowId as P,getParquetObjectId as j}from"./parquetIdUtils.js";import Q from"../../../support/Field.js";import N from"../../../support/FieldsIndex.js";import{isNumericField as A}from"../../../support/fieldUtils.js";import{fromParquetGeometryEncodingJSON as G}from"../../../support/parquetEncodingUtils.js";import{completeParquetLayerInfo as B,fromParquetJSONGeometryType as M,toParquetJSONGeometryType as z}from"../../../support/parquetUtils.js";import{loadParquetModule as D}from"../../../../libs/parquet/loadParquetModule.js";import{FeatureStoreQueryAdapter as k}from"../../../../views/2d/layers/features/FeatureStoreQueryAdapter.js";import{FeatureSnapshotSourceChunk as V}from"../../../../views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js";import{FeatureSourceChunkStore as U}from"../../../../views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js";import{FeatureMetadata as W}from"../../../../views/2d/layers/features/support/FeatureMetadata.js";import{FeatureSetReaderParquet as J}from"../../../../views/2d/layers/features/support/FeatureSetReaderParquet.js";const Z=new k,L=4,H="__OBJECTID",Y=new TextDecoder,X=8e3,$=2e7,K=8,ee=2,te=20;class re{constructor(e,t){this._files=e,this._createFileStream=t,this._fileIndex=0,this._streamIndex=0,this._streams=[],this._pending=new Set,this._resolvedCount=0}async next(e){for(await this._fill(e);this._pending.size>0;){n(e),await this._fill(e);const t=await se(this._pending);if(this._pending.delete(t.read),this._resolvedCount++,null!=t.chunk)return t.chunk}return null}async _fill(e){for(this._removeDone();this._pending.size<K;){const t=this._getOrCreateNextStream(e);if(null==t)return;this._pending.add(t.read(e))}}_getOrCreateNextStream(e){const t=this._resolvedCount>=K?K:ee;if(this._fileIndex<this._files.length&&this._streams.length<t){const t=this._files[this._fileIndex++],r=new ie(t.id,this._createFileStream(t,e));return this._streams.push(r),r}return this._getNextStream()}_getNextStream(){const e=this._streams.length;for(let t=0;t<e;t++){const r=(this._streamIndex+t)%e,s=this._streams[r];if(s.canRead)return this._streamIndex=(r+1)%e,s}return null}_removeDone(){let e=this._streamIndex;for(let t=this._streams.length-1;t>=0;t--)this._streams[t].done&&(this._streams.splice(t,1),t<e&&e--);this._streamIndex=this._streams.length>0?e%this._streams.length:0}}function se(e){return Promise.race(Array.from(e,async e=>({read:e,chunk:await e})))}class ie{constructor(e,t){this._fileId=e,this._stream=t,this._readCount=0,this._reachedEnd=!1}get canRead(){return!this._reachedEnd}get done(){return this._reachedEnd&&0===this._readCount}async read(e){this._readCount++;try{const t=await this._stream,r=await t.next(e);return null==r?(this._reachedEnd=!0,null):{fileId:this._fileId,chunk:r}}finally{this._readCount--}}}class ae{constructor(){this._queue=new o({concurrency:L,process:(e,t)=>this._executeQuery(e,t)}),this._streams=new Map,this._streamIdCounter=0,this._indexMap={}}async load(e){const t=e.spatialReference?l.fromJSON(e.spatialReference):void 0;if(t&&!t.isWGS84&&!t.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");this._customParameters=e.customParameters,this._provider=E(e.provider,null,()=>this._customParameters);const r=await this._provider.getMetadata(),a=await B(r,{fields:e.fields?.map(e=>Q.fromJSON(e)),geometryEncoding:e.geometryEncoding?G(e.geometryEncoding):null,geometryType:e.geometryType?M(e.geometryType):null,displayOptimization:e.displayOptimization,spatialReference:t});if(!a.fields)throw new s("parquet:unsupported","Fields must be defined");let n;if(a.spatialReference&&a.geometryType){if(!a.spatialReference)throw new s("parquet:unsupported","SpatialReference must be defined");if(!a.spatialReference.isGeographic&&!a.spatialReference.isWebMercator)throw new s("parquet:unsupported-projection","Only WGS84 and Web Mercator are supported");a.spatialReference.isGeographic&&!a.spatialReference.isWGS84&&(i.getLogger("parquet:unsupported-projection").warn("Found a geographic projection that is not WGS84. Handling as WGS84.",{spatialReference:a.spatialReference}),a.spatialReference=l.WGS84),n={geometry:a.geometryEncoding?{geometryType:z(a.geometryType),spatialReference:a.spatialReference.toJSON(),encoding:a.geometryEncoding.toJSON()}:null,displayOptimization:a.displayOptimization}}this.setCustomParameters(e.customParameters),this._displayOptimization=a.displayOptimization,await this._provider.updateGeometryInfo(n),this._capabilities=Se(await this._getFileStatistics());const o=await this._provider.getFiles();if(!o.length)return{layerDefinition:{},capabilities:Se(null)};const u=await o[0].file;a.file=u;const{fields:c}=a;if(null==c)throw new s("parquet-layer:missing-metadata","Unable to create parquet source: cannot infer fields",c);c.push(new Q({name:H,type:"oid",alias:H}));for(const s of c){const e=u.getColumnId(s.name);null!=e&&(this._indexMap[s.name]=e)}const p=new N(c.map(e=>e.toJSON()));this._fieldsIndex=p;const d=z(a.geometryType??"point");return this._metadata=W.createFeature({fieldsIndex:p.toJSON(),geometryType:d,hasZ:!1,hasM:!1,featureIdInfo:{type:"object-id",fieldName:H},subtypes:null,subtypeField:null,types:null,typeIdField:null,globalIdField:null,spatialReference:a.spatialReference,outSpatialReference:null,timeInfo:null,timeReferenceUnknownClient:null,dateFieldsTimeZone:null}),this._queryEngineParams={fieldsIndex:this._metadata.fieldsIndex,geometryType:d,featureIdInfo:{type:"object-id",fieldName:H},hasM:!1,hasZ:!1,spatialReference:a.spatialReference?.toJSON()??{wkid:4326},aggregateAdapter:null,timeInfo:null,definitionExpression:null},this._fullExtent=r?.extent?r.extent:await this._tryDeriveParquetFullExtent(a),{capabilities:this._capabilities,layerDefinition:{fields:a.fields?.map(e=>e.toJSON()),drawingInfo:O(d),extent:this._fullExtent??void 0,geometryType:d,geometryEncoding:a.geometryEncoding?.toJSON(),displayOptimization:a.displayOptimization}}}destroy(){this._provider.destroy(),this._queue.destroy();for(const{handle:e}of this._streams.values())e.remove();this._streams.clear()}setCustomParameters(e){this._customParameters=e}getIndexMap(){return this._indexMap}async updateFileProvider(e){this._provider=E(e,this._provider.getGeometryInfo(),()=>this._customParameters)}async queryFeatures(e,t){const r=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),Ie(r)||(r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,X):X,r.resultOffset=r.resultOffset??0),r.outStatistics)return this._queryStatistics(r,t);r.returnDistinctValues&&(r.returnGeometry=void 0);return(await this._enqueueQuery(r,t)).createQueryResponse()}async queryFeatureCount(e,t){const r=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!ne(r))return this._getFeatureCount();r.outFields=void 0,r.returnGeometry=void 0;return(await this._enqueueQuery(r,t)).createQueryResponseForCount()}async queryObjectIds(e,t){const r=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(r),!ne(r))return Array.from({length:await this._getFeatureCount()},(e,t)=>t);r.resultRecordCount=r.resultRecordCount?Math.min(r.resultRecordCount,8e3):8e3,r.resultOffset=r.resultOffset??0,r.returnGeometry=void 0,r.outFields=void 0;return(await this._enqueueQuery(r,t)).items.map(e=>e.getObjectId())}async queryAttributeBins(e,t={}){throw new s("parquet:unsupported","queryAttributeBins not supported.")}async queryExtent(e,t){const s=await C(e,null,this._queryEngineParams.spatialReference);if(this._validateQuery(s),this._fullExtent&&!ne(s))return{count:await this._getFeatureCount(),extent:this._fullExtent};const i=r(this._metadata.spatialReference);s.returnGeometry=!0,s.outFields=void 0;const a=c(p(),m),n=p(),o=await this._enqueueQuery(s,t);let u=0;for(const r of o.items)r.getBounds(n)&&(d(a,n),u+=1);return{count:u,extent:I(a,i,s.outSR?r(s.outSR):i.toJSON(),i,!1)}}async queryStream(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=await this._getCandidateFiles(e),s=new re(r,async(t,r)=>{const s=await t.file,i=await this._createParquetQuery(s,t.id,e);return s.executeQuery(i,r)}),i=this._streamIdCounter++,n=a(t.signal,e=>{const t=this._streams.get(i);null!=t&&(t.handle.remove(),this._streams.delete(i))});return this._streams.set(i,{stream:s,handle:n}),i}async getStreamNext(e,t){if(!t.signal)throw new Error("InternalError: AbortSignal must be passed");const r=this._streams.get(e);if(!r)return{result:null};const s=await r.stream.next(t.signal);if(null==s)return r.handle.remove(),this._streams.delete(e),{result:null};const i=s.chunk.serialize().buffer,a={fileId:s.fileId,buffer:i};return i instanceof ArrayBuffer?{result:a,transferList:[i]}:{result:a}}async getStreamNextFeatures(e,t){const{result:r}=await this.getStreamNext(e,t);if(null==r)return null;const s=(await D()).ParquetChunk.deserialize(new Uint8Array(r.buffer)),i=new J(this._metadata,this._indexMap,s,r.fileId),a=[];for(;i.next();){const e=S(i.readGeometryWorldSpace(),i.geometryType,i.hasZ,i.hasM),t=i.readAttributes();a.push({attributes:t,geometry:e})}return{features:a}}async createPatch(e,t,r,s,i){if(!i.signal)throw new Error("InternalError: AbortSignal must be passed");const a=await this._getFileInfoById(e),n=await a.file;return(await n.createChunkPatch(t,r,s,i.signal)).serialize().buffer}async _getCandidateFiles(e){const t=await this._provider.getFiles(),r=await this._getSpatialFilePruning(e);if(null==r)return t;const s=t.filter(e=>this._mayIncludeFileForSpatialPruning(e,r));return"xz"===r.type?he(s,r):s}async _queryStatistics(e,t){const r=await C({...e},null,this._queryEngineParams.spatialReference);if(r.returnGeometry=void 0,oe(r,this._fieldsIndex)){const e=await this._getStatisticsFromFiles(r);if(e)return e}return(await this._enqueueQuery(r,t)).createQueryResponse()}async _getStatisticsFromFiles(e){const t=await this._provider.getFiles(),r={},s=[];for(const i of e.outStatistics??[]){const e=ce(i,t);if(!e.available)return null;r[i.outStatisticFieldName]=e.value,s.push(le(i,this._fieldsIndex))}return{fields:s,features:[{attributes:r}]}}async _getSpatialFilePruning(e){if("tile"!==e.type&&("arcade"!==e.type||null==e.extent))return null;const t=this._displayOptimization,r=t?.index;if(null==r)return null;const s=e.outSpatialReference.wkid;if(null==r.wkid||null==s)return null;const i=r.wkid,a=await D();switch(r.type){case"xz":return{type:"xz",fieldName:r.code,intersects:(t,n)=>a.queryIntersectsXZStatistics(r.fullExtent,e.extent,s,i,te,t,n)};case"z":return{type:"xy",xFieldName:r.xColumn,yFieldName:r.yColumn,intersects:(t,r,n,o)=>a.queryIntersectsXYStatistics(e.extent,s,i,t,r,n,o)}}}_mayIncludeFileForSpatialPruning(e,t){switch(t.type){case"xz":{const r=ye(e,t);return null==r||we(r,t)}case"xy":{const{xStatistics:r,yStatistics:s}=_e(e,t);return null==r||null==s||xe(r,s,t)}}}async _tryDeriveParquetFullExtent(r){if(!r.spatialReference)return null;if(null==this._fullExtent&&"location"===r.geometryEncoding?.type){const i=await this._provider.getFiles(),{xField:a,yField:n}=r.geometryEncoding,o=c(p(),m);for(const r of i){const i=await r.file;for(const r of i.rowGroups()){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,r.columnDescriptorForAttribute(a),!1),s=e(i,r.columnDescriptorForAttribute(n),!1),u=[t.minValue(),s.minValue(),t.maxValue(),s.maxValue()];f(o,u),r.free()}catch(s){i.error=s,i.hasError=!0}finally{t(i)}}}return{xmin:o[0],ymin:o[1],xmax:o[3],ymax:o[4],spatialReference:r.spatialReference?.toJSON()}}return null}async _getFileInfoById(e){const t=await this._provider.getFiles();for(const r of t)if(r.id===e)return r;throw new Error(`InternalError: File ${e} does not exist`)}async _getFileStatistics(){return{featureCount:await this._getFeatureCount(),byteLength:await this._getByteLength()}}async _getFile(e){return(await this._getFileInfoById(e)).file}async _createParquetQuery(e,t,r){const s=(await D()).Query.new();return"tile"===r.type?(s.setExtent(r.extent),s.setQuantizationTransform(r.transform),s.setScale(r.scale)):"arcade"===r.type&&null!=r.extent&&s.setExtent(r.extent),s.setOutFields(r.outFields.filter(e=>null!=this._indexMap[e])),s.setOutSpatialReference(r.outSpatialReference.wkid),s.setReturnGeometry(r.returnGeometry),r.where&&await this._setWhereClause(s,e,t,r.where),s}async _getFeatureCount(){return(await this._provider.getFiles()).map(e=>e.statistics.rowCount).reduce((e,t)=>e+t,0)}async _getByteLength(){return(await this._provider.getFiles()).map(e=>e.statistics.byteSize).reduce((e,t)=>e+t,0)}_validateQuery(e){if(!this._capabilities.query.supportsStatistics&&e.outStatistics)throw new s("parquet:unsupported","Statistics queries are not supported",{query:e});if(!this._capabilities.query.supportsOrderBy&&e.orderByFields?.length)throw new s("parquet:unsupported","Queries using orderBy are not supported",{query:e});if(!this._capabilities.query.supportsDistinct&&e.returnDistinctValues)throw new s("parquet:unsupported","Queries using returnDistinctValues are not supported",{query:e})}async _setWhereClause(e,t,r,i){const a=this._indexMap,n=this._fieldsIndex,o={getAttribute(e,s){const i=a[s];if(null==i){const t=n.get(s);if("__OBJECTID"===t?.name){const t=e.row+e.rowGroupStart;return j(r,t)}return null}const o=t.readAttribute(e.rowGroup,e.row,i);if(null==o)return null;const u=n.get(s);return"esriFieldTypeString"===u.type||"esriFieldTypeDateOnly"===u.type||"esriFieldTypeTimeOnly"===u.type||"esriFieldTypeTimestampOffset"===u.type?Y.decode(o):o}},l=await u(i,this._fieldsIndex);if(!l.isStandardized)throw new s("sql-parse-error","expression is not standardized");const c=(e,t,r)=>l.testFeatureCompiled({rowGroup:e,row:t,rowGroupStart:r},o,null),p=l.fieldNames.map(e=>n.get(e)).filter(e=>e&&null!=this._indexMap[e?.name]);e.setWhere(i),e.setWhereEvaluator(c),e.setWhereFields(p.map(e=>e.name))}async*_queryChunks(e,t){const r=await D(),s=await this._provider.getFiles(),i=await this._getRequiredFields(e),a=this._tryGetGeneralizedGeometryScale(e);for(const o of s){const s=await o.file,u=r.Query.new();u.setOutFields(i),(e.geometry||e.returnGeometry)&&u.setReturnGeometry(!0),null!=a&&u.setScale(a);const l=e.geometry?.spatialReference??this._queryEngineParams.spatialReference,c=l.wkid;if(e.geometry&&(x(l)||F(l))){const t=y(g(),h);for(const r of v(e.geometry))_(t,r);u.setOutSpatialReference(c),u.setExtent({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3]})}e.where&&await this._setWhereClause(u,s,o.id,e.where);const p=await s.executeQuery(u),d=[],f=p.next(t);for(let e=0;e<L;e++)d.push(p.next(t));let m=await f;for(;null!=m;){n(t);const e=new J(this._metadata,this._indexMap,m,o.id),r=me([new V(e,null,0,!1)],this._queryEngineParams),s=d.shift();d.push(p.next(t)),yield r,m=await s}}}_enqueueQuery(e,t){return this._queue.push(e,t)}async _executeQuery(e,t){if(e.objectIds?.length){const r=new Map;for(const t of e.objectIds){const e=T(t),s=P(t);let i=r.get(e);i||(i=[],r.set(e,i)),i.push(s)}const s=[];for(const[i,a]of r.entries()){const r=await this._executeFileIdQuery(e,i,a,t);for(const e of r)s.push(e)}return new b(s,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}let r=e.resultRecordCount??await this._getFeatureCount(),i=e.resultOffset??0;if(r>$)throw new s("parquet:cannot-execute-query","Unable to execute query, dataset is too large.");const a={...e};e.where=void 0,e.resultRecordCount=void 0,e.resultOffset=void 0;const n=[];for await(const s of this._queryChunks(a,t)){const a=await s.executeQueryForOpaqueFeatures(e,t);if(a.length>i){const t=a.slice(i,Math.min(i+r,a.length));for(const e of t)n.push(e);if(i=0,r-=t.length,0===r)return new b(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}else i-=a.length}return new b(n,e,{fieldsIndex:this._fieldsIndex,geometryType:this._metadata.geometryType,spatialReference:this._queryEngineParams.spatialReference,hasM:!1,hasZ:!1,featureAdapter:Z,featureIdInfo:this._queryEngineParams.featureIdInfo})}async _executeFileIdQuery(e,t,r,s){const i=await this._getRequiredFields(e),a=(await D()).Query.new();a.setOutFields(i),a.setReturnGeometry(!!e.returnGeometry),a.setIds(new Uint32Array(r));const n=await this._getFile(t),o=await n.executeQuery(a,s);let u=await o.next(s),l=0;const c=[];for(;null!=u;){const e=new J(this._metadata,this._indexMap,u,t),r=new V(e,null,l++,!1);c.push(r),u=await o.next(s)}return me(c,this._queryEngineParams).executeQueryForOpaqueFeatures(e,s)}async _getRequiredFields(e){const t=new Set;if(e.outStatistics)for(const r of e.outStatistics)null!=r.onStatisticField&&t.add(r.onStatisticField);else if(e.outFields)for(const r of e.outFields)t.add(r);return(t.has("*")?this._fieldsIndex.fields.map(e=>e.name):Array.from(t)).filter(e=>null!=this._indexMap[e])}_tryGetGeneralizedGeometryScale(e){if(!this._displayOptimization)return null;const t=e.outSR??this._queryEngineParams.spatialReference;if(!x(t)&&!F(t))return null;const r=e.quantizationParameters?.tolerance??e.maxAllowableOffset;return r?w(r,t):null}}function ne(e){for(const t in e){const r=t;switch(r){case"resultOffset":case"resultRecordCount":case"aggregateIds":case"distance":case"gdbVersion":case"geometry":case"having":case"timeExtent":case"objectIds":case"historicMoment":case"where":return null!=e[r]}}return!1}function oe(e,t){return!!e.outStatistics?.length&&!ne(e)&&!e.groupByFieldsForStatistics?.length&&!e.orderByFields?.length&&!e.returnDistinctValues&&!e.returnAggIds&&e.outStatistics.every(e=>ue(e,t))}function ue(e,t){switch(e.statisticType){case"count":return"1"===e.onStatisticField||null!=t.get(e.onStatisticField);case"min":case"max":{const r=t.get(e.onStatisticField);return null!=r&&A(r)}default:return!1}}function le(e,t){const r="exceedslimit"!==e.statisticType?t.get(e.onStatisticField):null,s="min"!==e.statisticType&&"max"!==e.statisticType||"esriFieldTypeDate"!==r?.type?"esriFieldTypeDouble":r.type;return{name:e.outStatisticFieldName,alias:e.outStatisticFieldName,type:s}}function ce(e,t){switch(e.statisticType){case"count":return pe(e,t);case"min":return de(e,t,Math.min);case"max":return de(e,t,Math.max);default:return{available:!1,value:null}}}function pe(e,t){if("count"!==e.statisticType)return{available:!1,value:null};if("1"===e.onStatisticField)return{available:!0,value:t.reduce((e,t)=>e+t.statistics.rowCount,0)};let r=0;for(const s of t){const t=s.statistics.statistics.get(e.onStatisticField);if(null==t||null==t.nullCount)return{available:!1,value:null};r+=s.statistics.rowCount-t.nullCount}return{available:!0,value:r}}function de(e,t,r){if("min"!==e.statisticType&&"max"!==e.statisticType)return{available:!1,value:null};let s=null;const i="min"===e.statisticType?"minValue":"maxValue";for(const a of t){const t=a.statistics.statistics.get(e.onStatisticField);if(null==t)return{available:!1,value:null};const n=fe(t[i]);null!=n&&(s=null==s?n:r(s,n))}return{available:!0,value:s}}function fe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function me(e,t){const r=new U;for(const s of e)r.insert(s);return new q({...t,featureStore:r})}function ye(e,t){return e.statistics.statistics.get(t.fieldName)??null}function he(e,t){return e.slice().sort((e,r)=>{const s=ge(e,t),i=ge(r,t);return s===i?0:s<i?-1:1})}function ge(e,t){const r=ye(e,t);if(null==r)return Number.POSITIVE_INFINITY;const s=Fe(r.minValue),i=Fe(r.maxValue);return null==s||null==i||i<s?Number.POSITIVE_INFINITY:i-s}function _e(e,t){return{xStatistics:e.statistics.statistics.get(t.xFieldName)??null,yStatistics:e.statistics.statistics.get(t.yFieldName)??null}}function we(e,t){const r=Fe(e.minValue),s=Fe(e.maxValue);return null==r||null==s||t.intersects(r,s)}function xe(e,t,r){const s=Fe(e.minValue),i=Fe(e.maxValue),a=Fe(t.minValue),n=Fe(t.maxValue);return null==s||null==i||null==a||null==n||r.intersects(s,i,a,n)}function Fe(e){return"number"==typeof e&&Number.isFinite(e)?e:null}function Se(e){const t=e?.featureCount;let r=!1;return null!=t&&t<has("parquetlayer-full-query-feature-count")&&(r=!0),{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,isBranchVersioned:!1,supportedCurveTypes:[],supportsAttachment:!1,supportsM:!1,supportsTrueCurve:!1,supportsZ:!1},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryBins:!1,supportsQueryPivot:!1,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:!1,supportsExceedsLimitStatistics:!1,supportsAsyncConvert3D:!1},query:{...R,maxRecordCount:X,supportsOrderBy:r,supportsDistinct:!0,supportsStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1}},queryAttributeBins:{supportsDate:!1,supportsFixedInterval:!1,supportsAutoInterval:!1,supportsFixedBoundaries:!1,supportsStackBy:!1,supportsSplitBy:!1,supportsSnapToData:!1,supportsReturnFullIntervalBin:!1,supportsFirstDayOfWeek:!1,supportsNormalization:!1},queryRelated:{supportsCount:!1,supportsOrderBy:!1,supportsPagination:!1,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsGeometryUpdate:!1,supportsGlobalId:!1,supportsTrueCurveUpdate:!1,supportsTrueCurveUpdateByTrueCurveClientsOnly:!0,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsUploadWithItemId:!1,supportsUpdateWithoutM:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}function Ie(e){return!!(e.objectIds?.length||e.outStatistics||e.orderByFields?.length||e.returnDistinctValues)}export{ae as default};
|
|
@@ -57,7 +57,6 @@ export type CircuitVerifyProperties = Pick<VerifyCircuitsParametersProperties, "
|
|
|
57
57
|
* A CircuitManager provides access to circuit management capabilities for a telecom domain network
|
|
58
58
|
* in a utility network.
|
|
59
59
|
*
|
|
60
|
-
* @beta
|
|
61
60
|
* @since 4.34
|
|
62
61
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
63
62
|
* @see [UnitIdentifierManager](https://developers.arcgis.com/javascript/latest/references/core/networks/UnitIdentifierManager/)
|
|
@@ -124,6 +123,12 @@ export default class CircuitManager extends JSONSupport {
|
|
|
124
123
|
*
|
|
125
124
|
* @param circuit - The circuit to be altered.
|
|
126
125
|
* @returns Resolves when the circuit is successfully altered.
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const circuits = await circuitManager.queryCircuits(["FIRSTCIRCUIT"]);
|
|
129
|
+
* circuits[0].name = "NewCircuitName";
|
|
130
|
+
* await circuitManager.alter(circuits[0]);
|
|
131
|
+
* ```
|
|
127
132
|
*/
|
|
128
133
|
alter(circuit: Circuit): Promise<void>;
|
|
129
134
|
/**
|
|
@@ -135,6 +140,122 @@ export default class CircuitManager extends JSONSupport {
|
|
|
135
140
|
*
|
|
136
141
|
* @param circuit - The circuit to create.
|
|
137
142
|
* @returns Resolves when the circuit is successfully created.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* // Create a non-sectioned circuit with user-defined attributes.
|
|
146
|
+
* const startingLocation = new CircuitLocation({
|
|
147
|
+
* sourceId: 20,
|
|
148
|
+
* globalId: "{8A1B5A33-3EBA-42CC-9085-31B22DAFE5DC}",
|
|
149
|
+
* firstUnit: 1,
|
|
150
|
+
* lastUnit: 1,
|
|
151
|
+
* });
|
|
152
|
+
*
|
|
153
|
+
* const stoppingLocation = new CircuitLocation({
|
|
154
|
+
* sourceId: 20,
|
|
155
|
+
* globalId: "{F081B917-499E-43FC-AEC9-7C1B313BF128}",
|
|
156
|
+
* firstUnit: 1,
|
|
157
|
+
* lastUnit: 1,
|
|
158
|
+
* });
|
|
159
|
+
*
|
|
160
|
+
* const attributes = {
|
|
161
|
+
* attributeOne: 1,
|
|
162
|
+
* attributeTwo: "Two",
|
|
163
|
+
* attributeThree: new Date().getTime(),
|
|
164
|
+
* attributeFour: null,
|
|
165
|
+
* };
|
|
166
|
+
*
|
|
167
|
+
* const circuit = new Circuit({
|
|
168
|
+
* name: "FIRSTCIRCUIT",
|
|
169
|
+
* circuitType: "physical",
|
|
170
|
+
* startLocation: startingLocation,
|
|
171
|
+
* stopLocation: stoppingLocation,
|
|
172
|
+
* attributes: attributes,
|
|
173
|
+
* });
|
|
174
|
+
*
|
|
175
|
+
* await circuitManager.create(circuit);
|
|
176
|
+
* ```
|
|
177
|
+
* @example
|
|
178
|
+
* To create a sectioned circuit, provide a `Map` to represent the logical connectivity between
|
|
179
|
+
* sections in a circuit. This map should represent a directed adjacency list where each key is
|
|
180
|
+
* a `CircuitSection` that connects to other `CircuitSection` instances indicated by the key's
|
|
181
|
+
* value. The map type is `Map<CircuitSection, CircuitSection[]>`.
|
|
182
|
+
*
|
|
183
|
+
* In this example, section 1 connects to 2 and 3 (where sections 2 and 3 are in parallel),
|
|
184
|
+
* 2 connects to 4, 3 connects to 4, and 4 connects to nothing (it is the end of the circuit).
|
|
185
|
+
* ```ts
|
|
186
|
+
* // Create a sectioned circuit.
|
|
187
|
+
* const sectionOne = new CircuitSection({
|
|
188
|
+
* sectionId: 1,
|
|
189
|
+
* sectionType: "physical",
|
|
190
|
+
* startLocation: new CircuitLocation({
|
|
191
|
+
* sourceId: 20,
|
|
192
|
+
* globalId: "{6B0A0E4E-80EF-4688-B463-253063A5B4B2}",
|
|
193
|
+
* firstUnit: 1,
|
|
194
|
+
* lastUnit: 4,
|
|
195
|
+
* }),
|
|
196
|
+
* stopLocation: new CircuitLocation({
|
|
197
|
+
* sourceId: 20,
|
|
198
|
+
* globalId: "{3A557124-4243-4615-96DF-51991E6B9766}",
|
|
199
|
+
* firstUnit: 1,
|
|
200
|
+
* lastUnit: 4,
|
|
201
|
+
* }),
|
|
202
|
+
* });
|
|
203
|
+
*
|
|
204
|
+
* const sectionTwo = new CircuitSection({
|
|
205
|
+
* sectionId: 2,
|
|
206
|
+
* sectionType: "physical",
|
|
207
|
+
* subcircuit: new Subcircuit({ name: "SUBCIRCUITVALUE2" }),
|
|
208
|
+
* });
|
|
209
|
+
*
|
|
210
|
+
* const sectionThree = new CircuitSection({
|
|
211
|
+
* sectionId: 3,
|
|
212
|
+
* sectionType: "physical",
|
|
213
|
+
* startLocation: new CircuitLocation({
|
|
214
|
+
* sourceId: 20,
|
|
215
|
+
* globalId: "{7C874691-D659-4311-B19C-D33027B6F48A}",
|
|
216
|
+
* firstUnit: 1,
|
|
217
|
+
* lastUnit: 4,
|
|
218
|
+
* }),
|
|
219
|
+
* stopLocation: new CircuitLocation({
|
|
220
|
+
* sourceId: 20,
|
|
221
|
+
* globalId: "{BF34887C-359E-4E00-A695-8D92BF41FE37}",
|
|
222
|
+
* firstUnit: 1,
|
|
223
|
+
* lastUnit: 4,
|
|
224
|
+
* }),
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
* const sectionFour = new CircuitSection({
|
|
228
|
+
* sectionId: 4,
|
|
229
|
+
* sectionType: "physical",
|
|
230
|
+
* startLocation: new CircuitLocation({
|
|
231
|
+
* sourceId: 20,
|
|
232
|
+
* globalId: "{E4ECA4B4-F9F7-4AB2-B2FD-6CDAB1A9506B}",
|
|
233
|
+
* firstUnit: 1,
|
|
234
|
+
* lastUnit: 4,
|
|
235
|
+
* }),
|
|
236
|
+
* stopLocation: new CircuitLocation({
|
|
237
|
+
* sourceId: 20,
|
|
238
|
+
* globalId: "{18DE7259-FDC6-4788-B13B-3F6210CCCB56}",
|
|
239
|
+
* firstUnit: 1,
|
|
240
|
+
* lastUnit: 4,
|
|
241
|
+
* }),
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* const sections = new Map([
|
|
245
|
+
* [sectionOne, [sectionTwo, sectionThree]],
|
|
246
|
+
* [sectionTwo, [sectionFour]],
|
|
247
|
+
* [sectionThree, [sectionFour]],
|
|
248
|
+
* [sectionFour, []],
|
|
249
|
+
* ]);
|
|
250
|
+
*
|
|
251
|
+
* const sectionedCircuit = new Circuit({
|
|
252
|
+
* name: "CIRCUIT - 1749681983401",
|
|
253
|
+
* circuitType: "physical",
|
|
254
|
+
* sections: sections,
|
|
255
|
+
* });
|
|
256
|
+
*
|
|
257
|
+
* await circuitManager.create(sectionedCircuit);
|
|
258
|
+
* ```
|
|
138
259
|
*/
|
|
139
260
|
create(circuit: Circuit): Promise<void>;
|
|
140
261
|
/**
|
|
@@ -142,6 +263,11 @@ export default class CircuitManager extends JSONSupport {
|
|
|
142
263
|
*
|
|
143
264
|
* @param circuitNames - The names of the circuit or circuits to be deleted.
|
|
144
265
|
* @returns Resolves when the specified circuits are successfully deleted.
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* const circuitNames = ["FIRSTCIRCUIT"];
|
|
269
|
+
* await circuitManager.delete(circuitNames);
|
|
270
|
+
* ```
|
|
145
271
|
*/
|
|
146
272
|
delete(circuitNames: string[]): Promise<void>;
|
|
147
273
|
/**
|
|
@@ -151,6 +277,29 @@ export default class CircuitManager extends JSONSupport {
|
|
|
151
277
|
* @param props - An object specifying configuration settings for the export.
|
|
152
278
|
* @returns Resolves to an object
|
|
153
279
|
* specifying the export location and status for each circuit.
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* const circuits = await circuitManager.export({
|
|
283
|
+
* circuitNames: ["FIRSTCIRCUIT"],
|
|
284
|
+
* exportAcknowledgement: true,
|
|
285
|
+
* outSpatialReference: {
|
|
286
|
+
* wkid: 4326
|
|
287
|
+
* },
|
|
288
|
+
* resultTypes: [
|
|
289
|
+
* {
|
|
290
|
+
* type: "features",
|
|
291
|
+
* includeGeometry: true,
|
|
292
|
+
* includeDomainDescriptions: true,
|
|
293
|
+
* networkAttributeNames: ["Asset group", "Asset type"],
|
|
294
|
+
* diagramTemplateName: "",
|
|
295
|
+
* resultTypeFields: [
|
|
296
|
+
* { networkSourceId: 20, fieldName: "FIRSTUNIT" },
|
|
297
|
+
* { networkSourceId: 20, fieldName: "LASTUNIT" },
|
|
298
|
+
* ],
|
|
299
|
+
* },
|
|
300
|
+
* ],
|
|
301
|
+
* });
|
|
302
|
+
* ```
|
|
154
303
|
*/
|
|
155
304
|
export(props: CircuitExportProperties): Promise<CircuitExportResult[]>;
|
|
156
305
|
/**
|
|
@@ -185,6 +334,30 @@ export default class CircuitManager extends JSONSupport {
|
|
|
185
334
|
*
|
|
186
335
|
* @param query - The query specifying the criteria for the circuits to return.
|
|
187
336
|
* @returns The queried circuit names.
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* const props: QueryCircuitByLocationsProperties = {
|
|
340
|
+
* locations: [
|
|
341
|
+
* new CircuitLocation({
|
|
342
|
+
* sourceId: 20,
|
|
343
|
+
* globalId: "{8A1B5A33-3EBA-42CC-9085-31B22DAFE5DC}",
|
|
344
|
+
* firstUnit: 1,
|
|
345
|
+
* lastUnit: 1,
|
|
346
|
+
* }),
|
|
347
|
+
* ],
|
|
348
|
+
* locationType: "all",
|
|
349
|
+
* };
|
|
350
|
+
*
|
|
351
|
+
* const circuitNames = await circuitManager.queryCircuitNames(props);
|
|
352
|
+
* ```
|
|
353
|
+
* @example
|
|
354
|
+
* ```ts
|
|
355
|
+
* const props: QueryCircuitByIdsProperties = {
|
|
356
|
+
* globalIds: ["{8A1B5A33-3EBA-42CC-9085-31B22DAFE5DC}"],
|
|
357
|
+
* };
|
|
358
|
+
*
|
|
359
|
+
* const circuitNames = await circuitManager.queryCircuitNames(props);
|
|
360
|
+
* ```
|
|
188
361
|
*/
|
|
189
362
|
queryCircuitNames(query: QueryCircuitByLocationsProperties | QueryCircuitByIdsProperties): Promise<string[]>;
|
|
190
363
|
/**
|
|
@@ -193,6 +366,31 @@ export default class CircuitManager extends JSONSupport {
|
|
|
193
366
|
*
|
|
194
367
|
* @param query - The names, globalIds, or start/stop locations of the circuits to query.
|
|
195
368
|
* @returns The queried circuits.
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* // Query circuits by locations.
|
|
372
|
+
* const circuits = await circuitManager?.queryCircuits({
|
|
373
|
+
* hierarchy: "consumers-and-providers",
|
|
374
|
+
* locations: [
|
|
375
|
+
* new CircuitLocation({
|
|
376
|
+
* firstUnit: 1,
|
|
377
|
+
* globalId: "{B8E64696-E9C5-4349-ADC8-E72BBF2797D1}",
|
|
378
|
+
* lastUnit: 1,
|
|
379
|
+
* sourceId: 20,
|
|
380
|
+
* }),
|
|
381
|
+
* ],
|
|
382
|
+
* });
|
|
383
|
+
* ```
|
|
384
|
+
* @example
|
|
385
|
+
* ```ts
|
|
386
|
+
* // Query circuits by name.
|
|
387
|
+
* const circuits = await circuitManager.queryCircuits({ names: ["MULTISECTIONCIRCUIT"] });
|
|
388
|
+
* ```
|
|
389
|
+
* @example
|
|
390
|
+
* ```ts
|
|
391
|
+
* // Query circuits by globalIds.
|
|
392
|
+
* const circuits = await circuitManager.queryCircuits({ globalIds: ["{8A1B5A33-3EBA-42CC-9085-31B22DAFE5DC}"] });
|
|
393
|
+
* ```
|
|
196
394
|
*/
|
|
197
395
|
queryCircuits(query: QueryCircuitByNamesProperties | QueryCircuitByLocationsProperties | QueryCircuitByIdsProperties): Promise<Circuit[]>;
|
|
198
396
|
/**
|
|
@@ -202,6 +400,31 @@ export default class CircuitManager extends JSONSupport {
|
|
|
202
400
|
* @param options - The request options specified by the user in the data request.
|
|
203
401
|
* @returns Resolves to a [CircuitExportJobInfo](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitExportJobInfo/) object with the results of the export job.
|
|
204
402
|
* @since 5.1
|
|
403
|
+
* @example
|
|
404
|
+
* ```ts
|
|
405
|
+
* const exportJob = await circuitManager.submitExportJob({
|
|
406
|
+
* circuitNames: ["MULTISECTIONCIRCUIT"],
|
|
407
|
+
* exportAcknowledgement: true,
|
|
408
|
+
* outSpatialReference: {
|
|
409
|
+
* wkid: 4326,
|
|
410
|
+
* },
|
|
411
|
+
* resultTypes: [
|
|
412
|
+
* {
|
|
413
|
+
* type: "features",
|
|
414
|
+
* includeGeometry: true,
|
|
415
|
+
* includeDomainDescriptions: true,
|
|
416
|
+
* networkAttributeNames: ["Asset group", "Asset type"],
|
|
417
|
+
* diagramTemplateName: "",
|
|
418
|
+
* resultTypeFields: [
|
|
419
|
+
* { networkSourceId: 20, fieldName: "FIRSTUNIT" },
|
|
420
|
+
* { networkSourceId: 20, fieldName: "LASTUNIT" },
|
|
421
|
+
* ],
|
|
422
|
+
* },
|
|
423
|
+
* ],
|
|
424
|
+
* });
|
|
425
|
+
*
|
|
426
|
+
* await exportJob.waitForJobCompletion();
|
|
427
|
+
* ```
|
|
205
428
|
*/
|
|
206
429
|
submitExportJob(props: CircuitExportProperties, options?: RequestOptions | null | undefined): Promise<CircuitExportJobInfo>;
|
|
207
430
|
/**
|
|
@@ -211,6 +434,16 @@ export default class CircuitManager extends JSONSupport {
|
|
|
211
434
|
* @param options - The request options specified by the user in the data request.
|
|
212
435
|
* @returns Resolves to a [CircuitVerifyJobInfo](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitVerifyJobInfo/) object with the results of the verify job.
|
|
213
436
|
* @since 5.1
|
|
437
|
+
* @example
|
|
438
|
+
* ```ts
|
|
439
|
+
* const props: VerifyCircuitsProperties = {
|
|
440
|
+
* circuitNames: ["FIRSTCIRCUIT"],
|
|
441
|
+
* forceVerify: true,
|
|
442
|
+
* synthesizeGeometries: true,
|
|
443
|
+
* };
|
|
444
|
+
*
|
|
445
|
+
* const verifyCircuitsResult = await circuitManager.submitVerifyJob(props);
|
|
446
|
+
* ```
|
|
214
447
|
*/
|
|
215
448
|
submitVerifyJob(props: CircuitVerifyProperties, options?: RequestOptions | null | undefined): Promise<CircuitVerifyJobInfo>;
|
|
216
449
|
/**
|
|
@@ -220,6 +453,19 @@ export default class CircuitManager extends JSONSupport {
|
|
|
220
453
|
*
|
|
221
454
|
* @param props - An object specifying configuration settings for the verify operation.
|
|
222
455
|
* @returns Resolves to an array of objects specifying the verification status for each circuit.
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* const props: VerifyCircuitsProperties = {
|
|
459
|
+
* circuitNames: ["FIRSTCIRCUIT"],
|
|
460
|
+
* outSpatialReference: {
|
|
461
|
+
* wkid: 4326,
|
|
462
|
+
* },
|
|
463
|
+
* forceVerify: true,
|
|
464
|
+
* synthesizeGeometries: true,
|
|
465
|
+
* };
|
|
466
|
+
*
|
|
467
|
+
* const verifyCircuitsResult = await circuitManager.verify(props);
|
|
468
|
+
* ```
|
|
223
469
|
*/
|
|
224
470
|
verify(props: CircuitVerifyProperties): Promise<CircuitVerifyResult[]>;
|
|
225
471
|
}
|
|
@@ -18,7 +18,6 @@ export interface UnitIdentifierManagerProperties {
|
|
|
18
18
|
* A UnitIdentifierManager provides access to unit identifier management capabilities for a
|
|
19
19
|
* telecom domain network in a utility network.
|
|
20
20
|
*
|
|
21
|
-
* @beta
|
|
22
21
|
* @since 4.34
|
|
23
22
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
24
23
|
* @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|
|
@@ -71,7 +70,6 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
71
70
|
*
|
|
72
71
|
* @param networkElements - The network elements to combine in a telecom domain network.
|
|
73
72
|
* @returns `ServiceEdits` for combining network elements in a telecom domain network.
|
|
74
|
-
* @beta
|
|
75
73
|
* @since 5.1
|
|
76
74
|
* @example
|
|
77
75
|
* const networkElementA = new NetworkElement({
|
|
@@ -108,7 +106,6 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
108
106
|
* Each number in this array describes the number of units to assign an object resulting from the division.
|
|
109
107
|
* E.g., to divide one object with 6 units into an object with 5 units and another object with 1 unit, specify [5, 1].
|
|
110
108
|
* @returns `ServiceEdits` for dividing a network element in a telecom domain network.
|
|
111
|
-
* @beta
|
|
112
109
|
* @since 5.1
|
|
113
110
|
* @example
|
|
114
111
|
* const networkElement = new NetworkElement({
|
|
@@ -128,6 +125,17 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
128
125
|
* @param containers - The unit container features or objects to query.
|
|
129
126
|
* @returns Resolves to an array of objects describing
|
|
130
127
|
* the unit identifiers and gaps for the specified unit containers.
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const containers: UnitIdentifier[] = [
|
|
131
|
+
* {
|
|
132
|
+
* sourceId: 16,
|
|
133
|
+
* globalId: "{25B5F11B-70A2-4A61-9284-F0CE4C1E2111}",
|
|
134
|
+
* },
|
|
135
|
+
* ];
|
|
136
|
+
*
|
|
137
|
+
* const results = await unitIdentifierManager.query(containers);
|
|
138
|
+
* ```
|
|
131
139
|
*/
|
|
132
140
|
query(containers: UnitIdentifier[]): Promise<UnitQueryResult[]>;
|
|
133
141
|
/**
|
|
@@ -143,6 +151,15 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
143
151
|
* @param firstUnit - The first unit for the gap to be introduced.
|
|
144
152
|
* @param lastUnit - The last unit for the gap to be introduced.
|
|
145
153
|
* @returns Resolves when the gap is successfully inserted.
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* const container: UnitIdentifier = {
|
|
157
|
+
* sourceId: 16,
|
|
158
|
+
* globalId: "{25B5F11B-70A2-4A61-9284-F0CE4C1E2111}",
|
|
159
|
+
* };
|
|
160
|
+
*
|
|
161
|
+
* await unitIdentifierManager.reserve(container, 2, 5);
|
|
162
|
+
* ```
|
|
146
163
|
*/
|
|
147
164
|
reserve(container: UnitIdentifier, firstUnit: number, lastUnit: number): Promise<void>;
|
|
148
165
|
/**
|
|
@@ -151,6 +168,17 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
151
168
|
*
|
|
152
169
|
* @param containers - The unit container features or objects to be reset.
|
|
153
170
|
* @returns Resolves when the containers are successfully reset.
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const containers: UnitIdentifier[] = [
|
|
174
|
+
* {
|
|
175
|
+
* sourceId: 16,
|
|
176
|
+
* globalId: "{25B5F11B-70A2-4A61-9284-F0CE4C1E2111}",
|
|
177
|
+
* },
|
|
178
|
+
* ];
|
|
179
|
+
*
|
|
180
|
+
* await unitIdentifierManager.reset(containers);
|
|
181
|
+
* ```
|
|
154
182
|
*/
|
|
155
183
|
reset(containers: UnitIdentifier[]): Promise<void>;
|
|
156
184
|
/**
|
|
@@ -159,6 +187,15 @@ export default class UnitIdentifierManager extends JSONSupport {
|
|
|
159
187
|
* @param content - The unit identifiable feature or object being resized.
|
|
160
188
|
* @param lastUnit - The last unit for the feature or object to be resized to.
|
|
161
189
|
* @returns Resolves when the feature or object is successfully resized.
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* const content: UnitIdentifier = {
|
|
193
|
+
* sourceId: 16,
|
|
194
|
+
* globalId: "{25B5F11B-70A2-4A61-9284-F0CE4C1E2111}",
|
|
195
|
+
* };
|
|
196
|
+
*
|
|
197
|
+
* await unitIdentifierManager.resize(content, 8);
|
|
198
|
+
* ```
|
|
162
199
|
*/
|
|
163
200
|
resize(content: UnitIdentifier, lastUnit: number): Promise<void>;
|
|
164
201
|
}
|
|
@@ -99,7 +99,6 @@ export default class UtilityNetwork extends Network {
|
|
|
99
99
|
/**
|
|
100
100
|
* Returns true if the utility network data element includes a telecom domain network.
|
|
101
101
|
*
|
|
102
|
-
* @beta
|
|
103
102
|
* @since 4.34
|
|
104
103
|
* @see [Telecom domain network](https://doc.esri.com/en/arcgis-pro/latest/help/data/utility-network/telecom-domain-networks.html)
|
|
105
104
|
*/
|
|
@@ -268,7 +267,6 @@ export default class UtilityNetwork extends Network {
|
|
|
268
267
|
* @param telecomDomainNetworkName - The name of the telecom domain network to return a `CircuitManager` for.
|
|
269
268
|
* @returns Resolves to a [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|
|
270
269
|
* for the utility network's telecom domain network, or null if no such domain network exists.
|
|
271
|
-
* @beta
|
|
272
270
|
* @since 4.34
|
|
273
271
|
*/
|
|
274
272
|
getCircuitManager(telecomDomainNetworkName: string): Promise<CircuitManager | null>;
|
|
@@ -305,7 +303,6 @@ export default class UtilityNetwork extends Network {
|
|
|
305
303
|
*
|
|
306
304
|
* @returns Resolves to a [UnitIdentifierManager](https://developers.arcgis.com/javascript/latest/references/core/networks/UnitIdentifierManager/)
|
|
307
305
|
* for the utility network's telecom domain networks, or null if no such domain network exists.
|
|
308
|
-
* @beta
|
|
309
306
|
* @since 4.34
|
|
310
307
|
*/
|
|
311
308
|
getUnitIdentifierManager(): Promise<UnitIdentifierManager | null>;
|
|
@@ -354,10 +351,6 @@ export default class UtilityNetwork extends Network {
|
|
|
354
351
|
* The submitTraceJob method takes a set of parameters, executes the asynchronous trace on the backend, and returns trace results.
|
|
355
352
|
* The `gdbVersion` and `moment` properties of the `props` parameter will be hydrated from this [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/).
|
|
356
353
|
*
|
|
357
|
-
* > [!WARNING]
|
|
358
|
-
* >
|
|
359
|
-
* > The `path` and `circuit` trace types are reserved for future use.
|
|
360
|
-
*
|
|
361
354
|
* @param props - Props consists of namedTraceConfigurationGlobalId, traceLocations, outSpatialReference, traceConfiguration, resultTypes, and traceType.
|
|
362
355
|
* @returns Returns a Promise of TraceJobInfo.
|
|
363
356
|
* @since 4.27
|
|
@@ -376,10 +369,6 @@ export default class UtilityNetwork extends Network {
|
|
|
376
369
|
* The trace method takes a set of parameters, executes the trace on the backend, and returns trace results.
|
|
377
370
|
* The `gdbVersion` and `moment` properties of the `props` parameter will be hydrated from this [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/).
|
|
378
371
|
*
|
|
379
|
-
* > [!WARNING]
|
|
380
|
-
* >
|
|
381
|
-
* > The `path` and `circuit` trace types are reserved for future use.
|
|
382
|
-
*
|
|
383
372
|
* @param props - Props consists of namedTraceConfigurationGlobalId, traceLocations, outSpatialReference, traceConfiguration, resultTypes, and traceType.
|
|
384
373
|
* @returns Returns a Promise of TraceResult.
|
|
385
374
|
* @since 4.27
|
|
@@ -131,7 +131,6 @@ export interface CircuitEvents {}
|
|
|
131
131
|
*
|
|
132
132
|
* </details>
|
|
133
133
|
*
|
|
134
|
-
* @beta
|
|
135
134
|
* @since 4.34
|
|
136
135
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
137
136
|
* @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|
|
@@ -5,7 +5,6 @@ export interface CircuitLocationProperties extends Partial<Pick<CircuitLocation,
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a circuit start or stop location in a telecom domain network.
|
|
7
7
|
*
|
|
8
|
-
* @beta
|
|
9
8
|
* @since 4.34
|
|
10
9
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
11
10
|
* @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|
|
@@ -21,7 +21,6 @@ export interface CircuitPathProperties extends Partial<Pick<CircuitPath, "order"
|
|
|
21
21
|
* Represents a path in the telecom domain network.
|
|
22
22
|
* Paths are returned by path and circuit traces in a telecom domain network.
|
|
23
23
|
*
|
|
24
|
-
* @beta
|
|
25
24
|
* @since 4.34
|
|
26
25
|
*/
|
|
27
26
|
export default class CircuitPath extends JSONSupport {
|
|
@@ -13,7 +13,6 @@ export interface CircuitPathConnectivityElementProperties {
|
|
|
13
13
|
* Represents the junction and edge that comprise one hop in a path.
|
|
14
14
|
* Used for [paths](https://developers.arcgis.com/javascript/latest/references/core/networks/support/CircuitPath/) in the telecom domain network.
|
|
15
15
|
*
|
|
16
|
-
* @beta
|
|
17
16
|
* @since 4.34
|
|
18
17
|
*/
|
|
19
18
|
export default class CircuitPathConnectivityElement extends JSONSupport {
|
|
@@ -98,7 +98,6 @@ export interface CircuitSectionEvents {}
|
|
|
98
98
|
*
|
|
99
99
|
* </details>
|
|
100
100
|
*
|
|
101
|
-
* @beta
|
|
102
101
|
* @since 4.34
|
|
103
102
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
104
103
|
* @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|
|
@@ -60,13 +60,7 @@ export default class NamedTraceConfiguration extends NamedTraceConfigurationSupe
|
|
|
60
60
|
/** The full definition of the trace configuration. Only available when fully loading a utility network. */
|
|
61
61
|
get traceConfiguration(): TraceConfiguration | null | undefined;
|
|
62
62
|
set traceConfiguration(value: TraceConfigurationProperties | null | undefined);
|
|
63
|
-
/**
|
|
64
|
-
* The trace type defined in this trace configuration.
|
|
65
|
-
*
|
|
66
|
-
* > [!WARNING]
|
|
67
|
-
* >
|
|
68
|
-
* > The `path` and `circuit` types is reserved for future use.
|
|
69
|
-
*/
|
|
63
|
+
/** The trace type defined in this trace configuration. */
|
|
70
64
|
accessor traceType: TraceType | null | undefined;
|
|
71
65
|
/**
|
|
72
66
|
* Creates a deep clone of the named trace configuration.
|
|
@@ -9,7 +9,6 @@ export interface SubcircuitEvents {}
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents a subcircuit in a telecom domain network.
|
|
11
11
|
*
|
|
12
|
-
* @beta
|
|
13
12
|
* @since 4.34
|
|
14
13
|
* @see [UtilityNetwork](https://developers.arcgis.com/javascript/latest/references/core/networks/UtilityNetwork/)
|
|
15
14
|
* @see [CircuitManager](https://developers.arcgis.com/javascript/latest/references/core/networks/CircuitManager/)
|