@arcgis/core 5.1.0-next.43 → 5.1.0-next.45

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.
Files changed (262) hide show
  1. package/applications/Components/featureUtils.d.ts +11 -7
  2. package/arcade/featureset/actions/Adapted.js +1 -1
  3. package/arcade/featureset/actions/AttributeFilter.js +1 -1
  4. package/arcade/featureset/actions/OrderBy.js +1 -1
  5. package/arcade/featureset/actions/SpatialFilter.js +1 -1
  6. package/arcade/featureset/actions/Top.js +1 -1
  7. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  8. package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
  9. package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
  10. package/arcade/featureset/support/FeatureSet.js +1 -1
  11. package/arcade/featureset/support/OrderbyClause.js +1 -1
  12. package/assets/esri/core/workers/RemoteClient.js +1 -1
  13. package/assets/esri/core/workers/chunks/{eff198e0c21c9767ffaa.js → 0155e5679ded9de5c327.js} +1 -1
  14. package/assets/esri/core/workers/chunks/128799741dd3c6fc69b9.js +1 -0
  15. package/assets/esri/core/workers/chunks/13eb0162d95b4d27389c.js +1 -0
  16. package/assets/esri/core/workers/chunks/{0836964a65f76da35b5c.js → 1a3f874700f86b750390.js} +23 -23
  17. package/assets/esri/core/workers/chunks/1a481f3ae3146682eb00.js +1 -0
  18. package/assets/esri/core/workers/chunks/1cce2f8837ad765acf44.js +1 -0
  19. package/assets/esri/core/workers/chunks/2379c64b0ca30814a815.js +1 -0
  20. package/assets/esri/core/workers/chunks/23a9070e9362b8439770.js +1 -0
  21. package/assets/esri/core/workers/chunks/25e4568a3ff76f48ac5e.js +1 -0
  22. package/assets/esri/core/workers/chunks/{dbedd246f4b584583f95.js → 288bd32831e94e81653e.js} +1 -1
  23. package/assets/esri/core/workers/chunks/2b3a8a53cd68f666676b.js +1 -0
  24. package/assets/esri/core/workers/chunks/{4d16b6ac52e25bd7e6aa.js → 32a51ce8e1a362115c89.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{392941013107bbd96503.js → 365ad1ffd496ed86637b.js} +1 -1
  26. package/assets/esri/core/workers/chunks/375eac59c9f88c7572db.js +2 -0
  27. package/assets/esri/core/workers/chunks/{eab74d830c2eaa9d133b.js → 4869e2f35aaf6b058281.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{10941b50f5933d168df6.js → 521a671182b0f79e3624.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{c2f3fc1b34a6782b431f.js → 5351e71ce7839636d06d.js} +1 -1
  30. package/assets/esri/core/workers/chunks/5b515b5741733bcb4645.js +1 -0
  31. package/assets/esri/core/workers/chunks/{1669f1bf959c4e3083da.js → 5c0b3c76a7bc971c61dc.js} +1 -1
  32. package/assets/esri/core/workers/chunks/5c830cce32710d70dfa6.js +1 -0
  33. package/assets/esri/core/workers/chunks/5e9bd5ed6ecee5b15127.js +1 -0
  34. package/assets/esri/core/workers/chunks/5f2e246ffcbdedea4de5.js +1 -0
  35. package/assets/esri/core/workers/chunks/617328964d480d4a3a45.js +1 -0
  36. package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +1 -0
  37. package/assets/esri/core/workers/chunks/650614a9e4871714c42e.js +1 -0
  38. package/assets/esri/core/workers/chunks/66baacbef23291eab853.js +1 -0
  39. package/assets/esri/core/workers/chunks/7278cc37e85f0242f19b.js +1 -0
  40. package/assets/esri/core/workers/chunks/{3c597d8ef898627b8f93.js → 768bbc910be6c65ac107.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{a1f36240a31057f998da.js → 79dc7045d9a2d43ba8df.js} +1 -1
  42. package/assets/esri/core/workers/chunks/{f9da5c81535eaffc8b9c.js → 7f07f490c6fcc794c8d9.js} +1 -1
  43. package/assets/esri/core/workers/chunks/{2b386374330d96387aec.js → 851fc5290497991ba001.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{7132420980f77b6a871b.js → 8cafdd4addd366795600.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{30cdb2d1d9f018f1642d.js → 9032c040b214b5af775b.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{ff8ec6369c8a1bee9bb4.js → 908f171b9c512d738dea.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{c7799ba861ac5af08e6a.js → 92d4e962284e13ba2fc5.js} +1 -1
  48. package/assets/esri/core/workers/chunks/970d971551e42f7ae08d.js +1 -0
  49. package/assets/esri/core/workers/chunks/9802770413ad814dab29.js +1 -0
  50. package/assets/esri/core/workers/chunks/{6e8cfe69617876ee0dac.js → a69f1879735a031f62e9.js} +1 -1
  51. package/assets/esri/core/workers/chunks/{af804beb43d4d10c54d9.js → a9f35127c3f5bf42036b.js} +1 -1
  52. package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +1 -0
  53. package/assets/esri/core/workers/chunks/beb53b372d356800f333.js +1 -0
  54. package/assets/esri/core/workers/chunks/{8f12a559dbf284c21e2f.js → bf4d2f42d31861ea1046.js} +1 -1
  55. package/assets/esri/core/workers/chunks/c2aa3b1344b42a904234.js +1 -0
  56. package/assets/esri/core/workers/chunks/{9a9b1250be3e20499d75.js → ca88a364ef911526102e.js} +1 -1
  57. package/assets/esri/core/workers/chunks/cdeb6aec578a1c07d663.js +1 -0
  58. package/assets/esri/core/workers/chunks/cf5e4cf9b1aa37eeb6b0.js +1 -0
  59. package/assets/esri/core/workers/chunks/d0adf059085ddf7151dd.js +1 -0
  60. package/assets/esri/core/workers/chunks/d2af5342fbe80e2d8c60.js +1 -0
  61. package/assets/esri/core/workers/chunks/d3d024b3d2bb8fbbf760.js +1 -0
  62. package/assets/esri/core/workers/chunks/{80bfb5e5d613d2c412bf.js → dbafe96ce37bb82d0584.js} +1 -1
  63. package/assets/esri/core/workers/chunks/e4e0c5a45cf32973d5d5.js +1 -0
  64. package/assets/esri/core/workers/chunks/{093aa05fbde548bf9040.js → e5927f9d0e757ec4c22a.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{b15a02bdcd78a1a51bd6.js → e72ca52d930afb5650af.js} +1 -1
  66. package/assets/esri/core/workers/chunks/{465cc0e00f03cdb640b2.js → e7402dfd683f82878360.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{8838ff9668b472af16a1.js → ef0eae13408cbf83a64f.js} +1 -1
  68. package/assets/esri/core/workers/chunks/f1767b8ba82fdd9bd947.js +1 -0
  69. package/assets/esri/core/workers/chunks/{f835eea9f617556c7276.js → f6e3954ddbb5993d56df.js} +1 -1
  70. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  71. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  72. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  73. package/assets/esri/themes/base/widgets/_Grid.scss +5 -0
  74. package/assets/esri/themes/dark/main.css +1 -1
  75. package/assets/esri/themes/light/main.css +1 -1
  76. package/assets/esri/themes/light/view.css +1 -1
  77. package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
  78. package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
  79. package/chunks/ComponentShader.glsl.js +11 -11
  80. package/chunks/DefaultMaterial.glsl.js +1 -1
  81. package/chunks/HUDMaterial.glsl.js +28 -36
  82. package/chunks/ImageMaterial.glsl.js +1 -1
  83. package/chunks/Jpg.js +1 -1
  84. package/chunks/Path.glsl.js +7 -7
  85. package/chunks/Pattern.glsl.js +1 -1
  86. package/chunks/RibbonLine.glsl.js +2 -2
  87. package/chunks/ShadowHighlight.glsl.js +1 -1
  88. package/chunks/Terrain.glsl.js +5 -5
  89. package/chunks/Water.glsl.js +5 -5
  90. package/chunks/Zlib.js +1 -1
  91. package/chunks/lyr3DMain.js +1 -1
  92. package/chunks/lyr3DWorker.js +1 -1
  93. package/chunks/vxlLayer.js +1 -1
  94. package/config.js +1 -1
  95. package/core/arrayUtils.js +1 -1
  96. package/geometry/support/zscale.js +1 -1
  97. package/kernel.js +1 -1
  98. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  99. package/layers/SceneLayer.d.ts +16 -10
  100. package/layers/graphics/data/QueryEngineResult.js +1 -1
  101. package/layers/graphics/featureConversionUtils.js +1 -1
  102. package/layers/ogc/ogcFeatureUtils.js +1 -1
  103. package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
  104. package/layers/raster/formats/JpgPlus.js +1 -1
  105. package/layers/raster/formats/RasterCodec.js +1 -1
  106. package/layers/raster/formats/TiffDecoder.js +1 -1
  107. package/layers/save/featureLayerUtils.js +1 -1
  108. package/layers/save/groupLayerUtils.js +1 -1
  109. package/layers/save/mapImageLayerUtils.js +1 -1
  110. package/layers/support/Sublayer.d.ts +6 -0
  111. package/layers/support/Sublayer.js +1 -1
  112. package/layers/support/SubtypeSublayer.js +1 -1
  113. package/layers/support/layerUtils.js +1 -1
  114. package/package.json +3 -3
  115. package/rest/query/operations/pbfFeatureSetUtils.js +1 -1
  116. package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
  117. package/rest/query/operations/pbfOptimizedFeatureSet.js +1 -1
  118. package/support/revision.js +1 -1
  119. package/third-party-notices.txt +2 -2
  120. package/views/2d/engine/ManagedCanvas.js +1 -1
  121. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  122. package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
  123. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  124. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  125. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  126. package/views/2d/engine/webgl/TextureManager.js +1 -1
  127. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  128. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
  129. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  130. package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
  131. package/views/2d/layers/TileLayerView2D.js +1 -1
  132. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  133. package/views/2d/layers/features/Processor.js +1 -1
  134. package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
  135. package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
  136. package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
  137. package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
  138. package/views/3d/environment/EnvironmentManager.js +1 -1
  139. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  140. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  141. package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
  142. package/views/3d/support/MemoryController.js +1 -1
  143. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  144. package/views/3d/terrain/OverlayRenderer.js +1 -1
  145. package/views/3d/terrain/TerrainRenderer.js +1 -1
  146. package/views/3d/terrain/TileCompositor.js +1 -1
  147. package/views/3d/webgl-engine/collections/Component/ComponentDrawParameters.js +1 -1
  148. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  149. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  150. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  152. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  153. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  154. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  155. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
  156. package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
  157. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
  158. package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
  159. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
  160. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -2
  161. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
  162. package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
  163. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
  164. package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
  165. package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
  166. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  167. package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
  168. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  169. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  170. package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
  171. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  172. package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
  173. package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
  174. package/views/3d/webgl-engine/lib/Material.js +1 -1
  175. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  176. package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
  177. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  178. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  179. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  180. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  181. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  182. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  183. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  184. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  185. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  186. package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
  187. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  188. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  189. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  190. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  191. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  192. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  193. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  194. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  195. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  196. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  197. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  198. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  199. package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
  200. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  201. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  202. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  203. package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
  204. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  205. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  206. package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
  207. package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
  208. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  209. package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
  210. package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
  211. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  212. package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
  213. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  214. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  215. package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
  216. package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
  217. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  218. package/views/interactive/GraphicManipulator.js +1 -1
  219. package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
  220. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  221. package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
  222. package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
  223. package/widgets/Editor/EditorViewModel.d.ts +1 -1
  224. package/widgets/Editor.d.ts +2 -1
  225. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  226. package/widgets/FeatureTable.js +1 -1
  227. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  228. package/widgets/Sketch/support/PluginManager.js +1 -1
  229. package/assets/esri/core/workers/chunks/02a0a58ca5916db1db19.js +0 -1
  230. package/assets/esri/core/workers/chunks/03c8453ae72a4e190252.js +0 -1
  231. package/assets/esri/core/workers/chunks/04981ae9d7728208ffce.js +0 -1
  232. package/assets/esri/core/workers/chunks/0e669a04999feb9f98c9.js +0 -1
  233. package/assets/esri/core/workers/chunks/23af269e88f9ac101ffb.js +0 -1
  234. package/assets/esri/core/workers/chunks/244dd7a948ca8a7dc6ef.js +0 -1
  235. package/assets/esri/core/workers/chunks/26cafd20c8d03c274389.js +0 -1
  236. package/assets/esri/core/workers/chunks/2fa86dacc8a12a6a6c43.js +0 -1
  237. package/assets/esri/core/workers/chunks/3e26f9af6b8c75bad97a.js +0 -1
  238. package/assets/esri/core/workers/chunks/42b556d56013350c9d80.js +0 -1
  239. package/assets/esri/core/workers/chunks/5a6a6e7151085a3cd3dd.js +0 -1
  240. package/assets/esri/core/workers/chunks/5eb9fdb076488de9cd83.js +0 -1
  241. package/assets/esri/core/workers/chunks/65865c25487d23dd2e31.js +0 -1
  242. package/assets/esri/core/workers/chunks/65ea5028eb12457a3aeb.js +0 -1
  243. package/assets/esri/core/workers/chunks/73a008b48e29eb6f2064.js +0 -2
  244. package/assets/esri/core/workers/chunks/80a1ccabd4257cc61e0d.js +0 -1
  245. package/assets/esri/core/workers/chunks/8333561a938bcdf6c2e6.js +0 -1
  246. package/assets/esri/core/workers/chunks/91718795fc4ca6516ac7.js +0 -1
  247. package/assets/esri/core/workers/chunks/93846f8b77fc802069a7.js +0 -1
  248. package/assets/esri/core/workers/chunks/9b80569819cd1c72a9ff.js +0 -1
  249. package/assets/esri/core/workers/chunks/b056b4c79bcd542dd1d2.js +0 -1
  250. package/assets/esri/core/workers/chunks/b553264db0f10bb8c5f7.js +0 -1
  251. package/assets/esri/core/workers/chunks/b6e63d8ce3c9ac9762f4.js +0 -1
  252. package/assets/esri/core/workers/chunks/c1cae45a159a5373ac00.js +0 -1
  253. package/assets/esri/core/workers/chunks/c4f64195e44986644993.js +0 -1
  254. package/assets/esri/core/workers/chunks/ca6012135929b028ea1b.js +0 -1
  255. package/assets/esri/core/workers/chunks/de79645e559a2d1ffa67.js +0 -1
  256. package/assets/esri/core/workers/chunks/ea356a5b90ea44b5cbe1.js +0 -1
  257. package/assets/esri/core/workers/chunks/f0e6a26a3625068b08ab.js +0 -1
  258. package/assets/esri/core/workers/chunks/f36a234ef35faf8ca04d.js +0 -1
  259. package/views/2d/engine/vectorTiles/GlyphMosaic.js +0 -2
  260. package/views/2d/engine/vectorTiles/GlyphSource.js +0 -2
  261. package/views/2d/engine/vectorTiles/RectangleBinPack.js +0 -2
  262. /package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js.LICENSE.txt → 375eac59c9f88c7572db.js.LICENSE.txt} +0 -0
@@ -69,16 +69,20 @@ export function isFeatureSupportedLayer(layer: unknown): boolean;
69
69
  export function findUtilityNetwork(map: MapClass, layer: any): UtilityNetwork | null | undefined;
70
70
 
71
71
  /**
72
- * Used to query all JSON
72
+ * Retrieves all features in a layer matching a given [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/).
73
+ * This method executes the query in a loop, incrementing the query's [Query.start](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#start)
74
+ * when necessary to overcome transfer limits.
73
75
  *
74
- * @param layer - The layer being passed.
75
- * @param query - -The query being used.
76
- * @param options - -The request options.
77
- * @returns Returns a FeatureSet.
76
+ * Each query uses the layer's maximum query size for [Query.num](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#num).
77
+ *
78
+ * @param layer - The layer to query.
79
+ * @param query - Specifies the attributes and spatial filter of the query.
80
+ * @param options - The request options.
81
+ * @returns When resolved, the JSON object representing a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) is returned.
78
82
  * @internal
79
83
  * @internal
80
84
  */
81
- export function queryAllJSON(layer: FeatureLayer | SubtypeGroupLayer, query: Query, options?: RequestOptions): Promise<any>;
85
+ export function queryAllJSON(layer: FeatureLayer | SubtypeGroupLayer, query: Query, options?: RequestOptions): Promise<unknown>;
82
86
 
83
87
  /**
84
88
  * Finds an item in the specified map or generates a new value if it does not exist.
@@ -90,7 +94,7 @@ export function queryAllJSON(layer: FeatureLayer | SubtypeGroupLayer, query: Que
90
94
  * @internal
91
95
  * @internal
92
96
  */
93
- export function getOrCreateMapValue(map: any, key: any, createValue: () => any): any;
97
+ export function getOrCreateMapValue<TKey, TValue>(map: Map<TKey, TValue>, key: TKey, createValue: () => TValue): TValue;
94
98
 
95
99
  /**
96
100
  * Used to generate a new reactive map that implements the Map interface.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{FeatureSet as s}from"../support/FeatureSet.js";import{isDate as a,isLuxonDate as i,isArcadeTime as l,isArcadeDate as o,isArcadeDateOnly as n,cloneField as u,defaultMaxRecords as h}from"../support/shared.js";import{reformulateWithoutField as c,toWhereClause as d,translateFunctionToDatabaseSpecific as f,convertColumnReferenceToSql as p,makeToday as N,makeSqlFromDateTimeParameter as g,makeTimeString as S,arcadeDateToSqlString as m,arcadeDateOnlyToSqlString as T,convertIntervalToSql as C,combine as w,scanForField as _}from"../support/sqlUtils.js";import{SqlError as v}from"../../../core/sql/errorSupport.js";import y from"../../../core/sql/WhereClause.js";class W{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class A extends W{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class E extends W{constructor(e,t,r){super(u(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:c(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class F extends W{constructor(e,t,r){super(e),this.codefield=t,this._stringToCode=r,this._codeToString={};for(const s in r)this._codeToString[r[s]]=s;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,0,this.field.name,this.codefield instanceof y?d(this.codefield,0):this.codefield,e.parameters);return r.includes(F.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:y.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,s=null,u){switch(e.type){case"interval":return C(this.evaluateNodeToWhereClause(e.value,t,r,s,u),e.qualifier,e.op);case"case-expression":{let s=" CASE ";"simple"===e.format&&(s+=this.evaluateNodeToWhereClause(e.operand,t,r,F.BADNESS,u));for(const a of e.clauses)s+=" WHEN "+this.evaluateNodeToWhereClause(a.operand,t,r,F.BADNESS,u)+" THEN "+this.evaluateNodeToWhereClause(a.value,t,r,F.BADNESS,u);return null!==e.else&&(s+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,F.BADNESS,u)),s+=" END ",s}case"parameter":{const r=u[e.value.toLowerCase()];return"string"==typeof r?"'"+r.toString().replaceAll("'","''")+"'":a(r)||i(r)?g(r,t):l(r)?S(r,t):o(r)?m(r,t):n(r)?T(r,t):Array.isArray(r)?r.map(e=>"string"==typeof e?"'"+e.toString().replaceAll("'","''")+"'":a(e)||i(e)?g(e,t):l(e)?S(e,t):o(e)?m(e,t):n(e)?T(e,t):e.toString()):r.toString()}case"expression-list":{const a=[];for(const i of e.value)a.push(this.evaluateNodeToWhereClause(i,t,r,s,u));return a}case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,F.BADNESS,u)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,s,u)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,s,u)+") ";case"IS":if("null"!==e.right.type)throw new v("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new v("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IS NOT NULL )";case"IN":{if("expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const a=[];let i=!0;for(const t of e.right.value){if("string"!==t.type){i=!1;break}if(void 0===this._stringToCode[t.value]){i=!1;break}a.push(this._stringToCode[t.value].toString())}if(i)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IN ("+a.join(",")+")) "}const a=this.evaluateNodeToWhereClause(e.right,t,r,s,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IN ("+a.join(",")+")) "}const a=this.evaluateNodeToWhereClause(e.right,t,r,s,u);return Array.isArray(a)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IN ("+a.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" IN ("+a+")) "}case"NOT IN":{if("expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const a=[];let i=!0;for(const t of e.right.value){if("string"!==t.type){i=!1;break}if(void 0===this._stringToCode[t.value]){i=!1;break}a.push(this._stringToCode[t.value].toString())}if(i)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" NOT IN ("+a.join(",")+")) "}const a=this.evaluateNodeToWhereClause(e.right,t,r,s,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" NOT IN ("+a.join(",")+")) "}const a=this.evaluateNodeToWhereClause(e.right,t,r,s,u);return Array.isArray(a)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" NOT IN ("+a.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,s,u)+" NOT IN ("+a+")) "}case"BETWEEN":{const s=this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" BETWEEN "+s[0]+" AND "+s[1]+" ) "}case"NOTBETWEEN":{const s=this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT BETWEEN "+s[0]+" AND "+s[1]+" ) "}case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this._stringToCode[e.right.value.toString()])return" ("+s+" "+e.operator+" "+this._stringToCode[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this._stringToCode[e.left.value.toString()].toString()+" "+e.operator+" "+s+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return N(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return r&&r.toLowerCase()===e.column.toLowerCase()?"("+s+")":p(e);case"data-type":return e.value;case"function":{const s=this.evaluateNodeToWhereClause(e.args,t,r,F.BADNESS,u);return f(e.name,s,t)}}throw new v("UnsupportedSyntax",{node:e.type})}extractValue(e){if(this.codefield instanceof y){const t=this.codefield.calculateValueCompiled(e);return this._codeToString[y.convertValueToStorageFormat(t)]}return this._codeToString[e.attributes[this.codefield]]}}class x extends W{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:c(e,this.field.name,d(this._sql,0),t.getFieldsIndex())}}extractValue(e){return y.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class I extends s{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.Adapted",this._maxProcessing=30,this._parent=e.parentfeatureset,this._adaptedFields=e.adaptedFields,this._extraFilter=e.extraFilter}_initialiseFeatureSet(){this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.fields=[];for(const e of this._adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _queryAll(){return await this._ensureLoaded(),this._extraFilter?(await this.query({abortSignal:e})).features:this._calculateFields(await this._parent.queryAll(e))}async query(e){let r=e.where??null;const s=this._reformulateWithoutAdaptions(r),a=s.cannot;r=s.where;let i=!1,l=e.orderBy;if(null!=l){i=!0;const e=[];for(const t of this._adaptedFields)if(!(t instanceof A)&&!0===l.scanForField(t.field.name)){if(!(t instanceof E)){l=null,i=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}l&&e.length>0&&(l=l.replaceFields(e))}null!=r?null!=this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const o=await this._parent.query({...e,where:r,orderBy:l});return t(e.abortSignal),a?{...o,filterApplied:!1,ordered:!!i&&o.ordered,features:this._calculateFields(o.features)}:{...o,ordered:!!i&&o.ordered,features:this._calculateFields(o.features)}}async*_calculateFields(e){for await(const t of e)yield t.map(e=>{const t={};for(const r of this._adaptedFields)t[r.field.name]=r.extractValue(e);return{attributes:t,geometry:e.geometry}})}async queryStat(e){let t=!1,r=e.field,s=this._reformulateWithoutAdaptions(r);t=s.cannot,r=s.where;let a=e.where??null;if(s=this._reformulateWithoutAdaptions(a),t=t||s.cannot,a=s.where,null!=a?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,t)return null==a&&null==e.spatialFilter?this._manualStat(e.stat,r,e.limit??h,e.abortSignal):{calculated:!1};const i=await this._parent.queryStat({...e,field:r,where:a});return i.calculated?i:null==a&&null==e.spatialFilter?this._manualStat(e.stat,r,e.limit??h,e.abortSignal):{calculated:!1}}async canQueryAggregate(e){for(const a of e.groupBy)for(const e of this._adaptedFields)if(a.toLowerCase()===e.field.name.toLowerCase()&&!(e instanceof A))return!1;const t=[];for(const a of e.statistics)if(null!==a.workingexpr){const e=this._reformulateWithoutAdaptions(a.workingexpr);if(e.cannot)return!1;const r=a.clone();r.workingexpr=e.where,t.push(r)}else t.push(a);let r=e.where??null;const s=this._reformulateWithoutAdaptions(r);return!s.cannot&&(r=s.where,null!==r?null!==this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,this._parent.canQueryAggregate({...e,statistics:t,where:r}))}async queryAggregate(e){const t=[];for(const i of e.statistics)if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new r("NeverReach");const s=i.clone();s.workingexpr=e.where,t.push(s)}else t.push(i);let s=e.where??null;const a=this._reformulateWithoutAdaptions(s);if(a.cannot)throw new r("NeverReach");return s=a.where,null!==s?null!==this._extraFilter&&(s=w(this._extraFilter,s)):s=this._extraFilter,this._parent.queryAggregate({...e,statistics:t,where:s})}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this._adaptedFields)if(!0===_(e,r.field.name)){const s=r.rewriteSql(e,this);if(!0!==s.rewritten){t.cannot=!0,t.where=null;break}t.where=s.where}return t}}export{I as AdaptedFeatureSet,W as AdaptedField,E as FieldRename,A as OriginalField,x as SqlExpressionAdapted,F as StringToCodeAdapted};
2
+ import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{FeatureSet as a}from"../support/FeatureSet.js";import{isDate as s,isLuxonDate as i,isArcadeTime as l,isArcadeDate as o,isArcadeDateOnly as n,cloneField as u,defaultMaxRecords as h}from"../support/shared.js";import{reformulateWithoutField as c,toWhereClause as d,translateFunctionToDatabaseSpecific as f,convertColumnReferenceToSql as p,makeToday as N,makeSqlFromDateTimeParameter as g,makeTimeString as S,arcadeDateToSqlString as m,arcadeDateOnlyToSqlString as T,convertIntervalToSql as C,combine as w,scanForField as _}from"../support/sqlUtils.js";import{SqlError as v}from"../../../core/sql/errorSupport.js";import y from"../../../core/sql/WhereClause.js";class W{constructor(e){this.field=e,this.sqlRewritable=!1}postInitialization(e,t){}}class A extends W{constructor(e){super(e),this.sqlRewritable=!0}extractValue(e){return e.attributes[this.field.name]}rewriteSql(e){return{rewritten:this.sqlRewritable,where:e}}}class E extends W{constructor(e,t,r){super(u(e)),this.originalField=e,this.sqlRewritable=!0,this.field.name=t,this.field.alias=r}rewriteSql(e,t){return{rewritten:this.sqlRewritable,where:c(e,this.field.name,this.originalField.name,t.getFieldsIndex())}}extractValue(e){return e.attributes[this.originalField.name]}}class F extends W{constructor(e,t,r){super(e),this.codefield=t,this._stringToCode=r,this._codeToString={};for(const a in r)this._codeToString[r[a]]=a;this.sqlRewritable=!0}static{this.BADNESS="_!!!_BAD_LKP_!!!!"}rewriteSql(e,t){const r=this.evaluateNodeToWhereClause(e.parseTree,0,this.field.name,this.codefield instanceof y?d(this.codefield,0):this.codefield,e.parameters);return r.includes(F.BADNESS)?{rewritten:!1,where:e}:{rewritten:this.sqlRewritable,where:y.create(r,{fieldsIndex:t._parent.getFieldsIndex(),timeZone:t.dateFieldsTimeZoneDefaultUTC})}}evaluateNodeToWhereClause(e,t,r=null,a=null,u){switch(e.type){case"interval":return C(this.evaluateNodeToWhereClause(e.value,t,r,a,u),e.qualifier,e.op);case"case-expression":{let a=" CASE ";"simple"===e.format&&(a+=this.evaluateNodeToWhereClause(e.operand,t,r,F.BADNESS,u));for(const s of e.clauses)a+=" WHEN "+this.evaluateNodeToWhereClause(s.operand,t,r,F.BADNESS,u)+" THEN "+this.evaluateNodeToWhereClause(s.value,t,r,F.BADNESS,u);return null!==e.else&&(a+=" ELSE "+this.evaluateNodeToWhereClause(e.else,t,r,F.BADNESS,u)),a+=" END ",a}case"parameter":{const r=u[e.value.toLowerCase()];return"string"==typeof r?"'"+r.toString().replaceAll("'","''")+"'":s(r)||i(r)?g(r,t):l(r)?S(r,t):o(r)?m(r,t):n(r)?T(r,t):Array.isArray(r)?r.map(e=>"string"==typeof e?"'"+e.toString().replaceAll("'","''")+"'":s(e)||i(e)?g(e,t):l(e)?S(e,t):o(e)?m(e,t):n(e)?T(e,t):e.toString()):r.toString()}case"expression-list":{const s=[];for(const i of e.value)s.push(this.evaluateNodeToWhereClause(i,t,r,a,u));return s}case"unary-expression":return" ( NOT "+this.evaluateNodeToWhereClause(e.expr,t,r,F.BADNESS,u)+" ) ";case"binary-expression":switch(e.operator){case"AND":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" AND "+this.evaluateNodeToWhereClause(e.right,t,r,a,u)+") ";case"OR":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" OR "+this.evaluateNodeToWhereClause(e.right,t,r,a,u)+") ";case"IS":if("null"!==e.right.type)throw new v("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IS NULL )";case"ISNOT":if("null"!==e.right.type)throw new v("UnsupportedIsRhs");return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IS NOT NULL )";case"IN":{if("expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];let i=!0;for(const t of e.right.value){if("string"!==t.type){i=!1;break}if(void 0===this._stringToCode[t.value]){i=!1;break}s.push(this._stringToCode[t.value].toString())}if(i)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IN ("+s.join(",")+")) "}const s=this.evaluateNodeToWhereClause(e.right,t,r,a,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IN ("+s.join(",")+")) "}const s=this.evaluateNodeToWhereClause(e.right,t,r,a,u);return Array.isArray(s)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IN ("+s.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" IN ("+s+")) "}case"NOT IN":{if("expression-list"===e.right.type){if("column-reference"===e.left.type&&e.left.column.toUpperCase()===this.field.name.toUpperCase()){const s=[];let i=!0;for(const t of e.right.value){if("string"!==t.type){i=!1;break}if(void 0===this._stringToCode[t.value]){i=!1;break}s.push(this._stringToCode[t.value].toString())}if(i)return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" NOT IN ("+s.join(",")+")) "}const s=this.evaluateNodeToWhereClause(e.right,t,r,a,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" NOT IN ("+s.join(",")+")) "}const s=this.evaluateNodeToWhereClause(e.right,t,r,a,u);return Array.isArray(s)?" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" NOT IN ("+s.join(",")+")) ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,a,u)+" NOT IN ("+s+")) "}case"BETWEEN":{const a=this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" BETWEEN "+a[0]+" AND "+a[1]+" ) "}case"NOTBETWEEN":{const a=this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u);return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT BETWEEN "+a[0]+" AND "+a[1]+" ) "}case"LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"NOT LIKE":return""!==e.escape?" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+" ESCAPE '"+e.escape+"') ":" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" NOT LIKE "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"<>":case"=":if("column-reference"===e.left.type&&"string"===e.right.type){if(e.left.column.toUpperCase()===this.field.name.toUpperCase()&&void 0!==this._stringToCode[e.right.value.toString()])return" ("+a+" "+e.operator+" "+this._stringToCode[e.right.value.toString()].toString()+") "}else if("column-reference"===e.right.type&&"string"===e.left.type&&e.right.column.toUpperCase()===this.field.name.toUpperCase())return" ("+this._stringToCode[e.left.value.toString()].toString()+" "+e.operator+" "+a+") ";return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") ";case"<":case">":case">=":case"<=":case"*":case"-":case"+":case"/":case"||":return" ("+this.evaluateNodeToWhereClause(e.left,t,r,F.BADNESS,u)+" "+e.operator+" "+this.evaluateNodeToWhereClause(e.right,t,r,F.BADNESS,u)+") "}case"null":return"null";case"boolean":return!0===e.value?"1":"0";case"string":return"'"+e.value.toString().replaceAll("'","''")+"'";case"timestamp":return`timestamp '${e.value}'`;case"date":return`date '${e.value}'`;case"time":return`time '${e.value}'`;case"number":return e.value.toString();case"current-time":return N(e.mode,t);case"current-user":return"CURRENT_USER";case"column-reference":return r&&r.toLowerCase()===e.column.toLowerCase()?"("+a+")":p(e);case"data-type":return e.value;case"function":{const a=this.evaluateNodeToWhereClause(e.args,t,r,F.BADNESS,u);return f(e.name,a,t)}}throw new v("UnsupportedSyntax",{node:e.type})}extractValue(e){if(this.codefield instanceof y){const t=this.codefield.calculateValueCompiled(e);return this._codeToString[y.convertValueToStorageFormat(t)]}return this._codeToString[e.attributes[this.codefield]]}}class x extends W{constructor(e,t){super(e),this._sql=t}rewriteSql(e,t){return{rewritten:!0,where:c(e,this.field.name,d(this._sql,0),t.getFieldsIndex())}}extractValue(e){return y.convertValueToStorageFormat(this._sql.calculateValueCompiled(e),this.field.type)}}class I extends a{static findField(e,t){for(const r of e)if(r.name.toLowerCase()===t.toString().toLowerCase())return r;return null}constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.Adapted",this._maxProcessing=30,this._parent=e.parentfeatureset,this._adaptedFields=e.adaptedFields,this._extraFilter=e.extraFilter}_initialiseFeatureSet(){this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.fields=[];for(const e of this._adaptedFields)e.postInitialization(this,this._parent),this.fields.push(e.field)}async _queryAll(){return await this._ensureLoaded(),this._extraFilter?(await this.query({abortSignal:e})).features:this._calculateFields(await this._parent.queryAll(e))}async query(e){let r=e.where??null;const a=this._reformulateWithoutAdaptions(r),s=a.cannot;r=a.where;let i=!a.cannot,l=!1,o=e.orderBy;if(null!=o){l=!0;const e=[];for(const t of this._adaptedFields)if(!(t instanceof A)&&!0===o.scanForField(t.field.name)){if(!(t instanceof E)){o=null,l=!1,i=!1;break}e.push({field:t.field.name,newfield:t.originalField.name})}o&&e.length>0&&(o=o.replaceFields(e))}null!=r?null!=this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,await this._ensureLoaded();const n=await this._parent.query({...e,where:r,orderBy:o,limit:i?e.limit:null});return t(e.abortSignal),s?{...n,filterApplied:!1,ordered:!!l&&n.ordered,features:this._calculateFields(n.features)}:{...n,ordered:!!l&&n.ordered,features:this._calculateFields(n.features)}}async*_calculateFields(e){for await(const t of e)yield t.map(e=>{const t={};for(const r of this._adaptedFields)t[r.field.name]=r.extractValue(e);return{attributes:t,geometry:e.geometry}})}async queryStat(e){let t=!1,r=e.field,a=this._reformulateWithoutAdaptions(r);t=a.cannot,r=a.where;let s=e.where??null;if(a=this._reformulateWithoutAdaptions(s),t=t||a.cannot,s=a.where,null!=s?null!==this._extraFilter&&(s=w(this._extraFilter,s)):s=this._extraFilter,t)return null==s&&null==e.spatialFilter?this._manualStat(e.stat,r,e.limit??h,e.abortSignal):{calculated:!1};const i=await this._parent.queryStat({...e,field:r,where:s});return i.calculated?i:null==s&&null==e.spatialFilter?this._manualStat(e.stat,r,e.limit??h,e.abortSignal):{calculated:!1}}async canQueryAggregate(e){for(const s of e.groupBy)for(const e of this._adaptedFields)if(s.toLowerCase()===e.field.name.toLowerCase()&&!(e instanceof A))return!1;const t=[];for(const s of e.statistics)if(null!==s.workingexpr){const e=this._reformulateWithoutAdaptions(s.workingexpr);if(e.cannot)return!1;const r=s.clone();r.workingexpr=e.where,t.push(r)}else t.push(s);let r=e.where??null;const a=this._reformulateWithoutAdaptions(r);return!a.cannot&&(r=a.where,null!==r?null!==this._extraFilter&&(r=w(this._extraFilter,r)):r=this._extraFilter,this._parent.canQueryAggregate({...e,statistics:t,where:r}))}async queryAggregate(e){const t=[];for(const i of e.statistics)if(null!==i.workingexpr){const e=this._reformulateWithoutAdaptions(i.workingexpr);if(e.cannot)throw new r("NeverReach");const a=i.clone();a.workingexpr=e.where,t.push(a)}else t.push(i);let a=e.where??null;const s=this._reformulateWithoutAdaptions(a);if(s.cannot)throw new r("NeverReach");return a=s.where,null!==a?null!==this._extraFilter&&(a=w(this._extraFilter,a)):a=this._extraFilter,this._parent.queryAggregate({...e,statistics:t,where:a})}_reformulateWithoutAdaptions(e){const t={cannot:!1,where:e};if(null!==e)for(const r of this._adaptedFields)if(!0===_(e,r.field.name)){const a=r.rewriteSql(e,this);if(!0!==a.rewritten){t.cannot=!0,t.where=null;break}t.where=a.where}return t}}export{I as AdaptedFeatureSet,W as AdaptedField,E as FieldRename,A as OriginalField,x as SqlExpressionAdapted,F as StringToCodeAdapted};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t}from"../support/errorsupport.js";import{FeatureSet as s}from"../support/FeatureSet.js";import{defaultMaxRecords as r}from"../support/shared.js";import{combine as l}from"../support/sqlUtils.js";import a from"../../../core/sql/WhereClause.js";class i extends s{constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof a?(this._whereClause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereClause=null)}_initialiseFeatureSet(){this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){let s=e.where;null!==this._whereClauseFunction||(null!=s?null!==this._whereClause&&(s=l(this._whereClause,s)):s=this._whereClause),await this._ensureLoaded();const r=await this._parent.query({...e,where:s});return t(e.abortSignal),r.filterApplied&&null==this._whereClauseFunction?r:{...r,features:this._applyFilter(r.features,e.abortSignal)}}async*_applyFilter(e,s){for await(const r of e)if(t(s),null!=this._whereClause){const e=r.filter(e=>this._whereClause.testFeature(e));e.length>0&&(yield e)}else if(null!=this._whereClauseFunction){const e=[];for(const t of r)await this._whereClauseFunction(t)&&e.push(t);e.length>0&&(yield e)}else yield r}async queryStat(e){if(null!==this._whereClauseFunction)return null==e.where&&null==e.spatialFilter?this._manualStat(e.stat,e.field,e.limit??r,e.abortSignal):{calculated:!1};let t=this._whereClause;null!=e.where&&null!==this._whereClause&&(t=l(this._whereClause,e.where));const s=await this._parent.queryStat({...e,where:t});return s.calculated?s:null==e.where&&null==e.spatialFilter?this._manualStat(e.stat,e.field,e.limit??r,e.abortSignal):{calculated:!1}}async canQueryAggregate(e){if(null!==this._whereClauseFunction)return!1;let t=e.where;return null!=t?null!==this._whereClause&&(t=l(this._whereClause,t)):t=this._whereClause,this._parent.canQueryAggregate({...e,where:t})}async queryAggregate(e){let t=e.where;return null!=t?null!==this._whereClause&&(t=l(this._whereClause,t)):t=this._whereClause,this._parent.queryAggregate({...e,where:t})}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{i as default};
2
+ import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t}from"../support/errorsupport.js";import{FeatureSet as s}from"../support/FeatureSet.js";import{defaultMaxRecords as r}from"../support/shared.js";import{combine as l}from"../support/sqlUtils.js";import i from"../../../core/sql/WhereClause.js";class a extends s{constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.AttributeFilter",this._maxProcessing=1e3,this._parent=e.parentfeatureset,e.whereclause instanceof i?(this._whereClause=e.whereclause,this._whereClauseFunction=null):(this._whereClauseFunction=e.whereclause,this._whereClause=null)}_initialiseFeatureSet(){this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){let s=e.where,r=!0;null!==this._whereClauseFunction?r=!1:null!=s?null!==this._whereClause&&(s=l(this._whereClause,s)):s=this._whereClause,await this._ensureLoaded();const i=await this._parent.query({...e,where:s,limit:r?e.limit:null});return t(e.abortSignal),i.filterApplied&&null==this._whereClauseFunction?i:{...i,features:this._applyFilter(i.features,e.abortSignal)}}async*_applyFilter(e,s){for await(const r of e)if(t(s),null!=this._whereClause){const e=r.filter(e=>this._whereClause.testFeature(e));e.length>0&&(yield e)}else if(null!=this._whereClauseFunction){const e=[];for(const t of r)await this._whereClauseFunction(t)&&e.push(t);e.length>0&&(yield e)}else yield r}async queryStat(e){if(null!==this._whereClauseFunction)return null==e.where&&null==e.spatialFilter?this._manualStat(e.stat,e.field,e.limit??r,e.abortSignal):{calculated:!1};let t=this._whereClause;null!=e.where&&null!==this._whereClause&&(t=l(this._whereClause,e.where));const s=await this._parent.queryStat({...e,where:t});return s.calculated?s:null==e.where&&null==e.spatialFilter?this._manualStat(e.stat,e.field,e.limit??r,e.abortSignal):{calculated:!1}}async canQueryAggregate(e){if(null!==this._whereClauseFunction)return!1;let t=e.where;return null!=t?null!==this._whereClause&&(t=l(this._whereClause,t)):t=this._whereClause,this._parent.canQueryAggregate({...e,where:t})}async queryAggregate(e){let t=e.where;return null!=t?null!==this._whereClause&&(t=l(this._whereClause,t)):t=this._whereClause,this._parent.queryAggregate({...e,where:t})}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- 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};
2
+ import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import{a3 as t}from"../../../chunks/languageUtils.js";import{throwIfCancelled as e}from"../support/errorsupport.js";import{FeatureSet as a}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import{splitIntoChunks as i,insertSortedStableTopN 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){if(null!=r.orderBy)return this._parent.query(r);await this._ensureLoaded();const t=await this._parent.query({...r,orderBy:this._orderByClause});return e(r.abortSignal),!1===t.ordered?{...t,ordered:!0,features:null!=r.limit&&r.limit<=5e3?this._topNFeatures(t.features,r.limit,r.abortSignal):this._sortFeatures(t.features,r.abortSignal)}:t}async*_sortFeatures(r,a){const s=[];for await(const i of r)s.push(i),await t(),e(a);const o=s.flat();this._orderByClause.order(o),yield*i(o,this._maxQueryRate())}async*_topNFeatures(r,a,s){const n=[],u=this._orderByClause.toComparator();for await(const i of r){for(const r of i)o(n,r,a,u);await t(),e(s)}yield*i(n,this._maxQueryRate())}async queryStat(r){const t=await this._parent.queryStat(r);return t.calculated?t: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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as t}from"../../arcadeEnvironment.js";import{shapeExtent as e}from"../../kernel.js";import{throwIfCancelled as r,FeatureSetError as a}from"../support/errorsupport.js";import{FeatureSet as i}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import{invokeRemoteGeometryOp as l}from"../../geometry/operatorsWorkerConnection.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";class o extends i{constructor(t){super(),this.declaredClass="esri.arcade.featureset.actions.SpatialFilter",this._maxProcessing=40,this._parent=t.parentfeatureset,this._relation=t.relation,this._relationString=t.relationString??"",this._relationGeom=t.relationGeom}get _spatialFilter(){return{relation:"esriSpatialRelRelation"!==this._relation?this._relation:`esriSpatialRelRelation:${this._relationString}`,geometry:this._relationGeom}}async _queryAll(){return(await this.query({abortSignal:t})).features}async query(t){await this._ensureLoaded();const e=await this._parent.query({...t,spatialFilter:this._spatialFilter});return r(t.abortSignal),{...e,spatialFilterApplied:null==t.spatialFilter,features:e.spatialFilterApplied?e.features:this._applySpatialFilter(e.features,t.abortSignal)}}async*_applySpatialFilter(t,e){for await(const a of t){r(e);const t=[];for(const e of a)await this._executeSpatialRelationTest(e)&&t.push(e);t.length>0&&(yield t)}}async queryStat(t){if(null!=t.spatialFilter)return{calculated:!1};const e=await this._parent.queryStat({...t,spatialFilter:this._spatialFilter});return e.calculated?e:null==t.where&&null==t.spatialFilter?this._manualStat(t.stat,t.field,t.limit??s,t.abortSignal):{calculated:!1}}async canQueryAggregate(t){return null==t.spatialFilter&&this._parent.canQueryAggregate({...t,spatialFilter:this._spatialFilter})}async queryAggregate(t){if(null!=t.spatialFilter)throw new a("NeverReach");return this._parent.queryAggregate({...t,spatialFilter:this._spatialFilter})}async _executeSpatialRelationTest(t){if(null==t.geometry)return!1;switch(this._relation){case"esriSpatialRelEnvelopeIntersects":{const r=e(this._relationGeom),a=n(t.geometry);return null!=r&&null!=a&&l("intersects",[r.toJSON(),a])}case"esriSpatialRelIntersects":return l("intersects",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelContains":return l("contains",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelOverlaps":return l("overlaps",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelWithin":return l("within",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelTouches":return l("touches",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelCrosses":return l("crosses",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelRelation":return l("relate",[this._relationGeom.toJSON(),t.geometry,this._relationString]);default:return this._relation,!1}}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{o as default};
2
+ import{neverAbortedSignal as t}from"../../arcadeEnvironment.js";import{shapeExtent as e}from"../../kernel.js";import{throwIfCancelled as r,FeatureSetError as a}from"../support/errorsupport.js";import{FeatureSet as i}from"../support/FeatureSet.js";import{defaultMaxRecords as l}from"../support/shared.js";import{invokeRemoteGeometryOp as s}from"../../geometry/operatorsWorkerConnection.js";import{getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";class o extends i{constructor(t){super(),this.declaredClass="esri.arcade.featureset.actions.SpatialFilter",this._maxProcessing=40,this._parent=t.parentfeatureset,this._relation=t.relation,this._relationString=t.relationString??"",this._relationGeom=t.relationGeom}get _spatialFilter(){return{relation:"esriSpatialRelRelation"!==this._relation?this._relation:`esriSpatialRelRelation:${this._relationString}`,geometry:this._relationGeom}}async _queryAll(){return(await this.query({abortSignal:t})).features}async query(t){await this._ensureLoaded();const e=await this._parent.query({...t,spatialFilter:this._spatialFilter,limit:null==t.spatialFilter?t.limit:null});return r(t.abortSignal),{...e,spatialFilterApplied:null==t.spatialFilter,features:e.spatialFilterApplied?e.features:this._applySpatialFilter(e.features,t.abortSignal)}}async*_applySpatialFilter(t,e){for await(const a of t){r(e);const t=[];for(const e of a)await this._executeSpatialRelationTest(e)&&t.push(e);t.length>0&&(yield t)}}async queryStat(t){if(null!=t.spatialFilter)return{calculated:!1};const e=await this._parent.queryStat({...t,spatialFilter:this._spatialFilter});return e.calculated?e:null==t.where&&null==t.spatialFilter?this._manualStat(t.stat,t.field,t.limit??l,t.abortSignal):{calculated:!1}}async canQueryAggregate(t){return null==t.spatialFilter&&this._parent.canQueryAggregate({...t,spatialFilter:this._spatialFilter})}async queryAggregate(t){if(null!=t.spatialFilter)throw new a("NeverReach");return this._parent.queryAggregate({...t,spatialFilter:this._spatialFilter})}async _executeSpatialRelationTest(t){if(null==t.geometry)return!1;switch(this._relation){case"esriSpatialRelEnvelopeIntersects":{const r=e(this._relationGeom),a=n(t.geometry);return null!=r&&null!=a&&s("intersects",[r.toJSON(),a])}case"esriSpatialRelIntersects":return s("intersects",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelContains":return s("contains",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelOverlaps":return s("overlaps",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelWithin":return s("within",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelTouches":return s("touches",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelCrosses":return s("crosses",[this._relationGeom.toJSON(),t.geometry]);case"esriSpatialRelRelation":return s("relate",[this._relationGeom.toJSON(),t.geometry,this._relationString]);default:return this._relation,!1}}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{o as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{FeatureSetError as t}from"../support/errorsupport.js";import{FeatureSet as r}from"../support/FeatureSet.js";async function*a(e,t){let r=t;for await(const a of e)if(r>=a.length?(r-=a.length,yield a):(yield a.slice(0,r),r=0),r<=0)break}class s extends r{constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.Top",this._maxProcessing=100,this._parent=e.parentfeatureset,this._limit=e.topnum}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){await this._ensureLoaded();const t=await this._parent.queryAll(e.abortSignal);return{filterApplied:null==e.where,spatialFilterApplied:null==e.spatialFilter,ordered:!1,features:a(t,this._limit)}}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new t("NeverReach")}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{s as default};
2
+ import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{FeatureSetError as t}from"../support/errorsupport.js";import{FeatureSet as r}from"../support/FeatureSet.js";async function*a(e,t){let r=t;for await(const a of e)if(r>=a.length?(r-=a.length,yield a):(yield a.slice(0,r),r=0),r<=0)break}class i extends r{constructor(e){super(),this.declaredClass="esri.arcade.featureset.actions.Top",this._maxProcessing=100,this._parent=e.parentfeatureset,this._limit=e.topnum}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){const t=null!=e.limit&&null==e.where&&null==e.spatialFilter&&null==e.orderBy?Math.min(e.limit,this._limit):this._limit;await this._ensureLoaded();const{features:r}=await this._parent.query({limit:t,abortSignal:e.abortSignal});return{filterApplied:null==e.where,spatialFilterApplied:null==e.spatialFilter,ordered:!1,features:a(r,t)}}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new t("NeverReach")}getFieldsIndex(){return this._parent.getFieldsIndex()}}export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{id as e}from"../../../kernel.js";import t from"../../../request.js";import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import i from"../../Attachment.js";import a from"../../Dictionary.js";import{throwIfCancelled as s,FeatureSetError as l}from"../support/errorsupport.js";import{RootFeatureSet as n,emptyFeaturesResult as o,assignSpatialReferenceOnFeatures as u}from"../support/FeatureSet.js";import{defaultMaxRecords as c,stableStringify as h,extractServiceUrl as y}from"../support/shared.js";import{toWhereClause as d,isSingleField as p}from"../support/sqlUtils.js";import{decodeStatType as _}from"../support/stats.js";import{sliceEquals as m}from"../../../core/arrayUtils.js";import{createMD5Hash as f,outputTypes as F}from"../../../core/MD5.js";import{sqlAnd as w}from"../../../core/sql.js";import S from"../../../core/sql/WhereClause.js";import g from"../../../layers/FeatureLayer.js";import{toQueryStringParameters as b}from"../../../rest/query/operations/queryRelatedRecords.js";import R from"../../../rest/support/AttachmentQuery.js";import I from"../../../rest/support/Query.js";import q from"../../../rest/support/StatisticDefinition.js";function T(e){if(0===e.length)throw new l("NeverReach");const t=[];for(let i=0;i<e.length;i++){const r=e[i],a=[`"${r.name.replaceAll('"','""')}" ${r.asc?">":"<"} @last_${i}`];for(let t=0;t<i;t++){const r=e[t];a.push(`"${r.name.replaceAll('"','""')}" = @last_${t}`)}t.push(a.join(" AND "))}const r=t.join(" OR ");return S.create(r)}function Q(e,t){null==e.clause&&(e.clause=T(e.keyFields));for(let r=0;r<e.keyFields.length;r++){const i=e.keyFields[r].name;e.clause.parameters[`last_${r}`]=t.attributes[i]}}class v extends n{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this._requestStandardised=!1,this._useDefinitionExpression=!0,this._recentlyUsedQueries=null,this._featureSetQueryInterceptor=null,this._featureSetInfo=null,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry),e.lrucache&&(this._recentlyUsedQueries=e.lrucache),e.interceptor&&(this._featureSetQueryInterceptor=e.interceptor)}_maxQueryRate(){return c}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+h(e.toJSON());return f(t,F.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(this.spatialReference??=this._layer.spatialReference,this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer.capabilities?.data?.supportsZ,this.hasM=!0===this._layer.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=1,null!=e&&e>=10.61&&(this._databaseType=0)):null!=e&&(e>=10.5&&(this._databaseType=1,this._requestStandardised=!0),e>=10.61&&(this._databaseType=0))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new I;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch{return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}async _queryAll(){return(await this.query({abortSignal:r})).features}async query(e){return await this._ensureLoaded(),this.isTable()&&null!=e.spatialFilter?o:this._canUsePagination()?this._queryUsingPaging(e):this._queryUsingIdSetTraversal(e)}async _queryUsingPaging(e){let t="",r=!1;null!=e.orderBy&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(t=e.orderBy.constructClause(),r=!0);const i=await this.databaseType(),a=null==e.where?null==e.spatialFilter?"1=1":"":d(e.where,i);let s=this._maxQueryRate();const l=this._layer.capabilities?.query.maxRecordCount;null!=l&&l<s&&(s=l);const n=!0!==this._removeGeometry,o=this._overrideFields??this._fieldsIncludingObjectId(["*"]),u=this._createQuery();return u.where=w(u.where,a),null!=e.spatialFilter&&(u.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),u.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),u.geometry=e.spatialFilter.geometry),u.orderByFields=""!==t?t.split(","):null,u.outFields=o,u.returnGeometry=n,u.outSpatialReference=this.spatialReference,{ordered:r,filterApplied:!0,spatialFilterApplied:!0,features:this._queryPaginated(u,s,e.abortSignal)}}async*_queryPaginated(e,t,r){let i;e.num=t,e.start=0;do{s(r),i=await this.executeQuery(e,"execute"),yield i.features,e.start+=t}while(!0===i.exceededTransferLimit)}async _queryUsingIdSetTraversal(e){let t="",r=!1;null!=e.orderBy&&this._layer.capabilities&&this._layer.capabilities.query&&!0===this._layer.capabilities.query.supportsOrderBy&&(t=e.orderBy.constructClause(),r=!0);const i=await this.databaseType(),a=null==e.where?null==e.spatialFilter?"1=1":"":d(e.where,i),l=this._createQuery();l.where=w(l.where,a),null!=e.spatialFilter&&(l.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),l.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),l.geometry=e.spatialFilter.geometry),l.orderByFields=""!==t?t.split(","):null,l.outSpatialReference=this.spatialReference;const n=await this.executeQuery(l,"executeForIds");if(s(e.abortSignal),null==n||n.length<=0)return o;let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);const h=this._createQuery();return l.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),l.returnGeometry=!0!==this._removeGeometry,l.outSpatialReference=this.spatialReference,{ordered:r,filterApplied:!0,spatialFilterApplied:!0,features:this._traverseIdSet(h,n,u,e.abortSignal)}}async*_traverseIdSet(e,t,r,i){for(let a=0;a<t.length;a+=r){e.objectIds=t.slice(a,a+r),s(i);const l=await this.executeQuery(e,"execute");yield l.features}}async queryStat(e){await this._ensureLoaded();const t=this._layer.capabilities?.query,r=!!t?.supportsSqlExpression,i=!!t?.supportsStatistics,a=!!t?.supportsDistinct,s=_(e.stat);if("count"===s)return a?this._queryCount(e):{calculated:!1};const n=e.field;if(null==n)return{calculated:!1};if(!1===i||!1===p(n)&&!1===r||!1===n.isStandardized)return null!=e.spatialFilter||null!=e.where?{calculated:!1}:this._manualStat(e.stat,n,e.limit??c,e.abortSignal);if("distinct"===s)return!1===a?null!=e.spatialFilter||null!=e.where?{calculated:!1}:this._manualStat(s,n,e.limit??c,e.abortSignal):{calculated:!1};const o=await this.databaseType();if(this.isTable()&&null!=e.spatialFilter)return{calculated:!0,result:null};const u=this._createQuery();u.where=w(u.where,null==e.where?null==e.spatialFilter?"1=1":"":d(e.where,o)),null!=e.spatialFilter&&(u.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),u.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),u.geometry=e.spatialFilter.geometry);const h=new q;h.statisticType=s,h.onStatisticField=d(n,o),h.outStatisticFieldName="ARCADE_STAT_RESULT",u.returnGeometry=!1;let y="ARCADE_STAT_RESULT";u.outStatistics=[h];const m=await this.executeQuery(u,"execute");if(!m.hasOwnProperty("features")||0===m.features.length)throw new l("InvalidStatResponse");let f=!1;const F=m.fields??[];for(const l of F)if("ARCADE_STAT_RESULT"===l.name.toUpperCase()){y=l.name,"esriFieldTypeDate"===l.type&&(f=!0);break}const S=m.features[0].attributes[y];return{calculated:!0,result:f&&null!=S?new Date(S):S}}async _queryCount(e){const t=await this.databaseType();if(this.isTable()&&null!=e.spatialFilter)return{calculated:!0,result:0};const r=this._createQuery();r.where=w(r.where,null==e.where?null==e.spatialFilter?"1=1":"":d(e.where,t)),null!=e.spatialFilter&&(r.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),r.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),r.geometry=e.spatialFilter.geometry),r.returnGeometry=!1;return{calculated:!0,result:await this.executeQuery(r,"executeForCount")}}async canQueryAggregate(e){await this._ensureLoaded();let t=!1;const r=this._layer.capabilities?.query,i=!0===r?.supportsSqlExpression;if(null!=r&&!0===r.supportsStatistics&&!0===r.supportsOrderBy&&(t=!0),t)for(const a of e.statistics)(!1===a.workingexpr?.isStandardized||!1===p(a.workingexpr)&&!1===i)&&(t=!1);return t}async queryAggregate(e){if(await this._ensureLoaded(),this.isTable()&&null!=e.spatialFilter)return o;const t=await this.databaseType(),r=e.groupBy,i=e.orderBy;let a=null;if(!this._layer.capabilities.query.supportsPaginationOnAggregatedQueries){const e=this.getFieldsIndex();a={keyFields:r.map((t,r)=>({name:e.normalizeFieldName(t)??t,asc:null==i||1===i._directions[r]}))}}let s="",l=!1;null!=i&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==a||m(r,0,r.length,i._fields,0,Math.min(i._fields.length,r.length),(e,t)=>e.toLowerCase()===t.toLowerCase()))&&(s=i.constructClause(),l=!0),""===s&&(s=r.join(","));const n=e.statistics.map(e=>new q({onStatisticField:null!==e.workingexpr?d(e.workingexpr,t):"",outStatisticFieldName:e.field,statisticType:e.toStatisticsName()}));let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);const h=null==e.where?null==e.spatialFilter?"1=1":"":d(e.where,t),y=this._createQuery();return y.where=w(y.where,h),null!=e.spatialFilter&&(y.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),y.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),y.geometry=e.spatialFilter.geometry),y.orderByFields=""!==s?s.split(","):null,y.outFields=["*"],y.outStatistics=n,y.groupByFieldsForStatistics=r,y.returnGeometry=!1,null==a?{filterApplied:!0,spatialFilterApplied:!0,ordered:l,features:this._queryPaginated(y,u,e.abortSignal)}:{filterApplied:!0,spatialFilterApplied:!0,ordered:l,features:this._queryKeysetPaginated(y,a,e.abortSignal)}}async*_queryKeysetPaginated(e,t,r){const i=e.where;for(;;){if(null!=t.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new l("NotImplemented");e.where=w(i,d(t.clause,await this.databaseType()))}const a=await this.executeQuery(e,"execute");if(s(r),!a.hasOwnProperty("features"))throw new l("InvalidStatResponse");if(yield a.features,0===a.features.length||!0!==a.exceededTransferLimit)break;Q(t,a.features.at(-1))}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const r="execute"===t?async e=>{const t=await this._layer.source.queryFeaturesJSON(e);return u(t.features,t.spatialReference??this.spatialReference.toJSON()),t}:"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this._recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this._recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this._recentlyUsedQueries.addToCache(t,i),i=i.catch(e=>{throw this._recentlyUsedQueries?.removeFromCache(t),e}))}return this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return r||t.push(this.objectIdField),t}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}static create(e,t,r,i,a){const s=new g({url:e,outFields:null===t?["*"]:t});return new v({layer:s,spatialReference:r,lrucache:i,interceptor:a})}relationshipMetadata(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return y(this._layer.parsedUrl.path)}async queryAttachments(e,t,r,s,l){function n(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}const o=this._layer;if(!n(o))return[];const u=new R({objectIds:[e],returnMetadata:l});(t&&t>0||r&&r>0)&&(u.size=[t&&t>0?t:0,r&&r>0?r:t+1]),s&&s.length>0&&(u.attachmentTypes=s),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:o,query:u,method:"attachments"});const c=await o.queryAttachments(u);return c?.[e]?c[e].map(t=>{const r=`${this._layer.parsedUrl.path}/${e}/attachments/${t.id}`;let s=null;return l&&t.exifInfo&&(s=a.convertJsonToArcade(t.exifInfo,"system",!0)),new i(t.id,t.name,t.contentType,t.size,r,s,t.keywords??null)}):[]}async queryRelatedFeatures(e){const r=b(e);r.f="json",this._requestStandardised&&(r.sqlFormat="standard"),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:r,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await t(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:r});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const r=t.spatialReference,i=!0===t.exceededTransferLimit;for(const a of t.relatedRecordGroups)u(a.relatedRecords,r),e[a.objectId]={features:a.relatedRecords,exceededTransferLimit:i}}return e}throw new l("InvalidRequest")}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=w(r.where,this.objectIdField+"="+e.toString()),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.source.queryFeaturesJSON(r);return 1===i.features.length?(u(i.features,i.spatialReference??this.spatialReference.toJSON()),i.features[0]):null}async getIdentityUser(){await this.load();const t=e?.findCredential(this._layer.url);return t?t.userId:null}async getOwningSystemUrl(){await this.load();const r=e?.findServerInfo(this._layer.url);if(r)return r.owningSystemUrl??"";let i=this._layer.url;const a=i.toLowerCase().indexOf("/rest/services");if(i=a>-1?i.slice(0,a):i,i){i+="/rest/info";try{const e=await t(i,{query:{f:"json"}});let r="";return e.data?.owningSystemUrl&&(r=e.data.owningSystemUrl),r}catch{return""}}return""}getDataSourceFeatureSet(){const e=new v({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this._recentlyUsedQueries??void 0,interceptor:this._featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this._featureSetInfo)return this._featureSetInfo;let e=null,r="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const a=await t(i,{responseType:"json",query:{f:"json"}});e=a?.data?.name??null,r=a?.data?.serviceItemId??null}const a=this._layer.title&&null!==(this._layer.parent??null);return this._featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===r?null:r,serviceLayerUrl:""===i?null:i,webMapLayerId:a?this._layer.id??null:null,webMapLayerTitle:a?this._layer.title??null:null,className:null,objectClassId:null},this._featureSetInfo}}export{v as default};
2
+ import{id as e}from"../../../kernel.js";import t from"../../../request.js";import{neverAbortedSignal as r}from"../../arcadeEnvironment.js";import i from"../../Attachment.js";import a from"../../Dictionary.js";import{throwIfCancelled as s,FeatureSetError as l}from"../support/errorsupport.js";import{RootFeatureSet as n,emptyFeaturesResult as o,assignSpatialReferenceOnFeatures as u}from"../support/FeatureSet.js";import{defaultMaxRecords as c,stableStringify as h,extractServiceUrl as d}from"../support/shared.js";import{toWhereClause as y,isSingleField as p}from"../support/sqlUtils.js";import{decodeStatType as _}from"../support/stats.js";import{sliceEquals as m}from"../../../core/arrayUtils.js";import{createMD5Hash as f,outputTypes as F}from"../../../core/MD5.js";import{sqlAnd as w}from"../../../core/sql.js";import S from"../../../core/sql/WhereClause.js";import g from"../../../layers/FeatureLayer.js";import{toQueryStringParameters as b}from"../../../rest/query/operations/queryRelatedRecords.js";import R from"../../../rest/support/AttachmentQuery.js";import I from"../../../rest/support/Query.js";import q from"../../../rest/support/StatisticDefinition.js";function T(e){if(0===e.length)throw new l("NeverReach");const t=[];for(let i=0;i<e.length;i++){const r=e[i],a=[`"${r.name.replaceAll('"','""')}" ${r.asc?">":"<"} @last_${i}`];for(let t=0;t<i;t++){const r=e[t];a.push(`"${r.name.replaceAll('"','""')}" = @last_${t}`)}t.push(a.join(" AND "))}const r=t.join(" OR ");return S.create(r)}function Q(e,t){null==e.clause&&(e.clause=T(e.keyFields));for(let r=0;r<e.keyFields.length;r++){const i=e.keyFields[r].name;e.clause.parameters[`last_${r}`]=t.attributes[i]}}class v extends n{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerDynamic",this._removeGeometry=!1,this._overrideFields=null,this._requestStandardised=!1,this._useDefinitionExpression=!0,this._recentlyUsedQueries=null,this._featureSetQueryInterceptor=null,this._featureSetInfo=null,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry),e.lrucache&&(this._recentlyUsedQueries=e.lrucache),e.interceptor&&(this._featureSetQueryInterceptor=e.interceptor)}_maxQueryRate(){return c}get urlQueryPath(){return this._layer.parsedUrl.path||""}convertQueryToLruCacheKey(e){const t=this.urlQueryPath+","+h(e.toJSON());return f(t,F.String)}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}_initialiseFeatureSet(){if(this.spatialReference??=this._layer.spatialReference,this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),this.hasZ=!0===this._layer.capabilities?.data?.supportsZ,this.hasM=!0===this._layer.capabilities?.data?.supportsM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}if(this._layer.source&&this._layer.source.sourceJSON){const e=this._layer.source.sourceJSON.currentVersion;!0===this._layer.source.sourceJSON.useStandardizedQueries?(this._databaseType=1,null!=e&&e>=10.61&&(this._databaseType=0)):null!=e&&(e>=10.5&&(this._databaseType=1,this._requestStandardised=!0),e>=10.61&&(this._databaseType=0))}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this.subtypeField=this._layer.subtypeField??"",this.subtypes=this._layer.subtypes,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}async _runDatabaseProbe(e){await this._ensureLoaded();const t=new I;this.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t.where=e.replace("OBJECTID",this._layer.objectIdField);try{return await this._layer.queryObjectIds(t),!0}catch{return!1}}_canUsePagination(){return!(!this._layer.capabilities||!this._layer.capabilities.query||!0!==this._layer.capabilities.query.supportsPagination)}_cacheableFeatureSetSourceKey(){return this._layer.url}get gdbVersion(){return this._layer&&this._layer.capabilities&&this._layer.capabilities.data&&this._layer.capabilities.data.isVersioned?this._layer.gdbVersion||"SDE.DEFAULT":""}nativeCapabilities(){return{title:this._layer.title??"",source:this,canQueryRelated:!0,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:this._requestStandardised}}async _queryAll(){return(await this.query({abortSignal:r})).features}async query(e){return await this._ensureLoaded(),this.isTable()&&null!=e.spatialFilter?o:this._canUsePagination()?this._queryUsingPaging(e):this._queryUsingIdSetTraversal(e)}async _queryUsingPaging(e){let t=!0,r=null,i=!1;null!=e.orderBy&&(this._layer.capabilities?.query?.supportsOrderBy?(r=e.orderBy.toOrderByFields(),i=!0):t=!1);const a=await this.databaseType(),s=null==e.where?null==e.spatialFilter?"1=1":"":y(e.where,a);let l=this._maxQueryRate();const n=this._layer.capabilities?.query.maxRecordCount;null!=n&&n<l&&(l=n);const o=!0!==this._removeGeometry,u=this._overrideFields??this._fieldsIncludingObjectId(["*"]),c=this._createQuery();return c.where=w(c.where,s),null!=e.spatialFilter&&(c.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),c.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),c.geometry=e.spatialFilter.geometry),c.orderByFields=r,c.outFields=u,c.returnGeometry=o,c.outSpatialReference=this.spatialReference,{ordered:i,filterApplied:!0,spatialFilterApplied:!0,features:this._queryPaginated(c,l,t?e.limit:null,e.abortSignal)}}async*_queryPaginated(e,t,r,i){let a;e.num=null!=r?Math.min(r,t):t,e.start=0;do{s(i),a=await this.executeQuery(e,"execute"),yield a.features,e.start+=a.features.length,e.num=null!=r?Math.min(r-e.start,t):t}while(!0===a.exceededTransferLimit)}async _queryUsingIdSetTraversal(e){let t=!0,r=null,i=!1;null!=e.orderBy&&(this._layer.capabilities?.query?.supportsOrderBy?(r=e.orderBy.toOrderByFields(),i=!0):t=!1);const a=await this.databaseType(),l=null==e.where?null==e.spatialFilter?"1=1":"":y(e.where,a),n=this._createQuery();n.where=w(n.where,l),null!=e.spatialFilter&&(n.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),n.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),n.geometry=e.spatialFilter.geometry),n.orderByFields=r,n.outSpatialReference=this.spatialReference,n.num=t?e.limit:null;const u=await this.executeQuery(n,"executeForIds");if(s(e.abortSignal),null==u||u.length<=0)return o;let c=this._maxQueryRate();const h=this._layer.capabilities?.query.maxRecordCount;null!=h&&h<c&&(c=h);const d=this._createQuery();return n.outFields=this._overrideFields??this._fieldsIncludingObjectId(["*"]),n.returnGeometry=!0!==this._removeGeometry,n.outSpatialReference=this.spatialReference,{ordered:i,filterApplied:!0,spatialFilterApplied:!0,features:this._traverseIdSet(d,u,c,e.abortSignal)}}async*_traverseIdSet(e,t,r,i){for(let a=0;a<t.length;a+=r){e.objectIds=t.slice(a,a+r),s(i);const l=await this.executeQuery(e,"execute");yield l.features}}async queryStat(e){await this._ensureLoaded();const t=this._layer.capabilities?.query,r=!!t?.supportsSqlExpression,i=!!t?.supportsStatistics,a=!!t?.supportsDistinct,s=_(e.stat);if("count"===s)return a?this._queryCount(e):{calculated:!1};const n=e.field;if(null==n)return{calculated:!1};if(!1===i||!1===p(n)&&!1===r||!1===n.isStandardized)return null!=e.spatialFilter||null!=e.where?{calculated:!1}:this._manualStat(e.stat,n,e.limit??c,e.abortSignal);if("distinct"===s)return!1===a?null!=e.spatialFilter||null!=e.where?{calculated:!1}:this._manualStat(s,n,e.limit??c,e.abortSignal):{calculated:!1};const o=await this.databaseType();if(this.isTable()&&null!=e.spatialFilter)return{calculated:!0,result:null};const u=this._createQuery();u.where=w(u.where,null==e.where?null==e.spatialFilter?"1=1":"":y(e.where,o)),null!=e.spatialFilter&&(u.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),u.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),u.geometry=e.spatialFilter.geometry);const h=new q;h.statisticType=s,h.onStatisticField=y(n,o),h.outStatisticFieldName="ARCADE_STAT_RESULT",u.returnGeometry=!1;let d="ARCADE_STAT_RESULT";u.outStatistics=[h];const m=await this.executeQuery(u,"execute");if(!m.hasOwnProperty("features")||0===m.features.length)throw new l("InvalidStatResponse");let f=!1;const F=m.fields??[];for(const l of F)if("ARCADE_STAT_RESULT"===l.name.toUpperCase()){d=l.name,"esriFieldTypeDate"===l.type&&(f=!0);break}const S=m.features[0].attributes[d];return{calculated:!0,result:f&&null!=S?new Date(S):S}}async _queryCount(e){const t=await this.databaseType();if(this.isTable()&&null!=e.spatialFilter)return{calculated:!0,result:0};const r=this._createQuery();r.where=w(r.where,null==e.where?null==e.spatialFilter?"1=1":"":y(e.where,t)),null!=e.spatialFilter&&(r.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),r.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),r.geometry=e.spatialFilter.geometry),r.returnGeometry=!1;return{calculated:!0,result:await this.executeQuery(r,"executeForCount")}}async canQueryAggregate(e){await this._ensureLoaded();let t=!1;const r=this._layer.capabilities?.query,i=!0===r?.supportsSqlExpression;if(null!=r&&!0===r.supportsStatistics&&!0===r.supportsOrderBy&&(t=!0),t)for(const a of e.statistics)(!1===a.workingexpr?.isStandardized||!1===p(a.workingexpr)&&!1===i)&&(t=!1);return t}async queryAggregate(e){if(await this._ensureLoaded(),this.isTable()&&null!=e.spatialFilter)return o;const t=await this.databaseType(),r=e.groupBy,i=e.orderBy;let a=null;if(!this._layer.capabilities.query.supportsPaginationOnAggregatedQueries){const e=this.getFieldsIndex();a={keyFields:r.map((t,r)=>({name:e.normalizeFieldName(t)??t,asc:null==i||1===i._directions[r]}))}}let s=null,l=!1;null!=i&&!0===this._layer.capabilities?.query?.supportsOrderBy&&(null==a||m(r,0,r.length,i._fields,0,Math.min(i._fields.length,r.length),(e,t)=>e.toLowerCase()===t.toLowerCase()))&&(s=i.toOrderByFields(),l=!0),null==s&&(s=r.slice());const n=e.statistics.map(e=>new q({onStatisticField:null!==e.workingexpr?y(e.workingexpr,t):"",outStatisticFieldName:e.field,statisticType:e.toStatisticsName()}));let u=this._maxQueryRate();const c=this._layer.capabilities?.query.maxRecordCount;null!=c&&c<u&&(u=c);const h=null==e.where?null==e.spatialFilter?"1=1":"":y(e.where,t),d=this._createQuery();return d.where=w(d.where,h),null!=e.spatialFilter&&(d.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),d.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),d.geometry=e.spatialFilter.geometry),d.orderByFields=s,d.outFields=["*"],d.outStatistics=n,d.groupByFieldsForStatistics=r,d.returnGeometry=!1,null==a?{filterApplied:!0,spatialFilterApplied:!0,ordered:l,features:this._queryPaginated(d,u,null,e.abortSignal)}:{filterApplied:!0,spatialFilterApplied:!0,ordered:l,features:this._queryKeysetPaginated(d,a,e.abortSignal)}}async*_queryKeysetPaginated(e,t,r){const i=e.where;for(;;){if(null!=t.clause){if(!this._layer.capabilities.query.supportsOrderBy)throw new l("NotImplemented");e.where=w(i,y(t.clause,await this.databaseType()))}const a=await this.executeQuery(e,"execute");if(s(r),!a.hasOwnProperty("features"))throw new l("InvalidStatResponse");if(yield a.features,0===a.features.length||!0!==a.exceededTransferLimit)break;Q(t,a.features.at(-1))}}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,this.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),this._requestStandardised&&(e.sqlFormat="standard"),this._useDefinitionExpression?"subtype-group"===this._layer.type&&(e.where=this._layer.definitionExpression):e.where=null,e}executeQuery(e,t){const r="execute"===t?async e=>{const t=await this._layer.source.queryFeaturesJSON(e);return u(t.features,t.spatialReference??this.spatialReference.toJSON()),t}:"executeForCount"===t?this._layer.queryFeatureCount.bind(this._layer):this._layer.queryObjectIds.bind(this._layer);let i=null;if(this._recentlyUsedQueries){const t=this.convertQueryToLruCacheKey(e);i=this._recentlyUsedQueries.getFromCache(t),null===i&&(i=r(e),this._recentlyUsedQueries.addToCache(t,i),i=i.catch(e=>{throw this._recentlyUsedQueries?.removeFromCache(t),e}))}return this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:e,method:t}),null===i&&(i=r(e)),i}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return r||t.push(this.objectIdField),t}isTable(){return this._layer.isTable||null===this._layer.geometryType||"table"===this._layer.type||""===this._layer.geometryType||"esriGeometryNull"===this._layer.geometryType}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}static create(e,t,r,i,a){const s=new g({url:e,outFields:null===t?["*"]:t});return new v({layer:s,spatialReference:r,lrucache:i,interceptor:a})}relationshipMetadata(){return this._layer&&this._layer.source&&this._layer.source.sourceJSON?.relationships?this._layer.source.sourceJSON.relationships:[]}serviceUrl(){return d(this._layer.parsedUrl.path)}async queryAttachments(e,t,r,s,l){function n(e){const t=e.capabilities;return t?.data.supportsAttachment&&t?.operations.supportsQueryAttachments}const o=this._layer;if(!n(o))return[];const u=new R({objectIds:[e],returnMetadata:l});(t&&t>0||r&&r>0)&&(u.size=[t&&t>0?t:0,r&&r>0?r:t+1]),s&&s.length>0&&(u.attachmentTypes=s),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:o,query:u,method:"attachments"});const c=await o.queryAttachments(u);return c?.[e]?c[e].map(t=>{const r=`${this._layer.parsedUrl.path}/${e}/attachments/${t.id}`;let s=null;return l&&t.exifInfo&&(s=a.convertJsonToArcade(t.exifInfo,"system",!0)),new i(t.id,t.name,t.contentType,t.size,r,s,t.keywords??null)}):[]}async queryRelatedFeatures(e){const r=b(e);r.f="json",this._requestStandardised&&(r.sqlFormat="standard"),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preRequestCallback({layer:this._layer,queryPayload:r,method:"relatedrecords",url:this._layer.parsedUrl.path+"/queryRelatedRecords"});const i=await t(this._layer.parsedUrl.path+"/queryRelatedRecords",{responseType:"json",query:r});if(i.data){const e={},t=i.data;if(t?.relatedRecordGroups){const r=t.spatialReference,i=!0===t.exceededTransferLimit;for(const a of t.relatedRecordGroups)u(a.relatedRecords,r),e[a.objectId]={features:a.relatedRecords,exceededTransferLimit:i}}return e}throw new l("InvalidRequest")}async getFeatureByObjectId(e,t){const r=this._createQuery();r.outFields=t,r.returnGeometry=!1,r.outSpatialReference=this.spatialReference,r.where=w(r.where,this.objectIdField+"="+e.toString()),this._featureSetQueryInterceptor&&this._featureSetQueryInterceptor.preLayerQueryCallback({layer:this._layer,query:r,method:"execute"});const i=await this._layer.source.queryFeaturesJSON(r);return 1===i.features.length?(u(i.features,i.spatialReference??this.spatialReference.toJSON()),i.features[0]):null}async getIdentityUser(){await this.load();const t=e?.findCredential(this._layer.url);return t?t.userId:null}async getOwningSystemUrl(){await this.load();const r=e?.findServerInfo(this._layer.url);if(r)return r.owningSystemUrl??"";let i=this._layer.url;const a=i.toLowerCase().indexOf("/rest/services");if(i=a>-1?i.slice(0,a):i,i){i+="/rest/info";try{const e=await t(i,{query:{f:"json"}});let r="";return e.data?.owningSystemUrl&&(r=e.data.owningSystemUrl),r}catch{return""}}return""}getDataSourceFeatureSet(){const e=new v({layer:this._layer,spatialReference:this.spatialReference??void 0,outFields:this._overrideFields??void 0,includeGeometry:!this._removeGeometry,lrucache:this._recentlyUsedQueries??void 0,interceptor:this._featureSetQueryInterceptor??void 0});return e._useDefinitionExpression=!1,e}get preferredTimeZone(){return this._layer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._layer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._layer.datesInUnknownTimezone??!1}get editFieldsInfo(){return this._layer.editFieldsInfo??null}get timeInfo(){return this._layer.timeInfo??null}async getFeatureSetInfo(){if(this._featureSetInfo)return this._featureSetInfo;let e=null,r="serviceItemId"in this._layer?this._layer.serviceItemId:null;const i=this._layer.parsedUrl?.path??null;if(i){const a=await t(i,{responseType:"json",query:{f:"json"}});e=a?.data?.name??null,r=a?.data?.serviceItemId??null}const a=this._layer.title&&null!==(this._layer.parent??null);return this._featureSetInfo={layerId:this._layer.layerId,layerName:""===e?null:e,itemId:""===r?null:r,serviceLayerUrl:""===i?null:i,webMapLayerId:a?this._layer.id??null:null,webMapLayerTitle:a?this._layer.title??null:null,className:null,objectClassId:null},this._featureSetInfo}}export{v as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{RootFeatureSet as i,emptyFeaturesResult as s,assignSpatialReferenceOnFeatures as a}from"../support/FeatureSet.js";import{defaultMaxRecords as l}from"../support/shared.js";import{toWhereClause as n}from"../support/sqlUtils.js";import{splitIntoChunks as o}from"../../../core/arrayUtils.js";import{sqlAnd as y}from"../../../core/sql.js";import u from"../../../geometry/Geometry.js";import p from"../../../layers/FeatureLayer.js";import h from"../../../layers/support/FeatureType.js";import d from"../../../layers/support/Field.js";class c extends i{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(this.spatialReference??=this._layer.spatialReference,this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||this._layer.objectIdField===r||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=0,this.hasZ=!0===this._layer.capabilities?.data?.supportsZ,this.hasM=!0===this._layer.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}async _queryAll(){return(await this.query({abortSignal:e})).features}_queryLayerFeaturesJSON(e){return"queryFeaturesJSON"in this._layer?this._layer.queryFeaturesJSON(e):this._layer.source.queryFeaturesJSON(e)}async query(e){await this._ensureLoaded();let r="",i=!1;if(null!=e.orderBy&&(r=e.orderBy.constructClause(),i=!0),this.isTable()&&null!=e.spatialFilter)return s;const l=this._createQuery();return l.where=y(l.where,null==e.where?null==e.spatialFilter?"1=1":"":n(e.where,0)),null!=e.spatialFilter&&(l.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),l.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),l.geometry=e.spatialFilter.geometry),l.outSpatialReference=this.spatialReference,l.orderByFields=""!==r?r.split(","):null,{filterApplied:!0,spatialFilterApplied:!0,ordered:i,features:async function*(){const r=await this._queryLayerFeaturesJSON(l);t(e.abortSignal);for(const e of o(r.features,this._maxQueryRate()))a(e,r.spatialReference??this.spatialReference.toJSON()),yield e}.apply(this)}}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new r("NeverReach")}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,e.outFields=this._overrideFields??["*"],e.returnGeometry=!this._removeGeometry,e}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}relationshipMetadata(){return[]}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let r=e.layerDefinition.objectIdField;const i=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const u of e.layerDefinition.types)s.push(h.fromJSON(u));let a=e.layerDefinition.geometryType;void 0===a&&(a=e.featureSet.geometryType||"");let l=e.featureSet.features;if(!r){let t=!1;for(const i of e.layerDefinition.fields)if("oid"===i.type||"esriFieldTypeOID"===i.type){r=i.name,t=!0;break}if(!1===t){let t="FID",i=!0,s=0;for(;i;){let r=!0;for(const i of e.layerDefinition.fields)if(i.name===t){r=!1;break}!0===r?i=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const a=[];for(let r=0;r<l.length;r++)a.push({geometry:e.featureSet.features[r].geometry,attributes:{...e.featureSet.features[r].attributes,[t]:r}});l=a,r=t}}const n=[];for(const u of e.layerDefinition.fields)u instanceof d?n.push(u):n.push(d.fromJSON(u));let o=a;switch(o||(o=""),o){case"esriGeometryPoint":o="point";break;case"esriGeometryPolyline":o="polyline";break;case"esriGeometryPolygon":o="polygon";break;case"esriGeometryEnvelope":o="extent";break;case"esriGeometryMultipoint":o="multipoint";break;case"":case"esriGeometryNull":o="esriGeometryNull"}if("esriGeometryNull"!==o){const e=t.toJSON();for(const t of l)t.geometry&&t.geometry instanceof u==!1&&(t.geometry.type=o,void 0===t.geometry.spatialReference&&(t.geometry.spatialReference=e))}else for(const u of l)u.geometry&&(u.geometry=null);const y={outFields:["*"],source:l,fields:n,hasZ:!0===e.layerDefinition.hasZ||!0===e.featureSet.hasZ,hasM:!0===e.layerDefinition.hasM||!0===e.featureSet.hasM,types:s,typeIdField:i,objectIdField:r,spatialReference:t},f="esriGeometryNull"===o||null===o;f||(y.geometryType=o);const m=new p(y);return e.layerDefinition.subtypeField&&e.layerDefinition.subtypes&&m.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new c({layer:m,spatialReference:t,isTable:f})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();t.where=this.objectIdField+"="+e.toString();const r=await this._queryLayerFeaturesJSON(t);return 1===r.features.length?(a(r.features,r.spatialReference??this.spatialReference.toJSON()),r.features[0]):null}serviceUrl(){return""}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return"timeInfo"in this._layer?this._layer.timeInfo:null}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}export{c as default};
2
+ import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{RootFeatureSet as i,emptyFeaturesResult as s,assignSpatialReferenceOnFeatures as a}from"../support/FeatureSet.js";import{defaultMaxRecords as l}from"../support/shared.js";import{toWhereClause as n}from"../support/sqlUtils.js";import{splitIntoChunks as o}from"../../../core/arrayUtils.js";import{sqlAnd as y}from"../../../core/sql.js";import u from"../../../geometry/Geometry.js";import p from"../../../layers/FeatureLayer.js";import d from"../../../layers/support/FeatureType.js";import h from"../../../layers/support/Field.js";class c extends i{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerMemory",this._removeGeometry=!1,this._overrideFields=null,this._forceIsTable=!1,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),!0===e.isTable&&(this._forceIsTable=!0),void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return l}async loadImpl(){return!0===this._layer.loaded?(this._initialiseFeatureSet(),this):(await this._layer.load(),this._initialiseFeatureSet(),this)}get gdbVersion(){return""}_initialiseFeatureSet(){if(this.spatialReference??=this._layer.spatialReference,this.geometryType=this._layer.geometryType??"",this.fields=this._layer.fields.slice(),null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||this._layer.objectIdField===r||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}this.objectIdField=this._layer.objectIdField;for(const e of this.fields)"global-id"===e.type&&(this.globalIdField=e.name);this._databaseType=0,this.hasZ=!0===this._layer.capabilities?.data?.supportsZ,this.hasM=!0===this._layer.capabilities?.data?.supportsM,this.subtypeField=("subtypeField"in this._layer?this._layer.subtypeField:null)??"",this.subtypes="subtypes"in this._layer?this._layer.subtypes:null,this.typeIdField=("typeIdField"in this._layer?this._layer.typeIdField:null)??"",this.types="types"in this._layer?this._layer.types:null}isTable(){return this._forceIsTable||"isTable"in this._layer&&this._layer.isTable||"table"===this._layer.type||!this._layer.geometryType}async _queryAll(){return(await this.query({abortSignal:e})).features}_queryLayerFeaturesJSON(e){return"queryFeaturesJSON"in this._layer?this._layer.queryFeaturesJSON(e):this._layer.source.queryFeaturesJSON(e)}async query(e){await this._ensureLoaded();let r=null,i=!1;if(null!=e.orderBy&&(r=e.orderBy.toOrderByFields(),i=!0),this.isTable()&&null!=e.spatialFilter)return s;const l=this._createQuery();return l.where=y(l.where,null==e.where?null==e.spatialFilter?"1=1":"":n(e.where,0)),null!=e.spatialFilter&&(l.spatialRelationship=this._makeRelationshipEnum(e.spatialFilter.relation),l.relationParameter=this._makeRelationshipParam(e.spatialFilter.relation),l.geometry=e.spatialFilter.geometry),l.outSpatialReference=this.spatialReference,l.orderByFields=r,l.num=e.limit,{filterApplied:!0,spatialFilterApplied:!0,ordered:i,features:async function*(){const r=await this._queryLayerFeaturesJSON(l);t(e.abortSignal);for(const e of o(r.features,this._maxQueryRate()))a(e,r.spatialReference??this.spatialReference.toJSON()),yield e}.apply(this)}}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new r("NeverReach")}_createQuery(){const e=this._layer.createQuery();return e.returnZ=this.hasZ,e.returnM=this.hasM,e.outFields=this._overrideFields??["*"],e.returnGeometry=!this._removeGeometry,e}_makeRelationshipEnum(e){if(e.includes("esriSpatialRelRelation"))return"relation";switch(e){case"esriSpatialRelRelation":return"relation";case"esriSpatialRelIntersects":return"intersects";case"esriSpatialRelContains":return"contains";case"esriSpatialRelOverlaps":return"overlaps";case"esriSpatialRelWithin":return"within";case"esriSpatialRelTouches":return"touches";case"esriSpatialRelCrosses":return"crosses";case"esriSpatialRelEnvelopeIntersects":return"envelope-intersects"}return e}_makeRelationshipParam(e){return e.includes("esriSpatialRelRelation")?e.split(":")[1]:""}relationshipMetadata(){return[]}nativeCapabilities(){return{title:this._layer.title??"",canQueryRelated:!1,source:this,capabilities:this._layer.capabilities,databaseType:this._databaseType,requestStandardised:!0}}static create(e,t){let r=e.layerDefinition.objectIdField;const i=e.layerDefinition.typeIdField??"",s=[];if(e.layerDefinition.types)for(const u of e.layerDefinition.types)s.push(d.fromJSON(u));let a=e.layerDefinition.geometryType;void 0===a&&(a=e.featureSet.geometryType||"");let l=e.featureSet.features;if(!r){let t=!1;for(const i of e.layerDefinition.fields)if("oid"===i.type||"esriFieldTypeOID"===i.type){r=i.name,t=!0;break}if(!1===t){let t="FID",i=!0,s=0;for(;i;){let r=!0;for(const i of e.layerDefinition.fields)if(i.name===t){r=!1;break}!0===r?i=!1:(s++,t="FID"+s.toString())}e.layerDefinition.fields.push({type:"esriFieldTypeOID",name:t,alias:t});const a=[];for(let r=0;r<l.length;r++)a.push({geometry:e.featureSet.features[r].geometry,attributes:{...e.featureSet.features[r].attributes,[t]:r}});l=a,r=t}}const n=[];for(const u of e.layerDefinition.fields)u instanceof h?n.push(u):n.push(h.fromJSON(u));let o=a;switch(o||(o=""),o){case"esriGeometryPoint":o="point";break;case"esriGeometryPolyline":o="polyline";break;case"esriGeometryPolygon":o="polygon";break;case"esriGeometryEnvelope":o="extent";break;case"esriGeometryMultipoint":o="multipoint";break;case"":case"esriGeometryNull":o="esriGeometryNull"}if("esriGeometryNull"!==o){const e=t.toJSON();for(const t of l)t.geometry&&t.geometry instanceof u==!1&&(t.geometry.type=o,void 0===t.geometry.spatialReference&&(t.geometry.spatialReference=e))}else for(const u of l)u.geometry&&(u.geometry=null);const y={outFields:["*"],source:l,fields:n,hasZ:!0===e.layerDefinition.hasZ||!0===e.featureSet.hasZ,hasM:!0===e.layerDefinition.hasM||!0===e.featureSet.hasM,types:s,typeIdField:i,objectIdField:r,spatialReference:t},f="esriGeometryNull"===o||null===o;f||(y.geometryType=o);const m=new p(y);return e.layerDefinition.subtypeField&&e.layerDefinition.subtypes&&m.read({subtypes:e.layerDefinition.subtypes,subtypeField:e.layerDefinition.subtypeField}),new c({layer:m,spatialReference:t,isTable:f})}async queryAttachments(){return[]}async getFeatureByObjectId(e){const t=this._createQuery();t.where=this.objectIdField+"="+e.toString();const r=await this._queryLayerFeaturesJSON(t);return 1===r.features.length?(a(r.features,r.spatialReference??this.spatialReference.toJSON()),r.features[0]):null}serviceUrl(){return""}async getOwningSystemUrl(){return""}async getIdentityUser(){return""}get preferredTimeZone(){return"preferredTimeZone"in this._layer?this._layer.preferredTimeZone:null}get dateFieldsTimeZone(){return"dateFieldsTimeZone"in this._layer?this._layer.dateFieldsTimeZone:null}get datesInUnknownTimezone(){return"datesInUnknownTimezone"in this._layer&&this._layer.datesInUnknownTimezone}get editFieldsInfo(){return"editFieldsInfo"in this._layer?this._layer.editFieldsInfo:null}get timeInfo(){return"timeInfo"in this._layer?this._layer.timeInfo:null}async getFeatureSetInfo(){const e=this._layer.title&&this._layer.parent;return{layerId:null,layerName:null,itemId:null,serviceLayerUrl:null,webMapLayerId:e?this._layer.id??null:null,webMapLayerTitle:e?this._layer.title??null:null,className:null,objectClassId:null}}}export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{RootFeatureSet as i,emptyFeaturesResult as a}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import l from"../../../rest/support/RelationshipQuery.js";class d extends i{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._removeGeometry=!1,this._overrideFields=null,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),this._findObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return s}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return this._databaseType=await this._relatedLayer.databaseType(),this._databaseType}isTable(){return this._relatedLayer.isTable()}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){if(await this._ensureLoaded(),await this.databaseType(),this.isTable()&&null!=e.spatialFilter)return a;const r=this._layer.nativeCapabilities();if(!1===r.canQueryRelated)return a;if(r.capabilities?.queryRelated.supportsPagination)return this._queryUsingPaging(r.source,e);let i="",s=!1;null!=e.orderBy&&!0===r.capabilities?.queryRelated.supportsOrderBy&&(i=e.orderBy.constructClause(),s=!0);const d=new l;return d.objectIds=[this._findObjectId],d.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]),d.relationshipId=this.relationship.id,d.where="1=1",d.returnGeometry=!0!==this._removeGeometry,d.outSpatialReference=this.spatialReference,d.orderByFields=""!==i?i.split(","):null,{filterApplied:null==e.where,spatialFilterApplied:null==e.spatialFilter,ordered:s,features:async function*(){const i=await r.source.queryRelatedFeatures(d);t(e.abortSignal),yield i[this._findObjectId]?i[this._findObjectId].features:[]}.apply(this)}}async _queryUsingPaging(e,t){let r="",i=!1;const a=this._layer.nativeCapabilities();null!=t.orderBy&&!0===a.capabilities?.queryRelated.supportsOrderBy&&(r=t.orderBy.constructClause(),i=!0),await this.databaseType();let s=this._maxQueryRate();const d=a.capabilities?.query.maxRecordCount;null!=d&&d<s&&(s=d);const n=new l;return n.relationshipId=this.relationship.id,n.objectIds=[this._findObjectId],n.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]),n.where="1=1",n.orderByFields=""!==r?r.split(","):null,n.returnGeometry=!0!==this._removeGeometry,n.outSpatialReference=this.spatialReference,{filterApplied:null==t.where,spatialFilterApplied:null==t.spatialFilter,ordered:i,features:this._queryPaginated(e,n,s,t.abortSignal)}}async*_queryPaginated(e,r,i,a){let s;r.num=i,r.start=0;do{t(a);s=(await e.queryRelatedFeatures(r))[this._findObjectId]??{exceededTransferLimit:!1,features:[]},yield s.features,r.start+=i}while(!0===s.exceededTransferLimit)}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new r("NeverReach")}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return r||t.push(this.objectIdField),t}get gdbVersion(){return this._relatedLayer.gdbVersion}relationshipMetadata(){return this._relatedLayer.relationshipMetadata()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,r,i,a){return this._relatedLayer.queryAttachments(e,t,r,i,a)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer.editFieldsInfo??null}get timeInfo(){return this._relatedLayer.timeInfo??null}getFeatureSetInfo(){return this._relatedLayer.getFeatureSetInfo()}}export{d as default};
2
+ import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import{throwIfCancelled as t,FeatureSetError as r}from"../support/errorsupport.js";import{RootFeatureSet as i,emptyFeaturesResult as a}from"../support/FeatureSet.js";import{defaultMaxRecords as s}from"../support/shared.js";import l from"../../../rest/support/RelationshipQuery.js";class d extends i{constructor(e){super(),this.declaredClass="esri.arcade.featureset.sources.FeatureLayerRelated",this._removeGeometry=!1,this._overrideFields=null,this._maxProcessing=1e3,this._layer=e.layer,e.spatialReference&&(this.spatialReference=e.spatialReference),this._findObjectId=e.objectId,this.relationship=e.relationship,this._relatedLayer=e.relatedLayer,void 0!==e.outFields&&(this._overrideFields=e.outFields),void 0!==e.includeGeometry&&(this._removeGeometry=!1===e.includeGeometry)}_maxQueryRate(){return s}async loadImpl(){return await Promise.all([this._layer.load(),this._relatedLayer.load()]),this._initialiseFeatureSet(),this}nativeCapabilities(){return this._relatedLayer.nativeCapabilities()}_initialiseFeatureSet(){if(null==this.spatialReference&&(this.spatialReference=this._layer.spatialReference),this.geometryType=this._relatedLayer.geometryType,this.fields=this._relatedLayer.fields.slice(),this.hasZ=this._relatedLayer.hasZ,this.hasM=this._relatedLayer.hasM,null!==this._overrideFields)if(1===this._overrideFields.length&&"*"===this._overrideFields[0])this._overrideFields=null;else{const e=new Set(this._overrideFields.map(e=>e.toLowerCase()));this.fields=this.fields.filter(({type:t,name:r})=>"oid"===t||e.has(r.toLowerCase())),this._overrideFields=this.fields.map(({name:e})=>e)}const e=this._layer.nativeCapabilities();e&&(this._databaseType=e.databaseType),this.objectIdField=this._relatedLayer.objectIdField,this.globalIdField=this._relatedLayer.globalIdField,this.hasM=this._relatedLayer.supportsM,this.hasZ=this._relatedLayer.supportsZ,this.typeIdField=this._relatedLayer.typeIdField,this.types=this._relatedLayer.types,this.subtypeField=this._relatedLayer.subtypeField,this.subtypes=this._relatedLayer.subtypes}async databaseType(){return this._databaseType=await this._relatedLayer.databaseType(),this._databaseType}isTable(){return this._relatedLayer.isTable()}async _queryAll(){return(await this.query({abortSignal:e})).features}async query(e){if(await this._ensureLoaded(),await this.databaseType(),this.isTable()&&null!=e.spatialFilter)return a;const r=this._layer.nativeCapabilities();if(!1===r.canQueryRelated)return a;if(r.capabilities?.queryRelated.supportsPagination)return this._queryUsingPaging(r.source,e);let i=null,s=!1;null!=e.orderBy&&r.capabilities?.queryRelated.supportsOrderBy&&(i=e.orderBy.toOrderByFields(),s=!0);const d=new l;return d.objectIds=[this._findObjectId],d.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]),d.relationshipId=this.relationship.id,d.where="1=1",d.returnGeometry=!0!==this._removeGeometry,d.outSpatialReference=this.spatialReference,d.orderByFields=i,{filterApplied:null==e.where,spatialFilterApplied:null==e.spatialFilter,ordered:s,features:async function*(){const i=await r.source.queryRelatedFeatures(d);t(e.abortSignal),yield i[this._findObjectId]?i[this._findObjectId].features:[]}.apply(this)}}async _queryUsingPaging(e,t){let r=null==t.where&&null==t.spatialFilter,i=null,a=!1;const s=this._layer.nativeCapabilities();null!=t.orderBy&&(s.capabilities?.queryRelated.supportsOrderBy?(i=t.orderBy.toOrderByFields(),a=!0):r=!1),await this.databaseType();let d=this._maxQueryRate();const n=s.capabilities?.query.maxRecordCount;null!=n&&n<d&&(d=n);const o=new l;return o.relationshipId=this.relationship.id,o.objectIds=[this._findObjectId],o.outFields=null!==this._overrideFields?this._overrideFields:this._fieldsIncludingObjectId(this._relatedLayer.fields?this._relatedLayer.fields.map(e=>e.name):["*"]),o.where="1=1",o.orderByFields=i,o.returnGeometry=!0!==this._removeGeometry,o.outSpatialReference=this.spatialReference,{filterApplied:null==t.where,spatialFilterApplied:null==t.spatialFilter,ordered:a,features:this._queryPaginated(e,o,d,r?t.limit:null,t.abortSignal)}}async*_queryPaginated(e,r,i,a,s){let l;r.num=null!=a?Math.min(a,i):i,r.start=0;do{t(s);l=(await e.queryRelatedFeatures(r))[this._findObjectId]??{exceededTransferLimit:!1,features:[]},yield l.features,r.start+=l.features.length,r.num=null!=a?Math.min(a-r.start,i):i}while(!0===l.exceededTransferLimit)}async queryStat(e){return{calculated:!1}}async canQueryAggregate(e){return!1}async queryAggregate(e){throw new r("NeverReach")}_fieldsIncludingObjectId(e){if(null===e)return[this.objectIdField];const t=e.slice();if(t.includes("*"))return t;let r=!1;for(const i of t)if(i.toUpperCase()===this.objectIdField.toUpperCase()){r=!0;break}return r||t.push(this.objectIdField),t}get gdbVersion(){return this._relatedLayer.gdbVersion}relationshipMetadata(){return this._relatedLayer.relationshipMetadata()}serviceUrl(){return this._relatedLayer.serviceUrl()}queryAttachments(e,t,r,i,a){return this._relatedLayer.queryAttachments(e,t,r,i,a)}getFeatureByObjectId(e,t){return this._relatedLayer.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._relatedLayer.getOwningSystemUrl()}getIdentityUser(){return this._relatedLayer.getIdentityUser()}getDataSourceFeatureSet(){return this._relatedLayer}get preferredTimeZone(){return this._relatedLayer.preferredTimeZone??null}get dateFieldsTimeZone(){return this._relatedLayer.dateFieldsTimeZone??null}get datesInUnknownTimezone(){return this._relatedLayer.datesInUnknownTimezone}get editFieldsInfo(){return this._relatedLayer.editFieldsInfo??null}get timeInfo(){return this._relatedLayer.timeInfo??null}getFeatureSetInfo(){return this._relatedLayer.getFeatureSetInfo()}}export{d as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{neverAbortedSignal as e}from"../../arcadeEnvironment.js";import t from"./cache.js";import{throwIfCancelled as a,FeatureSetError as s}from"./errorsupport.js";import{QueryIterator as r}from"./FeatureSetIterator.js";import{layerGeometryEsriConstants as i,esriFieldToJson as n,layerGeometryEsriRestConstants as l}from"./shared.js";import{max as o,min as u,sum as h,variance as d,stdev as c,mean as p,distinct as y}from"./stats.js";import{invokeRemoteGeometryOp as m}from"../../geometry/operatorsWorkerConnection.js";import{cacheAsync as f}from"../../../core/iteratorUtils.js";import _ from"../../../core/sql/WhereClause.js";import g from"../../../geometry/SpatialReference.js";import{fromJSON as b}from"../../../geometry/support/jsonUtils.js";import T from"../../../layers/support/FieldsIndex.js";function F(e,t){for(const a of e)null!=a.geometry&&(a.geometry.spatialReference??=t)}const I=Object.freeze({ordered:!0,filterApplied:!0,spatialFilterApplied:!0,features:Object.freeze({next:()=>Promise.resolve({done:!0,value:void 0}),[Symbol.asyncIterator](){return this}})});class w{constructor(){this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._parent=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=7,this._databaseTypeProbed=null,this._loadPromise=null,this._allFeatures=null,this._fieldsIndex=null,this.typeIdField=null,this.types=null,this.subtypeField=null,this.subtypes=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1}_ensureLoaded(){return this.load()}load(){return null===this._loadPromise&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){return await(this._parent?.load()),this._initialiseFeatureSet(),this}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new g({wkid:4326}),this.geometryType=i.point)}getField(e,t){return e=e.toLowerCase(),(t||this.fields).find(t=>t.name.toLowerCase()===e)}getFieldsIndex(){return null===this._fieldsIndex&&(this._fieldsIndex=T.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return null!==this._parent?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return null!==this._parent?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}nativeCapabilities(){return this._parent.nativeCapabilities()}get _hasCachedFeatures(){return null!=this._allFeatures}async queryAll(t){null==this._allFeatures&&(this._allFeatures=this._queryAll().then(e=>f(e)));const s=(await this._allFeatures)();return null==t||t===e?s:async function*(){for await(const e of s)a(t),yield e}()}async databaseType(){if(7===this._databaseType){if(null!==t.applicationCache){const e=t.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==e)return e}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),null!==t.applicationCache&&t.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(e){throw null!==t.applicationCache&&t.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),e}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{dbType:2,probeSql:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{dbType:3,probeSql:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{dbType:1,probeSql:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e){if(!0===await this._runDatabaseProbe(t.probeSql))return t.dbType}return 1}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(null!==this._parent)return this._parent._runDatabaseProbe(e);throw new s("NotImplemented")}isTable(){return this._parent?.isTable()??!1}first(e){return this.iterator(e).next()}async isEmpty(e){return this._totalCount>=0?0===this._totalCount:null==await this.first(e)}async calculateStatistic(e,t,a,s){await this._ensureLoaded();let r=await this.queryStat({stat:e,field:t,limit:a,abortSignal:s});return!1===r.calculated&&(r=await this._manualStat(e,t,a,s)),r.result}async _manualStat(e,t,a,s){let r=null;switch(e.toLowerCase()){case"count":{if(this._totalCount>=0)return{calculated:!0,result:this._totalCount};const e=await this.queryAll(s);let t=0;for await(const a of e)t+=a.length;return this._totalCount=t,{calculated:!0,result:t}}case"distinct":return r=await y(this,t,a,s),{calculated:!0,result:r};case"avg":case"mean":return r=await p(this,t,s),{calculated:!0,result:r};case"stdev":return r=await c(this,t,s),{calculated:!0,result:r};case"variance":return r=await d(this,t,s),{calculated:!0,result:r};case"sum":return r=await h(this,t,s),{calculated:!0,result:r};case"min":return r=await u(this,t,s),{calculated:!0,result:r};case"max":return r=await o(this,t,s),{calculated:!0,result:r};default:return{calculated:!0,result:0}}}iterator(e){return new r(this,e)}async sumArea(e,t,a){let s=0;for await(const r of await this.queryAll(a))for(const a of r)null!=a.geometry&&(s+=null!=t?await m("geodeticArea",[a.geometry,e,t]):await m("area",[a.geometry,e]));return s}async sumLength(e,t,a){let s=0;for await(const r of await this.queryAll(a))for(const a of r)null!=a.geometry&&(s+=null!=t?await m("geodeticLength",[a.geometry,e,t]):await m("length",[a.geometry,e]));return s}async count(t){return await this.load(),this.calculateStatistic("count",_.create("1",{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),-1,t??e)}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,a,s,r){return this._parent.queryAttachments(e,t,a,s,r)}serviceUrl(){return this._parent.serviceUrl()}subtypeMetadata(){return this.subtypeField&&this.subtypes?{subtypeField:this.subtypeField,subtypes:this.subtypes?this.subtypes.map(e=>({name:e.name,code:e.code})):[]}:this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map(e=>({name:e.name,code:e.id})):[]}:null}relationshipMetadata(){return this._parent.relationshipMetadata()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(n(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:void 0===l[this.geometryType]?"esriGeometryNull":l[this.geometryType],fields:e}}async convertToText(e,t){if("schema"===e)return await this._ensureLoaded(),JSON.stringify(this.schema());if("featureset"===e){await this._ensureLoaded();const e=[];for await(const a of await this.queryAll(t))for(const t of a){const a={geometry:t.geometry??null,attributes:t.attributes};if(null!==a.geometry&&a.geometry.spatialReference){const{spatialReference:e,...t}=a.geometry;a.geometry=t}e.push(a)}return JSON.stringify({...this.schema(),features:e,spatialReference:this.spatialReference.toJSON()})}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return this._parent.getRootFeatureSet()}getDataSourceFeatureSet(){return null!==this._parent?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return"keeptype"===e?.featureset?this:"none"===e?.featureset?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){if("keeptype"===t?.featureset)return this;if("schema"===t?.featureset)return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if("none"===t?.featureset)return null;await this._ensureLoaded();const a=[];for await(const s of await this.queryAll(e))for(const e of s){const s={geometry:e.geometry?!0===t?.keepGeometryType?b(e.geometry):e.geometry:null,attributes:e.attributes};if(null!==s.geometry&&s.geometry.spatialReference&&!0!==t?.keepGeometryType){delete s.geometry.spatialReference;const{spatialReference:e,...t}=s.geometry;s.geometry=t}a.push(s)}return{...this.schema(),features:a,spatialReference:!0===t?.keepGeometryType?this.spatialReference:this.spatialReference?.toJSON()}}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){return this._parent?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._parent?.dateFieldsTimeZone??null}get dateFieldsTimeZoneDefaultUTC(){return this.datesInUnknownTimezone?"unknown":this.dateFieldsTimeZone||"UTC"}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){return this._parent?.editFieldsInfo??null}get timeInfo(){return this._parent?.timeInfo??null}getFeatureSetInfo(){return this._parent?this._parent.getFeatureSetInfo():Promise.resolve(null)}}class S extends w{constructor(){super(...arguments),this._parent=null}getRootFeatureSet(){return this}}export{w as FeatureSet,S as RootFeatureSet,F as assignSpatialReferenceOnFeatures,I as emptyFeaturesResult};
2
+ import e from"../../../Graphic.js";import{neverAbortedSignal as t}from"../../arcadeEnvironment.js";import a from"./cache.js";import{throwIfCancelled as s,FeatureSetError as r}from"./errorsupport.js";import{QueryIterator as i}from"./FeatureSetIterator.js";import{layerGeometryEsriConstants as n,esriFieldToJson as l,layerGeometryEsriRestConstants as o}from"./shared.js";import{max as u,min as h,sum as d,variance as c,stdev as p,mean as y,distinct as m}from"./stats.js";import{invokeRemoteGeometryOp as f}from"../../geometry/operatorsWorkerConnection.js";import{cacheAsync as _}from"../../../core/iteratorUtils.js";import g from"../../../core/sql/WhereClause.js";import b from"../../../geometry/SpatialReference.js";import{fromJSON as T}from"../../../geometry/support/jsonUtils.js";import F from"../../../layers/support/FieldsIndex.js";function I(e,t){for(const a of e)null!=a.geometry&&(a.geometry.spatialReference??=t)}const w=Object.freeze({ordered:!0,filterApplied:!0,spatialFilterApplied:!0,features:Object.freeze({next:()=>Promise.resolve({done:!0,value:void 0}),[Symbol.asyncIterator](){return this}})});class S{constructor(){this.declaredRootClass="esri.arcade.featureset.support.FeatureSet",this._parent=null,this._maxProcessing=200,this._maxQuery=500,this._totalCount=-1,this._databaseType=7,this._databaseTypeProbed=null,this._loadPromise=null,this._allFeatures=null,this._fieldsIndex=null,this.typeIdField=null,this.types=null,this.subtypeField=null,this.subtypes=null,this.fields=null,this.geometryType="",this.objectIdField="",this.globalIdField="",this.spatialReference=null,this.hasM=!1,this.hasZ=!1}_ensureLoaded(){return this.load()}load(){return null===this._loadPromise&&(this._loadPromise=this.loadImpl()),this._loadPromise}async loadImpl(){return await(this._parent?.load()),this._initialiseFeatureSet(),this}_initialiseFeatureSet(){null!==this._parent?(this.fields=this._parent.fields.slice(),this.geometryType=this._parent.geometryType,this.objectIdField=this._parent.objectIdField,this.globalIdField=this._parent.globalIdField,this.spatialReference=this._parent.spatialReference,this.hasM=this._parent.hasM,this.hasZ=this._parent.hasZ,this.typeIdField=this._parent.typeIdField,this.types=this._parent.types,this.subtypeField=this._parent.subtypeField,this.subtypes=this._parent.subtypes):(this.fields=[],this.typeIdField="",this.subtypeField="",this.objectIdField="",this.globalIdField="",this.spatialReference=new b({wkid:4326}),this.geometryType=n.point)}getField(e,t){return e=e.toLowerCase(),(t||this.fields).find(t=>t.name.toLowerCase()===e)}getFieldsIndex(){return null===this._fieldsIndex&&(this._fieldsIndex=F.fromLayer({timeInfo:this.timeInfo,editFieldsInfo:this.editFieldsInfo,dateFieldsTimeZone:this.dateFieldsTimeZone,datesInUnknownTimezone:this.datesInUnknownTimezone,fields:this.fields})),this._fieldsIndex}_maxProcessingRate(){return null!==this._parent?Math.min(this._maxProcessing,this._parent._maxProcessingRate()):Math.min(this._maxProcessing,this._maxQueryRate())}_maxQueryRate(){return null!==this._parent?Math.max(this._maxQuery,this._parent._maxQueryRate()):this._maxQuery}nativeCapabilities(){return this._parent.nativeCapabilities()}get _hasCachedFeatures(){return null!=this._allFeatures}async queryAll(e){null==this._allFeatures&&(this._allFeatures=this._queryAll().then(e=>_(e)));const a=(await this._allFeatures)();return null==e||e===t?a:async function*(){for await(const t of a)s(e),yield t}()}async databaseType(){if(7===this._databaseType){if(null!==a.applicationCache){const e=a.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());if(null!==e)return e}if(null!==this._databaseTypeProbed)return this._databaseTypeProbed;try{this._databaseTypeProbed=this._getDatabaseTypeImpl(),null!==a.applicationCache&&a.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(),this._databaseTypeProbed)}catch(e){throw null!==a.applicationCache&&a.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()),e}return this._databaseTypeProbed}return this._databaseType}async _getDatabaseTypeImpl(){const e=[{dbType:2,probeSql:"(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0"},{dbType:3,probeSql:"(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0"},{dbType:1,probeSql:"(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0"}];for(const t of e){if(!0===await this._runDatabaseProbe(t.probeSql))return t.dbType}return 1}_cacheableFeatureSetSourceKey(){return"MUSTBESET"}async _runDatabaseProbe(e){if(null!==this._parent)return this._parent._runDatabaseProbe(e);throw new r("NotImplemented")}isTable(){return this._parent?.isTable()??!1}async first(t){if(this._hasCachedFeatures)return this.iterator(t).next();const a=await this.query({limit:1,abortSignal:t});for await(const s of a.features)if(s.length>0)return e.fromJSON(s[0]);return null}async isEmpty(e){return this._totalCount>=0?0===this._totalCount:null==await this.first(e)}async calculateStatistic(e,t,a,s){await this._ensureLoaded();let r=await this.queryStat({stat:e,field:t,limit:a,abortSignal:s});return!1===r.calculated&&(r=await this._manualStat(e,t,a,s)),r.result}async _manualStat(e,t,a,s){let r=null;switch(e.toLowerCase()){case"count":{if(this._totalCount>=0)return{calculated:!0,result:this._totalCount};const e=await this.queryAll(s);let t=0;for await(const a of e)t+=a.length;return this._totalCount=t,{calculated:!0,result:t}}case"distinct":return r=await m(this,t,a,s),{calculated:!0,result:r};case"avg":case"mean":return r=await y(this,t,s),{calculated:!0,result:r};case"stdev":return r=await p(this,t,s),{calculated:!0,result:r};case"variance":return r=await c(this,t,s),{calculated:!0,result:r};case"sum":return r=await d(this,t,s),{calculated:!0,result:r};case"min":return r=await h(this,t,s),{calculated:!0,result:r};case"max":return r=await u(this,t,s),{calculated:!0,result:r};default:return{calculated:!0,result:0}}}iterator(e){return new i(this,e)}async sumArea(e,t,a){let s=0;for await(const r of await this.queryAll(a))for(const a of r)null!=a.geometry&&(s+=null!=t?await f("geodeticArea",[a.geometry,e,t]):await f("area",[a.geometry,e]));return s}async sumLength(e,t,a){let s=0;for await(const r of await this.queryAll(a))for(const a of r)null!=a.geometry&&(s+=null!=t?await f("geodeticLength",[a.geometry,e,t]):await f("length",[a.geometry,e]));return s}async count(e){return await this.load(),this.calculateStatistic("count",g.create("1",{fieldsIndex:this.getFieldsIndex(),timeZone:this.dateFieldsTimeZoneDefaultUTC}),-1,e??t)}castToText(e=!1){return"object, FeatureSet"}queryAttachments(e,t,a,s,r){return this._parent.queryAttachments(e,t,a,s,r)}serviceUrl(){return this._parent.serviceUrl()}subtypeMetadata(){return this.subtypeField&&this.subtypes?{subtypeField:this.subtypeField,subtypes:this.subtypes?this.subtypes.map(e=>({name:e.name,code:e.code})):[]}:this.typeIdField?{subtypeField:this.typeIdField,subtypes:this.types?this.types.map(e=>({name:e.name,code:e.id})):[]}:null}relationshipMetadata(){return this._parent.relationshipMetadata()}get gdbVersion(){return this._parent?this._parent.gdbVersion:""}schema(){const e=[];for(const t of this.fields)e.push(l(t));return{objectIdField:this.objectIdField,globalIdField:this.globalIdField,geometryType:void 0===o[this.geometryType]?"esriGeometryNull":o[this.geometryType],fields:e}}async convertToText(e,t){if("schema"===e)return await this._ensureLoaded(),JSON.stringify(this.schema());if("featureset"===e){await this._ensureLoaded();const e=[];for await(const a of await this.queryAll(t))for(const t of a){const a={geometry:t.geometry??null,attributes:t.attributes};if(null!==a.geometry&&a.geometry.spatialReference){const{spatialReference:e,...t}=a.geometry;a.geometry=t}e.push(a)}return JSON.stringify({...this.schema(),features:e,spatialReference:this.spatialReference.toJSON()})}return this.castToText()}getFeatureByObjectId(e,t){return this._parent.getFeatureByObjectId(e,t)}getOwningSystemUrl(){return this._parent.getOwningSystemUrl()}getIdentityUser(){return this._parent.getIdentityUser()}getRootFeatureSet(){return this._parent.getRootFeatureSet()}getDataSourceFeatureSet(){return null!==this._parent?this._parent.getDataSourceFeatureSet():this}castAsJson(e=null){return"keeptype"===e?.featureset?this:"none"===e?.featureset?null:{type:"FeatureSet"}}async castAsJsonAsync(e=null,t=null){if("keeptype"===t?.featureset)return this;if("schema"===t?.featureset)return await this._ensureLoaded(),JSON.parse(JSON.stringify(this.schema()));if("none"===t?.featureset)return null;await this._ensureLoaded();const a=[];for await(const s of await this.queryAll(e))for(const e of s){const s={geometry:e.geometry?!0===t?.keepGeometryType?T(e.geometry):e.geometry:null,attributes:e.attributes};if(null!==s.geometry&&s.geometry.spatialReference&&!0!==t?.keepGeometryType){delete s.geometry.spatialReference;const{spatialReference:e,...t}=s.geometry;s.geometry=t}a.push(s)}return{...this.schema(),features:a,spatialReference:!0===t?.keepGeometryType?this.spatialReference:this.spatialReference?.toJSON()}}fieldTimeZone(e){return this.getFieldsIndex().getTimeZone(e)}get preferredTimeZone(){return this._parent?.preferredTimeZone??null}get dateFieldsTimeZone(){return this._parent?.dateFieldsTimeZone??null}get dateFieldsTimeZoneDefaultUTC(){return this.datesInUnknownTimezone?"unknown":this.dateFieldsTimeZone||"UTC"}get datesInUnknownTimezone(){return this._parent.datesInUnknownTimezone}get editFieldsInfo(){return this._parent?.editFieldsInfo??null}get timeInfo(){return this._parent?.timeInfo??null}getFeatureSetInfo(){return this._parent?this._parent.getFeatureSetInfo():Promise.resolve(null)}}class C extends S{constructor(){super(...arguments),this._parent=null}getRootFeatureSet(){return this}}export{S as FeatureSet,C as RootFeatureSet,I as assignSpatialReferenceOnFeatures,w as emptyFeaturesResult};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function t(t,e){return t===e?0:null===t?-1:null===e?1:t<e?-1:1}class e{constructor(t){const e=t.split(",");this._fields=[],this._directions=[];for(let s=0;s<e.length;s++){const t=e[s].match(/\S+/g);this._fields.push(t[0]),2===t.length?"asc"===t[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}constructClause(){let t="";for(let e=0;e<this._fields.length;e++)0!==e&&(t+=","),t+=this._fields[e],1===this._directions[e]?t+=" ASC":t+=" DESC";return t}order(e){e.sort((e,s)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e,this._fields[i],i),l=this.featureValue(s,this._fields[i],i);let o=0;if(o=1===this._directions[i]?t(r,l):-1*t(r,l),0!==o)return o}return 0})}scanForField(t){for(let e=0;e<this._fields.length;e++)if(this._fields[e].toLowerCase().trim()===t.toLowerCase().trim())return!0;return!1}replaceFields(t){let s="";for(let e=0;e<this._fields.length;e++){0!==e&&(s+=",");let i=this._fields[e];for(const e of t)if(i.toLowerCase()===e.field.toLowerCase()){i=e.newfield;break}s+=i,1===this._directions[e]?s+=" ASC":s+=" DESC"}return new e(s)}featureValue(t,e,s){const i=t.attributes[e];if(void 0!==i)return i;for(const r in t.attributes)if(e.toLowerCase()===r.toLowerCase())return this._fields[s]=r,t.attributes[r];return null}}export{e as default};
2
+ function t(t,e){return t===e?0:null===t?-1:null===e?1:t<e?-1:1}class e{constructor(t){const e=t.split(",");this._fields=[],this._directions=[];for(let s=0;s<e.length;s++){const t=e[s].match(/\S+/g);this._fields.push(t[0]),2===t.length?"asc"===t[1].toLowerCase()?this._directions.push(1):this._directions.push(0):this._directions.push(1)}}toOrderByFields(){return this._fields.map((t,e)=>t+(1===this._directions[e]?" ASC":" DESC"))}order(t){t.sort(this.toComparator())}toComparator(){return(e,s)=>{for(let i=0;i<this._fields.length;i++){const r=this.featureValue(e,this._fields[i],i),o=this.featureValue(s,this._fields[i],i);let l=0;if(l=1===this._directions[i]?t(r,o):-1*t(r,o),0!==l)return l}return 0}}scanForField(t){for(let e=0;e<this._fields.length;e++)if(this._fields[e].toLowerCase().trim()===t.toLowerCase().trim())return!0;return!1}replaceFields(t){let s="";for(let e=0;e<this._fields.length;e++){0!==e&&(s+=",");let i=this._fields[e];for(const e of t)if(i.toLowerCase()===e.field.toLowerCase()){i=e.newfield;break}s+=i,1===this._directions[e]?s+=" ASC":s+=" DESC"}return new e(s)}featureValue(t,e,s){const i=t.attributes[e];if(void 0!==i)return i;for(const r in t.attributes)if(e.toLowerCase()===r.toLowerCase())return this._fields[s]=r,t.attributes[r];return null}}export{e as default};